@ikas/storefront 2.0.0-alpha.8 → 2.0.0

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 (166) 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/product-option-set/index.js +1 -1
  31. package/build/api/raffle/__generated__/getRafflesByCustomerId.d.ts +3 -0
  32. package/build/api/raffle/__generated__/listRaffle.d.ts +14 -16
  33. package/build/api/raffle/__generated__/saveRaffleParticipant.d.ts +2 -2
  34. package/build/api/raffle/index.d.ts +1 -1
  35. package/build/api/raffle/index.js +1 -1
  36. package/build/api/variant-type/__generated__/listVariantType.d.ts +3 -7
  37. package/build/components/checkout/components/address-form/index.js +1 -1
  38. package/build/components/checkout/components/address-form/model.d.ts +8 -0
  39. package/build/components/checkout/components/cart-summary/cart-item/index.js +1 -1
  40. package/build/components/checkout/components/cart-summary/index.js +1 -1
  41. package/build/components/checkout/components/cart-summary/style.module.scss.js +1 -1
  42. package/build/components/checkout/components/step-container/index.js +1 -1
  43. package/build/components/checkout/index.js +1 -1
  44. package/build/components/checkout/model.d.ts +2 -0
  45. package/build/components/checkout/model.js +1 -1
  46. package/build/components/checkout/steps/step-payment/payment-gateways/index.js +1 -1
  47. package/build/components/checkout/steps/step-payment/payment-gateways/installments/index.js +1 -1
  48. package/build/components/checkout/steps/step-shipping/index.js +1 -1
  49. package/build/components/checkout/steps/step-success/index.js +1 -1
  50. package/build/components/index.d.ts +1 -1
  51. package/build/components/page/ThemeComponent.js +1 -1
  52. package/build/components/page/head.js +1 -1
  53. package/build/components/page/index.js +1 -1
  54. package/build/components/page-editor/ThemeComponentEditor.d.ts +0 -3
  55. package/build/components/page-editor/ThemeComponentEditor.js +1 -1
  56. package/build/components/page-editor/index.d.ts +3 -1
  57. package/build/components/page-editor/index.js +1 -1
  58. package/build/components/page-editor/loader/index.d.ts +5 -1
  59. package/build/components/page-editor/loader/index.js +1 -1
  60. package/build/components/page-editor/loader/style.module.scss.js +1 -1
  61. package/build/components/page-editor/model.d.ts +8 -4
  62. package/build/components/page-editor/model.js +1 -1
  63. package/build/ext/@apollo/client/cache/inmemory/entityStore.js +1 -1
  64. package/build/ext/@apollo/client/cache/inmemory/inMemoryCache.js +1 -1
  65. package/build/ext/@apollo/client/cache/inmemory/policies.js +1 -1
  66. package/build/ext/@apollo/client/cache/inmemory/readFromStore.js +1 -1
  67. package/build/ext/@apollo/client/cache/inmemory/writeToStore.js +1 -1
  68. package/build/ext/@apollo/client/core/ApolloClient.js +1 -1
  69. package/build/ext/@apollo/client/core/LocalState.js +1 -1
  70. package/build/ext/@apollo/client/core/ObservableQuery.js +1 -1
  71. package/build/ext/@apollo/client/core/QueryManager.js +1 -1
  72. package/build/ext/@apollo/client/errors/index.js +1 -1
  73. package/build/ext/@apollo/client/ext/tslib/tslib.es6.js +15 -0
  74. package/build/ext/@apollo/client/link/context/index.js +1 -1
  75. package/build/ext/@apollo/client/link/core/ApolloLink.js +1 -1
  76. package/build/ext/@apollo/client/link/error/index.js +1 -1
  77. package/build/ext/@apollo/client/link/http/HttpLink.js +1 -1
  78. package/build/ext/@apollo/client/link/http/createHttpLink.js +1 -1
  79. package/build/ext/@apollo/client/link/http/selectHttpOptionsAndBody.js +1 -1
  80. package/build/ext/@apollo/client/link/utils/createOperation.js +1 -1
  81. package/build/ext/@apollo/client/utilities/common/mergeDeep.js +1 -1
  82. package/build/ext/@apollo/client/utilities/graphql/fragments.js +1 -1
  83. package/build/ext/@apollo/client/utilities/graphql/transform.js +1 -1
  84. package/build/ext/@apollo/client/utilities/observables/Concast.js +1 -1
  85. package/build/ext/ts-invariant/ext/tslib/tslib.es6.js +15 -0
  86. package/build/ext/ts-invariant/lib/invariant.esm.js +1 -1
  87. package/build/ext/tslib/tslib.es6.js +1 -1
  88. package/build/ikas.js +67 -2
  89. package/build/index.js +1 -1
  90. package/build/models/data/blog/index.js +1 -1
  91. package/build/models/data/brand/index.js +1 -1
  92. package/build/models/data/category/index.js +1 -1
  93. package/build/models/data/checkout/index.js +1 -1
  94. package/build/models/data/checkout-settings/index.d.ts +1 -1
  95. package/build/models/data/checkout-settings/index.js +1 -1
  96. package/build/models/data/customer/address/index.d.ts +4 -1
  97. package/build/models/data/customer/address/index.js +1 -1
  98. package/build/models/data/image/index.js +1 -1
  99. package/build/models/data/index.d.ts +1 -0
  100. package/build/models/data/language/index.d.ts +6 -0
  101. package/build/models/data/order/address/index.d.ts +2 -1
  102. package/build/models/data/order/address/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/components/index.js +1 -1
  146. package/build/scripts/generators/config/content.d.ts +2 -3
  147. package/build/scripts/generators/config/content.js +1 -1
  148. package/build/scripts/generators/config/index.js +1 -1
  149. package/build/scripts/generators/index.d.ts +1 -0
  150. package/build/scripts/generators/pages/index.js +1 -1
  151. package/build/scripts/generators/store/index.js +1 -1
  152. package/build/scripts/generators/theme/index.js +1 -1
  153. package/build/scripts/generators/types/index.d.ts +15 -0
  154. package/build/scripts/generators/types/index.js +1 -0
  155. package/build/store/cart.d.ts +6 -7
  156. package/build/store/cart.js +1 -1
  157. package/build/store/customer.d.ts +19 -0
  158. package/build/store/customer.js +1 -1
  159. package/build/storefront/index.d.ts +5 -3
  160. package/build/storefront/index.js +1 -1
  161. package/build/utils/fs.js +1 -1
  162. package/build/utils/google-fonts.d.ts +2 -0
  163. package/build/utils/google-fonts.js +1 -0
  164. package/package.json +9 -9
  165. package/build/models/theme/settings/prop/color/index.d.ts +0 -7
  166. package/build/models/theme/settings/prop/color/index.js +0 -1
@@ -0,0 +1,14 @@
1
+ export declare class IkasThemeColor {
2
+ id: string;
3
+ displayName: string;
4
+ key: string;
5
+ color: string;
6
+ translations: {
7
+ [locale: string]: ColorTranslation;
8
+ };
9
+ constructor(data: Partial<IkasThemeColor>);
10
+ }
11
+ export declare class ColorTranslation {
12
+ displayName: string | null;
13
+ constructor(data?: Partial<ColorTranslation>);
14
+ }
@@ -0,0 +1 @@
1
+ import{makeAutoObservable as s}from"mobx";import i from'../../../../ext/uuid/dist/esm-browser/v4.js';var t=function(t){this.translations={},this.id=t.id||i(),this.displayName=t.displayName||"",this.key=t.key||"",this.color=t.color||"",this.translations=t.translations||{},s(this)};export{t as IkasThemeColor};
@@ -0,0 +1,5 @@
1
+ export declare class IkasThemeFontFamily {
2
+ name: string | null;
3
+ variants: string[] | null;
4
+ constructor(data?: Partial<IkasThemeFontFamily>);
5
+ }
@@ -0,0 +1 @@
1
+ import{makeAutoObservable as i}from"mobx";var n=function(n){void 0===n&&(n={}),this.name=n.name||null,this.variants=n.variants||null,i(this)};export{n as IkasThemeFontFamily};
@@ -1,9 +1,11 @@
1
- import { IkasThemeColor } from "./prop/color";
2
- import { IkasThemeFavicon } from "./prop/favicon";
1
+ import { IkasThemeColor } from "./color";
2
+ import { IkasThemeFavicon } from "./favicon";
3
+ import { IkasThemeFontFamily } from "./font-family";
3
4
  export declare class IkasThemeSettings {
4
5
  colors: IkasThemeColor[];
5
6
  favicon: IkasThemeFavicon;
6
7
  stockPreference: IkasThemeStockPreference;
8
+ fontFamily: IkasThemeFontFamily;
7
9
  constructor(data?: Partial<IkasThemeSettings>);
8
10
  }
9
11
  export declare enum IkasThemeStockPreference {
@@ -1 +1 @@
1
- import{makeAutoObservable as o}from"mobx";import{IkasThemeColor as r}from"./prop/color/index.js";import{IkasThemeFavicon as i}from"./prop/favicon/index.js";var _,n=function(n){var O;void 0===n&&(n={}),this.colors=n.colors?n.colors.map((function(o){return new r(o)})):[],this.favicon=(null===(O=n.favicon)||void 0===O?void 0:O.id)?n.favicon:new i,this.stockPreference=n.stockPreference||_.SHOW_ALL,o(this)};!function(o){o.HIDE_OUT_OF_STOCK="HIDE_OUT_OF_STOCK",o.SHOW_ALL="SHOW_ALL",o.SHOW_OUT_OF_STOCK_AT_END="SHOW_OUT_OF_STOCK_AT_END"}(_||(_={}));export{n as IkasThemeSettings,_ as IkasThemeStockPreference};
1
+ import{makeAutoObservable as o}from"mobx";import{IkasThemeColor as i}from"./color/index.js";import{IkasThemeFavicon as n}from"./favicon/index.js";import{IkasThemeFontFamily as r}from"./font-family/index.js";var t,_=function(_){var f;void 0===_&&(_={}),this.colors=_.colors?_.colors.map((function(o){return new i(o)})):[],this.favicon=(null===(f=_.favicon)||void 0===f?void 0:f.id)?_.favicon:new n,this.stockPreference=_.stockPreference||t.SHOW_ALL,this.fontFamily=_.fontFamily?new r(_.fontFamily):new r,o(this)};!function(o){o.HIDE_OUT_OF_STOCK="HIDE_OUT_OF_STOCK",o.SHOW_ALL="SHOW_ALL",o.SHOW_OUT_OF_STOCK_AT_END="SHOW_OUT_OF_STOCK_AT_END"}(t||(t={}));export{_ as IkasThemeSettings,t as IkasThemeStockPreference};
@@ -1 +1 @@
1
- import{__spreadArrays as t,__awaiter as e,__generator as r}from'../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as i}from"mobx";import"../../data/blog/index.js";import"../../data/brand/index.js";import"../../data/category/index.js";import"../../data/checkout/index.js";import"../../data/customer/address/index.js";import"../../data/customer/index.js";import"../../data/customer-review/index.js";import"../../data/html-meta-data/index.js";import"../../data/image/index.js";import"../../data/installment-info/index.js";import"../../data/order/index.js";import"../../data/order/line-item/index.js";import{IkasProduct as n}from"../../data/product/index.js";import"../../data/variant-type/index.js";import"../../data/product/variant/index.js";import"../../data/product/variant/price/index.js";import"../../data/product-attribute/index.js";import"../../data/product/attribute-value/index.js";import"../../data/product-filter/index.js";import{IkasVariantValue as a}from"../../data/variant-type/variant-value/index.js";import"../../data/order-transaction/index.js";import"../../data/product-option-set/index.js";import"../../data/raffle/index.js";import"../../theme/theme.js";import"../../theme/page/index.js";import"../../theme/component/prop/index.js";import"../../theme/page/component/prop-value/link.js";import"../brand-list/index.js";import"../blog-list/index.js";import"../blog-category-list/index.js";import"../category-list/index.js";import"../product-list/index.js";import"../product-attribute-detail/index.js";import"../product-attribute-list/index.js";import{IkasCustomerReviewList as o}from"../customer-review-list/index.js";import"../validator/index.js";import"../validator/rules/index.js";import"../validator/form/login.js";import"../validator/form/address.js";import"../validator/form/register.js";import"../validator/form/contact-form.js";import"../validator/form/forgot-password.js";import"../validator/form/recover-password.js";import"../validator/form/account-info.js";import"../validator/form/raffle-form.js";import"../validator/form/customer-review.js";import"../raffle-list/index.js";import"../../theme/settings/index.js";import"../../theme/custom-data/index.js";import{Analytics as s}from"../../../analytics/analytics.js";import"react";import{IkasStorefrontConfig as u}from"../../../storefront/index.js";import'../../../ext/html-react-parser/index.js';import"../../../analytics/events.js";var d=function(){function d(t,e,r){this.router=null,this.product=new n(t),this.selectedVariantValues=e.map((function(t){return new a(t)})),this.router=r,i(this)}return Object.defineProperty(d.prototype,"mainVariantValue",{get:function(){return this.selectedVariantValues.length?this.selectedVariantValues[0]:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"selectedVariant",{get:function(){if(!this.product.hasVariant)return this.product.variants[0];var t=this.selectedVariantValues.map((function(t){return t.id}));return this.product.variants.find((function(e){return e.variantValues.every((function(e){return t.includes(e.id)}))}))},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"href",{get:function(){var t=this,e=this.product.metaData;if(!(null==e?void 0:e.slug))return"";var r=this.product.variantTypes.map((function(e){var r=e.variantType,i=r.values.find((function(e){return t.selectedVariantValues.some((function(t){return t.id===e.id}))}));if(i)return r.slug+"="+i.slug})).filter((function(t){return!!t})).join("&");return r?"/"+e.slug+"?"+r:"/"+e.slug},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"hasStock",{get:function(){return this.product.hasStock},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"displayedVariantTypes",{get:function(){var e=this,r=this.product.variantTypes.map((function(r,i){var n=r.variantType,a=[],o=i>0?e.product.variantTypes.slice(0,i):null,s=[];return o&&(s=e.selectedVariantValues.filter((function(t){return o.some((function(e){return e.variantType.id===t.variantTypeId}))}))),n.values.forEach((function(r){var i=t(s,[r]),n=e.product.variants.find((function(t){return t.isActive&&i.every((function(e){return t.variantValues.some((function(t){return t.id===e.id}))}))})),o=e.selectedVariant.variantValues.some((function(t){return t.id===r.id}));n&&a.push({variant:n,variantValue:r,hasStock:n.hasStock,isSelected:o})})),{variantType:n,displayedVariantValues:a}}));return 1===r.length&&(r[0].displayedVariantValues=r[0].displayedVariantValues.filter((function(t){return t.variant.isActive}))),r},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"isCustomerReviewEnabled",{get:function(){return!!u.customerReviewSettings&&!u.customerReviewSettings.customerPurchaseRequired},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"isCustomerReviewLoginRequired",{get:function(){return!u.customerReviewSettings||u.customerReviewSettings.customerLoginRequired},enumerable:!1,configurable:!0}),d.prototype.getCustomerReviews=function(){return e(this,void 0,void 0,(function(){var t;return r(this,(function(e){switch(e.label){case 0:return[4,(t=new o({productId:this.product.id})).getInitial()];case 1:return e.sent(),[2,t]}}))}))},d.prototype.selectVariantValue=function(e){var r,i=this,n=this.product.metaData,a=this.selectedVariantValues.map((function(t){return t.variantTypeId===e.variantTypeId?e:t})),o=this.product.variants.find((function(t){return t.isActive&&a.every((function(e){return t.variantValues.some((function(t){return t.id===e.id}))}))}));if(o)this.selectedVariantValues=a;else{var u=this.product.variantTypes.findIndex((function(t){return t.variantType.id===e.variantTypeId}));if(u>0){var d=this.product.variantTypes.slice(0,u),c=this.selectedVariantValues.filter((function(t){return d.some((function(e){return e.variantType.id===t.variantTypeId}))})),p=t(c,[e]);o=this.product.variants.find((function(t){return t.isActive&&p.every((function(e){return t.variantValues.some((function(t){return t.id===e.id}))}))}))}else{var l=a.slice(0,a.length-1);(o=this.product.variants.find((function(t){return t.isActive&&l.every((function(e){return t.variantValues.some((function(t){return t.id===e.id}))}))})))||(o=this.product.variants.find((function(t){return t.isActive&&t.variantValues.some((function(t){return t.id===e.id}))})))}if(!o)return;this.selectedVariantValues=o.variantValues}var m=this.product.variantTypes.map((function(t){var e=t.variantType,r=e.values.find((function(t){return i.selectedVariantValues.some((function(e){return e.id===t.id}))}));if(r)return e.slug+"="+r.slug})).filter((function(t){return!!t})).join("&"),f="/"+n.slug;if(m&&(f="/"+n.slug+"?"+m),f!==window.location.pathname){var v="production"!==process.env.NODE_ENV;null===(r=this.router)||void 0===r||r.replace(f,void 0,{shallow:v,scroll:!1}),s.productView(this)}},d}();export{d as IkasProductDetail};
1
+ import{__spreadArray as t,__awaiter as e,__generator as r}from'../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as i}from"mobx";import"../../data/blog/index.js";import"../../data/brand/index.js";import"../../data/category/index.js";import"../../data/checkout/index.js";import"../../data/customer/address/index.js";import"../../data/customer/index.js";import"../../data/customer-review/index.js";import"../../data/html-meta-data/index.js";import"../../data/image/index.js";import"../../data/installment-info/index.js";import"../../data/order/index.js";import"../../data/order/line-item/index.js";import{IkasProduct as n}from"../../data/product/index.js";import"../../data/variant-type/index.js";import"../../data/product/variant/index.js";import"../../data/product/variant/price/index.js";import"../../data/product-attribute/index.js";import"../../data/product/attribute-value/index.js";import"../../data/product-filter/index.js";import{IkasVariantValue as a}from"../../data/variant-type/variant-value/index.js";import"../../data/order-transaction/index.js";import"../../data/product-option-set/index.js";import"../../data/raffle/index.js";import"../../theme/theme.js";import"../../theme/page/index.js";import"../../theme/component/prop/index.js";import"../../theme/page/component/prop-value/link.js";import"../brand-list/index.js";import"../blog-list/index.js";import"../blog-category-list/index.js";import"../category-list/index.js";import"../product-list/index.js";import"../product-attribute-detail/index.js";import"../product-attribute-list/index.js";import{IkasCustomerReviewList as o}from"../customer-review-list/index.js";import"../validator/index.js";import"../validator/rules/index.js";import"../validator/form/login.js";import"../validator/form/address.js";import"../validator/form/register.js";import"../validator/form/contact-form.js";import"../validator/form/forgot-password.js";import"../validator/form/recover-password.js";import"../validator/form/account-info.js";import"../validator/form/raffle-form.js";import"../validator/form/customer-review.js";import"../raffle-list/index.js";import"../../theme/settings/index.js";import"../../theme/custom-data/index.js";import{Analytics as s}from"../../../analytics/analytics.js";import"../../../analytics/head/index.js";import{IkasStorefrontConfig as u}from"../../../storefront/index.js";var d=function(){function d(t,e,r){this.router=null,this.product=new n(t),this.selectedVariantValues=e.map((function(t){return new a(t)})),this.router=r,i(this)}return Object.defineProperty(d.prototype,"mainVariantValue",{get:function(){return this.selectedVariantValues.length?this.selectedVariantValues[0]:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"selectedVariant",{get:function(){if(!this.product.hasVariant)return this.product.variants[0];var t=this.selectedVariantValues.map((function(t){return t.id}));return this.product.variants.find((function(e){return e.variantValues.every((function(e){return t.includes(e.id)}))}))},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"href",{get:function(){var t=this,e=this.product.metaData;if(!(null==e?void 0:e.slug))return"";var r=this.product.variantTypes.map((function(e){var r=e.variantType,i=r.values.find((function(e){return t.selectedVariantValues.some((function(t){return t.id===e.id}))}));if(i)return"".concat(r.slug,"=").concat(i.slug)})).filter((function(t){return!!t})).join("&");return r?"/".concat(e.slug,"?").concat(r):"/".concat(e.slug)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"hasStock",{get:function(){return this.product.hasStock},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"displayedVariantTypes",{get:function(){var e=this,r=this.product.variantTypes.map((function(r,i){var n=r.variantType,a=[],o=i>0?e.product.variantTypes.slice(0,i):null,s=[];return o&&(s=e.selectedVariantValues.filter((function(t){return o.some((function(e){return e.variantType.id===t.variantTypeId}))}))),n.values.forEach((function(r){var i=t(t([],s,!0),[r],!1),n=e.product.variants.find((function(t){return t.isActive&&i.every((function(e){return t.variantValues.some((function(t){return t.id===e.id}))}))})),o=e.product.variants.find((function(t){return t.isActive&&t.hasStock&&i.every((function(e){return t.variantValues.some((function(t){return t.id===e.id}))}))})),u=e.selectedVariant.variantValues.some((function(t){return t.id===r.id}));n&&a.push({variant:n,variantValue:r,hasStock:!!o,isSelected:u})})),{variantType:n,displayedVariantValues:a}}));return 1===r.length&&(r[0].displayedVariantValues=r[0].displayedVariantValues.filter((function(t){return t.variant.isActive}))),r},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"isCustomerReviewEnabled",{get:function(){return!!u.customerReviewSettings&&!u.customerReviewSettings.customerPurchaseRequired},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"isCustomerReviewLoginRequired",{get:function(){return!u.customerReviewSettings||u.customerReviewSettings.customerLoginRequired},enumerable:!1,configurable:!0}),d.prototype.getCustomerReviews=function(){return e(this,void 0,void 0,(function(){var t;return r(this,(function(e){switch(e.label){case 0:return[4,(t=new o({productId:this.product.id})).getInitial()];case 1:return e.sent(),[2,t]}}))}))},d.prototype.selectVariantValue=function(e){var r,i=this,n=this.product.metaData,a=this.selectedVariantValues.map((function(t){return t.variantTypeId===e.variantTypeId?e:t})),o=this.product.variants.find((function(t){return t.isActive&&a.every((function(e){return t.variantValues.some((function(t){return t.id===e.id}))}))}));if(o)this.selectedVariantValues=a;else{var u=this.product.variantTypes.findIndex((function(t){return t.variantType.id===e.variantTypeId}));if(u>0){var d=this.product.variantTypes.slice(0,u),c=this.selectedVariantValues.filter((function(t){return d.some((function(e){return e.variantType.id===t.variantTypeId}))})),p=t(t([],c,!0),[e],!1);o=this.product.variants.find((function(t){return t.isActive&&p.every((function(e){return t.variantValues.some((function(t){return t.id===e.id}))}))}))}else{var l=a.slice(0,a.length-1);(o=this.product.variants.find((function(t){return t.isActive&&l.every((function(e){return t.variantValues.some((function(t){return t.id===e.id}))}))})))||(o=this.product.variants.find((function(t){return t.isActive&&t.variantValues.some((function(t){return t.id===e.id}))})))}if(!o)return;this.selectedVariantValues=o.variantValues}var m=this.product.variantTypes.map((function(t){var e=t.variantType,r=e.values.find((function(t){return i.selectedVariantValues.some((function(e){return e.id===t.id}))}));if(r)return"".concat(e.slug,"=").concat(r.slug)})).filter((function(t){return!!t})).join("&"),f="/".concat(n.slug);if(m&&(f="/".concat(n.slug,"?").concat(m)),f!==window.location.pathname){var v="production"!==process.env.NODE_ENV;null===(r=this.router)||void 0===r||r.replace(f,void 0,{shallow:v,scroll:!1}),s.productView(this)}},d}();export{d as IkasProductDetail};
@@ -82,7 +82,7 @@ export declare class IkasProductList {
82
82
  filters: IkasProductFilter[] | null | undefined;
83
83
  recommendFor: string | null | undefined;
84
84
  productListPropValue: IkasProductListPropValue;
85
- pageSpecificData: IkasBrand | IkasCategory | null | undefined;
85
+ pageSpecificData: IkasCategory | IkasBrand | null | undefined;
86
86
  };
87
87
  setVisibleInfiniteScrollPage: (page: number) => void;
88
88
  private restoreInfiniteScrollPage;
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as e}from'../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as i}from"mobx";import"../../theme/theme.js";import{IkasThemePageType as r}from"../../theme/page/index.js";import"../../theme/component/prop/index.js";import"../../theme/page/component/prop-value/link.js";import"../brand-list/index.js";import"../blog-list/index.js";import"../blog-category-list/index.js";import"../category-list/index.js";import{IkasProductDetail as s}from"../product-detail/index.js";import"../product-attribute-detail/index.js";import"../product-attribute-list/index.js";import"../customer-review-list/index.js";import"../validator/index.js";import"../validator/rules/index.js";import"../validator/form/login.js";import"../validator/form/address.js";import"../validator/form/register.js";import"../validator/form/contact-form.js";import"../validator/form/forgot-password.js";import"../validator/form/recover-password.js";import"../validator/form/account-info.js";import"../validator/form/raffle-form.js";import"../validator/form/customer-review.js";import"../raffle-list/index.js";import"../../theme/settings/index.js";import"../../theme/custom-data/index.js";import"../../../api/blog/index.js";import"../../../api/brand/index.js";import"../../../api/cart/index.js";import"../../../api/category/index.js";import"../../../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{IkasProductSearchAPI as n}from"../../../api/product-search/index.js";import"../../data/blog/index.js";import"../../data/brand/index.js";import{ModelOrder as o,IkasFilterCategory as a}from"../../data/category/index.js";import"../../data/checkout/index.js";import"../../data/customer/address/index.js";import"../../data/customer/index.js";import"../../data/customer-review/index.js";import"../../data/html-meta-data/index.js";import"../../data/image/index.js";import"../../data/installment-info/index.js";import"../../data/order/index.js";import"../../data/order/line-item/index.js";import"../../data/product/index.js";import"../../data/variant-type/index.js";import"../../data/product/variant/index.js";import"../../data/product/variant/price/index.js";import"../../data/product-attribute/index.js";import"../../data/product/attribute-value/index.js";import{IkasProductFilter as u,IkasProductFilterValue as l}from"../../data/product-filter/index.js";import"../../data/variant-type/variant-value/index.js";import"../../data/order-transaction/index.js";import"../../data/product-option-set/index.js";import"../../data/raffle/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 c from'../../../ext/query-string/index.js';import d from'../../../ext/lodash/debounce.js';import{Analytics as p}from"../../../analytics/analytics.js";import"react";import{IkasStorefrontConfig as h}from"../../../storefront/index.js";import'../../../ext/html-react-parser/index.js';import"../../../analytics/events.js";import{SortByDirectionEnum as f,SortByTypeEnum as m}from"../../../__generated__/global-types.js";var g,_,y=function(){function y(n,o){var l=this;if(this.filters=null,this._filterCategories=null,this._infiniteScrollPage=null,this._initialized=!1,this._minPage=null,this._filterBrandId=null,this._filterCategoryId=null,this.pageSpecificData=null,this._recommendFor=null,this._isLoading=!1,this._fetchRequestTime=0,this.router=null,this.applyFilters=function(){return t(l,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return[4,this.getInitial()];case 1:return t=e.sent(),[r.CATEGORY,r.BRAND,r.SEARCH].includes(this._pageType)?(t&&this.isBrowser()&&!this.isSearch&&(null===(i=this.router)||void 0===i||i.replace(location.pathname+(this.filterQueryParams?"?"+this.filterQueryParams:""),void 0,{shallow:!0})),[2]):[2]}}))}))},this.getInitial=function(i,r){return t(l,void 0,void 0,(function(){var t,n,o,a,u,l,c,d,p;return e(this,(function(e){switch(e.label){case 0:this._isLoading=!0,t=Date.now(),this._fetchRequestTime=t,e.label=1;case 1:return e.trys.push([1,12,13,14]),n=r?this._page:1,o=this._limit,!this.isFilterable||this.filters?[3,3]:[4,this.getFilters()];case 2:e.sent(),e.label=3;case 3:return this.applyQueryParamFilters(i),this.isSearch&&!this.hasAppliedfilter?(this.data=[],this._page=1,this._minPage=1,this._count=0,this._initialized=!0,[2,!0]):(a=void 0,this.isStatic?(n=void 0,o=void 0,[3,10]):[3,4]);case 4:return this.isDiscounted?(n=1,o=10,[3,10]):[3,5];case 5:return this.isRecommended?(n=1,o=10,[3,10]):[3,6];case 6:return this.isLastViewed?this.isBrowser()?[4,this.waitForCustomerStoreInit()]:[3,9]:[3,10];case 7:return e.sent(),[4,h.store.customerStore.getLastViewedProducts()];case 8:return(u=e.sent())&&u.length&&(a=u.map((function(t){return t.productId}))),[3,10];case 9:return[2];case 10:return[4,this.searchProducts(n||1,o||10,a)];case 11:return(l=e.sent())&&this._fetchRequestTime===t?(c=[],this.isStatic||this.isLastViewed?(d=this.isStatic?this._productListPropValue.productIds:h.store.customerStore._lastViewedProducts,c=(null==d?void 0:d.map((function(t){var e=l.data.find((function(e){return e.id===t.productId})),i=null==e?void 0:e.variants.find((function(e){return e.id===t.variantId}));if(e&&i)return new s(e,i.variantValues)})).filter((function(t){return!!t})))||[]):c=l.data.map((function(t){var e=t.variants.find((function(t){return t.isActive}));return new s(t,(e||t.variants[0]).variantValues)})),this.applyFacets(l.facets),this.data=c,this._count=l.count,this._initialized=!0,this._page=n||1,this._minPage=this.page,r||(this._infiniteScrollPage=null),this.handleListingEvent(),[2,!0]):[2];case 12:return p=e.sent(),console.log(p),[3,14];case 13:return t===this._fetchRequestTime&&(this._isLoading=!1),[7];case 14:return[2]}}))}))},this.getPrev=function(){return t(l,void 0,void 0,(function(){var t,i,r,n;return e(this,(function(e){switch(e.label){case 0:if(this.isStatic||this.isDiscounted||this.isRecommended||this.isLastViewed||this._isLoading||!this.hasPrev)return[2];this._isLoading=!0,e.label=1;case 1:return e.trys.push([1,3,4,5]),t=this._minPage-1,[4,this.searchProducts(t,this.limit)];case 2:return(i=e.sent())?(r=i.data.map((function(t){var e=t.variants.find((function(t){return t.isActive}));return new s(t,(e||t.variants[0]).variantValues)})),this.data=r.concat(this.data),this._count=i.count,this._minPage=t,[3,5]):[2];case 3:return n=e.sent(),console.log(n),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getNext=function(){return t(l,void 0,void 0,(function(){var t,i,r;return e(this,(function(e){switch(e.label){case 0:if(this.isStatic||this.isDiscounted||this.isRecommended||this.isLastViewed||this._isLoading||!this.hasNext)return[2];this._isLoading=!0,e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,this.searchProducts(this.page+1,this.limit)];case 2:return(t=e.sent())?(i=t.data.map((function(t){var e=t.variants.find((function(t){return t.isActive}));return new s(t,(e||t.variants[0]).variantValues)})),this.data=this.data.concat(i),this._count=t.count,this._page=this.page+1,[3,5]):[2];case 3:return r=e.sent(),console.log(r),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getPage=function(i){return t(l,void 0,void 0,(function(){var t,r,n;return e(this,(function(e){switch(e.label){case 0:if(this._isLoading||this.isStatic||this.isDiscounted||this.isRecommended||this.isLastViewed)return[2];this._isLoading=!0,e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,this.searchProducts(i,this.limit)];case 2:return(t=e.sent())?(r=t.data.map((function(t){var e=t.variants.find((function(t){return t.isActive}));return new s(t,(e||t.variants[0]).variantValues)})),this.data=r,this._count=t.count,this._page=i,this._minPage=i,[3,5]):[2];case 3:return n=e.sent(),console.log(n),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.setVisibleInfiniteScrollPage=function(t){var e;l._infiniteScrollPage!==t&&(l._infiniteScrollPage=t,null===(e=l.router)||void 0===e||e.replace(location.pathname+(l.filterQueryParams?"?"+l.filterQueryParams:""),void 0,{shallow:!0}))},this.searchDebouncer=d((function(){l.applyFilters()}),100),this.searchAnalyticsDebouncer=d((function(){p.search(l._searchKeyword)}),1e3),this.data=n.data?n.data.map((function(t){return new s(t.product,t.selectedVariantValues)})):[],this._type=n.type||n.productListPropValue.productListType||g.ALL,this._pageType=n.pageType,this._sort=n.sort||n.productListPropValue.initialSort||_.LAST_ADDED,"A_Z"!==this.initialSort&&"Z_A"!==this.initialSort||(this._sort=_.LAST_ADDED),this._pageType===r.SEARCH&&(this._sort=_.FEATURED),this._limit=n.limit||n.productListPropValue.initialLimit||20,this._page=n.page||1,this._minPage=n.minPage||null,this._count=n.count||0,this._searchKeyword=n.searchKeyword||"",this._productListPropValue=n.productListPropValue,this._filterBrandId=n.filterBrandId||null,this._filterCategoryId=n.filterCategoryId||null,this._recommendFor=n.recommendFor,this.filters=n.filters?n.filters.map((function(t){return new u(t,l)})):null,this._filterCategories=n.filterCategories?n.filterCategories.map((function(t){return new a(t)})):null,this.pageSpecificData=n.pageSpecificData||null,this.router=o,i(this),this.setPageSpecificSort(),this.isBrowser())if(this.restoreInfiniteScrollPage(),location.search&&(this.isFilterable||this._type===g.SEARCH)){var c=this.getQueryParams();this.getInitial(c,this._page>1)}else this._page>1?this.getInitial(void 0,!0):this.isLastViewed?this.getInitial():this.handleListingEvent()}return Object.defineProperty(y.prototype,"sort",{get:function(){return this._sort},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"limit",{get:function(){return this._limit},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"pageType",{get:function(){return this._pageType},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"page",{get:function(){return this._page},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"minPage",{get:function(){return this._minPage||1},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"pageCount",{get:function(){return Math.ceil(this._count/this._limit)},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"searchKeyword",{get:function(){return this._searchKeyword},set:function(t){t!==this._searchKeyword&&(this._searchKeyword=t,this.searchDebouncer(),this.searchAnalyticsDebouncer())},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isInitialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isFilterable",{get:function(){return this._type===g.ALL||this._type===g.CATEGORY},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isFiltered",{get:function(){var t,e;return(null===(t=this.filters)||void 0===t?void 0:t.some((function(t){return!!t.valueList.length})))||!!this._searchKeyword||this._pageType!==r.CATEGORY&&(!!this._filterCategoryId||(null===(e=this._filterCategories)||void 0===e?void 0:e.some((function(t){return t.isSelected}))))},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isStatic",{get:function(){return this._type===g.STATIC},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isDiscounted",{get:function(){return this._type===g.DISCOUNTED},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isRecommended",{get:function(){return this._type===g.RECOMMENDED},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isLastViewed",{get:function(){return this._type===g.LAST_VIEWED},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isSearch",{get:function(){return this._type===g.SEARCH},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"hasPrev",{get:function(){return!(this.isStatic||this.isDiscounted||this.isRecommended||!this._minPage)&&this._minPage>1},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"hasNext",{get:function(){return!(this.isStatic||this.isDiscounted||this.isRecommended)&&this.page*this.limit<this.count},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"filterQueryParams",{get:function(){var t,e,i,s,n=this,o={};if(null===(t=this.filters)||void 0===t||t.forEach((function(t){t.keyList.length&&(o[t.key]=t.keyList)})),this._searchKeyword&&(o.s=this._searchKeyword),this._infiniteScrollPage&&(o.page=this._infiniteScrollPage),this._pageType!==r.CATEGORY){var a=null===(e=this.filterCategories)||void 0===e?void 0:e.filter((function(t){return t.isSelected}));if(!!(null==a?void 0:a.length))o.c=null==a?void 0:a.map((function(t){return t.slug}));else if(this._filterCategoryId){var u=null===(s=null===(i=this.filterCategories)||void 0===i?void 0:i.find((function(t){return t.id===n._filterCategoryId})))||void 0===s?void 0:s.slug;u&&(o.c=u)}}return c.stringify(o,{arrayFormat:"comma"})},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"filterCategories",{get:function(){var t;return null===(t=this._filterCategories)||void 0===t?void 0:t.filter((function(t){return 0!==t.resultCount}))},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"hasAppliedfilter",{get:function(){var t;return!!this._searchKeyword||(null===(t=this.filters)||void 0===t?void 0:t.some((function(t){return!!t.valueList.length})))},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isFeaturedSortEnabled",{get:function(){var t;return(null===(t=this.pageSpecificData)||void 0===t?void 0:t.orderType)===o.MANUALLY&&[g.ALL,g.CATEGORY].includes(this._type)},enumerable:!1,configurable:!0}),y.prototype.setPageSpecificSort=function(){var t;if((null===(t=this.pageSpecificData)||void 0===t?void 0:t.orderType)&&[g.ALL,g.CATEGORY].includes(this._type))switch(this.pageSpecificData.orderType){case o.HIGHEST_DISCOUNT_RATIO:this._sort=_.DECRASING_DISCOUNT;break;case o.LOWEST_DISCOUNT_RATIO:this._sort=_.INCREASING_DISCOUNT;break;case o.HIGHEST_PRICE:this._sort=_.DECREASING_PRICE;break;case o.LOWEST_PRICE:this._sort=_.INCREASING_PRICE;break;case o.NEWEST:this._sort=_.LAST_ADDED;break;case o.OLDEST:this._sort=_.FIRST_ADDED;break;case o.MANUALLY:this._sort=_.FEATURED}},y.prototype.getSortParams=function(){var t=f.DESC,e=m.CREATED_AT;switch(this._sort){case _.INCREASING_PRICE:t=f.ASC,e=m.PRICE;break;case _.DECREASING_PRICE:t=f.DESC,e=m.PRICE;break;case _.FIRST_ADDED:t=f.ASC,e=m.CREATED_AT;break;case _.LAST_ADDED:t=f.DESC,e=m.CREATED_AT;break;case _.INCREASING_DISCOUNT:t=f.ASC,e=m.DISCOUNT_RATIO;break;case _.DECRASING_DISCOUNT:t=f.DESC,e=m.DISCOUNT_RATIO;break;case _.FEATURED:if(this.isSearch)return;t=f.ASC,e=m.MANUAL_SORT}return{direction:t,type:e}},y.prototype.searchProducts=function(i,s,o){var a,u,c;return t(this,void 0,void 0,(function(){var t,d,p,f;return e(this,(function(e){switch(e.label){case 0:return t=[],d=[],null===(a=this.filters)||void 0===a||a.forEach((function(e){e.valueList.length&&t.push(new l({id:e.id,type:e.type,displayType:e.displayType,valueList:e.valueList})),e.isFacetFilter&&d.push({id:e.id,type:e.type,displayType:e.displayType})})),p=null===(u=this._filterCategories)||void 0===u?void 0:u.filter((function(t){return t.isSelected})).map((function(t){return t.id})),f=this.getSortParams(),[4,n.searchProducts({page:i,perPage:s,productIdList:this.isStatic?null===(c=this._productListPropValue.productIds)||void 0===c?void 0:c.map((function(t){return t.productId})):o,filterList:t,facetList:d,brandId:this._pageType===r.BRAND&&this._type!==g.SEARCH?this._filterBrandId:void 0,categoryIdList:p&&p.length?p:this._filterCategoryId?[this._filterCategoryId]:void 0,priceListId:h.priceListId,salesChannelId:h.salesChannelId,query:this._searchKeyword,order:this._type===g.SEARCH?null:f?[f]:null},!0)];case 1:return[2,e.sent()]}}))}))},y.prototype.getFilters=function(){var i;return t(this,void 0,void 0,(function(){var t,s,o=this;return e(this,(function(e){switch(e.label){case 0:return[4,n.getProductFilterData(this._filterCategoryId?this._filterCategoryId:void 0)];case 1:return t=e.sent(),this.filters=null==t?void 0:t.filters.map((function(t){return new u(t,o)})),this._filterCategories=null==t?void 0:t.categories,this.pageType!==r.CATEGORY&&this._filterCategoryId&&(s=null===(i=this._filterCategories)||void 0===i?void 0:i.find((function(t){return t.id===o._filterCategoryId})))&&(s._isSelected=!0),this.filters&&this.filters.sort((function(t,e){return t.order>e.order?1:-1})),[2]}}))}))},y.prototype.applyQueryParamFilters=function(t){var e,i=this;try{null==t||t.forEach((function(t,e){var r,s=null===(r=i.filters)||void 0===r?void 0:r.find((function(t){return t.key===e}));s&&s.applyQueryParam(t)}));var s=null==t?void 0:t.get("s");if(s&&(this._searchKeyword=s),this._pageType!==r.CATEGORY){var n=null==t?void 0:t.get("c"),o=null==n?void 0:n.split(",");o&&o.length&&(null===(e=this.filterCategories)||void 0===e||e.forEach((function(t){t._isSelected=o.some((function(e){return e===t.slug}))})))}}catch(t){console.log(t)}},y.prototype.applyFacets=function(t){var e,i;null===(e=this.filters)||void 0===e||e.forEach((function(e){var i,r,s,n=null==t?void 0:t.find((function(t){return t.id===e.id}));n?null===(i=e.values)||void 0===i||i.forEach((function(t){var i=n.values.find((function(e){return e.id===t.id}));i?t.resultCount=i.count:e.isCustomValueFilter?t.resultCount=null:t.resultCount=0})):e.isCustomValueFilter?null===(r=e.values)||void 0===r||r.forEach((function(t){return t.resultCount=null})):null===(s=e.values)||void 0===s||s.forEach((function(t){return t.resultCount=0}))}));var r=null==t?void 0:t.find((function(t){return"category"===t.id}));r&&(null===(i=this._filterCategories)||void 0===i||i.forEach((function(t){var e=r.values.find((function(e){return e.id===t.id}));t.resultCount=e?e.count:0})))},y.prototype.clearFilters=function(){var t,e;null===(t=this.filters)||void 0===t||t.forEach((function(t){return t.clear()})),this._searchKeyword="",this._pageType!==r.CATEGORY&&(this._filterCategoryId=void 0),null===(e=this._filterCategories)||void 0===e||e.forEach((function(t){return t._isSelected=!1})),this.applyFilters()},y.prototype.setSortType=function(i){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return this._sort=i,[4,this.getInitial()];case 1:return t.sent(),[2]}}))}))},y.prototype.onFilterCategoryClick=function(i,r){var s,n;return void 0===r&&(r=!1),t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return r?(null===(s=this._filterCategories)||void 0===s||s.forEach((function(t){t.id===i.id&&(t._isSelected=!t.isSelected)})),[4,this.applyFilters()]):[3,2];case 1:return t.sent(),[3,3];case 2:null===(n=this.router)||void 0===n||n.push(i.href+(this.filterQueryParams?"?"+this.filterQueryParams:"")),t.label=3;case 3:return[2]}}))}))},y.prototype.toJSON=function(){return{data:this.data,type:this._type,pageType:this._pageType,sort:this._sort,limit:this._limit,page:this._page,count:this._count,searchKeyword:this._searchKeyword,initialized:this._initialized,minPage:this._minPage,filterBrandId:this._filterBrandId,filterCategoryId:this._filterCategoryId,filterCategories:this._filterCategories,filters:this.filters,recommendFor:this._recommendFor,productListPropValue:this._productListPropValue,pageSpecificData:this.pageSpecificData}},y.prototype.restoreInfiniteScrollPage=function(){var t=this.getQueryParams(),e=null==t?void 0:t.get("page");if(e){var i=parseInt(e);isNaN(i)||(this._page=i,this._infiniteScrollPage=i)}},y.prototype.getQueryParams=function(){if(this.isBrowser())return new URLSearchParams(location.search)},y.prototype.isBrowser=function(){return"undefined"!=typeof window},y.prototype.waitForCustomerStoreInit=function(){return new Promise((function(t){var e=setInterval((function(){h.store.customerStore.initialized&&(clearInterval(e),t(null))}),1e3)}))},y.prototype.handleListingEvent=function(){this.searchKeyword&&this.data.length?p.viewSearchResults(this._searchKeyword,this.data):this.data.length&&this._type===g.ALL&&p.viewListing(this.data)},y}();!function(t){t.ALL="ALL",t.STATIC="STATIC",t.DISCOUNTED="DISCOUNTED",t.RECOMMENDED="RECOMMENDED",t.CATEGORY="CATEGORY",t.SEARCH="SEARCH",t.LAST_VIEWED="LAST_VIEWED"}(g||(g={})),function(t){t.INCREASING_PRICE="INCREASING_PRICE",t.DECREASING_PRICE="DECREASING_PRICE",t.LAST_ADDED="LAST_ADDED",t.FIRST_ADDED="FIRST_ADDED",t.INCREASING_DISCOUNT="INCREASING_DISCOUNT",t.DECRASING_DISCOUNT="DECRASING_DISCOUNT",t.FEATURED="FEATURED"}(_||(_={}));export{y as IkasProductList,_ as IkasProductListSortType,g as IkasProductListType};
1
+ import{__awaiter as t,__generator as e}from'../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as i}from"mobx";import"../../theme/theme.js";import{IkasThemePageType as r}from"../../theme/page/index.js";import"../../theme/component/prop/index.js";import"../../theme/page/component/prop-value/link.js";import"../brand-list/index.js";import"../blog-list/index.js";import"../blog-category-list/index.js";import"../category-list/index.js";import{IkasProductDetail as s}from"../product-detail/index.js";import"../product-attribute-detail/index.js";import"../product-attribute-list/index.js";import"../customer-review-list/index.js";import"../validator/index.js";import"../validator/rules/index.js";import"../validator/form/login.js";import"../validator/form/address.js";import"../validator/form/register.js";import"../validator/form/contact-form.js";import"../validator/form/forgot-password.js";import"../validator/form/recover-password.js";import"../validator/form/account-info.js";import"../validator/form/raffle-form.js";import"../validator/form/customer-review.js";import"../raffle-list/index.js";import"../../theme/settings/index.js";import"../../theme/custom-data/index.js";import"../../../api/blog/index.js";import"../../../api/brand/index.js";import"../../../api/cart/index.js";import"../../../api/category/index.js";import"../../../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{IkasProductSearchAPI as n}from"../../../api/product-search/index.js";import"../../data/blog/index.js";import"../../data/brand/index.js";import{ModelOrder as o,IkasFilterCategory as a}from"../../data/category/index.js";import"../../data/checkout/index.js";import"../../data/customer/address/index.js";import"../../data/customer/index.js";import"../../data/customer-review/index.js";import"../../data/html-meta-data/index.js";import"../../data/image/index.js";import"../../data/installment-info/index.js";import"../../data/order/index.js";import"../../data/order/line-item/index.js";import"../../data/product/index.js";import"../../data/variant-type/index.js";import"../../data/product/variant/index.js";import"../../data/product/variant/price/index.js";import"../../data/product-attribute/index.js";import"../../data/product/attribute-value/index.js";import{IkasProductFilter as u,IkasProductFilterValue as c}from"../../data/product-filter/index.js";import"../../data/variant-type/variant-value/index.js";import"../../data/order-transaction/index.js";import"../../data/product-option-set/index.js";import"../../data/raffle/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 l from'../../../ext/query-string/index.js';import d from'../../../ext/lodash/debounce.js';import{Analytics as p}from"../../../analytics/analytics.js";import"../../../analytics/head/index.js";import{IkasStorefrontConfig as h}from"../../../storefront/index.js";import{SortByDirectionEnum as f,SortByTypeEnum as m}from"../../../__generated__/global-types.js";var g,_,y=function(){function y(n,o){var c=this;if(this.filters=null,this._filterCategories=null,this._infiniteScrollPage=null,this._initialized=!1,this._minPage=null,this._filterBrandId=null,this._filterCategoryId=null,this.pageSpecificData=null,this._recommendFor=null,this._isLoading=!1,this._fetchRequestTime=0,this.router=null,this.applyFilters=function(){return t(c,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return[4,this.getInitial()];case 1:return t=e.sent(),[r.CATEGORY,r.BRAND,r.SEARCH].includes(this._pageType)?(t&&this.isBrowser()&&!this.isSearch&&(null===(i=this.router)||void 0===i||i.replace("".concat(location.pathname).concat(this.filterQueryParams?"?"+this.filterQueryParams:""),void 0,{shallow:!0})),[2]):[2]}}))}))},this.getInitial=function(i,r){return t(c,void 0,void 0,(function(){var t,n,o,a,u,c,l,d,p;return e(this,(function(e){switch(e.label){case 0:this._isLoading=!0,t=Date.now(),this._fetchRequestTime=t,e.label=1;case 1:return e.trys.push([1,12,13,14]),n=r?this._page:1,o=this._limit,!this.isFilterable||this.filters?[3,3]:[4,this.getFilters()];case 2:e.sent(),e.label=3;case 3:return this.applyQueryParamFilters(i),this.isSearch&&!this.hasAppliedfilter?(this.data=[],this._page=1,this._minPage=1,this._count=0,this._initialized=!0,[2,!0]):(a=void 0,this.isStatic?(n=void 0,o=200,[3,10]):[3,4]);case 4:return this.isDiscounted?(n=1,o=10,[3,10]):[3,5];case 5:return this.isRecommended?(n=1,o=10,[3,10]):[3,6];case 6:return this.isLastViewed?this.isBrowser()?[4,this.waitForCustomerStoreInit()]:[3,9]:[3,10];case 7:return e.sent(),[4,h.store.customerStore.getLastViewedProducts()];case 8:return(u=e.sent())&&u.length&&(a=u.map((function(t){return t.productId}))),[3,10];case 9:return[2];case 10:return[4,this.searchProducts(n||1,o||10,a)];case 11:return(c=e.sent())&&this._fetchRequestTime===t?(l=[],this.isStatic||this.isLastViewed?(d=this.isStatic?this._productListPropValue.productIds:h.store.customerStore._lastViewedProducts,l=(null==d?void 0:d.map((function(t){var e=c.data.find((function(e){return e.id===t.productId})),i=null==e?void 0:e.variants.find((function(e){return e.id===t.variantId}));if((null==i?void 0:i.isActive)||(i=null==e?void 0:e.variants.find((function(t){return t.isActive}))),e&&i)return new s(e,i.variantValues)})).filter((function(t){return!!t})))||[]):l=c.data.map((function(t){var e=t.variants.find((function(t){return t.isActive}));return new s(t,(e||t.variants[0]).variantValues)})),this.applyFacets(c.facets),this.data=l,this._count=c.count,this._initialized=!0,this._page=n||1,this._minPage=this.page,r||(this._infiniteScrollPage=null),this.handleListingEvent(),[2,!0]):[2];case 12:return p=e.sent(),console.log(p),[3,14];case 13:return t===this._fetchRequestTime&&(this._isLoading=!1),[7];case 14:return[2]}}))}))},this.getPrev=function(){return t(c,void 0,void 0,(function(){var t,i,r,n;return e(this,(function(e){switch(e.label){case 0:if(this.isStatic||this.isDiscounted||this.isRecommended||this.isLastViewed||this._isLoading||!this.hasPrev)return[2];this._isLoading=!0,e.label=1;case 1:return e.trys.push([1,3,4,5]),t=this._minPage-1,[4,this.searchProducts(t,this.limit)];case 2:return(i=e.sent())?(r=i.data.map((function(t){var e=t.variants.find((function(t){return t.isActive}));return new s(t,(e||t.variants[0]).variantValues)})),this.data=r.concat(this.data),this._count=i.count,this._minPage=t,[3,5]):[2];case 3:return n=e.sent(),console.log(n),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getNext=function(){return t(c,void 0,void 0,(function(){var t,i,r;return e(this,(function(e){switch(e.label){case 0:if(this.isStatic||this.isDiscounted||this.isRecommended||this.isLastViewed||this._isLoading||!this.hasNext)return[2];this._isLoading=!0,e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,this.searchProducts(this.page+1,this.limit)];case 2:return(t=e.sent())?(i=t.data.map((function(t){var e=t.variants.find((function(t){return t.isActive}));return new s(t,(e||t.variants[0]).variantValues)})),this.data=this.data.concat(i),this._count=t.count,this._page=this.page+1,[3,5]):[2];case 3:return r=e.sent(),console.log(r),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getPage=function(i){return t(c,void 0,void 0,(function(){var t,r,n;return e(this,(function(e){switch(e.label){case 0:if(this._isLoading||this.isStatic||this.isDiscounted||this.isRecommended||this.isLastViewed)return[2];this._isLoading=!0,e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,this.searchProducts(i,this.limit)];case 2:return(t=e.sent())?(r=t.data.map((function(t){var e=t.variants.find((function(t){return t.isActive}));return new s(t,(e||t.variants[0]).variantValues)})),this.data=r,this._count=t.count,this._page=i,this._minPage=i,[3,5]):[2];case 3:return n=e.sent(),console.log(n),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.setVisibleInfiniteScrollPage=function(t){var e;c._infiniteScrollPage!==t&&(c._infiniteScrollPage=t,null===(e=c.router)||void 0===e||e.replace("".concat(location.pathname).concat(c.filterQueryParams?"?"+c.filterQueryParams:""),void 0,{shallow:!0}))},this.searchDebouncer=d((function(){c.applyFilters()}),100),this.searchAnalyticsDebouncer=d((function(){p.search(c._searchKeyword)}),1e3),this.data=n.data?n.data.map((function(t){return new s(t.product,t.selectedVariantValues)})):[],this._type=n.type||n.productListPropValue.productListType||g.ALL,this._pageType=n.pageType,this._sort=n.sort||n.productListPropValue.initialSort||_.LAST_ADDED,"A_Z"!==this.initialSort&&"Z_A"!==this.initialSort||(this._sort=_.LAST_ADDED),this._pageType===r.SEARCH&&(this._sort=_.FEATURED),this._limit=n.limit||n.productListPropValue.initialLimit||20,this._page=n.page||1,this._minPage=n.minPage||null,this._count=n.count||0,this._searchKeyword=n.searchKeyword||"",this._productListPropValue=n.productListPropValue,this._filterBrandId=n.filterBrandId||null,this._filterCategoryId=n.filterCategoryId||null,this._recommendFor=n.recommendFor,this.filters=n.filters?n.filters.map((function(t){return new u(t,c)})):null,this._filterCategories=n.filterCategories?n.filterCategories.map((function(t){return new a(t)})):null,this.pageSpecificData=n.pageSpecificData||null,this.router=o,i(this),this.setPageSpecificSort(),this.isBrowser())if(this.restoreInfiniteScrollPage(),location.search&&(this.isFilterable||this._type===g.SEARCH)){var l=this.getQueryParams();this.getInitial(l,this._page>1)}else this._page>1?this.getInitial(void 0,!0):this.isLastViewed?this.getInitial():this.handleListingEvent()}return Object.defineProperty(y.prototype,"sort",{get:function(){return this._sort},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"limit",{get:function(){return this._limit},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"pageType",{get:function(){return this._pageType},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"page",{get:function(){return this._page},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"minPage",{get:function(){return this._minPage||1},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"pageCount",{get:function(){return Math.ceil(this._count/this._limit)},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"searchKeyword",{get:function(){return this._searchKeyword},set:function(t){t!==this._searchKeyword&&(this._searchKeyword=t,this.searchDebouncer(),this.searchAnalyticsDebouncer())},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isInitialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isFilterable",{get:function(){return this._type===g.ALL||this._type===g.CATEGORY},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isFiltered",{get:function(){var t,e;return(null===(t=this.filters)||void 0===t?void 0:t.some((function(t){return!!t.valueList.length})))||!!this._searchKeyword||this._pageType!==r.CATEGORY&&(!!this._filterCategoryId||(null===(e=this._filterCategories)||void 0===e?void 0:e.some((function(t){return t.isSelected}))))},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isStatic",{get:function(){return this._type===g.STATIC},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isDiscounted",{get:function(){return this._type===g.DISCOUNTED},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isRecommended",{get:function(){return this._type===g.RECOMMENDED},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isLastViewed",{get:function(){return this._type===g.LAST_VIEWED},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isSearch",{get:function(){return this._type===g.SEARCH},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"hasPrev",{get:function(){return!(this.isStatic||this.isDiscounted||this.isRecommended||!this._minPage)&&this._minPage>1},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"hasNext",{get:function(){return!(this.isStatic||this.isDiscounted||this.isRecommended)&&this.page*this.limit<this.count},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"filterQueryParams",{get:function(){var t,e,i,s,n=this,o={};if(null===(t=this.filters)||void 0===t||t.forEach((function(t){t.keyList.length&&(o[t.key]=t.keyList)})),this._searchKeyword&&(o.s=this._searchKeyword),this._infiniteScrollPage&&(o.page=this._infiniteScrollPage),this._pageType!==r.CATEGORY){var a=null===(e=this.filterCategories)||void 0===e?void 0:e.filter((function(t){return t.isSelected}));if(!!(null==a?void 0:a.length))o.c=null==a?void 0:a.map((function(t){return t.slug}));else if(this._filterCategoryId){var u=null===(s=null===(i=this.filterCategories)||void 0===i?void 0:i.find((function(t){return t.id===n._filterCategoryId})))||void 0===s?void 0:s.slug;u&&(o.c=u)}}return l.stringify(o,{arrayFormat:"comma"})},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"filterCategories",{get:function(){var t;return null===(t=this._filterCategories)||void 0===t?void 0:t.filter((function(t){return 0!==t.resultCount}))},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"hasAppliedfilter",{get:function(){var t;return!!this._searchKeyword||(null===(t=this.filters)||void 0===t?void 0:t.some((function(t){return!!t.valueList.length})))},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isFeaturedSortEnabled",{get:function(){var t;return(null===(t=this.pageSpecificData)||void 0===t?void 0:t.orderType)===o.MANUALLY&&[g.ALL,g.CATEGORY].includes(this._type)},enumerable:!1,configurable:!0}),y.prototype.setPageSpecificSort=function(){var t;if((null===(t=this.pageSpecificData)||void 0===t?void 0:t.orderType)&&[g.ALL,g.CATEGORY].includes(this._type))switch(this.pageSpecificData.orderType){case o.HIGHEST_DISCOUNT_RATIO:this._sort=_.DECRASING_DISCOUNT;break;case o.LOWEST_DISCOUNT_RATIO:this._sort=_.INCREASING_DISCOUNT;break;case o.HIGHEST_PRICE:this._sort=_.DECREASING_PRICE;break;case o.LOWEST_PRICE:this._sort=_.INCREASING_PRICE;break;case o.NEWEST:this._sort=_.LAST_ADDED;break;case o.OLDEST:this._sort=_.FIRST_ADDED;break;case o.MANUALLY:this._sort=_.FEATURED}},y.prototype.getSortParams=function(){var t=f.DESC,e=m.CREATED_AT;switch(this._sort){case _.INCREASING_PRICE:t=f.ASC,e=m.PRICE;break;case _.DECREASING_PRICE:t=f.DESC,e=m.PRICE;break;case _.FIRST_ADDED:t=f.ASC,e=m.CREATED_AT;break;case _.LAST_ADDED:t=f.DESC,e=m.CREATED_AT;break;case _.INCREASING_DISCOUNT:t=f.ASC,e=m.DISCOUNT_RATIO;break;case _.DECRASING_DISCOUNT:t=f.DESC,e=m.DISCOUNT_RATIO;break;case _.FEATURED:if(this.isSearch)return;t=f.ASC,e=m.MANUAL_SORT}return{direction:t,type:e}},y.prototype.searchProducts=function(i,s,o){var a,u,l;return t(this,void 0,void 0,(function(){var t,d,p,f;return e(this,(function(e){switch(e.label){case 0:return t=[],d=[],null===(a=this.filters)||void 0===a||a.forEach((function(e){e.valueList.length&&t.push(new c({id:e.id,type:e.type,displayType:e.displayType,valueList:e.valueList})),e.isFacetFilter&&d.push({id:e.id,type:e.type,displayType:e.displayType})})),p=null===(u=this._filterCategories)||void 0===u?void 0:u.filter((function(t){return t.isSelected})).map((function(t){return t.id})),f=this.getSortParams(),[4,n.searchProducts({page:i,perPage:s,productIdList:this.isStatic?null===(l=this._productListPropValue.productIds)||void 0===l?void 0:l.map((function(t){return t.productId})):o,filterList:t,facetList:d,brandId:this._pageType===r.BRAND&&this._type!==g.SEARCH?this._filterBrandId:void 0,categoryIdList:p&&p.length?p:this._filterCategoryId?[this._filterCategoryId]:void 0,priceListId:h.priceListId,salesChannelId:h.salesChannelId,query:this._searchKeyword,order:this._type===g.SEARCH?null:f?[f]:null},!0)];case 1:return[2,e.sent()]}}))}))},y.prototype.getFilters=function(){var i;return t(this,void 0,void 0,(function(){var t,s,o=this;return e(this,(function(e){switch(e.label){case 0:return[4,n.getProductFilterData(this._filterCategoryId?this._filterCategoryId:void 0)];case 1:return t=e.sent(),this.filters=null==t?void 0:t.filters.map((function(t){return new u(t,o)})),this._filterCategories=null==t?void 0:t.categories,this.pageType!==r.CATEGORY&&this._filterCategoryId&&(s=null===(i=this._filterCategories)||void 0===i?void 0:i.find((function(t){return t.id===o._filterCategoryId})))&&(s._isSelected=!0),this.filters&&this.filters.sort((function(t,e){return t.order>e.order?1:-1})),[2]}}))}))},y.prototype.applyQueryParamFilters=function(t){var e,i=this;try{null==t||t.forEach((function(t,e){var r,s=null===(r=i.filters)||void 0===r?void 0:r.find((function(t){return t.key===e}));s&&s.applyQueryParam(t)}));var s=null==t?void 0:t.get("s");if(s&&(this._searchKeyword=s),this._pageType!==r.CATEGORY){var n=null==t?void 0:t.get("c"),o=null==n?void 0:n.split(",");o&&o.length&&(null===(e=this.filterCategories)||void 0===e||e.forEach((function(t){t._isSelected=o.some((function(e){return e===t.slug}))})))}}catch(t){console.log(t)}},y.prototype.applyFacets=function(t){var e,i;null===(e=this.filters)||void 0===e||e.forEach((function(e){var i,r,s,n=null==t?void 0:t.find((function(t){return t.id===e.id}));n?null===(i=e.values)||void 0===i||i.forEach((function(t){var i=n.values.find((function(e){return e.id===t.id}));i?t.resultCount=i.count:e.isCustomValueFilter?t.resultCount=null:t.resultCount=0})):e.isCustomValueFilter?null===(r=e.values)||void 0===r||r.forEach((function(t){return t.resultCount=null})):null===(s=e.values)||void 0===s||s.forEach((function(t){return t.resultCount=0}))}));var r=null==t?void 0:t.find((function(t){return"category"===t.id}));r&&(null===(i=this._filterCategories)||void 0===i||i.forEach((function(t){var e=r.values.find((function(e){return e.id===t.id}));t.resultCount=e?e.count:0})))},y.prototype.clearFilters=function(){var t,e;null===(t=this.filters)||void 0===t||t.forEach((function(t){return t.clear()})),this._searchKeyword="",this._pageType!==r.CATEGORY&&(this._filterCategoryId=void 0),null===(e=this._filterCategories)||void 0===e||e.forEach((function(t){return t._isSelected=!1})),this.applyFilters()},y.prototype.setSortType=function(i){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return this._sort=i,[4,this.getInitial()];case 1:return t.sent(),[2]}}))}))},y.prototype.onFilterCategoryClick=function(i,r){var s,n;return void 0===r&&(r=!1),t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return r?(null===(s=this._filterCategories)||void 0===s||s.forEach((function(t){t.id===i.id&&(t._isSelected=!t.isSelected)})),[4,this.applyFilters()]):[3,2];case 1:return t.sent(),[3,3];case 2:null===(n=this.router)||void 0===n||n.push(i.href+(this.filterQueryParams?"?"+this.filterQueryParams:"")),t.label=3;case 3:return[2]}}))}))},y.prototype.toJSON=function(){return{data:this.data,type:this._type,pageType:this._pageType,sort:this._sort,limit:this._limit,page:this._page,count:this._count,searchKeyword:this._searchKeyword,initialized:this._initialized,minPage:this._minPage,filterBrandId:this._filterBrandId,filterCategoryId:this._filterCategoryId,filterCategories:this._filterCategories,filters:this.filters,recommendFor:this._recommendFor,productListPropValue:this._productListPropValue,pageSpecificData:this.pageSpecificData}},y.prototype.restoreInfiniteScrollPage=function(){var t=this.getQueryParams(),e=null==t?void 0:t.get("page");if(e){var i=parseInt(e);isNaN(i)||(this._page=i,this._infiniteScrollPage=i)}},y.prototype.getQueryParams=function(){if(this.isBrowser())return new URLSearchParams(location.search)},y.prototype.isBrowser=function(){return"undefined"!=typeof window},y.prototype.waitForCustomerStoreInit=function(){return new Promise((function(t){var e=setInterval((function(){h.store.customerStore.initialized&&(clearInterval(e),t(null))}),1e3)}))},y.prototype.handleListingEvent=function(){this.searchKeyword&&this.data.length?p.viewSearchResults(this._searchKeyword,this.data):this.data.length&&this._type===g.ALL&&p.viewListing(this.data)},y}();!function(t){t.ALL="ALL",t.STATIC="STATIC",t.DISCOUNTED="DISCOUNTED",t.RECOMMENDED="RECOMMENDED",t.CATEGORY="CATEGORY",t.SEARCH="SEARCH",t.LAST_VIEWED="LAST_VIEWED"}(g||(g={})),function(t){t.INCREASING_PRICE="INCREASING_PRICE",t.DECREASING_PRICE="DECREASING_PRICE",t.LAST_ADDED="LAST_ADDED",t.FIRST_ADDED="FIRST_ADDED",t.INCREASING_DISCOUNT="INCREASING_DISCOUNT",t.DECRASING_DISCOUNT="DECRASING_DISCOUNT",t.FEATURED="FEATURED"}(_||(_={}));export{y as IkasProductList,_ as IkasProductListSortType,g as IkasProductListType};
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as t,__spreadArrays as r}from'../../../../ext/tslib/tslib.es6.js';import{makeObservable as s,computed as o,action as i}from"mobx";import{Validator as a}from"../index.js";import{PhoneRule as n,RequiredRule as u}from"../rules/index.js";var l=function(){function l(e){var t=this;this.validatorRules=function(e){return void 0===e&&(e=!1),r([new u({model:t.customer,fieldKey:"firstName",valuePath:"firstName",message:t.message.requiredRule}),new u({model:t.customer,fieldKey:"lastName",valuePath:"lastName",message:t.message.requiredRule})],e?[new n({model:t.customer,fieldKey:"phone",valuePath:"phone",message:t.message.phoneRule})]:[])},this.onFirstNameChange=function(e){t.customer.firstName=e},this.onLastNameChange=function(e){t.customer.lastName=e},this.onPhoneChange=function(e){t.customer.phone=e||null,e||t.validator.setRules(t.validatorRules())},s(this,{firstNameErrorMessage:o,lastNameErrorMessage:o,phoneErrorMessage:o,hasError:o,firstName:o,lastName:o,phone:o,validateAll:i,submit:i}),this.customer=e.customer,this.store=e.store,this.message=e.message,this.validator=new a(this.customer,this.validatorRules())}return Object.defineProperty(l.prototype,"hasError",{get:function(){return this.validator.hasError},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"email",{get:function(){return this.customer.email},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"firstName",{get:function(){return this.customer.firstName},set:function(e){this.customer.firstName=e},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"lastName",{get:function(){return this.customer.lastName},set:function(e){this.customer.lastName=e},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"phone",{get:function(){return this.customer.phone||""},set:function(e){this.customer.phone=e},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"firstNameErrorMessage",{get:function(){var e,t;return null===(t=null===(e=this.validator.results)||void 0===e?void 0:e.firstName)||void 0===t?void 0:t.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"lastNameErrorMessage",{get:function(){var e,t;return null===(t=null===(e=this.validator.results)||void 0===e?void 0:e.lastName)||void 0===t?void 0:t.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"phoneErrorMessage",{get:function(){var e,t;return null===(t=null===(e=this.validator.results)||void 0===e?void 0:e.phone)||void 0===t?void 0:t.errorMessage},enumerable:!1,configurable:!0}),l.prototype.validateAll=function(){return this.validator.validateAll()},l.prototype.submit=function(){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return e={isFormError:!1,isSuccess:!1},this.phone&&this.validator.setRules(this.validatorRules(!0)),[4,this.validateAll()];case 1:if(t.sent())return e.isFormError=!0,[2,e];t.label=2;case 2:return t.trys.push([2,4,,5]),[4,this.store.customerStore.saveCustomer(this.customer)];case 3:return t.sent()&&(e.isSuccess=!0),[2,e];case 4:return t.sent(),[2,e];case 5:return[2]}}))}))},l}();export{l as AccountInfoForm};
1
+ import{__awaiter as e,__generator as t,__spreadArray as r}from'../../../../ext/tslib/tslib.es6.js';import{makeObservable as s,computed as o,action as i}from"mobx";import{Validator as a}from"../index.js";import{PhoneRule as n,RequiredRule as u}from"../rules/index.js";var l=function(){function l(e){var t=this;this.validatorRules=function(e){return void 0===e&&(e=!1),r([new u({model:t.customer,fieldKey:"firstName",valuePath:"firstName",message:t.message.requiredRule}),new u({model:t.customer,fieldKey:"lastName",valuePath:"lastName",message:t.message.requiredRule})],e?[new n({model:t.customer,fieldKey:"phone",valuePath:"phone",message:t.message.phoneRule})]:[],!0)},this.onFirstNameChange=function(e){t.customer.firstName=e},this.onLastNameChange=function(e){t.customer.lastName=e},this.onPhoneChange=function(e){t.customer.phone=e||null,e||t.validator.setRules(t.validatorRules())},s(this,{firstNameErrorMessage:o,lastNameErrorMessage:o,phoneErrorMessage:o,hasError:o,firstName:o,lastName:o,phone:o,validateAll:i,submit:i}),this.customer=e.customer,this.store=e.store,this.message=e.message,this.validator=new a(this.customer,this.validatorRules())}return Object.defineProperty(l.prototype,"hasError",{get:function(){return this.validator.hasError},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"email",{get:function(){return this.customer.email},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"firstName",{get:function(){return this.customer.firstName},set:function(e){this.customer.firstName=e},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"lastName",{get:function(){return this.customer.lastName},set:function(e){this.customer.lastName=e},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"phone",{get:function(){return this.customer.phone||""},set:function(e){this.customer.phone=e},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"firstNameErrorMessage",{get:function(){var e,t;return null===(t=null===(e=this.validator.results)||void 0===e?void 0:e.firstName)||void 0===t?void 0:t.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"lastNameErrorMessage",{get:function(){var e,t;return null===(t=null===(e=this.validator.results)||void 0===e?void 0:e.lastName)||void 0===t?void 0:t.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"phoneErrorMessage",{get:function(){var e,t;return null===(t=null===(e=this.validator.results)||void 0===e?void 0:e.phone)||void 0===t?void 0:t.errorMessage},enumerable:!1,configurable:!0}),l.prototype.validateAll=function(){return this.validator.validateAll()},l.prototype.submit=function(){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return e={isFormError:!1,isSuccess:!1},this.phone&&this.validator.setRules(this.validatorRules(!0)),[4,this.validateAll()];case 1:if(t.sent())return e.isFormError=!0,[2,e];t.label=2;case 2:return t.trys.push([2,4,,5]),[4,this.store.customerStore.saveCustomer(this.customer)];case 3:return t.sent()&&(e.isSuccess=!0),[2,e];case 4:return t.sent(),[2,e];case 5:return[2]}}))}))},l}();export{l as AccountInfoForm};
@@ -1 +1 @@
1
- import{__spreadArrays as t,__awaiter as e,__generator as i}from'../../../../ext/tslib/tslib.es6.js';import{makeObservable as s,computed as r,observable as n,action as d}from"mobx";import o from'../../../../ext/lodash/cloneDeep.js';import"../../../../api/blog/index.js";import"../../../../api/brand/index.js";import"../../../../api/cart/index.js";import"../../../../api/category/index.js";import"../../../../api/checkout/index.js";import{IkasCityAPI as a}from"../../../../api/city/index.js";import{IkasCountryAPI as u}from"../../../../api/country/index.js";import"../../../../api/customer/index.js";import"../../../../api/customer-review/index.js";import{IkasDistrictAPI as c}from"../../../../api/district/index.js";import"../../../../api/html-meta-data/index.js";import"../../../../api/merchant/index.js";import"../../../../api/product-search/index.js";import"../../../data/blog/index.js";import"../../../data/brand/index.js";import"../../../data/category/index.js";import"../../../data/checkout/index.js";import"../../../data/customer/address/index.js";import"../../../data/customer/index.js";import"../../../data/customer-review/index.js";import"../../../data/html-meta-data/index.js";import"../../../data/image/index.js";import"../../../data/installment-info/index.js";import"../../../data/order/index.js";import"../../../data/order/line-item/index.js";import"../../../data/product/index.js";import"../../../data/variant-type/index.js";import"../../../data/product/variant/index.js";import"../../../data/product/variant/price/index.js";import"../../../data/product-attribute/index.js";import"../../../data/product/attribute-value/index.js";import"../../../data/product-filter/index.js";import"../../../data/variant-type/variant-value/index.js";import"../../../data/order-transaction/index.js";import"../../../data/product-option-set/index.js";import"../../../data/raffle/index.js";import"../../../theme/theme.js";import"../../../theme/page/index.js";import"../../../theme/component/prop/index.js";import"../../../theme/page/component/prop-value/link.js";import"../../brand-list/index.js";import"../../blog-list/index.js";import"../../blog-category-list/index.js";import"../../category-list/index.js";import"../../product-detail/index.js";import"../../product-list/index.js";import"../../product-attribute-detail/index.js";import"../../product-attribute-list/index.js";import"../../customer-review-list/index.js";import{Validator as l}from"../index.js";import{PhoneRule as m,RequiredRule as p}from"../rules/index.js";import"./login.js";import"./register.js";import"./contact-form.js";import"./forgot-password.js";import"./recover-password.js";import"./account-info.js";import"./raffle-form.js";import"./customer-review.js";import"../../raffle-list/index.js";import"../../../theme/settings/index.js";import"../../../theme/custom-data/index.js";import"../../../../api/apollo.js";import"../../../../api/favorite-product/index.js";import"../../../../api/contact-form/index.js";import{IkasStateAPI as h}from"../../../../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{IkasStorefrontConfig as f}from"../../../../storefront/index.js";var g=function(t){return t.sort((function(t,e){return t.label.localeCompare(e.label)}))},v=function(t){return{label:t.name,value:t.id+""}},j=function(){function j(g){var v=this;this.countries=[],this.states=[],this.cities=[],this.districts=[],this._isCountriesPending=!0,this._isStatesPending=!1,this._isCitiesPending=!1,this._isDistrictsPending=!1,this.validatorRules=function(e){return void 0===e&&(e=!1),t([new p({model:v.address,fieldKey:"firstName",valuePath:"firstName",message:v.message.requiredRule}),new p({model:v.address,fieldKey:"lastName",valuePath:"lastName",message:v.message.requiredRule}),new p({model:v.address,fieldKey:"addressLine1",valuePath:"addressLine1",message:v.message.requiredRule}),new p({model:v.address,fieldKey:"country",valuePath:"country",message:v.message.requiredRule}),new p({model:v.address,fieldKey:"state",valuePath:"state",message:v.message.requiredRule}),new p({model:v.address,fieldKey:"city",valuePath:"city",message:v.message.requiredRule}),new p({model:v.address,fieldKey:"title",valuePath:"title",message:v.message.requiredRule})],e?[new m({model:v.address,fieldKey:"phone",valuePath:"phone",message:v.message.phoneRule})]:[])},this.onTitleChange=function(t){v.address.title=t},this.onFirstNameChange=function(t){v.address.firstName=t},this.onLastNameChange=function(t){v.address.lastName=t},this.onPhoneChange=function(t){v.address.phone=t,t||v.validator.setRules(v.validatorRules())},this.onAddressLine1Change=function(t){v.address.addressLine1=t},this.onAddressLine2Change=function(t){v.address.addressLine2=t},this.onAddressPostalCodeChange=function(t){v.address.postalCode=t},this.onCountryChange=function(t){var e;if((null===(e=v.address.country)||void 0===e?void 0:e.id)!==t){var i=v.countries.find((function(e){return e.id===t}));v.address.country={id:null==i?void 0:i.id,name:null==i?void 0:i.name,code:null==i?void 0:i.iso3},v.address.state=void 0,v.address.city=void 0,v.address.district=void 0,v.states=[],v.cities=[],v.districts=[],v.listStates()}},this.onStateChange=function(t){var e;if((null===(e=v.address.state)||void 0===e?void 0:e.id)!==t){var i=v.states.find((function(e){return e.id===t}));v.address.state={id:i.id,name:null==i?void 0:i.name,code:null==i?void 0:i.stateCode},v.address.city=void 0,v.address.district=void 0,v.cities=[],v.districts=[],v.listCities()}},this.onCityChange=function(t){var e;if((null===(e=v.address.city)||void 0===e?void 0:e.id)!==t){var i=v.cities.find((function(e){return e.id===t}));v.address.city={id:i.id,name:i.name},v.address.district=void 0,v.districts=[],v.listDistricts()}},this.onDistrictChange=function(t){var e;if((null===(e=v.address.district)||void 0===e?void 0:e.id)!==t){var i=v.districts.find((function(e){return e.id===t}));v.address.district={id:i.id,name:i.name}}},this.onDistrictInputChange=function(t){v.address.district={id:void 0,name:t}},this.listCountries=function(){return e(v,void 0,void 0,(function(){var t,e,s;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,3,4]),this._isCountriesPending=!0,[4,u.listCountries()];case 1:return t=i.sent(),e=f.routings.find((function(t){return t.id===f.storefrontRoutingId})),(null===(s=null==e?void 0:e.countryCodes)||void 0===s?void 0:s.length)&&(t=t.filter((function(t){var i;return t.iso2&&(null===(i=e.countryCodes)||void 0===i?void 0:i.includes(t.iso2))}))),this.countries=t,1!==this.countries.length||this.address.country||this.onCountryChange(this.countries[0].id),this.countries=t,[3,4];case 2:return i.sent(),[3,4];case 3:return this._isCountriesPending=!1,[7];case 4:return[2]}}))}))},this.listStates=function(){return e(v,void 0,void 0,(function(){var t,e;return i(this,(function(i){switch(i.label){case 0:if(!(null===(e=this.address.country)||void 0===e?void 0:e.id))return[2];i.label=1;case 1:return i.trys.push([1,3,4,5]),this._isStatesPending=!0,[4,h.listStates(this.address.country.id)];case 2:return t=i.sent(),this.states=t,this.hasState||this.onStateChange(this.states[0].id),[3,5];case 3:return i.sent(),[3,5];case 4:return this._isStatesPending=!1,[7];case 5:return[2]}}))}))},this.listCities=function(){return e(v,void 0,void 0,(function(){var t,e,s;return i(this,(function(i){switch(i.label){case 0:if(!(null===(e=this.address.state)||void 0===e?void 0:e.id))return[2];i.label=1;case 1:return i.trys.push([1,3,4,5]),this._isCitiesPending=!0,[4,a.listCities(this.address.state.id,null===(s=this.address.country)||void 0===s?void 0:s.id)];case 2:return t=i.sent(),this.cities=t,[3,5];case 3:return i.sent(),[3,5];case 4:return this._isCitiesPending=!1,[7];case 5:return[2]}}))}))},this.listDistricts=function(){return e(v,void 0,void 0,(function(){var t,e,s;return i(this,(function(i){switch(i.label){case 0:if(!(null===(e=this.address.city)||void 0===e?void 0:e.id))return[2];i.label=1;case 1:return i.trys.push([1,3,4,5]),this._isDistrictsPending=!0,[4,c.listDistricts(this.address.city.id,null===(s=this.address.state)||void 0===s?void 0:s.id)];case 2:return t=i.sent(),this.districts=t,[3,5];case 3:return i.sent(),[3,5];case 4:return this._isDistrictsPending=!1,[7];case 5:return[2]}}))}))},this.validateAll=function(){return v.validator.validateAll()},this.submit=function(){return e(v,void 0,void 0,(function(){var t,e;return i(this,(function(i){switch(i.label){case 0:return t={isFormError:!1,isSuccess:!1},this.address.phone&&this.validator.setRules(this.validatorRules(!0)),[4,this.validateAll()];case 1:if(i.sent())return t.isFormError=!0,[2,t];if(!this.store.customerStore.customer||!this.address)return[2,t];e=o(this.store.customerStore.customer),this.isEdit?e.addresses[this.editingAddressIndex]=this.address:e.addresses.push(this.address),i.label=2;case 2:return i.trys.push([2,4,,5]),[4,this.store.customerStore.saveCustomer(e)];case 3:return i.sent()&&(t.isSuccess=!0),[2,t];case 4:return i.sent(),[2,t];case 5:return[2]}}))}))},s(this,{hasValidatorError:r,isEdit:r,results:r,editingAddressIndex:r,countries:n,states:n,cities:n,districts:n,_isCountriesPending:n,_isStatesPending:n,_isCitiesPending:n,_isDistrictsPending:n,isCountriesPending:r,isStatesPending:r,isCitiesPending:r,isDistrictsPending:r,onCountryChange:d,validateAll:d,submit:d}),this.address=g.address,this.message=g.message,this.store=g.store,this.validator=new l(this.address,this.validatorRules()),this.listCountries(),this.address.state&&this.listStates(),this.address.country&&this.listCities(),this.address.city&&this.listDistricts()}return Object.defineProperty(j.prototype,"isEdit",{get:function(){return-1!==this.editingAddressIndex},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"editingAddressIndex",{get:function(){var t,e,i=this;return null!==(e=null===(t=this.store.customerStore.customer)||void 0===t?void 0:t.addresses.findIndex((function(t){return t.id===i.address.id})))&&void 0!==e?e:-1},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"countryOptions",{get:function(){var t=this.countries.map(v);return g(t)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"stateOptions",{get:function(){var t=this.states.map(v);return g(t)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"cityOptions",{get:function(){var t=this.cities.map(v);return g(t)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"districtOptions",{get:function(){var t=this.districts.map(v);return g(t)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"hasState",{get:function(){return this.states.length>1},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isCountriesPending",{get:function(){return this._isCountriesPending},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isStatesPending",{get:function(){return this.isCountriesPending||this._isStatesPending},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isCitiesPending",{get:function(){return this.isStatesPending||this._isCitiesPending},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isDistrictsPending",{get:function(){return this.isCitiesPending||this._isDistrictsPending},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"hasValidatorError",{get:function(){return this.validator.hasError},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"results",{get:function(){return this.validator.results},enumerable:!1,configurable:!0}),j}();export{j as AddressForm};
1
+ import{__spreadArray as t,__awaiter as e,__generator as i}from'../../../../ext/tslib/tslib.es6.js';import{makeObservable as s,computed as r,observable as n,action as d}from"mobx";import o from'../../../../ext/lodash/cloneDeep.js';import"../../../../api/blog/index.js";import"../../../../api/brand/index.js";import"../../../../api/cart/index.js";import"../../../../api/category/index.js";import"../../../../api/checkout/index.js";import{IkasCityAPI as a}from"../../../../api/city/index.js";import{IkasCountryAPI as u}from"../../../../api/country/index.js";import"../../../../api/customer/index.js";import"../../../../api/customer-review/index.js";import{IkasDistrictAPI as c}from"../../../../api/district/index.js";import"../../../../api/html-meta-data/index.js";import"../../../../api/merchant/index.js";import"../../../../api/product-search/index.js";import"../../../data/blog/index.js";import"../../../data/brand/index.js";import"../../../data/category/index.js";import"../../../data/checkout/index.js";import"../../../data/customer/address/index.js";import"../../../data/customer/index.js";import"../../../data/customer-review/index.js";import"../../../data/html-meta-data/index.js";import"../../../data/image/index.js";import"../../../data/installment-info/index.js";import"../../../data/order/index.js";import"../../../data/order/line-item/index.js";import"../../../data/product/index.js";import"../../../data/variant-type/index.js";import"../../../data/product/variant/index.js";import"../../../data/product/variant/price/index.js";import"../../../data/product-attribute/index.js";import"../../../data/product/attribute-value/index.js";import"../../../data/product-filter/index.js";import"../../../data/variant-type/variant-value/index.js";import"../../../data/order-transaction/index.js";import"../../../data/product-option-set/index.js";import"../../../data/raffle/index.js";import"../../../theme/theme.js";import"../../../theme/page/index.js";import"../../../theme/component/prop/index.js";import"../../../theme/page/component/prop-value/link.js";import"../../brand-list/index.js";import"../../blog-list/index.js";import"../../blog-category-list/index.js";import"../../category-list/index.js";import"../../product-detail/index.js";import"../../product-list/index.js";import"../../product-attribute-detail/index.js";import"../../product-attribute-list/index.js";import"../../customer-review-list/index.js";import{Validator as l}from"../index.js";import{PhoneRule as m,RequiredRule as p}from"../rules/index.js";import"./login.js";import"./register.js";import"./contact-form.js";import"./forgot-password.js";import"./recover-password.js";import"./account-info.js";import"./raffle-form.js";import"./customer-review.js";import"../../raffle-list/index.js";import"../../../theme/settings/index.js";import"../../../theme/custom-data/index.js";import"../../../../api/apollo.js";import"../../../../api/favorite-product/index.js";import"../../../../api/contact-form/index.js";import{IkasStateAPI as h}from"../../../../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{IkasStorefrontConfig as f}from"../../../../storefront/index.js";var g=function(t){return t.sort((function(t,e){return t.label.localeCompare(e.label)}))},v=function(t){return{label:t.name,value:t.id+""}},j=function(){function j(g){var v=this;this.countries=[],this.states=[],this.cities=[],this.districts=[],this._isCountriesPending=!0,this._isStatesPending=!1,this._isCitiesPending=!1,this._isDistrictsPending=!1,this.validatorRules=function(e){return void 0===e&&(e=!1),t([new p({model:v.address,fieldKey:"firstName",valuePath:"firstName",message:v.message.requiredRule}),new p({model:v.address,fieldKey:"lastName",valuePath:"lastName",message:v.message.requiredRule}),new p({model:v.address,fieldKey:"addressLine1",valuePath:"addressLine1",message:v.message.requiredRule}),new p({model:v.address,fieldKey:"country",valuePath:"country",message:v.message.requiredRule}),new p({model:v.address,fieldKey:"state",valuePath:"state",message:v.message.requiredRule}),new p({model:v.address,fieldKey:"city",valuePath:"city",message:v.message.requiredRule}),new p({model:v.address,fieldKey:"title",valuePath:"title",message:v.message.requiredRule})],e?[new m({model:v.address,fieldKey:"phone",valuePath:"phone",message:v.message.phoneRule})]:[],!0)},this.onTitleChange=function(t){v.address.title=t},this.onFirstNameChange=function(t){v.address.firstName=t},this.onLastNameChange=function(t){v.address.lastName=t},this.onPhoneChange=function(t){v.address.phone=t,t||v.validator.setRules(v.validatorRules())},this.onAddressLine1Change=function(t){v.address.addressLine1=t},this.onAddressLine2Change=function(t){v.address.addressLine2=t},this.onAddressPostalCodeChange=function(t){v.address.postalCode=t},this.onCountryChange=function(t){var e;if((null===(e=v.address.country)||void 0===e?void 0:e.id)!==t){var i=v.countries.find((function(e){return e.id===t}));v.address.country={id:null==i?void 0:i.id,name:null==i?void 0:i.name,code:null==i?void 0:i.iso3},v.address.state=void 0,v.address.city=void 0,v.address.district=void 0,v.states=[],v.cities=[],v.districts=[],v.listStates()}},this.onStateChange=function(t){var e;if((null===(e=v.address.state)||void 0===e?void 0:e.id)!==t){var i=v.states.find((function(e){return e.id===t}));v.address.state={id:i.id,name:null==i?void 0:i.name,code:null==i?void 0:i.stateCode},v.address.city=void 0,v.address.district=void 0,v.cities=[],v.districts=[],v.listCities()}},this.onCityChange=function(t){var e;if((null===(e=v.address.city)||void 0===e?void 0:e.id)!==t){var i=v.cities.find((function(e){return e.id===t}));v.address.city={id:i.id,name:i.name},v.address.district=void 0,v.districts=[],v.listDistricts()}},this.onDistrictChange=function(t){var e;if((null===(e=v.address.district)||void 0===e?void 0:e.id)!==t){var i=v.districts.find((function(e){return e.id===t}));v.address.district={id:i.id,name:i.name}}},this.onDistrictInputChange=function(t){v.address.district={id:void 0,name:t}},this.listCountries=function(){return e(v,void 0,void 0,(function(){var t,e,s;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,3,4]),this._isCountriesPending=!0,[4,u.listCountries()];case 1:return t=i.sent(),e=f.routings.find((function(t){return t.id===f.storefrontRoutingId})),(null===(s=null==e?void 0:e.countryCodes)||void 0===s?void 0:s.length)&&(t=t.filter((function(t){var i;return t.iso2&&(null===(i=e.countryCodes)||void 0===i?void 0:i.includes(t.iso2))}))),this.countries=t,1!==this.countries.length||this.address.country||this.onCountryChange(this.countries[0].id),this.countries=t,[3,4];case 2:return i.sent(),[3,4];case 3:return this._isCountriesPending=!1,[7];case 4:return[2]}}))}))},this.listStates=function(){return e(v,void 0,void 0,(function(){var t,e;return i(this,(function(i){switch(i.label){case 0:if(!(null===(e=this.address.country)||void 0===e?void 0:e.id))return[2];i.label=1;case 1:return i.trys.push([1,3,4,5]),this._isStatesPending=!0,[4,h.listStates(this.address.country.id)];case 2:return t=i.sent(),this.states=t,this.hasState||this.onStateChange(this.states[0].id),[3,5];case 3:return i.sent(),[3,5];case 4:return this._isStatesPending=!1,[7];case 5:return[2]}}))}))},this.listCities=function(){return e(v,void 0,void 0,(function(){var t,e,s;return i(this,(function(i){switch(i.label){case 0:if(!(null===(e=this.address.state)||void 0===e?void 0:e.id))return[2];i.label=1;case 1:return i.trys.push([1,3,4,5]),this._isCitiesPending=!0,[4,a.listCities(this.address.state.id,null===(s=this.address.country)||void 0===s?void 0:s.id)];case 2:return t=i.sent(),this.cities=t,[3,5];case 3:return i.sent(),[3,5];case 4:return this._isCitiesPending=!1,[7];case 5:return[2]}}))}))},this.listDistricts=function(){return e(v,void 0,void 0,(function(){var t,e,s;return i(this,(function(i){switch(i.label){case 0:if(!(null===(e=this.address.city)||void 0===e?void 0:e.id))return[2];i.label=1;case 1:return i.trys.push([1,3,4,5]),this._isDistrictsPending=!0,[4,c.listDistricts(this.address.city.id,null===(s=this.address.state)||void 0===s?void 0:s.id)];case 2:return t=i.sent(),this.districts=t,[3,5];case 3:return i.sent(),[3,5];case 4:return this._isDistrictsPending=!1,[7];case 5:return[2]}}))}))},this.validateAll=function(){return v.validator.validateAll()},this.submit=function(){return e(v,void 0,void 0,(function(){var t,e;return i(this,(function(i){switch(i.label){case 0:return t={isFormError:!1,isSuccess:!1},this.address.phone&&this.validator.setRules(this.validatorRules(!0)),[4,this.validateAll()];case 1:if(i.sent())return t.isFormError=!0,[2,t];if(!this.store.customerStore.customer||!this.address)return[2,t];e=o(this.store.customerStore.customer),this.isEdit?e.addresses[this.editingAddressIndex]=this.address:e.addresses.push(this.address),i.label=2;case 2:return i.trys.push([2,4,,5]),[4,this.store.customerStore.saveCustomer(e)];case 3:return i.sent()&&(t.isSuccess=!0),[2,t];case 4:return i.sent(),[2,t];case 5:return[2]}}))}))},s(this,{hasValidatorError:r,isEdit:r,results:r,editingAddressIndex:r,countries:n,states:n,cities:n,districts:n,_isCountriesPending:n,_isStatesPending:n,_isCitiesPending:n,_isDistrictsPending:n,isCountriesPending:r,isStatesPending:r,isCitiesPending:r,isDistrictsPending:r,onCountryChange:d,validateAll:d,submit:d}),this.address=g.address,this.message=g.message,this.store=g.store,this.validator=new l(this.address,this.validatorRules()),this.listCountries(),this.address.state&&this.listStates(),this.address.country&&this.listCities(),this.address.city&&this.listDistricts()}return Object.defineProperty(j.prototype,"isEdit",{get:function(){return-1!==this.editingAddressIndex},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"editingAddressIndex",{get:function(){var t,e,i=this;return null!==(e=null===(t=this.store.customerStore.customer)||void 0===t?void 0:t.addresses.findIndex((function(t){return t.id===i.address.id})))&&void 0!==e?e:-1},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"countryOptions",{get:function(){var t=this.countries.map(v);return g(t)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"stateOptions",{get:function(){var t=this.states.map(v);return g(t)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"cityOptions",{get:function(){var t=this.cities.map(v);return g(t)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"districtOptions",{get:function(){var t=this.districts.map(v);return g(t)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"hasState",{get:function(){return this.states.length>1},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isCountriesPending",{get:function(){return this._isCountriesPending},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isStatesPending",{get:function(){return this.isCountriesPending||this._isStatesPending},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isCitiesPending",{get:function(){return this.isStatesPending||this._isCitiesPending},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isDistrictsPending",{get:function(){return this.isCitiesPending||this._isDistrictsPending},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"hasValidatorError",{get:function(){return this.validator.hasError},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"results",{get:function(){return this.validator.results},enumerable:!1,configurable:!0}),j}();export{j as AddressForm};
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as r}from'../../../../ext/tslib/tslib.es6.js';import{makeObservable as t,computed as s,observable as i,action as a}from"mobx";import{Validator as o}from"../index.js";import{RequiredRule as n,EmailRule as l,MinRule as m}from"../rules/index.js";import{Analytics as u}from"../../../../analytics/analytics.js";import"react";import"../../../../storefront/index.js";import'../../../../ext/html-react-parser/index.js';import"../../../../analytics/events.js";var d=function(){function d(e){var r=this;this.model={firstName:"",lastName:"",email:"",password:"",isMarketingAccepted:!1},this.onFirstNameChange=function(e){r.firstName=e},this.onLastNameChange=function(e){r.lastName=e},this.onEmailChange=function(e){r.email=e},this.onPasswordChange=function(e){r.password=e},t(this,{emailErrorMessage:s,passwordErrorMessage:s,firstNameErrorMessage:s,lastNameErrorMessage:s,hasError:s,redirect:s,model:i,validateAll:a,register:a}),this.store=e.store,this.validator=new o(this.model,[new n({fieldKey:"firstName",valuePath:"firstName",message:e.message.requiredRule}),new n({fieldKey:"lastName",valuePath:"lastName",message:e.message.requiredRule}),new n({fieldKey:"email",valuePath:"email",message:e.message.requiredRule}),new n({fieldKey:"password",valuePath:"password",message:e.message.requiredRule}),new l({fieldKey:"email",valuePath:"email",message:e.message.emailRule}),new m({fieldKey:"password",valuePath:"password",minValue:6,message:e.message.minRule})])}return Object.defineProperty(d.prototype,"firstName",{get:function(){return this.model.firstName},set:function(e){this.model.firstName=e},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"lastName",{get:function(){return this.model.lastName},set:function(e){this.model.lastName=e},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"email",{get:function(){return this.model.email},set:function(e){this.model.email=e},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"password",{get:function(){return this.model.password},set:function(e){this.model.password=e},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"isMarketingAccepted",{get:function(){return this.model.isMarketingAccepted},set:function(e){this.model.isMarketingAccepted=e},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"hasError",{get:function(){return this.validator.hasError},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"firstNameErrorMessage",{get:function(){return this.validator.results.firstName.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"lastNameErrorMessage",{get:function(){return this.validator.results.lastName.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"emailErrorMessage",{get:function(){return this.validator.results.email.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"passwordErrorMessage",{get:function(){return this.validator.results.password.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"redirect",{get:function(){if("undefined"!=typeof window)return new URLSearchParams(window.location.search).get("redirect")},enumerable:!1,configurable:!0}),d.prototype.validateAll=function(){return this.validator.validateAll()},d.prototype.register=function(){var t;return e(this,void 0,void 0,(function(){var e;return r(this,(function(r){switch(r.label){case 0:return e={isFormError:!1,isSuccess:!1},[4,this.validateAll()];case 1:if(r.sent())return e.isFormError=!0,[2,e];r.label=2;case 2:return r.trys.push([2,4,,5]),[4,this.store.customerStore.register(this.model.firstName,this.model.lastName,this.model.email,this.model.password,this.model.isMarketingAccepted)];case 3:return r.sent()&&(e.isSuccess=!0,u.completeRegistration(this.model.email,null===(t=this.store.customerStore.customer)||void 0===t?void 0:t.id)),[2,e];case 4:return r.sent(),[2,e];case 5:return[2]}}))}))},d}();export{d as RegisterForm};
1
+ import{__awaiter as e,__generator as r}from'../../../../ext/tslib/tslib.es6.js';import{makeObservable as t,computed as s,observable as a,action as i}from"mobx";import{Validator as o}from"../index.js";import{RequiredRule as n,EmailRule as l,MinRule as m}from"../rules/index.js";import{Analytics as u}from"../../../../analytics/analytics.js";import"../../../../analytics/head/index.js";var d=function(){function d(e){var r=this;this.model={firstName:"",lastName:"",email:"",password:"",isMarketingAccepted:!1},this.onFirstNameChange=function(e){r.firstName=e},this.onLastNameChange=function(e){r.lastName=e},this.onEmailChange=function(e){r.email=e},this.onPasswordChange=function(e){r.password=e},t(this,{emailErrorMessage:s,passwordErrorMessage:s,firstNameErrorMessage:s,lastNameErrorMessage:s,hasError:s,redirect:s,model:a,validateAll:i,register:i}),this.store=e.store,this.validator=new o(this.model,[new n({fieldKey:"firstName",valuePath:"firstName",message:e.message.requiredRule}),new n({fieldKey:"lastName",valuePath:"lastName",message:e.message.requiredRule}),new n({fieldKey:"email",valuePath:"email",message:e.message.requiredRule}),new n({fieldKey:"password",valuePath:"password",message:e.message.requiredRule}),new l({fieldKey:"email",valuePath:"email",message:e.message.emailRule}),new m({fieldKey:"password",valuePath:"password",minValue:6,message:e.message.minRule})])}return Object.defineProperty(d.prototype,"firstName",{get:function(){return this.model.firstName},set:function(e){this.model.firstName=e},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"lastName",{get:function(){return this.model.lastName},set:function(e){this.model.lastName=e},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"email",{get:function(){return this.model.email},set:function(e){this.model.email=e},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"password",{get:function(){return this.model.password},set:function(e){this.model.password=e},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"isMarketingAccepted",{get:function(){return this.model.isMarketingAccepted},set:function(e){this.model.isMarketingAccepted=e},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"hasError",{get:function(){return this.validator.hasError},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"firstNameErrorMessage",{get:function(){return this.validator.results.firstName.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"lastNameErrorMessage",{get:function(){return this.validator.results.lastName.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"emailErrorMessage",{get:function(){return this.validator.results.email.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"passwordErrorMessage",{get:function(){return this.validator.results.password.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"redirect",{get:function(){if("undefined"!=typeof window)return new URLSearchParams(window.location.search).get("redirect")},enumerable:!1,configurable:!0}),d.prototype.validateAll=function(){return this.validator.validateAll()},d.prototype.register=function(){var t;return e(this,void 0,void 0,(function(){var e;return r(this,(function(r){switch(r.label){case 0:return e={isFormError:!1,isSuccess:!1},[4,this.validateAll()];case 1:if(r.sent())return e.isFormError=!0,[2,e];r.label=2;case 2:return r.trys.push([2,4,,5]),[4,this.store.customerStore.register(this.model.firstName,this.model.lastName,this.model.email,this.model.password,this.model.isMarketingAccepted)];case 3:return r.sent()&&(e.isSuccess=!0,u.completeRegistration(this.model.email,null===(t=this.store.customerStore.customer)||void 0===t?void 0:t.id)),[2,e];case 4:return r.sent(),[2,e];case 5:return[2]}}))}))},d}();export{d as RegisterForm};
@@ -1 +1 @@
1
- import{__rest as t,__awaiter as o,__generator as e,__assign as r}from'../ext/tslib/tslib.es6.js';import*as i from"react";import{observer as s}from"mobx-react-lite";import d from"../components/checkout/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{IkasMerchantSettings as n}from"../models/data/merchant-settings/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{IkasThemePageType as m}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"../api/blog/index.js";import"../api/brand/index.js";import"../api/cart/index.js";import"../api/category/index.js";import{IkasCheckoutAPI as l}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{IkasCheckoutSettings as a}from"../models/data/checkout-settings/index.js";import{IkasNextPageDataProvider as c}from"../providers/page-data-next.js";import{IkasStorefrontConfig as u}from"../storefront/index.js";import{useRouter as p}from"next/router.js";import{FullscreenLoading as j}from"../components/checkout/components/fullscreen-loading/index.js";import{initIkasEvents as x}from"../analytics/events.js";var f=s((function(s){var m=s.merchantSettingsStr,c=s.checkoutSettingsStr,f=s.customizationProps,h=s.configJson,v=t(s,["merchantSettingsStr","checkoutSettingsStr","customizationProps","configJson"]),g=p(),y=i.useState(),b=y[0],F=y[1];u.initWithJson(h);var k=u.store,E=i.useMemo((function(){return c?new a(JSON.parse(c)):new a}),[c]),C=i.useMemo((function(){return m?new n(JSON.parse(m)):null}),[m]);i.useEffect((function(){document.documentElement.style.setProperty("--checkout-button-bg-color",(null==f?void 0:f.buttonBgColor)||"#272727"),document.documentElement.style.setProperty("--checkout-button-text-color",(null==f?void 0:f.buttonTextColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-button-disabled-bg-color",(null==f?void 0:f.buttonDisabledBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-button-disabled-text-color",(null==f?void 0:f.buttonDisabledTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-text-color",(null==f?void 0:f.primaryTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-secondary-text-color",(null==f?void 0:f.secondaryTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-bg-color",(null==f?void 0:f.primaryBgColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-secondary-bg-color",(null==f?void 0:f.secondaryBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-border-color",(null==f?void 0:f.borderColor)||"#E5E4E9"),document.documentElement.style.setProperty("--checkout-card-bg-color",(null==f?void 0:f.cardBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-error-color",(null==f?void 0:f.errorColor)||"#FB4E4E"),document.documentElement.style.setProperty("--checkout-error-light-color",(null==f?void 0:f.errorLightColor)||"#FCF3F4"),document.documentElement.style.setProperty("--checkout-warning-color",(null==f?void 0:f.warningColor)||"#FFBC1F"),document.documentElement.style.setProperty("--checkout-warning-light-color",(null==f?void 0:f.warningLightColor)||"#FFFAEE"),document.documentElement.style.setProperty("--checkout-success-color",(null==f?void 0:f.successColor)||"#2DCA73"),document.documentElement.style.setProperty("--checkout-success-light-color",(null==f?void 0:f.successLightColor)||"#F6FFED")}),[f]),i.useEffect((function(){k.checkLocalization(),P(),x()}),[]);var P=i.useCallback((function(){return o(void 0,void 0,void 0,(function(){var t,o,r;return e(this,(function(e){switch(e.label){case 0:return t=new URLSearchParams(window.location.search),(o=t.get("id"))?[4,l.getCheckoutById(o)]:[2,g.replace("/")];case 1:return(r=e.sent())?F(r):g.replace("/"),[2]}}))}))}),[]);return b?i.createElement(d,r({checkout:b,merchantSettings:C,checkoutSettings:E,customizationProps:f},v)):i.createElement(j,null)})),h=function(t){return o(void 0,void 0,void 0,(function(){return e(this,(function(o){switch(o.label){case 0:return[4,c.getStaticProps(t,m.CHECKOUT)];case 1:return[2,o.sent()]}}))}))};export{f as default,h as getStaticProps};
1
+ import{__rest as t,__awaiter as o,__generator as e,__assign as r}from'../ext/tslib/tslib.es6.js';import*as i from"react";import{observer as s}from"mobx-react-lite";import d from"../components/checkout/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{IkasMerchantSettings as n}from"../models/data/merchant-settings/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{IkasThemePageType as m}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"../api/blog/index.js";import"../api/brand/index.js";import"../api/cart/index.js";import"../api/category/index.js";import{IkasCheckoutAPI as l}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{IkasCheckoutSettings as a}from"../models/data/checkout-settings/index.js";import{IkasNextPageDataProvider as c}from"../providers/page-data-next.js";import{IkasStorefrontConfig as u}from"../storefront/index.js";import{useRouter as p}from"next/router.js";import{FullscreenLoading as j}from"../components/checkout/components/fullscreen-loading/index.js";import{initIkasEvents as x}from"../analytics/events.js";var f=s((function(s){var m=s.merchantSettingsStr,c=s.checkoutSettingsStr,f=s.customizationProps,h=s.configJson,v=t(s,["merchantSettingsStr","checkoutSettingsStr","customizationProps","configJson"]),g=p(),y=i.useState(),b=y[0],F=y[1];u.initWithJson(h,g);var k=u.store,E=i.useMemo((function(){return c?new a(JSON.parse(c)):new a}),[c]),C=i.useMemo((function(){return m?new n(JSON.parse(m)):null}),[m]);i.useEffect((function(){document.documentElement.style.setProperty("--checkout-button-bg-color",(null==f?void 0:f.buttonBgColor)||"#272727"),document.documentElement.style.setProperty("--checkout-button-text-color",(null==f?void 0:f.buttonTextColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-button-disabled-bg-color",(null==f?void 0:f.buttonDisabledBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-button-disabled-text-color",(null==f?void 0:f.buttonDisabledTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-text-color",(null==f?void 0:f.primaryTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-secondary-text-color",(null==f?void 0:f.secondaryTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-bg-color",(null==f?void 0:f.primaryBgColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-secondary-bg-color",(null==f?void 0:f.secondaryBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-border-color",(null==f?void 0:f.borderColor)||"#E5E4E9"),document.documentElement.style.setProperty("--checkout-card-bg-color",(null==f?void 0:f.cardBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-error-color",(null==f?void 0:f.errorColor)||"#FB4E4E"),document.documentElement.style.setProperty("--checkout-error-light-color",(null==f?void 0:f.errorLightColor)||"#FCF3F4"),document.documentElement.style.setProperty("--checkout-warning-color",(null==f?void 0:f.warningColor)||"#FFBC1F"),document.documentElement.style.setProperty("--checkout-warning-light-color",(null==f?void 0:f.warningLightColor)||"#FFFAEE"),document.documentElement.style.setProperty("--checkout-success-color",(null==f?void 0:f.successColor)||"#2DCA73"),document.documentElement.style.setProperty("--checkout-success-light-color",(null==f?void 0:f.successLightColor)||"#F6FFED")}),[f]),i.useEffect((function(){k.checkLocalization(),P(),x()}),[]);var P=i.useCallback((function(){return o(void 0,void 0,void 0,(function(){var t,o,r;return e(this,(function(e){switch(e.label){case 0:return t=new URLSearchParams(window.location.search),(o=t.get("id"))?[4,l.getCheckoutById(o)]:[2,g.replace("/")];case 1:return(r=e.sent())?F(r):g.replace("/"),[2]}}))}))}),[]);return b?i.createElement(d,r({checkout:b,merchantSettings:C,checkoutSettings:E,customizationProps:f},v)):i.createElement(j,null)})),h=function(t){return o(void 0,void 0,void 0,(function(){return e(this,(function(o){switch(o.label){case 0:return[4,c.getStaticProps(t,m.CHECKOUT)];case 1:return[2,o.sent()]}}))}))};export{f as default,h as getStaticProps};
@@ -1,9 +1,10 @@
1
1
  import * as React from "react";
2
2
  import { GetStaticProps } from "next";
3
+ import { WithRouterProps } from "next/dist/client/with-router";
3
4
  declare type Props = {
4
5
  configJson: Record<string, any>;
5
6
  components?: Record<string, any>;
6
- };
7
- export declare const getStaticProps: GetStaticProps;
8
- declare const _default: React.FunctionComponent<Props>;
7
+ } & WithRouterProps;
8
+ declare const _default: React.ComponentType<import("next/dist/client/with-router").ExcludeRouterProps<Props>>;
9
9
  export default _default;
10
+ export declare const getStaticProps: GetStaticProps;
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as o}from'../ext/tslib/tslib.es6.js';import*as r from"react";import n from"next/dynamic.js";import{observer as e}from"mobx-react-lite";import{IkasNextPageDataProvider as i}from"../providers/page-data-next.js";import{IkasStorefrontConfig as s}from"../storefront/index.js";var a=n((function(){return import("../components/page-editor/index.js").then((function(t){return t.IkasPageEditor}))}),{ssr:!1}),m=function(r){return t(void 0,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,i.getStaticProps(r,void 0,void 0,!0)];case 1:return[2,t.sent()]}}))}))},c=e((function(t){var o=t.configJson,n=t.components;return o&&s.initWithJson(o),n&&(s.currentPageComponents=n),r.createElement(a,null)}));export{c as default,m as getStaticProps};
1
+ import{__extends as t,__awaiter as n,__generator as o}from'../ext/tslib/tslib.es6.js';import*as r from"react";import e from"next/dynamic.js";import{IkasNextPageDataProvider as i}from"../providers/page-data-next.js";import{IkasStorefrontConfig as s}from"../storefront/index.js";import{withRouter as p}from"next/router";var u=e((function(){return import("../components/page-editor/index.js").then((function(t){return t.default}))}),{ssr:!1}),c=p(function(n){function o(){return null!==n&&n.apply(this,arguments)||this}return t(o,n),o.prototype.componentDidMount=function(){var t=this.props,n=t.configJson,o=t.components;n&&s.initWithJson(n,this.props.router),o&&(s.currentPageComponents=o)},o.prototype.render=function(){return r.createElement(u,null)},o}(r.Component)),m=function(t){return n(void 0,void 0,void 0,(function(){return o(this,(function(n){switch(n.label){case 0:return[4,i.getStaticProps(t,void 0,void 0,!0)];case 1:return[2,n.sent()]}}))}))};export{c as default,m as getStaticProps};
@@ -50,7 +50,7 @@ export declare class IkasPageDataProvider {
50
50
  getPageComponentPropValues(pageComponent: IkasThemePageComponent): Promise<IkasPageComponentPropValue>;
51
51
  getPageComponentPropValue(pageComponent: IkasThemePageComponent, prop: IkasThemeComponentProp): Promise<any>;
52
52
  private setPageMetaData;
53
- private setLinkSlugs;
53
+ setLinkSlugs(): Promise<[void, void, void]>;
54
54
  private getLinkSlugs;
55
55
  }
56
56
  export declare class IkasPageComponentPropValue {
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as t}from'../ext/tslib/tslib.es6.js';import{makeAutoObservable as r}from"mobx";import i from'../ext/lodash/uniq.js';import a from'../ext/lzutf8/build/production/lzutf8.js';import{IkasBlogMetadataTargetType as s}from"../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{IkasHTMLMetaDataTargetType as n}from"../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"../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{IkasRaffleMetadataTargetType as o}from"../models/data/raffle/index.js";import{IkasTheme as p}from"../models/theme/theme.js";import{IkasThemePageType as u}from"../models/theme/page/index.js";import{IkasThemePageComponent as c}from"../models/theme/page/component/index.js";import{IkasThemeComponent as l}from"../models/theme/component/index.js";import{IkasThemeComponentPropType as d}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{IkasProductDetail as m}from"../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{IkasBlogAPI as f}from"../api/blog/index.js";import{IkasBrandAPI as g}from"../api/brand/index.js";import"../api/cart/index.js";import{IkasCategoryAPI as h}from"../api/category/index.js";import"../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{IkasHTMLMetaDataAPI as v}from"../api/html-meta-data/index.js";import{IkasMerchantAPI as j}from"../api/merchant/index.js";import{IkasProductSearchAPI as T}from"../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{IkasProductOptionSetAPI as y}from"../api/product-option-set/index.js";import{IkasRaffleAPI as b}from"../api/raffle/index.js";import"../api/back-in-stock-reminder/index.js";import{IkasProductListPropValueProvider as x}from"./prop-value/product-list.js";import{IkasProductDetailPropValueProvider as D}from"./prop-value/product-detail.js";import{IkasBrandListPropValueProvider as L}from"./prop-value/brand-list.js";import{IkasBrandPropValueProvider as S}from"./prop-value/brand.js";import{IkasLinkPropValueProvider as O}from"./prop-value/link.js";import{IkasImageListPropValueProvider as w}from"./prop-value/image-list.js";import{IkasTextPropValueProvider as P}from"./prop-value/text.js";import{IkasColorPropValueProvider as C}from"./prop-value/color.js";import{IkasBooleanPropValueProvider as I}from"./prop-value/boolean.js";import{IkasImagePropValueProvider as E}from"./prop-value/image.js";import{IkasCategoryPropValueProvider as R}from"./prop-value/category.js";import{IkasCategoryListPropValueProvider as A}from"./prop-value/category-list.js";import{IkasCustomPropValueProvider as B}from"./prop-value/custom.js";import{IkasStorefrontConfig as M}from"../storefront/index.js";import{IkasRichTextPropValueProvider as G}from"./prop-value/rich-text.js";import{IkasBlogPropValueProvider as _}from"./prop-value/blog.js";import{IkasBlogListPropValueProvider as V}from"./prop-value/blog-list.js";import{IkasAttributePropValueProvider as F}from"./prop-value/attribute.js";import{IkasAttributeListPropValueProvider as k}from"./prop-value/attribute-list.js";import{IkasBlogCategoryPropValueProvider as U}from"./prop-value/blog-category.js";import{IkasBlogCategoryListPropValueProvider as N}from"./prop-value/blog-category-list.js";import{IkasRafflePropValueProvider as Y}from"./prop-value/raffle.js";import{IkasRaffleListPropValueProvider as J}from"./prop-value/raffle-list.js";import{populateRaffleProducts as H}from"./helpers/raffles.js";var z=function(){function c(e,t,i){this.pageType=null,this.pageParams={},this.pageComponentPropValues=[],this.pageSpecificData=null,this.merchantSettings=null,this.possiblePageTypes=[],this.linkMetaDataTargetIds=[],this.theme=new p(e),this.pageParams=t||{},this.pageType=i,r(this)}return Object.defineProperty(c.prototype,"page",{get:function(){var e=this;if(this.pageType===u.CUSTOM){var t=this.pageParams.slug;return this.theme.pages.find((function(e){return e.type===u.CUSTOM&&e.slug===t}))}return this.theme.pages.find((function(t){return t.type===e.pageType}))},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"nextPageData",{get:function(){var e,t,r;return{props:{propValuesStr:a.compress(JSON.stringify(this.pageComponentPropValues),{outputEncoding:"Base64"}),pageSpecificDataStr:this.pageSpecificData?JSON.stringify(this.pageSpecificData||{}):"",pageType:(null===(e=this.page)||void 0===e?void 0:e.type)||u.CUSTOM,pageTitle:(null===(t=this.page)||void 0===t?void 0:t.pageTitle)||null,pageDescription:(null===(r=this.page)||void 0===r?void 0:r.description)||null,settingsStr:JSON.stringify(this.theme.settings||{}),merchantSettingsStr:this.merchantSettings?JSON.stringify(this.merchantSettings):null,configJson:M.getJson()}}},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"specification",{get:function(){var e,t,r=this,i=this.page;return(null==i?void 0:i.type)===u.PRODUCT?null===(e=i.specifications)||void 0===e?void 0:e.find((function(e){var t;return e.id===(null===(t=r.pageSpecificData)||void 0===t?void 0:t.product.id)})):null===(t=null==i?void 0:i.specifications)||void 0===t?void 0:t.find((function(e){var t;return e.id===(null===(t=r.pageSpecificData)||void 0===t?void 0:t.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"pageComponents",{get:function(){var e;return this.specification?this.specification.components:(null===(e=this.page)||void 0===e?void 0:e.components)||[]},enumerable:!1,configurable:!0}),c.prototype.getMerchantSettings=function(){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,j.listMerchantSettings()];case 1:return(e=t.sent())&&(this.merchantSettings=e),[2]}}))}))},c.prototype.getPageData=function(){return e(this,void 0,void 0,(function(){var e,r=this;return t(this,(function(t){switch(t.label){case 0:return this.pageSpecificData?[3,2]:[4,this.getPageSpecificData()];case 1:t.sent(),t.label=2;case 2:return this.page?[4,this.getMerchantSettings()]:[2];case 3:return t.sent(),e=this,[4,Promise.all(this.pageComponents.map((function(e){return r.getPageComponentPropValues(e)})))];case 4:return e.pageComponentPropValues=t.sent(),[4,this.setLinkSlugs()];case 5:return t.sent(),[2]}}))}))},c.prototype.getPageSpecificData=function(){var r,i,a;return e(this,void 0,void 0,(function(){var p,c,l,d,j,x,D,L,S,O=this;return t(this,(function(w){switch(w.label){case 0:return this.pageType&&![u.BRAND,u.PRODUCT,u.CATEGORY,u.BLOG,u.BLOG_CATEGORY,u.RAFFLE_DETAIL].includes(this.pageType)?[2]:(p=this.pageParams.slug)?(c=[],(null===(r=this.possiblePageTypes)||void 0===r?void 0:r.includes(u.BLOG))||(null===(i=this.possiblePageTypes)||void 0===i?void 0:i.includes(u.BLOG_CATEGORY))?[4,f.listBlogMetaData(p)]:[3,2]):[2];case 1:return(c=w.sent()).length?[3,6]:[2];case 2:return(null===(a=this.possiblePageTypes)||void 0===a?void 0:a.includes(u.RAFFLE_DETAIL))?[4,b.listRaffleMetaData(p)]:[3,4];case 3:return(c=w.sent()).length?[3,6]:[2];case 4:return[4,v.listHTMLMetaData(p)];case 5:if(!(c=w.sent())||!c.length)return[2];w.label=6;case 6:if(!(l=c[0]).targetId)return[2];switch(d=function(){return e(O,void 0,void 0,(function(){var e,r,i,a,s,n;return t(this,(function(t){switch(t.label){case 0:return[4,T.searchProducts({productIdList:[l.targetId],priceListId:M.priceListId,salesChannelId:M.salesChannelId})];case 1:return(null==(e=t.sent())?void 0:e.data.length)?(r=e.data[0]).productOptionSetId?[4,y.list([r.productOptionSetId])]:[3,3]:[2];case 2:(null==(i=t.sent())?void 0:i.length)&&(r.productOptionSet=i[0]),t.label=3;case 3:return(a=r.variants.find((function(e){return e.isActive})))?(this.pageSpecificData=new m(r,a.variantValues),this.pageSpecificData.displayedVariantTypes.length&&(s=this.pageSpecificData.displayedVariantTypes[0]).displayedVariantValues.length&&(n=s.displayedVariantValues.find((function(e){return e.hasStock})))&&(this.pageSpecificData.selectedVariantValues=n.variant.variantValues),this.pageType=u.PRODUCT,this.setPageMetaData(l),[2]):[2]}}))}))},j=function(){return e(O,void 0,void 0,(function(){var e,r;return t(this,(function(t){switch(t.label){case 0:return[4,g.listBrands({idList:[l.targetId]})];case 1:return(e=t.sent()).brands.length?(r=e.brands[0],this.pageSpecificData=r,this.pageType=u.BRAND,this.setPageMetaData(l),[2]):[2]}}))}))},x=function(){return e(O,void 0,void 0,(function(){var e,r;return t(this,(function(t){switch(t.label){case 0:return[4,h.listCategories({idList:[l.targetId]})];case 1:return(e=t.sent()).categories.length?(r=e.categories[0],this.pageSpecificData=r,this.pageType=u.CATEGORY,this.setPageMetaData(l),[2]):[2]}}))}))},D=function(){return e(O,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,f.getBlog({id:l.targetId})];case 1:return(e=t.sent())?(this.pageSpecificData=e,this.pageType=u.BLOG,this.setPageMetaData(l),[2]):[2]}}))}))},L=function(){return e(O,void 0,void 0,(function(){var e,r;return t(this,(function(t){switch(t.label){case 0:return[4,f.listBlogCategory({idList:[l.targetId],page:1,limit:1})];case 1:return(e=t.sent())&&e.blogCategories.length?(r=e.blogCategories[0],this.pageSpecificData=r,this.pageType=u.BLOG_CATEGORY,this.setPageMetaData(l),[2]):[2]}}))}))},S=function(){return e(O,void 0,void 0,(function(){var e,r;return t(this,(function(t){switch(t.label){case 0:return[4,b.listRaffles({id:l.targetId})];case 1:return(e=t.sent())&&e.raffles.length?(r=e.raffles[0],[4,H([r])]):[2];case 2:return t.sent(),this.pageSpecificData=r,this.pageType=u.RAFFLE_DETAIL,this.setPageMetaData(l),[2]}}))}))},l.targetType){case n.BRAND:return[3,7];case n.CATEGORY:return[3,9];case n.PRODUCT:return[3,11];case s.BLOG:return[3,13];case s.BLOG_CATEGORY:return[3,15];case o.RAFFLE:return[3,17]}return[3,19];case 7:return[4,j()];case 8:return[2,w.sent()];case 9:return[4,x()];case 10:return[2,w.sent()];case 11:return[4,d()];case 12:return[2,w.sent()];case 13:return[4,D()];case 14:return[2,w.sent()];case 15:return[4,L()];case 16:return[2,w.sent()];case 17:return[4,S()];case 18:return[2,w.sent()];case 19:return[3,20];case 20:return[2]}}))}))},c.prototype.getPageComponentPropValues=function(r){return e(this,void 0,void 0,(function(){var i,a,s,n=this;return t(this,(function(o){switch(o.label){case 0:return i=this.theme.components.find((function(e){return e.id===r.componentId})),a={pageComponent:r,component:i,propValues:{}},s=function(i){return e(n,void 0,void 0,(function(){var e,s;return t(this,(function(t){switch(t.label){case 0:return e=a.propValues,s=i.name,[4,this.getPageComponentPropValue(r,i)];case 1:return e[s]=t.sent(),[2]}}))}))},[4,Promise.all(i.props.map(s))];case 1:return o.sent(),[2,a]}}))}))},c.prototype.getPageComponentPropValue=function(r,i){return e(this,void 0,void 0,(function(){var e,a,s,n,o,p=this;return t(this,(function(t){switch(t.label){case 0:if(a=r.propValues[i.name],s=[d.RAFFLE_LIST],null==a&&!s.includes(i.type))return[2,null];switch(i.type){case d.TEXT:return[3,1];case d.RICH_TEXT:return[3,2];case d.BOOLEAN:return[3,3];case d.IMAGE:return[3,4];case d.IMAGE_LIST:return[3,5];case d.BRAND:return[3,6];case d.BRAND_LIST:return[3,7];case d.PRODUCT_LIST:return[3,8];case d.PRODUCT_DETAIL:return[3,9];case d.PRODUCT_ATTRIBUTE:return[3,10];case d.PRODUCT_ATTRIBUTE_LIST:return[3,11];case d.CATEGORY:return[3,12];case d.CATEGORY_LIST:return[3,13];case d.LINK:case d.LIST_OF_LINK:return[3,14];case d.COLOR:return[3,15];case d.CUSTOM:return[3,16];case d.COMPONENT:case d.COMPONENT_LIST:return[3,17];case d.BLOG:return[3,19];case d.BLOG_LIST:return[3,20];case d.BLOG_CATEGORY:return[3,21];case d.BLOG_CATEGORY_LIST:return[3,22];case d.RAFFLE:return[3,23];case d.RAFFLE_LIST:return[3,24]}return[3,25];case 1:return e=new P(a),[3,26];case 2:return e=new G(a),[3,26];case 3:return e=new I(a),[3,26];case 4:return e=new E(a),[3,26];case 5:return e=new w(a),[3,26];case 6:return e=new S(a),[3,26];case 7:return e=new L(a),[3,26];case 8:return e=new x(this.pageType,a,this.pageSpecificData),[3,26];case 9:return e=new D(a),[3,26];case 10:return e=new F(a),[3,26];case 11:return e=new k(a),[3,26];case 12:return e=new R(a),[3,26];case 13:return e=new A(a),[3,26];case 14:return e=new O(a,this.theme,this.linkMetaDataTargetIds),[3,26];case 15:return e=new C(a),[3,26];case 16:return(n=this.theme.customData.find((function(e){return e.id===i.customDataId})))?(e=new B(a,n,this.theme,this.pageType,this,this.pageSpecificData,this.pageParams),[3,26]):[2];case 17:return o=a,[4,Promise.all(o.map((function(e){return p.getPageComponentPropValues(e)})))];case 18:case 27:return[2,t.sent()];case 19:return e=new _(a),[3,26];case 20:return e=new V(this.pageType,a,this.pageSpecificData),[3,26];case 21:return e=new U(a),[3,26];case 22:return e=new N(a),[3,26];case 23:return e=new Y(a),[3,26];case 24:return e=new J,[3,26];case 25:return[3,26];case 26:return[4,null==e?void 0:e.getValue()]}}))}))},c.prototype.setPageMetaData=function(e){this.page&&(this.page.pageTitle=e.pageTitle,this.page.description=e.description)},c.prototype.setLinkSlugs=function(){return e(this,void 0,void 0,(function(){var e,r,i;return t(this,(function(t){switch(t.label){case 0:return e=[],r=[],i=[],this.linkMetaDataTargetIds.forEach((function(t){switch(t.type){case"DEFAULT":e.push(t);break;case"BLOG":r.push(t);break;case"RAFFLE":i.push(t)}})),[4,Promise.all([this.getLinkSlugs(e,"DEFAULT"),this.getLinkSlugs(r,"BLOG"),this.getLinkSlugs(i,"RAFFLE")])];case 1:return[2,t.sent()]}}))}))},c.prototype.getLinkSlugs=function(r,a){return e(this,void 0,void 0,(function(){var s,n,o,p,u,c,l=this;return t(this,(function(d){switch(d.label){case 0:s=i(r.map((function(e){return e.id}))),n=1,o=200,p=[],u=!1,c=function(){return e(l,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:switch(e=[],a){case"DEFAULT":return[3,1];case"BLOG":return[3,3];case"RAFFLE":return[3,5]}return[3,7];case 1:return[4,v.listHTMLMetaData(void 0,s,void 0,n,o)];case 2:case 4:case 6:return e=t.sent(),[3,8];case 3:return[4,f.listBlogMetaData(void 0,s,void 0,n,o)];case 5:return[4,b.listRaffleMetaData(void 0,s,void 0,n,o)];case 7:return[3,8];case 8:return(null==e?void 0:e.length)?(p=p.concat(e),e.length<o&&(u=!0)):u=!0,n++,[2]}}))}))},d.label=1;case 1:return!u&&p.length<s.length?[4,c()]:[3,3];case 2:return d.sent(),[3,1];case 3:return p.forEach((function(e){r.filter((function(t){return t.id===e.targetId})).forEach((function(t){t.navigationLink.href+=e.slug}))})),[2]}}))}))},c}(),K=function(e){this.pageComponent=e.pageComponent?new c(e.pageComponent):new c({}),this.component=e.component?new l(e.component):new l({}),this.propValues=e.propValues||{}};export{K as IkasPageComponentPropValue,z as IkasPageDataProvider};
1
+ import{__awaiter as e,__generator as t}from'../ext/tslib/tslib.es6.js';import{makeAutoObservable as r}from"mobx";import i from'../ext/lodash/uniq.js';import a from'../ext/lzutf8/build/production/lzutf8.js';import{IkasBlogMetadataTargetType as s}from"../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{IkasHTMLMetaDataTargetType as n}from"../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"../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{IkasRaffleMetadataTargetType as o}from"../models/data/raffle/index.js";import{IkasTheme as p}from"../models/theme/theme.js";import{IkasThemePageType as u}from"../models/theme/page/index.js";import{IkasThemePageComponent as c}from"../models/theme/page/component/index.js";import{IkasThemeComponent as l}from"../models/theme/component/index.js";import{IkasThemeComponentPropType as d}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{IkasProductDetail as m}from"../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{IkasBlogAPI as f}from"../api/blog/index.js";import{IkasBrandAPI as g}from"../api/brand/index.js";import"../api/cart/index.js";import{IkasCategoryAPI as h}from"../api/category/index.js";import"../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{IkasHTMLMetaDataAPI as v}from"../api/html-meta-data/index.js";import{IkasMerchantAPI as j}from"../api/merchant/index.js";import{IkasProductSearchAPI as T}from"../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{IkasProductOptionSetAPI as y}from"../api/product-option-set/index.js";import{IkasRaffleAPI as x}from"../api/raffle/index.js";import"../api/back-in-stock-reminder/index.js";import{IkasProductListPropValueProvider as b}from"./prop-value/product-list.js";import{IkasProductDetailPropValueProvider as D}from"./prop-value/product-detail.js";import{IkasBrandListPropValueProvider as L}from"./prop-value/brand-list.js";import{IkasBrandPropValueProvider as S}from"./prop-value/brand.js";import{IkasLinkPropValueProvider as O}from"./prop-value/link.js";import{IkasImageListPropValueProvider as w}from"./prop-value/image-list.js";import{IkasTextPropValueProvider as P}from"./prop-value/text.js";import{IkasColorPropValueProvider as C}from"./prop-value/color.js";import{IkasBooleanPropValueProvider as I}from"./prop-value/boolean.js";import{IkasImagePropValueProvider as R}from"./prop-value/image.js";import{IkasCategoryPropValueProvider as E}from"./prop-value/category.js";import{IkasCategoryListPropValueProvider as A}from"./prop-value/category-list.js";import{IkasCustomPropValueProvider as B}from"./prop-value/custom.js";import{IkasStorefrontConfig as M}from"../storefront/index.js";import{IkasSliderPropValueProvider as G}from"./prop-value/slider.js";import{IkasRichTextPropValueProvider as _}from"./prop-value/rich-text.js";import{IkasBlogPropValueProvider as V}from"./prop-value/blog.js";import{IkasBlogListPropValueProvider as F}from"./prop-value/blog-list.js";import{IkasAttributePropValueProvider as k}from"./prop-value/attribute.js";import{IkasAttributeListPropValueProvider as U}from"./prop-value/attribute-list.js";import{IkasBlogCategoryPropValueProvider as N}from"./prop-value/blog-category.js";import{IkasBlogCategoryListPropValueProvider as Y}from"./prop-value/blog-category-list.js";import{IkasRafflePropValueProvider as J}from"./prop-value/raffle.js";import{IkasRaffleListPropValueProvider as H}from"./prop-value/raffle-list.js";import{populateRaffleProducts as z}from"./helpers/raffles.js";var K=function(){function c(e,t,i){this.pageType=null,this.pageParams={},this.pageComponentPropValues=[],this.pageSpecificData=null,this.merchantSettings=null,this.possiblePageTypes=[],this.linkMetaDataTargetIds=[],this.theme=new p(e),this.pageParams=t||{},this.pageType=i,r(this)}return Object.defineProperty(c.prototype,"page",{get:function(){var e=this;if(this.pageType===u.CUSTOM){var t=this.pageParams.slug;return this.theme.pages.find((function(e){return e.type===u.CUSTOM&&e.slug===t}))}return this.theme.pages.find((function(t){return t.type===e.pageType}))},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"nextPageData",{get:function(){var e,t,r;return{props:{propValuesStr:a.compress(JSON.stringify(this.pageComponentPropValues),{outputEncoding:"Base64"}),pageSpecificDataStr:this.pageSpecificData?JSON.stringify(this.pageSpecificData||{}):"",pageType:(null===(e=this.page)||void 0===e?void 0:e.type)||u.CUSTOM,pageTitle:(null===(t=this.page)||void 0===t?void 0:t.pageTitle)||null,pageDescription:(null===(r=this.page)||void 0===r?void 0:r.description)||null,settingsStr:JSON.stringify(this.theme.settings||{}),merchantSettingsStr:this.merchantSettings?JSON.stringify(this.merchantSettings):null,configJson:M.getJson()}}},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"specification",{get:function(){var e,t,r=this,i=this.page;return(null==i?void 0:i.type)===u.PRODUCT?null===(e=i.specifications)||void 0===e?void 0:e.find((function(e){var t;return e.id===(null===(t=r.pageSpecificData)||void 0===t?void 0:t.product.id)})):null===(t=null==i?void 0:i.specifications)||void 0===t?void 0:t.find((function(e){var t;return e.id===(null===(t=r.pageSpecificData)||void 0===t?void 0:t.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"pageComponents",{get:function(){var e;return this.specification?this.specification.components:(null===(e=this.page)||void 0===e?void 0:e.components)||[]},enumerable:!1,configurable:!0}),c.prototype.getMerchantSettings=function(){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,j.listMerchantSettings()];case 1:return(e=t.sent())&&(this.merchantSettings=e),[2]}}))}))},c.prototype.getPageData=function(){return e(this,void 0,void 0,(function(){var e,r=this;return t(this,(function(t){switch(t.label){case 0:return this.pageSpecificData?[3,2]:[4,this.getPageSpecificData()];case 1:t.sent(),t.label=2;case 2:return this.page?[4,this.getMerchantSettings()]:[2];case 3:return t.sent(),e=this,[4,Promise.all(this.pageComponents.map((function(e){return r.getPageComponentPropValues(e)})))];case 4:return e.pageComponentPropValues=t.sent(),[4,this.setLinkSlugs()];case 5:return t.sent(),[2]}}))}))},c.prototype.getPageSpecificData=function(){var r,i,a;return e(this,void 0,void 0,(function(){var p,c,l,d,j,b,D,L,S,O=this;return t(this,(function(w){switch(w.label){case 0:return this.pageType&&![u.BRAND,u.PRODUCT,u.CATEGORY,u.BLOG,u.BLOG_CATEGORY,u.RAFFLE_DETAIL].includes(this.pageType)?[2]:(p=this.pageParams.slug)?(c=[],(null===(r=this.possiblePageTypes)||void 0===r?void 0:r.includes(u.BLOG))||(null===(i=this.possiblePageTypes)||void 0===i?void 0:i.includes(u.BLOG_CATEGORY))?[4,f.listBlogMetaData(p)]:[3,2]):[2];case 1:return(c=w.sent()).length?[3,6]:[2];case 2:return(null===(a=this.possiblePageTypes)||void 0===a?void 0:a.includes(u.RAFFLE_DETAIL))?[4,x.listRaffleMetaData(p)]:[3,4];case 3:return(c=w.sent()).length?[3,6]:[2];case 4:return[4,v.listHTMLMetaData(p)];case 5:if(!(c=w.sent())||!c.length)return[2];w.label=6;case 6:if(!(l=c[0]).targetId)return[2];switch(d=function(){return e(O,void 0,void 0,(function(){var e,r,i,a,s,n;return t(this,(function(t){switch(t.label){case 0:return[4,T.searchProducts({productIdList:[l.targetId],priceListId:M.priceListId,salesChannelId:M.salesChannelId})];case 1:return(null==(e=t.sent())?void 0:e.data.length)?(r=e.data[0]).productOptionSetId?[4,y.list([r.productOptionSetId])]:[3,3]:[2];case 2:(null==(i=t.sent())?void 0:i.length)&&(r.productOptionSet=i[0]),t.label=3;case 3:return(a=r.variants.find((function(e){return e.isActive})))?(this.pageSpecificData=new m(r,a.variantValues),this.pageSpecificData.displayedVariantTypes.length&&(s=this.pageSpecificData.displayedVariantTypes[0]).displayedVariantValues.length&&(n=s.displayedVariantValues.find((function(e){return e.hasStock})))&&(this.pageSpecificData.selectedVariantValues=n.variant.variantValues),this.pageType=u.PRODUCT,this.setPageMetaData(l),[2]):[2]}}))}))},j=function(){return e(O,void 0,void 0,(function(){var e,r;return t(this,(function(t){switch(t.label){case 0:return[4,g.listBrands({idList:[l.targetId]})];case 1:return(e=t.sent()).brands.length?(r=e.brands[0],this.pageSpecificData=r,this.pageType=u.BRAND,this.setPageMetaData(l),[2]):[2]}}))}))},b=function(){return e(O,void 0,void 0,(function(){var e,r;return t(this,(function(t){switch(t.label){case 0:return[4,h.listCategories({idList:[l.targetId]})];case 1:return(e=t.sent()).categories.length?(r=e.categories[0],this.pageSpecificData=r,this.pageType=u.CATEGORY,this.setPageMetaData(l),[2]):[2]}}))}))},D=function(){return e(O,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,f.getBlog({id:l.targetId})];case 1:return(e=t.sent())?(this.pageSpecificData=e,this.pageType=u.BLOG,this.setPageMetaData(l),[2]):[2]}}))}))},L=function(){return e(O,void 0,void 0,(function(){var e,r;return t(this,(function(t){switch(t.label){case 0:return[4,f.listBlogCategory({idList:[l.targetId],page:1,limit:1})];case 1:return(e=t.sent())&&e.blogCategories.length?(r=e.blogCategories[0],this.pageSpecificData=r,this.pageType=u.BLOG_CATEGORY,this.setPageMetaData(l),[2]):[2]}}))}))},S=function(){return e(O,void 0,void 0,(function(){var e,r;return t(this,(function(t){switch(t.label){case 0:return[4,x.listRaffles({id:l.targetId})];case 1:return(e=t.sent())&&e.raffles.length?(r=e.raffles[0],[4,z([r])]):[2];case 2:return t.sent(),this.pageSpecificData=r,this.pageType=u.RAFFLE_DETAIL,this.setPageMetaData(l),[2]}}))}))},l.targetType){case n.BRAND:return[3,7];case n.CATEGORY:return[3,9];case n.PRODUCT:return[3,11];case s.BLOG:return[3,13];case s.BLOG_CATEGORY:return[3,15];case o.RAFFLE:return[3,17]}return[3,19];case 7:return[4,j()];case 8:return[2,w.sent()];case 9:return[4,b()];case 10:return[2,w.sent()];case 11:return[4,d()];case 12:return[2,w.sent()];case 13:return[4,D()];case 14:return[2,w.sent()];case 15:return[4,L()];case 16:return[2,w.sent()];case 17:return[4,S()];case 18:return[2,w.sent()];case 19:return[3,20];case 20:return[2]}}))}))},c.prototype.getPageComponentPropValues=function(r){return e(this,void 0,void 0,(function(){var i,a,s,n=this;return t(this,(function(o){switch(o.label){case 0:return i=this.theme.components.find((function(e){return e.id===r.componentId})),a={pageComponent:r,component:i,propValues:{}},s=function(i){return e(n,void 0,void 0,(function(){var e,s;return t(this,(function(t){switch(t.label){case 0:return e=a.propValues,s=i.name,[4,this.getPageComponentPropValue(r,i)];case 1:return e[s]=t.sent(),[2]}}))}))},[4,Promise.all(i.props.map(s))];case 1:return o.sent(),[2,a]}}))}))},c.prototype.getPageComponentPropValue=function(r,i){return e(this,void 0,void 0,(function(){var e,a,s,n,o,p=this;return t(this,(function(t){switch(t.label){case 0:if(a=r.propValues[i.name],s=[d.RAFFLE_LIST],null==a&&!s.includes(i.type))return[2,null];switch(i.type){case d.TEXT:return[3,1];case d.RICH_TEXT:return[3,2];case d.BOOLEAN:return[3,3];case d.IMAGE:return[3,4];case d.IMAGE_LIST:return[3,5];case d.BRAND:return[3,6];case d.BRAND_LIST:return[3,7];case d.PRODUCT_LIST:return[3,8];case d.PRODUCT_DETAIL:return[3,9];case d.PRODUCT_ATTRIBUTE:return[3,10];case d.PRODUCT_ATTRIBUTE_LIST:return[3,11];case d.CATEGORY:return[3,12];case d.CATEGORY_LIST:return[3,13];case d.LINK:case d.LIST_OF_LINK:return[3,14];case d.COLOR:return[3,15];case d.CUSTOM:return[3,16];case d.COMPONENT:case d.COMPONENT_LIST:return[3,17];case d.BLOG:return[3,19];case d.BLOG_LIST:return[3,20];case d.BLOG_CATEGORY:return[3,21];case d.BLOG_CATEGORY_LIST:return[3,22];case d.RAFFLE:return[3,23];case d.RAFFLE_LIST:return[3,24];case d.SLIDER:return[3,25]}return[3,26];case 1:return e=new P(a),[3,27];case 2:return e=new _(a),[3,27];case 3:return e=new I(a),[3,27];case 4:return e=new R(a),[3,27];case 5:return e=new w(a),[3,27];case 6:return e=new S(a),[3,27];case 7:return e=new L(a),[3,27];case 8:return e=new b(this.pageType,a,this.pageSpecificData),[3,27];case 9:return e=new D(a),[3,27];case 10:return e=new k(a),[3,27];case 11:return e=new U(a),[3,27];case 12:return e=new E(a),[3,27];case 13:return e=new A(a),[3,27];case 14:return e=new O(a,this.theme,this.linkMetaDataTargetIds),[3,27];case 15:return e=new C(a),[3,27];case 16:return(n=this.theme.customData.find((function(e){return e.id===i.customDataId})))?(e=new B(a,n,this.theme,this.pageType,this,this.pageSpecificData,this.pageParams),[3,27]):[2];case 17:return o=a,[4,Promise.all(o.map((function(e){return p.getPageComponentPropValues(e)})))];case 18:case 28:return[2,t.sent()];case 19:return e=new V(a),[3,27];case 20:return e=new F(this.pageType,a,this.pageSpecificData),[3,27];case 21:return e=new N(a),[3,27];case 22:return e=new Y(a),[3,27];case 23:return e=new J(a),[3,27];case 24:return e=new H,[3,27];case 25:return e=new G(a),[3,27];case 26:return[3,27];case 27:return[4,null==e?void 0:e.getValue()]}}))}))},c.prototype.setPageMetaData=function(e){this.page&&(this.page.pageTitle=e.pageTitle,this.page.description=e.description)},c.prototype.setLinkSlugs=function(){return e(this,void 0,void 0,(function(){var e,r,i;return t(this,(function(t){switch(t.label){case 0:return e=[],r=[],i=[],this.linkMetaDataTargetIds.forEach((function(t){switch(t.type){case"DEFAULT":e.push(t);break;case"BLOG":r.push(t);break;case"RAFFLE":i.push(t)}})),[4,Promise.all([this.getLinkSlugs(e,"DEFAULT"),this.getLinkSlugs(r,"BLOG"),this.getLinkSlugs(i,"RAFFLE")])];case 1:return[2,t.sent()]}}))}))},c.prototype.getLinkSlugs=function(r,a){return e(this,void 0,void 0,(function(){var s,n,o=this;return t(this,(function(p){switch(p.label){case 0:return s=i(r.map((function(e){return e.id}))),n=[],[4,function(){return e(o,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:switch(e=[],a){case"DEFAULT":return[3,1];case"BLOG":return[3,3];case"RAFFLE":return[3,5]}return[3,7];case 1:return[4,v.listHTMLMetaData(void 0,s,void 0)];case 2:case 4:case 6:return e=t.sent(),[3,8];case 3:return[4,f.listBlogMetaData(void 0,s,void 0)];case 5:return[4,x.listRaffleMetaData(void 0,s,void 0)];case 7:return[3,8];case 8:return e.length&&(n=e),[2]}}))}))}()];case 1:return p.sent(),r.forEach((function(e){var t=n.find((function(t){return t.targetId===e.id}));t&&(e.navigationLink.href+=t.slug)})),[2]}}))}))},c}(),X=function(e){this.pageComponent=e.pageComponent?new c(e.pageComponent):new c({}),this.component=e.component?new l(e.component):new l({}),this.propValues=e.propValues||{}};export{X as IkasPageComponentPropValue,K as IkasPageDataProvider};
@@ -4,7 +4,7 @@ import { IkasAttributeList } from "../models/ui/product-attribute-list";
4
4
  import { IkasProductListParams } from "../models/ui/product-list";
5
5
  import { IkasRaffleListParams } from "../models/ui/raffle-list";
6
6
  import { NextRouter } from "next/router.js";
7
- import { IkasThemeSettings, IkasThemeComponentProp, IkasBrandListParams, IkasBrandList, IkasCategoryList, IkasProductList, IkasProductDetail, IkasAttributeDetail, IkasNavigationLink, IkasImage, IkasThemeCustomData, IkasComponentRenderer, IkasBlogListParams, IkasBlogList, IkasBlogCategoryListParams, IkasBlogCategoryList, IkasRaffleList } from "../models";
7
+ import { IkasThemeSettings, IkasThemeComponentProp, IkasBrandListParams, IkasBrandList, IkasCategoryList, IkasProductList, IkasProductDetail, IkasAttributeDetail, IkasNavigationLink, IkasImage, IkasThemeCustomData, IkasComponentRenderer, IkasBlogListParams, IkasBlogList, IkasBlogCategoryListParams, IkasBlogCategoryList, IkasRaffleList, IkasSlider } from "../models";
8
8
  import { IkasPageComponentPropValue } from "./page-data-get";
9
9
  import { IkasAttributePropValueData } from "./prop-value/attribute";
10
10
  import { IkasAttributeListPropValueData } from "./prop-value/attribute-list";
@@ -61,4 +61,6 @@ export declare class IkasPageDataInit {
61
61
  static _initRafflePropValue(propValue: IkasRafflePropValueData): any;
62
62
  static initRaffleListPropValue(prop: IkasThemeComponentProp, propValue: any, pageComponentPropValue: IkasPageComponentPropValue): void;
63
63
  static _initRaffleListPropValue(propValue: IkasRaffleListParams): IkasRaffleList;
64
+ static initSliderPropValue(prop: IkasThemeComponentProp, propValue: any, pageComponentPropValue: IkasPageComponentPropValue): void;
65
+ static _initSliderPropValue(propValue: IkasSlider): IkasSlider;
64
66
  }