@artisan-commerce/analytics-web 0.2.0-canary.140 → 0.2.0-canary.142

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bundle.d.ts CHANGED
@@ -34,8 +34,13 @@ interface GoogleAnalyticsProviderConfig {
34
34
  * @extends EventCommonParams
35
35
  * @property {Function} callback Fired when event is resolved
36
36
  */
37
- interface GoogleAnalyticsCommonEventParams extends EventCommonParams {
37
+ interface GoogleAnalyticsCommonEventParams extends EventCommonParams, EcommerceCommonParams {
38
38
  callback?: () => void;
39
+ storeId?: string;
40
+ storeName?: string;
41
+ vendorId?: string;
42
+ ocassion?: "delivery" | "pickup" | "coupon";
43
+ items?: Gtag.Item[];
39
44
  }
40
45
  /**
41
46
  * Google Analytics custom event shared parameters.
@@ -46,6 +51,12 @@ interface GoogleAnalyticsCommonEventParams extends EventCommonParams {
46
51
  interface GoogleAnalyticsCustomEventParams {
47
52
  [key: string]: any;
48
53
  }
54
+ interface CommonGoogleAnalyticsEventParams {
55
+ /** The item that the user is selecting */
56
+ item: Gtag.Item;
57
+ /** Param used to add `item_list_name` outside the items array */
58
+ list?: string;
59
+ }
49
60
  declare namespace Gtag {
50
61
  interface Gtag {
51
62
  (command: "config", targetId: string, config?: ControlParams | EventParams | CustomParams): void;
@@ -87,22 +98,33 @@ declare namespace Gtag {
87
98
  }
88
99
  type Currency = string | number;
89
100
  interface Item {
90
- brand?: string;
91
- category?: string;
101
+ item_id?: string;
102
+ item_name?: string;
103
+ affiliation?: string;
104
+ coupon?: string;
105
+ currency?: CurrencyCodes;
92
106
  creative_name?: string;
93
107
  creative_slot?: string;
94
- currency?: string;
108
+ discount?: number;
95
109
  index?: number;
96
110
  item_brand?: string;
97
111
  item_category?: string;
98
- item_id?: string;
112
+ item_category2?: string;
113
+ item_category3?: string;
114
+ item_category4?: string;
115
+ item_category5?: string;
99
116
  item_list_id?: string;
100
117
  item_list_name?: string;
101
- item_name?: string;
102
118
  item_variant?: string;
103
119
  location_id?: string;
104
- price?: Currency;
120
+ price_in_usd?: number;
121
+ price?: number;
122
+ promotion_id?: string;
123
+ promotion_name?: string;
105
124
  quantity?: number;
125
+ original_item?: string;
126
+ item_revenue_in_usd?: number;
127
+ item_revenue?: number;
106
128
  }
107
129
  interface Promotion {
108
130
  creative_name?: string;
@@ -414,6 +436,29 @@ interface EventCommonParams {
414
436
  isAnonymous?: boolean;
415
437
  currency?: CurrencyCodes;
416
438
  }
439
+ interface EcommerceCommonParams {
440
+ total_item_quantity?: number;
441
+ purchase_revenue_in_usd?: number;
442
+ purchase_revenue?: number;
443
+ refund_value_in_usd?: number;
444
+ refund_value?: number;
445
+ shipping_value_in_usd?: number;
446
+ shipping_value?: number;
447
+ tax_value_in_usd?: number;
448
+ tax_value?: number;
449
+ unique_items?: string;
450
+ transaction_id?: string;
451
+ payment_type?: string;
452
+ coupon?: boolean;
453
+ currency?: CurrencyCodes;
454
+ }
455
+ interface UserProperties {
456
+ first_open_time?: boolean;
457
+ user_type?: "registered" | "anonymous";
458
+ user_status?: "new" | "returning";
459
+ ga_session_id?: string;
460
+ ga_session_number?: string;
461
+ }
417
462
 
418
463
  /**
419
464
  * Facebook Pixel Provider constructor configuration.
@@ -926,7 +971,7 @@ type SelectWorkflowParams = SelectWorkflowParams$3 & SelectWorkflowParams$2 & Se
926
971
  * @extends GoogleAnalyticsCustomEventParams
927
972
  * @extends SetVendorCommonParams
928
973
  */
929
- interface SetVendorParams$3 extends GoogleAnalyticsCommonEventParams, GoogleAnalyticsCustomEventParams, SetVendorCommonParams {
974
+ interface SetVendorParams$3 extends Omit<GoogleAnalyticsCommonEventParams, "vendorId">, GoogleAnalyticsCustomEventParams, SetVendorCommonParams {
930
975
  }
931
976
 
932
977
  /**
@@ -1354,7 +1399,7 @@ interface ViewCartParams$2 extends FacebookPixelCommonEventParams, FacebookPixel
1354
1399
  * @property {Product[]} products The products in the cart
1355
1400
  */
1356
1401
  interface ViewCartParams$1 extends SegmentCommonEventParams, SegmentCustomEventParams, ViewCartCommonParams {
1357
- products: Product[];
1402
+ products?: Product[];
1358
1403
  }
1359
1404
 
1360
1405
  /**
@@ -1362,12 +1407,9 @@ interface ViewCartParams$1 extends SegmentCommonEventParams, SegmentCustomEventP
1362
1407
  *
1363
1408
  * @interface ViewCartCommonParams
1364
1409
  * @since 0.1.0
1365
- * @property {string} cartId Shopping cart identifier
1366
- * @property {string} cartName Shopping cart name
1367
1410
  */
1368
1411
  interface ViewCartCommonParams {
1369
- cartId: ShoppingCart["id"];
1370
- cartName?: ShoppingCart["name"];
1412
+ shoppingCart?: ShoppingCart;
1371
1413
  }
1372
1414
  /**
1373
1415
  * viewCart event params.
@@ -1574,7 +1616,7 @@ type RemoveProductFromWishlistParams = RemoveProductFromWishlistParams$3 & Remov
1574
1616
  * @extends GoogleAnalyticsCustomEventParams
1575
1617
  * @extends RemoveProductFromCartCommonParams
1576
1618
  */
1577
- interface RemoveProductFromCartParams$3 extends GoogleAnalyticsCommonEventParams, GoogleAnalyticsCustomEventParams, RemoveProductFromCartCommonParams {
1619
+ interface RemoveProductFromCartParams$3 extends Omit<GoogleAnalyticsCommonEventParams, "storeId" | "storeName">, GoogleAnalyticsCustomEventParams, RemoveProductFromCartCommonParams {
1578
1620
  }
1579
1621
 
1580
1622
  /**
@@ -1618,7 +1660,8 @@ interface RemoveProductFromCartCommonParams {
1618
1660
  product: CartProduct;
1619
1661
  cartId: ShoppingCart["id"];
1620
1662
  cartName?: ShoppingCart["name"];
1621
- store: Store;
1663
+ storeId: Store["storeId"];
1664
+ storeName: Store["storeName"];
1622
1665
  priceCategory?: PriceCategoryType;
1623
1666
  }
1624
1667
  /**
@@ -1756,7 +1799,7 @@ type AddProductToWishlistParams = AddProductToWishlistParams$3 & AddProductToWis
1756
1799
  * @extends GoogleAnalyticsCustomEventParams
1757
1800
  * @extends AddProductToCartCommonParams
1758
1801
  */
1759
- interface AddProductToCartParams$3 extends GoogleAnalyticsCommonEventParams, GoogleAnalyticsCustomEventParams, AddProductToCartCommonParams {
1802
+ interface AddProductToCartParams$3 extends Omit<GoogleAnalyticsCommonEventParams, "storeId" | "storeName">, GoogleAnalyticsCustomEventParams, AddProductToCartCommonParams {
1760
1803
  }
1761
1804
 
1762
1805
  /**
@@ -1790,18 +1833,22 @@ interface AddProductToCartParams$1 extends SegmentCommonEventParams, SegmentCust
1790
1833
  *
1791
1834
  * @interface AddProductToCartCommonParams
1792
1835
  * @since 0.1.0
1793
- * @property {CartProduct} product The product that was added to the cart
1794
- * @property {string} cartId Shopping cart identifier
1795
- * @property {string} cartName Shopping cart name
1796
- * @property {Store} store Store where the user is buying the product
1797
- * @property {PriceCategoryType} priceCategory The product price category identifier
1798
1836
  */
1799
1837
  interface AddProductToCartCommonParams {
1838
+ /** The product ID that was added to the cart */
1800
1839
  product: CartProduct;
1840
+ /** Shopping cart identifier */
1801
1841
  cartId: ShoppingCart["id"];
1842
+ /** Shopping cart name */
1802
1843
  cartName?: ShoppingCart["name"];
1803
- store: Store;
1844
+ /** The store ID where the user is buying the product */
1845
+ storeId: Store["storeId"];
1846
+ /** The store name where the user is buying the product */
1847
+ storeName: Store["storeName"];
1848
+ /** The product price category identifier */
1804
1849
  priceCategory?: PriceCategoryType;
1850
+ /** Param used to add `item_list_name` inside the items array */
1851
+ list: CommonGoogleAnalyticsEventParams["list"];
1805
1852
  }
1806
1853
  /**
1807
1854
  * addProductToCart event params.
@@ -2097,7 +2144,7 @@ interface PurchaseSuccessParams$1 extends SegmentCommonEventParams, SegmentCusto
2097
2144
  */
2098
2145
  interface PurchaseSuccessCommonParams {
2099
2146
  /** The order shopping cart */
2100
- shoppingCart: ShoppingCart;
2147
+ shoppingCart?: ShoppingCart;
2101
2148
  /** The selected payment type (e.g. Cash, Card) */
2102
2149
  selectedPaymentType: PaymentType;
2103
2150
  /** The workflow name (e.g. Delivery) */
@@ -2296,12 +2343,12 @@ interface ViewProductDetailsParams$1 extends SegmentCommonEventParams, SegmentCu
2296
2343
  *
2297
2344
  * @interface ViewProductDetailsCommonParams
2298
2345
  * @since 0.1.0
2299
- * @property {Product} product the product that the details are being viewed
2300
- * @property {string} categoryId if the user came from a category list, the category id
2301
2346
  */
2302
2347
  interface ViewProductDetailsCommonParams {
2348
+ /** The details of the product that the user is viewing */
2303
2349
  product: Product;
2304
- categorId?: string;
2350
+ /** The list that the product belongs to, this is used to add `item_list_name` to the items array */
2351
+ list?: string;
2305
2352
  }
2306
2353
  /**
2307
2354
  * viewProductDetails event params.
@@ -3635,6 +3682,138 @@ interface RequestAssistanceCommonParams {
3635
3682
  */
3636
3683
  type RequestAssistanceParams = RequestAssistanceParams$3 & RequestAssistanceParams$2 & RequestAssistanceParams$1;
3637
3684
 
3685
+ /**
3686
+ * Event allowed parameters.
3687
+ *
3688
+ * @interface SelectPromotionParams
3689
+ * @since 0.1.0
3690
+ * @extends GoogleAnalyticsCommonEventParams
3691
+ * @extends GoogleAnalyticsCustomEventParams
3692
+ */
3693
+ interface SelectPromotionParams extends GoogleAnalyticsCommonEventParams, GoogleAnalyticsCustomEventParams, CommonGoogleAnalyticsEventParams {
3694
+ promotionId?: string;
3695
+ promotionName?: string;
3696
+ creativeName?: string;
3697
+ creativeSlot?: string;
3698
+ originalItem?: Gtag.Item;
3699
+ }
3700
+
3701
+ /**
3702
+ * Event allowed parameters.
3703
+ *
3704
+ * @interface ViewPromotionParams
3705
+ * @since 0.1.0
3706
+ * @extends GoogleAnalyticsCommonEventParams
3707
+ * @extends GoogleAnalyticsCustomEventParams
3708
+ */
3709
+ interface ViewPromotionParams extends GoogleAnalyticsCommonEventParams, GoogleAnalyticsCustomEventParams, CommonGoogleAnalyticsEventParams {
3710
+ promotionId?: string;
3711
+ promotionName?: string;
3712
+ creativeName?: string;
3713
+ creativeSlot?: string;
3714
+ originalItem?: Gtag.Item;
3715
+ }
3716
+
3717
+ /**
3718
+ * Event allowed parameters.
3719
+ *
3720
+ * @interface SelectItemParams
3721
+ * @since 0.1.0
3722
+ * @extends GoogleAnalyticsCommonEventParams
3723
+ * @extends GoogleAnalyticsCustomEventParams
3724
+ */
3725
+ interface SelectItemParams$3 extends GoogleAnalyticsCommonEventParams, GoogleAnalyticsCustomEventParams, CommonGoogleAnalyticsEventParams {
3726
+ }
3727
+
3728
+ /**
3729
+ * Event allowed parameters.
3730
+ *
3731
+ * @interface SelectItemParams
3732
+ * @extends FacebookPixelCommonEventParams
3733
+ * @extends FacebookPixelCustomEventParams
3734
+ * @extends SelectItemCommonParams
3735
+ */
3736
+ interface SelectItemParams$2 extends FacebookPixelCommonEventParams, FacebookPixelCustomEventParams, SelectItemCommonParams {
3737
+ }
3738
+
3739
+ /**
3740
+ * Event allowed parameters.
3741
+ *
3742
+ * @interface SelectItemParams
3743
+ * @since 0.1.0
3744
+ * @extends SegmentCommonEventParams
3745
+ * @extends SegmentCustomEventParams
3746
+ * @extends SelectItemCommonParams
3747
+ */
3748
+ interface SelectItemParams$1 extends SegmentCommonEventParams, SegmentCustomEventParams, SelectItemCommonParams {
3749
+ }
3750
+
3751
+ /**
3752
+ * selectItem event interface
3753
+ *
3754
+ * @interface SelectItemCommonParams
3755
+ * @since 0.1.0
3756
+ */
3757
+ interface SelectItemCommonParams {
3758
+ }
3759
+ /**
3760
+ * selectItem event params.
3761
+ *
3762
+ * @typedef SelectItemParams
3763
+ * @since 0.1.0
3764
+ */
3765
+ type SelectItemParams = SelectItemParams$3 & SelectItemParams$2 & SelectItemParams$1;
3766
+
3767
+ /**
3768
+ * Event allowed parameters.
3769
+ *
3770
+ * @interface ViewItemListParams
3771
+ * @since 0.1.0
3772
+ * @extends GoogleAnalyticsCommonEventParams
3773
+ * @extends GoogleAnalyticsCustomEventParams
3774
+ */
3775
+ interface ViewItemListParams$3 extends GoogleAnalyticsCommonEventParams, GoogleAnalyticsCustomEventParams, CommonGoogleAnalyticsEventParams {
3776
+ }
3777
+
3778
+ /**
3779
+ * Event allowed parameters.
3780
+ *
3781
+ * @interface ViewItemListParams
3782
+ * @extends FacebookPixelCommonEventParams
3783
+ * @extends FacebookPixelCustomEventParams
3784
+ * @extends ViewItemListCommonParams
3785
+ */
3786
+ interface ViewItemListParams$2 extends FacebookPixelCommonEventParams, FacebookPixelCustomEventParams, ViewItemListCommonParams {
3787
+ }
3788
+
3789
+ /**
3790
+ * Event allowed parameters.
3791
+ *
3792
+ * @interface ViewItemListParams
3793
+ * @since 0.1.0
3794
+ * @extends SegmentCommonEventParams
3795
+ * @extends SegmentCustomEventParams
3796
+ * @extends CategoryImpressionCommonParams
3797
+ */
3798
+ interface ViewItemListParams$1 extends SegmentCommonEventParams, SegmentCustomEventParams, ViewItemListCommonParams {
3799
+ }
3800
+
3801
+ /**
3802
+ * viewItemList event interface
3803
+ *
3804
+ * @interface ViewItemListCommonParams
3805
+ * @since 0.1.0
3806
+ */
3807
+ interface ViewItemListCommonParams {
3808
+ }
3809
+ /**
3810
+ * viewItemList event params.
3811
+ *
3812
+ * @typedef ViewItemListParams
3813
+ * @since 0.1.0
3814
+ */
3815
+ type ViewItemListParams = ViewItemListParams$3 & ViewItemListParams$2 & ViewItemListParams$1;
3816
+
3638
3817
  /**
3639
3818
  * Event allowed parameters.
3640
3819
  *
@@ -4825,9 +5004,9 @@ type SearchCategoryAttemptParams = SearchCategoryAttemptParams$3 & SearchCategor
4825
5004
  * @since 0.1.0
4826
5005
  * @extends GoogleAnalyticsCommonEventParams
4827
5006
  * @extends GoogleAnalyticsCustomEventParams
4828
- * @property {string} itemBrand The item brand (e.g. El Español)
4829
5007
  */
4830
5008
  interface CategoryImpressionParams$3 extends GoogleAnalyticsCommonEventParams, GoogleAnalyticsCustomEventParams, CategoryImpressionCommonParams {
5009
+ /** The item brand (e.g. El Español) */
4831
5010
  itemBrand?: string;
4832
5011
  }
4833
5012
 
@@ -4860,16 +5039,18 @@ interface CategoryImpressionParams$1 extends SegmentCommonEventParams, SegmentCu
4860
5039
  *
4861
5040
  * @interface CategoryImpressionCommonParams
4862
5041
  * @since 0.1.0
4863
- * @property {Category} category the category a user had an impression on
4864
- * @property {string} list the name of the list where the category is
4865
- * @property {number} position the position in a list where the category is
4866
- * @property {number} duration how long in milliseconds the user had an impression before interacting with the category or left
4867
5042
  */
4868
5043
  interface CategoryImpressionCommonParams {
5044
+ /** The category the user is viewing */
4869
5045
  category: Category;
5046
+ /** The name of the list where the category is */
4870
5047
  list?: string;
5048
+ /** The position in a list where the category is */
4871
5049
  position?: number;
5050
+ /** How long in milliseconds the user had an impression before interacting with the category or left */
4872
5051
  duration?: number;
5052
+ /** `item_category` send inside items array */
5053
+ itemCategory?: string;
4873
5054
  }
4874
5055
  /**
4875
5056
  * categoryImpression event params.
@@ -5682,6 +5863,12 @@ declare const events: {
5682
5863
  logOutOfCoverage: (params?: OutOfCoverageParams) => void;
5683
5864
  logSetLocation: (params?: SetLocationParams) => void;
5684
5865
  };
5866
+ global: {
5867
+ logViewItemList: (params: ViewItemListParams) => void;
5868
+ logSelectItem: (params: SelectItemParams) => void;
5869
+ logViewPromotion: (params: ViewPromotionParams) => void;
5870
+ logSelectPromotion: (params: SelectPromotionParams) => void;
5871
+ };
5685
5872
  help: {
5686
5873
  logRequestAssistance: (params: RequestAssistanceParams) => void;
5687
5874
  };
@@ -5786,5 +5973,7 @@ declare const identifyUser: (identify: Segment$1.Traits) => void;
5786
5973
  */
5787
5974
  declare const checkInit: () => boolean;
5788
5975
 
5789
- export { Fbq, Gtag, Providers, Segment$1 as Segment, checkInit, events, identifyUser, initAnalytics, updateActiveVendor };
5790
- export type { AnalyticsMeta, AnalyticsProvidersConfigs, AuthProviderMethods, FacebookConversionsApiConfig, FacebookPixelCommonEventParams, FacebookPixelCustomEventParams, FacebookPixelProvider, FacebookPixelProviderConfig, GoogleAnalyticsCommonEventParams, GoogleAnalyticsCustomEventParams, GoogleAnalyticsProvider, GoogleAnalyticsProviderConfig, InitAnalyticsConfig, InitAnalyticsConfigMeta, SegmentCommonEventParams, SegmentCustomEventParams, SegmentProvider, SegmentProviderConfig, SupportedProviders };
5976
+ declare const toItemProduct: (product: CartProduct) => Gtag.Item[];
5977
+
5978
+ export { Fbq, Gtag, Providers, Segment$1 as Segment, checkInit, events, identifyUser, initAnalytics, toItemProduct, updateActiveVendor };
5979
+ export type { AnalyticsMeta, AnalyticsProvidersConfigs, AuthProviderMethods, CommonGoogleAnalyticsEventParams, FacebookConversionsApiConfig, FacebookPixelCommonEventParams, FacebookPixelCustomEventParams, FacebookPixelProvider, FacebookPixelProviderConfig, GoogleAnalyticsCommonEventParams, GoogleAnalyticsCustomEventParams, GoogleAnalyticsProvider, GoogleAnalyticsProviderConfig, InitAnalyticsConfig, InitAnalyticsConfigMeta, SegmentCommonEventParams, SegmentCustomEventParams, SegmentProvider, SegmentProviderConfig, SupportedProviders, UserProperties };