Skip to content

Commit

Permalink
infered return types
Browse files Browse the repository at this point in the history
  • Loading branch information
lysy-vlc committed Jul 11, 2024
1 parent cc644d6 commit 3246ccd
Show file tree
Hide file tree
Showing 13 changed files with 152 additions and 135 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@piwikpro/ngx-piwik-pro-project",
"version": "1.1.1",
"version": "2.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,34 @@ import { Injectable } from '@angular/core';
type IContentTracking = typeof ContentTracking;

@Injectable({
providedIn: 'root'
providedIn: 'root'
})
export class ContentTrackingService {
trackAllContentImpressions(...params: Parameters<IContentTracking['trackAllContentImpressions']>) {
ContentTracking.trackAllContentImpressions(...params);
}

trackVisibleContentImpressions(...params: Parameters<IContentTracking['trackVisibleContentImpressions']>) {
ContentTracking.trackVisibleContentImpressions(...params);
}

trackContentImpressionsWithinNode(...params: Parameters<IContentTracking['trackContentImpressionsWithinNode']>) {
ContentTracking.trackContentImpressionsWithinNode(...params);
}

trackContentImpression(...params: Parameters<IContentTracking['trackContentImpression']>) {
ContentTracking.trackContentImpression(...params);
}

logAllContentBlocksOnPage(...params: Parameters<IContentTracking['logAllContentBlocksOnPage']>): void {
ContentTracking.logAllContentBlocksOnPage(...params);
}

trackContentInteractionNode(...params: Parameters<IContentTracking['trackContentInteractionNode']>) {
ContentTracking.trackContentInteractionNode(...params);
}

trackContentInteraction(...params: Parameters<IContentTracking['trackContentInteraction']>) {
ContentTracking.trackContentInteraction(...params);
}
}
trackAllContentImpressions(...params: Parameters<IContentTracking['trackAllContentImpressions']>): ReturnType<IContentTracking['trackAllContentImpressions']> {
return ContentTracking.trackAllContentImpressions(...params);
}

trackVisibleContentImpressions(...params: Parameters<IContentTracking['trackVisibleContentImpressions']>): ReturnType<IContentTracking['trackVisibleContentImpressions']> {
return ContentTracking.trackVisibleContentImpressions(...params);
}

trackContentImpressionsWithinNode(...params: Parameters<IContentTracking['trackContentImpressionsWithinNode']>): ReturnType<IContentTracking['trackContentImpressionsWithinNode']> {
return ContentTracking.trackContentImpressionsWithinNode(...params);
}

trackContentImpression(...params: Parameters<IContentTracking['trackContentImpression']>): ReturnType<IContentTracking['trackContentImpression']> {
return ContentTracking.trackContentImpression(...params);
}

logAllContentBlocksOnPage(...params: Parameters<IContentTracking['logAllContentBlocksOnPage']>): ReturnType<IContentTracking['logAllContentBlocksOnPage']> {
return ContentTracking.logAllContentBlocksOnPage(...params);
}

trackContentInteractionNode(...params: Parameters<IContentTracking['trackContentInteractionNode']>): ReturnType<IContentTracking['trackContentInteractionNode']> {
return ContentTracking.trackContentInteractionNode(...params);
}

trackContentInteraction(...params: Parameters<IContentTracking['trackContentInteraction']>): ReturnType<IContentTracking['trackContentInteraction']> {
return ContentTracking.trackContentInteraction(...params);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,50 @@ import { Injectable } from '@angular/core';
type ICookieManagement = typeof CookieManagement;

@Injectable({
providedIn: 'root'
providedIn: 'root'
})
export class CookieManagementService {
disableCookies(...params: Parameters<ICookieManagement['disableCookies']>) {
CookieManagement.disableCookies(...params);
}
enableCookies(...params: Parameters<ICookieManagement['enableCookies']>) {
CookieManagement.enableCookies(...params);
}
deleteCookies(...params: Parameters<ICookieManagement['deleteCookies']>) {
CookieManagement.deleteCookies(...params);
}
hasCookies(...params: Parameters<ICookieManagement['hasCookies']>): Promise<boolean> {
return CookieManagement.hasCookies(...params);
}
setCookieNamePrefix(...params: Parameters<ICookieManagement['setCookieNamePrefix']>) {
CookieManagement.setCookieNamePrefix(...params);
}
setCookieDomain(...params: Parameters<ICookieManagement['setCookieDomain']>) {
CookieManagement.setCookieDomain(...params);
}
setCookiePath(...params: Parameters<ICookieManagement['setCookiePath']>) {
CookieManagement.setCookiePath(...params);
}
setSecureCookie(...params: Parameters<ICookieManagement['setSecureCookie']>) {
CookieManagement.setSecureCookie(...params);
}
setVisitorCookieTimeout(...params: Parameters<ICookieManagement['setVisitorCookieTimeout']>) {
CookieManagement.setVisitorCookieTimeout(...params);
}
setSessionCookieTimeout(...params: Parameters<ICookieManagement['setSessionCookieTimeout']>) {
CookieManagement.setSessionCookieTimeout(...params);
}
setVisitorIdCookie(...params: Parameters<ICookieManagement['setVisitorIdCookie']>) {
CookieManagement.setVisitorIdCookie(...params);
}
}
disableCookies(...params: Parameters<ICookieManagement['disableCookies']>): ReturnType<ICookieManagement['disableCookies']> {
return CookieManagement.disableCookies(...params);
}

enableCookies(...params: Parameters<ICookieManagement['enableCookies']>): ReturnType<ICookieManagement['enableCookies']> {
return CookieManagement.enableCookies(...params);
}

deleteCookies(...params: Parameters<ICookieManagement['deleteCookies']>): ReturnType<ICookieManagement['deleteCookies']> {
return CookieManagement.deleteCookies(...params);
}

hasCookies(...params: Parameters<ICookieManagement['hasCookies']>): ReturnType<ICookieManagement['hasCookies']> {
return CookieManagement.hasCookies(...params);
}

setCookieNamePrefix(...params: Parameters<ICookieManagement['setCookieNamePrefix']>): ReturnType<ICookieManagement['setCookieNamePrefix']> {
return CookieManagement.setCookieNamePrefix(...params);
}

setCookieDomain(...params: Parameters<ICookieManagement['setCookieDomain']>): ReturnType<ICookieManagement['setCookieDomain']> {
return CookieManagement.setCookieDomain(...params);
}

setCookiePath(...params: Parameters<ICookieManagement['setCookiePath']>): ReturnType<ICookieManagement['setCookiePath']> {
return CookieManagement.setCookiePath(...params);
}

setSecureCookie(...params: Parameters<ICookieManagement['setSecureCookie']>): ReturnType<ICookieManagement['setSecureCookie']> {
return CookieManagement.setSecureCookie(...params);
}

setVisitorCookieTimeout(...params: Parameters<ICookieManagement['setVisitorCookieTimeout']>): ReturnType<ICookieManagement['setVisitorCookieTimeout']> {
return CookieManagement.setVisitorCookieTimeout(...params);
}

setSessionCookieTimeout(...params: Parameters<ICookieManagement['setSessionCookieTimeout']>): ReturnType<ICookieManagement['setSessionCookieTimeout']> {
return CookieManagement.setSessionCookieTimeout(...params);
}

setVisitorIdCookie(...params: Parameters<ICookieManagement['setVisitorIdCookie']>): ReturnType<ICookieManagement['setVisitorIdCookie']> {
return CookieManagement.setVisitorIdCookie(...params);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ import { Injectable } from '@angular/core';
type ICustomDimensions = typeof CustomDimensions;

@Injectable({
providedIn: 'root'
providedIn: 'root'
})
export class CustomDimensionsService {
getCustomDimensionValue(...params: Parameters<ICustomDimensions['getCustomDimensionValue']>): Promise<string | undefined> {
return CustomDimensions.getCustomDimensionValue(...params);
}
setCustomDimensionValue(...params: Parameters<ICustomDimensions['setCustomDimensionValue']>) {
CustomDimensions.setCustomDimensionValue(...params);
}
getCustomDimensionValue(...params: Parameters<ICustomDimensions['getCustomDimensionValue']>): ReturnType<ICustomDimensions['getCustomDimensionValue']> {
return CustomDimensions.getCustomDimensionValue(...params);
}

setCustomDimensionValue(...params: Parameters<ICustomDimensions['setCustomDimensionValue']>): ReturnType<ICustomDimensions['setCustomDimensionValue']> {
return CustomDimensions.setCustomDimensionValue(...params);
}

deleteCustomDimension(...params: Parameters<ICustomDimensions['deleteCustomDimension']>) {
CustomDimensions.deleteCustomDimension(...params);
}
}
deleteCustomDimension(...params: Parameters<ICustomDimensions['deleteCustomDimension']>): ReturnType<ICustomDimensions['deleteCustomDimension']> {
return CustomDimensions.deleteCustomDimension(...params);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type ICustomEvent = typeof CustomEvent;
providedIn: 'root'
})
export class CustomEventsService {
trackEvent(...params: Parameters<ICustomEvent['trackEvent']>) {
trackEvent(...params: Parameters<ICustomEvent['trackEvent']>): ReturnType<ICustomEvent['trackEvent']> {
CustomEvent.trackEvent(...params)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type IDataLayer = typeof DataLayer;
providedIn: 'root'
})
export class DataLayerService {
push(...params: Parameters<IDataLayer['push']>) {
push(...params: Parameters<IDataLayer['push']>): ReturnType<IDataLayer['push']> {
return DataLayer.push(...params);
}
}
Original file line number Diff line number Diff line change
@@ -1,41 +1,49 @@
import { Dimensions, DownloadAndOutlink } from '@piwikpro/tracking-base-library'

import { DownloadAndOutlink } from '@piwikpro/tracking-base-library'
import { Injectable } from '@angular/core';

type IDownloadAndOutlink = typeof DownloadAndOutlink;

@Injectable({
providedIn: 'root'
providedIn: 'root'
})
export class DownloadAndOutlinkService {
trackLink(...params: Parameters<IDownloadAndOutlink['trackLink']>) {
DownloadAndOutlink.trackLink(...params);
}
enableLinkTracking(...params: Parameters<IDownloadAndOutlink['enableLinkTracking']>) {
DownloadAndOutlink.enableLinkTracking(...params);
}
setLinkClasses(...params: Parameters<IDownloadAndOutlink['setLinkClasses']>) {
DownloadAndOutlink.setLinkClasses(...params);
}
setDownloadClasses(...params: Parameters<IDownloadAndOutlink['setDownloadClasses']>) {
DownloadAndOutlink.setDownloadClasses(...params);
}
setDownloadExtensions(...params: Parameters<IDownloadAndOutlink['setDownloadExtensions']>) {
DownloadAndOutlink.setDownloadExtensions(...params);
}
addDownloadExtensions(...params: Parameters<IDownloadAndOutlink['addDownloadExtensions']>) {
DownloadAndOutlink.addDownloadExtensions(...params);
}
removeDownloadExtensions(...params: Parameters<IDownloadAndOutlink['removeDownloadExtensions']>) {
DownloadAndOutlink.removeDownloadExtensions(...params);
}
setLinkTrackingTimer(...params: Parameters<IDownloadAndOutlink['setLinkTrackingTimer']>) {
DownloadAndOutlink.setLinkTrackingTimer(...params);
}
getLinkTrackingTimer(...params: Parameters<IDownloadAndOutlink['getLinkTrackingTimer']>) {
return DownloadAndOutlink.getLinkTrackingTimer(...params);
}
setIgnoreClasses(...params: Parameters<IDownloadAndOutlink['setIgnoreClasses']>) {
DownloadAndOutlink.setIgnoreClasses(...params);
}
}
trackLink(...params: Parameters<IDownloadAndOutlink['trackLink']>): ReturnType<IDownloadAndOutlink['trackLink']> {
return DownloadAndOutlink.trackLink(...params);
}

enableLinkTracking(...params: Parameters<IDownloadAndOutlink['enableLinkTracking']>): ReturnType<IDownloadAndOutlink['enableLinkTracking']> {
return DownloadAndOutlink.enableLinkTracking(...params);
}

setLinkClasses(...params: Parameters<IDownloadAndOutlink['setLinkClasses']>): ReturnType<IDownloadAndOutlink['setLinkClasses']> {
return DownloadAndOutlink.setLinkClasses(...params);
}

setDownloadClasses(...params: Parameters<IDownloadAndOutlink['setDownloadClasses']>): ReturnType<IDownloadAndOutlink['setDownloadClasses']> {
return DownloadAndOutlink.setDownloadClasses(...params);
}

setDownloadExtensions(...params: Parameters<IDownloadAndOutlink['setDownloadExtensions']>): ReturnType<IDownloadAndOutlink['setDownloadExtensions']> {
return DownloadAndOutlink.setDownloadExtensions(...params);
}

addDownloadExtensions(...params: Parameters<IDownloadAndOutlink['addDownloadExtensions']>): ReturnType<IDownloadAndOutlink['addDownloadExtensions']> {
return DownloadAndOutlink.addDownloadExtensions(...params);
}

removeDownloadExtensions(...params: Parameters<IDownloadAndOutlink['removeDownloadExtensions']>): ReturnType<IDownloadAndOutlink['removeDownloadExtensions']> {
return DownloadAndOutlink.removeDownloadExtensions(...params);
}

setLinkTrackingTimer(...params: Parameters<IDownloadAndOutlink['setLinkTrackingTimer']>): ReturnType<IDownloadAndOutlink['setLinkTrackingTimer']> {
return DownloadAndOutlink.setLinkTrackingTimer(...params);
}

getLinkTrackingTimer(...params: Parameters<IDownloadAndOutlink['getLinkTrackingTimer']>): ReturnType<IDownloadAndOutlink['getLinkTrackingTimer']> {
return DownloadAndOutlink.getLinkTrackingTimer(...params);
}

setIgnoreClasses(...params: Parameters<IDownloadAndOutlink['setIgnoreClasses']>): ReturnType<IDownloadAndOutlink['setIgnoreClasses']> {
return DownloadAndOutlink.setIgnoreClasses(...params);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class ECommerceService {
])
}

ecommerceAddToCart(...params: Parameters<IeCommerce['ecommerceAddToCart']>) {
ecommerceAddToCart(...params: Parameters<IeCommerce['ecommerceAddToCart']>): ReturnType<IeCommerce['ecommerceAddToCart']> {
eCommerce.ecommerceAddToCart(...params)
}

Expand All @@ -49,7 +49,7 @@ export class ECommerceService {
])
}

ecommerceRemoveFromCart(...params: Parameters<IeCommerce['ecommerceRemoveFromCart']>) {
ecommerceRemoveFromCart(...params: Parameters<IeCommerce['ecommerceRemoveFromCart']>): ReturnType<IeCommerce['ecommerceRemoveFromCart']> {
eCommerce.ecommerceRemoveFromCart(...params)
}

Expand Down Expand Up @@ -103,7 +103,7 @@ export class ECommerceService {
]);
}

ecommerceOrder(...params: Parameters<IeCommerce['ecommerceOrder']>) {
ecommerceOrder(...params: Parameters<IeCommerce['ecommerceOrder']>): ReturnType<IeCommerce['ecommerceOrder']> {
eCommerce.ecommerceOrder(...params)
}

Expand All @@ -117,7 +117,7 @@ export class ECommerceService {
]);
}

ecommerceCartUpdate(...params: Parameters<IeCommerce['ecommerceCartUpdate']>) {
ecommerceCartUpdate(...params: Parameters<IeCommerce['ecommerceCartUpdate']>): ReturnType<IeCommerce['ecommerceCartUpdate']> {
eCommerce.ecommerceCartUpdate(...params)
}

Expand All @@ -134,7 +134,7 @@ export class ECommerceService {
]);
}

ecommerceProductDetailView(...params: Parameters<IeCommerce['ecommerceProductDetailView']>) {
ecommerceProductDetailView(...params: Parameters<IeCommerce['ecommerceProductDetailView']>): ReturnType<IeCommerce['ecommerceProductDetailView']> {
eCommerce.ecommerceProductDetailView(...params)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type IGoalConversions = typeof GoalConversions;
providedIn: 'root'
})
export class GoalConversionsService {
trackGoal( ...params: Parameters<IGoalConversions['trackGoal']>) {
trackGoal( ...params: Parameters<IGoalConversions['trackGoal']>): ReturnType<IGoalConversions['trackGoal']> {
GoalConversions.trackGoal(...params)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type IPageViews = typeof PageViews
providedIn: 'root'
})
export class PageViewsService {
trackPageView(...params: Parameters<IPageViews['trackPageView']>) {
trackPageView(...params: Parameters<IPageViews['trackPageView']>): ReturnType<IPageViews['trackPageView']> {
PageViews.trackPageView(...params)
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { Dimensions, SiteSearch } from '@piwikpro/tracking-base-library'

import { Injectable } from '@angular/core';
import { SiteSearch } from '@piwikpro/tracking-base-library'

type ISiteSearch = typeof SiteSearch;

@Injectable({
providedIn: 'root'
})
export class SiteSearchService {
trackSiteSearch(...params: Parameters<ISiteSearch['trackSiteSearch']>) {
SiteSearch.trackSiteSearch(...params)
trackSiteSearch(...params: Parameters<ISiteSearch['trackSiteSearch']>): ReturnType<ISiteSearch['trackSiteSearch']> {
return SiteSearch.trackSiteSearch(...params)
}
}
}
Loading

0 comments on commit 3246ccd

Please sign in to comment.