@ikas/storefront 6.1.0-beta.13 → 6.1.0-beta.131

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 (122) hide show
  1. package/build/analytics/analytics.d.ts +3 -3
  2. package/build/analytics/analytics.js +1 -1
  3. package/build/analytics/googleAnalytics.js +1 -1
  4. package/build/analytics/googleTagManager.d.ts +3 -2
  5. package/build/analytics/googleTagManager.js +1 -1
  6. package/build/analytics/ikasV3.d.ts +6 -0
  7. package/build/analytics/ikasV3.js +1 -1
  8. package/build/components/checkout/components/address-form/index.js +1 -1
  9. package/build/components/checkout/components/address-form/model.d.ts +3 -0
  10. package/build/components/checkout/components/address-form/model.js +1 -1
  11. package/build/components/checkout/components/button/index.d.ts +1 -0
  12. package/build/components/checkout/components/button/index.js +1 -1
  13. package/build/components/checkout/components/button/style.module.scss.js +1 -1
  14. package/build/components/checkout/components/cart-summary/index.d.ts +4 -1
  15. package/build/components/checkout/components/cart-summary/index.js +1 -1
  16. package/build/components/checkout/components/cart-summary/style.module.scss.js +1 -1
  17. package/build/components/checkout/components/customer-addresses/index.d.ts +1 -0
  18. package/build/components/checkout/components/customer-addresses/index.js +1 -1
  19. package/build/components/checkout/components/error/stock-error/index.js +1 -1
  20. package/build/components/checkout/components/form-item/index.js +1 -1
  21. package/build/components/checkout/components/form-item/model.d.ts +5 -0
  22. package/build/components/checkout/components/form-item/model.js +1 -1
  23. package/build/components/checkout/components/form-item/style.module.scss.js +1 -1
  24. package/build/components/checkout/components/hepsipay/index.d.ts +9 -0
  25. package/build/components/checkout/components/hepsipay/index.js +1 -0
  26. package/build/components/checkout/components/input-with-button/style.module.scss.js +1 -1
  27. package/build/components/checkout/components/modal/index.d.ts +1 -0
  28. package/build/components/checkout/components/modal/index.js +1 -1
  29. package/build/components/checkout/components/modal/style.module.scss.js +1 -1
  30. package/build/components/checkout/components/offer-product/index.js +1 -1
  31. package/build/components/checkout/components/phone-number-input/index.js +1 -1
  32. package/build/components/checkout/components/quick-registration/completed.js +1 -1
  33. package/build/components/checkout/components/stripe/checkout-form.js +1 -1
  34. package/build/components/checkout/index.js +1 -1
  35. package/build/components/checkout/model.d.ts +18 -6
  36. package/build/components/checkout/model.js +1 -1
  37. package/build/components/checkout/steps/step-info/index.js +1 -1
  38. package/build/components/checkout/steps/step-payment/billing-address/index.js +1 -1
  39. package/build/components/checkout/steps/step-payment/payment-gateways/index.js +1 -1
  40. package/build/components/checkout/steps/step-success/index.js +1 -1
  41. package/build/components/image/index.d.ts +1 -0
  42. package/build/components/image/index.js +1 -1
  43. package/build/components/index.d.ts +2 -0
  44. package/build/components/page/head.js +1 -1
  45. package/build/components/page/index.js +1 -1
  46. package/build/components/page-editor/ThemeComponentEditor.js +1 -1
  47. package/build/components/page-editor/model.js +1 -1
  48. package/build/components/paypal-express-checkout/index.d.ts +9 -0
  49. package/build/components/paypal-express-checkout/index.js +1 -0
  50. package/build/components/plain-image/index.d.ts +13 -0
  51. package/build/components/plain-image/index.js +1 -0
  52. package/build/components/popup/index.js +1 -1
  53. package/build/components/popup/renderer/index.js +1 -1
  54. package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/formatIncompletePhoneNumber.js +1 -0
  55. package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/getCountries.js +1 -0
  56. package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/formatIncompletePhoneNumber.js +1 -0
  57. package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/getCountries.js +1 -0
  58. package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/getCountryCallingCode.js +1 -0
  59. package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/isSupportedCountry.js +1 -0
  60. package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/parsePhoneNumber.js +1 -0
  61. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/ObserverComponent.js +1 -0
  62. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/index.js +1 -0
  63. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/observer.js +1 -0
  64. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/useObserver.js +1 -0
  65. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/utils/UniversalFinalizationRegistry.js +1 -0
  66. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/utils/assertEnvironment.js +1 -0
  67. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/utils/observerBatching.js +1 -0
  68. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/utils/observerFinalizationRegistry.js +1 -0
  69. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/utils/printDebugValue.js +1 -0
  70. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/checkbox-item-view/index.js +1 -1
  71. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/index.js +1 -1
  72. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/input-item-view/index.js +1 -1
  73. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/phone-input-item-view/get-countries.js +1 -0
  74. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/phone-input-item-view/index.js +1 -0
  75. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/index.js +1 -1
  76. package/build/ext/@ikas/popup-renderer/build/popup-renderer/helpers/index.js +1 -1
  77. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/form-settings/index.js +1 -1
  78. package/build/hooks/useCustomerReviews.d.ts +2 -0
  79. package/build/hooks/useCustomerReviews.js +1 -1
  80. package/build/hooks/useStore.js +1 -1
  81. package/build/index.js +1 -1
  82. package/build/models/data/checkout-settings/index.d.ts +1 -0
  83. package/build/models/data/checkout-settings/index.js +1 -1
  84. package/build/models/data/customer/review/index.d.ts +4 -1
  85. package/build/models/data/customer/review/index.js +1 -1
  86. package/build/models/data/order/gift-card-line/index.d.ts +8 -0
  87. package/build/models/data/order/gift-card-line/index.js +1 -0
  88. package/build/models/data/order/index.d.ts +3 -0
  89. package/build/models/data/order/index.js +1 -1
  90. package/build/models/data/order/line-item/bundle-product-settings/index.d.ts +7 -0
  91. package/build/models/data/order/line-item/bundle-product-settings/index.js +1 -0
  92. package/build/models/data/order/line-item/index.d.ts +2 -0
  93. package/build/models/data/order/line-item/index.js +1 -1
  94. package/build/models/data/product/filter/index.d.ts +2 -0
  95. package/build/models/data/product/filter/index.js +1 -1
  96. package/build/models/data/product/index.d.ts +6 -0
  97. package/build/models/data/product/index.js +1 -1
  98. package/build/models/data/product/translations/index.d.ts +7 -0
  99. package/build/models/data/product/translations/index.js +1 -0
  100. package/build/models/data/product/variant/bundle-settings/bundle-product/index.js +1 -1
  101. package/build/models/data/product/variant/index.d.ts +1 -0
  102. package/build/models/data/product/variant/index.js +1 -1
  103. package/build/models/data/theme-json/component/prop/index.d.ts +1 -0
  104. package/build/models/data/theme-json/component/prop/index.js +1 -1
  105. package/build/models/data/theme-json/custom-data/index.d.ts +1 -0
  106. package/build/models/data/theme-json/custom-data/index.js +1 -1
  107. package/build/models/ui/customer-review-list/index.d.ts +8 -0
  108. package/build/models/ui/customer-review-list/index.js +1 -1
  109. package/build/models/ui/product-list/index.d.ts +17 -0
  110. package/build/models/ui/product-list/index.js +1 -1
  111. package/build/page-data-init/index.js +1 -1
  112. package/build/pages/checkout.js +1 -1
  113. package/build/store/cart/api.d.ts +2 -1
  114. package/build/store/cart/api.js +1 -1
  115. package/build/store/cart/index.d.ts +1 -0
  116. package/build/store/cart/index.js +1 -1
  117. package/build/store/checkout/index.d.ts +3 -1
  118. package/build/store/checkout/index.js +1 -1
  119. package/build/store/customer/index.js +1 -1
  120. package/build/utils/helper.d.ts +1 -0
  121. package/build/utils/helper.js +1 -1
  122. package/package.json +12 -12
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as t,__assign as i}from'./../../../../ext/tslib/tslib.es6.js';import{IkasProductPrice as r}from"./price/index.js";import{IkasVariantValue as n}from"../../variant-type/variant-value/index.js";import{IkasProductAttributeValue as o}from"../attribute-value/index.js";import{IkasProductImage as u}from"../image/index.js";import{IkasBundleSettings as c}from"./bundle-settings/index.js";import{IkasCustomerPriceListRuleValueType as l,IkasCampaignType as a,IkasCampaignFilterType as s,IkasCampaignApplicablePrice as d,IkasCustomerPriceListRuleFilterType as p}from"@ikas/storefront-models";import{IkasProductVariantFunctions as f,IkasProductPriceFunctions as m}from"@ikas/storefront-model-functions";import{IkasStorefrontConfig as b}from"@ikas/storefront-config";import{saveProductBackInStockRemind as v,listProductBackInStockRemind as g}from"@ikas/storefront-api";import h from"lodash/groupBy";import y from"lodash/sortBy";import{IkasProductVariantUnit as P}from"./unit/index.js";import{formatCurrency as I}from"../../../../utils/currency.js";import{makeAutoObservable as S}from"mobx";import{IkasBaseStore as O}from"../../../../store/base.js";import"../../../../store/customer/index.js";import"../../../../store/cart/index.js";var j=function(){function j(e){void 0===e&&(e={}),this._backInStockReminderSaved=!1,this.product=null,this.id=e.id||Date.now()+"",this.productId=e.productId||"",this.sku=e.sku||null,this.barcodeList=e.barcodeList||[],this.baseBundlePrices=e.baseBundlePrices?e.baseBundlePrices.map((function(e){return new r(e)})):[],this.bundleSettings=e.bundleSettings?new c(e.bundleSettings):null,this.variantValues=e.variantValues?e.variantValues.map((function(e){return new n(e)})):[],this.images=e.images?e.images.map((function(e){return new u(e)})):[],this.attributes=e.attributes?e.attributes.map((function(e){return new o(e)})):[],this.prices=e.prices?e.prices.map((function(e){return new r(e)})):[],this.stock=e.stock||0,this.isActive=void 0===e.isActive||e.isActive,this.campaigns=e.campaigns||[],this.unit=e.unit?new P(e.unit):null,this.sellIfOutOfStock=e.sellIfOutOfStock||!1,this.images=y(this.images,"order"),S(this)}return Object.defineProperty(j.prototype,"mainImage",{get:function(){var e=f.getMainImage(this);return e?new u(e):void 0},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"hasStock",{get:function(){return f.hasStock(this)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isBackInStockEnabled",{get:function(){return b.isBackInStockEnabled()},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isBackInStockCustomerLoginRequired",{get:function(){return b.isCustomerLoginRequiredForBackInStock()},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isBackInStockReminderSaved",{get:function(){return this._backInStockReminderSaved},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"groupedAttributeValues",{get:function(){var e,t=h(this.attributes,"productAttributeId");return(null===(e=this.attributes)||void 0===e?void 0:e.map((function(e){var i=e.productAttributeId;if(i){var r=t[i];return(null==r?void 0:r.length)&&r[0].productAttribute?{attribute:r[0].productAttribute,values:r}:void 0}})).filter((function(e){return!!e})))||[]},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"b2bPriceRule",{get:function(){var e,t,i=this,r=O.getInstance().customerStore.customer,n=null==r?void 0:r.priceListRules,o=function(e){var t,r,n,o;if(e.type===p.CATEGORY)return u=null===(t=e.valueList)||void 0===t?void 0:t.some((function(e){var t;return null===(t=i.product)||void 0===t?void 0:t.categories.find((function(t){return t.id===e}))}));if(e.type===p.PRODUCT)return u=null===(r=e.valueList)||void 0===r?void 0:r.some((function(e){return i.id===e}));if(e.type===p.PRODUCT_BRAND){var u=null===(n=e.valueList)||void 0===n?void 0:n.some((function(e){var t,r;return(null===(r=null===(t=i.product)||void 0===t?void 0:t.brand)||void 0===r?void 0:r.id)===e}));return u}if(e.type===p.PRODUCT_TAG){u=null===(o=e.valueList)||void 0===o?void 0:o.some((function(e){var t,r;return null===(r=null===(t=i.product)||void 0===t?void 0:t.tags)||void 0===r?void 0:r.find((function(t){return t.id===e}))}));return u}};if(n){for(var u=0,c=n;u<c.length;u++){var l=c[u];if(l.shouldMatchAllFilters?null===(e=l.filters)||void 0===e?void 0:e.every(o):null===(t=l.filters)||void 0===t?void 0:t.some(o))return l}return null}return null},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"price",{get:function(){var e,t;if(b.isB2BStorefront()){var i=O.getInstance().customerStore.customer;if(null==i?void 0:i.priceListId){var r=null===(e=this.prices)||void 0===e?void 0:e.find((function(e){return e.priceListId===i.priceListId}));if(r)return r}}return null===(t=this.prices)||void 0===t?void 0:t.find((function(e){return b.getPriceListId()?e.priceListId===b.getPriceListId():null===e.priceListId}))},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"bundlePrice",{get:function(){var e,t;if(b.isB2BStorefront()){var i=O.getInstance().customerStore.customer;if(null==i?void 0:i.priceListId){var r=null===(e=this.baseBundlePrices)||void 0===e?void 0:e.find((function(e){return e.priceListId===i.priceListId}));if(r)return r}}return(null===(t=this.baseBundlePrices)||void 0===t?void 0:t.find((function(e){return b.getPriceListId()?e.priceListId===b.getPriceListId():null===e.priceListId})))||this.price},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"finalPrice",{get:function(){var e=0;this.bundleSettings&&this.bundleSettings.products.every((function(e){return!!e.product}))?e=m.getFinalPrice(this.bundlePrice)+this.bundleSettings.products.reduce((function(e,t){return e+(t.addToBundleBasePrice?t.finalPriceWithQuantity:0)}),0):e=m.getFinalPrice(this.price);if(!this.b2bPriceRule)return e;switch(this.b2bPriceRule.valueType){case l.DISCOUNT_RATE:return e*((100-this.b2bPriceRule.value)/100);case l.DISCOUNT_AMOUNT:return e-this.b2bPriceRule.value;case l.FIXED_PRICE:return this.b2bPriceRule.value;default:return e}},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"formattedFinalPrice",{get:function(){return I(this.finalPrice,this.price.currency||"",this.price.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"sellPrice",{get:function(){return this.bundleSettings&&this.bundleSettings.products.every((function(e){return!!e.product}))?this.bundlePrice.sellPrice+this.bundleSettings.products.reduce((function(e,t){return e+(t.addToBundleBasePrice?t.sellPriceWithQuantity:0)}),0):this.price.sellPrice},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"formattedSellPrice",{get:function(){return I(this.sellPrice,this.price.currency||"",this.price.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"formattedBuyPrice",{get:function(){return I(this.price.buyPrice||0,this.price.currency||"",this.price.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"appliedCampaignAmount",{get:function(){var e,t,i,r,n,o,u=this;if(!(null===(e=this.price.campaignPrice)||void 0===e?void 0:e.campaignId))return null;var c=(null===(r=null===(i=null===(t=this.product)||void 0===t?void 0:t.campaigns)||void 0===i?void 0:i.find((function(e){var t;return e.campaign.id===(null===(t=u.price.campaignPrice)||void 0===t?void 0:t.campaignId)})))||void 0===r?void 0:r.campaign)||null;if(!c)return null;var l={type:c.type,formattedPrice:null,discountPercentage:null},s=c.tieredDiscount&&c.tieredDiscount.rules&&c.tieredDiscount.rules.length>0&&c.tieredDiscount.rules[0].amount;return c.type===a.FIXED_AMOUNT&&(l.formattedPrice=I(c.fixedDiscount?(null===(n=c.fixedDiscount)||void 0===n?void 0:n.amount)||0:s||0,this.price.currency||"",this.price.currencySymbol||"")),c.type===a.RATIO&&(l.discountPercentage=c.fixedDiscount?(null===(o=c.fixedDiscount.amount)||void 0===o?void 0:o.toString())||null:s?s.toString():null),l},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"campaignPrice",{get:function(){var e;return(null===(e=this.price.campaignPrice)||void 0===e?void 0:e.campaignPrice)||null},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"formattedCampaignPrice",{get:function(){return I(this.campaignPrice||0,this.price.currency||"",this.price.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"discountPrice",{get:function(){return this.finalPrice===this.sellPrice?null:this.finalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"formattedDiscountPrice",{get:function(){return I(this.discountPrice||0,this.price.currency||"",this.price.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"hasDiscount",{get:function(){return this.finalPrice!==this.sellPrice},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"discountAmount",{get:function(){return this.hasDiscount?this.sellPrice-this.finalPrice:0},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"discountPercentage",{get:function(){return this.hasDiscount?(100-100*this.finalPrice/this.sellPrice).toFixed(0):0},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"finalPriceWithCampaignOffers",{get:function(){var e,t;return this.finalPrice+((null===(t=null===(e=this.product)||void 0===e?void 0:e.offers)||void 0===t?void 0:t.filter((function(e){return e.isSelected&&!e.isAccepted})).reduce((function(e,t){return e+t.product.selectedVariant.finalPrice}),0))||0)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"formattedFinalPriceWithCampaignOffers",{get:function(){return I(this.finalPriceWithCampaignOffers,this.price.currency||"",this.price.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"sellPriceWithCampaignOffers",{get:function(){var e,t;return this.sellPrice+((null===(t=null===(e=this.product)||void 0===e?void 0:e.offers)||void 0===t?void 0:t.filter((function(e){return e.isSelected&&!e.isAccepted})).reduce((function(e,t){return e+t.product.selectedVariant.sellPrice}),0))||0)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"formattedSellPriceWithCampaignOffers",{get:function(){return I(this.sellPriceWithCampaignOffers,this.price.currency||"",this.price.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"campaignOffersDiscountPercentage",{get:function(){return this.finalPriceWithCampaignOffers!==this.sellPriceWithCampaignOffers?(100-100*this.finalPriceWithCampaignOffers/this.sellPriceWithCampaignOffers).toFixed(0):0},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"tieredDiscountProducts",{get:function(){var e,t,i,r,n=this,o=null===(i=null===(t=null===(e=this.product)||void 0===e?void 0:e.campaigns)||void 0===t?void 0:t.find((function(e){return!!e.campaign.tieredDiscount})))||void 0===i?void 0:i.campaign,u=null===(r=null==o?void 0:o.tieredDiscount)||void 0===r?void 0:r.filters;if(u){var c=u.find((function(e){return e.type===s.PRODUCT_AND_VARIANT}));if(c){var l=[];if(c.idList.map((function(e){l.push(e.replace("p:","").replace("v:",""))})),!l.some((function(e){return n.id===e||n.productId===e})))return[]}}return o&&o.tieredDiscount?o.tieredDiscount.rules.every((function(e){return!e.lineItemQuantityRange}))?[]:o.tieredDiscount.rules.map((function(e){var t,i,r,u,c=o.applicablePrice===d.SELL_PRICE?n.sellPrice:n.finalPrice,l=c*((null===(t=e.lineItemQuantityRange)||void 0===t?void 0:t.min)||1),s=I(c,n.price.currency||"",n.price.currencySymbol||""),p=I(l,n.price.currency||"",n.price.currencySymbol||""),f=o.type===a.RATIO?c-c*(e.amount||1)/100:c,m=f*((null===(i=e.lineItemQuantityRange)||void 0===i?void 0:i.min)||1)-(o.type===a.FIXED_AMOUNT&&e.amount||0),b=I(f,n.price.currency||"",n.price.currencySymbol||""),v=I(m,n.price.currency||"",n.price.currencySymbol||"");return{amount:e.amount,lineItemQuantityRange:{min:(null===(r=e.lineItemQuantityRange)||void 0===r?void 0:r.min)||0,max:(null===(u=e.lineItemQuantityRange)||void 0===u?void 0:u.max)||0},type:o.type,sellPrice:c,finalPrice:f,sellPriceWithQuantity:l,finalPriceWithQuantity:m,formattedSellPrice:s,formattedSellPriceWithQuantity:p,formattedFinalPrice:b,formattedFinalPriceWithQuantity:v}})):[]},enumerable:!1,configurable:!0}),j.prototype.saveBackInStockReminder=function(i){var r;return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,g({email:{eq:i},productId:{eq:this.productId},variantId:{eq:this.id}})];case 1:return(e=t.sent())&&(null===(r=e.data)||void 0===r?void 0:r.length)?(this._backInStockReminderSaved=!0,[2,!1]):[3,2];case 2:return[4,v({input:{email:i,productId:this.productId,variantId:this.id}})];case 3:return t.sent().isSuccess?(this._backInStockReminderSaved=!0,[2,!0]):(this._backInStockReminderSaved=!1,[2,!1]);case 4:return[2]}}))}))},j.prototype.toJSON=function(){var e=i({},this);return delete e.product,e},j}();export{j as IkasProductVariant};
1
+ import{__awaiter as e,__generator as t,__assign as i}from'./../../../../ext/tslib/tslib.es6.js';import{IkasProductPrice as r}from"./price/index.js";import{IkasVariantValue as n}from"../../variant-type/variant-value/index.js";import{IkasProductAttributeValue as o}from"../attribute-value/index.js";import{IkasProductImage as u}from"../image/index.js";import{IkasBundleSettings as c}from"./bundle-settings/index.js";import{IkasCustomerPriceListRuleValueType as l,IkasCampaignType as a,IkasCampaignFilterType as s,IkasCampaignApplicablePrice as d,IkasCustomerPriceListRuleFilterType as p}from"@ikas/storefront-models";import{IkasProductVariantFunctions as f,IkasProductPriceFunctions as m}from"@ikas/storefront-model-functions";import{IkasStorefrontConfig as b}from"@ikas/storefront-config";import{saveProductBackInStockRemind as v,listProductBackInStockRemind as h}from"@ikas/storefront-api";import g from"lodash/groupBy";import y from"lodash/sortBy";import{IkasProductVariantUnit as P}from"./unit/index.js";import{formatCurrency as I}from"../../../../utils/currency.js";import{makeAutoObservable as S}from"mobx";import{IkasBaseStore as O}from"../../../../store/base.js";import"../../../../store/customer/index.js";import"../../../../store/cart/index.js";var j=function(){function j(e){void 0===e&&(e={}),this._backInStockReminderSaved=!1,this.product=null,this.id=e.id||Date.now()+"",this.productId=e.productId||"",this.sku=e.sku||null,this.barcodeList=e.barcodeList||[],this.baseBundlePrices=e.baseBundlePrices?e.baseBundlePrices.map((function(e){return new r(e)})):[],this.bundleSettings=e.bundleSettings?new c(e.bundleSettings):null,this.variantValues=e.variantValues?e.variantValues.map((function(e){return new n(e)})):[],this.images=e.images?e.images.map((function(e){return new u(e)})):[],this.attributes=e.attributes?e.attributes.map((function(e){return new o(e)})):[],this.prices=e.prices?e.prices.map((function(e){return new r(e)})):[],this.stock=e.stock||0,this.isActive=void 0===e.isActive||e.isActive,this.campaigns=e.campaigns||[],this.unit=e.unit?new P(e.unit):null,this.sellIfOutOfStock=e.sellIfOutOfStock||!1,this.images=y(this.images,"order"),S(this)}return Object.defineProperty(j.prototype,"mainImage",{get:function(){var e=f.getMainImage(this);return e?new u(e):void 0},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"hasStock",{get:function(){return f.hasStock(this)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isBackInStockEnabled",{get:function(){return b.isBackInStockEnabled()},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isBackInStockCustomerLoginRequired",{get:function(){return b.isCustomerLoginRequiredForBackInStock()},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isBackInStockReminderSaved",{get:function(){return this._backInStockReminderSaved},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"groupedAttributeValues",{get:function(){var e,t=g(this.attributes,"productAttributeId");return(null===(e=this.attributes)||void 0===e?void 0:e.map((function(e){var i=e.productAttributeId;if(i){var r=t[i];return(null==r?void 0:r.length)&&r[0].productAttribute?{attribute:r[0].productAttribute,values:r}:void 0}})).filter((function(e){return!!e})))||[]},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"b2bPriceRule",{get:function(){var e,t,i=this,r=O.getInstance().customerStore.customer,n=null==r?void 0:r.priceListRules,o=function(e){var t,r,n,o;if(e.type===p.CATEGORY)return u=null===(t=e.valueList)||void 0===t?void 0:t.some((function(e){var t;return null===(t=i.product)||void 0===t?void 0:t.categories.find((function(t){return t.id===e}))}));if(e.type===p.PRODUCT)return u=null===(r=e.valueList)||void 0===r?void 0:r.some((function(e){return i.id===e}));if(e.type===p.PRODUCT_BRAND){var u=null===(n=e.valueList)||void 0===n?void 0:n.some((function(e){var t,r;return(null===(r=null===(t=i.product)||void 0===t?void 0:t.brand)||void 0===r?void 0:r.id)===e}));return u}if(e.type===p.PRODUCT_TAG){u=null===(o=e.valueList)||void 0===o?void 0:o.some((function(e){var t,r;return null===(r=null===(t=i.product)||void 0===t?void 0:t.tags)||void 0===r?void 0:r.find((function(t){return t.id===e}))}));return u}};if(n){for(var u=0,c=n;u<c.length;u++){var l=c[u];if(l.shouldMatchAllFilters?null===(e=l.filters)||void 0===e?void 0:e.every(o):null===(t=l.filters)||void 0===t?void 0:t.some(o))return l}return null}return null},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"price",{get:function(){var e,t;if(b.isB2BStorefront()){var i=O.getInstance().customerStore.customer;if(null==i?void 0:i.priceListId){var r=null===(e=this.prices)||void 0===e?void 0:e.find((function(e){return e.priceListId===i.priceListId}));if(r)return r}}return null===(t=this.prices)||void 0===t?void 0:t.find((function(e){return b.getPriceListId()?e.priceListId===b.getPriceListId():null===e.priceListId}))},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"bundlePrice",{get:function(){var e,t;if(b.isB2BStorefront()){var i=O.getInstance().customerStore.customer;if(null==i?void 0:i.priceListId){var r=null===(e=this.baseBundlePrices)||void 0===e?void 0:e.find((function(e){return e.priceListId===i.priceListId}));if(r)return r}}return(null===(t=this.baseBundlePrices)||void 0===t?void 0:t.find((function(e){return b.getPriceListId()?e.priceListId===b.getPriceListId():null===e.priceListId})))||this.price},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"finalPrice",{get:function(){var e=0;this.bundleSettings&&this.bundleSettings.products.every((function(e){return!!e.product}))?e=m.getFinalPrice(this.bundlePrice)+this.bundleSettings.products.reduce((function(e,t){return e+(t.addToBundleBasePrice?t.finalPriceWithQuantity:0)}),0):e=m.getFinalPrice(this.price);if(!this.b2bPriceRule)return e;switch(this.b2bPriceRule.valueType){case l.DISCOUNT_RATE:return e*((100-this.b2bPriceRule.value)/100);case l.DISCOUNT_AMOUNT:return e-this.b2bPriceRule.value;case l.FIXED_PRICE:return this.b2bPriceRule.value;default:return e}},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"formattedFinalPrice",{get:function(){return I(this.finalPrice,this.price.currency||"",this.price.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"sellPrice",{get:function(){return this.bundleSettings&&this.bundleSettings.products.every((function(e){return!!e.product}))?this.bundlePrice.sellPrice+this.bundleSettings.products.reduce((function(e,t){return e+(t.addToBundleBasePrice?t.sellPriceWithQuantity:0)}),0):this.price.sellPrice},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"formattedSellPrice",{get:function(){return I(this.sellPrice,this.price.currency||"",this.price.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"formattedBuyPrice",{get:function(){return I(this.price.buyPrice||0,this.price.currency||"",this.price.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"appliedCampaignAmount",{get:function(){var e,t,i,r,n,o,u=this;if(!(null===(e=this.price.campaignPrice)||void 0===e?void 0:e.campaignId))return null;var c=(null===(r=null===(i=null===(t=this.product)||void 0===t?void 0:t.campaigns)||void 0===i?void 0:i.find((function(e){var t;return e.campaign.id===(null===(t=u.price.campaignPrice)||void 0===t?void 0:t.campaignId)})))||void 0===r?void 0:r.campaign)||null;if(!c)return null;var l={type:c.type,formattedPrice:null,discountPercentage:null},s=c.tieredDiscount&&c.tieredDiscount.rules&&c.tieredDiscount.rules.length>0&&c.tieredDiscount.rules[0].amount;return c.type===a.FIXED_AMOUNT&&(l.formattedPrice=I(c.fixedDiscount?(null===(n=c.fixedDiscount)||void 0===n?void 0:n.amount)||0:s||0,this.price.currency||"",this.price.currencySymbol||"")),c.type===a.RATIO&&(l.discountPercentage=c.fixedDiscount?(null===(o=c.fixedDiscount.amount)||void 0===o?void 0:o.toString())||null:s?s.toString():null),l},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"campaignPrice",{get:function(){var e;return(null===(e=this.price.campaignPrice)||void 0===e?void 0:e.campaignPrice)||null},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"formattedCampaignPrice",{get:function(){return I(this.campaignPrice||0,this.price.currency||"",this.price.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"discountPrice",{get:function(){return this.finalPrice===this.sellPrice?null:this.finalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"formattedDiscountPrice",{get:function(){return I(this.discountPrice||0,this.price.currency||"",this.price.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"hasDiscount",{get:function(){return this.finalPrice!==this.sellPrice},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"discountAmount",{get:function(){return this.hasDiscount?this.sellPrice-this.finalPrice:0},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"discountPercentage",{get:function(){return this.hasDiscount?(100-100*this.finalPrice/this.sellPrice).toFixed(0):0},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"finalPriceWithCampaignOffers",{get:function(){var e,t;return this.finalPrice+((null===(t=null===(e=this.product)||void 0===e?void 0:e.offers)||void 0===t?void 0:t.filter((function(e){return e.isSelected&&!e.isAccepted})).reduce((function(e,t){return e+t.product.selectedVariant.finalPrice}),0))||0)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"formattedFinalPriceWithCampaignOffers",{get:function(){return I(this.finalPriceWithCampaignOffers,this.price.currency||"",this.price.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"sellPriceWithCampaignOffers",{get:function(){var e,t;return this.sellPrice+((null===(t=null===(e=this.product)||void 0===e?void 0:e.offers)||void 0===t?void 0:t.filter((function(e){return e.isSelected&&!e.isAccepted})).reduce((function(e,t){return e+t.product.selectedVariant.sellPrice}),0))||0)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"formattedSellPriceWithCampaignOffers",{get:function(){return I(this.sellPriceWithCampaignOffers,this.price.currency||"",this.price.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"campaignOffersDiscountPercentage",{get:function(){return this.finalPriceWithCampaignOffers!==this.sellPriceWithCampaignOffers?(100-100*this.finalPriceWithCampaignOffers/this.sellPriceWithCampaignOffers).toFixed(0):0},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"tieredDiscountProducts",{get:function(){var e,t,i,r,n=this,o=null===(i=null===(t=null===(e=this.product)||void 0===e?void 0:e.campaigns)||void 0===t?void 0:t.find((function(e){return!!e.campaign.tieredDiscount})))||void 0===i?void 0:i.campaign,u=null===(r=null==o?void 0:o.tieredDiscount)||void 0===r?void 0:r.filters;if(u){var c=u.find((function(e){return e.type===s.PRODUCT_AND_VARIANT}));if(c){var l=[];if(c.idList.map((function(e){l.push(e.replace("p:","").replace("v:",""))})),!l.some((function(e){return n.id===e||n.productId===e})))return[]}}return o&&o.tieredDiscount?o.tieredDiscount.rules.every((function(e){return!e.lineItemQuantityRange}))?[]:o.tieredDiscount.rules.map((function(e){var t,i,r,u,c=o.applicablePrice===d.SELL_PRICE?n.sellPrice:n.finalPrice,l=c*((null===(t=e.lineItemQuantityRange)||void 0===t?void 0:t.min)||1),s=I(c,n.price.currency||"",n.price.currencySymbol||""),p=I(l,n.price.currency||"",n.price.currencySymbol||""),f=o.type===a.RATIO?c-c*(e.amount||1)/100:c,m=f*((null===(i=e.lineItemQuantityRange)||void 0===i?void 0:i.min)||1)-(o.type===a.FIXED_AMOUNT&&e.amount||0),b=I(f,n.price.currency||"",n.price.currencySymbol||""),v=I(m,n.price.currency||"",n.price.currencySymbol||"");return{amount:e.amount,lineItemQuantityRange:{min:(null===(r=e.lineItemQuantityRange)||void 0===r?void 0:r.min)||0,max:(null===(u=e.lineItemQuantityRange)||void 0===u?void 0:u.max)||0},type:o.type,sellPrice:c,finalPrice:f,sellPriceWithQuantity:l,finalPriceWithQuantity:m,formattedSellPrice:s,formattedSellPriceWithQuantity:p,formattedFinalPrice:b,formattedFinalPriceWithQuantity:v,salesChannelIds:o.salesChannelIds}})):[]},enumerable:!1,configurable:!0}),j.prototype.saveBackInStockReminder=function(i){var r;return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,h({email:{eq:i},productId:{eq:this.productId},variantId:{eq:this.id}})];case 1:return(e=t.sent())&&(null===(r=e.data)||void 0===r?void 0:r.length)?(this._backInStockReminderSaved=!0,[2,!1]):[3,2];case 2:return[4,v({input:{email:i,productId:this.productId,variantId:this.id}})];case 3:return t.sent().isSuccess?(this._backInStockReminderSaved=!0,[2,!0]):(this._backInStockReminderSaved=!1,[2,!1]);case 4:return[2]}}))}))},j.prototype.toJSON=function(){var e=i({},this);return delete e.product,e},j}();export{j as IkasProductVariant};
@@ -18,6 +18,7 @@ export declare class IkasThemeJsonComponentProp implements IThemeJsonComponentPr
18
18
  };
19
19
  excludedFields?: string[] | null;
20
20
  excludedFieldsCategory?: string[] | null;
21
+ isFacetListNotSent?: boolean;
21
22
  constructor(data: Partial<IkasThemeJsonComponentProp>);
22
23
  }
23
24
  export { IkasThemeJsonComponentPropType };
@@ -1 +1 @@
1
- import{IkasThemeJsonComponentPropType as e}from"@ikas/storefront-models";export{IkasThemeJsonComponentPropType}from"@ikas/storefront-models";import{makeAutoObservable as t}from"mobx";var i=function(i){this.translations={},this.id=i.id||Date.now()+"",this.name=i.name||"",this.displayName=i.displayName||"",this.description=i.description||"",this.type=i.type||e.TEXT,this.isRequired=i.isRequired||!1,this.customDataId=i.customDataId||null,this.requiredPropId=i.requiredPropId,this.requiredEnumOptionId=i.requiredEnumOptionId,this.requiredEnumOptionValue=i.requiredEnumOptionValue,this.attributeTypes=i.attributeTypes||null,this.sliderData=i.sliderData||{},this.translations=i.translations||{},this.excludedFields=i.excludedFields||[],this.excludedFieldsCategory=i.excludedFieldsCategory||[],t(this)};export{i as IkasThemeJsonComponentProp};
1
+ import{IkasThemeJsonComponentPropType as t}from"@ikas/storefront-models";export{IkasThemeJsonComponentPropType}from"@ikas/storefront-models";import{makeAutoObservable as e}from"mobx";var i=function(i){this.translations={},this.id=i.id||Date.now()+"",this.name=i.name||"",this.displayName=i.displayName||"",this.description=i.description||"",this.type=i.type||t.TEXT,this.isRequired=i.isRequired||!1,this.customDataId=i.customDataId||null,this.requiredPropId=i.requiredPropId,this.requiredEnumOptionId=i.requiredEnumOptionId,this.requiredEnumOptionValue=i.requiredEnumOptionValue,this.attributeTypes=i.attributeTypes||null,this.sliderData=i.sliderData||{},this.translations=i.translations||{},this.excludedFields=i.excludedFields||[],this.excludedFieldsCategory=i.excludedFieldsCategory||[],this.isFacetListNotSent=i.isFacetListNotSent||!1,e(this)};export{i as IkasThemeJsonComponentProp};
@@ -21,6 +21,7 @@ export declare class IkasThemeJsonCustomData implements IThemeJsonCustomData {
21
21
  parent?: IkasThemeJsonCustomData | null;
22
22
  excludedFields?: string[] | null;
23
23
  excludedFieldsCategory?: string[] | null;
24
+ isFacetListNotSent?: boolean;
24
25
  constructor(data?: Partial<IkasThemeJsonCustomData>);
25
26
  get flat(): IkasThemeJsonCustomData[];
26
27
  toJSON(): this;
@@ -1 +1 @@
1
- import{__assign as t}from'./../../../../ext/tslib/tslib.es6.js';import i from"lodash/flatten";import{IkasThemeJsonComponentPropType as e}from"@ikas/storefront-models";var s=function(){function s(i){void 0===i&&(i={});var a,l=this;this.translations={},this.customDataId=null,this.id=i.id||"",this.name=i.name||null,this.description=i.description||null,this.typescriptName=i.name||null,this.type=i.type||e.TEXT,this.isRequired=void 0===i.isRequired||i.isRequired,this.translations=i.translations||{},this.key=i.key||null,this.parent=i.parent||null,this.itemCount=i.itemCount||null,this.attributeTypes=i.attributeTypes||null,this.enumOptions=(null===(a=i.enumOptions)||void 0===a?void 0:a.map((function(t){return new n(t)})))||null,this.customDataId=i.customDataId||null,this.sliderData=i.sliderData||{},this.isRoot=i.isRoot||!1,this.nestedData=i.nestedData?i.nestedData.map((function(i){return new s(t(t({},i),{parent:l}))})):null,this.type!==e.STATIC_LIST||this.itemCount||(this.itemCount=1),this.excludedFields=i.excludedFields||[],this.excludedFieldsCategory=i.excludedFieldsCategory||[]}return Object.defineProperty(s.prototype,"flat",{get:function(){if(!this.nestedData||!this.nestedData.length)return[this];var t=i(this.nestedData.map((function(t){return t.flat}))),e=[];return e.push(this),e=e.concat(t)},enumerable:!1,configurable:!0}),s.prototype.toJSON=function(){var i=t({},this);return delete i.parent,i},s}(),n=function(t){void 0===t&&(t={}),this.translations={},this.id=t.id||"",this.displayName=t.displayName||"",this.value=t.value||"",this.translations=t.translations||{}},a=function(t){void 0===t&&(t={}),this.name=t.name||null,this.description=t.description||null},l=function(t){void 0===t&&(t={}),this.displayName=t.displayName||null};export{s as IkasThemeJsonCustomData,l as IkasThemeJsonCustomDataEnumOptionTranslation,a as IkasThemeJsonCustomDataTranslation,n as IkasThemeJsonEnumOption};
1
+ import{__assign as t}from'./../../../../ext/tslib/tslib.es6.js';import i from"lodash/flatten";import{IkasThemeJsonComponentPropType as e}from"@ikas/storefront-models";var s=function(){function s(i){void 0===i&&(i={});var a,o=this;this.translations={},this.customDataId=null,this.id=i.id||"",this.name=i.name||null,this.description=i.description||null,this.typescriptName=i.name||null,this.type=i.type||e.TEXT,this.isRequired=void 0===i.isRequired||i.isRequired,this.translations=i.translations||{},this.key=i.key||null,this.parent=i.parent||null,this.itemCount=i.itemCount||null,this.attributeTypes=i.attributeTypes||null,this.enumOptions=(null===(a=i.enumOptions)||void 0===a?void 0:a.map((function(t){return new n(t)})))||null,this.customDataId=i.customDataId||null,this.sliderData=i.sliderData||{},this.isRoot=i.isRoot||!1,this.nestedData=i.nestedData?i.nestedData.map((function(i){return new s(t(t({},i),{parent:o}))})):null,this.type!==e.STATIC_LIST||this.itemCount||(this.itemCount=1),this.excludedFields=i.excludedFields||[],this.excludedFieldsCategory=i.excludedFieldsCategory||[],this.isFacetListNotSent=i.isFacetListNotSent||!1}return Object.defineProperty(s.prototype,"flat",{get:function(){if(!this.nestedData||!this.nestedData.length)return[this];var t=i(this.nestedData.map((function(t){return t.flat}))),e=[];return e.push(this),e=e.concat(t)},enumerable:!1,configurable:!0}),s.prototype.toJSON=function(){var i=t({},this);return delete i.parent,i},s}(),n=function(t){void 0===t&&(t={}),this.translations={},this.id=t.id||"",this.displayName=t.displayName||"",this.value=t.value||"",this.translations=t.translations||{}},a=function(t){void 0===t&&(t={}),this.name=t.name||null,this.description=t.description||null},o=function(t){void 0===t&&(t={}),this.displayName=t.displayName||null};export{s as IkasThemeJsonCustomData,o as IkasThemeJsonCustomDataEnumOptionTranslation,a as IkasThemeJsonCustomDataTranslation,n as IkasThemeJsonEnumOption};
@@ -9,6 +9,8 @@ export declare class IkasCustomerReviewList {
9
9
  private _productId?;
10
10
  private _hasImage?;
11
11
  private _productIds?;
12
+ private _locale?;
13
+ private _sortWithImagesFirst?;
12
14
  private _isLoading;
13
15
  constructor(data: IkasCustomerReviewListParams);
14
16
  get limit(): number;
@@ -21,6 +23,8 @@ export declare class IkasCustomerReviewList {
21
23
  get isLoading(): boolean;
22
24
  get hasImage(): boolean | undefined;
23
25
  get productIds(): string[] | null | undefined;
26
+ get locale(): string | undefined;
27
+ get sortWithImagesFirst(): boolean | undefined;
24
28
  private listCustomerReviews;
25
29
  getInitial: () => Promise<void>;
26
30
  getPrev: () => Promise<void>;
@@ -34,10 +38,13 @@ export declare class IkasCustomerReviewList {
34
38
  initialized: boolean;
35
39
  minPage: number | null | undefined;
36
40
  productId: string | null | undefined;
41
+ locale: string | undefined;
42
+ sortWithImagesFirst: boolean | undefined;
37
43
  };
38
44
  }
39
45
  export declare type IkasCustomerReviewListParams = {
40
46
  data?: IkasCustomerReview[];
47
+ locale?: string;
41
48
  limit?: number;
42
49
  page?: number;
43
50
  count?: number;
@@ -46,4 +53,5 @@ export declare type IkasCustomerReviewListParams = {
46
53
  productId?: string;
47
54
  productIds?: string[] | null;
48
55
  hasImage?: boolean;
56
+ sortWithImagesFirst?: boolean;
49
57
  };
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as i,__assign as e}from'./../../../ext/tslib/tslib.es6.js';import{IkasStorefrontConfig as a}from"@ikas/storefront-config";import{makeAutoObservable as r}from"mobx";import o from"../../../store/customer/api.js";import n from"../../../store/product/index.js";import"../../data/blog/category/index.js";import"../../data/blog/content/index.js";import"../../data/blog/meta-data/index.js";import"../../data/blog/tag/index.js";import"../../data/blog/index.js";import"../../data/brand/index.js";import"@ikas/storefront-models";import"../../data/campaign-offer/index.js";import"../../data/cart/campaign-offer/index.js";import"../../data/cart/index.js";import"../../data/category/path-item/index.js";import"../../data/category/index.js";import"../../data/checkout/index.js";import"../../data/checkout-settings/index.js";import"../../data/city/index.js";import"../../data/country/index.js";import"../../data/customer/address/region/index.js";import"../../data/customer/address/index.js";import"../../data/customer/address/ikas-localized-customer-address.js";import"../../data/customer/attribute/index.js";import"../../data/customer/review/summary/index.js";import{IkasCustomerReview as s}from"../../data/customer/review/index.js";import"../../data/customer/index.js";import"../../data/customer-form-data-input/index.js";import"../../data/district/index.js";import"../../data/favorite-product/index.js";import"../../data/filter-category/index.js";import"../../data/html-meta-data/index.js";import"../../data/image/index.js";import"../../data/order/address/region/index.js";import"../../data/order/address/index.js";import"../../data/order/line-item/option/value/index.js";import"../../data/order/line-item/variant/value/index.js";import"../../data/order/line-item/variant/index.js";import"../../data/order/line-item/index.js";import"../../data/order/order-transaction-with-prices/index.js";import"../../data/order/package/index.js";import"../../data/order/transaction/index.js";import"../../data/order/index.js";import"../../data/payment-gateway/index.js";import"../../data/product/attribute-value/index.js";import"../../data/product/filter/index.js";import"../../data/product/campaign-offer/index.js";import"../../data/product/option-set/option/index.js";import"../../data/product/option-set/index.js";import"../../data/product/stock-location/index.js";import"../../data/product/variant/price/index.js";import"../../data/product/variant/index.js";import"../../data/variant-type/index.js";import"../../data/product/index.js";import"../../data/raffle/index.js";import"../../data/shipping-zone/state/city/district/region/index.js";import"../../data/state/index.js";import"../../data/storefront-popup/storefront-popup-display-filter/index.js";import"../../data/storefront-popup/storefront-popup-display-settings/index.js";import"../../data/storefront-popup/storefront-popup-page-filter/index.js";import"../../data/storefront-popup/index.js";import"../../data/theme-json/index.js";import"../../data/theme-json/component/index.js";import"../../data/theme-json/custom-data/index.js";import"../../data/variant-type/variant-value/index.js";import"@ikas/localized-address";var d=function(){function d(e){var a=this;this._initialized=!1,this._minPage=null,this._productId=null,this._hasImage=!1,this._productIds=null,this._isLoading=!1,this.getInitial=function(){return t(a,void 0,void 0,(function(){var t,e,a,r;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,this.listCustomerReviews(this.page,this.limit,this.hasImage,this.productIds)];case 2:return t=i.sent(),this.data=(null===(a=t.data)||void 0===a?void 0:a.data)||[],this._count=(null===(r=t.data)||void 0===r?void 0:r.count)||0,this._initialized=!0,this._minPage=this.page,[3,5];case 3:return e=i.sent(),console.log(e),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getPrev=function(){return t(a,void 0,void 0,(function(){var t,e,a,r,o;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading||!this.hasPrev)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),t=this._minPage-1,[4,this.listCustomerReviews(t,this.limit,this.hasImage,this.productIds)];case 2:return e=i.sent(),this.data=(null===(r=e.data)||void 0===r?void 0:r.data.concat(this.data))||this.data,this._count=(null===(o=e.data)||void 0===o?void 0:o.count)||this._count,this._minPage=t,[3,5];case 3:return a=i.sent(),console.log(a),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getNext=function(){return t(a,void 0,void 0,(function(){var t,e,a,r;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading||!this.hasNext)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,this.listCustomerReviews(this.page+1,this.limit,this.hasImage,this.productIds)];case 2:return t=i.sent(),this.data=this.data.concat((null===(a=t.data)||void 0===a?void 0:a.data)||[]),this._count=(null===(r=t.data)||void 0===r?void 0:r.count)||this._count,this._page=this.page+1,[3,5];case 3:return e=i.sent(),console.log(e),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getPage=function(e){return t(a,void 0,void 0,(function(){var t,a,r,o;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,this.listCustomerReviews(e,this.limit,this.hasImage,this.productIds)];case 2:return t=i.sent(),this.data=(null===(r=t.data)||void 0===r?void 0:r.data)||[],this._count=(null===(o=t.data)||void 0===o?void 0:o.count)||0,this._page=e,this._minPage=e,[3,5];case 3:return a=i.sent(),console.log(a),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.data=e.data?e.data.map((function(t){return new s(t)})):[],this._limit=e.limit||5,this._page=e.page||1,this._count=e.count||0,this._initialized=e.initialized||!1,this._hasImage=e.hasImage||!1,this._minPage=e.minPage,this._productId=e.productId||null,this._productIds=e.productIds||null,r(this)}return Object.defineProperty(d.prototype,"limit",{get:function(){return this._limit},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"page",{get:function(){return this._page},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"pageCount",{get:function(){return Math.ceil(this._count/this._limit)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"isInitialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"hasPrev",{get:function(){return!!this._minPage&&this._minPage>1},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"hasNext",{get:function(){return this.page*this.limit<this.count},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"hasImage",{get:function(){return this._hasImage},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"productIds",{get:function(){return this._productIds},enumerable:!1,configurable:!0}),d.prototype.listCustomerReviews=function(r,s,d,u){var p,c,m;return t(this,void 0,void 0,(function(){var t,l,h;return i(this,(function(i){switch(i.label){case 0:return[4,o.listCustomerReviews(e(e(e({},this._productId?{productId:this._productId}:{}),{input:{salesChannelId:a.getSalesChannelId()||""},pagination:{page:r,limit:s},hasImage:d}),u?{productIds:u}:{}))];case 1:return t=i.sent(),!(null===(p=t.data)||void 0===p?void 0:p.data)||this._productId?[3,3]:(l=null===(c=null==t?void 0:t.data)||void 0===c?void 0:c.data.map((function(t){return null==t?void 0:t.productId})),[4,n.searchProducts({input:{productIdList:l}})]);case 2:h=i.sent(),t.data.data=null===(m=null==t?void 0:t.data)||void 0===m?void 0:m.data.map((function(t){var i,a,r=null===(a=null===(i=null==h?void 0:h.data)||void 0===i?void 0:i.data)||void 0===a?void 0:a.find((function(i){return i.id===t.productId}));return e(e({},t),{product:r})})).filter((function(t){return t.product&&!t.product.deleted})),i.label=3;case 3:return[2,t]}}))}))},d.prototype.toJSON=function(){return{data:this.data,limit:this._limit,page:this._page,count:this._count,initialized:this._initialized,minPage:this._minPage,productId:this._productId}},d}();export{d as IkasCustomerReviewList};
1
+ import{__awaiter as t,__generator as i,__assign as e}from'./../../../ext/tslib/tslib.es6.js';import{IkasStorefrontConfig as a}from"@ikas/storefront-config";import{makeAutoObservable as r}from"mobx";import o from"../../../store/customer/api.js";import s from"../../../store/product/index.js";import"../../data/blog/category/index.js";import"../../data/blog/content/index.js";import"../../data/blog/meta-data/index.js";import"../../data/blog/tag/index.js";import"../../data/blog/index.js";import"../../data/brand/index.js";import"@ikas/storefront-models";import"../../data/campaign-offer/index.js";import"../../data/cart/campaign-offer/index.js";import"../../data/cart/index.js";import"../../data/category/path-item/index.js";import"../../data/category/index.js";import"../../data/checkout/index.js";import"../../data/checkout-settings/index.js";import"../../data/city/index.js";import"../../data/country/index.js";import"../../data/customer/address/region/index.js";import"../../data/customer/address/index.js";import"../../data/customer/address/ikas-localized-customer-address.js";import"../../data/customer/attribute/index.js";import"../../data/customer/review/summary/index.js";import{IkasCustomerReview as n}from"../../data/customer/review/index.js";import"../../data/customer/index.js";import"../../data/customer-form-data-input/index.js";import"../../data/district/index.js";import"../../data/favorite-product/index.js";import"../../data/filter-category/index.js";import"../../data/html-meta-data/index.js";import"../../data/image/index.js";import"../../data/order/address/region/index.js";import"../../data/order/address/index.js";import"../../data/order/line-item/option/value/index.js";import"../../data/order/line-item/variant/value/index.js";import"../../data/order/line-item/variant/index.js";import"../../data/order/line-item/index.js";import"../../data/order/order-transaction-with-prices/index.js";import"../../data/order/package/index.js";import"../../data/order/transaction/index.js";import"../../data/order/index.js";import"../../data/payment-gateway/index.js";import"../../data/product/attribute-value/index.js";import"../../data/product/filter/index.js";import"../../data/product/campaign-offer/index.js";import"../../data/product/option-set/option/index.js";import"../../data/product/option-set/index.js";import"../../data/product/stock-location/index.js";import"../../data/product/variant/price/index.js";import"../../data/product/variant/index.js";import"../../data/variant-type/index.js";import"../../data/product/index.js";import"../../data/raffle/index.js";import"../../data/shipping-zone/state/city/district/region/index.js";import"../../data/state/index.js";import"../../data/storefront-popup/storefront-popup-display-filter/index.js";import"../../data/storefront-popup/storefront-popup-display-settings/index.js";import"../../data/storefront-popup/storefront-popup-page-filter/index.js";import"../../data/storefront-popup/index.js";import"../../data/theme-json/index.js";import"../../data/theme-json/component/index.js";import"../../data/theme-json/custom-data/index.js";import"../../data/variant-type/variant-value/index.js";import"@ikas/localized-address";var d=function(){function d(e){var a,o=this;this._initialized=!1,this._minPage=null,this._productId=null,this._hasImage=!1,this._productIds=null,this._isLoading=!1,this.getInitial=function(){return t(o,void 0,void 0,(function(){var t,e,a,r;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,this.listCustomerReviews(this.page,this.limit,this.hasImage,this.productIds,this.locale,this.sortWithImagesFirst)];case 2:return t=i.sent(),this.data=(null===(a=t.data)||void 0===a?void 0:a.data)||[],this._count=(null===(r=t.data)||void 0===r?void 0:r.count)||0,this._initialized=!0,this._minPage=this.page,[3,5];case 3:return e=i.sent(),console.log(e),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getPrev=function(){return t(o,void 0,void 0,(function(){var t,e,a,r,o;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading||!this.hasPrev)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),t=this._minPage-1,[4,this.listCustomerReviews(t,this.limit,this.hasImage,this.productIds,this.locale)];case 2:return e=i.sent(),this.data=(null===(r=e.data)||void 0===r?void 0:r.data.concat(this.data))||this.data,this._count=(null===(o=e.data)||void 0===o?void 0:o.count)||this._count,this._minPage=t,[3,5];case 3:return a=i.sent(),console.log(a),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getNext=function(){return t(o,void 0,void 0,(function(){var t,e,a,r;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading||!this.hasNext)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,this.listCustomerReviews(this.page+1,this.limit,this.hasImage,this.productIds,this.locale)];case 2:return t=i.sent(),this.data=this.data.concat((null===(a=t.data)||void 0===a?void 0:a.data)||[]),this._count=(null===(r=t.data)||void 0===r?void 0:r.count)||this._count,this._page=this.page+1,[3,5];case 3:return e=i.sent(),console.log(e),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getPage=function(e){return t(o,void 0,void 0,(function(){var t,a,r,o;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,this.listCustomerReviews(e,this.limit,this.hasImage,this.productIds,this.locale)];case 2:return t=i.sent(),this.data=(null===(r=t.data)||void 0===r?void 0:r.data)||[],this._count=(null===(o=t.data)||void 0===o?void 0:o.count)||0,this._page=e,this._minPage=e,[3,5];case 3:return a=i.sent(),console.log(a),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.data=e.data?e.data.map((function(t){return new n(t)})):[],this._limit=e.limit||5,this._page=e.page||1,this._count=e.count||0,this._initialized=e.initialized||!1,this._hasImage=e.hasImage||!1,this._minPage=e.minPage,this._productId=e.productId||null,this._productIds=e.productIds||null,this._locale=e.locale||void 0,this._sortWithImagesFirst=null!==(a=e.sortWithImagesFirst)&&void 0!==a?a:void 0,r(this)}return Object.defineProperty(d.prototype,"limit",{get:function(){return this._limit},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"page",{get:function(){return this._page},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"pageCount",{get:function(){return Math.ceil(this._count/this._limit)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"isInitialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"hasPrev",{get:function(){return!!this._minPage&&this._minPage>1},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"hasNext",{get:function(){return this.page*this.limit<this.count},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"hasImage",{get:function(){return this._hasImage},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"productIds",{get:function(){return this._productIds},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"locale",{get:function(){return this._locale},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"sortWithImagesFirst",{get:function(){return this._sortWithImagesFirst},enumerable:!1,configurable:!0}),d.prototype.listCustomerReviews=function(r,n,d,u,p,c){var l,m,h;return void 0===c&&(c=!0),t(this,void 0,void 0,(function(){var t,g,f;return i(this,(function(i){switch(i.label){case 0:return[4,o.listCustomerReviews(e(e(e({},this._productId?{productId:this._productId}:{}),{input:{salesChannelId:a.getSalesChannelId()||""},pagination:{page:r,limit:n},hasImage:d,locale:p,sortWithImagesFirst:c}),u?{productIds:u}:{}))];case 1:return t=i.sent(),!(null===(l=t.data)||void 0===l?void 0:l.data)||this._productId?[3,3]:(g=null===(m=null==t?void 0:t.data)||void 0===m?void 0:m.data.map((function(t){return null==t?void 0:t.productId})),[4,s.searchProducts({input:{productIdList:g}})]);case 2:f=i.sent(),t.data.data=null===(h=null==t?void 0:t.data)||void 0===h?void 0:h.data.map((function(t){var i,a,r=null===(a=null===(i=null==f?void 0:f.data)||void 0===i?void 0:i.data)||void 0===a?void 0:a.find((function(i){return i.id===t.productId}));return e(e({},t),{product:r})})).filter((function(t){return t.product&&!t.product.deleted})),i.label=3;case 3:return[2,t]}}))}))},d.prototype.toJSON=function(){return{data:this.data,limit:this._limit,page:this._page,count:this._count,initialized:this._initialized,minPage:this._minPage,productId:this._productId,locale:this._locale,sortWithImagesFirst:this._sortWithImagesFirst}},d}();export{d as IkasCustomerReviewList};
@@ -13,6 +13,8 @@ export declare class IkasProductList {
13
13
  private _infiniteScrollPage;
14
14
  private _count;
15
15
  private _searchKeyword;
16
+ private _enableSuggestions?;
17
+ private _baseCategoryIdList;
16
18
  private _initialized;
17
19
  private _minPage?;
18
20
  private _productListPropValue;
@@ -27,17 +29,26 @@ export declare class IkasProductList {
27
29
  private _fetchRequestTime;
28
30
  private router?;
29
31
  private _excludedFields?;
32
+ private _isFacetListNotSent?;
30
33
  private _disabledSortTypes?;
34
+ private _suggestions?;
35
+ private _suggestionCategoryId;
31
36
  constructor(data: IkasProductListParams | IkasProductList, router?: NextRouter);
32
37
  get sort(): IkasProductListSortType;
33
38
  get limit(): number;
34
39
  get pageType(): IkasThemeJsonPageType;
35
40
  get page(): number;
36
41
  get minPage(): number;
42
+ get baseCategoryIdList(): string[] | null;
37
43
  get count(): number;
38
44
  get pageCount(): number;
39
45
  get searchKeyword(): string;
40
46
  set searchKeyword(value: string);
47
+ get enableSuggestions(): boolean | null | undefined;
48
+ set enableSuggestions(value: boolean | null | undefined);
49
+ get suggestions(): IkasSearchSuggestion[] | null | undefined;
50
+ get suggestionCategoryId(): string | null;
51
+ set suggestionCategoryId(value: string | null);
41
52
  get isInitialized(): boolean;
42
53
  get isFilterable(): boolean;
43
54
  get isFiltered(): boolean | undefined;
@@ -124,6 +135,7 @@ export declare type IkasProductListParams = {
124
135
  recommendedProductData?: IkasRecommendedProductProps | null;
125
136
  viewedTogetherProductData?: IkasViewedTogetherProductProps | null;
126
137
  excludedFields?: string[] | null;
138
+ isFacetListNotSent?: boolean;
127
139
  disabledSortTypes?: IkasProductListSortByTypeEnum[] | null;
128
140
  };
129
141
  export declare enum IkasProductListType {
@@ -167,3 +179,8 @@ export declare enum IkasRelatedProductsType {
167
179
  CATEGORY = "CATEGORY",
168
180
  BRAND = "BRAND"
169
181
  }
182
+ export declare type IkasSearchSuggestion = {
183
+ brandId: string | null;
184
+ categoryId: string | null;
185
+ term: string;
186
+ };
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as e,__assign as i}from'./../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as r}from"mobx";import s from"lodash/debounce";import"../../data/blog/category/index.js";import"../../data/blog/content/index.js";import"../../data/blog/meta-data/index.js";import"../../data/blog/tag/index.js";import"../../data/blog/index.js";import"../../data/brand/index.js";import{IkasThemeJsonPageType as o,IkasCategoryProductsOrderType as a,IkasThemeJsonStockPreference as n}from"@ikas/storefront-models";import"../../data/campaign-offer/index.js";import"../../data/cart/campaign-offer/index.js";import"../../data/cart/index.js";import"../../data/category/path-item/index.js";import"../../data/category/index.js";import"../../data/checkout/index.js";import"../../data/checkout-settings/index.js";import"../../data/city/index.js";import"../../data/country/index.js";import"../../data/customer/address/region/index.js";import"../../data/customer/address/index.js";import"../../data/customer/address/ikas-localized-customer-address.js";import"../../data/customer/attribute/index.js";import"../../data/customer/review/summary/index.js";import"../../data/customer/review/index.js";import"../../data/customer/index.js";import"../../data/customer-form-data-input/index.js";import"../../data/district/index.js";import"../../data/favorite-product/index.js";import{IkasFilterCategory as d}from"../../data/filter-category/index.js";import"../../data/html-meta-data/index.js";import"../../data/image/index.js";import"../../data/order/address/region/index.js";import"../../data/order/address/index.js";import"../../data/order/line-item/option/value/index.js";import"../../data/order/line-item/variant/value/index.js";import"../../data/order/line-item/variant/index.js";import"../../data/order/line-item/index.js";import"../../data/order/order-transaction-with-prices/index.js";import"../../data/order/package/index.js";import"../../data/order/transaction/index.js";import"../../data/order/index.js";import"../../data/payment-gateway/index.js";import"../../data/product/attribute-value/index.js";import{IkasProductFilter as c,IkasProductFilterValue as u}from"../../data/product/filter/index.js";import"../../data/product/campaign-offer/index.js";import"../../data/product/option-set/option/index.js";import"../../data/product/option-set/index.js";import"../../data/product/stock-location/index.js";import"../../data/product/variant/price/index.js";import"../../data/product/variant/index.js";import"../../data/variant-type/index.js";import{IkasProduct as l}from"../../data/product/index.js";import"../../data/raffle/index.js";import"../../data/shipping-zone/state/city/district/region/index.js";import"../../data/state/index.js";import"../../data/storefront-popup/storefront-popup-display-filter/index.js";import"../../data/storefront-popup/storefront-popup-display-settings/index.js";import"../../data/storefront-popup/storefront-popup-page-filter/index.js";import"../../data/storefront-popup/index.js";import"../../data/theme-json/index.js";import"../../data/theme-json/component/index.js";import"../../data/theme-json/custom-data/index.js";import"../../data/variant-type/variant-value/index.js";import"@ikas/localized-address";import p from"../../../store/product/index.js";import h from"query-string";import{SortByDirectionEnum as f,SortByTypeEnum as m,GetSuggestedProductsMethodEnum as g}from"@ikas/storefront-api";import{IkasStorefrontConfig as _}from"@ikas/storefront-config";import{Analytics as v}from"../../../analytics/analytics.js";import"../../../analytics/head/index.js";import"../../../components/page/index.js";import"../../../components/page/head.js";import"react";import"next/image.js";import{IkasProductVariantFunctions as y}from"@ikas/storefront-model-functions";import"../../../components/link/index.js";import"../../../components/page-editor/loader/style.module.scss.js";import"../../../components/google-captcha/index.js";import"../blog-list/index.js";import"../blog-category-list/index.js";import"../brand-list/index.js";import"../category-list/index.js";import"../product-attribute-detail/index.js";import"../product-attribute-list/index.js";import"../customer-review-list/index.js";import"../customer-review-summary-list/index.js";import"../validator/index.js";import"../validator/rules/index.js";import"../validator/form/login.js";import"../validator/form/address.js";import"../validator/form/ikas-address.js";import"../validator/form/register.js";import"../validator/form/contact-form.js";import"../validator/form/forgot-password.js";import"../validator/form/recover-password.js";import"../validator/form/account-info.js";import"../validator/form/raffle-form.js";import"../validator/form/customer-review.js";import"../raffle-list/index.js";import"../../../pages/home.js";import"../../../pages/_slug_/index.js";import"../../../pages/pages/_slug_.js";import"../../../pages/checkout.js";import"../../../pages/account/index.js";import"../../../pages/account/addresses.js";import"../../../pages/account/orders/index.js";import"../../../pages/account/orders/_id_.js";import"../../../pages/account/login.js";import"../../../pages/account/register.js";import"../../../pages/account/forgot-password.js";import"../../../pages/account/recover-password.js";import"../../../pages/cart.js";import"../../../pages/editor.js";import"../../../pages/account/favorite-products.js";import"../../../pages/search.js";import"next/error.js";import"../../../pages/blog/index.js";import"../../../pages/blog/_slug_.js";import"../../../pages/raffle/_slug_.js";import"../../../pages/raffle/index.js";import"../../../pages/account/raffles.js";import"../../../pages/account/activate.js";import{IkasBaseStore as E}from"../../../store/base.js";import"../../../store/customer/index.js";import"../../../store/cart/index.js";import"lodash/get";var I,S,C,P,T,A=function(){function I(a,n){var u=this;this.filters=null,this._filterCategories=null,this._infiniteScrollPage=null,this._initialized=!1,this._minPage=null,this._filterBrandId=null,this._filterCategoryId=null,this._relatedProductData=null,this._recommendedProductData=null,this._viewedTogetherProductData=null,this.pageSpecificData=null,this._recommendFor=null,this._isLoading=!1,this._fetchRequestTime=0,this.router=null,this._excludedFields=null,this._disabledSortTypes=null,this.applyFilters=function(){return t(u,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,this.getInitial()];case 1:return t=e.sent(),[o.CATEGORY,o.BRAND,o.SEARCH].includes(this._pageType)?(t&&this.setQueryParams(),[2]):[2]}}))}))},this.getSelectedVariant=function(t){return t.variants[0]},this.getInitial=function(r,s){return t(u,void 0,void 0,(function(){var t,o,a,n,d,c,u,p,h,f,m,g,_,v,I,S=this;return e(this,(function(e){switch(e.label){case 0:this._isLoading=!0,t=Date.now(),this._fetchRequestTime=t,e.label=1;case 1:return e.trys.push([1,14,15,16]),o=s?this._page:1,a=this._limit,!this.isFilterable||this.filters?[3,3]:[4,this.getFilters()];case 2:e.sent(),e.label=3;case 3:return this.applyQueryParamFilters(r),this.isSearch&&!this.hasAppliedfilter?(this.data=[],this._page=1,this._minPage=1,this._count=0,this._initialized=!0,[2,!0]):(n=void 0,d=!1,this.isStatic?(o=void 0,a=200,[3,10]):[3,4]);case 4:return this.isDiscounted?(o=1,a=10,[3,10]):[3,5];case 5:return this.isRecommended?(o=1,a=10,[3,10]):[3,6];case 6:return this.isLastViewed?this.isBrowser()?[4,this.waitForCustomerStoreInit()]:[3,9]:[3,10];case 7:return e.sent(),[4,E.getInstance().customerStore.getLastViewedProducts()];case 8:return(c=e.sent())&&c.length?(n=c.map((function(t){return t.productId})),d=E.getInstance().customerStore.useLastViewedProductResponse,[3,10]):[2];case 9:return[2];case 10:return d?(p=E.getInstance().customerStore._savedLastViewedProductsResponse,[3,13]):[3,11];case 11:return[4,this.searchProducts(o||1,a||10,n)];case 12:p=e.sent(),e.label=13;case 13:return(u=p)&&this._fetchRequestTime===t?(h=[],!d&&this.isLastViewed&&E.getInstance().customerStore.setSavedLastViewedProductsResponse(u),this.isStatic||this.isLastViewed?(f=this.isStatic?this._productListPropValue.productIds:E.getInstance().customerStore._lastViewedProducts,h=(null==f?void 0:f.map((function(t){var e,r,s=null===(r=null===(e=u.data)||void 0===e?void 0:e.data)||void 0===r?void 0:r.find((function(e){return e.id===t.productId})),o=null==s?void 0:s.variants.find((function(e){return e.id===t.variantId}));if((null==o?void 0:o.isActive)&&y.hasStock(o)||(o=null==s?void 0:s.variants.find((function(t){return t.isActive&&y.hasStock(t)}))),s&&o)return new l(i(i({},s),{selectedVariantValues:o.variantValues}))})).filter((function(t){return!!t})))||[]):h=(null===(_=null===(g=u.data)||void 0===g?void 0:g.data)||void 0===_?void 0:_.map((function(t){var e=S.getSelectedVariant(t);return new l(i(i({},t),{selectedVariantValues:e.variantValues}))})))||[],this.applyFacets(null===(v=u.data)||void 0===v?void 0:v.facets),this.data=h,this._count=(null===(I=u.data)||void 0===I?void 0:I.count)||0,this._initialized=!0,this._page=o||1,this._minPage=this.page,this.setIsFilteredForProducts(),this.setIsStaticForProducts(),s||(this._infiniteScrollPage=null),this.handleListingEvent(),[2,!0]):[2];case 14:return m=e.sent(),console.log(m),[3,16];case 15:return t===this._fetchRequestTime&&(this._isLoading=!1),[7];case 16:return[2]}}))}))},this.getPrev=function(){return t(u,void 0,void 0,(function(){var t,r,s,o,a,n,d,c=this;return e(this,(function(e){switch(e.label){case 0:if(this.isStatic||this.isDiscounted||this.isRecommended||this.isLastViewed||this._isLoading||!this.hasPrev)return[2];this._isLoading=!0,e.label=1;case 1:return e.trys.push([1,3,4,5]),t=this._minPage-1,[4,this.searchProducts(t,this.limit)];case 2:return(r=e.sent())?(s=null===(n=null===(a=r.data)||void 0===a?void 0:a.data)||void 0===n?void 0:n.map((function(t){var e=c.getSelectedVariant(t);return new l(i(i({},t),{selectedVariantValues:e.variantValues}))})),this.data=(null==s?void 0:s.concat(this.data))||this.data,this._count=(null===(d=r.data)||void 0===d?void 0:d.count)||this._count,this._minPage=t,this.setIsFilteredForProducts(),this.setIsStaticForProducts(),[3,5]):[2];case 3:return o=e.sent(),console.log(o),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getNext=function(){return t(u,void 0,void 0,(function(){var t,r,s,o,a,n,d=this;return e(this,(function(e){switch(e.label){case 0:if(this.isStatic||this.isDiscounted||this.isRecommended||this.isLastViewed||this._isLoading||!this.hasNext)return[2];this._isLoading=!0,e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,this.searchProducts(this.page+1,this.limit)];case 2:return(t=e.sent())?(r=null===(a=null===(o=t.data)||void 0===o?void 0:o.data)||void 0===a?void 0:a.map((function(t){var e=d.getSelectedVariant(t);return new l(i(i({},t),{selectedVariantValues:e.variantValues}))})),this.data=this.data.concat(r||[]),this._count=(null===(n=t.data)||void 0===n?void 0:n.count)||this._count,this._page=this.page+1,this.setIsFilteredForProducts(),this.setIsStaticForProducts(),[3,5]):[2];case 3:return s=e.sent(),console.log(s),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getPage=function(r){return t(u,void 0,void 0,(function(){var t,s,o,a,n,d,c=this;return e(this,(function(e){switch(e.label){case 0:if(this._isLoading||this.isStatic||this.isDiscounted||this.isRecommended||this.isLastViewed)return[2];this._isLoading=!0,e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,this.searchProducts(r,this.limit)];case 2:return(t=e.sent())?(s=null===(n=null===(a=t.data)||void 0===a?void 0:a.data)||void 0===n?void 0:n.map((function(t){var e=c.getSelectedVariant(t);return new l(i(i({},t),{selectedVariantValues:e.variantValues}))})),this.data=s||[],this._count=(null===(d=t.data)||void 0===d?void 0:d.count)||0,this._page=r,this._minPage=r,this.setIsFilteredForProducts(),this.setIsStaticForProducts(),[3,5]):[2];case 3:return o=e.sent(),console.log(o),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.setVisibleInfiniteScrollPage=function(t){var e;u._infiniteScrollPage!==t&&(u._infiniteScrollPage=t,_.getIsEditor()||null===(e=u.router)||void 0===e||e.replace("".concat(location.pathname).concat(u.queryParams?"?"+u.queryParams:""),void 0,{shallow:!0}))},this.searchDebouncer=s((function(){u.applyFilters()}),500),this.searchAnalyticsDebouncer=s((function(){v.search(u._searchKeyword,u.data.length)}),1e3);var p=a,h=a;if(this.data=a.data?a.data.map((function(t){return new l(t)})):[],this._type=p.type||h._type||p.productListPropValue.productListType||h._productListPropValue.productListType||S.ALL,this._pageType=a.pageType,this._sort=a.sort||a.productListPropValue.initialSort||C.LAST_ADDED,this._limit=a.limit||p.productListPropValue.initialLimit||h._productListPropValue.initialLimit||20,this._page=a.page||1,this._minPage=a.minPage||null,this._count=a.count||0,this._searchKeyword=a.searchKeyword||"",this._productListPropValue=p.productListPropValue||h._productListPropValue,this._filterBrandId=p.filterBrandId||h._filterBrandId||null,this._filterCategoryId=p.filterCategoryId||h._filterCategoryId||null,this._relatedProductData=p.relatedProductData||h._relatedProductData||null,this._recommendedProductData=p.recommendedProductData||h._recommendedProductData||null,this._viewedTogetherProductData=p.viewedTogetherProductData||h._viewedTogetherProductData||null,this._excludedFields=p.excludedFields||h._excludedFields||null,this._disabledSortTypes=p.disabledSortTypes||h._disabledSortTypes||null,this._recommendFor=p.recommendFor||h._recommendFor,this.filters=a.filters?a.filters.map((function(t){return new c(t,u)})):null,this._filterCategories=a.filterCategories?a.filterCategories.map((function(t){return new d(t)})):null,this.pageSpecificData=p.pageSpecificData||h.pageSpecificData||null,this.router=n,r(this,{router:!1}),this.setPageSpecificSort(),this.setIsFilteredForProducts(),this.setIsStaticForProducts(),this.isBrowser())if(this.restoreInfiniteScrollPage(),location.search&&(this.isFilterable||this._type===S.SEARCH)){var f=this.getQueryParams();this.getInitial(f,this._page>1)}else this._page>1?this.getInitial(void 0,!0):this.isLastViewed?this.getInitial():this.handleListingEvent()}return Object.defineProperty(I.prototype,"sort",{get:function(){return this._sort},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"limit",{get:function(){return this._limit},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"pageType",{get:function(){return this._pageType},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"page",{get:function(){return this._page},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"minPage",{get:function(){return this._minPage||1},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"pageCount",{get:function(){return Math.ceil(this._count/this._limit)},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"searchKeyword",{get:function(){return this._searchKeyword},set:function(t){t!==this._searchKeyword&&(this._searchKeyword=t,this.searchDebouncer(),this.searchAnalyticsDebouncer())},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isInitialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isFilterable",{get:function(){return this._type===S.ALL||this._type===S.CATEGORY},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isFiltered",{get:function(){var t,e;return(null===(t=this.filters)||void 0===t?void 0:t.some((function(t){return!!t.valueList.length})))||!!this._searchKeyword||this._pageType!==o.CATEGORY&&(!!this._filterCategoryId||(null===(e=this._filterCategories)||void 0===e?void 0:e.some((function(t){return t.isSelected}))))},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isStatic",{get:function(){return this._type===S.STATIC},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isDiscounted",{get:function(){return this._type===S.DISCOUNTED},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isRecommended",{get:function(){return this._type===S.RECOMMENDED},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isLastViewed",{get:function(){return this._type===S.LAST_VIEWED},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isRelatedProducts",{get:function(){return this._type===S.RELATED_PRODUCTS},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isRecommendedProducts",{get:function(){return this._type===S.RECOMMENDED_PRODUCTS},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isViewedTogetherProducts",{get:function(){return this._type===S.VIEWED_TOGETHER},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isSearch",{get:function(){return this._type===S.SEARCH},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"hasPrev",{get:function(){return!(this.isStatic||this.isDiscounted||this.isRecommended||!this._minPage)&&this._minPage>1},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"hasNext",{get:function(){return!(this.isStatic||this.isDiscounted||this.isRecommended)&&this.page*this.limit<this.count},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"queryParams",{get:function(){var t,e,i,r,s=this,a={};if(null===(t=this.filters)||void 0===t||t.forEach((function(t){t.keyList.length&&(a[t.key]=t.keyList)})),this._searchKeyword&&(a.s=this._searchKeyword),this._sort&&(a.o=D[this._sort]),this._infiniteScrollPage&&(a.page=this._infiniteScrollPage),this._pageType!==o.CATEGORY){var n=null===(e=this.filterCategories)||void 0===e?void 0:e.filter((function(t){return t.isSelected}));if(!!(null==n?void 0:n.length))a.c=null==n?void 0:n.map((function(t){return t.slug}));else if(this._filterCategoryId){var d=null===(r=null===(i=this.filterCategories)||void 0===i?void 0:i.find((function(t){return t.id===s._filterCategoryId})))||void 0===r?void 0:r.slug;d&&(a.c=d)}}return h.stringify(a,{arrayFormat:"comma"})},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"filterCategories",{get:function(){var t;return null===(t=this._filterCategories)||void 0===t?void 0:t.filter((function(t){return 0!==t.resultCount}))},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"hasAppliedfilter",{get:function(){var t;return!!this._searchKeyword||(null===(t=this.filters)||void 0===t?void 0:t.some((function(t){return!!t.valueList.length})))},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isFeaturedSortEnabled",{get:function(){var t;return(null===(t=this.pageSpecificData)||void 0===t?void 0:t.orderType)===a.MANUALLY&&[S.ALL,S.CATEGORY].includes(this._type)},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"disabledSortTypes",{get:function(){return this._disabledSortTypes},enumerable:!1,configurable:!0}),I.prototype.setIsFilteredForProducts=function(){var t=this;this.data.forEach((function(e){return e.isFiltered=t.isFiltered||!1}))},I.prototype.setIsStaticForProducts=function(){var t=this;this.data.forEach((function(e){return e.isStatic=t.isStatic||!1}))},I.prototype.setPageSpecificSort=function(){var t;if((null===(t=this.pageSpecificData)||void 0===t?void 0:t.orderType)&&[S.ALL].includes(this._type))switch(this.pageSpecificData.orderType){case a.HIGHEST_DISCOUNT_RATIO:this._sort=C.DECRASING_DISCOUNT;break;case a.LOWEST_DISCOUNT_RATIO:this._sort=C.INCREASING_DISCOUNT;break;case a.HIGHEST_PRICE:this._sort=C.DECREASING_PRICE;break;case a.LOWEST_PRICE:this._sort=C.INCREASING_PRICE;break;case a.NEWEST:this._sort=C.LAST_ADDED;break;case a.OLDEST:this._sort=C.FIRST_ADDED;break;case a.MANUALLY:this._sort=C.FEATURED}},I.prototype.getSortParams=function(){var t,e;switch(this._sort){case C.INCREASING_PRICE:t=f.ASC,e=m.PRICE;break;case C.DECREASING_PRICE:t=f.DESC,e=m.PRICE;break;case C.FIRST_ADDED:t=f.ASC,e=m.CREATED_AT;break;case C.LAST_ADDED:t=f.DESC,e=m.CREATED_AT;break;case C.INCREASING_DISCOUNT:t=f.ASC,e=m.DISCOUNT_RATIO;break;case C.DECRASING_DISCOUNT:t=f.DESC,e=m.DISCOUNT_RATIO;break;case C.FEATURED:if(this.isSearch)return;t=f.ASC,e=m.MANUAL_SORT;break;case C.DEFAULT:t=void 0,e=void 0;break;case C.AVERAGE_RATING:t=f.DESC,e=m.AVERAGE_RATING;break;case C.REVIEW_COUNT:t=f.DESC,e=m.REVIEW_COUNT;break;case C.SALE_COUNT:t=f.DESC,e=m.SALE_COUNT;break;case C.A_Z:t=f.ASC,e=m.NAME;break;case C.Z_A:t=f.DESC,e=m.NAME}if(t&&e)return{direction:t,type:e}},I.prototype.searchProducts=function(i,r,s){var a,d,c;return t(this,void 0,void 0,(function(){var t,l,h,f,m;return e(this,(function(e){switch(e.label){case 0:return t=[],l=[],null===(a=this.filters)||void 0===a||a.forEach((function(e){e.valueList.length&&t.push(new u({id:e.id,type:e.type,displayType:e.displayType,valueList:e.valueList})),e.isFacetFilter&&l.push({id:e.id,type:e.type,displayType:e.displayType})})),h=null===(d=this._filterCategories)||void 0===d?void 0:d.filter((function(t){return t.isSelected})).map((function(t){return t.id})),f=this.getSortParams(),this.isRelatedProducts&&this._relatedProductData?[4,p.getSuggestedProducts({priceListId:_.getPriceListId(),salesChannelId:_.getSalesChannelId(),productId:this._relatedProductData.productId,brandIds:this._relatedProductData.brandIds,categoryIds:this._relatedProductData.categoryIds,locale:_.getCurrentLocale()})]:[3,2];case 1:case 3:case 5:case 7:return[2,e.sent()];case 2:return this.isRecommendedProducts&&this._recommendedProductData?[4,p.getSuggestedProducts({priceListId:_.getPriceListId(),salesChannelId:_.getSalesChannelId(),brandIds:this._recommendedProductData.brandIds,categoryIds:this._recommendedProductData.categoryIds,locale:_.getCurrentLocale()})]:[3,4];case 4:return this.isViewedTogetherProducts&&this._viewedTogetherProductData?[4,p.getSuggestedProducts({priceListId:_.getPriceListId(),salesChannelId:_.getSalesChannelId(),method:g.VIEWED_TOGETHER,productIds:this._viewedTogetherProductData.productIds,locale:_.getCurrentLocale()})]:[3,6];case 6:return m={input:{page:i,perPage:r,productIdList:this.isStatic?null===(c=this._productListPropValue.productIds)||void 0===c?void 0:c.map((function(t){return t.productId})):s,filterList:t,facetList:l,brandId:this._pageType===o.BRAND&&this._type!==S.SEARCH?this._filterBrandId:void 0,categoryIdList:h&&h.length?h:this._filterCategoryId?[this._filterCategoryId]:void 0,priceListId:_.getPriceListId(),salesChannelId:_.getSalesChannelId(),query:this._searchKeyword,order:f?[f]:[],showStockOption:_.getStockPreference()||n.SHOW_ALL}},[4,p.searchProducts(m,this._excludedFields)]}}))}))},I.prototype.getFilters=function(){var i,r,s,a;return t(this,void 0,void 0,(function(){var t,n,d=this;return e(this,(function(e){switch(e.label){case 0:return[4,p.getProductFilterData({categoryId:this._filterCategoryId?this._filterCategoryId:void 0,locale:_.getCurrentLocale()})];case 1:return t=e.sent(),this.filters=null===(i=null==t?void 0:t.data)||void 0===i?void 0:i.filters.map((function(t){return new c(t,d)})),this._filterCategories=null===(r=null==t?void 0:t.data)||void 0===r?void 0:r.categories,this._disabledSortTypes=null===(s=t.data)||void 0===s?void 0:s.disabledSortTypes,this.pageType!==o.CATEGORY&&this._filterCategoryId&&(n=null===(a=this._filterCategories)||void 0===a?void 0:a.find((function(t){return t.id===d._filterCategoryId})))&&(n.isSelected=!0),this.filters&&this.filters.sort((function(t,e){return t.order>e.order?1:-1})),[2]}}))}))},I.prototype.applyQueryParamFilters=function(t){var e,i=this;try{null==t||t.forEach((function(t,e){var r,s=null===(r=i.filters)||void 0===r?void 0:r.find((function(t){return t.key===e}));s&&s.applyQueryParam(t)}));var r=null==t?void 0:t.get("s");r&&(this._searchKeyword=r);var s=null==t?void 0:t.get("o");if(s){var a=parseInt(s),n=Object.entries(D).find((function(t){return t[1]===a}));n&&(this._sort=n[0])}if(this._pageType!==o.CATEGORY){var d=null==t?void 0:t.get("c"),c=null==d?void 0:d.split(",");c&&c.length&&(null===(e=this.filterCategories)||void 0===e||e.forEach((function(t){t.isSelected=c.some((function(e){return e===t.slug}))})))}}catch(t){console.log(t)}},I.prototype.applyFacets=function(t){var e,i;null===(e=this.filters)||void 0===e||e.forEach((function(e){var i,r,s,o=null==t?void 0:t.find((function(t){return t.id===e.id}));o?null===(i=e.values)||void 0===i||i.forEach((function(t){var i=o.values.find((function(e){return e.id===t.id}));i?t.resultCount=i.count:e.isCustomValueFilter?t.resultCount=null:t.resultCount=0})):e.isCustomValueFilter?null===(r=e.values)||void 0===r||r.forEach((function(t){return t.resultCount=null})):null===(s=e.values)||void 0===s||s.forEach((function(t){return t.resultCount=0}))}));var r=null==t?void 0:t.find((function(t){return"category"===t.id}));r&&(null===(i=this._filterCategories)||void 0===i||i.forEach((function(t){var e=r.values.find((function(e){return e.id===t.id}));t.resultCount=e?e.count:0})))},I.prototype.setQueryParams=function(){var t;!this.isBrowser()||this.isSearch||_.getIsEditor()||null===(t=this.router)||void 0===t||t.replace("".concat(location.pathname).concat(this.queryParams?"?"+this.queryParams:""),void 0,{shallow:!0})},I.prototype.clearFilters=function(){var t,e;null===(t=this.filters)||void 0===t||t.forEach((function(t){return t.clear()})),this._searchKeyword="",this._pageType!==o.CATEGORY&&(this._filterCategoryId=void 0),null===(e=this._filterCategories)||void 0===e||e.forEach((function(t){return t.isSelected=!1})),this.applyFilters()},I.prototype.setSortType=function(i){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return this._sort=i,[4,this.getInitial()];case 1:return t.sent()&&this.setQueryParams(),[2]}}))}))},I.prototype.onFilterCategoryClick=function(i,r){var s,o;return void 0===r&&(r=!1),t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return r?(null===(s=this._filterCategories)||void 0===s||s.forEach((function(t){t.id===i.id&&(t.isSelected=!t.isSelected)})),[4,this.applyFilters()]):[3,2];case 1:return t.sent(),[3,3];case 2:_.getIsEditor()||null===(o=E.getInstance().router)||void 0===o||o.push(i.href+(this.queryParams?"?"+this.queryParams:"")),t.label=3;case 3:return[2]}}))}))},I.prototype.toJSON=function(){return{data:this.data,type:this._type,pageType:this._pageType,sort:this._sort,limit:this._limit,page:this._page,count:this._count,searchKeyword:this._searchKeyword,initialized:this._initialized,minPage:this._minPage,filterBrandId:this._filterBrandId,filterCategoryId:this._filterCategoryId,filterCategories:this._filterCategories,filters:this.filters,recommendFor:this._recommendFor,productListPropValue:this._productListPropValue}},I.prototype.restoreInfiniteScrollPage=function(){var t=this.getQueryParams(),e=null==t?void 0:t.get("page");if(e){var i=parseInt(e);isNaN(i)||(this._page=i,this._infiniteScrollPage=i)}},I.prototype.getQueryParams=function(){if(this.isBrowser())return new URLSearchParams(location.search)},I.prototype.isBrowser=function(){return"undefined"!=typeof window},I.prototype.waitForCustomerStoreInit=function(){return new Promise((function(t){var e=setInterval((function(){E.getInstance().customerStore.initialized&&(clearInterval(e),t(null))}),1e3)}))},I.prototype.handleListingEvent=function(){this.searchKeyword&&this.data.length?v.viewSearchResults(this._searchKeyword,this.data):this.data.length&&this._type===S.ALL&&v.viewListing(this.data)},I}();!function(t){t.ALL="ALL",t.STATIC="STATIC",t.DISCOUNTED="DISCOUNTED",t.RECOMMENDED="RECOMMENDED",t.CATEGORY="CATEGORY",t.SEARCH="SEARCH",t.LAST_VIEWED="LAST_VIEWED",t.RELATED_PRODUCTS="RELATED_PRODUCTS",t.VIEWED_TOGETHER="VIEWED_TOGETHER",t.RECOMMENDED_PRODUCTS="RECOMMENDED_PRODUCTS"}(S||(S={})),function(t){t.INCREASING_PRICE="INCREASING_PRICE",t.DECREASING_PRICE="DECREASING_PRICE",t.LAST_ADDED="LAST_ADDED",t.FIRST_ADDED="FIRST_ADDED",t.INCREASING_DISCOUNT="INCREASING_DISCOUNT",t.DECRASING_DISCOUNT="DECRASING_DISCOUNT",t.FEATURED="FEATURED",t.DEFAULT="DEFAULT",t.AVERAGE_RATING="AVERAGE_RATING",t.REVIEW_COUNT="REVIEW_COUNT",t.SALE_COUNT="SALE_COUNT",t.A_Z="A_Z",t.Z_A="Z_A"}(C||(C={})),function(t){t.AVERAGE_RATING="AVERAGE_RATING",t.CREATED_AT="CREATED_AT",t.DISCOUNT_RATIO="DISCOUNT_RATIO",t.MANUAL_SORT="MANUAL_SORT",t.NAME="NAME",t.PRICE="PRICE",t.REVIEW_COUNT="REVIEW_COUNT",t.SALE_COUNT="SALE_COUNT"}(P||(P={})),function(t){t.CATEGORY="CATEGORY",t.BRAND="BRAND"}(T||(T={}));var D=((I={})[C.INCREASING_PRICE]=1,I[C.DECREASING_PRICE]=2,I[C.LAST_ADDED]=3,I[C.FIRST_ADDED]=4,I[C.INCREASING_DISCOUNT]=5,I[C.DECRASING_DISCOUNT]=6,I[C.FEATURED]=7,I[C.DEFAULT]=8,I[C.AVERAGE_RATING]=9,I[C.REVIEW_COUNT]=10,I[C.SALE_COUNT]=11,I[C.A_Z]=12,I[C.Z_A]=13,I);export{A as IkasProductList,P as IkasProductListSortByTypeEnum,C as IkasProductListSortType,S as IkasProductListType,T as IkasRelatedProductsType};
1
+ import{__awaiter as t,__generator as e,__assign as i}from'./../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as r}from"mobx";import s from"lodash/debounce";import"../../data/blog/category/index.js";import"../../data/blog/content/index.js";import"../../data/blog/meta-data/index.js";import"../../data/blog/tag/index.js";import"../../data/blog/index.js";import"../../data/brand/index.js";import{IkasThemeJsonPageType as o,IkasCategoryProductsOrderType as a,IkasThemeJsonStockPreference as n,IkasProductFilterType as d,IkasProductFilterDisplayType as u}from"@ikas/storefront-models";import"../../data/campaign-offer/index.js";import"../../data/cart/campaign-offer/index.js";import"../../data/cart/index.js";import"../../data/category/path-item/index.js";import"../../data/category/index.js";import"../../data/checkout/index.js";import"../../data/checkout-settings/index.js";import"../../data/city/index.js";import"../../data/country/index.js";import"../../data/customer/address/region/index.js";import"../../data/customer/address/index.js";import"../../data/customer/address/ikas-localized-customer-address.js";import"../../data/customer/attribute/index.js";import"../../data/customer/review/summary/index.js";import"../../data/customer/review/index.js";import"../../data/customer/index.js";import"../../data/customer-form-data-input/index.js";import"../../data/district/index.js";import"../../data/favorite-product/index.js";import{IkasFilterCategory as c}from"../../data/filter-category/index.js";import"../../data/html-meta-data/index.js";import"../../data/image/index.js";import"../../data/order/address/region/index.js";import"../../data/order/address/index.js";import"../../data/order/line-item/option/value/index.js";import"../../data/order/line-item/variant/value/index.js";import"../../data/order/line-item/variant/index.js";import"../../data/order/line-item/index.js";import"../../data/order/order-transaction-with-prices/index.js";import"../../data/order/package/index.js";import"../../data/order/transaction/index.js";import"../../data/order/index.js";import"../../data/payment-gateway/index.js";import"../../data/product/attribute-value/index.js";import{IkasProductFilter as l,IkasProductFilterValue as p}from"../../data/product/filter/index.js";import"../../data/product/campaign-offer/index.js";import"../../data/product/option-set/option/index.js";import"../../data/product/option-set/index.js";import"../../data/product/stock-location/index.js";import"../../data/product/variant/price/index.js";import"../../data/product/variant/index.js";import"../../data/variant-type/index.js";import{IkasProduct as h}from"../../data/product/index.js";import"../../data/raffle/index.js";import"../../data/shipping-zone/state/city/district/region/index.js";import"../../data/state/index.js";import"../../data/storefront-popup/storefront-popup-display-filter/index.js";import"../../data/storefront-popup/storefront-popup-display-settings/index.js";import"../../data/storefront-popup/storefront-popup-page-filter/index.js";import"../../data/storefront-popup/index.js";import"../../data/theme-json/index.js";import"../../data/theme-json/component/index.js";import"../../data/theme-json/custom-data/index.js";import"../../data/variant-type/variant-value/index.js";import"@ikas/localized-address";import g from"../../../store/product/index.js";import f from"query-string";import{SortByDirectionEnum as m,SortByTypeEnum as _,GetSuggestedProductsMethodEnum as y}from"@ikas/storefront-api";import{IkasStorefrontConfig as v}from"@ikas/storefront-config";import{Analytics as I}from"../../../analytics/analytics.js";import"../../../analytics/head/index.js";import"../../../components/page/index.js";import"../../../components/page/head.js";import"react";import"next/image.js";import{stringToSlug as E,IkasProductVariantFunctions as S}from"@ikas/storefront-model-functions";import"../../../components/link/index.js";import"../../../components/page-editor/loader/style.module.scss.js";import"../../../components/google-captcha/index.js";import"../../../components/paypal-express-checkout/index.js";import"../blog-list/index.js";import"../blog-category-list/index.js";import"../brand-list/index.js";import"../category-list/index.js";import"../product-attribute-detail/index.js";import"../product-attribute-list/index.js";import"../customer-review-list/index.js";import"../customer-review-summary-list/index.js";import"../validator/index.js";import"../validator/rules/index.js";import"../validator/form/login.js";import"../validator/form/address.js";import"../validator/form/ikas-address.js";import"../validator/form/register.js";import"../validator/form/contact-form.js";import"../validator/form/forgot-password.js";import"../validator/form/recover-password.js";import"../validator/form/account-info.js";import"../validator/form/raffle-form.js";import"../validator/form/customer-review.js";import"../raffle-list/index.js";import"../../../pages/home.js";import"../../../pages/_slug_/index.js";import"../../../pages/pages/_slug_.js";import"../../../pages/checkout.js";import"../../../pages/account/index.js";import"../../../pages/account/addresses.js";import"../../../pages/account/orders/index.js";import"../../../pages/account/orders/_id_.js";import"../../../pages/account/login.js";import"../../../pages/account/register.js";import"../../../pages/account/forgot-password.js";import"../../../pages/account/recover-password.js";import"../../../pages/cart.js";import"../../../pages/editor.js";import"../../../pages/account/favorite-products.js";import"../../../pages/search.js";import"next/error.js";import"../../../pages/blog/index.js";import"../../../pages/blog/_slug_.js";import"../../../pages/raffle/_slug_.js";import"../../../pages/raffle/index.js";import"../../../pages/account/raffles.js";import"../../../pages/account/activate.js";import{IkasBaseStore as C}from"../../../store/base.js";import"../../../store/customer/index.js";import"../../../store/cart/index.js";import"lodash/get";var b,P,T,D,A,j=function(){function b(a,n){var d=this;this.filters=null,this._filterCategories=null,this._infiniteScrollPage=null,this._enableSuggestions=null,this._baseCategoryIdList=null,this._initialized=!1,this._minPage=null,this._filterBrandId=null,this._filterCategoryId=null,this._relatedProductData=null,this._recommendedProductData=null,this._viewedTogetherProductData=null,this.pageSpecificData=null,this._recommendFor=null,this._isLoading=!1,this._fetchRequestTime=0,this.router=null,this._excludedFields=null,this._isFacetListNotSent=!1,this._disabledSortTypes=null,this._suggestions=null,this._suggestionCategoryId=null,this.applyFilters=function(){return t(d,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,this.getInitial()];case 1:return t=e.sent(),[o.CATEGORY,o.BRAND,o.SEARCH].includes(this._pageType)?(t&&this.setQueryParams(),[2]):[2]}}))}))},this.getSelectedVariant=function(t){return t.variants[0]},this.getInitial=function(r,s){return t(d,void 0,void 0,(function(){var t,o,a,n,d,u,c,l,p,g,f,m,_,y,v,I,E=this;return e(this,(function(e){switch(e.label){case 0:this._isLoading=!0,t=Date.now(),this._fetchRequestTime=t,e.label=1;case 1:return e.trys.push([1,14,15,16]),o=s?this._page:1,a=this._limit,!this.isFilterable||this.filters?[3,3]:[4,this.getFilters()];case 2:e.sent(),e.label=3;case 3:return this.applyQueryParamFilters(r),this.isSearch&&!this.hasAppliedfilter?(this.data=[],this._page=1,this._minPage=1,this._count=0,this._initialized=!0,[2,!0]):(n=void 0,d=!1,this.isStatic?(o=void 0,a=200,[3,10]):[3,4]);case 4:return this.isDiscounted?(o=1,a=10,[3,10]):[3,5];case 5:return this.isRecommended?(o=1,a=10,[3,10]):[3,6];case 6:return this.isLastViewed?this.isBrowser()?[4,this.waitForCustomerStoreInit()]:[3,9]:[3,10];case 7:return e.sent(),[4,C.getInstance().customerStore.getLastViewedProducts()];case 8:return(u=e.sent())&&u.length?(n=u.map((function(t){return t.productId})),d=C.getInstance().customerStore.useLastViewedProductResponse,[3,10]):[2];case 9:return[2];case 10:return d?(l=C.getInstance().customerStore._savedLastViewedProductsResponse,[3,13]):[3,11];case 11:return[4,this.searchProducts(o||1,a||10,n)];case 12:l=e.sent(),e.label=13;case 13:return(c=l)&&this._fetchRequestTime===t?(p=[],!d&&this.isLastViewed&&C.getInstance().customerStore.setSavedLastViewedProductsResponse(c),this.isStatic||this.isLastViewed?(g=this.isStatic?this._productListPropValue.productIds:C.getInstance().customerStore._lastViewedProducts,p=(null==g?void 0:g.map((function(t){var e,r,s=null===(r=null===(e=c.data)||void 0===e?void 0:e.data)||void 0===r?void 0:r.find((function(e){return e.id===t.productId})),o=null==s?void 0:s.variants.find((function(e){return e.id===t.variantId}));if((null==o?void 0:o.isActive)&&S.hasStock(o)||(o=null==s?void 0:s.variants.find((function(t){return t.isActive&&S.hasStock(t)}))),s&&o)return new h(i(i({},s),{selectedVariantValues:o.variantValues}))})).filter((function(t){return!!t})))||[]):p=(null===(_=null===(m=c.data)||void 0===m?void 0:m.data)||void 0===_?void 0:_.map((function(t){var e=E.getSelectedVariant(t);return new h(i(i({},t),{selectedVariantValues:e.variantValues}))})))||[],this.applyFacets(null===(y=c.data)||void 0===y?void 0:y.facets),this.data=p,this._count=(null===(v=c.data)||void 0===v?void 0:v.count)||0,this._initialized=!0,this._page=o||1,this._minPage=this.page,this._suggestions=null===(I=c.data)||void 0===I?void 0:I.suggestions,this.setIsFilteredForProducts(),this.setIsStaticForProducts(),s||(this._infiniteScrollPage=null),this.handleListingEvent(),[2,!0]):[2];case 14:return f=e.sent(),console.log(f),[3,16];case 15:return t===this._fetchRequestTime&&(this._isLoading=!1),[7];case 16:return[2]}}))}))},this.getPrev=function(){return t(d,void 0,void 0,(function(){var t,r,s,o,a,n,d,u=this;return e(this,(function(e){switch(e.label){case 0:if(this.isStatic||this.isDiscounted||this.isRecommended||this.isLastViewed||this._isLoading||!this.hasPrev)return[2];this._isLoading=!0,e.label=1;case 1:return e.trys.push([1,3,4,5]),t=this._minPage-1,[4,this.searchProducts(t,this.limit)];case 2:return(r=e.sent())?(s=null===(n=null===(a=r.data)||void 0===a?void 0:a.data)||void 0===n?void 0:n.map((function(t){var e=u.getSelectedVariant(t);return new h(i(i({},t),{selectedVariantValues:e.variantValues}))})),this.data=(null==s?void 0:s.concat(this.data))||this.data,this._count=(null===(d=r.data)||void 0===d?void 0:d.count)||this._count,this._minPage=t,this.setIsFilteredForProducts(),this.setIsStaticForProducts(),[3,5]):[2];case 3:return o=e.sent(),console.log(o),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getNext=function(){return t(d,void 0,void 0,(function(){var t,r,s,o,a,n,d=this;return e(this,(function(e){switch(e.label){case 0:if(this.isStatic||this.isDiscounted||this.isRecommended||this.isLastViewed||this._isLoading||!this.hasNext)return[2];this._isLoading=!0,e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,this.searchProducts(this.page+1,this.limit)];case 2:return(t=e.sent())?(r=null===(a=null===(o=t.data)||void 0===o?void 0:o.data)||void 0===a?void 0:a.map((function(t){var e=d.getSelectedVariant(t);return new h(i(i({},t),{selectedVariantValues:e.variantValues}))})),this.data=this.data.concat(r||[]),this._count=(null===(n=t.data)||void 0===n?void 0:n.count)||this._count,this._page=this.page+1,this.setIsFilteredForProducts(),this.setIsStaticForProducts(),[3,5]):[2];case 3:return s=e.sent(),console.log(s),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getPage=function(r){return t(d,void 0,void 0,(function(){var t,s,o,a,n,d,u=this;return e(this,(function(e){switch(e.label){case 0:if(this._isLoading||this.isStatic||this.isDiscounted||this.isRecommended||this.isLastViewed)return[2];this._isLoading=!0,e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,this.searchProducts(r,this.limit)];case 2:return(t=e.sent())?(s=null===(n=null===(a=t.data)||void 0===a?void 0:a.data)||void 0===n?void 0:n.map((function(t){var e=u.getSelectedVariant(t);return new h(i(i({},t),{selectedVariantValues:e.variantValues}))})),this.data=s||[],this._count=(null===(d=t.data)||void 0===d?void 0:d.count)||0,this._page=r,this._minPage=r,this.setIsFilteredForProducts(),this.setIsStaticForProducts(),[3,5]):[2];case 3:return o=e.sent(),console.log(o),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.setVisibleInfiniteScrollPage=function(t){var e;d._infiniteScrollPage!==t&&(d._infiniteScrollPage=t,v.getIsEditor()||null===(e=d.router)||void 0===e||e.replace("".concat(location.pathname).concat(d.queryParams?"?"+d.queryParams:""),void 0,{shallow:!0}))},this.searchDebouncer=s((function(){d.applyFilters()}),500),this.searchAnalyticsDebouncer=s((function(){I.search(d._searchKeyword,d.data.length)}),1e3);var u=a,p=a;if(this.data=a.data?a.data.map((function(t){return new h(t)})):[],this._type=u.type||p._type||u.productListPropValue.productListType||p._productListPropValue.productListType||P.ALL,this._pageType=a.pageType,this._sort=a.sort||a.productListPropValue.initialSort||T.LAST_ADDED,this._limit=a.limit||u.productListPropValue.initialLimit||p._productListPropValue.initialLimit||20,this._page=a.page||1,this._minPage=a.minPage||null,this._count=a.count||0,this._searchKeyword=a.searchKeyword||"",this._productListPropValue=u.productListPropValue||p._productListPropValue,this._filterBrandId=u.filterBrandId||p._filterBrandId||null,this._filterCategoryId=u.filterCategoryId||p._filterCategoryId||null,this._relatedProductData=u.relatedProductData||p._relatedProductData||null,this._recommendedProductData=u.recommendedProductData||p._recommendedProductData||null,this._viewedTogetherProductData=u.viewedTogetherProductData||p._viewedTogetherProductData||null,this._excludedFields=u.excludedFields||p._excludedFields||null,this._isFacetListNotSent=u.isFacetListNotSent||p._isFacetListNotSent||!1,this._disabledSortTypes=u.disabledSortTypes||p._disabledSortTypes||null,this._recommendFor=u.recommendFor||p._recommendFor,this.filters=a.filters?a.filters.map((function(t){return new l(t,d)})):null,this._filterCategories=a.filterCategories?a.filterCategories.map((function(t){return new c(t)})):null,this.pageSpecificData=u.pageSpecificData||p.pageSpecificData||null,this.router=n,r(this,{router:!1}),this.setPageSpecificSort(),this.setIsFilteredForProducts(),this.setIsStaticForProducts(),this.isBrowser())if(this.restoreInfiniteScrollPage(),location.search&&(this.isFilterable||this._type===P.SEARCH)){var g=this.pageType===o.PRODUCT?void 0:this.getQueryParams();this.getInitial(g,this._page>1)}else this._page>1?this.getInitial(void 0,!0):this.isLastViewed?this.getInitial():this.handleListingEvent()}return Object.defineProperty(b.prototype,"sort",{get:function(){return this._sort},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"limit",{get:function(){return this._limit},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"pageType",{get:function(){return this._pageType},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"page",{get:function(){return this._page},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"minPage",{get:function(){return this._minPage||1},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"baseCategoryIdList",{get:function(){return this._baseCategoryIdList},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"pageCount",{get:function(){return Math.ceil(this._count/this._limit)},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"searchKeyword",{get:function(){return this._searchKeyword},set:function(t){t!==this._searchKeyword&&(this._searchKeyword=t,this.searchDebouncer(),this.searchAnalyticsDebouncer())},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"enableSuggestions",{get:function(){return this._enableSuggestions},set:function(t){this._enableSuggestions=t},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"suggestions",{get:function(){return this._suggestions},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"suggestionCategoryId",{get:function(){return this._suggestionCategoryId},set:function(t){this._suggestionCategoryId=t},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isInitialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isFilterable",{get:function(){return this._type===P.ALL||this._type===P.CATEGORY},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isFiltered",{get:function(){var t,e;return(null===(t=this.filters)||void 0===t?void 0:t.some((function(t){return!!t.valueList.length})))||!!this._searchKeyword||this._pageType!==o.CATEGORY&&(!!this._filterCategoryId||(null===(e=this._filterCategories)||void 0===e?void 0:e.some((function(t){return t.isSelected}))))},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isStatic",{get:function(){return this._type===P.STATIC},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isDiscounted",{get:function(){return this._type===P.DISCOUNTED},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isRecommended",{get:function(){return this._type===P.RECOMMENDED},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isLastViewed",{get:function(){return this._type===P.LAST_VIEWED},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isRelatedProducts",{get:function(){return this._type===P.RELATED_PRODUCTS},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isRecommendedProducts",{get:function(){return this._type===P.RECOMMENDED_PRODUCTS},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isViewedTogetherProducts",{get:function(){return this._type===P.VIEWED_TOGETHER},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isSearch",{get:function(){return this._type===P.SEARCH},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"hasPrev",{get:function(){return!(this.isStatic||this.isDiscounted||this.isRecommended||!this._minPage)&&this._minPage>1},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"hasNext",{get:function(){return!(this.isStatic||this.isDiscounted||this.isRecommended)&&this.page*this.limit<this.count},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"queryParams",{get:function(){var t,e,i,r,s=this,a={};if(null===(t=this.filters)||void 0===t||t.forEach((function(t){t.keyList.length&&(a[E(t.name)]=t.isDiscountStatusFilter?t.keyList.map((function(e){return t.discountStatusMapping[e]})):t.keyList)})),this._searchKeyword&&(a.s=this._searchKeyword),this._sort&&(a.o=R[this._sort]),this._baseCategoryIdList&&(a.bc=this._baseCategoryIdList),this._suggestionCategoryId&&(a.suggestionCategoryId=this._suggestionCategoryId),this._infiniteScrollPage&&(a.page=this._infiniteScrollPage),this._pageType!==o.CATEGORY){var n=null===(e=this.filterCategories)||void 0===e?void 0:e.filter((function(t){return t.isSelected}));if(!!(null==n?void 0:n.length))a.c=null==n?void 0:n.map((function(t){return t.slug}));else if(this._filterCategoryId){var d=null===(r=null===(i=this.filterCategories)||void 0===i?void 0:i.find((function(t){return t.id===s._filterCategoryId})))||void 0===r?void 0:r.slug;d&&(a.c=d)}}return f.stringify(a,{arrayFormat:"comma",encode:!1})},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"filterCategories",{get:function(){var t;return null===(t=this._filterCategories)||void 0===t?void 0:t.filter((function(t){return 0!==t.resultCount}))},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"hasAppliedfilter",{get:function(){var t;return!!this._searchKeyword||(null===(t=this.filters)||void 0===t?void 0:t.some((function(t){return!!t.valueList.length})))},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isFeaturedSortEnabled",{get:function(){var t;return(null===(t=this.pageSpecificData)||void 0===t?void 0:t.orderType)===a.MANUALLY&&[P.ALL,P.CATEGORY].includes(this._type)},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"disabledSortTypes",{get:function(){return this._disabledSortTypes},enumerable:!1,configurable:!0}),b.prototype.setIsFilteredForProducts=function(){var t=this;this.data.forEach((function(e){return e.isFiltered=t.isFiltered||!1}))},b.prototype.setIsStaticForProducts=function(){var t=this;this.data.forEach((function(e){return e.isStatic=t.isStatic||!1}))},b.prototype.setPageSpecificSort=function(){var t;if((null===(t=this.pageSpecificData)||void 0===t?void 0:t.orderType)&&[P.ALL].includes(this._type))switch(this.pageSpecificData.orderType){case a.HIGHEST_DISCOUNT_RATIO:this._sort=T.DECRASING_DISCOUNT;break;case a.LOWEST_DISCOUNT_RATIO:this._sort=T.INCREASING_DISCOUNT;break;case a.HIGHEST_PRICE:this._sort=T.DECREASING_PRICE;break;case a.LOWEST_PRICE:this._sort=T.INCREASING_PRICE;break;case a.NEWEST:this._sort=T.LAST_ADDED;break;case a.OLDEST:this._sort=T.FIRST_ADDED;break;case a.MANUALLY:this._sort=T.FEATURED}},b.prototype.getSortParams=function(){var t,e;switch(this._sort){case T.INCREASING_PRICE:t=m.ASC,e=_.PRICE;break;case T.DECREASING_PRICE:t=m.DESC,e=_.PRICE;break;case T.FIRST_ADDED:t=m.ASC,e=_.CREATED_AT;break;case T.LAST_ADDED:t=m.DESC,e=_.CREATED_AT;break;case T.INCREASING_DISCOUNT:t=m.ASC,e=_.DISCOUNT_RATIO;break;case T.DECRASING_DISCOUNT:t=m.DESC,e=_.DISCOUNT_RATIO;break;case T.FEATURED:if(this.isSearch)return;t=m.ASC,e=_.MANUAL_SORT;break;case T.DEFAULT:t=void 0,e=void 0;break;case T.AVERAGE_RATING:t=m.DESC,e=_.AVERAGE_RATING;break;case T.REVIEW_COUNT:t=m.DESC,e=_.REVIEW_COUNT;break;case T.SALE_COUNT:t=m.DESC,e=_.SALE_COUNT;break;case T.A_Z:t=m.ASC,e=_.NAME;break;case T.Z_A:t=m.DESC,e=_.NAME}if(t&&e)return{direction:t,type:e}},b.prototype.searchProducts=function(r,s,a){var c,l,h,f,m,_;return t(this,void 0,void 0,(function(){var t,I,E,S,C,b,T,D,A,j,R=this;return e(this,(function(e){switch(e.label){case 0:return t=[],I=[],null===(c=this.filters)||void 0===c||c.forEach((function(e){e.valueList.length&&t.push(new p({id:e.id,type:e.type,displayType:e.displayType,valueList:e.isDiscountStatusFilter?e.valueList.map((function(t){return e.discountStatusMapping[t]})):e.valueList})),e.isFacetFilter&&!R._isFacetListNotSent&&I.push({id:e.id,type:e.type,displayType:e.displayType})})),(E=null===(l=new URLSearchParams(location.search))||void 0===l?void 0:l.get("suggestion"))&&(S=JSON.parse(decodeURIComponent(E)),(C=S.brandId)&&((b=null===(h=this.filters)||void 0===h?void 0:h.find((function(t){return"brand"===t.id&&t.type===d.BRAND})))&&(T=null===(f=b.values)||void 0===f?void 0:f.find((function(t){return t.id===C})))&&b.applyQueryParam(T.name),t.push(new p({id:"brand",type:d.BRAND,displayType:u.BOX,valueList:[C]}))),S.categoryId&&(this._filterCategoryId=S.categoryId),this.searchKeyword=S.term),D=null===(m=this._filterCategories)||void 0===m?void 0:m.filter((function(t){return t.isSelected})).map((function(t){return t.id})),A=this.getSortParams(),this.isRelatedProducts&&this._relatedProductData?[4,g.getSuggestedProducts({priceListId:v.getPriceListId(),salesChannelId:v.getSalesChannelId(),productId:this._relatedProductData.productId,brandIds:this._relatedProductData.brandIds,categoryIds:this._relatedProductData.categoryIds,locale:v.getCurrentLocale()})]:[3,2];case 1:case 3:case 5:case 7:return[2,e.sent()];case 2:return this.isRecommendedProducts&&this._recommendedProductData?[4,g.getSuggestedProducts({priceListId:v.getPriceListId(),salesChannelId:v.getSalesChannelId(),brandIds:this._recommendedProductData.brandIds,categoryIds:this._recommendedProductData.categoryIds,locale:v.getCurrentLocale()})]:[3,4];case 4:return this.isViewedTogetherProducts&&this._viewedTogetherProductData?[4,g.getSuggestedProducts({priceListId:v.getPriceListId(),salesChannelId:v.getSalesChannelId(),method:y.VIEWED_TOGETHER,productIds:this._viewedTogetherProductData.productIds,locale:v.getCurrentLocale()})]:[3,6];case 6:return j={input:i(i(i(i({page:r,perPage:s},this.enableSuggestions?{enableSuggestions:this.enableSuggestions}:{}),{productIdList:this.isStatic?null===(_=this._productListPropValue.productIds)||void 0===_?void 0:_.map((function(t){return t.productId})):a,filterList:t,facetList:I}),this.baseCategoryIdList?{baseCategoryIdList:this.baseCategoryIdList}:{}),{brandId:this._pageType===o.BRAND&&this._type!==P.SEARCH?this._filterBrandId:void 0,categoryIdList:D&&D.length?D:this._filterCategoryId?[this._filterCategoryId]:void 0,priceListId:v.getPriceListId(),salesChannelId:v.getSalesChannelId(),query:this._searchKeyword,order:A?[A]:[],showStockOption:v.getStockPreference()||n.SHOW_ALL})},[4,g.searchProducts(j,this._excludedFields)]}}))}))},b.prototype.getFilters=function(){var i,r,s,a;return t(this,void 0,void 0,(function(){var t,n,d=this;return e(this,(function(e){switch(e.label){case 0:return[4,g.getProductFilterData({categoryId:this._filterCategoryId?this._filterCategoryId:void 0,locale:v.getCurrentLocale()})];case 1:return t=e.sent(),this.filters=null===(i=null==t?void 0:t.data)||void 0===i?void 0:i.filters.map((function(t){return new l(t,d)})),this._filterCategories=null===(r=null==t?void 0:t.data)||void 0===r?void 0:r.categories,this._disabledSortTypes=null===(s=t.data)||void 0===s?void 0:s.disabledSortTypes,this.pageType!==o.CATEGORY&&this._filterCategoryId&&(n=null===(a=this._filterCategories)||void 0===a?void 0:a.find((function(t){return t.id===d._filterCategoryId})))&&(n.isSelected=!0),this.filters&&this.filters.sort((function(t,e){return t.order>e.order?1:-1})),[2]}}))}))},b.prototype.applyQueryParamFilters=function(t){var e,i,r=this;try{null==t||t.forEach((function(t,e){var i,s=null===(i=r.filters)||void 0===i?void 0:i.find((function(t){return t.key===e||t.name===e||E(t.name)===E(e)}));s&&s.applyQueryParam(t)}));var s=null==t?void 0:t.get("s");s&&(this._searchKeyword=s);var a=null==t?void 0:t.get("o");if(a){var n=parseInt(a),d=Object.entries(R).find((function(t){return t[1]===n}));d&&(this._sort=d[0])}if(this._pageType!==o.CATEGORY){var u=null==t?void 0:t.get("c"),c=null==u?void 0:u.split(",");c&&c.length&&(null===(e=this.filterCategories)||void 0===e||e.forEach((function(t){t.isSelected=c.some((function(e){return e===t.slug}))})))}if(this._pageType===o.SEARCH){var l=null==t?void 0:t.get("bc"),p=null==l?void 0:l.split(",");p&&(this._baseCategoryIdList=p);var h=null===(i=new URLSearchParams(location.search))||void 0===i?void 0:i.get("suggestion");if(h){var g=JSON.parse(decodeURIComponent(h)).categoryId;g&&(this.suggestionCategoryId=g)}var f=null==t?void 0:t.get("suggestionCategoryId");f&&(this.suggestionCategoryId=f,this._filterCategoryId=f)}}catch(t){console.log(t)}},b.prototype.applyFacets=function(t){var e,i;null===(e=this.filters)||void 0===e||e.forEach((function(e){var i,r,s,o=null==t?void 0:t.find((function(t){return t.id===e.id}));o?null===(i=e.values)||void 0===i||i.forEach((function(t){var i=e.isDiscountStatusFilter?e.discountStatusMapping[t.id]:t.id,r=o.values.find((function(t){return t.id===i}));r?t.resultCount=r.count:e.isCustomValueFilter?t.resultCount=null:t.resultCount=0})):e.isCustomValueFilter?null===(r=e.values)||void 0===r||r.forEach((function(t){return t.resultCount=null})):null===(s=e.values)||void 0===s||s.forEach((function(t){return t.resultCount=0}))}));var r=null==t?void 0:t.find((function(t){return"category"===t.id}));r&&(null===(i=this._filterCategories)||void 0===i||i.forEach((function(t){var e=r.values.find((function(e){return e.id===t.id}));t.resultCount=e?e.count:0})))},b.prototype.setQueryParams=function(){var t;!this.isBrowser()||this.isSearch||v.getIsEditor()||null===(t=this.router)||void 0===t||t.replace("".concat(location.pathname).concat(this.queryParams?"?"+this.queryParams:""),void 0,{shallow:!0})},b.prototype.clearFilters=function(){var t,e;null===(t=this.filters)||void 0===t||t.forEach((function(t){return t.clear()})),this._searchKeyword="",this._pageType!==o.CATEGORY&&(this._filterCategoryId=void 0),null===(e=this._filterCategories)||void 0===e||e.forEach((function(t){return t.isSelected=!1})),this.applyFilters()},b.prototype.setSortType=function(i){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return this._sort=i,[4,this.getInitial()];case 1:return t.sent()&&this.setQueryParams(),[2]}}))}))},b.prototype.onFilterCategoryClick=function(i,r){var s,o;return void 0===r&&(r=!1),t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return r?(null===(s=this._filterCategories)||void 0===s||s.forEach((function(t){t.id===i.id&&(t.isSelected=!t.isSelected)})),[4,this.applyFilters()]):[3,2];case 1:return t.sent(),[3,3];case 2:v.getIsEditor()||null===(o=C.getInstance().router)||void 0===o||o.push(i.href+(this.queryParams?"?"+this.queryParams:"")),t.label=3;case 3:return[2]}}))}))},b.prototype.toJSON=function(){return{data:this.data,type:this._type,pageType:this._pageType,sort:this._sort,limit:this._limit,page:this._page,count:this._count,searchKeyword:this._searchKeyword,initialized:this._initialized,minPage:this._minPage,filterBrandId:this._filterBrandId,filterCategoryId:this._filterCategoryId,filterCategories:this._filterCategories,filters:this.filters,recommendFor:this._recommendFor,productListPropValue:this._productListPropValue}},b.prototype.restoreInfiniteScrollPage=function(){var t=this.getQueryParams(),e=null==t?void 0:t.get("page");if(e){var i=parseInt(e);isNaN(i)||(this._page=i,this._infiniteScrollPage=i)}},b.prototype.getQueryParams=function(){if(this.isBrowser())return new URLSearchParams(location.search)},b.prototype.isBrowser=function(){return"undefined"!=typeof window},b.prototype.waitForCustomerStoreInit=function(){return new Promise((function(t){var e=setInterval((function(){C.getInstance().customerStore.initialized&&(clearInterval(e),t(null))}),1e3)}))},b.prototype.handleListingEvent=function(){this.searchKeyword&&this.data.length?I.viewSearchResults(this._searchKeyword,this.data):this.data.length&&this._type===P.ALL&&I.viewListing(this.data)},b}();!function(t){t.ALL="ALL",t.STATIC="STATIC",t.DISCOUNTED="DISCOUNTED",t.RECOMMENDED="RECOMMENDED",t.CATEGORY="CATEGORY",t.SEARCH="SEARCH",t.LAST_VIEWED="LAST_VIEWED",t.RELATED_PRODUCTS="RELATED_PRODUCTS",t.VIEWED_TOGETHER="VIEWED_TOGETHER",t.RECOMMENDED_PRODUCTS="RECOMMENDED_PRODUCTS"}(P||(P={})),function(t){t.INCREASING_PRICE="INCREASING_PRICE",t.DECREASING_PRICE="DECREASING_PRICE",t.LAST_ADDED="LAST_ADDED",t.FIRST_ADDED="FIRST_ADDED",t.INCREASING_DISCOUNT="INCREASING_DISCOUNT",t.DECRASING_DISCOUNT="DECRASING_DISCOUNT",t.FEATURED="FEATURED",t.DEFAULT="DEFAULT",t.AVERAGE_RATING="AVERAGE_RATING",t.REVIEW_COUNT="REVIEW_COUNT",t.SALE_COUNT="SALE_COUNT",t.A_Z="A_Z",t.Z_A="Z_A"}(T||(T={})),function(t){t.AVERAGE_RATING="AVERAGE_RATING",t.CREATED_AT="CREATED_AT",t.DISCOUNT_RATIO="DISCOUNT_RATIO",t.MANUAL_SORT="MANUAL_SORT",t.NAME="NAME",t.PRICE="PRICE",t.REVIEW_COUNT="REVIEW_COUNT",t.SALE_COUNT="SALE_COUNT"}(D||(D={})),function(t){t.CATEGORY="CATEGORY",t.BRAND="BRAND"}(A||(A={}));var R=((b={})[T.INCREASING_PRICE]=1,b[T.DECREASING_PRICE]=2,b[T.LAST_ADDED]=3,b[T.FIRST_ADDED]=4,b[T.INCREASING_DISCOUNT]=5,b[T.DECRASING_DISCOUNT]=6,b[T.FEATURED]=7,b[T.DEFAULT]=8,b[T.AVERAGE_RATING]=9,b[T.REVIEW_COUNT]=10,b[T.SALE_COUNT]=11,b[T.A_Z]=12,b[T.Z_A]=13,b);export{j as IkasProductList,D as IkasProductListSortByTypeEnum,T as IkasProductListSortType,P as IkasProductListType,A as IkasRelatedProductsType};
@@ -1 +1 @@
1
- import{__assign as e}from'./../ext/tslib/tslib.es6.js';import{renderComponent as t}from"../components/page/index.js";import{IkasAttributeList as i}from"../models/ui/product-attribute-list/index.js";import{IkasBlogCategory as a}from"../models/data/blog/category/index.js";import"../models/data/blog/content/index.js";import"../models/data/blog/meta-data/index.js";import"../models/data/blog/tag/index.js";import{IkasBlog as r}from"../models/data/blog/index.js";import{IkasBrand as o}from"../models/data/brand/index.js";import{IkasThemeJsonPageType as n,initIkasCategory as s,IkasThemeJsonComponentPropType as u,IkasProductAttributeType as l}from"@ikas/storefront-models";import"mobx";import"../models/data/campaign-offer/index.js";import"../models/data/cart/campaign-offer/index.js";import"../models/data/cart/index.js";import"../models/data/category/path-item/index.js";import{IkasCategory as d}from"../models/data/category/index.js";import"../models/data/checkout/index.js";import"../models/data/checkout-settings/index.js";import"../models/data/city/index.js";import"../models/data/country/index.js";import"../models/data/customer/address/region/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/address/ikas-localized-customer-address.js";import"../models/data/customer/attribute/index.js";import"../models/data/customer/review/summary/index.js";import"../models/data/customer/review/index.js";import"../models/data/customer/index.js";import"../models/data/customer-form-data-input/index.js";import"../models/data/district/index.js";import"../models/data/favorite-product/index.js";import"../models/data/filter-category/index.js";import"../models/data/html-meta-data/index.js";import{IkasImage as p}from"../models/data/image/index.js";import"../models/data/order/address/region/index.js";import"../models/data/order/address/index.js";import"../models/data/order/line-item/option/value/index.js";import"../models/data/order/line-item/variant/value/index.js";import"../models/data/order/line-item/variant/index.js";import"../models/data/order/line-item/index.js";import"../models/data/order/order-transaction-with-prices/index.js";import"../models/data/order/package/index.js";import"../models/data/order/transaction/index.js";import"../models/data/order/index.js";import"../models/data/payment-gateway/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product/filter/index.js";import"../models/data/product/campaign-offer/index.js";import"../models/data/product/option-set/option/index.js";import"../models/data/product/option-set/index.js";import"../models/data/product/stock-location/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product/variant/index.js";import"../models/data/variant-type/index.js";import{IkasProduct as c}from"../models/data/product/index.js";import{IkasRaffle as m}from"../models/data/raffle/index.js";import"../models/data/shipping-zone/state/city/district/region/index.js";import"../models/data/state/index.js";import"../models/data/storefront-popup/storefront-popup-display-filter/index.js";import"../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../models/data/storefront-popup/index.js";import"../models/data/theme-json/index.js";import"../models/data/theme-json/component/index.js";import"../models/data/theme-json/custom-data/index.js";import{IkasThemeJsonPageComponent as f}from"../models/data/theme-json/page/component/index.js";import"../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import{IkasBlogList as g}from"../models/ui/blog-list/index.js";import{IkasBlogCategoryList as V}from"../models/ui/blog-category-list/index.js";import{IkasBrandList as P}from"../models/ui/brand-list/index.js";import{IkasCategoryList as v}from"../models/ui/category-list/index.js";import{IkasNavigationLink as D}from"../models/ui/navigation-link/index.js";import{IkasProductList as j}from"../models/ui/product-list/index.js";import{IkasAttributeDetail as L}from"../models/ui/product-attribute-detail/index.js";import"../models/ui/customer-review-list/index.js";import"../models/ui/customer-review-summary-list/index.js";import"../models/ui/validator/index.js";import"../models/ui/validator/rules/index.js";import"../models/ui/validator/form/login.js";import"../models/ui/validator/form/address.js";import"../models/ui/validator/form/ikas-address.js";import"../models/ui/validator/form/register.js";import"../models/ui/validator/form/contact-form.js";import"../models/ui/validator/form/forgot-password.js";import"../models/ui/validator/form/recover-password.js";import"../models/ui/validator/form/account-info.js";import"../models/ui/validator/form/raffle-form.js";import"../models/ui/validator/form/customer-review.js";import{IkasComponentRenderer as h}from"../models/ui/component-renderer/index.js";import{IkasRaffleList as T}from"../models/ui/raffle-list/index.js";import{IkasPageComponentPropValue as x,getPlaceholderBrand as C,getPlaceholderCategory as I,getPlaceholderProduct as S,getPlaceholderBlog as b,getPlaceholderBlogCategory as E,getPlaceholderRaffle as O,ProductDataBindingFields as A,ProductVariantDataBindingFields as w,CategoryDataBindingFields as y,BrandDataBindingFields as R}from"@ikas/storefront-providers";import _ from"lodash/flatten";import{IkasBaseStore as B}from"../store/base.js";import"../store/customer/index.js";import"../store/cart/index.js";import{IkasProductVariantFunctions as k,stringToSlug as G}from"@ikas/storefront-model-functions";import{IkasStorefrontConfig as N}from"@ikas/storefront-config";import U from"react";var M=function(){function M(){}return M.setPageSpecificData=function(t,i,u){var l;if(this.pageType=i,this.isBrowser=u,t)switch(i){case n.PRODUCT:var p=t;M.pageSpecificData=new c(e(e({},p),{selectedVariantValues:p.selectedVariantValues||(null===(l=p.variants.find((function(e){return k.hasStock(e)})))||void 0===l?void 0:l.variantValues)||p.variants[0].variantValues})),u&&this._initProductOnBrowser(M.pageSpecificData);break;case n.CATEGORY:var f=t;s(f,N.getCurrentLocale()),M.pageSpecificData=new d(f);break;case n.BRAND:var g=t;M.pageSpecificData=new o(g);break;case n.BLOG:var V=t;M.pageSpecificData=new r(V);break;case n.BLOG_CATEGORY:var P=t;M.pageSpecificData=new a(P);break;case n.RAFFLE_DETAIL:var v=t;M.pageSpecificData=new m(v)}else this.pageSpecificData=void 0},M.isServer=function(){return"undefined"==typeof window},M.initPagePropValues=function(e,t,i,a,r){return this.flatCustomDataList=_(i.map((function(e){return e.flat}))),e.map((function(e){return M.initPageComponentPropValue(e,t,a,r)}))},M.initPageComponentPropValue=function(t,i,a,r){var o=i.find((function(e){return e.id===t.pageComponent.componentId})),n=null==o?void 0:o.props,s={};return null==n||n.map((function(e){var i=t.propValues[e.name];s[e.name]=M.initPropValue(e,i,a,r)})),new x(e(e({},t),{pageComponent:new f(e(e({},t.pageComponent),{propValues:s,componentId:o.id})),component:o,propValues:s}))},M.initPropValue=function(e,t,i,a){if(null==t)return null;switch(e.type){case u.TEXT:return M.initTextPropValue(t);case u.IMAGE:return M.initImagePropValue(t);case u.IMAGE_LIST:return M.initImageListPropValue(t);case u.BRAND:return M.initBrandPropValue(t);case u.BRAND_LIST:return M.initBrandListPropValue(t);case u.CATEGORY:return M.initCategoryPropValue(t);case u.CATEGORY_LIST:return M.initCategoryListPropValue(t);case u.PRODUCT_LIST:return M.initProductListPropValue(t);case u.PRODUCT_DETAIL:return M.initProductPropValue(t);case u.PRODUCT_ATTRIBUTE:return M.initAttributePropValue(t);case u.PRODUCT_ATTRIBUTE_LIST:return M.initAttributeListPropValue(t);case u.LINK:case u.LIST_OF_LINK:return M.initLinkPropValue(t);case u.COMPONENT:return M.initComponentPropValue(t,i,a);case u.COMPONENT_LIST:return M.initComponentListPropValue(t,i,a);case u.CUSTOM:return M.initCustomDataPropValue(t,i,a);case u.BLOG:return M.initBlogPropValue(t);case u.BLOG_LIST:return M.initBlogListPropValue(t);case u.BLOG_CATEGORY:return M.initBlogCategoryPropValue(t);case u.BLOG_LIST:return M.initBlogCategoryListPropValue(t);case u.RAFFLE:return M.initRafflePropValue(t);case u.RAFFLE_LIST:return M.initRaffleListPropValue(t);case u.SLIDER:return M.initSliderPropValue(t);case u.VIDEO:return M.initVideoPropValue(t);default:return t}},M.initTextPropValue=function(e){var t=this;function i(e){for(var t,i=/{{(.*?)}}|([^{}]+)/g,a=[];null!==(t=i.exec(e));)t[1]?a.push({value:t[1],isVariable:!0}):t[2]&&a.push({value:t[2],isVariable:!1});return a}return i(e).filter((function(e){return e.isVariable})).length?U.createElement("div",null,function(){for(var a,r,o,s,u=i(e),d=u.filter((function(e){return e.isVariable})),p={},c=B.getInstance().currentPageType,m=function(e){var i=e.value;if(c===n.PRODUCT){var u=t.pageSpecificData;if(i.includes(A.ATTRIBUTE_VALUE)){var d=i.split(A.ATTRIBUTE_VALUE)[1].split("_")[1],m=u.groupedAttributeValues.find((function(e){return e.attribute.id===d})),f=u.selectedVariant.groupedAttributeValues.find((function(e){return e.attribute.id===d}))||m;f?f.attribute.type===l.CHOICE?p[i]=(null===(a=f.values[0].productAttributeOption)||void 0===a?void 0:a.name)||"":f.attribute.type===l.MULTIPLE_CHOICE?p[i]=f.values.map((function(e){var t;return null===(t=e.productAttributeOption)||void 0===t?void 0:t.name})).join(", ")||"":p[i]=f.values[0].value||"":p[i]=""}else i.includes(A.NAME)?p[i]=u.name:i.includes(A.DESCRIPTION)?p[i]=u.description:i.includes(A.SHORT_DESCRIPTION)?p[i]=u.shortDescription:i.includes(A.CATEGORY_NAME)?p[i]=(null===(r=u.categories[0])||void 0===r?void 0:r.name)||"":i.includes(A.TAG)?p[i]=(null===(o=u.tags)||void 0===o?void 0:o.map((function(e){return e.name})).join(", "))||"":i.includes(w.BARCODE)?p[i]=(null===(s=u.selectedVariant.barcodeList)||void 0===s?void 0:s.length)?u.selectedVariant.barcodeList[0]:"":i.includes(w.SKU)?p[i]=u.selectedVariant.sku:i.includes(w.SELL_PRICE)?p[i]=u.selectedVariant.formattedSellPrice:i.includes(w.DISCOUNT_PRICE)?p[i]=u.selectedVariant.formattedDiscountPrice:i.includes(w.STOCK)?p[i]=u.selectedVariant.stock:p[i]=""}else if(c===n.CATEGORY){var g=t.pageSpecificData;i===y.NAME?p[i]=g.name:i===y.DESCRIPTION?p[i]=g.description:p[i]=""}else if(c===n.BRAND){var V=t.pageSpecificData;i===R.NAME?p[i]=V.name:p[i]=""}else p[i]=""},f=0,g=d;f<g.length;f++){m(g[f])}for(var V="",P=0,v=u;P<v.length;P++){var D=v[P];D.isVariable?V+=p[D.value]:V+=D.value}return V}()):e},M.initBrandPropValue=function(e){return e.brandPropValue.usePageData&&this.pageSpecificData?this.pageSpecificData:e.brand?new o(e.brand):C()},M.initBrandListPropValue=function(e){return new P(e)},M.initCategoryPropValue=function(t){var i,a;return t.categoryPropValue.usePageData&&this.pageSpecificData?((null===(i=t.categoryPropValue.excludedFieldsCategory)||void 0===i?void 0:i.length)&&(this.pageSpecificData.description=null),this.pageSpecificData):t.category?new d(e(e({},t.category),{description:(null===(a=t.categoryPropValue.excludedFieldsCategory)||void 0===a?void 0:a.length)?null:t.category.description})):I()},M.initCategoryListPropValue=function(e){return new v(e)},M.initProductListPropValue=function(t){return new j(e(e({},t),{pageSpecificData:this.pageSpecificData}),B.getInstance().router)},M.initProductPropValue=function(t){var i=new c(S());if(t.productDetailPropValue.usePageData&&this.pageSpecificData)i=this.pageSpecificData;else if(t.productDetail){var a=t.productDetail;i=new c(e(e({},a),{selectedVariantValues:a.selectedVariantValues}))}return i},M._initProductOnBrowser=function(e){var t=new URLSearchParams(window.location.search),i=t.get("vid");if(i){var a=e.variants.find((function(e){return e.id===i}));a&&(e.selectedVariantValues=a.variantValues)}else{var r=e.variantTypes.map((function(e){return e.variantType.slug})),o=[];r.forEach((function(i,a){var r=e.variantTypes[a],n=G(t.get(i)||"");if(n){var s=r.variantType.values.find((function(e){return e.slug===n}));s&&o.push(s)}})),o.length===e.selectedVariantValues.length&&(e.selectedVariantValues=o)}e.setOptionRealPrices()},M.initAttributePropValue=function(t){var i=null;if(t.attributePropValue.usePageData&&this.pageSpecificData)i=this.pageSpecificData;else if(t.productDetail){var a=t.productDetail;i=new c(e(e({},a),{selectedVariantValues:a.selectedVariantValues}))}return new L(i,t.attributePropValue)},M.initAttributeListPropValue=function(t){var a=null;if(t.attributeListPropValue.usePageData&&this.pageSpecificData)a=this.pageSpecificData;else if(t.productDetail){var r=t.productDetail;a=new c(e(e({},r),{selectedVariantValues:r.selectedVariantValues}))}return new i(a,t.attributeListPropValue)},M.initLinkPropValue=function(e){return Array.isArray(e)?e.map((function(e){return new D(e.href,e.label,e.subLinks,e.isExternal||void 0)})):e?new D(e.href,e.label,e.subLinks,e.isExternal||void 0):void 0},M.initImagePropValue=function(e){return new p(e)},M.initImageListPropValue=function(e){return e.map((function(e){return new p(e)}))},M.initCustomDataPropValue=function(e,t,i){if(e&&e.value&&e.customDataId){var a=this.flatCustomDataList.find((function(t){return t.id===e.customDataId}));if(a)return this._initCustomDataPropValue(e,a,t,i)}},M._initCustomDataPropValue=function(e,t,i,a){var r=this;if(!e)return null;var o=e.value;if(null==o)return null;switch(t.type){case u.TEXT:return this.initTextPropValue(o);case u.BRAND:return this.initBrandPropValue(o);case u.BRAND_LIST:return this.initBrandListPropValue(o);case u.CATEGORY_LIST:return this.initCategoryListPropValue(o);case u.CATEGORY:return this.initCategoryPropValue(o);case u.IMAGE_LIST:return this.initImageListPropValue(o);case u.IMAGE:return this.initImagePropValue(o);case u.LINK:return this.initLinkPropValue(o);case u.PRODUCT_DETAIL:return this.initProductPropValue(o);case u.PRODUCT_LIST:return this.initProductListPropValue(o);case u.PRODUCT_ATTRIBUTE:return this.initAttributePropValue(o);case u.PRODUCT_ATTRIBUTE_LIST:return this.initAttributeListPropValue(o);case u.BLOG:return this.initBlogPropValue(o);case u.BLOG_LIST:return this.initBlogListPropValue(o);case u.BLOG_CATEGORY:return this.initBlogCategoryPropValue(o);case u.BLOG_CATEGORY_LIST:return this.initBlogCategoryListPropValue(o);case u.RAFFLE:return this.initRafflePropValue(o);case u.RAFFLE_LIST:return this.initRaffleListPropValue(o);case u.SLIDER:return this.initSliderPropValue(o);case u.VIDEO:return M.initVideoPropValue(o);case u.OBJECT:for(var n={},s=function(e){var t=o[e.key],r=void 0;e.customDataId&&(r=l.flatCustomDataList.find((function(e){return e.id===t.customDataId}))),n[e.key]=l._initCustomDataPropValue(t,r||e,i,a)},l=this,d=0,p=t.nestedData||[];d<p.length;d++){s(p[d])}return n;case u.DYNAMIC_LIST:case u.STATIC_LIST:try{if(!o||!o.length)return null;var c=[],m=t.nestedData[0];return o.forEach((function(e){var t;m.customDataId&&(t=r.flatCustomDataList.find((function(t){return t.id===e.customDataId}))),c.push(r._initCustomDataPropValue(e,t||m,i,a))})),c}catch(e){return[]}case u.COMPONENT:return this.initComponentPropValue(o,i,a);case u.COMPONENT_LIST:return this.initComponentListPropValue(o,i,a);default:return o}},M.initComponentPropValue=function(e,t,i){return this._initComponentPropValue(e,t,i)},M._initComponentPropValue=function(e,i,a){var r=e.length?e[0]:void 0;if(r){var o=new x(r),n=M.initPageComponentPropValue(o,[o.component],i,a);if(n)return new h((function(){return t(n,i,-10)}))}},M.initComponentListPropValue=function(e,t,i){return this._initComponentListPropValue(e,t,i)},M._initComponentListPropValue=function(e,i,a){return e&&e.length?e.map((function(e){var r=new x(e),o=M.initPageComponentPropValue(r,[r.component],i,a);return new h((function(){return t(o,i,-1)}))})):[]},M.initBlogPropValue=function(e){return e.blogPropValue.usePageData&&this.pageSpecificData?this.pageSpecificData:e.blog?new r(e.blog):b()},M.initBlogListPropValue=function(e){return new g(e)},M.initBlogCategoryPropValue=function(e){return e.blogCategoryPropValue.usePageData&&this.pageSpecificData?this.pageSpecificData:e.blogCategory?new a(e.blogCategory):E()},M.initBlogCategoryListPropValue=function(e){return new V(e)},M.initRafflePropValue=function(e){return e.rafflePropValue.usePageData&&this.pageSpecificData?this.pageSpecificData:e.raffle?new m(e.raffle):new m(O())},M.initRaffleListPropValue=function(e){return new T(e)},M.initSliderPropValue=function(e){return e},M.initVideoPropValue=function(t){return e(e({},t),{thumbnailImage:t.thumbnailImage?new p(t.thumbnailImage):null})},M.pageSpecificData={},M.flatCustomDataList=[],M.isBrowser=!1,M}();export{M as IkasPageDataInit};
1
+ import{__assign as e}from'./../ext/tslib/tslib.es6.js';import{renderComponent as t}from"../components/page/index.js";import{IkasAttributeList as i}from"../models/ui/product-attribute-list/index.js";import{IkasBlogCategory as a}from"../models/data/blog/category/index.js";import"../models/data/blog/content/index.js";import"../models/data/blog/meta-data/index.js";import"../models/data/blog/tag/index.js";import{IkasBlog as r}from"../models/data/blog/index.js";import{IkasBrand as o}from"../models/data/brand/index.js";import{IkasThemeJsonPageType as n,initIkasCategory as s,IkasThemeJsonComponentPropType as u,IkasProductAttributeType as l}from"@ikas/storefront-models";import"mobx";import"../models/data/campaign-offer/index.js";import"../models/data/cart/campaign-offer/index.js";import"../models/data/cart/index.js";import"../models/data/category/path-item/index.js";import{IkasCategory as d}from"../models/data/category/index.js";import"../models/data/checkout/index.js";import"../models/data/checkout-settings/index.js";import"../models/data/city/index.js";import"../models/data/country/index.js";import"../models/data/customer/address/region/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/address/ikas-localized-customer-address.js";import"../models/data/customer/attribute/index.js";import"../models/data/customer/review/summary/index.js";import"../models/data/customer/review/index.js";import"../models/data/customer/index.js";import"../models/data/customer-form-data-input/index.js";import"../models/data/district/index.js";import"../models/data/favorite-product/index.js";import"../models/data/filter-category/index.js";import"../models/data/html-meta-data/index.js";import{IkasImage as p}from"../models/data/image/index.js";import"../models/data/order/address/region/index.js";import"../models/data/order/address/index.js";import"../models/data/order/line-item/option/value/index.js";import"../models/data/order/line-item/variant/value/index.js";import"../models/data/order/line-item/variant/index.js";import"../models/data/order/line-item/index.js";import"../models/data/order/order-transaction-with-prices/index.js";import"../models/data/order/package/index.js";import"../models/data/order/transaction/index.js";import"../models/data/order/index.js";import"../models/data/payment-gateway/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product/filter/index.js";import"../models/data/product/campaign-offer/index.js";import"../models/data/product/option-set/option/index.js";import"../models/data/product/option-set/index.js";import"../models/data/product/stock-location/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product/variant/index.js";import"../models/data/variant-type/index.js";import{IkasProduct as c}from"../models/data/product/index.js";import{IkasRaffle as m}from"../models/data/raffle/index.js";import"../models/data/shipping-zone/state/city/district/region/index.js";import"../models/data/state/index.js";import"../models/data/storefront-popup/storefront-popup-display-filter/index.js";import"../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../models/data/storefront-popup/index.js";import"../models/data/theme-json/index.js";import"../models/data/theme-json/component/index.js";import"../models/data/theme-json/custom-data/index.js";import{IkasThemeJsonPageComponent as f}from"../models/data/theme-json/page/component/index.js";import"../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import{IkasBlogList as g}from"../models/ui/blog-list/index.js";import{IkasBlogCategoryList as V}from"../models/ui/blog-category-list/index.js";import{IkasBrandList as P}from"../models/ui/brand-list/index.js";import{IkasCategoryList as v}from"../models/ui/category-list/index.js";import{IkasNavigationLink as D}from"../models/ui/navigation-link/index.js";import{IkasProductList as j}from"../models/ui/product-list/index.js";import{IkasAttributeDetail as L}from"../models/ui/product-attribute-detail/index.js";import"../models/ui/customer-review-list/index.js";import"../models/ui/customer-review-summary-list/index.js";import"../models/ui/validator/index.js";import"../models/ui/validator/rules/index.js";import"../models/ui/validator/form/login.js";import"../models/ui/validator/form/address.js";import"../models/ui/validator/form/ikas-address.js";import"../models/ui/validator/form/register.js";import"../models/ui/validator/form/contact-form.js";import"../models/ui/validator/form/forgot-password.js";import"../models/ui/validator/form/recover-password.js";import"../models/ui/validator/form/account-info.js";import"../models/ui/validator/form/raffle-form.js";import"../models/ui/validator/form/customer-review.js";import{IkasComponentRenderer as h}from"../models/ui/component-renderer/index.js";import{IkasRaffleList as T}from"../models/ui/raffle-list/index.js";import{IkasPageComponentPropValue as C,getPlaceholderBrand as x,getPlaceholderCategory as I,getPlaceholderProduct as S,getPlaceholderBlog as b,getPlaceholderBlogCategory as E,getPlaceholderRaffle as O,ProductDataBindingFields as A,ProductVariantDataBindingFields as w,CategoryDataBindingFields as y,BrandDataBindingFields as R}from"@ikas/storefront-providers";import _ from"lodash/flatten";import{IkasBaseStore as B}from"../store/base.js";import"../store/customer/index.js";import"../store/cart/index.js";import{IkasProductVariantFunctions as k,stringToSlug as G}from"@ikas/storefront-model-functions";import{IkasStorefrontConfig as N}from"@ikas/storefront-config";import U from"react";var M=function(){function M(){}return M.setPageSpecificData=function(t,i,u){var l;if(this.pageType=i,this.isBrowser=u,t)switch(i){case n.PRODUCT:var p=t;M.pageSpecificData=new c(e(e({},p),{selectedVariantValues:p.selectedVariantValues||(null===(l=p.variants.find((function(e){return k.hasStock(e)})))||void 0===l?void 0:l.variantValues)||p.variants[0].variantValues})),u&&this._initProductOnBrowser(M.pageSpecificData);break;case n.CATEGORY:var f=t;s(f,N.getCurrentLocale()),M.pageSpecificData=new d(f);break;case n.BRAND:var g=t;M.pageSpecificData=new o(g);break;case n.BLOG:var V=t;M.pageSpecificData=new r(V);break;case n.BLOG_CATEGORY:var P=t;M.pageSpecificData=new a(P);break;case n.RAFFLE_DETAIL:var v=t;M.pageSpecificData=new m(v)}else this.pageSpecificData=void 0},M.isServer=function(){return"undefined"==typeof window},M.initPagePropValues=function(e,t,i,a,r){return this.flatCustomDataList=_(i.map((function(e){return e.flat}))),e.map((function(e){return M.initPageComponentPropValue(e,t,a,r)}))},M.initPageComponentPropValue=function(t,i,a,r){var o=i.find((function(e){return e.id===t.pageComponent.componentId})),n=null==o?void 0:o.props,s={};return null==n||n.map((function(e){var i=t.propValues[e.name];s[e.name]=M.initPropValue(e,i,a,r)})),new C(e(e({},t),{pageComponent:new f(e(e({},t.pageComponent),{propValues:s,componentId:o.id})),component:o,propValues:s}))},M.initPropValue=function(e,t,i,a){if(null==t)return null;switch(e.type){case u.TEXT:return M.initTextPropValue(t);case u.IMAGE:return M.initImagePropValue(t);case u.IMAGE_LIST:return M.initImageListPropValue(t);case u.BRAND:return M.initBrandPropValue(t);case u.BRAND_LIST:return M.initBrandListPropValue(t);case u.CATEGORY:return M.initCategoryPropValue(t);case u.CATEGORY_LIST:return M.initCategoryListPropValue(t);case u.PRODUCT_LIST:return M.initProductListPropValue(t);case u.PRODUCT_DETAIL:return M.initProductPropValue(t);case u.PRODUCT_ATTRIBUTE:return M.initAttributePropValue(t);case u.PRODUCT_ATTRIBUTE_LIST:return M.initAttributeListPropValue(t);case u.LINK:case u.LIST_OF_LINK:return M.initLinkPropValue(t);case u.COMPONENT:return M.initComponentPropValue(t,i,a);case u.COMPONENT_LIST:return M.initComponentListPropValue(t,i,a);case u.CUSTOM:return M.initCustomDataPropValue(t,i,a);case u.BLOG:return M.initBlogPropValue(t);case u.BLOG_LIST:return M.initBlogListPropValue(t);case u.BLOG_CATEGORY:return M.initBlogCategoryPropValue(t);case u.BLOG_LIST:return M.initBlogCategoryListPropValue(t);case u.RAFFLE:return M.initRafflePropValue(t);case u.RAFFLE_LIST:return M.initRaffleListPropValue(t);case u.SLIDER:return M.initSliderPropValue(t);case u.VIDEO:return M.initVideoPropValue(t);default:return t}},M.initTextPropValue=function(e){var t=this;function i(e){for(var t,i=/{{(.*?)}}|([^{}]+)/g,a=[];null!==(t=i.exec(e));)t[1]?a.push({value:t[1],isVariable:!0}):t[2]&&a.push({value:t[2],isVariable:!1});return a}return i(e).filter((function(e){return e.isVariable})).length?U.createElement("div",null,function(){for(var a,r,o,s,u=i(e),d=u.filter((function(e){return e.isVariable})),p={},c=B.getInstance().currentPageType,m=function(e){var i=e.value;if(c===n.PRODUCT){var u=t.pageSpecificData;if(i.includes(A.ATTRIBUTE_VALUE)){var d=i.split(A.ATTRIBUTE_VALUE)[1].split("_")[1],m=u.groupedAttributeValues.find((function(e){return e.attribute.id===d})),f=u.selectedVariant.groupedAttributeValues.find((function(e){return e.attribute.id===d}))||m;f?f.attribute.type===l.CHOICE?p[i]=(null===(a=f.values[0].productAttributeOption)||void 0===a?void 0:a.name)||"":f.attribute.type===l.MULTIPLE_CHOICE?p[i]=f.values.map((function(e){var t;return null===(t=e.productAttributeOption)||void 0===t?void 0:t.name})).join(", ")||"":p[i]=f.values[0].value||"":p[i]=""}else i.includes(A.NAME)?p[i]=u.name:i.includes(A.DESCRIPTION)?p[i]=u.description:i.includes(A.SHORT_DESCRIPTION)?p[i]=u.shortDescription:i.includes(A.CATEGORY_NAME)?p[i]=(null===(r=u.categories[0])||void 0===r?void 0:r.name)||"":i.includes(A.TAG)?p[i]=(null===(o=u.tags)||void 0===o?void 0:o.map((function(e){return e.name})).join(", "))||"":i.includes(w.BARCODE)?p[i]=(null===(s=u.selectedVariant.barcodeList)||void 0===s?void 0:s.length)?u.selectedVariant.barcodeList[0]:"":i.includes(w.SKU)?p[i]=u.selectedVariant.sku:i.includes(w.SELL_PRICE)?p[i]=u.selectedVariant.formattedSellPrice:i.includes(w.DISCOUNT_PRICE)?p[i]=u.selectedVariant.formattedDiscountPrice:i.includes(w.STOCK)?p[i]=u.selectedVariant.stock:p[i]=""}else if(c===n.CATEGORY){var g=t.pageSpecificData;i===y.NAME?p[i]=g.name:i===y.DESCRIPTION?p[i]=g.description:p[i]=""}else if(c===n.BRAND){var V=t.pageSpecificData;i===R.NAME?p[i]=V.name:p[i]=""}else p[i]=""},f=0,g=d;f<g.length;f++){m(g[f])}for(var V="",P=0,v=u;P<v.length;P++){var D=v[P];D.isVariable?V+=p[D.value]:V+=D.value}return V}()):e},M.initBrandPropValue=function(e){return e.brandPropValue.usePageData&&this.pageSpecificData?this.pageSpecificData:e.brand?new o(e.brand):x()},M.initBrandListPropValue=function(e){return new P(e)},M.initCategoryPropValue=function(t){var i,a;return t.categoryPropValue.usePageData&&this.pageSpecificData?((null===(i=t.categoryPropValue.excludedFieldsCategory)||void 0===i?void 0:i.length)&&(this.pageSpecificData.description=null),this.pageSpecificData):t.category?new d(e(e({},t.category),{description:(null===(a=t.categoryPropValue.excludedFieldsCategory)||void 0===a?void 0:a.length)?null:t.category.description})):I()},M.initCategoryListPropValue=function(e){return new v(e)},M.initProductListPropValue=function(t){return new j(e(e({},t),{pageSpecificData:this.pageSpecificData}),B.getInstance().router)},M.initProductPropValue=function(t){var i=new c(S());if(t.productDetailPropValue.usePageData&&this.pageSpecificData)i=this.pageSpecificData;else if(t.productDetail){var a=t.productDetail;i=new c(e(e({},a),{selectedVariantValues:a.selectedVariantValues}))}return i},M._initProductOnBrowser=function(e){var t=new URLSearchParams(window.location.search),i=t.get("vid");if(i){var a=e.variants.find((function(e){return e.id===i}));a&&(e.selectedVariantValues=a.variantValues)}else{var r=e.variantTypes.map((function(e){return e.variantType.slug})),o=[];r.forEach((function(i,a){var r=e.variantTypes[a],n=G(t.get(decodeURIComponent(i))||"");if(n){var s=r.variantType.values.find((function(e){return e.slug===n}));s&&o.push(s)}})),o.length===e.selectedVariantValues.length&&(e.selectedVariantValues=o)}e.setOptionRealPrices()},M.initAttributePropValue=function(t){var i=null;if(t.attributePropValue.usePageData&&this.pageSpecificData)i=this.pageSpecificData;else if(t.productDetail){var a=t.productDetail;i=new c(e(e({},a),{selectedVariantValues:a.selectedVariantValues}))}return new L(i,t.attributePropValue)},M.initAttributeListPropValue=function(t){var a=null;if(t.attributeListPropValue.usePageData&&this.pageSpecificData)a=this.pageSpecificData;else if(t.productDetail){var r=t.productDetail;a=new c(e(e({},r),{selectedVariantValues:r.selectedVariantValues}))}return new i(a,t.attributeListPropValue)},M.initLinkPropValue=function(e){return Array.isArray(e)?e.map((function(e){return new D(e.href,e.label,e.subLinks,e.isExternal||void 0)})):e?new D(e.href,e.label,e.subLinks,e.isExternal||void 0):void 0},M.initImagePropValue=function(e){return new p(e)},M.initImageListPropValue=function(e){return e.map((function(e){return new p(e)}))},M.initCustomDataPropValue=function(e,t,i){if(e&&e.value&&e.customDataId){var a=this.flatCustomDataList.find((function(t){return t.id===e.customDataId}));if(a)return this._initCustomDataPropValue(e,a,t,i)}},M._initCustomDataPropValue=function(e,t,i,a){var r=this;if(!e)return null;var o=e.value;if(null==o)return null;switch(t.type){case u.TEXT:return this.initTextPropValue(o);case u.BRAND:return this.initBrandPropValue(o);case u.BRAND_LIST:return this.initBrandListPropValue(o);case u.CATEGORY_LIST:return this.initCategoryListPropValue(o);case u.CATEGORY:return this.initCategoryPropValue(o);case u.IMAGE_LIST:return this.initImageListPropValue(o);case u.IMAGE:return this.initImagePropValue(o);case u.LINK:return this.initLinkPropValue(o);case u.PRODUCT_DETAIL:return this.initProductPropValue(o);case u.PRODUCT_LIST:return this.initProductListPropValue(o);case u.PRODUCT_ATTRIBUTE:return this.initAttributePropValue(o);case u.PRODUCT_ATTRIBUTE_LIST:return this.initAttributeListPropValue(o);case u.BLOG:return this.initBlogPropValue(o);case u.BLOG_LIST:return this.initBlogListPropValue(o);case u.BLOG_CATEGORY:return this.initBlogCategoryPropValue(o);case u.BLOG_CATEGORY_LIST:return this.initBlogCategoryListPropValue(o);case u.RAFFLE:return this.initRafflePropValue(o);case u.RAFFLE_LIST:return this.initRaffleListPropValue(o);case u.SLIDER:return this.initSliderPropValue(o);case u.VIDEO:return M.initVideoPropValue(o);case u.OBJECT:for(var n={},s=function(e){var t=o[e.key],r=void 0;e.customDataId&&(r=l.flatCustomDataList.find((function(e){return e.id===t.customDataId}))),n[e.key]=l._initCustomDataPropValue(t,r||e,i,a)},l=this,d=0,p=t.nestedData||[];d<p.length;d++){s(p[d])}return n;case u.DYNAMIC_LIST:case u.STATIC_LIST:try{if(!o||!o.length)return null;var c=[],m=t.nestedData[0];return o.forEach((function(e){var t;m.customDataId&&(t=r.flatCustomDataList.find((function(t){return t.id===e.customDataId}))),c.push(r._initCustomDataPropValue(e,t||m,i,a))})),c}catch(e){return[]}case u.COMPONENT:return this.initComponentPropValue(o,i,a);case u.COMPONENT_LIST:return this.initComponentListPropValue(o,i,a);default:return o}},M.initComponentPropValue=function(e,t,i){return this._initComponentPropValue(e,t,i)},M._initComponentPropValue=function(e,i,a){var r=e.length?e[0]:void 0;if(r){var o=new C(r),n=M.initPageComponentPropValue(o,[o.component],i,a);if(n)return new h((function(){return t(n,i,-10)}))}},M.initComponentListPropValue=function(e,t,i){return this._initComponentListPropValue(e,t,i)},M._initComponentListPropValue=function(e,i,a){return e&&e.length?e.map((function(e){var r=new C(e),o=M.initPageComponentPropValue(r,[r.component],i,a);return new h((function(){return t(o,i,-1)}))})):[]},M.initBlogPropValue=function(e){return e.blogPropValue.usePageData&&this.pageSpecificData?this.pageSpecificData:e.blog?new r(e.blog):b()},M.initBlogListPropValue=function(e){return new g(e)},M.initBlogCategoryPropValue=function(e){return e.blogCategoryPropValue.usePageData&&this.pageSpecificData?this.pageSpecificData:e.blogCategory?new a(e.blogCategory):E()},M.initBlogCategoryListPropValue=function(e){return new V(e)},M.initRafflePropValue=function(e){return e.rafflePropValue.usePageData&&this.pageSpecificData?this.pageSpecificData:e.raffle?new m(e.raffle):new m(O())},M.initRaffleListPropValue=function(e){return new T(e)},M.initSliderPropValue=function(e){return e},M.initVideoPropValue=function(t){return e(e({},t),{thumbnailImage:t.thumbnailImage?new p(t.thumbnailImage):null})},M.pageSpecificData={},M.flatCustomDataList=[],M.isBrowser=!1,M}();export{M as IkasPageDataInit};
@@ -1 +1 @@
1
- import{__rest as o,__awaiter as e,__generator as t,__assign as r}from'./../ext/tslib/tslib.es6.js';import*as s from"react";import{observer as i}from"mobx-react-lite";import d from"../components/checkout/index.js";import{useRouter as n}from"next/router.js";import{FullscreenLoading as a}from"../components/checkout/components/fullscreen-loading/index.js";import{CheckoutStep as m}from"../components/checkout/model.js";import{setAPIClientConfig as l,getCartById as c}from"@ikas/storefront-api";import{IkasStorefrontConfig as u}from"@ikas/storefront-config";import"../analytics/analytics.js";import"../analytics/head/index.js";import"../components/page/index.js";import"../components/page/head.js";import"next/image.js";import"@ikas/storefront-model-functions";import"../components/link/index.js";import"../components/page-editor/loader/style.module.scss.js";import"../components/google-captcha/index.js";import"../models/data/blog/category/index.js";import"../models/data/blog/content/index.js";import"../models/data/blog/meta-data/index.js";import"../models/data/blog/tag/index.js";import"../models/data/blog/index.js";import"../models/data/brand/index.js";import"@ikas/storefront-models";import"mobx";import"../models/data/campaign-offer/index.js";import"../models/data/cart/campaign-offer/index.js";import{IkasCart as p}from"../models/data/cart/index.js";import"../models/data/category/path-item/index.js";import"../models/data/category/index.js";import{IkasCheckout as j}from"../models/data/checkout/index.js";import"../models/data/checkout-settings/index.js";import"../models/data/city/index.js";import"../models/data/country/index.js";import"../models/data/customer/address/region/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/address/ikas-localized-customer-address.js";import"../models/data/customer/attribute/index.js";import"../models/data/customer/review/summary/index.js";import"../models/data/customer/review/index.js";import"../models/data/customer/index.js";import"../models/data/customer-form-data-input/index.js";import"../models/data/district/index.js";import"../models/data/favorite-product/index.js";import"../models/data/filter-category/index.js";import"../models/data/html-meta-data/index.js";import"../models/data/image/index.js";import"../models/data/order/address/region/index.js";import"../models/data/order/address/index.js";import"../models/data/order/line-item/option/value/index.js";import"../models/data/order/line-item/variant/value/index.js";import"../models/data/order/line-item/variant/index.js";import"../models/data/order/line-item/index.js";import"../models/data/order/order-transaction-with-prices/index.js";import"../models/data/order/package/index.js";import"../models/data/order/transaction/index.js";import"../models/data/order/index.js";import"../models/data/payment-gateway/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product/filter/index.js";import"../models/data/product/campaign-offer/index.js";import"../models/data/product/option-set/option/index.js";import"../models/data/product/option-set/index.js";import"../models/data/product/stock-location/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product/variant/index.js";import"../models/data/variant-type/index.js";import"../models/data/product/index.js";import"../models/data/raffle/index.js";import"../models/data/shipping-zone/state/city/district/region/index.js";import"../models/data/state/index.js";import"../models/data/storefront-popup/storefront-popup-display-filter/index.js";import"../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../models/data/storefront-popup/index.js";import"../models/data/theme-json/index.js";import"../models/data/theme-json/component/index.js";import"../models/data/theme-json/custom-data/index.js";import"../models/data/variant-type/variant-value/index.js";import{LocalizedAddressConfig as f}from"@ikas/localized-address";import"../models/ui/blog-list/index.js";import"../models/ui/blog-category-list/index.js";import"../models/ui/brand-list/index.js";import"../models/ui/category-list/index.js";import"../models/ui/product-list/index.js";import"../models/ui/product-attribute-detail/index.js";import"../models/ui/product-attribute-list/index.js";import"../models/ui/customer-review-list/index.js";import"../models/ui/customer-review-summary-list/index.js";import"../models/ui/validator/index.js";import"../models/ui/validator/rules/index.js";import"../models/ui/validator/form/login.js";import"../models/ui/validator/form/address.js";import"../models/ui/validator/form/ikas-address.js";import"../models/ui/validator/form/register.js";import"../models/ui/validator/form/contact-form.js";import"../models/ui/validator/form/forgot-password.js";import"../models/ui/validator/form/recover-password.js";import"../models/ui/validator/form/account-info.js";import"../models/ui/validator/form/raffle-form.js";import"../models/ui/validator/form/customer-review.js";import"../models/ui/raffle-list/index.js";import"./home.js";import"./_slug_/index.js";import"./pages/_slug_.js";import"./account/index.js";import"./account/addresses.js";import"./account/orders/index.js";import"./account/orders/_id_.js";import"./account/login.js";import"./account/register.js";import"./account/forgot-password.js";import"./account/recover-password.js";import"./cart.js";import"./editor.js";import"./account/favorite-products.js";import"./search.js";import"next/error.js";import"./blog/index.js";import"./blog/_slug_.js";import"./raffle/_slug_.js";import"./raffle/index.js";import"./account/raffles.js";import"./account/activate.js";import{IkasBaseStore as g}from"../store/base.js";import"../store/customer/index.js";import"../store/cart/index.js";import"lodash/get";import{initIkasEvents as x}from"../analytics/events.js";import{APIErrorCode as y}from'./../ext/@ikas/fe-api-client/build/utils/api.js';import'./../ext/axios/index.js';import'./../ext/@ikas/fe-api-client/build/ext/lodash/_defineProperty.js';import'./../ext/@ikas/fe-api-client/build/ext/lodash/_baseGetTag.js';import'./../ext/@ikas/fe-api-client/build/ext/lodash/_stringToPath.js';import'./../ext/@ikas/fe-api-client/build/ext/lodash/_baseToString.js';import v from"../store/checkout/index.js";var h=i((function(i){var h=i.customizationProps,b=i.configJson,E=o(i,["customizationProps","configJson"]),k=n(),C=s.useState(),F=C[0],P=C[1],w=s.useState(E.checkoutSettings),_=w[0],B=w[1];u.init(b),f.setCDNUrl(process.env.NEXT_PUBLIC_SETTINGS_CDN_URL),l(),s.useEffect((function(){!function(o){document.documentElement.style.setProperty("--checkout-button-bg-color",(null==o?void 0:o.buttonBgColor)||"#272727"),document.documentElement.style.setProperty("--checkout-button-text-color",(null==o?void 0:o.buttonTextColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-button-disabled-bg-color",(null==o?void 0:o.buttonDisabledBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-button-disabled-text-color",(null==o?void 0:o.buttonDisabledTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-text-color",(null==o?void 0:o.primaryTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-secondary-text-color",(null==o?void 0:o.secondaryTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-bg-color",(null==o?void 0:o.primaryBgColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-secondary-bg-color",(null==o?void 0:o.secondaryBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-border-color",(null==o?void 0:o.borderColor)||"#E5E4E9"),document.documentElement.style.setProperty("--checkout-card-bg-color",(null==o?void 0:o.cardBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-error-color",(null==o?void 0:o.errorColor)||"#FB4E4E"),document.documentElement.style.setProperty("--checkout-error-light-color",(null==o?void 0:o.errorLightColor)||"#FCF3F4"),document.documentElement.style.setProperty("--checkout-warning-color",(null==o?void 0:o.warningColor)||"#FFBC1F"),document.documentElement.style.setProperty("--checkout-warning-light-color",(null==o?void 0:o.warningLightColor)||"#FFFAEE"),document.documentElement.style.setProperty("--checkout-success-color",(null==o?void 0:o.successColor)||"#2DCA73"),document.documentElement.style.setProperty("--checkout-success-light-color",(null==o?void 0:o.successLightColor)||"#F6FFED"),document.documentElement.style.setProperty("--checkout-secondary-button-bg-color",(null==o?void 0:o.secondaryButtonBgColor)||"#ffffff0"),document.documentElement.style.setProperty("--checkout-secondary-button-text-color",(null==o?void 0:o.secondaryButtonTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-secondary-button-border-color",(null==o?void 0:o.secondaryButtonBorderColor)||"#E5E4E9"),document.documentElement.style.setProperty("--checkout-campaign-title-color",(null==o?void 0:o.campaignOffersTitleColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-description-color",(null==o?void 0:o.campaignOffersDescriptionColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-container-bg-color",(null==o?void 0:o.campaignOffersContainerBgColor)||"#ffffff"),document.documentElement.style.setProperty("--checkout-campaign-discount-percentage-color",(null==o?void 0:o.campaignOffersDiscountPercentageColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-discount-percentage-bg-color",(null==o?void 0:o.campaignOffersDiscountPercentageBgColor)||"#FFF1BD"),document.documentElement.style.setProperty("--checkout-campaign-countdown-text-color",(null==o?void 0:o.campaignOffersCountdownTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-countdown-time-color",(null==o?void 0:o.campaignOffersCountdownTimeColor)||"#FB4E4E"),document.documentElement.style.setProperty("--checkout-campaign-countdown-bg-color",(null==o?void 0:o.campaignOffersCountdownBgColor)||"#FFF5F6"),document.documentElement.style.setProperty("--checkout-campaign-middle-phase-overlay-color",(null==o?void 0:o.campaignOffersMiddlePhaseOverlayColor)||"#292727ad")}(h)}),[h]),s.useEffect((function(){g.getInstance().checkLocalization(),S(),x()}),[]);var S=s.useCallback((function(){return e(void 0,void 0,void 0,(function(){var o,e,r,s,i,d,n,a,l,u,f,x,h,b,E,C,F;return t(this,(function(t){switch(t.label){case 0:if(o=new URLSearchParams(window.location.search),e=o.get("id"),r=o.get("step"),s=o.get("lines"),i=o.get("couponCode"),!s)return[3,5];t.label=1;case 1:return t.trys.push([1,3,,4]),(d=g.getInstance().cartStore).removeCart(),n=s.split(","),a=n.map((function(o){var e=o.split(":"),t=e[0],r=e[1];return{variantId:t,quantity:parseInt(r)}})),l={variantLines:a,couponCode:i||void 0},[4,d.createCart(l)];case 2:return(u=t.sent()).success&&(window.location.href="/checkout?id=".concat(null===(C=u.response.data)||void 0===C?void 0:C.id,"&step=info")),[3,4];case 3:return f=t.sent(),console.error("Error creating cart:",f),[3,4];case 4:return[2];case 5:return e?(x=!1,r&&r===m.SUCCESS&&(x=!0),[4,c({id:e,getCompletedCart:x})]):[2,k.replace("/")];case 6:return h=t.sent(),_?[3,8]:[4,v.listCheckoutSettings({})];case 7:(b=t.sent()).isSuccess&&(null===(F=b.data)||void 0===F?void 0:F.length)?B(b.data[0]):(console.error("CHECKOUT SETTINGS FETCH FAILED!"),console.error(b),console.error(b.graphQLErrors),console.error(b.errorCodes)),t.label=8;case 8:return h.isSuccess&&h.data?(E=h.data,P(new j(E)),g.getInstance().cartStore.setCart(new p(E))):h.errorCodes.some((function(o){return o===y.LOGIN_REQUIRED}))?k.replace("/account/login?redirect="+encodeURIComponent(window.location.href)):k.replace("/"),[2]}}))}))}),[]);return F&&_?s.createElement(d,r({checkout:F,customizationProps:h},E,{checkoutSettings:_})):s.createElement(a,null)}));export{h as default};
1
+ import{__rest as o,__awaiter as e,__generator as t,__assign as r}from'./../ext/tslib/tslib.es6.js';import*as s from"react";import{observer as i}from"mobx-react-lite";import d from"../components/checkout/index.js";import{useRouter as n}from"next/router.js";import{FullscreenLoading as a}from"../components/checkout/components/fullscreen-loading/index.js";import{CheckoutStep as m}from"../components/checkout/model.js";import{setAPIClientConfig as l,getCartById as c,CampaignOfferTargetPageTypeEnum as p}from"@ikas/storefront-api";import{IkasStorefrontConfig as u}from"@ikas/storefront-config";import"../analytics/analytics.js";import"../analytics/head/index.js";import"../components/page/index.js";import"../components/page/head.js";import"next/image.js";import"@ikas/storefront-model-functions";import"../components/link/index.js";import"../components/page-editor/loader/style.module.scss.js";import"../components/google-captcha/index.js";import"../components/paypal-express-checkout/index.js";import"../models/data/blog/category/index.js";import"../models/data/blog/content/index.js";import"../models/data/blog/meta-data/index.js";import"../models/data/blog/tag/index.js";import"../models/data/blog/index.js";import"../models/data/brand/index.js";import"@ikas/storefront-models";import"mobx";import"../models/data/campaign-offer/index.js";import"../models/data/cart/campaign-offer/index.js";import{IkasCart as j}from"../models/data/cart/index.js";import"../models/data/category/path-item/index.js";import"../models/data/category/index.js";import{IkasCheckout as f}from"../models/data/checkout/index.js";import"../models/data/checkout-settings/index.js";import"../models/data/city/index.js";import"../models/data/country/index.js";import"../models/data/customer/address/region/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/address/ikas-localized-customer-address.js";import"../models/data/customer/attribute/index.js";import"../models/data/customer/review/summary/index.js";import"../models/data/customer/review/index.js";import"../models/data/customer/index.js";import"../models/data/customer-form-data-input/index.js";import"../models/data/district/index.js";import"../models/data/favorite-product/index.js";import"../models/data/filter-category/index.js";import"../models/data/html-meta-data/index.js";import"../models/data/image/index.js";import"../models/data/order/address/region/index.js";import"../models/data/order/address/index.js";import"../models/data/order/line-item/option/value/index.js";import"../models/data/order/line-item/variant/value/index.js";import"../models/data/order/line-item/variant/index.js";import"../models/data/order/line-item/index.js";import"../models/data/order/order-transaction-with-prices/index.js";import"../models/data/order/package/index.js";import"../models/data/order/transaction/index.js";import"../models/data/order/index.js";import"../models/data/payment-gateway/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product/filter/index.js";import"../models/data/product/campaign-offer/index.js";import"../models/data/product/option-set/option/index.js";import"../models/data/product/option-set/index.js";import"../models/data/product/stock-location/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product/variant/index.js";import"../models/data/variant-type/index.js";import"../models/data/product/index.js";import"../models/data/raffle/index.js";import"../models/data/shipping-zone/state/city/district/region/index.js";import"../models/data/state/index.js";import"../models/data/storefront-popup/storefront-popup-display-filter/index.js";import"../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../models/data/storefront-popup/index.js";import"../models/data/theme-json/index.js";import"../models/data/theme-json/component/index.js";import"../models/data/theme-json/custom-data/index.js";import"../models/data/variant-type/variant-value/index.js";import{LocalizedAddressConfig as g}from"@ikas/localized-address";import"../models/ui/blog-list/index.js";import"../models/ui/blog-category-list/index.js";import"../models/ui/brand-list/index.js";import"../models/ui/category-list/index.js";import"../models/ui/product-list/index.js";import"../models/ui/product-attribute-detail/index.js";import"../models/ui/product-attribute-list/index.js";import"../models/ui/customer-review-list/index.js";import"../models/ui/customer-review-summary-list/index.js";import"../models/ui/validator/index.js";import"../models/ui/validator/rules/index.js";import"../models/ui/validator/form/login.js";import"../models/ui/validator/form/address.js";import"../models/ui/validator/form/ikas-address.js";import"../models/ui/validator/form/register.js";import"../models/ui/validator/form/contact-form.js";import"../models/ui/validator/form/forgot-password.js";import"../models/ui/validator/form/recover-password.js";import"../models/ui/validator/form/account-info.js";import"../models/ui/validator/form/raffle-form.js";import"../models/ui/validator/form/customer-review.js";import"../models/ui/raffle-list/index.js";import"./home.js";import"./_slug_/index.js";import"./pages/_slug_.js";import"./account/index.js";import"./account/addresses.js";import"./account/orders/index.js";import"./account/orders/_id_.js";import"./account/login.js";import"./account/register.js";import"./account/forgot-password.js";import"./account/recover-password.js";import"./cart.js";import"./editor.js";import"./account/favorite-products.js";import"./search.js";import"next/error.js";import"./blog/index.js";import"./blog/_slug_.js";import"./raffle/_slug_.js";import"./raffle/index.js";import"./account/raffles.js";import"./account/activate.js";import{IkasBaseStore as x}from"../store/base.js";import"../store/customer/index.js";import"../store/cart/index.js";import"lodash/get";import{initIkasEvents as y}from"../analytics/events.js";import{APIErrorCode as v}from'./../ext/@ikas/fe-api-client/build/utils/api.js';import'./../ext/axios/index.js';import'./../ext/@ikas/fe-api-client/build/ext/lodash/_defineProperty.js';import'./../ext/@ikas/fe-api-client/build/ext/lodash/_baseGetTag.js';import'./../ext/@ikas/fe-api-client/build/ext/lodash/_stringToPath.js';import'./../ext/@ikas/fe-api-client/build/ext/lodash/_baseToString.js';import h from"../store/checkout/index.js";var b=i((function(i){var b=i.customizationProps,C=i.configJson,E=o(i,["customizationProps","configJson"]),k=n(),F=s.useState(),P=F[0],w=F[1],_=s.useState(E.checkoutSettings),B=_[0],T=_[1];u.init(C),g.setCDNUrl(process.env.NEXT_PUBLIC_SETTINGS_CDN_URL),l(),s.useEffect((function(){!function(o){document.documentElement.style.setProperty("--checkout-button-bg-color",(null==o?void 0:o.buttonBgColor)||"#272727"),document.documentElement.style.setProperty("--checkout-button-text-color",(null==o?void 0:o.buttonTextColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-button-disabled-bg-color",(null==o?void 0:o.buttonDisabledBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-button-disabled-text-color",(null==o?void 0:o.buttonDisabledTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-text-color",(null==o?void 0:o.primaryTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-secondary-text-color",(null==o?void 0:o.secondaryTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-bg-color",(null==o?void 0:o.primaryBgColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-secondary-bg-color",(null==o?void 0:o.secondaryBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-border-color",(null==o?void 0:o.borderColor)||"#E5E4E9"),document.documentElement.style.setProperty("--checkout-card-bg-color",(null==o?void 0:o.cardBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-error-color",(null==o?void 0:o.errorColor)||"#FB4E4E"),document.documentElement.style.setProperty("--checkout-error-light-color",(null==o?void 0:o.errorLightColor)||"#FCF3F4"),document.documentElement.style.setProperty("--checkout-warning-color",(null==o?void 0:o.warningColor)||"#FFBC1F"),document.documentElement.style.setProperty("--checkout-warning-light-color",(null==o?void 0:o.warningLightColor)||"#FFFAEE"),document.documentElement.style.setProperty("--checkout-success-color",(null==o?void 0:o.successColor)||"#2DCA73"),document.documentElement.style.setProperty("--checkout-success-light-color",(null==o?void 0:o.successLightColor)||"#F6FFED"),document.documentElement.style.setProperty("--checkout-secondary-button-bg-color",(null==o?void 0:o.secondaryButtonBgColor)||"#ffffff0"),document.documentElement.style.setProperty("--checkout-secondary-button-text-color",(null==o?void 0:o.secondaryButtonTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-secondary-button-border-color",(null==o?void 0:o.secondaryButtonBorderColor)||"#E5E4E9"),document.documentElement.style.setProperty("--checkout-campaign-title-color",(null==o?void 0:o.campaignOffersTitleColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-description-color",(null==o?void 0:o.campaignOffersDescriptionColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-container-bg-color",(null==o?void 0:o.campaignOffersContainerBgColor)||"#ffffff"),document.documentElement.style.setProperty("--checkout-campaign-discount-percentage-color",(null==o?void 0:o.campaignOffersDiscountPercentageColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-discount-percentage-bg-color",(null==o?void 0:o.campaignOffersDiscountPercentageBgColor)||"#FFF1BD"),document.documentElement.style.setProperty("--checkout-campaign-countdown-text-color",(null==o?void 0:o.campaignOffersCountdownTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-countdown-time-color",(null==o?void 0:o.campaignOffersCountdownTimeColor)||"#FB4E4E"),document.documentElement.style.setProperty("--checkout-campaign-countdown-bg-color",(null==o?void 0:o.campaignOffersCountdownBgColor)||"#FFF5F6"),document.documentElement.style.setProperty("--checkout-campaign-middle-phase-overlay-color",(null==o?void 0:o.campaignOffersMiddlePhaseOverlayColor)||"#292727ad")}(b)}),[b]),s.useEffect((function(){x.getInstance().checkLocalization(),S(),y()}),[]);var S=s.useCallback((function(){return e(void 0,void 0,void 0,(function(){var o,e,r,s,i,d,n,a,l,u,g,y,b,C,E,F,P;return t(this,(function(t){switch(t.label){case 0:if(o=new URLSearchParams(window.location.search),e=o.get("id"),r=o.get("step"),s=o.get("lines"),i=o.get("couponCode"),!s)return[3,5];t.label=1;case 1:return t.trys.push([1,3,,4]),(d=x.getInstance().cartStore).removeCart(),n=s.split(","),a=n.map((function(o){var e=o.split(":"),t=e[0],r=e[1];return{variantId:t,quantity:parseInt(r)}})),l={variantLines:a,couponCode:i||void 0},[4,d.createCart(l)];case 2:return(u=t.sent()).success&&(window.location.href="/checkout?id=".concat(null===(F=u.response.data)||void 0===F?void 0:F.id,"&step=info")),[3,4];case 3:return g=t.sent(),console.error("Error creating cart:",g),[3,4];case 4:return[2];case 5:return e?(y=!1,r&&r===m.SUCCESS&&(y=!0),[4,c({id:e,getCompletedCart:y,targetPageType:p.CHECKOUT})]):[2,k.replace("/")];case 6:return b=t.sent(),B?[3,8]:[4,h.listCheckoutSettings({})];case 7:(C=t.sent()).isSuccess&&(null===(P=C.data)||void 0===P?void 0:P.length)?T(C.data[0]):(console.error("CHECKOUT SETTINGS FETCH FAILED!"),console.error(C),console.error(C.graphQLErrors),console.error(C.errorCodes)),t.label=8;case 8:return b.isSuccess&&b.data?(E=b.data,w(new f(E)),x.getInstance().cartStore.setCart(new j(E))):b.errorCodes.some((function(o){return o===v.LOGIN_REQUIRED}))?k.replace("/account/login?redirect="+encodeURIComponent(window.location.href)):k.replace("/"),[2]}}))}))}),[]);return P&&B?s.createElement(d,r({checkout:P,customizationProps:b},E,{checkoutSettings:B})):s.createElement(a,null)}));export{b as default};