@ikas/bp-storefront 1.4.0-beta.9 → 1.4.0-beta.91

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 (45) hide show
  1. package/dist/analytics/analytics-functions/helpers.js +1 -1
  2. package/dist/analytics/analytics.js +1 -1
  3. package/dist/analytics/google-tag-manager/productView.js +1 -1
  4. package/dist/analytics/google-tag-manager/viewCategory.js +1 -1
  5. package/dist/analytics/ikas/analytics.js +1 -1
  6. package/dist/analytics/utils.js +1 -1
  7. package/dist/ext/lodash/flatten.js +1 -0
  8. package/dist/functions/api/cart/index.js +1 -1
  9. package/dist/functions/models/category/index.js +1 -1
  10. package/dist/functions/models/image/index.d.ts +65 -20
  11. package/dist/functions/models/image/index.js +1 -1
  12. package/dist/functions/models/product/option-set/index.d.ts +18 -0
  13. package/dist/functions/models/product/option-set/index.js +1 -1
  14. package/dist/functions/models/product/variant/index.d.ts +14 -4
  15. package/dist/functions/models/product-list/index.js +1 -1
  16. package/dist/functions/models/validator/account-info/index.js +1 -1
  17. package/dist/functions/models/validator/contact-form/index.js +1 -1
  18. package/dist/functions/models/validator/coupon-code-form/index.js +1 -1
  19. package/dist/functions/models/validator/customer-review/index.js +1 -1
  20. package/dist/functions/models/validator/forgot-password/index.js +1 -1
  21. package/dist/functions/models/validator/login/index.js +1 -1
  22. package/dist/functions/models/validator/newsletter-subscription/index.js +1 -1
  23. package/dist/functions/models/validator/order-tracking/index.js +1 -1
  24. package/dist/functions/models/validator/recover-password/index.js +1 -1
  25. package/dist/functions/models/validator/register/index.js +1 -1
  26. package/dist/functions/models/validator/sms-login/index.js +1 -1
  27. package/dist/functions/models/validator/verify-phone-number/index.js +1 -1
  28. package/dist/functions/stores/base/index.d.ts +76 -1
  29. package/dist/functions/stores/base/index.js +1 -1
  30. package/dist/functions/stores/cart/index.js +1 -1
  31. package/dist/functions/stores/customer/index.js +1 -1
  32. package/dist/index.d.ts +1 -0
  33. package/dist/index.js +1 -1
  34. package/dist/packages/storefront-config/src/index.js +1 -1
  35. package/dist/packages/storefront-config/src/theme-globals.js +1 -0
  36. package/dist/storefront-config/src/index.d.ts +4 -0
  37. package/dist/storefront-config/src/theme-globals.d.ts +295 -0
  38. package/dist/storefront-models/src/models/blueprint/prop-value/index.d.ts +2 -0
  39. package/dist/storefront-models/src/models/blueprint/prop-value/svg-list.d.ts +3 -0
  40. package/dist/storefront-models/src/models/blueprint/prop-value/svg.d.ts +3 -0
  41. package/dist/theme/settings/index.d.ts +48 -0
  42. package/dist/theme/settings/index.js +1 -0
  43. package/dist/utils/component-renderer.d.ts +2 -1
  44. package/dist/utils/component-renderer.js +1 -1
  45. package/package.json +1 -1
@@ -1 +1 @@
1
- import{__awaiter as s,__generator as o,__assign as t}from'./../../ext/tslib/tslib.es6.mjs.js';import{getCustomerBasicInfo as e}from"../../functions/models/customer/index.js";import"../../stores/base/index.js";import"../../packages/storefront-config/src/index.js";import"../../stores/cart/index.js";import{customerStore as r}from"../../stores/customer/index.js";import'./../../ext/mobx/dist/mobx.esm.js';import"../../i18n/index.js";import"../../router/index.js";import'./../../ext/lodash/sortBy.js';import{waitForCustomerStoreInit as n}from"../../functions/stores/customer/index.js";function i(){return s(this,void 0,void 0,function(){var s;return o(this,function(o){switch(o.label){case 0:return[4,n(r)];case 1:return o.sent(),(s=r.customer)?[2,t(t({},e(s)),{consentGranted:r._customerConsentGranted})]:[2,null]}})})}export{i as getCustomerInfo};
1
+ import{__awaiter as s,__generator as o,__assign as t}from'./../../ext/tslib/tslib.es6.mjs.js';import{getCustomerBasicInfo as e}from"../../functions/models/customer/index.js";import"../../packages/storefront-config/src/index.js";import'./../../ext/lodash/_isFlattenable.js';import'./../../ext/lodash/sortBy.js';import"../../stores/base/index.js";import"../../stores/cart/index.js";import{customerStore as r}from"../../stores/customer/index.js";import'./../../ext/mobx/dist/mobx.esm.js';import"../../i18n/index.js";import"../../router/index.js";import{waitForCustomerStoreInit as n}from"../../functions/stores/customer/index.js";function i(){return s(this,void 0,void 0,function(){var s;return o(this,function(o){switch(o.label){case 0:return[4,n(r)];case 1:return o.sent(),(s=r.customer)?[2,t(t({},e(s)),{consentGranted:r._customerConsentGranted})]:[2,null]}})})}export{i as getCustomerInfo};
@@ -1 +1 @@
1
- import"../packages/storefront-config/src/index.js";import'./../ext/mobx/dist/mobx.esm.js';import'./../ext/lodash/sortBy.js';import"../router/index.js";import"../stores/cart/index.js";import"../stores/customer/index.js";import"../packages/storefront-api-client/src/utils/api.js";import'./../ext/isomorphic-fetch/fetch-npm-node.js';import"../stores/base/index.js";import"../i18n/index.js";import'./../ext/animejs/lib/anime.esm.js';import"../packages/storefront-api/src/index.js";import"../theme/styles/index.js";import'./../ext/preact/dist/preact.mjs.js';import'./../ext/preact/hooks/dist/hooks.mjs.js';import"../utils/fetch.js";import"../packages/storefront-models/src/models/merchant-settings/index.js";import'./../ext/uuid/dist/esm-browser/stringify.js';import'./../ext/uuid/dist/esm-browser/v3.js';import'./../ext/uuid/dist/esm-browser/native.js';import'./../ext/uuid/dist/esm-browser/v5.js';import"../functions/models/product-list/index.js";var s=function(){function s(){}return s.subscribers=[],s}();export{s as Analytics};
1
+ import"../packages/storefront-config/src/index.js";import'./../ext/mobx/dist/mobx.esm.js';import'./../ext/lodash/sortBy.js';import"../router/index.js";import"../stores/cart/index.js";import"../stores/customer/index.js";import"../packages/storefront-api-client/src/utils/api.js";import'./../ext/isomorphic-fetch/fetch-npm-node.js';import"../stores/base/index.js";import"../i18n/index.js";import'./../ext/lodash/_isFlattenable.js';import'./../ext/animejs/lib/anime.esm.js';import"../packages/storefront-api/src/index.js";import"../theme/styles/index.js";import'./../ext/preact/dist/preact.mjs.js';import'./../ext/preact/hooks/dist/hooks.mjs.js';import"../utils/fetch.js";import"../packages/storefront-models/src/models/merchant-settings/index.js";import'./../ext/uuid/dist/esm-browser/stringify.js';import'./../ext/uuid/dist/esm-browser/v3.js';import'./../ext/uuid/dist/esm-browser/native.js';import'./../ext/uuid/dist/esm-browser/v5.js';import"../functions/models/product-list/index.js";var s=function(){function s(){}return s.subscribers=[],s}();export{s as Analytics};
@@ -1 +1 @@
1
- import{getProductHref as s}from"../../functions/models/product/index.js";import"../../packages/storefront-config/src/index.js";import'./../../ext/mobx/dist/mobx.esm.js';import"../../router/index.js";import"../../stores/cart/index.js";import"../../stores/customer/index.js";import'./../../ext/uuid/dist/esm-browser/stringify.js';import'./../../ext/uuid/dist/esm-browser/v3.js';import'./../../ext/uuid/dist/esm-browser/native.js';import'./../../ext/uuid/dist/esm-browser/v5.js';import"../../i18n/index.js";import"../../functions/models/product-list/index.js";import"../../stores/base/index.js";import"../../packages/storefront-api-client/src/utils/api.js";import'./../../ext/isomorphic-fetch/fetch-npm-node.js';import"../analytics.js";import'./../../ext/animejs/lib/anime.esm.js';import"../../packages/storefront-api/src/index.js";import"../../theme/styles/index.js";import'./../../ext/preact/dist/preact.mjs.js';import'./../../ext/preact/hooks/dist/hooks.mjs.js';import"../../utils/fetch.js";import"../../packages/storefront-models/src/models/merchant-settings/index.js";import{extractProductData as e}from"../utils.js";import{dataLayer as o,formatGTMItem as t}from"./utils.js";function i(i){if(o())try{var r=e(i),m={event:"view_item-GTM",ecommerce:{items:[t(r)],extraParams:{parent_id:i.id,currency:r.currency,url:"https://".concat(window.location.hostname).concat(s(i)),item_image:r.image||"",barcode:r.barcode||"",sellPrice:r.sellPrice,discountPrice:r.discountPrice}}};return window.dataLayer.push(m),m}catch(s){console.error(s)}}export{i as gtm_productView};
1
+ import{getProductHref as s}from"../../functions/models/product/index.js";import"../../packages/storefront-config/src/index.js";import'./../../ext/mobx/dist/mobx.esm.js';import"../../router/index.js";import"../../stores/cart/index.js";import"../../stores/customer/index.js";import'./../../ext/uuid/dist/esm-browser/stringify.js';import'./../../ext/uuid/dist/esm-browser/v3.js';import'./../../ext/uuid/dist/esm-browser/native.js';import'./../../ext/uuid/dist/esm-browser/v5.js';import"../../i18n/index.js";import"../../functions/models/product-list/index.js";import'./../../ext/lodash/_isFlattenable.js';import'./../../ext/lodash/sortBy.js';import"../../stores/base/index.js";import"../../packages/storefront-api-client/src/utils/api.js";import'./../../ext/isomorphic-fetch/fetch-npm-node.js';import"../analytics.js";import'./../../ext/animejs/lib/anime.esm.js';import"../../packages/storefront-api/src/index.js";import"../../theme/styles/index.js";import'./../../ext/preact/dist/preact.mjs.js';import'./../../ext/preact/hooks/dist/hooks.mjs.js';import"../../utils/fetch.js";import"../../packages/storefront-models/src/models/merchant-settings/index.js";import{extractProductData as e}from"../utils.js";import{dataLayer as o,formatGTMItem as t}from"./utils.js";function i(i){if(o())try{var r=e(i),m={event:"view_item-GTM",ecommerce:{items:[t(r)],extraParams:{parent_id:i.id,currency:r.currency,url:"https://".concat(window.location.hostname).concat(s(i)),item_image:r.image||"",barcode:r.barcode||"",sellPrice:r.sellPrice,discountPrice:r.discountPrice}}};return window.dataLayer.push(m),m}catch(s){console.error(s)}}export{i as gtm_productView};
@@ -1 +1 @@
1
- import"../../packages/storefront-config/src/index.js";import'./../../ext/lodash/sortBy.js';import'./../../ext/mobx/dist/mobx.esm.js';import"../../router/index.js";import"../../stores/cart/index.js";import"../../stores/customer/index.js";import"../../packages/storefront-api-client/src/utils/api.js";import'./../../ext/isomorphic-fetch/fetch-npm-node.js';import"../../stores/base/index.js";import"../../i18n/index.js";import"../analytics.js";import'./../../ext/animejs/lib/anime.esm.js';import"../../packages/storefront-api/src/index.js";import"../../theme/styles/index.js";import'./../../ext/preact/dist/preact.mjs.js';import'./../../ext/preact/hooks/dist/hooks.mjs.js';import"../../utils/fetch.js";import"../../packages/storefront-models/src/models/merchant-settings/index.js";import{getIkasCategoryHref as s}from"../../functions/models/category/index.js";import'./../../ext/uuid/dist/esm-browser/stringify.js';import'./../../ext/uuid/dist/esm-browser/v3.js';import'./../../ext/uuid/dist/esm-browser/native.js';import'./../../ext/uuid/dist/esm-browser/v5.js';import"../../functions/models/product-list/index.js";import{dataLayer as e}from"./utils.js";function o(o,t){if(e())try{var i={event:"view_category-GTM",ecommerce:{category:[{id:o.id,name:o.name,metaData:o.metaData,href:s(o),image:o.image,path:t}]}};return window.dataLayer.push(i),i}catch(s){console.error(s)}}export{o as gtm_viewCategory};
1
+ import"../../packages/storefront-config/src/index.js";import'./../../ext/lodash/sortBy.js';import'./../../ext/mobx/dist/mobx.esm.js';import"../../router/index.js";import"../../stores/cart/index.js";import"../../stores/customer/index.js";import"../../packages/storefront-api-client/src/utils/api.js";import'./../../ext/isomorphic-fetch/fetch-npm-node.js';import"../../stores/base/index.js";import"../../i18n/index.js";import'./../../ext/lodash/_isFlattenable.js';import"../analytics.js";import'./../../ext/animejs/lib/anime.esm.js';import"../../packages/storefront-api/src/index.js";import"../../theme/styles/index.js";import'./../../ext/preact/dist/preact.mjs.js';import'./../../ext/preact/hooks/dist/hooks.mjs.js';import"../../utils/fetch.js";import"../../packages/storefront-models/src/models/merchant-settings/index.js";import{getIkasCategoryHref as s}from"../../functions/models/category/index.js";import'./../../ext/uuid/dist/esm-browser/stringify.js';import'./../../ext/uuid/dist/esm-browser/v3.js';import'./../../ext/uuid/dist/esm-browser/native.js';import'./../../ext/uuid/dist/esm-browser/v5.js';import"../../functions/models/product-list/index.js";import{dataLayer as e}from"./utils.js";function o(o,t){if(e())try{var i={event:"view_category-GTM",ecommerce:{category:[{id:o.id,name:o.name,metaData:o.metaData,href:s(o),image:o.image,path:t}]}};return window.dataLayer.push(i),i}catch(s){console.error(s)}}export{o as gtm_viewCategory};
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as e,__assign as n}from'./../../ext/tslib/tslib.es6.mjs.js';import{IkasStorefrontConfig as r}from"../../packages/storefront-config/src/index.js";import{getSelectedProductVariant as i}from"../../functions/models/product/index.js";import{getCookieValue as s}from"../../utils/helper.js";import"../../router/index.js";import"../../stores/cart/index.js";import{getCategoryPath as o}from"../../functions/models/category/index.js";import{customerStore as c}from"../../stores/customer/index.js";import'./../../ext/uuid/dist/esm-browser/stringify.js';import'./../../ext/uuid/dist/esm-browser/v3.js';import'./../../ext/uuid/dist/esm-browser/native.js';import'./../../ext/uuid/dist/esm-browser/v5.js';import"../../i18n/index.js";import'./../../ext/mobx/dist/mobx.esm.js';import"../../functions/models/product-list/index.js";import{getProductVariantPrice as u,getProductVariantFinalPrice as d}from"../../functions/models/product/variant/index.js";import{baseStore as a}from"../../stores/base/index.js";import{waitForCustomerStoreInit as l}from"../../functions/stores/customer/index.js";import"../analytics.js";import'./../../ext/animejs/lib/anime.esm.js';import"../../packages/storefront-api-client/src/utils/api.js";import'./../../ext/isomorphic-fetch/fetch-npm-node.js';import"../../packages/storefront-api/src/index.js";import"../../theme/styles/index.js";import'./../../ext/preact/dist/preact.mjs.js';import'./../../ext/preact/hooks/dist/hooks.mjs.js';import"../../utils/fetch.js";import"../../packages/storefront-models/src/models/merchant-settings/index.js";var E,O;!function(t){t[t.SESSION_START=1]="SESSION_START",t[t.PAGE_VIEW=2]="PAGE_VIEW",t[t.PRODUCT_VIEW=3]="PRODUCT_VIEW",t[t.ADD_TO_CART=4]="ADD_TO_CART",t[t.VIEW_CART=5]="VIEW_CART",t[t.ORDER_SUCCESS=6]="ORDER_SUCCESS",t[t.BEGIN_CHECKOUT=7]="BEGIN_CHECKOUT",t[t.CHECKOUT_STEP=8]="CHECKOUT_STEP",t[t.CUSTOMER_REGISTER=9]="CUSTOMER_REGISTER",t[t.CUSTOMER_VISIT=10]="CUSTOMER_VISIT",t[t.CUSTOMER_LOGIN=11]="CUSTOMER_LOGIN",t[t.BRAND_VIEW=12]="BRAND_VIEW",t[t.CATEGORY_VIEW=13]="CATEGORY_VIEW",t[t.POPUP_VIEW=14]="POPUP_VIEW",t[t.SEARCH=15]="SEARCH",t[t.FAVORITE_PRODUCT=16]="FAVORITE_PRODUCT",t[t.CONTACT_FORM=17]="CONTACT_FORM",t[t.CONTACT_FORM_BACKEND=205]="CONTACT_FORM_BACKEND"}(E||(E={})),function(t){t[t.INDEX=1]="INDEX",t[t.CATEGORY=2]="CATEGORY",t[t.BRAND=3]="BRAND",t[t.PRODUCT=4]="PRODUCT",t[t.CUSTOM=5]="CUSTOM",t[t.ACCOUNT=6]="ACCOUNT",t[t.ADDRESSES=7]="ADDRESSES",t[t.ORDERS=8]="ORDERS",t[t.ORDER_DETAIL=9]="ORDER_DETAIL",t[t.LOGIN=10]="LOGIN",t[t.REGISTER=11]="REGISTER",t[t.FORGOT_PASSWORD=12]="FORGOT_PASSWORD",t[t.RECOVER_PASSWORD=13]="RECOVER_PASSWORD",t[t.CART=14]="CART",t[t.FAVORITE_PRODUCTS=15]="FAVORITE_PRODUCTS",t[t.SEARCH=16]="SEARCH",t[t.NOT_FOUND=17]="NOT_FOUND",t[t.BLOG=18]="BLOG",t[t.BLOG_INDEX=19]="BLOG_INDEX",t[t.BLOG_CATEGORY=20]="BLOG_CATEGORY",t[t.CHECKOUT=21]="CHECKOUT"}(O||(O={}));var R=import.meta.env.VITE_PUBLIC_ANALYTICS_URL?"".concat(import.meta.env.VITE_PUBLIC_ANALYTICS_URL,"/sendEventV2"):"https://0.myikas.com/sendEventV2",f=function(){function t(){}return t.SESSION_ID_KEY="ikas_session_id",t.VISITOR_ID_KEY="ikas_visitor_id",t.JOURNEY_ID_KEY="ikas_journey_id",t.EXPIRY_LENGTH=18e5,t}();function _(r,i){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:i,t:E.PAGE_VIEW,ts:Date.now(),d:n(n({},F()),{pt:B(r)})}])];case 1:return t.sent(),[2]}})})}function T(r,s){return t(this,void 0,void 0,function(){var t,c,a,l;return e(this,function(e){switch(e.label){case 0:return t=[],c=[],r.categories&&r.categories.length>0&&o(r.categories[0]).map(function(e){t.push(e.name),c.push(e.id)}),a=i(r),l=u(a),[4,M([{id:s,t:E.PRODUCT_VIEW,ts:Date.now(),d:n(n({},F()),{d:n({pr:n({id:r.id,vid:a.id,cp:t,cid:c,n:r.name,pr:d(a)},(null==l?void 0:l.currency)?{c:null==l?void 0:l.currency}:{})},r.brand?{br:{id:r.brand.id}}:{})})}])];case 1:return e.sent(),[2]}})})}function I(r,i,s){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:s,t:E.ADD_TO_CART,ts:Date.now(),d:n(n({},F()),{d:{crt:{id:i.id,c:i.currencyCode,pr:i.totalFinalPrice,il:K(i)},crtItm:H(r)}})}])];case 1:return t.sent(),[2]}})})}function C(r,i){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:i,t:E.VIEW_CART,ts:Date.now(),d:n(n({},F()),{d:{crt:{id:r.id,c:r.currencyCode,pr:r.totalFinalPrice,il:K(r)}}})}])];case 1:return t.sent(),[2]}})})}function m(r,i){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:i,t:E.ORDER_SUCCESS,ts:Date.now(),d:n(n({},F()),{d:{chk:{id:r.id,s:"success",p:r.totalFinalPrice,c:r.currencyCode,il:K(r)}}})}])];case 1:return t.sent(),[4,V()];case 2:return t.sent(),[2]}})})}function v(r,i){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:i,t:E.BEGIN_CHECKOUT,ts:Date.now(),d:n(n({},F()),{d:{chk:{id:r.id,p:r.totalFinalPrice,c:r.currencyCode,il:K(r)}}})}])];case 1:return t.sent(),[2]}})})}function S(r,i){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{t:E.CHECKOUT_STEP,ts:Date.now(),d:n(n({},F()),{d:{chk:{id:r.id,s:i,p:r.totalFinalPrice,c:r.currencyCode,il:K(r)}}})}])];case 1:return t.sent(),[2]}})})}function h(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:r,t:E.CUSTOMER_REGISTER,ts:Date.now(),d:n(n({},F()),{d:{cst:W()}})}])];case 1:return t.sent(),[2]}})})}function D(){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{t:E.CUSTOMER_LOGIN,ts:Date.now(),d:n(n({},F()),{d:{cst:W()}})}])];case 1:return t.sent(),[2]}})})}function p(){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{t:E.CUSTOMER_VISIT,ts:Date.now(),d:n(n({},F()),{d:{cst:W()}})}])];case 1:return t.sent(),[2]}})})}function A(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{t:E.BRAND_VIEW,ts:Date.now(),d:n(n({},F()),{d:{cst:W(),br:{id:r.id}}})}])];case 1:return t.sent(),[2]}})})}function N(r,i,s){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:s,t:E.CATEGORY_VIEW,ts:Date.now(),d:n(n({},F()),{d:{cst:W(),ctg:{id:r.id,cp:i}}})}])];case 1:return t.sent(),[2]}})})}function U(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{t:E.POPUP_VIEW,ts:Date.now(),d:n(n({},F()),{d:{cst:W()},m:{sfpid:r}})}])];case 1:return t.sent(),[2]}})})}function P(r,i,s){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:i,t:E.SEARCH,ts:Date.now(),d:n(n({},F()),{d:{src:n({s:r},s?{r:s}:{})}})}])];case 1:return t.sent(),[2]}})})}function x(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:r,t:E.CONTACT_FORM,ts:Date.now(),d:n({},F())}])];case 1:return t.sent(),[2]}})})}function w(r,i){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:i,t:E.FAVORITE_PRODUCT,ts:Date.now(),d:n(n({},F()),{d:{pr:{id:r}}})}])];case 1:return t.sent(),[2]}})})}function G(){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return localStorage.removeItem(f.JOURNEY_ID_KEY),f.journeyId=void 0,[4,b()];case 1:return t.sent(),[2]}})})}function b(){return t(this,void 0,void 0,function(){var t,n;return e(this,function(e){switch(e.label){case 0:return e.trys.push([0,4,,5]),(t=localStorage.getItem(f.JOURNEY_ID_KEY))?(f.journeyId=t,[3,3]):[3,1];case 1:return[4,y()];case 2:e.sent(),e.label=3;case 3:return r.init({journeyId:f.journeyId||""}),[3,5];case 4:return n=e.sent(),console.error(n),[3,5];case 5:return[2]}})})}function j(){return t(this,void 0,void 0,function(){return e(this,function(t){return[2,"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)})]})})}function V(){return t(this,void 0,void 0,function(){var t,n,r;return e(this,function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),r={},[4,j()];case 1:return r.id=e.sent(),r.expiry=Date.now()+f.EXPIRY_LENGTH,t=r,localStorage.setItem(f.SESSION_ID_KEY,JSON.stringify(t)),f.sessionId=t.id,[4,L()];case 2:return e.sent(),[3,4];case 3:return n=e.sent(),console.error(n),[3,4];case 4:return[2]}})})}function y(){return t(this,void 0,void 0,function(){var t;return e(this,function(e){switch(e.label){case 0:return[4,j()];case 1:return t=e.sent(),localStorage.setItem(f.JOURNEY_ID_KEY,t),f.journeyId=t,[2]}})})}function g(){return t(this,void 0,void 0,function(){var t,n,i;return e(this,function(e){switch(e.label){case 0:return e.trys.push([0,7,,8]),(t=localStorage.getItem(f.SESSION_ID_KEY))?(n=JSON.parse(t)).expiry<Date.now()||n.id.length<=13?[4,V()]:[3,2]:[3,4];case 1:return e.sent(),[3,3];case 2:f.sessionId=n.id,e.label=3;case 3:return[3,6];case 4:return[4,V()];case 5:e.sent(),e.label=6;case 6:return r.init({sessionId:f.sessionId||""}),[3,8];case 7:return i=e.sent(),console.error(i),[3,8];case 8:return[2]}})})}function L(){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{t:E.SESSION_START,ts:Date.now(),d:n({},F())}])];case 1:return t.sent(),[2]}})})}function Y(){return t(this,void 0,void 0,function(){var t,n,i;return e(this,function(e){switch(e.label){case 0:return e.trys.push([0,4,,5]),(t=localStorage.getItem(f.VISITOR_ID_KEY))&&t.length>13?(f.visitorId=t,[3,3]):[3,1];case 1:return n=f,[4,j()];case 2:n.visitorId=e.sent(),localStorage.setItem(f.VISITOR_ID_KEY,f.visitorId),e.label=3;case 3:return r.init({visitorId:f.visitorId}),[3,5];case 4:return i=e.sent(),console.error(i),[3,5];case 5:return[2]}})})}function B(t){switch(t){case"INDEX":return O.INDEX;case"CATEGORY":return O.CATEGORY;case"BRAND":return O.BRAND;case"PRODUCT":return O.PRODUCT;case"CUSTOM":return O.CUSTOM;case"ACCOUNT":return O.ACCOUNT;case"ADDRESSES":return O.ADDRESSES;case"ORDERS":return O.ORDERS;case"ORDER_DETAIL":return O.ORDER_DETAIL;case"LOGIN":return O.LOGIN;case"REGISTER":return O.REGISTER;case"FORGOT_PASSWORD":return O.FORGOT_PASSWORD;case"RECOVER_PASSWORD":return O.RECOVER_PASSWORD;case"CART":return O.CART;case"FAVORITE_PRODUCTS":return O.FAVORITE_PRODUCTS;case"SEARCH":return O.SEARCH;case"NOT_FOUND":return O.NOT_FOUND;case"BLOG":return O.BLOG;case"BLOG_INDEX":return O.BLOG_INDEX;case"BLOG_CATEGORY":return O.BLOG_CATEGORY;case"CHECKOUT":return O.CHECKOUT}}function W(){var t=c.customer;return{id:(null==t?void 0:t.id)||void 0,e:(null==t?void 0:t.email)||void 0,c:c._customerConsentGranted}}function F(){return{u:window.location.href,r:document.referrer,pt:a.currentPageType?B(a.currentPageType):void 0,m:{fbp:s("_fbp"),fbc:s("_fbc")}}}function K(t){return t.orderLineItems.map(function(t){return n(n(n(n({},t.variant.productId?{pid:t.variant.productId}:{}),t.variant.id?{vid:t.variant.id}:{}),{c:t.quantity}),t.finalPrice?{p:t.finalPrice}:{})})}function H(t){return n(n(n(n({},t.variant.productId?{pid:t.variant.productId}:{}),t.variant.id?{vid:t.variant.id}:{}),{c:t.quantity}),t.finalPrice?{p:t.finalPrice}:{})}function M(i){return t(this,void 0,void 0,function(){var t,s,o,u,d,a,E,O,_,T,I;return e(this,function(e){switch(e.label){case 0:return e.trys.push([0,6,,7]),[4,l(c)];case 1:return e.sent(),[4,g()];case 2:return e.sent(),[4,Y()];case 3:return e.sent(),[4,b()];case 4:return e.sent(),t={e:i,scid:r.salesChannelId,sfid:r.storefrontId,sid:f.sessionId,jid:f.journeyId,vid:f.visitorId,sfrid:r.storefrontRoutingId||"",ud:n(n(n(n({id:null===(o=c.customer)||void 0===o?void 0:o.id},(null===(u=c.customer)||void 0===u?void 0:u.email)?{em:null===(d=c.customer)||void 0===d?void 0:d.email}:{}),(null===(a=c.customer)||void 0===a?void 0:a.phone)?{ph:null===(E=c.customer)||void 0===E?void 0:E.phone}:{}),(null===(O=c.customer)||void 0===O?void 0:O.lastName)?{ln:null===(_=c.customer)||void 0===_?void 0:_.lastName}:{}),(null===(T=c.customer)||void 0===T?void 0:T.firstName)?{fn:null===(I=c.customer)||void 0===I?void 0:I.firstName}:{}),v:3},[4,fetch(R,{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json","x-api-key":r.apiKey}})];case 5:return e.sent(),[3,7];case 6:return s=e.sent(),console.error(s),[3,7];case 7:return[2]}})})}export{f as default,I as iks_addToCart,w as iks_addToWishlist,v as iks_beginCheckout,b as iks_checkJourneyId,S as iks_checkoutStep,x as iks_contactForm,D as iks_customerLogin,h as iks_customerRegister,p as iks_customerVisit,_ as iks_pageView,T as iks_productView,m as iks_purchase,G as iks_refreshJourneyId,P as iks_search,A as iks_viewBrand,C as iks_viewCart,N as iks_viewCategory,U as iks_viewPopup};
1
+ import{__awaiter as t,__generator as e,__assign as n}from'./../../ext/tslib/tslib.es6.mjs.js';import{IkasStorefrontConfig as r}from"../../packages/storefront-config/src/index.js";import{getSelectedProductVariant as i}from"../../functions/models/product/index.js";import{getCookieValue as s}from"../../utils/helper.js";import"../../router/index.js";import"../../stores/cart/index.js";import{getCategoryPath as o}from"../../functions/models/category/index.js";import{customerStore as c}from"../../stores/customer/index.js";import'./../../ext/uuid/dist/esm-browser/stringify.js';import'./../../ext/uuid/dist/esm-browser/v3.js';import'./../../ext/uuid/dist/esm-browser/native.js';import'./../../ext/uuid/dist/esm-browser/v5.js';import"../../i18n/index.js";import'./../../ext/mobx/dist/mobx.esm.js';import"../../functions/models/product-list/index.js";import{getProductVariantPrice as u,getProductVariantFinalPrice as d}from"../../functions/models/product/variant/index.js";import'./../../ext/lodash/_isFlattenable.js';import'./../../ext/lodash/sortBy.js';import{baseStore as a}from"../../stores/base/index.js";import{waitForCustomerStoreInit as l}from"../../functions/stores/customer/index.js";import"../analytics.js";import'./../../ext/animejs/lib/anime.esm.js';import"../../packages/storefront-api-client/src/utils/api.js";import'./../../ext/isomorphic-fetch/fetch-npm-node.js';import"../../packages/storefront-api/src/index.js";import"../../theme/styles/index.js";import'./../../ext/preact/dist/preact.mjs.js';import'./../../ext/preact/hooks/dist/hooks.mjs.js';import"../../utils/fetch.js";import"../../packages/storefront-models/src/models/merchant-settings/index.js";var E,O;!function(t){t[t.SESSION_START=1]="SESSION_START",t[t.PAGE_VIEW=2]="PAGE_VIEW",t[t.PRODUCT_VIEW=3]="PRODUCT_VIEW",t[t.ADD_TO_CART=4]="ADD_TO_CART",t[t.VIEW_CART=5]="VIEW_CART",t[t.ORDER_SUCCESS=6]="ORDER_SUCCESS",t[t.BEGIN_CHECKOUT=7]="BEGIN_CHECKOUT",t[t.CHECKOUT_STEP=8]="CHECKOUT_STEP",t[t.CUSTOMER_REGISTER=9]="CUSTOMER_REGISTER",t[t.CUSTOMER_VISIT=10]="CUSTOMER_VISIT",t[t.CUSTOMER_LOGIN=11]="CUSTOMER_LOGIN",t[t.BRAND_VIEW=12]="BRAND_VIEW",t[t.CATEGORY_VIEW=13]="CATEGORY_VIEW",t[t.POPUP_VIEW=14]="POPUP_VIEW",t[t.SEARCH=15]="SEARCH",t[t.FAVORITE_PRODUCT=16]="FAVORITE_PRODUCT",t[t.CONTACT_FORM=17]="CONTACT_FORM",t[t.CONTACT_FORM_BACKEND=205]="CONTACT_FORM_BACKEND"}(E||(E={})),function(t){t[t.INDEX=1]="INDEX",t[t.CATEGORY=2]="CATEGORY",t[t.BRAND=3]="BRAND",t[t.PRODUCT=4]="PRODUCT",t[t.CUSTOM=5]="CUSTOM",t[t.ACCOUNT=6]="ACCOUNT",t[t.ADDRESSES=7]="ADDRESSES",t[t.ORDERS=8]="ORDERS",t[t.ORDER_DETAIL=9]="ORDER_DETAIL",t[t.LOGIN=10]="LOGIN",t[t.REGISTER=11]="REGISTER",t[t.FORGOT_PASSWORD=12]="FORGOT_PASSWORD",t[t.RECOVER_PASSWORD=13]="RECOVER_PASSWORD",t[t.CART=14]="CART",t[t.FAVORITE_PRODUCTS=15]="FAVORITE_PRODUCTS",t[t.SEARCH=16]="SEARCH",t[t.NOT_FOUND=17]="NOT_FOUND",t[t.BLOG=18]="BLOG",t[t.BLOG_INDEX=19]="BLOG_INDEX",t[t.BLOG_CATEGORY=20]="BLOG_CATEGORY",t[t.CHECKOUT=21]="CHECKOUT"}(O||(O={}));var R=import.meta.env.VITE_PUBLIC_ANALYTICS_URL?"".concat(import.meta.env.VITE_PUBLIC_ANALYTICS_URL,"/sendEventV2"):"https://0.myikas.com/sendEventV2",_=function(){function t(){}return t.SESSION_ID_KEY="ikas_session_id",t.VISITOR_ID_KEY="ikas_visitor_id",t.JOURNEY_ID_KEY="ikas_journey_id",t.EXPIRY_LENGTH=18e5,t}();function f(r,i){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:i,t:E.PAGE_VIEW,ts:Date.now(),d:n(n({},W()),{pt:B(r)})}])];case 1:return t.sent(),[2]}})})}function T(r,s){return t(this,void 0,void 0,function(){var t,c,a,l;return e(this,function(e){switch(e.label){case 0:return t=[],c=[],r.categories&&r.categories.length>0&&o(r.categories[0]).map(function(e){t.push(e.name),c.push(e.id)}),a=i(r),l=u(a),[4,M([{id:s,t:E.PRODUCT_VIEW,ts:Date.now(),d:n(n({},W()),{d:n({pr:n({id:r.id,vid:a.id,cp:t,cid:c,n:r.name,pr:d(a)},(null==l?void 0:l.currency)?{c:null==l?void 0:l.currency}:{})},r.brand?{br:{id:r.brand.id}}:{})})}])];case 1:return e.sent(),[2]}})})}function I(r,i,s){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:s,t:E.ADD_TO_CART,ts:Date.now(),d:n(n({},W()),{d:{crt:{id:i.id,c:i.currencyCode,pr:i.totalFinalPrice,il:K(i)},crtItm:H(r)}})}])];case 1:return t.sent(),[2]}})})}function m(r,i){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:i,t:E.VIEW_CART,ts:Date.now(),d:n(n({},W()),{d:{crt:{id:r.id,c:r.currencyCode,pr:r.totalFinalPrice,il:K(r)}}})}])];case 1:return t.sent(),[2]}})})}function C(r,i){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:i,t:E.ORDER_SUCCESS,ts:Date.now(),d:n(n({},W()),{d:{chk:{id:r.id,s:"success",p:r.totalFinalPrice,c:r.currencyCode,il:K(r)}}})}])];case 1:return t.sent(),[4,y()];case 2:return t.sent(),[2]}})})}function v(r,i){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:i,t:E.BEGIN_CHECKOUT,ts:Date.now(),d:n(n({},W()),{d:{chk:{id:r.id,p:r.totalFinalPrice,c:r.currencyCode,il:K(r)}}})}])];case 1:return t.sent(),[2]}})})}function S(r,i){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{t:E.CHECKOUT_STEP,ts:Date.now(),d:n(n({},W()),{d:{chk:{id:r.id,s:i,p:r.totalFinalPrice,c:r.currencyCode,il:K(r)}}})}])];case 1:return t.sent(),[2]}})})}function h(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:r,t:E.CUSTOMER_REGISTER,ts:Date.now(),d:n(n({},W()),{d:{cst:F()}})}])];case 1:return t.sent(),[2]}})})}function D(){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{t:E.CUSTOMER_LOGIN,ts:Date.now(),d:n(n({},W()),{d:{cst:F()}})}])];case 1:return t.sent(),[2]}})})}function p(){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{t:E.CUSTOMER_VISIT,ts:Date.now(),d:n(n({},W()),{d:{cst:F()}})}])];case 1:return t.sent(),[2]}})})}function A(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{t:E.BRAND_VIEW,ts:Date.now(),d:n(n({},W()),{d:{cst:F(),br:{id:r.id}}})}])];case 1:return t.sent(),[2]}})})}function N(r,i,s){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:s,t:E.CATEGORY_VIEW,ts:Date.now(),d:n(n({},W()),{d:{cst:F(),ctg:{id:r.id,cp:i}}})}])];case 1:return t.sent(),[2]}})})}function U(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{t:E.POPUP_VIEW,ts:Date.now(),d:n(n({},W()),{d:{cst:F()},m:{sfpid:r}})}])];case 1:return t.sent(),[2]}})})}function P(r,i,s){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:i,t:E.SEARCH,ts:Date.now(),d:n(n({},W()),{d:{src:n({s:r},s?{r:s}:{})}})}])];case 1:return t.sent(),[2]}})})}function x(r){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:r,t:E.CONTACT_FORM,ts:Date.now(),d:n({},W())}])];case 1:return t.sent(),[2]}})})}function w(r,i){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{id:i,t:E.FAVORITE_PRODUCT,ts:Date.now(),d:n(n({},W()),{d:{pr:{id:r}}})}])];case 1:return t.sent(),[2]}})})}function G(){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return localStorage.removeItem(_.JOURNEY_ID_KEY),_.journeyId=void 0,[4,b()];case 1:return t.sent(),[2]}})})}function b(){return t(this,void 0,void 0,function(){var t,n;return e(this,function(e){switch(e.label){case 0:return e.trys.push([0,4,,5]),(t=localStorage.getItem(_.JOURNEY_ID_KEY))?(_.journeyId=t,[3,3]):[3,1];case 1:return[4,V()];case 2:e.sent(),e.label=3;case 3:return r.init({journeyId:_.journeyId||""}),[3,5];case 4:return n=e.sent(),console.error(n),[3,5];case 5:return[2]}})})}function j(){return t(this,void 0,void 0,function(){return e(this,function(t){return[2,"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)})]})})}function y(){return t(this,void 0,void 0,function(){var t,n,r;return e(this,function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),r={},[4,j()];case 1:return r.id=e.sent(),r.expiry=Date.now()+_.EXPIRY_LENGTH,t=r,localStorage.setItem(_.SESSION_ID_KEY,JSON.stringify(t)),_.sessionId=t.id,[4,L()];case 2:return e.sent(),[3,4];case 3:return n=e.sent(),console.error(n),[3,4];case 4:return[2]}})})}function V(){return t(this,void 0,void 0,function(){var t;return e(this,function(e){switch(e.label){case 0:return[4,j()];case 1:return t=e.sent(),localStorage.setItem(_.JOURNEY_ID_KEY,t),_.journeyId=t,[2]}})})}function g(){return t(this,void 0,void 0,function(){var t,n,i;return e(this,function(e){switch(e.label){case 0:return e.trys.push([0,7,,8]),(t=localStorage.getItem(_.SESSION_ID_KEY))?(n=JSON.parse(t)).expiry<Date.now()||n.id.length<=13?[4,y()]:[3,2]:[3,4];case 1:return e.sent(),[3,3];case 2:_.sessionId=n.id,e.label=3;case 3:return[3,6];case 4:return[4,y()];case 5:e.sent(),e.label=6;case 6:return r.init({sessionId:_.sessionId||""}),[3,8];case 7:return i=e.sent(),console.error(i),[3,8];case 8:return[2]}})})}function L(){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return[4,M([{t:E.SESSION_START,ts:Date.now(),d:n({},W())}])];case 1:return t.sent(),[2]}})})}function Y(){return t(this,void 0,void 0,function(){var t,n,i;return e(this,function(e){switch(e.label){case 0:return e.trys.push([0,4,,5]),(t=localStorage.getItem(_.VISITOR_ID_KEY))&&t.length>13?(_.visitorId=t,[3,3]):[3,1];case 1:return n=_,[4,j()];case 2:n.visitorId=e.sent(),localStorage.setItem(_.VISITOR_ID_KEY,_.visitorId),e.label=3;case 3:return r.init({visitorId:_.visitorId}),[3,5];case 4:return i=e.sent(),console.error(i),[3,5];case 5:return[2]}})})}function B(t){switch(t){case"INDEX":return O.INDEX;case"CATEGORY":return O.CATEGORY;case"BRAND":return O.BRAND;case"PRODUCT":return O.PRODUCT;case"CUSTOM":return O.CUSTOM;case"ACCOUNT":return O.ACCOUNT;case"ADDRESSES":return O.ADDRESSES;case"ORDERS":return O.ORDERS;case"ORDER_DETAIL":return O.ORDER_DETAIL;case"LOGIN":return O.LOGIN;case"REGISTER":return O.REGISTER;case"FORGOT_PASSWORD":return O.FORGOT_PASSWORD;case"RECOVER_PASSWORD":return O.RECOVER_PASSWORD;case"CART":return O.CART;case"FAVORITE_PRODUCTS":return O.FAVORITE_PRODUCTS;case"SEARCH":return O.SEARCH;case"NOT_FOUND":return O.NOT_FOUND;case"BLOG":return O.BLOG;case"BLOG_INDEX":return O.BLOG_INDEX;case"BLOG_CATEGORY":return O.BLOG_CATEGORY;case"CHECKOUT":return O.CHECKOUT}}function F(){var t=c.customer;return{id:(null==t?void 0:t.id)||void 0,e:(null==t?void 0:t.email)||void 0,c:c._customerConsentGranted}}function W(){return{u:window.location.href,r:document.referrer,pt:a.currentPageType?B(a.currentPageType):void 0,m:{fbp:s("_fbp"),fbc:s("_fbc")}}}function K(t){return t.orderLineItems.map(function(t){return n(n(n(n({},t.variant.productId?{pid:t.variant.productId}:{}),t.variant.id?{vid:t.variant.id}:{}),{c:t.quantity}),t.finalPrice?{p:t.finalPrice}:{})})}function H(t){return n(n(n(n({},t.variant.productId?{pid:t.variant.productId}:{}),t.variant.id?{vid:t.variant.id}:{}),{c:t.quantity}),t.finalPrice?{p:t.finalPrice}:{})}function M(i){return t(this,void 0,void 0,function(){var t,s,o,u,d,a,E,O,f,T,I;return e(this,function(e){switch(e.label){case 0:return e.trys.push([0,6,,7]),[4,l(c)];case 1:return e.sent(),[4,g()];case 2:return e.sent(),[4,Y()];case 3:return e.sent(),[4,b()];case 4:return e.sent(),t={e:i,scid:r.salesChannelId,sfid:r.storefrontId,sid:_.sessionId,jid:_.journeyId,vid:_.visitorId,sfrid:r.storefrontRoutingId||"",ud:n(n(n(n({id:null===(o=c.customer)||void 0===o?void 0:o.id},(null===(u=c.customer)||void 0===u?void 0:u.email)?{em:null===(d=c.customer)||void 0===d?void 0:d.email}:{}),(null===(a=c.customer)||void 0===a?void 0:a.phone)?{ph:null===(E=c.customer)||void 0===E?void 0:E.phone}:{}),(null===(O=c.customer)||void 0===O?void 0:O.lastName)?{ln:null===(f=c.customer)||void 0===f?void 0:f.lastName}:{}),(null===(T=c.customer)||void 0===T?void 0:T.firstName)?{fn:null===(I=c.customer)||void 0===I?void 0:I.firstName}:{}),v:3},[4,fetch(R,{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json","x-api-key":r.apiKey}})];case 5:return e.sent(),[3,7];case 6:return s=e.sent(),console.error(s),[3,7];case 7:return[2]}})})}export{_ as default,I as iks_addToCart,w as iks_addToWishlist,v as iks_beginCheckout,b as iks_checkJourneyId,S as iks_checkoutStep,x as iks_contactForm,D as iks_customerLogin,h as iks_customerRegister,p as iks_customerVisit,f as iks_pageView,T as iks_productView,C as iks_purchase,G as iks_refreshJourneyId,P as iks_search,A as iks_viewBrand,m as iks_viewCart,N as iks_viewCategory,U as iks_viewPopup};
@@ -1 +1 @@
1
- import{IkasStorefrontConfig as i}from"../packages/storefront-config/src/index.js";import{getSelectedProductVariant as e}from"../functions/models/product/index.js";import{isServer as r}from"../utils/helper.js";import"../router/index.js";import"../stores/cart/index.js";import{getCategoryPath as t}from"../functions/models/category/index.js";import"../stores/customer/index.js";import'./../ext/uuid/dist/esm-browser/stringify.js';import'./../ext/uuid/dist/esm-browser/v3.js';import'./../ext/uuid/dist/esm-browser/native.js';import'./../ext/uuid/dist/esm-browser/v5.js';import"../i18n/index.js";import'./../ext/mobx/dist/mobx.esm.js';import{getDefaultSrc as o}from"../functions/models/image/index.js";import"../functions/models/product-list/index.js";import{getProductVariantMainImage as n,getProductVariantPrice as a,getProductVariantFinalPrice as s,getProductVariantSellPrice as d,getProductVariantDiscountPrice as m}from"../functions/models/product/variant/index.js";import"../stores/base/index.js";import"../packages/storefront-api-client/src/utils/api.js";import'./../ext/isomorphic-fetch/fetch-npm-node.js';import"./analytics.js";import'./../ext/animejs/lib/anime.esm.js';import"../packages/storefront-api/src/index.js";import"../theme/styles/index.js";import'./../ext/preact/dist/preact.mjs.js';import'./../ext/preact/hooks/dist/hooks.mjs.js';import"../utils/fetch.js";import"../packages/storefront-models/src/models/merchant-settings/index.js";var u=function(){return!r()&&!i.isEditor},c=function(){return u()&&!!i.fbpId&&!!window.fbq},l=function(){return u()&&!!window.gtag},p=function(){return u()&&!!window.dataLayer},v=function(){return u()&&!!i.tiktokPixelId&&!!window.ttq};function f(i,r){var u,c,l,p,v=e(i),f=i.categories.length>0?t(i.categories[0]).map(function(i){return i.name}):[],j=null===(u=n(v))||void 0===u?void 0:u.image,g=a(v);return{id:i.id,variantId:v.id,name:i.name,price:null!==(c=s(v))&&void 0!==c?c:0,currency:(null==g?void 0:g.currency)||"TRY",categoryPath:f,categoryString:f.join(" > "),brand:(null===(l=i.brand)||void 0===l?void 0:l.name)||"",variant:v.variantValues.map(function(i){return i.name}).join(" / "),barcode:null===(p=v.barcodeList)||void 0===p?void 0:p[0],image:j?o(j):"",sellPrice:d(v)||void 0,discountPrice:m(v)}}function j(i,e,r){var t,o,n,a,s,d=[];if(null===(t=null==r?void 0:r.categories)||void 0===t?void 0:t.length)(m=r.categories[0]).categoryPath&&m.categoryPath.forEach(function(i){return d.push(i)}),d.push(m.name);else if(null===(o=i.variant.categories)||void 0===o?void 0:o.length){var m;(m=i.variant.categories[0]).categoryPath&&m.categoryPath.forEach(function(i){return d.push(i.name)}),d.push(m.name)}return{id:i.variant.productId||"",variantId:i.variant.id||"",name:i.variant.name,price:i.finalPrice||0,quantity:null!=e?e:i.quantity,currency:i.currencyCode||"",categoryPath:d,categoryString:d.join(" > "),brand:(null===(n=null==r?void 0:r.brand)||void 0===n?void 0:n.name)||(null===(a=i.variant.brand)||void 0===a?void 0:a.name)||"",variant:(null===(s=i.variant.variantValues)||void 0===s?void 0:s.map(function(i){return i.variantValueName}).join(" / "))||""}}function g(i){var e;return{items:i.orderLineItems.map(function(i){return j(i)}),totalPrice:"totalFinalPrice"in i?i.totalFinalPrice:i.totalPrice,currency:i.currencyCode||(null===(e=i.orderLineItems[0])||void 0===e?void 0:e.currencyCode)||"TRY",itemCount:i.orderLineItems.length}}export{u as canTrack,g as extractCartData,j as extractCartItemData,f as extractProductData,c as hasFacebookPixel,l as hasGoogleAnalytics,p as hasGoogleTagManager,v as hasTiktokPixel};
1
+ import{IkasStorefrontConfig as i}from"../packages/storefront-config/src/index.js";import{getSelectedProductVariant as e}from"../functions/models/product/index.js";import{isServer as o}from"../utils/helper.js";import"../router/index.js";import"../stores/cart/index.js";import{getCategoryPath as r}from"../functions/models/category/index.js";import"../stores/customer/index.js";import'./../ext/uuid/dist/esm-browser/stringify.js';import'./../ext/uuid/dist/esm-browser/v3.js';import'./../ext/uuid/dist/esm-browser/native.js';import'./../ext/uuid/dist/esm-browser/v5.js';import"../i18n/index.js";import'./../ext/mobx/dist/mobx.esm.js';import{getDefaultSrc as t}from"../functions/models/image/index.js";import"../functions/models/product-list/index.js";import{getProductVariantMainImage as n,getProductVariantPrice as s,getProductVariantFinalPrice as a,getProductVariantSellPrice as d,getProductVariantDiscountPrice as m}from"../functions/models/product/variant/index.js";import'./../ext/lodash/_isFlattenable.js';import'./../ext/lodash/sortBy.js';import"../stores/base/index.js";import"../packages/storefront-api-client/src/utils/api.js";import'./../ext/isomorphic-fetch/fetch-npm-node.js';import"./analytics.js";import'./../ext/animejs/lib/anime.esm.js';import"../packages/storefront-api/src/index.js";import"../theme/styles/index.js";import'./../ext/preact/dist/preact.mjs.js';import'./../ext/preact/hooks/dist/hooks.mjs.js';import"../utils/fetch.js";import"../packages/storefront-models/src/models/merchant-settings/index.js";var u=function(){return!o()&&!i.isEditor},c=function(){return u()&&!!i.fbpId&&!!window.fbq},l=function(){return u()&&!!window.gtag},p=function(){return u()&&!!window.dataLayer},v=function(){return u()&&!!i.tiktokPixelId&&!!window.ttq};function f(i,o){var u,c,l,p,v=e(i),f=i.categories.length>0?r(i.categories[0]).map(function(i){return i.name}):[],j=null===(u=n(v))||void 0===u?void 0:u.image,g=s(v);return{id:i.id,variantId:v.id,name:i.name,price:null!==(c=a(v))&&void 0!==c?c:0,currency:(null==g?void 0:g.currency)||"TRY",categoryPath:f,categoryString:f.join(" > "),brand:(null===(l=i.brand)||void 0===l?void 0:l.name)||"",variant:v.variantValues.map(function(i){return i.name}).join(" / "),barcode:null===(p=v.barcodeList)||void 0===p?void 0:p[0],image:j?t(j):"",sellPrice:d(v)||void 0,discountPrice:m(v)}}function j(i,e,o){var r,t,n,s,a,d=[];if(null===(r=null==o?void 0:o.categories)||void 0===r?void 0:r.length)(m=o.categories[0]).categoryPath&&m.categoryPath.forEach(function(i){return d.push(i)}),d.push(m.name);else if(null===(t=i.variant.categories)||void 0===t?void 0:t.length){var m;(m=i.variant.categories[0]).categoryPath&&m.categoryPath.forEach(function(i){return d.push(i.name)}),d.push(m.name)}return{id:i.variant.productId||"",variantId:i.variant.id||"",name:i.variant.name,price:i.finalPrice||0,quantity:null!=e?e:i.quantity,currency:i.currencyCode||"",categoryPath:d,categoryString:d.join(" > "),brand:(null===(n=null==o?void 0:o.brand)||void 0===n?void 0:n.name)||(null===(s=i.variant.brand)||void 0===s?void 0:s.name)||"",variant:(null===(a=i.variant.variantValues)||void 0===a?void 0:a.map(function(i){return i.variantValueName}).join(" / "))||""}}function g(i){var e;return{items:i.orderLineItems.map(function(i){return j(i)}),totalPrice:"totalFinalPrice"in i?i.totalFinalPrice:i.totalPrice,currency:i.currencyCode||(null===(e=i.orderLineItems[0])||void 0===e?void 0:e.currencyCode)||"TRY",itemCount:i.orderLineItems.length}}export{u as canTrack,g as extractCartData,j as extractCartItemData,f as extractProductData,c as hasFacebookPixel,l as hasGoogleAnalytics,p as hasGoogleTagManager,v as hasTiktokPixel};
@@ -0,0 +1 @@
1
+ import t from"./_baseFlatten.js";var r=t;var a=function(t){return(null==t?0:t.length)?r(t,1):[]};export{a as default};
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as r,__assign as t}from'./../../../ext/tslib/tslib.es6.mjs.js';import{APIResponse as s}from"../../../packages/storefront-api-client/src/utils/api.js";import'./../../../ext/isomorphic-fetch/fetch-npm-node.js';import{IkasStorefrontConfig as i}from"../../../packages/storefront-config/src/index.js";import"../../../analytics/analytics.js";import'./../../../ext/mobx/dist/mobx.esm.js';import'./../../../ext/animejs/lib/anime.esm.js';import"../../../packages/storefront-api/src/index.js";import{initIkasCampaignOffer as n}from"../../models/product/campaign-offer/init.js";import"../../../stores/customer/index.js";import"../../../i18n/index.js";import'./../../../ext/lodash/sortBy.js';import"../../../router/index.js";import"../../../stores/cart/index.js";import"../../../stores/base/index.js";import'./../../../ext/uuid/dist/esm-browser/stringify.js';import'./../../../ext/uuid/dist/esm-browser/v3.js';import'./../../../ext/uuid/dist/esm-browser/native.js';import'./../../../ext/uuid/dist/esm-browser/v5.js';import{initIkasOrder as d}from"../../models/order/index.js";import"../../models/product-list/index.js";import"../../../theme/styles/index.js";import'./../../../ext/preact/dist/preact.mjs.js';import'./../../../ext/preact/hooks/dist/hooks.mjs.js';import"../../../utils/fetch.js";import"../../../packages/storefront-models/src/models/merchant-settings/index.js";function o(e){return t(t({},d(e)),{cancelReason:null})}function a(t){return e(this,void 0,void 0,function(){var e,d,a;return r(this,function(r){switch(r.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/queries/getCartById.js")];case 1:return[4,(0,r.sent().getCartById)(t,["merchantId","orderLineItems.variant.tagIds","billingAddress.region.createdAt","billingAddress.region.deleted","billingAddress.region.updatedAt","shippingAddress.region.createdAt","shippingAddress.region.deleted","shippingAddress.region.updatedAt","currencyRates","abandonedCartFlows"])];case 2:return e=r.sent(),d=e.data?o(e.data):null,null===(a=null==d?void 0:d.campaignOffers)||void 0===a||a.forEach(function(e){e.campaignOffer&&n(e.campaignOffer,i.getCurrentLocale())}),[2,new s(d||null,e.graphQLErrors,e.errorCodes)]}})})}function p(t){return e(this,void 0,void 0,function(){var e,i;return r(this,function(r){switch(r.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/saveCart.js")];case 1:return[4,(0,r.sent().saveCart)(t,["merchantId","orderLineItems.variant.tagIds","billingAddress.region.createdAt","billingAddress.region.deleted","billingAddress.region.updatedAt","shippingAddress.region.createdAt","shippingAddress.region.deleted","shippingAddress.region.updatedAt","currencyRates","abandonedCartFlows"])];case 2:return e=r.sent(),i=e.data?o(e.data):null,[2,new s(i||null,e.graphQLErrors)]}})})}function c(t){return e(this,void 0,void 0,function(){var e;return r(this,function(r){switch(r.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/createPayWithIkasSessionUrl.js")];case 1:return[4,(0,r.sent().createPayWithIkasSessionUrl)(t)];case 2:return e=r.sent(),[2,new s(e.data,e.graphQLErrors)]}})})}function u(t){return e(this,void 0,void 0,function(){var e,i;return r(this,function(r){switch(r.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/saveCartCouponCode.js")];case 1:return[4,(0,r.sent().saveCartCouponCode)(t,["merchantId","orderLineItems.variant.tagIds","billingAddress.region.createdAt","billingAddress.region.deleted","billingAddress.region.updatedAt","shippingAddress.region.createdAt","shippingAddress.region.deleted","shippingAddress.region.updatedAt","currencyRates","abandonedCartFlows"])];case 2:return e=r.sent(),i=e.data?o(e.data):null,[2,new s(i||null,e.graphQLErrors)]}})})}function l(t){return e(this,void 0,void 0,function(){var e,i;return r(this,function(r){switch(r.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/addItemToCart.js")];case 1:return[4,(0,r.sent().addItemToCart)(t,["merchantId","orderLineItems.variant.tagIds","billingAddress.region.createdAt","billingAddress.region.deleted","billingAddress.region.updatedAt","shippingAddress.region.createdAt","shippingAddress.region.deleted","shippingAddress.region.updatedAt","currencyRates","abandonedCartFlows"])];case 2:return e=r.sent(),i=e.data?o(e.data):null,[2,new s(i||null,e.graphQLErrors)]}})})}function m(t){return e(this,void 0,void 0,function(){var e,i;return r(this,function(r){switch(r.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/updateCartCampaignOffer.js")];case 1:return[4,(0,r.sent().updateCartCampaignOffer)(t,["merchantId","orderLineItems.variant.tagIds","billingAddress.region.createdAt","billingAddress.region.deleted","billingAddress.region.updatedAt","shippingAddress.region.createdAt","shippingAddress.region.deleted","shippingAddress.region.updatedAt","currencyRates","abandonedCartFlows"])];case 2:return e=r.sent(),i=e.data?o(e.data):null,[2,new s(i||null,e.graphQLErrors)]}})})}export{l as apiAddItemToCart,c as apiCreatePayWithIkasSessionUrl,a as apiGetCartById,p as apiSaveCart,u as apiSaveCartCouponCode,m as apiUpdateCartCampaignOffer};
1
+ import{__awaiter as e,__generator as r,__assign as t}from'./../../../ext/tslib/tslib.es6.mjs.js';import{APIResponse as s}from"../../../packages/storefront-api-client/src/utils/api.js";import'./../../../ext/isomorphic-fetch/fetch-npm-node.js';import{IkasStorefrontConfig as i}from"../../../packages/storefront-config/src/index.js";import"../../../analytics/analytics.js";import'./../../../ext/mobx/dist/mobx.esm.js';import'./../../../ext/animejs/lib/anime.esm.js';import"../../../packages/storefront-api/src/index.js";import{initIkasCampaignOffer as n}from"../../models/product/campaign-offer/init.js";import"../../../stores/customer/index.js";import"../../../i18n/index.js";import'./../../../ext/lodash/sortBy.js';import"../../../router/index.js";import"../../../stores/cart/index.js";import"../../../stores/base/index.js";import'./../../../ext/uuid/dist/esm-browser/stringify.js';import'./../../../ext/uuid/dist/esm-browser/v3.js';import'./../../../ext/uuid/dist/esm-browser/native.js';import'./../../../ext/uuid/dist/esm-browser/v5.js';import{initIkasOrder as d}from"../../models/order/index.js";import"../../models/product-list/index.js";import'./../../../ext/lodash/_isFlattenable.js';import"../../../theme/styles/index.js";import'./../../../ext/preact/dist/preact.mjs.js';import'./../../../ext/preact/hooks/dist/hooks.mjs.js';import"../../../utils/fetch.js";import"../../../packages/storefront-models/src/models/merchant-settings/index.js";function o(e){return t(t({},d(e)),{cancelReason:null})}function a(t){return e(this,void 0,void 0,function(){var e,d,a;return r(this,function(r){switch(r.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/queries/getCartById.js")];case 1:return[4,(0,r.sent().getCartById)(t,["merchantId","orderLineItems.variant.tagIds","billingAddress.region.createdAt","billingAddress.region.deleted","billingAddress.region.updatedAt","shippingAddress.region.createdAt","shippingAddress.region.deleted","shippingAddress.region.updatedAt","currencyRates","abandonedCartFlows"])];case 2:return e=r.sent(),d=e.data?o(e.data):null,null===(a=null==d?void 0:d.campaignOffers)||void 0===a||a.forEach(function(e){e.campaignOffer&&n(e.campaignOffer,i.getCurrentLocale())}),[2,new s(d||null,e.graphQLErrors,e.errorCodes)]}})})}function p(t){return e(this,void 0,void 0,function(){var e,i;return r(this,function(r){switch(r.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/saveCart.js")];case 1:return[4,(0,r.sent().saveCart)(t,["merchantId","orderLineItems.variant.tagIds","billingAddress.region.createdAt","billingAddress.region.deleted","billingAddress.region.updatedAt","shippingAddress.region.createdAt","shippingAddress.region.deleted","shippingAddress.region.updatedAt","currencyRates","abandonedCartFlows"])];case 2:return e=r.sent(),i=e.data?o(e.data):null,[2,new s(i||null,e.graphQLErrors)]}})})}function l(t){return e(this,void 0,void 0,function(){var e;return r(this,function(r){switch(r.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/createPayWithIkasSessionUrl.js")];case 1:return[4,(0,r.sent().createPayWithIkasSessionUrl)(t)];case 2:return e=r.sent(),[2,new s(e.data,e.graphQLErrors)]}})})}function u(t){return e(this,void 0,void 0,function(){var e,i;return r(this,function(r){switch(r.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/saveCartCouponCode.js")];case 1:return[4,(0,r.sent().saveCartCouponCode)(t,["merchantId","orderLineItems.variant.tagIds","billingAddress.region.createdAt","billingAddress.region.deleted","billingAddress.region.updatedAt","shippingAddress.region.createdAt","shippingAddress.region.deleted","shippingAddress.region.updatedAt","currencyRates","abandonedCartFlows"])];case 2:return e=r.sent(),i=e.data?o(e.data):null,[2,new s(i||null,e.graphQLErrors)]}})})}function c(t){return e(this,void 0,void 0,function(){var e,i;return r(this,function(r){switch(r.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/addItemToCart.js")];case 1:return[4,(0,r.sent().addItemToCart)(t,["merchantId","orderLineItems.variant.tagIds","billingAddress.region.createdAt","billingAddress.region.deleted","billingAddress.region.updatedAt","shippingAddress.region.createdAt","shippingAddress.region.deleted","shippingAddress.region.updatedAt","currencyRates","abandonedCartFlows"])];case 2:return e=r.sent(),i=e.data?o(e.data):null,[2,new s(i||null,e.graphQLErrors)]}})})}function m(t){return e(this,void 0,void 0,function(){var e,i;return r(this,function(r){switch(r.label){case 0:return[4,import("../../../packages/storefront-api/src/__api/mutations/updateCartCampaignOffer.js")];case 1:return[4,(0,r.sent().updateCartCampaignOffer)(t,["merchantId","orderLineItems.variant.tagIds","billingAddress.region.createdAt","billingAddress.region.deleted","billingAddress.region.updatedAt","shippingAddress.region.createdAt","shippingAddress.region.deleted","shippingAddress.region.updatedAt","currencyRates","abandonedCartFlows"])];case 2:return e=r.sent(),i=e.data?o(e.data):null,[2,new s(i||null,e.graphQLErrors)]}})})}export{c as apiAddItemToCart,l as apiCreatePayWithIkasSessionUrl,a as apiGetCartById,p as apiSaveCart,u as apiSaveCartCouponCode,m as apiUpdateCartCampaignOffer};
@@ -1 +1 @@
1
- import{withRoutePrefix as t}from"../../../router/index.js";function e(e){var a;return(null===(a=e.metaData)||void 0===a?void 0:a.slug)?t("/".concat(e.metaData.slug)):""}function a(t){var e={id:t.id,createdAt:t.createdAt,updatedAt:t.updatedAt,deleted:t.deleted,metaData:t.metaData,description:t.description,imageId:t.imageId,name:t.name};return t.categoryPathItems.some(function(t){return t.id===e.id})?t.categoryPathItems:t.categoryPathItems.concat(e)}export{a as getCategoryPath,e as getIkasCategoryHref};
1
+ import{withRoutePrefix as t}from"../../../router/index.js";function e(e){var a;return(null===(a=e.metaData)||void 0===a?void 0:a.slug)?t("/".concat(e.metaData.slug)):""}function a(t){if(!t)return[];var e={id:t.id,createdAt:t.createdAt,updatedAt:t.updatedAt,deleted:t.deleted,metaData:t.metaData,description:t.description,imageId:t.imageId,name:t.name};return t.categoryPathItems.some(function(t){return t.id===e.id})?t.categoryPathItems:t.categoryPathItems.concat(e)}export{a as getCategoryPath,e as getIkasCategoryHref};
@@ -1,62 +1,97 @@
1
1
  import { IkasImage } from "../../../storefront-models/src";
2
2
  /**
3
- * Returns the default source URL for an image at 1080px resolution.
3
+ * Returns the default source URL for an image OR video at 1080px resolution.
4
+ *
5
+ * Product media items (IkasProductImage) can be videos. ALWAYS check `item.isVideo`
6
+ * and render a `<video src={getDefaultSrc(item)}>` instead of an `<img>` when it is true.
7
+ * Never assume every media item is an image.
4
8
  *
5
9
  * @ai-category Image
6
10
  * @ai-related getThumbnailSrc, getSrc, createMediaSrcset
7
11
  *
8
12
  * @param image - The image object to generate the default source URL for.
9
- * @returns The CDN URL string for the image at 1080px size.
13
+ * @returns The CDN URL string for the image or video at 1080px size.
10
14
  *
11
15
  * @example
12
16
  * ```typescript
13
- * import { getDefaultSrc } from "@ikas/bp-storefront";
14
- *
15
- * const src = getDefaultSrc(image);
16
- * console.log(src); // "https://cdn.example.com/images/.../1080/image.webp"
17
+ * import { getDefaultSrc, createMediaSrcset } from "@ikas/bp-storefront";
18
+ *
19
+ * // Product images can be videos — ALWAYS branch on isVideo when mapping media:
20
+ * {product.images.map((item, i) =>
21
+ * item.isVideo ? (
22
+ * <video key={i} src={getDefaultSrc(item)} muted playsInline preload="metadata">
23
+ * <track kind="captions" />
24
+ * </video>
25
+ * ) : (
26
+ * <img key={i} src={getDefaultSrc(item)} srcSet={createMediaSrcset(item)} alt={`Product ${i + 1}`} />
27
+ * )
28
+ * )}
17
29
  * ```
18
30
  */
19
31
  export declare function getDefaultSrc(image: IkasImage): string;
20
32
  /**
21
- * Returns the thumbnail source URL for an image at 180px resolution.
33
+ * Returns the thumbnail source URL for an image OR video at 180px resolution.
34
+ *
35
+ * When mapping over product media (IkasProductImage[]), some items are videos:
36
+ * check `item.isVideo` and render a `<video>` thumbnail (typically with a play
37
+ * overlay) instead of an `<img>` when it is true.
22
38
  *
23
39
  * @ai-category Image
24
40
  * @ai-related getDefaultSrc, getSrc, createMediaSrcset
25
41
  *
26
42
  * @param image - The image object to generate the thumbnail source URL for.
27
- * @returns The CDN URL string for the image at 180px size.
43
+ * @returns The CDN URL string for the image or video at 180px size.
28
44
  *
29
45
  * @example
30
46
  * ```typescript
31
- * import { getThumbnailSrc } from "@ikas/bp-storefront";
32
- *
33
- * const thumbnailSrc = getThumbnailSrc(image);
34
- * console.log(thumbnailSrc); // "https://cdn.example.com/images/.../180/image.webp"
47
+ * import { getThumbnailSrc, getDefaultSrc } from "@ikas/bp-storefront";
48
+ *
49
+ * // Thumbnail rail — branch on isVideo per item:
50
+ * {product.images.map((item, i) =>
51
+ * item.isVideo ? (
52
+ * <video key={i} src={getDefaultSrc(item)} muted preload="metadata">
53
+ * <track kind="captions" />
54
+ * </video>
55
+ * ) : (
56
+ * <img key={i} src={getThumbnailSrc(item)} sizes="112px" alt={`Thumb ${i + 1}`} />
57
+ * )
58
+ * )}
35
59
  * ```
36
60
  */
37
61
  export declare function getThumbnailSrc(image: IkasImage): string;
38
62
  /**
39
63
  * Generates the full CDN source URL for an image or video at the specified size, handling both legacy path-based and merchant-scoped ID formats.
40
64
  *
65
+ * NOTE: For videos (`image.isVideo === true`) the `size` argument is IGNORED — the original .mp4 is always returned.
66
+ * So `getSrc(item, 240)` and `getDefaultSrc(item)` produce the identical URL for a video. PREFER `getDefaultSrc(item)`
67
+ * for video `src` (no size param) — do NOT pass an arbitrary size like `getSrc(item, 240)`, it is misleading.
68
+ *
41
69
  * @ai-category Image
42
70
  * @ai-related getDefaultSrc, getThumbnailSrc, createMediaSrcset
43
71
  *
44
72
  * @param image - The image object containing the id, fileName, and isVideo flag.
45
- * @param size - The desired image width in pixels for the generated URL.
73
+ * @param size - The desired image width in pixels. Ignored for videos.
46
74
  * @returns The full CDN URL string for the image or video.
47
75
  *
48
76
  * @example
49
77
  * ```typescript
50
- * import { getSrc } from "@ikas/bp-storefront";
78
+ * import { getSrc, getDefaultSrc } from "@ikas/bp-storefront";
51
79
  *
52
80
  * const src = getSrc(image, 640);
53
81
  * console.log(src); // "https://cdn.example.com/images/.../640/image.webp"
82
+ *
83
+ * // For a video, use getDefaultSrc (size is ignored anyway):
84
+ * <video src={getDefaultSrc(item)} muted playsInline preload="metadata" />
54
85
  * ```
55
86
  */
56
87
  export declare function getSrc(image: IkasImage, size: number): string;
57
88
  /**
58
89
  * Generates a complete responsive `srcset` string for an image across all standard sizes (180–3840px).
59
90
  *
91
+ * srcset applies to `<img>` only — video media (`item.isVideo === true`) has no srcset
92
+ * and must be rendered with `<video src={getDefaultSrc(item)}>`. When mapping product
93
+ * images, branch on `item.isVideo` first, then only use createMediaSrcset on the image branch.
94
+ *
60
95
  * @ai-category Image
61
96
  * @ai-related getDefaultSrc, getThumbnailSrc, getSrc
62
97
  *
@@ -67,12 +102,22 @@ export declare function getSrc(image: IkasImage, size: number): string;
67
102
  * ```typescript
68
103
  * import { createMediaSrcset, getDefaultSrc } from "@ikas/bp-storefront";
69
104
  *
70
- * <img
71
- * src={getDefaultSrc(image)}
72
- * srcSet={createMediaSrcset(image)}
73
- * sizes="(max-width: 768px) 100vw, 50vw"
74
- * alt="Product"
75
- * />
105
+ * // Product images can be videos — ALWAYS branch on isVideo when mapping media:
106
+ * {product.images.map((item, i) =>
107
+ * item.isVideo ? (
108
+ * <video key={i} src={getDefaultSrc(item)} muted playsInline preload="metadata">
109
+ * <track kind="captions" />
110
+ * </video>
111
+ * ) : (
112
+ * <img
113
+ * key={i}
114
+ * src={getDefaultSrc(item)}
115
+ * srcSet={createMediaSrcset(item)}
116
+ * sizes="(max-width: 768px) 100vw, 50vw"
117
+ * alt={`Product ${i + 1}`}
118
+ * />
119
+ * )
120
+ * )}
76
121
  * ```
77
122
  */
78
123
  export declare function createMediaSrcset(image?: IkasImage | null): string;
@@ -1 +1 @@
1
- import{IkasStorefrontConfig as c}from"../../../packages/storefront-config/src/index.js";function n(c){return a(c,1080)}function o(c){return a(c,180)}function a(n,o){var a,i=c.cdnUrl,t=c.videoCdnUrl;if(n.id.includes("/"))return n.isVideo?"".concat(t,"videos/").concat(n.id,"/original.mp4"):n.fileName?"".concat(i,"images/").concat(n.id,"/").concat(o,"/").concat(n.fileName,".webp"):"".concat(i,"images/").concat(n.id,"/image_").concat(o,".webp");var e=null===(a=c.merchantSettings)||void 0===a?void 0:a.merchantId;return n.isVideo?"".concat(t,"videos/").concat(e,"/").concat(n.id,"/original.mp4"):n.fileName?"".concat(i,"images/").concat(e,"/").concat(n.id,"/").concat(o,"/").concat(n.fileName,".webp"):"".concat(i,"images/").concat(e,"/").concat(n.id,"/image_").concat(o,".webp")}var i=[180,360,420,540,640,720,800,900,1080,1296,1350,1512,1728,1950,2560,3840];function t(c){return c?i.map(function(n){return"".concat(a(c,n)," ").concat(n,"w")}).join(", "):""}export{t as createMediaSrcset,n as getDefaultSrc,a as getSrc,o as getThumbnailSrc};
1
+ import{IkasStorefrontConfig as c}from"../../../packages/storefront-config/src/index.js";function n(c){return o(c,1080)}function i(c){return o(c,180)}function o(n,i){var o;if(!(null==n?void 0:n.id))return"";var a=c.cdnUrl,t=c.videoCdnUrl;if(n.id.includes("/"))return n.isVideo?"".concat(t,"videos/").concat(n.id,"/original.mp4"):n.fileName?"".concat(a,"images/").concat(n.id,"/").concat(i,"/").concat(n.fileName,".webp"):"".concat(a,"images/").concat(n.id,"/image_").concat(i,".webp");var e=null===(o=c.merchantSettings)||void 0===o?void 0:o.merchantId;return n.isVideo?"".concat(t,"videos/").concat(e,"/").concat(n.id,"/original.mp4"):n.fileName?"".concat(a,"images/").concat(e,"/").concat(n.id,"/").concat(i,"/").concat(n.fileName,".webp"):"".concat(a,"images/").concat(e,"/").concat(n.id,"/image_").concat(i,".webp")}var a=[180,360,420,540,640,720,800,900,1080,1296,1350,1512,1728,1950,2560,3840];function t(c){return(null==c?void 0:c.id)?a.map(function(n){return"".concat(o(c,n)," ").concat(n,"w")}).join(", "):""}export{t as createMediaSrcset,n as getDefaultSrc,o as getSrc,i as getThumbnailSrc};
@@ -48,6 +48,24 @@ export declare function initOptionValues(optionSet: IkasProductOptionSet): void;
48
48
  * ```
49
49
  */
50
50
  export declare function getDisplayedOptions(optionSet: IkasProductOptionSet): IkasProductOption[];
51
+ /**
52
+ * Checks whether the option set has any displayed (top-level) options.
53
+ *
54
+ * @ai-category ProductOptionSet
55
+ * @ai-related getDisplayedOptions, hasValidProductOptionSetValues
56
+ *
57
+ * @param optionSet - The product option set to check.
58
+ * @returns True if there is at least one displayed option, false otherwise.
59
+ *
60
+ * @example
61
+ * ```typescript
62
+ * import { hasDisplayedOptions } from "@ikas/bp-storefront";
63
+ * if (hasDisplayedOptions(product.optionSet)) {
64
+ * // render option selector
65
+ * }
66
+ * ```
67
+ */
68
+ export declare function hasDisplayedOptions(optionSet: IkasProductOptionSet): boolean;
51
69
  /**
52
70
  * Initializes the values for all options in the product option set by delegating to the option-level initializer.
53
71
  *
@@ -1 +1 @@
1
- import{sortBy as n}from"../../../../utils/helper.js";import{initIkasProductOptionValues as o,hasValidProductOptionValues as t}from"./option/index.js";function i(n){n.options.forEach(function(o){var t=n.options.filter(function(n){return n.requiredOptionId===o.id});t.length?o.childOptions=t:o.childOptions=[]})}function r(n){n.options.forEach(function(n){return o(n)})}function e(o){return n(o.options.filter(function(n){return!n.requiredOptionId}),"order")}function u(n){n.options.forEach(function(n){return o(n)})}function f(n){return e(n).every(t)}export{e as getDisplayedOptions,f as hasValidProductOptionSetValues,r as initOptionValues,u as initProductOptionSetValues,i as setChildOptions};
1
+ import{sortBy as n}from"../../../../utils/helper.js";import{initIkasProductOptionValues as o,hasValidProductOptionValues as t}from"./option/index.js";function r(n){n.options.forEach(function(o){var t=n.options.filter(function(n){return n.requiredOptionId===o.id});t.length?o.childOptions=t:o.childOptions=[]})}function i(n){n.options.forEach(function(n){return o(n)})}function e(o){return n(o.options.filter(function(n){return!n.requiredOptionId}),"order")}function u(n){return e(n).length>0}function f(n){n.options.forEach(function(n){return o(n)})}function c(n){return e(n).every(t)}export{e as getDisplayedOptions,u as hasDisplayedOptions,c as hasValidProductOptionSetValues,i as initOptionValues,f as initProductOptionSetValues,r as setChildOptions};
@@ -1,16 +1,19 @@
1
1
  import { BackInStockNotificationForm, IkasAppliedCampaignAmount, IkasProductAttributeMap, IkasProductPrice, IkasProductVariant } from "../../../../storefront-models/src";
2
2
  /**
3
- * Get the main/primary image for a product variant.
3
+ * Get the main/primary media item for a product variant.
4
+ *
5
+ * The returned IkasProductImage may be a video (`isVideo === true`) — branch on it
6
+ * and render `<video>` instead of `<img>`.
4
7
  *
5
8
  * @ai-category ProductDetail, ProductList
6
9
  * @ai-related getSelectedProductVariant
7
10
  *
8
11
  * @param variant - The product variant
9
- * @returns The first IkasProductImage of the variant, or undefined if no images. Access `.image` to get the IkasImage for CDN helpers.
12
+ * @returns The first IkasProductImage of the variant, or undefined if no images. Check `.isVideo` to decide between `<video>` and `<img>`, and access `.image` to get the IkasImage for CDN helpers.
10
13
  *
11
14
  * @example
12
15
  * ```typescript
13
- * import { getProductVariantMainImage, getSelectedProductVariant, getDefaultSrc } from "@ikas/bp-storefront";
16
+ * import { getProductVariantMainImage, getSelectedProductVariant, getDefaultSrc, createMediaSrcset } from "@ikas/bp-storefront";
14
17
  * import { IkasProduct } from "@ikas/bp-storefront";
15
18
  *
16
19
  * function ProductImage({ product }: { product: IkasProduct }) {
@@ -22,7 +25,14 @@ import { BackInStockNotificationForm, IkasAppliedCampaignAmount, IkasProductAttr
22
25
  * return <div className="no-image">No image available</div>;
23
26
  * }
24
27
  *
25
- * return <img src={getDefaultSrc(image)} alt={product.name} />;
28
+ * // Media can be a video — branch on isVideo:
29
+ * return productImage.isVideo ? (
30
+ * <video src={getDefaultSrc(image)} muted playsInline loop>
31
+ * <track kind="captions" />
32
+ * </video>
33
+ * ) : (
34
+ * <img src={getDefaultSrc(image)} srcSet={createMediaSrcset(image)} alt={product.name} />
35
+ * );
26
36
  * }
27
37
  * ```
28
38
  */
@@ -1 +1 @@
1
- import{__assign as e,__awaiter as t,__generator as r}from'./../../../ext/tslib/tslib.es6.mjs.js';import{IkasStorefrontConfig as n}from"../../../packages/storefront-config/src/index.js";import i from'./../../../ext/lodash/cloneDeep.js';import{I18n as a}from"../../../i18n/index.js";import{Router as o,withRoutePrefix as s}from"../../../router/index.js";import{customerStore as u}from"../../../stores/customer/index.js";import{isClient as d,isBackNavigation as l,getQueryParams as c,debounce as f,stringToSlug as v,stringifyQueryParams as p}from"../../../utils/helper.js";import{setSavedLastViewedProductsResponse as g,getLastViewedProducts as I,waitForCustomerStoreInit as E}from"../../stores/customer/index.js";import{getIkasFilterCategorySlug as C,getIkasFilterCategoryHref as S}from"../filter-category/index.js";import{getFilterValueList as A,clearFilter as y,selectFilterValue as T,onNumberRangeFilterOptionClick as R,getFilterKeyList as D,applyQueryParamForFilter as h,initIkasProductFilter as _,isCustomValueFilter as m}from"../product/filter/index.js";import{getProductVariantPrice as b,hasProductVariantStock as N}from"../product/variant/index.js";var L;function O(t){var r=e({data:[],limit:10,page:1,count:0,isInitialized:!1,isLoading:!1,type:"ALL",sort:"DEFAULT",searchKeyword:"",pageType:"CATEGORY",category:null,brand:null,productListPropValue:{id:"",productIds:[],initialLimit:10,productListType:"ALL"}},t);return function(e){var t;if((null===(t=e.pageSpecificData)||void 0===t?void 0:t.orderType)&&["ALL"].includes(e.type))switch(e.pageSpecificData.orderType){case"HIGHEST_DISCOUNT_RATIO":e.sort="DECRASING_DISCOUNT";break;case"LOWEST_DISCOUNT_RATIO":e.sort="INCREASING_DISCOUNT";break;case"HIGHEST_PRICE":e.sort="DECREASING_PRICE";break;case"LOWEST_PRICE":e.sort="INCREASING_PRICE";break;case"NEWEST":e.sort="LAST_ADDED";break;case"OLDEST":e.sort="FIRST_ADDED";break;case"MANUALLY":e.sort="FEATURED"}}(r),z(r),J(r),r}function P(e){var t;if(d()&&(!l()||!o.isFromBFCache)){!function(e){var t=c(),r=null==t?void 0:t.get("page");if(r){var n=parseInt(r);isNaN(n)||(e.page=n,e.infiniteScrollPage=n)}}(e);if(["CATEGORY","BRAND","SEARCH"].includes(e.pageType)&&location.search&&U(e)&&((null===(t=e.productListPropValue)||void 0===t?void 0:t.usePageFilter)||"SEARCH"===e.type))le(e,c(),e.page>1);else e.page>1?le(e,void 0,!0):k(e)?le(e):Re(e)}}function G(e,t){t!==e.searchKeyword&&(e.searchKeyword=t,_e(e),me(e))}function U(e){return"ALL"===e.type||"CATEGORY"===e.type}function V(e){var t,r;return(null===(t=e.filters)||void 0===t?void 0:t.some(function(e){return!!A(e).length}))||!!e.searchKeyword||"CATEGORY"!==e.pageType&&(!!e.filterCategoryId||!!(null===(r=e.filterCategories)||void 0===r?void 0:r.some(function(e){return e.isSelected})))}function w(e){return"STATIC"===e.type}function F(e){return"DISCOUNTED"===e.type}function j(e){return"RECOMMENDED"===e.type}function k(e){return"LAST_VIEWED"===e.type}function x(e){return"RELATED_PRODUCTS"===e.type}function H(e){return"VIEWED_TOGETHER"===e.type}function W(e){return"PURCHASED_TOGETHER"===e.type}function K(e){return"SEARCH"===e.type}function B(e){return!(w(e)||F(e)||j(e)||!e.minPage)&&e.minPage>1}function Y(e){return!(w(e)||F(e)||j(e))&&e.page*e.limit<e.count}function Z(e){var t;return(null===(t=e.filterCategories)||void 0===t?void 0:t.filter(function(e){return 0!==e.resultCount}))||[]}function M(e){var t;return!!e.searchKeyword||!!(null===(t=e.filters)||void 0===t?void 0:t.some(function(e){return!!A(e).length}))}function q(e){var t;return"MANUALLY"===(null===(t=e.pageSpecificData)||void 0===t?void 0:t.orderType)&&["ALL","CATEGORY"].includes(e.type)}function z(e){var t=V(e);e.data.forEach(function(e){return e.isFiltered=t||!1})}function J(e){var t=w(e);e.data.forEach(function(e){return e.isFiltered=t||!1})}function X(e){e._enableSuggestions=!0}function Q(e){var t={};return e.categoryId&&(t.categoryId=e.categoryId),e.brandId&&(t.brandId=e.brandId),Object.keys(t).length?s("/search?suggestion=".concat(encodeURIComponent(JSON.stringify(t)))):s("/search")}function $(i,a,o,s){return t(this,void 0,void 0,function(){var t,u,d,l,f,v,p,g,I,E,C,S,y,T,R,D;return r(this,function(r){switch(r.label){case 0:return t=[],u=[],null===(S=i.filters)||void 0===S||S.forEach(function(e){var r=A(e);r.length&&t.push({id:e.id,type:e.type,displayType:e.displayType,valueList:r}),e.isFacetFilter&&u.push({id:e.id,type:e.type,displayType:e.displayType})}),d=c(),(l=null==d?void 0:d.get("suggestion"))&&(f=JSON.parse(decodeURIComponent(l)),(v=f.brandId)&&((p=null===(y=i.filters)||void 0===y?void 0:y.find(function(e){return"brand"===e.id&&"BRAND"===e.type}))&&(g=null===(T=p.values)||void 0===T?void 0:T.find(function(e){return e.id===v}))&&h(p,g.name),t.push({id:"brand",type:"BRAND",displayType:"BOX",valueList:[v]})),f.categoryId&&(i.filterCategoryId=f.categoryId),i.searchKeyword=f.term),I=null===(R=i.filterCategories)||void 0===R?void 0:R.filter(function(e){return e.isSelected}).map(function(e){return e.id}),E=function(e){var t,r;switch(e.sort){case"INCREASING_PRICE":t="ASC",r="PRICE";break;case"DECREASING_PRICE":t="DESC",r="PRICE";break;case"FIRST_ADDED":t="ASC",r="CREATED_AT";break;case"LAST_ADDED":t="DESC",r="CREATED_AT";break;case"INCREASING_DISCOUNT":t="ASC",r="DISCOUNT_RATIO";break;case"DECRASING_DISCOUNT":t="DESC",r="DISCOUNT_RATIO";break;case"FEATURED":if(K(e))return;t="ASC",r="MANUAL_SORT";break;case"DEFAULT":t=void 0,r=void 0;break;case"AVERAGE_RATING":t="DESC",r="AVERAGE_RATING";break;case"REVIEW_COUNT":t="DESC",r="REVIEW_COUNT";break;case"SALE_COUNT":t="DESC",r="SALE_COUNT";break;case"A_Z":t="ASC",r="NAME";break;case"Z_A":t="DESC",r="NAME"}if(t&&r)return{direction:t,type:r}}(i),j(i)&&i.recommendedProductData?[4,import("../../api/product/index.js")]:[3,3];case 1:return[4,(0,r.sent().apiGetSuggestedProducts)({priceListId:n.priceListId,salesChannelId:n.salesChannelId,brandIds:i.recommendedProductData.brandIds,categoryIds:i.recommendedProductData.categoryIds,locale:n.getCurrentLocale()})];case 2:case 5:case 8:case 11:case 14:return[2,r.sent()];case 3:return x(i)&&i.relatedProductData?[4,import("../../api/product/index.js")]:[3,6];case 4:return[4,(0,r.sent().apiGetSuggestedProducts)({priceListId:n.priceListId,salesChannelId:n.salesChannelId,productId:i.relatedProductData.productId,brandIds:i.relatedProductData.brandIds,categoryIds:i.relatedProductData.categoryIds,locale:n.getCurrentLocale()})];case 6:return H(i)&&i.viewedTogetherProductData?[4,import("../../api/product/index.js")]:[3,9];case 7:return[4,(0,r.sent().apiGetSuggestedProducts)({priceListId:n.priceListId,salesChannelId:n.salesChannelId,method:"VIEWED_TOGETHER",productIds:i.viewedTogetherProductData.productIds,locale:n.getCurrentLocale()})];case 9:return W(i)&&i.purchasedTogetherProductData?[4,import("../../api/product/index.js")]:[3,12];case 10:return[4,(0,r.sent().apiGetSuggestedProducts)({priceListId:n.priceListId,salesChannelId:n.salesChannelId,method:"PURCHASED_TOGETHER",productIds:i.purchasedTogetherProductData.productIds,locale:n.getCurrentLocale()})];case 12:return C={input:e(e(e(e({page:a,perPage:o},i._enableSuggestions?{enableSuggestions:i._enableSuggestions}:{}),{productIdList:w(i)?null===(D=i.productListPropValue.productIds)||void 0===D?void 0:D.map(function(e){return e.productId}):s,filterList:t,facetList:u}),i.baseCategoryIdList?{baseCategoryIdList:i.baseCategoryIdList}:{}),{brandId:"BRAND"===i.pageType&&"SEARCH"!==i.type?i.filterBrandId:void 0,categoryIdList:I&&I.length?I:i.filterCategoryId?[i.filterCategoryId]:void 0,priceListId:n.priceListId,salesChannelId:n.salesChannelId,query:i.searchKeyword,order:E?[E]:[],showStockOption:n.stockPreference||"SHOW_ALL"})},[4,import("../../api/product/index.js")];case 13:return[4,(0,r.sent().apiSearchProducts)(C,i.excludedFields||[])]}})})}function ee(e){return t(this,void 0,void 0,function(){var t,i,a,o,s,u;return r(this,function(r){switch(r.label){case 0:return[4,import("../../api/product/index.js")];case 1:return[4,(0,r.sent().apiGetProductFilterData)({categoryId:e.filterCategoryId?e.filterCategoryId:void 0,locale:n.getCurrentLocale()})];case 2:return t=r.sent(),e.filters=null===(a=null==t?void 0:t.data)||void 0===a?void 0:a.filters.map(function(e){return _(e)}),e.filterCategories=null===(o=null==t?void 0:t.data)||void 0===o?void 0:o.categories,ye(e),e.disabledSortTypes=null===(s=t.data)||void 0===s?void 0:s.disabledSortTypes,"CATEGORY"!==e.pageType&&e.filterCategoryId&&(i=null===(u=e.filterCategories)||void 0===u?void 0:u.find(function(t){return t.id===e.filterCategoryId}))&&(i.isSelected=!0),e.filters&&e.filters.sort(function(e,t){return e.order>t.order?1:-1}),[2]}})})}function te(e){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return[4,le(e)];case 1:return t=r.sent(),["CATEGORY","BRAND","SEARCH"].includes(e.pageType)?(t&&ne(e),[2]):[2]}})})}function re(e){var t,r,n,i={};if(null===(t=e.filters)||void 0===t||t.forEach(function(e){var t=D(e);t.length&&(i[v(e.name)]=t)}),e.searchKeyword&&(i.s=e.searchKeyword),e.sort&&(i.o=be[e.sort]),e.baseCategoryIdList&&(i.bc=e.baseCategoryIdList),e.suggestionCategoryId&&(i.suggestionCategoryId=e.suggestionCategoryId),e.infiniteScrollPage?i.page=e.infiniteScrollPage:i.page=e.page,"CATEGORY"!==e.pageType){var a=null===(r=e.filterCategories)||void 0===r?void 0:r.filter(function(e){return e.isSelected});if(!!(null==a?void 0:a.length))i.c=null==a?void 0:a.map(function(e){return C(e)});else if(e.filterCategoryId){var o=null===(n=e.filterCategories)||void 0===n?void 0:n.find(function(t){return t.id===e.filterCategoryId}),s=o?C(o):void 0;s&&(i.c=s)}}return p(i,{arrayFormat:"comma"})}function ne(e){if(d()&&!K(e)&&!n.isEditor){var t=re(e),r=s("".concat(location.pathname).concat(t?"?"+t:""));o.navigate(r,!0)}}function ie(e){var t,r;null===(t=e.filters)||void 0===t||t.forEach(function(e){return y(e)}),e.searchKeyword="","CATEGORY"!==e.pageType&&(e.filterCategoryId=void 0),null===(r=e.filterCategories)||void 0===r||r.forEach(function(e){return e.isSelected=!1}),te(e)}function ae(e,t){y(t),te(e)}function oe(e,t,r){T(t,r),te(e)}function se(e,t,r){R(t,r),te(e)}function ue(e){var t,r=null===(t=e.filters)||void 0===t?void 0:t.filter(function(e){var t;return null===(t=e.values)||void 0===t?void 0:t.some(function(e){return e.isSelected})});return null==r?void 0:r.map(function(e){var t,r;return e.numberRange?{filter:e,values:[e.numberRange.from+"-"+e.numberRange.to],commaSeperatedValues:e.numberRange.from+"-"+e.numberRange.to}:e.numberRangeListOptions?{filter:e,values:e.numberRangeListOptions.filter(function(e){return e.isSelected}).map(function(e){return e.from+"-"+e.to}),commaSeperatedValues:e.numberRangeListOptions.filter(function(e){return e.isSelected}).map(function(e){return e.from+"-"+e.to}).join(",")}:{filter:e,values:(null===(t=e.values)||void 0===t?void 0:t.filter(function(e){return e.isSelected}).map(function(e){return e.name}))||[],commaSeperatedValues:(null===(r=e.values)||void 0===r?void 0:r.filter(function(e){return e.isSelected}).map(function(e){return e.name}).join(","))||""}})}function de(e){return e.variants[0]}function le(e,n,a){return t(this,void 0,void 0,function(){var t,o,s,l,c,f,v,p,S,A,y,T,R,D,_,b;return r(this,function(r){switch(r.label){case 0:e.isLoading=!0,t=Date.now(),e.fetchRequestTime=t,r.label=1;case 1:return r.trys.push([1,14,15,16]),o=a?e.page:1,s=e.limit,!U(e)||e.filters?[3,3]:[4,ee(e)];case 2:r.sent(),r.label=3;case 3:return function(e,t){var r;try{null==t||t.forEach(function(t,r){var n,i=null===(n=e.filters)||void 0===n?void 0:n.find(function(e){return e.key===r});i&&h(i,t)});var n=null==t?void 0:t.get("s");n&&(e.searchKeyword=n);var i=null==t?void 0:t.get("o");if(i){var a=parseInt(i),o=Object.entries(be).find(function(e){return e[1]===a});o&&(e.sort=o[0])}if("CATEGORY"!==e.pageType){var s=null==t?void 0:t.get("c"),u=null==s?void 0:s.split(",");u&&u.length&&(null===(r=e.filterCategories)||void 0===r||r.forEach(function(e){e.isSelected=u.some(function(t){return t===C(e)})}))}if("SEARCH"===e.pageType){var d=null==t?void 0:t.get("bc"),l=null==d?void 0:d.split(",");l&&(e.baseCategoryIdList=l);var c=null==t?void 0:t.get("suggestion");if(c){var f=JSON.parse(decodeURIComponent(c)).categoryId;f&&(e.suggestionCategoryId=f)}var v=null==t?void 0:t.get("suggestionCategoryId");v&&(e.suggestionCategoryId=v,e.filterCategoryId=v)}}catch(e){console.log(e)}}(e,n),[4,fe(e)];case 4:return r.sent(),K(e)&&!M(e)?(e.data=[],e.page=1,e.minPage=1,e.count=0,e.isInitialized=!0,[2,!0]):(l=void 0,c=!1,w(e)?(o=void 0,s=200,[3,10]):[3,5]);case 5:return F(e)||j(e)?(o=1,s=10,[3,10]):[3,6];case 6:return k(e)?d()?[4,E(u)]:[3,9]:[3,10];case 7:return r.sent(),[4,I(u)];case 8:return(f=r.sent())&&f.length?(l=f.map(function(e){return e.productId}),c=u.useLastViewedProductResponse,[3,10]):[2];case 9:return[2];case 10:return c?(p=u._savedLastViewedProductsResponse,[3,13]):[3,11];case 11:return[4,$(e,o||1,s||10,l)];case 12:p=r.sent(),r.label=13;case 13:return(v=p)&&e.fetchRequestTime===t?(S=[],!c&&k(e)&&g(u,v),w(e)||k(e)?(A=w(e)?e.productListPropValue.productIds:u._lastViewedProducts,S=(null==A?void 0:A.map(function(e){var t,r,n=null===(r=null===(t=v.data)||void 0===t?void 0:t.data)||void 0===r?void 0:r.find(function(t){return t.id===e.productId}),i=null==n?void 0:n.variants.find(function(t){return t.id===e.variantId});if((null==i?void 0:i.isActive)&&N(i)||(i=null==n?void 0:n.variants.find(function(e){return e.isActive&&N(e)})),n&&i)return n.selectedVariantValues=i.variantValues,n}).filter(function(e){return!!e}))||[]):S=(null===(R=null===(T=v.data)||void 0===T?void 0:T.data)||void 0===R?void 0:R.map(function(e){var t=de(e);return e.selectedVariantValues=t.variantValues,e}))||[],null===(D=e.filters)||void 0===D||D.forEach(function(e){var t,r;if(void 0===e.isCollapsed){var n=!1;(!1===(null===(t=e.settings)||void 0===t?void 0:t.showCollapsedOnMobile)&&d()&&window.innerWidth<768||!1===(null===(r=e.settings)||void 0===r?void 0:r.showCollapsedOnDesktop))&&(n=!0),e.isCollapsed=!n}}),function(e,t){var r,n,a=i(e);null===(r=a.filters)||void 0===r||r.forEach(function(e){var r,n,i,a=null==t?void 0:t.find(function(t){return t.id===e.id});a?null===(r=e.values)||void 0===r||r.forEach(function(t){var r=a.values.find(function(e){return e.id===t.id});r?t.resultCount=r.count:m(e)?t.resultCount=null:t.resultCount=0}):m(e)?null===(n=e.values)||void 0===n||n.forEach(function(e){return e.resultCount=null}):null===(i=e.values)||void 0===i||i.forEach(function(e){return e.resultCount=0})});var o=null==t?void 0:t.find(function(e){return"category"===e.id});o&&(null===(n=a.filterCategories)||void 0===n||n.forEach(function(e){var t=o.values.find(function(t){return t.id===e.id});e.resultCount=t?t.count:0})),e.filters=a.filters,e.filterCategories=a.filterCategories,ye(e)}(e,null===(_=v.data)||void 0===_?void 0:_.facets),e.data=S,e.count=(null===(b=v.data)||void 0===b?void 0:b.count)||0,e.isInitialized=!0,e.page=o||1,e.minPage=e.page,v.data&&"suggestions"in v.data&&(e.suggestions=v.data.suggestions),z(e),J(e),a||(e.infiniteScrollPage=null),Re(e),[2,!0]):[2];case 14:return y=r.sent(),console.log(y),[3,16];case 15:return t===e.fetchRequestTime&&(e.isLoading=!1),[7];case 16:return[2]}})})}function ce(e){e.isCollapsed=!e.isCollapsed}function fe(e){return t(this,void 0,void 0,function(){var t,n,i,a,o,s,u,d,l,c;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,13,,14]),e.productListPropValue.category?[4,import("../../api/category/index.js")]:[3,3];case 1:return[4,(0,r.sent().apiListCategory)({id:{eq:e.productListPropValue.category}})];case 2:return t=r.sent(),e.category=(null===(o=null===(a=t.data)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0])||null,[3,7];case 3:return e.productListPropValue.usePageFilter&&"CATEGORY"===e.pageType&&e.pageSpecificData?(e.category=e.pageSpecificData,[3,7]):[3,4];case 4:return e.filterCategoryId?[4,import("../../api/category/index.js")]:[3,7];case 5:return[4,(0,r.sent().apiListCategory)({id:{eq:e.filterCategoryId}})];case 6:t=r.sent(),e.category=(null===(u=null===(s=t.data)||void 0===s?void 0:s.data)||void 0===u?void 0:u[0])||null,r.label=7;case 7:return e.productListPropValue.usePageFilter&&"BRAND"===e.pageType&&e.pageSpecificData?(e.brand=e.pageSpecificData,[3,12]):[3,8];case 8:return e.filterBrandId?e.filterBrandId!==(null===(d=e.pageSpecificData)||void 0===d?void 0:d.id)?[3,9]:(e.brand=e.pageSpecificData,[3,12]):[3,12];case 9:return[4,import("../../api/brand/index.js")];case 10:return[4,(0,r.sent().apiListProductBrand)({id:{eq:e.filterBrandId}})];case 11:n=r.sent(),e.brand=(null===(c=null===(l=n.data)||void 0===l?void 0:l.data)||void 0===c?void 0:c[0])||null,r.label=12;case 12:return[3,14];case 13:return i=r.sent(),console.error(i),[3,14];case 14:return[2]}})})}function ve(e){return t(this,void 0,void 0,function(){var t,n,i,a,o,s,u;return r(this,function(r){switch(r.label){case 0:if(w(e)||F(e)||j(e)||x(e)||H(e)||W(e)||k(e)||e.isLoading||!B(e))return[2];e.isLoading=!0,r.label=1;case 1:return r.trys.push([1,3,4,5]),t=e.minPage-1,[4,$(e,t,e.limit)];case 2:return(n=r.sent())?(i=null===(s=null===(o=n.data)||void 0===o?void 0:o.data)||void 0===s?void 0:s.map(function(e){var t=de(e);return e.selectedVariantValues=t.variantValues,e}),e.data=(null==i?void 0:i.concat(e.data))||e.data,e.count=(null===(u=n.data)||void 0===u?void 0:u.count)||e.count,e.minPage=t,z(e),J(e),ne(e),[3,5]):[2];case 3:return a=r.sent(),console.log(a),[3,5];case 4:return e.isLoading=!1,[7];case 5:return[2]}})})}function pe(e){return t(this,void 0,void 0,function(){var t,n,i,a,o,s;return r(this,function(r){switch(r.label){case 0:if(w(e)||F(e)||j(e)||x(e)||H(e)||W(e)||k(e)||e.isLoading||!Y(e))return[2];e.isLoading=!0,r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,$(e,e.page+1,e.limit)];case 2:return(t=r.sent())?(n=null===(o=null===(a=t.data)||void 0===a?void 0:a.data)||void 0===o?void 0:o.map(function(e){var t=de(e);return e.selectedVariantValues=t.variantValues,e}),e.data=e.data.concat(n||[]),e.count=(null===(s=t.data)||void 0===s?void 0:s.count)||e.count,e.page=e.page+1,z(e),J(e),ne(e),[3,5]):[2];case 3:return i=r.sent(),console.log(i),[3,5];case 4:return e.isLoading=!1,[7];case 5:return[2]}})})}function ge(e,n){return t(this,void 0,void 0,function(){var t,i,a,o,s,u;return r(this,function(r){switch(r.label){case 0:if(e.isLoading||w(e)||F(e)||j(e)||k(e)||x(e)||H(e)||W(e))return[2];e.isLoading=!0,r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,$(e,n,e.limit)];case 2:return(t=r.sent())?(i=null===(s=null===(o=t.data)||void 0===o?void 0:o.data)||void 0===s?void 0:s.map(function(e){var t=de(e);return e.selectedVariantValues=t.variantValues,e}),e.data=i||[],e.count=(null===(u=t.data)||void 0===u?void 0:u.count)||0,e.page=n,e.minPage=n,z(e),J(e),ne(e),[3,5]):[2];case 3:return a=r.sent(),console.log(a),[3,5];case 4:return e.isLoading=!1,[7];case 5:return[2]}})})}function Ie(e,n){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return e.sort=n,[4,le(e)];case 1:return t.sent()&&ne(e),[2]}})})}function Ee(e){return Ce(e,e.sort)}function Ce(e,t){switch(t){case"INCREASING_PRICE":return a.translate("sort_type.increasing_price");case"DECREASING_PRICE":return a.translate("sort_type.decreasing_price");case"LAST_ADDED":return a.translate("sort_type.last_added");case"FIRST_ADDED":return a.translate("sort_type.first_added");case"INCREASING_DISCOUNT":return a.translate("sort_type.increasing_discount");case"DECRASING_DISCOUNT":return a.translate("sort_type.decreasing_discount");case"FEATURED":return a.translate("sort_type.featured");case"DEFAULT":return a.translate("sort_type.default");case"AVERAGE_RATING":return a.translate("sort_type.average_rating");case"REVIEW_COUNT":return a.translate("sort_type.review_count");case"SALE_COUNT":return a.translate("sort_type.sale_count");case"A_Z":return a.translate("sort_type.a_z");case"Z_A":return a.translate("sort_type.z_a")}}function Se(e){var t,r,n,i,a,o,s,u,d=[];return(null===(t=e.disabledSortTypes)||void 0===t?void 0:t.includes("NAME"))||(d.push({label:Ce(0,"A_Z"),value:"A_Z",isSelected:"A_Z"===e.sort}),d.push({label:Ce(0,"Z_A"),value:"Z_A",isSelected:"Z_A"===e.sort})),(null===(r=e.disabledSortTypes)||void 0===r?void 0:r.includes("PRICE"))||(d.push({label:Ce(0,"INCREASING_PRICE"),value:"INCREASING_PRICE",isSelected:"INCREASING_PRICE"===e.sort}),d.push({label:Ce(0,"DECREASING_PRICE"),value:"DECREASING_PRICE",isSelected:"DECREASING_PRICE"===e.sort})),(null===(n=e.disabledSortTypes)||void 0===n?void 0:n.includes("CREATED_AT"))||(d.push({label:Ce(0,"LAST_ADDED"),value:"LAST_ADDED",isSelected:"LAST_ADDED"===e.sort}),d.push({label:Ce(0,"FIRST_ADDED"),value:"FIRST_ADDED",isSelected:"FIRST_ADDED"===e.sort})),(null===(i=e.disabledSortTypes)||void 0===i?void 0:i.includes("DISCOUNT_RATIO"))||(d.push({label:Ce(0,"INCREASING_DISCOUNT"),value:"INCREASING_DISCOUNT",isSelected:"INCREASING_DISCOUNT"===e.sort}),d.push({label:Ce(0,"DECRASING_DISCOUNT"),value:"DECRASING_DISCOUNT",isSelected:"DECRASING_DISCOUNT"===e.sort})),(null===(a=e.disabledSortTypes)||void 0===a?void 0:a.includes("MANUAL_SORT"))||d.push({label:Ce(0,"FEATURED"),value:"FEATURED",isSelected:"FEATURED"===e.sort}),(null===(o=e.disabledSortTypes)||void 0===o?void 0:o.includes("AVERAGE_RATING"))||d.push({label:Ce(0,"AVERAGE_RATING"),value:"AVERAGE_RATING",isSelected:"AVERAGE_RATING"===e.sort}),(null===(s=e.disabledSortTypes)||void 0===s?void 0:s.includes("REVIEW_COUNT"))||d.push({label:Ce(0,"REVIEW_COUNT"),value:"REVIEW_COUNT",isSelected:"REVIEW_COUNT"===e.sort}),(null===(u=e.disabledSortTypes)||void 0===u?void 0:u.includes("SALE_COUNT"))||d.push({label:Ce(0,"SALE_COUNT"),value:"SALE_COUNT",isSelected:"SALE_COUNT"===e.sort}),d}function Ae(e,i,a){return t(this,void 0,void 0,function(){var t,s,u;return r(this,function(r){switch(r.label){case 0:return a?(null===(u=e.filterCategories)||void 0===u||u.forEach(function(e){e.id===i.id&&(e.isSelected=!e.isSelected)}),[4,te(e)]):[3,2];case 1:return r.sent(),[3,3];case 2:n.isEditor||(t=re(e),s=S(i)+(t?"?"+t:""),o.navigate(s)),r.label=3;case 3:return[2]}})})}function ye(e){var t;null===(t=e.filterCategories)||void 0===t||t.forEach(function(e){e.image=e.imageId?{id:e.imageId,isVideo:!1}:null})}function Te(e,t){if(e.infiniteScrollPage!==t){e.infiniteScrollPage=t;var r=re(e);o.navigate("".concat(location.pathname).concat(r?"?"+r:""),!0)}}function Re(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return e.searchKeyword&&e.data.length?[4,import("../../../analytics/analytics-functions/viewSearchResults.js")]:[3,2];case 1:return(0,t.sent().anl_viewSearchResults)(e.searchKeyword,e.data),[3,4];case 2:return e.data.length&&"ALL"===e.type?[4,import("../../../analytics/analytics-functions/viewListing.js")]:[3,4];case 3:(0,t.sent().anl_viewListing)(e.data),t.label=4;case 4:return[2]}})})}function De(e){var t=e.data[0];if(!t)return n.getDefaultCurrencyCode()||"";var r=de(t),i=b(r);return(null==i?void 0:i.currency)||n.getDefaultCurrencyCode()||""}function he(e){var t=e.data[0];if(!t)return n.getDefaultCurrencySymbol()||"";var r=de(t),i=b(r);return(null==i?void 0:i.currencySymbol)||n.getDefaultCurrencySymbol()||""}var _e=f(function(e){te(e)},500),me=f(function(e){return t(void 0,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,import("../../../analytics/analytics-functions/search.js")];case 1:return(0,t.sent().anl_search)(e.searchKeyword),[2]}})})},1e3),be=((L={}).INCREASING_PRICE=1,L.DECREASING_PRICE=2,L.LAST_ADDED=3,L.FIRST_ADDED=4,L.INCREASING_DISCOUNT=5,L.DECRASING_DISCOUNT=6,L.FEATURED=7,L.DEFAULT=8,L.AVERAGE_RATING=9,L.REVIEW_COUNT=10,L.SALE_COUNT=11,L.A_Z=12,L.Z_A=13,L);export{ae as clearProductListFilter,ie as clearProductListFilters,X as enableProductListSuggestions,De as getProductListCurrencyCode,he as getProductListCurrencySymbol,Z as getProductListFilterCategories,le as getProductListInitialData,pe as getProductListNextPage,ge as getProductListPage,ve as getProductListPrevPage,Se as getProductListSortOptions,Ee as getProductListSortTypeTranslation,Q as getProductListSuggestionHref,ue as getSelectedFilterValues,oe as handleFilterValueClick,se as handleNumberRangeOptionClick,M as hasProductListAppliedFilters,q as hasProductListFeaturedSortEnabled,Y as hasProductListNextPage,B as hasProductListPrevPage,O as initProductList,ye as initProductListFilterCategories,P as initProductListOnBrowser,F as isProductListDiscounted,U as isProductListFilterable,V as isProductListFiltered,k as isProductListLastViewed,W as isProductListPurchasedTogether,j as isProductListRecommended,x as isProductListRelatedProducts,K as isProductListSearch,w as isProductListStatic,H as isProductListViewedTogether,Ae as onFilterCategoryClick,ce as productListToggleFilterCollapsed,G as searchProductList,z as setProductListIsFilteredForProducts,J as setProductListIsStaticForProducts,Te as setProductListVisiblePage,Ie as setSortType,Ce as translateProductListSortType};
1
+ import{__assign as e,__awaiter as t,__generator as r}from'./../../../ext/tslib/tslib.es6.mjs.js';import{IkasStorefrontConfig as n}from"../../../packages/storefront-config/src/index.js";import i from'./../../../ext/lodash/cloneDeep.js';import{I18n as a}from"../../../i18n/index.js";import{Router as o,withRoutePrefix as s}from"../../../router/index.js";import{customerStore as u}from"../../../stores/customer/index.js";import{isClient as d,isBackNavigation as l,getQueryParams as c,debounce as f,stringToSlug as v,stringifyQueryParams as p}from"../../../utils/helper.js";import{setSavedLastViewedProductsResponse as g,getLastViewedProducts as I,waitForCustomerStoreInit as E}from"../../stores/customer/index.js";import{getIkasFilterCategorySlug as C,getIkasFilterCategoryHref as S}from"../filter-category/index.js";import{getFilterValueList as A,clearFilter as y,selectFilterValue as T,onNumberRangeFilterOptionClick as R,getFilterKeyList as D,applyQueryParamForFilter as h,initIkasProductFilter as _,isCustomValueFilter as m}from"../product/filter/index.js";import{getProductVariantPrice as b,hasProductVariantStock as N}from"../product/variant/index.js";var L;function O(t){var r=e({data:[],limit:10,page:1,count:0,isInitialized:!1,isLoading:!1,type:"ALL",sort:"DEFAULT",searchKeyword:"",pageType:"CATEGORY",category:null,brand:null,productListPropValue:{id:"",productIds:[],initialLimit:10,productListType:"ALL"}},t);return function(e){var t;if((null===(t=e.pageSpecificData)||void 0===t?void 0:t.orderType)&&["ALL"].includes(e.type))switch(e.pageSpecificData.orderType){case"HIGHEST_DISCOUNT_RATIO":e.sort="DECRASING_DISCOUNT";break;case"LOWEST_DISCOUNT_RATIO":e.sort="INCREASING_DISCOUNT";break;case"HIGHEST_PRICE":e.sort="DECREASING_PRICE";break;case"LOWEST_PRICE":e.sort="INCREASING_PRICE";break;case"NEWEST":e.sort="LAST_ADDED";break;case"OLDEST":e.sort="FIRST_ADDED";break;case"MANUALLY":e.sort="FEATURED"}}(r),z(r),J(r),r}function P(e){var t;if(d()&&(!l()||!o.isFromBFCache)){!function(e){var t=c(),r=null==t?void 0:t.get("page");if(r){var n=parseInt(r);isNaN(n)||(e.page=n,e.infiniteScrollPage=n)}}(e);if(["CATEGORY","BRAND","SEARCH"].includes(e.pageType)&&location.search&&U(e)&&((null===(t=e.productListPropValue)||void 0===t?void 0:t.usePageFilter)||"SEARCH"===e.type))le(e,c(),e.page>1);else e.page>1?le(e,void 0,!0):k(e)?le(e):Re(e)}}function G(e,t){t!==e.searchKeyword&&(e.searchKeyword=t,_e(e),me(e))}function U(e){return"ALL"===e.type||"CATEGORY"===e.type}function V(e){var t,r;return(null===(t=e.filters)||void 0===t?void 0:t.some(function(e){return!!A(e).length}))||!!e.searchKeyword||"CATEGORY"!==e.pageType&&(!!e.filterCategoryId||!!(null===(r=e.filterCategories)||void 0===r?void 0:r.some(function(e){return e.isSelected})))}function w(e){return"STATIC"===e.type}function F(e){return"DISCOUNTED"===e.type}function j(e){return"RECOMMENDED"===e.type}function k(e){return"LAST_VIEWED"===e.type}function x(e){return"RELATED_PRODUCTS"===e.type}function H(e){return"VIEWED_TOGETHER"===e.type}function W(e){return"PURCHASED_TOGETHER"===e.type}function K(e){return"SEARCH"===e.type}function B(e){return!(w(e)||F(e)||j(e)||!e.minPage)&&e.minPage>1}function Y(e){return!(w(e)||F(e)||j(e))&&e.page*e.limit<e.count}function Z(e){var t;return(null===(t=e.filterCategories)||void 0===t?void 0:t.filter(function(e){return 0!==e.resultCount}))||[]}function M(e){var t;return!!e.searchKeyword||!!(null===(t=e.filters)||void 0===t?void 0:t.some(function(e){return!!A(e).length}))}function q(e){var t;return"MANUALLY"===(null===(t=e.pageSpecificData)||void 0===t?void 0:t.orderType)&&["ALL","CATEGORY"].includes(e.type)}function z(e){var t=V(e);e.data.forEach(function(e){return e.isFiltered=t||!1})}function J(e){var t=w(e);e.data.forEach(function(e){return e.isFiltered=t||!1})}function X(e){e._enableSuggestions=!0}function Q(e){var t={};return e.categoryId&&(t.categoryId=e.categoryId),e.brandId&&(t.brandId=e.brandId),Object.keys(t).length?s("/search?suggestion=".concat(encodeURIComponent(JSON.stringify(t)))):s("/search")}function $(i,a,o,s){return t(this,void 0,void 0,function(){var t,u,d,l,f,v,p,g,I,E,C,S,y,T,R,D;return r(this,function(r){switch(r.label){case 0:return t=[],u=[],null===(S=i.filters)||void 0===S||S.forEach(function(e){var r=A(e);r.length&&t.push({id:e.id,type:e.type,displayType:e.displayType,valueList:r}),e.isFacetFilter&&u.push({id:e.id,type:e.type,displayType:e.displayType})}),d=c(),(l=null==d?void 0:d.get("suggestion"))&&(f=JSON.parse(decodeURIComponent(l)),(v=f.brandId)&&((p=null===(y=i.filters)||void 0===y?void 0:y.find(function(e){return"brand"===e.id&&"BRAND"===e.type}))&&(g=null===(T=p.values)||void 0===T?void 0:T.find(function(e){return e.id===v}))&&h(p,g.name),t.push({id:"brand",type:"BRAND",displayType:"BOX",valueList:[v]})),f.categoryId&&(i.filterCategoryId=f.categoryId),i.searchKeyword=f.term),I=null===(R=i.filterCategories)||void 0===R?void 0:R.filter(function(e){return e.isSelected}).map(function(e){return e.id}),E=function(e){var t,r;switch(e.sort){case"INCREASING_PRICE":t="ASC",r="PRICE";break;case"DECREASING_PRICE":t="DESC",r="PRICE";break;case"FIRST_ADDED":t="ASC",r="CREATED_AT";break;case"LAST_ADDED":t="DESC",r="CREATED_AT";break;case"INCREASING_DISCOUNT":t="ASC",r="DISCOUNT_RATIO";break;case"DECRASING_DISCOUNT":t="DESC",r="DISCOUNT_RATIO";break;case"FEATURED":if(K(e))return;t="ASC",r="MANUAL_SORT";break;case"DEFAULT":t=void 0,r=void 0;break;case"AVERAGE_RATING":t="DESC",r="AVERAGE_RATING";break;case"REVIEW_COUNT":t="DESC",r="REVIEW_COUNT";break;case"SALE_COUNT":t="DESC",r="SALE_COUNT";break;case"A_Z":t="ASC",r="NAME";break;case"Z_A":t="DESC",r="NAME"}if(t&&r)return{direction:t,type:r}}(i),j(i)&&i.recommendedProductData?[4,import("../../api/product/index.js")]:[3,3];case 1:return[4,(0,r.sent().apiGetSuggestedProducts)({priceListId:n.priceListId,salesChannelId:n.salesChannelId,brandIds:i.recommendedProductData.brandIds,categoryIds:i.recommendedProductData.categoryIds,locale:n.getCurrentLocale()})];case 2:case 5:case 8:case 11:case 14:return[2,r.sent()];case 3:return x(i)&&i.relatedProductData?[4,import("../../api/product/index.js")]:[3,6];case 4:return[4,(0,r.sent().apiGetSuggestedProducts)({priceListId:n.priceListId,salesChannelId:n.salesChannelId,productId:i.relatedProductData.productId,brandIds:i.relatedProductData.brandIds,categoryIds:i.relatedProductData.categoryIds,locale:n.getCurrentLocale()})];case 6:return H(i)&&i.viewedTogetherProductData?[4,import("../../api/product/index.js")]:[3,9];case 7:return[4,(0,r.sent().apiGetSuggestedProducts)({priceListId:n.priceListId,salesChannelId:n.salesChannelId,method:"VIEWED_TOGETHER",productIds:i.viewedTogetherProductData.productIds,locale:n.getCurrentLocale()})];case 9:return W(i)&&i.purchasedTogetherProductData?[4,import("../../api/product/index.js")]:[3,12];case 10:return[4,(0,r.sent().apiGetSuggestedProducts)({priceListId:n.priceListId,salesChannelId:n.salesChannelId,method:"PURCHASED_TOGETHER",productIds:i.purchasedTogetherProductData.productIds,locale:n.getCurrentLocale()})];case 12:return C={input:e(e(e(e({page:a,perPage:o},i._enableSuggestions?{enableSuggestions:i._enableSuggestions}:{}),{productIdList:w(i)?null===(D=i.productListPropValue.productIds)||void 0===D?void 0:D.map(function(e){return e.productId}):s,filterList:t,facetList:u}),i.baseCategoryIdList?{baseCategoryIdList:i.baseCategoryIdList}:{}),{brandId:"BRAND"===i.pageType&&"SEARCH"!==i.type?i.filterBrandId:void 0,categoryIdList:I&&I.length?I:i.filterCategoryId?[i.filterCategoryId]:void 0,priceListId:n.priceListId,salesChannelId:n.salesChannelId,query:i.searchKeyword,order:E?[E]:[],showStockOption:n.stockPreference||"SHOW_ALL"})},[4,import("../../api/product/index.js")];case 13:return[4,(0,r.sent().apiSearchProducts)(C,i.excludedFields||[])]}})})}function ee(e){return t(this,void 0,void 0,function(){var t,i,a,o,s,u;return r(this,function(r){switch(r.label){case 0:return[4,import("../../api/product/index.js")];case 1:return[4,(0,r.sent().apiGetProductFilterData)({categoryId:e.filterCategoryId?e.filterCategoryId:void 0,locale:n.getCurrentLocale()})];case 2:return t=r.sent(),e.filters=null===(a=null==t?void 0:t.data)||void 0===a?void 0:a.filters.map(function(e){return _(e)}),e.filterCategories=null===(o=null==t?void 0:t.data)||void 0===o?void 0:o.categories,ye(e),e.disabledSortTypes=null===(s=t.data)||void 0===s?void 0:s.disabledSortTypes,"CATEGORY"!==e.pageType&&e.filterCategoryId&&(i=null===(u=e.filterCategories)||void 0===u?void 0:u.find(function(t){return t.id===e.filterCategoryId}))&&(i.isSelected=!0),e.filters&&e.filters.sort(function(e,t){return e.order>t.order?1:-1}),[2]}})})}function te(e){return t(this,void 0,void 0,function(){var t;return r(this,function(r){switch(r.label){case 0:return[4,le(e)];case 1:return t=r.sent(),["CATEGORY","BRAND","SEARCH"].includes(e.pageType)?(t&&ne(e),[2]):[2]}})})}function re(e){var t,r,n,i={};if(null===(t=e.filters)||void 0===t||t.forEach(function(e){var t=D(e);t.length&&(i[v(e.name)]=t)}),e.searchKeyword&&(i.s=e.searchKeyword),e.sort&&(i.o=be[e.sort]),e.baseCategoryIdList&&(i.bc=e.baseCategoryIdList),e.suggestionCategoryId&&(i.suggestionCategoryId=e.suggestionCategoryId),e.infiniteScrollPage?i.page=e.infiniteScrollPage:i.page=e.page,"CATEGORY"!==e.pageType){var a=null===(r=e.filterCategories)||void 0===r?void 0:r.filter(function(e){return e.isSelected});if(!!(null==a?void 0:a.length))i.c=null==a?void 0:a.map(function(e){return C(e)});else if(e.filterCategoryId){var o=null===(n=e.filterCategories)||void 0===n?void 0:n.find(function(t){return t.id===e.filterCategoryId}),s=o?C(o):void 0;s&&(i.c=s)}}return p(i,{arrayFormat:"comma"})}function ne(e){if(d()&&!K(e)&&!n.isEditor){var t=re(e),r=s("".concat(location.pathname).concat(t?"?"+t:""));o.navigate(r,!0)}}function ie(e){var t,r;null===(t=e.filters)||void 0===t||t.forEach(function(e){return y(e)}),e.searchKeyword="","CATEGORY"!==e.pageType&&(e.filterCategoryId=void 0),null===(r=e.filterCategories)||void 0===r||r.forEach(function(e){return e.isSelected=!1}),te(e)}function ae(e,t){y(t),te(e)}function oe(e,t,r){T(t,r),te(e)}function se(e,t,r){R(t,r),te(e)}function ue(e){var t,r=null===(t=e.filters)||void 0===t?void 0:t.filter(function(e){var t;return null===(t=e.values)||void 0===t?void 0:t.some(function(e){return e.isSelected})});return null==r?void 0:r.map(function(e){var t,r;return e.numberRange?{filter:e,values:[e.numberRange.from+"-"+e.numberRange.to],commaSeperatedValues:e.numberRange.from+"-"+e.numberRange.to}:e.numberRangeListOptions?{filter:e,values:e.numberRangeListOptions.filter(function(e){return e.isSelected}).map(function(e){return e.from+"-"+e.to}),commaSeperatedValues:e.numberRangeListOptions.filter(function(e){return e.isSelected}).map(function(e){return e.from+"-"+e.to}).join(",")}:{filter:e,values:(null===(t=e.values)||void 0===t?void 0:t.filter(function(e){return e.isSelected}).map(function(e){return e.name}))||[],commaSeperatedValues:(null===(r=e.values)||void 0===r?void 0:r.filter(function(e){return e.isSelected}).map(function(e){return e.name}).join(","))||""}})}function de(e){return e.variants[0]}function le(e,n,a){return t(this,void 0,void 0,function(){var t,o,s,l,c,f,v,p,S,A,y,T,R,D,_,b;return r(this,function(r){switch(r.label){case 0:e.isLoading=!0,t=Date.now(),e.fetchRequestTime=t,r.label=1;case 1:return r.trys.push([1,14,15,16]),o=a?e.page:1,s=e.limit,!U(e)||e.filters?[3,3]:[4,ee(e)];case 2:r.sent(),r.label=3;case 3:return function(e,t){var r;try{null==t||t.forEach(function(t,r){var n,i=null===(n=e.filters)||void 0===n?void 0:n.find(function(e){return e.key===r});i&&h(i,t)});var n=null==t?void 0:t.get("s");n&&(e.searchKeyword=n);var i=null==t?void 0:t.get("o");if(i){var a=parseInt(i),o=Object.entries(be).find(function(e){return e[1]===a});o&&(e.sort=o[0])}if("CATEGORY"!==e.pageType){var s=null==t?void 0:t.get("c"),u=null==s?void 0:s.split(",");u&&u.length&&(null===(r=e.filterCategories)||void 0===r||r.forEach(function(e){e.isSelected=u.some(function(t){return t===C(e)})}))}if("SEARCH"===e.pageType){var d=null==t?void 0:t.get("bc"),l=null==d?void 0:d.split(",");l&&(e.baseCategoryIdList=l);var c=null==t?void 0:t.get("suggestion");if(c){var f=JSON.parse(decodeURIComponent(c)).categoryId;f&&(e.suggestionCategoryId=f)}var v=null==t?void 0:t.get("suggestionCategoryId");v&&(e.suggestionCategoryId=v,e.filterCategoryId=v)}}catch(e){console.log(e)}}(e,n),[4,fe(e)];case 4:return r.sent(),K(e)&&!M(e)?(e.data=[],e.page=1,e.minPage=1,e.count=0,e.isInitialized=!0,[2,!0]):(l=void 0,c=!1,w(e)?(o=void 0,s=200,[3,10]):[3,5]);case 5:return F(e)||j(e)?(o=1,s=10,[3,10]):[3,6];case 6:return k(e)?d()?[4,E(u)]:[3,9]:[3,10];case 7:return r.sent(),[4,I(u)];case 8:return(f=r.sent())&&f.length?(l=f.map(function(e){return e.productId}),c=u.useLastViewedProductResponse,[3,10]):[2];case 9:return[2];case 10:return c?(p=u._savedLastViewedProductsResponse,[3,13]):[3,11];case 11:return[4,$(e,o||1,s||10,l)];case 12:p=r.sent(),r.label=13;case 13:return(v=p)&&e.fetchRequestTime===t?(S=[],!c&&k(e)&&g(u,v),w(e)||k(e)?(A=w(e)?e.productListPropValue.productIds:u._lastViewedProducts,S=(null==A?void 0:A.map(function(e){var t,r,n=null===(r=null===(t=v.data)||void 0===t?void 0:t.data)||void 0===r?void 0:r.find(function(t){return t.id===e.productId}),i=null==n?void 0:n.variants.find(function(t){return t.id===e.variantId});if((null==i?void 0:i.isActive)&&N(i)||(i=null==n?void 0:n.variants.find(function(e){return e.isActive&&N(e)})),n&&i)return n.selectedVariantValues=i.variantValues,n}).filter(function(e){return!!e}))||[]):S=(null===(R=null===(T=v.data)||void 0===T?void 0:T.data)||void 0===R?void 0:R.map(function(e){var t=de(e);return e.selectedVariantValues=t.variantValues,e}))||[],null===(D=e.filters)||void 0===D||D.forEach(function(e){var t,r;if(void 0===e.isCollapsed){var n=!1;(!1===(null===(t=e.settings)||void 0===t?void 0:t.showCollapsedOnMobile)&&d()&&window.innerWidth<768||!1===(null===(r=e.settings)||void 0===r?void 0:r.showCollapsedOnDesktop))&&(n=!0),e.isCollapsed=!n}}),function(e,t){var r,n,a=i(e);null===(r=a.filters)||void 0===r||r.forEach(function(e){var r,n,i,a=null==t?void 0:t.find(function(t){return t.id===e.id});a?null===(r=e.values)||void 0===r||r.forEach(function(t){var r=a.values.find(function(e){return e.id===t.id});r?t.resultCount=r.count:m(e)?t.resultCount=null:t.resultCount=0}):m(e)?null===(n=e.values)||void 0===n||n.forEach(function(e){return e.resultCount=null}):null===(i=e.values)||void 0===i||i.forEach(function(e){return e.resultCount=0})});var o=null==t?void 0:t.find(function(e){return"category"===e.id});o&&(null===(n=a.filterCategories)||void 0===n||n.forEach(function(e){var t=o.values.find(function(t){return t.id===e.id});e.resultCount=t?t.count:0})),e.filters=a.filters,e.filterCategories=a.filterCategories,ye(e)}(e,null===(_=v.data)||void 0===_?void 0:_.facets),e.data=S,e.count=(null===(b=v.data)||void 0===b?void 0:b.count)||0,e.isInitialized=!0,e.page=o||1,e.minPage=e.page,v.data&&"suggestions"in v.data&&(e.suggestions=v.data.suggestions),z(e),J(e),a||(e.infiniteScrollPage=null),Re(e),[2,!0]):[2];case 14:return y=r.sent(),console.log(y),[3,16];case 15:return t===e.fetchRequestTime&&(e.isLoading=!1),[7];case 16:return[2]}})})}function ce(e){e.isCollapsed=!e.isCollapsed}function fe(e){return t(this,void 0,void 0,function(){var t,n,i,a,o,s,u,d,l,c;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,13,,14]),e.productListPropValue.category?[4,import("../../api/category/index.js")]:[3,3];case 1:return[4,(0,r.sent().apiListCategory)({id:{eq:e.productListPropValue.category}})];case 2:return t=r.sent(),e.category=(null===(o=null===(a=t.data)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0])||null,[3,7];case 3:return e.productListPropValue.usePageFilter&&"CATEGORY"===e.pageType&&e.pageSpecificData?(e.category=e.pageSpecificData,[3,7]):[3,4];case 4:return e.filterCategoryId?[4,import("../../api/category/index.js")]:[3,7];case 5:return[4,(0,r.sent().apiListCategory)({id:{eq:e.filterCategoryId}})];case 6:t=r.sent(),e.category=(null===(u=null===(s=t.data)||void 0===s?void 0:s.data)||void 0===u?void 0:u[0])||null,r.label=7;case 7:return e.productListPropValue.usePageFilter&&"BRAND"===e.pageType&&e.pageSpecificData?(e.brand=e.pageSpecificData,[3,12]):[3,8];case 8:return e.filterBrandId?e.filterBrandId!==(null===(d=e.pageSpecificData)||void 0===d?void 0:d.id)?[3,9]:(e.brand=e.pageSpecificData,[3,12]):[3,12];case 9:return[4,import("../../api/brand/index.js")];case 10:return[4,(0,r.sent().apiListProductBrand)({id:{eq:e.filterBrandId}})];case 11:n=r.sent(),e.brand=(null===(c=null===(l=n.data)||void 0===l?void 0:l.data)||void 0===c?void 0:c[0])||null,r.label=12;case 12:return[3,14];case 13:return i=r.sent(),console.error(i),[3,14];case 14:return[2]}})})}function ve(e){return t(this,void 0,void 0,function(){var t,n,i,a,o,s,u;return r(this,function(r){switch(r.label){case 0:if(w(e)||F(e)||j(e)||x(e)||H(e)||W(e)||k(e)||e.isLoading||!B(e))return[2];e.isLoading=!0,r.label=1;case 1:return r.trys.push([1,3,4,5]),t=e.minPage-1,[4,$(e,t,e.limit)];case 2:return(n=r.sent())?(i=null===(s=null===(o=n.data)||void 0===o?void 0:o.data)||void 0===s?void 0:s.map(function(e){var t=de(e);return e.selectedVariantValues=t.variantValues,e}),e.data=(null==i?void 0:i.concat(e.data))||e.data,e.count=(null===(u=n.data)||void 0===u?void 0:u.count)||e.count,e.minPage=t,z(e),J(e),ne(e),[3,5]):[2];case 3:return a=r.sent(),console.log(a),[3,5];case 4:return e.isLoading=!1,[7];case 5:return[2]}})})}function pe(e){return t(this,void 0,void 0,function(){var t,n,i,a,o,s;return r(this,function(r){switch(r.label){case 0:if(w(e)||F(e)||j(e)||x(e)||H(e)||W(e)||k(e)||e.isLoading||!Y(e))return[2];e.isLoading=!0,r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,$(e,e.page+1,e.limit)];case 2:return(t=r.sent())?(n=null===(o=null===(a=t.data)||void 0===a?void 0:a.data)||void 0===o?void 0:o.map(function(e){var t=de(e);return e.selectedVariantValues=t.variantValues,e}),e.data=e.data.concat(n||[]),e.count=(null===(s=t.data)||void 0===s?void 0:s.count)||e.count,e.page=e.page+1,z(e),J(e),ne(e),[3,5]):[2];case 3:return i=r.sent(),console.log(i),[3,5];case 4:return e.isLoading=!1,[7];case 5:return[2]}})})}function ge(e,n){return t(this,void 0,void 0,function(){var t,i,a,o,s,u;return r(this,function(r){switch(r.label){case 0:if(e.isLoading||w(e)||F(e)||j(e)||k(e)||x(e)||H(e)||W(e))return[2];e.isLoading=!0,r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,$(e,n,e.limit)];case 2:return(t=r.sent())?(i=null===(s=null===(o=t.data)||void 0===o?void 0:o.data)||void 0===s?void 0:s.map(function(e){var t=de(e);return e.selectedVariantValues=t.variantValues,e}),e.data=i||[],e.count=(null===(u=t.data)||void 0===u?void 0:u.count)||0,e.page=n,e.minPage=n,z(e),J(e),ne(e),[3,5]):[2];case 3:return a=r.sent(),console.log(a),[3,5];case 4:return e.isLoading=!1,[7];case 5:return[2]}})})}function Ie(e,n){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return e.sort=n,[4,le(e)];case 1:return t.sent()&&ne(e),[2]}})})}function Ee(e){return Ce(e,e.sort)}function Ce(e,t){switch(t){case"INCREASING_PRICE":return a.translate("sort_type.increasing_price");case"DECREASING_PRICE":return a.translate("sort_type.decreasing_price");case"LAST_ADDED":return a.translate("sort_type.last_added");case"FIRST_ADDED":return a.translate("sort_type.first_added");case"INCREASING_DISCOUNT":return a.translate("sort_type.increasing_discount");case"DECRASING_DISCOUNT":return a.translate("sort_type.decreasing_discount");case"FEATURED":return a.translate("sort_type.featured");case"DEFAULT":return a.translate("sort_type.default");case"AVERAGE_RATING":return a.translate("sort_type.average_rating");case"REVIEW_COUNT":return a.translate("sort_type.review_count");case"SALE_COUNT":return a.translate("sort_type.sale_count");case"A_Z":return a.translate("sort_type.a_z");case"Z_A":return a.translate("sort_type.z_a")}}function Se(e){var t,r,n,i,a,o,s,u;if(!e)return[];var d=[];return(null===(t=e.disabledSortTypes)||void 0===t?void 0:t.includes("NAME"))||(d.push({label:Ce(0,"A_Z"),value:"A_Z",isSelected:"A_Z"===e.sort}),d.push({label:Ce(0,"Z_A"),value:"Z_A",isSelected:"Z_A"===e.sort})),(null===(r=e.disabledSortTypes)||void 0===r?void 0:r.includes("PRICE"))||(d.push({label:Ce(0,"INCREASING_PRICE"),value:"INCREASING_PRICE",isSelected:"INCREASING_PRICE"===e.sort}),d.push({label:Ce(0,"DECREASING_PRICE"),value:"DECREASING_PRICE",isSelected:"DECREASING_PRICE"===e.sort})),(null===(n=e.disabledSortTypes)||void 0===n?void 0:n.includes("CREATED_AT"))||(d.push({label:Ce(0,"LAST_ADDED"),value:"LAST_ADDED",isSelected:"LAST_ADDED"===e.sort}),d.push({label:Ce(0,"FIRST_ADDED"),value:"FIRST_ADDED",isSelected:"FIRST_ADDED"===e.sort})),(null===(i=e.disabledSortTypes)||void 0===i?void 0:i.includes("DISCOUNT_RATIO"))||(d.push({label:Ce(0,"INCREASING_DISCOUNT"),value:"INCREASING_DISCOUNT",isSelected:"INCREASING_DISCOUNT"===e.sort}),d.push({label:Ce(0,"DECRASING_DISCOUNT"),value:"DECRASING_DISCOUNT",isSelected:"DECRASING_DISCOUNT"===e.sort})),(null===(a=e.disabledSortTypes)||void 0===a?void 0:a.includes("MANUAL_SORT"))||d.push({label:Ce(0,"FEATURED"),value:"FEATURED",isSelected:"FEATURED"===e.sort}),(null===(o=e.disabledSortTypes)||void 0===o?void 0:o.includes("AVERAGE_RATING"))||d.push({label:Ce(0,"AVERAGE_RATING"),value:"AVERAGE_RATING",isSelected:"AVERAGE_RATING"===e.sort}),(null===(s=e.disabledSortTypes)||void 0===s?void 0:s.includes("REVIEW_COUNT"))||d.push({label:Ce(0,"REVIEW_COUNT"),value:"REVIEW_COUNT",isSelected:"REVIEW_COUNT"===e.sort}),(null===(u=e.disabledSortTypes)||void 0===u?void 0:u.includes("SALE_COUNT"))||d.push({label:Ce(0,"SALE_COUNT"),value:"SALE_COUNT",isSelected:"SALE_COUNT"===e.sort}),d}function Ae(e,i,a){return t(this,void 0,void 0,function(){var t,s,u;return r(this,function(r){switch(r.label){case 0:return a?(null===(u=e.filterCategories)||void 0===u||u.forEach(function(e){e.id===i.id&&(e.isSelected=!e.isSelected)}),[4,te(e)]):[3,2];case 1:return r.sent(),[3,3];case 2:n.isEditor||(t=re(e),s=S(i)+(t?"?"+t:""),o.navigate(s)),r.label=3;case 3:return[2]}})})}function ye(e){var t;null===(t=e.filterCategories)||void 0===t||t.forEach(function(e){e.image=e.imageId?{id:e.imageId,isVideo:!1}:null})}function Te(e,t){if(e.infiniteScrollPage!==t){e.infiniteScrollPage=t;var r=re(e);o.navigate("".concat(location.pathname).concat(r?"?"+r:""),!0)}}function Re(e){return t(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return e.searchKeyword&&e.data.length?[4,import("../../../analytics/analytics-functions/viewSearchResults.js")]:[3,2];case 1:return(0,t.sent().anl_viewSearchResults)(e.searchKeyword,e.data),[3,4];case 2:return e.data.length&&"ALL"===e.type?[4,import("../../../analytics/analytics-functions/viewListing.js")]:[3,4];case 3:(0,t.sent().anl_viewListing)(e.data),t.label=4;case 4:return[2]}})})}function De(e){var t=e.data[0];if(!t)return n.getDefaultCurrencyCode()||"";var r=de(t),i=b(r);return(null==i?void 0:i.currency)||n.getDefaultCurrencyCode()||""}function he(e){var t=e.data[0];if(!t)return n.getDefaultCurrencySymbol()||"";var r=de(t),i=b(r);return(null==i?void 0:i.currencySymbol)||n.getDefaultCurrencySymbol()||""}var _e=f(function(e){te(e)},500),me=f(function(e){return t(void 0,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,import("../../../analytics/analytics-functions/search.js")];case 1:return(0,t.sent().anl_search)(e.searchKeyword),[2]}})})},1e3),be=((L={}).INCREASING_PRICE=1,L.DECREASING_PRICE=2,L.LAST_ADDED=3,L.FIRST_ADDED=4,L.INCREASING_DISCOUNT=5,L.DECRASING_DISCOUNT=6,L.FEATURED=7,L.DEFAULT=8,L.AVERAGE_RATING=9,L.REVIEW_COUNT=10,L.SALE_COUNT=11,L.A_Z=12,L.Z_A=13,L);export{ae as clearProductListFilter,ie as clearProductListFilters,X as enableProductListSuggestions,De as getProductListCurrencyCode,he as getProductListCurrencySymbol,Z as getProductListFilterCategories,le as getProductListInitialData,pe as getProductListNextPage,ge as getProductListPage,ve as getProductListPrevPage,Se as getProductListSortOptions,Ee as getProductListSortTypeTranslation,Q as getProductListSuggestionHref,ue as getSelectedFilterValues,oe as handleFilterValueClick,se as handleNumberRangeOptionClick,M as hasProductListAppliedFilters,q as hasProductListFeaturedSortEnabled,Y as hasProductListNextPage,B as hasProductListPrevPage,O as initProductList,ye as initProductListFilterCategories,P as initProductListOnBrowser,F as isProductListDiscounted,U as isProductListFilterable,V as isProductListFiltered,k as isProductListLastViewed,W as isProductListPurchasedTogether,j as isProductListRecommended,x as isProductListRelatedProducts,K as isProductListSearch,w as isProductListStatic,H as isProductListViewedTogether,Ae as onFilterCategoryClick,ce as productListToggleFilterCollapsed,G as searchProductList,z as setProductListIsFilteredForProducts,J as setProductListIsStaticForProducts,Te as setProductListVisiblePage,Ie as setSortType,Ce as translateProductListSortType};
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as s,__assign as r}from'./../../../../ext/tslib/tslib.es6.mjs.js';import{I18n as i}from"../../../../i18n/index.js";import{customerStore as a}from"../../../../stores/customer/index.js";import"../../../../stores/base/index.js";import"../../../../packages/storefront-config/src/index.js";import"../../../../stores/cart/index.js";import'./../../../../ext/mobx/dist/mobx.esm.js';import"../../../../router/index.js";import'./../../../../ext/lodash/sortBy.js';import{waitForCustomerStoreInit as t,saveCustomer as o}from"../../../stores/customer/index.js";import{validateValue as n,FORM_ITEM_DEFAULT_VALUE as l}from"../index.js";import{isCustomerSubscribed as u}from"../../customer/index.js";function m(o){return e(this,void 0,void 0,function(){var e;return s(this,function(s){switch(s.label){case 0:return[4,t(a)];case 1:return s.sent(),e=a.customer,o.firstName=r(r({},l),{value:(null==e?void 0:e.firstName)||"",isRequired:!0,label:i.translate("label.first_name"),placeholder:i.translate("placeholder.first_name")}),o.lastName=r(r({},l),{value:(null==e?void 0:e.lastName)||"",isRequired:!0,label:i.translate("label.last_name"),placeholder:i.translate("placeholder.last_name")}),o.phone=r(r({},l),{value:(null==e?void 0:e.phone)||"",isRequired:!1,label:i.translate("label.phone"),placeholder:i.translate("placeholder.phone")}),o.isMarketingAccepted={value:!!e&&u(e),hasError:!1,message:void 0},o.isInitialized=!0,o.isSubmitted=!1,o.isSubmitting=!1,o.isSuccess=void 0,o.isFailure=void 0,o.responseMessage=void 0,[2]}})})}function d(e,s){e.firstName&&(e.firstName.value=s),e.isSubmitted&&f(e)}function c(e,s){e.lastName&&(e.lastName.value=s),e.isSubmitted&&f(e)}function v(e,s){e.phone&&(e.phone.value=s),e.isSubmitted&&f(e)}function p(e,s){e.isMarketingAccepted&&(e.isMarketingAccepted.value=s,e.isSubmitted&&f(e))}function h(t){return e(this,void 0,void 0,function(){var e,n,l,u,m;return s(this,function(s){switch(s.label){case 0:return t.isSubmitted=!0,t.isSuccess=void 0,t.isFailure=void 0,t.responseMessage=void 0,f(t)?[2,!1]:(t.isSubmitting=!0,[4,o(a,r(r({},a.customer),{firstName:null===(n=t.firstName)||void 0===n?void 0:n.value,lastName:null===(l=t.lastName)||void 0===l?void 0:l.value,phone:null===(u=t.phone)||void 0===u?void 0:u.value,subscriptionStatus:(null===(m=t.isMarketingAccepted)||void 0===m?void 0:m.value)?"SUBSCRIBED":"NOT_SUBSCRIBED"}))]);case 1:return e=s.sent(),t.isSubmitting=!1,e?(t.isSuccess=!0,t.responseMessage=i.translate("notification.success.account_info"),[2,!0]):(t.isFailure=!0,t.responseMessage=i.translate("notification.failure.account_info"),[2,!1])}})})}function f(e){if(!e.firstName||!e.lastName||!e.phone)return!1;var s=n(e.firstName.value,{required:!0});s.hasError?(e.firstName.hasError=!0,e.firstName.message=s.message):(e.firstName.hasError=!1,e.firstName.message=void 0);var r=n(e.lastName.value,{required:!0});r.hasError?(e.lastName.hasError=!0,e.lastName.message=r.message):(e.lastName.hasError=!1,e.lastName.message=void 0);var i=n(e.phone.value,{phone:!0});return i.hasError?(e.phone.hasError=!0,e.phone.message=i.message):(e.phone.hasError=!1,e.phone.message=void 0),s.hasError||r.hasError||i.hasError}export{m as initAccountInfoForm,d as setAccountInfoFormFirstName,p as setAccountInfoFormIsMarketingAccepted,c as setAccountInfoFormLastName,v as setAccountInfoFormPhone,h as submitAccountInfoForm};
1
+ import{__awaiter as e,__generator as s,__assign as r}from'./../../../../ext/tslib/tslib.es6.mjs.js';import{I18n as i}from"../../../../i18n/index.js";import{customerStore as a}from"../../../../stores/customer/index.js";import"../../../../packages/storefront-config/src/index.js";import'./../../../../ext/lodash/_isFlattenable.js';import'./../../../../ext/lodash/sortBy.js';import"../../../../stores/base/index.js";import"../../../../stores/cart/index.js";import'./../../../../ext/mobx/dist/mobx.esm.js';import"../../../../router/index.js";import{waitForCustomerStoreInit as t,saveCustomer as o}from"../../../stores/customer/index.js";import{validateValue as n,FORM_ITEM_DEFAULT_VALUE as l}from"../index.js";import{isCustomerSubscribed as m}from"../../customer/index.js";function u(o){return e(this,void 0,void 0,function(){var e;return s(this,function(s){switch(s.label){case 0:return[4,t(a)];case 1:return s.sent(),e=a.customer,o.firstName=r(r({},l),{value:(null==e?void 0:e.firstName)||"",isRequired:!0,label:i.translate("label.first_name"),placeholder:i.translate("placeholder.first_name")}),o.lastName=r(r({},l),{value:(null==e?void 0:e.lastName)||"",isRequired:!0,label:i.translate("label.last_name"),placeholder:i.translate("placeholder.last_name")}),o.phone=r(r({},l),{value:(null==e?void 0:e.phone)||"",isRequired:!1,label:i.translate("label.phone"),placeholder:i.translate("placeholder.phone")}),o.isMarketingAccepted={value:!!e&&m(e),hasError:!1,message:void 0},o.isInitialized=!0,o.isSubmitted=!1,o.isSubmitting=!1,o.isSuccess=void 0,o.isFailure=void 0,o.responseMessage=void 0,[2]}})})}function d(e,s){e.firstName&&(e.firstName.value=s),e.isSubmitted&&f(e)}function c(e,s){e.lastName&&(e.lastName.value=s),e.isSubmitted&&f(e)}function p(e,s){e.phone&&(e.phone.value=s),e.isSubmitted&&f(e)}function v(e,s){e.isMarketingAccepted&&(e.isMarketingAccepted.value=s,e.isSubmitted&&f(e))}function h(t){return e(this,void 0,void 0,function(){var e,n,l,m,u;return s(this,function(s){switch(s.label){case 0:return t.isSubmitted=!0,t.isSuccess=void 0,t.isFailure=void 0,t.responseMessage=void 0,f(t)?[2,!1]:(t.isSubmitting=!0,[4,o(a,r(r({},a.customer),{firstName:null===(n=t.firstName)||void 0===n?void 0:n.value,lastName:null===(l=t.lastName)||void 0===l?void 0:l.value,phone:null===(m=t.phone)||void 0===m?void 0:m.value,subscriptionStatus:(null===(u=t.isMarketingAccepted)||void 0===u?void 0:u.value)?"SUBSCRIBED":"NOT_SUBSCRIBED"}))]);case 1:return e=s.sent(),t.isSubmitting=!1,e?(t.isSuccess=!0,t.responseMessage=i.translate("notification.success.account_info"),[2,!0]):(t.isFailure=!0,t.responseMessage=i.translate("notification.failure.account_info"),[2,!1])}})})}function f(e){if(!e.firstName||!e.lastName||!e.phone)return!1;var s=n(e.firstName.value,{required:!0});s.hasError?(e.firstName.hasError=!0,e.firstName.message=s.message):(e.firstName.hasError=!1,e.firstName.message=void 0);var r=n(e.lastName.value,{required:!0});r.hasError?(e.lastName.hasError=!0,e.lastName.message=r.message):(e.lastName.hasError=!1,e.lastName.message=void 0);var i=n(e.phone.value,{phone:!0});return i.hasError?(e.phone.hasError=!0,e.phone.message=i.message):(e.phone.hasError=!1,e.phone.message=void 0),s.hasError||r.hasError||i.hasError}export{u as initAccountInfoForm,d as setAccountInfoFormFirstName,v as setAccountInfoFormIsMarketingAccepted,c as setAccountInfoFormLastName,p as setAccountInfoFormPhone,h as submitAccountInfoForm};
@@ -1 +1 @@
1
- import{__assign as e,__awaiter as s,__generator as a}from'./../../../../ext/tslib/tslib.es6.mjs.js';import{I18n as r}from"../../../../i18n/index.js";import{customerStore as t}from"../../../../stores/customer/index.js";import"../../../../stores/base/index.js";import"../../../../packages/storefront-config/src/index.js";import"../../../../stores/cart/index.js";import'./../../../../ext/mobx/dist/mobx.esm.js';import"../../../../router/index.js";import'./../../../../ext/lodash/sortBy.js';import{saveContactForm as i}from"../../../stores/customer/index.js";import{FORM_ITEM_DEFAULT_VALUE as o,validateValue as l}from"../index.js";function m(s){s.firstName=e(e({},o),{label:r.translate("label.first_name"),placeholder:r.translate("placeholder.first_name")}),s.lastName=e(e({},o),{label:r.translate("label.last_name"),placeholder:r.translate("placeholder.last_name")}),s.email=e(e({},o),{label:r.translate("label.email"),placeholder:r.translate("placeholder.email")}),s.phone=e(e({},o),{label:r.translate("label.phone"),placeholder:r.translate("placeholder.phone")}),s.message=e(e({},o),{label:r.translate("label.message"),placeholder:r.translate("placeholder.message")}),s.isSubmitted=!1,s.isSubmitting=!1,s.isSuccess=void 0,s.isFailure=void 0,s.responseMessage=void 0}function n(e,s){e.firstName.value=s,e.isSubmitted&&p(e)}function u(e,s){e.lastName.value=s,e.isSubmitted&&p(e)}function d(e,s){e.email.value=s,e.isSubmitted&&p(e)}function c(e,s){e.phone.value=s,e.isSubmitted&&p(e)}function h(e,s){e.message.value=s,e.isSubmitted&&p(e)}function f(e){return s(this,void 0,void 0,function(){var s;return a(this,function(a){switch(a.label){case 0:return e.isSubmitted=!0,e.isSuccess=void 0,e.isFailure=void 0,e.responseMessage=void 0,p(e)?[2,!1]:(e.isSubmitting=!0,[4,i(t,{firstName:e.firstName.value,lastName:e.lastName.value,email:e.email.value,message:e.message.value,referer:window.location.href,phone:e.phone.value})]);case 1:return s=a.sent(),e.isSubmitting=!1,s?(e.isSuccess=!0,e.responseMessage=r.translate("notification.success.contact_form"),[2,!0]):(e.isFailure=!0,e.responseMessage=r.translate("notification.failure.contact_form"),[2,!1])}})})}function p(e){var s=l(e.firstName.value,{required:!0});s.hasError?(e.firstName.hasError=!0,e.firstName.message=s.message):(e.firstName.hasError=!1,e.firstName.message=void 0);var a=l(e.lastName.value,{required:!0});a.hasError?(e.lastName.hasError=!0,e.lastName.message=a.message):(e.lastName.hasError=!1,e.lastName.message=void 0);var r=l(e.email.value,{required:!0,email:!0});r.hasError?(e.email.hasError=!0,e.email.message=r.message):(e.email.hasError=!1,e.email.message=void 0);var t=l(e.message.value,{required:!0});return t.hasError?(e.message.hasError=!0,e.message.message=t.message):(e.message.hasError=!1,e.message.message=void 0),s.hasError||a.hasError||r.hasError||t.hasError}export{m as initContactForm,d as setContactFormEmail,n as setContactFormFirstName,u as setContactFormLastName,h as setContactFormMessage,c as setContactFormPhone,f as submitContactForm};
1
+ import{__assign as e,__awaiter as s,__generator as a}from'./../../../../ext/tslib/tslib.es6.mjs.js';import{I18n as r}from"../../../../i18n/index.js";import{customerStore as t}from"../../../../stores/customer/index.js";import"../../../../packages/storefront-config/src/index.js";import'./../../../../ext/lodash/_isFlattenable.js';import'./../../../../ext/lodash/sortBy.js';import"../../../../stores/base/index.js";import"../../../../stores/cart/index.js";import'./../../../../ext/mobx/dist/mobx.esm.js';import"../../../../router/index.js";import{saveContactForm as i}from"../../../stores/customer/index.js";import{FORM_ITEM_DEFAULT_VALUE as o,validateValue as l}from"../index.js";function m(s){s.firstName=e(e({},o),{label:r.translate("label.first_name"),placeholder:r.translate("placeholder.first_name")}),s.lastName=e(e({},o),{label:r.translate("label.last_name"),placeholder:r.translate("placeholder.last_name")}),s.email=e(e({},o),{label:r.translate("label.email"),placeholder:r.translate("placeholder.email")}),s.phone=e(e({},o),{label:r.translate("label.phone"),placeholder:r.translate("placeholder.phone")}),s.message=e(e({},o),{label:r.translate("label.message"),placeholder:r.translate("placeholder.message")}),s.isSubmitted=!1,s.isSubmitting=!1,s.isSuccess=void 0,s.isFailure=void 0,s.responseMessage=void 0}function n(e,s){e.firstName.value=s,e.isSubmitted&&p(e)}function u(e,s){e.lastName.value=s,e.isSubmitted&&p(e)}function d(e,s){e.email.value=s,e.isSubmitted&&p(e)}function c(e,s){e.phone.value=s,e.isSubmitted&&p(e)}function h(e,s){e.message.value=s,e.isSubmitted&&p(e)}function f(e){return s(this,void 0,void 0,function(){var s;return a(this,function(a){switch(a.label){case 0:return e.isSubmitted=!0,e.isSuccess=void 0,e.isFailure=void 0,e.responseMessage=void 0,p(e)?[2,!1]:(e.isSubmitting=!0,[4,i(t,{firstName:e.firstName.value,lastName:e.lastName.value,email:e.email.value,message:e.message.value,referer:window.location.href,phone:e.phone.value})]);case 1:return s=a.sent(),e.isSubmitting=!1,s?(e.isSuccess=!0,e.responseMessage=r.translate("notification.success.contact_form"),[2,!0]):(e.isFailure=!0,e.responseMessage=r.translate("notification.failure.contact_form"),[2,!1])}})})}function p(e){var s=l(e.firstName.value,{required:!0});s.hasError?(e.firstName.hasError=!0,e.firstName.message=s.message):(e.firstName.hasError=!1,e.firstName.message=void 0);var a=l(e.lastName.value,{required:!0});a.hasError?(e.lastName.hasError=!0,e.lastName.message=a.message):(e.lastName.hasError=!1,e.lastName.message=void 0);var r=l(e.email.value,{required:!0,email:!0});r.hasError?(e.email.hasError=!0,e.email.message=r.message):(e.email.hasError=!1,e.email.message=void 0);var t=l(e.message.value,{required:!0});return t.hasError?(e.message.hasError=!0,e.message.message=t.message):(e.message.hasError=!1,e.message.message=void 0),s.hasError||a.hasError||r.hasError||t.hasError}export{m as initContactForm,d as setContactFormEmail,n as setContactFormFirstName,u as setContactFormLastName,h as setContactFormMessage,c as setContactFormPhone,f as submitContactForm};