@ikas/storefront 2.0.43 → 2.0.45
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.
- package/build/_virtual/index.js_commonjs-proxy3.js +1 -1
- package/build/_virtual/index.js_commonjs-proxy4.js +1 -1
- package/build/components/checkout/components/cart-summary/index.js +1 -1
- package/build/components/checkout/index.d.ts +1 -0
- package/build/components/checkout/index.js +1 -1
- package/build/components/checkout/model.d.ts +3 -1
- package/build/components/checkout/model.js +1 -1
- package/build/ikas.js +2 -2
- package/build/models/theme/theme.js +1 -1
- package/build/providers/page-data-next.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{makeAutoObservable as e}from"mobx";import{IkasThemeComponent as o}from"./component/index.js";import{IkasThemeComponentProp as n,IkasThemeComponentPropType as t}from"./component/prop/index.js";import{IkasThemeCustomData as r}from"./custom-data/index.js";import{IkasThemePage as i,IkasThemePageType as s}from"./page/index.js";import{IkasThemePageComponent as a}from"./page/component/index.js";import{IkasThemeSettings as p}from"./settings/index.js";var u="checkout",m=function(){function u(n){var t;void 0===n&&(n={}),this.name=n.name||"",this.components=n.components?n.components.map((function(e){return new o(e)})):[],this.pages=n.pages?n.pages.map((function(e){return new i(e)})):[],this.settings=n.settings?new p(n.settings):new p,this.customData=n.customData?null===(t=n.customData)||void 0===t?void 0:t.map((function(e){return new r(e)})):[],this.createCheckoutData(),e(this)}return Object.defineProperty(u.prototype,"headerComponent",{get:function(){return this.components.find((function(e){return e.isHeader}))},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"footerComponent",{get:function(){return this.components.find((function(e){return e.isFooter}))},enumerable:!1,configurable:!0}),u.prototype.createCheckoutData=function(){var e=this.components.find((function(e){return"checkout"===e.id})),r=this.pages.find((function(e){return"checkout"===e.id}));e||(e=new o({id:"checkout",dir:"",displayName:"",props:[new n({name:"buttonBgColor",isRequired:!1,type:t.COLOR}),new n({name:"buttonTextColor",isRequired:!1,type:t.COLOR}),new n({name:"buttonDisabledBgColor",isRequired:!1,type:t.COLOR}),new n({name:"buttonDisabledTextColor",isRequired:!1,type:t.COLOR}),new n({name:"primaryTextColor",isRequired:!1,type:t.COLOR}),new n({name:"secondaryTextColor",isRequired:!1,type:t.COLOR}),new n({name:"primaryBgColor",isRequired:!1,type:t.COLOR}),new n({name:"secondaryBgColor",isRequired:!1,type:t.COLOR}),new n({name:"borderColor",isRequired:!1,type:t.COLOR}),new n({name:"cardBgColor",isRequired:!1,type:t.COLOR}),new n({name:"errorColor",isRequired:!1,type:t.COLOR}),new n({name:"errorLightColor",isRequired:!1,type:t.COLOR}),new n({name:"warningColor",isRequired:!1,type:t.COLOR}),new n({name:"warningLightColor",isRequired:!1,type:t.COLOR}),new n({name:"successColor",isRequired:!1,type:t.COLOR}),new n({name:"successLightColor",isRequired:!1,type:t.COLOR})]}),this.components.push(e)),r||this.pages.push(new i({id:"checkout",type:s.CHECKOUT,components:[new a({componentId:e.id,propValues:{buttonBgColor:c,buttonTextColor:C,buttonDisabledBgColor:d,buttonDisabledTextColor:l,primaryTextColor:
|
|
1
|
+
import{makeAutoObservable as e}from"mobx";import{IkasThemeComponent as o}from"./component/index.js";import{IkasThemeComponentProp as n,IkasThemeComponentPropType as t}from"./component/prop/index.js";import{IkasThemeCustomData as r}from"./custom-data/index.js";import{IkasThemePage as i,IkasThemePageType as s}from"./page/index.js";import{IkasThemePageComponent as a}from"./page/component/index.js";import{IkasThemeSettings as p}from"./settings/index.js";var u="checkout",m=function(){function u(n){var t;void 0===n&&(n={}),this.name=n.name||"",this.components=n.components?n.components.map((function(e){return new o(e)})):[],this.pages=n.pages?n.pages.map((function(e){return new i(e)})):[],this.settings=n.settings?new p(n.settings):new p,this.customData=n.customData?null===(t=n.customData)||void 0===t?void 0:t.map((function(e){return new r(e)})):[],this.createCheckoutData(),e(this)}return Object.defineProperty(u.prototype,"headerComponent",{get:function(){return this.components.find((function(e){return e.isHeader}))},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"footerComponent",{get:function(){return this.components.find((function(e){return e.isFooter}))},enumerable:!1,configurable:!0}),u.prototype.createCheckoutData=function(){var e=this.components.find((function(e){return"checkout"===e.id})),r=this.pages.find((function(e){return"checkout"===e.id}));e||(e=new o({id:"checkout",dir:"",displayName:"",props:[new n({name:"showTax",isRequired:!1,type:t.BOOLEAN}),new n({name:"buttonBgColor",isRequired:!1,type:t.COLOR}),new n({name:"buttonTextColor",isRequired:!1,type:t.COLOR}),new n({name:"buttonDisabledBgColor",isRequired:!1,type:t.COLOR}),new n({name:"buttonDisabledTextColor",isRequired:!1,type:t.COLOR}),new n({name:"primaryTextColor",isRequired:!1,type:t.COLOR}),new n({name:"secondaryTextColor",isRequired:!1,type:t.COLOR}),new n({name:"primaryBgColor",isRequired:!1,type:t.COLOR}),new n({name:"secondaryBgColor",isRequired:!1,type:t.COLOR}),new n({name:"borderColor",isRequired:!1,type:t.COLOR}),new n({name:"cardBgColor",isRequired:!1,type:t.COLOR}),new n({name:"errorColor",isRequired:!1,type:t.COLOR}),new n({name:"errorLightColor",isRequired:!1,type:t.COLOR}),new n({name:"warningColor",isRequired:!1,type:t.COLOR}),new n({name:"warningLightColor",isRequired:!1,type:t.COLOR}),new n({name:"successColor",isRequired:!1,type:t.COLOR}),new n({name:"successLightColor",isRequired:!1,type:t.COLOR})]}),this.components.push(e)),r||this.pages.push(new i({id:"checkout",type:s.CHECKOUT,components:[new a({componentId:e.id,propValues:{showTax:!0,buttonBgColor:c,buttonTextColor:C,buttonDisabledBgColor:d,buttonDisabledTextColor:l,primaryTextColor:O,secondaryTextColor:g,primaryBgColor:F,secondaryBgColor:R,borderColor:y,cardBgColor:h,errorColor:w,errorLightColor:f,warningColor:L,warningLightColor:b,successColor:x,successLightColor:q}})]}))},u}(),c="#272727",C="#FFFFFF",d="#F7F7F9",l="#8A8B94",O="#272727",g="#8A8B94",F="#FFFFFF",R="#F7F7F9",y="#E5E4E9",h="#F7F7F9",w="#FB4E4E",f="#FCF3F4",L="#FFBC1F",b="#FFFAEE",x="#2DCA73",q="#F6FFED";export{u as CHECKOUT_ID,m as IkasTheme};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as t,__assign as o,__spreadArray as r}from'../ext/tslib/tslib.es6.js';import i from"fs";import n from"next/config.js";import"../models/data/blog/index.js";import"../models/data/brand/index.js";import"../models/data/category/index.js";import"../models/data/checkout/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/index.js";import"../models/data/customer-review/index.js";import"mobx";import"../models/data/html-meta-data/index.js";import"../models/data/image/index.js";import"../models/data/installment-info/index.js";import"../models/data/order/index.js";import"../models/data/order/line-item/index.js";import"../api/product-option-file/index.js";import"../models/data/product/index.js";import"../models/data/variant-type/index.js";import"../models/data/product/variant/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product-attribute/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product-filter/index.js";import"../models/data/variant-type/variant-value/index.js";import"../models/data/order-transaction/index.js";import"../models/data/product-option-set/index.js";import"../models/data/raffle/index.js";import"../models/data/product-campaing/campaign/index.js";import"../models/data/customer-attribute/index.js";import"../models/data/customer-attribute/customer-attribute-sales-channel/index.js";import{IkasTheme as s}from"../models/theme/theme.js";import{IkasThemePageType as a}from"../models/theme/page/index.js";import"../models/theme/component/prop/index.js";import"../models/theme/page/component/prop-value/link.js";import"../models/ui/brand-list/index.js";import"../models/ui/blog-list/index.js";import"../models/ui/blog-category-list/index.js";import"../models/ui/category-list/index.js";import"../models/ui/product-detail/index.js";import"../models/ui/product-list/index.js";import"../models/ui/product-attribute-detail/index.js";import"../models/ui/product-attribute-list/index.js";import"../models/ui/customer-review-list/index.js";import"../models/ui/customer-review-summary-list/index.js";import"../models/ui/validator/index.js";import"../models/ui/validator/rules/index.js";import"../models/ui/validator/form/login.js";import"../models/ui/validator/form/address.js";import"../models/ui/validator/form/register.js";import"../models/ui/validator/form/contact-form.js";import"../models/ui/validator/form/forgot-password.js";import"../models/ui/validator/form/recover-password.js";import"../models/ui/validator/form/account-info.js";import"../models/ui/validator/form/raffle-form.js";import"../models/ui/validator/form/customer-review.js";import"../models/ui/raffle-list/index.js";import"../models/theme/settings/index.js";import"../models/theme/custom-data/index.js";import{IkasStorefront as d}from"../models/data/storefront/index.js";import{IkasSalesChannel as l}from"../models/data/sales-channel/index.js";import{IkasStorefrontRouting as m}from"../models/data/storefront/routing/index.js";import{IkasStorefrontConfig as c}from"../storefront/index.js";import{IkasPageDataProvider as p}from"./page-data-get.js";import{IkasStorefrontThemeLocalization as u}from"../models/data/storefront/theme-localization/index.js";import{IkasStorefrontAPI as f}from"../api/storefront/index.js";import{I18NFileReader as g}from"../utils/i18n.js";import"../api/blog/index.js";import"../api/brand/index.js";import"../api/cart/index.js";import"../api/category/index.js";import{IkasCheckoutAPI as j}from"../api/checkout/index.js";import"../api/city/index.js";import"../api/country/index.js";import"../api/customer/index.js";import"../api/customer-review/index.js";import"../api/customer-review-summary/index.js";import"../api/district/index.js";import"../api/html-meta-data/index.js";import"../api/merchant/index.js";import"../api/product-search/index.js";import"../api/apollo.js";import"../api/favorite-product/index.js";import"../api/contact-form/index.js";import"../api/state/index.js";import"../api/product-option-set/index.js";import"../api/raffle/index.js";import"../api/back-in-stock-reminder/index.js";import"../api/product-campaign/index.js";import{getGoogleFontHref as x}from"../utils/google-fonts.js";var v=function(){function v(){}return v.readLocalTheme=function(){return new Promise((function(e,t){i.readFile("./src/theme.json",{flag:"a+"},(function(o,r){if(o)return t(o);var i=r.length?JSON.parse(r.toString()):{};e(new s(i))}))}))},v.readSettingsFile=function(){return new Promise((function(e){var t=n().serverRuntimeConfig.SETTINGS;i.readFile(t,{flag:"a+"},(function(t,o){if(t)return console.error("SETTINGS FILE READ ERROR!!!"),console.error(t),e(null);var r=o.length?JSON.parse(o.toString()):{};e(r)}))}))},v.getSettings=function(o){var r=this;return new Promise((function(n){return e(r,void 0,void 0,(function(){var e,r,s,a,p,g,j,x,h,S,C,y,I,b,w,k;return t(this,(function(t){switch(t.label){case 0:return"local"===process.env.NEXT_PUBLIC_ENV?c.storefrontId?[4,f.getStorefront(c.storefrontId)]:(console.error("Missing storefrontId in the config.json file!"),[2,n(null)]):[3,3];case 1:return(e=t.sent())?(r=e,[4,v.readLocalTheme()]):[2,n(null)];case 2:return s=t.sent(),a=v.createColorScript(s.settings),p=v.createFontScript(s.settings),g=[],a&&g.push(a),p&&g.push(p),n({storefront:r,themeLocalization:new u({themeJson:s}),salesChannel:new l({id:r.salesChannelId}),routing:r.routings.length?r.routings.find((function(e){return e.locale===o||e.id===o}))||r.routings[0]:new m({}),favicon:s.settings.favicon,stockPreference:s.settings.stockPreference,storefrontJSScripts:g,domain:"",productBackInStockSettings:{customerLoginRequired:!0},customerReviewSettings:{customerLoginRequired:!0,customerPurchaseRequired:!1}}),[3,5];case 3:return[4,v.readSettingsFile()];case 4:if(!(j=t.sent())||!j.localizationMap)return[2,n(null)];if(x=new d(j.storefront),h=new l(j.salesChannel),S=j.localizationMap,C=j.storefrontJSScripts||[],y=j.domain,I=j.productBackInStockSettings?{customerLoginRequired:j.productBackInStockSettings.customerLoginRequired}:null,b=j.customerReviewSettings?{customerLoginRequired:j.customerReviewSettings.customerLoginRequired||!1,customerPurchaseRequired:j.customerReviewSettings.customerPurchaseRequired||!1}:null,w=S[o],k=x.routings.find((function(e){return e.id===o||e.path===o})),!w||!k)return console.error("THEME LOCALIZATION PATH OR ROUTING MISSING!!!"),[2,n(null)];i.readFile(w,{flag:"a+"},(function(e,t){if(e)return console.error("THEME LOCALZIATION FILE READ ERROR!!!"),console.error(e),n(null);var o=t.length?JSON.parse(t.toString()):{},r=new u(o),i=r.themeJson.settings.favicon,s=r.themeJson.settings.stockPreference;if(r.themeJson.settings){var a=v.createColorScript(r.themeJson.settings),d=v.createFontScript(r.themeJson.settings);a&&C.push(a),d&&C.push(d)}n({storefront:x,themeLocalization:r,salesChannel:h,routing:k,favicon:i,stockPreference:s,storefrontJSScripts:C,domain:y,productBackInStockSettings:I,customerReviewSettings:b})})),t.label=5;case 5:return[2]}}))}))}))},v.getPageData=function(i,s,d,l,m){var u,f;return e(this,void 0,void 0,(function(){var e,x,h,S,C,y,I,b,w,k,P,R,L,T,B,E,V,J,F,O,N,D,A,q,z,M;return t(this,(function(t){switch(t.label){case 0:return e="local"===process.env.NEXT_PUBLIC_ENV,x=!e&&m,h=n().serverRuntimeConfig,x?[3,7]:(S=i.locale)?[4,v.getSettings(S)]:[2,{props:{},notFound:!0}];case 1:return(C=t.sent())&&C.storefront.mainStorefrontThemeId&&C.storefront.salesChannelId?(y=C.storefront,I=C.themeLocalization,b=C.salesChannel,w=C.routing,k=C.favicon,P=C.stockPreference,R=C.storefrontJSScripts,L=C.domain,T=C.productBackInStockSettings,B=C.customerReviewSettings,c.storefrontId=y.id,c.storefrontRoutingId=w.id,c.storefrontThemeId=y.mainStorefrontThemeId,c.salesChannelId=y.salesChannelId,c.priceListId=w.priceListId||void 0,c.stockLocationIds=null===(u=b.stockLocations)||void 0===u?void 0:u.map((function(e){return e.id})),c.routings=y.routings,c.paymentGateways=b.paymentGateways||[],c.gtmId=y.gtmId||void 0,c.fbpId=y.fbpId||void 0,c.analytics4Id=y.analytics4Id||void 0,c.universalAnalyticsId=y.universalAnalyticsId||void 0,c.favicon=k||null,c.stockPreference=P||null,c.storefrontJSScripts=R||[],c.domain=L,c.productBackInStockSettings=T,c.customerReviewSettings=B,(E=new p(I.themeJson,i.params,d)).possiblePageTypes=l||(d?[d]:[]),m?[3,3]:[4,E.getPageData()]):[2,{props:{},notFound:!0}];case 2:if(t.sent(),!E.page)return[2,{props:{},notFound:!0}];t.label=3;case 3:return V=m?E.theme.components.map((function(e){return e.id})):E.page.components.map((function(e){return e.componentId})),J=I.themeJson.components.filter((function(e){return m||V.includes(e.id)})),F=r(["common"],J.map((function(e){return e.dir})),!0),(d===a.CHECKOUT||m)&&F.push("checkout-page"),O=h.nextI18nConf,N=w.locale,[4,new g(N,F,e?void 0:O.localePath).read()];case 4:return D=t.sent(),c.translations=D,A={},d!==a.CHECKOUT?[3,6]:(q=null===(f=E.page)||void 0===f?void 0:f.components[0])?[4,j.listCheckoutSettings()]:[3,6];case 5:z=t.sent(),M={buttonBgColor:q.propValues.buttonBgColor,buttonTextColor:q.propValues.buttonTextColor,buttonDisabledBgColor:q.propValues.buttonDisabledBgColor,buttonDisabledTextColor:q.propValues.buttonDisabledTextColor,primaryTextColor:q.propValues.primaryTextColor,secondaryTextColor:q.propValues.secondaryTextColor,primaryBgColor:q.propValues.primaryBgColor,secondaryBgColor:q.propValues.secondaryBgColor,borderColor:q.propValues.borderColor,cardBgColor:q.propValues.cardBgColor,errorColor:q.propValues.errorColor,errorLightColor:q.propValues.errorLightColor,warningColor:q.propValues.warningColor,warningLightColor:q.propValues.warningLightColor,successColor:q.propValues.successColor,successLightColor:q.propValues.successLightColor},A.customizationProps=M,A.returnPolicy=I.returnPolicy,A.privacyPolicy=I.privacyPolicy,A.termsOfService=I.termsOfService,A.checkoutSettingsStr=(null==z?void 0:z.length)?JSON.stringify(z[0]):null,t.label=6;case 6:return s?[2,{props:o(o({},E.nextPageData.props),A)}]:[2,{props:o(o({},E.nextPageData.props),A),revalidate:60}];case 7:return[2,{props:{}}];case 8:return[2]}}))}))},v.getStaticProps=function(o,r,i,n){return e(this,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,v.getPageData(o,!1,r,i,n)];case 1:return[2,e.sent()]}}))}))},v.getServerSideProps=function(o,r){return e(this,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,v.getPageData(o,!0,r)];case 1:return[2,e.sent()]}}))}))},v.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 ")},v.createFontScript=function(e){var t=x(e.fontFamily);if(t)return'<link id="ikas-font" rel="stylesheet" href="'.concat(t,"\"> \n <style>\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 </style>')},v}();export{v as IkasNextPageDataProvider};
|
|
1
|
+
import{__awaiter as e,__generator as t,__assign as o,__spreadArray as r}from'../ext/tslib/tslib.es6.js';import i from"fs";import n from"next/config.js";import"../models/data/blog/index.js";import"../models/data/brand/index.js";import"../models/data/category/index.js";import"../models/data/checkout/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/index.js";import"../models/data/customer-review/index.js";import"mobx";import"../models/data/html-meta-data/index.js";import"../models/data/image/index.js";import"../models/data/installment-info/index.js";import"../models/data/order/index.js";import"../models/data/order/line-item/index.js";import"../api/product-option-file/index.js";import"../models/data/product/index.js";import"../models/data/variant-type/index.js";import"../models/data/product/variant/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product-attribute/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product-filter/index.js";import"../models/data/variant-type/variant-value/index.js";import"../models/data/order-transaction/index.js";import"../models/data/product-option-set/index.js";import"../models/data/raffle/index.js";import"../models/data/product-campaing/campaign/index.js";import"../models/data/customer-attribute/index.js";import"../models/data/customer-attribute/customer-attribute-sales-channel/index.js";import{IkasTheme as s}from"../models/theme/theme.js";import{IkasThemePageType as a}from"../models/theme/page/index.js";import"../models/theme/component/prop/index.js";import"../models/theme/page/component/prop-value/link.js";import"../models/ui/brand-list/index.js";import"../models/ui/blog-list/index.js";import"../models/ui/blog-category-list/index.js";import"../models/ui/category-list/index.js";import"../models/ui/product-detail/index.js";import"../models/ui/product-list/index.js";import"../models/ui/product-attribute-detail/index.js";import"../models/ui/product-attribute-list/index.js";import"../models/ui/customer-review-list/index.js";import"../models/ui/customer-review-summary-list/index.js";import"../models/ui/validator/index.js";import"../models/ui/validator/rules/index.js";import"../models/ui/validator/form/login.js";import"../models/ui/validator/form/address.js";import"../models/ui/validator/form/register.js";import"../models/ui/validator/form/contact-form.js";import"../models/ui/validator/form/forgot-password.js";import"../models/ui/validator/form/recover-password.js";import"../models/ui/validator/form/account-info.js";import"../models/ui/validator/form/raffle-form.js";import"../models/ui/validator/form/customer-review.js";import"../models/ui/raffle-list/index.js";import"../models/theme/settings/index.js";import"../models/theme/custom-data/index.js";import{IkasStorefront as d}from"../models/data/storefront/index.js";import{IkasSalesChannel as l}from"../models/data/sales-channel/index.js";import{IkasStorefrontRouting as m}from"../models/data/storefront/routing/index.js";import{IkasStorefrontConfig as c}from"../storefront/index.js";import{IkasPageDataProvider as p}from"./page-data-get.js";import{IkasStorefrontThemeLocalization as u}from"../models/data/storefront/theme-localization/index.js";import{IkasStorefrontAPI as f}from"../api/storefront/index.js";import{I18NFileReader as g}from"../utils/i18n.js";import"../api/blog/index.js";import"../api/brand/index.js";import"../api/cart/index.js";import"../api/category/index.js";import{IkasCheckoutAPI as j}from"../api/checkout/index.js";import"../api/city/index.js";import"../api/country/index.js";import"../api/customer/index.js";import"../api/customer-review/index.js";import"../api/customer-review-summary/index.js";import"../api/district/index.js";import"../api/html-meta-data/index.js";import"../api/merchant/index.js";import"../api/product-search/index.js";import"../api/apollo.js";import"../api/favorite-product/index.js";import"../api/contact-form/index.js";import"../api/state/index.js";import"../api/product-option-set/index.js";import"../api/raffle/index.js";import"../api/back-in-stock-reminder/index.js";import"../api/product-campaign/index.js";import{getGoogleFontHref as x}from"../utils/google-fonts.js";var v=function(){function v(){}return v.readLocalTheme=function(){return new Promise((function(e,t){i.readFile("./src/theme.json",{flag:"a+"},(function(o,r){if(o)return t(o);var i=r.length?JSON.parse(r.toString()):{};e(new s(i))}))}))},v.readSettingsFile=function(){return new Promise((function(e){var t=n().serverRuntimeConfig.SETTINGS;i.readFile(t,{flag:"a+"},(function(t,o){if(t)return console.error("SETTINGS FILE READ ERROR!!!"),console.error(t),e(null);var r=o.length?JSON.parse(o.toString()):{};e(r)}))}))},v.getSettings=function(o){var r=this;return new Promise((function(n){return e(r,void 0,void 0,(function(){var e,r,s,a,p,g,j,x,h,S,C,y,I,b,w,k;return t(this,(function(t){switch(t.label){case 0:return"local"===process.env.NEXT_PUBLIC_ENV?c.storefrontId?[4,f.getStorefront(c.storefrontId)]:(console.error("Missing storefrontId in the config.json file!"),[2,n(null)]):[3,3];case 1:return(e=t.sent())?(r=e,[4,v.readLocalTheme()]):[2,n(null)];case 2:return s=t.sent(),a=v.createColorScript(s.settings),p=v.createFontScript(s.settings),g=[],a&&g.push(a),p&&g.push(p),n({storefront:r,themeLocalization:new u({themeJson:s}),salesChannel:new l({id:r.salesChannelId}),routing:r.routings.length?r.routings.find((function(e){return e.locale===o||e.id===o}))||r.routings[0]:new m({}),favicon:s.settings.favicon,stockPreference:s.settings.stockPreference,storefrontJSScripts:g,domain:"",productBackInStockSettings:{customerLoginRequired:!0},customerReviewSettings:{customerLoginRequired:!0,customerPurchaseRequired:!1}}),[3,5];case 3:return[4,v.readSettingsFile()];case 4:if(!(j=t.sent())||!j.localizationMap)return[2,n(null)];if(x=new d(j.storefront),h=new l(j.salesChannel),S=j.localizationMap,C=j.storefrontJSScripts||[],y=j.domain,I=j.productBackInStockSettings?{customerLoginRequired:j.productBackInStockSettings.customerLoginRequired}:null,b=j.customerReviewSettings?{customerLoginRequired:j.customerReviewSettings.customerLoginRequired||!1,customerPurchaseRequired:j.customerReviewSettings.customerPurchaseRequired||!1}:null,w=S[o],k=x.routings.find((function(e){return e.id===o||e.path===o})),!w||!k)return console.error("THEME LOCALIZATION PATH OR ROUTING MISSING!!!"),[2,n(null)];i.readFile(w,{flag:"a+"},(function(e,t){if(e)return console.error("THEME LOCALZIATION FILE READ ERROR!!!"),console.error(e),n(null);var o=t.length?JSON.parse(t.toString()):{},r=new u(o),i=r.themeJson.settings.favicon,s=r.themeJson.settings.stockPreference;if(r.themeJson.settings){var a=v.createColorScript(r.themeJson.settings),d=v.createFontScript(r.themeJson.settings);a&&C.push(a),d&&C.push(d)}n({storefront:x,themeLocalization:r,salesChannel:h,routing:k,favicon:i,stockPreference:s,storefrontJSScripts:C,domain:y,productBackInStockSettings:I,customerReviewSettings:b})})),t.label=5;case 5:return[2]}}))}))}))},v.getPageData=function(i,s,d,l,m){var u,f,x;return e(this,void 0,void 0,(function(){var e,h,S,C,y,I,b,w,k,P,R,T,L,B,E,V,J,F,O,N,D,A,q,z,M,G;return t(this,(function(t){switch(t.label){case 0:return e="local"===process.env.NEXT_PUBLIC_ENV,h=!e&&m,S=n().serverRuntimeConfig,h?[3,7]:(C=i.locale)?[4,v.getSettings(C)]:[2,{props:{},notFound:!0}];case 1:return(y=t.sent())&&y.storefront.mainStorefrontThemeId&&y.storefront.salesChannelId?(I=y.storefront,b=y.themeLocalization,w=y.salesChannel,k=y.routing,P=y.favicon,R=y.stockPreference,T=y.storefrontJSScripts,L=y.domain,B=y.productBackInStockSettings,E=y.customerReviewSettings,c.storefrontId=I.id,c.storefrontRoutingId=k.id,c.storefrontThemeId=I.mainStorefrontThemeId,c.salesChannelId=I.salesChannelId,c.priceListId=k.priceListId||void 0,c.stockLocationIds=null===(u=w.stockLocations)||void 0===u?void 0:u.map((function(e){return e.id})),c.routings=I.routings,c.paymentGateways=w.paymentGateways||[],c.gtmId=I.gtmId||void 0,c.fbpId=I.fbpId||void 0,c.analytics4Id=I.analytics4Id||void 0,c.universalAnalyticsId=I.universalAnalyticsId||void 0,c.favicon=P||null,c.stockPreference=R||null,c.storefrontJSScripts=T||[],c.domain=L,c.productBackInStockSettings=B,c.customerReviewSettings=E,(V=new p(b.themeJson,i.params,d)).possiblePageTypes=l||(d?[d]:[]),m?[3,3]:[4,V.getPageData()]):[2,{props:{},notFound:!0}];case 2:if(t.sent(),!V.page)return[2,{props:{},notFound:!0}];t.label=3;case 3:return J=m?V.theme.components.map((function(e){return e.id})):V.page.components.map((function(e){return e.componentId})),F=b.themeJson.components.filter((function(e){return m||J.includes(e.id)})),O=r(["common"],F.map((function(e){return e.dir})),!0),(d===a.CHECKOUT||m)&&O.push("checkout-page"),N=S.nextI18nConf,D=k.locale,[4,new g(D,O,e?void 0:N.localePath).read()];case 4:return A=t.sent(),c.translations=A,q={},d!==a.CHECKOUT?[3,6]:(z=null===(f=V.page)||void 0===f?void 0:f.components[0])?[4,j.listCheckoutSettings()]:[3,6];case 5:M=t.sent(),G={showTax:null===(x=z.propValues.showTax)||void 0===x||x,buttonBgColor:z.propValues.buttonBgColor,buttonTextColor:z.propValues.buttonTextColor,buttonDisabledBgColor:z.propValues.buttonDisabledBgColor,buttonDisabledTextColor:z.propValues.buttonDisabledTextColor,primaryTextColor:z.propValues.primaryTextColor,secondaryTextColor:z.propValues.secondaryTextColor,primaryBgColor:z.propValues.primaryBgColor,secondaryBgColor:z.propValues.secondaryBgColor,borderColor:z.propValues.borderColor,cardBgColor:z.propValues.cardBgColor,errorColor:z.propValues.errorColor,errorLightColor:z.propValues.errorLightColor,warningColor:z.propValues.warningColor,warningLightColor:z.propValues.warningLightColor,successColor:z.propValues.successColor,successLightColor:z.propValues.successLightColor},q.customizationProps=G,q.returnPolicy=b.returnPolicy,q.privacyPolicy=b.privacyPolicy,q.termsOfService=b.termsOfService,q.checkoutSettingsStr=(null==M?void 0:M.length)?JSON.stringify(M[0]):null,t.label=6;case 6:return s?[2,{props:o(o({},V.nextPageData.props),q)}]:[2,{props:o(o({},V.nextPageData.props),q),revalidate:60}];case 7:return[2,{props:{}}];case 8:return[2]}}))}))},v.getStaticProps=function(o,r,i,n){return e(this,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,v.getPageData(o,!1,r,i,n)];case 1:return[2,e.sent()]}}))}))},v.getServerSideProps=function(o,r){return e(this,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,v.getPageData(o,!0,r)];case 1:return[2,e.sent()]}}))}))},v.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 ")},v.createFontScript=function(e){var t=x(e.fontFamily);if(t)return'<link id="ikas-font" rel="stylesheet" href="'.concat(t,"\"> \n <style>\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 </style>')},v}();export{v as IkasNextPageDataProvider};
|