@ikas/storefront-next 6.1.0-beta.380 → 6.1.0-beta.382

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.
@@ -1 +1 @@
1
- var n=function(){return n=Object.assign||function(n){for(var t,e=1,r=arguments.length;e<r;e++)for(var o in t=arguments[e])Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n},n.apply(this,arguments)};function t(n,t,e,r){return new(e||(e=Promise))((function(o,a){function l(n){try{i(r.next(n))}catch(n){a(n)}}function c(n){try{i(r.throw(n))}catch(n){a(n)}}function i(n){var t;n.done?o(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(l,c)}i((r=r.apply(n,t||[])).next())}))}function e(n,t){var e,r,o,a,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(a){return function(c){return function(a){if(e)throw new TypeError("Generator is already executing.");for(;l;)try{if(e=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return l.label++,{value:a[1],done:!1};case 5:l.label++,r=a[1],a=[0];continue;case 7:a=l.ops.pop(),l.trys.pop();continue;default:if(!(o=l.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){l=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){l.label=a[1];break}if(6===a[0]&&l.label<o[1]){l.label=o[1],o=a;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(a);break}o[2]&&l.ops.pop(),l.trys.pop();continue}a=t.call(n,l)}catch(n){a=[6,n],r=0}finally{e=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function r(n,t,e){if(e||2===arguments.length)for(var r,o=0,a=t.length;o<a;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return n.concat(r||Array.prototype.slice.call(t))}export{n as __assign,t as __awaiter,e as __generator,r as __spreadArray};
1
+ var e=function(){return e=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},e.apply(this,arguments)};function t(e,t,n,r){return new(n||(n=Promise))((function(o,a){function c(e){try{i(r.next(e))}catch(e){a(e)}}function l(e){try{i(r.throw(e))}catch(e){a(e)}}function i(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,l)}i((r=r.apply(e,t||[])).next())}))}function n(e,t){var n,r,o,a,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;c;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return c.label++,{value:a[1],done:!1};case 5:c.label++,r=a[1],a=[0];continue;case 7:a=c.ops.pop(),c.trys.pop();continue;default:if(!(o=c.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){c=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){c.label=a[1];break}if(6===a[0]&&c.label<o[1]){c.label=o[1],o=a;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(a);break}o[2]&&c.ops.pop(),c.trys.pop();continue}a=t.call(e,c)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}function r(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;o<a;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}function o(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}export{e as __assign,t as __awaiter,n as __generator,o as __makeTemplateObject,r as __spreadArray};
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as t}from"../../../ext/tslib/tslib.es6.js";import n from"path";import{deleteDirContent as r,createFile as a}from"../../../utils/fs.js";import{PAGE_INFO as o,CHECKOUT_PAGE_CONTENT as s,EDITOR_PAGE_CONTENT as c}from"./info.js";var i=function(){function i(){}return i.generate=function(a,s){return void 0===s&&(s=!0),e(this,void 0,void 0,(function(){var e,c,p,u,f,g,m,l,h,d,P,C,_;return t(this,(function(t){switch(t.label){case 0:return e=n.join(a||process.cwd(),"src","pages"),[4,r(e,["_app.tsx","_document.tsx","api"])];case 1:t.sent(),c=!0,p=0,u=o,t.label=2;case 2:return p<u.length?(f=u[p]).isCheckout&&!s?[3,5]:(g=c)?[4,i.generatePageWithInfo(f,a)]:[3,4]:[3,6];case 3:g=t.sent(),t.label=4;case 4:c=g,t.label=5;case 5:return p++,[3,2];case 6:return m=o.find((function(e){return e.isCheckout})),l=o.find((function(e){return e.isEditor})),s?[3,7]:(d=!0,[3,11]);case 7:return m?[4,i.generatePageWithInfo(m,a)]:[3,9];case 8:return P=t.sent(),[3,10];case 9:P=!1,t.label=10;case 10:d=P,t.label=11;case 11:return h=d,l?[4,i.generatePageWithInfo(l,a)]:[3,13];case 12:return _=t.sent(),[3,14];case 13:_=!1,t.label=14;case 14:return C=_,[2,c&&h&&C]}}))}))},i.generatePageWithInfo=function(r,o){return e(this,void 0,void 0,(function(){var e,i,p,u,f,g,m,l,h;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e="",r.isCheckout?e=s:r.isEditor?e=c:(i=r.pageComponentName+"Next",p="import { ".concat(r.pageComponentName,' } from "@ikas/storefront";\r\n'),u="import { ".concat(r.pageComponentName," as ").concat(i,' } from "@ikas/storefront-next";\r\n'),f='import Components from "src/components/__generated__/pages/'.concat(r.path.replace(".tsx",""),'";\r\n'),g="\nconst PageComponent = ".concat(r.pageComponentName,".default;\n\nconst Page = (props: any) => {\n return <PageComponent components={Components} {...props} />;\n};\n\nexport default Page;\r\n"),m=r.isDynamicSSG?"export const getStaticPaths = ".concat(i,".getStaticPaths;\r\n"):"",l=r.isSSR?"export const getServerSideProps = ".concat(i,".getServerSideProps;\r\n"):"export const getStaticProps = ".concat(i,".getStaticProps;\r\n"),e=p+u+f+g+m+l),[4,a(n.join(o||process.cwd(),"src","pages"),r.path,e)];case 1:return[2,t.sent()];case 2:return h=t.sent(),console.error(h),[2,!1];case 3:return[2]}}))}))},i.generatePageWithType=function(n){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return(e=o.find((function(e){return e.pageTypes.includes(n)})))?[4,i.generatePageWithInfo(e)]:[3,2];case 1:return[2,t.sent()];case 2:return[2,!1]}}))}))},i}();export{i as PageGenerator};
1
+ import{__awaiter as e,__generator as t}from"../../../ext/tslib/tslib.es6.js";import n from"path";import{deleteDirContent as r,createFile as a}from"../../../utils/fs.js";import{PAGE_INFO as o,CHECKOUT_PAGE_CONTENT as s,EDITOR_PAGE_CONTENT as c}from"./info.js";var i=function(){function i(){}return i.generate=function(a){return e(this,void 0,void 0,(function(){var e,s,c,p,u,f,g,m,l,h,d,P;return t(this,(function(t){switch(t.label){case 0:return e=n.join(a||process.cwd(),"src","pages"),[4,r(e,["_app.tsx","_document.tsx","api"])];case 1:t.sent(),s=!0,c=0,p=o,t.label=2;case 2:return c<p.length?(u=p[c],(f=s)?[4,i.generatePageWithInfo(u,a)]:[3,4]):[3,6];case 3:f=t.sent(),t.label=4;case 4:s=f,t.label=5;case 5:return c++,[3,2];case 6:return g=o.find((function(e){return e.isCheckout})),m=o.find((function(e){return e.isEditor})),g?[4,i.generatePageWithInfo(g,a)]:[3,8];case 7:return h=t.sent(),[3,9];case 8:h=!1,t.label=9;case 9:return l=h,m?[4,i.generatePageWithInfo(m,a)]:[3,11];case 10:return P=t.sent(),[3,12];case 11:P=!1,t.label=12;case 12:return d=P,[2,s&&l&&d]}}))}))},i.generatePageWithInfo=function(r,o){return e(this,void 0,void 0,(function(){var e,i,p,u,f,g,m,l,h;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e="",r.isCheckout?e=s:r.isEditor?e=c:(i=r.pageComponentName+"Next",p="import { ".concat(r.pageComponentName,' } from "@ikas/storefront";\r\n'),u="import { ".concat(r.pageComponentName," as ").concat(i,' } from "@ikas/storefront-next";\r\n'),f='import Components from "src/components/__generated__/pages/'.concat(r.path.replace(".tsx",""),'";\r\n'),g="\nconst PageComponent = ".concat(r.pageComponentName,".default;\n\nconst Page = (props: any) => {\n return <PageComponent components={Components} {...props} />;\n};\n\nexport default Page;\r\n"),m=r.isDynamicSSG?"export const getStaticPaths = ".concat(i,".getStaticPaths;\r\n"):"",l=r.isSSR?"export const getServerSideProps = ".concat(i,".getServerSideProps;\r\n"):"export const getStaticProps = ".concat(i,".getStaticProps;\r\n"),e=p+u+f+g+m+l),[4,a(n.join(o||process.cwd(),"src","pages"),r.path,e)];case 1:return[2,t.sent()];case 2:return h=t.sent(),console.error(h),[2,!1];case 3:return[2]}}))}))},i.generatePageWithType=function(n){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return(e=o.find((function(e){return e.pageTypes.includes(n)})))?[4,i.generatePageWithInfo(e)]:[3,2];case 1:return[2,t.sent()];case 2:return[2,!1]}}))}))},i}();export{i as PageGenerator};
@@ -1 +1 @@
1
- import{IkasThemeJsonPageType as e}from"@ikas/storefront-models";var a="checkout",t=[{path:"[slug]/index.tsx",pageComponentName:"SlugPage",pageTypes:[e.PRODUCT,e.CATEGORY,e.BRAND],isDynamicSSG:!0},{path:"account/orders/[id].tsx",pageComponentName:"OrderDetailPage",pageTypes:[e.ORDER_DETAIL],isSSR:!0},{path:"account/orders/index.tsx",pageComponentName:"OrdersPage",pageTypes:[e.ORDERS]},{path:"account/addresses.tsx",pageComponentName:"AddressesPage",pageTypes:[e.ADDRESSES]},{path:"account/favorite-products.tsx",pageComponentName:"FavoriteProductsPage",pageTypes:[e.FAVORITE_PRODUCTS]},{path:"account/forgot-password.tsx",pageComponentName:"ForgotPasswordPage",pageTypes:[e.FORGOT_PASSWORD]},{path:"account/activate.tsx",pageComponentName:"ActivateCustomerPage",pageTypes:[e.ACTIVATE_CUSTOMER]},{path:"account/index.tsx",pageComponentName:"AccountPage",pageTypes:[e.ACCOUNT]},{path:"account/login.tsx",pageComponentName:"LoginPage",pageTypes:[e.LOGIN]},{path:"account/raffles.tsx",pageComponentName:"AccountRafflesPage",pageTypes:[e.RAFFLE_ACCOUNT]},{path:"account/recover-password.tsx",pageComponentName:"RecoverPasswordPage",pageTypes:[e.RECOVER_PASSWORD]},{path:"account/register.tsx",pageComponentName:"RegisterPage",pageTypes:[e.REGISTER]},{path:"blog/[slug].tsx",pageComponentName:"BlogSlugPage",pageTypes:[e.BLOG,e.BLOG_CATEGORY],isDynamicSSG:!0},{path:"blog/index.tsx",pageComponentName:"BlogPage",pageTypes:[e.BLOG_INDEX]},{path:"pages/[slug].tsx",pageComponentName:"CustomPage",pageTypes:[e.CUSTOM],isDynamicSSG:!0},{path:"raffle/[slug].tsx",pageComponentName:"RafflePage",pageTypes:[e.RAFFLE_DETAIL],isDynamicSSG:!0},{path:"raffle/index.tsx",pageComponentName:"RafflesPage",pageTypes:[e.RAFFLE]},{path:"404.tsx",pageComponentName:"NotFoundPage",pageTypes:[e.NOT_FOUND]},{path:"cart.tsx",pageComponentName:"CartPage",pageTypes:[e.CART]},{path:"index.tsx",pageComponentName:"IndexPage",pageTypes:[e.INDEX]},{path:"search.tsx",pageComponentName:"SearchPage",pageTypes:[e.SEARCH]},{path:"checkout.tsx",pageComponentName:"CheckoutPage",pageTypes:[],isCheckout:!0},{path:"editor.tsx",pageComponentName:"EditorPage",pageTypes:[],isEditor:!0}],o='import { CheckoutPage } from "@ikas/storefront";\nimport { CheckoutPage as CheckoutPageNext } from "@ikas/storefront-next";\n\nexport default CheckoutPage.default;\nexport const getServerSideProps = CheckoutPageNext.getServerSideProps;\n',p='import { EditorPage } from "@ikas/storefront";\nimport { EditorPage as EditorPageNext } from "@ikas/storefront-next";\nimport Components from "../components/__generated__/editor";\n\nconst PageComponent = EditorPage.default;\n\nconst Page = (props: any) => {\n return <PageComponent components={Components} {...props} />;\n};\n\nexport default Page;\nexport const getStaticProps = EditorPageNext.getStaticProps;\n';export{a as CHECKOUT_COMPONENT_ID,o as CHECKOUT_PAGE_CONTENT,p as EDITOR_PAGE_CONTENT,t as PAGE_INFO};
1
+ import{IkasThemeJsonPageType as e}from"@ikas/storefront-models";var a="checkout",t=[{path:"[slug]/index.tsx",pageComponentName:"SlugPage",pageTypes:[e.PRODUCT,e.CATEGORY,e.BRAND],isDynamicSSG:!0},{path:"account/orders/[id].tsx",pageComponentName:"OrderDetailPage",pageTypes:[e.ORDER_DETAIL],isSSR:!0},{path:"account/orders/index.tsx",pageComponentName:"OrdersPage",pageTypes:[e.ORDERS]},{path:"account/addresses.tsx",pageComponentName:"AddressesPage",pageTypes:[e.ADDRESSES]},{path:"account/favorite-products.tsx",pageComponentName:"FavoriteProductsPage",pageTypes:[e.FAVORITE_PRODUCTS]},{path:"account/forgot-password.tsx",pageComponentName:"ForgotPasswordPage",pageTypes:[e.FORGOT_PASSWORD]},{path:"account/activate.tsx",pageComponentName:"ActivateCustomerPage",pageTypes:[e.ACTIVATE_CUSTOMER]},{path:"account/index.tsx",pageComponentName:"AccountPage",pageTypes:[e.ACCOUNT]},{path:"account/login.tsx",pageComponentName:"LoginPage",pageTypes:[e.LOGIN]},{path:"account/raffles.tsx",pageComponentName:"AccountRafflesPage",pageTypes:[e.RAFFLE_ACCOUNT]},{path:"account/recover-password.tsx",pageComponentName:"RecoverPasswordPage",pageTypes:[e.RECOVER_PASSWORD]},{path:"account/register.tsx",pageComponentName:"RegisterPage",pageTypes:[e.REGISTER]},{path:"blog/[slug].tsx",pageComponentName:"BlogSlugPage",pageTypes:[e.BLOG,e.BLOG_CATEGORY],isDynamicSSG:!0},{path:"blog/index.tsx",pageComponentName:"BlogPage",pageTypes:[e.BLOG_INDEX]},{path:"pages/[slug].tsx",pageComponentName:"CustomPage",pageTypes:[e.CUSTOM],isDynamicSSG:!0},{path:"raffle/[slug].tsx",pageComponentName:"RafflePage",pageTypes:[e.RAFFLE_DETAIL],isDynamicSSG:!0},{path:"raffle/index.tsx",pageComponentName:"RafflesPage",pageTypes:[e.RAFFLE]},{path:"404.tsx",pageComponentName:"NotFoundPage",pageTypes:[e.NOT_FOUND]},{path:"cart.tsx",pageComponentName:"CartPage",pageTypes:[e.CART]},{path:"index.tsx",pageComponentName:"IndexPage",pageTypes:[e.INDEX]},{path:"search.tsx",pageComponentName:"SearchPage",pageTypes:[e.SEARCH]},{path:"checkout.tsx",pageComponentName:"CheckoutPage",pageTypes:[],isCheckout:!0},{path:"editor.tsx",pageComponentName:"EditorPage",pageTypes:[],isEditor:!0}],o='import { CheckoutPage } from "@ikas/storefront";\nimport { CheckoutPage as CheckoutPageNext } from "@ikas/storefront-next";\n\nexport default CheckoutPage.default;\nexport const getStaticProps = CheckoutPageNext.getStaticProps;\n',p='import { EditorPage } from "@ikas/storefront";\nimport { EditorPage as EditorPageNext } from "@ikas/storefront-next";\nimport Components from "../components/__generated__/editor";\n\nconst PageComponent = EditorPage.default;\n\nconst Page = (props: any) => {\n return <PageComponent components={Components} {...props} />;\n};\n\nexport default Page;\nexport const getStaticProps = EditorPageNext.getStaticProps;\n';export{a as CHECKOUT_COMPONENT_ID,o as CHECKOUT_PAGE_CONTENT,p as EDITOR_PAGE_CONTENT,t as PAGE_INFO};
@@ -23,10 +23,12 @@ export declare class IkasNextPageDataProvider {
23
23
  static getLocalSettings(locale: string): Promise<SettingsData | null>;
24
24
  static getProdSettings(locale: string): Promise<SettingsData | null>;
25
25
  static getSettings(locale: string): Promise<SettingsData | null>;
26
- static setStorefrontConfig(settings: SettingsData): Promise<void>;
27
- static applyStorefrontConfig(settings: SettingsData, isStandalone?: boolean): void;
26
+ static setStorefrontConfig(settings: SettingsData, pageType?: IkasThemeJsonPageType, isEditor?: boolean): Promise<void>;
27
+ static applyStorefrontConfig(settings: SettingsData, isStandalone?: boolean, withNavigationWarning?: boolean): void;
28
28
  static setTranslations(settings: SettingsData, componentIds: string[], pageType?: IkasThemeJsonPageType, isEditor?: boolean, contextLocale?: string): Promise<void>;
29
+ static getLocaleJsonNamespace(localeJson: unknown, namespace: string): Record<string, any> | undefined;
29
30
  static loadStandaloneCheckoutTranslations(settings: SettingsData): Promise<Record<string, any>>;
31
+ static mergeTranslations(defaults: Record<string, any>, overrides: Record<string, any>): Record<string, any>;
30
32
  static getExtraProps(settings: SettingsData, provider: IkasPageDataProvider, pageType?: IkasThemeJsonPageType): Promise<Record<string, any>>;
31
33
  static buildCheckoutExtraProps(settings: SettingsData, provider: IkasPageDataProvider, checkoutSettings: Awaited<ReturnType<typeof listCheckoutSettings>>): Record<string, any>;
32
34
  static getPageData(context: GetStaticPropsContext<ParsedUrlQuery> | GetServerSidePropsContext<ParsedUrlQuery>, isServer: boolean, pageType?: IkasThemeJsonPageType, possiblePageTypes?: IkasThemeJsonPageType[], isEditor?: boolean): Promise<{
@@ -46,6 +48,7 @@ export declare class IkasNextPageDataProvider {
46
48
  } | {
47
49
  props: any;
48
50
  }>;
51
+ static omitPaymentStepScripts<T extends Record<string, any>>(props: T, context: GetStaticPropsContext<ParsedUrlQuery> | GetServerSidePropsContext<ParsedUrlQuery>): T;
49
52
  static getStaticProps(context: GetStaticPropsContext<ParsedUrlQuery>, pageType?: IkasThemeJsonPageType, possiblePageTypes?: IkasThemeJsonPageType[], isEditor?: boolean): Promise<{
50
53
  props: any;
51
54
  } | {
@@ -100,6 +103,7 @@ export declare type SettingsData = {
100
103
  favicon: IkasThemeJsonFavicon;
101
104
  stockPreference: IkasThemeJsonStockPreference;
102
105
  storefrontJSScripts: string[];
106
+ themeStyleScripts?: string[];
103
107
  highPriorityStoreFrontJSScripts: string[];
104
108
  domain: string;
105
109
  productBackInStockSettings: IkasProductBackInStockSettings | null;
@@ -1 +1 @@
1
- import{__assign as e,__spreadArray as t,__awaiter as o,__generator as n}from'./../ext/tslib/tslib.es6.js';import r from"fs";import i from"path";import s from"next/config.js";import{IkasThemeJsonPageType as a,IkasThemeJsonStockPreference as c}from"@ikas/storefront-models";import{IkasPageDataProvider as l}from"@ikas/storefront-providers";import{IkasStorefrontConfig as u}from"@ikas/storefront-config";import{setAPIClientConfig as p,getStorefrontSettings as d,listMerchantSettings as g,listCheckoutSettings as f}from"@ikas/storefront-api";import{getGoogleFontHref as h}from"../utils/google-fonts.js";import{I18NFileReader as m,CHECKOUT_TRANSLATION_NAMESPACE as S,readDefaultCheckoutTranslations as v}from"../utils/i18n.js";import{createFile as C,deleteDirContent as y}from"../utils/fs.js";var P,I=function(){function I(){}return I.getStandaloneCheckoutRequest=function(e){var t,o=e.req,n=null===(t=null==o?void 0:o.headers)||void 0===t?void 0:t["x-settings-path"];if(!n||"string"!=typeof n)return null;var r=function(e){var t=o.headers[e];return"string"==typeof t&&t?t:void 0},i=r("x-storefront-type");return{requestPath:I.getRequestPath(o)||"",settingsPath:n,projectJsonPath:r("x-project-json-path"),deployDir:r("x-deploy-dir"),host:r("x-host"),storefrontType:i===P.HEADLESS?P.HEADLESS:P.STUDIO}},I.getRequestPath=function(e){var t;try{var o=null===(t=e[Object.getOwnPropertySymbols(e).find((function(e){return"Symbol(NextRequestMeta)"===e.toString()}))])||void 0===t?void 0:t.__NEXT_INIT_URL;if(!o)return e.url;var n=new URL(o,"http://localhost");return n.pathname+n.search}catch(t){return e.url}},I.readJsonFile=function(e){return JSON.parse(r.readFileSync(e,"utf8"))},I.ensureCheckoutPage=function(o){var n=o.components||[],r=o.pages||[],i=n.some((function(e){return"checkout"===e.id})),s=r.some((function(e){return e.type===a.CHECKOUT}));return i&&s?o:e(e({},o),{components:i?n:t(t([],n,!0),[{id:"checkout",dir:"",displayName:"Checkout",props:[],isHeader:!1,isFooter:!1,defaultPropValuesTranslations:{}}],!1),pages:s?r:t(t([],r,!0),[{id:"checkout",name:"Checkout",type:a.CHECKOUT,slug:null,pageTitle:null,description:null,components:[{id:"checkout",componentId:"checkout",propValues:{}}],specifications:null,canonicals:null,disableIndex:null}],!1)})},I.getCheckoutThemeJson=function(e){return e.storefrontType===P.STUDIO?e.projectJson.checkoutThemeJson:e.themeLocalization.themeJson},I.getHeadlessRouting=function(e,t,o){var n=null==o?void 0:o.toLowerCase(),r=n?e.find((function(e){var t;return(null===(t=e.domain)||void 0===t?void 0:t.toLowerCase())===n})):void 0;if(r)return r;var i=t.split("?")[0].split("/")[1],s=i?e.find((function(e){return e.path===i})):void 0;return s||(e.find((function(e){return!e.domain&&!e.path}))||e[0])},I.getStudioRouting=function(e,t){var o=t.split("?")[0].split("/")[1];return o="checkout"===o?null:o,e.find((function(e){return o?e.path===o:!e.path}))},I.getHeadlessLocalizationPath=function(e,t,o){var n=i.join(e,"localizations"),s=i.join(n,"".concat(t.mainStorefrontThemeId,"_").concat(o,".json"));if(r.existsSync(s))return s;try{var a=r.readdirSync(n).filter((function(e){return e.endsWith("_".concat(o,".json"))}));if(1===a.length)return i.join(n,a[0])}catch(e){}},I.getStandaloneApiConfig=function(e,t,o){return{URL:process.env.INTERNAL_GQL_URL||process.env.NEXT_PUBLIC_GQL_URL||"",HEADERS:{"x-api-key":e||"","x-sfid":t,"x-sfrid":o,"x-timezone":Intl.DateTimeFormat().resolvedOptions().timeZone||""}}},I.getStandaloneCheckoutSettings=function(e){var r,i;return o(this,void 0,void 0,(function(){var o,s,a,l,u,p,d,f,h,m,S,v,C,y,T,k,L,R,w,O,E,b,D,B;return n(this,(function(n){switch(n.label){case 0:o=e.requestPath,s=e.settingsPath,a=e.projectJsonPath,l=e.deployDir,u=e.host,p=e.storefrontType,d=p===P.STUDIO,n.label=1;case 1:if(n.trys.push([1,11,,12]),!d&&!l)return console.error("[checkout] Deploy dir missing for headless"),[2,null];if(!(null==(f=I.readJsonFile(s))?void 0:f.storefront))return console.error("[checkout] Settings missing"),[2,null];if(h=void 0,d){if(!a)return console.error("[checkout] Project json path missing for studio"),[2,null];h=I.readJsonFile(a)}return m=f.storefront,S=d?I.getStudioRouting(m.routings,o):I.getHeadlessRouting(m.routings,o,u),(v=S?d?null===(r=f.localizationMap)||void 0===r?void 0:r[S.id]:I.getHeadlessLocalizationPath(l,m,S.locale):void 0)&&S?(C=f.merchantSettings)?[3,3]:[4,g({},I.getStandaloneApiConfig(f.apiKey,m.id,S.id))]:(console.error("[checkout] Theme localization path or routing missing"),[2,null]);case 2:if(!(y=n.sent()).isSuccess||!y.data)return console.error("[checkout] Merchant settings fetch failed"),[2,null];C=y.data,n.label=3;case 3:return C.address=null,delete C.merchantAddress,T=I.readJsonFile(v),k=t([],f.storefrontJSScripts||[],!0),L=void 0,R=void 0,d?(h.checkoutThemeJson=I.ensureCheckoutPage(h.checkoutThemeJson||{}),w=null===(i=m.indexPageSeoSettings)||void 0===i?void 0:i.find((function(e){return e.locale===S.locale})),L={id:(null==w?void 0:w.favIcon)||null},R=c.SHOW_ALL,[3,10]):[3,4];case 4:if(T.themeJson=I.ensureCheckoutPage(T.themeJson),O=T.themeJson.settings,L=null==O?void 0:O.favicon,R=null==O?void 0:O.stockPreference,!O)return[3,10];E=I.createColorStyle(O),b=void 0,n.label=5;case 5:return n.trys.push([5,8,,9]),O.fontFamily?[4,I.getCachedFontScript(O)]:[3,7];case 6:b=n.sent(),n.label=7;case 7:return[3,9];case 8:return D=n.sent(),console.error("[checkout] Font fetch failed",D),[3,9];case 9:E&&k.push(E),b&&k.push(b),n.label=10;case 10:return[2,{storefrontType:p,storefront:m,themeLocalization:T,salesChannel:f.salesChannel,routing:S,favicon:L,stockPreference:R,storefrontJSScripts:k,highPriorityStoreFrontJSScripts:f.highPriorityStoreFrontJSScripts||[],domain:f.domain,productBackInStockSettings:f.productBackInStockSettings?{customerLoginRequired:f.productBackInStockSettings.customerLoginRequired}:null,customerReviewSettings:f.customerReviewSettings?{customerLoginRequired:f.customerReviewSettings.customerLoginRequired||!1,customerPurchaseRequired:f.customerReviewSettings.customerPurchaseRequired||!1}:null,merchantSettings:C,customerSettings:f.customerSettings,custom:f.custom,storefrontPopups:f.storefrontPopups||[],loyaltyPrograms:f.loyaltyPrograms||[],payWithIkasUrl:f.payWithIkasUrl,projectJson:h,deployDir:l,apiKey:f.apiKey}];case 11:return B=n.sent(),console.error("[checkout] Settings read error",B),[2,null];case 12:return[2]}}))}))},I.readLocalTheme=function(){return new Promise((function(e,t){r.readFile("./src/theme.json",{flag:"a+"},(function(o,n){if(o)return t(o);var r=n.length?JSON.parse(n.toString()):{};e(r)}))}))},I.readSettingsFile=function(){return new Promise((function(e){var t,o,n=null===(o=null===(t=s())||void 0===t?void 0:t.serverRuntimeConfig)||void 0===o?void 0:o.SETTINGS;if(!n)return console.error("SETTINGS PATH MISSING!!!"),e(null);r.readFile(n,{flag:"a+"},(function(t,o){if(t)return console.error("SETTINGS FILE READ ERROR!!!"),console.error(t),e(null);var n=o.length?JSON.parse(o.toString()):{};e(n)}))}))},I.cacheLocalSettingsFile=function(e){return o(this,void 0,void 0,(function(){var t,o;return n(this,(function(n){switch(n.label){case 0:return[4,y(t=".ikas")];case 1:return n.sent(),o="settings-".concat(this.startTime,".json"),[4,C(t,o,JSON.stringify(e,null,2))];case 2:return n.sent(),[2]}}))}))},I.readLocalSettingsFile=function(){try{var e=r.readFileSync(".ikas/settings-".concat(this.startTime,".json"));if(e&&e.length)return JSON.parse(e.toString())}catch(e){}},I.getLocalSettings=function(e){return o(this,void 0,void 0,(function(){var t,o,r,i,s,a,c,l,u,p;return n(this,(function(n){switch(n.label){case 0:return[4,I.readLocalSettingsFile()];case 1:return(t=n.sent())?[3,4]:[4,d()];case 2:return(o=n.sent()).isSuccess&&o.data?(t=o.data,[4,this.cacheLocalSettingsFile(t)]):(console.error("Storefront settings fetch failed!"),console.error(o),[2,null]);case 3:n.sent(),n.label=4;case 4:return r=t.storefront,i=t.salesChannel,s=[],a=t.productBackInStockSettings?{customerLoginRequired:t.productBackInStockSettings.customerLoginRequired}:null,c=t.customerReviewSettings?{customerLoginRequired:t.customerReviewSettings.customerLoginRequired||!1,customerPurchaseRequired:t.customerReviewSettings.customerPurchaseRequired||!1}:null,[4,I.readLocalTheme()];case 5:return l=n.sent(),u=I.createColorScript(l.settings),[4,I.createFontScript(l.settings)];case 6:return p=n.sent(),u&&s.push(u),p&&s.push(p),[2,{storefrontType:P.HEADLESS,storefront:r,themeLocalization:{id:"",locale:"en",privacyPolicy:null,returnPolicy:null,storefrontId:r.id,storefrontThemeId:"",termsOfService:null,imprint:null,shippingPolicy:null,themeJson:l},salesChannel:i,routing:r.routings.length?r.routings.find((function(t){return t.locale===e||t.id===e}))||r.routings[0]:{countryCodes:[],domain:"",dynamicCurrencySettings:{roundingFormat:null,targetCurrencyCode:""},id:"",locale:"en",path:null,priceListId:null,currencyCode:"USD",currencySymbol:"$"},favicon:l.settings.favicon,stockPreference:l.settings.stockPreference,storefrontJSScripts:s,highPriorityStoreFrontJSScripts:[],domain:"localhost:3333",productBackInStockSettings:a,customerReviewSettings:c,merchantSettings:t.merchantSettings,customerSettings:t.customerSettings,storefrontPopups:t.storefrontPopups,loyaltyPrograms:t.loyaltyPrograms}]}}))}))},I.getProdSettings=function(e){return o(this,void 0,void 0,(function(){var t=this;return n(this,(function(i){return[2,new Promise((function(i){return o(t,void 0,void 0,(function(){var t,s,a,c,l,u,p,d,f,h,m,S,v;return n(this,(function(C){switch(C.label){case 0:return[4,I.readSettingsFile()];case 1:return(t=C.sent())&&t.localizationMap?(s=t.storefront,a=t.salesChannel,c=t.localizationMap,l=t.storefrontJSScripts||[],u=t.highPriorityStoreFrontJSScripts||[],p=t.domain,d=t.productBackInStockSettings?{customerLoginRequired:t.productBackInStockSettings.customerLoginRequired}:null,f=t.customerReviewSettings?{customerLoginRequired:t.customerReviewSettings.customerLoginRequired||!1,customerPurchaseRequired:t.customerReviewSettings.customerPurchaseRequired||!1}:null,(h=t.merchantSettings)?[3,3]:[4,g({})]):[2,i(null)];case 2:if(!(m=C.sent()).isSuccess||!m.data)return console.error("MERCHANT SETTINGS FETCH FAILED!"),[2,i(null)];h=m.data,C.label=3;case 3:return h&&(h.address=null,delete h.merchantAddress),S=c[e],v=s.routings.find((function(t){return t.id===e||t.path===e})),S&&v?(r.readFile(S,{flag:"a+"},(function(e,r){return o(this,void 0,void 0,(function(){var o,c,g,m,S,C,y;return n(this,(function(n){switch(n.label){case 0:return e?(console.error("THEME LOCALIZATION FILE READ ERROR!!!"),console.error(e),[2,i(null)]):(o=r.length?JSON.parse(r.toString()):{},g=(c=o).themeJson.settings.favicon,m=c.themeJson.settings.stockPreference,c.themeJson.settings?(S=I.createColorScript(c.themeJson.settings),[4,I.createFontScript(c.themeJson.settings)]):[3,2]);case 1:C=n.sent(),S&&l.push(S),C&&l.push(C),n.label=2;case 2:return y=t.customerSettings,i({storefrontType:P.HEADLESS,storefront:s,themeLocalization:c,salesChannel:a,routing:v,favicon:g,stockPreference:m,storefrontJSScripts:l,highPriorityStoreFrontJSScripts:u,domain:p,productBackInStockSettings:d,customerReviewSettings:f,merchantSettings:h,customerSettings:y,custom:t.custom,storefrontPopups:t.storefrontPopups,loyaltyPrograms:t.loyaltyPrograms,payWithIkasUrl:t.payWithIkasUrl}),[2]}}))}))})),[2]):(console.error("THEME LOCALIZATION PATH OR ROUTING MISSING!!!"),[2,i(null)])}}))}))}))]}))}))},I.getSettings=function(e){return o(this,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return"local"===process.env.NEXT_PUBLIC_ENV?[4,this.getLocalSettings(e)]:[3,2];case 1:case 3:return[2,t.sent()];case 2:return[4,this.getProdSettings(e)]}}))}))},I.setStorefrontConfig=function(e){return o(this,void 0,void 0,(function(){return n(this,(function(t){return I.applyStorefrontConfig(e),[2]}))}))},I.applyStorefrontConfig=function(t,o){var n,r;void 0===o&&(o=!1);var i=t.storefront,s=t.salesChannel,a=t.routing,c=t.favicon,l=t.stockPreference,d=t.storefrontJSScripts,g=t.highPriorityStoreFrontJSScripts,f=t.domain,h=t.productBackInStockSettings,m=t.customerReviewSettings,S=t.merchantSettings,v=t.customerSettings,C=t.custom,y=t.storefrontPopups,P=t.loyaltyPrograms,I=t.payWithIkasUrl,T=t.apiKey;o&&u.clear(),u.init(e(e({},T?{apiKey:T}:{}),{apiUrl:process.env.INTERNAL_GQL_URL||process.env.NEXT_PUBLIC_GQL_URL,cdnUrl:process.env.NEXT_PUBLIC_CDN_URL,storefrontId:i.id,storefrontRoutingId:a.id,storefrontThemeId:i.mainStorefrontThemeId,storefrontB2BSettings:i.b2bSettings||void 0,storefrontType:i.type,salesChannelId:i.salesChannelId,priceListId:a.priceListId||void 0,stockLocationIds:null===(n=s.stockLocations)||void 0===n?void 0:n.map((function(e){return e.id})),routings:i.routings,paymentGateways:s.paymentGateways||[],gtmId:i.gtmId||void 0,fbpId:i.fbpId||void 0,analytics4Id:i.analytics4Id||void 0,universalAnalyticsId:i.universalAnalyticsId||void 0,tiktokPixelId:i.tiktokPixelId||void 0,openAiPixelId:i.openAiPixelId||void 0,favicon:c||null,pickUpStockLocationIds:i.pickUpStockLocationIds&&i.pickUpStockLocationIds.length?i.pickUpStockLocationIds:null,stockPreference:l||null,storefrontJSScripts:d||[],highPriorityStoreFrontJSScripts:g||[],domain:f,productBackInStockSettings:h,customerReviewSettings:m,merchantSettings:S,customerSettings:v,metaTemplates:i.metaTemplates||null,custom:C||null,indexPageSeoSettings:i.indexPageSeoSettings,storefrontPopups:y,loyaltyPrograms:P,payWithIkasUrl:I,milesSmilesSettings:(null===(r=i.socialLoginSettings)||void 0===r?void 0:r.find((function(e){return"miles_smiles"===e.provider})))||null})),p()},I.setTranslations=function(e,r,i,c,l){return o(this,void 0,void 0,(function(){var o,p,d,g,f,h,S,v;return n(this,(function(n){switch(n.label){case 0:return o=s().serverRuntimeConfig,p=e.routing,d="local"===process.env.NEXT_PUBLIC_ENV,g=e.themeLocalization.themeJson.components.filter((function(e){return c||r.includes(e.id)})),f=t(["common"],g.map((function(e){return e.dir})),!0),(i===a.CHECKOUT||c)&&f.push("checkout-page"),h=o.nextI18nConf,S=d&&l?l:p.locale,[4,new m(S,f,d?void 0:h.localePath).read()];case 1:return v=n.sent(),u.init({translations:v}),[2]}}))}))},I.loadStandaloneCheckoutTranslations=function(e){var t,s,a;return o(this,void 0,void 0,(function(){var o,c,l,u,p,d;return n(this,(function(n){switch(n.label){case 0:o=e.routing.locale;try{e.storefrontType===P.STUDIO?c=null===(a=null===(s=null===(t=e.projectJson)||void 0===t?void 0:t.i18nTranslations)||void 0===s?void 0:s[o])||void 0===a?void 0:a.checkout_page:e.deployDir&&(l=i.join(e.deployDir,"public","locales",o,"checkout.json"),r.existsSync(l)&&(c=I.readJsonFile(l)))}catch(e){console.error("[checkout] Translations read error",e)}return d={},u=S,(p=c)?[3,2]:[4,v(o)];case 1:p=n.sent(),n.label=2;case 2:return[2,(d[u]=p,d)]}}))}))},I.getExtraProps=function(e,t,r){var i;return o(this,void 0,void 0,(function(){var o;return n(this,(function(n){switch(n.label){case 0:return r===a.CHECKOUT&&(null===(i=t.page)||void 0===i?void 0:i.components[0])?[4,f({})]:[2,{}];case 1:return o=n.sent(),[2,I.buildCheckoutExtraProps(e,t,o)]}}))}))},I.buildCheckoutExtraProps=function(e,t,o){var n,r,i,s,a,c,l,u,p,d,g,f,h,m,S,v,C,y,P,I,T,k,L,R,w={},O=e.themeLocalization,E=null===(n=t.page)||void 0===n?void 0:n.components[0];if(E){o.isSuccess||(console.error("CHECKOUT SETTINGS FETCH FAILED!"),console.error(o.graphQLErrors),console.error(o.errorCodes));var b={logo:null!==(r=E.propValues.logo)&&void 0!==r?r:null,showTax:null===(i=E.propValues.showTax)||void 0===i||i,showLoyaltyPoints:null!==(s=E.propValues.showLoyaltyPoints)&&void 0!==s&&s,showCampaignOffersDesign:null!==(a=E.propValues.showCampaignOffersDesign)&&void 0!==a&&a,showCampaignIsBiggerImage:null!==(c=E.propValues.showCampaignIsBiggerImage)&&void 0!==c&&c,campaignOfferIsSmallDesign:null!==(l=E.propValues.campaignOfferIsSmallDesign)&&void 0!==l&&l,showCampaignHideDiscountBadge:null!==(u=E.propValues.showCampaignHideDiscountBadge)&&void 0!==u&&u,campaignOfferCountdownStyleIsLine:null!==(p=E.propValues.campaignOfferCountdownStyleIsLine)&&void 0!==p&&p,campaignOfferCountdownStyleIsLineSuccessPage:null!==(d=E.propValues.campaignOfferCountdownStyleIsLineSuccessPage)&&void 0!==d&&d,campaignOffersEnableMiddlePhase:null!==(g=E.propValues.campaignOffersEnableMiddlePhase)&&void 0!==g&&g,campaignOffersTitleColor:null!==(f=E.propValues.campaignOffersTitleColor)&&void 0!==f?f:null,campaignOffersDescriptionColor:null!==(h=E.propValues.campaignOffersDescriptionColor)&&void 0!==h?h:null,campaignOffersContainerBgColor:null!==(m=E.propValues.campaignOffersContainerBgColor)&&void 0!==m?m:null,campaignOffersDiscountPercentageColor:null!==(S=E.propValues.campaignOffersDiscountPercentageColor)&&void 0!==S?S:null,campaignOffersDiscountPercentageBgColor:null!==(v=E.propValues.campaignOffersDiscountPercentageBgColor)&&void 0!==v?v:null,campaignOffersCountdownTextColor:null!==(C=E.propValues.campaignOffersCountdownTextColor)&&void 0!==C?C:null,campaignOffersCountdownTimeColor:null!==(y=E.propValues.campaignOffersCountdownTimeColor)&&void 0!==y?y:null,campaignOffersCountdownBgColor:null!==(P=E.propValues.campaignOffersCountdownBgColor)&&void 0!==P?P:null,campaignOffersMiddlePhaseOverlayColor:null!==(I=E.propValues.campaignOffersMiddlePhaseOverlayColor)&&void 0!==I?I:null,buttonBgColor:E.propValues.buttonBgColor,buttonTextColor:E.propValues.buttonTextColor,buttonDisabledBgColor:E.propValues.buttonDisabledBgColor,buttonDisabledTextColor:E.propValues.buttonDisabledTextColor,primaryTextColor:E.propValues.primaryTextColor,secondaryTextColor:E.propValues.secondaryTextColor,primaryBgColor:E.propValues.primaryBgColor,secondaryBgColor:E.propValues.secondaryBgColor,borderColor:E.propValues.borderColor,cardBgColor:E.propValues.cardBgColor,errorColor:E.propValues.errorColor,errorLightColor:E.propValues.errorLightColor,warningColor:E.propValues.warningColor,warningLightColor:E.propValues.warningLightColor,successColor:E.propValues.successColor,successLightColor:E.propValues.successLightColor,secondaryButtonBgColor:null!==(T=E.propValues.secondaryButtonBgColor)&&void 0!==T?T:null,secondaryButtonTextColor:null!==(k=E.propValues.secondaryButtonTextColor)&&void 0!==k?k:null,secondaryButtonBorderColor:null!==(L=E.propValues.secondaryButtonBorderColor)&&void 0!==L?L:null};w.customizationProps=b,w.returnPolicy=O.returnPolicy,w.privacyPolicy=O.privacyPolicy,w.termsOfService=O.termsOfService,w.imprint=O.imprint,w.shippingPolicy=O.shippingPolicy,w.checkoutSettings=(null===(R=null==o?void 0:o.data)||void 0===R?void 0:R.length)?o.data[0]:null}return w},I.getPageData=function(t,r,i,s,c){var d;return o(this,void 0,void 0,(function(){var o,g,f,h,m,S,v,C,y;return n(this,(function(n){switch(n.label){case 0:return(o=i===a.CHECKOUT?I.getStandaloneCheckoutRequest(t):null)?[2,I.getStandaloneCheckoutPageData(t,o)]:(g="local"===process.env.NEXT_PUBLIC_ENV,f=!g&&c,u.init({apiUrl:process.env.NEXT_PUBLIC_GQL_URL,cdnUrl:process.env.NEXT_PUBLIC_CDN_URL}),p(),f?[3,7]:(h=t.locale)?[4,I.getSettings(h)]:[2,{props:{},notFound:!0}]);case 1:return(m=n.sent())&&m.storefront.mainStorefrontThemeId&&m.storefront.salesChannelId?[4,this.setStorefrontConfig(m)]:[2,{props:{},notFound:!0}];case 2:return n.sent(),S=m.themeLocalization,(v=new l(S.themeJson,t.params,i,m.merchantSettings)).possiblePageTypes=s||(i?[i]:[]),c?[3,4]:[4,v.getPageData()];case 3:if(n.sent(),!v.page)return[2,{props:{},notFound:!0}];n.label=4;case 4:return C=c?v.theme.components.map((function(e){return e.id})):(null===(d=v.page)||void 0===d?void 0:d.components.map((function(e){return e.componentId})))||[],[4,this.setTranslations(m,C,i,c,h)];case 5:return n.sent(),[4,this.getExtraProps(m,v,i)];case 6:return y=n.sent(),r?[2,{props:e(e({},v.nextPageData.props),y)}]:[2,{props:e(e({},v.nextPageData.props),y),revalidate:60}];case 7:return[2,{props:{}}];case 8:return[2]}}))}))},I.getStandaloneCheckoutPageData=function(t,r){var i,s;return o(this,void 0,void 0,(function(){var o,c,p,d,g,h,m,S;return n(this,(function(n){switch(n.label){case 0:return o={props:{},notFound:!0},t.locale?[4,I.getStandaloneCheckoutSettings(r)]:[2,o];case 1:return(c=n.sent())&&c.storefront.mainStorefrontThemeId&&c.storefront.salesChannelId?((p=new l(I.getCheckoutThemeJson(c),t.params,a.CHECKOUT,c.merchantSettings)).possiblePageTypes=[a.CHECKOUT],[4,p.getPageData()]):[2,o];case 2:return n.sent(),p.page?(d=I.getStandaloneApiConfig(c.apiKey,c.storefront.id,c.routing.id),[4,Promise.all([f({},d),I.loadStandaloneCheckoutTranslations(c)])]):[2,o];case 3:return g=n.sent(),h=g[0],m=g[1],I.applyStorefrontConfig(c,!0),u.init({translations:m}),S=e(e({},p.nextPageData.props),I.buildCheckoutExtraProps(c,p,h)),(null===(i=S.configJson)||void 0===i?void 0:i.storefrontId)!==c.storefront.id?(console.error("[checkout] CONFIG STOREFRONT MISMATCH",{expected:c.storefront.id,actual:null===(s=S.configJson)||void 0===s?void 0:s.storefrontId}),[2,o]):[2,{props:S}]}}))}))},I.getStaticProps=function(e,t,r,i){return o(this,void 0,void 0,(function(){return n(this,(function(o){switch(o.label){case 0:return[4,I.getPageData(e,!1,t,r,i)];case 1:return[2,o.sent()]}}))}))},I.getServerSideProps=function(e,t){return o(this,void 0,void 0,(function(){return n(this,(function(o){switch(o.label){case 0:return[4,I.getPageData(e,!0,t)];case 1:return[2,o.sent()]}}))}))},I.createColorStyle=function(e){var t;if(null===(t=e.colors)||void 0===t?void 0:t.length){var o=function(e){return"".concat(e).replace(/[<>{};]/g,"")};return"<style>:root{".concat(e.colors.map((function(e){return"".concat(o(e.key),":").concat(o(e.color),";")})).join(""),"}</style>")}},I.createColorScript=function(e){if(e.colors)return"<script>".concat(e.colors.map((function(e){return'document.documentElement.style.setProperty("'.concat(e.key,'","').concat(e.color,'");')})).join("\r\n"),"<\/script> \n ")},I.getCachedFontScript=function(e){return o(this,void 0,void 0,(function(){var t,o,r,i;return n(this,(function(n){switch(n.label){case 0:return(t=h(e.fontFamily))?(o="".concat(t,"|").concat(e.fontFamily.name),(r=I.fontScriptCache.get(o))&&r.expiresAt>Date.now()?[2,r.script]:[4,I.createFontScript(e)]):[2];case 1:return(i=n.sent())&&I.fontScriptCache.set(o,{script:i,expiresAt:Date.now()+864e5}),[2,i]}}))}))},I.createFontScript=function(e){return o(this,void 0,void 0,(function(){var t,o,r;return n(this,(function(n){switch(n.label){case 0:return(t=h(e.fontFamily))?[4,fetch(t,{headers:{"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36"}})]:[3,3];case 1:return[4,n.sent().text()];case 2:return o=n.sent(),r=o.replace(new RegExp("fonts.gstatic.com","g"),"fonts.myikas.com"),[2,"<style>\n ".concat(r,"\n\n body { \n font-family: '").concat(e.fontFamily.name,'\', -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;\n } \n\n </style>')];case 3:return[2]}}))}))},I.startTime=Date.now(),I.fontScriptCache=new Map,I}();!function(e){e.STUDIO="studio",e.HEADLESS="headless"}(P||(P={}));export{P as CheckoutStorefrontType,I as IkasNextPageDataProvider};
1
+ import{__assign as e,__spreadArray as t,__awaiter as o,__generator as n}from'./../ext/tslib/tslib.es6.js';import r from"fs";import i from"path";import s from"next/config.js";import{IkasThemeJsonPageType as a,IkasThemeJsonStockPreference as c}from"@ikas/storefront-models";import{IkasPageDataProvider as l}from"@ikas/storefront-providers";import{IkasStorefrontConfig as u}from"@ikas/storefront-config";import{setAPIClientConfig as p,getStorefrontSettings as d,listMerchantSettings as g,listCheckoutSettings as f}from"@ikas/storefront-api";import{getGoogleFontHref as h}from"../utils/google-fonts.js";import{I18NFileReader as m,CHECKOUT_TRANSLATION_NAMESPACE as S,readDefaultCheckoutTranslations as v}from"../utils/i18n.js";import{createFile as y,deleteDirContent as C}from"../utils/fs.js";import{getRedirectGuardScript as P}from"../utils/redirect-guard/index.js";var T,I=function(){function I(){}return I.getStandaloneCheckoutRequest=function(e){var t,o=e.req,n=null===(t=null==o?void 0:o.headers)||void 0===t?void 0:t["x-settings-path"];if(!n||"string"!=typeof n)return null;var r=function(e){var t=o.headers[e];return"string"==typeof t&&t?t:void 0},i=r("x-storefront-type");return{requestPath:I.getRequestPath(o)||"",settingsPath:n,projectJsonPath:r("x-project-json-path"),deployDir:r("x-deploy-dir"),host:r("x-host"),storefrontType:i===T.HEADLESS?T.HEADLESS:T.STUDIO}},I.getRequestPath=function(e){var t;try{var o=null===(t=e[Object.getOwnPropertySymbols(e).find((function(e){return"Symbol(NextRequestMeta)"===e.toString()}))])||void 0===t?void 0:t.__NEXT_INIT_URL;if(!o)return e.url;var n=new URL(o,"http://localhost");return n.pathname+n.search}catch(t){return e.url}},I.readJsonFile=function(e){return JSON.parse(r.readFileSync(e,"utf8"))},I.ensureCheckoutPage=function(o){var n=o.components||[],r=o.pages||[],i=n.some((function(e){return"checkout"===e.id})),s=r.some((function(e){return e.type===a.CHECKOUT}));return i&&s?o:e(e({},o),{components:i?n:t(t([],n,!0),[{id:"checkout",dir:"",displayName:"Checkout",props:[],isHeader:!1,isFooter:!1,defaultPropValuesTranslations:{}}],!1),pages:s?r:t(t([],r,!0),[{id:"checkout",name:"Checkout",type:a.CHECKOUT,slug:null,pageTitle:null,description:null,components:[{id:"checkout",componentId:"checkout",propValues:{}}],specifications:null,canonicals:null,disableIndex:null}],!1)})},I.getCheckoutThemeJson=function(e){return e.storefrontType===T.STUDIO?e.projectJson.checkoutThemeJson:e.themeLocalization.themeJson},I.getHeadlessRouting=function(e,t,o){var n=null==o?void 0:o.toLowerCase(),r=n?e.find((function(e){var t;return(null===(t=e.domain)||void 0===t?void 0:t.toLowerCase())===n})):void 0;if(r)return r;var i=t.split("?")[0].split("/")[1],s=i?e.find((function(e){return e.path===i})):void 0;return s||(e.find((function(e){return!e.domain&&!e.path}))||e[0])},I.getStudioRouting=function(e,t){var o=t.split("?")[0].split("/")[1];return o="checkout"===o?null:o,e.find((function(e){return o?e.path===o:!e.path}))},I.getHeadlessLocalizationPath=function(e,t,o){var n=i.join(e,"localizations"),s=i.join(n,"".concat(t.mainStorefrontThemeId,"_").concat(o,".json"));if(r.existsSync(s))return s;try{var a=r.readdirSync(n).filter((function(e){return e.endsWith("_".concat(o,".json"))}));if(1===a.length)return i.join(n,a[0])}catch(e){}},I.getStandaloneApiConfig=function(e,t,o){return{URL:process.env.INTERNAL_GQL_URL||process.env.NEXT_PUBLIC_GQL_URL||"",HEADERS:{"x-api-key":e||"","x-sfid":t,"x-sfrid":o,"x-timezone":Intl.DateTimeFormat().resolvedOptions().timeZone||""}}},I.getStandaloneCheckoutSettings=function(e){var r,i;return o(this,void 0,void 0,(function(){var o,s,a,l,u,p,d,f,h,m,S,v,y,C,P,k,L,R,w,O,E,b,J,D,B;return n(this,(function(n){switch(n.label){case 0:o=e.requestPath,s=e.settingsPath,a=e.projectJsonPath,l=e.deployDir,u=e.host,p=e.storefrontType,d=p===T.STUDIO,n.label=1;case 1:if(n.trys.push([1,11,,12]),!d&&!l)return console.error("[checkout] Deploy dir missing for headless"),[2,null];if(!(null==(f=I.readJsonFile(s))?void 0:f.storefront))return console.error("[checkout] Settings missing"),[2,null];if(h=void 0,d){if(!a)return console.error("[checkout] Project json path missing for studio"),[2,null];h=I.readJsonFile(a)}return m=f.storefront,S=d?I.getStudioRouting(m.routings,o):I.getHeadlessRouting(m.routings,o,u),(v=S?d?null===(r=f.localizationMap)||void 0===r?void 0:r[S.id]:I.getHeadlessLocalizationPath(l,m,S.locale):void 0)&&S?(y=f.merchantSettings)?[3,3]:[4,g({},I.getStandaloneApiConfig(f.apiKey,m.id,S.id))]:(console.error("[checkout] Theme localization path or routing missing"),[2,null]);case 2:if(!(C=n.sent()).isSuccess||!C.data)return console.error("[checkout] Merchant settings fetch failed"),[2,null];y=C.data,n.label=3;case 3:return y.address=null,delete y.merchantAddress,P=I.readJsonFile(v),k=t([],f.storefrontJSScripts||[],!0),L=[],R=void 0,w=void 0,d?(h.checkoutThemeJson=I.ensureCheckoutPage(h.checkoutThemeJson||{}),O=null===(i=m.indexPageSeoSettings)||void 0===i?void 0:i.find((function(e){return e.locale===S.locale})),R={id:(null==O?void 0:O.favIcon)||null},w=c.SHOW_ALL,[3,10]):[3,4];case 4:if(P.themeJson=I.ensureCheckoutPage(P.themeJson),E=P.themeJson.settings,R=null==E?void 0:E.favicon,w=null==E?void 0:E.stockPreference,!E)return[3,10];b=I.createColorStyle(E),J=void 0,n.label=5;case 5:return n.trys.push([5,8,,9]),E.fontFamily?[4,I.getCachedFontScript(E)]:[3,7];case 6:J=n.sent(),n.label=7;case 7:return[3,9];case 8:return D=n.sent(),console.error("[checkout] Font fetch failed",D),[3,9];case 9:b&&L.push(b),J&&L.push(J),n.label=10;case 10:return[2,{storefrontType:p,storefront:m,themeLocalization:P,salesChannel:f.salesChannel,routing:S,favicon:R,stockPreference:w,storefrontJSScripts:k,themeStyleScripts:L,highPriorityStoreFrontJSScripts:f.highPriorityStoreFrontJSScripts||[],domain:f.domain,productBackInStockSettings:f.productBackInStockSettings?{customerLoginRequired:f.productBackInStockSettings.customerLoginRequired}:null,customerReviewSettings:f.customerReviewSettings?{customerLoginRequired:f.customerReviewSettings.customerLoginRequired||!1,customerPurchaseRequired:f.customerReviewSettings.customerPurchaseRequired||!1}:null,merchantSettings:y,customerSettings:f.customerSettings,custom:f.custom,storefrontPopups:f.storefrontPopups||[],loyaltyPrograms:f.loyaltyPrograms||[],payWithIkasUrl:f.payWithIkasUrl,projectJson:h,deployDir:l,apiKey:f.apiKey}];case 11:return B=n.sent(),console.error("[checkout] Settings read error",B),[2,null];case 12:return[2]}}))}))},I.readLocalTheme=function(){return new Promise((function(e,t){r.readFile("./src/theme.json",{flag:"a+"},(function(o,n){if(o)return t(o);var r=n.length?JSON.parse(n.toString()):{};e(r)}))}))},I.readSettingsFile=function(){return new Promise((function(e){var t,o,n=null===(o=null===(t=s())||void 0===t?void 0:t.serverRuntimeConfig)||void 0===o?void 0:o.SETTINGS;if(!n)return console.error("SETTINGS PATH MISSING!!!"),e(null);r.readFile(n,{flag:"a+"},(function(t,o){if(t)return console.error("SETTINGS FILE READ ERROR!!!"),console.error(t),e(null);var n=o.length?JSON.parse(o.toString()):{};e(n)}))}))},I.cacheLocalSettingsFile=function(e){return o(this,void 0,void 0,(function(){var t,o;return n(this,(function(n){switch(n.label){case 0:return[4,C(t=".ikas")];case 1:return n.sent(),o="settings-".concat(this.startTime,".json"),[4,y(t,o,JSON.stringify(e,null,2))];case 2:return n.sent(),[2]}}))}))},I.readLocalSettingsFile=function(){try{var e=r.readFileSync(".ikas/settings-".concat(this.startTime,".json"));if(e&&e.length)return JSON.parse(e.toString())}catch(e){}},I.getLocalSettings=function(e){return o(this,void 0,void 0,(function(){var t,o,r,i,s,a,c,l,u,p,g;return n(this,(function(n){switch(n.label){case 0:return[4,I.readLocalSettingsFile()];case 1:return(t=n.sent())?[3,4]:[4,d()];case 2:return(o=n.sent()).isSuccess&&o.data?(t=o.data,[4,this.cacheLocalSettingsFile(t)]):(console.error("Storefront settings fetch failed!"),console.error(o),[2,null]);case 3:n.sent(),n.label=4;case 4:return r=t.storefront,i=t.salesChannel,s=[],a=[],c=t.productBackInStockSettings?{customerLoginRequired:t.productBackInStockSettings.customerLoginRequired}:null,l=t.customerReviewSettings?{customerLoginRequired:t.customerReviewSettings.customerLoginRequired||!1,customerPurchaseRequired:t.customerReviewSettings.customerPurchaseRequired||!1}:null,[4,I.readLocalTheme()];case 5:return u=n.sent(),p=I.createColorScript(u.settings),[4,I.createFontScript(u.settings)];case 6:return g=n.sent(),p&&a.push(p),g&&a.push(g),[2,{storefrontType:T.HEADLESS,storefront:r,themeLocalization:{id:"",locale:"en",privacyPolicy:null,returnPolicy:null,storefrontId:r.id,storefrontThemeId:"",termsOfService:null,imprint:null,shippingPolicy:null,themeJson:u},salesChannel:i,routing:r.routings.length?r.routings.find((function(t){return t.locale===e||t.id===e}))||r.routings[0]:{countryCodes:[],domain:"",dynamicCurrencySettings:{roundingFormat:null,targetCurrencyCode:""},id:"",locale:"en",path:null,priceListId:null,currencyCode:"USD",currencySymbol:"$"},favicon:u.settings.favicon,stockPreference:u.settings.stockPreference,storefrontJSScripts:s,themeStyleScripts:a,highPriorityStoreFrontJSScripts:[],domain:"localhost:3333",productBackInStockSettings:c,customerReviewSettings:l,merchantSettings:t.merchantSettings,customerSettings:t.customerSettings,storefrontPopups:t.storefrontPopups,loyaltyPrograms:t.loyaltyPrograms}]}}))}))},I.getProdSettings=function(e){return o(this,void 0,void 0,(function(){var t=this;return n(this,(function(i){return[2,new Promise((function(i){return o(t,void 0,void 0,(function(){var t,s,a,c,l,u,p,d,f,h,m,S,v,y;return n(this,(function(C){switch(C.label){case 0:return[4,I.readSettingsFile()];case 1:return(t=C.sent())&&t.localizationMap?(s=t.storefront,a=t.salesChannel,c=t.localizationMap,l=t.storefrontJSScripts||[],u=[],p=t.highPriorityStoreFrontJSScripts||[],d=t.domain,f=t.productBackInStockSettings?{customerLoginRequired:t.productBackInStockSettings.customerLoginRequired}:null,h=t.customerReviewSettings?{customerLoginRequired:t.customerReviewSettings.customerLoginRequired||!1,customerPurchaseRequired:t.customerReviewSettings.customerPurchaseRequired||!1}:null,(m=t.merchantSettings)?[3,3]:[4,g({})]):[2,i(null)];case 2:if(!(S=C.sent()).isSuccess||!S.data)return console.error("MERCHANT SETTINGS FETCH FAILED!"),[2,i(null)];m=S.data,C.label=3;case 3:return m&&(m.address=null,delete m.merchantAddress),v=c[e],y=s.routings.find((function(t){return t.id===e||t.path===e})),v&&y?(r.readFile(v,{flag:"a+"},(function(e,r){return o(this,void 0,void 0,(function(){var o,c,g,S,v,C,P;return n(this,(function(n){switch(n.label){case 0:return e?(console.error("THEME LOCALIZATION FILE READ ERROR!!!"),console.error(e),[2,i(null)]):(o=r.length?JSON.parse(r.toString()):{},g=(c=o).themeJson.settings.favicon,S=c.themeJson.settings.stockPreference,c.themeJson.settings?(v=I.createColorScript(c.themeJson.settings),[4,I.createFontScript(c.themeJson.settings)]):[3,2]);case 1:C=n.sent(),v&&u.push(v),C&&u.push(C),n.label=2;case 2:return P=t.customerSettings,i({storefrontType:T.HEADLESS,storefront:s,themeLocalization:c,salesChannel:a,routing:y,favicon:g,stockPreference:S,storefrontJSScripts:l,themeStyleScripts:u,highPriorityStoreFrontJSScripts:p,domain:d,productBackInStockSettings:f,customerReviewSettings:h,merchantSettings:m,customerSettings:P,custom:t.custom,storefrontPopups:t.storefrontPopups,loyaltyPrograms:t.loyaltyPrograms,payWithIkasUrl:t.payWithIkasUrl}),[2]}}))}))})),[2]):(console.error("THEME LOCALIZATION PATH OR ROUTING MISSING!!!"),[2,i(null)])}}))}))}))]}))}))},I.getSettings=function(e){return o(this,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return"local"===process.env.NEXT_PUBLIC_ENV?[4,this.getLocalSettings(e)]:[3,2];case 1:case 3:return[2,t.sent()];case 2:return[4,this.getProdSettings(e)]}}))}))},I.setStorefrontConfig=function(e,t,r){return o(this,void 0,void 0,(function(){var o;return n(this,(function(n){return o=t!==a.CHECKOUT&&!r,I.applyStorefrontConfig(e,!1,o),[2]}))}))},I.applyStorefrontConfig=function(t,o,n){var r,i;void 0===o&&(o=!1),void 0===n&&(n=!1);var s=t.storefront,a=t.salesChannel,c=t.routing,l=t.favicon,d=t.stockPreference,g=t.storefrontJSScripts,f=t.themeStyleScripts,h=t.highPriorityStoreFrontJSScripts,m=t.domain,S=t.productBackInStockSettings,v=t.customerReviewSettings,y=t.merchantSettings,C=t.customerSettings,T=t.custom,I=t.storefrontPopups,k=t.loyaltyPrograms,L=t.payWithIkasUrl,R=t.apiKey;o&&u.clear(),u.init(e(e({},R?{apiKey:R}:{}),{apiUrl:process.env.INTERNAL_GQL_URL||process.env.NEXT_PUBLIC_GQL_URL,cdnUrl:process.env.NEXT_PUBLIC_CDN_URL,storefrontId:s.id,storefrontRoutingId:c.id,storefrontThemeId:s.mainStorefrontThemeId,storefrontB2BSettings:s.b2bSettings||void 0,storefrontType:s.type,salesChannelId:s.salesChannelId,priceListId:c.priceListId||void 0,stockLocationIds:null===(r=a.stockLocations)||void 0===r?void 0:r.map((function(e){return e.id})),routings:s.routings,paymentGateways:a.paymentGateways||[],gtmId:s.gtmId||void 0,fbpId:s.fbpId||void 0,analytics4Id:s.analytics4Id||void 0,universalAnalyticsId:s.universalAnalyticsId||void 0,tiktokPixelId:s.tiktokPixelId||void 0,openAiPixelId:s.openAiPixelId||void 0,favicon:l||null,pickUpStockLocationIds:s.pickUpStockLocationIds&&s.pickUpStockLocationIds.length?s.pickUpStockLocationIds:null,stockPreference:d||null,storefrontJSScripts:g||[],themeStyleScripts:f||[],highPriorityStoreFrontJSScripts:h||[],navigationWarningScript:n?P(t):void 0,domain:m,productBackInStockSettings:S,customerReviewSettings:v,merchantSettings:y,customerSettings:C,metaTemplates:s.metaTemplates||null,custom:T||null,indexPageSeoSettings:s.indexPageSeoSettings,storefrontPopups:I,loyaltyPrograms:k,payWithIkasUrl:L,milesSmilesSettings:(null===(i=s.socialLoginSettings)||void 0===i?void 0:i.find((function(e){return"miles_smiles"===e.provider})))||null})),p()},I.setTranslations=function(e,r,i,c,l){return o(this,void 0,void 0,(function(){var o,p,d,g,f,h,S,v;return n(this,(function(n){switch(n.label){case 0:return o=s().serverRuntimeConfig,p=e.routing,d="local"===process.env.NEXT_PUBLIC_ENV,g=e.themeLocalization.themeJson.components.filter((function(e){return c||r.includes(e.id)})),f=t(["common"],g.map((function(e){return e.dir})),!0),(i===a.CHECKOUT||c)&&f.push("checkout-page"),h=o.nextI18nConf,S=d&&l?l:p.locale,[4,new m(S,f,d?void 0:h.localePath).read()];case 1:return v=n.sent(),u.init({translations:v}),[2]}}))}))},I.getLocaleJsonNamespace=function(e,t){try{var o="string"==typeof e?JSON.parse(e):e,n=null==o?void 0:o[t];return n&&"object"==typeof n?n:void 0}catch(e){return void console.error("[checkout] localeJson parse error",e)}},I.loadStandaloneCheckoutTranslations=function(e){var t,s,a,c;return o(this,void 0,void 0,(function(){var o,l,u,p,d,g,f;return n(this,(function(n){switch(n.label){case 0:o=e.routing.locale;try{e.storefrontType===T.STUDIO?l=null===(a=null===(s=null===(t=e.projectJson)||void 0===t?void 0:t.i18nTranslations)||void 0===s?void 0:s[o])||void 0===a?void 0:a.checkout_page:!(l=I.getLocaleJsonNamespace(null===(c=e.themeLocalization)||void 0===c?void 0:c.localeJson,S))&&e.deployDir&&(u=i.join(e.deployDir,"public","locales",o),(p=["".concat(S,".json"),"checkout.json"].map((function(e){return i.join(u,e)})).find((function(e){return r.existsSync(e)})))&&(l=I.readJsonFile(p)))}catch(e){console.error("[checkout] Translations read error",e)}n.label=1;case 1:return n.trys.push([1,3,,4]),[4,v(o)];case 2:return d=n.sent(),[3,4];case 3:if(g=n.sent(),console.error("[checkout] Default translations read error",g),!l)throw g;return[3,4];case 4:return[2,(f={},f[S]=l?I.mergeTranslations(d||{},l):d,f)]}}))}))},I.mergeTranslations=function(t,o){var n=e({},t);return Object.entries(o).forEach((function(e){var o=e[0],r=e[1],i=null==t?void 0:t[o];r&&"object"==typeof r&&!Array.isArray(r)?n[o]=i&&"object"==typeof i&&!Array.isArray(i)?I.mergeTranslations(i,r):r:("string"==typeof r&&""!==r||void 0===i&&void 0!==r)&&(n[o]=r)})),n},I.getExtraProps=function(e,t,r){var i;return o(this,void 0,void 0,(function(){var o;return n(this,(function(n){switch(n.label){case 0:return r===a.CHECKOUT&&(null===(i=t.page)||void 0===i?void 0:i.components[0])?[4,f({})]:[2,{}];case 1:return o=n.sent(),[2,I.buildCheckoutExtraProps(e,t,o)]}}))}))},I.buildCheckoutExtraProps=function(e,t,o){var n,r,i,s,a,c,l,u,p,d,g,f,h,m,S,v,y,C,P,T,I,k,L,R,w={},O=e.themeLocalization,E=null===(n=t.page)||void 0===n?void 0:n.components[0];if(E){o.isSuccess||(console.error("CHECKOUT SETTINGS FETCH FAILED!"),console.error(o.graphQLErrors),console.error(o.errorCodes));var b={logo:null!==(r=E.propValues.logo)&&void 0!==r?r:null,showTax:null===(i=E.propValues.showTax)||void 0===i||i,showLoyaltyPoints:null!==(s=E.propValues.showLoyaltyPoints)&&void 0!==s&&s,showCampaignOffersDesign:null!==(a=E.propValues.showCampaignOffersDesign)&&void 0!==a&&a,showCampaignIsBiggerImage:null!==(c=E.propValues.showCampaignIsBiggerImage)&&void 0!==c&&c,campaignOfferIsSmallDesign:null!==(l=E.propValues.campaignOfferIsSmallDesign)&&void 0!==l&&l,showCampaignHideDiscountBadge:null!==(u=E.propValues.showCampaignHideDiscountBadge)&&void 0!==u&&u,campaignOfferCountdownStyleIsLine:null!==(p=E.propValues.campaignOfferCountdownStyleIsLine)&&void 0!==p&&p,campaignOfferCountdownStyleIsLineSuccessPage:null!==(d=E.propValues.campaignOfferCountdownStyleIsLineSuccessPage)&&void 0!==d&&d,campaignOffersEnableMiddlePhase:null!==(g=E.propValues.campaignOffersEnableMiddlePhase)&&void 0!==g&&g,campaignOffersTitleColor:null!==(f=E.propValues.campaignOffersTitleColor)&&void 0!==f?f:null,campaignOffersDescriptionColor:null!==(h=E.propValues.campaignOffersDescriptionColor)&&void 0!==h?h:null,campaignOffersContainerBgColor:null!==(m=E.propValues.campaignOffersContainerBgColor)&&void 0!==m?m:null,campaignOffersDiscountPercentageColor:null!==(S=E.propValues.campaignOffersDiscountPercentageColor)&&void 0!==S?S:null,campaignOffersDiscountPercentageBgColor:null!==(v=E.propValues.campaignOffersDiscountPercentageBgColor)&&void 0!==v?v:null,campaignOffersCountdownTextColor:null!==(y=E.propValues.campaignOffersCountdownTextColor)&&void 0!==y?y:null,campaignOffersCountdownTimeColor:null!==(C=E.propValues.campaignOffersCountdownTimeColor)&&void 0!==C?C:null,campaignOffersCountdownBgColor:null!==(P=E.propValues.campaignOffersCountdownBgColor)&&void 0!==P?P:null,campaignOffersMiddlePhaseOverlayColor:null!==(T=E.propValues.campaignOffersMiddlePhaseOverlayColor)&&void 0!==T?T:null,buttonBgColor:E.propValues.buttonBgColor,buttonTextColor:E.propValues.buttonTextColor,buttonDisabledBgColor:E.propValues.buttonDisabledBgColor,buttonDisabledTextColor:E.propValues.buttonDisabledTextColor,primaryTextColor:E.propValues.primaryTextColor,secondaryTextColor:E.propValues.secondaryTextColor,primaryBgColor:E.propValues.primaryBgColor,secondaryBgColor:E.propValues.secondaryBgColor,borderColor:E.propValues.borderColor,cardBgColor:E.propValues.cardBgColor,errorColor:E.propValues.errorColor,errorLightColor:E.propValues.errorLightColor,warningColor:E.propValues.warningColor,warningLightColor:E.propValues.warningLightColor,successColor:E.propValues.successColor,successLightColor:E.propValues.successLightColor,secondaryButtonBgColor:null!==(I=E.propValues.secondaryButtonBgColor)&&void 0!==I?I:null,secondaryButtonTextColor:null!==(k=E.propValues.secondaryButtonTextColor)&&void 0!==k?k:null,secondaryButtonBorderColor:null!==(L=E.propValues.secondaryButtonBorderColor)&&void 0!==L?L:null};w.customizationProps=b,w.returnPolicy=O.returnPolicy,w.privacyPolicy=O.privacyPolicy,w.termsOfService=O.termsOfService,w.imprint=O.imprint,w.shippingPolicy=O.shippingPolicy,w.checkoutSettings=(null===(R=null==o?void 0:o.data)||void 0===R?void 0:R.length)?o.data[0]:null}return w},I.getPageData=function(t,r,i,s,c){var d;return o(this,void 0,void 0,(function(){var o,g,f,h,m,S,v,y,C;return n(this,(function(n){switch(n.label){case 0:return(o=i===a.CHECKOUT?I.getStandaloneCheckoutRequest(t):null)?[2,I.getStandaloneCheckoutPageData(t,o)]:(g="local"===process.env.NEXT_PUBLIC_ENV,f=!g&&c,u.init({apiUrl:process.env.NEXT_PUBLIC_GQL_URL,cdnUrl:process.env.NEXT_PUBLIC_CDN_URL}),p(),f?[3,7]:(h=t.locale)?[4,I.getSettings(h)]:[2,{props:{},notFound:!0}]);case 1:return(m=n.sent())&&m.storefront.mainStorefrontThemeId&&m.storefront.salesChannelId?[4,this.setStorefrontConfig(m,i,c)]:[2,{props:{},notFound:!0}];case 2:return n.sent(),S=m.themeLocalization,(v=new l(S.themeJson,t.params,i,m.merchantSettings)).possiblePageTypes=s||(i?[i]:[]),c?[3,4]:[4,v.getPageData()];case 3:if(n.sent(),!v.page)return[2,{props:{},notFound:!0}];n.label=4;case 4:return y=c?v.theme.components.map((function(e){return e.id})):(null===(d=v.page)||void 0===d?void 0:d.components.map((function(e){return e.componentId})))||[],[4,this.setTranslations(m,y,i,c,h)];case 5:return n.sent(),[4,this.getExtraProps(m,v,i)];case 6:return C=n.sent(),r?[2,{props:I.omitPaymentStepScripts(e(e({},v.nextPageData.props),C),t)}]:[2,{props:e(e({},v.nextPageData.props),C),revalidate:60}];case 7:return[2,{props:{}}];case 8:return[2]}}))}))},I.getStandaloneCheckoutPageData=function(t,r){var i,s;return o(this,void 0,void 0,(function(){var o,c,p,d,g,h,m,S;return n(this,(function(n){switch(n.label){case 0:return o={props:{},notFound:!0},t.locale?[4,I.getStandaloneCheckoutSettings(r)]:[2,o];case 1:return(c=n.sent())&&c.storefront.mainStorefrontThemeId&&c.storefront.salesChannelId?((p=new l(I.getCheckoutThemeJson(c),t.params,a.CHECKOUT,c.merchantSettings)).possiblePageTypes=[a.CHECKOUT],[4,p.getPageData()]):[2,o];case 2:return n.sent(),p.page?(d=I.getStandaloneApiConfig(c.apiKey,c.storefront.id,c.routing.id),[4,Promise.all([f({},d),I.loadStandaloneCheckoutTranslations(c)])]):[2,o];case 3:return g=n.sent(),h=g[0],m=g[1],I.applyStorefrontConfig(c,!0),u.init({translations:m}),S=e(e({},p.nextPageData.props),I.buildCheckoutExtraProps(c,p,h)),(null===(i=S.configJson)||void 0===i?void 0:i.storefrontId)!==c.storefront.id?(console.error("[checkout] CONFIG STOREFRONT MISMATCH",{expected:c.storefront.id,actual:null===(s=S.configJson)||void 0===s?void 0:s.storefrontId}),[2,o]):[2,{props:I.omitPaymentStepScripts(S,t)}]}}))}))},I.omitPaymentStepScripts=function(t,o){var n="query"in o?o.query.step:void 0;return"true"===process.env.NEXT_PUBLIC_RESTRICT_PAYMENT_SCRIPTS&&"payment"===n&&t.configJson?e(e({},t),{configJson:e(e({},t.configJson),{storefrontJSScripts:[],highPriorityStoreFrontJSScripts:[]})}):t},I.getStaticProps=function(e,t,r,i){return o(this,void 0,void 0,(function(){return n(this,(function(o){switch(o.label){case 0:return[4,I.getPageData(e,!1,t,r,i)];case 1:return[2,o.sent()]}}))}))},I.getServerSideProps=function(e,t){return o(this,void 0,void 0,(function(){return n(this,(function(o){switch(o.label){case 0:return[4,I.getPageData(e,!0,t)];case 1:return[2,o.sent()]}}))}))},I.createColorStyle=function(e){var t;if(null===(t=e.colors)||void 0===t?void 0:t.length){var o=function(e){return"".concat(e).replace(/[<>{};]/g,"")};return"<style>:root{".concat(e.colors.map((function(e){return"".concat(o(e.key),":").concat(o(e.color),";")})).join(""),"}</style>")}},I.createColorScript=function(e){if(e.colors)return"<script>".concat(e.colors.map((function(e){return'document.documentElement.style.setProperty("'.concat(e.key,'","').concat(e.color,'");')})).join("\r\n"),"<\/script> \n ")},I.getCachedFontScript=function(e){return o(this,void 0,void 0,(function(){var t,o,r,i;return n(this,(function(n){switch(n.label){case 0:return(t=h(e.fontFamily))?(o="".concat(t,"|").concat(e.fontFamily.name),(r=I.fontScriptCache.get(o))&&r.expiresAt>Date.now()?[2,r.script]:[4,I.createFontScript(e)]):[2];case 1:return(i=n.sent())&&I.fontScriptCache.set(o,{script:i,expiresAt:Date.now()+864e5}),[2,i]}}))}))},I.createFontScript=function(e){return o(this,void 0,void 0,(function(){var t,o,r;return n(this,(function(n){switch(n.label){case 0:return(t=h(e.fontFamily))?[4,fetch(t,{headers:{"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36"}})]:[3,3];case 1:return[4,n.sent().text()];case 2:return o=n.sent(),r=o.replace(new RegExp("fonts.gstatic.com","g"),"fonts.myikas.com"),[2,"<style>\n ".concat(r,"\n\n body { \n font-family: '").concat(e.fontFamily.name,'\', -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;\n } \n\n </style>')];case 3:return[2]}}))}))},I.startTime=Date.now(),I.fontScriptCache=new Map,I}();!function(e){e.STUDIO="studio",e.HEADLESS="headless"}(T||(T={}));export{T as CheckoutStorefrontType,I as IkasNextPageDataProvider};
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Which hosts the navigation warning lets through without asking (FR-1077). Pure on purpose: the
3
+ * guard's `index.ts` reads the settings and the env and hands the values in, so tests import this
4
+ * file as it is.
5
+ *
6
+ * Two kinds of entry, the same two the backend accepts in `navigationWarningSettings.allowedHosts`
7
+ * — and the matching rule every storefront has to share:
8
+ * - `ornek.com` covers `ornek.com` and its `www.` twin (and `www.ornek.com` covers both too) —
9
+ * merchants type the bare name while their links point at `www.`.
10
+ * - `*.ornek.com` covers every subdomain under `ornek.com`, at any depth, but not `ornek.com`
11
+ * itself: a merchant who wants both adds both.
12
+ */
13
+ /**
14
+ * ikas's starter list. It is not stored anywhere: every store gets it on top of its own
15
+ * `allowedHosts`, and a merchant cannot take an entry out — which is why it holds exact hosts
16
+ * only. A wildcard here would also allow what anyone can publish under the same domain (Google
17
+ * Sites and Forms, a link shim such as `l.facebook.com`, a payment link), and that is exactly
18
+ * where a hijacked script would send a shopper. Payment providers are left out for the same
19
+ * reason: on a Studio page payment happens in checkout, where the warning never runs.
20
+ */
21
+ export declare const IKAS_DEFAULT_ALLOWED_HOSTS: readonly string[];
22
+ /**
23
+ * Where ikas's own social login sends the visitor (`socialLogin` in the storefront's customer
24
+ * store). ikas's own flow, so it is never warned — whatever the merchant's list says.
25
+ */
26
+ export declare const SOCIAL_LOGIN_HOSTS: readonly string[];
27
+ /** The longest host name DNS allows. */
28
+ export declare const MAX_HOST_LENGTH = 253;
29
+ export declare type HostRules = {
30
+ /** Hosts allowed exactly, `www.` twins included. */
31
+ exact: string[];
32
+ /** `*.` entries without the `*.`: every host below one is allowed, the host itself is not. */
33
+ suffix: string[];
34
+ };
35
+ /**
36
+ * One list entry, as a merchant types it or the backend sends it, in the form the browser compares
37
+ * against — or null when it is not a host at all. Goes through `URL` so an IDN becomes the punycode
38
+ * a destination's `hostname` carries, and a scheme, credentials, port, path or query falls away:
39
+ * `https://Örnek.com:8080/a` → `xn--rnek-4qa.com`, `*.Ornek.com.` → `*.ornek.com`. What the
40
+ * backend rejects is rejected here too: IP addresses, single labels, `*` anywhere but the leftmost
41
+ * label, a wildcard over a bare TLD, and labels or hosts longer than DNS allows.
42
+ */
43
+ export declare function normalizeHostPattern(raw: unknown): string | null;
44
+ /**
45
+ * Normalized entries → the two sets the browser checks. Entries that are not normalized are
46
+ * skipped rather than trusted.
47
+ */
48
+ export declare function compileHostRules(patterns: readonly string[]): HostRules;
49
+ declare type OwnHostSources = {
50
+ /** The host this request was served on (`settingsData.domain`). */
51
+ domain?: string | null;
52
+ /** Each routing's own domain, for stores that give a language a domain of its own. */
53
+ routingDomains?: (string | null | undefined)[];
54
+ /** The store's connected domains, as the settings carry them. */
55
+ storefrontDomains?: {
56
+ name?: string | null;
57
+ redirectDomainName?: string | null;
58
+ deleted?: boolean | null;
59
+ }[] | null;
60
+ /** URLs of ikas's own services a flow leaves the page for (Pay with ikas, the storefront API). */
61
+ serviceUrls?: (string | null | undefined)[];
62
+ };
63
+ /**
64
+ * The hosts that are the store itself or ikas's own flows: never warned, never on the merchant's
65
+ * list. Wildcards are not accepted here — `*.myikas.com` in particular would cover every other
66
+ * store, a free trial one included.
67
+ */
68
+ export declare function collectOwnHosts({ domain, routingDomains, storefrontDomains, serviceUrls, }: OwnHostSources): string[];
69
+ export {};
@@ -0,0 +1 @@
1
+ import{__spreadArray as t}from'./../../ext/tslib/tslib.es6.js';var o=["instagram.com","facebook.com","m.facebook.com","x.com","twitter.com","youtube.com","m.youtube.com","youtu.be","tiktok.com","pinterest.com","tr.pinterest.com","pin.it","linkedin.com","tr.linkedin.com","threads.com","threads.net","t.me","wa.me","whatsapp.com","api.whatsapp.com","web.whatsapp.com","google.com","google.com.tr","maps.google.com","maps.app.goo.gl","g.page","search.google.com","play.google.com"],e=["accounts.google.com","www.facebook.com","m.facebook.com","appleid.apple.com","id.twitch.tv"],r=253,a=/^(\*\.)?[a-z0-9-]+(\.[a-z0-9-]+)+$/,n=/^\d+(\.\d+){3}$/;function c(t){if("string"!=typeof t)return null;var o=t.trim().toLowerCase();if(!o||o.length>253)return null;var e,r=o.startsWith("*.");r&&(o=o.slice(2));try{e=new URL(o.includes("://")?o:"http://"+o).hostname.replace(/\.$/,"")}catch(t){return null}if(n.test(e)||e.split(".").some((function(t){return t.length>63})))return null;var c=(r?"*.":"")+e;return a.test(c)?c:null}function i(t){var o=new Set,e=new Set;return t.forEach((function(t){if(c(t)===t)if(t.startsWith("*."))e.add(t.slice(2));else{var r=t.startsWith("www.")&&-1!==t.indexOf(".",4)?t.slice(4):t;o.add(r),o.add("www."+r)}})),{exact:Array.from(o),suffix:Array.from(e)}}function m(o){var e=o.domain,r=o.routingDomains,a=void 0===r?[]:r,n=o.storefrontDomains,i=void 0===n?[]:n,m=o.serviceUrls,s=void 0===m?[]:m,l=t(t(t([e],a,!0),(i||[]).filter((function(t){return!t.deleted})).reduce((function(t,o){return t.concat([o.name,o.redirectDomainName])}),[]),!0),s,!0),u=new Set;return l.forEach((function(t){var o=c(t);o&&!o.startsWith("*.")&&u.add(o)})),Array.from(u)}export{o as IKAS_DEFAULT_ALLOWED_HOSTS,r as MAX_HOST_LENGTH,e as SOCIAL_LOGIN_HOSTS,m as collectOwnHosts,i as compileHostRules,c as normalizeHostPattern};
@@ -0,0 +1,7 @@
1
+ import type { SettingsData } from "../../provider/page-data-next";
2
+ /**
3
+ * The navigation warning's inline script for this store's pages (FR-1116), or "" while the warning
4
+ * is off, which leaves the page exactly as it renders without the guard. Checkout never gets it:
5
+ * the caller skips that page type, and the standalone checkout does not call this at all.
6
+ */
7
+ export declare function getRedirectGuardScript(settings: SettingsData): string;
@@ -0,0 +1 @@
1
+ import{__spreadArray as o}from'./../../ext/tslib/tslib.es6.js';import{collectOwnHosts as r,compileHostRules as t,SOCIAL_LOGIN_HOSTS as s,IKAS_DEFAULT_ALLOWED_HOSTS as n}from"./hosts.js";import{buildRedirectGuardScript as i}from"./script.js";import{parseNavigationWarningSettings as e}from"./settings.js";import{getRedirectGuardTexts as m}from"./texts.js";function a(a){var f,l=e(a.storefront.navigationWarningSettings);if(!l)return"";var p=r({domain:a.domain,routingDomains:(a.storefront.routings||[]).map((function(o){return o.domain})),storefrontDomains:a.storefront.domains,serviceUrls:[a.payWithIkasUrl,process.env.NEXT_PUBLIC_GQL_URL,process.env.NEXT_PUBLIC_BASE_URL]}),u=t(o(o(o(o([],p,!0),s,!0),n,!0),l.allowedHosts,!0));return i({rules:u,texts:m(null===(f=a.routing)||void 0===f?void 0:f.locale)})}export{a as getRedirectGuardScript};
@@ -0,0 +1,42 @@
1
+ /**
2
+ * The navigation warning's browser half (FR-1077): the first script of every page while the store
3
+ * has the warning on, called as `RUNTIME(window, config)` — see `buildRedirectGuardScript`.
4
+ *
5
+ * WHY A STRING, like the analytics snippets in `render/head.ts`, and not a function inlined through
6
+ * `Function.prototype.toString`: what ships is then exactly what is written and tested here. A
7
+ * stringified function is whatever the compiler made of it — the minified SSR build and tsx's test
8
+ * transform can each add helpers that live outside the function, and the copy that reaches the
9
+ * browser is not the one the tests ran. Hence the rules for the source below: ES2017 (it runs
10
+ * before anything else on the page, in every browser a shopper has), ASCII only, and no backtick or
11
+ * `${` (it sits in a template literal).
12
+ *
13
+ * WHAT IT DOES. It cancels — synchronously, which is the actual protection — every top-level
14
+ * navigation to a host that is neither the store's own nor on the allowlist, and shows the shopper
15
+ * where the page wanted to send them. "Continue" repeats exactly that navigation; anything else
16
+ * leaves them on the page. Three ways in:
17
+ * - The Navigation API's `navigate` event, for every navigation same-origin code starts in this
18
+ * tab: `location.*`, `form.submit()`, meta refresh, `window.open(…, "_self")` and the theme
19
+ * Router's `location.href`. Browsers without the API get the other two only.
20
+ * - A `click` listener for links. Bubble phase, so a page handler that already prevented the click
21
+ * (a link used as a lightbox trigger) is left alone, and registered before the Router's own
22
+ * window listener, so a held link stops there — the Router re-issues every click as
23
+ * `location.href` or, for `target=_blank`, `window.open`, which fires no `navigate` here.
24
+ * - `window.open` itself, for windows opened with a user gesture behind them. One without is left
25
+ * to the browser's popup blocker: asking about it would let "Continue" open a popup the browser
26
+ * was about to block.
27
+ * - The links of same-origin frames — where a chat widget usually draws its window. A link that
28
+ * opens a new tab or takes this tab away is held; one that stays inside the frame is not, and the
29
+ * frame's own `window.open` is left alone so the widget's popups keep working. Frames are hooked
30
+ * on every `load`, as a widget rewriting its frame (`document.open`) wipes its listeners; adding
31
+ * the same listener again is otherwise a no-op.
32
+ *
33
+ * WHAT IT ASSUMES OF THE PAGE: nothing, since everything else on it — apps, GTM, the merchant's own
34
+ * scripts — runs after it and may be hostile. The built-ins it relies on are captured before they
35
+ * can be patched, nothing is reachable from the page (no global, a closed shadow root), Continue
36
+ * takes only a real click and not in the first 600ms, the first destination of a dialog cannot be
37
+ * swapped for another, and a dialog removed from the page counts as "stay". What it cannot catch
38
+ * is listed in the plan and the report: anything inside a cross-origin frame, navigations started
39
+ * by another origin's document (such a frame navigating the top window, a page using
40
+ * `window.opener`), `open` taken from a fresh frame, and anything that runs before it.
41
+ */
42
+ export declare const REDIRECT_GUARD_RUNTIME: string;
@@ -0,0 +1 @@
1
+ import{__makeTemplateObject as e}from'./../../ext/tslib/tslib.es6.js';var n,t=String.raw(n||(n=e(['(function (win, cfg) {\n "use strict";\n var doc = win.document;\n var FunctionP = win.Function.prototype;\n var uncurry = FunctionP.bind.bind(FunctionP.call);\n var apply = uncurry(FunctionP.apply);\n var describe = win.Object.getOwnPropertyDescriptor;\n var protoOf = win.Object.getPrototypeOf;\n var create = win.Object.create;\n var now = win.Date.now;\n\n function proto(name) {\n var C = win[name];\n return C ? C.prototype : null;\n }\n function getter(p, name) {\n var d = p ? describe(p, name) : null;\n return d && d.get ? uncurry(d.get) : null;\n }\n function setter(p, name) {\n var d = p ? describe(p, name) : null;\n return d && d.set ? uncurry(d.set) : null;\n }\n function method(p, name) {\n var f = p ? p[name] : null;\n return typeof f === "function" ? uncurry(f) : null;\n }\n\n var EventP = proto("Event");\n var NodeP = proto("Node");\n var ElementP = proto("Element");\n var DocumentP = proto("Document");\n var attachShadow = method(ElementP, "attachShadow");\n if (!doc || !EventP || !NodeP || !attachShadow) return;\n\n var listen = method(proto("EventTarget"), "addEventListener");\n var preventDefault = method(EventP, "preventDefault");\n var stopImmediatePropagation = method(EventP, "stopImmediatePropagation");\n var cancelableOf = getter(EventP, "cancelable");\n var defaultPreventedOf = getter(EventP, "defaultPrevented");\n var targetOf = getter(EventP, "target");\n var composedPath = method(EventP, "composedPath");\n var MouseEventP = proto("MouseEvent");\n var buttonOf = getter(MouseEventP, "button");\n var ctrlKeyOf = getter(MouseEventP, "ctrlKey");\n var metaKeyOf = getter(MouseEventP, "metaKey");\n var shiftKeyOf = getter(MouseEventP, "shiftKey");\n var altKeyOf = getter(MouseEventP, "altKey");\n var keyOf = getter(proto("KeyboardEvent"), "key");\n var persistedOf = getter(proto("PageTransitionEvent"), "persisted");\n var appendChild = method(NodeP, "appendChild");\n var removeChild = method(NodeP, "removeChild");\n var parentNodeOf = getter(NodeP, "parentNode");\n var nodeTypeOf = getter(NodeP, "nodeType");\n var isConnectedOf = getter(NodeP, "isConnected");\n var baseURIOf = getter(NodeP, "baseURI");\n var ownerDocumentOf = getter(NodeP, "ownerDocument");\n var setTextContent = setter(NodeP, "textContent");\n var localNameOf = getter(ElementP, "localName");\n var getAttribute = method(ElementP, "getAttribute");\n var getAttributeNS = method(ElementP, "getAttributeNS");\n var setAttribute = method(ElementP, "setAttribute");\n var removeAttribute = method(ElementP, "removeAttribute");\n var createElement = method(DocumentP, "createElement");\n var createTextNode = method(DocumentP, "createTextNode");\n var getElementsByTagName = method(DocumentP, "getElementsByTagName");\n var documentElementOf = getter(DocumentP, "documentElement");\n var activeElementOf = getter(DocumentP, "activeElement");\n var focus = method(proto("HTMLElement"), "focus");\n var DialogP = proto("HTMLDialogElement");\n var showModal = method(DialogP, "showModal");\n var closeDialog = method(DialogP, "close");\n var dialogOpenOf = getter(DialogP, "open");\n var submitForm = method(proto("HTMLFormElement"), "submit");\n var eachFormEntry = method(proto("FormData"), "forEach");\n var IFrameP = proto("HTMLIFrameElement");\n var contentWindowOf = getter(IFrameP, "contentWindow");\n var contentDocumentOf = getter(IFrameP, "contentDocument");\n var WeakMapC = win.WeakMap;\n var weakGet = method(WeakMapC && WeakMapC.prototype, "get");\n var weakSet = method(WeakMapC && WeakMapC.prototype, "set");\n var DataTransferC = win.DataTransfer;\n var URLC = win.URL;\n var hrefOf = getter(URLC.prototype, "href");\n var protocolOf = getter(URLC.prototype, "protocol");\n var hostnameOf = getter(URLC.prototype, "hostname");\n var StringP = win.String.prototype;\n var slice = method(StringP, "slice");\n var indexOf = method(StringP, "indexOf");\n var toLowerCase = method(StringP, "toLowerCase");\n var charCodeAt = method(StringP, "charCodeAt");\n var MutationObserverC = win.MutationObserver;\n var observe = method(proto("MutationObserver"), "observe");\n var disconnect = method(proto("MutationObserver"), "disconnect");\n var loc = win.location;\n var nativeOpen = win.open;\n var activation = win.navigator ? win.navigator.userActivation : null;\n var isActiveOf = activation ? getter(protoOf(activation), "isActive") : null;\n var navigation = win.navigation;\n var NavigateEventP = proto("NavigateEvent");\n var navigationTypeOf = getter(NavigateEventP, "navigationType");\n var destinationOf = getter(NavigateEventP, "destination");\n var downloadRequestOf = getter(NavigateEventP, "downloadRequest");\n var formDataOf = getter(NavigateEventP, "formData");\n var sourceElementOf = getter(NavigateEventP, "sourceElement");\n var userInitiatedOf = getter(NavigateEventP, "userInitiated");\n var urlOf = getter(proto("NavigationDestination"), "url");\n var sameDocumentOf = getter(proto("NavigationDestination"), "sameDocument");\n\n var XLINK = "http://www.w3.org/1999/xlink";\n var MAX_SCRIPT_PROMPTS = 3;\n var PROCEED_DELAY = 600;\n var BYPASS_TTL = 2000;\n // The look follows the Figma "ShopperDialog" (DEV-3783): Inter, the ikas tokens inlined as values\n // because nothing of the page\'s CSS reaches into this shadow root.\n var STYLE =\n ":host{all:initial!important;display:block!important;position:fixed!important;inset:0!important;" +\n "z-index:2147483647!important;pointer-events:none!important}" +\n "dialog{box-sizing:border-box;position:fixed;inset:0;width:100%;height:100%;max-width:none;max-height:none;" +\n "margin:0;padding:16px;border:0;background:transparent;display:flex;align-items:center;justify-content:center;" +\n "pointer-events:auto;color-scheme:light;color:#131318;text-align:left;" +\n "font-family:Inter,-apple-system,system-ui,BlinkMacSystemFont,\'Segoe UI\',Roboto,Helvetica,Arial,sans-serif}" +\n "dialog:not([open]){display:none}" +\n "dialog::backdrop{background:rgba(19,19,24,.4)}" +\n ".fallback{background:rgba(19,19,24,.4)}" +\n ".card{box-sizing:border-box;display:flex;flex-direction:column;align-items:flex-start;gap:12px;width:100%;" +\n "max-width:420px;max-height:100%;overflow:auto;padding:20px;border:1px solid #e5e7eb;border-radius:12px;" +\n "background:#fff;box-shadow:0 8px 8px -4px rgba(19,19,24,.03),0 20px 24px -4px rgba(19,19,24,.08)}" +\n "h2{align-self:stretch;margin:0;color:#131318;font-size:16px;font-weight:600;line-height:24px}" +\n "p{align-self:stretch;margin:0;color:#4a5565;font-size:14px;font-weight:400;line-height:20px}" +\n ".host{color:#e7000b;font-weight:600;word-break:break-all}" +\n ".actions{display:flex;flex-wrap:wrap;align-items:flex-start;gap:8px}" +\n "button{box-sizing:border-box;display:flex;align-items:center;justify-content:center;gap:8px;min-height:36px;" +\n "margin:0;padding:8px 16px;border:1px solid transparent;border-radius:6px;font:inherit;font-size:14px;" +\n "font-weight:500;line-height:20px;cursor:pointer}" +\n ".stay{background:#4f39f6;color:#fff}.stay:hover{background:#432dd7}" +\n ".proceed{border-color:#d1d5dc;background:#fff;color:#131318}.proceed:hover{background:#f9fafb}" +\n "button:focus-visible{outline:2px solid #4f39f6;outline-offset:2px}" +\n "@media (max-width:480px){.actions{align-self:stretch;flex-direction:column}button{width:100%}}" +\n "@keyframes fade{from{opacity:0}to{opacity:1}}" +\n "@media (prefers-reduced-motion:no-preference){.card{animation:fade .12s ease-out}}";\n\n var exactHosts = create(null);\n var suffixHosts = create(null);\n var index;\n for (index = 0; index < cfg.rules.exact.length; index++) exactHosts[cfg.rules.exact[index]] = true;\n for (index = 0; index < cfg.rules.suffix.length; index++) suffixHosts[cfg.rules.suffix[index]] = true;\n var here = loc.hostname;\n if (here) {\n exactHosts[here] = true;\n exactHosts[slice(here, 0, 4) === "www." ? slice(here, 4) : "www." + here] = true;\n }\n\n function isTrustedHost(host) {\n if (exactHosts[host] === true) return true;\n for (var dot = indexOf(host, "."); dot !== -1; dot = indexOf(host, ".", dot + 1)) {\n if (suffixHosts[slice(host, dot + 1)] === true) return true;\n }\n return false;\n }\n\n function parseWebUrl(raw, base) {\n var url;\n try {\n url = new URLC(raw, base || baseURIOf(doc));\n } catch (error) {\n return null;\n }\n var protocol = protocolOf(url);\n if (protocol !== "http:" && protocol !== "https:") return null;\n var host = hostnameOf(url);\n if (host.length > 1 && charCodeAt(host, host.length - 1) === 46) host = slice(host, 0, -1);\n return { href: hrefOf(url), host: host };\n }\n\n function isUserActive() {\n return isActiveOf ? isActiveOf(activation) : true;\n }\n\n function element(parent, tag, className, text) {\n var node = createElement(doc, tag);\n if (className) setAttribute(node, "class", className);\n if (text) setTextContent(node, text);\n appendChild(parent, node);\n return node;\n }\n\n var texts = cfg.texts;\n var container = createElement(doc, "div");\n var shadow = attachShadow(container, { mode: "closed" });\n element(shadow, "style", "", STYLE);\n var dialog = element(shadow, "dialog", showModal ? "" : "fallback", "");\n setAttribute(dialog, "role", "alertdialog");\n setAttribute(dialog, "aria-modal", "true");\n setAttribute(dialog, "aria-labelledby", "title");\n setAttribute(dialog, "aria-describedby", "body");\n setAttribute(dialog, "lang", texts.lang);\n setAttribute(dialog, "dir", "ltr");\n var card = element(dialog, "div", "card", "");\n setAttribute(element(card, "h2", "", texts.title), "id", "title");\n var body = element(card, "p", "", "");\n setAttribute(body, "id", "body");\n appendChild(body, createTextNode(doc, texts.bodyBefore));\n var hostLabel = element(body, "bdi", "host", "");\n setAttribute(hostLabel, "dir", "ltr");\n appendChild(body, createTextNode(doc, texts.bodyAfter));\n var actions = element(card, "div", "actions", "");\n var stayButton = element(actions, "button", "stay", texts.stay);\n var proceedButton = element(actions, "button", "proceed", texts.proceed);\n setAttribute(stayButton, "type", "button");\n setAttribute(proceedButton, "type", "button");\n\n var pending = null;\n var bypass = null;\n var observer = null;\n var restoreFocusTo = null;\n var savedOverflow = "";\n var focusedButton = stayButton;\n var declinedHosts = create(null);\n var scriptPrompts = 0;\n\n function show(next) {\n var root = documentElementOf(doc);\n if (!root) return;\n pending = next;\n next.shownAt = now();\n setTextContent(hostLabel, next.host);\n restoreFocusTo = activeElementOf(doc);\n appendChild(root, container);\n savedOverflow = root.style.overflow;\n root.style.overflow = "hidden";\n if (showModal) {\n try {\n showModal(dialog);\n } catch (error) {\n setAttribute(dialog, "open", "");\n }\n } else {\n setAttribute(dialog, "open", "");\n }\n focus(stayButton);\n if (MutationObserverC && observe) {\n observer = new MutationObserverC(function () {\n if (pending !== null && !isConnectedOf(container)) reset();\n });\n observe(observer, root, { childList: true });\n }\n }\n\n function reset() {\n pending = null;\n if (observer !== null) {\n disconnect(observer);\n observer = null;\n }\n if (closeDialog && dialogOpenOf(dialog)) closeDialog(dialog);\n else removeAttribute(dialog, "open");\n var parent = parentNodeOf(container);\n if (parent) removeChild(parent, container);\n var root = documentElementOf(doc);\n if (root) root.style.overflow = savedOverflow;\n var previous = restoreFocusTo;\n restoreFocusTo = null;\n if (previous) {\n try {\n focus(previous);\n } catch (error) {}\n }\n }\n\n function stay() {\n var declined = pending;\n if (declined === null) return;\n reset();\n if (declined.script) declinedHosts[declined.host] = true;\n }\n\n function submitCopy(copy, action) {\n var root = documentElementOf(doc);\n var form = createElement(doc, "form");\n setAttribute(form, "method", "post");\n setAttribute(form, "action", action);\n setAttribute(form, "enctype", copy.enctype);\n setAttribute(form, "target", "_self");\n setAttribute(form, "hidden", "");\n for (var i = 0; i < copy.entries.length; i++) {\n var input = createElement(doc, "input");\n var value = copy.entries[i][1];\n setAttribute(input, "name", copy.entries[i][0]);\n if (typeof value === "string") {\n setAttribute(input, "type", "hidden");\n setAttribute(input, "value", value);\n } else {\n if (!DataTransferC) return false;\n var transfer = new DataTransferC();\n transfer.items.add(value);\n setAttribute(input, "type", "file");\n input.files = transfer.files;\n }\n appendChild(form, input);\n }\n if (!root) return false;\n appendChild(root, form);\n submitForm(form);\n return true;\n }\n\n function proceed() {\n var approved = pending;\n reset();\n if (approved.newTab) {\n apply(nativeOpen, win, [approved.href, approved.target, approved.features ? approved.features + ",noopener" : "noopener"]);\n return;\n }\n bypass = { href: approved.href, until: now() + BYPASS_TTL };\n if (approved.form !== null) {\n if (!submitCopy(approved.form, approved.href)) bypass = null;\n } else if (approved.replace) {\n loc.replace(approved.href);\n } else {\n loc.assign(approved.href);\n }\n }\n\n function attempt(next) {\n if (pending !== null) {\n if (isConnectedOf(container)) return;\n reset();\n }\n if (next.script) {\n if (declinedHosts[next.host] === true || scriptPrompts >= MAX_SCRIPT_PROMPTS) return;\n scriptPrompts++;\n }\n show(next);\n }\n\n listen(stayButton, "click", function () {\n stay();\n });\n listen(proceedButton, "click", function (event) {\n if (event.isTrusted && pending !== null && now() - pending.shownAt >= PROCEED_DELAY) proceed();\n });\n listen(stayButton, "focus", function () {\n focusedButton = stayButton;\n });\n listen(proceedButton, "focus", function () {\n focusedButton = proceedButton;\n });\n listen(dialog, "click", function (event) {\n if (targetOf(event) === dialog) stay();\n });\n listen(dialog, "cancel", function (event) {\n preventDefault(event);\n stay();\n });\n listen(dialog, "close", function () {\n if (dialogOpenOf && !dialogOpenOf(dialog)) stay();\n });\n listen(dialog, "keydown", function (event) {\n if (showModal || !keyOf) return;\n var key = keyOf(event);\n if (key === "Escape") {\n stay();\n } else if (key === "Tab") {\n preventDefault(event);\n focus(focusedButton === stayButton ? proceedButton : stayButton);\n }\n });\n\n function findLink(event) {\n var path = composedPath ? composedPath(event) : [];\n for (var i = 0; i < path.length; i++) {\n var node = path[i];\n if (node === win) return null;\n var type = nodeTypeOf(node);\n if (type === 9) return null;\n if (type !== 1) continue;\n var name = localNameOf(node);\n if (name !== "a" && name !== "area") continue;\n var href = getAttribute(node, "href");\n if (href === null && getAttributeNS) href = getAttributeNS(node, XLINK, "href");\n if (href !== null) return { node: node, href: href };\n }\n return null;\n }\n\n function baseTarget(root) {\n var bases = getElementsByTagName(root, "base");\n for (var i = 0; i < bases.length; i++) {\n var target = getAttribute(bases[i], "target");\n if (target !== null) return target;\n }\n return "";\n }\n\n function isFrameName(root, name) {\n var frames = getElementsByTagName(root, "iframe");\n for (var i = 0; i < frames.length; i++) if (getAttribute(frames[i], "name") === name) return true;\n return false;\n }\n\n function linkGoesTo(target, depth, root) {\n var name = toLowerCase(target);\n if (name === "" || name === "_self") return depth === 0 ? "tab" : null;\n if (name === "_top") return "tab";\n if (name === "_parent") return depth <= 1 ? "tab" : null;\n if (name === "_blank") return "new";\n return isFrameName(root, target) || isFrameName(doc, target) ? null : "new";\n }\n\n function onLinkClick(event, depth) {\n if (defaultPreventedOf(event)) return;\n try {\n if (buttonOf(event) !== 0 || ctrlKeyOf(event) || metaKeyOf(event) || shiftKeyOf(event) || altKeyOf(event)) {\n return;\n }\n } catch (error) {\n return;\n }\n var link = findLink(event);\n if (link === null) return;\n var url = parseWebUrl(link.href, baseURIOf(link.node));\n if (url === null || isTrustedHost(url.host)) return;\n var root = ownerDocumentOf(link.node);\n var target = getAttribute(link.node, "target");\n var goesTo = linkGoesTo(target === null ? baseTarget(root) : target, depth, root);\n if (goesTo === null) return;\n var newTab = goesTo === "new";\n var script = !event.isTrusted;\n if (script && newTab && !isUserActive()) return;\n preventDefault(event);\n stopImmediatePropagation(event);\n attempt({\n href: url.href,\n host: url.host,\n newTab: newTab,\n target: "_blank",\n features: "",\n replace: false,\n form: null,\n script: script,\n });\n }\n\n listen(win, "click", function (event) {\n onLinkClick(event, 0);\n });\n\n var frameClickListeners = WeakMapC ? new WeakMapC() : null;\n var frameLoadListeners = WeakMapC ? new WeakMapC() : null;\n\n function guardFrame(frame, depth) {\n var frameWin;\n var frameDoc;\n try {\n frameWin = contentWindowOf(frame);\n frameDoc = contentDocumentOf(frame);\n } catch (error) {\n return;\n }\n if (!frameWin || !frameDoc) return;\n var onClick = weakGet(frameClickListeners, frameWin);\n if (!onClick) {\n onClick = function (event) {\n onLinkClick(event, depth);\n };\n weakSet(frameClickListeners, frameWin, onClick);\n }\n try {\n listen(frameWin, "click", onClick);\n } catch (error) {\n return;\n }\n watchFrames(frameDoc, depth + 1);\n }\n\n function watchFrames(root, depth) {\n var onLoad = weakGet(frameLoadListeners, root);\n if (!onLoad) {\n onLoad = function (event) {\n var frame = targetOf(event);\n if (frame && nodeTypeOf(frame) === 1 && localNameOf(frame) === "iframe") guardFrame(frame, depth);\n };\n weakSet(frameLoadListeners, root, onLoad);\n }\n listen(root, "load", onLoad, true);\n var frames = getElementsByTagName(root, "iframe");\n for (var i = 0; i < frames.length; i++) guardFrame(frames[i], depth);\n }\n\n if (contentWindowOf && contentDocumentOf && frameClickListeners && weakGet && weakSet) watchFrames(doc, 1);\n\n if (typeof nativeOpen === "function") {\n win.open = function open(url, target, features) {\n var destination = url === undefined || url === null || url === "" ? null : parseWebUrl(url);\n if (destination === null || isTrustedHost(destination.host)) return apply(nativeOpen, win, arguments);\n var name = target === undefined || target === null || target === "" ? "_blank" : "" + target;\n var lowerName = toLowerCase(name);\n var sameTab = lowerName === "_self" || lowerName === "_top" || lowerName === "_parent";\n if ((!sameTab && lowerName !== "_blank" && isFrameName(doc, name)) || !isUserActive()) {\n return apply(nativeOpen, win, arguments);\n }\n attempt({\n href: destination.href,\n host: destination.host,\n newTab: !sameTab,\n target: name,\n features: features === undefined || features === null ? "" : "" + features,\n replace: false,\n form: null,\n script: true,\n });\n return null;\n };\n }\n\n function copyForm(data, source) {\n var entries = [];\n var hasFile = false;\n eachFormEntry(data, function (value, name) {\n entries[entries.length] = [name, value];\n if (typeof value !== "string") hasFile = true;\n });\n var enctype = null;\n if (source && nodeTypeOf(source) === 1) {\n enctype = getAttribute(source, "formenctype");\n var owner = localNameOf(source) === "form" ? source : source.form;\n if (!enctype && owner) enctype = getAttribute(owner, "enctype");\n }\n if (!enctype) enctype = hasFile ? "multipart/form-data" : "application/x-www-form-urlencoded";\n return { entries: entries, enctype: enctype };\n }\n\n if (navigation && navigationTypeOf && destinationOf && urlOf) {\n listen(navigation, "navigate", function (event) {\n if (!event.isTrusted || !cancelableOf(event)) return;\n var type = navigationTypeOf(event);\n if (type === "traverse" || type === "reload") return;\n var destination = destinationOf(event);\n if (sameDocumentOf && sameDocumentOf(destination)) return;\n if (downloadRequestOf && downloadRequestOf(event) !== null) return;\n var url = parseWebUrl(urlOf(destination));\n if (url === null) return;\n if (bypass !== null && bypass.href === url.href) {\n var approved = now() <= bypass.until;\n bypass = null;\n if (approved) return;\n }\n if (isTrustedHost(url.host)) return;\n preventDefault(event);\n var data = formDataOf ? formDataOf(event) : null;\n attempt({\n href: url.href,\n host: url.host,\n newTab: false,\n target: "_self",\n features: "",\n replace: type === "replace",\n form: data ? copyForm(data, sourceElementOf ? sourceElementOf(event) : null) : null,\n script: !(userInitiatedOf && userInitiatedOf(event)),\n });\n });\n }\n\n listen(win, "pageshow", function (event) {\n if (pending !== null && persistedOf && persistedOf(event)) reset();\n });\n})'],['(function (win, cfg) {\n "use strict";\n var doc = win.document;\n var FunctionP = win.Function.prototype;\n var uncurry = FunctionP.bind.bind(FunctionP.call);\n var apply = uncurry(FunctionP.apply);\n var describe = win.Object.getOwnPropertyDescriptor;\n var protoOf = win.Object.getPrototypeOf;\n var create = win.Object.create;\n var now = win.Date.now;\n\n function proto(name) {\n var C = win[name];\n return C ? C.prototype : null;\n }\n function getter(p, name) {\n var d = p ? describe(p, name) : null;\n return d && d.get ? uncurry(d.get) : null;\n }\n function setter(p, name) {\n var d = p ? describe(p, name) : null;\n return d && d.set ? uncurry(d.set) : null;\n }\n function method(p, name) {\n var f = p ? p[name] : null;\n return typeof f === "function" ? uncurry(f) : null;\n }\n\n var EventP = proto("Event");\n var NodeP = proto("Node");\n var ElementP = proto("Element");\n var DocumentP = proto("Document");\n var attachShadow = method(ElementP, "attachShadow");\n if (!doc || !EventP || !NodeP || !attachShadow) return;\n\n var listen = method(proto("EventTarget"), "addEventListener");\n var preventDefault = method(EventP, "preventDefault");\n var stopImmediatePropagation = method(EventP, "stopImmediatePropagation");\n var cancelableOf = getter(EventP, "cancelable");\n var defaultPreventedOf = getter(EventP, "defaultPrevented");\n var targetOf = getter(EventP, "target");\n var composedPath = method(EventP, "composedPath");\n var MouseEventP = proto("MouseEvent");\n var buttonOf = getter(MouseEventP, "button");\n var ctrlKeyOf = getter(MouseEventP, "ctrlKey");\n var metaKeyOf = getter(MouseEventP, "metaKey");\n var shiftKeyOf = getter(MouseEventP, "shiftKey");\n var altKeyOf = getter(MouseEventP, "altKey");\n var keyOf = getter(proto("KeyboardEvent"), "key");\n var persistedOf = getter(proto("PageTransitionEvent"), "persisted");\n var appendChild = method(NodeP, "appendChild");\n var removeChild = method(NodeP, "removeChild");\n var parentNodeOf = getter(NodeP, "parentNode");\n var nodeTypeOf = getter(NodeP, "nodeType");\n var isConnectedOf = getter(NodeP, "isConnected");\n var baseURIOf = getter(NodeP, "baseURI");\n var ownerDocumentOf = getter(NodeP, "ownerDocument");\n var setTextContent = setter(NodeP, "textContent");\n var localNameOf = getter(ElementP, "localName");\n var getAttribute = method(ElementP, "getAttribute");\n var getAttributeNS = method(ElementP, "getAttributeNS");\n var setAttribute = method(ElementP, "setAttribute");\n var removeAttribute = method(ElementP, "removeAttribute");\n var createElement = method(DocumentP, "createElement");\n var createTextNode = method(DocumentP, "createTextNode");\n var getElementsByTagName = method(DocumentP, "getElementsByTagName");\n var documentElementOf = getter(DocumentP, "documentElement");\n var activeElementOf = getter(DocumentP, "activeElement");\n var focus = method(proto("HTMLElement"), "focus");\n var DialogP = proto("HTMLDialogElement");\n var showModal = method(DialogP, "showModal");\n var closeDialog = method(DialogP, "close");\n var dialogOpenOf = getter(DialogP, "open");\n var submitForm = method(proto("HTMLFormElement"), "submit");\n var eachFormEntry = method(proto("FormData"), "forEach");\n var IFrameP = proto("HTMLIFrameElement");\n var contentWindowOf = getter(IFrameP, "contentWindow");\n var contentDocumentOf = getter(IFrameP, "contentDocument");\n var WeakMapC = win.WeakMap;\n var weakGet = method(WeakMapC && WeakMapC.prototype, "get");\n var weakSet = method(WeakMapC && WeakMapC.prototype, "set");\n var DataTransferC = win.DataTransfer;\n var URLC = win.URL;\n var hrefOf = getter(URLC.prototype, "href");\n var protocolOf = getter(URLC.prototype, "protocol");\n var hostnameOf = getter(URLC.prototype, "hostname");\n var StringP = win.String.prototype;\n var slice = method(StringP, "slice");\n var indexOf = method(StringP, "indexOf");\n var toLowerCase = method(StringP, "toLowerCase");\n var charCodeAt = method(StringP, "charCodeAt");\n var MutationObserverC = win.MutationObserver;\n var observe = method(proto("MutationObserver"), "observe");\n var disconnect = method(proto("MutationObserver"), "disconnect");\n var loc = win.location;\n var nativeOpen = win.open;\n var activation = win.navigator ? win.navigator.userActivation : null;\n var isActiveOf = activation ? getter(protoOf(activation), "isActive") : null;\n var navigation = win.navigation;\n var NavigateEventP = proto("NavigateEvent");\n var navigationTypeOf = getter(NavigateEventP, "navigationType");\n var destinationOf = getter(NavigateEventP, "destination");\n var downloadRequestOf = getter(NavigateEventP, "downloadRequest");\n var formDataOf = getter(NavigateEventP, "formData");\n var sourceElementOf = getter(NavigateEventP, "sourceElement");\n var userInitiatedOf = getter(NavigateEventP, "userInitiated");\n var urlOf = getter(proto("NavigationDestination"), "url");\n var sameDocumentOf = getter(proto("NavigationDestination"), "sameDocument");\n\n var XLINK = "http://www.w3.org/1999/xlink";\n var MAX_SCRIPT_PROMPTS = 3;\n var PROCEED_DELAY = 600;\n var BYPASS_TTL = 2000;\n // The look follows the Figma "ShopperDialog" (DEV-3783): Inter, the ikas tokens inlined as values\n // because nothing of the page\'s CSS reaches into this shadow root.\n var STYLE =\n ":host{all:initial!important;display:block!important;position:fixed!important;inset:0!important;" +\n "z-index:2147483647!important;pointer-events:none!important}" +\n "dialog{box-sizing:border-box;position:fixed;inset:0;width:100%;height:100%;max-width:none;max-height:none;" +\n "margin:0;padding:16px;border:0;background:transparent;display:flex;align-items:center;justify-content:center;" +\n "pointer-events:auto;color-scheme:light;color:#131318;text-align:left;" +\n "font-family:Inter,-apple-system,system-ui,BlinkMacSystemFont,\'Segoe UI\',Roboto,Helvetica,Arial,sans-serif}" +\n "dialog:not([open]){display:none}" +\n "dialog::backdrop{background:rgba(19,19,24,.4)}" +\n ".fallback{background:rgba(19,19,24,.4)}" +\n ".card{box-sizing:border-box;display:flex;flex-direction:column;align-items:flex-start;gap:12px;width:100%;" +\n "max-width:420px;max-height:100%;overflow:auto;padding:20px;border:1px solid #e5e7eb;border-radius:12px;" +\n "background:#fff;box-shadow:0 8px 8px -4px rgba(19,19,24,.03),0 20px 24px -4px rgba(19,19,24,.08)}" +\n "h2{align-self:stretch;margin:0;color:#131318;font-size:16px;font-weight:600;line-height:24px}" +\n "p{align-self:stretch;margin:0;color:#4a5565;font-size:14px;font-weight:400;line-height:20px}" +\n ".host{color:#e7000b;font-weight:600;word-break:break-all}" +\n ".actions{display:flex;flex-wrap:wrap;align-items:flex-start;gap:8px}" +\n "button{box-sizing:border-box;display:flex;align-items:center;justify-content:center;gap:8px;min-height:36px;" +\n "margin:0;padding:8px 16px;border:1px solid transparent;border-radius:6px;font:inherit;font-size:14px;" +\n "font-weight:500;line-height:20px;cursor:pointer}" +\n ".stay{background:#4f39f6;color:#fff}.stay:hover{background:#432dd7}" +\n ".proceed{border-color:#d1d5dc;background:#fff;color:#131318}.proceed:hover{background:#f9fafb}" +\n "button:focus-visible{outline:2px solid #4f39f6;outline-offset:2px}" +\n "@media (max-width:480px){.actions{align-self:stretch;flex-direction:column}button{width:100%}}" +\n "@keyframes fade{from{opacity:0}to{opacity:1}}" +\n "@media (prefers-reduced-motion:no-preference){.card{animation:fade .12s ease-out}}";\n\n var exactHosts = create(null);\n var suffixHosts = create(null);\n var index;\n for (index = 0; index < cfg.rules.exact.length; index++) exactHosts[cfg.rules.exact[index]] = true;\n for (index = 0; index < cfg.rules.suffix.length; index++) suffixHosts[cfg.rules.suffix[index]] = true;\n var here = loc.hostname;\n if (here) {\n exactHosts[here] = true;\n exactHosts[slice(here, 0, 4) === "www." ? slice(here, 4) : "www." + here] = true;\n }\n\n function isTrustedHost(host) {\n if (exactHosts[host] === true) return true;\n for (var dot = indexOf(host, "."); dot !== -1; dot = indexOf(host, ".", dot + 1)) {\n if (suffixHosts[slice(host, dot + 1)] === true) return true;\n }\n return false;\n }\n\n function parseWebUrl(raw, base) {\n var url;\n try {\n url = new URLC(raw, base || baseURIOf(doc));\n } catch (error) {\n return null;\n }\n var protocol = protocolOf(url);\n if (protocol !== "http:" && protocol !== "https:") return null;\n var host = hostnameOf(url);\n if (host.length > 1 && charCodeAt(host, host.length - 1) === 46) host = slice(host, 0, -1);\n return { href: hrefOf(url), host: host };\n }\n\n function isUserActive() {\n return isActiveOf ? isActiveOf(activation) : true;\n }\n\n function element(parent, tag, className, text) {\n var node = createElement(doc, tag);\n if (className) setAttribute(node, "class", className);\n if (text) setTextContent(node, text);\n appendChild(parent, node);\n return node;\n }\n\n var texts = cfg.texts;\n var container = createElement(doc, "div");\n var shadow = attachShadow(container, { mode: "closed" });\n element(shadow, "style", "", STYLE);\n var dialog = element(shadow, "dialog", showModal ? "" : "fallback", "");\n setAttribute(dialog, "role", "alertdialog");\n setAttribute(dialog, "aria-modal", "true");\n setAttribute(dialog, "aria-labelledby", "title");\n setAttribute(dialog, "aria-describedby", "body");\n setAttribute(dialog, "lang", texts.lang);\n setAttribute(dialog, "dir", "ltr");\n var card = element(dialog, "div", "card", "");\n setAttribute(element(card, "h2", "", texts.title), "id", "title");\n var body = element(card, "p", "", "");\n setAttribute(body, "id", "body");\n appendChild(body, createTextNode(doc, texts.bodyBefore));\n var hostLabel = element(body, "bdi", "host", "");\n setAttribute(hostLabel, "dir", "ltr");\n appendChild(body, createTextNode(doc, texts.bodyAfter));\n var actions = element(card, "div", "actions", "");\n var stayButton = element(actions, "button", "stay", texts.stay);\n var proceedButton = element(actions, "button", "proceed", texts.proceed);\n setAttribute(stayButton, "type", "button");\n setAttribute(proceedButton, "type", "button");\n\n var pending = null;\n var bypass = null;\n var observer = null;\n var restoreFocusTo = null;\n var savedOverflow = "";\n var focusedButton = stayButton;\n var declinedHosts = create(null);\n var scriptPrompts = 0;\n\n function show(next) {\n var root = documentElementOf(doc);\n if (!root) return;\n pending = next;\n next.shownAt = now();\n setTextContent(hostLabel, next.host);\n restoreFocusTo = activeElementOf(doc);\n appendChild(root, container);\n savedOverflow = root.style.overflow;\n root.style.overflow = "hidden";\n if (showModal) {\n try {\n showModal(dialog);\n } catch (error) {\n setAttribute(dialog, "open", "");\n }\n } else {\n setAttribute(dialog, "open", "");\n }\n focus(stayButton);\n if (MutationObserverC && observe) {\n observer = new MutationObserverC(function () {\n if (pending !== null && !isConnectedOf(container)) reset();\n });\n observe(observer, root, { childList: true });\n }\n }\n\n function reset() {\n pending = null;\n if (observer !== null) {\n disconnect(observer);\n observer = null;\n }\n if (closeDialog && dialogOpenOf(dialog)) closeDialog(dialog);\n else removeAttribute(dialog, "open");\n var parent = parentNodeOf(container);\n if (parent) removeChild(parent, container);\n var root = documentElementOf(doc);\n if (root) root.style.overflow = savedOverflow;\n var previous = restoreFocusTo;\n restoreFocusTo = null;\n if (previous) {\n try {\n focus(previous);\n } catch (error) {}\n }\n }\n\n function stay() {\n var declined = pending;\n if (declined === null) return;\n reset();\n if (declined.script) declinedHosts[declined.host] = true;\n }\n\n function submitCopy(copy, action) {\n var root = documentElementOf(doc);\n var form = createElement(doc, "form");\n setAttribute(form, "method", "post");\n setAttribute(form, "action", action);\n setAttribute(form, "enctype", copy.enctype);\n setAttribute(form, "target", "_self");\n setAttribute(form, "hidden", "");\n for (var i = 0; i < copy.entries.length; i++) {\n var input = createElement(doc, "input");\n var value = copy.entries[i][1];\n setAttribute(input, "name", copy.entries[i][0]);\n if (typeof value === "string") {\n setAttribute(input, "type", "hidden");\n setAttribute(input, "value", value);\n } else {\n if (!DataTransferC) return false;\n var transfer = new DataTransferC();\n transfer.items.add(value);\n setAttribute(input, "type", "file");\n input.files = transfer.files;\n }\n appendChild(form, input);\n }\n if (!root) return false;\n appendChild(root, form);\n submitForm(form);\n return true;\n }\n\n function proceed() {\n var approved = pending;\n reset();\n if (approved.newTab) {\n apply(nativeOpen, win, [approved.href, approved.target, approved.features ? approved.features + ",noopener" : "noopener"]);\n return;\n }\n bypass = { href: approved.href, until: now() + BYPASS_TTL };\n if (approved.form !== null) {\n if (!submitCopy(approved.form, approved.href)) bypass = null;\n } else if (approved.replace) {\n loc.replace(approved.href);\n } else {\n loc.assign(approved.href);\n }\n }\n\n function attempt(next) {\n if (pending !== null) {\n if (isConnectedOf(container)) return;\n reset();\n }\n if (next.script) {\n if (declinedHosts[next.host] === true || scriptPrompts >= MAX_SCRIPT_PROMPTS) return;\n scriptPrompts++;\n }\n show(next);\n }\n\n listen(stayButton, "click", function () {\n stay();\n });\n listen(proceedButton, "click", function (event) {\n if (event.isTrusted && pending !== null && now() - pending.shownAt >= PROCEED_DELAY) proceed();\n });\n listen(stayButton, "focus", function () {\n focusedButton = stayButton;\n });\n listen(proceedButton, "focus", function () {\n focusedButton = proceedButton;\n });\n listen(dialog, "click", function (event) {\n if (targetOf(event) === dialog) stay();\n });\n listen(dialog, "cancel", function (event) {\n preventDefault(event);\n stay();\n });\n listen(dialog, "close", function () {\n if (dialogOpenOf && !dialogOpenOf(dialog)) stay();\n });\n listen(dialog, "keydown", function (event) {\n if (showModal || !keyOf) return;\n var key = keyOf(event);\n if (key === "Escape") {\n stay();\n } else if (key === "Tab") {\n preventDefault(event);\n focus(focusedButton === stayButton ? proceedButton : stayButton);\n }\n });\n\n function findLink(event) {\n var path = composedPath ? composedPath(event) : [];\n for (var i = 0; i < path.length; i++) {\n var node = path[i];\n if (node === win) return null;\n var type = nodeTypeOf(node);\n if (type === 9) return null;\n if (type !== 1) continue;\n var name = localNameOf(node);\n if (name !== "a" && name !== "area") continue;\n var href = getAttribute(node, "href");\n if (href === null && getAttributeNS) href = getAttributeNS(node, XLINK, "href");\n if (href !== null) return { node: node, href: href };\n }\n return null;\n }\n\n function baseTarget(root) {\n var bases = getElementsByTagName(root, "base");\n for (var i = 0; i < bases.length; i++) {\n var target = getAttribute(bases[i], "target");\n if (target !== null) return target;\n }\n return "";\n }\n\n function isFrameName(root, name) {\n var frames = getElementsByTagName(root, "iframe");\n for (var i = 0; i < frames.length; i++) if (getAttribute(frames[i], "name") === name) return true;\n return false;\n }\n\n function linkGoesTo(target, depth, root) {\n var name = toLowerCase(target);\n if (name === "" || name === "_self") return depth === 0 ? "tab" : null;\n if (name === "_top") return "tab";\n if (name === "_parent") return depth <= 1 ? "tab" : null;\n if (name === "_blank") return "new";\n return isFrameName(root, target) || isFrameName(doc, target) ? null : "new";\n }\n\n function onLinkClick(event, depth) {\n if (defaultPreventedOf(event)) return;\n try {\n if (buttonOf(event) !== 0 || ctrlKeyOf(event) || metaKeyOf(event) || shiftKeyOf(event) || altKeyOf(event)) {\n return;\n }\n } catch (error) {\n return;\n }\n var link = findLink(event);\n if (link === null) return;\n var url = parseWebUrl(link.href, baseURIOf(link.node));\n if (url === null || isTrustedHost(url.host)) return;\n var root = ownerDocumentOf(link.node);\n var target = getAttribute(link.node, "target");\n var goesTo = linkGoesTo(target === null ? baseTarget(root) : target, depth, root);\n if (goesTo === null) return;\n var newTab = goesTo === "new";\n var script = !event.isTrusted;\n if (script && newTab && !isUserActive()) return;\n preventDefault(event);\n stopImmediatePropagation(event);\n attempt({\n href: url.href,\n host: url.host,\n newTab: newTab,\n target: "_blank",\n features: "",\n replace: false,\n form: null,\n script: script,\n });\n }\n\n listen(win, "click", function (event) {\n onLinkClick(event, 0);\n });\n\n var frameClickListeners = WeakMapC ? new WeakMapC() : null;\n var frameLoadListeners = WeakMapC ? new WeakMapC() : null;\n\n function guardFrame(frame, depth) {\n var frameWin;\n var frameDoc;\n try {\n frameWin = contentWindowOf(frame);\n frameDoc = contentDocumentOf(frame);\n } catch (error) {\n return;\n }\n if (!frameWin || !frameDoc) return;\n var onClick = weakGet(frameClickListeners, frameWin);\n if (!onClick) {\n onClick = function (event) {\n onLinkClick(event, depth);\n };\n weakSet(frameClickListeners, frameWin, onClick);\n }\n try {\n listen(frameWin, "click", onClick);\n } catch (error) {\n return;\n }\n watchFrames(frameDoc, depth + 1);\n }\n\n function watchFrames(root, depth) {\n var onLoad = weakGet(frameLoadListeners, root);\n if (!onLoad) {\n onLoad = function (event) {\n var frame = targetOf(event);\n if (frame && nodeTypeOf(frame) === 1 && localNameOf(frame) === "iframe") guardFrame(frame, depth);\n };\n weakSet(frameLoadListeners, root, onLoad);\n }\n listen(root, "load", onLoad, true);\n var frames = getElementsByTagName(root, "iframe");\n for (var i = 0; i < frames.length; i++) guardFrame(frames[i], depth);\n }\n\n if (contentWindowOf && contentDocumentOf && frameClickListeners && weakGet && weakSet) watchFrames(doc, 1);\n\n if (typeof nativeOpen === "function") {\n win.open = function open(url, target, features) {\n var destination = url === undefined || url === null || url === "" ? null : parseWebUrl(url);\n if (destination === null || isTrustedHost(destination.host)) return apply(nativeOpen, win, arguments);\n var name = target === undefined || target === null || target === "" ? "_blank" : "" + target;\n var lowerName = toLowerCase(name);\n var sameTab = lowerName === "_self" || lowerName === "_top" || lowerName === "_parent";\n if ((!sameTab && lowerName !== "_blank" && isFrameName(doc, name)) || !isUserActive()) {\n return apply(nativeOpen, win, arguments);\n }\n attempt({\n href: destination.href,\n host: destination.host,\n newTab: !sameTab,\n target: name,\n features: features === undefined || features === null ? "" : "" + features,\n replace: false,\n form: null,\n script: true,\n });\n return null;\n };\n }\n\n function copyForm(data, source) {\n var entries = [];\n var hasFile = false;\n eachFormEntry(data, function (value, name) {\n entries[entries.length] = [name, value];\n if (typeof value !== "string") hasFile = true;\n });\n var enctype = null;\n if (source && nodeTypeOf(source) === 1) {\n enctype = getAttribute(source, "formenctype");\n var owner = localNameOf(source) === "form" ? source : source.form;\n if (!enctype && owner) enctype = getAttribute(owner, "enctype");\n }\n if (!enctype) enctype = hasFile ? "multipart/form-data" : "application/x-www-form-urlencoded";\n return { entries: entries, enctype: enctype };\n }\n\n if (navigation && navigationTypeOf && destinationOf && urlOf) {\n listen(navigation, "navigate", function (event) {\n if (!event.isTrusted || !cancelableOf(event)) return;\n var type = navigationTypeOf(event);\n if (type === "traverse" || type === "reload") return;\n var destination = destinationOf(event);\n if (sameDocumentOf && sameDocumentOf(destination)) return;\n if (downloadRequestOf && downloadRequestOf(event) !== null) return;\n var url = parseWebUrl(urlOf(destination));\n if (url === null) return;\n if (bypass !== null && bypass.href === url.href) {\n var approved = now() <= bypass.until;\n bypass = null;\n if (approved) return;\n }\n if (isTrustedHost(url.host)) return;\n preventDefault(event);\n var data = formDataOf ? formDataOf(event) : null;\n attempt({\n href: url.href,\n host: url.host,\n newTab: false,\n target: "_self",\n features: "",\n replace: type === "replace",\n form: data ? copyForm(data, sourceElementOf ? sourceElementOf(event) : null) : null,\n script: !(userInitiatedOf && userInitiatedOf(event)),\n });\n });\n }\n\n listen(win, "pageshow", function (event) {\n if (pending !== null && persistedOf && persistedOf(event)) reset();\n });\n})'])));export{t as REDIRECT_GUARD_RUNTIME};
@@ -0,0 +1,14 @@
1
+ import { HostRules } from "./hosts";
2
+ import { RedirectGuardTexts } from "./texts";
3
+ export declare type RedirectGuardConfig = {
4
+ rules: HostRules;
5
+ texts: RedirectGuardTexts;
6
+ };
7
+ /**
8
+ * JSON for an inline script: pure ASCII, and unable to end the script element or open an HTML
9
+ * comment in it. `<`, `>` and `&` become `\u` escapes like every character outside ASCII (U+2028
10
+ * and U+2029 included), so the script means the same under any charset the page is read with.
11
+ */
12
+ export declare function toInlineScriptJson(value: unknown): string;
13
+ /** The guard as the page's first script: the runtime, called with this store's rules and copy. */
14
+ export declare function buildRedirectGuardScript(config: RedirectGuardConfig): string;
@@ -0,0 +1 @@
1
+ import{REDIRECT_GUARD_RUNTIME as t}from"./runtime.js";function r(t){return JSON.stringify(t).replace(/[<>&\u007f-\uffff]/g,(function(t){return"\\u"+t.charCodeAt(0).toString(16).padStart(4,"0")}))}function n(n){return"<script>".concat(t,"(window,").concat(r(n),");<\/script>")}export{n as buildRedirectGuardScript,r as toInlineScriptJson};
@@ -0,0 +1,16 @@
1
+ /** The backend's limit on the merchant's own list; anything past it is dropped, not inlined. */
2
+ export declare const MAX_ALLOWED_HOSTS = 100;
3
+ export declare type NavigationWarningSettings = {
4
+ /** The hosts the merchant added, normalized. ikas's starter list comes on top of these. */
5
+ allowedHosts: string[];
6
+ };
7
+ /**
8
+ * `storefront.navigationWarningSettings` (FR-1077) — `{ isEnabled: boolean, allowedHosts: string[] }`
9
+ * in the backend model — or null when the warning is off.
10
+ *
11
+ * Read as `unknown` all the same: the warning turns on for `isEnabled === true` and nothing else,
12
+ * so a missing field (every store until its merchant turns the warning on) or a malformed one
13
+ * leaves the page exactly as it renders without the warning. The backend validates the list
14
+ * before it stores it; it is normalized again here because these hosts end up inside a script.
15
+ */
16
+ export declare function parseNavigationWarningSettings(value: unknown): NavigationWarningSettings | null;
@@ -0,0 +1 @@
1
+ import{normalizeHostPattern as r}from"./hosts.js";var t=100;function o(t){if(!t||"object"!=typeof t)return null;var o=t,e=o.isEnabled,l=o.allowedHosts;return!0!==e?null:{allowedHosts:(Array.isArray(l)?l:[]).slice(0,100).map(r).filter((function(r){return!!r}))}}export{t as MAX_ALLOWED_HOSTS,o as parseNavigationWarningSettings};
@@ -0,0 +1,12 @@
1
+ export declare type RedirectGuardTexts = {
2
+ /** The language the copy is in, for the dialog's `lang`. */
3
+ lang: string;
4
+ title: string;
5
+ /** The body around the destination host, which the browser fills in. */
6
+ bodyBefore: string;
7
+ bodyAfter: string;
8
+ stay: string;
9
+ proceed: string;
10
+ };
11
+ /** The copy for a routing locale (`tr`, `de-DE`, `en_US`…), English when there is none for it. */
12
+ export declare function getRedirectGuardTexts(locale: string | null | undefined): RedirectGuardTexts;
@@ -0,0 +1 @@
1
+ var e={tr:{title:"Başka bir siteye gidiyorsunuz.",body:"Bu sayfa sizi {host} adresine götürmek istiyor. Kartınızı ya da şifrenizi bu adreste girmeyin.",stay:"Bu sayfada kal",proceed:"Devam et"},en:{title:"You're going to another site.",body:"This page wants to take you to {host}. Don't enter your card details or password there.",stay:"Stay on this page",proceed:"Continue"},de:{title:"Sie wechseln zu einer anderen Website.",body:"Diese Seite möchte Sie zu {host} weiterleiten. Geben Sie dort keine Kartendaten oder Passwörter ein.",stay:"Auf dieser Seite bleiben",proceed:"Weiter"},fr:{title:"Vous allez vers un autre site.",body:"Cette page veut vous rediriger vers {host}. N'y saisissez ni vos données de carte ni votre mot de passe.",stay:"Rester sur cette page",proceed:"Continuer"}};function t(t){var r=(t||"").toLowerCase().split(/[-_]/)[0],i=Object.prototype.hasOwnProperty.call(e,r)?r:"en",o=e[i],s=o.title,a=o.body,n=o.stay,d=o.proceed,y=a.split("{host}"),u=y[0],l=y[1];return{lang:i,title:s,bodyBefore:u,bodyAfter:void 0===l?"":l,stay:n,proceed:d}}export{t as getRedirectGuardTexts};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront-next",
3
- "version": "6.1.0-beta.380",
3
+ "version": "6.1.0-beta.382",
4
4
  "description": "Next.js specific functions for ikas storefront themes.",
5
5
  "author": "ikas",
6
6
  "license": "ISC",
@@ -17,23 +17,23 @@
17
17
  },
18
18
  "peerDependencies": {
19
19
  "next": "12.2.0",
20
- "@ikas/storefront-config": "^6.1.0-beta.380",
21
- "@ikas/storefront-providers": "^6.1.0-beta.380",
22
- "@ikas/storefront-models": "^6.1.0-beta.380",
23
- "@ikas/storefront-api": "^6.1.0-beta.380",
24
- "@ikas/storefront-assets": "^6.1.0-beta.380",
20
+ "@ikas/storefront-config": "^6.1.0-beta.382",
21
+ "@ikas/storefront-providers": "^6.1.0-beta.382",
22
+ "@ikas/storefront-models": "^6.1.0-beta.382",
23
+ "@ikas/storefront-api": "^6.1.0-beta.382",
24
+ "@ikas/storefront-assets": "^6.1.0-beta.382",
25
25
  "axios": "^0.26.0",
26
26
  "lodash": "^4.17.21",
27
27
  "cors": "^2.8.5",
28
28
  "adm-zip": "^0.5.9"
29
29
  },
30
30
  "devDependencies": {
31
- "@ikas/storefront-cmd": "^6.1.0-beta.380",
32
- "@ikas/storefront-config": "^6.1.0-beta.380",
33
- "@ikas/storefront-providers": "^6.1.0-beta.380",
34
- "@ikas/storefront-models": "^6.1.0-beta.380",
35
- "@ikas/storefront-api": "^6.1.0-beta.380",
36
- "@ikas/storefront-assets": "^6.1.0-beta.380",
31
+ "@ikas/storefront-cmd": "^6.1.0-beta.382",
32
+ "@ikas/storefront-config": "^6.1.0-beta.382",
33
+ "@ikas/storefront-providers": "^6.1.0-beta.382",
34
+ "@ikas/storefront-models": "^6.1.0-beta.382",
35
+ "@ikas/storefront-api": "^6.1.0-beta.382",
36
+ "@ikas/storefront-assets": "^6.1.0-beta.382",
37
37
  "@rollup/plugin-node-resolve": "^13.3.0",
38
38
  "@rollup/plugin-commonjs": "^22.0.0",
39
39
  "@rollup/plugin-json": "^4.1.0",