@ikas/storefront 2.0.0-alpha.2 → 2.0.0-alpha.21

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 (178) hide show
  1. package/build/__generated__/global-types.d.ts +10 -2
  2. package/build/__generated__/global-types.js +1 -1
  3. package/build/analytics/facebookPixel.js +1 -1
  4. package/build/analytics/googleTagManager.js +1 -1
  5. package/build/analytics/head/index.js +1 -1
  6. package/build/analytics/ikas.js +1 -1
  7. package/build/api/apollo.js +1 -1
  8. package/build/api/blog/__generated__/getBlog.d.ts +14 -16
  9. package/build/api/blog/__generated__/listBlog.d.ts +14 -16
  10. package/build/api/blog/__generated__/listBlogCategory.d.ts +14 -16
  11. package/build/api/blog/__generated__/listBlogMetaData.d.ts +14 -16
  12. package/build/api/brand/__generated__/listProductBrand.d.ts +3 -3
  13. package/build/api/cart/__generated__/getCart.d.ts +2 -4
  14. package/build/api/cart/__generated__/saveItemToCart.d.ts +2 -4
  15. package/build/api/category/__generated__/listCategory.d.ts +3 -3
  16. package/build/api/checkout/__generated__/getCheckoutById.d.ts +2 -4
  17. package/build/api/checkout/__generated__/getOrder.d.ts +5 -11
  18. package/build/api/checkout/__generated__/listCheckoutSettings.d.ts +1 -1
  19. package/build/api/checkout/index.js +1 -1
  20. package/build/api/customer/__generated__/createOrderRefundRequest.d.ts +5 -11
  21. package/build/api/customer/__generated__/customerLogin.d.ts +12 -5
  22. package/build/api/customer/__generated__/customerSocialLogin.d.ts +161 -0
  23. package/build/api/customer/__generated__/getCustomerOrders.d.ts +5 -11
  24. package/build/api/customer/__generated__/getMyCustomer.d.ts +4 -5
  25. package/build/api/customer/__generated__/registerCustomer.d.ts +12 -5
  26. package/build/api/customer/__generated__/saveMyCustomer.d.ts +12 -5
  27. package/build/api/customer/index.d.ts +5 -0
  28. package/build/api/customer/index.js +1 -1
  29. package/build/api/customer-review/__generated__/listCustomerReviews.d.ts +14 -16
  30. package/build/api/raffle/__generated__/getRafflesByCustomerId.d.ts +3 -0
  31. package/build/api/raffle/__generated__/listRaffle.d.ts +14 -16
  32. package/build/api/raffle/__generated__/saveRaffleParticipant.d.ts +2 -2
  33. package/build/api/raffle/index.d.ts +1 -1
  34. package/build/api/raffle/index.js +1 -1
  35. package/build/api/variant-type/__generated__/listVariantType.d.ts +3 -7
  36. package/build/components/checkout/components/address-form/index.js +1 -1
  37. package/build/components/checkout/components/address-form/model.d.ts +8 -0
  38. package/build/components/checkout/components/cart-summary/cart-item/index.js +1 -1
  39. package/build/components/checkout/components/cart-summary/index.js +1 -1
  40. package/build/components/checkout/components/step-container/index.js +1 -1
  41. package/build/components/checkout/index.js +1 -1
  42. package/build/components/checkout/model.d.ts +2 -0
  43. package/build/components/checkout/model.js +1 -1
  44. package/build/components/checkout/steps/step-payment/payment-gateways/index.js +1 -1
  45. package/build/components/checkout/steps/step-payment/payment-gateways/installments/index.js +1 -1
  46. package/build/components/checkout/steps/step-shipping/index.js +1 -1
  47. package/build/components/checkout/steps/step-success/index.js +1 -1
  48. package/build/components/index.d.ts +1 -1
  49. package/build/components/page/ThemeComponent.js +1 -1
  50. package/build/components/page/head.js +1 -1
  51. package/build/components/page/index.js +1 -1
  52. package/build/components/page-editor/ThemeComponentEditor.d.ts +0 -3
  53. package/build/components/page-editor/ThemeComponentEditor.js +1 -1
  54. package/build/components/page-editor/index.d.ts +3 -1
  55. package/build/components/page-editor/index.js +1 -1
  56. package/build/components/page-editor/loader/index.d.ts +5 -1
  57. package/build/components/page-editor/loader/index.js +1 -1
  58. package/build/components/page-editor/loader/style.module.scss.js +1 -1
  59. package/build/components/page-editor/model.d.ts +6 -4
  60. package/build/components/page-editor/model.js +1 -1
  61. package/build/ext/@apollo/client/cache/inmemory/entityStore.js +1 -1
  62. package/build/ext/@apollo/client/cache/inmemory/inMemoryCache.js +1 -1
  63. package/build/ext/@apollo/client/cache/inmemory/policies.js +1 -1
  64. package/build/ext/@apollo/client/cache/inmemory/readFromStore.js +1 -1
  65. package/build/ext/@apollo/client/cache/inmemory/writeToStore.js +1 -1
  66. package/build/ext/@apollo/client/core/ApolloClient.js +1 -1
  67. package/build/ext/@apollo/client/core/LocalState.js +1 -1
  68. package/build/ext/@apollo/client/core/ObservableQuery.js +1 -1
  69. package/build/ext/@apollo/client/core/QueryManager.js +1 -1
  70. package/build/ext/@apollo/client/errors/index.js +1 -1
  71. package/build/ext/@apollo/client/ext/tslib/tslib.es6.js +15 -0
  72. package/build/ext/@apollo/client/link/context/index.js +1 -1
  73. package/build/ext/@apollo/client/link/core/ApolloLink.js +1 -1
  74. package/build/ext/@apollo/client/link/error/index.js +1 -1
  75. package/build/ext/@apollo/client/link/http/HttpLink.js +1 -1
  76. package/build/ext/@apollo/client/link/http/createHttpLink.js +1 -1
  77. package/build/ext/@apollo/client/link/http/selectHttpOptionsAndBody.js +1 -1
  78. package/build/ext/@apollo/client/link/utils/createOperation.js +1 -1
  79. package/build/ext/@apollo/client/utilities/common/mergeDeep.js +1 -1
  80. package/build/ext/@apollo/client/utilities/graphql/fragments.js +1 -1
  81. package/build/ext/@apollo/client/utilities/graphql/transform.js +1 -1
  82. package/build/ext/@apollo/client/utilities/observables/Concast.js +1 -1
  83. package/build/ext/ts-invariant/ext/tslib/tslib.es6.js +15 -0
  84. package/build/ext/ts-invariant/lib/invariant.esm.js +1 -1
  85. package/build/ext/tslib/tslib.es6.js +1 -1
  86. package/build/ikas.js +67 -2
  87. package/build/index.d.ts +1 -0
  88. package/build/index.js +1 -1
  89. package/build/models/data/blog/index.js +1 -1
  90. package/build/models/data/brand/index.js +1 -1
  91. package/build/models/data/category/index.js +1 -1
  92. package/build/models/data/checkout/index.js +1 -1
  93. package/build/models/data/checkout-settings/index.d.ts +1 -1
  94. package/build/models/data/checkout-settings/index.js +1 -1
  95. package/build/models/data/customer/address/index.d.ts +4 -1
  96. package/build/models/data/customer/address/index.js +1 -1
  97. package/build/models/data/image/index.js +1 -1
  98. package/build/models/data/index.d.ts +1 -0
  99. package/build/models/data/language/index.d.ts +6 -0
  100. package/build/models/data/order/address/index.d.ts +2 -1
  101. package/build/models/data/order/address/index.js +1 -1
  102. package/build/models/data/order/index.js +1 -1
  103. package/build/models/data/order/line-item/variant/index.js +1 -1
  104. package/build/models/data/product/index.js +1 -1
  105. package/build/models/data/product-filter/index.js +1 -1
  106. package/build/models/data/product-option-set/index.d.ts +4 -0
  107. package/build/models/data/product-option-set/index.js +1 -1
  108. package/build/models/data/raffle/index.d.ts +2 -1
  109. package/build/models/data/raffle/index.js +1 -1
  110. package/build/models/data/slider/index.d.ts +5 -0
  111. package/build/models/data/slider/index.js +1 -0
  112. package/build/models/theme/component/index.d.ts +9 -0
  113. package/build/models/theme/component/index.js +1 -1
  114. package/build/models/theme/component/prop/index.d.ts +21 -0
  115. package/build/models/theme/component/prop/index.js +1 -1
  116. package/build/models/theme/custom-data/index.d.ts +20 -1
  117. package/build/models/theme/custom-data/index.js +1 -1
  118. package/build/models/theme/settings/color/index.d.ts +14 -0
  119. package/build/models/theme/settings/color/index.js +1 -0
  120. package/build/models/theme/settings/{prop/favicon → favicon}/index.d.ts +0 -0
  121. package/build/models/theme/settings/{prop/favicon → favicon}/index.js +0 -0
  122. package/build/models/theme/settings/font-family/index.d.ts +5 -0
  123. package/build/models/theme/settings/font-family/index.js +1 -0
  124. package/build/models/theme/settings/index.d.ts +4 -2
  125. package/build/models/theme/settings/index.js +1 -1
  126. package/build/models/ui/product-detail/index.js +1 -1
  127. package/build/models/ui/product-list/index.d.ts +1 -1
  128. package/build/models/ui/product-list/index.js +1 -1
  129. package/build/models/ui/validator/form/account-info.js +1 -1
  130. package/build/models/ui/validator/form/address.js +1 -1
  131. package/build/models/ui/validator/form/register.js +1 -1
  132. package/build/pages/checkout.js +1 -1
  133. package/build/pages/editor.d.ts +4 -3
  134. package/build/pages/editor.js +1 -1
  135. package/build/providers/page-data-get.d.ts +1 -1
  136. package/build/providers/page-data-get.js +1 -1
  137. package/build/providers/page-data-init.d.ts +3 -1
  138. package/build/providers/page-data-init.js +1 -1
  139. package/build/providers/page-data-next.d.ts +2 -1
  140. package/build/providers/page-data-next.js +1 -1
  141. package/build/providers/prop-value/custom.d.ts +1 -0
  142. package/build/providers/prop-value/custom.js +1 -1
  143. package/build/providers/prop-value/slider.d.ts +11 -0
  144. package/build/providers/prop-value/slider.js +1 -0
  145. package/build/scripts/generators/api/index.d.ts +3 -3
  146. package/build/scripts/generators/api/index.js +1 -0
  147. package/build/scripts/generators/api/info.d.ts +4 -4
  148. package/build/scripts/generators/api/info.js +1 -0
  149. package/build/scripts/generators/components/index.d.ts +4 -4
  150. package/build/scripts/generators/components/index.js +1 -0
  151. package/build/scripts/generators/config/content.d.ts +4 -3
  152. package/build/scripts/generators/config/content.js +1 -0
  153. package/build/scripts/generators/config/index.d.ts +6 -6
  154. package/build/scripts/generators/config/index.js +1 -0
  155. package/build/scripts/generators/index.d.ts +7 -0
  156. package/build/scripts/generators/pages/index.d.ts +4 -4
  157. package/build/scripts/generators/pages/index.js +1 -0
  158. package/build/scripts/generators/pages/info.js +1 -0
  159. package/build/scripts/generators/store/content.js +1 -0
  160. package/build/scripts/generators/store/index.d.ts +2 -2
  161. package/build/scripts/generators/store/index.js +1 -0
  162. package/build/scripts/generators/theme/index.d.ts +4 -4
  163. package/build/scripts/generators/theme/index.js +1 -0
  164. package/build/scripts/generators/types/index.d.ts +15 -0
  165. package/build/scripts/generators/types/index.js +1 -0
  166. package/build/store/cart.d.ts +6 -7
  167. package/build/store/cart.js +1 -1
  168. package/build/store/customer.d.ts +19 -0
  169. package/build/store/customer.js +1 -1
  170. package/build/storefront/index.d.ts +5 -3
  171. package/build/storefront/index.js +1 -1
  172. package/build/utils/fs.d.ts +2 -2
  173. package/build/utils/fs.js +1 -0
  174. package/build/utils/google-fonts.d.ts +2 -0
  175. package/build/utils/google-fonts.js +1 -0
  176. package/package.json +8 -7
  177. package/build/models/theme/settings/prop/color/index.d.ts +0 -7
  178. package/build/models/theme/settings/prop/color/index.js +0 -1
@@ -1 +1 @@
1
- import{renderComponent as e}from"../components/page/index.js";import{IkasBlogCategory as t,IkasBlog as i}from"../models/data/blog/index.js";import{IkasBrand as a}from"../models/data/brand/index.js";import{IkasCategory as r}from"../models/data/category/index.js";import"../models/data/checkout/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/index.js";import"../models/data/customer-review/index.js";import"../models/data/html-meta-data/index.js";import{IkasImage as o}from"../models/data/image/index.js";import"../models/data/installment-info/index.js";import"../models/data/order/index.js";import"../models/data/order/line-item/index.js";import{observable as n}from"mobx";import"../models/data/product/index.js";import"../models/data/variant-type/index.js";import"../models/data/product/variant/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product-attribute/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product-filter/index.js";import"../models/data/variant-type/variant-value/index.js";import"../models/data/order-transaction/index.js";import"../models/data/product-option-set/index.js";import{IkasRaffle as u}from"../models/data/raffle/index.js";import"../models/theme/theme.js";import{IkasThemePageType as s}from"../models/theme/page/index.js";import{IkasThemePageComponent as l}from"../models/theme/page/component/index.js";import{IkasThemeComponent as p}from"../models/theme/component/index.js";import{IkasThemeComponentPropType as m}from"../models/theme/component/prop/index.js";import"../models/theme/page/component/prop-value/link.js";import{IkasBrandList as c}from"../models/ui/brand-list/index.js";import{IkasBlogList as d}from"../models/ui/blog-list/index.js";import{IkasBlogCategoryList as f}from"../models/ui/blog-category-list/index.js";import{IkasCategoryList as V}from"../models/ui/category-list/index.js";import{IkasNavigationLink as P}from"../models/ui/navigation-link/index.js";import{IkasProductDetail as g}from"../models/ui/product-detail/index.js";import{IkasProductList as L}from"../models/ui/product-list/index.js";import{IkasAttributeDetail as _}from"../models/ui/product-attribute-detail/index.js";import{IkasAttributeList as h}from"../models/ui/product-attribute-list/index.js";import"../models/ui/customer-review-list/index.js";import"../models/ui/validator/index.js";import"../models/ui/validator/rules/index.js";import"../models/ui/validator/form/login.js";import"../models/ui/validator/form/address.js";import"../models/ui/validator/form/register.js";import"../models/ui/validator/form/contact-form.js";import"../models/ui/validator/form/forgot-password.js";import"../models/ui/validator/form/recover-password.js";import"../models/ui/validator/form/account-info.js";import"../models/ui/validator/form/raffle-form.js";import"../models/ui/validator/form/customer-review.js";import{IkasComponentRenderer as D}from"../models/ui/component-renderer/index.js";import{IkasRaffleList as v}from"../models/ui/raffle-list/index.js";import{IkasThemeSettings as C}from"../models/theme/settings/index.js";import"../models/theme/custom-data/index.js";import T from'../ext/lzutf8/build/production/lzutf8.js';import{IkasPageComponentPropValue as b}from"./page-data-get.js";import{getPlaceholderBrand as j,getPlaceholderCategory as B,getPlaceholderProduct as w,getPlaceholderBlog as I,getPlaceholderBlogCategory as S,getPlaceholderRaffle as x}from"./placeholders.js";var O=function(){function O(){}return O.setPageSpecificData=function(e,a,o){if(e){var n=JSON.parse(e);switch(a){case s.PRODUCT:var l=n;O.pageSpecificData=new g(l.product,l.selectedVariantValues),o&&this._initProductDetailOnBrowser(O.pageSpecificData);break;case s.CATEGORY:var p=n;O.pageSpecificData=new r(p);break;case s.BRAND:var m=n;O.pageSpecificData=new r(m);break;case s.BLOG:var c=n;O.pageSpecificData=new i(c);break;case s.BLOG_CATEGORY:var d=n;O.pageSpecificData=new t(d);break;case s.RAFFLE_DETAIL:var f=n;O.pageSpecificData=new u(f)}}},O.isServer=function(){return"undefined"==typeof window},O.initPropValues=function(e,t,i,a,r){var o=new C(JSON.parse(i)),n=a?T.decompress(e,{inputEncoding:"Base64"}):e,u=JSON.parse(n).map((function(e){return{pageComponent:new l(e.pageComponent),component:new p(e.component),propValues:e.propValues}}));return u.forEach((function(e){e.component.props.forEach((function(i){var a=e.propValues[i.name];if(null!=a)switch(i.type){case m.IMAGE:O.initImagePropValue(i,a,e);break;case m.IMAGE_LIST:O.initImageListPropValue(i,a,e);break;case m.BRAND:O.initBrandPropValue(i,a,e);break;case m.BRAND_LIST:O.initBrandListPropValue(i,a,e);break;case m.CATEGORY:O.initCategoryPropValue(i,a,e);break;case m.CATEGORY_LIST:O.initCategoryListPropValue(i,a,e);break;case m.PRODUCT_LIST:O.initProductListPropValue(i,a,e,t);break;case m.PRODUCT_DETAIL:O.initProductDetailPropValue(i,a,e,t);break;case m.PRODUCT_ATTRIBUTE:O.initAttributePropValue(i,a,e);break;case m.PRODUCT_ATTRIBUTE_LIST:O.initAttributeListPropValue(i,a,e);break;case m.LINK:case m.LIST_OF_LINK:O.initLinkPropValue(i,a,e);break;case m.COMPONENT:O.initComponentPropValue(i,a,e,t,o,r);break;case m.COMPONENT_LIST:O.initComponentListPropValue(i,a,e,t,o,r);break;case m.CUSTOM:O.initCustomDataPropValue(i,a,e,t,o,r);break;case m.BLOG:O.initBlogPropValue(i,a,e);break;case m.BLOG_LIST:O.initBlogListPropValue(i,a,e);break;case m.BLOG_CATEGORY:O.initBlogCategoryPropValue(i,a,e);break;case m.BLOG_LIST:O.initBlogCategoryListPropValue(i,a,e);break;case m.RAFFLE:O.initRafflePropValue(i,a,e);break;case m.RAFFLE_LIST:O.initRaffleListPropValue(i,a,e)}}))})),u},O.initBrandPropValue=function(e,t,i){i.propValues[e.name]=O._initBrandPropValue(t)},O._initBrandPropValue=function(e){return e.brandPropValue.usePageData?this.pageSpecificData:e.brand?new a(e.brand):j()},O.initBrandListPropValue=function(e,t,i){i.propValues[e.name]=O._initBrandListPropValue(t)},O._initBrandListPropValue=function(e){return new c(e)},O.initCategoryPropValue=function(e,t,i){i.propValues[e.name]=O._initCategoryPropValue(t)},O._initCategoryPropValue=function(e){return e.categoryPropValue.usePageData?this.pageSpecificData:e.category?new r(e.category):B()},O.initCategoryListPropValue=function(e,t,i){var a=new V(t);i.propValues[e.name]=a},O._initCategoryListPropValue=function(e){return new V(e)},O.initProductListPropValue=function(e,t,i,a){i.propValues[e.name]=this._initProductListPropValue(t,a)},O._initProductListPropValue=function(e,t){return new L(e,t)},O.initProductDetailPropValue=function(e,t,i,a){i.propValues[e.name]=this._initProductDetailPropValue(t,a)},O._initProductDetailPropValue=function(e,t){var i=w();return e.productDetailPropValue.usePageData?i=this.pageSpecificData:e.productDetail&&(i=new g(e.productDetail.product,e.productDetail.selectedVariantValues)),i.router=t,i},O._initProductDetailOnBrowser=function(e){var t=new URLSearchParams(window.location.search),i=t.get("vid");if(i){var a=e.product.variants.find((function(e){return e.id===i}));a&&(e.selectedVariantValues=a.variantValues)}else{var r=e.product.variantTypes.map((function(e){return e.variantType.slug})),o=[];r.forEach((function(i,a){var r=e.product.variantTypes[a],n=t.get(i);if(n){var u=r.variantType.values.find((function(e){return e.slug===n}));u&&o.push(u)}})),o.length===e.selectedVariantValues.length&&(e.selectedVariantValues=o)}},O.initAttributePropValue=function(e,t,i){i.propValues[e.name]=O._initAttributePropValue(t)},O._initAttributePropValue=function(e){var t=null;return e.attributePropValue.usePageData?t=this.pageSpecificData:e.productDetail&&(t=new g(e.productDetail.product,e.productDetail.selectedVariantValues)),new _(t,e.attributePropValue)},O.initAttributeListPropValue=function(e,t,i){i.propValues[e.name]=O._initAttributeListPropValue(t)},O._initAttributeListPropValue=function(e){var t=null;return e.attributeListPropValue.usePageData?t=this.pageSpecificData:e.productDetail&&(t=new g(e.productDetail.product,e.productDetail.selectedVariantValues)),new h(t,e.attributeListPropValue)},O.initLinkPropValue=function(e,t,i){i.propValues[e.name]=this._initLinkPropValue(t)},O._initLinkPropValue=function(e){return Array.isArray(e)?e.map((function(e){return new P(e.href,e.label,e.subLinks,e.isExternal||void 0)})):e?new P(e.href,e.label,e.subLinks,e.isExternal):void 0},O.initImagePropValue=function(e,t,i){i.propValues[e.name]=this._initImagePropValue(t)},O._initImagePropValue=function(e){return new o(e.id)},O.initImageListPropValue=function(e,t,i){i.propValues[e.name]=this._initImageListPropValue(t)},O._initImageListPropValue=function(e){return e.map((function(e){return new o(e.id)}))},O.initCustomDataPropValue=function(e,t,i,a,r,o){t&&t.value&&t.customData&&(i.propValues[e.name]=this._initCustomDataPropValue(t,t.customData,a,r,o))},O._initCustomDataPropValue=function(e,t,i,a,r){var o=this;if(!e)return null;var n=e.value;if(null==n)return null;switch(t.type){case m.BRAND:return this._initBrandPropValue(n);case m.BRAND_LIST:return this._initBrandListPropValue(n);case m.CATEGORY_LIST:return this._initCategoryListPropValue(n);case m.CATEGORY:return this._initCategoryPropValue(n);case m.IMAGE_LIST:return this._initImageListPropValue(n);case m.IMAGE:return this._initImagePropValue(n);case m.LINK:return this._initLinkPropValue(n);case m.PRODUCT_DETAIL:return this._initProductDetailPropValue(n,i);case m.PRODUCT_LIST:return this._initProductListPropValue(n,i);case m.PRODUCT_ATTRIBUTE:return this._initAttributePropValue(n);case m.PRODUCT_ATTRIBUTE_LIST:return this._initAttributeListPropValue(n);case m.BLOG:return this._initBlogPropValue(n);case m.BLOG_LIST:return this._initBlogListPropValue(n);case m.BLOG_CATEGORY:return this._initBlogCategoryPropValue(n);case m.BLOG_CATEGORY_LIST:return this._initBlogCategoryListPropValue(n);case m.RAFFLE:return this._initRafflePropValue(n);case m.RAFFLE_LIST:return this._initRaffleListPropValue(n);case m.OBJECT:for(var u={},s=0,l=t.nestedData||[];s<l.length;s++){var p=l[s],c=n[p.key],d=void 0;p.customDataId&&(d=c.customData),u[p.key]=this._initCustomDataPropValue(c,d||p,i,a,r)}return u;case m.DYNAMIC_LIST:case m.STATIC_LIST:try{if(!n||!n.length)return null;var f=[],V=t.nestedData[0];return n.forEach((function(e){var t;V.customDataId&&(t=e.customData),f.push(o._initCustomDataPropValue(e,t||V,i,a,r))})),f}catch(e){return[]}case m.COMPONENT:return this._initComponentPropValue(n,i,a,r);case m.COMPONENT_LIST:return this._initComponentListPropValue(n,i,a,r);default:return n}},O.initComponentPropValue=function(e,t,i,a,r,o){i.propValues[e.name]=this._initComponentPropValue(t,a,r,o)},O._initComponentPropValue=function(t,i,a,r){var o=t.length?t[0]:void 0;if(o){var n=new b(o),u=this.initPropValues(JSON.stringify([n]),i,JSON.stringify(a),!1,r);if(u.length)return new D((function(){return e(u[0],a,-10)}))}},O.initComponentListPropValue=function(e,t,i,a,r,o){i.propValues[e.name]=this._initComponentListPropValue(t,a,r,o)},O._initComponentListPropValue=function(t,i,a,r){var o=this;return t&&t.length?t.map((function(t){var n=new b(t),u=o.initPropValues(JSON.stringify([n]),i,JSON.stringify(a),!1,r);return new D((function(){return e(u[0],a,-1)}))})):[]},O.initBlogPropValue=function(e,t,i){i.propValues[e.name]=O._initBlogPropValue(t)},O._initBlogPropValue=function(e){return e.blogPropValue.usePageData?this.pageSpecificData:e.blog?new i(e.blog):I()},O.initBlogListPropValue=function(e,t,i){i.propValues[e.name]=this._initBlogListPropValue(t)},O._initBlogListPropValue=function(e){return new d(e)},O.initBlogCategoryPropValue=function(e,t,i){i.propValues[e.name]=O._initBlogCategoryPropValue(t)},O._initBlogCategoryPropValue=function(e){return e.blogCategoryPropValue.usePageData?this.pageSpecificData:e.blogCategory?new t(e.blogCategory):S()},O.initBlogCategoryListPropValue=function(e,t,i){i.propValues[e.name]=this._initBlogCategoryListPropValue(t)},O._initBlogCategoryListPropValue=function(e){return new f(e)},O.initRafflePropValue=function(e,t,i){i.propValues[e.name]=O._initRafflePropValue(t)},O._initRafflePropValue=function(e){return e.rafflePropValue.usePageData?this.pageSpecificData:e.raffle?new u(e.raffle):x()},O.initRaffleListPropValue=function(e,t,i){i.propValues[e.name]=this._initRaffleListPropValue(t)},O._initRaffleListPropValue=function(e){return new v(e)},O.pageSpecificData=n({}),O}();export{O as IkasPageDataInit};
1
+ import{renderComponent as e}from"../components/page/index.js";import{IkasBlogCategory as t,IkasBlog as i}from"../models/data/blog/index.js";import{IkasBrand as a}from"../models/data/brand/index.js";import{IkasCategory as r}from"../models/data/category/index.js";import"../models/data/checkout/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/index.js";import"../models/data/customer-review/index.js";import"../models/data/html-meta-data/index.js";import{IkasImage as o}from"../models/data/image/index.js";import"../models/data/installment-info/index.js";import"../models/data/order/index.js";import"../models/data/order/line-item/index.js";import{observable as n}from"mobx";import"../models/data/product/index.js";import"../models/data/variant-type/index.js";import"../models/data/product/variant/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product-attribute/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product-filter/index.js";import"../models/data/variant-type/variant-value/index.js";import"../models/data/order-transaction/index.js";import"../models/data/product-option-set/index.js";import{IkasRaffle as u}from"../models/data/raffle/index.js";import{IkasSlider as s}from"../models/data/slider/index.js";import"../models/theme/theme.js";import{IkasThemePageType as l}from"../models/theme/page/index.js";import{IkasThemePageComponent as p}from"../models/theme/page/component/index.js";import{IkasThemeComponent as m}from"../models/theme/component/index.js";import{IkasThemeComponentPropType as c}from"../models/theme/component/prop/index.js";import"../models/theme/page/component/prop-value/link.js";import{IkasBrandList as d}from"../models/ui/brand-list/index.js";import{IkasBlogList as f}from"../models/ui/blog-list/index.js";import{IkasBlogCategoryList as V}from"../models/ui/blog-category-list/index.js";import{IkasCategoryList as P}from"../models/ui/category-list/index.js";import{IkasNavigationLink as g}from"../models/ui/navigation-link/index.js";import{IkasProductDetail as _}from"../models/ui/product-detail/index.js";import{IkasProductList as L}from"../models/ui/product-list/index.js";import{IkasAttributeDetail as h}from"../models/ui/product-attribute-detail/index.js";import{IkasAttributeList as D}from"../models/ui/product-attribute-list/index.js";import"../models/ui/customer-review-list/index.js";import"../models/ui/validator/index.js";import"../models/ui/validator/rules/index.js";import"../models/ui/validator/form/login.js";import"../models/ui/validator/form/address.js";import"../models/ui/validator/form/register.js";import"../models/ui/validator/form/contact-form.js";import"../models/ui/validator/form/forgot-password.js";import"../models/ui/validator/form/recover-password.js";import"../models/ui/validator/form/account-info.js";import"../models/ui/validator/form/raffle-form.js";import"../models/ui/validator/form/customer-review.js";import{IkasComponentRenderer as v}from"../models/ui/component-renderer/index.js";import{IkasRaffleList as C}from"../models/ui/raffle-list/index.js";import{IkasThemeSettings as T}from"../models/theme/settings/index.js";import"../models/theme/custom-data/index.js";import b from'../ext/lzutf8/build/production/lzutf8.js';import{IkasPageComponentPropValue as j}from"./page-data-get.js";import{getPlaceholderBrand as S,getPlaceholderCategory as B,getPlaceholderProduct as I,getPlaceholderBlog as w,getPlaceholderBlogCategory as x,getPlaceholderRaffle as O}from"./placeholders.js";var y=function(){function y(){}return y.setPageSpecificData=function(e,a,o){if(e){var n=JSON.parse(e);switch(a){case l.PRODUCT:var s=n;y.pageSpecificData=new _(s.product,s.selectedVariantValues),o&&this._initProductDetailOnBrowser(y.pageSpecificData);break;case l.CATEGORY:var p=n;y.pageSpecificData=new r(p);break;case l.BRAND:var m=n;y.pageSpecificData=new r(m);break;case l.BLOG:var c=n;y.pageSpecificData=new i(c);break;case l.BLOG_CATEGORY:var d=n;y.pageSpecificData=new t(d);break;case l.RAFFLE_DETAIL:var f=n;y.pageSpecificData=new u(f)}}},y.isServer=function(){return"undefined"==typeof window},y.initPropValues=function(e,t,i,a,r){var o=new T(JSON.parse(i)),n=a?b.decompress(e,{inputEncoding:"Base64"}):e,u=JSON.parse(n).map((function(e){return{pageComponent:new p(e.pageComponent),component:new m(e.component),propValues:e.propValues}}));return u.forEach((function(e){e.component.props.forEach((function(i){var a=e.propValues[i.name];if(null!=a)switch(i.type){case c.IMAGE:y.initImagePropValue(i,a,e);break;case c.IMAGE_LIST:y.initImageListPropValue(i,a,e);break;case c.BRAND:y.initBrandPropValue(i,a,e);break;case c.BRAND_LIST:y.initBrandListPropValue(i,a,e);break;case c.CATEGORY:y.initCategoryPropValue(i,a,e);break;case c.CATEGORY_LIST:y.initCategoryListPropValue(i,a,e);break;case c.PRODUCT_LIST:y.initProductListPropValue(i,a,e,t);break;case c.PRODUCT_DETAIL:y.initProductDetailPropValue(i,a,e,t);break;case c.PRODUCT_ATTRIBUTE:y.initAttributePropValue(i,a,e);break;case c.PRODUCT_ATTRIBUTE_LIST:y.initAttributeListPropValue(i,a,e);break;case c.LINK:case c.LIST_OF_LINK:y.initLinkPropValue(i,a,e);break;case c.COMPONENT:y.initComponentPropValue(i,a,e,t,o,r);break;case c.COMPONENT_LIST:y.initComponentListPropValue(i,a,e,t,o,r);break;case c.CUSTOM:y.initCustomDataPropValue(i,a,e,t,o,r);break;case c.BLOG:y.initBlogPropValue(i,a,e);break;case c.BLOG_LIST:y.initBlogListPropValue(i,a,e);break;case c.BLOG_CATEGORY:y.initBlogCategoryPropValue(i,a,e);break;case c.BLOG_LIST:y.initBlogCategoryListPropValue(i,a,e);break;case c.RAFFLE:y.initRafflePropValue(i,a,e);break;case c.RAFFLE_LIST:y.initRaffleListPropValue(i,a,e);break;case c.SLIDER:y.initSliderPropValue(i,a,e)}}))})),u},y.initBrandPropValue=function(e,t,i){i.propValues[e.name]=y._initBrandPropValue(t)},y._initBrandPropValue=function(e){return e.brandPropValue.usePageData?this.pageSpecificData:e.brand?new a(e.brand):S()},y.initBrandListPropValue=function(e,t,i){i.propValues[e.name]=y._initBrandListPropValue(t)},y._initBrandListPropValue=function(e){return new d(e)},y.initCategoryPropValue=function(e,t,i){i.propValues[e.name]=y._initCategoryPropValue(t)},y._initCategoryPropValue=function(e){return e.categoryPropValue.usePageData?this.pageSpecificData:e.category?new r(e.category):B()},y.initCategoryListPropValue=function(e,t,i){var a=new P(t);i.propValues[e.name]=a},y._initCategoryListPropValue=function(e){return new P(e)},y.initProductListPropValue=function(e,t,i,a){i.propValues[e.name]=this._initProductListPropValue(t,a)},y._initProductListPropValue=function(e,t){return new L(e,t)},y.initProductDetailPropValue=function(e,t,i,a){i.propValues[e.name]=this._initProductDetailPropValue(t,a)},y._initProductDetailPropValue=function(e,t){var i=I();return e.productDetailPropValue.usePageData?i=this.pageSpecificData:e.productDetail&&(i=new _(e.productDetail.product,e.productDetail.selectedVariantValues)),i.router=t,i},y._initProductDetailOnBrowser=function(e){var t=new URLSearchParams(window.location.search),i=t.get("vid");if(i){var a=e.product.variants.find((function(e){return e.id===i}));a&&(e.selectedVariantValues=a.variantValues)}else{var r=e.product.variantTypes.map((function(e){return e.variantType.slug})),o=[];r.forEach((function(i,a){var r=e.product.variantTypes[a],n=t.get(i);if(n){var u=r.variantType.values.find((function(e){return e.slug===n}));u&&o.push(u)}})),o.length===e.selectedVariantValues.length&&(e.selectedVariantValues=o)}},y.initAttributePropValue=function(e,t,i){i.propValues[e.name]=y._initAttributePropValue(t)},y._initAttributePropValue=function(e){var t=null;return e.attributePropValue.usePageData?t=this.pageSpecificData:e.productDetail&&(t=new _(e.productDetail.product,e.productDetail.selectedVariantValues)),new h(t,e.attributePropValue)},y.initAttributeListPropValue=function(e,t,i){i.propValues[e.name]=y._initAttributeListPropValue(t)},y._initAttributeListPropValue=function(e){var t=null;return e.attributeListPropValue.usePageData?t=this.pageSpecificData:e.productDetail&&(t=new _(e.productDetail.product,e.productDetail.selectedVariantValues)),new D(t,e.attributeListPropValue)},y.initLinkPropValue=function(e,t,i){i.propValues[e.name]=this._initLinkPropValue(t)},y._initLinkPropValue=function(e){return Array.isArray(e)?e.map((function(e){return new g(e.href,e.label,e.subLinks,e.isExternal||void 0)})):e?new g(e.href,e.label,e.subLinks,e.isExternal):void 0},y.initImagePropValue=function(e,t,i){i.propValues[e.name]=this._initImagePropValue(t)},y._initImagePropValue=function(e){return new o(e.id)},y.initImageListPropValue=function(e,t,i){i.propValues[e.name]=this._initImageListPropValue(t)},y._initImageListPropValue=function(e){return e.map((function(e){return new o(e.id)}))},y.initCustomDataPropValue=function(e,t,i,a,r,o){t&&t.value&&t.customData&&(i.propValues[e.name]=this._initCustomDataPropValue(t,t.customData,a,r,o))},y._initCustomDataPropValue=function(e,t,i,a,r){var o=this;if(!e)return null;var n=e.value;if(null==n)return null;switch(t.type){case c.BRAND:return this._initBrandPropValue(n);case c.BRAND_LIST:return this._initBrandListPropValue(n);case c.CATEGORY_LIST:return this._initCategoryListPropValue(n);case c.CATEGORY:return this._initCategoryPropValue(n);case c.IMAGE_LIST:return this._initImageListPropValue(n);case c.IMAGE:return this._initImagePropValue(n);case c.LINK:return this._initLinkPropValue(n);case c.PRODUCT_DETAIL:return this._initProductDetailPropValue(n,i);case c.PRODUCT_LIST:return this._initProductListPropValue(n,i);case c.PRODUCT_ATTRIBUTE:return this._initAttributePropValue(n);case c.PRODUCT_ATTRIBUTE_LIST:return this._initAttributeListPropValue(n);case c.BLOG:return this._initBlogPropValue(n);case c.BLOG_LIST:return this._initBlogListPropValue(n);case c.BLOG_CATEGORY:return this._initBlogCategoryPropValue(n);case c.BLOG_CATEGORY_LIST:return this._initBlogCategoryListPropValue(n);case c.RAFFLE:return this._initRafflePropValue(n);case c.RAFFLE_LIST:return this._initRaffleListPropValue(n);case c.SLIDER:return this._initSliderPropValue(n);case c.OBJECT:for(var u={},s=0,l=t.nestedData||[];s<l.length;s++){var p=l[s],m=n[p.key],d=void 0;p.customDataId&&(d=m.customData),u[p.key]=this._initCustomDataPropValue(m,d||p,i,a,r)}return u;case c.DYNAMIC_LIST:case c.STATIC_LIST:try{if(!n||!n.length)return null;var f=[],V=t.nestedData[0];return n.forEach((function(e){var t;V.customDataId&&(t=e.customData),f.push(o._initCustomDataPropValue(e,t||V,i,a,r))})),f}catch(e){return[]}case c.COMPONENT:return this._initComponentPropValue(n,i,a,r);case c.COMPONENT_LIST:return this._initComponentListPropValue(n,i,a,r);default:return n}},y.initComponentPropValue=function(e,t,i,a,r,o){i.propValues[e.name]=this._initComponentPropValue(t,a,r,o)},y._initComponentPropValue=function(t,i,a,r){var o=t.length?t[0]:void 0;if(o){var n=new j(o),u=this.initPropValues(JSON.stringify([n]),i,JSON.stringify(a),!1,r);if(u.length)return new v((function(){return e(u[0],a,-10)}))}},y.initComponentListPropValue=function(e,t,i,a,r,o){i.propValues[e.name]=this._initComponentListPropValue(t,a,r,o)},y._initComponentListPropValue=function(t,i,a,r){var o=this;return t&&t.length?t.map((function(t){var n=new j(t),u=o.initPropValues(JSON.stringify([n]),i,JSON.stringify(a),!1,r);return new v((function(){return e(u[0],a,-1)}))})):[]},y.initBlogPropValue=function(e,t,i){i.propValues[e.name]=y._initBlogPropValue(t)},y._initBlogPropValue=function(e){return e.blogPropValue.usePageData?this.pageSpecificData:e.blog?new i(e.blog):w()},y.initBlogListPropValue=function(e,t,i){i.propValues[e.name]=this._initBlogListPropValue(t)},y._initBlogListPropValue=function(e){return new f(e)},y.initBlogCategoryPropValue=function(e,t,i){i.propValues[e.name]=y._initBlogCategoryPropValue(t)},y._initBlogCategoryPropValue=function(e){return e.blogCategoryPropValue.usePageData?this.pageSpecificData:e.blogCategory?new t(e.blogCategory):x()},y.initBlogCategoryListPropValue=function(e,t,i){i.propValues[e.name]=this._initBlogCategoryListPropValue(t)},y._initBlogCategoryListPropValue=function(e){return new V(e)},y.initRafflePropValue=function(e,t,i){i.propValues[e.name]=y._initRafflePropValue(t)},y._initRafflePropValue=function(e){return e.rafflePropValue.usePageData?this.pageSpecificData:e.raffle?new u(e.raffle):O()},y.initRaffleListPropValue=function(e,t,i){i.propValues[e.name]=this._initRaffleListPropValue(t)},y._initRaffleListPropValue=function(e){return new C(e)},y.initSliderPropValue=function(e,t,i){i.propValues[e.name]=this._initSliderPropValue(t)},y._initSliderPropValue=function(e){return new s(e)},y.pageSpecificData=n({}),y}();export{y as IkasPageDataInit};
@@ -6,7 +6,7 @@ import { IkasStorefront } from "../models/data/storefront";
6
6
  import { IkasSalesChannel } from "../models/data/sales-channel";
7
7
  import { IkasStorefrontRouting } from "../models/data/storefront/routing";
8
8
  import { IkasStorefrontThemeLocalization } from "../models/data/storefront/theme-localization";
9
- import { IkasThemeFavicon } from "../models/theme/settings/prop/favicon";
9
+ import { IkasThemeFavicon } from "../models/theme/settings/favicon";
10
10
  import { IkasThemeSettings, IkasThemeStockPreference } from "../models/theme/settings";
11
11
  import { IkasProductBackInStockSettings } from "../models/data/product-back-in-stock-settings";
12
12
  export declare class IkasNextPageDataProvider {
@@ -227,6 +227,7 @@ export declare class IkasNextPageDataProvider {
227
227
  revalidate?: undefined;
228
228
  }>;
229
229
  static createColorScript(settings: IkasThemeSettings): string | undefined;
230
+ static createFontScript(settings: IkasThemeSettings): string | undefined;
230
231
  }
231
232
  export declare type SettingsData = {
232
233
  storefront: IkasStorefront;
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as o,__assign as t,__spreadArrays as r}from'../ext/tslib/tslib.es6.js';import i from"fs";import n from"next/config.js";import"../models/data/blog/index.js";import"../models/data/brand/index.js";import"../models/data/category/index.js";import"../models/data/checkout/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/index.js";import"../models/data/customer-review/index.js";import"../models/data/html-meta-data/index.js";import"../models/data/image/index.js";import"../models/data/installment-info/index.js";import"../models/data/order/index.js";import"../models/data/order/line-item/index.js";import"mobx";import"../models/data/product/index.js";import"../models/data/variant-type/index.js";import"../models/data/product/variant/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product-attribute/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product-filter/index.js";import"../models/data/variant-type/variant-value/index.js";import"../models/data/order-transaction/index.js";import"../models/data/product-option-set/index.js";import"../models/data/raffle/index.js";import{IkasTheme as s}from"../models/theme/theme.js";import{IkasThemePageType as a}from"../models/theme/page/index.js";import"../models/theme/component/prop/index.js";import"../models/theme/page/component/prop-value/link.js";import"../models/ui/brand-list/index.js";import"../models/ui/blog-list/index.js";import"../models/ui/blog-category-list/index.js";import"../models/ui/category-list/index.js";import"../models/ui/product-detail/index.js";import"../models/ui/product-list/index.js";import"../models/ui/product-attribute-detail/index.js";import"../models/ui/product-attribute-list/index.js";import"../models/ui/customer-review-list/index.js";import"../models/ui/validator/index.js";import"../models/ui/validator/rules/index.js";import"../models/ui/validator/form/login.js";import"../models/ui/validator/form/address.js";import"../models/ui/validator/form/register.js";import"../models/ui/validator/form/contact-form.js";import"../models/ui/validator/form/forgot-password.js";import"../models/ui/validator/form/recover-password.js";import"../models/ui/validator/form/account-info.js";import"../models/ui/validator/form/raffle-form.js";import"../models/ui/validator/form/customer-review.js";import"../models/ui/raffle-list/index.js";import"../models/theme/settings/index.js";import"../models/theme/custom-data/index.js";import{IkasStorefront as d}from"../models/data/storefront/index.js";import{IkasSalesChannel as l}from"../models/data/sales-channel/index.js";import{IkasStorefrontRouting as m}from"../models/data/storefront/routing/index.js";import{IkasStorefrontConfig as c}from"../storefront/index.js";import{IkasPageDataProvider as p}from"./page-data-get.js";import{IkasStorefrontThemeLocalization as u}from"../models/data/storefront/theme-localization/index.js";import{IkasStorefrontAPI as f}from"../api/storefront/index.js";import{I18NFileReader as g}from"../utils/i18n.js";import"../api/blog/index.js";import"../api/brand/index.js";import"../api/cart/index.js";import"../api/category/index.js";import{IkasCheckoutAPI as j}from"../api/checkout/index.js";import"../api/city/index.js";import"../api/country/index.js";import"../api/customer/index.js";import"../api/customer-review/index.js";import"../api/district/index.js";import"../api/html-meta-data/index.js";import"../api/merchant/index.js";import"../api/product-search/index.js";import"../api/apollo.js";import"../api/favorite-product/index.js";import"../api/contact-form/index.js";import"../api/state/index.js";import"../api/product-option-set/index.js";import"../api/raffle/index.js";import"../api/back-in-stock-reminder/index.js";var x=function(){function x(){}return x.readLocalTheme=function(){return new Promise((function(e,o){i.readFile("./src/theme.json",{flag:"a+"},(function(t,r){if(t)return o(t);var i=r.length?JSON.parse(r.toString()):{};e(new s(i))}))}))},x.readSettingsFile=function(){return new Promise((function(e){var o=n().serverRuntimeConfig.SETTINGS;i.readFile(o,{flag:"a+"},(function(o,t){if(o)return console.error("SETTINGS FILE READ ERROR!!!"),console.error(o),e(null);var r=t.length?JSON.parse(t.toString()):{};e(r)}))}))},x.getSettings=function(t){var r=this;return new Promise((function(n){return e(r,void 0,void 0,(function(){var e,r,s,a,p,g,j,v,h,S,C,I,b,w;return o(this,(function(o){switch(o.label){case 0:return"local"===process.env.NEXT_PUBLIC_ENV?c.storefrontId?[4,f.getStorefront(c.storefrontId)]:(console.error("Missing storefrontId in the config.json file!"),[2,n(null)]):[3,3];case 1:return(e=o.sent())?(r=e,[4,x.readLocalTheme()]):[2,n(null)];case 2:return s=o.sent(),a=x.createColorScript(s.settings),n({storefront:r,themeLocalization:new u({themeJson:s}),salesChannel:new l({id:r.salesChannelId}),routing:r.routings.length?r.routings.find((function(e){return e.locale===t||e.id===t}))||r.routings[0]:new m({}),favicon:s.settings.favicon,stockPreference:s.settings.stockPreference,storefrontJSScripts:a?[a]:[],domain:"",productBackInStockSettings:{customerLoginRequired:!0},customerReviewSettings:{customerLoginRequired:!0,customerPurchaseRequired:!1}}),[3,5];case 3:return[4,x.readSettingsFile()];case 4:if(!(p=o.sent())||!p.localizationMap)return[2,n(null)];if(g=new d(p.storefront),j=new l(p.salesChannel),v=p.localizationMap,h=p.storefrontJSScripts||[],S=p.domain,C=p.productBackInStockSettings?{customerLoginRequired:p.productBackInStockSettings.customerLoginRequired}:null,I=p.customerReviewSettings?{customerLoginRequired:p.customerReviewSettings.customerLoginRequired,customerPurchaseRequired:p.customerReviewSettings.customerPurchaseRequired}:null,b=v[t],w=g.routings.find((function(e){return e.id===t||e.path===t})),!b||!w)return console.error("THEME LOCALIZATION PATH OR ROUTING MISSING!!!"),[2,n(null)];i.readFile(b,{flag:"a+"},(function(e,o){if(e)return console.error("THEME LOCALZIATION FILE READ ERROR!!!"),console.error(e),n(null);var t=o.length?JSON.parse(o.toString()):{},r=new u(t),i=r.themeJson.settings.favicon,s=r.themeJson.settings.stockPreference;if(r.themeJson.settings){var a=x.createColorScript(r.themeJson.settings);a&&h.push(a)}n({storefront:g,themeLocalization:r,salesChannel:j,routing:w,favicon:i,stockPreference:s,storefrontJSScripts:h,domain:S,productBackInStockSettings:C,customerReviewSettings:I})})),o.label=5;case 5:return[2]}}))}))}))},x.getPageData=function(i,s,d,l,m){var u,f;return e(this,void 0,void 0,(function(){var e,v,h,S,C,I,b,w,y,P,k,L,R,T,E,B,V,J,O,N,D,F,q,z,A,G;return o(this,(function(o){switch(o.label){case 0:return e="local"===process.env.NEXT_PUBLIC_ENV,v=!e&&m,h=n().serverRuntimeConfig,v?[3,7]:(S=i.locale)?[4,x.getSettings(S)]:[2,{props:{},notFound:!0}];case 1:return(C=o.sent())&&C.storefront.mainStorefrontThemeId&&C.storefront.salesChannelId?(I=C.storefront,b=C.themeLocalization,w=C.salesChannel,y=C.routing,P=C.favicon,k=C.stockPreference,L=C.storefrontJSScripts,R=C.domain,T=C.productBackInStockSettings,E=C.customerReviewSettings,c.storefrontId=I.id,c.storefrontRoutingId=y.id,c.storefrontThemeId=I.mainStorefrontThemeId,c.salesChannelId=I.salesChannelId,c.priceListId=y.priceListId||void 0,c.stockLocationIds=null===(u=w.stockLocations)||void 0===u?void 0:u.map((function(e){return e.id})),c.routings=I.routings,c.paymentGateways=w.paymentGateways||[],c.gtmId=I.gtmId||void 0,c.fbpId=I.fbpId||void 0,c.favicon=P||null,c.stockPreference=k||null,c.storefrontJSScripts=L||[],c.domain=R,c.productBackInStockSettings=T,c.customerReviewSettings=E,(B=new p(b.themeJson,i.params,d)).possiblePageTypes=l||(d?[d]:[]),m?[3,3]:[4,B.getPageData()]):[2,{props:{},notFound:!0}];case 2:if(o.sent(),!B.page)return[2,{props:{},notFound:!0}];o.label=3;case 3:return V=m?B.theme.components.map((function(e){return e.id})):B.page.components.map((function(e){return e.componentId})),J=b.themeJson.components.filter((function(e){return m||V.includes(e.id)})),O=r(["common"],J.map((function(e){return e.dir}))),(d===a.CHECKOUT||m)&&O.push("checkout-page"),N=h.nextI18nConf,D=y.locale,[4,new g(D,O,e?void 0:N.localePath).read()];case 4:return F=o.sent(),c.translations=F,q={},d!==a.CHECKOUT?[3,6]:(z=null===(f=B.page)||void 0===f?void 0:f.components[0])?[4,j.listCheckoutSettings()]:[3,6];case 5:A=o.sent(),G={buttonBgColor:z.propValues.buttonBgColor,buttonTextColor:z.propValues.buttonTextColor,buttonDisabledBgColor:z.propValues.buttonDisabledBgColor,buttonDisabledTextColor:z.propValues.buttonDisabledTextColor,primaryTextColor:z.propValues.primaryTextColor,secondaryTextColor:z.propValues.secondaryTextColor,primaryBgColor:z.propValues.primaryBgColor,secondaryBgColor:z.propValues.secondaryBgColor,borderColor:z.propValues.borderColor,cardBgColor:z.propValues.cardBgColor,errorColor:z.propValues.errorColor,errorLightColor:z.propValues.errorLightColor,warningColor:z.propValues.warningColor,warningLightColor:z.propValues.warningLightColor,successColor:z.propValues.successColor,successLightColor:z.propValues.successLightColor},q.customizationProps=G,q.returnPolicy=b.returnPolicy,q.privacyPolicy=b.privacyPolicy,q.termsOfService=b.termsOfService,q.checkoutSettingsStr=(null==A?void 0:A.length)?JSON.stringify(A[0]):null,o.label=6;case 6:return s?[2,{props:t(t({},B.nextPageData.props),q)}]:[2,{props:t(t({},B.nextPageData.props),q),revalidate:60}];case 7:return[2,{props:{}}];case 8:return[2]}}))}))},x.getStaticProps=function(t,r,i,n){return e(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,x.getPageData(t,!1,r,i,n)];case 1:return[2,e.sent()]}}))}))},x.getServerSideProps=function(t,r){return e(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,x.getPageData(t,!0,r)];case 1:return[2,e.sent()]}}))}))},x.createColorScript=function(e){if(e.colors)return"<script>"+e.colors.map((function(e){return'document.documentElement.style.setProperty("'+e.key+'","'+e.color+'");'})).join("\r\n")+"<\/script> \n "},x}();export{x as IkasNextPageDataProvider};
1
+ import{__awaiter as e,__generator as t,__assign as o,__spreadArray as r}from'../ext/tslib/tslib.es6.js';import i from"fs";import n from"next/config.js";import"../models/data/blog/index.js";import"../models/data/brand/index.js";import"../models/data/category/index.js";import"../models/data/checkout/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/index.js";import"../models/data/customer-review/index.js";import"../models/data/html-meta-data/index.js";import"../models/data/image/index.js";import"../models/data/installment-info/index.js";import"../models/data/order/index.js";import"../models/data/order/line-item/index.js";import"mobx";import"../models/data/product/index.js";import"../models/data/variant-type/index.js";import"../models/data/product/variant/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product-attribute/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product-filter/index.js";import"../models/data/variant-type/variant-value/index.js";import"../models/data/order-transaction/index.js";import"../models/data/product-option-set/index.js";import"../models/data/raffle/index.js";import{IkasTheme as s}from"../models/theme/theme.js";import{IkasThemePageType as a}from"../models/theme/page/index.js";import"../models/theme/component/prop/index.js";import"../models/theme/page/component/prop-value/link.js";import"../models/ui/brand-list/index.js";import"../models/ui/blog-list/index.js";import"../models/ui/blog-category-list/index.js";import"../models/ui/category-list/index.js";import"../models/ui/product-detail/index.js";import"../models/ui/product-list/index.js";import"../models/ui/product-attribute-detail/index.js";import"../models/ui/product-attribute-list/index.js";import"../models/ui/customer-review-list/index.js";import"../models/ui/validator/index.js";import"../models/ui/validator/rules/index.js";import"../models/ui/validator/form/login.js";import"../models/ui/validator/form/address.js";import"../models/ui/validator/form/register.js";import"../models/ui/validator/form/contact-form.js";import"../models/ui/validator/form/forgot-password.js";import"../models/ui/validator/form/recover-password.js";import"../models/ui/validator/form/account-info.js";import"../models/ui/validator/form/raffle-form.js";import"../models/ui/validator/form/customer-review.js";import"../models/ui/raffle-list/index.js";import"../models/theme/settings/index.js";import"../models/theme/custom-data/index.js";import{IkasStorefront as d}from"../models/data/storefront/index.js";import{IkasSalesChannel as l}from"../models/data/sales-channel/index.js";import{IkasStorefrontRouting as m}from"../models/data/storefront/routing/index.js";import{IkasStorefrontConfig as c}from"../storefront/index.js";import{IkasPageDataProvider as p}from"./page-data-get.js";import{IkasStorefrontThemeLocalization as u}from"../models/data/storefront/theme-localization/index.js";import{IkasStorefrontAPI as f}from"../api/storefront/index.js";import{I18NFileReader as g}from"../utils/i18n.js";import"../api/blog/index.js";import"../api/brand/index.js";import"../api/cart/index.js";import"../api/category/index.js";import{IkasCheckoutAPI as j}from"../api/checkout/index.js";import"../api/city/index.js";import"../api/country/index.js";import"../api/customer/index.js";import"../api/customer-review/index.js";import"../api/district/index.js";import"../api/html-meta-data/index.js";import"../api/merchant/index.js";import"../api/product-search/index.js";import"../api/apollo.js";import"../api/favorite-product/index.js";import"../api/contact-form/index.js";import"../api/state/index.js";import"../api/product-option-set/index.js";import"../api/raffle/index.js";import"../api/back-in-stock-reminder/index.js";import{getGoogleFontHref as h}from"../utils/google-fonts.js";var x=function(){function x(){}return x.readLocalTheme=function(){return new Promise((function(e,t){i.readFile("./src/theme.json",{flag:"a+"},(function(o,r){if(o)return t(o);var i=r.length?JSON.parse(r.toString()):{};e(new s(i))}))}))},x.readSettingsFile=function(){return new Promise((function(e){var t=n().serverRuntimeConfig.SETTINGS;i.readFile(t,{flag:"a+"},(function(t,o){if(t)return console.error("SETTINGS FILE READ ERROR!!!"),console.error(t),e(null);var r=o.length?JSON.parse(o.toString()):{};e(r)}))}))},x.getSettings=function(o){var r=this;return new Promise((function(n){return e(r,void 0,void 0,(function(){var e,r,s,a,p,g,j,h,v,S,C,b,y,I,w,k;return t(this,(function(t){switch(t.label){case 0:return"local"===process.env.NEXT_PUBLIC_ENV?c.storefrontId?[4,f.getStorefront(c.storefrontId)]:(console.error("Missing storefrontId in the config.json file!"),[2,n(null)]):[3,3];case 1:return(e=t.sent())?(r=e,[4,x.readLocalTheme()]):[2,n(null)];case 2:return s=t.sent(),a=x.createColorScript(s.settings),p=x.createFontScript(s.settings),g=[],a&&g.push(a),p&&g.push(p),n({storefront:r,themeLocalization:new u({themeJson:s}),salesChannel:new l({id:r.salesChannelId}),routing:r.routings.length?r.routings.find((function(e){return e.locale===o||e.id===o}))||r.routings[0]:new m({}),favicon:s.settings.favicon,stockPreference:s.settings.stockPreference,storefrontJSScripts:g,domain:"",productBackInStockSettings:{customerLoginRequired:!0},customerReviewSettings:{customerLoginRequired:!0,customerPurchaseRequired:!1}}),[3,5];case 3:return[4,x.readSettingsFile()];case 4:if(!(j=t.sent())||!j.localizationMap)return[2,n(null)];if(h=new d(j.storefront),v=new l(j.salesChannel),S=j.localizationMap,C=j.storefrontJSScripts||[],b=j.domain,y=j.productBackInStockSettings?{customerLoginRequired:j.productBackInStockSettings.customerLoginRequired}:null,I=j.customerReviewSettings?{customerLoginRequired:j.customerReviewSettings.customerLoginRequired||!1,customerPurchaseRequired:j.customerReviewSettings.customerPurchaseRequired||!1}:null,w=S[o],k=h.routings.find((function(e){return e.id===o||e.path===o})),!w||!k)return console.error("THEME LOCALIZATION PATH OR ROUTING MISSING!!!"),[2,n(null)];i.readFile(w,{flag:"a+"},(function(e,t){if(e)return console.error("THEME LOCALZIATION FILE READ ERROR!!!"),console.error(e),n(null);var o=t.length?JSON.parse(t.toString()):{},r=new u(o),i=r.themeJson.settings.favicon,s=r.themeJson.settings.stockPreference;if(r.themeJson.settings){var a=x.createColorScript(r.themeJson.settings),d=x.createFontScript(r.themeJson.settings);a&&C.push(a),d&&C.push(d)}n({storefront:h,themeLocalization:r,salesChannel:v,routing:k,favicon:i,stockPreference:s,storefrontJSScripts:C,domain:b,productBackInStockSettings:y,customerReviewSettings:I})})),t.label=5;case 5:return[2]}}))}))}))},x.getPageData=function(i,s,d,l,m){var u,f;return e(this,void 0,void 0,(function(){var e,h,v,S,C,b,y,I,w,k,P,R,L,T,B,E,V,J,F,O,N,D,q,A,z,M;return t(this,(function(t){switch(t.label){case 0:return e="local"===process.env.NEXT_PUBLIC_ENV,h=!e&&m,v=n().serverRuntimeConfig,h?[3,7]:(S=i.locale)?[4,x.getSettings(S)]:[2,{props:{},notFound:!0}];case 1:return(C=t.sent())&&C.storefront.mainStorefrontThemeId&&C.storefront.salesChannelId?(b=C.storefront,y=C.themeLocalization,I=C.salesChannel,w=C.routing,k=C.favicon,P=C.stockPreference,R=C.storefrontJSScripts,L=C.domain,T=C.productBackInStockSettings,B=C.customerReviewSettings,c.storefrontId=b.id,c.storefrontRoutingId=w.id,c.storefrontThemeId=b.mainStorefrontThemeId,c.salesChannelId=b.salesChannelId,c.priceListId=w.priceListId||void 0,c.stockLocationIds=null===(u=I.stockLocations)||void 0===u?void 0:u.map((function(e){return e.id})),c.routings=b.routings,c.paymentGateways=I.paymentGateways||[],c.gtmId=b.gtmId||void 0,c.fbpId=b.fbpId||void 0,c.favicon=k||null,c.stockPreference=P||null,c.storefrontJSScripts=R||[],c.domain=L,c.productBackInStockSettings=T,c.customerReviewSettings=B,(E=new p(y.themeJson,i.params,d)).possiblePageTypes=l||(d?[d]:[]),m?[3,3]:[4,E.getPageData()]):[2,{props:{},notFound:!0}];case 2:if(t.sent(),!E.page)return[2,{props:{},notFound:!0}];t.label=3;case 3:return V=m?E.theme.components.map((function(e){return e.id})):E.page.components.map((function(e){return e.componentId})),J=y.themeJson.components.filter((function(e){return m||V.includes(e.id)})),F=r(["common"],J.map((function(e){return e.dir})),!0),(d===a.CHECKOUT||m)&&F.push("checkout-page"),O=v.nextI18nConf,N=w.locale,[4,new g(N,F,e?void 0:O.localePath).read()];case 4:return D=t.sent(),c.translations=D,q={},d!==a.CHECKOUT?[3,6]:(A=null===(f=E.page)||void 0===f?void 0:f.components[0])?[4,j.listCheckoutSettings()]:[3,6];case 5:z=t.sent(),M={buttonBgColor:A.propValues.buttonBgColor,buttonTextColor:A.propValues.buttonTextColor,buttonDisabledBgColor:A.propValues.buttonDisabledBgColor,buttonDisabledTextColor:A.propValues.buttonDisabledTextColor,primaryTextColor:A.propValues.primaryTextColor,secondaryTextColor:A.propValues.secondaryTextColor,primaryBgColor:A.propValues.primaryBgColor,secondaryBgColor:A.propValues.secondaryBgColor,borderColor:A.propValues.borderColor,cardBgColor:A.propValues.cardBgColor,errorColor:A.propValues.errorColor,errorLightColor:A.propValues.errorLightColor,warningColor:A.propValues.warningColor,warningLightColor:A.propValues.warningLightColor,successColor:A.propValues.successColor,successLightColor:A.propValues.successLightColor},q.customizationProps=M,q.returnPolicy=y.returnPolicy,q.privacyPolicy=y.privacyPolicy,q.termsOfService=y.termsOfService,q.checkoutSettingsStr=(null==z?void 0:z.length)?JSON.stringify(z[0]):null,t.label=6;case 6:return s?[2,{props:o(o({},E.nextPageData.props),q)}]:[2,{props:o(o({},E.nextPageData.props),q),revalidate:60}];case 7:return[2,{props:{}}];case 8:return[2]}}))}))},x.getStaticProps=function(o,r,i,n){return e(this,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,x.getPageData(o,!1,r,i,n)];case 1:return[2,e.sent()]}}))}))},x.getServerSideProps=function(o,r){return e(this,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,x.getPageData(o,!0,r)];case 1:return[2,e.sent()]}}))}))},x.createColorScript=function(e){if(e.colors)return"<script>".concat(e.colors.map((function(e){return'document.documentElement.style.setProperty("'.concat(e.key,'","').concat(e.color,'");')})).join("\r\n"),"<\/script> \n ")},x.createFontScript=function(e){var t=h(e.fontFamily);if(t)return'<link id="ikas-font" rel="stylesheet" href="'.concat(t,"\"> \n <style>\n body { \n font-family: '").concat(e.fontFamily.name,'\', -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;\n } \n </style>')},x}();export{x as IkasNextPageDataProvider};
@@ -37,6 +37,7 @@ export declare class IkasCustomPropValueProvider implements IkasPropValueProvide
37
37
  private getBlogCategoryListValue;
38
38
  private getRaffleValue;
39
39
  private getRaffleListValue;
40
+ private getSliderValue;
40
41
  }
41
42
  export declare type CustomDataValue = {
42
43
  value: any;
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as e}from'../../ext/tslib/tslib.es6.js';import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-review/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/installment-info/index.js";import"../../models/data/order/index.js";import"../../models/data/order/line-item/index.js";import"mobx";import"../../models/data/product/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product-attribute/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product-filter/index.js";import"../../models/data/variant-type/variant-value/index.js";import"../../models/data/order-transaction/index.js";import"../../models/data/product-option-set/index.js";import"../../models/data/raffle/index.js";import"../../models/theme/theme.js";import"../../models/theme/page/index.js";import{IkasThemePageComponent as r}from"../../models/theme/page/component/index.js";import{IkasThemeComponentPropType as s}from"../../models/theme/component/prop/index.js";import"../../models/theme/page/component/prop-value/link.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/category-list/index.js";import"../../models/ui/product-detail/index.js";import"../../models/ui/product-list/index.js";import"../../models/ui/product-attribute-detail/index.js";import"../../models/ui/product-attribute-list/index.js";import"../../models/ui/customer-review-list/index.js";import"../../models/ui/validator/index.js";import"../../models/ui/validator/rules/index.js";import"../../models/ui/validator/form/login.js";import"../../models/ui/validator/form/address.js";import"../../models/ui/validator/form/register.js";import"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import"../../models/ui/raffle-list/index.js";import"../../models/theme/settings/index.js";import{IkasThemeCustomData as a}from"../../models/theme/custom-data/index.js";import{IkasBrandListPropValueProvider as i}from"./brand-list.js";import{IkasBrandPropValueProvider as o}from"./brand.js";import{IkasCategoryListPropValueProvider as u}from"./category-list.js";import{IkasCategoryPropValueProvider as n}from"./category.js";import{IkasColorPropValueProvider as c}from"./color.js";import{IkasBooleanPropValueProvider as l}from"./boolean.js";import{IkasTextPropValueProvider as m}from"./text.js";import{IkasImageListPropValueProvider as d}from"./image-list.js";import{IkasImagePropValueProvider as p}from"./image.js";import{IkasLinkPropValueProvider as h}from"./link.js";import{IkasProductDetailPropValueProvider as f}from"./product-detail.js";import{IkasProductListPropValueProvider as v}from"./product-list.js";import{IkasRichTextPropValueProvider as g}from"./rich-text.js";import{IkasBlogPropValueProvider as D}from"./blog.js";import{IkasBlogListPropValueProvider as V}from"./blog-list.js";import{IkasAttributePropValueProvider as j}from"./attribute.js";import{IkasAttributeListPropValueProvider as w}from"./attribute-list.js";import y from'../../ext/lodash/cloneDeep.js';import{IkasBlogCategoryPropValueProvider as b}from"./blog-category.js";import{IkasBlogCategoryListPropValueProvider as T}from"./blog-category-list.js";import{IkasRaffleListPropValueProvider as P}from"./raffle-list.js";import{IkasRafflePropValueProvider as L}from"./raffle.js";var x=function(){function x(t,e,r,s,a,i,o){this.value=t,this.customData=e,this.theme=r,this.pageType=s,this.pageDataProvider=a,this.pageSpecificData=i,this.pageParams=o}return x.prototype.getValue=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:if((void 0===this.value||null===this.value)&&this.customData.type!==s.RAFFLE_LIST)return[2,{value:null,customData:this.customData}];e.label=1;case 1:switch(e.trys.push([1,56,,57]),this.customData.type){case s.TEXT:return[3,2];case s.RICH_TEXT:return[3,4];case s.BOOLEAN:return[3,6];case s.BRAND_LIST:return[3,8];case s.BRAND:return[3,10];case s.CATEGORY_LIST:return[3,12];case s.CATEGORY:return[3,14];case s.COLOR:return[3,16];case s.IMAGE_LIST:return[3,18];case s.IMAGE:return[3,20];case s.LINK:case s.LIST_OF_LINK:return[3,22];case s.PRODUCT_DETAIL:return[3,24];case s.PRODUCT_LIST:return[3,26];case s.PRODUCT_ATTRIBUTE:return[3,28];case s.PRODUCT_ATTRIBUTE_LIST:return[3,30];case s.OBJECT:return[3,32];case s.DYNAMIC_LIST:case s.STATIC_LIST:return[3,34];case s.ENUM:return[3,36];case s.CUSTOM:return[3,38];case s.COMPONENT:case s.COMPONENT_LIST:return[3,40];case s.BLOG:return[3,42];case s.BLOG_LIST:return[3,44];case s.BLOG_CATEGORY:return[3,46];case s.BLOG_CATEGORY_LIST:return[3,48];case s.RAFFLE:return[3,50];case s.RAFFLE_LIST:return[3,52]}return[3,54];case 2:return[4,this.getTextValue()];case 3:return t=e.sent(),[3,55];case 4:return[4,this.getRichTextPropValue()];case 5:return t=e.sent(),[3,55];case 6:return[4,this.getBooleanValue()];case 7:return t=e.sent(),[3,55];case 8:return[4,this.getBrandListPropValue()];case 9:return t=e.sent(),[3,55];case 10:return[4,this.getBrandPropValue()];case 11:return t=e.sent(),[3,55];case 12:return[4,this.getCategoryListPropValue()];case 13:return t=e.sent(),[3,55];case 14:return[4,this.getCategoryPropValue()];case 15:return t=e.sent(),[3,55];case 16:return[4,this.getColorPropValue()];case 17:return t=e.sent(),[3,55];case 18:return[4,this.getImageListPropValue()];case 19:return t=e.sent(),[3,55];case 20:return[4,this.getImagePropValue()];case 21:return t=e.sent(),[3,55];case 22:return[4,this.getLinkPropValue()];case 23:return t=e.sent(),[3,55];case 24:return[4,this.getProductDetailPropValue()];case 25:return t=e.sent(),[3,55];case 26:return[4,this.getProductListPropValue()];case 27:return t=e.sent(),[3,55];case 28:return[4,this.getProductAttributePropValue()];case 29:return t=e.sent(),[3,55];case 30:return[4,this.getProductAttributeListPropValue()];case 31:return t=e.sent(),[3,55];case 32:return[4,this.getObjectValue()];case 33:return t=e.sent(),[3,55];case 34:return[4,this.getArrayValue()];case 35:return t=e.sent(),[3,55];case 36:return[4,this.getEnumValue()];case 37:return t=e.sent(),[3,55];case 38:return[4,this.getCustomDataValue()];case 39:return t=e.sent(),[3,55];case 40:return[4,this.getComponentListValue()];case 41:return t=e.sent(),[3,55];case 42:return[4,this.getBlogValue()];case 43:return t=e.sent(),[3,55];case 44:return[4,this.getBlogListValue()];case 45:return t=e.sent(),[3,55];case 46:return[4,this.getBlogCategoryValue()];case 47:return t=e.sent(),[3,55];case 48:return[4,this.getBlogCategoryListValue()];case 49:return t=e.sent(),[3,55];case 50:return[4,this.getRaffleValue()];case 51:return t=e.sent(),[3,55];case 52:return[4,this.getRaffleListValue()];case 53:return t=e.sent(),[3,55];case 54:return[3,55];case 55:return[3,57];case 56:return e.sent(),[2];case 57:return!this.customData.isRequired||void 0!==(null==t?void 0:t.value)&&null!==(null==t?void 0:t.value)?[2,t]:[2]}}))}))},x.prototype.getBooleanValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new l(this.value).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},x.prototype.getBrandListPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new i(this.value).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},x.prototype.getBrandPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new o(this.value).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},x.prototype.getCategoryListPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new u(this.value).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},x.prototype.getCategoryPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new n(this.value).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},x.prototype.getColorPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new c(this.value).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},x.prototype.getRichTextPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new g(this.value).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},x.prototype.getImageListPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new d(this.value).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},x.prototype.getImagePropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new p(this.value).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},x.prototype.getLinkPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new h(this.value,this.theme,this.pageDataProvider.linkMetaDataTargetIds).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},x.prototype.getProductDetailPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new f(this.value).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},x.prototype.getProductListPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new v(this.pageType,this.value,this.pageSpecificData).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},x.prototype.getProductAttributePropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new j(this.value).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},x.prototype.getProductAttributeListPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new w(this.value).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},x.prototype.getTextValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new m(this.value).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},x.prototype.getObjectValue=function(){return t(this,void 0,void 0,(function(){var t,r,a,i,o,u;return e(this,(function(e){switch(e.label){case 0:t={},r=0,a=this.customData.nestedData||[],e.label=1;case 1:if(!(r<a.length))return[3,4];if(!(i=a[r]).key)return[3,3];if(o=this.value[i.key],i.isRequired&&i.type!==s.RAFFLE_LIST&&null==o)throw new Error("Required data is missing");return[4,new x(o,i,this.theme,this.pageType,this.pageDataProvider,this.pageSpecificData).getValue()];case 2:if(u=e.sent(),i.isRequired&&null==u)throw new Error("Required data is missing");t[i.key]=u,e.label=3;case 3:return r++,[3,1];case 4:return[2,{value:t,customData:this.customData}]}}))}))},x.prototype.getArrayValue=function(){return t(this,void 0,void 0,(function(){var t,r,a,i,o,u;return e(this,(function(e){switch(e.label){case 0:if(!this.value||!Array.isArray(this.value))throw new Error("Incorrect data!");t=[],r=this.customData.nestedData[0],a=0,i=this.value,e.label=1;case 1:if(!(a<i.length))return[3,4];if(o=i[a],r.isRequired&&r.type!==s.RAFFLE_LIST&&null==o)throw new Error("Required data is missing");return[4,new x(o,r,this.theme,this.pageType,this.pageDataProvider,this.pageSpecificData).getValue()];case 2:if(u=e.sent(),r.isRequired&&null==u)throw new Error("Required data is missing");t.push(u),e.label=3;case 3:return a++,[3,1];case 4:return[2,{value:t,customData:this.customData}]}}))}))},x.prototype.getEnumValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){return[2,{value:this.value,customData:this.customData}]}))}))},x.prototype.getCustomDataValue=function(){return t(this,void 0,void 0,(function(){var t,r=this;return e(this,(function(e){switch(e.label){case 0:return(t=this.theme.customData.find((function(t){return t.id===r.customData.customDataId})))?((t=new a(y(t))).isRequired=this.customData.isRequired,[4,new x(this.value,t,this.theme,this.pageType,this.pageDataProvider,this.pageSpecificData).getValue()]):[2,{value:null,customData:this.customData}];case 1:return[2,e.sent()]}}))}))},x.prototype.getComponentListValue=function(){return t(this,void 0,void 0,(function(){var t,s,a=this;return e(this,(function(e){switch(e.label){case 0:return t=this.value?this.value.map((function(t){return new r(t)})):[],s={},[4,Promise.all(t.map((function(t){return a.pageDataProvider.getPageComponentPropValues(t)})))];case 1:return[2,(s.value=e.sent(),s.customData=this.customData,s)]}}))}))},x.prototype.getBlogValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new D(this.value).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},x.prototype.getBlogListValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new V(this.pageType,this.value,this.pageSpecificData).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},x.prototype.getBlogCategoryValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new b(this.value).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},x.prototype.getBlogCategoryListValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new T(this.value).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},x.prototype.getRaffleValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new L(this.value).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},x.prototype.getRaffleListValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,(new P).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},x}();export{x as IkasCustomPropValueProvider};
1
+ import{__awaiter as t,__generator as e}from'../../ext/tslib/tslib.es6.js';import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-review/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/installment-info/index.js";import"../../models/data/order/index.js";import"../../models/data/order/line-item/index.js";import"mobx";import"../../models/data/product/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product-attribute/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product-filter/index.js";import"../../models/data/variant-type/variant-value/index.js";import"../../models/data/order-transaction/index.js";import"../../models/data/product-option-set/index.js";import"../../models/data/raffle/index.js";import"../../models/theme/theme.js";import"../../models/theme/page/index.js";import{IkasThemePageComponent as r}from"../../models/theme/page/component/index.js";import{IkasThemeComponentPropType as s}from"../../models/theme/component/prop/index.js";import"../../models/theme/page/component/prop-value/link.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/category-list/index.js";import"../../models/ui/product-detail/index.js";import"../../models/ui/product-list/index.js";import"../../models/ui/product-attribute-detail/index.js";import"../../models/ui/product-attribute-list/index.js";import"../../models/ui/customer-review-list/index.js";import"../../models/ui/validator/index.js";import"../../models/ui/validator/rules/index.js";import"../../models/ui/validator/form/login.js";import"../../models/ui/validator/form/address.js";import"../../models/ui/validator/form/register.js";import"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import"../../models/ui/raffle-list/index.js";import"../../models/theme/settings/index.js";import{IkasThemeCustomData as a}from"../../models/theme/custom-data/index.js";import{IkasBrandListPropValueProvider as i}from"./brand-list.js";import{IkasBrandPropValueProvider as o}from"./brand.js";import{IkasCategoryListPropValueProvider as u}from"./category-list.js";import{IkasCategoryPropValueProvider as n}from"./category.js";import{IkasColorPropValueProvider as c}from"./color.js";import{IkasBooleanPropValueProvider as l}from"./boolean.js";import{IkasTextPropValueProvider as m}from"./text.js";import{IkasImageListPropValueProvider as d}from"./image-list.js";import{IkasImagePropValueProvider as h}from"./image.js";import{IkasLinkPropValueProvider as p}from"./link.js";import{IkasProductDetailPropValueProvider as f}from"./product-detail.js";import{IkasProductListPropValueProvider as v}from"./product-list.js";import{IkasRichTextPropValueProvider as g}from"./rich-text.js";import{IkasBlogPropValueProvider as D}from"./blog.js";import{IkasBlogListPropValueProvider as V}from"./blog-list.js";import{IkasAttributePropValueProvider as j}from"./attribute.js";import{IkasAttributeListPropValueProvider as w}from"./attribute-list.js";import y from'../../ext/lodash/cloneDeep.js';import{IkasBlogCategoryPropValueProvider as b}from"./blog-category.js";import{IkasBlogCategoryListPropValueProvider as T}from"./blog-category-list.js";import{IkasRaffleListPropValueProvider as L}from"./raffle-list.js";import{IkasRafflePropValueProvider as P}from"./raffle.js";import{IkasSliderPropValueProvider as x}from"./slider.js";var R=function(){function R(t,e,r,s,a,i,o){this.value=t,this.customData=e,this.theme=r,this.pageType=s,this.pageDataProvider=a,this.pageSpecificData=i,this.pageParams=o}return R.prototype.getValue=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:if((void 0===this.value||null===this.value)&&this.customData.type!==s.RAFFLE_LIST)return[2,{value:null,customData:this.customData}];e.label=1;case 1:switch(e.trys.push([1,58,,59]),this.customData.type){case s.TEXT:return[3,2];case s.RICH_TEXT:return[3,4];case s.BOOLEAN:return[3,6];case s.BRAND_LIST:return[3,8];case s.BRAND:return[3,10];case s.CATEGORY_LIST:return[3,12];case s.CATEGORY:return[3,14];case s.COLOR:return[3,16];case s.IMAGE_LIST:return[3,18];case s.IMAGE:return[3,20];case s.LINK:case s.LIST_OF_LINK:return[3,22];case s.PRODUCT_DETAIL:return[3,24];case s.PRODUCT_LIST:return[3,26];case s.PRODUCT_ATTRIBUTE:return[3,28];case s.PRODUCT_ATTRIBUTE_LIST:return[3,30];case s.OBJECT:return[3,32];case s.DYNAMIC_LIST:case s.STATIC_LIST:return[3,34];case s.ENUM:return[3,36];case s.CUSTOM:return[3,38];case s.COMPONENT:case s.COMPONENT_LIST:return[3,40];case s.BLOG:return[3,42];case s.BLOG_LIST:return[3,44];case s.BLOG_CATEGORY:return[3,46];case s.BLOG_CATEGORY_LIST:return[3,48];case s.RAFFLE:return[3,50];case s.RAFFLE_LIST:return[3,52];case s.SLIDER:return[3,54]}return[3,56];case 2:return[4,this.getTextValue()];case 3:return t=e.sent(),[3,57];case 4:return[4,this.getRichTextPropValue()];case 5:return t=e.sent(),[3,57];case 6:return[4,this.getBooleanValue()];case 7:return t=e.sent(),[3,57];case 8:return[4,this.getBrandListPropValue()];case 9:return t=e.sent(),[3,57];case 10:return[4,this.getBrandPropValue()];case 11:return t=e.sent(),[3,57];case 12:return[4,this.getCategoryListPropValue()];case 13:return t=e.sent(),[3,57];case 14:return[4,this.getCategoryPropValue()];case 15:return t=e.sent(),[3,57];case 16:return[4,this.getColorPropValue()];case 17:return t=e.sent(),[3,57];case 18:return[4,this.getImageListPropValue()];case 19:return t=e.sent(),[3,57];case 20:return[4,this.getImagePropValue()];case 21:return t=e.sent(),[3,57];case 22:return[4,this.getLinkPropValue()];case 23:return t=e.sent(),[3,57];case 24:return[4,this.getProductDetailPropValue()];case 25:return t=e.sent(),[3,57];case 26:return[4,this.getProductListPropValue()];case 27:return t=e.sent(),[3,57];case 28:return[4,this.getProductAttributePropValue()];case 29:return t=e.sent(),[3,57];case 30:return[4,this.getProductAttributeListPropValue()];case 31:return t=e.sent(),[3,57];case 32:return[4,this.getObjectValue()];case 33:return t=e.sent(),[3,57];case 34:return[4,this.getArrayValue()];case 35:return t=e.sent(),[3,57];case 36:return[4,this.getEnumValue()];case 37:return t=e.sent(),[3,57];case 38:return[4,this.getCustomDataValue()];case 39:return t=e.sent(),[3,57];case 40:return[4,this.getComponentListValue()];case 41:return t=e.sent(),[3,57];case 42:return[4,this.getBlogValue()];case 43:return t=e.sent(),[3,57];case 44:return[4,this.getBlogListValue()];case 45:return t=e.sent(),[3,57];case 46:return[4,this.getBlogCategoryValue()];case 47:return t=e.sent(),[3,57];case 48:return[4,this.getBlogCategoryListValue()];case 49:return t=e.sent(),[3,57];case 50:return[4,this.getRaffleValue()];case 51:return t=e.sent(),[3,57];case 52:return[4,this.getRaffleListValue()];case 53:return t=e.sent(),[3,57];case 54:return[4,this.getSliderValue()];case 55:return t=e.sent(),[3,57];case 56:return[3,57];case 57:return[3,59];case 58:return e.sent(),[2];case 59:return!this.customData.isRequired||void 0!==(null==t?void 0:t.value)&&null!==(null==t?void 0:t.value)?[2,t]:[2]}}))}))},R.prototype.getBooleanValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new l(this.value).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},R.prototype.getBrandListPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new i(this.value).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},R.prototype.getBrandPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new o(this.value).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},R.prototype.getCategoryListPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new u(this.value).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},R.prototype.getCategoryPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new n(this.value).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},R.prototype.getColorPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new c(this.value).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},R.prototype.getRichTextPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new g(this.value).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},R.prototype.getImageListPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new d(this.value).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},R.prototype.getImagePropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new h(this.value).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},R.prototype.getLinkPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new p(this.value,this.theme,this.pageDataProvider.linkMetaDataTargetIds).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},R.prototype.getProductDetailPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new f(this.value).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},R.prototype.getProductListPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new v(this.pageType,this.value,this.pageSpecificData).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},R.prototype.getProductAttributePropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new j(this.value).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},R.prototype.getProductAttributeListPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new w(this.value).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},R.prototype.getTextValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new m(this.value).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},R.prototype.getObjectValue=function(){return t(this,void 0,void 0,(function(){var t,r,a,i,o,u;return e(this,(function(e){switch(e.label){case 0:t={},r=0,a=this.customData.nestedData||[],e.label=1;case 1:if(!(r<a.length))return[3,4];if(!(i=a[r]).key)return[3,3];if(o=this.value[i.key],i.isRequired&&i.type!==s.RAFFLE_LIST&&null==o)throw new Error("Required data is missing");return[4,new R(o,i,this.theme,this.pageType,this.pageDataProvider,this.pageSpecificData).getValue()];case 2:if(u=e.sent(),i.isRequired&&null==u)throw new Error("Required data is missing");t[i.key]=u,e.label=3;case 3:return r++,[3,1];case 4:return[2,{value:t,customData:this.customData}]}}))}))},R.prototype.getArrayValue=function(){return t(this,void 0,void 0,(function(){var t,r,a,i,o,u;return e(this,(function(e){switch(e.label){case 0:if(!this.value||!Array.isArray(this.value))throw new Error("Incorrect data!");t=[],r=this.customData.nestedData[0],a=0,i=this.value,e.label=1;case 1:if(!(a<i.length))return[3,4];if(o=i[a],r.isRequired&&r.type!==s.RAFFLE_LIST&&null==o)throw new Error("Required data is missing");return[4,new R(o,r,this.theme,this.pageType,this.pageDataProvider,this.pageSpecificData).getValue()];case 2:if(u=e.sent(),r.isRequired&&null==u)throw new Error("Required data is missing");t.push(u),e.label=3;case 3:return a++,[3,1];case 4:return[2,{value:t,customData:this.customData}]}}))}))},R.prototype.getEnumValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){return[2,{value:this.value,customData:this.customData}]}))}))},R.prototype.getCustomDataValue=function(){return t(this,void 0,void 0,(function(){var t,r=this;return e(this,(function(e){switch(e.label){case 0:return(t=this.theme.customData.find((function(t){return t.id===r.customData.customDataId})))?((t=new a(y(t))).isRequired=this.customData.isRequired,[4,new R(this.value,t,this.theme,this.pageType,this.pageDataProvider,this.pageSpecificData).getValue()]):[2,{value:null,customData:this.customData}];case 1:return[2,e.sent()]}}))}))},R.prototype.getComponentListValue=function(){return t(this,void 0,void 0,(function(){var t,s,a=this;return e(this,(function(e){switch(e.label){case 0:return t=this.value?this.value.map((function(t){return new r(t)})):[],s={},[4,Promise.all(t.map((function(t){return a.pageDataProvider.getPageComponentPropValues(t)})))];case 1:return[2,(s.value=e.sent(),s.customData=this.customData,s)]}}))}))},R.prototype.getBlogValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new D(this.value).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},R.prototype.getBlogListValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new V(this.pageType,this.value,this.pageSpecificData).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},R.prototype.getBlogCategoryValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new b(this.value).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},R.prototype.getBlogCategoryListValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new T(this.value).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},R.prototype.getRaffleValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new P(this.value).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},R.prototype.getRaffleListValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,(new L).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},R.prototype.getSliderValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new x(this.value).getValue()];case 1:return[2,{value:t.sent(),customData:this.customData}]}}))}))},R}();export{R as IkasCustomPropValueProvider};
@@ -0,0 +1,11 @@
1
+ import { IkasSlider } from "src";
2
+ import IkasPropValueProvider from ".";
3
+ export declare class IkasSliderPropValueProvider implements IkasPropValueProvider<IkasSliderPropValueData> {
4
+ private sliderData;
5
+ constructor(sliderData: IkasSliderPropValueData);
6
+ getValue(): Promise<IkasSlider>;
7
+ }
8
+ export declare type IkasSliderPropValueData = {
9
+ value: number;
10
+ unit: string | null;
11
+ };
@@ -0,0 +1 @@
1
+ import{__awaiter as t,__generator as i}from'../../ext/tslib/tslib.es6.js';import{IkasSlider as e}from"../../models/data/slider/index.js";var n=function(){function n(t){this.sliderData=t}return n.prototype.getValue=function(){return t(this,void 0,void 0,(function(){return i(this,(function(t){return[2,new e({value:this.sliderData.value,unit:this.sliderData.unit})]}))}))},n}();export{n as IkasSliderPropValueProvider};
@@ -1,5 +1,5 @@
1
1
  import { APIInfo } from "./info";
2
- export default class APIGenerator {
3
- static generate(): boolean;
4
- static generateAPI(apiInfo: APIInfo): boolean;
2
+ export declare class APIGenerator {
3
+ static generate(): Promise<boolean>;
4
+ static generateAPI(apiInfo: APIInfo): Promise<boolean>;
5
5
  }
@@ -0,0 +1 @@
1
+ import{__awaiter as e,__generator as r}from'../../../ext/tslib/tslib.es6.js';import t from"path";import{deleteDirContent as n,createFile as s}from"../../../utils/fs.js";import{API_INFO as o}from"./info.js";var i=function(){function i(){}return i.generate=function(){return e(this,void 0,void 0,(function(){var e,s,a,c,u,l;return r(this,(function(r){switch(r.label){case 0:return e=t.join(process.cwd(),"src","pages","api"),[4,n(e)];case 1:r.sent(),s=!0,a=0,c=o,r.label=2;case 2:return a<c.length?(u=c[a],(l=s)?[4,i.generateAPI(u)]:[3,4]):[3,6];case 3:l=r.sent(),r.label=4;case 4:s=l,r.label=5;case 5:return a++,[3,2];case 6:return[2,s]}}))}))},i.generateAPI=function(e){return s(t.join(process.cwd(),"src","pages","api"),e.fileName,e.content)},i}();export{i as APIGenerator};
@@ -1,7 +1,7 @@
1
- export declare const GET_COMPONENT_DIRS_API_CONTENT = "import { IkasLocalThemeAPI } from \"@ikas/storefront/src/pages/api\";\n\nexport default IkasLocalThemeAPI.GetComponentDirs.getComponentDirs;\nexport const config = IkasLocalThemeAPI.GetComponentDirs.config;\n";
2
- export declare const GET_THEME_API_CONTENT = "import { IkasLocalThemeAPI } from \"@ikas/storefront/src/pages/api\";\n\nexport default IkasLocalThemeAPI.GetTheme.getTheme;\nexport const config = IkasLocalThemeAPI.GetTheme.config;\n";
3
- export declare const UPDATE_THEME_API_CONTENT = "import { IkasLocalThemeAPI } from \"@ikas/storefront/src/pages/api\";\n\nexport default IkasLocalThemeAPI.UpdateTheme.updateTheme;\nexport const config = IkasLocalThemeAPI.UpdateTheme.config;\n";
4
- export declare const UPLOAD_THEME_API_CONTENT = "import { IkasLocalThemeAPI } from \"@ikas/storefront/src/pages/api\";\n\nexport default IkasLocalThemeAPI.UploadTheme.uploadTheme;\nexport const config = IkasLocalThemeAPI.UploadTheme.config;\n";
1
+ export declare const GET_COMPONENT_DIRS_API_CONTENT = "import { IkasLocalThemeAPI } from \"@ikas/storefront-utils\";\n\nexport default IkasLocalThemeAPI.GetComponentDirs.getComponentDirs;\nexport const config = IkasLocalThemeAPI.GetComponentDirs.config;\n";
2
+ export declare const GET_THEME_API_CONTENT = "import { IkasLocalThemeAPI } from \"@ikas/storefront-utils\";\n\nexport default IkasLocalThemeAPI.GetTheme.getTheme;\nexport const config = IkasLocalThemeAPI.GetTheme.config;\n";
3
+ export declare const UPDATE_THEME_API_CONTENT = "import { IkasLocalThemeAPI } from \"@ikas/storefront-utils\";\n\nexport default IkasLocalThemeAPI.UpdateTheme.updateTheme;\nexport const config = IkasLocalThemeAPI.UpdateTheme.config;\n";
4
+ export declare const UPLOAD_THEME_API_CONTENT = "import { IkasLocalThemeAPI } from \"@ikas/storefront-utils\";\n\nexport default IkasLocalThemeAPI.UploadTheme.uploadTheme;\nexport const config = IkasLocalThemeAPI.UploadTheme.config;\n";
5
5
  export declare const API_INFO: {
6
6
  content: string;
7
7
  fileName: string;
@@ -0,0 +1 @@
1
+ var e='import { IkasLocalThemeAPI } from "@ikas/storefront-utils";\n\nexport default IkasLocalThemeAPI.GetComponentDirs.getComponentDirs;\nexport const config = IkasLocalThemeAPI.GetComponentDirs.config;\n',o='import { IkasLocalThemeAPI } from "@ikas/storefront-utils";\n\nexport default IkasLocalThemeAPI.GetTheme.getTheme;\nexport const config = IkasLocalThemeAPI.GetTheme.config;\n',t='import { IkasLocalThemeAPI } from "@ikas/storefront-utils";\n\nexport default IkasLocalThemeAPI.UpdateTheme.updateTheme;\nexport const config = IkasLocalThemeAPI.UpdateTheme.config;\n',n='import { IkasLocalThemeAPI } from "@ikas/storefront-utils";\n\nexport default IkasLocalThemeAPI.UploadTheme.uploadTheme;\nexport const config = IkasLocalThemeAPI.UploadTheme.config;\n',a=[{content:e,fileName:"getComponentDirs.ts"},{content:o,fileName:"getTheme.ts"},{content:t,fileName:"updateTheme.ts"},{content:n,fileName:"uploadTheme.ts"}];export{a as API_INFO,e as GET_COMPONENT_DIRS_API_CONTENT,o as GET_THEME_API_CONTENT,t as UPDATE_THEME_API_CONTENT,n as UPLOAD_THEME_API_CONTENT};
@@ -1,6 +1,6 @@
1
1
  import { IkasTheme } from "../../../models/theme/theme";
2
- export default class ComponentImportsGenerator {
3
- static generate(themeJson: IkasTheme): boolean;
4
- static generateAllComponentImportsFileForEditor(themeJson: IkasTheme): boolean;
5
- static generateAllComponentImportsFile(themeJson: IkasTheme): boolean;
2
+ export declare class ComponentImportsGenerator {
3
+ static generate(themeJson: IkasTheme): Promise<boolean>;
4
+ static generateAllComponentImportsFileForEditor(themeJson: IkasTheme): Promise<boolean>;
5
+ static generateAllComponentImportsFile(themeJson: IkasTheme): Promise<boolean>;
6
6
  }
@@ -0,0 +1 @@
1
+ import{__awaiter as n,__generator as t}from'../../../ext/tslib/tslib.es6.js';import o from"path";import{deleteDirContent as e,createFile as r}from"../../../utils/fs.js";var c=function(){function c(){}return c.generate=function(r){return n(this,void 0,void 0,(function(){var n;return t(this,(function(t){switch(t.label){case 0:return[4,e(o.join(process.cwd(),"src","components","__generated__"))];case 1:return t.sent(),[4,c.generateAllComponentImportsFile(r)];case 2:return(n=t.sent())?[4,c.generateAllComponentImportsFileForEditor(r)]:[3,4];case 3:n=t.sent(),t.label=4;case 4:return[2,n]}}))}))},c.generateAllComponentImportsFileForEditor=function(e){return n(this,void 0,void 0,(function(){var n,c,i,s;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),n='import dynamic from "next/dynamic";\r\n',n+='import { IkasEditorComponentLoader } from "@ikas/storefront";\r\n',n+="\r\n",n+="\r\n",(c=e.components.filter((function(n){return"checkout"!==n.id}))).filter((function(n){return"checkout"!==n.id})).forEach((function(t,o){n+="const Component".concat(o,' = dynamic(() => import("../').concat(t.dir,'"), { loading: () => <IkasEditorComponentLoader /> });\r\n')})),n+="\r\n",n+="\nconst Components = {\n ".concat(c.map((function(n,t){return'"'.concat(n.id,'": Component').concat(t)})),"\n};\n"),n+="\r\n",n+="export default Components;",i=o.join(process.cwd(),"src","components","__generated__"),[4,r(i,"editor.tsx",n)];case 1:return[2,t.sent()];case 2:return s=t.sent(),console.error(s),[2,!1];case 3:return[2]}}))}))},c.generateAllComponentImportsFile=function(e){return n(this,void 0,void 0,(function(){var n,c,i,s;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),n="",(c=e.components.filter((function(n){return"checkout"!==n.id}))).filter((function(n){return"checkout"!==n.id})).forEach((function(t,o){n+="import Component".concat(o,' from "../').concat(t.dir,'";\r\n')})),n+="\r\n",n+="\nconst Components = {\n ".concat(c.map((function(n,t){return'"'.concat(n.id,'": Component').concat(t)})),"\n};\n"),n+="\r\n",n+="export default Components;",i=o.join(process.cwd(),"src","components","__generated__"),[4,r(i,"index.tsx",n)];case 1:return[2,t.sent()];case 2:return s=t.sent(),console.error(s),[2,!1];case 3:return[2]}}))}))},c}();export{c as ComponentImportsGenerator};
@@ -5,6 +5,7 @@ export declare const DEPENDENCIES: {
5
5
  mobx: string;
6
6
  "mobx-react-lite": string;
7
7
  "next-transpile-modules": string;
8
+ "@ikas/storefront-utils": string;
8
9
  };
9
10
  export declare const DEV_DEPENDENCIES: {
10
11
  "@types/node": string;
@@ -30,7 +31,7 @@ export declare const SCRIPTS: {
30
31
  generate: string;
31
32
  "prettier:all": string;
32
33
  };
33
- export declare const TS_CONFIG = "{\n \"compilerOptions\": {\n \"target\": \"esnext\",\n \"lib\": [\n \"dom\",\n \"dom.iterable\",\n \"esnext\"\n ],\n \"allowJs\": true,\n \"skipLibCheck\": true,\n \"strict\": true,\n \"forceConsistentCasingInFileNames\": true,\n \"experimentalDecorators\": true,\n \"noEmit\": true,\n \"esModuleInterop\": true,\n \"module\": \"esnext\",\n \"moduleResolution\": \"node\",\n \"resolveJsonModule\": true,\n \"isolatedModules\": true,\n \"jsx\": \"preserve\",\n \"baseUrl\": \".\",\n \"useUnknownInCatchVariables\": false\n },\n \"typeRoots\": [\n \"./node_modules/@types\"\n ],\n \"include\": [\n \"next-env.d.ts\",\n \"**/*.ts\",\n \"**/*.tsx\",\n \"**/typings/global.d.ts\",\n ],\n \"exclude\": [\n \"node_modules\",\n \"./src/pages/api\",\n ]\n}";
34
+ export declare const TS_CONFIG = "{\n \"compilerOptions\": {\n \"target\": \"esnext\",\n \"lib\": [\n \"dom\",\n \"dom.iterable\",\n \"esnext\"\n ],\n \"allowJs\": true,\n \"skipLibCheck\": true,\n \"strict\": true,\n \"forceConsistentCasingInFileNames\": true,\n \"experimentalDecorators\": true,\n \"noEmit\": true,\n \"esModuleInterop\": true,\n \"module\": \"esnext\",\n \"moduleResolution\": \"node\",\n \"resolveJsonModule\": true,\n \"isolatedModules\": true,\n \"jsx\": \"preserve\",\n \"baseUrl\": \".\",\n \"useUnknownInCatchVariables\": false,\n \"incremental\": true\n },\n \"typeRoots\": [\n \"./node_modules/@types\"\n ],\n \"include\": [\n \"next-env.d.ts\",\n \"**/*.ts\",\n \"**/*.tsx\",\n \"**/typings/global.d.ts\",\n ],\n \"exclude\": [\n \"node_modules\",\n \"./src/pages/api\",\n ]\n}";
34
35
  export declare const NEXT_CONFIG = "const withTM = require(\"next-transpile-modules\")([\"@ikas/storefront\"]);\n\nconst config = {\n i18n: {\n defaultLocale: \"en\",\n locales: [\"en\"],\n localeDetection: false,\n },\n basePath: process.env.NEXTJS_BASE_PATH || \"\",\n\n images: {\n deviceSizes: [\n 180,\n 360,\n 540,\n 720,\n 900,\n 1080,\n 1296,\n 1512,\n 1728,\n 1950,\n 2560,\n 3840,\n ],\n },\n\n webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => {\n if (!isServer) {\n config.resolve.fallback.fs = false;\n }\n return config;\n },\n};\n\nmodule.exports = withTM(config);";
35
- export declare const DEV_ENV = "NEXT_PUBLIC_ENV=local\nNEXT_PUBLIC_BASE_URL=https://api.myikas.dev\nNEXT_PUBLIC_IMG_HOST=cdn.myikas.dev\nNEXT_PUBLIC_IMG_BASE_URL=https://cdn.myikas.dev/\nNEXT_PUBLIC_UPLOAD_GQL_URL=https://api.myikas.dev/api/admin/graphql\nNEXT_PUBLIC_GQL_URL=https://api.myikas.dev/api/sf/graphql\n";
36
- export declare const PROD_ENV = "NEXT_PUBLIC_ENV=local\nNEXT_PUBLIC_BASE_URL=https://api.myikas.com\nNEXT_PUBLIC_IMG_HOST=cdn.myikas.com\nNEXT_PUBLIC_IMG_BASE_URL=https://cdn.myikas.com/\nNEXT_PUBLIC_UPLOAD_GQL_URL=https://api.myikas.com/api/admin/graphql\nNEXT_PUBLIC_GQL_URL=https://api.myikas.com/api/sf/graphql\n";
36
+ export declare const DEV_ENV = "NEXT_PUBLIC_ENV=local\nNEXT_PUBLIC_BASE_URL=https://api.myikas.dev/api/sf\nNEXT_PUBLIC_IMG_BASE_URL=https://cdn.myikas.dev/\nNEXT_PUBLIC_UPLOAD_GQL_URL=https://api.myikas.dev/api/admin/graphql\nNEXT_PUBLIC_GQL_URL=https://api.myikas.dev/api/sf/graphql\n";
37
+ export declare const PROD_ENV = "NEXT_PUBLIC_ENV=local\nNEXT_PUBLIC_BASE_URL=https://api.myikas.com\nNEXT_PUBLIC_IMG_BASE_URL=https://cdn.myikas.com/\nNEXT_PUBLIC_UPLOAD_GQL_URL=https://api.myikas.com/api/admin/graphql\nNEXT_PUBLIC_GQL_URL=https://api.myikas.com/api/sf/graphql\n";
@@ -0,0 +1 @@
1
+ var n={next:"12.0.7",react:"17.0.2","react-dom":"17.0.2",mobx:"^6.1.3","mobx-react-lite":"^3.1.5","next-transpile-modules":"^9.0.0","@ikas/storefront-utils":"^2.0.0-alpha.1"},e={"@types/node":"^14.14.6","@types/react":"^16.9.55","@typescript-eslint/eslint-plugin":"^2.10.0","@typescript-eslint/parser":"^2.10.0",eslint:"^6.6.0","eslint-config-react-app":"^5.2.1","eslint-loader":"3.0.3","eslint-plugin-flowtype":"4.6.0","eslint-plugin-import":"2.20.1","eslint-plugin-jsx-a11y":"6.2.3","eslint-plugin-react":"7.19.0","eslint-plugin-react-hooks":"^1.6.1",sass:"^1.43.4",typescript:"^4.5.2"},t={upgradeDependencies:"yarn upgrade @ikas/storefront @ikas/storefront-utils",dev:"next dev -p 3333",build:"next build",start:"next start",generate:"ikas --generate","prettier:all":"npx prettier@^2.1 './**/src/**/*.(ts|tsx|css|scss)' --write"},s='{\n "compilerOptions": {\n "target": "esnext",\n "lib": [\n "dom",\n "dom.iterable",\n "esnext"\n ],\n "allowJs": true,\n "skipLibCheck": true,\n "strict": true,\n "forceConsistentCasingInFileNames": true,\n "experimentalDecorators": true,\n "noEmit": true,\n "esModuleInterop": true,\n "module": "esnext",\n "moduleResolution": "node",\n "resolveJsonModule": true,\n "isolatedModules": true,\n "jsx": "preserve",\n "baseUrl": ".",\n "useUnknownInCatchVariables": false,\n "incremental": true\n },\n "typeRoots": [\n "./node_modules/@types"\n ],\n "include": [\n "next-env.d.ts",\n "**/*.ts",\n "**/*.tsx",\n "**/typings/global.d.ts",\n ],\n "exclude": [\n "node_modules",\n "./src/pages/api",\n ]\n}',i='const withTM = require("next-transpile-modules")(["@ikas/storefront"]);\n\nconst config = {\n i18n: {\n defaultLocale: "en",\n locales: ["en"],\n localeDetection: false,\n },\n basePath: process.env.NEXTJS_BASE_PATH || "",\n\n images: {\n deviceSizes: [\n 180,\n 360,\n 540,\n 720,\n 900,\n 1080,\n 1296,\n 1512,\n 1728,\n 1950,\n 2560,\n 3840,\n ],\n },\n\n webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => {\n if (!isServer) {\n config.resolve.fallback.fs = false;\n }\n return config;\n },\n};\n\nmodule.exports = withTM(config);',a="NEXT_PUBLIC_ENV=local\nNEXT_PUBLIC_BASE_URL=https://api.myikas.dev/api/sf\nNEXT_PUBLIC_IMG_BASE_URL=https://cdn.myikas.dev/\nNEXT_PUBLIC_UPLOAD_GQL_URL=https://api.myikas.dev/api/admin/graphql\nNEXT_PUBLIC_GQL_URL=https://api.myikas.dev/api/sf/graphql\n",r="NEXT_PUBLIC_ENV=local\nNEXT_PUBLIC_BASE_URL=https://api.myikas.com\nNEXT_PUBLIC_IMG_BASE_URL=https://cdn.myikas.com/\nNEXT_PUBLIC_UPLOAD_GQL_URL=https://api.myikas.com/api/admin/graphql\nNEXT_PUBLIC_GQL_URL=https://api.myikas.com/api/sf/graphql\n";export{n as DEPENDENCIES,e as DEV_DEPENDENCIES,a as DEV_ENV,i as NEXT_CONFIG,r as PROD_ENV,t as SCRIPTS,s as TS_CONFIG};
@@ -1,8 +1,8 @@
1
1
  export declare type ENV = "dev" | "prod";
2
- export default class ConfigGenerator {
3
- static generate(env: ENV): boolean | undefined;
4
- static generateTsConfig(): boolean;
5
- static generateNextConfig(): boolean;
6
- static generatePackageJson(): boolean | undefined;
7
- static generateEnv(env: ENV): boolean;
2
+ export declare class ConfigGenerator {
3
+ static generate(env: ENV): Promise<boolean | undefined>;
4
+ static generateTsConfig(): Promise<boolean>;
5
+ static generateNextConfig(): Promise<boolean>;
6
+ static generatePackageJson(): Promise<boolean | undefined>;
7
+ static generateEnv(env: ENV): Promise<boolean>;
8
8
  }
@@ -0,0 +1 @@
1
+ import{__awaiter as e,__generator as n,__assign as t}from'../../../ext/tslib/tslib.es6.js';import r from"path";import s from"fs";import{sortObject as o}from"../../../utils/helper.js";import"../../../storefront/index.js";import"../../../utils/i18n.js";import{createFile as i}from"../../../utils/fs.js";import{TS_CONFIG as c,NEXT_CONFIG as a,SCRIPTS as u,DEV_ENV as f,PROD_ENV as p,DEV_DEPENDENCIES as l,DEPENDENCIES as g}from"./content.js";var d=function(){function d(){}return d.generate=function(t){return e(this,void 0,void 0,(function(){var e,r,s;return n(this,(function(n){switch(n.label){case 0:return[4,d.generateTsConfig()];case 1:return(s=n.sent())?[4,d.generateNextConfig()]:[3,3];case 2:s=n.sent(),n.label=3;case 3:return(r=s)?[4,d.generatePackageJson()]:[3,5];case 4:r=n.sent(),n.label=5;case 5:return(e=r)?[4,d.generateEnv(t)]:[3,7];case 6:e=n.sent(),n.label=7;case 7:return[2,e]}}))}))},d.generateTsConfig=function(){return i(process.cwd(),"tsconfig.json",c)},d.generateNextConfig=function(){return i(process.cwd(),"next.config.js",a)},d.generatePackageJson=function(){return e(this,void 0,void 0,(function(){var e,c,a,f,p;return n(this,(function(n){switch(n.label){case 0:return n.trys.push([0,3,,4]),e=r.join(process.cwd(),"package.json"),(c=s.readFileSync(e)).length?(a=JSON.parse(c.toString()),(f=function(e){var n="dev"===e?l:g,r="dev"===e?"devDependencies":"dependencies";a[r]&&"object"==typeof a[r]?a[r]=t(t({},a[r]),n):a[r]=n;var s=o(a[r]);a[r]=s})("dev"),f("normal"),a.scripts&&"object"==typeof a.scripts?a.scripts=t(t({},a.scripts),u):a.scripts=u,[4,i(e,"",JSON.stringify(a,null,2))]):[3,2];case 1:return[2,n.sent()];case 2:return[3,4];case 3:return p=n.sent(),console.error(p),[2,!1];case 4:return[2]}}))}))},d.generateEnv=function(e){var n="dev"===e?f:p;return i(process.cwd(),".env",n)},d}();export{d as ConfigGenerator};
@@ -0,0 +1,7 @@
1
+ export * from "./api";
2
+ export * from "./components";
3
+ export * from "./config";
4
+ export * from "./pages";
5
+ export * from "./store";
6
+ export * from "./theme";
7
+ export * from "./types";
@@ -1,7 +1,7 @@
1
1
  import { IkasThemePageType } from "../../../models/theme/page";
2
2
  import { PageInfo } from "./info";
3
- export default class PageGenerator {
4
- static generate(): boolean;
5
- static generatePageWithInfo(pageInfo: PageInfo): boolean;
6
- static generatePageWithType(pageType: IkasThemePageType): boolean;
3
+ export declare class PageGenerator {
4
+ static generate(): Promise<boolean>;
5
+ static generatePageWithInfo(pageInfo: PageInfo): Promise<boolean>;
6
+ static generatePageWithType(pageType: IkasThemePageType): Promise<boolean>;
7
7
  }
@@ -0,0 +1 @@
1
+ import{__awaiter as e,__generator as n}from'../../../ext/tslib/tslib.es6.js';import t from"path";import{deleteDirContent as r,createFile as o}from"../../../utils/fs.js";import{PAGE_INFO as s,CHECKOUT_PAGE_CONTENT as a,EDITOR_PAGE_CONTENT as c}from"./info.js";var i=function(){function i(){}return i.generate=function(){return e(this,void 0,void 0,(function(){var e,o,a,c,p,u,m,f,g,d,l,h;return n(this,(function(n){switch(n.label){case 0:return e=t.join(process.cwd(),"src","pages"),[4,r(e,["_app.tsx","_document.tsx","api"])];case 1:n.sent(),o=!0,a=0,c=s,n.label=2;case 2:return a<c.length?(p=c[a],(u=o)?[4,i.generatePageWithInfo(p)]:[3,4]):[3,6];case 3:u=n.sent(),n.label=4;case 4:o=u,n.label=5;case 5:return a++,[3,2];case 6:return m=s.find((function(e){return e.isCheckout})),f=s.find((function(e){return e.isEditor})),m?[4,i.generatePageWithInfo(m)]:[3,8];case 7:return d=n.sent(),[3,9];case 8:d=!1,n.label=9;case 9:return g=d,f?[4,i.generatePageWithInfo(f)]:[3,11];case 10:return h=n.sent(),[3,12];case 11:h=!1,n.label=12;case 12:return l=h,[2,o&&g&&l]}}))}))},i.generatePageWithInfo=function(r){return e(this,void 0,void 0,(function(){var e,s,i,p,u,m;return n(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),e="",r.isCheckout?e=a:r.isEditor?e=c:(s="import { ".concat(r.pageComponentName,' } from "@ikas/storefront";\r\n'),'import Components from "src/components/__generated__/index";\r\n',i="\nconst PageComponent = ".concat(r.pageComponentName,".default;\n\nconst Page = (props: any) => {\n return <PageComponent components={Components} {...props} />;\n};\n\nexport default Page;\r\n"),p=r.isDynamicSSG?"export const getStaticPaths = ".concat(r.pageComponentName,".getStaticPaths;\r\n"):"",u=r.isSSR?"export const getServerSideProps = ".concat(r.pageComponentName,".getServerSideProps;\r\n"):"export const getStaticProps = ".concat(r.pageComponentName,".getStaticProps;\r\n"),e=s+'import Components from "src/components/__generated__/index";\r\n'+i+p+u),[4,o(t.join(process.cwd(),"src","pages"),r.path,e)];case 1:return[2,n.sent()];case 2:return m=n.sent(),console.error(m),[2,!1];case 3:return[2]}}))}))},i.generatePageWithType=function(t){return e(this,void 0,void 0,(function(){var e;return n(this,(function(n){switch(n.label){case 0:return(e=s.find((function(e){return e.pageTypes.includes(t)})))?[4,i.generatePageWithInfo(e)]:[3,2];case 1:return[2,n.sent()];case 2:return[2,!1]}}))}))},i}();export{i as PageGenerator};
@@ -0,0 +1 @@
1
+ import{IkasThemePageType as e}from"../../../models/theme/page/index.js";var a=[{path:"[slug]/index.tsx",pageComponentName:"SlugPage",pageTypes:[e.PRODUCT,e.CATEGORY,e.BRAND],isDynamicSSG:!0},{path:"account/orders/[id].tsx",pageComponentName:"OrderDetailPage",pageTypes:[e.ORDER_DETAIL],isSSR:!0},{path:"account/orders/index.tsx",pageComponentName:"OrdersPage",pageTypes:[e.ORDERS]},{path:"account/addresses.tsx",pageComponentName:"AddressesPage",pageTypes:[e.ADDRESSES]},{path:"account/favorite-products.tsx",pageComponentName:"FavoriteProductsPage",pageTypes:[e.FAVORITE_PRODUCTS]},{path:"account/forgot-password.tsx",pageComponentName:"ForgotPasswordPage",pageTypes:[e.FORGOT_PASSWORD]},{path:"account/index.tsx",pageComponentName:"AccountPage",pageTypes:[e.ACCOUNT]},{path:"account/login.tsx",pageComponentName:"LoginPage",pageTypes:[e.LOGIN]},{path:"account/raffles.tsx",pageComponentName:"AccountRafflesPage",pageTypes:[e.RAFFLE_ACCOUNT]},{path:"account/recover-password.tsx",pageComponentName:"RecoverPasswordPage",pageTypes:[e.RECOVER_PASSWORD]},{path:"account/register.tsx",pageComponentName:"RegisterPage",pageTypes:[e.REGISTER]},{path:"blog/[slug].tsx",pageComponentName:"BlogSlugPage",pageTypes:[e.BLOG,e.BLOG_CATEGORY],isDynamicSSG:!0},{path:"blog/index.tsx",pageComponentName:"BlogPage",pageTypes:[e.BLOG_INDEX]},{path:"pages/[slug].tsx",pageComponentName:"CustomPage",pageTypes:[e.CUSTOM],isDynamicSSG:!0},{path:"raffle/[slug].tsx",pageComponentName:"RafflePage",pageTypes:[e.RAFFLE_DETAIL],isDynamicSSG:!0},{path:"raffle/index.tsx",pageComponentName:"RafflesPage",pageTypes:[e.RAFFLE]},{path:"404.tsx",pageComponentName:"NotFoundPage",pageTypes:[e.NOT_FOUND]},{path:"cart.tsx",pageComponentName:"CartPage",pageTypes:[e.CART]},{path:"index.tsx",pageComponentName:"IndexPage",pageTypes:[e.INDEX]},{path:"search.tsx",pageComponentName:"SearchPage",pageTypes:[e.SEARCH]},{path:"checkout.tsx",pageComponentName:"CheckoutPage",pageTypes:[],isCheckout:!0},{path:"editor.tsx",pageComponentName:"EditorPage",pageTypes:[],isEditor:!0}],t='import { CheckoutPage } from "@ikas/storefront";\n\nexport default CheckoutPage.default;\nexport const getStaticProps = CheckoutPage.getStaticProps;\n',p='import { EditorPage } from "@ikas/storefront";\nimport Components from "../components/__generated__/editor";\n\nconst PageComponent = EditorPage.default;\n\nconst Page = (props: any) => {\n return <PageComponent components={Components} {...props} />;\n};\n\nexport default Page;\nexport const getStaticProps = EditorPage.getStaticProps;\n';export{t as CHECKOUT_PAGE_CONTENT,p as EDITOR_PAGE_CONTENT,a as PAGE_INFO};
@@ -0,0 +1 @@
1
+ var e='import { IkasBaseStore } from "@ikas/storefront";\n\nexport default class Store extends IkasBaseStore {\n // Add your own stores here if needed\n // ex: yourStore: YourStore;\n\n constructor() {\n super();\n\n // Init your own stores here\n // ex: this.yourStore = new YourStore();\n }\n}\n';export{e as STORE_CONTENT};
@@ -1,3 +1,3 @@
1
- export default class StoreGenerator {
2
- static generate(): boolean;
1
+ export declare class StoreGenerator {
2
+ static generate(): Promise<boolean>;
3
3
  }
@@ -0,0 +1 @@
1
+ import{__awaiter as t,__generator as r}from'../../../ext/tslib/tslib.es6.js';import s from"path";import o from"fs";import{createFile as e}from"../../../utils/fs.js";import{STORE_CONTENT as n}from"./content.js";var i=function(){function i(){}return i.generate=function(){return t(this,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return o.existsSync(s.join(process.cwd(),"src","store","index.ts"))?[3,2]:[4,e(s.join(process.cwd(),"src","store"),"index.ts",n)];case 1:return[2,t.sent()];case 2:return[2,!0]}}))}))},i}();export{i as StoreGenerator};
@@ -1,6 +1,6 @@
1
1
  import { IkasTheme } from "../../../models/theme/theme";
2
- export default class ThemeJsonGenerator {
3
- static generate(themeJson: IkasTheme): boolean;
4
- static generateInitialThemeJsonFile(): boolean;
5
- static getTheme(): any;
2
+ export declare class ThemeJsonGenerator {
3
+ static generate(themeJson: IkasTheme): Promise<boolean>;
4
+ static generateInitialThemeJsonFile(): Promise<boolean>;
5
+ static getTheme(): Promise<any>;
6
6
  }
@@ -0,0 +1 @@
1
+ import{__awaiter as e,__generator as r}from'../../../ext/tslib/tslib.es6.js';import t from"path";import n from"fs";import{createFile as o}from"../../../utils/fs.js";import{IkasTheme as i}from"../../../models/theme/theme.js";import{IkasThemePage as s,IkasThemePageType as m}from"../../../models/theme/page/index.js";var u=function(){function u(){}return u.generate=function(e){return o(t.join(process.cwd(),"src","theme.json"),"",JSON.stringify(e,null,2))},u.generateInitialThemeJsonFile=function(){var e=new i;return e.pages.push(new s({type:m.INDEX})),u.generate(e)},u.getTheme=function(){return e(this,void 0,void 0,(function(){var e,o;return r(this,(function(r){try{return e=t.join(process.cwd(),"src","theme.json"),[2,(o=n.readFileSync(e)).length?JSON.parse(o.toString()):null]}catch(e){console.error(e)}return[2]}))}))},u}();export{u as ThemeJsonGenerator};
@@ -0,0 +1,15 @@
1
+ import { IkasTheme } from "../../../models/theme/theme";
2
+ import { IkasThemeCustomData } from "../../../models/theme/custom-data";
3
+ declare type File = {
4
+ content: string;
5
+ imports: string[];
6
+ internalCustomDatas: IkasThemeCustomData[];
7
+ };
8
+ export declare class CustomDataTypesGenerator {
9
+ static generate(themeJson: IkasTheme): Promise<boolean>;
10
+ static generateAllCustomDataTypes(customData: IkasThemeCustomData, file: File): void;
11
+ static genenateCustomDataType(customData: IkasThemeCustomData, file: File): void;
12
+ static getType(customData: IkasThemeCustomData, file: File): string;
13
+ static generateTypeName(customData: IkasThemeCustomData): string;
14
+ }
15
+ export {};
@@ -0,0 +1 @@
1
+ import{__awaiter as e,__generator as t}from'../../../ext/tslib/tslib.es6.js';import a from"path";import{createFile as o,deleteDirContent as s}from"../../../utils/fs.js";import"../../../models/data/blog/index.js";import"../../../models/data/brand/index.js";import"../../../models/data/category/index.js";import"../../../models/data/checkout/index.js";import"../../../models/data/customer/address/index.js";import"../../../models/data/customer/index.js";import"../../../models/data/customer-review/index.js";import"../../../models/data/html-meta-data/index.js";import"../../../models/data/image/index.js";import"../../../models/data/installment-info/index.js";import"../../../models/data/order/index.js";import"../../../models/data/order/line-item/index.js";import"mobx";import"../../../models/data/product/index.js";import"../../../models/data/variant-type/index.js";import"../../../models/data/product/variant/index.js";import"../../../models/data/product/variant/price/index.js";import"../../../models/data/product-attribute/index.js";import"../../../models/data/product/attribute-value/index.js";import"../../../models/data/product-filter/index.js";import"../../../models/data/variant-type/variant-value/index.js";import"../../../models/data/order-transaction/index.js";import"../../../models/data/product-option-set/index.js";import"../../../models/data/raffle/index.js";import"../../../models/theme/theme.js";import"../../../models/theme/page/index.js";import{IkasThemeComponentPropType as r}from"../../../models/theme/component/prop/index.js";import"../../../models/theme/page/component/prop-value/link.js";import"../../../models/ui/brand-list/index.js";import"../../../models/ui/blog-list/index.js";import"../../../models/ui/blog-category-list/index.js";import"../../../models/ui/category-list/index.js";import"../../../models/ui/product-detail/index.js";import"../../../models/ui/product-list/index.js";import"../../../models/ui/product-attribute-detail/index.js";import"../../../models/ui/product-attribute-list/index.js";import"../../../models/ui/customer-review-list/index.js";import"../../../models/ui/validator/index.js";import"../../../models/ui/validator/rules/index.js";import"../../../models/ui/validator/form/login.js";import"../../../models/ui/validator/form/address.js";import"../../../models/ui/validator/form/register.js";import"../../../models/ui/validator/form/contact-form.js";import"../../../models/ui/validator/form/forgot-password.js";import"../../../models/ui/validator/form/recover-password.js";import"../../../models/ui/validator/form/account-info.js";import"../../../models/ui/validator/form/raffle-form.js";import"../../../models/ui/validator/form/customer-review.js";import"../../../models/ui/raffle-list/index.js";import"../../../models/theme/settings/index.js";import"../../../models/theme/custom-data/index.js";import i from'../../../ext/lodash/uniq.js';var n=function(){function n(){}return n.generate=function(r){return e(this,void 0,void 0,(function(){var e,m,d,p,c;return t(this,(function(t){switch(t.label){case 0:return[4,s(a.join(process.cwd(),"src","components","__generated__","types"))];case 1:t.sent(),e={content:"",imports:[],internalCustomDatas:[]},t.label=2;case 2:return t.trys.push([2,4,,5]),r.customData.forEach((function(t){n.generateAllCustomDataTypes(t,e)})),e.internalCustomDatas.forEach((function(t){n.generateAllCustomDataTypes(t,e)})),m=a.join(process.cwd(),"src","components","__generated__"),e.imports=i(e.imports),d="import {\r\n",e.imports.forEach((function(e){d+="\t".concat(e,",\r\n")})),p=(d+='} from "@ikas/storefront"\r\n\r\n')+e.content,[4,o(m,"types.ts",p)];case 3:return[2,t.sent()];case 4:return c=t.sent(),console.log(c),[2,!1];case 5:return[2]}}))}))},n.generateAllCustomDataTypes=function(e,t){var a=e.type===r.ENUM,o="export ".concat(a?"enum":"type"," ").concat(n.generateTypeName(e)).concat(a?"":" = ","{ \r\n"),s="};\r\n\r\n";e.type!==r.DYNAMIC_LIST&&e.type!==r.STATIC_LIST||!e.nestedData?e.type===r.ENUM&&e.enumOptions?(t.content+=o,e.enumOptions.forEach((function(e){e.value&&e.value[0].match(/^\d/)&&(e.value="_"+e.value),t.content+='\t"'.concat(null==e?void 0:e.value,'" = "').concat(null==e?void 0:e.displayName,'",'),t.content+="\r\n"})),t.content+=s):(t.content+=o,e.nestedData&&e.nestedData.forEach((function(e){n.genenateCustomDataType(e,t),t.content+="\r\n"})),t.content+=s):n.generateAllCustomDataTypes(e.nestedData[0],t)},n.genenateCustomDataType=function(e,t){var a=n.getType(e,t);e.key&&e.key[0].match(/^\d/)&&(e.key="_"+e.key),t.content+="\t".concat(e.key).concat(e.isRequired?"":"?",": ").concat(a).concat([r.DYNAMIC_LIST,r.STATIC_LIST].includes(e.type)?"[]":"").concat(e.type===r.ENUM?",":";")},n.getType=function(e,t){var a="";switch(e.type){case r.TEXT:case r.RICH_TEXT:case r.COLOR:a="string";break;case r.BOOLEAN:a="boolean";break;case r.IMAGE:a="IkasImage",t.imports.push(a);break;case r.IMAGE_LIST:a="IkasImageList",t.imports.push(a);break;case r.LINK:a="IkasNavigationLink",t.imports.push(a);break;case r.LIST_OF_LINK:a="IkasNavigationLink[]",t.imports.push("IkasNavigationLink");break;case r.PRODUCT_DETAIL:a="IkasProductDetail",t.imports.push(a);break;case r.PRODUCT_LIST:a="IkasProductDetail[]",t.imports.push("IkasProductDetail");break;case r.PRODUCT_ATTRIBUTE:a="IkasProductAttribute",t.imports.push(a);break;case r.PRODUCT_ATTRIBUTE_LIST:a="IkasProductAttribute[]",t.imports.push("IkasProductAttribute");break;case r.BRAND:a="IkasBrand",t.imports.push(a);break;case r.BRAND_LIST:a="IkasBrandList",t.imports.push(a);break;case r.CATEGORY:a="IkasCategory",t.imports.push(a);break;case r.CATEGORY_LIST:a="IkasCategoryList",t.imports.push(a);break;case r.COMPONENT:a="IkasComponentRenderer";break;case r.COMPONENT_LIST:a="IkasComponentRenderer[]";break;case r.BLOG:a="IkasBlog",t.imports.push(a);break;case r.BLOG_LIST:a="IkasBlogList",t.imports.push(a);break;case r.BLOG_CATEGORY:a="IkasBlogCategory",t.imports.push(a);break;case r.BLOG_CATEGORY_LIST:a="IkasBlogCategoryList",t.imports.push(a);break;case r.RAFFLE:a="IkasRaffle",t.imports.push(a);break;case r.RAFFLE_LIST:a="IkasRaffleList",t.imports.push(a);break;case r.ENUM:a=n.generateTypeName(e),t.content.includes("export enum ".concat(a))||t.internalCustomDatas.push(e);break;case r.DYNAMIC_LIST:case r.STATIC_LIST:e.nestedData&&(e.nestedData[0].type===r.OBJECT||e.nestedData[0].type===r.ENUM?(a=n.generateTypeName(e),t.content.includes("export type ".concat(a))||t.internalCustomDatas.push(e)):a=n.getType(e.nestedData[0],t))}return a},n.generateTypeName=function(e){if(e.typescriptName)return e.typescriptName;var t=e.name||"";return(t=(t=t.replace(/\s/g,"")).replace(/\W/g,""))[0].match(/^\d/)&&(t="_"+t),e.type===r.ENUM&&(t+="Enum"),t},n}();export{n as CustomDataTypesGenerator};
@@ -10,21 +10,20 @@ export declare class IkasCartStore {
10
10
  private _isLoadingCart;
11
11
  private _cartLoadFinished;
12
12
  constructor(baseStore: IkasBaseStore);
13
- get isBrowser(): boolean;
14
13
  get isLoadingCart(): boolean;
15
14
  get cartLoadFinished(): boolean;
16
15
  get checkoutId(): string | null | undefined;
17
16
  get checkoutUrl(): string | undefined;
17
+ addItem: (variant: IkasProductVariant, product: IkasProduct, initialQuantity?: number) => Promise<boolean>;
18
+ changeItemQuantity: (item: IkasOrderLineItem, quantity: number) => Promise<boolean>;
19
+ removeItem: (item: IkasOrderLineItem) => Promise<void>;
20
+ removeCart: () => void;
21
+ waitUntilInitialized: () => Promise<unknown>;
22
+ private removeCardIfEmpty;
18
23
  private getCart;
19
24
  private setCart;
20
25
  private beforeCartOperationCheck;
21
26
  private findExistingItem;
22
27
  private createCartLineOptions;
23
28
  private getOptionValues;
24
- addItem: (variant: IkasProductVariant, product: IkasProduct, initialQuantity?: number) => Promise<boolean>;
25
- changeItemQuantity: (item: IkasOrderLineItem, quantity: number) => Promise<boolean>;
26
- removeItem: (item: IkasOrderLineItem) => Promise<void>;
27
- removeCardIfEmpty: () => void;
28
- removeCart: () => void;
29
- waitUntilInitialized: () => Promise<unknown>;
30
29
  }
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as e}from'../ext/tslib/tslib.es6.js';import"../api/blog/index.js";import"../api/brand/index.js";import{IkasCartAPI as i}from"../api/cart/index.js";import"../api/category/index.js";import{IkasCheckoutAPI as r}from"../api/checkout/index.js";import"../api/city/index.js";import"../api/country/index.js";import"../api/customer/index.js";import"../api/customer-review/index.js";import"../api/district/index.js";import"../api/html-meta-data/index.js";import"../api/merchant/index.js";import"../api/product-search/index.js";import"../models/data/blog/index.js";import"../models/data/brand/index.js";import"../models/data/category/index.js";import"../models/data/checkout/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/index.js";import"../models/data/customer-review/index.js";import"../models/data/html-meta-data/index.js";import"../models/data/image/index.js";import"../models/data/installment-info/index.js";import"../models/data/order/index.js";import"../models/data/order/line-item/index.js";import{makeAutoObservable as o}from"mobx";import"../models/data/product/index.js";import"../models/data/variant-type/index.js";import"../models/data/product/variant/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product-attribute/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product-filter/index.js";import"../models/data/variant-type/variant-value/index.js";import"../models/data/order-transaction/index.js";import"../models/data/product-option-set/index.js";import"../models/data/raffle/index.js";import"../models/theme/theme.js";import"../models/theme/page/index.js";import"../models/theme/component/prop/index.js";import"../models/theme/page/component/prop-value/link.js";import"../models/ui/brand-list/index.js";import"../models/ui/blog-list/index.js";import"../models/ui/blog-category-list/index.js";import"../models/ui/category-list/index.js";import"../models/ui/product-detail/index.js";import"../models/ui/product-list/index.js";import"../models/ui/product-attribute-detail/index.js";import"../models/ui/product-attribute-list/index.js";import"../models/ui/customer-review-list/index.js";import"../models/ui/validator/index.js";import"../models/ui/validator/rules/index.js";import"../models/ui/validator/form/login.js";import"../models/ui/validator/form/address.js";import"../models/ui/validator/form/register.js";import"../models/ui/validator/form/contact-form.js";import"../models/ui/validator/form/forgot-password.js";import"../models/ui/validator/form/recover-password.js";import"../models/ui/validator/form/account-info.js";import"../models/ui/validator/form/raffle-form.js";import"../models/ui/validator/form/customer-review.js";import"../models/ui/raffle-list/index.js";import"../models/theme/settings/index.js";import"../models/theme/custom-data/index.js";import"../api/apollo.js";import"../api/favorite-product/index.js";import"../api/contact-form/index.js";import"../api/state/index.js";import"../api/product-option-set/index.js";import"../api/raffle/index.js";import"../api/back-in-stock-reminder/index.js";import{Analytics as n}from"../analytics/analytics.js";import"react";import{IkasStorefrontConfig as s}from"../storefront/index.js";import'../ext/html-react-parser/index.js';import"../analytics/events.js";import{IkasProductCartLineOption as a}from"../models/data/product-cart-item-options/index.js";var d="cartId",u="checkoutId",c=function(){function d(d){var u=this;this.cart=null,this._checkoutId=null,this._isLoadingCart=!1,this._cartLoadFinished=!1,this.getCart=function(){return t(u,void 0,void 0,(function(){var t,r,o,n,s,a;return e(this,(function(e){switch(e.label){case 0:if(!this.isBrowser)return[2];e.label=1;case 1:return e.trys.push([1,6,7,8]),this._isLoadingCart=!0,t=null===(s=this.baseStore.customerStore.customer)||void 0===s?void 0:s.id,(r=(null===(a=this.cart)||void 0===a?void 0:a.id)||localStorage.getItem("cartId"))||t?[4,i.getCart(r||void 0)]:[2];case 2:return(o=e.sent())?[4,this.setCart(o)]:[3,4];case 3:return e.sent(),[3,5];case 4:this.removeCart(),e.label=5;case 5:return[3,8];case 6:return n=e.sent(),console.log(n),[3,8];case 7:return this._isLoadingCart=!1,this._cartLoadFinished=!0,[7];case 8:return[2]}}))}))},this.setCart=function(i){return t(u,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return localStorage.setItem("cartId",i.id),this.cart=i,this._checkoutId||(this._checkoutId=localStorage.getItem("checkoutId")||void 0),this._checkoutId?[3,2]:[4,r.getCheckoutId(i.id)];case 1:t=e.sent(),this._checkoutId=t,t&&localStorage.setItem("checkoutId",t),e.label=2;case 2:return[2]}}))}))},this.beforeCartOperationCheck=function(){return t(u,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t=localStorage.getItem("cartId"),!this.cart||t?[3,1]:(this.removeCart(),[3,3]);case 1:return this.cart||!t?[3,3]:[4,this.getCart()];case 2:e.sent(),e.label=3;case 3:return[2]}}))}))},this.findExistingItem=function(t,e){var i,r,o,n,s;if(!e.productOptionSetId)return null===(i=u.cart)||void 0===i?void 0:i.items.find((function(e){return e.variant.id===t.id}));for(var a=u.getOptionValues(e),d=(null===(r=u.cart)||void 0===r?void 0:r.items.filter((function(e){var i;return e.variant.id===t.id&&(null===(i=e.options)||void 0===i?void 0:i.length)===a.length})))||[],c=0,l=d;c<l.length;c++){var m=l[c];if(m.options){for(var p=!0,h=function(t){var i=t.values.map((function(t){return t.value})),r=null===(s=null===(n=null===(o=e.productOptionSet)||void 0===o?void 0:o.options)||void 0===n?void 0:n.find((function(e){return e.id===t.productOptionId})))||void 0===s?void 0:s.values;if(!(p=p&&i.length===(null==r?void 0:r.length)&&i.every((function(t){return null==r?void 0:r.includes(t)}))))return"break"},v=0,f=m.options;v<f.length;v++){if("break"===h(f[v]))break}if(p)return m}}},this.createCartLineOptions=function(t){if(t&&t.options){for(var e=[],i=0,r=t.options;i<r.length;i++){var o=r[i],n=new a({});n.productOptionId=o.productOptionId,n.productOptionsSetId=o.productOptionsSetId,n.values=o.values.map((function(t){return t.value})),e.push(n)}return e}return null},this.getOptionValues=function(t){var e,i=[];return null===(e=t.productOptionSet)||void 0===e||e.options.forEach((function(t){t.values.length&&i.push(new a({productOptionId:t.id,productOptionsSetId:t.productOptionSetId,values:t.values}))})),i},this.addItem=function(r,o,a){return void 0===a&&(a=1),t(u,void 0,void 0,(function(){var t,d,u,c,l,m,p,h,v,f,j,I,g;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,5,,6]),o.canAddToCart?[4,this.beforeCartOperationCheck()]:[2,!1];case 1:return e.sent(),this.cart&&(t=this.findExistingItem(r,o))?(null===(v=o.productOptionSet)||void 0===v||v.initOptionValues(),[2,this.changeItemQuantity(t,t.quantity+1)]):(d=this.getOptionValues(o),u=(null===(f=this.cart)||void 0===f?void 0:f.id)||localStorage.getItem("cartId"),c={cartId:u,customerId:(null===(j=this.cart)||void 0===j?void 0:j.customerId)||(null===(I=this.baseStore.customerStore.customer)||void 0===I?void 0:I.id)||null,item:{id:null,quantity:a,variant:{id:r.id,name:o.name}},options:d.length?d:null,priceListId:s.priceListId||null,salesChannelId:s.salesChannelId,storefrontId:s.storefrontId,storefrontRoutingId:s.storefrontRoutingId,storefrontThemeId:s.storefrontThemeId},[4,i.saveItemToCart(c)]);case 2:return(l=e.sent())?[4,this.setCart(l)]:[3,4];case 3:e.sent(),e.label=4;case 4:return this.cart&&(m=this.cart.id+"-"+this.cart.updatedAt,(p=this.cart.items.find((function(t){return t.variant.id})))&&n.addToCart(p,a,m,this.cart)),null===(g=o.productOptionSet)||void 0===g||g.initOptionValues(),[2,!0];case 5:return h=e.sent(),console.log(h),[2,!1];case 6:return[2]}}))}))},this.changeItemQuantity=function(r,o){return t(u,void 0,void 0,(function(){var t,a,d,u,c,l,m,p;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,5,,6]),[4,this.beforeCartOperationCheck()];case 1:return e.sent(),t={cartId:(null===(l=this.cart)||void 0===l?void 0:l.id)||null,customerId:(null===(m=this.cart)||void 0===m?void 0:m.customerId)||(null===(p=this.baseStore.customerStore.customer)||void 0===p?void 0:p.id)||null,item:{id:r.id,quantity:o,variant:{id:r.variant.id,name:r.variant.name}},options:this.createCartLineOptions(r),priceListId:s.priceListId||null,salesChannelId:s.salesChannelId,storefrontId:s.storefrontId,storefrontRoutingId:s.storefrontRoutingId,storefrontThemeId:s.storefrontThemeId},[4,i.saveItemToCart(t)];case 2:return(a=e.sent())?[4,this.setCart(a)]:[3,4];case 3:e.sent(),e.label=4;case 4:return this.removeCardIfEmpty(),this.cart&&(d=this.cart.id+"-"+this.cart.updatedAt,(u=r.quantity)>o?n.removeFromCart(r,u-o,this.cart):n.addToCart(r,o-u,d,this.cart)),[2,!0];case 5:return c=e.sent(),console.log(c),[2,!1];case 6:return[2]}}))}))},this.removeItem=function(i){return t(u,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,this.changeItemQuantity(i,0)];case 1:return t.sent(),[2]}}))}))},this.removeCardIfEmpty=function(){var t;0===(null===(t=u.cart)||void 0===t?void 0:t.itemCount)&&u.removeCart()},this.removeCart=function(){localStorage.removeItem("cartId"),localStorage.removeItem("checkoutId"),u.cart=void 0,u._checkoutId=void 0},this.waitUntilInitialized=function(){return new Promise((function(t){var e=setInterval((function(){u.cartLoadFinished&&(clearInterval(e),t(null))}),100)}))},this.baseStore=d,o(this)}return Object.defineProperty(d.prototype,"isBrowser",{get:function(){return"undefined"!=typeof localStorage},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"isLoadingCart",{get:function(){return this._isLoadingCart},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"cartLoadFinished",{get:function(){return this._cartLoadFinished},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"checkoutId",{get:function(){return this._checkoutId},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"checkoutUrl",{get:function(){if(this._checkoutId)return"/checkout?id="+this._checkoutId+"&step=info"},enumerable:!1,configurable:!0}),d}();export{d as CART_LS_KEY,u as CHECKOUT_LS_KEY,c as IkasCartStore};
1
+ import{__awaiter as t,__generator as e}from'../ext/tslib/tslib.es6.js';import"../api/blog/index.js";import"../api/brand/index.js";import{IkasCartAPI as i}from"../api/cart/index.js";import"../api/category/index.js";import{IkasCheckoutAPI as o}from"../api/checkout/index.js";import"../api/city/index.js";import"../api/country/index.js";import"../api/customer/index.js";import"../api/customer-review/index.js";import"../api/district/index.js";import"../api/html-meta-data/index.js";import"../api/merchant/index.js";import"../api/product-search/index.js";import"../models/data/blog/index.js";import"../models/data/brand/index.js";import"../models/data/category/index.js";import"../models/data/checkout/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/index.js";import"../models/data/customer-review/index.js";import"../models/data/html-meta-data/index.js";import"../models/data/image/index.js";import"../models/data/installment-info/index.js";import"../models/data/order/index.js";import"../models/data/order/line-item/index.js";import{makeAutoObservable as r}from"mobx";import"../models/data/product/index.js";import"../models/data/variant-type/index.js";import"../models/data/product/variant/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product-attribute/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product-filter/index.js";import"../models/data/variant-type/variant-value/index.js";import"../models/data/order-transaction/index.js";import"../models/data/product-option-set/index.js";import"../models/data/raffle/index.js";import"../models/theme/theme.js";import"../models/theme/page/index.js";import"../models/theme/component/prop/index.js";import"../models/theme/page/component/prop-value/link.js";import"../models/ui/brand-list/index.js";import"../models/ui/blog-list/index.js";import"../models/ui/blog-category-list/index.js";import"../models/ui/category-list/index.js";import"../models/ui/product-detail/index.js";import"../models/ui/product-list/index.js";import"../models/ui/product-attribute-detail/index.js";import"../models/ui/product-attribute-list/index.js";import"../models/ui/customer-review-list/index.js";import"../models/ui/validator/index.js";import"../models/ui/validator/rules/index.js";import"../models/ui/validator/form/login.js";import"../models/ui/validator/form/address.js";import"../models/ui/validator/form/register.js";import"../models/ui/validator/form/contact-form.js";import"../models/ui/validator/form/forgot-password.js";import"../models/ui/validator/form/recover-password.js";import"../models/ui/validator/form/account-info.js";import"../models/ui/validator/form/raffle-form.js";import"../models/ui/validator/form/customer-review.js";import"../models/ui/raffle-list/index.js";import"../models/theme/settings/index.js";import"../models/theme/custom-data/index.js";import"../api/apollo.js";import"../api/favorite-product/index.js";import"../api/contact-form/index.js";import"../api/state/index.js";import"../api/product-option-set/index.js";import"../api/raffle/index.js";import"../api/back-in-stock-reminder/index.js";import{Analytics as n}from"../analytics/analytics.js";import"../analytics/head/index.js";import{IkasStorefrontConfig as a}from"../storefront/index.js";import{IkasProductCartLineOption as s}from"../models/data/product-cart-item-options/index.js";var d="cartId",c="checkoutId",u=function(){function d(d){var c=this;this.cart=null,this._checkoutId=null,this._isLoadingCart=!1,this._cartLoadFinished=!1,this.addItem=function(o,r,s){return void 0===s&&(s=1),t(c,void 0,void 0,(function(){var t,d,c,u,l,m,p,h,v,f,j,I,g;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,5,,6]),r.canAddToCart?[4,this.beforeCartOperationCheck()]:[2,!1];case 1:return e.sent(),this.cart&&(t=this.findExistingItem(o,r))?(null===(v=r.productOptionSet)||void 0===v||v.initOptionValues(),[2,this.changeItemQuantity(t,t.quantity+1)]):(d=this.getOptionValues(r),c=(null===(f=this.cart)||void 0===f?void 0:f.id)||localStorage.getItem("cartId"),u={cartId:c,customerId:(null===(j=this.cart)||void 0===j?void 0:j.customerId)||(null===(I=this.baseStore.customerStore.customer)||void 0===I?void 0:I.id)||null,item:{id:null,quantity:s,variant:{id:o.id,name:r.name}},options:d.length?d:null,priceListId:a.priceListId||null,salesChannelId:a.salesChannelId,storefrontId:a.storefrontId,storefrontRoutingId:a.storefrontRoutingId,storefrontThemeId:a.storefrontThemeId},[4,i.saveItemToCart(u)]);case 2:return(l=e.sent())?[4,this.setCart(l)]:[3,4];case 3:e.sent(),e.label=4;case 4:return this.cart&&(m="".concat(this.cart.id,"-").concat(this.cart.updatedAt),(p=this.cart.items.find((function(t){return t.variant.id})))&&n.addToCart(p,s,m,this.cart)),null===(g=r.productOptionSet)||void 0===g||g.initOptionValues(),[2,!0];case 5:return h=e.sent(),console.log(h),[2,!1];case 6:return[2]}}))}))},this.changeItemQuantity=function(o,r){return t(c,void 0,void 0,(function(){var t,s,d,c,u,l,m,p;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,5,,6]),[4,this.beforeCartOperationCheck()];case 1:return e.sent(),t={cartId:(null===(l=this.cart)||void 0===l?void 0:l.id)||null,customerId:(null===(m=this.cart)||void 0===m?void 0:m.customerId)||(null===(p=this.baseStore.customerStore.customer)||void 0===p?void 0:p.id)||null,item:{id:o.id,quantity:r,variant:{id:o.variant.id,name:o.variant.name}},options:this.createCartLineOptions(o),priceListId:a.priceListId||null,salesChannelId:a.salesChannelId,storefrontId:a.storefrontId,storefrontRoutingId:a.storefrontRoutingId,storefrontThemeId:a.storefrontThemeId},[4,i.saveItemToCart(t)];case 2:return(s=e.sent())?[4,this.setCart(s)]:[3,4];case 3:e.sent(),e.label=4;case 4:return this.removeCardIfEmpty(),this.cart&&(d="".concat(this.cart.id,"-").concat(this.cart.updatedAt),(c=o.quantity)>r?n.removeFromCart(o,c-r,this.cart):n.addToCart(o,r-c,d,this.cart)),[2,!0];case 5:return u=e.sent(),console.log(u),[2,!1];case 6:return[2]}}))}))},this.removeItem=function(i){return t(c,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,this.changeItemQuantity(i,0)];case 1:return t.sent(),[2]}}))}))},this.removeCart=function(){localStorage.removeItem("cartId"),localStorage.removeItem("checkoutId"),c.cart=void 0,c._checkoutId=void 0},this.waitUntilInitialized=function(){return new Promise((function(t){var e=setInterval((function(){c.cartLoadFinished&&(clearInterval(e),t(null))}),100)}))},this.removeCardIfEmpty=function(){var t;0===(null===(t=c.cart)||void 0===t?void 0:t.itemCount)&&c.removeCart()},this.getCart=function(){return t(c,void 0,void 0,(function(){var t,o,r,n,a,s;return e(this,(function(e){switch(e.label){case 0:if(!("undefined"!=typeof localStorage))return[2];e.label=1;case 1:return e.trys.push([1,6,7,8]),this._isLoadingCart=!0,t=null===(a=this.baseStore.customerStore.customer)||void 0===a?void 0:a.id,(o=(null===(s=this.cart)||void 0===s?void 0:s.id)||localStorage.getItem("cartId"))||t?[4,i.getCart(o||void 0)]:[2];case 2:return(r=e.sent())?[4,this.setCart(r)]:[3,4];case 3:return e.sent(),[3,5];case 4:this.removeCart(),e.label=5;case 5:return[3,8];case 6:return n=e.sent(),console.log(n),[3,8];case 7:return this._isLoadingCart=!1,this._cartLoadFinished=!0,[7];case 8:return[2]}}))}))},this.setCart=function(i){return t(c,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return localStorage.setItem("cartId",i.id),this.cart=i,this._checkoutId||(this._checkoutId=localStorage.getItem("checkoutId")||void 0),this._checkoutId?[3,2]:[4,o.getCheckoutId(i.id)];case 1:t=e.sent(),this._checkoutId=t,t&&localStorage.setItem("checkoutId",t),e.label=2;case 2:return[2]}}))}))},this.beforeCartOperationCheck=function(){return t(c,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t=localStorage.getItem("cartId"),!this.cart||t?[3,1]:(this.removeCart(),[3,3]);case 1:return this.cart||!t?[3,3]:[4,this.getCart()];case 2:e.sent(),e.label=3;case 3:return[2]}}))}))},this.findExistingItem=function(t,e){var i,o,r,n,a;if(!e.productOptionSetId)return null===(i=c.cart)||void 0===i?void 0:i.items.find((function(e){return e.variant.id===t.id}));for(var s=c.getOptionValues(e),d=(null===(o=c.cart)||void 0===o?void 0:o.items.filter((function(e){var i;return e.variant.id===t.id&&(null===(i=e.options)||void 0===i?void 0:i.length)===s.length})))||[],u=0,l=d;u<l.length;u++){var m=l[u];if(m.options){for(var p=!0,h=function(t){var i=t.values.map((function(t){return t.value})),o=null===(a=null===(n=null===(r=e.productOptionSet)||void 0===r?void 0:r.options)||void 0===n?void 0:n.find((function(e){return e.id===t.productOptionId})))||void 0===a?void 0:a.values;if(!(p=p&&i.length===(null==o?void 0:o.length)&&i.every((function(t){return null==o?void 0:o.includes(t)}))))return"break"},v=0,f=m.options;v<f.length;v++){if("break"===h(f[v]))break}if(p)return m}}},this.createCartLineOptions=function(t){if(t&&t.options){for(var e=[],i=0,o=t.options;i<o.length;i++){var r=o[i],n=new s({});n.productOptionId=r.productOptionId,n.productOptionsSetId=r.productOptionsSetId,n.values=r.values.map((function(t){return t.value})),e.push(n)}return e}return null},this.getOptionValues=function(t){var e,i=[];return null===(e=t.productOptionSet)||void 0===e||e.options.forEach((function(t){t.values.length&&i.push(new s({productOptionId:t.id,productOptionsSetId:t.productOptionSetId,values:t.values}))})),i},this.baseStore=d,r(this)}return Object.defineProperty(d.prototype,"isLoadingCart",{get:function(){return this._isLoadingCart},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"cartLoadFinished",{get:function(){return this._cartLoadFinished},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"checkoutId",{get:function(){return this._checkoutId},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"checkoutUrl",{get:function(){if(this._checkoutId)return"/checkout?id=".concat(this._checkoutId,"&step=info")},enumerable:!1,configurable:!0}),d}();export{d as CART_LS_KEY,c as CHECKOUT_LS_KEY,u as IkasCartStore};