shopkit-analytics 1.1.2 → 1.1.3

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.
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  initTracking,
3
3
  initializeEventTracking
4
- } from "../chunk-ANVCP4FV.mjs";
5
- import "../chunk-EBZU3HYF.mjs";
4
+ } from "../chunk-ASHIIHZ4.mjs";
5
+ import "../chunk-T4CBWUTQ.mjs";
6
6
  import "../chunk-2DA66EMD.mjs";
7
7
  import "../chunk-UFDN3A6M.mjs";
8
8
  import {
9
9
  EventType
10
- } from "../chunk-FXJKI3KV.mjs";
10
+ } from "../chunk-CYSLR6EI.mjs";
11
11
  import {
12
12
  eventPublisher,
13
13
  eventSubscriber,
@@ -468,92 +468,4 @@ declare class ShopifyAdapter extends BaseAdapter {
468
468
  private trackAddToCart;
469
469
  }
470
470
 
471
- /**
472
- * Configuration interface for KwikPass Adapter
473
- */
474
- interface KwikPassConfig {
475
- enableDebugLogs?: boolean;
476
- enableKwikPassEvents?: boolean;
477
- }
478
- /**
479
- * KwikPass Analytics Adapter for tracking events to KwikPass platform
480
- */
481
- declare class KwikPassAdapter extends BaseAdapter {
482
- readonly name = "KwikPass";
483
- private enableKwikPassEvents;
484
- constructor(config?: KwikPassConfig);
485
- /**
486
- * Initialize the KwikPass adapter
487
- */
488
- initialize(): Promise<void>;
489
- /**
490
- * Track an event using KwikPass
491
- * @param event The event to track
492
- * @param adapterParams Optional adapter-specific parameters
493
- */
494
- trackEvent(event: TEvent, adapterParams?: TAdapterParams): Promise<void>;
495
- /**
496
- * Send event to KwikPass platform
497
- */
498
- private sendKwikPassEvent;
499
- /**
500
- * Track collection view event
501
- */
502
- private trackCollectionView;
503
- /**
504
- * Track product view event
505
- */
506
- private trackProductView;
507
- /**
508
- * Track page view event
509
- */
510
- private trackPageView;
511
- }
512
-
513
- /**
514
- * Configuration interface for Kwik Checkout Adapter
515
- */
516
- interface KwikCheckoutConfig {
517
- mid?: string;
518
- environment?: string;
519
- storeId?: string;
520
- enableDebugLogs?: boolean;
521
- }
522
- /**
523
- * Kwik Checkout Analytics Adapter for tracking checkout events to GoKwik platform
524
- */
525
- declare class KwikCheckoutAdapter extends BaseAdapter {
526
- readonly name = "KwikCheckout";
527
- private mid;
528
- private environment;
529
- private storeId;
530
- constructor(config: KwikCheckoutConfig);
531
- /**
532
- * Initialize the GoKwik adapter
533
- */
534
- initialize(): Promise<void>;
535
- /**
536
- * Track an event using GoKwik
537
- * @param event The event to track
538
- * @param adapterParams Optional adapter-specific parameters
539
- */
540
- trackEvent(event: TEvent, adapterParams?: TAdapterParams): Promise<void>;
541
- /**
542
- * Check if the adapter is enabled
543
- */
544
- isEnabled(): boolean;
545
- /**
546
- * Track event on client-side (browser GoKwik)
547
- */
548
- private trackClientSide;
549
- /**
550
- * Utility function to format event payload for client-side tracking
551
- */
552
- private formatEventPayload;
553
- /**
554
- * Send event to GoKwik platform
555
- */
556
- private sendGoKwikEvent;
557
- }
558
-
559
- export { BaseAdapter as B, type GoogleAdapterConfig as G, type KwikPassConfig as K, type LoggerConfig as L, type MultiPixelAdapterConfig as M, type PostHogAdapterConfig as P, type ShopifyAdapterConfig as S, type MoengageAdapterConfig as a, type KwikCheckoutConfig as b, MultiPixelAdapter as c, GoogleAdapter as d, MoengageAdapter as e, PostHogAdapter as f, ShopifyAdapter as g, KwikPassAdapter as h, KwikCheckoutAdapter as i, type Logger as j, createLogger as k, logger as l, createAdapterLogger as m };
471
+ export { BaseAdapter as B, type GoogleAdapterConfig as G, type LoggerConfig as L, type MultiPixelAdapterConfig as M, type PostHogAdapterConfig as P, type ShopifyAdapterConfig as S, type MoengageAdapterConfig as a, MultiPixelAdapter as b, GoogleAdapter as c, MoengageAdapter as d, PostHogAdapter as e, ShopifyAdapter as f, type Logger as g, createLogger as h, createAdapterLogger as i, logger as l };
@@ -468,92 +468,4 @@ declare class ShopifyAdapter extends BaseAdapter {
468
468
  private trackAddToCart;
469
469
  }
470
470
 
471
- /**
472
- * Configuration interface for KwikPass Adapter
473
- */
474
- interface KwikPassConfig {
475
- enableDebugLogs?: boolean;
476
- enableKwikPassEvents?: boolean;
477
- }
478
- /**
479
- * KwikPass Analytics Adapter for tracking events to KwikPass platform
480
- */
481
- declare class KwikPassAdapter extends BaseAdapter {
482
- readonly name = "KwikPass";
483
- private enableKwikPassEvents;
484
- constructor(config?: KwikPassConfig);
485
- /**
486
- * Initialize the KwikPass adapter
487
- */
488
- initialize(): Promise<void>;
489
- /**
490
- * Track an event using KwikPass
491
- * @param event The event to track
492
- * @param adapterParams Optional adapter-specific parameters
493
- */
494
- trackEvent(event: TEvent, adapterParams?: TAdapterParams): Promise<void>;
495
- /**
496
- * Send event to KwikPass platform
497
- */
498
- private sendKwikPassEvent;
499
- /**
500
- * Track collection view event
501
- */
502
- private trackCollectionView;
503
- /**
504
- * Track product view event
505
- */
506
- private trackProductView;
507
- /**
508
- * Track page view event
509
- */
510
- private trackPageView;
511
- }
512
-
513
- /**
514
- * Configuration interface for Kwik Checkout Adapter
515
- */
516
- interface KwikCheckoutConfig {
517
- mid?: string;
518
- environment?: string;
519
- storeId?: string;
520
- enableDebugLogs?: boolean;
521
- }
522
- /**
523
- * Kwik Checkout Analytics Adapter for tracking checkout events to GoKwik platform
524
- */
525
- declare class KwikCheckoutAdapter extends BaseAdapter {
526
- readonly name = "KwikCheckout";
527
- private mid;
528
- private environment;
529
- private storeId;
530
- constructor(config: KwikCheckoutConfig);
531
- /**
532
- * Initialize the GoKwik adapter
533
- */
534
- initialize(): Promise<void>;
535
- /**
536
- * Track an event using GoKwik
537
- * @param event The event to track
538
- * @param adapterParams Optional adapter-specific parameters
539
- */
540
- trackEvent(event: TEvent, adapterParams?: TAdapterParams): Promise<void>;
541
- /**
542
- * Check if the adapter is enabled
543
- */
544
- isEnabled(): boolean;
545
- /**
546
- * Track event on client-side (browser GoKwik)
547
- */
548
- private trackClientSide;
549
- /**
550
- * Utility function to format event payload for client-side tracking
551
- */
552
- private formatEventPayload;
553
- /**
554
- * Send event to GoKwik platform
555
- */
556
- private sendGoKwikEvent;
557
- }
558
-
559
- export { BaseAdapter as B, type GoogleAdapterConfig as G, type KwikPassConfig as K, type LoggerConfig as L, type MultiPixelAdapterConfig as M, type PostHogAdapterConfig as P, type ShopifyAdapterConfig as S, type MoengageAdapterConfig as a, type KwikCheckoutConfig as b, MultiPixelAdapter as c, GoogleAdapter as d, MoengageAdapter as e, PostHogAdapter as f, ShopifyAdapter as g, KwikPassAdapter as h, KwikCheckoutAdapter as i, type Logger as j, createLogger as k, logger as l, createAdapterLogger as m };
471
+ export { BaseAdapter as B, type GoogleAdapterConfig as G, type LoggerConfig as L, type MultiPixelAdapterConfig as M, type PostHogAdapterConfig as P, type ShopifyAdapterConfig as S, type MoengageAdapterConfig as a, MultiPixelAdapter as b, GoogleAdapter as c, MoengageAdapter as d, PostHogAdapter as e, ShopifyAdapter as f, type Logger as g, createLogger as h, createAdapterLogger as i, logger as l };
package/dist/index.d.mts CHANGED
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
- import { G as GoogleAdapterConfig, M as MultiPixelAdapterConfig, a as MoengageAdapterConfig, P as PostHogAdapterConfig, S as ShopifyAdapterConfig, K as KwikPassConfig, b as KwikCheckoutConfig, L as LoggerConfig } from './index-BgLdfy-M.mjs';
3
- export { B as BaseAdapter, d as GoogleAdapter, i as KwikCheckoutAdapter, h as KwikPassAdapter, j as Logger, e as MoengageAdapter, c as MultiPixelAdapter, f as PostHogAdapter, g as ShopifyAdapter, m as createAdapterLogger, k as createLogger, l as logger } from './index-BgLdfy-M.mjs';
2
+ import { G as GoogleAdapterConfig, M as MultiPixelAdapterConfig, a as MoengageAdapterConfig, P as PostHogAdapterConfig, S as ShopifyAdapterConfig, L as LoggerConfig } from './index-fYvOG_to.mjs';
3
+ export { B as BaseAdapter, c as GoogleAdapter, g as Logger, d as MoengageAdapter, b as MultiPixelAdapter, e as PostHogAdapter, f as ShopifyAdapter, i as createAdapterLogger, h as createLogger, l as logger } from './index-fYvOG_to.mjs';
4
4
  import { T as TrackingAdapter } from './subscriber-90r_t90W.mjs';
5
5
  export { I as IAdapterParams, b as IBaseAdapterParams, a as TAdapterParams, e as eventSubscriber } from './subscriber-90r_t90W.mjs';
6
6
  import { s as AffiliateConfig } from './affiliate-tracker-B9nV3E9y.mjs';
7
7
  export { a as AffiliateData, A as AffiliateParams, b as AffiliateTracker, c as AffiliateTrackerProps, h as captureAffiliateParams, j as clearAffiliateParams, i as getAffiliateParams, o as getAffiliateSource, n as hasAffiliateData, e as useAffiliateSource, u as useAffiliateTracker, d as useHasAffiliateData } from './affiliate-tracker-B9nV3E9y.mjs';
8
- export { BaseEvent, EventType, IAddPaymentInfoEvent, IAddToCartEvent, IAddressAddedGKEvent, IAddressCompletedGKEvent, IAddressSelectedGKEvent, IBeginCheckoutEvent, ICartViewedEvent, ICollectionViewKPEvent, ICustomEvent, IMobileAddedGKEvent, IOrderCompletedEvent, IOrderSuccessEvent, IPageViewEvent, IPageViewKPEvent, IPaymentCompletedGKEvent, IPaymentMethodSelectedGKEvent, IPinCodeAddedGKEvent, IProductViewKPEvent, IPurchaseEvent, IRemoveFromCartEvent, ISearchEvent, IShopifyPageViewEvent, ISpecificEvent, IStartedCheckoutGKEvent, IUserLoginEvent, IUserSignupEvent, IViewContentEvent, IViewSearchResultsEvent, IViewedProductEvent, TEvent } from './types.mjs';
8
+ export { BaseEvent, EventType, IAddPaymentInfoEvent, IAddToCartEvent, IBeginCheckoutEvent, ICartViewedEvent, ICustomEvent, IPageViewEvent, IPurchaseEvent, IRemoveFromCartEvent, ISearchEvent, IShopifyPageViewEvent, ISpecificEvent, IUserLoginEvent, IUserSignupEvent, IViewContentEvent, IViewSearchResultsEvent, IViewedProductEvent, TEvent } from './types.mjs';
9
9
  export { eventPublisher, initTracking, initializeEventTracking, publishEvent } from './events/index.mjs';
10
10
  export { E as ExperimentData, P as PRIMA_EXPERIMENT_COOKIES, a as PRIMA_EXPERIMENT_COOKIE_NAMES } from './types-BBZbvq9-.mjs';
11
11
  export { getExperimentParams, hasExperimentData } from './experiment/index.mjs';
@@ -40,8 +40,6 @@ interface ShopkitAnalyticsConfig {
40
40
  moengage?: MoengageAdapterConfig;
41
41
  posthog?: PostHogAdapterConfig;
42
42
  shopify?: ShopifyAdapterConfig;
43
- kwikpass?: KwikPassConfig;
44
- kwikcheckout?: KwikCheckoutConfig;
45
43
  customAdapters?: TrackingAdapter[];
46
44
  affiliate?: {
47
45
  enabled?: boolean;
@@ -232,4 +230,4 @@ interface ShopifyAnalyticsScriptProps {
232
230
  }
233
231
  declare function ShopifyAnalyticsScript({ domain, }: ShopifyAnalyticsScriptProps): null;
234
232
 
235
- export { AffiliateConfig, type CAPIEvent, type FacebookCAPIConfig, FacebookCAPIService, GoogleAdapterConfig, KwikCheckoutConfig, KwikPassConfig, LoggerConfig, MoengageAdapterConfig, MultiPixelAdapterConfig, PostHogAdapterConfig, RateLimiter, ShopifyAdapterConfig, ShopifyAnalyticsScript, ShopkitAnalytics, type ShopkitAnalyticsConfig, type ShopkitAnalyticsProps, TrackingAdapter, ShopkitAnalytics as default, facebookCAPIService };
233
+ export { AffiliateConfig, type CAPIEvent, type FacebookCAPIConfig, FacebookCAPIService, GoogleAdapterConfig, LoggerConfig, MoengageAdapterConfig, MultiPixelAdapterConfig, PostHogAdapterConfig, RateLimiter, ShopifyAdapterConfig, ShopifyAnalyticsScript, ShopkitAnalytics, type ShopkitAnalyticsConfig, type ShopkitAnalyticsProps, TrackingAdapter, ShopkitAnalytics as default, facebookCAPIService };
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
- import { G as GoogleAdapterConfig, M as MultiPixelAdapterConfig, a as MoengageAdapterConfig, P as PostHogAdapterConfig, S as ShopifyAdapterConfig, K as KwikPassConfig, b as KwikCheckoutConfig, L as LoggerConfig } from './index-C3YOamdo.js';
3
- export { B as BaseAdapter, d as GoogleAdapter, i as KwikCheckoutAdapter, h as KwikPassAdapter, j as Logger, e as MoengageAdapter, c as MultiPixelAdapter, f as PostHogAdapter, g as ShopifyAdapter, m as createAdapterLogger, k as createLogger, l as logger } from './index-C3YOamdo.js';
2
+ import { G as GoogleAdapterConfig, M as MultiPixelAdapterConfig, a as MoengageAdapterConfig, P as PostHogAdapterConfig, S as ShopifyAdapterConfig, L as LoggerConfig } from './index-B-TnPt4F.js';
3
+ export { B as BaseAdapter, c as GoogleAdapter, g as Logger, d as MoengageAdapter, b as MultiPixelAdapter, e as PostHogAdapter, f as ShopifyAdapter, i as createAdapterLogger, h as createLogger, l as logger } from './index-B-TnPt4F.js';
4
4
  import { T as TrackingAdapter } from './subscriber-AtiHiP3i.js';
5
5
  export { I as IAdapterParams, b as IBaseAdapterParams, a as TAdapterParams, e as eventSubscriber } from './subscriber-AtiHiP3i.js';
6
6
  import { s as AffiliateConfig } from './affiliate-tracker-B9nV3E9y.js';
7
7
  export { a as AffiliateData, A as AffiliateParams, b as AffiliateTracker, c as AffiliateTrackerProps, h as captureAffiliateParams, j as clearAffiliateParams, i as getAffiliateParams, o as getAffiliateSource, n as hasAffiliateData, e as useAffiliateSource, u as useAffiliateTracker, d as useHasAffiliateData } from './affiliate-tracker-B9nV3E9y.js';
8
- export { BaseEvent, EventType, IAddPaymentInfoEvent, IAddToCartEvent, IAddressAddedGKEvent, IAddressCompletedGKEvent, IAddressSelectedGKEvent, IBeginCheckoutEvent, ICartViewedEvent, ICollectionViewKPEvent, ICustomEvent, IMobileAddedGKEvent, IOrderCompletedEvent, IOrderSuccessEvent, IPageViewEvent, IPageViewKPEvent, IPaymentCompletedGKEvent, IPaymentMethodSelectedGKEvent, IPinCodeAddedGKEvent, IProductViewKPEvent, IPurchaseEvent, IRemoveFromCartEvent, ISearchEvent, IShopifyPageViewEvent, ISpecificEvent, IStartedCheckoutGKEvent, IUserLoginEvent, IUserSignupEvent, IViewContentEvent, IViewSearchResultsEvent, IViewedProductEvent, TEvent } from './types.js';
8
+ export { BaseEvent, EventType, IAddPaymentInfoEvent, IAddToCartEvent, IBeginCheckoutEvent, ICartViewedEvent, ICustomEvent, IPageViewEvent, IPurchaseEvent, IRemoveFromCartEvent, ISearchEvent, IShopifyPageViewEvent, ISpecificEvent, IUserLoginEvent, IUserSignupEvent, IViewContentEvent, IViewSearchResultsEvent, IViewedProductEvent, TEvent } from './types.js';
9
9
  export { eventPublisher, initTracking, initializeEventTracking, publishEvent } from './events/index.js';
10
10
  export { E as ExperimentData, P as PRIMA_EXPERIMENT_COOKIES, a as PRIMA_EXPERIMENT_COOKIE_NAMES } from './types-BBZbvq9-.js';
11
11
  export { getExperimentParams, hasExperimentData } from './experiment/index.js';
@@ -40,8 +40,6 @@ interface ShopkitAnalyticsConfig {
40
40
  moengage?: MoengageAdapterConfig;
41
41
  posthog?: PostHogAdapterConfig;
42
42
  shopify?: ShopifyAdapterConfig;
43
- kwikpass?: KwikPassConfig;
44
- kwikcheckout?: KwikCheckoutConfig;
45
43
  customAdapters?: TrackingAdapter[];
46
44
  affiliate?: {
47
45
  enabled?: boolean;
@@ -232,4 +230,4 @@ interface ShopifyAnalyticsScriptProps {
232
230
  }
233
231
  declare function ShopifyAnalyticsScript({ domain, }: ShopifyAnalyticsScriptProps): null;
234
232
 
235
- export { AffiliateConfig, type CAPIEvent, type FacebookCAPIConfig, FacebookCAPIService, GoogleAdapterConfig, KwikCheckoutConfig, KwikPassConfig, LoggerConfig, MoengageAdapterConfig, MultiPixelAdapterConfig, PostHogAdapterConfig, RateLimiter, ShopifyAdapterConfig, ShopifyAnalyticsScript, ShopkitAnalytics, type ShopkitAnalyticsConfig, type ShopkitAnalyticsProps, TrackingAdapter, ShopkitAnalytics as default, facebookCAPIService };
233
+ export { AffiliateConfig, type CAPIEvent, type FacebookCAPIConfig, FacebookCAPIService, GoogleAdapterConfig, LoggerConfig, MoengageAdapterConfig, MultiPixelAdapterConfig, PostHogAdapterConfig, RateLimiter, ShopifyAdapterConfig, ShopifyAnalyticsScript, ShopkitAnalytics, type ShopkitAnalyticsConfig, type ShopkitAnalyticsProps, TrackingAdapter, ShopkitAnalytics as default, facebookCAPIService };
package/dist/index.js CHANGED
@@ -266,8 +266,6 @@ __export(src_exports, {
266
266
  EventType: () => EventType,
267
267
  FacebookCAPIService: () => FacebookCAPIService,
268
268
  GoogleAdapter: () => GoogleAdapter,
269
- KwikCheckoutAdapter: () => KwikCheckoutAdapter,
270
- KwikPassAdapter: () => KwikPassAdapter,
271
269
  MoengageAdapter: () => MoengageAdapter,
272
270
  MultiPixelAdapter: () => MultiPixelAdapter,
273
271
  PRIMA_EXPERIMENT_COOKIES: () => PRIMA_EXPERIMENT_COOKIES,
@@ -626,19 +624,6 @@ var EventType = /* @__PURE__ */ ((EventType2) => {
626
624
  EventType2["VIEW_SEARCH_RESULTS"] = "view_search_results";
627
625
  EventType2["USER_SIGNUP"] = "user_signup";
628
626
  EventType2["USER_LOGIN"] = "user_login";
629
- EventType2["STARTED_CHECKOUT_GK"] = "started_checkout_gk";
630
- EventType2["MOBILE_ADDED_GK"] = "mobile_added_gk";
631
- EventType2["PIN_CODE_ADDED_GK"] = "pin_code_added_gk";
632
- EventType2["ADDRESS_ADDED_GK"] = "address_added_gk";
633
- EventType2["ADDRESS_SELECTED_GK"] = "address_selected_gk";
634
- EventType2["ADDRESS_COMPLETED_GK"] = "address_completed_gk";
635
- EventType2["PAYMENT_METHOD_SELECTED_GK"] = "payment_method_selected_gk";
636
- EventType2["PAYMENT_COMPLETED_GK"] = "payment_completed_gk";
637
- EventType2["ORDER_SUCCESS"] = "order_success";
638
- EventType2["ORDER_COMPLETED"] = "order_completed";
639
- EventType2["PRODUCT_VIEW_KP"] = "product_view_kp";
640
- EventType2["COLLECTION_VIEW_KP"] = "collection_view_kp";
641
- EventType2["PAGE_VIEW_KP"] = "page_view_kp";
642
627
  EventType2["SHOPIFY_PAGE_VIEW"] = "shopify_page_view";
643
628
  EventType2["CUSTOM"] = "custom";
644
629
  EventType2["SPECIFIC"] = "specific";
@@ -1884,360 +1869,6 @@ var ShopifyAdapter = class extends BaseAdapter {
1884
1869
  }
1885
1870
  };
1886
1871
 
1887
- // src/adapters/kwikpass-adapter.ts
1888
- var KwikPassAdapter = class extends BaseAdapter {
1889
- constructor(config = {}) {
1890
- super(config);
1891
- this.name = "KwikPass";
1892
- this.enableKwikPassEvents = config.enableKwikPassEvents ?? true;
1893
- this.initializeLogger();
1894
- }
1895
- /**
1896
- * Initialize the KwikPass adapter
1897
- */
1898
- async initialize() {
1899
- try {
1900
- if (typeof window !== "undefined") {
1901
- }
1902
- this.initialized = true;
1903
- } catch (error) {
1904
- this.logger.error(
1905
- "Failed to initialize KwikPass adapter",
1906
- error
1907
- );
1908
- throw error;
1909
- }
1910
- }
1911
- /**
1912
- * Track an event using KwikPass
1913
- * @param event The event to track
1914
- * @param adapterParams Optional adapter-specific parameters
1915
- */
1916
- async trackEvent(event, adapterParams) {
1917
- if (!this.initialized || typeof window === "undefined") {
1918
- this.logger.warn(
1919
- "KwikPass adapter not initialized or not in browser environment"
1920
- );
1921
- return;
1922
- }
1923
- if (!this.enableKwikPassEvents) {
1924
- return;
1925
- }
1926
- const affiliateParams = this.enhanceWithAffiliateParams(event);
1927
- const enhancedEvent = this.enhanceWithExperimentParams(affiliateParams);
1928
- try {
1929
- switch (event.type) {
1930
- case "product_view_kp" /* PRODUCT_VIEW_KP */:
1931
- this.trackProductView(enhancedEvent, adapterParams);
1932
- break;
1933
- case "collection_view_kp" /* COLLECTION_VIEW_KP */:
1934
- this.trackCollectionView(enhancedEvent, adapterParams);
1935
- break;
1936
- case "page_view_kp" /* PAGE_VIEW_KP */:
1937
- this.trackPageView(enhancedEvent, adapterParams);
1938
- break;
1939
- default:
1940
- this.logger.warn("Event not supported", { eventType: event.type });
1941
- break;
1942
- }
1943
- } catch (error) {
1944
- this.logger.error("Error tracking KwikPass event", error, {
1945
- eventType: event.type
1946
- });
1947
- }
1948
- }
1949
- /**
1950
- * Send event to KwikPass platform
1951
- */
1952
- sendKwikPassEvent(type, eventData, adapterParams) {
1953
- const customEventType = this.getEventName(adapterParams, type);
1954
- const enhancedEventData = this.mergeEventData(eventData, adapterParams);
1955
- if (typeof window !== "undefined") {
1956
- const customEvent = new CustomEvent(`page_view_kp`, {
1957
- detail: {
1958
- type: customEventType,
1959
- detail: enhancedEventData
1960
- }
1961
- });
1962
- window.dispatchEvent(customEvent);
1963
- }
1964
- }
1965
- /**
1966
- * Track collection view event
1967
- */
1968
- trackCollectionView(event, adapterParams) {
1969
- this.sendKwikPassEvent(
1970
- "collection",
1971
- {
1972
- product_id: event.productId,
1973
- product_name: event.productName,
1974
- price: event.price,
1975
- currency: event.currency,
1976
- category: event.category,
1977
- timestamp: event.timestamp || Date.now()
1978
- },
1979
- adapterParams
1980
- );
1981
- }
1982
- /**
1983
- * Track product view event
1984
- */
1985
- trackProductView(event, adapterParams) {
1986
- this.sendKwikPassEvent(
1987
- "product",
1988
- {
1989
- product_id: event.productId,
1990
- product_name: event.productName,
1991
- price: event.price,
1992
- currency: event.currency,
1993
- category: event.category,
1994
- timestamp: event.timestamp || Date.now()
1995
- },
1996
- adapterParams
1997
- );
1998
- }
1999
- /**
2000
- * Track page view event
2001
- */
2002
- trackPageView(event, adapterParams) {
2003
- this.sendKwikPassEvent(
2004
- "other",
2005
- {
2006
- path: event.path,
2007
- title: event.title,
2008
- referrer: event.referrer,
2009
- timestamp: event.timestamp || Date.now()
2010
- },
2011
- adapterParams
2012
- );
2013
- }
2014
- };
2015
-
2016
- // src/adapters/kwik-checkout-adapter.ts
2017
- var KwikCheckoutAdapter = class extends BaseAdapter {
2018
- constructor(config) {
2019
- super(config);
2020
- this.name = "KwikCheckout";
2021
- this.mid = config.mid || "";
2022
- this.environment = config.environment || "production";
2023
- this.storeId = config.storeId || "";
2024
- this.initializeLogger();
2025
- }
2026
- /**
2027
- * Initialize the GoKwik adapter
2028
- */
2029
- async initialize() {
2030
- try {
2031
- if (typeof window !== "undefined") {
2032
- }
2033
- this.initialized = true;
2034
- } catch (error) {
2035
- this.logger.error("Failed to initialize GoKwik adapter", error);
2036
- throw error;
2037
- }
2038
- }
2039
- /**
2040
- * Track an event using GoKwik
2041
- * @param event The event to track
2042
- * @param adapterParams Optional adapter-specific parameters
2043
- */
2044
- async trackEvent(event, adapterParams) {
2045
- if (!event.eventId) {
2046
- event.eventId = generateEventId(event.type);
2047
- }
2048
- if (!event.timestamp) {
2049
- event.timestamp = Date.now();
2050
- }
2051
- await this.trackClientSide(event, adapterParams);
2052
- }
2053
- /**
2054
- * Check if the adapter is enabled
2055
- */
2056
- isEnabled() {
2057
- return this.initialized && typeof window !== "undefined";
2058
- }
2059
- /**
2060
- * Track event on client-side (browser GoKwik)
2061
- */
2062
- async trackClientSide(event, adapterParams) {
2063
- if (!this.initialized || typeof window === "undefined") {
2064
- this.logger.warn(
2065
- "Cannot track client-side event, adapter not initialized or not in browser environment",
2066
- {
2067
- eventType: event.type
2068
- }
2069
- );
2070
- return;
2071
- }
2072
- const { eventName, enhancedParams } = this.formatEventPayload(
2073
- event,
2074
- adapterParams
2075
- );
2076
- if (!eventName) {
2077
- return;
2078
- }
2079
- const finalParams = {
2080
- ...enhancedParams,
2081
- ...event.eventId && { event_id: event.eventId }
2082
- };
2083
- this.sendGoKwikEvent(eventName, finalParams);
2084
- }
2085
- /**
2086
- * Utility function to format event payload for client-side tracking
2087
- */
2088
- formatEventPayload(event, adapterParams) {
2089
- let baseParams = {};
2090
- let eventName = "";
2091
- switch (event.type) {
2092
- case "started_checkout_gk" /* STARTED_CHECKOUT_GK */:
2093
- eventName = this.getEventName(adapterParams, "started_checkout");
2094
- baseParams = {
2095
- cart_value: event.cartValue,
2096
- currency: event.currency,
2097
- timestamp: event.timestamp || Date.now()
2098
- };
2099
- break;
2100
- case "mobile_added_gk" /* MOBILE_ADDED_GK */:
2101
- eventName = this.getEventName(adapterParams, "mobile_added");
2102
- baseParams = {
2103
- mobile: event.mobile,
2104
- timestamp: event.timestamp || Date.now()
2105
- };
2106
- break;
2107
- case "address_selected_gk" /* ADDRESS_SELECTED_GK */:
2108
- eventName = this.getEventName(adapterParams, "address_selected");
2109
- baseParams = {
2110
- address_id: event.addressId,
2111
- timestamp: event.timestamp || Date.now()
2112
- };
2113
- break;
2114
- case "address_completed_gk" /* ADDRESS_COMPLETED_GK */:
2115
- eventName = this.getEventName(adapterParams, "address_completed");
2116
- baseParams = {
2117
- address_id: event.addressId,
2118
- timestamp: event.timestamp || Date.now()
2119
- };
2120
- break;
2121
- case "address_added_gk" /* ADDRESS_ADDED_GK */:
2122
- eventName = this.getEventName(adapterParams, "address_added");
2123
- baseParams = {
2124
- address_id: event.addressId,
2125
- timestamp: event.timestamp || Date.now()
2126
- };
2127
- break;
2128
- case "pin_code_added_gk" /* PIN_CODE_ADDED_GK */:
2129
- eventName = this.getEventName(adapterParams, "pin_code_added");
2130
- baseParams = {
2131
- pin_code: event.pinCode,
2132
- timestamp: event.timestamp || Date.now()
2133
- };
2134
- break;
2135
- case "payment_method_selected_gk" /* PAYMENT_METHOD_SELECTED_GK */:
2136
- eventName = this.getEventName(adapterParams, "payment_method_selected");
2137
- baseParams = {
2138
- payment_method: event.paymentMethod,
2139
- timestamp: event.timestamp || Date.now()
2140
- };
2141
- break;
2142
- case "payment_completed_gk" /* PAYMENT_COMPLETED_GK */:
2143
- eventName = this.getEventName(adapterParams, "payment_completed");
2144
- baseParams = {
2145
- amount: event.amount,
2146
- currency: event.currency,
2147
- timestamp: event.timestamp || Date.now()
2148
- };
2149
- break;
2150
- case "order_success" /* ORDER_SUCCESS */:
2151
- eventName = this.getEventName(adapterParams, "order_success");
2152
- baseParams = {
2153
- order_id: event.orderId,
2154
- amount: event.amount,
2155
- currency: event.currency,
2156
- timestamp: event.timestamp || Date.now()
2157
- };
2158
- break;
2159
- case "order_completed" /* ORDER_COMPLETED */:
2160
- eventName = this.getEventName(adapterParams, "order_completed");
2161
- baseParams = {
2162
- order_id: event.orderId,
2163
- amount: event.amount,
2164
- currency: event.currency,
2165
- timestamp: event.timestamp || Date.now()
2166
- };
2167
- break;
2168
- case "cart_viewed" /* CART_VIEWED */:
2169
- eventName = this.getEventName(adapterParams, "cart_viewed");
2170
- baseParams = {
2171
- cart_id: event.cartId,
2172
- products: event.products,
2173
- timestamp: event.timestamp || Date.now()
2174
- };
2175
- break;
2176
- case "initiate_checkout" /* INITIATE_CHECKOUT */:
2177
- eventName = this.getEventName(adapterParams, "checkout_started");
2178
- baseParams = {
2179
- cart_value: event.cartValue,
2180
- currency: event.currency,
2181
- item_count: event.itemCount,
2182
- items: event.items,
2183
- timestamp: event.timestamp || Date.now()
2184
- };
2185
- break;
2186
- case "purchase" /* PURCHASE */:
2187
- eventName = this.getEventName(adapterParams, "checkout_completed");
2188
- baseParams = {
2189
- order_id: event.orderId,
2190
- cart_value: event.cartValue,
2191
- currency: event.currency,
2192
- item_count: event.itemCount,
2193
- items: event.items,
2194
- timestamp: event.timestamp || Date.now()
2195
- };
2196
- break;
2197
- case "add_payment_info" /* ADD_PAYMENT_INFO */:
2198
- eventName = this.getEventName(adapterParams, "add_payment_info");
2199
- baseParams = {
2200
- cart_value: event.cartValue,
2201
- currency: event.currency,
2202
- item_count: event.itemCount,
2203
- payment_type: event.paymentType,
2204
- items: event.items,
2205
- timestamp: event.timestamp || Date.now()
2206
- };
2207
- break;
2208
- default:
2209
- this.logger.warn(`Skipping unknown event type: ${event.type}`);
2210
- return { eventName: "", enhancedParams: {} };
2211
- }
2212
- const affiliateParams = this.enhanceWithAffiliateParams(baseParams);
2213
- const experimentParams = this.enhanceWithExperimentParams(affiliateParams);
2214
- const enhancedParams = this.mergeEventData(experimentParams, adapterParams);
2215
- return { eventName, enhancedParams };
2216
- }
2217
- /**
2218
- * Send event to GoKwik platform
2219
- */
2220
- sendGoKwikEvent(eventName, eventData) {
2221
- try {
2222
- if (typeof window !== "undefined" && window.gokwikSdk) {
2223
- window.gokwikSdk.track?.(eventName, eventData);
2224
- } else {
2225
- if (typeof window !== "undefined") {
2226
- const customEvent = new CustomEvent(`gokwik_${eventName}`, {
2227
- detail: eventData
2228
- });
2229
- window.dispatchEvent(customEvent);
2230
- }
2231
- }
2232
- } catch (error) {
2233
- this.logger.error(
2234
- `Error sending GoKwik event ${eventName}`,
2235
- error
2236
- );
2237
- }
2238
- }
2239
- };
2240
-
2241
1872
  // src/events/init.ts
2242
1873
  async function initializeEventTracking(adapters) {
2243
1874
  const { eventSubscriber: eventSubscriber2 } = await Promise.resolve().then(() => (init_subscriber(), subscriber_exports));
@@ -2767,20 +2398,6 @@ var ShopkitAnalytics = ({
2767
2398
  adapters.push(shopifyAdapter);
2768
2399
  logger2.info("Added Shopify Analytics adapter");
2769
2400
  }
2770
- if (config.kwikpass) {
2771
- const kwikpassAdapter = new KwikPassAdapter(
2772
- addLoggerConfig(config.kwikpass)
2773
- );
2774
- adapters.push(kwikpassAdapter);
2775
- logger2.info("Added KwikPass Analytics adapter");
2776
- }
2777
- if (config.kwikcheckout) {
2778
- const kwikcheckoutAdapter = new KwikCheckoutAdapter(
2779
- addLoggerConfig(config.kwikcheckout)
2780
- );
2781
- adapters.push(kwikcheckoutAdapter);
2782
- logger2.info("Added KwikCheckout Analytics adapter");
2783
- }
2784
2401
  if (config.customAdapters) {
2785
2402
  adapters.push(...config.customAdapters);
2786
2403
  logger2.info(`Added ${config.customAdapters.length} custom adapters`);
@@ -3136,8 +2753,6 @@ var facebookCAPIService = new FacebookCAPIService();
3136
2753
  EventType,
3137
2754
  FacebookCAPIService,
3138
2755
  GoogleAdapter,
3139
- KwikCheckoutAdapter,
3140
- KwikPassAdapter,
3141
2756
  MoengageAdapter,
3142
2757
  MultiPixelAdapter,
3143
2758
  PRIMA_EXPERIMENT_COOKIES,