@ikas/storefront 4.14.7 → 4.14.8

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.
@@ -17,6 +17,7 @@ export declare class IkasBaseStore {
17
17
  router?: NextRouter;
18
18
  private constructor();
19
19
  static getInstance(): IkasBaseStore;
20
+ handleRouting(routing: IkasStorefrontRouting): void;
20
21
  setLocalization(localeOption: IkasLocaleOption): void;
21
22
  setLanguage(language: IkasLanguageOption): void;
22
23
  private checkLocalization;
@@ -1 +1 @@
1
- import{__awaiter as o,__generator as t}from'./../ext/tslib/tslib.es6.js';import{configure as i,makeObservable as n,observable as e}from"mobx";import{enableStaticRendering as r}from"mobx-react-lite";import s from"lodash/sortBy";import a from"lodash/flatten";import{IkasCartStore as c}from"./cart/index.js";import{IkasCustomerStore as u}from"./customer/index.js";import l from"./location/index.js";import{IkasThemeJsonPageType as d}from"@ikas/storefront-models";import{IkasStorefrontConfig as h}from"@ikas/storefront-config";import{IkasPageDataInit as p}from"../page-data-init/index.js";i({enforceActions:"never"}),r("undefined"==typeof window);var g=function(){function i(){this.currentPageType=null,this.localeOptions=[],this.languageOptions=[],this.showLocaleOptions=!1,this.currentCountryCode=null,this.spaLinksDisabled=!1,this.localeChecked=!1,this.customerStore=new u(this),this.cartStore=new c(this),"undefined"!=typeof window&&(this.spaLinksDisabled=navigator.userAgent.includes("Instagram")),this.init(),n(this,{currentPageType:e,localeOptions:e,languageOptions:e,showLocaleOptions:e,currentCountryCode:e,spaLinksDisabled:e})}return i.getInstance=function(){return this._instance||(this._instance=new i),this._instance},i.prototype.setLocalization=function(o){o.routing.domain?window.location.replace("https://"+o.routing.domain):window.location.replace(window.location.origin+(o.routing.path?"/"+o.routing.path:"")+(this.router?this.router.asPath:""))},i.prototype.setLanguage=function(o){var t,i,n=h.getRoutings().find((function(t){return t.id===o.id}));if(n)if(this.currentPageType===d.CATEGORY||this.currentPageType===d.BRAND||this.currentPageType===d.PRODUCT){var e=null===(i=null===(t=p.pageSpecificData.metaData)||void 0===t?void 0:t.translations)||void 0===i?void 0:i.find((function(o){return o.locale===n.locale}));if(e&&(null==e?void 0:e.slug)){var r="";r=n.path?"".concat(window.location.origin,"/").concat(n.path,"/").concat(e.slug):"".concat(window.location.origin,"/").concat(e.slug),window.location.replace(r)}else window.location.replace(window.location.origin+(n.path?"/"+n.path:"")+(this.router?this.router.asPath:""))}else window.location.replace(window.location.origin+(n.path?"/"+n.path:"")+(this.router?this.router.asPath:""))},i.prototype.checkLocalization=function(){return o(this,void 0,void 0,(function(){var o,i,n,e,r,c,u,d,p,g,f;return t(this,(function(t){switch(t.label){case 0:return this.localeChecked?[2]:"undefined"==typeof window?(console.warn("checkLocalization should be called on the client side!"),[2]):[4,l.getMyCountry()];case 1:return(o=t.sent()).isSuccess?(i=o.data,n=h.getCurrentRouting(),this.currentCountryCode=i,n&&i?(e=!0,r=h.getRoutings().filter((function(o){var t;return null===(t=o.countryCodes)||void 0===t?void 0:t.includes(i)})),c=h.getRoutings().find((function(o){var t;return!(null===(t=o.countryCodes)||void 0===t?void 0:t.length)})),r.length?r.some((function(o){return o.id===n.id}))||(e=!1):c&&n.id!==c.id&&(e=!1),u=[],d=[],p=a(h.getRoutings().map((function(o){return o.countryCodes||[]}))),[4,l.listCountry({iso2:{in:p}})]):[3,3]):[2];case 2:if(!(g=t.sent()).isSuccess)return[2];f=g.data||[],h.getRoutings().forEach((function(o){var t;(null===(t=o.countryCodes)||void 0===t?void 0:t.length)?o.countryCodes.forEach((function(t){var n=f.find((function(o){return o.iso2===t}));u.some((function(o){return o.iso2===(null==n?void 0:n.iso2)}))||u.push({id:(null==n?void 0:n.iso2)||(null==n?void 0:n.iso3)||Date.now()+"",countryName:(null==n?void 0:n.native)||(null==n?void 0:n.name)||"",iso2:(null==n?void 0:n.iso2)||void 0,iso3:(null==n?void 0:n.iso3)||void 0,routing:o,isRecommended:t===i})})):u.push({id:o.id,routing:o,isRecommended:!h.getRoutings().some((function(o){var t;return null===(t=o.countryCodes)||void 0===t?void 0:t.includes(i)}))})})),r.length&&(h.getRoutings().forEach((function(o){var t;r.some((function(t){return t.id===o.id}))&&d.push({id:o.id,currencyCode:o.currencyCode,currencySymbol:o.currencySymbol,language:"undefined"!=typeof Intl&&void 0!==Intl.DisplayNames&&new Intl.DisplayNames([],{type:"language"}).of(o.locale)||o.locale,locale:o.locale,isSelected:o.id===(null===(t=h.getCurrentRouting())||void 0===t?void 0:t.id)||!1})})),this.languageOptions=s(d,"language")),this.localeOptions=s(u,"countryName"),e||(this.showLocaleOptions=!0),this.localeChecked=!0,t.label=3;case 3:return[2]}}))}))},i.prototype.init=function(){this.customerStore.init()},i}();export{g as IkasBaseStore};
1
+ import{__awaiter as o,__generator as t}from'./../ext/tslib/tslib.es6.js';import{configure as n,makeObservable as i,observable as e}from"mobx";import{enableStaticRendering as r}from"mobx-react-lite";import s from"lodash/sortBy";import a from"lodash/flatten";import{IkasCartStore as u}from"./cart/index.js";import{IkasCustomerStore as c}from"./customer/index.js";import l from"./location/index.js";import{IkasThemeJsonPageType as d}from"@ikas/storefront-models";import{IkasStorefrontConfig as h}from"@ikas/storefront-config";import{IkasPageDataInit as p}from"../page-data-init/index.js";n({enforceActions:"never"}),r("undefined"==typeof window);var g=function(){function n(){this.currentPageType=null,this.localeOptions=[],this.languageOptions=[],this.showLocaleOptions=!1,this.currentCountryCode=null,this.spaLinksDisabled=!1,this.localeChecked=!1,this.customerStore=new c(this),this.cartStore=new u(this),"undefined"!=typeof window&&(this.spaLinksDisabled=navigator.userAgent.includes("Instagram")),this.init(),i(this,{currentPageType:e,localeOptions:e,languageOptions:e,showLocaleOptions:e,currentCountryCode:e,spaLinksDisabled:e})}return n.getInstance=function(){return this._instance||(this._instance=new n),this._instance},n.prototype.handleRouting=function(o){var t,n;if(this.currentPageType===d.CATEGORY||this.currentPageType===d.BRAND||this.currentPageType===d.PRODUCT){var i=null===(n=null===(t=p.pageSpecificData.metaData)||void 0===t?void 0:t.translations)||void 0===n?void 0:n.find((function(t){return t.locale===o.locale}));if(i&&(null==i?void 0:i.slug)){var e="";e=o.path?"".concat(window.location.origin,"/").concat(o.path,"/").concat(i.slug):"".concat(window.location.origin,"/").concat(i.slug),window.location.replace(e)}else window.location.replace(window.location.origin+(o.path?"/"+o.path:"")+(this.router?this.router.asPath:""))}else window.location.replace(window.location.origin+(o.path?"/"+o.path:"")+(this.router?this.router.asPath:""))},n.prototype.setLocalization=function(o){var t=o.routing;t.domain?window.location.replace("https://"+t.domain):this.handleRouting(t)},n.prototype.setLanguage=function(o){var t=h.getRoutings().find((function(t){return t.id===o.id}));t&&this.handleRouting(t)},n.prototype.checkLocalization=function(){return o(this,void 0,void 0,(function(){var o,n,i,e,r,u,c,d,p,g,f;return t(this,(function(t){switch(t.label){case 0:return this.localeChecked?[2]:"undefined"==typeof window?(console.warn("checkLocalization should be called on the client side!"),[2]):[4,l.getMyCountry()];case 1:return(o=t.sent()).isSuccess?(n=o.data,i=h.getCurrentRouting(),this.currentCountryCode=n,i&&n?(e=!0,r=h.getRoutings().filter((function(o){var t;return null===(t=o.countryCodes)||void 0===t?void 0:t.includes(n)})),u=h.getRoutings().find((function(o){var t;return!(null===(t=o.countryCodes)||void 0===t?void 0:t.length)})),r.length?r.some((function(o){return o.id===i.id}))||(e=!1):u&&i.id!==u.id&&(e=!1),c=[],d=[],p=a(h.getRoutings().map((function(o){return o.countryCodes||[]}))),[4,l.listCountry({iso2:{in:p}})]):[3,3]):[2];case 2:if(!(g=t.sent()).isSuccess)return[2];f=g.data||[],h.getRoutings().forEach((function(o){var t;(null===(t=o.countryCodes)||void 0===t?void 0:t.length)?o.countryCodes.forEach((function(t){var i=f.find((function(o){return o.iso2===t}));c.some((function(o){return o.iso2===(null==i?void 0:i.iso2)}))||c.push({id:(null==i?void 0:i.iso2)||(null==i?void 0:i.iso3)||Date.now()+"",countryName:(null==i?void 0:i.native)||(null==i?void 0:i.name)||"",iso2:(null==i?void 0:i.iso2)||void 0,iso3:(null==i?void 0:i.iso3)||void 0,routing:o,isRecommended:t===n})})):c.push({id:o.id,routing:o,isRecommended:!h.getRoutings().some((function(o){var t;return null===(t=o.countryCodes)||void 0===t?void 0:t.includes(n)}))})})),r.length&&(h.getRoutings().forEach((function(o){var t;r.some((function(t){return t.id===o.id}))&&d.push({id:o.id,currencyCode:o.currencyCode,currencySymbol:o.currencySymbol,language:"undefined"!=typeof Intl&&void 0!==Intl.DisplayNames&&new Intl.DisplayNames([],{type:"language"}).of(o.locale)||o.locale,locale:o.locale,isSelected:o.id===(null===(t=h.getCurrentRouting())||void 0===t?void 0:t.id)||!1})})),this.languageOptions=s(d,"language")),this.localeOptions=s(c,"countryName"),e||(this.showLocaleOptions=!0),this.localeChecked=!0,t.label=3;case 3:return[2]}}))}))},n.prototype.init=function(){this.customerStore.init()},n}();export{g as IkasBaseStore};
@@ -1,6 +1,7 @@
1
1
  import { IkasContactForm, IkasCustomer, IkasCustomerAttributeValue, IkasFavoriteProduct, IkasOrderTransaction, IkasProduct, IkasOrder, IkasRaffleParticipant, IkasProductFile } from "../../models/data";
2
2
  import { IkasLoginError, IkasRegisterError } from "@ikas/storefront-api";
3
3
  import { IkasBaseStore } from "../base";
4
+ export declare type SocialLoginProvider = "facebook" | "google" | "twitch";
4
5
  export declare class IkasCustomerStore {
5
6
  customer?: IkasCustomer | null;
6
7
  private token?;
@@ -21,7 +22,7 @@ export declare class IkasCustomerStore {
21
22
  get isCaptchaRequired(): boolean;
22
23
  private get useLastViewedProductResponse();
23
24
  private toAnalyticsCustomer;
24
- socialLogin(provider: "facebook" | "google"): Promise<void>;
25
+ socialLogin(provider: SocialLoginProvider): Promise<void>;
25
26
  socialLoginToken(token: string): Promise<boolean>;
26
27
  refundOrder(order: IkasOrder, email?: string | null): Promise<boolean>;
27
28
  /**
@@ -1,4 +1,4 @@
1
1
  export { IkasBaseStore } from "./base";
2
2
  export type { IkasLocaleOption } from "./base";
3
- export { IkasCustomerStore } from "./customer";
3
+ export { IkasCustomerStore, type SocialLoginProvider } from "./customer";
4
4
  export { IkasCartStore } from "./cart";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "4.14.7",
3
+ "version": "4.14.8",
4
4
  "description": "Storefront functionality for ikas storefront themes.",
5
5
  "author": "ikas",
6
6
  "license": "ISC",
@@ -17,11 +17,11 @@
17
17
  "build": "rm -rf build && rollup -c"
18
18
  },
19
19
  "devDependencies": {
20
- "@ikas/storefront-api": "^4.14.7",
21
- "@ikas/storefront-config": "^4.14.7",
22
- "@ikas/storefront-model-functions": "^4.14.7",
23
- "@ikas/storefront-models": "^4.14.7",
24
- "@ikas/storefront-providers": "^4.14.7",
20
+ "@ikas/storefront-api": "^4.14.8",
21
+ "@ikas/storefront-config": "^4.14.8",
22
+ "@ikas/storefront-model-functions": "^4.14.8",
23
+ "@ikas/storefront-models": "^4.14.8",
24
+ "@ikas/storefront-providers": "^4.14.8",
25
25
  "@ikas/localized-address": "1.0.0-beta.3",
26
26
  "@adyen/adyen-web": "^5.28.2",
27
27
  "@rollup/plugin-commonjs": "^22.0.0",
@@ -55,11 +55,11 @@
55
55
  },
56
56
  "peerDependencies": {
57
57
  "@ikas/localized-address": "1.0.0-beta.3",
58
- "@ikas/storefront-api": "^4.14.7",
59
- "@ikas/storefront-config": "^4.14.7",
60
- "@ikas/storefront-model-functions": "^4.14.7",
61
- "@ikas/storefront-models": "^4.14.7",
62
- "@ikas/storefront-providers": "^4.14.7",
58
+ "@ikas/storefront-api": "^4.14.8",
59
+ "@ikas/storefront-config": "^4.14.8",
60
+ "@ikas/storefront-model-functions": "^4.14.8",
61
+ "@ikas/storefront-models": "^4.14.8",
62
+ "@ikas/storefront-providers": "^4.14.8",
63
63
  "mobx": "^6.1.3",
64
64
  "mobx-react-lite": "^3.1.5",
65
65
  "next": "12.2.0",