@selwise/widget 0.0.1
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/npm/cjs/constants.js +167 -0
- package/dist/npm/cjs/constants.js.map +1 -0
- package/dist/npm/cjs/core/conflict-resolver.js +203 -0
- package/dist/npm/cjs/core/conflict-resolver.js.map +1 -0
- package/dist/npm/cjs/core/event-batcher.js +977 -0
- package/dist/npm/cjs/core/event-batcher.js.map +1 -0
- package/dist/npm/cjs/core/experiment-overrides.js +178 -0
- package/dist/npm/cjs/core/experiment-overrides.js.map +1 -0
- package/dist/npm/cjs/core/experiments.js +317 -0
- package/dist/npm/cjs/core/experiments.js.map +1 -0
- package/dist/npm/cjs/core/frequency-caps.js +297 -0
- package/dist/npm/cjs/core/frequency-caps.js.map +1 -0
- package/dist/npm/cjs/core/index.js +27 -0
- package/dist/npm/cjs/core/index.js.map +1 -0
- package/dist/npm/cjs/core/indexeddb-queue.js +333 -0
- package/dist/npm/cjs/core/indexeddb-queue.js.map +1 -0
- package/dist/npm/cjs/core/journey-tracker.js +243 -0
- package/dist/npm/cjs/core/journey-tracker.js.map +1 -0
- package/dist/npm/cjs/core/page-targeting/index.js +72 -0
- package/dist/npm/cjs/core/page-targeting/index.js.map +1 -0
- package/dist/npm/cjs/core/script-executor.js +80 -0
- package/dist/npm/cjs/core/script-executor.js.map +1 -0
- package/dist/npm/cjs/core/segments.js +172 -0
- package/dist/npm/cjs/core/segments.js.map +1 -0
- package/dist/npm/cjs/core/tracker.js +798 -0
- package/dist/npm/cjs/core/tracker.js.map +1 -0
- package/dist/npm/cjs/datalayer/basket.js +385 -0
- package/dist/npm/cjs/datalayer/basket.js.map +1 -0
- package/dist/npm/cjs/datalayer/cart-association.js +226 -0
- package/dist/npm/cjs/datalayer/cart-association.js.map +1 -0
- package/dist/npm/cjs/datalayer/checkout.js +382 -0
- package/dist/npm/cjs/datalayer/checkout.js.map +1 -0
- package/dist/npm/cjs/datalayer/constants.js +163 -0
- package/dist/npm/cjs/datalayer/constants.js.map +1 -0
- package/dist/npm/cjs/datalayer/index.js +1010 -0
- package/dist/npm/cjs/datalayer/index.js.map +1 -0
- package/dist/npm/cjs/datalayer/listener.js +416 -0
- package/dist/npm/cjs/datalayer/listener.js.map +1 -0
- package/dist/npm/cjs/datalayer/page.js +343 -0
- package/dist/npm/cjs/datalayer/page.js.map +1 -0
- package/dist/npm/cjs/datalayer/product.js +517 -0
- package/dist/npm/cjs/datalayer/product.js.map +1 -0
- package/dist/npm/cjs/datalayer/reverse-mappings.js +139 -0
- package/dist/npm/cjs/datalayer/reverse-mappings.js.map +1 -0
- package/dist/npm/cjs/datalayer/search.js +363 -0
- package/dist/npm/cjs/datalayer/search.js.map +1 -0
- package/dist/npm/cjs/datalayer/types.js +134 -0
- package/dist/npm/cjs/datalayer/types.js.map +1 -0
- package/dist/npm/cjs/datalayer/user.js +372 -0
- package/dist/npm/cjs/datalayer/user.js.map +1 -0
- package/dist/npm/cjs/debug/index.js +679 -0
- package/dist/npm/cjs/debug/index.js.map +1 -0
- package/dist/npm/cjs/entries/cdn.js +72 -0
- package/dist/npm/cjs/entries/cdn.js.map +1 -0
- package/dist/npm/cjs/index.js +10 -0
- package/dist/npm/cjs/index.js.map +1 -0
- package/dist/npm/cjs/modules/contract/recommendation-contract.js +119 -0
- package/dist/npm/cjs/modules/contract/recommendation-contract.js.map +1 -0
- package/dist/npm/cjs/modules/contract/search-contract.js +18 -0
- package/dist/npm/cjs/modules/contract/search-contract.js.map +1 -0
- package/dist/npm/cjs/modules/contract/tracking-contract.js +16 -0
- package/dist/npm/cjs/modules/contract/tracking-contract.js.map +1 -0
- package/dist/npm/cjs/modules/contract/widget-contract.js +10 -0
- package/dist/npm/cjs/modules/contract/widget-contract.js.map +1 -0
- package/dist/npm/cjs/modules/products/tracking.js +214 -0
- package/dist/npm/cjs/modules/products/tracking.js.map +1 -0
- package/dist/npm/cjs/modules/recommendation/cart-handlers.js +52 -0
- package/dist/npm/cjs/modules/recommendation/cart-handlers.js.map +1 -0
- package/dist/npm/cjs/modules/recommendation/components/product-card-renderer.js +287 -0
- package/dist/npm/cjs/modules/recommendation/components/product-card-renderer.js.map +1 -0
- package/dist/npm/cjs/modules/recommendation/index.js +678 -0
- package/dist/npm/cjs/modules/recommendation/index.js.map +1 -0
- package/dist/npm/cjs/modules/recommendation/renderers/grid.js +21 -0
- package/dist/npm/cjs/modules/recommendation/renderers/grid.js.map +1 -0
- package/dist/npm/cjs/modules/recommendation/renderers/list.js +22 -0
- package/dist/npm/cjs/modules/recommendation/renderers/list.js.map +1 -0
- package/dist/npm/cjs/modules/recommendation/renderers/masonry.js +22 -0
- package/dist/npm/cjs/modules/recommendation/renderers/masonry.js.map +1 -0
- package/dist/npm/cjs/modules/recommendation/renderers/slider-renderer.js +145 -0
- package/dist/npm/cjs/modules/recommendation/renderers/slider-renderer.js.map +1 -0
- package/dist/npm/cjs/modules/recommendation/slider-controls.js +201 -0
- package/dist/npm/cjs/modules/recommendation/slider-controls.js.map +1 -0
- package/dist/npm/cjs/modules/recommendation/tracking.js +247 -0
- package/dist/npm/cjs/modules/recommendation/tracking.js.map +1 -0
- package/dist/npm/cjs/modules/recommendation/utils/dom.js +70 -0
- package/dist/npm/cjs/modules/recommendation/utils/dom.js.map +1 -0
- package/dist/npm/cjs/modules/recommendation/utils/format.js +13 -0
- package/dist/npm/cjs/modules/recommendation/utils/format.js.map +1 -0
- package/dist/npm/cjs/modules/recommendation/utils/index.js +22 -0
- package/dist/npm/cjs/modules/recommendation/utils/index.js.map +1 -0
- package/dist/npm/cjs/modules/renderer/helpers.js +16 -0
- package/dist/npm/cjs/modules/renderer/helpers.js.map +1 -0
- package/dist/npm/cjs/modules/renderer/index.js +52 -0
- package/dist/npm/cjs/modules/renderer/index.js.map +1 -0
- package/dist/npm/cjs/modules/renderer/style-resolver.js +11 -0
- package/dist/npm/cjs/modules/renderer/style-resolver.js.map +1 -0
- package/dist/npm/cjs/modules/renderer/styles/index.js +254 -0
- package/dist/npm/cjs/modules/renderer/styles/index.js.map +1 -0
- package/dist/npm/cjs/modules/renderer/styles.js +7 -0
- package/dist/npm/cjs/modules/renderer/styles.js.map +1 -0
- package/dist/npm/cjs/modules/renderer/utils/helpers.js +243 -0
- package/dist/npm/cjs/modules/renderer/utils/helpers.js.map +1 -0
- package/dist/npm/cjs/modules/renderer/utils/image-renderer.js +65 -0
- package/dist/npm/cjs/modules/renderer/utils/image-renderer.js.map +1 -0
- package/dist/npm/cjs/modules/renderer/utils/placement.js +34 -0
- package/dist/npm/cjs/modules/renderer/utils/placement.js.map +1 -0
- package/dist/npm/cjs/modules/renderer/utils.js +61 -0
- package/dist/npm/cjs/modules/renderer/utils.js.map +1 -0
- package/dist/npm/cjs/modules/renderer/widgets/announcement-bar.js +84 -0
- package/dist/npm/cjs/modules/renderer/widgets/announcement-bar.js.map +1 -0
- package/dist/npm/cjs/modules/renderer/widgets/cart-count.js +211 -0
- package/dist/npm/cjs/modules/renderer/widgets/cart-count.js.map +1 -0
- package/dist/npm/cjs/modules/renderer/widgets/cookie-consent.js +459 -0
- package/dist/npm/cjs/modules/renderer/widgets/cookie-consent.js.map +1 -0
- package/dist/npm/cjs/modules/renderer/widgets/countdown-timer.js +132 -0
- package/dist/npm/cjs/modules/renderer/widgets/countdown-timer.js.map +1 -0
- package/dist/npm/cjs/modules/renderer/widgets/custom.js +58 -0
- package/dist/npm/cjs/modules/renderer/widgets/custom.js.map +1 -0
- package/dist/npm/cjs/modules/renderer/widgets/embedded-card.js +97 -0
- package/dist/npm/cjs/modules/renderer/widgets/embedded-card.js.map +1 -0
- package/dist/npm/cjs/modules/renderer/widgets/exit-intent-popup.js +151 -0
- package/dist/npm/cjs/modules/renderer/widgets/exit-intent-popup.js.map +1 -0
- package/dist/npm/cjs/modules/renderer/widgets/floating-button.js +70 -0
- package/dist/npm/cjs/modules/renderer/widgets/floating-button.js.map +1 -0
- package/dist/npm/cjs/modules/renderer/widgets/helpers.js +87 -0
- package/dist/npm/cjs/modules/renderer/widgets/helpers.js.map +1 -0
- package/dist/npm/cjs/modules/renderer/widgets/index.js +39 -0
- package/dist/npm/cjs/modules/renderer/widgets/index.js.map +1 -0
- package/dist/npm/cjs/modules/renderer/widgets/inline-banner.js +124 -0
- package/dist/npm/cjs/modules/renderer/widgets/inline-banner.js.map +1 -0
- package/dist/npm/cjs/modules/renderer/widgets/newsletter.js +280 -0
- package/dist/npm/cjs/modules/renderer/widgets/newsletter.js.map +1 -0
- package/dist/npm/cjs/modules/renderer/widgets/product-view-count.js +197 -0
- package/dist/npm/cjs/modules/renderer/widgets/product-view-count.js.map +1 -0
- package/dist/npm/cjs/modules/renderer/widgets/slide-in.js +105 -0
- package/dist/npm/cjs/modules/renderer/widgets/slide-in.js.map +1 -0
- package/dist/npm/cjs/modules/renderer/widgets/sticky-footer.js +47 -0
- package/dist/npm/cjs/modules/renderer/widgets/sticky-footer.js.map +1 -0
- package/dist/npm/cjs/modules/search/cart/index.js +42 -0
- package/dist/npm/cjs/modules/search/cart/index.js.map +1 -0
- package/dist/npm/cjs/modules/search/components/index.js +13 -0
- package/dist/npm/cjs/modules/search/components/index.js.map +1 -0
- package/dist/npm/cjs/modules/search/components/search-box.js +28 -0
- package/dist/npm/cjs/modules/search/components/search-box.js.map +1 -0
- package/dist/npm/cjs/modules/search/components/search-item.js +197 -0
- package/dist/npm/cjs/modules/search/components/search-item.js.map +1 -0
- package/dist/npm/cjs/modules/search/components/suggestions.js +132 -0
- package/dist/npm/cjs/modules/search/components/suggestions.js.map +1 -0
- package/dist/npm/cjs/modules/search/index.js +646 -0
- package/dist/npm/cjs/modules/search/index.js.map +1 -0
- package/dist/npm/cjs/modules/search/renderers/position-renderers.js +229 -0
- package/dist/npm/cjs/modules/search/renderers/position-renderers.js.map +1 -0
- package/dist/npm/cjs/modules/search/renderers/results-renderer.js +180 -0
- package/dist/npm/cjs/modules/search/renderers/results-renderer.js.map +1 -0
- package/dist/npm/cjs/modules/search/services/api-service.js +121 -0
- package/dist/npm/cjs/modules/search/services/api-service.js.map +1 -0
- package/dist/npm/cjs/modules/search/services/tracking-service.js +263 -0
- package/dist/npm/cjs/modules/search/services/tracking-service.js.map +1 -0
- package/dist/npm/cjs/modules/search/styles.js +864 -0
- package/dist/npm/cjs/modules/search/styles.js.map +1 -0
- package/dist/npm/cjs/modules/search/utils/helpers.js +100 -0
- package/dist/npm/cjs/modules/search/utils/helpers.js.map +1 -0
- package/dist/npm/cjs/modules/search/utils/icons.js +41 -0
- package/dist/npm/cjs/modules/search/utils/icons.js.map +1 -0
- package/dist/npm/cjs/modules/search/utils/index.js +22 -0
- package/dist/npm/cjs/modules/search/utils/index.js.map +1 -0
- package/dist/npm/cjs/modules/search/utils/storage.js +58 -0
- package/dist/npm/cjs/modules/search/utils/storage.js.map +1 -0
- package/dist/npm/cjs/selwise.js +1160 -0
- package/dist/npm/cjs/selwise.js.map +1 -0
- package/dist/npm/cjs/sentry-test.js +118 -0
- package/dist/npm/cjs/sentry-test.js.map +1 -0
- package/dist/npm/cjs/sentry.js +451 -0
- package/dist/npm/cjs/sentry.js.map +1 -0
- package/dist/npm/cjs/shared/cart/handlers.js +259 -0
- package/dist/npm/cjs/shared/cart/handlers.js.map +1 -0
- package/dist/npm/cjs/shared/cart/index.js +23 -0
- package/dist/npm/cjs/shared/cart/index.js.map +1 -0
- package/dist/npm/cjs/shared/cart/types.js +7 -0
- package/dist/npm/cjs/shared/cart/types.js.map +1 -0
- package/dist/npm/cjs/shared/product-card/index.js +24 -0
- package/dist/npm/cjs/shared/product-card/index.js.map +1 -0
- package/dist/npm/cjs/shared/product-card/renderer.js +341 -0
- package/dist/npm/cjs/shared/product-card/renderer.js.map +1 -0
- package/dist/npm/cjs/shared/product-card/styles.js +195 -0
- package/dist/npm/cjs/shared/product-card/styles.js.map +1 -0
- package/dist/npm/cjs/shared/product-card/types.js +67 -0
- package/dist/npm/cjs/shared/product-card/types.js.map +1 -0
- package/dist/npm/cjs/types/config.js +6 -0
- package/dist/npm/cjs/types/config.js.map +1 -0
- package/dist/npm/cjs/types/experiments.js +17 -0
- package/dist/npm/cjs/types/experiments.js.map +1 -0
- package/dist/npm/cjs/types/global-api.js +3 -0
- package/dist/npm/cjs/types/global-api.js.map +1 -0
- package/dist/npm/cjs/types/index.js +27 -0
- package/dist/npm/cjs/types/index.js.map +1 -0
- package/dist/npm/cjs/types/recommendation.js +6 -0
- package/dist/npm/cjs/types/recommendation.js.map +1 -0
- package/dist/npm/cjs/types/renderer.js +6 -0
- package/dist/npm/cjs/types/renderer.js.map +1 -0
- package/dist/npm/cjs/types/search.js +6 -0
- package/dist/npm/cjs/types/search.js.map +1 -0
- package/dist/npm/cjs/utils/api-url.js +35 -0
- package/dist/npm/cjs/utils/api-url.js.map +1 -0
- package/dist/npm/cjs/utils/debounce.js +74 -0
- package/dist/npm/cjs/utils/debounce.js.map +1 -0
- package/dist/npm/cjs/utils/event-id.js +23 -0
- package/dist/npm/cjs/utils/event-id.js.map +1 -0
- package/dist/npm/cjs/utils/index.js +28 -0
- package/dist/npm/cjs/utils/index.js.map +1 -0
- package/dist/npm/cjs/utils/logger.js +74 -0
- package/dist/npm/cjs/utils/logger.js.map +1 -0
- package/dist/npm/cjs/utils/sanitize.js +159 -0
- package/dist/npm/cjs/utils/sanitize.js.map +1 -0
- package/dist/npm/cjs/utils/storage.js +285 -0
- package/dist/npm/cjs/utils/storage.js.map +1 -0
- package/dist/npm/cjs/utils/tracking-metadata.js +18 -0
- package/dist/npm/cjs/utils/tracking-metadata.js.map +1 -0
- package/dist/npm/cjs/utils/url-matcher.js +11 -0
- package/dist/npm/cjs/utils/url-matcher.js.map +1 -0
- package/dist/npm/esm/constants.d.ts +130 -0
- package/dist/npm/esm/constants.js +164 -0
- package/dist/npm/esm/constants.js.map +1 -0
- package/dist/npm/esm/core/conflict-resolver.d.ts +96 -0
- package/dist/npm/esm/core/conflict-resolver.js +198 -0
- package/dist/npm/esm/core/conflict-resolver.js.map +1 -0
- package/dist/npm/esm/core/event-batcher.d.ts +253 -0
- package/dist/npm/esm/core/event-batcher.js +973 -0
- package/dist/npm/esm/core/event-batcher.js.map +1 -0
- package/dist/npm/esm/core/experiment-overrides.d.ts +7 -0
- package/dist/npm/esm/core/experiment-overrides.js +172 -0
- package/dist/npm/esm/core/experiment-overrides.js.map +1 -0
- package/dist/npm/esm/core/experiments.d.ts +90 -0
- package/dist/npm/esm/core/experiments.js +313 -0
- package/dist/npm/esm/core/experiments.js.map +1 -0
- package/dist/npm/esm/core/frequency-caps.d.ts +124 -0
- package/dist/npm/esm/core/frequency-caps.js +292 -0
- package/dist/npm/esm/core/frequency-caps.js.map +1 -0
- package/dist/npm/esm/core/index.d.ts +10 -0
- package/dist/npm/esm/core/index.js +11 -0
- package/dist/npm/esm/core/index.js.map +1 -0
- package/dist/npm/esm/core/indexeddb-queue.d.ts +83 -0
- package/dist/npm/esm/core/indexeddb-queue.js +328 -0
- package/dist/npm/esm/core/indexeddb-queue.js.map +1 -0
- package/dist/npm/esm/core/journey-tracker.d.ts +102 -0
- package/dist/npm/esm/core/journey-tracker.js +237 -0
- package/dist/npm/esm/core/journey-tracker.js.map +1 -0
- package/dist/npm/esm/core/page-targeting/index.d.ts +8 -0
- package/dist/npm/esm/core/page-targeting/index.js +67 -0
- package/dist/npm/esm/core/page-targeting/index.js.map +1 -0
- package/dist/npm/esm/core/script-executor.d.ts +31 -0
- package/dist/npm/esm/core/script-executor.js +76 -0
- package/dist/npm/esm/core/script-executor.js.map +1 -0
- package/dist/npm/esm/core/segments.d.ts +39 -0
- package/dist/npm/esm/core/segments.js +168 -0
- package/dist/npm/esm/core/segments.js.map +1 -0
- package/dist/npm/esm/core/tracker.d.ts +182 -0
- package/dist/npm/esm/core/tracker.js +794 -0
- package/dist/npm/esm/core/tracker.js.map +1 -0
- package/dist/npm/esm/datalayer/basket.d.ts +104 -0
- package/dist/npm/esm/datalayer/basket.js +381 -0
- package/dist/npm/esm/datalayer/basket.js.map +1 -0
- package/dist/npm/esm/datalayer/cart-association.d.ts +65 -0
- package/dist/npm/esm/datalayer/cart-association.js +222 -0
- package/dist/npm/esm/datalayer/cart-association.js.map +1 -0
- package/dist/npm/esm/datalayer/checkout.d.ts +96 -0
- package/dist/npm/esm/datalayer/checkout.js +378 -0
- package/dist/npm/esm/datalayer/checkout.js.map +1 -0
- package/dist/npm/esm/datalayer/constants.d.ts +77 -0
- package/dist/npm/esm/datalayer/constants.js +160 -0
- package/dist/npm/esm/datalayer/constants.js.map +1 -0
- package/dist/npm/esm/datalayer/index.d.ts +212 -0
- package/dist/npm/esm/datalayer/index.js +991 -0
- package/dist/npm/esm/datalayer/index.js.map +1 -0
- package/dist/npm/esm/datalayer/listener.d.ts +108 -0
- package/dist/npm/esm/datalayer/listener.js +411 -0
- package/dist/npm/esm/datalayer/listener.js.map +1 -0
- package/dist/npm/esm/datalayer/page.d.ts +94 -0
- package/dist/npm/esm/datalayer/page.js +339 -0
- package/dist/npm/esm/datalayer/page.js.map +1 -0
- package/dist/npm/esm/datalayer/product.d.ts +133 -0
- package/dist/npm/esm/datalayer/product.js +513 -0
- package/dist/npm/esm/datalayer/product.js.map +1 -0
- package/dist/npm/esm/datalayer/reverse-mappings.d.ts +62 -0
- package/dist/npm/esm/datalayer/reverse-mappings.js +135 -0
- package/dist/npm/esm/datalayer/reverse-mappings.js.map +1 -0
- package/dist/npm/esm/datalayer/search.d.ts +108 -0
- package/dist/npm/esm/datalayer/search.js +359 -0
- package/dist/npm/esm/datalayer/search.js.map +1 -0
- package/dist/npm/esm/datalayer/types.d.ts +292 -0
- package/dist/npm/esm/datalayer/types.js +131 -0
- package/dist/npm/esm/datalayer/types.js.map +1 -0
- package/dist/npm/esm/datalayer/user.d.ts +104 -0
- package/dist/npm/esm/datalayer/user.js +368 -0
- package/dist/npm/esm/datalayer/user.js.map +1 -0
- package/dist/npm/esm/debug/index.d.ts +173 -0
- package/dist/npm/esm/debug/index.js +673 -0
- package/dist/npm/esm/debug/index.js.map +1 -0
- package/dist/npm/esm/entries/cdn.d.ts +1 -0
- package/dist/npm/esm/entries/cdn.js +35 -0
- package/dist/npm/esm/entries/cdn.js.map +1 -0
- package/dist/npm/esm/index.d.ts +4 -0
- package/dist/npm/esm/index.js +4 -0
- package/dist/npm/esm/index.js.map +1 -0
- package/dist/npm/esm/modules/contract/recommendation-contract.d.ts +5 -0
- package/dist/npm/esm/modules/contract/recommendation-contract.js +107 -0
- package/dist/npm/esm/modules/contract/recommendation-contract.js.map +1 -0
- package/dist/npm/esm/modules/contract/search-contract.d.ts +1 -0
- package/dist/npm/esm/modules/contract/search-contract.js +2 -0
- package/dist/npm/esm/modules/contract/search-contract.js.map +1 -0
- package/dist/npm/esm/modules/contract/tracking-contract.d.ts +1 -0
- package/dist/npm/esm/modules/contract/tracking-contract.js +2 -0
- package/dist/npm/esm/modules/contract/tracking-contract.js.map +1 -0
- package/dist/npm/esm/modules/contract/widget-contract.d.ts +1 -0
- package/dist/npm/esm/modules/contract/widget-contract.js +2 -0
- package/dist/npm/esm/modules/contract/widget-contract.js.map +1 -0
- package/dist/npm/esm/modules/products/tracking.d.ts +122 -0
- package/dist/npm/esm/modules/products/tracking.js +203 -0
- package/dist/npm/esm/modules/products/tracking.js.map +1 -0
- package/dist/npm/esm/modules/recommendation/cart-handlers.d.ts +10 -0
- package/dist/npm/esm/modules/recommendation/cart-handlers.js +49 -0
- package/dist/npm/esm/modules/recommendation/cart-handlers.js.map +1 -0
- package/dist/npm/esm/modules/recommendation/components/product-card-renderer.d.ts +37 -0
- package/dist/npm/esm/modules/recommendation/components/product-card-renderer.js +281 -0
- package/dist/npm/esm/modules/recommendation/components/product-card-renderer.js.map +1 -0
- package/dist/npm/esm/modules/recommendation/index.d.ts +11 -0
- package/dist/npm/esm/modules/recommendation/index.js +674 -0
- package/dist/npm/esm/modules/recommendation/index.js.map +1 -0
- package/dist/npm/esm/modules/recommendation/renderers/grid.d.ts +5 -0
- package/dist/npm/esm/modules/recommendation/renderers/grid.js +18 -0
- package/dist/npm/esm/modules/recommendation/renderers/grid.js.map +1 -0
- package/dist/npm/esm/modules/recommendation/renderers/list.d.ts +5 -0
- package/dist/npm/esm/modules/recommendation/renderers/list.js +19 -0
- package/dist/npm/esm/modules/recommendation/renderers/list.js.map +1 -0
- package/dist/npm/esm/modules/recommendation/renderers/masonry.d.ts +5 -0
- package/dist/npm/esm/modules/recommendation/renderers/masonry.js +19 -0
- package/dist/npm/esm/modules/recommendation/renderers/masonry.js.map +1 -0
- package/dist/npm/esm/modules/recommendation/renderers/slider-renderer.d.ts +10 -0
- package/dist/npm/esm/modules/recommendation/renderers/slider-renderer.js +140 -0
- package/dist/npm/esm/modules/recommendation/renderers/slider-renderer.js.map +1 -0
- package/dist/npm/esm/modules/recommendation/slider-controls.d.ts +17 -0
- package/dist/npm/esm/modules/recommendation/slider-controls.js +187 -0
- package/dist/npm/esm/modules/recommendation/slider-controls.js.map +1 -0
- package/dist/npm/esm/modules/recommendation/tracking.d.ts +28 -0
- package/dist/npm/esm/modules/recommendation/tracking.js +237 -0
- package/dist/npm/esm/modules/recommendation/tracking.js.map +1 -0
- package/dist/npm/esm/modules/recommendation/utils/dom.d.ts +10 -0
- package/dist/npm/esm/modules/recommendation/utils/dom.js +63 -0
- package/dist/npm/esm/modules/recommendation/utils/dom.js.map +1 -0
- package/dist/npm/esm/modules/recommendation/utils/format.d.ts +4 -0
- package/dist/npm/esm/modules/recommendation/utils/format.js +10 -0
- package/dist/npm/esm/modules/recommendation/utils/format.js.map +1 -0
- package/dist/npm/esm/modules/recommendation/utils/index.d.ts +5 -0
- package/dist/npm/esm/modules/recommendation/utils/index.js +6 -0
- package/dist/npm/esm/modules/recommendation/utils/index.js.map +1 -0
- package/dist/npm/esm/modules/renderer/helpers.d.ts +5 -0
- package/dist/npm/esm/modules/renderer/helpers.js +6 -0
- package/dist/npm/esm/modules/renderer/helpers.js.map +1 -0
- package/dist/npm/esm/modules/renderer/index.d.ts +8 -0
- package/dist/npm/esm/modules/renderer/index.js +48 -0
- package/dist/npm/esm/modules/renderer/index.js.map +1 -0
- package/dist/npm/esm/modules/renderer/style-resolver.d.ts +1 -0
- package/dist/npm/esm/modules/renderer/style-resolver.js +8 -0
- package/dist/npm/esm/modules/renderer/style-resolver.js.map +1 -0
- package/dist/npm/esm/modules/renderer/styles/index.d.ts +12 -0
- package/dist/npm/esm/modules/renderer/styles/index.js +250 -0
- package/dist/npm/esm/modules/renderer/styles/index.js.map +1 -0
- package/dist/npm/esm/modules/renderer/styles.d.ts +1 -0
- package/dist/npm/esm/modules/renderer/styles.js +2 -0
- package/dist/npm/esm/modules/renderer/styles.js.map +1 -0
- package/dist/npm/esm/modules/renderer/utils/helpers.d.ts +58 -0
- package/dist/npm/esm/modules/renderer/utils/helpers.js +225 -0
- package/dist/npm/esm/modules/renderer/utils/helpers.js.map +1 -0
- package/dist/npm/esm/modules/renderer/utils/image-renderer.d.ts +17 -0
- package/dist/npm/esm/modules/renderer/utils/image-renderer.js +60 -0
- package/dist/npm/esm/modules/renderer/utils/image-renderer.js.map +1 -0
- package/dist/npm/esm/modules/renderer/utils/placement.d.ts +6 -0
- package/dist/npm/esm/modules/renderer/utils/placement.js +31 -0
- package/dist/npm/esm/modules/renderer/utils/placement.js.map +1 -0
- package/dist/npm/esm/modules/renderer/utils.d.ts +11 -0
- package/dist/npm/esm/modules/renderer/utils.js +44 -0
- package/dist/npm/esm/modules/renderer/utils.js.map +1 -0
- package/dist/npm/esm/modules/renderer/widgets/announcement-bar.d.ts +5 -0
- package/dist/npm/esm/modules/renderer/widgets/announcement-bar.js +81 -0
- package/dist/npm/esm/modules/renderer/widgets/announcement-bar.js.map +1 -0
- package/dist/npm/esm/modules/renderer/widgets/cart-count.d.ts +6 -0
- package/dist/npm/esm/modules/renderer/widgets/cart-count.js +208 -0
- package/dist/npm/esm/modules/renderer/widgets/cart-count.js.map +1 -0
- package/dist/npm/esm/modules/renderer/widgets/cookie-consent.d.ts +18 -0
- package/dist/npm/esm/modules/renderer/widgets/cookie-consent.js +454 -0
- package/dist/npm/esm/modules/renderer/widgets/cookie-consent.js.map +1 -0
- package/dist/npm/esm/modules/renderer/widgets/countdown-timer.d.ts +5 -0
- package/dist/npm/esm/modules/renderer/widgets/countdown-timer.js +129 -0
- package/dist/npm/esm/modules/renderer/widgets/countdown-timer.js.map +1 -0
- package/dist/npm/esm/modules/renderer/widgets/custom.d.ts +5 -0
- package/dist/npm/esm/modules/renderer/widgets/custom.js +55 -0
- package/dist/npm/esm/modules/renderer/widgets/custom.js.map +1 -0
- package/dist/npm/esm/modules/renderer/widgets/embedded-card.d.ts +5 -0
- package/dist/npm/esm/modules/renderer/widgets/embedded-card.js +94 -0
- package/dist/npm/esm/modules/renderer/widgets/embedded-card.js.map +1 -0
- package/dist/npm/esm/modules/renderer/widgets/exit-intent-popup.d.ts +6 -0
- package/dist/npm/esm/modules/renderer/widgets/exit-intent-popup.js +147 -0
- package/dist/npm/esm/modules/renderer/widgets/exit-intent-popup.js.map +1 -0
- package/dist/npm/esm/modules/renderer/widgets/floating-button.d.ts +5 -0
- package/dist/npm/esm/modules/renderer/widgets/floating-button.js +67 -0
- package/dist/npm/esm/modules/renderer/widgets/floating-button.js.map +1 -0
- package/dist/npm/esm/modules/renderer/widgets/helpers.d.ts +29 -0
- package/dist/npm/esm/modules/renderer/widgets/helpers.js +82 -0
- package/dist/npm/esm/modules/renderer/widgets/helpers.js.map +1 -0
- package/dist/npm/esm/modules/renderer/widgets/index.d.ts +17 -0
- package/dist/npm/esm/modules/renderer/widgets/index.js +19 -0
- package/dist/npm/esm/modules/renderer/widgets/index.js.map +1 -0
- package/dist/npm/esm/modules/renderer/widgets/inline-banner.d.ts +5 -0
- package/dist/npm/esm/modules/renderer/widgets/inline-banner.js +121 -0
- package/dist/npm/esm/modules/renderer/widgets/inline-banner.js.map +1 -0
- package/dist/npm/esm/modules/renderer/widgets/newsletter.d.ts +6 -0
- package/dist/npm/esm/modules/renderer/widgets/newsletter.js +277 -0
- package/dist/npm/esm/modules/renderer/widgets/newsletter.js.map +1 -0
- package/dist/npm/esm/modules/renderer/widgets/product-view-count.d.ts +6 -0
- package/dist/npm/esm/modules/renderer/widgets/product-view-count.js +194 -0
- package/dist/npm/esm/modules/renderer/widgets/product-view-count.js.map +1 -0
- package/dist/npm/esm/modules/renderer/widgets/slide-in.d.ts +5 -0
- package/dist/npm/esm/modules/renderer/widgets/slide-in.js +102 -0
- package/dist/npm/esm/modules/renderer/widgets/slide-in.js.map +1 -0
- package/dist/npm/esm/modules/renderer/widgets/sticky-footer.d.ts +5 -0
- package/dist/npm/esm/modules/renderer/widgets/sticky-footer.js +44 -0
- package/dist/npm/esm/modules/renderer/widgets/sticky-footer.js.map +1 -0
- package/dist/npm/esm/modules/search/cart/index.d.ts +26 -0
- package/dist/npm/esm/modules/search/cart/index.js +39 -0
- package/dist/npm/esm/modules/search/cart/index.js.map +1 -0
- package/dist/npm/esm/modules/search/components/index.d.ts +6 -0
- package/dist/npm/esm/modules/search/components/index.js +7 -0
- package/dist/npm/esm/modules/search/components/index.js.map +1 -0
- package/dist/npm/esm/modules/search/components/search-box.d.ts +11 -0
- package/dist/npm/esm/modules/search/components/search-box.js +25 -0
- package/dist/npm/esm/modules/search/components/search-box.js.map +1 -0
- package/dist/npm/esm/modules/search/components/search-item.d.ts +20 -0
- package/dist/npm/esm/modules/search/components/search-item.js +193 -0
- package/dist/npm/esm/modules/search/components/search-item.js.map +1 -0
- package/dist/npm/esm/modules/search/components/suggestions.d.ts +10 -0
- package/dist/npm/esm/modules/search/components/suggestions.js +129 -0
- package/dist/npm/esm/modules/search/components/suggestions.js.map +1 -0
- package/dist/npm/esm/modules/search/index.d.ts +67 -0
- package/dist/npm/esm/modules/search/index.js +642 -0
- package/dist/npm/esm/modules/search/index.js.map +1 -0
- package/dist/npm/esm/modules/search/renderers/position-renderers.d.ts +23 -0
- package/dist/npm/esm/modules/search/renderers/position-renderers.js +221 -0
- package/dist/npm/esm/modules/search/renderers/position-renderers.js.map +1 -0
- package/dist/npm/esm/modules/search/renderers/results-renderer.d.ts +20 -0
- package/dist/npm/esm/modules/search/renderers/results-renderer.js +176 -0
- package/dist/npm/esm/modules/search/renderers/results-renderer.js.map +1 -0
- package/dist/npm/esm/modules/search/services/api-service.d.ts +18 -0
- package/dist/npm/esm/modules/search/services/api-service.js +115 -0
- package/dist/npm/esm/modules/search/services/api-service.js.map +1 -0
- package/dist/npm/esm/modules/search/services/tracking-service.d.ts +16 -0
- package/dist/npm/esm/modules/search/services/tracking-service.js +250 -0
- package/dist/npm/esm/modules/search/services/tracking-service.js.map +1 -0
- package/dist/npm/esm/modules/search/styles.d.ts +13 -0
- package/dist/npm/esm/modules/search/styles.js +860 -0
- package/dist/npm/esm/modules/search/styles.js.map +1 -0
- package/dist/npm/esm/modules/search/utils/helpers.d.ts +24 -0
- package/dist/npm/esm/modules/search/utils/helpers.js +93 -0
- package/dist/npm/esm/modules/search/utils/helpers.js.map +1 -0
- package/dist/npm/esm/modules/search/utils/icons.d.ts +16 -0
- package/dist/npm/esm/modules/search/utils/icons.js +36 -0
- package/dist/npm/esm/modules/search/utils/icons.js.map +1 -0
- package/dist/npm/esm/modules/search/utils/index.d.ts +6 -0
- package/dist/npm/esm/modules/search/utils/index.js +7 -0
- package/dist/npm/esm/modules/search/utils/index.js.map +1 -0
- package/dist/npm/esm/modules/search/utils/storage.d.ts +7 -0
- package/dist/npm/esm/modules/search/utils/storage.js +52 -0
- package/dist/npm/esm/modules/search/utils/storage.js.map +1 -0
- package/dist/npm/esm/package.json +1 -0
- package/dist/npm/esm/selwise.d.ts +209 -0
- package/dist/npm/esm/selwise.js +1123 -0
- package/dist/npm/esm/selwise.js.map +1 -0
- package/dist/npm/esm/sentry-test.d.ts +45 -0
- package/dist/npm/esm/sentry-test.js +109 -0
- package/dist/npm/esm/sentry-test.js.map +1 -0
- package/dist/npm/esm/sentry.d.ts +86 -0
- package/dist/npm/esm/sentry.js +441 -0
- package/dist/npm/esm/sentry.js.map +1 -0
- package/dist/npm/esm/shared/cart/handlers.d.ts +46 -0
- package/dist/npm/esm/shared/cart/handlers.js +249 -0
- package/dist/npm/esm/shared/cart/handlers.js.map +1 -0
- package/dist/npm/esm/shared/cart/index.d.ts +6 -0
- package/dist/npm/esm/shared/cart/index.js +7 -0
- package/dist/npm/esm/shared/cart/index.js.map +1 -0
- package/dist/npm/esm/shared/cart/types.d.ts +30 -0
- package/dist/npm/esm/shared/cart/types.js +6 -0
- package/dist/npm/esm/shared/cart/types.js.map +1 -0
- package/dist/npm/esm/shared/product-card/index.d.ts +7 -0
- package/dist/npm/esm/shared/product-card/index.js +8 -0
- package/dist/npm/esm/shared/product-card/index.js.map +1 -0
- package/dist/npm/esm/shared/product-card/renderer.d.ts +35 -0
- package/dist/npm/esm/shared/product-card/renderer.js +334 -0
- package/dist/npm/esm/shared/product-card/renderer.js.map +1 -0
- package/dist/npm/esm/shared/product-card/styles.d.ts +17 -0
- package/dist/npm/esm/shared/product-card/styles.js +190 -0
- package/dist/npm/esm/shared/product-card/styles.js.map +1 -0
- package/dist/npm/esm/shared/product-card/types.d.ts +84 -0
- package/dist/npm/esm/shared/product-card/types.js +63 -0
- package/dist/npm/esm/shared/product-card/types.js.map +1 -0
- package/dist/npm/esm/types/config.d.ts +26 -0
- package/dist/npm/esm/types/config.js +5 -0
- package/dist/npm/esm/types/config.js.map +1 -0
- package/dist/npm/esm/types/experiments.d.ts +47 -0
- package/dist/npm/esm/types/experiments.js +14 -0
- package/dist/npm/esm/types/experiments.js.map +1 -0
- package/dist/npm/esm/types/global-api.d.ts +40 -0
- package/dist/npm/esm/types/global-api.js +2 -0
- package/dist/npm/esm/types/global-api.js.map +1 -0
- package/dist/npm/esm/types/index.d.ts +9 -0
- package/dist/npm/esm/types/index.js +11 -0
- package/dist/npm/esm/types/index.js.map +1 -0
- package/dist/npm/esm/types/recommendation.d.ts +186 -0
- package/dist/npm/esm/types/recommendation.js +5 -0
- package/dist/npm/esm/types/recommendation.js.map +1 -0
- package/dist/npm/esm/types/renderer.d.ts +99 -0
- package/dist/npm/esm/types/renderer.js +5 -0
- package/dist/npm/esm/types/renderer.js.map +1 -0
- package/dist/npm/esm/types/search.d.ts +186 -0
- package/dist/npm/esm/types/search.js +5 -0
- package/dist/npm/esm/types/search.js.map +1 -0
- package/dist/npm/esm/utils/api-url.d.ts +1 -0
- package/dist/npm/esm/utils/api-url.js +32 -0
- package/dist/npm/esm/utils/api-url.js.map +1 -0
- package/dist/npm/esm/utils/debounce.d.ts +27 -0
- package/dist/npm/esm/utils/debounce.js +70 -0
- package/dist/npm/esm/utils/debounce.js.map +1 -0
- package/dist/npm/esm/utils/event-id.d.ts +5 -0
- package/dist/npm/esm/utils/event-id.js +20 -0
- package/dist/npm/esm/utils/event-id.js.map +1 -0
- package/dist/npm/esm/utils/index.d.ts +11 -0
- package/dist/npm/esm/utils/index.js +12 -0
- package/dist/npm/esm/utils/index.js.map +1 -0
- package/dist/npm/esm/utils/logger.d.ts +31 -0
- package/dist/npm/esm/utils/logger.js +66 -0
- package/dist/npm/esm/utils/logger.js.map +1 -0
- package/dist/npm/esm/utils/sanitize.d.ts +38 -0
- package/dist/npm/esm/utils/sanitize.js +148 -0
- package/dist/npm/esm/utils/sanitize.js.map +1 -0
- package/dist/npm/esm/utils/storage.d.ts +72 -0
- package/dist/npm/esm/utils/storage.js +271 -0
- package/dist/npm/esm/utils/storage.js.map +1 -0
- package/dist/npm/esm/utils/tracking-metadata.d.ts +1 -0
- package/dist/npm/esm/utils/tracking-metadata.js +15 -0
- package/dist/npm/esm/utils/tracking-metadata.js.map +1 -0
- package/dist/npm/esm/utils/url-matcher.d.ts +4 -0
- package/dist/npm/esm/utils/url-matcher.js +8 -0
- package/dist/npm/esm/utils/url-matcher.js.map +1 -0
- package/package.json +62 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import Selwise from '../selwise.js';
|
|
2
|
+
import { resolveApiUrl } from '../utils/api-url.js';
|
|
3
|
+
function isDevelopmentMode(scriptTag) {
|
|
4
|
+
if (scriptTag.getAttribute('data-env') === 'development') {
|
|
5
|
+
return true;
|
|
6
|
+
}
|
|
7
|
+
if (typeof process !== 'undefined') {
|
|
8
|
+
return process.env?.NODE_ENV === 'development';
|
|
9
|
+
}
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
function autoInitFromCurrentScript() {
|
|
13
|
+
if (typeof document === 'undefined')
|
|
14
|
+
return;
|
|
15
|
+
const scriptTag = document.currentScript;
|
|
16
|
+
if (!scriptTag)
|
|
17
|
+
return;
|
|
18
|
+
const siteKey = scriptTag.getAttribute('data-site-key');
|
|
19
|
+
const apiUrl = resolveApiUrl(scriptTag.getAttribute('data-api-url'));
|
|
20
|
+
if (!siteKey)
|
|
21
|
+
return;
|
|
22
|
+
const widget = new Selwise();
|
|
23
|
+
void widget.init({ siteKey, apiUrl });
|
|
24
|
+
if (isDevelopmentMode(scriptTag)) {
|
|
25
|
+
void import('../sentry-test.js')
|
|
26
|
+
.then(({ exposeSentryTests }) => {
|
|
27
|
+
exposeSentryTests();
|
|
28
|
+
})
|
|
29
|
+
.catch(() => {
|
|
30
|
+
// Silently fail if sentry-test module is not available
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
autoInitFromCurrentScript();
|
|
35
|
+
//# sourceMappingURL=cdn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cdn.js","sourceRoot":"","sources":["../../../../src/entries/cdn.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,SAAS,iBAAiB,CAAC,SAA4B;IACrD,IAAI,SAAS,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,aAAa,EAAE,CAAC;QACzD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE,CAAC;QACnC,OAAO,OAAO,CAAC,GAAG,EAAE,QAAQ,KAAK,aAAa,CAAC;IACjD,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,yBAAyB;IAChC,IAAI,OAAO,QAAQ,KAAK,WAAW;QAAE,OAAO;IAE5C,MAAM,SAAS,GAAG,QAAQ,CAAC,aAAyC,CAAC;IACrE,IAAI,CAAC,SAAS;QAAE,OAAO;IAEvB,MAAM,OAAO,GAAG,SAAS,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;IACxD,MAAM,MAAM,GAAG,aAAa,CAAC,SAAS,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC,CAAC;IAErE,IAAI,CAAC,OAAO;QAAE,OAAO;IAErB,MAAM,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;IAC7B,KAAK,MAAM,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IAEtC,IAAI,iBAAiB,CAAC,SAAS,CAAC,EAAE,CAAC;QACjC,KAAK,MAAM,CAAC,gBAAgB,CAAC;aAC1B,IAAI,CAAC,CAAC,EAAE,iBAAiB,EAAE,EAAE,EAAE;YAC9B,iBAAiB,EAAE,CAAC;QACtB,CAAC,CAAC;aACD,KAAK,CAAC,GAAG,EAAE;YACV,uDAAuD;QACzD,CAAC,CAAC,CAAC;IACP,CAAC;AACH,CAAC;AAED,yBAAyB,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { RECOMMENDATION_STRATEGIES, RECOMMENDATION_DISPLAY_TYPES, RECOMMENDATION_TRIGGERS, RECOMMENDATION_INSERT_POSITIONS, RECOMMENDATION_PLATFORMS, RECOMMENDATION_STYLE_CONFIGS, getDefaultRecommendationConfig, validateRecommendationConfig, sanitizeRecommendationConfig } from '@selwise/recommendation-contract';
|
|
2
|
+
import type { RecommendationStrategy, RecommendationDisplayType, RecommendationTrigger, RecommendationInsertPosition, RecommendationPlatform } from '@selwise/recommendation-contract';
|
|
3
|
+
import type { RecommendationWidget } from '../../types';
|
|
4
|
+
export declare function resolveRecommendationConfig(rawWidget: unknown): RecommendationWidget | null;
|
|
5
|
+
export { RECOMMENDATION_STRATEGIES, RECOMMENDATION_DISPLAY_TYPES, RECOMMENDATION_TRIGGERS, RECOMMENDATION_INSERT_POSITIONS, RECOMMENDATION_PLATFORMS, RECOMMENDATION_STYLE_CONFIGS, getDefaultRecommendationConfig, validateRecommendationConfig, sanitizeRecommendationConfig, type RecommendationStrategy, type RecommendationDisplayType, type RecommendationTrigger, type RecommendationInsertPosition, type RecommendationPlatform, };
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { RECOMMENDATION_STRATEGIES, RECOMMENDATION_DISPLAY_TYPES, RECOMMENDATION_TRIGGERS, RECOMMENDATION_INSERT_POSITIONS, RECOMMENDATION_PLATFORMS, RECOMMENDATION_STYLE_CONFIGS, getDefaultRecommendationConfig, validateRecommendationConfig, sanitizeRecommendationConfig, } from '@selwise/recommendation-contract';
|
|
2
|
+
function isRecord(value) {
|
|
3
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
4
|
+
}
|
|
5
|
+
export function resolveRecommendationConfig(rawWidget) {
|
|
6
|
+
if (!isRecord(rawWidget)) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
if (typeof rawWidget.id !== 'string' || rawWidget.id.trim().length === 0) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
if (typeof rawWidget.name !== 'string' || rawWidget.name.trim().length === 0) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
const validationInput = {
|
|
16
|
+
strategy: rawWidget.strategy,
|
|
17
|
+
displayType: rawWidget.displayType,
|
|
18
|
+
trigger: rawWidget.trigger,
|
|
19
|
+
insertPosition: rawWidget.insertPosition,
|
|
20
|
+
cartPlatform: rawWidget.cartPlatform,
|
|
21
|
+
maxProducts: rawWidget.maxProducts,
|
|
22
|
+
productsPerRow: rawWidget.productsPerRow,
|
|
23
|
+
autoplay: rawWidget.autoplay,
|
|
24
|
+
autoplaySpeed: rawWidget.autoplaySpeed,
|
|
25
|
+
loop: rawWidget.loop,
|
|
26
|
+
pauseOnHover: rawWidget.pauseOnHover,
|
|
27
|
+
slidesPerView: rawWidget.slidesPerView,
|
|
28
|
+
slidesPerViewTablet: rawWidget.slidesPerViewTablet,
|
|
29
|
+
slidesPerViewMobile: rawWidget.slidesPerViewMobile,
|
|
30
|
+
slideGap: rawWidget.slideGap,
|
|
31
|
+
title: rawWidget.title,
|
|
32
|
+
subtitle: rawWidget.subtitle,
|
|
33
|
+
showOnAllPages: rawWidget.showOnAllPages,
|
|
34
|
+
includeUrls: rawWidget.includeUrls,
|
|
35
|
+
excludeUrls: rawWidget.excludeUrls,
|
|
36
|
+
containerSelector: rawWidget.containerSelector,
|
|
37
|
+
addToCartEnabled: rawWidget.addToCartEnabled,
|
|
38
|
+
addToCartConfig: rawWidget.addToCartConfig,
|
|
39
|
+
triggerConfig: rawWidget.triggerConfig,
|
|
40
|
+
arrowStyles: rawWidget.arrowStyles,
|
|
41
|
+
dotStyles: rawWidget.dotStyles,
|
|
42
|
+
titleStyles: rawWidget.titleStyles,
|
|
43
|
+
subtitleStyles: rawWidget.subtitleStyles,
|
|
44
|
+
containerStyles: rawWidget.containerStyles,
|
|
45
|
+
};
|
|
46
|
+
const validation = validateRecommendationConfig(validationInput);
|
|
47
|
+
if (!validation.valid) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
const normalized = sanitizeRecommendationConfig(validationInput);
|
|
51
|
+
const pageTargetingJson = {
|
|
52
|
+
showOnAllPages: normalized.showOnAllPages,
|
|
53
|
+
includeUrls: normalized.includeUrls,
|
|
54
|
+
excludeUrls: normalized.excludeUrls,
|
|
55
|
+
containerSelector: normalized.containerSelector,
|
|
56
|
+
insertPosition: normalized.insertPosition,
|
|
57
|
+
};
|
|
58
|
+
return {
|
|
59
|
+
id: rawWidget.id,
|
|
60
|
+
name: rawWidget.name,
|
|
61
|
+
strategy: normalized.strategy,
|
|
62
|
+
displayType: normalized.displayType,
|
|
63
|
+
title: normalized.title,
|
|
64
|
+
subtitle: normalized.subtitle,
|
|
65
|
+
maxProducts: normalized.maxProducts,
|
|
66
|
+
slidesPerView: normalized.slidesPerView,
|
|
67
|
+
slidesPerViewMobile: normalized.slidesPerViewMobile,
|
|
68
|
+
slidesPerViewTablet: normalized.slidesPerViewTablet,
|
|
69
|
+
slideGap: normalized.slideGap,
|
|
70
|
+
autoplay: normalized.autoplay,
|
|
71
|
+
autoplaySpeed: normalized.autoplaySpeed,
|
|
72
|
+
loop: normalized.loop,
|
|
73
|
+
pauseOnHover: normalized.pauseOnHover,
|
|
74
|
+
arrowStyles: normalized.arrowStyles,
|
|
75
|
+
dotStyles: normalized.dotStyles,
|
|
76
|
+
titleStyles: normalized.titleStyles,
|
|
77
|
+
subtitleStyles: normalized.subtitleStyles,
|
|
78
|
+
containerStyles: normalized.containerStyles,
|
|
79
|
+
containerSelector: normalized.containerSelector,
|
|
80
|
+
insertPosition: normalized.insertPosition,
|
|
81
|
+
addToCartEnabled: normalized.addToCartEnabled,
|
|
82
|
+
cartPlatform: normalized.cartPlatform,
|
|
83
|
+
addToCartConfig: normalized.addToCartConfig,
|
|
84
|
+
cartButtonText: typeof normalized.addToCartConfig?.buttonText === 'string'
|
|
85
|
+
? normalized.addToCartConfig.buttonText
|
|
86
|
+
: undefined,
|
|
87
|
+
customCartScript: typeof rawWidget.customCartScript === 'string'
|
|
88
|
+
? rawWidget.customCartScript
|
|
89
|
+
: typeof normalized.addToCartConfig?.customScript === 'string'
|
|
90
|
+
? normalized.addToCartConfig.customScript
|
|
91
|
+
: undefined,
|
|
92
|
+
customCSS: typeof rawWidget.customCSS === 'string' ? rawWidget.customCSS : undefined,
|
|
93
|
+
customJS: typeof rawWidget.customJS === 'string' ? rawWidget.customJS : undefined,
|
|
94
|
+
productCard: isRecord(rawWidget.productCard)
|
|
95
|
+
? rawWidget.productCard
|
|
96
|
+
: undefined,
|
|
97
|
+
pageTargetingJson,
|
|
98
|
+
segmentTargetingMode: rawWidget.segmentTargetingMode === 'include' || rawWidget.segmentTargetingMode === 'exclude'
|
|
99
|
+
? rawWidget.segmentTargetingMode
|
|
100
|
+
: 'all',
|
|
101
|
+
segmentIds: Array.isArray(rawWidget.segmentIds)
|
|
102
|
+
? rawWidget.segmentIds.filter((segmentId) => typeof segmentId === 'string')
|
|
103
|
+
: [],
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
export { RECOMMENDATION_STRATEGIES, RECOMMENDATION_DISPLAY_TYPES, RECOMMENDATION_TRIGGERS, RECOMMENDATION_INSERT_POSITIONS, RECOMMENDATION_PLATFORMS, RECOMMENDATION_STYLE_CONFIGS, getDefaultRecommendationConfig, validateRecommendationConfig, sanitizeRecommendationConfig, };
|
|
107
|
+
//# sourceMappingURL=recommendation-contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recommendation-contract.js","sourceRoot":"","sources":["../../../../../src/modules/contract/recommendation-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,4BAA4B,EAC5B,uBAAuB,EACvB,+BAA+B,EAC/B,wBAAwB,EACxB,4BAA4B,EAC5B,8BAA8B,EAC9B,4BAA4B,EAC5B,4BAA4B,GAC7B,MAAM,kCAAkC,CAAC;AAU1C,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,C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E,CAAC,CAAC,SAAS;QACb,iBAAiB;QACjB,oBAAoB,EAClB,SAAS,CAAC,oBAAoB,KAAK,SAAS,IAAI,SAAS,CAAC,oBAAoB,KAAK,SAAS;YAC1F,CAAC,CAAC,SAAS,CAAC,oBAAoB;YAChC,CAAC,CAAC,KAAK;QACX,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC;YAC7C,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,OAAO,SAAS,KAAK,QAAQ,CAAC;YAC3E,CAAC,CAAC,EAAE;KACP,CAAC;AACJ,CAAC;AAED,OAAO,EACL,yBAAyB,EACzB,4BAA4B,EAC5B,uBAAuB,EACvB,+BAA+B,EAC/B,wBAAwB,EACxB,4BAA4B,EAC5B,8BAA8B,EAC9B,4BAA4B,EAC5B,4BAA4B,GAM7B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SEARCH_POSITIONS, SEARCH_FLOATING_POSITIONS, CATEGORY_DISPLAY_MODES, SEARCH_STYLE_CONFIGS, SUGGESTION_STYLE_CONFIGS, getDefaultSearchStyles, getDefaultSuggestionStyles, getAllowedSearchStyleKeys, getAllowedSuggestionStyleKeys, validateSearchConfig, validateSearchStyles, sanitizeSearchStyles, sanitizeSuggestionStyles, type SearchPosition, type SearchFloatingPosition, type CategoryDisplayMode, } from '@selwise/search-contract';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { SEARCH_POSITIONS, SEARCH_FLOATING_POSITIONS, CATEGORY_DISPLAY_MODES, SEARCH_STYLE_CONFIGS, SUGGESTION_STYLE_CONFIGS, getDefaultSearchStyles, getDefaultSuggestionStyles, getAllowedSearchStyleKeys, getAllowedSuggestionStyleKeys, validateSearchConfig, validateSearchStyles, sanitizeSearchStyles, sanitizeSuggestionStyles, } from '@selwise/search-contract';
|
|
2
|
+
//# sourceMappingURL=search-contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-contract.js","sourceRoot":"","sources":["../../../../../src/modules/contract/search-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,yBAAyB,EACzB,sBAAsB,EACtB,oBAAoB,EACpB,wBAAwB,EACxB,sBAAsB,EACtB,0BAA0B,EAC1B,yBAAyB,EACzB,6BAA6B,EAC7B,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,wBAAwB,GAIzB,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CANONICAL_EVENTS, EVENT_CATEGORIES, DEFAULT_PAGE_TYPE_PATTERNS, TRACKING_MODULES, COOKIE_CONSENT_DEFAULTS, FREQUENCY_CAP_INTERVALS, validateCanonicalEvent, validateDataLayerConfig, sanitizeDataLayerConfig, validateFrequencyInterval, validateFrequencyCapPayload, type CanonicalEventName, } from '@selwise/tracking-contract';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { CANONICAL_EVENTS, EVENT_CATEGORIES, DEFAULT_PAGE_TYPE_PATTERNS, TRACKING_MODULES, COOKIE_CONSENT_DEFAULTS, FREQUENCY_CAP_INTERVALS, validateCanonicalEvent, validateDataLayerConfig, sanitizeDataLayerConfig, validateFrequencyInterval, validateFrequencyCapPayload, } from '@selwise/tracking-contract';
|
|
2
|
+
//# sourceMappingURL=tracking-contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracking-contract.js","sourceRoot":"","sources":["../../../../../src/modules/contract/tracking-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,0BAA0B,EAC1B,gBAAgB,EAChB,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,yBAAyB,EACzB,2BAA2B,GAE5B,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TYPE_STYLE_CONFIGS, getDefaultStyles, sanitizeStyles, isWidgetType, resolveInlineBannerLayout, type WidgetType, type InlineBannerLayoutInput, type InlineBannerLayout, } from '@selwise/widget-contract';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"widget-contract.js","sourceRoot":"","sources":["../../../../../src/modules/contract/widget-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,yBAAyB,GAI1B,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import type { Product } from '../../types/recommendation';
|
|
2
|
+
/**
|
|
3
|
+
* Product Tracker - Standardized product event tracking
|
|
4
|
+
*
|
|
5
|
+
* Ensures consistent product identification across all tracking events.
|
|
6
|
+
* Always uses itemCode as the primary product identifier.
|
|
7
|
+
*/
|
|
8
|
+
export type ProductEventSource = 'recommendation' | 'search' | 'category' | 'product_page' | 'cart' | 'organic';
|
|
9
|
+
export interface ProductEventContext {
|
|
10
|
+
/** Source of the product event */
|
|
11
|
+
source: ProductEventSource;
|
|
12
|
+
/** Widget ID for recommendation events */
|
|
13
|
+
widgetId?: string;
|
|
14
|
+
/** Position of product in list (for analytics) */
|
|
15
|
+
position?: number;
|
|
16
|
+
/** Search query (for search events) */
|
|
17
|
+
query?: string;
|
|
18
|
+
/** List type (e.g., 'bestsellers', 'new_arrivals') */
|
|
19
|
+
listType?: string;
|
|
20
|
+
/** Additional custom metadata */
|
|
21
|
+
customData?: Record<string, any>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Extract itemCode from product object
|
|
25
|
+
* Uses canonical product identifier fields.
|
|
26
|
+
*
|
|
27
|
+
* @param product - Product object from API
|
|
28
|
+
* @returns The merchant's product ID (itemCode)
|
|
29
|
+
*/
|
|
30
|
+
export declare function getProductItemCode(product: Product | string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Extract product UUID (internal database ID)
|
|
33
|
+
* Only for internal use - never send in tracking events
|
|
34
|
+
*
|
|
35
|
+
* @param product - Product object from API
|
|
36
|
+
* @returns Internal UUID or undefined
|
|
37
|
+
*/
|
|
38
|
+
export declare function getProductUuid(product: Product): string | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Track a product view/impression event
|
|
41
|
+
*
|
|
42
|
+
* @param product - Product object from API
|
|
43
|
+
* @param context - Event context (source, position, etc.)
|
|
44
|
+
* @returns Promise that resolves when event is tracked
|
|
45
|
+
*/
|
|
46
|
+
export declare function trackProductView(product: Product | string, context: ProductEventContext): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Track a product click event
|
|
49
|
+
*
|
|
50
|
+
* @param product - Product object from API
|
|
51
|
+
* @param context - Event context (source, position, etc.)
|
|
52
|
+
* @returns Promise that resolves when event is tracked
|
|
53
|
+
*/
|
|
54
|
+
export declare function trackProductClick(product: Product | string, context: ProductEventContext): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Track an add_to_cart event
|
|
57
|
+
*
|
|
58
|
+
* @param product - Product object from API
|
|
59
|
+
* @param quantity - Quantity added (default: 1)
|
|
60
|
+
* @param context - Event context (source, widgetId, etc.)
|
|
61
|
+
* @returns Promise that resolves when event is tracked
|
|
62
|
+
*/
|
|
63
|
+
export declare function trackAddToCart(product: Product | string, quantity: number | undefined, context: ProductEventContext): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Track product impression (for analytics/funnel)
|
|
66
|
+
*
|
|
67
|
+
* @param products - Array of products being viewed
|
|
68
|
+
* @param context - Event context (source, listType, etc.)
|
|
69
|
+
* @returns Promise that resolves when events are tracked
|
|
70
|
+
*/
|
|
71
|
+
export declare function trackProductImpressions(products: (Product | string)[], context: ProductEventContext): Promise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* Prepare product event data with normalized product identification
|
|
74
|
+
*
|
|
75
|
+
* @param product - Product object or itemCode
|
|
76
|
+
* @param eventName - Event type (view, click, add_to_cart, etc.)
|
|
77
|
+
* @param context - Event context
|
|
78
|
+
* @returns Normalized event data ready for tracking
|
|
79
|
+
*/
|
|
80
|
+
export declare function prepareProductEventData(product: Product | string, eventName: string, context: ProductEventContext): {
|
|
81
|
+
name: string;
|
|
82
|
+
entityType: string;
|
|
83
|
+
entityId: string | null;
|
|
84
|
+
metadata: Record<string, any>;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Product Tracker class for OOP-style tracking
|
|
88
|
+
*
|
|
89
|
+
* Example usage:
|
|
90
|
+
* ```typescript
|
|
91
|
+
* const tracker = new ProductTracker();
|
|
92
|
+
* await tracker.trackView(product, { source: 'recommendation', widgetId: 'xxx' });
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
export declare class ProductTracker {
|
|
96
|
+
/**
|
|
97
|
+
* Track a product view/impression
|
|
98
|
+
*/
|
|
99
|
+
static view(product: Product | string, context: ProductEventContext): Promise<void>;
|
|
100
|
+
/**
|
|
101
|
+
* Track a product click
|
|
102
|
+
*/
|
|
103
|
+
static click(product: Product | string, context: ProductEventContext): Promise<void>;
|
|
104
|
+
/**
|
|
105
|
+
* Track add to cart
|
|
106
|
+
*/
|
|
107
|
+
static addToCart(product: Product | string, quantity: number, context: ProductEventContext): Promise<void>;
|
|
108
|
+
/**
|
|
109
|
+
* Track product impressions (list view)
|
|
110
|
+
*/
|
|
111
|
+
static impressions(products: (Product | string)[], context: ProductEventContext): Promise<void>;
|
|
112
|
+
/**
|
|
113
|
+
* Prepare event data (for custom tracking)
|
|
114
|
+
*/
|
|
115
|
+
static prepareEvent(product: Product | string, eventName: string, context: ProductEventContext): {
|
|
116
|
+
name: string;
|
|
117
|
+
entityType: string;
|
|
118
|
+
entityId: string | null;
|
|
119
|
+
metadata: Record<string, any>;
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
export default ProductTracker;
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extract itemCode from product object
|
|
3
|
+
* Uses canonical product identifier fields.
|
|
4
|
+
*
|
|
5
|
+
* @param product - Product object from API
|
|
6
|
+
* @returns The merchant's product ID (itemCode)
|
|
7
|
+
*/
|
|
8
|
+
export function getProductItemCode(product) {
|
|
9
|
+
if (typeof product === 'string') {
|
|
10
|
+
return product;
|
|
11
|
+
}
|
|
12
|
+
// id is the canonical product identifier; itemCode mirrors id when present.
|
|
13
|
+
return product.itemCode || product.id;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Extract product UUID (internal database ID)
|
|
17
|
+
* Only for internal use - never send in tracking events
|
|
18
|
+
*
|
|
19
|
+
* @param product - Product object from API
|
|
20
|
+
* @returns Internal UUID or undefined
|
|
21
|
+
*/
|
|
22
|
+
export function getProductUuid(product) {
|
|
23
|
+
return product._uuid;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Track a product view/impression event
|
|
27
|
+
*
|
|
28
|
+
* @param product - Product object from API
|
|
29
|
+
* @param context - Event context (source, position, etc.)
|
|
30
|
+
* @returns Promise that resolves when event is tracked
|
|
31
|
+
*/
|
|
32
|
+
export async function trackProductView(product, context) {
|
|
33
|
+
const itemCode = getProductItemCode(product);
|
|
34
|
+
// Use the global tracking function from core tracker
|
|
35
|
+
if (typeof window !== 'undefined' && window.Selwise || window.Selwise) {
|
|
36
|
+
const Selwise = window.Selwise || window.Selwise;
|
|
37
|
+
// Check if batch tracking is enabled
|
|
38
|
+
if (Selwise.trackEvent) {
|
|
39
|
+
await Selwise.trackEvent('product_view', {
|
|
40
|
+
entityType: context.source,
|
|
41
|
+
entityId: context.widgetId || null,
|
|
42
|
+
metadata: {
|
|
43
|
+
productItemCode: itemCode,
|
|
44
|
+
position: context.position,
|
|
45
|
+
query: context.query,
|
|
46
|
+
listType: context.listType,
|
|
47
|
+
...context.customData,
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Track a product click event
|
|
55
|
+
*
|
|
56
|
+
* @param product - Product object from API
|
|
57
|
+
* @param context - Event context (source, position, etc.)
|
|
58
|
+
* @returns Promise that resolves when event is tracked
|
|
59
|
+
*/
|
|
60
|
+
export async function trackProductClick(product, context) {
|
|
61
|
+
const itemCode = getProductItemCode(product);
|
|
62
|
+
if (typeof window !== 'undefined' && window.Selwise || window.Selwise) {
|
|
63
|
+
const Selwise = window.Selwise || window.Selwise;
|
|
64
|
+
if (Selwise.trackEvent) {
|
|
65
|
+
await Selwise.trackEvent('click', {
|
|
66
|
+
entityType: context.source,
|
|
67
|
+
entityId: context.widgetId || itemCode,
|
|
68
|
+
metadata: {
|
|
69
|
+
productItemCode: itemCode,
|
|
70
|
+
position: context.position,
|
|
71
|
+
query: context.query,
|
|
72
|
+
listType: context.listType,
|
|
73
|
+
...context.customData,
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Track an add_to_cart event
|
|
81
|
+
*
|
|
82
|
+
* @param product - Product object from API
|
|
83
|
+
* @param quantity - Quantity added (default: 1)
|
|
84
|
+
* @param context - Event context (source, widgetId, etc.)
|
|
85
|
+
* @returns Promise that resolves when event is tracked
|
|
86
|
+
*/
|
|
87
|
+
export async function trackAddToCart(product, quantity = 1, context) {
|
|
88
|
+
const itemCode = getProductItemCode(product);
|
|
89
|
+
if (typeof window !== 'undefined' && window.Selwise || window.Selwise) {
|
|
90
|
+
const Selwise = window.Selwise || window.Selwise;
|
|
91
|
+
if (Selwise.trackEvent) {
|
|
92
|
+
await Selwise.trackEvent('add_to_cart', {
|
|
93
|
+
entityType: context.source,
|
|
94
|
+
entityId: context.widgetId || itemCode,
|
|
95
|
+
metadata: {
|
|
96
|
+
productItemCode: itemCode,
|
|
97
|
+
quantity,
|
|
98
|
+
price: typeof product === 'object' ? product.price : undefined,
|
|
99
|
+
...context.customData,
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Track product impression (for analytics/funnel)
|
|
107
|
+
*
|
|
108
|
+
* @param products - Array of products being viewed
|
|
109
|
+
* @param context - Event context (source, listType, etc.)
|
|
110
|
+
* @returns Promise that resolves when events are tracked
|
|
111
|
+
*/
|
|
112
|
+
export async function trackProductImpressions(products, context) {
|
|
113
|
+
if (typeof window !== 'undefined' && window.Selwise || window.Selwise) {
|
|
114
|
+
const Selwise = window.Selwise || window.Selwise;
|
|
115
|
+
if (Selwise.trackEvent) {
|
|
116
|
+
// Track as a batch of impressions
|
|
117
|
+
const itemCodes = products.map(getProductItemCode);
|
|
118
|
+
await Selwise.trackEvent('product_impression', {
|
|
119
|
+
entityType: context.source,
|
|
120
|
+
entityId: context.widgetId || null,
|
|
121
|
+
metadata: {
|
|
122
|
+
productItemCodes: itemCodes,
|
|
123
|
+
count: itemCodes.length,
|
|
124
|
+
listType: context.listType,
|
|
125
|
+
query: context.query,
|
|
126
|
+
...context.customData,
|
|
127
|
+
},
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Prepare product event data with normalized product identification
|
|
134
|
+
*
|
|
135
|
+
* @param product - Product object or itemCode
|
|
136
|
+
* @param eventName - Event type (view, click, add_to_cart, etc.)
|
|
137
|
+
* @param context - Event context
|
|
138
|
+
* @returns Normalized event data ready for tracking
|
|
139
|
+
*/
|
|
140
|
+
export function prepareProductEventData(product, eventName, context) {
|
|
141
|
+
const itemCode = getProductItemCode(product);
|
|
142
|
+
return {
|
|
143
|
+
name: eventName,
|
|
144
|
+
entityType: context.source,
|
|
145
|
+
entityId: context.widgetId || itemCode,
|
|
146
|
+
metadata: {
|
|
147
|
+
productItemCode: itemCode,
|
|
148
|
+
...(typeof product === 'object' && {
|
|
149
|
+
_productUuid: product._uuid, // Only for internal use
|
|
150
|
+
price: product.price,
|
|
151
|
+
category: product.category,
|
|
152
|
+
}),
|
|
153
|
+
...(context.position !== undefined && { position: context.position }),
|
|
154
|
+
...(context.query && { query: context.query }),
|
|
155
|
+
...(context.listType && { listType: context.listType }),
|
|
156
|
+
...context.customData,
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Product Tracker class for OOP-style tracking
|
|
162
|
+
*
|
|
163
|
+
* Example usage:
|
|
164
|
+
* ```typescript
|
|
165
|
+
* const tracker = new ProductTracker();
|
|
166
|
+
* await tracker.trackView(product, { source: 'recommendation', widgetId: 'xxx' });
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
169
|
+
export class ProductTracker {
|
|
170
|
+
/**
|
|
171
|
+
* Track a product view/impression
|
|
172
|
+
*/
|
|
173
|
+
static async view(product, context) {
|
|
174
|
+
return trackProductView(product, context);
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Track a product click
|
|
178
|
+
*/
|
|
179
|
+
static async click(product, context) {
|
|
180
|
+
return trackProductClick(product, context);
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Track add to cart
|
|
184
|
+
*/
|
|
185
|
+
static async addToCart(product, quantity, context) {
|
|
186
|
+
return trackAddToCart(product, quantity, context);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Track product impressions (list view)
|
|
190
|
+
*/
|
|
191
|
+
static async impressions(products, context) {
|
|
192
|
+
return trackProductImpressions(products, context);
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Prepare event data (for custom tracking)
|
|
196
|
+
*/
|
|
197
|
+
static prepareEvent(product, eventName, context) {
|
|
198
|
+
return prepareProductEventData(product, eventName, context);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
// Export convenience functions
|
|
202
|
+
export default ProductTracker;
|
|
203
|
+
//# sourceMappingURL=tracking.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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AAC,CAAC;IACpD,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,YAAY,CACjB,OAAyB,EACzB,SAAiB,EACjB,OAA4B;QAE5B,OAAO,uBAAuB,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC;CACF;AAED,+BAA+B;AAC/B,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cart Handlers for Recommendation Module
|
|
3
|
+
* Uses shared cart module for platform-specific implementations
|
|
4
|
+
*/
|
|
5
|
+
import type { Product, RecommendationWidget, RecommendationConfig } from '../../types';
|
|
6
|
+
export declare function handleAddToCart(product: Product, widget: RecommendationWidget, config: RecommendationConfig, trackEvent?: (type: 'add_to_cart', widgetId: string, productItemCode: string, config: RecommendationConfig) => void, trackBehavior?: (type: 'add_to_cart', product: {
|
|
7
|
+
itemCode: string;
|
|
8
|
+
category?: string;
|
|
9
|
+
price?: number;
|
|
10
|
+
}, config: RecommendationConfig) => void): void;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cart Handlers for Recommendation Module
|
|
3
|
+
* Uses shared cart module for platform-specific implementations
|
|
4
|
+
*/
|
|
5
|
+
import { addToCart, createButtonState, } from '../../shared/cart/index.js';
|
|
6
|
+
export function handleAddToCart(product, widget, config, trackEvent, trackBehavior) {
|
|
7
|
+
const productItemCode = product.itemCode || product.id;
|
|
8
|
+
// Track add to cart event
|
|
9
|
+
trackEvent?.('add_to_cart', widget.id, productItemCode, config);
|
|
10
|
+
// Track behavior for AI personalization
|
|
11
|
+
trackBehavior?.('add_to_cart', {
|
|
12
|
+
itemCode: productItemCode,
|
|
13
|
+
category: product.categories,
|
|
14
|
+
price: product.price,
|
|
15
|
+
}, config);
|
|
16
|
+
// Map to shared cart product type
|
|
17
|
+
const cartProduct = {
|
|
18
|
+
id: productItemCode,
|
|
19
|
+
title: product.title,
|
|
20
|
+
price: product.price,
|
|
21
|
+
variantId: product.variantId,
|
|
22
|
+
itemCode: productItemCode,
|
|
23
|
+
wooProductId: product.wooProductId,
|
|
24
|
+
magentoProductId: product.magentoProductId,
|
|
25
|
+
prestaProductId: product.prestaProductId,
|
|
26
|
+
attributeId: product.attributeId,
|
|
27
|
+
};
|
|
28
|
+
const platform = (widget.cartPlatform || 'custom');
|
|
29
|
+
// For Akinon, we need button state
|
|
30
|
+
if (platform === 'akinon') {
|
|
31
|
+
const button = document.querySelector(`[data-selwise-action="add-to-cart"][data-product-id="${productItemCode}"]`);
|
|
32
|
+
const buttonState = createButtonState(button, {
|
|
33
|
+
loading: 'Adding...',
|
|
34
|
+
success: 'Added!',
|
|
35
|
+
error: 'Hata',
|
|
36
|
+
default: widget.cartButtonText || 'Add to Cart',
|
|
37
|
+
});
|
|
38
|
+
addToCart(cartProduct, platform, { buttonState });
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
addToCart(cartProduct, platform, {
|
|
42
|
+
customScript: widget.customCartScript ||
|
|
43
|
+
(typeof widget.addToCartConfig?.customScript === 'string'
|
|
44
|
+
? widget.addToCartConfig.customScript
|
|
45
|
+
: undefined),
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=cart-handlers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cart-handlers.js","sourceRoot":"","sources":["../../../../../src/modules/recommendation/cart-handlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,SAAS,EACT,iBAAiB,GAGlB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,UAAU,eAAe,CAC7B,OAAgB,EAChB,MAA4B,EAC5B,MAA4B,EAC5B,UAKS,EACT,aAIS;IAET,MAAM,eAAe,GAAG,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,EAAE,CAAC;IAEvD,0BAA0B;IAC1B,UAAU,EAAE,CAAC,aAAa,EAAE,MAAM,CAAC,EA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