@ikas/storefront-next 6.1.0-beta.38 → 6.1.0-beta.381

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
- import{__awaiter as e,__generator as r}from'./../ext/tslib/tslib.es6.js';import t from"fs";import n from"path";import o from"adm-zip";import s from"axios";import i from"@ikas/storefront-assets/checkout/de.js";import c from"@ikas/storefront-assets/checkout/en.js";import a from"@ikas/storefront-assets/checkout/fr.js";import u from"@ikas/storefront-assets/checkout/tr.js";import{corsMiddleware as l}from"./middleware.js";var d=function(s,d){return e(void 0,void 0,void 0,(function(){var e,h,y,v,g,S,j,w,b;return r(this,(function(r){switch(r.label){case 0:return[4,l(s,d)];case 1:r.sent(),e=function(){d.statusCode=200,d.setHeader("Content-Type","application/json"),d.json({status:"ok"})},h=function(){d.statusCode=400,d.setHeader("Content-Type","application/json"),d.json({status:"failed"})},y="",r.label=2;case 2:return r.trys.push([2,9,10,11]),[4,new Promise((function(e,r){var o=n.join(process.cwd(),"src","theme.json");t.readFile(o,(function(t,n){if(t)return console.error("An error occurred while reading the theme.json file!"),r(t);e(JSON.parse(n.toString()))}))}))];case 3:return v=r.sent(),[4,new Promise((function(e,r){var o=n.join(process.cwd(),"public","locales"),s=function(e){return e.length?e.split(".")[0]:e};t.readdir(o,(function(l,d){if(l)return r(l);var h=d.filter((function(e){return t.lstatSync(n.join(o,e)).isDirectory()})),f={},p=!1;h.forEach((function(e){var r=n.join(process.cwd(),"public","locales",e);f[e]={};try{var o=t.readdirSync(r);o.forEach((function(r){var o=t.readFileSync(n.join(process.cwd(),"public","locales",e,r)),l=s(e).toLowerCase(),d=s(r);f[l][d]=JSON.parse(o.toString()),f[l]["checkout-page"]="tr"===l?u:"de"===l?i:"fr"===l?a:c}))}catch(e){console.error("An error occurred while reading localization files!"),console.error(e),p=!0}})),p?r(null):e(f)}))}))];case 4:return g=r.sent(),[4,f(v,g)];case 5:return S=r.sent(),j=!1,"string"!=typeof S?[3,8]:(T=n.join(process.cwd()),N="theme.zip",L=n.join(process.cwd(),N),k=new o,C=["node_modules",".next","out",".git"],t.readdirSync(T).forEach((function(e){var r=n.join(T,e);if(t.lstatSync(r).isDirectory()){if(C.includes(e))return;k.addLocalFolder(r,e)}else k.addLocalFile(e)})),k.writeZip(L),y=L,w=t.statSync(y),[4,p(S,t.readFileSync(y),w.size)]);case 6:return(j=r.sent())?[4,m()]:[3,8];case 7:j=r.sent(),r.label=8;case 8:return j?e():h(),[3,11];case 9:return b=r.sent(),console.error(b),h(),[3,11];case 10:return y&&function(e){try{t.unlinkSync(e)}catch(e){console.error("An error occurrred while deleting the zip file!"),console.error(e)}}(y),[7];case 11:return[2]}var T,N,L,k,C}))}))},h={};function f(t,n){return e(this,void 0,void 0,(function(){var e,o,i,c,a;return r(this,(function(r){switch(r.label){case 0:return r.trys.push([0,4,,5]),e=Object.keys(n),o=e.some((function(e){return"en"===e}))?"en":e[0],[4,y()];case 1:return i=r.sent(),[4,s({method:"post",url:process.env.NEXT_PUBLIC_PARTNER_GQL_URL,headers:{"x-api-key":i.apiKey,"Content-Type":"application/json"},data:JSON.stringify({query:"\n mutation createNewThemeVersion($input: CreateNewThemeVersionInput!) {\n createNewThemeVersion(input: $input) {\n themeVersionId\n uploadUrl\n }\n }\n ",variables:{input:{themeId:i.themeId,themeSecret:i.themeSecret,themeJson:JSON.stringify(t),locales:Object.entries(n).map((function(e){var r=e[0],t=e[1];return{isDefaultLocale:r===o,locale:r,localeJson:JSON.stringify(t)}}))}}})})];case 2:return[4,r.sent().data];case 3:return(c=r.sent()).data&&c.data.createNewThemeVersion?[2,c.data.createNewThemeVersion.uploadUrl]:[3,5];case 4:return a=r.sent(),console.error("An error occurred during saveTheme!"),console.log(a),[3,5];case 5:return[2]}}))}))}function p(t,n,o){return e(this,void 0,void 0,(function(){var e,i;return r(this,(function(r){switch(r.label){case 0:e={headers:{"Content-Type":"application/zip","Content-Length":o+""},maxBodyLength:104857600,maxContentLength:104857600},r.label=1;case 1:return r.trys.push([1,3,,4]),[4,s.put(t,n,e)];case 2:return[2,200===r.sent().status];case 3:return i=r.sent(),console.error("An error occurred during uploadTheme!"),console.log(i),[2,!1];case 4:return[2]}}))}))}function m(){return e(this,void 0,void 0,(function(){var e,t;return r(this,(function(r){switch(r.label){case 0:return r.trys.push([0,4,,5]),[4,y()];case 1:return e=r.sent(),[4,fetch(process.env.NEXT_PUBLIC_PARTNER_GQL_URL,{method:"POST",body:JSON.stringify({query:"\n mutation buildThemeLatestVersion(\n $themeSecret: String!\n $themeId: String!\n ) {\n buildThemeLatestVersion(\n themeSecret: $themeSecret\n themeId: $themeId\n )\n }\n ",variables:{themeSecret:e.themeSecret,themeId:e.themeId}}),headers:{"x-api-key":e.apiKey,"Content-Type":"application/json"}})];case 2:return[4,r.sent().json()];case 3:return r.sent(),[2,!0];case 4:return t=r.sent(),console.error("An error occurred during buildTheme!"),console.log(t),[2,!1];case 5:return[2]}}))}))}function y(){return new Promise((function(e,r){var o=n.join(process.cwd(),"config.json");t.readFile(o,(function(t,n){if(t)return console.error("An error occurred while reading the storefront config!"),r(t);e(JSON.parse(n.toString()))}))}))}export{h as config,d as uploadTheme};
1
+ import{__awaiter as e,__generator as r}from'./../ext/tslib/tslib.es6.js';import n from"fs";import t from"path";import o from"adm-zip";import s from"axios";import i from"@ikas/storefront-assets/checkout/de.js";import a from"@ikas/storefront-assets/checkout/en.js";import c from"@ikas/storefront-assets/checkout/fr.js";import u from"@ikas/storefront-assets/checkout/tr.js";import{corsMiddleware as l}from"./middleware.js";var d=function(s,d){return e(void 0,void 0,void 0,(function(){var e,p,y,T,g,j,v,w,b,S,k;return r(this,(function(r){switch(r.label){case 0:return[4,l(s,d)];case 1:if(r.sent(),"POST"!==s.method)return d.statusCode=405,d.setHeader("Allow","POST"),d.setHeader("Content-Type","application/json"),d.json({status:"failed",message:"Method not allowed. Use POST."}),[2];if(!(e=function(e){if(!e||"object"!=typeof e)return null;var r=e.uploadToken;return"string"==typeof r&&r.trim().length?r:null}(s.body)))return d.statusCode=400,d.setHeader("Content-Type","application/json"),d.json({status:"failed",message:"uploadToken is required and must be a non-empty string."}),[2];p=function(){d.statusCode=200,d.setHeader("Content-Type","application/json"),d.json({status:"ok"})},y=function(){d.statusCode=400,d.setHeader("Content-Type","application/json"),d.json({status:"failed"})},T=function(){d.statusCode=403,d.setHeader("Content-Type","application/json"),d.json({status:"failed",code:"UNAUTHORIZED"})},g="",r.label=2;case 2:return r.trys.push([2,9,10,11]),[4,new Promise((function(e,r){var o=t.join(process.cwd(),"src","theme.json");n.readFile(o,(function(n,t){if(n)return console.error("An error occurred while reading the theme.json file!"),r(n);e(JSON.parse(t.toString()))}))}))];case 3:return j=r.sent(),[4,new Promise((function(e,r){var o=t.join(process.cwd(),"public","locales"),s=function(e){return e.length?e.split(".")[0]:e};n.readdir(o,(function(l,d){if(l)return r(l);var p=d.filter((function(e){return n.lstatSync(t.join(o,e)).isDirectory()})),f={},h=!1;p.forEach((function(e){var r=t.join(process.cwd(),"public","locales",e);f[e]={};try{var o=n.readdirSync(r);o.forEach((function(r){var o=n.readFileSync(t.join(process.cwd(),"public","locales",e,r)),l=s(e).toLowerCase(),d=s(r);f[l][d]=JSON.parse(o.toString()),f[l]["checkout-page"]="tr"===l?u:"de"===l?i:"fr"===l?c:a}))}catch(e){console.error("An error occurred while reading localization files!"),console.error(e),h=!0}})),h?r(null):e(f)}))}))];case 4:return v=r.sent(),[4,f(j,v,e)];case 5:return null===(w=r.sent())?(T(),[2]):(b=!1,"string"!=typeof w?[3,8]:(C=t.join(process.cwd()),N="theme.zip",L=t.join(process.cwd(),N),O=new o,A=["node_modules",".next","out",".git"],n.readdirSync(C).forEach((function(e){var r=t.join(C,e);if(n.lstatSync(r).isDirectory()){if(A.includes(e))return;O.addLocalFolder(r,e)}else O.addLocalFile(e)})),O.writeZip(L),g=L,S=n.statSync(g),[4,h(w,n.readFileSync(g),S.size)]));case 6:return(b=r.sent())?[4,m(e)]:[3,8];case 7:b=r.sent(),r.label=8;case 8:return b?p():y(),[3,11];case 9:return k=r.sent(),console.error(k),y(),[3,11];case 10:return g&&function(e){try{n.unlinkSync(e)}catch(e){console.error("An error occurrred while deleting the zip file!"),console.error(e)}}(g),[7];case 11:return[2]}var C,N,L,O,A}))}))},p={};function f(n,t,o){return e(this,void 0,void 0,(function(){var e,i,a,c,u;return r(this,(function(r){switch(r.label){case 0:return r.trys.push([0,4,,5]),e=Object.keys(t),i=e.some((function(e){return"en"===e}))?"en":e[0],[4,T()];case 1:return a=r.sent(),[4,s({method:"post",url:process.env.NEXT_PUBLIC_PARTNER_GQL_URL,headers:{"Content-Type":"application/json"},data:JSON.stringify({query:"\n mutation createNewThemeVersion($input: CreateNewThemeVersionInput!) {\n createNewThemeVersion(input: $input) {\n themeVersionId\n uploadUrl\n }\n }\n ",variables:{input:{themeId:a.themeId,uploadToken:o,themeJson:JSON.stringify(n),locales:Object.entries(t).map((function(e){var r=e[0],n=e[1];return{isDefaultLocale:r===i,locale:r,localeJson:JSON.stringify(n)}}))}}})})];case 2:return[4,r.sent().data];case 3:return(c=r.sent()).data&&c.data.createNewThemeVersion?[2,c.data.createNewThemeVersion.uploadUrl]:(y("saveTheme",c.errors),!c.errors&&c.data&&null===c.data.createNewThemeVersion?[2,null]:[3,5]);case 4:return u=r.sent(),console.error("An error occurred during saveTheme!",null==u?void 0:u.message),[3,5];case 5:return[2]}}))}))}function h(n,t,o){return e(this,void 0,void 0,(function(){var e,i;return r(this,(function(r){switch(r.label){case 0:e={headers:{"Content-Type":"application/zip","Content-Length":o+""},maxBodyLength:104857600,maxContentLength:104857600},r.label=1;case 1:return r.trys.push([1,3,,4]),[4,s.put(n,t,e)];case 2:return[2,200===r.sent().status];case 3:return i=r.sent(),console.error("An error occurred during uploadTheme!"),console.log(i),[2,!1];case 4:return[2]}}))}))}function m(n){return e(this,void 0,void 0,(function(){var e,t,o;return r(this,(function(r){switch(r.label){case 0:return r.trys.push([0,4,,5]),[4,T()];case 1:return e=r.sent(),[4,fetch(process.env.NEXT_PUBLIC_PARTNER_GQL_URL,{method:"POST",body:JSON.stringify({query:"\n mutation buildThemeLatestVersion(\n $themeId: String!\n $uploadToken: String!\n ) {\n buildThemeLatestVersion(\n themeId: $themeId\n uploadToken: $uploadToken\n )\n }\n ",variables:{themeId:e.themeId,uploadToken:n}}),headers:{"Content-Type":"application/json"}})];case 2:return[4,r.sent().json()];case 3:return!(t=r.sent()).errors&&t.data&&!0===t.data.buildThemeLatestVersion?[2,!0]:(y("buildTheme",t.errors),[2,!1]);case 4:return o=r.sent(),console.error("An error occurred during buildTheme!",null==o?void 0:o.message),[2,!1];case 5:return[2]}}))}))}function y(e,r){var n=Array.isArray(r)?r.map((function(e){return e&&e.message})):[];console.error("".concat(e," failed!"),n)}function T(){return new Promise((function(e,r){var o=t.join(process.cwd(),"config.json");n.readFile(o,(function(n,t){if(n)return console.error("An error occurred while reading the storefront config!"),r(n);e(JSON.parse(t.toString()))}))}))}export{p as config,d as uploadTheme};
package/build/index.js CHANGED
@@ -1 +1 @@
1
- export{IkasLocalThemeAPI}from"./api/index.js";import*as a from"./pages/home.js";export{a as IndexPage};import*as s from"./pages/_slug_/index.js";export{s as SlugPage};import*as o from"./pages/pages/_slug_.js";export{o as CustomPage};import*as e from"./pages/checkout.js";export{e as CheckoutPage};import*as r from"./pages/account/index.js";export{r as AccountPage};import*as t from"./pages/account/addresses.js";export{t as AddressesPage};import*as p from"./pages/account/orders/index.js";export{p as OrdersPage};import*as g from"./pages/account/orders/_id_.js";export{g as OrderDetailPage};import*as m from"./pages/account/login.js";export{m as LoginPage};import*as i from"./pages/account/register.js";export{i as RegisterPage};import*as f from"./pages/account/forgot-password.js";export{f as ForgotPasswordPage};import*as c from"./pages/account/recover-password.js";export{c as RecoverPasswordPage};import*as x from"./pages/cart.js";export{x as CartPage};import*as P from"./pages/editor.js";export{P as EditorPage};import*as d from"./pages/account/favorite-products.js";export{d as FavoriteProductsPage};import*as u from"./pages/search.js";export{u as SearchPage};import*as j from"./pages/404.js";export{j as NotFoundPage};import*as n from"./pages/blog/index.js";export{n as BlogPage};import*as l from"./pages/blog/_slug_.js";export{l as BlogSlugPage};import*as _ from"./pages/raffle/_slug_.js";export{_ as RafflePage};import*as v from"./pages/raffle/index.js";export{v as RafflesPage};import*as h from"./pages/account/raffles.js";export{h as AccountRafflesPage};import*as A from"./pages/account/activate.js";export{A as ActivateCustomerPage};export{IkasNextPageDataProvider}from"./provider/page-data-next.js";export{getGoogleFontHref}from"./utils/google-fonts.js";
1
+ export{IkasLocalThemeAPI}from"./api/index.js";import*as a from"./pages/home.js";export{a as IndexPage};import*as o from"./pages/_slug_/index.js";export{o as SlugPage};import*as s from"./pages/pages/_slug_.js";export{s as CustomPage};import*as e from"./pages/checkout.js";export{e as CheckoutPage};import*as r from"./pages/account/index.js";export{r as AccountPage};import*as t from"./pages/account/addresses.js";export{t as AddressesPage};import*as p from"./pages/account/orders/index.js";export{p as OrdersPage};import*as g from"./pages/account/orders/_id_.js";export{g as OrderDetailPage};import*as m from"./pages/account/login.js";export{m as LoginPage};import*as i from"./pages/account/register.js";export{i as RegisterPage};import*as f from"./pages/account/forgot-password.js";export{f as ForgotPasswordPage};import*as c from"./pages/account/recover-password.js";export{c as RecoverPasswordPage};import*as x from"./pages/cart.js";export{x as CartPage};import*as P from"./pages/editor.js";export{P as EditorPage};import*as d from"./pages/account/favorite-products.js";export{d as FavoriteProductsPage};import*as u from"./pages/search.js";export{u as SearchPage};import*as n from"./pages/404.js";export{n as NotFoundPage};import*as j from"./pages/blog/index.js";export{j as BlogPage};import*as l from"./pages/blog/_slug_.js";export{l as BlogSlugPage};import*as _ from"./pages/raffle/_slug_.js";export{_ as RafflePage};import*as v from"./pages/raffle/index.js";export{v as RafflesPage};import*as h from"./pages/account/raffles.js";export{h as AccountRafflesPage};import*as k from"./pages/account/activate.js";export{k as ActivateCustomerPage};export{CheckoutStorefrontType,IkasNextPageDataProvider}from"./provider/page-data-next.js";export{getGoogleFontHref}from"./utils/google-fonts.js";
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as t}from"../../../ext/tslib/tslib.es6.js";import{IkasThemeJsonComponentPropType as a}from"@ikas/storefront-models";import s from"path";import{createFile as r,deleteDirContent as n}from"../../../utils/fs.js";import o from"lodash/uniq";var c=function(){function c(){}return c.generate=function(a,p){return e(this,void 0,void 0,(function(){var e,u,I,k,m,T,L;return t(this,(function(t){switch(t.label){case 0:return[4,n(s.join(p||process.cwd(),"src","components","__generated__","types"))];case 1:t.sent(),e={content:"",imports:[],internalCustomDatas:[]},t.label=2;case 2:t.trys.push([2,5,,6]),a.customData.forEach((function(t){c.generateAllCustomDataTypes(t,e,a)})),u=0,I=0;do{u=e.internalCustomDatas.length,e.internalCustomDatas.forEach((function(t){c.generateAllCustomDataTypes(t,e,a)})),(I=e.internalCustomDatas.length)!==u&&(e.internalCustomDatas=e.internalCustomDatas.splice(u,I))}while(u!==I);return[4,i.generate(a,e)];case 3:return t.sent(),k=s.join(p||process.cwd(),"src","components","__generated__"),e.imports=o(e.imports),m="import {\r\n",e.imports.forEach((function(e){m+="\t".concat(e,",\r\n")})),T=(m+='} from "@ikas/storefront"\r\n\r\n')+e.content,[4,r(k,"types.ts",T)];case 4:return[2,t.sent()];case 5:return L=t.sent(),console.log(L),[2,!1];case 6:return[2]}}))}))},c.generateAllCustomDataTypes=function(e,t,s){var r=e.type===a.ENUM,n="export ".concat(r?"enum":"type"," ").concat(c.generateTypeName(e)).concat(r?"":" = ","{ \r\n"),o="};\r\n\r\n";e.type!==a.DYNAMIC_LIST&&e.type!==a.STATIC_LIST||!e.nestedData?e.type===a.ENUM&&e.enumOptions?(t.content+=n,e.enumOptions.forEach((function(e){var a=e.value;e.value&&!isNaN(parseInt(e.value))&&(a="_"+e.value),t.content+='\t"'.concat(a,'" = "').concat(null==e?void 0:e.value,'",'),t.content+="\r\n"})),t.content+=o):(t.content+=n,e.nestedData&&e.nestedData.forEach((function(e){c.genenateCustomDataType(e,t,s),t.content+="\r\n"})),t.content+=o):c.generateAllCustomDataTypes(e.nestedData[0],t,s)},c.genenateCustomDataType=function(e,t,s){var r=c.getType(e,t,s);e.key&&e.key[0].match(/^\d/)&&(e.key="_"+e.key),t.content+="\t".concat(e.key).concat(e.isRequired?"":"?",": ").concat(r).concat([a.DYNAMIC_LIST,a.STATIC_LIST].includes(e.type)?"[]":"").concat(e.type===a.ENUM?",":";")},c.getType=function(e,t,s){var r="";switch(e.type){case a.TEXT:case a.RICH_TEXT:case a.COLOR:r="string";break;case a.BOOLEAN:r="boolean";break;case a.IMAGE:r="IkasImage",t.imports.push(r);break;case a.IMAGE_LIST:r="IkasImage[]",t.imports.push("IkasImage");break;case a.LINK:r="IkasNavigationLink",t.imports.push(r);break;case a.LIST_OF_LINK:r="IkasNavigationLink[]",t.imports.push("IkasNavigationLink");break;case a.PRODUCT_DETAIL:r="IkasProduct",t.imports.push(r);break;case a.PRODUCT_LIST:r="IkasProductList",t.imports.push("IkasProductList");break;case a.PRODUCT_ATTRIBUTE:r="IkasAttributeDetail",t.imports.push(r);break;case a.PRODUCT_ATTRIBUTE_LIST:r="IkasAttributeList",t.imports.push("IkasAttributeList");break;case a.BRAND:r="IkasBrand",t.imports.push(r);break;case a.BRAND_LIST:r="IkasBrandList",t.imports.push(r);break;case a.CATEGORY:r="IkasCategory",t.imports.push(r);break;case a.CATEGORY_LIST:r="IkasCategoryList",t.imports.push(r);break;case a.CUSTOM:var n=s.customData.find((function(t){return t.id===e.customDataId}));n&&(r=c.generateTypeName(n));break;case a.COMPONENT:r="IkasComponentRenderer",t.imports.push(r);break;case a.COMPONENT_LIST:r="IkasComponentRenderer[]",t.imports.push("IkasComponentRenderer");break;case a.BLOG:r="IkasBlog",t.imports.push(r);break;case a.BLOG_LIST:r="IkasBlogList",t.imports.push(r);break;case a.BLOG_CATEGORY:r="IkasBlogCategory",t.imports.push(r);break;case a.BLOG_CATEGORY_LIST:r="IkasBlogCategoryList",t.imports.push(r);break;case a.RAFFLE:r="IkasRaffle",t.imports.push(r);break;case a.RAFFLE_LIST:r="IkasRaffleList",t.imports.push(r);break;case a.SLIDER:r="IkasSlider",t.imports.push(r);break;case a.VIDEO:r="IkasVideo",t.imports.push(r);break;case a.ENUM:case a.OBJECT:r=c.generateTypeName(e),t.content.includes("export enum ".concat(r))||t.internalCustomDatas.push(e);break;case a.DYNAMIC_LIST:case a.STATIC_LIST:e.nestedData&&(e.nestedData[0].type===a.OBJECT||e.nestedData[0].type===a.ENUM?(r=c.generateTypeName(e.nestedData[0]),t.content.includes("export type ".concat(r))||t.internalCustomDatas.push(e.nestedData[0])):r=c.getType(e.nestedData[0],t,s))}return r},c.generateTypeName=function(e){if(e.typescriptName)return e.typescriptName;var t=e.name||"";return(t=(t=t.replace(/\s/g,"")).replace(/\W/g,""))[0].match(/^\d/)&&(t="_"+t),e.type===a.ENUM&&(t+="Enum"),t},c}(),i=function(){function s(){}return s.generate=function(a,r){return e(this,void 0,void 0,(function(){return t(this,(function(e){return a.components.forEach((function(e){e.props.length>0&&"checkout"!==e.id&&(r.content+="export type ".concat(s.generatePropTypeName(e),"Props = {\n"),e.props.forEach((function(e){r.content+="\t".concat(e.name).concat(e.isRequired?"":"?",": ").concat(s.getType(e,a,r),";\n")})),r.content+="};\r\n\r\n")})),[2]}))}))},s.getType=function(e,t,s){var r="";switch(e.type){case a.TEXT:case a.RICH_TEXT:case a.COLOR:r="string";break;case a.BOOLEAN:r="boolean";break;case a.IMAGE:r="IkasImage",s.imports.push(r);break;case a.IMAGE_LIST:r="IkasImage[]",s.imports.push("IkasImage");break;case a.LINK:r="IkasNavigationLink",s.imports.push(r);break;case a.LIST_OF_LINK:r="IkasNavigationLink[]",s.imports.push("IkasNavigationLink");break;case a.PRODUCT_DETAIL:r="IkasProduct",s.imports.push(r);break;case a.PRODUCT_LIST:r="IkasProductList",s.imports.push("IkasProductList");break;case a.PRODUCT_ATTRIBUTE:r="IkasAttributeDetail",s.imports.push(r);break;case a.PRODUCT_ATTRIBUTE_LIST:r="IkasAttributeList",s.imports.push("IkasAttributeList");break;case a.BRAND:r="IkasBrand",s.imports.push(r);break;case a.BRAND_LIST:r="IkasBrandList",s.imports.push(r);break;case a.CATEGORY:r="IkasCategory",s.imports.push(r);break;case a.CATEGORY_LIST:r="IkasCategoryList",s.imports.push(r);break;case a.CUSTOM:var n=t.customData.find((function(t){return t.id===e.customDataId}));n&&(r=c.getType(n,s,t),n.type!==a.DYNAMIC_LIST&&n.type!==a.STATIC_LIST||(r+="[]"));break;case a.COMPONENT:r="IkasComponentRenderer",s.imports.push(r);break;case a.COMPONENT_LIST:r="IkasComponentRenderer[]",s.imports.push("IkasComponentRenderer");break;case a.BLOG:r="IkasBlog",s.imports.push(r);break;case a.BLOG_LIST:r="IkasBlogList",s.imports.push(r);break;case a.BLOG_CATEGORY:r="IkasBlogCategory",s.imports.push(r);break;case a.BLOG_CATEGORY_LIST:r="IkasBlogCategoryList",s.imports.push(r);break;case a.RAFFLE:r="IkasRaffle",s.imports.push(r);break;case a.RAFFLE_LIST:r="IkasRaffleList",s.imports.push(r);break;case a.SLIDER:r="IkasSlider",s.imports.push(r);break;case a.VIDEO:r="IkasVideo",s.imports.push(r)}return r},s.generatePropTypeName=function(e){if(""!==e.displayName){var t=(e.dir||"").split("-"),a="";return t.forEach((function(e,t){return a+=e.charAt(0).toUpperCase()+e.slice(1)})),a[0].match(/^\d/)&&(a="_"+a),a}},s}();export{c as CustomDataTypesGenerator,i as PropTypeGenarator};
1
+ import{__awaiter as e,__generator as t}from"../../../ext/tslib/tslib.es6.js";import{IkasThemeJsonComponentPropType as a}from"@ikas/storefront-models";import s from"path";import{createFile as r,deleteDirContent as n}from"../../../utils/fs.js";import o from"lodash/uniq";var i=function(){function i(){}return i.generate=function(a,p){return e(this,void 0,void 0,(function(){var e,u,I,k,m,T,L;return t(this,(function(t){switch(t.label){case 0:return[4,n(s.join(p||process.cwd(),"src","components","__generated__","types"))];case 1:t.sent(),e={content:"",imports:[],internalCustomDatas:[]},t.label=2;case 2:t.trys.push([2,5,,6]),a.customData.forEach((function(t){i.generateAllCustomDataTypes(t,e,a)})),u=0,I=0;do{u=e.internalCustomDatas.length,e.internalCustomDatas.forEach((function(t){i.generateAllCustomDataTypes(t,e,a)})),(I=e.internalCustomDatas.length)!==u&&(e.internalCustomDatas=e.internalCustomDatas.splice(u,I))}while(u!==I);return[4,c.generate(a,e)];case 3:return t.sent(),k=s.join(p||process.cwd(),"src","components","__generated__"),e.imports=o(e.imports),m="import {\r\n",e.imports.forEach((function(e){m+="\t".concat(e,",\r\n")})),T=(m+='} from "@ikas/storefront"\r\n\r\n')+e.content,[4,r(k,"types.ts",T)];case 4:return[2,t.sent()];case 5:return L=t.sent(),console.log(L),[2,!1];case 6:return[2]}}))}))},i.generateAllCustomDataTypes=function(e,t,s){var r=e.type===a.ENUM,n="export ".concat(r?"enum":"type"," ").concat(i.generateTypeName(e)).concat(r?"":" = ","{ \r\n"),o="};\r\n\r\n";e.type!==a.DYNAMIC_LIST&&e.type!==a.STATIC_LIST||!e.nestedData?e.type===a.ENUM&&e.enumOptions?(t.content+=n,e.enumOptions.forEach((function(e){var a=e.value;e.value&&!isNaN(parseInt(e.value))&&(a="_"+e.value),t.content+='\t"'.concat(a,'" = "').concat(null==e?void 0:e.value,'",'),t.content+="\r\n"})),t.content+=o):(t.content+=n,e.nestedData&&e.nestedData.forEach((function(e){i.genenateCustomDataType(e,t,s),t.content+="\r\n"})),t.content+=o):i.generateAllCustomDataTypes(e.nestedData[0],t,s)},i.genenateCustomDataType=function(e,t,s){var r=i.getType(e,t,s);e.key&&e.key[0].match(/^\d/)&&(e.key="_"+e.key),t.content+="\t".concat(e.key).concat(e.isRequired?"":"?",": ").concat(r).concat([a.DYNAMIC_LIST,a.STATIC_LIST].includes(e.type)?"[]":"").concat(e.type===a.ENUM?",":";")},i.getType=function(e,t,s){var r="";switch(e.type){case a.TEXT:case a.RICH_TEXT:case a.COLOR:r="string";break;case a.BOOLEAN:r="boolean";break;case a.IMAGE:r="IkasImage",t.imports.push(r);break;case a.IMAGE_LIST:r="IkasImage[]",t.imports.push("IkasImage");break;case a.LINK:r="IkasNavigationLink",t.imports.push(r);break;case a.LIST_OF_LINK:r="IkasNavigationLink[]",t.imports.push("IkasNavigationLink");break;case a.PRODUCT_DETAIL:r="IkasProduct",t.imports.push(r);break;case a.PRODUCT_LIST:r="IkasProductList",t.imports.push("IkasProductList");break;case a.PRODUCT_ATTRIBUTE:r="IkasAttributeDetail",t.imports.push(r);break;case a.PRODUCT_ATTRIBUTE_LIST:r="IkasAttributeList",t.imports.push("IkasAttributeList");break;case a.BRAND:r="IkasBrand",t.imports.push(r);break;case a.BRAND_LIST:r="IkasBrandList",t.imports.push(r);break;case a.CATEGORY:r="IkasCategory",t.imports.push(r);break;case a.CATEGORY_LIST:r="IkasCategoryList",t.imports.push(r);break;case a.CUSTOM:var n=s.customData.find((function(t){return t.id===e.customDataId}));n&&(r=i.generateTypeName(n));break;case a.COMPONENT:r="IkasComponentRenderer",t.imports.push(r);break;case a.COMPONENT_LIST:r="IkasComponentRenderer[]",t.imports.push("IkasComponentRenderer");break;case a.BLOG:r="IkasBlog",t.imports.push(r);break;case a.BLOG_LIST:r="IkasBlogList",t.imports.push(r);break;case a.BLOG_CATEGORY:r="IkasBlogCategory",t.imports.push(r);break;case a.BLOG_CATEGORY_LIST:r="IkasBlogCategoryList",t.imports.push(r);break;case a.RAFFLE:r="IkasRaffle",t.imports.push(r);break;case a.RAFFLE_LIST:r="IkasRaffleList",t.imports.push(r);break;case a.SLIDER:r="IkasSlider",t.imports.push(r);break;case a.VIDEO:r="IkasVideo",t.imports.push(r);break;case a.ENUM:case a.OBJECT:r=i.generateTypeName(e),t.content.includes("export enum ".concat(r))||t.internalCustomDatas.push(e);break;case a.DYNAMIC_LIST:case a.STATIC_LIST:e.nestedData&&(e.nestedData[0].type===a.OBJECT||e.nestedData[0].type===a.ENUM?(r=i.generateTypeName(e.nestedData[0]),t.content.includes("export type ".concat(r))||t.internalCustomDatas.push(e.nestedData[0])):r=i.getType(e.nestedData[0],t,s))}return r},i.generateTypeName=function(e){var t;if(e.typescriptName)return e.typescriptName;if((e.type===a.DYNAMIC_LIST||e.type===a.STATIC_LIST)&&(null===(t=e.nestedData)||void 0===t?void 0:t.length))return i.generateTypeName(e.nestedData[0]);var s=e.name||"";return(s=(s=s.replace(/\s/g,"")).replace(/\W/g,""))[0].match(/^\d/)&&(s="_"+s),e.type===a.ENUM&&(s+="Enum"),s},i}(),c=function(){function s(){}return s.generate=function(a,r){return e(this,void 0,void 0,(function(){return t(this,(function(e){return a.components.forEach((function(e){e.props.length>0&&"checkout"!==e.id&&(r.content+="export type ".concat(s.generatePropTypeName(e),"Props = {\n"),e.props.forEach((function(e){r.content+="\t".concat(e.name).concat(e.isRequired?"":"?",": ").concat(s.getType(e,a,r),";\n")})),r.content+="};\r\n\r\n")})),[2]}))}))},s.getType=function(e,t,s){var r="";switch(e.type){case a.TEXT:case a.RICH_TEXT:case a.COLOR:r="string";break;case a.BOOLEAN:r="boolean";break;case a.IMAGE:r="IkasImage",s.imports.push(r);break;case a.IMAGE_LIST:r="IkasImage[]",s.imports.push("IkasImage");break;case a.LINK:r="IkasNavigationLink",s.imports.push(r);break;case a.LIST_OF_LINK:r="IkasNavigationLink[]",s.imports.push("IkasNavigationLink");break;case a.PRODUCT_DETAIL:r="IkasProduct",s.imports.push(r);break;case a.PRODUCT_LIST:r="IkasProductList",s.imports.push("IkasProductList");break;case a.PRODUCT_ATTRIBUTE:r="IkasAttributeDetail",s.imports.push(r);break;case a.PRODUCT_ATTRIBUTE_LIST:r="IkasAttributeList",s.imports.push("IkasAttributeList");break;case a.BRAND:r="IkasBrand",s.imports.push(r);break;case a.BRAND_LIST:r="IkasBrandList",s.imports.push(r);break;case a.CATEGORY:r="IkasCategory",s.imports.push(r);break;case a.CATEGORY_LIST:r="IkasCategoryList",s.imports.push(r);break;case a.CUSTOM:var n=t.customData.find((function(t){return t.id===e.customDataId}));n&&(r=i.getType(n,s,t),n.type!==a.DYNAMIC_LIST&&n.type!==a.STATIC_LIST||(r+="[]"));break;case a.COMPONENT:r="IkasComponentRenderer",s.imports.push(r);break;case a.COMPONENT_LIST:r="IkasComponentRenderer[]",s.imports.push("IkasComponentRenderer");break;case a.BLOG:r="IkasBlog",s.imports.push(r);break;case a.BLOG_LIST:r="IkasBlogList",s.imports.push(r);break;case a.BLOG_CATEGORY:r="IkasBlogCategory",s.imports.push(r);break;case a.BLOG_CATEGORY_LIST:r="IkasBlogCategoryList",s.imports.push(r);break;case a.RAFFLE:r="IkasRaffle",s.imports.push(r);break;case a.RAFFLE_LIST:r="IkasRaffleList",s.imports.push(r);break;case a.SLIDER:r="IkasSlider",s.imports.push(r);break;case a.VIDEO:r="IkasVideo",s.imports.push(r)}return r},s.generatePropTypeName=function(e){if(""!==e.displayName){var t=(e.dir||"").split("-"),a="";return t.forEach((function(e,t){return a+=e.charAt(0).toUpperCase()+e.slice(1)})),a[0].match(/^\d/)&&(a="_"+a),a}},s}();export{i as CustomDataTypesGenerator,c as PropTypeGenarator};
@@ -1,2 +1,3 @@
1
- import { GetStaticProps } from "next";
1
+ import { GetServerSideProps, GetStaticProps } from "next";
2
+ export declare const getServerSideProps: GetServerSideProps;
2
3
  export declare const getStaticProps: GetStaticProps;
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as r}from'./../ext/tslib/tslib.es6.js';import{IkasThemeJsonPageType as o}from"@ikas/storefront-models";import{IkasNextPageDataProvider as e}from"../provider/page-data-next.js";var i=function(i){return t(void 0,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,e.getStaticProps(i,o.CHECKOUT)];case 1:return[2,t.sent()]}}))}))};export{i as getStaticProps};
1
+ import{__awaiter as t,__generator as r}from'./../ext/tslib/tslib.es6.js';import{IkasThemeJsonPageType as e}from"@ikas/storefront-models";import{IkasNextPageDataProvider as o}from"../provider/page-data-next.js";var i=function(i){return t(void 0,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,o.getServerSideProps(i,e.CHECKOUT)];case 1:return[2,t.sent()]}}))}))},n=function(i){return t(void 0,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,o.getStaticProps(i,e.CHECKOUT)];case 1:return[2,t.sent()]}}))}))};export{i as getServerSideProps,n as getStaticProps};
@@ -1,11 +1,21 @@
1
1
  /// <reference types="node" />
2
2
  import { GetServerSidePropsContext, GetStaticPropsContext } from "next";
3
3
  import { ParsedUrlQuery } from "querystring";
4
- import { IkasCustomerReviewSettings, IkasCustomerSettings, IkasImage, IkasMerchantSettings, IkasProductBackInStockSettings, IkasSalesChannel, IkasStorefront, IkasStorefrontPopup, IkasStorefrontRouting, IkasStorefrontThemeLocalization, IkasThemeJson, IkasThemeJsonFavicon, IkasThemeJsonPageType, IkasThemeJsonSettings, IkasThemeJsonStockPreference } from "@ikas/storefront-models";
4
+ import { IkasCustomerReviewSettings, IkasCustomerSettings, IkasImage, IkasLoyaltyProgram, IkasMerchantSettings, IkasProductBackInStockSettings, IkasSalesChannel, IkasStorefront, IkasStorefrontPopup, IkasStorefrontRouting, IkasStorefrontThemeLocalization, IkasThemeJson, IkasThemeJsonFavicon, IkasThemeJsonPageType, IkasThemeJsonSettings, IkasThemeJsonStockPreference } from "@ikas/storefront-models";
5
5
  import { IkasPageDataProvider } from "@ikas/storefront-providers";
6
- import { IkasStorefrontSettings } from "@ikas/storefront-api";
6
+ import { listCheckoutSettings, IkasStorefrontSettings } from "@ikas/storefront-api";
7
7
  export declare class IkasNextPageDataProvider {
8
8
  static startTime: number;
9
+ static getStandaloneCheckoutRequest(context: GetStaticPropsContext<ParsedUrlQuery> | GetServerSidePropsContext<ParsedUrlQuery>): StandaloneCheckoutRequest | null;
10
+ private static getRequestPath;
11
+ static readJsonFile(filePath: string): any;
12
+ static ensureCheckoutPage(themeJson: IkasThemeJson): IkasThemeJson;
13
+ static getCheckoutThemeJson(settings: SettingsData): IkasThemeJson;
14
+ static getHeadlessRouting(routings: IkasStorefrontRouting[], requestPath: string, host?: string): IkasStorefrontRouting;
15
+ static getStudioRouting(routings: IkasStorefrontRouting[], requestPath: string): IkasStorefrontRouting | undefined;
16
+ static getHeadlessLocalizationPath(deployDir: string, storefront: IkasStorefront, locale: string): string | undefined;
17
+ static getStandaloneApiConfig(apiKey: string | undefined, storefrontId: string, storefrontRoutingId: string): StandaloneApiConfig;
18
+ static getStandaloneCheckoutSettings(request: StandaloneCheckoutRequest): Promise<SettingsData | null>;
9
19
  static readLocalTheme(): Promise<IkasThemeJson>;
10
20
  static readSettingsFile(): Promise<SettingsData | null>;
11
21
  static cacheLocalSettingsFile(settings: IkasStorefrontSettings): Promise<void>;
@@ -14,51 +24,77 @@ export declare class IkasNextPageDataProvider {
14
24
  static getProdSettings(locale: string): Promise<SettingsData | null>;
15
25
  static getSettings(locale: string): Promise<SettingsData | null>;
16
26
  static setStorefrontConfig(settings: SettingsData): Promise<void>;
27
+ static applyStorefrontConfig(settings: SettingsData, isStandalone?: boolean): void;
17
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;
30
+ static loadStandaloneCheckoutTranslations(settings: SettingsData): Promise<Record<string, any>>;
31
+ static mergeTranslations(defaults: Record<string, any>, overrides: Record<string, any>): Record<string, any>;
18
32
  static getExtraProps(settings: SettingsData, provider: IkasPageDataProvider, pageType?: IkasThemeJsonPageType): Promise<Record<string, any>>;
33
+ static buildCheckoutExtraProps(settings: SettingsData, provider: IkasPageDataProvider, checkoutSettings: Awaited<ReturnType<typeof listCheckoutSettings>>): Record<string, any>;
19
34
  static getPageData(context: GetStaticPropsContext<ParsedUrlQuery> | GetServerSidePropsContext<ParsedUrlQuery>, isServer: boolean, pageType?: IkasThemeJsonPageType, possiblePageTypes?: IkasThemeJsonPageType[], isEditor?: boolean): Promise<{
35
+ props: any;
36
+ } | {
20
37
  props: {};
21
38
  notFound: boolean;
22
39
  revalidate?: undefined;
23
40
  } | {
24
41
  props: any;
42
+ revalidate: number;
25
43
  notFound?: undefined;
26
- revalidate?: undefined;
44
+ }>;
45
+ static getStandaloneCheckoutPageData(context: GetStaticPropsContext<ParsedUrlQuery> | GetServerSidePropsContext<ParsedUrlQuery>, request: StandaloneCheckoutRequest): Promise<{
46
+ props: {};
47
+ notFound: true;
27
48
  } | {
28
49
  props: any;
29
- revalidate: number;
30
- notFound?: undefined;
31
50
  }>;
51
+ static omitPaymentStepScripts<T extends Record<string, any>>(props: T, context: GetStaticPropsContext<ParsedUrlQuery> | GetServerSidePropsContext<ParsedUrlQuery>): T;
32
52
  static getStaticProps(context: GetStaticPropsContext<ParsedUrlQuery>, pageType?: IkasThemeJsonPageType, possiblePageTypes?: IkasThemeJsonPageType[], isEditor?: boolean): Promise<{
53
+ props: any;
54
+ } | {
33
55
  props: {};
34
56
  notFound: boolean;
35
57
  revalidate?: undefined;
36
- } | {
37
- props: any;
38
- notFound?: undefined;
39
- revalidate?: undefined;
40
58
  } | {
41
59
  props: any;
42
60
  revalidate: number;
43
61
  notFound?: undefined;
44
62
  }>;
45
63
  static getServerSideProps(context: GetServerSidePropsContext<ParsedUrlQuery>, pageType?: IkasThemeJsonPageType): Promise<{
64
+ props: any;
65
+ } | {
46
66
  props: {};
47
67
  notFound: boolean;
48
68
  revalidate?: undefined;
49
- } | {
50
- props: any;
51
- notFound?: undefined;
52
- revalidate?: undefined;
53
69
  } | {
54
70
  props: any;
55
71
  revalidate: number;
56
72
  notFound?: undefined;
57
73
  }>;
74
+ static createColorStyle(settings: IkasThemeJsonSettings): string | undefined;
58
75
  static createColorScript(settings: IkasThemeJsonSettings): string | undefined;
76
+ private static fontScriptCache;
77
+ static getCachedFontScript(settings: IkasThemeJsonSettings): Promise<string | undefined>;
59
78
  static createFontScript(settings: IkasThemeJsonSettings): Promise<string | undefined>;
60
79
  }
80
+ export declare enum CheckoutStorefrontType {
81
+ STUDIO = "studio",
82
+ HEADLESS = "headless"
83
+ }
84
+ export declare type StandaloneApiConfig = {
85
+ URL: string;
86
+ HEADERS: Record<string, string>;
87
+ };
88
+ export declare type StandaloneCheckoutRequest = {
89
+ requestPath: string;
90
+ settingsPath: string;
91
+ projectJsonPath?: string;
92
+ deployDir?: string;
93
+ host?: string;
94
+ storefrontType: CheckoutStorefrontType;
95
+ };
61
96
  export declare type SettingsData = {
97
+ storefrontType: CheckoutStorefrontType;
62
98
  storefront: IkasStorefront;
63
99
  themeLocalization: IkasStorefrontThemeLocalization;
64
100
  salesChannel: IkasSalesChannel;
@@ -67,6 +103,7 @@ export declare type SettingsData = {
67
103
  favicon: IkasThemeJsonFavicon;
68
104
  stockPreference: IkasThemeJsonStockPreference;
69
105
  storefrontJSScripts: string[];
106
+ themeStyleScripts?: string[];
70
107
  highPriorityStoreFrontJSScripts: string[];
71
108
  domain: string;
72
109
  productBackInStockSettings: IkasProductBackInStockSettings | null;
@@ -75,10 +112,16 @@ export declare type SettingsData = {
75
112
  customerSettings?: IkasCustomerSettings;
76
113
  custom?: Record<string, any> | null;
77
114
  storefrontPopups: IkasStorefrontPopup[];
115
+ loyaltyPrograms: IkasLoyaltyProgram[];
116
+ payWithIkasUrl?: string | null;
117
+ projectJson?: Record<string, any>;
118
+ deployDir?: string;
119
+ apiKey?: string;
78
120
  };
79
121
  export declare type IkasCheckoutCustomizationProps = {
80
122
  logo?: IkasImage;
81
123
  showTax?: boolean;
124
+ showLoyaltyPoints?: boolean;
82
125
  showCampaignOffersDesign?: boolean;
83
126
  showCampaignIsBiggerImage?: boolean;
84
127
  campaignOfferIsSmallDesign?: boolean;
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as t,__spreadArray as o,__assign as n}from'./../ext/tslib/tslib.es6.js';import r from"fs";import s from"next/config.js";import{IkasThemeJsonPageType as i}from"@ikas/storefront-models";import{IkasPageDataProvider as a}from"@ikas/storefront-providers";import{IkasStorefrontConfig as c}from"@ikas/storefront-config";import{getStorefrontSettings as l,listMerchantSettings as u,setAPIClientConfig as p,listCheckoutSettings as g}from"@ikas/storefront-api";import{getGoogleFontHref as d}from"../utils/google-fonts.js";import{I18NFileReader as f}from"../utils/i18n.js";import{createFile as m,deleteDirContent as h}from"../utils/fs.js";var S=function(){function S(){}return S.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)}))}))},S.readSettingsFile=function(){return new Promise((function(e){var t=s().serverRuntimeConfig.SETTINGS;r.readFile(t,{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)}))}))},S.cacheLocalSettingsFile=function(o){return e(this,void 0,void 0,(function(){var e,n;return t(this,(function(t){switch(t.label){case 0:return[4,h(e=".ikas")];case 1:return t.sent(),n="settings-".concat(this.startTime,".json"),[4,m(e,n,JSON.stringify(o,null,2))];case 2:return t.sent(),[2]}}))}))},S.readLocalSettingsFile=function(){try{var e=r.readFileSync(".ikas/settings-".concat(this.startTime,".json"));if(e&&e.length)return JSON.parse(e.toString())}catch(e){}},S.getLocalSettings=function(o){return e(this,void 0,void 0,(function(){var e,n,r,s,i,a,c,u,p,g;return t(this,(function(t){switch(t.label){case 0:return[4,S.readLocalSettingsFile()];case 1:return(e=t.sent())?[3,4]:[4,l()];case 2:return(n=t.sent()).isSuccess&&n.data?(e=n.data,[4,this.cacheLocalSettingsFile(e)]):(console.error("Storefront settings fetch failed!"),console.error(n),[2,null]);case 3:t.sent(),t.label=4;case 4:return r=e.storefront,s=e.salesChannel,i=[],a=e.productBackInStockSettings?{customerLoginRequired:e.productBackInStockSettings.customerLoginRequired}:null,c=e.customerReviewSettings?{customerLoginRequired:e.customerReviewSettings.customerLoginRequired||!1,customerPurchaseRequired:e.customerReviewSettings.customerPurchaseRequired||!1}:null,[4,S.readLocalTheme()];case 5:return u=t.sent(),p=S.createColorScript(u.settings),[4,S.createFontScript(u.settings)];case 6:return g=t.sent(),p&&i.push(p),g&&i.push(g),[2,{storefront:r,themeLocalization:{id:"",locale:"en",privacyPolicy:null,returnPolicy:null,storefrontId:r.id,storefrontThemeId:"",termsOfService:null,imprint:null,shippingPolicy:null,themeJson:u},salesChannel:s,routing:r.routings.length?r.routings.find((function(e){return e.locale===o||e.id===o}))||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:i,highPriorityStoreFrontJSScripts:[],domain:"localhost:3333",productBackInStockSettings:a,customerReviewSettings:c,merchantSettings:e.merchantSettings,customerSettings:e.customerSettings,storefrontPopups:e.storefrontPopups}]}}))}))},S.getProdSettings=function(o){return e(this,void 0,void 0,(function(){var n=this;return t(this,(function(s){return[2,new Promise((function(s){return e(n,void 0,void 0,(function(){var n,i,a,c,l,p,g,d,f,m,h,v,C;return t(this,(function(I){switch(I.label){case 0:return[4,S.readSettingsFile()];case 1:return(n=I.sent())&&n.localizationMap?(i=n.storefront,a=n.salesChannel,c=n.localizationMap,l=n.storefrontJSScripts||[],p=n.highPriorityStoreFrontJSScripts||[],g=n.domain,d=n.productBackInStockSettings?{customerLoginRequired:n.productBackInStockSettings.customerLoginRequired}:null,f=n.customerReviewSettings?{customerLoginRequired:n.customerReviewSettings.customerLoginRequired||!1,customerPurchaseRequired:n.customerReviewSettings.customerPurchaseRequired||!1}:null,(m=n.merchantSettings)?[3,3]:[4,u({})]):[2,s(null)];case 2:if(!(h=I.sent()).isSuccess||!h.data)return console.error("MERCHANT SETTINGS FETCH FAILED!"),[2,s(null)];m=h.data,I.label=3;case 3:return m&&(m.address=null,delete m.merchantAddress),v=c[o],C=i.routings.find((function(e){return e.id===o||e.path===o})),v&&C?(r.readFile(v,{flag:"a+"},(function(o,r){return e(this,void 0,void 0,(function(){var e,c,u,h,v,I,y;return t(this,(function(t){switch(t.label){case 0:return o?(console.error("THEME LOCALIZATION FILE READ ERROR!!!"),console.error(o),[2,s(null)]):(e=r.length?JSON.parse(r.toString()):{},u=(c=e).themeJson.settings.favicon,h=c.themeJson.settings.stockPreference,c.themeJson.settings?(v=S.createColorScript(c.themeJson.settings),[4,S.createFontScript(c.themeJson.settings)]):[3,2]);case 1:I=t.sent(),v&&l.push(v),I&&l.push(I),t.label=2;case 2:return y=n.customerSettings,s({storefront:i,themeLocalization:c,salesChannel:a,routing:C,favicon:u,stockPreference:h,storefrontJSScripts:l,highPriorityStoreFrontJSScripts:p,domain:g,productBackInStockSettings:d,customerReviewSettings:f,merchantSettings:m,customerSettings:y,custom:n.custom,storefrontPopups:n.storefrontPopups}),[2]}}))}))})),[2]):(console.error("THEME LOCALIZATION PATH OR ROUTING MISSING!!!"),[2,s(null)])}}))}))}))]}))}))},S.getSettings=function(o){return e(this,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return"local"===process.env.NEXT_PUBLIC_ENV?[4,this.getLocalSettings(o)]:[3,2];case 1:case 3:return[2,e.sent()];case 2:return[4,this.getProdSettings(o)]}}))}))},S.setStorefrontConfig=function(o){var n;return e(this,void 0,void 0,(function(){var e,r,s,i,a,l,u,g,d,f,m,h,S,v;return t(this,(function(t){return e=o.storefront,r=o.salesChannel,s=o.routing,i=o.favicon,a=o.stockPreference,l=o.storefrontJSScripts,u=o.highPriorityStoreFrontJSScripts,g=o.domain,d=o.productBackInStockSettings,f=o.customerReviewSettings,m=o.merchantSettings,h=o.customerSettings,S=o.custom,v=o.storefrontPopups,c.init({apiUrl:process.env.NEXT_PUBLIC_GQL_URL,cdnUrl:process.env.NEXT_PUBLIC_CDN_URL,storefrontId:e.id,storefrontRoutingId:s.id,storefrontThemeId:e.mainStorefrontThemeId,storefrontB2BSettings:e.b2bSettings||void 0,storefrontType:e.type,salesChannelId:e.salesChannelId,priceListId:s.priceListId||void 0,stockLocationIds:null===(n=r.stockLocations)||void 0===n?void 0:n.map((function(e){return e.id})),routings:e.routings,paymentGateways:r.paymentGateways||[],gtmId:e.gtmId||void 0,fbpId:e.fbpId||void 0,analytics4Id:e.analytics4Id||void 0,universalAnalyticsId:e.universalAnalyticsId||void 0,tiktokPixelId:e.tiktokPixelId||void 0,favicon:i||null,pickUpStockLocationIds:e.pickUpStockLocationIds&&e.pickUpStockLocationIds.length?e.pickUpStockLocationIds:null,stockPreference:a||null,storefrontJSScripts:l||[],highPriorityStoreFrontJSScripts:u||[],domain:g,productBackInStockSettings:d,customerReviewSettings:f,merchantSettings:m,customerSettings:h,metaTemplates:e.metaTemplates||null,custom:S||null,indexPageSeoSettings:e.indexPageSeoSettings,storefrontPopups:v}),p(),[2]}))}))},S.setTranslations=function(n,r,a,l,u){return e(this,void 0,void 0,(function(){var e,p,g,d,m,h,S,v;return t(this,(function(t){switch(t.label){case 0:return e=s().serverRuntimeConfig,p=n.routing,g="local"===process.env.NEXT_PUBLIC_ENV,d=n.themeLocalization.themeJson.components.filter((function(e){return l||r.includes(e.id)})),m=o(["common"],d.map((function(e){return e.dir})),!0),(a===i.CHECKOUT||l)&&m.push("checkout-page"),h=e.nextI18nConf,S=g&&u?u:p.locale,[4,new f(S,m,g?void 0:h.localePath).read()];case 1:return v=t.sent(),c.init({translations:v}),[2]}}))}))},S.getExtraProps=function(o,n,r){var s,a,c,l,u,p,d,f,m,h,S,v,C,I,y,P,L,T,w,O,k,B,b;return e(this,void 0,void 0,(function(){var e,R,V,E,F;return t(this,(function(t){switch(t.label){case 0:return e={},R=o.themeLocalization,r!==i.CHECKOUT?[3,2]:(V=null===(s=n.page)||void 0===s?void 0:s.components[0])?[4,g({})]:[3,2];case 1:(E=t.sent()).isSuccess||(console.error("CHECKOUT SETTINGS FETCH FAILED!"),console.error(E.graphQLErrors),console.error(E.errorCodes)),F={logo:null!==(a=V.propValues.logo)&&void 0!==a?a:null,showTax:null===(c=V.propValues.showTax)||void 0===c||c,showCampaignOffersDesign:null!==(l=V.propValues.showCampaignOffersDesign)&&void 0!==l&&l,showCampaignIsBiggerImage:null!==(u=V.propValues.showCampaignIsBiggerImage)&&void 0!==u&&u,campaignOfferIsSmallDesign:null!==(p=V.propValues.campaignOfferIsSmallDesign)&&void 0!==p&&p,showCampaignHideDiscountBadge:null!==(d=V.propValues.showCampaignHideDiscountBadge)&&void 0!==d&&d,campaignOfferCountdownStyleIsLine:null!==(f=V.propValues.campaignOfferCountdownStyleIsLine)&&void 0!==f&&f,campaignOfferCountdownStyleIsLineSuccessPage:null!==(m=V.propValues.campaignOfferCountdownStyleIsLineSuccessPage)&&void 0!==m&&m,campaignOffersEnableMiddlePhase:null!==(h=V.propValues.campaignOffersEnableMiddlePhase)&&void 0!==h&&h,campaignOffersTitleColor:null!==(S=V.propValues.campaignOffersTitleColor)&&void 0!==S?S:null,campaignOffersDescriptionColor:null!==(v=V.propValues.campaignOffersDescriptionColor)&&void 0!==v?v:null,campaignOffersContainerBgColor:null!==(C=V.propValues.campaignOffersContainerBgColor)&&void 0!==C?C:null,campaignOffersDiscountPercentageColor:null!==(I=V.propValues.campaignOffersDiscountPercentageColor)&&void 0!==I?I:null,campaignOffersDiscountPercentageBgColor:null!==(y=V.propValues.campaignOffersDiscountPercentageBgColor)&&void 0!==y?y:null,campaignOffersCountdownTextColor:null!==(P=V.propValues.campaignOffersCountdownTextColor)&&void 0!==P?P:null,campaignOffersCountdownTimeColor:null!==(L=V.propValues.campaignOffersCountdownTimeColor)&&void 0!==L?L:null,campaignOffersCountdownBgColor:null!==(T=V.propValues.campaignOffersCountdownBgColor)&&void 0!==T?T:null,campaignOffersMiddlePhaseOverlayColor:null!==(w=V.propValues.campaignOffersMiddlePhaseOverlayColor)&&void 0!==w?w:null,buttonBgColor:V.propValues.buttonBgColor,buttonTextColor:V.propValues.buttonTextColor,buttonDisabledBgColor:V.propValues.buttonDisabledBgColor,buttonDisabledTextColor:V.propValues.buttonDisabledTextColor,primaryTextColor:V.propValues.primaryTextColor,secondaryTextColor:V.propValues.secondaryTextColor,primaryBgColor:V.propValues.primaryBgColor,secondaryBgColor:V.propValues.secondaryBgColor,borderColor:V.propValues.borderColor,cardBgColor:V.propValues.cardBgColor,errorColor:V.propValues.errorColor,errorLightColor:V.propValues.errorLightColor,warningColor:V.propValues.warningColor,warningLightColor:V.propValues.warningLightColor,successColor:V.propValues.successColor,successLightColor:V.propValues.successLightColor,secondaryButtonBgColor:null!==(O=V.propValues.secondaryButtonBgColor)&&void 0!==O?O:null,secondaryButtonTextColor:null!==(k=V.propValues.secondaryButtonTextColor)&&void 0!==k?k:null,secondaryButtonBorderColor:null!==(B=V.propValues.secondaryButtonBorderColor)&&void 0!==B?B:null},e.customizationProps=F,e.returnPolicy=R.returnPolicy,e.privacyPolicy=R.privacyPolicy,e.termsOfService=R.termsOfService,e.imprint=R.imprint,e.shippingPolicy=R.shippingPolicy,e.checkoutSettings=(null===(b=null==E?void 0:E.data)||void 0===b?void 0:b.length)?E.data[0]:null,t.label=2;case 2:return[2,e]}}))}))},S.getPageData=function(o,r,s,i,l){var u;return e(this,void 0,void 0,(function(){var e,g,d,f,m,h,v,C;return t(this,(function(t){switch(t.label){case 0:return e="local"===process.env.NEXT_PUBLIC_ENV,g=!e&&l,c.init({apiUrl:process.env.NEXT_PUBLIC_GQL_URL,cdnUrl:process.env.NEXT_PUBLIC_CDN_URL}),p(),g?[3,7]:(d=o.locale)?[4,S.getSettings(d)]:[2,{props:{},notFound:!0}];case 1:return(f=t.sent())&&f.storefront.mainStorefrontThemeId&&f.storefront.salesChannelId?[4,this.setStorefrontConfig(f)]:[2,{props:{},notFound:!0}];case 2:return t.sent(),m=f.themeLocalization,(h=new a(m.themeJson,o.params,s,f.merchantSettings)).possiblePageTypes=i||(s?[s]:[]),l?[3,4]:[4,h.getPageData()];case 3:if(t.sent(),!h.page)return[2,{props:{},notFound:!0}];t.label=4;case 4:return v=l?h.theme.components.map((function(e){return e.id})):(null===(u=h.page)||void 0===u?void 0:u.components.map((function(e){return e.componentId})))||[],[4,this.setTranslations(f,v,s,l,d)];case 5:return t.sent(),[4,this.getExtraProps(f,h,s)];case 6:return C=t.sent(),r?[2,{props:n(n({},h.nextPageData.props),C)}]:[2,{props:n(n({},h.nextPageData.props),C),revalidate:60}];case 7:return[2,{props:{}}];case 8:return[2]}}))}))},S.getStaticProps=function(o,n,r,s){return e(this,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,S.getPageData(o,!1,n,r,s)];case 1:return[2,e.sent()]}}))}))},S.getServerSideProps=function(o,n){return e(this,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,S.getPageData(o,!0,n)];case 1:return[2,e.sent()]}}))}))},S.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 ")},S.createFontScript=function(o){return e(this,void 0,void 0,(function(){var e,n,r;return t(this,(function(t){switch(t.label){case 0:return(e=d(o.fontFamily))?[4,fetch(e,{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,t.sent().text()];case 2:return n=t.sent(),r=n.replace(new RegExp("fonts.gstatic.com","g"),"fonts.myikas.com"),[2,"<style>\n ".concat(r,"\n\n body { \n font-family: '").concat(o.fontFamily.name,'\', -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;\n } \n\n </style>')];case 3:return[2]}}))}))},S.startTime=Date.now(),S}();export{S 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 f,listCheckoutSettings as g}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";var P,T=function(){function T(){}return T.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:T.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}},T.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}},T.readJsonFile=function(e){return JSON.parse(r.readFileSync(e,"utf8"))},T.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)})},T.getCheckoutThemeJson=function(e){return e.storefrontType===P.STUDIO?e.projectJson.checkoutThemeJson:e.themeLocalization.themeJson},T.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])},T.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}))},T.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){}},T.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||""}}},T.getStandaloneCheckoutSettings=function(e){var r,i;return o(this,void 0,void 0,(function(){var o,s,a,l,u,p,d,g,h,m,S,v,y,C,I,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===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==(g=T.readJsonFile(s))?void 0:g.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=T.readJsonFile(a)}return m=g.storefront,S=d?T.getStudioRouting(m.routings,o):T.getHeadlessRouting(m.routings,o,u),(v=S?d?null===(r=g.localizationMap)||void 0===r?void 0:r[S.id]:T.getHeadlessLocalizationPath(l,m,S.locale):void 0)&&S?(y=g.merchantSettings)?[3,3]:[4,f({},T.getStandaloneApiConfig(g.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,I=T.readJsonFile(v),k=t([],g.storefrontJSScripts||[],!0),L=[],R=void 0,w=void 0,d?(h.checkoutThemeJson=T.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(I.themeJson=T.ensureCheckoutPage(I.themeJson),E=I.themeJson.settings,R=null==E?void 0:E.favicon,w=null==E?void 0:E.stockPreference,!E)return[3,10];b=T.createColorStyle(E),J=void 0,n.label=5;case 5:return n.trys.push([5,8,,9]),E.fontFamily?[4,T.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:I,salesChannel:g.salesChannel,routing:S,favicon:R,stockPreference:w,storefrontJSScripts:k,themeStyleScripts:L,highPriorityStoreFrontJSScripts:g.highPriorityStoreFrontJSScripts||[],domain:g.domain,productBackInStockSettings:g.productBackInStockSettings?{customerLoginRequired:g.productBackInStockSettings.customerLoginRequired}:null,customerReviewSettings:g.customerReviewSettings?{customerLoginRequired:g.customerReviewSettings.customerLoginRequired||!1,customerPurchaseRequired:g.customerReviewSettings.customerPurchaseRequired||!1}:null,merchantSettings:y,customerSettings:g.customerSettings,custom:g.custom,storefrontPopups:g.storefrontPopups||[],loyaltyPrograms:g.loyaltyPrograms||[],payWithIkasUrl:g.payWithIkasUrl,projectJson:h,deployDir:l,apiKey:g.apiKey}];case 11:return B=n.sent(),console.error("[checkout] Settings read error",B),[2,null];case 12:return[2]}}))}))},T.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)}))}))},T.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)}))}))},T.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]}}))}))},T.readLocalSettingsFile=function(){try{var e=r.readFileSync(".ikas/settings-".concat(this.startTime,".json"));if(e&&e.length)return JSON.parse(e.toString())}catch(e){}},T.getLocalSettings=function(e){return o(this,void 0,void 0,(function(){var t,o,r,i,s,a,c,l,u,p,f;return n(this,(function(n){switch(n.label){case 0:return[4,T.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,T.readLocalTheme()];case 5:return u=n.sent(),p=T.createColorScript(u.settings),[4,T.createFontScript(u.settings)];case 6:return f=n.sent(),p&&a.push(p),f&&a.push(f),[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: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}]}}))}))},T.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,g,h,m,S,v,y;return n(this,(function(C){switch(C.label){case 0:return[4,T.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,g=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,f({})]):[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,f,S,v,C,I;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()):{},f=(c=o).themeJson.settings.favicon,S=c.themeJson.settings.stockPreference,c.themeJson.settings?(v=T.createColorScript(c.themeJson.settings),[4,T.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 I=t.customerSettings,i({storefrontType:P.HEADLESS,storefront:s,themeLocalization:c,salesChannel:a,routing:y,favicon:f,stockPreference:S,storefrontJSScripts:l,themeStyleScripts:u,highPriorityStoreFrontJSScripts:p,domain:d,productBackInStockSettings:g,customerReviewSettings:h,merchantSettings:m,customerSettings:I,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)])}}))}))}))]}))}))},T.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)]}}))}))},T.setStorefrontConfig=function(e){return o(this,void 0,void 0,(function(){return n(this,(function(t){return T.applyStorefrontConfig(e),[2]}))}))},T.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,f=t.themeStyleScripts,g=t.highPriorityStoreFrontJSScripts,h=t.domain,m=t.productBackInStockSettings,S=t.customerReviewSettings,v=t.merchantSettings,y=t.customerSettings,C=t.custom,P=t.storefrontPopups,T=t.loyaltyPrograms,I=t.payWithIkasUrl,k=t.apiKey;o&&u.clear(),u.init(e(e({},k?{apiKey:k}:{}),{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||[],themeStyleScripts:f||[],highPriorityStoreFrontJSScripts:g||[],domain:h,productBackInStockSettings:m,customerReviewSettings:S,merchantSettings:v,customerSettings:y,metaTemplates:i.metaTemplates||null,custom:C||null,indexPageSeoSettings:i.indexPageSeoSettings,storefrontPopups:P,loyaltyPrograms:T,payWithIkasUrl:I,milesSmilesSettings:(null===(r=i.socialLoginSettings)||void 0===r?void 0:r.find((function(e){return"miles_smiles"===e.provider})))||null})),p()},T.setTranslations=function(e,r,i,c,l){return o(this,void 0,void 0,(function(){var o,p,d,f,g,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,f=e.themeLocalization.themeJson.components.filter((function(e){return c||r.includes(e.id)})),g=t(["common"],f.map((function(e){return e.dir})),!0),(i===a.CHECKOUT||c)&&g.push("checkout-page"),h=o.nextI18nConf,S=d&&l?l:p.locale,[4,new m(S,g,d?void 0:h.localePath).read()];case 1:return v=n.sent(),u.init({translations:v}),[2]}}))}))},T.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)}},T.loadStandaloneCheckoutTranslations=function(e){var t,s,a,c;return o(this,void 0,void 0,(function(){var o,l,u,p,d,f,g;return n(this,(function(n){switch(n.label){case 0:o=e.routing.locale;try{e.storefrontType===P.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=T.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=T.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(f=n.sent(),console.error("[checkout] Default translations read error",f),!l)throw f;return[3,4];case 4:return[2,(g={},g[S]=l?T.mergeTranslations(d||{},l):d,g)]}}))}))},T.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)?T.mergeTranslations(i,r):r:("string"==typeof r&&""!==r||void 0===i&&void 0!==r)&&(n[o]=r)})),n},T.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,g({})]:[2,{}];case 1:return o=n.sent(),[2,T.buildCheckoutExtraProps(e,t,o)]}}))}))},T.buildCheckoutExtraProps=function(e,t,o){var n,r,i,s,a,c,l,u,p,d,f,g,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!==(f=E.propValues.campaignOffersEnableMiddlePhase)&&void 0!==f&&f,campaignOffersTitleColor:null!==(g=E.propValues.campaignOffersTitleColor)&&void 0!==g?g: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},T.getPageData=function(t,r,i,s,c){var d;return o(this,void 0,void 0,(function(){var o,f,g,h,m,S,v,y,C;return n(this,(function(n){switch(n.label){case 0:return(o=i===a.CHECKOUT?T.getStandaloneCheckoutRequest(t):null)?[2,T.getStandaloneCheckoutPageData(t,o)]:(f="local"===process.env.NEXT_PUBLIC_ENV,g=!f&&c,u.init({apiUrl:process.env.NEXT_PUBLIC_GQL_URL,cdnUrl:process.env.NEXT_PUBLIC_CDN_URL}),p(),g?[3,7]:(h=t.locale)?[4,T.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 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:T.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]}}))}))},T.getStandaloneCheckoutPageData=function(t,r){var i,s;return o(this,void 0,void 0,(function(){var o,c,p,d,f,h,m,S;return n(this,(function(n){switch(n.label){case 0:return o={props:{},notFound:!0},t.locale?[4,T.getStandaloneCheckoutSettings(r)]:[2,o];case 1:return(c=n.sent())&&c.storefront.mainStorefrontThemeId&&c.storefront.salesChannelId?((p=new l(T.getCheckoutThemeJson(c),t.params,a.CHECKOUT,c.merchantSettings)).possiblePageTypes=[a.CHECKOUT],[4,p.getPageData()]):[2,o];case 2:return n.sent(),p.page?(d=T.getStandaloneApiConfig(c.apiKey,c.storefront.id,c.routing.id),[4,Promise.all([g({},d),T.loadStandaloneCheckoutTranslations(c)])]):[2,o];case 3:return f=n.sent(),h=f[0],m=f[1],T.applyStorefrontConfig(c,!0),u.init({translations:m}),S=e(e({},p.nextPageData.props),T.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:T.omitPaymentStepScripts(S,t)}]}}))}))},T.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},T.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,T.getPageData(e,!1,t,r,i)];case 1:return[2,o.sent()]}}))}))},T.getServerSideProps=function(e,t){return o(this,void 0,void 0,(function(){return n(this,(function(o){switch(o.label){case 0:return[4,T.getPageData(e,!0,t)];case 1:return[2,o.sent()]}}))}))},T.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>")}},T.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 ")},T.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=T.fontScriptCache.get(o))&&r.expiresAt>Date.now()?[2,r.script]:[4,T.createFontScript(e)]):[2];case 1:return(i=n.sent())&&T.fontScriptCache.set(o,{script:i,expiresAt:Date.now()+864e5}),[2,i]}}))}))},T.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]}}))}))},T.startTime=Date.now(),T.fontScriptCache=new Map,T}();!function(e){e.STUDIO="studio",e.HEADLESS="headless"}(P||(P={}));export{P as CheckoutStorefrontType,T as IkasNextPageDataProvider};
@@ -1 +1 @@
1
- var a=function(a){if(a.name){var t=a.name.replace(/ /g,"+"),e="";if(a.variants){e+=":";var r=a.variants.some((function(a){return"italic"===a}));if(r&&(e+="ital,"),e+="wght@",r){var n=new RegExp("italic","i");e+=a.variants.reduce((function(a,t){return n.test(t)?a:a+"0,".concat(t.replace("regular","400"),";")}),""),e+=a.variants.reduce((function(a,t){return n.test(t)?a+"1,".concat("italic"===t?"400":t.replace("italic",""),";"):a}),"")}else e+=a.variants.reduce((function(a,t){return a+"".concat(t.replace("regular","400"),";")}),"");e=e.substring(0,e.length-1),e+="&display=swap"}return"https://fonts.myikas.com/css2?family=".concat(t).concat(e)}};export{a as getGoogleFontHref};
1
+ var a=function(a){if(a.name){var t=a.name.replace(/ /g,"+"),e="";if(a.variants){e+=":";var r=a.variants.some((function(a){return"italic"===a}));if(r&&(e+="ital,"),e+="wght@",r){var n=new RegExp("italic","i");e+=a.variants.reduce((function(a,t){return n.test(t)?a:a+"0,".concat(t.replace("regular","400"),";")}),""),e+=a.variants.reduce((function(a,t){return n.test(t)?a+"1,".concat("italic"===t?"400":t.replace("italic",""),";"):a}),"")}else e+=a.variants.reduce((function(a,t){return a+"".concat(t.replace("regular","400"),";")}),"");e=e.substring(0,e.length-1),e+="&display=swap"}var c=process.env.NEXT_PUBLIC_FONT_DOMAIN||"fonts.myikas.com";return"https://".concat(c,"/css2?family=").concat(t).concat(e)}};export{a as getGoogleFontHref};
@@ -1,4 +1,5 @@
1
1
  export declare const CHECKOUT_TRANSLATION_NAMESPACE = "checkout-page";
2
+ export declare function readDefaultCheckoutTranslations(locale: string): Promise<Record<string, any>>;
2
3
  export declare class I18NFileReader {
3
4
  locale: string;
4
5
  namespaces: string[];
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as t}from'./../ext/tslib/tslib.es6.js';import s from"fs";import r from"path";var o="checkout-page",n=function(){function o(e,t,s){this.locale=e,this.namespaces=t,this.localePath=s}return o.prototype.read=function(){return e(this,void 0,void 0,(function(){var e,o,n,a,c,i,l,u,h;return t(this,(function(t){switch(t.label){case 0:e={},o=0,n=this.namespaces,t.label=1;case 1:if(!(o<n.length))return[3,16];a=n[o],t.label=2;case 2:return t.trys.push([2,14,,15]),c=this.localePath?r.join(this.localePath,this.locale,a+".json"):r.join(process.cwd(),"public","locales",this.locale,a+".json"),s.existsSync(c)?[4,this.readLocaleFile(c)]:[3,4];case 3:return i=t.sent(),e[a]=i,[3,13];case 4:return"checkout-page"!==a?[3,13]:(l={},"tr"!==this.locale?[3,6]:[4,import("@ikas/storefront-assets/checkout/tr.js")]);case 5:return u=t.sent(),l=u.default,[3,12];case 6:return"de"!==this.locale?[3,8]:[4,import("@ikas/storefront-assets/checkout/de.js")];case 7:return u=t.sent(),l=u.default,[3,12];case 8:return"fr"!==this.locale?[3,10]:[4,import("@ikas/storefront-assets/checkout/fr.js")];case 9:return u=t.sent(),l=u.default,[3,12];case 10:return[4,import("@ikas/storefront-assets/checkout/en.js")];case 11:u=t.sent(),l=u.default,t.label=12;case 12:e[a]=l,t.label=13;case 13:return[3,15];case 14:return h=t.sent(),console.error("I18N FILE READ ERROR!"),console.error(h),[3,15];case 15:return o++,[3,1];case 16:return[2,e]}}))}))},o.prototype.readLocaleFile=function(r){return e(this,void 0,void 0,(function(){return t(this,(function(e){return[2,new Promise((function(e,t){s.readFile(r,{flag:"r"},(function(s,r){if(s)return t(s);var o=r.length?JSON.parse(r.toString()):{};e(o)}))}))]}))}))},o}();export{o as CHECKOUT_TRANSLATION_NAMESPACE,n as I18NFileReader};
1
+ import{__awaiter as e,__generator as t}from'./../ext/tslib/tslib.es6.js';import r from"fs";import s from"path";var o="checkout-page";function n(r){return e(this,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return"tr"!==r?[3,2]:[4,import("@ikas/storefront-assets/checkout/tr.js")];case 1:case 3:case 5:case 7:return[2,e.sent().default];case 2:return"de"!==r?[3,4]:[4,import("@ikas/storefront-assets/checkout/de.js")];case 4:return"fr"!==r?[3,6]:[4,import("@ikas/storefront-assets/checkout/fr.js")];case 6:return[4,import("@ikas/storefront-assets/checkout/en.js")]}}))}))}var c=function(){function o(e,t,r){this.locale=e,this.namespaces=t,this.localePath=r}return o.prototype.read=function(){return e(this,void 0,void 0,(function(){var e,o,c,a,i,u,l,h,f;return t(this,(function(t){switch(t.label){case 0:e={},o=0,c=this.namespaces,t.label=1;case 1:if(!(o<c.length))return[3,9];a=c[o],t.label=2;case 2:return t.trys.push([2,7,,8]),i=this.localePath?s.join(this.localePath,this.locale,a+".json"):s.join(process.cwd(),"public","locales",this.locale,a+".json"),r.existsSync(i)?[4,this.readLocaleFile(i)]:[3,4];case 3:return u=t.sent(),e[a]=u,[3,6];case 4:return"checkout-page"!==a?[3,6]:(l=e,h=a,[4,n(this.locale)]);case 5:l[h]=t.sent(),t.label=6;case 6:return[3,8];case 7:return f=t.sent(),console.error("I18N FILE READ ERROR!"),console.error(f),[3,8];case 8:return o++,[3,1];case 9:return[2,e]}}))}))},o.prototype.readLocaleFile=function(s){return e(this,void 0,void 0,(function(){return t(this,(function(e){return[2,new Promise((function(e,t){r.readFile(s,{flag:"r"},(function(r,s){if(r)return t(r);var o=s.length?JSON.parse(s.toString()):{};e(o)}))}))]}))}))},o}();export{o as CHECKOUT_TRANSLATION_NAMESPACE,c as I18NFileReader,n as readDefaultCheckoutTranslations};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront-next",
3
- "version": "6.1.0-beta.38",
3
+ "version": "6.1.0-beta.381",
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.38",
21
- "@ikas/storefront-providers": "^6.1.0-beta.38",
22
- "@ikas/storefront-models": "^6.1.0-beta.38",
23
- "@ikas/storefront-api": "^6.1.0-beta.38",
24
- "@ikas/storefront-assets": "^6.1.0-beta.38",
20
+ "@ikas/storefront-config": "^6.1.0-beta.381",
21
+ "@ikas/storefront-providers": "^6.1.0-beta.381",
22
+ "@ikas/storefront-models": "^6.1.0-beta.381",
23
+ "@ikas/storefront-api": "^6.1.0-beta.381",
24
+ "@ikas/storefront-assets": "^6.1.0-beta.381",
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.38",
32
- "@ikas/storefront-config": "^6.1.0-beta.38",
33
- "@ikas/storefront-providers": "^6.1.0-beta.38",
34
- "@ikas/storefront-models": "^6.1.0-beta.38",
35
- "@ikas/storefront-api": "^6.1.0-beta.38",
36
- "@ikas/storefront-assets": "^6.1.0-beta.38",
31
+ "@ikas/storefront-cmd": "^6.1.0-beta.381",
32
+ "@ikas/storefront-config": "^6.1.0-beta.381",
33
+ "@ikas/storefront-providers": "^6.1.0-beta.381",
34
+ "@ikas/storefront-models": "^6.1.0-beta.381",
35
+ "@ikas/storefront-api": "^6.1.0-beta.381",
36
+ "@ikas/storefront-assets": "^6.1.0-beta.381",
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",