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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/build/__generated__/global-types.d.ts +10 -2
  2. package/build/__generated__/global-types.js +1 -1
  3. package/build/analytics/facebookPixel.js +1 -1
  4. package/build/analytics/googleTagManager.js +1 -1
  5. package/build/analytics/head/index.js +1 -1
  6. package/build/analytics/ikas.js +1 -1
  7. package/build/api/apollo.js +1 -1
  8. package/build/api/blog/__generated__/getBlog.d.ts +14 -16
  9. package/build/api/blog/__generated__/listBlog.d.ts +14 -16
  10. package/build/api/blog/__generated__/listBlogCategory.d.ts +14 -16
  11. package/build/api/blog/__generated__/listBlogMetaData.d.ts +14 -16
  12. package/build/api/brand/__generated__/listProductBrand.d.ts +3 -3
  13. package/build/api/cart/__generated__/getCart.d.ts +2 -4
  14. package/build/api/cart/__generated__/saveItemToCart.d.ts +2 -4
  15. package/build/api/category/__generated__/listCategory.d.ts +3 -3
  16. package/build/api/checkout/__generated__/getCheckoutById.d.ts +2 -4
  17. package/build/api/checkout/__generated__/getOrder.d.ts +5 -11
  18. package/build/api/checkout/__generated__/listCheckoutSettings.d.ts +1 -1
  19. package/build/api/checkout/index.js +1 -1
  20. package/build/api/customer/__generated__/createOrderRefundRequest.d.ts +5 -11
  21. package/build/api/customer/__generated__/customerLogin.d.ts +12 -5
  22. package/build/api/customer/__generated__/customerSocialLogin.d.ts +161 -0
  23. package/build/api/customer/__generated__/getCustomerOrders.d.ts +5 -11
  24. package/build/api/customer/__generated__/getMyCustomer.d.ts +4 -5
  25. package/build/api/customer/__generated__/registerCustomer.d.ts +12 -5
  26. package/build/api/customer/__generated__/saveMyCustomer.d.ts +12 -5
  27. package/build/api/customer/index.d.ts +5 -0
  28. package/build/api/customer/index.js +1 -1
  29. package/build/api/customer-review/__generated__/listCustomerReviews.d.ts +14 -16
  30. package/build/api/raffle/__generated__/getRafflesByCustomerId.d.ts +3 -0
  31. package/build/api/raffle/__generated__/listRaffle.d.ts +14 -16
  32. package/build/api/raffle/__generated__/saveRaffleParticipant.d.ts +2 -2
  33. package/build/api/raffle/index.d.ts +1 -1
  34. package/build/api/raffle/index.js +1 -1
  35. package/build/api/variant-type/__generated__/listVariantType.d.ts +3 -7
  36. package/build/components/checkout/components/address-form/index.js +1 -1
  37. package/build/components/checkout/components/address-form/model.d.ts +8 -0
  38. package/build/components/checkout/components/cart-summary/cart-item/index.js +1 -1
  39. package/build/components/checkout/components/cart-summary/index.js +1 -1
  40. package/build/components/checkout/components/step-container/index.js +1 -1
  41. package/build/components/checkout/index.js +1 -1
  42. package/build/components/checkout/model.d.ts +2 -0
  43. package/build/components/checkout/model.js +1 -1
  44. package/build/components/checkout/steps/step-payment/payment-gateways/index.js +1 -1
  45. package/build/components/checkout/steps/step-payment/payment-gateways/installments/index.js +1 -1
  46. package/build/components/checkout/steps/step-shipping/index.js +1 -1
  47. package/build/components/checkout/steps/step-success/index.js +1 -1
  48. package/build/components/index.d.ts +1 -1
  49. package/build/components/page/ThemeComponent.js +1 -1
  50. package/build/components/page/head.js +1 -1
  51. package/build/components/page/index.js +1 -1
  52. package/build/components/page-editor/ThemeComponentEditor.d.ts +0 -3
  53. package/build/components/page-editor/ThemeComponentEditor.js +1 -1
  54. package/build/components/page-editor/index.d.ts +3 -1
  55. package/build/components/page-editor/index.js +1 -1
  56. package/build/components/page-editor/loader/index.d.ts +5 -1
  57. package/build/components/page-editor/loader/index.js +1 -1
  58. package/build/components/page-editor/loader/style.module.scss.js +1 -1
  59. package/build/components/page-editor/model.d.ts +6 -4
  60. package/build/components/page-editor/model.js +1 -1
  61. package/build/ext/@apollo/client/cache/inmemory/entityStore.js +1 -1
  62. package/build/ext/@apollo/client/cache/inmemory/inMemoryCache.js +1 -1
  63. package/build/ext/@apollo/client/cache/inmemory/policies.js +1 -1
  64. package/build/ext/@apollo/client/cache/inmemory/readFromStore.js +1 -1
  65. package/build/ext/@apollo/client/cache/inmemory/writeToStore.js +1 -1
  66. package/build/ext/@apollo/client/core/ApolloClient.js +1 -1
  67. package/build/ext/@apollo/client/core/LocalState.js +1 -1
  68. package/build/ext/@apollo/client/core/ObservableQuery.js +1 -1
  69. package/build/ext/@apollo/client/core/QueryManager.js +1 -1
  70. package/build/ext/@apollo/client/errors/index.js +1 -1
  71. package/build/ext/@apollo/client/ext/tslib/tslib.es6.js +15 -0
  72. package/build/ext/@apollo/client/link/context/index.js +1 -1
  73. package/build/ext/@apollo/client/link/core/ApolloLink.js +1 -1
  74. package/build/ext/@apollo/client/link/error/index.js +1 -1
  75. package/build/ext/@apollo/client/link/http/HttpLink.js +1 -1
  76. package/build/ext/@apollo/client/link/http/createHttpLink.js +1 -1
  77. package/build/ext/@apollo/client/link/http/selectHttpOptionsAndBody.js +1 -1
  78. package/build/ext/@apollo/client/link/utils/createOperation.js +1 -1
  79. package/build/ext/@apollo/client/utilities/common/mergeDeep.js +1 -1
  80. package/build/ext/@apollo/client/utilities/graphql/fragments.js +1 -1
  81. package/build/ext/@apollo/client/utilities/graphql/transform.js +1 -1
  82. package/build/ext/@apollo/client/utilities/observables/Concast.js +1 -1
  83. package/build/ext/ts-invariant/ext/tslib/tslib.es6.js +15 -0
  84. package/build/ext/ts-invariant/lib/invariant.esm.js +1 -1
  85. package/build/ext/tslib/tslib.es6.js +1 -1
  86. package/build/ikas.js +67 -2
  87. package/build/index.d.ts +1 -0
  88. package/build/index.js +1 -1
  89. package/build/models/data/blog/index.js +1 -1
  90. package/build/models/data/brand/index.js +1 -1
  91. package/build/models/data/category/index.js +1 -1
  92. package/build/models/data/checkout/index.js +1 -1
  93. package/build/models/data/checkout-settings/index.d.ts +1 -1
  94. package/build/models/data/checkout-settings/index.js +1 -1
  95. package/build/models/data/customer/address/index.d.ts +4 -1
  96. package/build/models/data/customer/address/index.js +1 -1
  97. package/build/models/data/image/index.js +1 -1
  98. package/build/models/data/index.d.ts +1 -0
  99. package/build/models/data/language/index.d.ts +6 -0
  100. package/build/models/data/order/address/index.d.ts +2 -1
  101. package/build/models/data/order/address/index.js +1 -1
  102. package/build/models/data/order/index.js +1 -1
  103. package/build/models/data/order/line-item/variant/index.js +1 -1
  104. package/build/models/data/product/index.js +1 -1
  105. package/build/models/data/product-filter/index.js +1 -1
  106. package/build/models/data/product-option-set/index.d.ts +4 -0
  107. package/build/models/data/product-option-set/index.js +1 -1
  108. package/build/models/data/raffle/index.d.ts +2 -1
  109. package/build/models/data/raffle/index.js +1 -1
  110. package/build/models/data/slider/index.d.ts +5 -0
  111. package/build/models/data/slider/index.js +1 -0
  112. package/build/models/theme/component/index.d.ts +9 -0
  113. package/build/models/theme/component/index.js +1 -1
  114. package/build/models/theme/component/prop/index.d.ts +21 -0
  115. package/build/models/theme/component/prop/index.js +1 -1
  116. package/build/models/theme/custom-data/index.d.ts +20 -1
  117. package/build/models/theme/custom-data/index.js +1 -1
  118. package/build/models/theme/settings/color/index.d.ts +14 -0
  119. package/build/models/theme/settings/color/index.js +1 -0
  120. package/build/models/theme/settings/{prop/favicon → favicon}/index.d.ts +0 -0
  121. package/build/models/theme/settings/{prop/favicon → favicon}/index.js +0 -0
  122. package/build/models/theme/settings/font-family/index.d.ts +5 -0
  123. package/build/models/theme/settings/font-family/index.js +1 -0
  124. package/build/models/theme/settings/index.d.ts +4 -2
  125. package/build/models/theme/settings/index.js +1 -1
  126. package/build/models/ui/product-detail/index.js +1 -1
  127. package/build/models/ui/product-list/index.d.ts +1 -1
  128. package/build/models/ui/product-list/index.js +1 -1
  129. package/build/models/ui/validator/form/account-info.js +1 -1
  130. package/build/models/ui/validator/form/address.js +1 -1
  131. package/build/models/ui/validator/form/register.js +1 -1
  132. package/build/pages/checkout.js +1 -1
  133. package/build/pages/editor.d.ts +4 -3
  134. package/build/pages/editor.js +1 -1
  135. package/build/providers/page-data-get.d.ts +1 -1
  136. package/build/providers/page-data-get.js +1 -1
  137. package/build/providers/page-data-init.d.ts +3 -1
  138. package/build/providers/page-data-init.js +1 -1
  139. package/build/providers/page-data-next.d.ts +2 -1
  140. package/build/providers/page-data-next.js +1 -1
  141. package/build/providers/prop-value/custom.d.ts +1 -0
  142. package/build/providers/prop-value/custom.js +1 -1
  143. package/build/providers/prop-value/slider.d.ts +11 -0
  144. package/build/providers/prop-value/slider.js +1 -0
  145. package/build/scripts/generators/api/index.d.ts +3 -3
  146. package/build/scripts/generators/api/index.js +1 -0
  147. package/build/scripts/generators/api/info.d.ts +4 -4
  148. package/build/scripts/generators/api/info.js +1 -0
  149. package/build/scripts/generators/components/index.d.ts +4 -4
  150. package/build/scripts/generators/components/index.js +1 -0
  151. package/build/scripts/generators/config/content.d.ts +4 -3
  152. package/build/scripts/generators/config/content.js +1 -0
  153. package/build/scripts/generators/config/index.d.ts +6 -6
  154. package/build/scripts/generators/config/index.js +1 -0
  155. package/build/scripts/generators/index.d.ts +7 -0
  156. package/build/scripts/generators/pages/index.d.ts +4 -4
  157. package/build/scripts/generators/pages/index.js +1 -0
  158. package/build/scripts/generators/pages/info.js +1 -0
  159. package/build/scripts/generators/store/content.js +1 -0
  160. package/build/scripts/generators/store/index.d.ts +2 -2
  161. package/build/scripts/generators/store/index.js +1 -0
  162. package/build/scripts/generators/theme/index.d.ts +4 -4
  163. package/build/scripts/generators/theme/index.js +1 -0
  164. package/build/scripts/generators/types/index.d.ts +15 -0
  165. package/build/scripts/generators/types/index.js +1 -0
  166. package/build/store/cart.d.ts +6 -7
  167. package/build/store/cart.js +1 -1
  168. package/build/store/customer.d.ts +19 -0
  169. package/build/store/customer.js +1 -1
  170. package/build/storefront/index.d.ts +5 -3
  171. package/build/storefront/index.js +1 -1
  172. package/build/utils/fs.d.ts +2 -2
  173. package/build/utils/fs.js +1 -0
  174. package/build/utils/google-fonts.d.ts +2 -0
  175. package/build/utils/google-fonts.js +1 -0
  176. package/package.json +8 -7
  177. package/build/models/theme/settings/prop/color/index.d.ts +0 -7
  178. package/build/models/theme/settings/prop/color/index.js +0 -1
@@ -15,6 +15,25 @@ export declare class IkasCustomerStore {
15
15
  get canCreateEmailSubscription(): boolean;
16
16
  get customerConsentGranted(): boolean;
17
17
  login: (email: string, password: string) => Promise<boolean>;
18
+ /**
19
+ * Call it when click the social login button
20
+ * This will automaticly redirect to matched url.
21
+ * @param provider
22
+ * @returns undefined
23
+ */
24
+ socialLogin(provider: "facebook" | "google"): Promise<void>;
25
+ /**
26
+ * When user click the social login ex. facebook login. We navigate to backend.
27
+ * and backend navigate to provider. after user login into provider,
28
+ * backend redirect to account/login with following params;
29
+ * socialLoginStatus: success | fail
30
+ * socialLoginError: string
31
+ * socialLoginToken: string
32
+ * if query params includes socialLoginToken call this function to verify
33
+ * @param token
34
+ * @returns boolean
35
+ */
36
+ socialLoginToken(token: string): Promise<boolean>;
18
37
  register: (firstName: string, lastName: string, email: string, password: string, isMarketingAccepted?: boolean | undefined) => Promise<boolean>;
19
38
  saveContactForm: (input: IkasContactForm) => Promise<boolean | undefined>;
20
39
  checkEmail: (email: string) => Promise<boolean>;
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as e,__assign as r}from'../ext/tslib/tslib.es6.js';import{makeAutoObservable as i}from"mobx";import{apollo as o}from"../api/apollo.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{IkasCustomer as s,IkasCustomerEmailSubscriptionStatus as n}from"../models/data/customer/index.js";import"../models/data/customer-review/index.js";import"../models/data/html-meta-data/index.js";import"../models/data/image/index.js";import"../models/data/installment-info/index.js";import"../models/data/order/index.js";import"../models/data/order/line-item/index.js";import"../models/data/product/index.js";import"../models/data/variant-type/index.js";import"../models/data/product/variant/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product-attribute/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product-filter/index.js";import"../models/data/variant-type/variant-value/index.js";import"../models/data/order-transaction/index.js";import"../models/data/product-option-set/index.js";import"../models/data/raffle/index.js";import"../models/theme/theme.js";import"../models/theme/page/index.js";import"../models/theme/component/prop/index.js";import"../models/theme/page/component/prop-value/link.js";import"../models/ui/brand-list/index.js";import"../models/ui/blog-list/index.js";import"../models/ui/blog-category-list/index.js";import"../models/ui/category-list/index.js";import"../models/ui/product-detail/index.js";import"../models/ui/product-list/index.js";import"../models/ui/product-attribute-detail/index.js";import"../models/ui/product-attribute-list/index.js";import"../models/ui/customer-review-list/index.js";import"../models/ui/validator/index.js";import"../models/ui/validator/rules/index.js";import"../models/ui/validator/form/login.js";import"../models/ui/validator/form/address.js";import"../models/ui/validator/form/register.js";import"../models/ui/validator/form/contact-form.js";import"../models/ui/validator/form/forgot-password.js";import"../models/ui/validator/form/recover-password.js";import"../models/ui/validator/form/account-info.js";import"../models/ui/validator/form/raffle-form.js";import"../models/ui/validator/form/customer-review.js";import"../models/ui/raffle-list/index.js";import"../models/theme/settings/index.js";import"../models/theme/custom-data/index.js";import"../api/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{IkasCustomerAPI as a}from"../api/customer/index.js";import{IkasCustomerReviewAPI as u}from"../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 d}from"../api/product-search/index.js";import{IkasFavoriteProductAPI as c}from"../api/favorite-product/index.js";import{IkasContactFormAPI as l}from"../api/contact-form/index.js";import"../api/state/index.js";import"../api/product-option-set/index.js";import{IkasRaffleAPI as m}from"../api/raffle/index.js";import"../api/back-in-stock-reminder/index.js";import{Analytics as h}from"../analytics/analytics.js";import"react";import{IkasStorefrontConfig as p}from"../storefront/index.js";import'../ext/html-react-parser/index.js';import"../analytics/events.js";import{populateRaffleProducts as f}from"../providers/helpers/raffles.js";import v from'../ext/lodash/uniqBy.js';var w="undefined"==typeof localStorage,g=function(){function g(o){var s=this;this.customer=null,this.token=null,this.tokenExpiry=null,this.baseStore=null,this._initialized=!1,this._visitorSubscribedEmail=!1,this._lastViewedProducts=[],this._customerConsentGranted=!1,this._refundSettings=null,this.login=function(r,i){return t(s,void 0,void 0,(function(){var t,o,s;return e(this,(function(e){switch(e.label){case 0:return[4,a.login(r,i)];case 1:return(t=e.sent())?(this.setToken(t.token,t.tokenExpiry),this.setCustomer(t.customer),this.customer&&h.customerLogin(),(o=null===(s=this.baseStore)||void 0===s?void 0:s.cartStore.cart)?[4,this.baseStore.cartStore.changeItemQuantity(o.items[0],o.items[0].quantity)]:[3,3]):[3,4];case 2:e.sent(),e.label=3;case 3:return this.saveLocalLastViewedProducts(),[2,!0];case 4:return[2,!1]}}))}))},this.register=function(r,i,o,n,u){return t(s,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,a.register(o,n,r,i,u)];case 1:return(t=e.sent())?(this.setToken(t.token,t.tokenExpiry),this.setCustomer(t.customer),this.saveLocalLastViewedProducts(),[2,!0]):[2,!1]}}))}))},this.saveContactForm=function(r){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return h.contactForm(r),[4,l.sendContactFormToMerchant(r)];case 1:return[2,t.sent()]}}))}))},this.checkEmail=function(r){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,a.checkEmail(r)];case 1:return[2,t.sent()]}}))}))},this.forgotPassword=function(r){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,a.forgotPassword(r)];case 1:return[2,t.sent()]}}))}))},this.recoverPassword=function(r,i,o){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,a.recoverPassword(r,i,o)];case 1:return[2,t.sent()]}}))}))},this.logout=function(){var t;s.clearLocalData(),null===(t=s.baseStore)||void 0===t||t.cartStore.removeCart(),h.customerLogout()},this.saveCustomer=function(r){return t(s,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,a.saveCustomer(r)];case 1:return(t=e.sent())?(this.setCustomer(t),[2,!0]):[2,!1]}}))}))},this.getOrders=function(){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,a.getOrders()];case 1:return[2,t.sent()]}}))}))},this.getOrder=function(r){return t(s,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return[4,a.getOrders(r)];case 1:return t=e.sent(),Array.isArray(t)&&t.length?((i=t[0])._refundSettings=this._refundSettings,[2,i]):[2,null]}}))}))},this.getOrderTransactions=function(r){return void 0===r&&(r={}),t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,a.getOrderTransactions(r)];case 1:return[2,t.sent()]}}))}))},this.getFavoriteProductsIds=function(){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,c.listFavoriteProducts()];case 1:return[2,t.sent()];case 2:return t.sent(),[2,[]];case 3:return[2]}}))}))},this.getFavoriteProducts=function(){return t(s,void 0,void 0,(function(){var t,r;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),[4,c.listFavoriteProducts()];case 1:return(t=e.sent()).length?[4,d.searchProducts({productIdList:t.map((function(t){return t.productId})),priceListId:p.priceListId,salesChannelId:p.salesChannelId})]:[2,[]];case 2:return[2,(null==(r=e.sent())?void 0:r.data)||[]];case 3:return e.sent(),[2,[]];case 4:return[2]}}))}))},this.getOrderRefundSettings=function(){return t(s,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return this._refundSettings?[3,2]:(t=this,[4,a.getOrderRefundSettings()]);case 1:t._refundSettings=e.sent(),e.label=2;case 2:return[2]}}))}))},this.addItemToFavorite=function(r){return t(s,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:if(!(null===(i=this.customer)||void 0===i?void 0:i.id))throw Error("Unauthorized");e.label=1;case 1:return e.trys.push([1,3,,4]),[4,c.saveFavoriteProduct(!0,r)];case 2:return t=e.sent(),h.addToWishlist(r),[2,t];case 3:return e.sent(),[2,!1];case 4:return[2]}}))}))},this.removeItemFromFavorite=function(r){return t(s,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:if(!(null===(t=this.customer)||void 0===t?void 0:t.id))throw Error("Unauthorized");e.label=1;case 1:return e.trys.push([1,3,,4]),[4,c.saveFavoriteProduct(!1,r)];case 2:return[2,e.sent()];case 3:return e.sent(),[2,!1];case 4:return[2]}}))}))},this.isProductFavorite=function(r){return t(s,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:if(!(null===(t=this.customer)||void 0===t?void 0:t.id))throw Error("Unauthorized");return[4,c.isFavoriteProduct(r)];case 1:return[2,e.sent()]}}))}))},this.createEmailSubscription=function(r){return t(s,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,a.createCustomerEmailSubscription(r)];case 1:return(t=e.sent())&&(window.localStorage.setItem("customerEmailSubscription","true"),this.customer?(this.customer.subscriptionStatus,n.SUBSCRIBED):this._visitorSubscribedEmail=!0),[2,t]}}))}))},this.sendReview=function(i){return t(s,void 0,void 0,(function(){var t,o,s,n,a;return e(this,(function(e){switch(e.label){case 0:if(e.trys.push([0,2,,3]),t=p.customerReviewSettings,o=p.salesChannelId,!t)return[2];if(!(s=null===(a=this.customer)||void 0===a?void 0:a.id)&&t.customerLoginRequired)throw Error("Unauthorized");return[4,u.createCustomerReview(r(r({},i),{customerId:t.customerLoginRequired?s:void 0,salesChannelId:o||""}))];case 1:return[2,e.sent()];case 2:return n=e.sent(),console.log(n),[3,3];case 3:return[2]}}))}))},this.onCustomerConsentGrant=function(){s.saveCustomerConsent()},this.waitUntilInitialized=function(){return new Promise((function(t){var e=setInterval((function(){s.initialized&&(clearInterval(e),t(null))}),100)}))},this.getRaffles=function(){return t(s,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,m.getRafflesByCustomerId()];case 1:return(t=e.sent())?[4,f(t)]:[3,3];case 2:e.sent(),e.label=3;case 3:return[2,t]}}))}))},this.baseStore=o,this.init(),i(this)}return Object.defineProperty(g.prototype,"initialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"canCreateEmailSubscription",{get:function(){var t;return!((null===(t=this.customer)||void 0===t?void 0:t.isSubscribed)||w||this._visitorSubscribedEmail)&&!window.localStorage.getItem("customerEmailSubscription")},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"customerConsentGranted",{get:function(){return this._customerConsentGranted},enumerable:!1,configurable:!0}),g.prototype.init=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return this.loadToken(),this.loadLastViewedProducts(),this.loadCustomerConsent(),[4,this.refreshToken()];case 1:return t.sent(),[4,this.getCustomer()];case 2:return t.sent(),[4,this.getOrderRefundSettings()];case 3:return t.sent(),this._initialized=!0,this.customer&&h.customerVisit(),[2]}}))}))},g.prototype.routeChangeInit=function(){this.customer||(this.loadToken(),this.getCustomer())},g.prototype.getCustomer=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return w||!this.token?[2]:[4,a.getCustomer()];case 1:return(t=e.sent())&&this.setCustomer(t),[2]}}))}))},g.prototype.refreshToken=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return this.token?[4,a.refreshToken(this.token)]:[2];case 1:return(null==(t=e.sent())?void 0:t.token)||(null==t?void 0:t.tokenExpiry)?this.setToken(t.token,t.tokenExpiry):(this.token=null,this.tokenExpiry=null,this.clearLocalData()),[2]}}))}))},g.prototype.setCustomer=function(t){this.customer=new s(t)},g.prototype.getLastViewedProducts=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return this.customer?(t=this,[4,a.getLastViewedProducts(this.customer.id)]):[3,2];case 1:return t._lastViewedProducts=e.sent(),[3,3];case 2:this.loadLastViewedProducts(),e.label=3;case 3:return[2,this._lastViewedProducts]}}))}))},g.prototype.saveLastViewedProducts=function(){w||window.localStorage.setItem("lastViewedProducts",JSON.stringify(this._lastViewedProducts))},g.prototype.loadLastViewedProducts=function(){if(!w)try{var t=window.localStorage.getItem("lastViewedProducts");t&&(this._lastViewedProducts=JSON.parse(t),this._lastViewedProducts=this._lastViewedProducts.reverse(),this._lastViewedProducts=v(this._lastViewedProducts,"variantId"))}catch(t){}},g.prototype.removeLastViewedProducts=function(){w||window.localStorage.removeItem("lastViewedProducts")},g.prototype.onProductView=function(r,i){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return this.customer?this._lastViewedProducts.find((function(t){return t.productId===r}))?[2]:[4,a.saveLastViewedProducts({customerId:this.customer.id,products:[{productId:r,variantId:i}]})]:[3,2];case 1:return t.sent()&&this._lastViewedProducts.push({productId:r,variantId:i}),[3,3];case 2:this._lastViewedProducts.push({productId:r,variantId:i}),this._lastViewedProducts=this._lastViewedProducts.slice(0,20),this._lastViewedProducts=v(this._lastViewedProducts,"variantId"),this.saveLastViewedProducts(),t.label=3;case 3:return[2]}}))}))},g.prototype.saveLocalLastViewedProducts=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:if(w)return[2];t.label=1;case 1:return t.trys.push([1,4,,5]),this.loadLastViewedProducts(),this._lastViewedProducts.length?[4,a.saveLastViewedProducts({customerId:this.customer.id,products:this._lastViewedProducts})]:[3,3];case 2:t.sent()&&this.removeLastViewedProducts(),t.label=3;case 3:return[3,5];case 4:return t.sent(),[3,5];case 5:return[2]}}))}))},g.prototype.saveCustomerConsent=function(){w||(this._customerConsentGranted=!0,window.localStorage.setItem("customerConsent","true"))},g.prototype.loadCustomerConsent=function(){w||(this._customerConsentGranted=!!window.localStorage.getItem("customerConsent"))},g.prototype.removeCustomerConsent=function(){w||window.localStorage.removeItem("customerConsent")},g.prototype.setToken=function(t,e){w||(this.token=t,this.tokenExpiry=e,localStorage.setItem("customerToken",t),localStorage.setItem("customerTokenExpiry",e+""),o.setCustomerToken(t))},g.prototype.loadToken=function(){if(!w){var t=localStorage.getItem("customerToken"),e=localStorage.getItem("customerTokenExpiry");t&&e&&this.setToken(t,parseInt(e))}},g.prototype.clearLocalTokenData=function(){localStorage.removeItem("customerToken"),localStorage.removeItem("customerTokenExpiry"),this.token=void 0,this.tokenExpiry=void 0},g.prototype.clearLocalData=function(){this.clearLocalTokenData(),this.customer=void 0,o.setCustomerToken()},g}();export{g as IkasCustomerStore};
1
+ import{__awaiter as t,__generator as e,__assign as r}from'../ext/tslib/tslib.es6.js';import{makeAutoObservable as i}from"mobx";import{apollo as o}from"../api/apollo.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{IkasCustomer as s,IkasCustomerEmailSubscriptionStatus as n}from"../models/data/customer/index.js";import"../models/data/customer-review/index.js";import"../models/data/html-meta-data/index.js";import"../models/data/image/index.js";import"../models/data/installment-info/index.js";import"../models/data/order/index.js";import"../models/data/order/line-item/index.js";import"../models/data/product/index.js";import"../models/data/variant-type/index.js";import"../models/data/product/variant/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product-attribute/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product-filter/index.js";import"../models/data/variant-type/variant-value/index.js";import"../models/data/order-transaction/index.js";import"../models/data/product-option-set/index.js";import"../models/data/raffle/index.js";import"../models/theme/theme.js";import"../models/theme/page/index.js";import"../models/theme/component/prop/index.js";import"../models/theme/page/component/prop-value/link.js";import"../models/ui/brand-list/index.js";import"../models/ui/blog-list/index.js";import"../models/ui/blog-category-list/index.js";import"../models/ui/category-list/index.js";import"../models/ui/product-detail/index.js";import"../models/ui/product-list/index.js";import"../models/ui/product-attribute-detail/index.js";import"../models/ui/product-attribute-list/index.js";import"../models/ui/customer-review-list/index.js";import"../models/ui/validator/index.js";import"../models/ui/validator/rules/index.js";import"../models/ui/validator/form/login.js";import"../models/ui/validator/form/address.js";import"../models/ui/validator/form/register.js";import"../models/ui/validator/form/contact-form.js";import"../models/ui/validator/form/forgot-password.js";import"../models/ui/validator/form/recover-password.js";import"../models/ui/validator/form/account-info.js";import"../models/ui/validator/form/raffle-form.js";import"../models/ui/validator/form/customer-review.js";import"../models/ui/raffle-list/index.js";import"../models/theme/settings/index.js";import"../models/theme/custom-data/index.js";import"../api/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{IkasCustomerAPI as a}from"../api/customer/index.js";import{IkasCustomerReviewAPI as u}from"../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 c}from"../api/product-search/index.js";import{IkasFavoriteProductAPI as d}from"../api/favorite-product/index.js";import{IkasContactFormAPI as l}from"../api/contact-form/index.js";import"../api/state/index.js";import"../api/product-option-set/index.js";import{IkasRaffleAPI as m}from"../api/raffle/index.js";import"../api/back-in-stock-reminder/index.js";import{Analytics as h}from"../analytics/analytics.js";import"../analytics/head/index.js";import{IkasStorefrontConfig as p}from"../storefront/index.js";import{populateRaffleProducts as f}from"../providers/helpers/raffles.js";import v from'../ext/lodash/uniqBy.js';var w="undefined"==typeof localStorage,g=function(){function g(o){var s=this;this.customer=null,this.token=null,this.tokenExpiry=null,this.baseStore=null,this._initialized=!1,this._visitorSubscribedEmail=!1,this._lastViewedProducts=[],this._customerConsentGranted=!1,this._refundSettings=null,this.login=function(r,i){return t(s,void 0,void 0,(function(){var t,o,s;return e(this,(function(e){switch(e.label){case 0:return[4,a.login(r,i)];case 1:return(t=e.sent())?(this.setToken(t.token,t.tokenExpiry),this.setCustomer(t.customer),this.customer&&h.customerLogin(),(o=null===(s=this.baseStore)||void 0===s?void 0:s.cartStore.cart)?[4,this.baseStore.cartStore.changeItemQuantity(o.items[0],o.items[0].quantity)]:[3,3]):[3,4];case 2:e.sent(),e.label=3;case 3:return this.saveLocalLastViewedProducts(),[2,!0];case 4:return[2,!1]}}))}))},this.register=function(r,i,o,n,u){return t(s,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,a.register(o,n,r,i,u)];case 1:return(t=e.sent())?(this.setToken(t.token,t.tokenExpiry),this.setCustomer(t.customer),this.saveLocalLastViewedProducts(),[2,!0]):[2,!1]}}))}))},this.saveContactForm=function(r){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return h.contactForm(r),[4,l.sendContactFormToMerchant(r)];case 1:return[2,t.sent()]}}))}))},this.checkEmail=function(r){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,a.checkEmail(r)];case 1:return[2,t.sent()]}}))}))},this.forgotPassword=function(r){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,a.forgotPassword(r)];case 1:return[2,t.sent()]}}))}))},this.recoverPassword=function(r,i,o){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,a.recoverPassword(r,i,o)];case 1:return[2,t.sent()]}}))}))},this.logout=function(){var t;s.clearLocalData(),null===(t=s.baseStore)||void 0===t||t.cartStore.removeCart(),h.customerLogout()},this.saveCustomer=function(r){return t(s,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,a.saveCustomer(r)];case 1:return(t=e.sent())?(this.setCustomer(t),[2,!0]):[2,!1]}}))}))},this.getOrders=function(){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,a.getOrders()];case 1:return[2,t.sent()]}}))}))},this.getOrder=function(r){return t(s,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return[4,a.getOrders(r)];case 1:return t=e.sent(),Array.isArray(t)&&t.length?((i=t[0])._refundSettings=this._refundSettings,[2,i]):[2,null]}}))}))},this.getOrderTransactions=function(r){return void 0===r&&(r={}),t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,a.getOrderTransactions(r)];case 1:return[2,t.sent()]}}))}))},this.getFavoriteProductsIds=function(){return t(s,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,d.listFavoriteProducts()];case 1:return[2,t.sent()];case 2:return t.sent(),[2,[]];case 3:return[2]}}))}))},this.getFavoriteProducts=function(){return t(s,void 0,void 0,(function(){var t,r;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),[4,d.listFavoriteProducts()];case 1:return(t=e.sent()).length?[4,c.searchProducts({productIdList:t.map((function(t){return t.productId})),priceListId:p.priceListId,salesChannelId:p.salesChannelId})]:[2,[]];case 2:return[2,(null==(r=e.sent())?void 0:r.data)||[]];case 3:return e.sent(),[2,[]];case 4:return[2]}}))}))},this.getOrderRefundSettings=function(){return t(s,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return this._refundSettings?[3,2]:(t=this,[4,a.getOrderRefundSettings()]);case 1:t._refundSettings=e.sent(),e.label=2;case 2:return[2]}}))}))},this.addItemToFavorite=function(r){return t(s,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:if(!(null===(i=this.customer)||void 0===i?void 0:i.id))throw Error("Unauthorized");e.label=1;case 1:return e.trys.push([1,3,,4]),[4,d.saveFavoriteProduct(!0,r)];case 2:return t=e.sent(),h.addToWishlist(r),[2,t];case 3:return e.sent(),[2,!1];case 4:return[2]}}))}))},this.removeItemFromFavorite=function(r){return t(s,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:if(!(null===(t=this.customer)||void 0===t?void 0:t.id))throw Error("Unauthorized");e.label=1;case 1:return e.trys.push([1,3,,4]),[4,d.saveFavoriteProduct(!1,r)];case 2:return[2,e.sent()];case 3:return e.sent(),[2,!1];case 4:return[2]}}))}))},this.isProductFavorite=function(r){return t(s,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:if(!(null===(t=this.customer)||void 0===t?void 0:t.id))throw Error("Unauthorized");return[4,d.isFavoriteProduct(r)];case 1:return[2,e.sent()]}}))}))},this.createEmailSubscription=function(r){return t(s,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,a.createCustomerEmailSubscription(r)];case 1:return(t=e.sent())&&(window.localStorage.setItem("customerEmailSubscription","true"),this.customer?(this.customer.subscriptionStatus,n.SUBSCRIBED):this._visitorSubscribedEmail=!0),[2,t]}}))}))},this.sendReview=function(i){return t(s,void 0,void 0,(function(){var t,o,s,n,a;return e(this,(function(e){switch(e.label){case 0:if(e.trys.push([0,2,,3]),t=p.customerReviewSettings,o=p.salesChannelId,!t)return[2];if(!(s=null===(a=this.customer)||void 0===a?void 0:a.id)&&t.customerLoginRequired)throw Error("Unauthorized");return[4,u.createCustomerReview(r(r({},i),{customerId:t.customerLoginRequired?s:void 0,salesChannelId:o||""}))];case 1:return[2,e.sent()];case 2:return n=e.sent(),console.log(n),[3,3];case 3:return[2]}}))}))},this.onCustomerConsentGrant=function(){s.saveCustomerConsent()},this.waitUntilInitialized=function(){return new Promise((function(t){var e=setInterval((function(){s.initialized&&(clearInterval(e),t(null))}),100)}))},this.getRaffles=function(){return t(s,void 0,void 0,(function(){var t,r;return e(this,(function(e){switch(e.label){case 0:return[4,m.getRafflesByCustomerId()];case 1:return t=e.sent(),[4,m.getRafflesByCustomerId(!0)];case 2:return r=e.sent(),null==t||t.forEach((function(t){(null==r?void 0:r.find((function(e){return e.id===t.id})))&&(t.isCustomerWinner=!0)})),t?[4,f(t)]:[3,4];case 3:e.sent(),e.label=4;case 4:return[2,t]}}))}))},this.baseStore=o,this.init(),i(this)}return Object.defineProperty(g.prototype,"initialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"canCreateEmailSubscription",{get:function(){var t;return!((null===(t=this.customer)||void 0===t?void 0:t.isSubscribed)||w||this._visitorSubscribedEmail)&&!window.localStorage.getItem("customerEmailSubscription")},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"customerConsentGranted",{get:function(){return this._customerConsentGranted},enumerable:!1,configurable:!0}),g.prototype.socialLogin=function(r){return t(this,void 0,void 0,(function(){var t,i,o;return e(this,(function(e){switch(e.label){case 0:return"undefined"==typeof window?[2]:(t=new URLSearchParams(window.location.search).get("redirect")||"",i="".concat(process.env.NEXT_PUBLIC_BASE_URL,"/ms/").concat(r,"/login/authenticate?redirect=").concat(t),[4,fetch(i,{headers:{"x-api-key":p.config.apiKey||"","x-sfid":p.storefrontId||"","x-sfrid":p.storefrontRoutingId||""}})]);case 1:return[4,e.sent().json()];case 2:return o=e.sent(),p.router?p.router.replace(o.redirectUrl):window.location.href=o.redirectUrl,[2]}}))}))},g.prototype.socialLoginToken=function(r){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,a.socialLogin(r)];case 1:return(null==(t=e.sent())?void 0:t.customer)?(this.setToken(t.token,t.tokenExpiry),this.setCustomer(t.customer),this.customer&&h.customerLogin(),[2,!0]):[2,!1]}}))}))},g.prototype.init=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return this.loadToken(),this.loadLastViewedProducts(),this.loadCustomerConsent(),[4,this.refreshToken()];case 1:return t.sent(),[4,this.getCustomer()];case 2:return t.sent(),[4,this.getOrderRefundSettings()];case 3:return t.sent(),this._initialized=!0,this.customer&&h.customerVisit(),[2]}}))}))},g.prototype.routeChangeInit=function(){this.customer||(this.loadToken(),this.getCustomer())},g.prototype.getCustomer=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return w||!this.token?[2]:[4,a.getCustomer()];case 1:return(t=e.sent())&&this.setCustomer(t),[2]}}))}))},g.prototype.refreshToken=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return this.token?[4,a.refreshToken(this.token)]:[2];case 1:return(null==(t=e.sent())?void 0:t.token)||(null==t?void 0:t.tokenExpiry)?this.setToken(t.token,t.tokenExpiry):(this.token=null,this.tokenExpiry=null,this.clearLocalData()),[2]}}))}))},g.prototype.setCustomer=function(t){this.customer=new s(t)},g.prototype.getLastViewedProducts=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return this.customer?(t=this,[4,a.getLastViewedProducts(this.customer.id)]):[3,2];case 1:return t._lastViewedProducts=e.sent(),[3,3];case 2:this.loadLastViewedProducts(),e.label=3;case 3:return[2,this._lastViewedProducts]}}))}))},g.prototype.saveLastViewedProducts=function(){w||window.localStorage.setItem("lastViewedProducts",JSON.stringify(this._lastViewedProducts))},g.prototype.loadLastViewedProducts=function(){if(!w)try{var t=window.localStorage.getItem("lastViewedProducts");t&&(this._lastViewedProducts=JSON.parse(t),this._lastViewedProducts=this._lastViewedProducts.reverse(),this._lastViewedProducts=v(this._lastViewedProducts,"variantId"))}catch(t){}},g.prototype.removeLastViewedProducts=function(){w||window.localStorage.removeItem("lastViewedProducts")},g.prototype.onProductView=function(r,i){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return this.customer?this._lastViewedProducts.find((function(t){return t.productId===r}))?[2]:[4,a.saveLastViewedProducts({customerId:this.customer.id,products:[{productId:r,variantId:i}]})]:[3,2];case 1:return t.sent()&&this._lastViewedProducts.push({productId:r,variantId:i}),[3,3];case 2:this._lastViewedProducts.push({productId:r,variantId:i}),this._lastViewedProducts=this._lastViewedProducts.slice(0,20),this._lastViewedProducts=v(this._lastViewedProducts,"variantId"),this.saveLastViewedProducts(),t.label=3;case 3:return[2]}}))}))},g.prototype.saveLocalLastViewedProducts=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:if(w)return[2];t.label=1;case 1:return t.trys.push([1,4,,5]),this.loadLastViewedProducts(),this._lastViewedProducts.length?[4,a.saveLastViewedProducts({customerId:this.customer.id,products:this._lastViewedProducts})]:[3,3];case 2:t.sent()&&this.removeLastViewedProducts(),t.label=3;case 3:return[3,5];case 4:return t.sent(),[3,5];case 5:return[2]}}))}))},g.prototype.saveCustomerConsent=function(){w||(this._customerConsentGranted=!0,window.localStorage.setItem("customerConsent","true"))},g.prototype.loadCustomerConsent=function(){w||(this._customerConsentGranted=!!window.localStorage.getItem("customerConsent"))},g.prototype.removeCustomerConsent=function(){w||window.localStorage.removeItem("customerConsent")},g.prototype.setToken=function(t,e){w||(this.token=t,this.tokenExpiry=e,localStorage.setItem("customerToken",t),localStorage.setItem("customerTokenExpiry",e+""),o.setCustomerToken(t))},g.prototype.loadToken=function(){if(!w){var t=localStorage.getItem("customerToken"),e=localStorage.getItem("customerTokenExpiry");t&&e&&this.setToken(t,parseInt(e))}},g.prototype.clearLocalTokenData=function(){localStorage.removeItem("customerToken"),localStorage.removeItem("customerTokenExpiry"),this.token=void 0,this.tokenExpiry=void 0},g.prototype.clearLocalData=function(){this.clearLocalTokenData(),this.customer=void 0,o.setCustomerToken()},g}();export{g as IkasCustomerStore};
@@ -2,13 +2,15 @@ import { IkasProductBackInStockSettings } from "../models/data/product-back-in-s
2
2
  import { IkasSalesChannelPaymentGateway } from "../models/data/sales-channel";
3
3
  import { IkasStorefrontRouting } from "../models/data/storefront/routing";
4
4
  import { IkasThemeStockPreference } from "../models/theme/settings";
5
- import { IkasThemeFavicon } from "../models/theme/settings/prop/favicon";
5
+ import { IkasThemeFavicon } from "../models/theme/settings/favicon";
6
6
  import { IkasBaseStore } from "../store";
7
7
  import { IkasCustomerReviewSettings } from "../models";
8
+ import { NextRouter } from "next/router";
8
9
  export declare class IkasStorefrontConfig {
9
10
  static store: IkasBaseStore;
10
11
  static config: Record<string, any>;
11
12
  static apiUrlOverride: string | null;
13
+ static router?: NextRouter;
12
14
  static domain: string;
13
15
  static storefrontId?: string;
14
16
  static storefrontRoutingId?: string;
@@ -24,12 +26,12 @@ export declare class IkasStorefrontConfig {
24
26
  static stockPreference: IkasThemeStockPreference;
25
27
  static translations: Record<string, any>;
26
28
  static storefrontJSScripts: string[];
27
- static isEditor: boolean;
28
29
  static customerReviewSettings: IkasCustomerReviewSettings | null;
29
30
  static productBackInStockSettings: IkasProductBackInStockSettings | null;
31
+ static isEditor: boolean;
30
32
  static currentPageComponents?: Record<string, any>;
31
33
  static init(store: IkasBaseStore, config: Record<string, any>, apiUrlOverride?: string): void;
32
- static initWithJson(json: Record<string, any>): void;
34
+ static initWithJson(json: Record<string, any>, router: NextRouter): void;
33
35
  static getCurrentLocale(): string;
34
36
  static getJson(): {
35
37
  domain: string;
@@ -1 +1 @@
1
- var t=function(){function t(){}return t.init=function(n,o,r){t.store=n,t.config=o,t.apiUrlOverride=r||null,"local"===process.env.NEXT_PUBLIC_ENV&&(this.storefrontId=o.storefrontId)},t.initWithJson=function(n){try{Object.entries(n).forEach((function(n){var o=n[0],r=n[1];t[o]=r}))}catch(t){console.log(t)}},t.getCurrentLocale=function(){var n;return(null===(n=t.routings.find((function(n){return n.id===t.storefrontRoutingId})))||void 0===n?void 0:n.locale)||"en"},t.getJson=function(){return{domain:t.domain,storefrontId:t.storefrontId||null,storefrontRoutingId:t.storefrontRoutingId||null,storefrontThemeId:t.storefrontThemeId||null,salesChannelId:t.salesChannelId||null,priceListId:t.priceListId||null,stockLocationIds:t.stockLocationIds||null,routings:JSON.parse(JSON.stringify(t.routings))||null,paymentGateways:JSON.parse(JSON.stringify(t.paymentGateways))||null,gtmId:t.gtmId||null,fbpId:t.fbpId||null,favicon:JSON.parse(JSON.stringify(t.favicon)),stockPreference:t.stockPreference||null,storefrontJSScripts:t.storefrontJSScripts||[],translations:this.translations,customerReviewSettings:t.customerReviewSettings,productBackInStockSettings:t.productBackInStockSettings?JSON.parse(JSON.stringify(t.productBackInStockSettings)):null}},t.config={},t.apiUrlOverride=null,t.routings=[],t.paymentGateways=[],t.translations={},t.storefrontJSScripts=[],t.isEditor=!1,t}();export{t as IkasStorefrontConfig};
1
+ var t=function(){function t(){}return t.init=function(n,r,o){t.store=n,t.config=r,t.apiUrlOverride=o||null,"local"===process.env.NEXT_PUBLIC_ENV&&(this.storefrontId=r.storefrontId)},t.initWithJson=function(n,r){try{Object.entries(n).forEach((function(n){var r=n[0],o=n[1];t[r]=o})),t.router=r}catch(t){console.log(t)}},t.getCurrentLocale=function(){var n;return(null===(n=t.routings.find((function(n){return n.id===t.storefrontRoutingId})))||void 0===n?void 0:n.locale)||"en"},t.getJson=function(){return{domain:t.domain,storefrontId:t.storefrontId||null,storefrontRoutingId:t.storefrontRoutingId||null,storefrontThemeId:t.storefrontThemeId||null,salesChannelId:t.salesChannelId||null,priceListId:t.priceListId||null,stockLocationIds:t.stockLocationIds||null,routings:JSON.parse(JSON.stringify(t.routings))||null,paymentGateways:JSON.parse(JSON.stringify(t.paymentGateways))||null,gtmId:t.gtmId||null,fbpId:t.fbpId||null,favicon:JSON.parse(JSON.stringify(t.favicon)),stockPreference:t.stockPreference||null,storefrontJSScripts:t.storefrontJSScripts||[],translations:this.translations,customerReviewSettings:t.customerReviewSettings,productBackInStockSettings:t.productBackInStockSettings?JSON.parse(JSON.stringify(t.productBackInStockSettings)):null}},t.config={},t.apiUrlOverride=null,t.routings=[],t.paymentGateways=[],t.translations={},t.storefrontJSScripts=[],t.isEditor=!1,t}();export{t as IkasStorefrontConfig};
@@ -16,7 +16,7 @@ export declare function getFilePathParts(path: string): {
16
16
  *
17
17
  * @returns true for successfull operation, false otherwise
18
18
  */
19
- export declare function deleteDirContent(dirPath: string, ignoreFiles?: string[]): boolean;
19
+ export declare function deleteDirContent(dirPath: string, ignoreFiles?: string[]): Promise<boolean>;
20
20
  /**
21
21
  * Creates the given file and directories for the filePath
22
22
  * @param basePath Base directory path for the file
@@ -25,4 +25,4 @@ export declare function deleteDirContent(dirPath: string, ignoreFiles?: string[]
25
25
  *
26
26
  * @returns true for successfull operation, false otherwise
27
27
  */
28
- export declare function createFile(basePath: string, fileSubPath: string, fileStr: string): boolean;
28
+ export declare function createFile(basePath: string, fileSubPath: string, fileStr: string): Promise<boolean>;
@@ -0,0 +1 @@
1
+ import{__awaiter as r,__generator as t,__spreadArray as n}from'../ext/tslib/tslib.es6.js';import i from"fs";import e from"path";function o(r){var t=r.split("/");return t.length>1?{dirParts:t.slice(0,t.length-1),filePart:t[t.length-1]}:{filePart:r}}function u(n,o){return r(this,void 0,void 0,(function(){return t(this,(function(r){try{return i.readdirSync(n).forEach((function(r){(null==o?void 0:o.includes(r))||i.unlinkSync(e.join(n,r))})),[2,!0]}catch(r){return[2,!1]}return[2]}))}))}function c(u,c,l){var s;return r(this,void 0,void 0,(function(){var r,d,f;return t(this,(function(t){try{return r=u,d=o(c),(null===(s=d.dirParts)||void 0===s?void 0:s.length)&&(r=e.join.apply(e,n([r],d.dirParts,!1))),i.existsSync(r)||i.mkdirSync(r,{recursive:!0}),f=e.join(r,d.filePart),i.writeFileSync(f,l),[2,!0]}catch(r){return console.error(r),[2,!1]}return[2]}))}))}export{c as createFile,u as deleteDirContent,o as getFilePathParts};
@@ -0,0 +1,2 @@
1
+ import { IkasThemeFontFamily } from "src/models/theme/settings/font-family";
2
+ export declare const getGoogleFontHref: (fontFamily: IkasThemeFontFamily) => string | undefined;
@@ -0,0 +1 @@
1
+ var a=function(a){if(a.name){var t=a.name.replace(/ /g,"+"),e="";if(a.variants){e+=":";var r=a.variants.some((function(a){return"italic"===a}));if(r&&(e+="ital,"),e+="wght@",r){var n=new RegExp("italic","i");e+=a.variants.reduce((function(a,t){return n.test(t)?a:a+"0,".concat(t.replace("regular","400"),";")}),""),e+=a.variants.reduce((function(a,t){return n.test(t)?a+"1,".concat("italic"===t?"400":t.replace("italic",""),";"):a}),"")}else e+=a.variants.reduce((function(a,t){return a+"".concat(t.replace("regular","400"),";")}),"");e=e.substring(0,e.length-1),e+="&display=swap"}return"https://fonts.googleapis.com/css2?family=".concat(t).concat(e)}};export{a as getGoogleFontHref};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "2.0.0-alpha.2",
3
+ "version": "2.0.0-alpha.21",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.js",
6
6
  "author": "Umut Ozan Yıldırım",
@@ -23,7 +23,7 @@
23
23
  "peerDependencies": {
24
24
  "mobx": "^6.1.3",
25
25
  "mobx-react-lite": "^3.1.5",
26
- "next": "12.0.4",
26
+ "next": "12.0.7",
27
27
  "react": "17.0.2",
28
28
  "react-dom": "17.0.2"
29
29
  },
@@ -34,7 +34,6 @@
34
34
  "axios": "^0.21.0",
35
35
  "command-line-args": "^5.2.0",
36
36
  "cors": "^2.8.5",
37
- "fs-extra": "^10.0.0",
38
37
  "graphql": "^15.3.0",
39
38
  "graphql-tag": "^2.10.3",
40
39
  "html-react-parser": "^1.4.0",
@@ -54,7 +53,6 @@
54
53
  "@types/archiver": "^5.1.0",
55
54
  "@types/command-line-args": "^5.2.0",
56
55
  "@types/cors": "^2.8.9",
57
- "@types/fs-extra": "^9.0.13",
58
56
  "@types/jest": "^26.0.14",
59
57
  "@types/lodash": "^4.14.168",
60
58
  "@types/node": "^14.14.6",
@@ -76,7 +74,7 @@
76
74
  "jest": "^26.4.2",
77
75
  "mobx": "^6.1.3",
78
76
  "mobx-react-lite": "^3.1.5",
79
- "next": "11.1.2",
77
+ "next": "12.0.7",
80
78
  "postcss": "^8.4.4",
81
79
  "prettier": "^2.2.1",
82
80
  "react": "17.0.2",
@@ -90,12 +88,15 @@
90
88
  "rollup-plugin-rename-node-modules": "^1.2.0",
91
89
  "rollup-plugin-terser": "^7.0.2",
92
90
  "rollup-plugin-typescript": "^1.0.1",
93
- "rollup-plugin-typescript2": "^0.29.0",
91
+ "rollup-plugin-typescript2": "^0.31.1",
94
92
  "sass": "^1.44.0",
93
+ "rollup-watch": "^4.3.1",
95
94
  "ts-essentials": "^7.0.1",
96
95
  "ts-jest": "^26.4.0",
96
+ "ts-loader": "^8.0.4",
97
+ "tslib": "^2.3.1",
97
98
  "ttypescript": "^1.5.12",
98
- "typescript": "^4.1.3",
99
+ "typescript": "^4.5.4",
99
100
  "typescript-transform-paths": "^2.2.2",
100
101
  "typings": "^2.1.1"
101
102
  },
@@ -1,7 +0,0 @@
1
- export declare class IkasThemeColor {
2
- id: string;
3
- displayName: string;
4
- key: string;
5
- color: string;
6
- constructor(data: Partial<IkasThemeColor>);
7
- }
@@ -1 +0,0 @@
1
- import{makeAutoObservable as i}from"mobx";import o from'../../../../../ext/uuid/dist/esm-browser/v4.js';var s=function(s){this.id=s.id||o(),this.displayName=s.displayName||"",this.key=s.key||"",this.color=s.color||"",i(this)};export{s as IkasThemeColor};