@ikas/storefront 5.0.29 → 6.1.0-beta.10

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 (135) hide show
  1. package/build/components/popup/index.js +1 -1
  2. package/build/components/popup/renderer/index.js +1 -1
  3. package/build/components/popup/utils/index.js +1 -1
  4. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/button-element-renderer/index.js +1 -0
  5. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/divider-element-renderer/index.js +1 -0
  6. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/checkbox-item-view/index.js +1 -0
  7. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/date-item-view/index.js +1 -0
  8. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/gender-item-view/index.js +1 -0
  9. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/index.js +1 -0
  10. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/input-item-view/index.js +1 -0
  11. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/image-column-element-renderer/index.js +1 -0
  12. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/image-element-renderer/index.js +1 -0
  13. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/index.js +1 -0
  14. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/product-list-renderer/index.js +1 -0
  15. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/social-element-renderer/index.js +1 -0
  16. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/space-element-renderer/index.js +1 -0
  17. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/text-element-renderer/index.js +1 -0
  18. package/build/models/data/product/index.js +1 -1
  19. package/build/models/data/storefront-popup/index.js +1 -1
  20. package/build/models/ui/product-list/index.js +1 -1
  21. package/build/page-data-init/index.js +1 -1
  22. package/package.json +13 -13
  23. package/build/packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/components/button-element-renderer/index.js +0 -1
  24. package/build/packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/components/divider-element-renderer/index.js +0 -1
  25. package/build/packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/checkbox-item-view/index.js +0 -1
  26. package/build/packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/date-item-view/index.js +0 -1
  27. package/build/packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/gender-item-view/index.js +0 -1
  28. package/build/packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/index.js +0 -1
  29. package/build/packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/input-item-view/index.js +0 -1
  30. package/build/packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/components/image-column-element-renderer/index.js +0 -1
  31. package/build/packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/components/image-element-renderer/index.js +0 -1
  32. package/build/packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/components/index.js +0 -1
  33. package/build/packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/components/product-list-renderer/index.js +0 -1
  34. package/build/packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/components/social-element-renderer/index.js +0 -1
  35. package/build/packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/components/space-element-renderer/index.js +0 -1
  36. package/build/packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/components/text-element-renderer/index.js +0 -1
  37. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/AsYouType.js +0 -0
  38. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/AsYouTypeFormatter.PatternMatcher.js +0 -0
  39. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/AsYouTypeFormatter.PatternParser.js +0 -0
  40. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/AsYouTypeFormatter.complete.js +0 -0
  41. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/AsYouTypeFormatter.js +0 -0
  42. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/AsYouTypeFormatter.util.js +0 -0
  43. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/AsYouTypeParser.js +0 -0
  44. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/AsYouTypeState.js +0 -0
  45. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/ParseError.js +0 -0
  46. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/PhoneNumber.js +0 -0
  47. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/PhoneNumberMatcher.js +0 -0
  48. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/constants.js +0 -0
  49. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/findNumbers/LRUCache.js +0 -0
  50. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/findNumbers/Leniency.js +0 -0
  51. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/findNumbers/RegExpCache.js +0 -0
  52. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/findNumbers/isValidCandidate.js +0 -0
  53. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/findNumbers/isValidPreCandidate.js +0 -0
  54. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/findNumbers/matchPhoneNumberStringAgainstPhoneNumber.js +0 -0
  55. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/findNumbers/parsePreCandidate.js +0 -0
  56. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/findNumbers/utf-8.js +0 -0
  57. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/findNumbers/util.js +0 -0
  58. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/format.js +0 -0
  59. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/RFC3966.js +0 -0
  60. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/applyInternationalSeparatorStyle.js +0 -0
  61. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/checkNumberLength.js +0 -0
  62. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/extension/createExtensionPattern.js +0 -0
  63. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/extension/extractExtension.js +0 -0
  64. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/extractCountryCallingCode.js +0 -0
  65. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js +0 -0
  66. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/extractFormattedPhoneNumberFromPossibleRfc3966NumberUri.js +0 -0
  67. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/extractNationalNumber.js +0 -0
  68. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/extractNationalNumberFromPossiblyIncompleteNumber.js +0 -0
  69. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/extractPhoneContext.js +0 -0
  70. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/formatNationalNumberUsingFormat.js +0 -0
  71. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/getCountryByCallingCode.js +0 -0
  72. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/getCountryByNationalNumber.js +0 -0
  73. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/getIddPrefix.js +0 -0
  74. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/getNumberType.js +0 -0
  75. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/getPossibleCountriesForNumber.js +0 -0
  76. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/isObject.js +0 -0
  77. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/isViablePhoneNumber.js +0 -0
  78. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/matchesEntirely.js +0 -0
  79. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/mergeArrays.js +0 -0
  80. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/parseDigits.js +0 -0
  81. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/helpers/stripIddPrefix.js +0 -0
  82. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/isPossible.js +0 -0
  83. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/isValid.js +0 -0
  84. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/isValidPhoneNumber.js +0 -0
  85. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/legacy/findPhoneNumbersInitialImplementation.js +0 -0
  86. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/metadata.js +0 -0
  87. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/normalizeArguments.js +0 -0
  88. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/parse.js +0 -0
  89. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/parseIncompletePhoneNumber.js +0 -0
  90. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/parsePhoneNumber.js +0 -0
  91. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/parsePhoneNumberWithError_.js +0 -0
  92. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/parsePhoneNumber_.js +0 -0
  93. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/tools/semver-compare.js +0 -0
  94. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/index.es6.exports/PhoneNumberSearch.js +0 -0
  95. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/metadata.min.json.js +0 -0
  96. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/AsYouType.js +0 -0
  97. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/Metadata.js +0 -0
  98. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/PhoneNumberMatcher.js +0 -0
  99. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/isValidPhoneNumber.js +0 -0
  100. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/withMetadataArgument.js +0 -0
  101. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/ext/tslib/tslib.es6.mjs.js +0 -0
  102. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/popup-renderer/assets/left-arrow.js +0 -0
  103. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/popup-renderer/assets/right-arrow.js +0 -0
  104. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/popup-renderer/assets/x-close.js +0 -0
  105. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/popup-renderer/helpers/index.js +0 -0
  106. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/popup-renderer/models/index.js +0 -0
  107. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/background-settings/index.js +0 -0
  108. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/close-settings/index.js +0 -0
  109. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/index.js +0 -0
  110. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/base/index.js +0 -0
  111. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/button/index.js +0 -0
  112. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/divider/index.js +0 -0
  113. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/checkbox/index.js +0 -0
  114. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-attribute/index.js +0 -0
  115. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-birthday/index.js +0 -0
  116. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-email/index.js +0 -0
  117. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-gender/index.js +0 -0
  118. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-name/index.js +0 -0
  119. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-phone/index.js +0 -0
  120. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-surname/index.js +0 -0
  121. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/form-settings/index.js +0 -0
  122. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/index.js +0 -0
  123. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/image/index.js +0 -0
  124. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/image-column/index.js +0 -0
  125. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/product/detail-settings/index.js +0 -0
  126. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/product/index.js +0 -0
  127. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/social/index.js +0 -0
  128. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/space/index.js +0 -0
  129. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/text/index.js +0 -0
  130. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/step/index.js +0 -0
  131. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/teaser/index.js +0 -0
  132. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/popup-renderer/models/modal/window-settings/index.js +0 -0
  133. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/popup-renderer/models/settings/index.js +0 -0
  134. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/popup-renderer/models/settings/visibility-condition/index.js +0 -0
  135. /package/build/{packages/storefront/ext → ext}/@ikas/popup-renderer/build/popup-renderer/models/settings/visibility-time/index.js +0 -0
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as t,__spreadArray as r}from'./../../ext/tslib/tslib.es6.js';import*as n from"react";import{observer as i}from"mobx-react-lite";import{IkasStorefrontConfig as o}from"@ikas/storefront-config";import s from"../../hooks/useDimension.js";import l from"./renderer/index.js";import{checkSavedSessionForPopups as u,checkIsPopupSavedToLocalStorage as c}from"./utils/index.js";import{IkasStorefrontPopupPageFilterTypeEnum as a,IkasStorefrontPopupPageFilterDataTypeEnum as d,IkasStorefrontPopupDeviceTypeEnum as p}from"@ikas/storefront-models";var f=i((function(){var i=s().isMobile,f=n.useState([]),m=f[0],v=f[1];return n.useEffect((function(){e(void 0,void 0,void 0,(function(){var e,n,s,l;return t(this,(function(t){switch(t.label){case 0:return[4,new Promise((function(e){var t=setInterval((function(){var r=o.getSessionId();r&&(clearInterval(t),e(r))}),100)}))];case 1:return t.sent(),u(),e=[],n=o.getStorefrontPopups().filter((function(t){var r;if(c(t.id))return!1;var n=[];if((null===(r=t.pageFilters)||void 0===r?void 0:r.length)&&(n=t.pageFilters.filter((function(e){return e.pageType===a.CUSTOM}))).length){var o=window.location.href;o.includes("http://localhost:3333/")&&(o=o.replace("http://localhost:3333/","https://bundle.myikas.dev/")),n.forEach((function(t){var r;null===(r=t.filters)||void 0===r||r.forEach((function(t){t.type===d.CONTAINS&&o.includes(t.value)?e.push(d.CONTAINS):t.type===d.DOES_NOT_CONTAIN&&o.includes(t.value)?e.push(d.DOES_NOT_CONTAIN):t.type===d.EXACT_MATCH&&o===t.value&&e.push(d.EXACT_MATCH)}))}))}if(e.includes(d.DOES_NOT_CONTAIN))return!1;var s=function(){return i?[p.ALL,p.MOBILE].includes(t.visibleDevice):[p.ALL,p.DESKTOP].includes(t.visibleDevice)};return(e.length||!(!e.length&&!t.isFilteredOnServerSide))&&s()})),s=document.head.querySelector('link[href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css"]'),n.length&&!s&&((l=document.createElement("link")).type="text/css",l.rel="stylesheet",l.href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css",document.head.appendChild(l)),v(r([],n,!0)),[2]}}))}))}),[i]),n.createElement(n.Fragment,null,m.map((function(e,t){return n.createElement(l,{storefrontPopup:e,key:e.id})})))}));export{f as PopupListRendererForPage};
1
+ import{__spreadArray as e}from'./../../ext/tslib/tslib.es6.js';import*as t from"react";import{observer as r}from"mobx-react-lite";import{IkasStorefrontConfig as i}from"@ikas/storefront-config";import n from"../../hooks/useDimension.js";import o from"./renderer/index.js";import{checkSavedSessionForPopups as s,checkIsPopupSavedToLocalStorage as l}from"./utils/index.js";import{IkasStorefrontPopupPageFilterTypeEnum as u,IkasStorefrontPopupPageFilterDataTypeEnum as p,IkasStorefrontPopupDeviceTypeEnum as c}from"@ikas/storefront-models";import{IkasBaseStore as a}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";var m=r((function(){var r=n().isMobile,m=t.useState([]),d=m[0],f=m[1];return t.useEffect((function(){s(),a.getInstance().currentPageType;var t=[],n=i.getStorefrontPopups().filter((function(e){var i;if(l(e.id))return!1;var n=[];if((null===(i=e.pageFilters)||void 0===i?void 0:i.length)&&(n=e.pageFilters.filter((function(e){return e.pageType===u.CUSTOM}))).length){var o=window.location.href;o.includes("http://localhost:3333/")&&(o=o.replace("http://localhost:3333/","https://bundle.myikas.dev/")),n.forEach((function(e){var r;null===(r=e.filters)||void 0===r||r.forEach((function(e){e.type===p.CONTAINS&&o.includes(e.value)?t.push(p.CONTAINS):e.type===p.DOES_NOT_CONTAIN&&o.includes(e.value)?t.push(p.DOES_NOT_CONTAIN):e.type===p.EXACT_MATCH&&o===e.value&&t.push(p.EXACT_MATCH)}))}))}if(t.includes(p.DOES_NOT_CONTAIN))return!1;var s=function(){return r?[c.ALL,c.MOBILE].includes(e.visibleDevice):[c.ALL,c.DESKTOP].includes(e.visibleDevice)};return(t.length||!(!t.length&&!e.isFilteredOnServerSide))&&s()})),o=document.head.querySelector('link[href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css"]');if(n.length&&!o){var m=document.createElement("link");m.type="text/css",m.rel="stylesheet",m.href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css",document.head.appendChild(m)}f(e([],n,!0))}),[r]),t.createElement(t.Fragment,null,d.map((function(e,r){return t.createElement(o,{storefrontPopup:e,key:e.id})})))}));export{m as PopupListRendererForPage};
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as o}from'./../../../ext/tslib/tslib.es6.js';import*as r from"react";import{observer as s}from"mobx-react-lite";import p from"../../../hooks/useDimension.js";import{IkasBaseStore as t}from"../../../store/base.js";import"../../../store/customer/index.js";import"../../../store/cart/index.js";import{IkasStorefrontPopupDisplayTriggerTypeEnum as n}from"../../../models/data/storefront-popup/storefront-popup-display-settings/index.js";import{exitIntent as d}from"../utils/index.js";import{IkasStorefrontPopupRendererViewModel as i}from"./model.js";import"react-date-picker/dist/DatePicker.css";import u from'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/components/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/ext/tslib/tslib.es6.mjs.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/PhoneNumberMatcher.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/AsYouTypeFormatter.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/ParseError.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/metadata.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/PhoneNumber.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/PhoneNumberMatcher.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/AsYouType.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/Metadata.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/findNumbers/isValidCandidate.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/index.es6.exports/PhoneNumberSearch.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/base/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/settings/index.js';import"mobx";import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/settings/visibility-condition/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/teaser/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/button/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/divider/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/checkbox/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-attribute/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-gender/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/image/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/image-column/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/product/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/product/detail-settings/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/social/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/space/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/text/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/background-settings/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/close-settings/index.js';var a=s((function(s){var a=s.storefrontPopup,m=r.useState((function(){return new i({},a)}))[0],l=p().isMobile;r.useEffect((function(){e(void 0,void 0,void 0,(function(){var e,r;return o(this,(function(o){switch(o.label){case 0:return[4,m.init()];case 1:if(o.sent(),!m.storefrontPopupData)return[2];if(!m.isModalClosedByUser){if((e=m.storefrontPopupData.displaySettings.triggerType)===n.SCROLL_DOWN)return window.addEventListener("scroll",m.handleScroll),[2,function(){window.removeEventListener("scroll",m.handleScroll)}];if(e===n.EXIT_INTENT)return r=d({onExitIntent:function(){m.openModal()}}),[2,function(){r()}]}return[2]}}))}))}),[]);var c=r.useCallback((function(r){return e(void 0,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,m.addProductToCart(r)];case 1:return[2,e.sent()]}}))}))}),[]);return m.storefrontPopupData&&m.storefrontPopupData.contentJson&&!m.isLoading?r.createElement(u,{key:m.storefrontPopupData.id,popup:m.storefrontPopupData.contentJson,dynamicData:{products:m.popupProducts},sfProps:{onModalClose:m.onModalClose,onCustomerSave:m.onCustomerFormDataSave,isCustomerLoggedIn:m.isCustomerLoggedIn,currentCountryCode:t.getInstance().currentCountryCode||void 0,addProductToCart:c},isMobile:l}):null}));export{a as default};
1
+ import{__awaiter as e,__generator as o}from'./../../../ext/tslib/tslib.es6.js';import*as r from"react";import{observer as p}from"mobx-react-lite";import d from"../../../hooks/useDimension.js";import{IkasBaseStore as s}from"../../../store/base.js";import"../../../store/customer/index.js";import"../../../store/cart/index.js";import{IkasStorefrontPopupDisplayTriggerTypeEnum as n}from"../../../models/data/storefront-popup/storefront-popup-display-settings/index.js";import{exitIntent as t}from"../utils/index.js";import{IkasStorefrontPopupRendererViewModel as i}from"./model.js";import"react-date-picker/dist/DatePicker.css";import u from'./../../../ext/@ikas/popup-renderer/build/popup-renderer/components/index.js';import'./../../../ext/@ikas/popup-renderer/build/ext/tslib/tslib.es6.mjs.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/PhoneNumberMatcher.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/AsYouTypeFormatter.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/ParseError.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/metadata.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/PhoneNumber.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/PhoneNumberMatcher.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/AsYouType.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/Metadata.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/findNumbers/isValidCandidate.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/index.es6.exports/PhoneNumberSearch.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/base/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/settings/index.js';import"mobx";import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/settings/visibility-condition/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/teaser/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/button/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/divider/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/checkbox/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-attribute/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-gender/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/image/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/image-column/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/product/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/product/detail-settings/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/social/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/space/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/text/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/background-settings/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/close-settings/index.js';var m=p((function(p){var m=p.storefrontPopup,l=r.useState((function(){return new i({},m)}))[0],a=d().isMobile;r.useEffect((function(){e(void 0,void 0,void 0,(function(){var e,r;return o(this,(function(o){switch(o.label){case 0:return[4,l.init()];case 1:if(o.sent(),!l.storefrontPopupData)return[2];if(!l.isModalClosedByUser){if((e=l.storefrontPopupData.displaySettings.triggerType)===n.SCROLL_DOWN)return window.addEventListener("scroll",l.handleScroll),[2,function(){window.removeEventListener("scroll",l.handleScroll)}];if(e===n.EXIT_INTENT)return r=t({onExitIntent:function(){l.openModal()}}),[2,function(){r()}]}return[2]}}))}))}),[]);var b=r.useCallback((function(r){return e(void 0,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,l.addProductToCart(r)];case 1:return[2,e.sent()]}}))}))}),[]);return l.storefrontPopupData&&l.storefrontPopupData.contentJson&&!l.isLoading?r.createElement(u,{key:l.storefrontPopupData.id,popup:l.storefrontPopupData.contentJson,dynamicData:{products:l.popupProducts},sfProps:{onModalClose:l.onModalClose,onCustomerSave:l.onCustomerFormDataSave,isCustomerLoggedIn:l.isCustomerLoggedIn,currentCountryCode:s.getInstance().currentCountryCode||void 0,addProductToCart:b},isMobile:a}):null}));export{m as default};
@@ -1 +1 @@
1
- import{__spreadArray as e,__awaiter as r,__generator as o,__assign as t}from'./../../../ext/tslib/tslib.es6.js';import{IkasStorefrontConfig as n}from"@ikas/storefront-config";import s from"lodash/throttle";import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/components/index.js';import{getPopupDynamicData as d}from'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/helpers/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/settings/index.js';import"mobx";import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/settings/visibility-condition/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/teaser/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/index.js';import{PopupElementTypeEnum as p}from'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/base/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/button/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/divider/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/checkbox/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-attribute/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-gender/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/image/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/image-column/index.js';import{ProductListTypeEnum as i,PopupProduct as a,MAX_PRODUCT_COUNT as u}from'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/product/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/product/detail-settings/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/social/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/space/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/text/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/background-settings/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/close-settings/index.js';import{SortByDirectionEnum as l}from"@ikas/storefront-api";import m from"../../../store/product/index.js";import{IkasBaseStore as c}from"../../../store/base.js";import"../../../store/customer/index.js";import"../../../store/cart/index.js";var f="ikas-storefront-popups",g=function(){var e=localStorage.getItem("ikas-storefront-popups");return e?JSON.parse(e):null},k=function(r){var o=g()||{},t=n.getSessionId();if(t){var s=o[t]?o[t]:[],d=r;o[t]=e(e([],s,!0),[d],!1),localStorage.setItem("ikas-storefront-popups",JSON.stringify(o))}},v=function(){var e=n.getSessionId(),r=g();r&&e&&!Object.keys(r).includes(e)&&localStorage.removeItem("ikas-storefront-popups")},b=function(e){var r=g();if(!r)return!1;var o=!1;return Object.keys(r).forEach((function(t){r[t].includes(e)&&(o=!0)})),o};function h(e,s,f,g){var k,v,b,h;return r(this,void 0,void 0,(function(){var r,g,x,I,_,j,E,P;return o(this,(function(y){switch(y.label){case 0:r={},g=[],x=[],e.modal.steps.forEach((function(e){e.elements.forEach((function(e){e.type===p.PRODUCT_LIST&&x.push(e)}))})),I=d(e),_=function(d){var p,x,_,j,E,P,y,S,T,L,C,D;return o(this,(function(o){switch(o.label){case 0:switch(p={input:{}},x=d.sortType.includes("ASC")?l.ASC:l.DESC,_=d.sortType.replace("ASC_","").replace("DESC_",""),j={direction:x,type:_},E=[],d.listType){case i.ALL:case i.LAST_VIEWED:return[3,1];case i.SPECIFIC:return[3,4];case i.CATEGORY:return[3,5]}return[3,6];case 1:return P=[],d.listType!==i.LAST_VIEWED?[3,3]:[4,c.getInstance().customerStore.getLastViewedProducts()];case 2:E=o.sent(),P=E.map((function(e){return e.productId})),o.label=3;case 3:return p.input={page:1,perPage:u,order:j?[j]:void 0,productIdList:P},[3,6];case 4:return(y=d.variantPairs||[]).length&&(S=y.map((function(e){return e.productId})),p.input={productIdList:S,page:1,perPage:u,order:j?[j]:void 0}),[3,6];case 5:return T=d.categoryId,p.input={categoryIdList:T?[T]:void 0,page:1,perPage:u,order:j?[j]:void 0},[3,6];case 6:return d.listType!==i.CATEGORY||(null===(k=p.input.categoryIdList)||void 0===k?void 0:k.length)?[4,m.searchProducts({input:t(t({},p.input),{priceListId:n.getPriceListId(),salesChannelId:n.getSalesChannelId()})})]:[2,"continue"];case 7:return(L=o.sent())&&L.isSuccess&&(null===(b=null===(v=L.data)||void 0===v?void 0:v.data)||void 0===b?void 0:b.length)&&(null==(C=null===(h=L.data)||void 0===h?void 0:h.data)?void 0:C.length)&&(D=[],C.forEach((function(r){var o,t,n;if(d.listType===i.SPECIFIC){var p=I.variantPairs.filter((function(e){return e.productListElementId===d.id}));(c=r.variants.find((function(e){return p.some((function(o){return o.productId===r.id&&o.variantId===e.id}))})))&&(n=[c])}else if(d.listType===i.LAST_VIEWED&&E.length){var u=E.find((function(e){return e.productId===r.id}));if(u)(c=r.variants.find((function(e){return e.id===u.variantId})))&&(n=[c])}else n=(null==r?void 0:r.variants[0])?[r.variants[0]]:[];for(var l=0,m=n||[];l<m.length;l++){var c;if((c=m[l])&&r){var k=(null===(o=c.images)||void 0===o?void 0:o.length)?c.images[0]:null;D.push(new a({productId:r.id,variantId:c.id,name:r.name,price:c.formattedSellPrice,discountPrice:c.hasDiscount?c.formattedDiscountPrice:null,discountRatio:c.discountPercentage?c.discountPercentage:null,imageURL:k?"".concat(s,"images/").concat(f,"/").concat(k.imageId):null,url:"".concat(e.storeUrl,"/").concat(null===(t=r.metaData)||void 0===t?void 0:t.slug)})),g.find((function(e){return e.id===r.id}))||g.push(r)}}})),r[d.id]=D),[2]}}))},j=0,E=x,y.label=1;case 1:return j<E.length?(P=E[j],[5,_(P)]):[3,4];case 2:y.sent(),y.label=3;case 3:return j++,[3,1];case 4:return[2,{totalProducts:r,ikasProducts:g}]}}))}))}var x=function(e){var r,o,n,d,p,i;return void 0===e&&(e={}),n=t(t({},{threshold:20,maxDisplays:1,eventThrottle:200,onExitIntent:function(){}}),e),d=new Map,p=0,i=function(){d.forEach((function(e,r,o){return function(e){var r=d.get(e),o=r.eventName,t=r.callback;document.removeEventListener(o,t),d.delete(e)}(r)}))},r="mousemove",o=s((function(e){e.clientY<=n.threshold&&p<n.maxDisplays&&(p++,1)&&(n.onExitIntent(),p>=n.maxDisplays&&i())}),n.eventThrottle),document.addEventListener(r,o,!1),d.set("document:".concat(r),{eventName:r,callback:o}),i};export{f as SESSION_POPUPS_KEY,k as addPopupToLocalStorage,b as checkIsPopupSavedToLocalStorage,v as checkSavedSessionForPopups,x as exitIntent,h as getPopupProducts,g as getPopupsFromLocalStorage};
1
+ import{__spreadArray as e,__awaiter as r,__generator as o,__assign as t}from'./../../../ext/tslib/tslib.es6.js';import{IkasStorefrontConfig as n}from"@ikas/storefront-config";import d from"lodash/throttle";import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/components/index.js';import{getPopupDynamicData as s}from'./../../../ext/@ikas/popup-renderer/build/popup-renderer/helpers/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/settings/index.js';import"mobx";import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/settings/visibility-condition/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/teaser/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/index.js';import{PopupElementTypeEnum as i}from'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/base/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/button/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/divider/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/checkbox/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-attribute/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-gender/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/image/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/image-column/index.js';import{ProductListTypeEnum as p,PopupProduct as u,MAX_PRODUCT_COUNT as a}from'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/product/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/product/detail-settings/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/social/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/space/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/text/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/background-settings/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/close-settings/index.js';import{SortByDirectionEnum as l}from"@ikas/storefront-api";import m from"../../../store/product/index.js";import{IkasBaseStore as c}from"../../../store/base.js";import"../../../store/customer/index.js";import"../../../store/cart/index.js";var f="ikas-storefront-popups",v=function(){var e=localStorage.getItem("ikas-storefront-popups");return e?JSON.parse(e):null},g=function(r){var o=v()||{},t=n.getSessionId();if(t){var d=o[t]?o[t]:[],s=r;o[t]=e(e([],d,!0),[s],!1),localStorage.setItem("ikas-storefront-popups",JSON.stringify(o))}},b=function(){var e=n.getSessionId(),r=v();r&&e&&!Object.keys(r).includes(e)&&localStorage.removeItem("ikas-storefront-popups")},k=function(e){var r=v();if(!r)return!1;var o=!1;return Object.keys(r).forEach((function(t){r[t].includes(e)&&(o=!0)})),o};function h(e,d,f,v){var g,b,k,h;return r(this,void 0,void 0,(function(){var r,v,x,I,_,j,E,P;return o(this,(function(y){switch(y.label){case 0:r={},v=[],x=[],e.modal.steps.forEach((function(e){e.elements.forEach((function(e){e.type===i.PRODUCT_LIST&&x.push(e)}))})),I=s(e),_=function(s){var i,x,_,j,E,P,y,S,T,L,C,D;return o(this,(function(o){switch(o.label){case 0:switch(i={input:{}},x=s.sortType.includes("ASC")?l.ASC:l.DESC,_=s.sortType.replace("ASC_","").replace("DESC_",""),j={direction:x,type:_},E=[],s.listType){case p.ALL:case p.LAST_VIEWED:return[3,1];case p.SPECIFIC:return[3,4];case p.CATEGORY:return[3,5]}return[3,6];case 1:return P=[],s.listType!==p.LAST_VIEWED?[3,3]:[4,c.getInstance().customerStore.getLastViewedProducts()];case 2:E=o.sent(),P=E.map((function(e){return e.productId})),o.label=3;case 3:return i.input={page:1,perPage:a,order:j?[j]:void 0,productIdList:P},[3,6];case 4:return(y=s.variantPairs||[]).length&&(S=y.map((function(e){return e.productId})),i.input={productIdList:S,page:1,perPage:a,order:j?[j]:void 0}),[3,6];case 5:return T=s.categoryId,i.input={categoryIdList:T?[T]:void 0,page:1,perPage:a,order:j?[j]:void 0},[3,6];case 6:return s.listType!==p.CATEGORY||(null===(g=i.input.categoryIdList)||void 0===g?void 0:g.length)?[4,m.searchProducts({input:t(t({},i.input),{priceListId:n.getPriceListId(),salesChannelId:n.getSalesChannelId()})})]:[2,"continue"];case 7:return(L=o.sent())&&L.isSuccess&&(null===(k=null===(b=L.data)||void 0===b?void 0:b.data)||void 0===k?void 0:k.length)&&(null==(C=null===(h=L.data)||void 0===h?void 0:h.data)?void 0:C.length)&&(D=[],C.forEach((function(r){var o,t,n;if(s.listType===p.SPECIFIC){var i=I.variantPairs.filter((function(e){return e.productListElementId===s.id}));(c=r.variants.find((function(e){return i.some((function(o){return o.productId===r.id&&o.variantId===e.id}))})))&&(n=[c])}else if(s.listType===p.LAST_VIEWED&&E.length){var a=E.find((function(e){return e.productId===r.id}));if(a)(c=r.variants.find((function(e){return e.id===a.variantId})))&&(n=[c])}else n=(null==r?void 0:r.variants[0])?[r.variants[0]]:[];for(var l=0,m=n||[];l<m.length;l++){var c;if((c=m[l])&&r){var g=(null===(o=c.images)||void 0===o?void 0:o.length)?c.images[0]:null;D.push(new u({productId:r.id,variantId:c.id,name:r.name,price:c.formattedSellPrice,discountPrice:c.hasDiscount?c.formattedDiscountPrice:null,discountRatio:c.discountPercentage?c.discountPercentage:null,imageURL:g?"".concat(d,"images/").concat(f,"/").concat(g.imageId):null,url:"".concat(e.storeUrl,"/").concat(null===(t=r.metaData)||void 0===t?void 0:t.slug)})),v.find((function(e){return e.id===r.id}))||v.push(r)}}})),r[s.id]=D),[2]}}))},j=0,E=x,y.label=1;case 1:return j<E.length?(P=E[j],[5,_(P)]):[3,4];case 2:y.sent(),y.label=3;case 3:return j++,[3,1];case 4:return[2,{totalProducts:r,ikasProducts:v}]}}))}))}var x=function(e){var r,o,n,s,i,p;return void 0===e&&(e={}),n=t(t({},{threshold:20,maxDisplays:1,eventThrottle:200,onExitIntent:function(){}}),e),s=new Map,i=0,p=function(){s.forEach((function(e,r,o){return function(e){var r=s.get(e),o=r.eventName,t=r.callback;document.removeEventListener(o,t),s.delete(e)}(r)}))},r="mousemove",o=d((function(e){e.clientY<=n.threshold&&i<n.maxDisplays&&(i++,1)&&(n.onExitIntent(),i>=n.maxDisplays&&p())}),n.eventThrottle),document.addEventListener(r,o,!1),s.set("document:".concat(r),{eventName:r,callback:o}),p};export{f as SESSION_POPUPS_KEY,g as addPopupToLocalStorage,k as checkIsPopupSavedToLocalStorage,b as checkSavedSessionForPopups,x as exitIntent,h as getPopupProducts,v as getPopupsFromLocalStorage};
@@ -0,0 +1 @@
1
+ import{__assign as t}from"../../../ext/tslib/tslib.es6.mjs.js";import e from"react";import{observer as n}from"../../../../../../mobx-react/dist/mobxreact.esm.js";import{ButtonActionTypeEnum as o}from"../../models/modal/step/elements/button/index.js";import{getHorizontalAlignment as r,injectFontScript as i}from"../../helpers/index.js";var a=n((function(n){var a=n.element,c=n.isStandaloneButtonComponent,l=n.onClose,s=n.disableButtonAction,d=e.useRef(null),u=a,m={display:"flex",alignItems:"center",justifyContent:r(u.horizontalAlignment),padding:"".concat(u.outerVerticalPadding,"px ").concat(u.outerHorizontalPadding,"px"),backgroundColor:u.bgColor},f={color:u.color,backgroundColor:u.buttonBgColor,fontSize:u.fontSize,fontWeight:u.fontWeight,fontFamily:i(u.fontFamily),textAlign:"center",border:"".concat(u.borderWidth,"px ").concat(u.borderStyle," ").concat(u.borderColor),borderRadius:u.borderRadius,padding:"".concat(u.verticalPadding,"px ").concat(u.horizontalPadding,"px")},p={width:"".concat(u.width,"%"),minWidth:"fit-content",cursor:"pointer"},b=e.useCallback((function(){if(d.current&&!s){var t=u.link||void 0;if(!c&&t)d.current.href=t||"",d.current.click();else switch(u.actionType){case o.NAVIGATE_TO_LINK_AND_CLOSE:d.current.href=t||"",null==l||l(!0),d.current.click();break;case o.NAVIGATE_TO_LINK:d.current.href=t||"",d.current.click();break;case o.CLOSE:null==l||l(!0)}}}),[d,d.current]);return e.createElement("div",{style:m},e.createElement("a",{onClick:b,style:p,target:u.openLinkInNewWindow?"_blank":"_self",ref:d},e.createElement("div",{dangerouslySetInnerHTML:{__html:u.text},style:t({},f)})))}));export{a as default};
@@ -0,0 +1 @@
1
+ import t from"react";import{observer as o}from"../../../../../../mobx-react/dist/mobxreact.esm.js";import{getHorizontalAlignment as e}from"../../helpers/index.js";import{ButtonBorderStyle as r}from"../../models/modal/background-settings/index.js";var d=o((function(o){var d=o.element,a={display:"flex",alignItems:"center",justifyContent:e(d.horizontalAlignment),padding:"".concat(d.verticalPadding,"px ").concat(d.horizontalPadding,"px"),backgroundColor:d.bgColor,width:"100%"},n=d.borderStyle===r.SOLID?"solid":d.borderStyle===r.DASHED?"dashed":"dotted",i={width:"".concat(d.width,"%"),height:"".concat(d.borderWidth,"px"),borderRadius:"".concat(d.borderRadius,"px"),borderBottom:"".concat(d.borderWidth,"px ").concat(n," ").concat(d.borderColor)};return t.createElement("div",{style:a},t.createElement("div",{style:i}))}));export{d as default};
@@ -0,0 +1 @@
1
+ import e from"react";import{observer as t}from"../../../../../../../mobx-react/dist/mobxreact.esm.js";var r=t((function(t){var r=t.checkboxItem;e.useEffect((function(){r.showInCheckedStatus?r.isChecked=!0:r.isChecked=!1}),[r.showInCheckedStatus]);var i=r.requiredToBeChecked,o=e.useCallback((function(){var e=/<pre[^>]*>([\s\S]*?)<\/pre>/.exec(r.text);return e?e[1]:r.text}),[r.text]);return e.createElement("div",{style:{width:"100%",display:"flex",gap:6,flexDirection:"column"}},e.createElement("div",{style:{width:"100%",display:"flex",gap:8,flexDirection:"row",alignItems:"baseline",wordBreak:"break-word"}},e.createElement("input",{style:{width:"16px",height:"16px",cursor:"pointer",position:"relative",top:3},type:"checkbox",checked:r.isChecked,onChange:function(){r.isChecked=!r.isChecked,i&&i.hasError&&r.isChecked&&(i.hasError=!1)}}),e.createElement("div",{dangerouslySetInnerHTML:{__html:o()}})),!!i&&i.hasError&&e.createElement("div",{style:{color:"red",fontSize:"12px"}},i.validationErrorMessage))}));export{r as CheckboxItemView};
@@ -0,0 +1 @@
1
+ import e from"react";import{observer as r}from"../../../../../../../mobx-react/dist/mobxreact.esm.js";import t from"react-date-picker";var a=r((function(r){var a=e.useState(!1),o=a[0],l=a[1],n=e.useRef(null);r.placeholder;var c=r.isRequired,i=r.inputLabel;r.updateCurrentInfo;var s=r.formInputSettings,u=r.value,d=r.onValueChange;return e.useEffect((function(){if(n.current){var e=n.current.getElementsByClassName("react-date-picker__wrapper");if(e.length>0){var r=e[0];r.style.backgroundColor=s.bgColor,r.style.border="".concat(s.borderWidth,"px solid ").concat(o?s.focusBorderColor:s.borderColor),r.style.borderRadius="".concat(s.borderRadius,"px"),r.style.fontSize="14px",r.style.padding="10px 12px",r.style.height="".concat(s.height,"px")}}}),[n.current]),e.createElement("div",{style:{width:"100%",display:"flex",gap:2,flexDirection:"column"},ref:n},(i||c)&&e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:4,marginBottom:"6px"}},e.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"}},i&&e.createElement("label",{style:{color:"black",fontSize:"14px"}},i.text),c&&e.createElement("label",{style:{color:"black",fontSize:"14px"}},"*")),c&&c.hasError&&e.createElement("div",{style:{color:"red",fontSize:"12px"}},c.validationErrorMessage)),e.createElement(t,{onChange:function(e){return function(e){var r=e?e.valueOf().toString():"";d(r),c&&c.hasError&&r.length>0&&(c.hasError=!1)}(e)},value:u?new Date(Number(u)):null,className:"ikas-popup-datepicker",disableCalendar:!0,format:"dd / MM / yyyy",maxDate:new Date,clearIcon:null,onFocus:function(){return l(!0)},onBlur:function(){return function(){if(l(!1),n.current){var e=n.current.getElementsByClassName("react-date-picker__wrapper");e.length>0&&(e[0].style.border="".concat(s.borderWidth,"px solid ").concat(s.borderColor))}}()}}))}));export{a as default};
@@ -0,0 +1 @@
1
+ import e from"react";import{observer as r}from"../../../../../../../mobx-react/dist/mobxreact.esm.js";var t=r((function(r){var t,o=e.useState(!1),n=o[0],i=o[1],l=r.genderFormItem,a=r.formInputSettings;r.onValueChange;var d={width:"100%",backgroundColor:a.bgColor,border:"".concat(a.borderWidth,"px solid ").concat(n?a.focusBorderColor:a.borderColor),color:l.genders.find((function(e){return e.isSelected}))?"black":"#697586",borderRadius:"".concat(a.borderRadius,"px"),fontSize:"14px",padding:"10px 12px",height:"".concat(a.height,"px"),appearance:"none",backgroundImage:"url(\"data:image/svg+xml, %3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='currentColor' strokeWidth='2' strokeLinecap='round' strokeLinejoin='round' %3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E\")",backgroundRepeat:"no-repeat",backgroundPosition:"right 12px center",backgroundSize:"20px",cursor:"pointer"};return e.createElement("div",{style:{width:"100%",display:"flex",gap:2,flexDirection:"column"}},(l.inputLabel||l.required)&&e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:4,marginBottom:"6px"}},e.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"}},l.inputLabel&&e.createElement("label",{style:{color:"black",fontSize:"14px"}},l.inputLabel.text),l.required&&e.createElement("label",{style:{color:"black",fontSize:"14px"}},"*")),l.required&&l.required.hasError&&e.createElement("div",{style:{color:"red",fontSize:"12px"}},l.required.validationErrorMessage)),e.createElement("select",{value:(null===(t=l.genders.find((function(e){return e.isSelected})))||void 0===t?void 0:t.type)||void 0,onChange:function(e){return r=e.target.value,l.genders.forEach((function(e){e.isSelected=e.type===r})),void(l.required&&l.required.hasError&&(l.required.hasError=!1));var r},style:d,onFocus:function(){return i(!0)},onBlur:function(){return i(!1)}},!!l.placeholder&&e.createElement("option",{value:"",disabled:!0,selected:!0,hidden:!0},l.placeholder.text),l.genders.filter((function(e){return!!e.label})).map((function(r){return e.createElement("option",{key:r.type,value:r.type},r.label)}))))}));export{t as default};
@@ -0,0 +1 @@
1
+ import{__awaiter as e,__generator as r}from"../../../ext/tslib/tslib.es6.mjs.js";import t from"react";import{observer as n}from"../../../../../../mobx-react/dist/mobxreact.esm.js";import{getHorizontalAlignment as a,injectFontScript as o,validateEmail as i,validatePhoneNumber as l}from"../../helpers/index.js";import{FormItemTypeEnum as s}from"../../models/modal/step/elements/form/index.js";import u from"../button-element-renderer/index.js";import m from"./input-item-view/index.js";import{CheckboxItemView as c}from"./checkbox-item-view/index.js";import d from"./date-item-view/index.js";import f from"./gender-item-view/index.js";var E=n((function(n){var E=n.element,p=n.popup,v=n.isPreviewMode,C=n.sfProps,I=t.useState(!1);I[0];var h=I[1],M=E,S=M.rows.slice().sort((function(e,r){return e.order-r.order})),g=M.formSettings,R=M.buttonSettings,O=M.bgColor,_={display:"flex",flexDirection:"column",justifyContent:a(M.horizontalAlignment),gap:"".concat(g.gapBetweenItems,"px"),padding:"".concat(M.outerVerticalPadding,"px ").concat(M.outerHorizontalPadding,"px"),backgroundColor:O,width:"100%"},T={display:"flex",flexDirection:"row",width:"100%",gap:"".concat(g.gapBetweenItems,"px")},b={flex:1,display:"flex",alignItems:"flex-end",fontFamily:o(g.fontFamily),fontSize:g.fontSize},U=function(){return e(void 0,void 0,void 0,(function(){var e,t,n;return r(this,(function(r){switch(r.label){case 0:return e=p.modal.steps.findIndex((function(e){return e.id===p.modal.selectedStep.id})),t=e===p.modal.steps.length-2,!v&&C&&t?(h(!0),a=0,M.rows.forEach((function(e){e.columns.forEach((function(e){switch(e.type){case s.CUSTOMER_BIRTHDAY:var r=e.formItem;r.required&&!r.value&&(r.required.hasError=!0,a++);break;case s.CUSTOMER_EMAIL:case s.CUSTOMER_PHONE:case s.CUSTOMER_NAME:case s.CUSTOMER_SURNAME:var t=e.formItem;if(t.required&&!t.value){if(t.type===s.CUSTOMER_EMAIL&&(null==C?void 0:C.isCustomerLoggedIn))return;t.required.hasError=!0,a++}else if(e.type===s.CUSTOMER_EMAIL){var n=i(t.value||"");t.validEmailError.hasError=!n,n||a++}else if(e.type===s.CUSTOMER_PHONE){var o=l(t.value||"",null==C?void 0:C.currentCountryCode);t.validPhoneError.hasError=!o,o||a++}break;case s.CUSTOMER_GENDER:var u=e.formItem,m=u.genders.find((function(e){return e.isSelected}));u.required&&!m&&(u.required.hasError=!0,a++);break;case s.CHECKBOX_FORM_ITEM:var c=e.formItem;c.requiredToBeChecked&&!c.isChecked&&(c.requiredToBeChecked.hasError=!0,a++)}}))})),a>0?(h(!1),[2]):(n={},M.rows.forEach((function(e){e.columns.forEach((function(e){var r;switch(e.type){case s.CUSTOMER_BIRTHDAY:n.birthday=e.formItem.value;break;case s.CUSTOMER_EMAIL:n.email=e.formItem.value;break;case s.CUSTOMER_GENDER:n.gender=(null===(r=e.formItem.genders.find((function(e){return e.isSelected})))||void 0===r?void 0:r.type)||"";break;case s.CUSTOMER_PHONE:n.phone=e.formItem.value;break;case s.CUSTOMER_NAME:n.firstName=e.formItem.value||"";break;case s.CUSTOMER_SURNAME:n.lastName=e.formItem.value||"";break;case s.CHECKBOX_FORM_ITEM:n.hasPermission=e.formItem.isChecked}}))})),[4,C.onCustomerSave(n)])):[3,2];case 1:r.sent(),h(!1),r.label=2;case 2:return-1!==e&&e<p.modal.steps.length&&(p.modal.selectedStep=p.modal.steps[e+1]),[2]}var a}))}))};return t.createElement("div",{style:_},S.map((function(e,r){return t.createElement("div",{style:T,key:r},e.columns.slice().sort((function(e,r){return e.order-r.order})).map((function(e,r){return t.createElement("div",{style:b,key:r},function(e){switch(e.type){case s.CUSTOMER_EMAIL:case s.CUSTOMER_PHONE:case s.CUSTOMER_NAME:case s.CUSTOMER_SURNAME:var r=e.formItem;if(r.type===s.CUSTOMER_EMAIL&&(null==C?void 0:C.isCustomerLoggedIn)&&!v)return null;var n=null;if(e.type===s.CUSTOMER_EMAIL){var a=r;a.validEmailError.hasError&&(n=a.validEmailError.validationErrorMessage)}else if(e.type===s.CUSTOMER_PHONE){var o=r;o.validPhoneError.hasError&&(n=o.validPhoneError.validationErrorMessage)}return t.createElement(m,{formInputSettings:g.formInputSettings,inputLabel:r.inputLabel,isRequired:r.required,onValueChange:function(e){return v?null:r.value=e},placeholder:r.placeholder,updateCurrentInfo:r.updateCurrentInfo,value:r.value||"",validationErrorMessage:n});case s.CUSTOMER_BIRTHDAY:var i=e.formItem;return t.createElement(d,{formInputSettings:g.formInputSettings,inputLabel:i.inputLabel,isRequired:i.required,onValueChange:function(e){return v?null:i.value=e},placeholder:i.placeholder,updateCurrentInfo:i.updateCurrentInfo,value:i.value||""});case s.CUSTOMER_GENDER:var l=e.formItem;return t.createElement(f,{genderFormItem:l,formInputSettings:g.formInputSettings,onValueChange:function(e){return v?null:l.genders.forEach((function(r){r.isSelected=r.label===e}))}});case s.CHECKBOX_FORM_ITEM:return t.createElement(c,{checkboxItem:e.formItem})}}(e))})))})),t.createElement("div",{style:{width:"100%",minWidth:"fit-content"},onClick:function(e){U(),e.preventDefault(),e.stopPropagation()}},t.createElement(u,{element:R})," "))}));export{E as default};
@@ -0,0 +1 @@
1
+ import e from"react";import{observer as t}from"../../../../../../../mobx-react/dist/mobxreact.esm.js";var r=t((function(t){var r=e.useState(!1),o=r[0],n=r[1];e.useRef(null);var l=t.placeholder,a=t.isRequired,i=t.inputLabel;t.updateCurrentInfo;var c=t.validationErrorMessage,d=t.formInputSettings,u=t.value,s=t.onValueChange,p={width:"100%",backgroundColor:d.bgColor?"".concat(d.bgColor):"transparent",border:"".concat(d.borderWidth,"px solid ").concat(o?d.focusBorderColor:d.borderColor),borderRadius:"".concat(d.borderRadius,"px"),fontSize:"14px",padding:"10px 12px",height:"".concat(d.height,"px"),outline:"none"},x=a?((null==l?void 0:l.text)||"")+" *":(null==l?void 0:l.text)||"";return e.createElement("div",{style:{width:"100%",display:"flex",gap:2,flexDirection:"column"}},(i||a)&&e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:4,marginBottom:"6px"}},e.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"}},i&&e.createElement("label",{style:{color:"black",fontSize:"14px"}},i.text)),a&&a.hasError&&e.createElement("div",{style:{color:"red",fontSize:"12px"}},a.validationErrorMessage),!!c&&e.createElement("div",{style:{color:"red",fontSize:"12px"}},c)),e.createElement("input",{type:"text",placeholder:x,value:u||"",onChange:function(e){return function(e){s(e),a&&a.hasError&&e.length>0&&(a.hasError=!1)}(e.target.value)},style:p,onFocus:function(){return n(!0)},onBlur:function(){return n(!1)}}))}));export{r as default};
@@ -0,0 +1 @@
1
+ import e from"react";import{observer as t}from"../../../../../../mobx-react/dist/mobxreact.esm.js";import{ImageFitEnum as r}from"../../models/modal/step/elements/image/index.js";var i=t((function(t){var i=t.element,a=t.popup,o=t.editModeChildren,d=t.isMobile,n=i;n.cdnURL||(n.cdnURL=a.cdnURL),n.merchantId||(n.merchantId=a.merchantId);var c=a.modal.windowSettings,m={width:c.takeFullWidth||d?"100%":c.maxWidth,backgroundColor:n.bgColor,padding:"".concat(n.verticalPadding,"px ").concat(n.horizontalPadding,"px"),borderRadius:n.borderRadius};if(!n.src&&a.isPreviewMode&&o)return e.createElement("div",{style:m},o);var l={objectFit:n.objectFit===r.CONTAIN?"contain":"cover",height:"100%"};return e.createElement("a",{href:n.link||void 0,style:m,target:"_blank"},n.src&&e.createElement("img",{src:n.src||void 0,width:"100% !important",style:l}))}));export{i as default};
@@ -0,0 +1 @@
1
+ import e from"react";import{observer as t}from"../../../../../../mobx-react/dist/mobxreact.esm.js";import{ImagePositionEnum as i,ImageFitEnum as a}from"../../models/modal/step/elements/image/index.js";var o=t((function(t){var o=t.element,r=t.popup,n=t.editModeChildren,d=o;if(d.cdnURL||(d.cdnURL=r.cdnURL),d.merchantId||(d.merchantId=r.merchantId),!d.src&&r.isPreviewMode&&n)return n;var c={display:"flex",alignItems:"center",justifyContent:d.imagePosition===i.DISABLE_FLOAT?"center":d.imagePosition===i.FLOAT_LEFT?"flex-start":"flex-end",padding:"".concat(d.verticalPadding,"px ").concat(d.horizontalPadding,"px"),backgroundColor:d.bgColor,maxWidth:"100%"},m={borderRadius:"".concat(d.borderRadius,"px"),objectFit:d.objectFit===a.CONTAIN?"contain":"cover",width:"".concat(d.maxWidth,"%")};return e.createElement("a",{href:d.link||void 0,style:c,target:"_blank"},e.createElement("img",{src:d.src||void 0,width:100===d.maxWidth?"100% !important":void 0,style:m}))}));export{o as default};
@@ -0,0 +1 @@
1
+ import e from"react";import{observer as t}from"../../../../../mobx-react/dist/mobxreact.esm.js";import{PopupTypeEnum as o,PopupPositonEnum as n}from"../models/modal/index.js";import i from"../assets/x-close.js";import{CloseButtonPositionTypeEnum as r,CloseIconTypeEnum as l,CloseButtonDisplayTypeEnum as s}from"../models/modal/close-settings/index.js";import{PopupElementTypeEnum as a,ComponentVerticalAlignmentEnum as d}from"../models/modal/step/elements/base/index.js";import c from"./text-element-renderer/index.js";import m from"./button-element-renderer/index.js";import p from"./space-element-renderer/index.js";import u from"./divider-element-renderer/index.js";import f from"./social-element-renderer/index.js";import P from"./image-element-renderer/index.js";import E from"./image-column-element-renderer/index.js";import x from"./product-list-renderer/index.js";import g from"./form-element-renderer/index.js";import{ImageColumnPositionEnum as v,MobileImageColumnPositionEnum as T}from"../models/modal/step/elements/image-column/index.js";var y=t((function(t){var y,b,C,O,I=t.popup,_=t.dynamicData,h=t.dashboardComponents,M=t.previewMode,w=t.sfProps,A=t.isMobile,D=I.modal,S=D.teaser,R=!!D.selectedStep.isTeaser,k=D.selectedStep.elements.find((function(e){return e.type===a.IMAGE_COLUMN})),N=R?S.backgroundSettings:D.backgroundSettings,j=R?S.windowSettings:D.windowSettings,B=R?S.closeSettings:D.closeSettings,L=N.allowScrollingWhenPopupOpen,U=I.isPreviewMode||M,H=!!U||D.isVisible;document.body.style.overflow=H&&!L?"hidden":"auto";var W=N.overlay,F=N.border,V="center",G="center";switch(R?o.POPUP:D.type){case o.POPUP:var z=R?S.position:D.position;z===n.POPUP_TOP_LEFT?(V="flex-start",G="flex-start"):z===n.POPUP_TOP_CENTER?(V="center",G="flex-start"):z===n.POPUP_TOP_RIGHT?(V="flex-end",G="flex-start"):z===n.POPUP_MIDDLE_LEFT?(V="flex-start",G="center"):z===n.POPUP_MIDDLE_CENTER?(V="center",G="center"):z===n.POPUP_MIDDLE_RIGHT?(V="flex-end",G="center"):z===n.POPUP_BOTTOM_LEFT?(V="flex-start",G="flex-end"):z===n.POPUP_BOTTOM_CENTER?(V="center",G="flex-end"):z===n.POPUP_BOTTOM_RIGHT&&(V="flex-end",G="flex-end");break;case o.DRAWER:D.position===n.DRAWER_LEFT?(V="flex-start",G="center"):D.position===n.DRAWER_RIGHT&&(V="flex-end",G="center");break;case o.NOTIFICATION_BAR:D.position===n.NOTIFICATION_BAR_UP?(V="center",G="flex-start"):D.position===n.NOTIFICATION_BAR_DOWN&&(V="center",G="flex-end")}var K=e.useMemo((function(){return 2147483644}),[]),X=e.useMemo((function(){return K+1}),[]),Y=e.useMemo((function(){return X+1}),[]),q=e.useMemo((function(){return Y+1}),[]),J={position:"fixed",display:"flex",justifyContent:V,alignItems:G,top:0,left:0,right:0,bottom:0,zIndex:K,overflow:"hidden",padding:"".concat(j.outerVerticalPadding,"px ").concat(j.outerHorizontalPadding,"px"),opacity:H?1:0,visibility:H?"visible":"hidden",transition:"opacity 0.3s ease, visibility 0.3s ease"},Q={position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:X,backgroundColor:W?W.bgColor:"",opacity:W?(W.bgOpacity||100)/100:void 0},Z={position:"relative",zIndex:Y,backgroundColor:N.bgColor,border:F?"".concat(F.borderWidth,"px ").concat(F.borderStyle," ").concat(F.borderColor):"",borderRadius:"".concat(j.borderRadius,"px"),maxWidth:"100%",maxHeight:"100%",width:j.takeFullWidth?"100%":void 0,minHeight:j.minHeight,height:j.takeFullHeight?"100%":void 0,boxShadow:N.shadow?"0 0 10px ".concat(N.shadow.color):"",overflow:"auto",opacity:H?1:0,visibility:H?"visible":"hidden",transition:"opacity 0.3s ease, visibility 0.3s ease"},$="";switch(null==k?void 0:k.verticalAlignment){case d.BOTTOM:$="flex-end";break;case d.MIDDLE:$="center";break;case d.TOP:$="flex-start"}var ee=k?k.imagePosition===v.LEFT_ALIGN?"row-reverse":"row":"",te=k?k.mobilePosition===T.TOP?"column-reverse":"column":"",oe={display:"flex",flexDirection:k?A?te:ee:"column",overflow:"hidden"},ne={width:j.takeFullWidth?"100%":j.maxWidth,maxWidth:"100%",overflow:"auto",display:"flex",flexDirection:"column",justifyContent:$,padding:"".concat(j.innerVerticalPadding,"px ").concat(j.innerHorizontalPadding,"px")},ie={position:B.closeButtonPositionType===r.TAKE_SPACE?"relative":"absolute",float:B.closeButtonPositionType===r.TAKE_SPACE?"right":"none",top:8,right:8,zIndex:q},re={position:"sticky",padding:"6px",marginLeft:B.closeButtonPositionType===r.TAKE_SPACE?"14px":void 0,display:"flex",justifyContent:"center",alignItems:"center",border:(null===(y=B.iconSettings)||void 0===y?void 0:y.type)===l.WITH_BORDER?"1px solid ".concat(null===(b=B.iconSettings)||void 0===b?void 0:b.color):"",borderRadius:"50%",backgroundColor:null===(C=B.iconSettings)||void 0===C?void 0:C.backgroundColor},le={color:null===(O=B.iconSettings)||void 0===O?void 0:O.color,cursor:"pointer"},se=function(t){var o=t.type,n=h&&h[o]&&h[o].length?h[o][0]:null,i=n&&I.marketingPopupViewModel?e.createElement(n,{element:t,marketingPopupViewModel:I.marketingPopupViewModel}):void 0;switch(o){case a.TEXT:return e.createElement(c,{element:t});case a.IMAGE:return e.createElement(P,{element:t,popup:I,editModeChildren:i});case a.IMAGE_COLUMN:return A&&k.mobilePosition===T.HIDE?null:e.createElement(E,{element:t,popup:I,editModeChildren:i,isMobile:A});case a.BUTTON:return e.createElement(m,{element:t,onClose:ae,isStandaloneButtonComponent:!0});case a.DIVIDER:return e.createElement(u,{element:t});case a.FORM:return e.createElement(g,{element:t,popup:I,isPreviewMode:!!U,sfProps:w});case a.PRODUCT_LIST:return e.createElement(x,{element:t,products:_.products[t.id],popup:I,editModeChildren:i,isPreviewMode:!!U,sfProps:w,onClose:ae});case a.SOCIAL_MEDIA:return e.createElement(f,{element:t,popup:I,editModeChildren:i});case a.SPACE:return e.createElement(p,{element:t})}},ae=function(e){U||D.isVisible&&(D.isVisible=!1,w&&w.onModalClose(e))};return e.createElement("div",{className:"ikas-popup-default-styles",id:"ikas-popup-container",style:J},e.createElement("div",{style:Z},B.closeButtonDisplayType!==s.ALWAYS_HIDDEN&&e.createElement("div",{style:ie,onClick:function(){return ae()}},e.createElement("div",{style:re,className:B.closeButtonDisplayType===s.VISIBLE_ON_HOVER?"visible-on-hover":""},e.createElement(i,{style:le}))),e.createElement("div",{style:oe,onClick:function(e){R&&(D.selectedStep=D.steps[0])}},e.createElement("div",{style:ne},D.selectedStep.elements.filter((function(e){return e.type!==a.IMAGE_COLUMN})).slice().sort((function(e,t){return e.order-t.order})).map((function(e){return se(e)}))),k&&se(k))),e.createElement("div",{style:Q,onClick:function(){return ae()}}))}));export{y as default};
@@ -0,0 +1 @@
1
+ import{__spreadArray as t,__assign as e,__awaiter as o,__generator as n}from"../../../ext/tslib/tslib.es6.mjs.js";import i from"react";import{observer as l}from"../../../../../../mobx-react/dist/mobxreact.esm.js";import{getHorizontalAlignment as r,injectFontScript as a}from"../../helpers/index.js";import{ProductListTypeEnum as d,ProductListLayoutEnum as c}from"../../models/modal/step/elements/product/index.js";import s from"../button-element-renderer/index.js";import u from"../../../../../../swiper/modules/navigation.mjs.js";import m from"../../../../../../swiper/modules/scrollbar.mjs.js";import{Swiper as p,SwiperSlide as v}from"../../../../../../swiper/swiper-react.mjs.js";import g from"../../assets/left-arrow.js";import f from"../../assets/right-arrow.js";import{ProductActionTypeEnum as b}from"../../models/modal/step/elements/product/detail-settings/index.js";import{ComponentHorizontalAlignmentEnum as x}from"../../models/modal/step/elements/base/index.js";var h=l((function(l){var h,y=l.element,E=l.products,P=l.popup,w=l.editModeChildren,C=l.isPreviewMode,S=l.sfProps,z=l.onClose,j=i.useState(null),R=j[0],A=j[1],D=i.useState(!1),I=D[0],W=D[1],_=i.useState(!1),F=_[0],T=_[1],k=y,L=[];if(E&&(L=k.listType===d.SPECIFIC?(null===(h=k.variantPairs)||void 0===h?void 0:h.length)?E.slice().sort((function(t,e){return k.variantPairs.findIndex((function(e){return e.variantId===t.variantId}))-k.variantPairs.findIndex((function(t){return t.variantId===e.variantId}))})):[]:t([],E,!0)),L.length>k.maxProductsToShow&&(L.length=k.maxProductsToShow),!(L&&L.length||!P.isPreviewMode)&&w)return w;if(!L||!L.length)return null;k.gapBetweenProductElements;var B=k.productDetailSettings.image,H=k.productDetailSettings.button,M=k.buttonSettings,N=k.productDetailSettings.discountRatio,O=k.productDetailSettings.finalPrice,U=k.productDetailSettings.originalPrice,V=k.productDetailSettings.name,$=r(k.horizontalAlignment),q=1;k.layout===c.ONE_COLUMN?q=1:k.layout===c.TWO_COLUMN?q=2:k.layout===c.THREE_COLUMN&&(q=3);var G={padding:"".concat(k.outerVerticalPadding,"px ").concat(k.outerHorizontalPadding,"px"),backgroundColor:k.productBgColor,width:"100%",height:"max-content"},J={display:"flex",flexDirection:"column",justifyContent:"space-between",alignItems:"center",height:"100%",cursor:"pointer"},K={display:"flex",justifyContent:$,alignItems:"center",width:"100%",backgroundColor:null==B?void 0:B.bgColor,borderRadius:(null==B?void 0:B.borderRadius)?"".concat(B.borderRadius,"px"):void 0},Q={width:"".concat(null==B?void 0:B.maxWidth,"%"),objectFit:"contain",borderRadius:(null==B?void 0:B.borderRadius)?"".concat(B.borderRadius,"px"):void 0},X={display:"flex",flexDirection:"column",width:"100%"},Y={display:"flex",flexDirection:"column"},Z={backgroundColor:null==V?void 0:V.bgColor,color:null==V?void 0:V.color,fontFamily:V?a(V.fontFamily):void 0,fontSize:null==V?void 0:V.fontSize,fontWeight:null==V?void 0:V.fontWeight,padding:"".concat(null==V?void 0:V.verticalPadding,"px ").concat(null==V?void 0:V.horizontalPadding,"px"),width:"100%",textAlign:null==V?void 0:V.horizontalAlignment,border:"".concat(null==V?void 0:V.borderWidth,"px ").concat(null==V?void 0:V.borderStyle," ").concat(null==V?void 0:V.borderColor),borderRadius:null==V?void 0:V.borderRadius},tt={backgroundColor:null==N?void 0:N.bgColor,color:null==N?void 0:N.color,fontFamily:N?a(N.fontFamily):void 0,fontSize:null==N?void 0:N.fontSize,fontWeight:null==N?void 0:N.fontWeight,padding:"".concat(null==N?void 0:N.verticalPadding,"px ").concat(null==N?void 0:N.horizontalPadding,"px"),width:"fit-content !important",border:"".concat(null==N?void 0:N.borderWidth,"px ").concat(null==N?void 0:N.borderStyle," ").concat(null==N?void 0:N.borderColor),borderRadius:null==N?void 0:N.borderRadius},et={textDecoration:"line-through",backgroundColor:null==U?void 0:U.bgColor,color:null==U?void 0:U.color,fontFamily:U?a(U.fontFamily):void 0,fontSize:null==U?void 0:U.fontSize,fontWeight:null==U?void 0:U.fontWeight,padding:"".concat(null==U?void 0:U.verticalPadding,"px ").concat(null==U?void 0:U.horizontalPadding,"px"),width:"100%",textAlign:null==U?void 0:U.horizontalAlignment,border:"".concat(null==U?void 0:U.borderWidth,"px ").concat(null==U?void 0:U.borderStyle," ").concat(null==U?void 0:U.borderColor),borderRadius:null==U?void 0:U.borderRadius},ot={backgroundColor:null==O?void 0:O.bgColor,color:null==O?void 0:O.color,fontFamily:O?a(O.fontFamily):void 0,fontSize:null==O?void 0:O.fontSize,fontWeight:null==O?void 0:O.fontWeight,padding:"".concat(null==O?void 0:O.verticalPadding,"px ").concat(null==O?void 0:O.horizontalPadding,"px"),width:"100%",textAlign:null==O?void 0:O.horizontalAlignment,border:"".concat(null==O?void 0:O.borderWidth,"px ").concat(null==O?void 0:O.borderStyle," ").concat(null==O?void 0:O.borderColor),borderRadius:null==O?void 0:O.borderRadius},nt={width:"".concat(M.width,"%"),minWidth:"fit-content"},it=e({display:"flex",justifyContent:"center",width:"100%",gap:"10px"},1===q?{position:"absolute",top:"calc(50% - 25px)",alignItems:"center",justifyContent:"space-between",zIndex:10}:void 0),lt={padding:10,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",border:"1px solid #EEF2F6",cursor:"pointer"};return i.createElement("div",{style:G},i.createElement(p,{onSwiper:A,modules:[u,m],spaceBetween:k.gapBetweenProducts,slidesPerView:q,navigation:{nextEl:".custom-next-button",prevEl:".custom-prev-button"},scrollbar:void 0},L.map((function(t,e){return i.createElement(v,{style:{height:"auto"},key:t.variantId},i.createElement("div",{style:J,onClick:function(){return function(t){return o(void 0,void 0,void 0,(function(){var e,o;return n(this,(function(n){switch(n.label){case 0:return C||!t.url?[3,4]:(null===(o=k.productDetailSettings.button)||void 0===o?void 0:o.action)===b.ADD_TO_CART&&S?[4,S.addProductToCart(t)]:[3,2];case 1:return n.sent()&&((e=document.createElement("a")).href="".concat(P.storeUrl,"/cart"),e.target="_self",e.click()),[3,3];case 2:(e=document.createElement("a")).href=t.url,e.target="_self",e.click(),n.label=3;case 3:z(!0),n.label=4;case 4:return[2]}}))}))}(t)}},i.createElement("div",{style:X},!!B&&t.imageURL&&i.createElement("div",{style:K},i.createElement("img",{src:t.imageURL||void 0,alt:t.name||void 0,style:Q})),!!V&&i.createElement("div",{style:Y},!!V&&i.createElement("div",{style:Z},t.name)),(!!U||!!O||!!N)&&i.createElement("div",{style:{display:"flex",flexDirection:"column",gap:2}},!!N&&!!t.discountPrice&&i.createElement("div",{style:{padding:"".concat(N.outerVerticalPadding,"px ").concat(N.outerHorizontalPadding,"px"),width:"100% !important",display:"flex",justifyContent:r(N.horizontalAlignment),alignItems:"center"}},i.createElement("div",{style:tt},function(t){return t.$discountRatio?k.productDetailSettings.discountRatioText?"".concat(t.$discountRatio," ").concat(k.productDetailSettings.discountRatioText):t.$discountRatio:null}(t))),i.createElement("div",{style:{display:"flex",gap:4,flexWrap:"wrap",overflow:"hidden",width:"100%",justifyContent:r((null==U?void 0:U.horizontalAlignment)||(null==O?void 0:O.horizontalAlignment)||x.LEFT),alignItems:"center"}},!!U&&!!t.discountPrice&&i.createElement("div",{style:{padding:"".concat(U.outerVerticalPadding,"px ").concat(U.outerHorizontalPadding,"px")}},i.createElement("div",{style:et},t.price)),!!O&&i.createElement("div",{style:{padding:"".concat(O.outerVerticalPadding,"px ").concat(O.outerHorizontalPadding,"px")}},i.createElement("div",{style:ot},t.discountPrice||t.price))))),!!H&&i.createElement("div",{style:nt},i.createElement(s,{disableButtonAction:!0,element:M}))))})),L.length>1&&i.createElement("div",{style:it},i.createElement("div",{className:"custom-prev-button",style:e(e({},lt),I?{opacity:.5,cursor:"not-allowed"}:{}),onClick:function(){R&&(T(R.isEnd),W(R.isBeginning))}},i.createElement(g,null)),i.createElement("div",{className:"custom-next-button",style:e(e({},lt),F?{opacity:.5,cursor:"not-allowed"}:{}),onClick:function(){R&&(T(R.isEnd),W(R.isBeginning))}},i.createElement(f,null)))))}));export{h as default};
@@ -0,0 +1 @@
1
+ import e from"react";import{observer as t}from"../../../../../../mobx-react/dist/mobxreact.esm.js";import{getHorizontalAlignment as r}from"../../helpers/index.js";var n=t((function(t){var n=t.element,i=n.socialMediaLinks.filter((function(e){return!!e.link})).sort((function(e,t){return e.order-t.order}));if(!i.length&&t.editModeChildren&&t.popup.isPreviewMode)return t.editModeChildren;var o={display:"flex",alignItems:"center",justifyContent:r(n.horizontalAlignment),padding:"".concat(n.verticalPadding,"px ").concat(n.horizontalPadding,"px"),backgroundColor:n.bgColor,width:"100%"},a={display:"flex",alignItems:"center",gap:"".concat(n.gapBetweenLogos,"px")};return e.createElement("div",{style:o},e.createElement("div",{style:a},i.map((function(t,r){return e.createElement("a",{href:t.link||"",key:r,target:"_blank"},e.createElement("img",{src:t.iconUrlWithoutHash||"",width:24,height:24}))}))))}));export{n as default};
@@ -0,0 +1 @@
1
+ import t from"react";import{observer as e}from"../../../../../../mobx-react/dist/mobxreact.esm.js";var r=e((function(e){var r=e.element,o={backgroundColor:r.bgColor,padding:"".concat(r.verticalPadding,"px ").concat(r.horizontalPadding,"px"),height:r.height,width:"100%"};return t.createElement("div",{style:o})}));export{r as default};
@@ -0,0 +1 @@
1
+ import{__assign as t}from"../../../ext/tslib/tslib.es6.mjs.js";import o from"react";import{observer as e}from"../../../../../../mobx-react/dist/mobxreact.esm.js";import{injectFontScript as r}from"../../helpers/index.js";var n=e((function(e){var n=e.element,a=n,i={border:"".concat(a.borderWidth,"px ").concat(a.borderStyle," ").concat(a.borderColor),borderRadius:a.borderRadius,padding:"".concat(a.outerVerticalPadding,"px ").concat(a.outerHorizontalPadding,"px")},d={color:a.color,fontSize:a.fontSize,fontWeight:a.fontWeight,fontFamily:r(a.fontFamily),textAlign:a.horizontalAlignment,padding:"".concat(a.verticalPadding,"px ").concat(a.horizontalPadding,"px"),backgroundColor:a.bgColor};return o.createElement("div",{style:i},o.createElement("div",{dangerouslySetInnerHTML:{__html:n.text},style:t({},d)}))}));export{n as default};
@@ -1 +1 @@
1
- import{__spreadArray as t,__assign as e,__awaiter as i,__generator as n}from'./../../../ext/tslib/tslib.es6.js';import r from"lodash/sortBy";import a from"lodash/cloneDeep";import{IkasCategory as o}from"../category/index.js";import{IkasProductVariant as s}from"./variant/index.js";import{IkasProductAttributeValue as u}from"./attribute-value/index.js";import{IkasProductVariantType as c}from"./variant-type/index.js";import{IkasBrand as d}from"../brand/index.js";import{IkasHTMLMetaData as l}from"../html-meta-data/index.js";import{IkasProductTag as p}from"./tag/index.js";import{IkasProductOptionPriceTypeEnum as f,IkasProductType as v}from"@ikas/storefront-models";export{IkasProductType}from"@ikas/storefront-models";import{IkasProductOptionSet as h}from"./option-set/index.js";import{makeObservable as m,observable as g,computed as V}from"mobx";import{IkasProductFunctions as b}from"@ikas/storefront-model-functions";import{IkasProductCampaign as y}from"./campaign/index.js";import{IkasStorefrontConfig as P}from"@ikas/storefront-config";import{IkasBaseStore as I}from"../../../store/base.js";import O from"lodash/groupBy";import{IkasProductBaseUnit as w}from"./base-unit/index.js";import{formatCurrency as S}from"../../../utils/currency.js";import"lodash/get";import T from"../../../store/product/index.js";import{IkasCustomerReviewList as j}from"../../ui/customer-review-list/index.js";import{IkasProductStar as C}from"./star/index.js";import{IkasProductCampaignOffer as x,IkasProductOffer as R}from"./campaign-offer/index.js";import{IkasProductGroup as G}from"./group/index.js";import{IkasImage as E}from"../image/index.js";import{IkasProductSalesChannel as A}from"./sales-channel/index.js";var k=function(){function k(b){void 0===b&&(b={});var O,E,L,D=this;this.metaData=null,this.brand=null,this.tags=null,this.productOptionSetId=null,this.productOptionSet=null,this.campaigns=null,this.selectedVariantValues=[],this.isFiltered=!1,this.isStatic=!1,this.bundleProductCache={},this.productGroupItems=[],this.showVariantsInGroup=!1,this.selectVariantValue=function(i,n){var r,a=D.metaData,o=D.selectedVariantValues.map((function(t){return t.variantTypeId===i.variantTypeId?i:t})),s=D.variants.find((function(t){return t.isActive&&o.every((function(e){return t.variantValues.some((function(t){return t.id===e.id}))}))}));if(s)D.selectedVariantValues=o;else{var u=D.variantTypes.findIndex((function(t){return t.variantType.id===i.variantTypeId}));if(u>0){var c=D.variantTypes.slice(0,u),d=D.selectedVariantValues.filter((function(t){return c.some((function(e){return e.variantType.id===t.variantTypeId}))})),l=t(t([],d,!0),[i],!1);s=D.variants.find((function(t){return t.isActive&&l.every((function(e){return t.variantValues.some((function(t){return t.id===e.id}))}))}))}else{var p=o.slice(0,o.length-1);(s=D.variants.find((function(t){return t.isActive&&p.every((function(e){return t.variantValues.some((function(t){return t.id===e.id}))}))})))||(s=D.variants.find((function(t){return t.isActive&&t.variantValues.some((function(t){return t.id===i.id}))})))}if(!s)return;D.selectedVariantValues=s.variantValues}var f={};new URLSearchParams(window.location.search).forEach((function(t,i){var n;"vid"!==i&&(f=e(e({},f),((n={})[i]=t,n)))})),D.variantTypes.map((function(t){delete f[decodeURIComponent(t.variantType.slug)]}));var v=t(t([],Object.entries(f).map((function(t){var e=t[0],i=t[1];return"".concat(e,"=").concat(i)})),!0),D.variantTypes.map((function(t){var e=t.variantType,i=e.values.find((function(t){return D.selectedVariantValues.some((function(e){return e.id===t.id}))}));if(i)return"".concat(e.slug,"=").concat(i.slug)})),!0).filter((function(t){return!!t})).join("&");if(D.setOptionRealPrices(),!n){var h="/".concat(a.slug);if(v&&(h="/".concat(a.slug,"?").concat(v)),h===window.location.pathname)return;null===(r=I.getInstance().router)||void 0===r||r.replace(h,void 0,{shallow:!1,scroll:!1})}},this.getVariantUnitPriceText=function(t){var e,i,n=t.price;if(n.unitPrice&&D.baseUnit){var r=D.baseUnit.baseAmount,a=(null===(i=null===(e=D.baseUnit)||void 0===e?void 0:e.unit)||void 0===i?void 0:i.name)||"";return"".concat(S(n.unitPrice,n.currency||"",n.currencySymbol||"")," / ").concat(r&&1!==r?r:"").concat(a)}},this.getCampaigns=function(){return i(D,void 0,void 0,(function(){var t,e,i,r,a,o=this;return n(this,(function(n){switch(n.label){case 0:return t=I.getInstance(),e=t.customerStore.customer,i=e?e.customerGroupIds:null,r=this.variants.map((function(t){return t.id})),[4,T.getProductCampaigns({input:{customerGroupIds:i,salesChannelId:P.getSalesChannelId()||"",variantIds:r}})];case 1:return a=n.sent(),this.campaigns=a.data,this.campaigns?(this.campaigns.map((function(t){o.variants.map((function(e){var i;t.variantIds.some((function(t){return t===e.id}))&&(null===(i=e.campaigns)||void 0===i||i.push(t))}))})),[2,this.campaigns]):[2]}}))}))},this.getAvailableStockLocations=function(){return i(D,void 0,void 0,(function(){var t,e;return n(this,(function(i){switch(i.label){case 0:return t=this.variants.map((function(t){return t.id})),e=P.getPickupStockLocationIds(),[4,T.getVariantStockLocations({stockLocationIdList:e,variantIds:t})];case 1:return[2,i.sent().data||[]]}}))}))},this.getCustomerReviews=function(t){return i(D,void 0,void 0,(function(){var i,r,a,o,s;return n(this,(function(n){switch(n.label){case 0:return i=!!(null===(o=this.selectedVariant.bundleSettings)||void 0===o?void 0:o.products.length),r=[this.id],i&&(null===(s=this.selectedVariant.bundleSettings)||void 0===s||s.products.forEach((function(t){r.push(t.productId)}))),[4,(a=new j(e(e(e({},i?{}:{productId:this.id}),{limit:null==t?void 0:t.limit,page:null==t?void 0:t.page,hasImage:null==t?void 0:t.hasImage}),i?{productIds:r}:{}))).getInitial()];case 1:return n.sent(),[2,a]}}))}))},this.getProductOptionSet=function(){return i(D,void 0,void 0,(function(){var t,e;return n(this,(function(i){switch(i.label){case 0:return this.productOptionSet?[2,!0]:this.productOptionSetId?[4,T.listProductOptionSet({id:{eq:this.productOptionSetId}})]:[2,!1];case 1:return(t=i.sent()).isSuccess&&(null===(e=t.data)||void 0===e?void 0:e.length)?(this.productOptionSet=t.data[0],this.setOptionPrices(),this.setOptionRealPrices(),[2,!0]):[2,!1]}}))}))},this.initBundleProducts=function(){return i(D,void 0,void 0,(function(){var t,e,i,r,a,o;return n(this,(function(n){switch(n.label){case 0:return t="","undefined"!=typeof window&&(e=new URLSearchParams(window.location.search),t=e.get("editLineID")||""),t?(i=null===(a=I.getInstance().cartStore.cart)||void 0===a?void 0:a.items.find((function(e){return e.id===t})))&&(r=this.variants.find((function(t){return t.id===i.variant.id})))?(this.selectedVariantValues=r.variantValues,[4,this.getBundleProductsOfVariant(r)]):[3,2]:[3,3];case 1:n.sent(),null===(o=r.bundleSettings)||void 0===o||o.products.forEach((function(t){var e,n,r;try{var a=null===(e=i.variant.bundleProducts)||void 0===e?void 0:e.find((function(e){return e.id===t.id})),o=t.product.variants.find((function(t){return t.id===(null==a?void 0:a.variant.id)}));t.product.selectedVariantValues=o.variantValues,t.quantity=(null===(r=null===(n=i.variant.bundleProducts)||void 0===n?void 0:n.find((function(t){return t.variant.id===o.id})))||void 0===r?void 0:r.quantity)||0}catch(t){console.error(t)}})),n.label=2;case 2:return[3,5];case 3:return[4,this.getBundleProductsOfVariant(this.selectedVariant)];case 4:n.sent(),n.label=5;case 5:return[2]}}))}))},this.setShowVariantsInGroup=function(t){D.showVariantsInGroup=t},this.getBundleProductsOfVariant=function(t){return i(D,void 0,void 0,(function(){var e,i,r,o,s,u,c=this;return n(this,(function(n){switch(n.label){case 0:return(null==(e=null===(r=t.bundleSettings)||void 0===r?void 0:r.products.map((function(t){return t.productId})).filter((function(t){return-1===Object.keys(c.bundleProductCache).indexOf(t)})))?void 0:e.length)?[4,T.searchProducts({input:{productIdList:e,perPage:200,priceListId:P.getPriceListId(),salesChannelId:P.getSalesChannelId()}})]:[3,2];case 1:(i=n.sent()).isSuccess&&(null===(s=null===(o=i.data)||void 0===o?void 0:o.data)||void 0===s||s.forEach((function(t){c.bundleProductCache[t.id]=t}))),n.label=2;case 2:return null===(u=t.bundleSettings)||void 0===u||u.products.forEach((function(t){var e=c.bundleProductCache[t.productId];t.setProduct(new k(a(e)))})),[2]}}))}))},this.setOptionRealPrices=function(){var t,e=D.selectedVariant||D.variants[0];if(e){var i=e.price.currency;i&&(null===(t=D.productOptionSet)||void 0===t||t.options.forEach((function(t){var e;if(t.selectSettings)t.selectSettings.values.forEach((function(t){var e;if(t.priceType===f.RATIO&&t.initPrice)if(t.otherPrices){var n=(null===(e=t.otherPrices.find((function(t){return t.currencyCode===i})))||void 0===e?void 0:e.price)||t.initPrice||1;t.price=D.selectedVariant.price.finalPrice*n/100}else t.price=D.selectedVariant.price.finalPrice*t.initPrice/100}));else if(t.priceType===f.RATIO&&t.initPrice)if(t.otherPrices){var n=(null===(e=t.otherPrices.find((function(t){return t.currencyCode===i})))||void 0===e?void 0:e.price)||t.initPrice||1;t.price=D.selectedVariant.price.finalPrice*n/100}else t.price=D.selectedVariant.price.finalPrice*t.initPrice/100})))}},this.setOptionPrices=function(){var t,e=D.variants[0];if(e){var i=e.price.currency;null===(t=D.productOptionSet)||void 0===t||t.options.forEach((function(t){var n,r;if(t.selectSettings&&t.selectSettings.values.forEach((function(t){var n,r;if(t.otherPrices)if(t.priceType===f.RATIO){var a=(null===(n=t.otherPrices.find((function(t){return t.currencyCode===i})))||void 0===n?void 0:n.price)||t.price||1;t.price=e.price.finalPrice*a}else t.price=(null===(r=t.otherPrices.find((function(t){return t.currencyCode===i})))||void 0===r?void 0:r.price)||t.price})),t.otherPrices)if(t.priceType===f.RATIO){var a=(null===(n=t.otherPrices.find((function(t){return t.currencyCode===i})))||void 0===n?void 0:n.price)||t.price||1;t.price=e.price.finalPrice*a}else t.price=(null===(r=t.otherPrices.find((function(t){return t.currencyCode===i})))||void 0===r?void 0:r.price)||t.price}))}},this.id=b.id||Date.now()+"",this.name=b.name||"",this.type=b.type||v.PHYSICAL,this.description=b.description||"",this.shortDescription=b.shortDescription||"",this.metaData=b.metaData?new l(b.metaData):null,this.brand=b.brand?new d(b.brand):null,this.categories=b.categories?b.categories.map((function(t){return new o(t)})):[],this.deleted=b.deleted||null,this.tags=b.tags?b.tags.map((function(t){return new p(t)})):[],this.variants=b.variants?b.variants.map((function(t){return new s(t)})):[],this.attributes=b.attributes?b.attributes.map((function(t){return new u(t)})):[],this.variantTypes=b.variantTypes?b.variantTypes.map((function(t){return new c(t)})):[],this.productOptionSetId=b.productOptionSetId||null,this.averageRating=null!==(O=b.averageRating)&&void 0!==O?O:null,this.reviewCount=null!==(E=b.reviewCount)&&void 0!==E?E:null,this.stars=b.stars?b.stars.map((function(t){return new C(t)})):null,this.baseUnit=b.baseUnit?new w(b.baseUnit):null,this.campaigns=(null===(L=b.campaigns)||void 0===L?void 0:L.map((function(t){return new y(t)})))||null,this.selectedVariantValues=b.selectedVariantValues||[],this.productOptionSet=b.productOptionSet?new h(b.productOptionSet):null,this.variantTypes=r(this.variantTypes,"order"),this.groupVariantsByVariantTypeId=b.groupVariantsByVariantTypeId||null,this.dynamicPriceListIds=b.dynamicPriceListIds||null,this.productVolumeDiscountId=b.productVolumeDiscountId||null,this.campaignOffers=b.campaignOffers?b.campaignOffers.map((function(t){return new x(t)})):null,this.appliedCampaignOffer=b.appliedCampaignOffer,this.offers=b.offers?b.offers.map((function(t){return new R(t)})):void 0,this.productGroup=b.productGroup?new G(b.productGroup):null,this.salesChannels=b.salesChannels?b.salesChannels.map((function(t){return new A(t)})):null,this.productGroupItems=b.productGroupItems,this.variants.forEach((function(t){return t.product=D})),this.setOptionPrices(),this.setOptionRealPrices(),this.customerReviews=b.customerReviews?new j(b.customerReviews):null,m(this,{selectedVariantValues:g,isFiltered:g,isStatic:g,showVariantsInGroup:g,hasVariant:V,hasStock:V,hasValidProductOptionValues:V,href:V,productHref:V,mainVariantType:V,mainVariantValue:V,selectedVariant:V,displayedVariantTypes:V,isCustomerReviewEnabled:V,isCustomerReviewLoginRequired:V,isAddToCartEnabled:V,groupedAttributeValues:V,selectedVariantUnitPriceText:V,displayedProductGroups:V})}return Object.defineProperty(k.prototype,"hasVariant",{get:function(){return b.hasVariant(this,this.showVariantsInGroup)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"hasStock",{get:function(){return this.isStatic?this.selectedVariant.hasStock:b.hasStock(this)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"hasValidProductOptionValues",{get:function(){return!this.productOptionSet||this.productOptionSet.hasValidValues},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"href",{get:function(){return b.getSelectedVariantHref(this,this.selectedVariantValues)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"productHref",{get:function(){return this.groupVariantsByVariantTypeId||this.isFiltered?this.href:b.getProductHref(this)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"mainVariantType",{get:function(){return b.getMainVariantType(this)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"mainVariantValue",{get:function(){return b.getMainVariantValue(this.selectedVariantValues)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"selectedVariant",{get:function(){if(!this.hasVariant)return this.variants[0];var t=this.selectedVariantValues.map((function(t){return t.id}));return this.variants.find((function(e){return e.variantValues.every((function(e){return t.includes(e.id)}))}))},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"displayedVariantTypes",{get:function(){return this.hasVariant?b.getDisplayedVariantTypes(this,this.selectedVariantValues):[]},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"isCustomerReviewEnabled",{get:function(){return P.isCustomerReviewEnabled()},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"isCustomerReviewLoginRequired",{get:function(){return P.isCustomerReviewLoginRequired()},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"isAddToCartEnabled",{get:function(){var t,e=!0;return null===(t=this.selectedVariant.bundleSettings)||void 0===t||t.products.forEach((function(t){0===t.quantity&&null!==t.minQuantity&&0!==t.minQuantity&&(e=!1)})),e&&this.hasValidProductOptionValues&&(this.selectedVariant.hasStock||this.selectedVariant.sellIfOutOfStock)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"groupedAttributeValues",{get:function(){var t,e=O(this.attributes,"productAttributeId");return(null===(t=this.attributes)||void 0===t?void 0:t.map((function(t){var i=t.productAttributeId;if(i){var n=e[i];return(null==n?void 0:n.length)&&n[0].productAttribute?{attribute:n[0].productAttribute,values:n}:void 0}})).filter((function(t){return!!t})))||[]},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"selectedVariantUnitPriceText",{get:function(){return this.getVariantUnitPriceText(this.selectedVariant)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"displayedProductGroups",{get:function(){var e,i=this,n=[],a=[];return null===(e=this.productGroupItems)||void 0===e||e.forEach((function(t){t.groupValues.forEach((function(t){n.includes(t.name)||n.push(t.name)}))})),n.forEach((function(e){var n,o={name:e,items:[]};i.productGroupItems=r(i.productGroupItems,(function(t){var e;return parseInt((null===(e=t.order)||void 0===e?void 0:e.value)||"999",10)})),null===(n=i.productGroupItems)||void 0===n||n.forEach((function(n){var r,a,s,u=n.groupValues.find((function(t){return t.name===e}));if(u&&!o.items.some((function(t){return t.value===u.value}))){var c="";if(n.productId===i.id)c=i.href;else{var d=(null===(r=i.productGroup)||void 0===r?void 0:r.values.filter((function(t){return t.name!==e})))||[],l=t(t([],d,!0),[u],!1),p=null===(a=i.productGroupItems)||void 0===a?void 0:a.find((function(t){return l.every((function(e){return t.groupValues.some((function(t){return e.name===t.name&&e.value===t.value}))}))}));c=p?p.href:n.href}o.items.push({image:n.image?new E(n.image):null,href:c,value:u.value,isSelected:(null===(s=i.productGroupItems)||void 0===s?void 0:s.some((function(t){return t.groupValues.some((function(t){return t.value===u.value}))&&t.productId===i.id})))||!1})}})),a.push(o)})),a},enumerable:!1,configurable:!0}),k}();export{k as IkasProduct};
1
+ import{__spreadArray as t,__assign as e,__awaiter as i,__generator as n}from'./../../../ext/tslib/tslib.es6.js';import r from"lodash/sortBy";import a from"lodash/cloneDeep";import{IkasCategory as o}from"../category/index.js";import{IkasProductVariant as s}from"./variant/index.js";import{IkasProductAttributeValue as u}from"./attribute-value/index.js";import{IkasProductVariantType as c}from"./variant-type/index.js";import{IkasBrand as d}from"../brand/index.js";import{IkasHTMLMetaData as l}from"../html-meta-data/index.js";import{IkasProductTag as p}from"./tag/index.js";import{IkasProductOptionPriceTypeEnum as f,IkasProductType as v}from"@ikas/storefront-models";export{IkasProductType}from"@ikas/storefront-models";import{IkasProductOptionSet as h}from"./option-set/index.js";import{makeObservable as m,observable as g,computed as V}from"mobx";import{IkasProductFunctions as b}from"@ikas/storefront-model-functions";import{IkasProductCampaign as y}from"./campaign/index.js";import{IkasStorefrontConfig as P}from"@ikas/storefront-config";import{IkasBaseStore as I}from"../../../store/base.js";import O from"lodash/groupBy";import{IkasProductBaseUnit as w}from"./base-unit/index.js";import{formatCurrency as S}from"../../../utils/currency.js";import"lodash/get";import T from"../../../store/product/index.js";import{IkasCustomerReviewList as j}from"../../ui/customer-review-list/index.js";import{IkasProductStar as C}from"./star/index.js";import{IkasProductCampaignOffer as x,IkasProductOffer as R}from"./campaign-offer/index.js";import{IkasProductGroup as G}from"./group/index.js";import{IkasImage as E}from"../image/index.js";import{IkasProductSalesChannel as A}from"./sales-channel/index.js";var k=function(){function k(b){void 0===b&&(b={});var O,E,L,D=this;this.metaData=null,this.brand=null,this.tags=null,this.productOptionSetId=null,this.productOptionSet=null,this.campaigns=null,this.selectedVariantValues=[],this.isFiltered=!1,this.isStatic=!1,this.bundleProductCache={},this.productGroupItems=[],this.showVariantsInGroup=!1,this.selectVariantValue=function(i,n){var r,a=D.metaData,o=D.selectedVariantValues.map((function(t){return t.variantTypeId===i.variantTypeId?i:t})),s=D.variants.find((function(t){return t.isActive&&o.every((function(e){return t.variantValues.some((function(t){return t.id===e.id}))}))}));if(s)D.selectedVariantValues=o;else{var u=D.variantTypes.findIndex((function(t){return t.variantType.id===i.variantTypeId}));if(u>0){var c=D.variantTypes.slice(0,u),d=D.selectedVariantValues.filter((function(t){return c.some((function(e){return e.variantType.id===t.variantTypeId}))})),l=t(t([],d,!0),[i],!1);s=D.variants.find((function(t){return t.isActive&&l.every((function(e){return t.variantValues.some((function(t){return t.id===e.id}))}))}))}else{var p=o.slice(0,o.length-1);(s=D.variants.find((function(t){return t.isActive&&p.every((function(e){return t.variantValues.some((function(t){return t.id===e.id}))}))})))||(s=D.variants.find((function(t){return t.isActive&&t.variantValues.some((function(t){return t.id===i.id}))})))}if(!s)return;D.selectedVariantValues=s.variantValues}var f={};new URLSearchParams(window.location.search).forEach((function(t,i){var n;"vid"!==i&&(f=e(e({},f),((n={})[i]=t,n)))})),D.variantTypes.map((function(t){delete f[t.variantType.slug]}));var v=t(t([],Object.entries(f).map((function(t){var e=t[0],i=t[1];return"".concat(e,"=").concat(i)})),!0),D.variantTypes.map((function(t){var e=t.variantType,i=e.values.find((function(t){return D.selectedVariantValues.some((function(e){return e.id===t.id}))}));if(i)return"".concat(e.slug,"=").concat(i.slug)})),!0).filter((function(t){return!!t})).join("&");if(D.setOptionRealPrices(),!n){var h="/".concat(a.slug);if(v&&(h="/".concat(a.slug,"?").concat(v)),h===window.location.pathname)return;null===(r=I.getInstance().router)||void 0===r||r.replace(h,void 0,{shallow:!1,scroll:!1})}},this.getVariantUnitPriceText=function(t){var e,i,n=t.price;if(n.unitPrice&&D.baseUnit){var r=D.baseUnit.baseAmount,a=(null===(i=null===(e=D.baseUnit)||void 0===e?void 0:e.unit)||void 0===i?void 0:i.name)||"";return"".concat(S(n.unitPrice,n.currency||"",n.currencySymbol||"")," / ").concat(r&&1!==r?r:"").concat(a)}},this.getCampaigns=function(){return i(D,void 0,void 0,(function(){var t,e,i,r,a,o=this;return n(this,(function(n){switch(n.label){case 0:return t=I.getInstance(),e=t.customerStore.customer,i=e?e.customerGroupIds:null,r=this.variants.map((function(t){return t.id})),[4,T.getProductCampaigns({input:{customerGroupIds:i,salesChannelId:P.getSalesChannelId()||"",variantIds:r}})];case 1:return a=n.sent(),this.campaigns=a.data,this.campaigns?(this.campaigns.map((function(t){o.variants.map((function(e){var i;t.variantIds.some((function(t){return t===e.id}))&&(null===(i=e.campaigns)||void 0===i||i.push(t))}))})),[2,this.campaigns]):[2]}}))}))},this.getAvailableStockLocations=function(){return i(D,void 0,void 0,(function(){var t,e;return n(this,(function(i){switch(i.label){case 0:return t=this.variants.map((function(t){return t.id})),e=P.getPickupStockLocationIds(),[4,T.getVariantStockLocations({stockLocationIdList:e,variantIds:t})];case 1:return[2,i.sent().data||[]]}}))}))},this.getCustomerReviews=function(t){return i(D,void 0,void 0,(function(){var i,r,a,o,s;return n(this,(function(n){switch(n.label){case 0:return i=!!(null===(o=this.selectedVariant.bundleSettings)||void 0===o?void 0:o.products.length),r=[this.id],i&&(null===(s=this.selectedVariant.bundleSettings)||void 0===s||s.products.forEach((function(t){r.push(t.productId)}))),[4,(a=new j(e(e(e({},i?{}:{productId:this.id}),{limit:null==t?void 0:t.limit,page:null==t?void 0:t.page,hasImage:null==t?void 0:t.hasImage}),i?{productIds:r}:{}))).getInitial()];case 1:return n.sent(),[2,a]}}))}))},this.getProductOptionSet=function(){return i(D,void 0,void 0,(function(){var t,e;return n(this,(function(i){switch(i.label){case 0:return this.productOptionSet?[2,!0]:this.productOptionSetId?[4,T.listProductOptionSet({id:{eq:this.productOptionSetId}})]:[2,!1];case 1:return(t=i.sent()).isSuccess&&(null===(e=t.data)||void 0===e?void 0:e.length)?(this.productOptionSet=t.data[0],this.setOptionPrices(),this.setOptionRealPrices(),[2,!0]):[2,!1]}}))}))},this.initBundleProducts=function(){return i(D,void 0,void 0,(function(){var t,e,i,r,a,o;return n(this,(function(n){switch(n.label){case 0:return t="","undefined"!=typeof window&&(e=new URLSearchParams(window.location.search),t=e.get("editLineID")||""),t?(i=null===(a=I.getInstance().cartStore.cart)||void 0===a?void 0:a.items.find((function(e){return e.id===t})))&&(r=this.variants.find((function(t){return t.id===i.variant.id})))?(this.selectedVariantValues=r.variantValues,[4,this.getBundleProductsOfVariant(r)]):[3,2]:[3,3];case 1:n.sent(),null===(o=r.bundleSettings)||void 0===o||o.products.forEach((function(t){var e,n,r;try{var a=null===(e=i.variant.bundleProducts)||void 0===e?void 0:e.find((function(e){return e.id===t.id})),o=t.product.variants.find((function(t){return t.id===(null==a?void 0:a.variant.id)}));t.product.selectedVariantValues=o.variantValues,t.quantity=(null===(r=null===(n=i.variant.bundleProducts)||void 0===n?void 0:n.find((function(t){return t.variant.id===o.id})))||void 0===r?void 0:r.quantity)||0}catch(t){console.error(t)}})),n.label=2;case 2:return[3,5];case 3:return[4,this.getBundleProductsOfVariant(this.selectedVariant)];case 4:n.sent(),n.label=5;case 5:return[2]}}))}))},this.setShowVariantsInGroup=function(t){D.showVariantsInGroup=t},this.getBundleProductsOfVariant=function(t){return i(D,void 0,void 0,(function(){var e,i,r,o,s,u,c=this;return n(this,(function(n){switch(n.label){case 0:return(null==(e=null===(r=t.bundleSettings)||void 0===r?void 0:r.products.map((function(t){return t.productId})).filter((function(t){return-1===Object.keys(c.bundleProductCache).indexOf(t)})))?void 0:e.length)?[4,T.searchProducts({input:{productIdList:e,perPage:200,priceListId:P.getPriceListId(),salesChannelId:P.getSalesChannelId()}})]:[3,2];case 1:(i=n.sent()).isSuccess&&(null===(s=null===(o=i.data)||void 0===o?void 0:o.data)||void 0===s||s.forEach((function(t){c.bundleProductCache[t.id]=t}))),n.label=2;case 2:return null===(u=t.bundleSettings)||void 0===u||u.products.forEach((function(t){var e=c.bundleProductCache[t.productId];t.setProduct(new k(a(e)))})),[2]}}))}))},this.setOptionRealPrices=function(){var t,e=D.selectedVariant||D.variants[0];if(e){var i=e.price.currency;i&&(null===(t=D.productOptionSet)||void 0===t||t.options.forEach((function(t){var e;if(t.selectSettings)t.selectSettings.values.forEach((function(t){var e;if(t.priceType===f.RATIO&&t.initPrice)if(t.otherPrices){var n=(null===(e=t.otherPrices.find((function(t){return t.currencyCode===i})))||void 0===e?void 0:e.price)||t.initPrice||1;t.price=D.selectedVariant.price.finalPrice*n/100}else t.price=D.selectedVariant.price.finalPrice*t.initPrice/100}));else if(t.priceType===f.RATIO&&t.initPrice)if(t.otherPrices){var n=(null===(e=t.otherPrices.find((function(t){return t.currencyCode===i})))||void 0===e?void 0:e.price)||t.initPrice||1;t.price=D.selectedVariant.price.finalPrice*n/100}else t.price=D.selectedVariant.price.finalPrice*t.initPrice/100})))}},this.setOptionPrices=function(){var t,e=D.variants[0];if(e){var i=e.price.currency;null===(t=D.productOptionSet)||void 0===t||t.options.forEach((function(t){var n,r;if(t.selectSettings&&t.selectSettings.values.forEach((function(t){var n,r;if(t.otherPrices)if(t.priceType===f.RATIO){var a=(null===(n=t.otherPrices.find((function(t){return t.currencyCode===i})))||void 0===n?void 0:n.price)||t.price||1;t.price=e.price.finalPrice*a}else t.price=(null===(r=t.otherPrices.find((function(t){return t.currencyCode===i})))||void 0===r?void 0:r.price)||t.price})),t.otherPrices)if(t.priceType===f.RATIO){var a=(null===(n=t.otherPrices.find((function(t){return t.currencyCode===i})))||void 0===n?void 0:n.price)||t.price||1;t.price=e.price.finalPrice*a}else t.price=(null===(r=t.otherPrices.find((function(t){return t.currencyCode===i})))||void 0===r?void 0:r.price)||t.price}))}},this.id=b.id||Date.now()+"",this.name=b.name||"",this.type=b.type||v.PHYSICAL,this.description=b.description||"",this.shortDescription=b.shortDescription||"",this.metaData=b.metaData?new l(b.metaData):null,this.brand=b.brand?new d(b.brand):null,this.categories=b.categories?b.categories.map((function(t){return new o(t)})):[],this.deleted=b.deleted||null,this.tags=b.tags?b.tags.map((function(t){return new p(t)})):[],this.variants=b.variants?b.variants.map((function(t){return new s(t)})):[],this.attributes=b.attributes?b.attributes.map((function(t){return new u(t)})):[],this.variantTypes=b.variantTypes?b.variantTypes.map((function(t){return new c(t)})):[],this.productOptionSetId=b.productOptionSetId||null,this.averageRating=null!==(O=b.averageRating)&&void 0!==O?O:null,this.reviewCount=null!==(E=b.reviewCount)&&void 0!==E?E:null,this.stars=b.stars?b.stars.map((function(t){return new C(t)})):null,this.baseUnit=b.baseUnit?new w(b.baseUnit):null,this.campaigns=(null===(L=b.campaigns)||void 0===L?void 0:L.map((function(t){return new y(t)})))||null,this.selectedVariantValues=b.selectedVariantValues||[],this.productOptionSet=b.productOptionSet?new h(b.productOptionSet):null,this.variantTypes=r(this.variantTypes,"order"),this.groupVariantsByVariantTypeId=b.groupVariantsByVariantTypeId||null,this.dynamicPriceListIds=b.dynamicPriceListIds||null,this.productVolumeDiscountId=b.productVolumeDiscountId||null,this.campaignOffers=b.campaignOffers?b.campaignOffers.map((function(t){return new x(t)})):null,this.appliedCampaignOffer=b.appliedCampaignOffer,this.offers=b.offers?b.offers.map((function(t){return new R(t)})):void 0,this.productGroup=b.productGroup?new G(b.productGroup):null,this.salesChannels=b.salesChannels?b.salesChannels.map((function(t){return new A(t)})):null,this.productGroupItems=b.productGroupItems,this.variants.forEach((function(t){return t.product=D})),this.setOptionPrices(),this.setOptionRealPrices(),this.customerReviews=b.customerReviews?new j(b.customerReviews):null,m(this,{selectedVariantValues:g,isFiltered:g,isStatic:g,showVariantsInGroup:g,hasVariant:V,hasStock:V,hasValidProductOptionValues:V,href:V,productHref:V,mainVariantType:V,mainVariantValue:V,selectedVariant:V,displayedVariantTypes:V,isCustomerReviewEnabled:V,isCustomerReviewLoginRequired:V,isAddToCartEnabled:V,groupedAttributeValues:V,selectedVariantUnitPriceText:V,displayedProductGroups:V})}return Object.defineProperty(k.prototype,"hasVariant",{get:function(){return b.hasVariant(this,this.showVariantsInGroup)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"hasStock",{get:function(){return this.isStatic?this.selectedVariant.hasStock:b.hasStock(this)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"hasValidProductOptionValues",{get:function(){return!this.productOptionSet||this.productOptionSet.hasValidValues},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"href",{get:function(){return b.getSelectedVariantHref(this,this.selectedVariantValues)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"productHref",{get:function(){return this.groupVariantsByVariantTypeId||this.isFiltered?this.href:b.getProductHref(this)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"mainVariantType",{get:function(){return b.getMainVariantType(this)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"mainVariantValue",{get:function(){return b.getMainVariantValue(this.selectedVariantValues)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"selectedVariant",{get:function(){if(!this.hasVariant)return this.variants[0];var t=this.selectedVariantValues.map((function(t){return t.id}));return this.variants.find((function(e){return e.variantValues.every((function(e){return t.includes(e.id)}))}))},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"displayedVariantTypes",{get:function(){return this.hasVariant?b.getDisplayedVariantTypes(this,this.selectedVariantValues):[]},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"isCustomerReviewEnabled",{get:function(){return P.isCustomerReviewEnabled()},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"isCustomerReviewLoginRequired",{get:function(){return P.isCustomerReviewLoginRequired()},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"isAddToCartEnabled",{get:function(){var t,e=!0;return null===(t=this.selectedVariant.bundleSettings)||void 0===t||t.products.forEach((function(t){0===t.quantity&&null!==t.minQuantity&&0!==t.minQuantity&&(e=!1)})),e&&this.hasValidProductOptionValues&&(this.selectedVariant.hasStock||this.selectedVariant.sellIfOutOfStock)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"groupedAttributeValues",{get:function(){var t,e=O(this.attributes,"productAttributeId");return(null===(t=this.attributes)||void 0===t?void 0:t.map((function(t){var i=t.productAttributeId;if(i){var n=e[i];return(null==n?void 0:n.length)&&n[0].productAttribute?{attribute:n[0].productAttribute,values:n}:void 0}})).filter((function(t){return!!t})))||[]},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"selectedVariantUnitPriceText",{get:function(){return this.getVariantUnitPriceText(this.selectedVariant)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"displayedProductGroups",{get:function(){var e,i=this,n=[],a=[];return null===(e=this.productGroupItems)||void 0===e||e.forEach((function(t){t.groupValues.forEach((function(t){n.includes(t.name)||n.push(t.name)}))})),n.forEach((function(e){var n,o={name:e,items:[]};i.productGroupItems=r(i.productGroupItems,(function(t){var e;return parseInt((null===(e=t.order)||void 0===e?void 0:e.value)||"999",10)})),null===(n=i.productGroupItems)||void 0===n||n.forEach((function(n){var r,a,s,u=n.groupValues.find((function(t){return t.name===e}));if(u&&!o.items.some((function(t){return t.value===u.value}))){var c="";if(n.productId===i.id)c=i.href;else{var d=(null===(r=i.productGroup)||void 0===r?void 0:r.values.filter((function(t){return t.name!==e})))||[],l=t(t([],d,!0),[u],!1),p=null===(a=i.productGroupItems)||void 0===a?void 0:a.find((function(t){return l.every((function(e){return t.groupValues.some((function(t){return e.name===t.name&&e.value===t.value}))}))}));c=p?p.href:n.href}o.items.push({image:n.image?new E(n.image):null,href:c,value:u.value,isSelected:(null===(s=i.productGroupItems)||void 0===s?void 0:s.some((function(t){return t.groupValues.some((function(t){return t.value===u.value}))&&t.productId===i.id})))||!1})}})),a.push(o)})),a},enumerable:!1,configurable:!0}),k}();export{k as IkasProduct};
@@ -1 +1 @@
1
- import{__extends as e}from'./../../../ext/tslib/tslib.es6.js';import{IkasBaseModel as r}from"../base/index.js";import{IkasStorefrontPopupAnalytics as o}from"./storefront-popup-analytics/index.js";import{IkasStorefrontPopupDateFilter as s}from"./storefront-popup-date-filter/index.js";import{IkasStorefrontPopupDisplayFilter as p}from"./storefront-popup-display-filter/index.js";import{IkasStorefrontPopupDisplaySettings as n}from"./storefront-popup-display-settings/index.js";import{IkasStorefrontPopupPageFilter as t}from"./storefront-popup-page-filter/index.js";import{IkasStorefrontPopupRouting as d}from"./storefront-popup-routing/index.js";import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/components/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/ext/tslib/tslib.es6.mjs.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/PhoneNumberMatcher.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/AsYouTypeFormatter.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/ParseError.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/metadata.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/PhoneNumber.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/PhoneNumberMatcher.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/AsYouType.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/Metadata.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/findNumbers/isValidCandidate.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/index.es6.exports/PhoneNumberSearch.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/base/index.js';import{Popup as i}from'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/settings/index.js';import"mobx";import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/settings/visibility-condition/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/teaser/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/button/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/divider/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/checkbox/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-attribute/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-gender/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/image/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/image-column/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/product/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/product/detail-settings/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/social/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/space/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/text/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/background-settings/index.js';import'./../../../packages/storefront/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/close-settings/index.js';import{IkasStorefrontConfig as l}from"@ikas/storefront-config";var a,u,m,b=function(r){function b(e){var b,c=this;(c=r.call(this,e)||this).analytics=e.analytics?new o(e.analytics):null,c.dateFilter=e.dateFilter?new s(e.dateFilter):null,c.displayFilters=e.displayFilters?e.displayFilters.map((function(e){return new p(e)})):null,c.displaySettings=e.displaySettings?new n(e.displaySettings):new n,c.name=e.name||"",c.pageFilters=e.pageFilters?e.pageFilters.map((function(e){return new t(e)})):null,c.status=e.status||a.ACTIVE,c.storefrontRoutings=e.storefrontRoutings?e.storefrontRoutings.map((function(e){return new d(e)})):[],c.type=e.type||u.FORM,c.visibleDevice=e.visibleDevice||m.ALL,c.isFilteredOnServerSide=e.isFilteredOnServerSide||null;var f=(null===(b=l.getMerchantSettings())||void 0===b?void 0:b.merchantId)||"",k=l.getCdnUrl()||"";return c.contentJson=e.contentJson?new i(e.contentJson,k,f):null,c}return e(b,r),b}(r);!function(e){e.ACTIVE="ACTIVE",e.DRAFT="DRAFT",e.PASSIVE="PASSIVE"}(a||(a={})),function(e){e.FORM="FORM",e.NOTIFICATION="NOTIFICATION",e.NOTIFICATION_BAR="NOTIFICATION_BAR",e.PAGE_OVERLAY="PAGE_OVERLAY",e.POPUP="POPUP"}(u||(u={})),function(e){e.ALL="ALL",e.DESKTOP="DESKTOP",e.MOBILE="MOBILE"}(m||(m={}));export{b as IkasStorefrontPopup,m as IkasStorefrontPopupDeviceTypeEnum,a as IkasStorefrontPopupStatusEnum,u as IkasStorefrontPopupTypeEnum};
1
+ import{__extends as e}from'./../../../ext/tslib/tslib.es6.js';import{IkasBaseModel as r}from"../base/index.js";import{IkasStorefrontPopupAnalytics as o}from"./storefront-popup-analytics/index.js";import{IkasStorefrontPopupDateFilter as p}from"./storefront-popup-date-filter/index.js";import{IkasStorefrontPopupDisplayFilter as s}from"./storefront-popup-display-filter/index.js";import{IkasStorefrontPopupDisplaySettings as d}from"./storefront-popup-display-settings/index.js";import{IkasStorefrontPopupPageFilter as n}from"./storefront-popup-page-filter/index.js";import{IkasStorefrontPopupRouting as i}from"./storefront-popup-routing/index.js";import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/components/index.js';import'./../../../ext/@ikas/popup-renderer/build/ext/tslib/tslib.es6.mjs.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/PhoneNumberMatcher.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/AsYouTypeFormatter.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/ParseError.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/metadata.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/PhoneNumber.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/PhoneNumberMatcher.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/AsYouType.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/Metadata.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/findNumbers/isValidCandidate.js';import'./../../../ext/@ikas/popup-renderer/build/ext/libphonenumber-js/index.es6.exports/PhoneNumberSearch.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/base/index.js';import{Popup as t}from'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/settings/index.js';import"mobx";import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/settings/visibility-condition/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/teaser/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/button/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/divider/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/checkbox/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-attribute/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-gender/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/image/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/image-column/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/product/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/product/detail-settings/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/social/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/space/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/text/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/background-settings/index.js';import'./../../../ext/@ikas/popup-renderer/build/popup-renderer/models/modal/close-settings/index.js';import{IkasStorefrontConfig as l}from"@ikas/storefront-config";var u,m,a,b=function(r){function b(e){var b,j=this;(j=r.call(this,e)||this).analytics=e.analytics?new o(e.analytics):null,j.dateFilter=e.dateFilter?new p(e.dateFilter):null,j.displayFilters=e.displayFilters?e.displayFilters.map((function(e){return new s(e)})):null,j.displaySettings=e.displaySettings?new d(e.displaySettings):new d,j.name=e.name||"",j.pageFilters=e.pageFilters?e.pageFilters.map((function(e){return new n(e)})):null,j.status=e.status||u.ACTIVE,j.storefrontRoutings=e.storefrontRoutings?e.storefrontRoutings.map((function(e){return new i(e)})):[],j.type=e.type||m.FORM,j.visibleDevice=e.visibleDevice||a.ALL,j.isFilteredOnServerSide=e.isFilteredOnServerSide||null;var x=(null===(b=l.getMerchantSettings())||void 0===b?void 0:b.merchantId)||"",_=l.getCdnUrl()||"";return j.contentJson=e.contentJson?new t(e.contentJson,_,x):null,j}return e(b,r),b}(r);!function(e){e.ACTIVE="ACTIVE",e.DRAFT="DRAFT",e.PASSIVE="PASSIVE"}(u||(u={})),function(e){e.FORM="FORM",e.NOTIFICATION="NOTIFICATION",e.NOTIFICATION_BAR="NOTIFICATION_BAR",e.PAGE_OVERLAY="PAGE_OVERLAY",e.POPUP="POPUP"}(m||(m={})),function(e){e.ALL="ALL",e.DESKTOP="DESKTOP",e.MOBILE="MOBILE"}(a||(a={}));export{b as IkasStorefrontPopup,a as IkasStorefrontPopupDeviceTypeEnum,u as IkasStorefrontPopupStatusEnum,m as IkasStorefrontPopupTypeEnum};
@@ -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{stringToSlug as y,IkasProductVariantFunctions as E}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 I}from"../../../store/base.js";import"../../../store/customer/index.js";import"../../../store/cart/index.js";import"lodash/get";var S,C,P,T,A,D=function(){function S(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,y,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,I.getInstance().customerStore.getLastViewedProducts()];case 8:return(c=e.sent())&&c.length?(n=c.map((function(t){return t.productId})),d=I.getInstance().customerStore.useLastViewedProductResponse,[3,10]):[2];case 9:return[2];case 10:return d?(p=I.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&&I.getInstance().customerStore.setSavedLastViewedProductsResponse(u),this.isStatic||this.isLastViewed?(f=this.isStatic?this._productListPropValue.productIds:I.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)&&E.hasStock(o)||(o=null==s?void 0:s.variants.find((function(t){return t.isActive&&E.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===(y=u.data)||void 0===y?void 0:y.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||C.ALL,this._pageType=a.pageType,this._sort=a.sort||a.productListPropValue.initialSort||P.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===C.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(S.prototype,"sort",{get:function(){return this._sort},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"limit",{get:function(){return this._limit},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"pageType",{get:function(){return this._pageType},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"page",{get:function(){return this._page},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"minPage",{get:function(){return this._minPage||1},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"pageCount",{get:function(){return Math.ceil(this._count/this._limit)},enumerable:!1,configurable:!0}),Object.defineProperty(S.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(S.prototype,"isInitialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"isFilterable",{get:function(){return this._type===C.ALL||this._type===C.CATEGORY},enumerable:!1,configurable:!0}),Object.defineProperty(S.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(S.prototype,"isStatic",{get:function(){return this._type===C.STATIC},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"isDiscounted",{get:function(){return this._type===C.DISCOUNTED},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"isRecommended",{get:function(){return this._type===C.RECOMMENDED},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"isLastViewed",{get:function(){return this._type===C.LAST_VIEWED},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"isRelatedProducts",{get:function(){return this._type===C.RELATED_PRODUCTS},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"isRecommendedProducts",{get:function(){return this._type===C.RECOMMENDED_PRODUCTS},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"isViewedTogetherProducts",{get:function(){return this._type===C.VIEWED_TOGETHER},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"isSearch",{get:function(){return this._type===C.SEARCH},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"hasPrev",{get:function(){return!(this.isStatic||this.isDiscounted||this.isRecommended||!this._minPage)&&this._minPage>1},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"hasNext",{get:function(){return!(this.isStatic||this.isDiscounted||this.isRecommended)&&this.page*this.limit<this.count},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),Object.defineProperty(S.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[y(t.name)]=t.keyList)})),this._searchKeyword&&(a.s=this._searchKeyword),this._sort&&(a.o=b[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",encode:!1})},enumerable:!1,configurable:!0}),Object.defineProperty(S.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(S.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(S.prototype,"isFeaturedSortEnabled",{get:function(){var t;return(null===(t=this.pageSpecificData)||void 0===t?void 0:t.orderType)===a.MANUALLY&&[C.ALL,C.CATEGORY].includes(this._type)},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"disabledSortTypes",{get:function(){return this._disabledSortTypes},enumerable:!1,configurable:!0}),S.prototype.setIsFilteredForProducts=function(){var t=this;this.data.forEach((function(e){return e.isFiltered=t.isFiltered||!1}))},S.prototype.setIsStaticForProducts=function(){var t=this;this.data.forEach((function(e){return e.isStatic=t.isStatic||!1}))},S.prototype.setPageSpecificSort=function(){var t;if((null===(t=this.pageSpecificData)||void 0===t?void 0:t.orderType)&&[C.ALL].includes(this._type))switch(this.pageSpecificData.orderType){case a.HIGHEST_DISCOUNT_RATIO:this._sort=P.DECRASING_DISCOUNT;break;case a.LOWEST_DISCOUNT_RATIO:this._sort=P.INCREASING_DISCOUNT;break;case a.HIGHEST_PRICE:this._sort=P.DECREASING_PRICE;break;case a.LOWEST_PRICE:this._sort=P.INCREASING_PRICE;break;case a.NEWEST:this._sort=P.LAST_ADDED;break;case a.OLDEST:this._sort=P.FIRST_ADDED;break;case a.MANUALLY:this._sort=P.FEATURED}},S.prototype.getSortParams=function(){var t,e;switch(this._sort){case P.INCREASING_PRICE:t=f.ASC,e=m.PRICE;break;case P.DECREASING_PRICE:t=f.DESC,e=m.PRICE;break;case P.FIRST_ADDED:t=f.ASC,e=m.CREATED_AT;break;case P.LAST_ADDED:t=f.DESC,e=m.CREATED_AT;break;case P.INCREASING_DISCOUNT:t=f.ASC,e=m.DISCOUNT_RATIO;break;case P.DECRASING_DISCOUNT:t=f.DESC,e=m.DISCOUNT_RATIO;break;case P.FEATURED:if(this.isSearch)return;t=f.ASC,e=m.MANUAL_SORT;break;case P.DEFAULT:t=void 0,e=void 0;break;case P.AVERAGE_RATING:t=f.DESC,e=m.AVERAGE_RATING;break;case P.REVIEW_COUNT:t=f.DESC,e=m.REVIEW_COUNT;break;case P.SALE_COUNT:t=f.DESC,e=m.SALE_COUNT;break;case P.A_Z:t=f.ASC,e=m.NAME;break;case P.Z_A:t=f.DESC,e=m.NAME}if(t&&e)return{direction:t,type:e}},S.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!==C.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)]}}))}))},S.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]}}))}))},S.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||t.name===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(b).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)}},S.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})))},S.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})},S.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()},S.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]}}))}))},S.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=I.getInstance().router)||void 0===o||o.push(i.href+(this.queryParams?"?"+this.queryParams:"")),t.label=3;case 3:return[2]}}))}))},S.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}},S.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)}},S.prototype.getQueryParams=function(){if(this.isBrowser())return new URLSearchParams(location.search)},S.prototype.isBrowser=function(){return"undefined"!=typeof window},S.prototype.waitForCustomerStoreInit=function(){return new Promise((function(t){var e=setInterval((function(){I.getInstance().customerStore.initialized&&(clearInterval(e),t(null))}),1e3)}))},S.prototype.handleListingEvent=function(){this.searchKeyword&&this.data.length?v.viewSearchResults(this._searchKeyword,this.data):this.data.length&&this._type===C.ALL&&v.viewListing(this.data)},S}();!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"}(C||(C={})),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"}(P||(P={})),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"}(T||(T={})),function(t){t.CATEGORY="CATEGORY",t.BRAND="BRAND"}(A||(A={}));var b=((S={})[P.INCREASING_PRICE]=1,S[P.DECREASING_PRICE]=2,S[P.LAST_ADDED]=3,S[P.FIRST_ADDED]=4,S[P.INCREASING_DISCOUNT]=5,S[P.DECRASING_DISCOUNT]=6,S[P.FEATURED]=7,S[P.DEFAULT]=8,S[P.AVERAGE_RATING]=9,S[P.REVIEW_COUNT]=10,S[P.SALE_COUNT]=11,S[P.A_Z]=12,S[P.Z_A]=13,S);export{D as IkasProductList,T as IkasProductListSortByTypeEnum,P as IkasProductListSortType,C as IkasProductListType,A 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}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};