shopkit-analytics 1.1.2 → 1.2.0

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.
Files changed (36) hide show
  1. package/dist/adapters/index.d.mts +1 -1
  2. package/dist/adapters/index.d.ts +1 -1
  3. package/dist/adapters/index.js +9 -372
  4. package/dist/adapters/index.js.map +1 -1
  5. package/dist/adapters/index.mjs +2 -6
  6. package/dist/affiliate/index.d.mts +2 -2
  7. package/dist/affiliate/index.d.ts +2 -2
  8. package/dist/{affiliate-tracker-B9nV3E9y.d.mts → affiliate-tracker-BgHwibPv.d.mts} +1 -1
  9. package/dist/{affiliate-tracker-B9nV3E9y.d.ts → affiliate-tracker-BgHwibPv.d.ts} +1 -1
  10. package/dist/{chunk-FXJKI3KV.mjs → chunk-CYSLR6EI.mjs} +1 -14
  11. package/dist/chunk-CYSLR6EI.mjs.map +1 -0
  12. package/dist/{chunk-EBZU3HYF.mjs → chunk-YJE5NOFF.mjs} +11 -372
  13. package/dist/chunk-YJE5NOFF.mjs.map +1 -0
  14. package/dist/{chunk-ANVCP4FV.mjs → chunk-ZTIVTB5J.mjs} +2 -2
  15. package/dist/events/index.d.mts +1 -1
  16. package/dist/events/index.d.ts +1 -1
  17. package/dist/events/index.js +9 -27
  18. package/dist/events/index.js.map +1 -1
  19. package/dist/events/index.mjs +3 -3
  20. package/dist/{index-C3YOamdo.d.ts → index-B-TnPt4F.d.ts} +1 -89
  21. package/dist/{index-BgLdfy-M.d.mts → index-fYvOG_to.d.mts} +1 -89
  22. package/dist/index.d.mts +6 -127
  23. package/dist/index.d.ts +6 -127
  24. package/dist/index.js +9 -718
  25. package/dist/index.js.map +1 -1
  26. package/dist/index.mjs +3 -337
  27. package/dist/index.mjs.map +1 -1
  28. package/dist/types.d.mts +2 -129
  29. package/dist/types.d.ts +2 -129
  30. package/dist/types.js +0 -13
  31. package/dist/types.js.map +1 -1
  32. package/dist/types.mjs +1 -1
  33. package/package.json +1 -1
  34. package/dist/chunk-EBZU3HYF.mjs.map +0 -1
  35. package/dist/chunk-FXJKI3KV.mjs.map +0 -1
  36. /package/dist/{chunk-ANVCP4FV.mjs.map → chunk-ZTIVTB5J.mjs.map} +0 -0
@@ -141,4 +141,4 @@ declare function getConfig(): Required<AffiliateConfig>;
141
141
  */
142
142
  declare function resetConfig(): void;
143
143
 
144
- export { type AffiliateParams as A, DEFAULT_CONFIG as D, type AffiliateData as a, AffiliateTracker as b, type AffiliateTrackerProps as c, useHasAffiliateData as d, useAffiliateSource as e, useAutoCapture as f, useAffiliateEvents as g, captureAffiliateParams as h, getAffiliateParams as i, clearAffiliateParams as j, configureAffiliateTracker as k, appendAffiliateParams as l, getAffiliateParamsAsUrlString as m, hasAffiliateData as n, getAffiliateSource as o, addEventListener as p, getConfig as q, resetConfig as r, type AffiliateConfig as s, type AffiliateTrackerHookReturn as t, useAffiliateTracker as u, type AffiliateEvent as v, type AffiliateEventType as w };
144
+ export { type AffiliateConfig as A, DEFAULT_CONFIG as D, AffiliateTracker as a, useHasAffiliateData as b, useAffiliateSource as c, captureAffiliateParams as d, clearAffiliateParams as e, getAffiliateSource as f, getAffiliateParams as g, hasAffiliateData as h, type AffiliateTrackerProps as i, type AffiliateParams as j, type AffiliateData as k, useAutoCapture as l, useAffiliateEvents as m, configureAffiliateTracker as n, appendAffiliateParams as o, getAffiliateParamsAsUrlString as p, addEventListener as q, getConfig as r, resetConfig as s, type AffiliateTrackerHookReturn as t, useAffiliateTracker as u, type AffiliateEvent as v, type AffiliateEventType as w };
@@ -13,19 +13,6 @@ var EventType = /* @__PURE__ */ ((EventType2) => {
13
13
  EventType2["VIEW_SEARCH_RESULTS"] = "view_search_results";
14
14
  EventType2["USER_SIGNUP"] = "user_signup";
15
15
  EventType2["USER_LOGIN"] = "user_login";
16
- EventType2["STARTED_CHECKOUT_GK"] = "started_checkout_gk";
17
- EventType2["MOBILE_ADDED_GK"] = "mobile_added_gk";
18
- EventType2["PIN_CODE_ADDED_GK"] = "pin_code_added_gk";
19
- EventType2["ADDRESS_ADDED_GK"] = "address_added_gk";
20
- EventType2["ADDRESS_SELECTED_GK"] = "address_selected_gk";
21
- EventType2["ADDRESS_COMPLETED_GK"] = "address_completed_gk";
22
- EventType2["PAYMENT_METHOD_SELECTED_GK"] = "payment_method_selected_gk";
23
- EventType2["PAYMENT_COMPLETED_GK"] = "payment_completed_gk";
24
- EventType2["ORDER_SUCCESS"] = "order_success";
25
- EventType2["ORDER_COMPLETED"] = "order_completed";
26
- EventType2["PRODUCT_VIEW_KP"] = "product_view_kp";
27
- EventType2["COLLECTION_VIEW_KP"] = "collection_view_kp";
28
- EventType2["PAGE_VIEW_KP"] = "page_view_kp";
29
16
  EventType2["SHOPIFY_PAGE_VIEW"] = "shopify_page_view";
30
17
  EventType2["CUSTOM"] = "custom";
31
18
  EventType2["SPECIFIC"] = "specific";
@@ -35,4 +22,4 @@ var EventType = /* @__PURE__ */ ((EventType2) => {
35
22
  export {
36
23
  EventType
37
24
  };
38
- //# sourceMappingURL=chunk-FXJKI3KV.mjs.map
25
+ //# sourceMappingURL=chunk-CYSLR6EI.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/types.ts"],"sourcesContent":["/**\n * Event types that can be tracked across the application\n * Organized by category for better maintainability and understanding\n */\nexport enum EventType {\n // ============================================================================\n // CORE E-COMMERCE EVENTS\n // Standard events used across all analytics platforms\n // ============================================================================\n\n /** Basic page view tracking */\n PAGE_VIEW = \"page_view\",\n\n /** Product viewing and interaction events */\n VIEW_CONTENT = \"view_content\",\n VIEWED_PRODUCT = \"viewed_product\",\n\n /** Shopping cart events */\n ADD_TO_CART = \"add_to_cart\",\n REMOVE_FROM_CART = \"remove_from_cart\",\n CART_VIEWED = \"cart_viewed\",\n\n /** Checkout flow events */\n INITIATE_CHECKOUT = \"initiate_checkout\",\n ADD_PAYMENT_INFO = \"add_payment_info\",\n PURCHASE = \"purchase\",\n\n /** Search and discovery events */\n SEARCH = \"search\",\n VIEW_SEARCH_RESULTS = \"view_search_results\",\n\n // ============================================================================\n // USER AUTHENTICATION EVENTS\n // Events specific to MoEngage for user lifecycle tracking\n // ============================================================================\n\n /** User account creation tracking */\n USER_SIGNUP = \"user_signup\",\n\n /** User login tracking */\n USER_LOGIN = \"user_login\",\n\n // ============================================================================\n // PLATFORM-SPECIFIC EVENTS\n // Events for specific platform integrations\n // ============================================================================\n\n /** Shopify analytics integration - Do Not Remove */\n SHOPIFY_PAGE_VIEW = \"shopify_page_view\",\n\n // ============================================================================\n // CUSTOM EVENTS\n // Generic events for flexible tracking requirements\n // ============================================================================\n\n /** Generic custom event for any tracking needs */\n CUSTOM = \"custom\",\n\n /** Specific custom event with predefined structure */\n SPECIFIC = \"specific\",\n}\n\n/**\n * Base event interface that all events should implement\n */\nexport interface BaseEvent {\n type: EventType;\n timestamp?: number;\n eventId?: string;\n event_category?: string;\n description?: string;\n [key: string]: any;\n}\n\n// ============================================================================\n// CORE ANALYTICS EVENTS\n// These are the fundamental events used across all analytics platforms\n// ============================================================================\n\n/**\n * Page view event - Tracks when a user views a page\n */\nexport interface IPageViewEvent extends BaseEvent {\n type: EventType.PAGE_VIEW;\n path: string;\n title: string;\n referrer?: string;\n}\n\n/**\n * Viewed product event - Triggered after user views a product for 20+ seconds\n */\nexport interface IViewedProductEvent extends BaseEvent {\n type: EventType.VIEWED_PRODUCT;\n productId: string;\n productName: string;\n price: number;\n currency: string;\n viewDuration?: number;\n}\n\n/**\n * Add to cart event - Tracks when user adds product to cart\n */\nexport interface IAddToCartEvent extends BaseEvent {\n type: EventType.ADD_TO_CART;\n productId: string;\n productName: string;\n price: number;\n currency?: string;\n quantity?: number;\n variant?: string;\n}\n\n/**\n * Remove from cart event - Tracks when user removes product from cart\n */\nexport interface IRemoveFromCartEvent extends BaseEvent {\n type: EventType.REMOVE_FROM_CART;\n productId: string;\n productName: string;\n price: number;\n currency?: string;\n quantity: number;\n variant?: string;\n}\n\n/**\n * Cart viewed event - Tracks when user views their cart\n */\nexport interface ICartViewedEvent extends BaseEvent {\n type: EventType.CART_VIEWED;\n cartId: string;\n products: Array<{\n variantId: string;\n price: number;\n quantity: number;\n }>;\n}\n\n/**\n * Search event - Tracks when user performs a search\n */\nexport interface ISearchEvent extends BaseEvent {\n type: EventType.SEARCH;\n searchTerm: string;\n content_ids: string[];\n resultsCount?: number;\n}\n\n/**\n * Add Payment Info event - Tracks when user adds payment information\n */\nexport interface IAddPaymentInfoEvent extends BaseEvent {\n type: EventType.ADD_PAYMENT_INFO;\n cartValue: number;\n currency?: string;\n itemCount: number;\n paymentType?: string;\n items: Array<{\n productId: string;\n productName: string;\n price: number;\n quantity: number;\n variant?: string;\n }>;\n}\n\n// ============================================================================\n// USER AUTHENTICATION EVENTS\n// Events specific to MoEngage for user authentication tracking\n// ============================================================================\n\n/**\n * User signup event - Tracks when a user creates an account\n */\nexport interface IUserSignupEvent extends BaseEvent {\n type: EventType.USER_SIGNUP;\n userId?: string;\n method?: string;\n success: boolean;\n pagePath: string;\n pageTitle: string;\n timestamp: number;\n customProperties?: Record<string, any>;\n}\n\n/**\n * User login event - Tracks when a user logs into their account\n */\nexport interface IUserLoginEvent extends BaseEvent {\n type: EventType.USER_LOGIN;\n userId?: string;\n method?: string;\n success: boolean;\n pagePath: string;\n pageTitle: string;\n timestamp: number;\n customProperties?: Record<string, any>;\n}\n\n// ============================================================================\n// PLATFORM-SPECIFIC EVENTS\n// Events designed for specific analytics platforms\n// ============================================================================\n\n/**\n * View content event - Facebook Pixel specific event for content viewing\n */\nexport interface IViewContentEvent extends BaseEvent {\n type: EventType.VIEW_CONTENT;\n content_type?: string;\n content_ids?: string[];\n content_name?: string;\n content_category?: string;\n value?: number;\n currency?: string;\n items?: Array<any>;\n}\n\n/**\n * Purchase event - Facebook Pixel specific event for purchase tracking\n */\nexport interface IPurchaseEvent extends BaseEvent {\n type: EventType.PURCHASE;\n orderId?: string;\n cartValue?: number;\n currency?: string;\n itemCount?: number;\n items: Array<{\n productId: string;\n productName: string;\n price: number;\n quantity: number;\n variant?: string;\n }>;\n transaction_id?: string;\n coupon?: string;\n shipping?: number;\n tax?: number;\n discount?: number | string;\n}\n\n/**\n * View search results event - Google Analytics 4 specific event\n */\nexport interface IViewSearchResultsEvent extends BaseEvent {\n type: EventType.VIEW_SEARCH_RESULTS;\n search_term?: string;\n}\n\n/**\n * Begin checkout event - Google Analytics 4 specific event for checkout initiation\n */\nexport interface IBeginCheckoutEvent extends BaseEvent {\n type: EventType.INITIATE_CHECKOUT;\n orderId?: string;\n cartValue: number;\n currency?: string;\n itemCount: number;\n items: Array<{\n productId: string;\n productName: string;\n price: number;\n quantity: number;\n variant?: string;\n }>;\n coupon?: string;\n discount?: number | string;\n}\n\n// ============================================================================\n// CUSTOM EVENTS\n// Generic events for custom tracking needs\n// ============================================================================\n\n/**\n * Custom event - For any custom tracking requirements not covered by standard events\n */\nexport interface ICustomEvent extends BaseEvent {\n type: EventType.CUSTOM;\n}\n\n/**\n * Specific event - For specific tracking requirements with custom properties\n */\nexport interface ISpecificEvent extends BaseEvent {\n type: EventType.SPECIFIC;\n}\n\n// ============================================================================\n// SHOPIFY EVENTS\n// Events specific to Shopify platform integration\n// ============================================================================\n\n/**\n * Shopify page view event - Tracks page views specifically for Shopify analytics\n */\nexport interface IShopifyPageViewEvent extends BaseEvent {\n type: EventType.SHOPIFY_PAGE_VIEW;\n path?: string;\n}\n\n/**\n * Union type of all possible events\n */\nexport type TEvent =\n | IPageViewEvent\n | IAddToCartEvent\n | IRemoveFromCartEvent\n | ICartViewedEvent\n | ISearchEvent\n | IUserSignupEvent\n | IUserLoginEvent\n | IViewContentEvent\n | IPurchaseEvent\n | IViewSearchResultsEvent\n | IBeginCheckoutEvent\n | ICustomEvent\n | ISpecificEvent\n | IAddPaymentInfoEvent\n | IViewedProductEvent\n | IShopifyPageViewEvent;\n"],"mappings":";AAIO,IAAK,YAAL,kBAAKA,eAAL;AAOL,EAAAA,WAAA,eAAY;AAGZ,EAAAA,WAAA,kBAAe;AACf,EAAAA,WAAA,oBAAiB;AAGjB,EAAAA,WAAA,iBAAc;AACd,EAAAA,WAAA,sBAAmB;AACnB,EAAAA,WAAA,iBAAc;AAGd,EAAAA,WAAA,uBAAoB;AACpB,EAAAA,WAAA,sBAAmB;AACnB,EAAAA,WAAA,cAAW;AAGX,EAAAA,WAAA,YAAS;AACT,EAAAA,WAAA,yBAAsB;AAQtB,EAAAA,WAAA,iBAAc;AAGd,EAAAA,WAAA,gBAAa;AAQb,EAAAA,WAAA,uBAAoB;AAQpB,EAAAA,WAAA,YAAS;AAGT,EAAAA,WAAA,cAAW;AAvDD,SAAAA;AAAA,GAAA;","names":["EventType"]}
@@ -378,12 +378,13 @@ var MultiPixelAdapter = class extends BaseAdapter {
378
378
  if (!eventName) {
379
379
  return;
380
380
  }
381
- console.log("@@@ trackClientSide", eventName, enhancedParams, {
382
- eventID: event.eventId
383
- });
384
- window.fbq("track", eventName, enhancedParams, {
385
- eventID: event.eventId
386
- });
381
+ try {
382
+ window.fbq("track", eventName, enhancedParams, {
383
+ eventID: event.eventId
384
+ });
385
+ } catch (error) {
386
+ console.error("Facebook Pixel tracking error:", error);
387
+ }
387
388
  }
388
389
  /**
389
390
  * Track event on server-side for all enabled pixels
@@ -403,14 +404,8 @@ var MultiPixelAdapter = class extends BaseAdapter {
403
404
  eventId: event.eventId,
404
405
  timestamp: event.timestamp,
405
406
  enhancedParams,
406
- userInfo: browserInfo,
407
- // Send all pixel info to the multi-pixel endpoint
408
- pixels: this.pixels.filter((pixel) => pixel.config.enableCAPI).map((pixel) => ({
409
- pixelId: pixel.config.pixelId,
410
- name: pixel.config.name
411
- }))
407
+ userInfo: browserInfo
412
408
  };
413
- console.log("@@@ trackServerSide", payload);
414
409
  const endpoint = this.getConfig("capiEndpoint", "/api/events/multi");
415
410
  const response = await fetch(endpoint, {
416
411
  method: "POST",
@@ -420,7 +415,7 @@ var MultiPixelAdapter = class extends BaseAdapter {
420
415
  body: JSON.stringify(payload)
421
416
  });
422
417
  if (!response.ok) {
423
- throw new Error(`Server-side tracking failed: ${response.status}`);
418
+ this.logger.error(`Server-side tracking failed: ${response.status}`);
424
419
  }
425
420
  } catch (error) {
426
421
  this.logger.error(
@@ -1468,360 +1463,6 @@ var ShopifyAdapter = class extends BaseAdapter {
1468
1463
  }
1469
1464
  };
1470
1465
 
1471
- // src/adapters/kwikpass-adapter.ts
1472
- var KwikPassAdapter = class extends BaseAdapter {
1473
- constructor(config = {}) {
1474
- super(config);
1475
- this.name = "KwikPass";
1476
- this.enableKwikPassEvents = config.enableKwikPassEvents ?? true;
1477
- this.initializeLogger();
1478
- }
1479
- /**
1480
- * Initialize the KwikPass adapter
1481
- */
1482
- async initialize() {
1483
- try {
1484
- if (typeof window !== "undefined") {
1485
- }
1486
- this.initialized = true;
1487
- } catch (error) {
1488
- this.logger.error(
1489
- "Failed to initialize KwikPass adapter",
1490
- error
1491
- );
1492
- throw error;
1493
- }
1494
- }
1495
- /**
1496
- * Track an event using KwikPass
1497
- * @param event The event to track
1498
- * @param adapterParams Optional adapter-specific parameters
1499
- */
1500
- async trackEvent(event, adapterParams) {
1501
- if (!this.initialized || typeof window === "undefined") {
1502
- this.logger.warn(
1503
- "KwikPass adapter not initialized or not in browser environment"
1504
- );
1505
- return;
1506
- }
1507
- if (!this.enableKwikPassEvents) {
1508
- return;
1509
- }
1510
- const affiliateParams = this.enhanceWithAffiliateParams(event);
1511
- const enhancedEvent = this.enhanceWithExperimentParams(affiliateParams);
1512
- try {
1513
- switch (event.type) {
1514
- case "product_view_kp" /* PRODUCT_VIEW_KP */:
1515
- this.trackProductView(enhancedEvent, adapterParams);
1516
- break;
1517
- case "collection_view_kp" /* COLLECTION_VIEW_KP */:
1518
- this.trackCollectionView(enhancedEvent, adapterParams);
1519
- break;
1520
- case "page_view_kp" /* PAGE_VIEW_KP */:
1521
- this.trackPageView(enhancedEvent, adapterParams);
1522
- break;
1523
- default:
1524
- this.logger.warn("Event not supported", { eventType: event.type });
1525
- break;
1526
- }
1527
- } catch (error) {
1528
- this.logger.error("Error tracking KwikPass event", error, {
1529
- eventType: event.type
1530
- });
1531
- }
1532
- }
1533
- /**
1534
- * Send event to KwikPass platform
1535
- */
1536
- sendKwikPassEvent(type, eventData, adapterParams) {
1537
- const customEventType = this.getEventName(adapterParams, type);
1538
- const enhancedEventData = this.mergeEventData(eventData, adapterParams);
1539
- if (typeof window !== "undefined") {
1540
- const customEvent = new CustomEvent(`page_view_kp`, {
1541
- detail: {
1542
- type: customEventType,
1543
- detail: enhancedEventData
1544
- }
1545
- });
1546
- window.dispatchEvent(customEvent);
1547
- }
1548
- }
1549
- /**
1550
- * Track collection view event
1551
- */
1552
- trackCollectionView(event, adapterParams) {
1553
- this.sendKwikPassEvent(
1554
- "collection",
1555
- {
1556
- product_id: event.productId,
1557
- product_name: event.productName,
1558
- price: event.price,
1559
- currency: event.currency,
1560
- category: event.category,
1561
- timestamp: event.timestamp || Date.now()
1562
- },
1563
- adapterParams
1564
- );
1565
- }
1566
- /**
1567
- * Track product view event
1568
- */
1569
- trackProductView(event, adapterParams) {
1570
- this.sendKwikPassEvent(
1571
- "product",
1572
- {
1573
- product_id: event.productId,
1574
- product_name: event.productName,
1575
- price: event.price,
1576
- currency: event.currency,
1577
- category: event.category,
1578
- timestamp: event.timestamp || Date.now()
1579
- },
1580
- adapterParams
1581
- );
1582
- }
1583
- /**
1584
- * Track page view event
1585
- */
1586
- trackPageView(event, adapterParams) {
1587
- this.sendKwikPassEvent(
1588
- "other",
1589
- {
1590
- path: event.path,
1591
- title: event.title,
1592
- referrer: event.referrer,
1593
- timestamp: event.timestamp || Date.now()
1594
- },
1595
- adapterParams
1596
- );
1597
- }
1598
- };
1599
-
1600
- // src/adapters/kwik-checkout-adapter.ts
1601
- var KwikCheckoutAdapter = class extends BaseAdapter {
1602
- constructor(config) {
1603
- super(config);
1604
- this.name = "KwikCheckout";
1605
- this.mid = config.mid || "";
1606
- this.environment = config.environment || "production";
1607
- this.storeId = config.storeId || "";
1608
- this.initializeLogger();
1609
- }
1610
- /**
1611
- * Initialize the GoKwik adapter
1612
- */
1613
- async initialize() {
1614
- try {
1615
- if (typeof window !== "undefined") {
1616
- }
1617
- this.initialized = true;
1618
- } catch (error) {
1619
- this.logger.error("Failed to initialize GoKwik adapter", error);
1620
- throw error;
1621
- }
1622
- }
1623
- /**
1624
- * Track an event using GoKwik
1625
- * @param event The event to track
1626
- * @param adapterParams Optional adapter-specific parameters
1627
- */
1628
- async trackEvent(event, adapterParams) {
1629
- if (!event.eventId) {
1630
- event.eventId = generateEventId(event.type);
1631
- }
1632
- if (!event.timestamp) {
1633
- event.timestamp = Date.now();
1634
- }
1635
- await this.trackClientSide(event, adapterParams);
1636
- }
1637
- /**
1638
- * Check if the adapter is enabled
1639
- */
1640
- isEnabled() {
1641
- return this.initialized && typeof window !== "undefined";
1642
- }
1643
- /**
1644
- * Track event on client-side (browser GoKwik)
1645
- */
1646
- async trackClientSide(event, adapterParams) {
1647
- if (!this.initialized || typeof window === "undefined") {
1648
- this.logger.warn(
1649
- "Cannot track client-side event, adapter not initialized or not in browser environment",
1650
- {
1651
- eventType: event.type
1652
- }
1653
- );
1654
- return;
1655
- }
1656
- const { eventName, enhancedParams } = this.formatEventPayload(
1657
- event,
1658
- adapterParams
1659
- );
1660
- if (!eventName) {
1661
- return;
1662
- }
1663
- const finalParams = {
1664
- ...enhancedParams,
1665
- ...event.eventId && { event_id: event.eventId }
1666
- };
1667
- this.sendGoKwikEvent(eventName, finalParams);
1668
- }
1669
- /**
1670
- * Utility function to format event payload for client-side tracking
1671
- */
1672
- formatEventPayload(event, adapterParams) {
1673
- let baseParams = {};
1674
- let eventName = "";
1675
- switch (event.type) {
1676
- case "started_checkout_gk" /* STARTED_CHECKOUT_GK */:
1677
- eventName = this.getEventName(adapterParams, "started_checkout");
1678
- baseParams = {
1679
- cart_value: event.cartValue,
1680
- currency: event.currency,
1681
- timestamp: event.timestamp || Date.now()
1682
- };
1683
- break;
1684
- case "mobile_added_gk" /* MOBILE_ADDED_GK */:
1685
- eventName = this.getEventName(adapterParams, "mobile_added");
1686
- baseParams = {
1687
- mobile: event.mobile,
1688
- timestamp: event.timestamp || Date.now()
1689
- };
1690
- break;
1691
- case "address_selected_gk" /* ADDRESS_SELECTED_GK */:
1692
- eventName = this.getEventName(adapterParams, "address_selected");
1693
- baseParams = {
1694
- address_id: event.addressId,
1695
- timestamp: event.timestamp || Date.now()
1696
- };
1697
- break;
1698
- case "address_completed_gk" /* ADDRESS_COMPLETED_GK */:
1699
- eventName = this.getEventName(adapterParams, "address_completed");
1700
- baseParams = {
1701
- address_id: event.addressId,
1702
- timestamp: event.timestamp || Date.now()
1703
- };
1704
- break;
1705
- case "address_added_gk" /* ADDRESS_ADDED_GK */:
1706
- eventName = this.getEventName(adapterParams, "address_added");
1707
- baseParams = {
1708
- address_id: event.addressId,
1709
- timestamp: event.timestamp || Date.now()
1710
- };
1711
- break;
1712
- case "pin_code_added_gk" /* PIN_CODE_ADDED_GK */:
1713
- eventName = this.getEventName(adapterParams, "pin_code_added");
1714
- baseParams = {
1715
- pin_code: event.pinCode,
1716
- timestamp: event.timestamp || Date.now()
1717
- };
1718
- break;
1719
- case "payment_method_selected_gk" /* PAYMENT_METHOD_SELECTED_GK */:
1720
- eventName = this.getEventName(adapterParams, "payment_method_selected");
1721
- baseParams = {
1722
- payment_method: event.paymentMethod,
1723
- timestamp: event.timestamp || Date.now()
1724
- };
1725
- break;
1726
- case "payment_completed_gk" /* PAYMENT_COMPLETED_GK */:
1727
- eventName = this.getEventName(adapterParams, "payment_completed");
1728
- baseParams = {
1729
- amount: event.amount,
1730
- currency: event.currency,
1731
- timestamp: event.timestamp || Date.now()
1732
- };
1733
- break;
1734
- case "order_success" /* ORDER_SUCCESS */:
1735
- eventName = this.getEventName(adapterParams, "order_success");
1736
- baseParams = {
1737
- order_id: event.orderId,
1738
- amount: event.amount,
1739
- currency: event.currency,
1740
- timestamp: event.timestamp || Date.now()
1741
- };
1742
- break;
1743
- case "order_completed" /* ORDER_COMPLETED */:
1744
- eventName = this.getEventName(adapterParams, "order_completed");
1745
- baseParams = {
1746
- order_id: event.orderId,
1747
- amount: event.amount,
1748
- currency: event.currency,
1749
- timestamp: event.timestamp || Date.now()
1750
- };
1751
- break;
1752
- case "cart_viewed" /* CART_VIEWED */:
1753
- eventName = this.getEventName(adapterParams, "cart_viewed");
1754
- baseParams = {
1755
- cart_id: event.cartId,
1756
- products: event.products,
1757
- timestamp: event.timestamp || Date.now()
1758
- };
1759
- break;
1760
- case "initiate_checkout" /* INITIATE_CHECKOUT */:
1761
- eventName = this.getEventName(adapterParams, "checkout_started");
1762
- baseParams = {
1763
- cart_value: event.cartValue,
1764
- currency: event.currency,
1765
- item_count: event.itemCount,
1766
- items: event.items,
1767
- timestamp: event.timestamp || Date.now()
1768
- };
1769
- break;
1770
- case "purchase" /* PURCHASE */:
1771
- eventName = this.getEventName(adapterParams, "checkout_completed");
1772
- baseParams = {
1773
- order_id: event.orderId,
1774
- cart_value: event.cartValue,
1775
- currency: event.currency,
1776
- item_count: event.itemCount,
1777
- items: event.items,
1778
- timestamp: event.timestamp || Date.now()
1779
- };
1780
- break;
1781
- case "add_payment_info" /* ADD_PAYMENT_INFO */:
1782
- eventName = this.getEventName(adapterParams, "add_payment_info");
1783
- baseParams = {
1784
- cart_value: event.cartValue,
1785
- currency: event.currency,
1786
- item_count: event.itemCount,
1787
- payment_type: event.paymentType,
1788
- items: event.items,
1789
- timestamp: event.timestamp || Date.now()
1790
- };
1791
- break;
1792
- default:
1793
- this.logger.warn(`Skipping unknown event type: ${event.type}`);
1794
- return { eventName: "", enhancedParams: {} };
1795
- }
1796
- const affiliateParams = this.enhanceWithAffiliateParams(baseParams);
1797
- const experimentParams = this.enhanceWithExperimentParams(affiliateParams);
1798
- const enhancedParams = this.mergeEventData(experimentParams, adapterParams);
1799
- return { eventName, enhancedParams };
1800
- }
1801
- /**
1802
- * Send event to GoKwik platform
1803
- */
1804
- sendGoKwikEvent(eventName, eventData) {
1805
- try {
1806
- if (typeof window !== "undefined" && window.gokwikSdk) {
1807
- window.gokwikSdk.track?.(eventName, eventData);
1808
- } else {
1809
- if (typeof window !== "undefined") {
1810
- const customEvent = new CustomEvent(`gokwik_${eventName}`, {
1811
- detail: eventData
1812
- });
1813
- window.dispatchEvent(customEvent);
1814
- }
1815
- }
1816
- } catch (error) {
1817
- this.logger.error(
1818
- `Error sending GoKwik event ${eventName}`,
1819
- error
1820
- );
1821
- }
1822
- }
1823
- };
1824
-
1825
1466
  export {
1826
1467
  createLogger,
1827
1468
  logger,
@@ -1831,8 +1472,6 @@ export {
1831
1472
  GoogleAdapter,
1832
1473
  MoengageAdapter,
1833
1474
  PostHogAdapter,
1834
- ShopifyAdapter,
1835
- KwikPassAdapter,
1836
- KwikCheckoutAdapter
1475
+ ShopifyAdapter
1837
1476
  };
1838
- //# sourceMappingURL=chunk-EBZU3HYF.mjs.map
1477
+ //# sourceMappingURL=chunk-YJE5NOFF.mjs.map