@ikas/storefront 2.0.0-alpha.13 → 2.0.0-alpha.14
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{__extends as e}from'../../ext/tslib/tslib.es6.js';import*as t from"react";import{Observer as o}from"mobx-react-lite";import{withRouter as n}from"next/router.js";import{ThemeEditorComponent as r}from"./ThemeComponentEditor.js";import i from"./model.js";import{IkasPageHead as
|
|
1
|
+
import{__extends as e}from'../../ext/tslib/tslib.es6.js';import*as t from"react";import{Observer as o}from"mobx-react-lite";import{withRouter as n}from"next/router.js";import{ThemeEditorComponent as r}from"./ThemeComponentEditor.js";import i from"./model.js";import{IkasPageHead as a}from"../page/head.js";import{IkasEditorComponentLoader as m}from"./loader/index.js";import{reaction as l,makeObservable as s,computed as p}from"mobx";import{getGoogleFontHref as d}from"../../utils/google-fonts.js";var u=n(function(n){function u(e){var t=n.call(this,e)||this;return t.interceptClickEvent=function(e){var t=e.target;"A"===t.tagName&&(t.getAttribute("href"),e.preventDefault())},t.handleRouteChangeStart=function(e,o){throw o.shallow||t.vm.onPageChange(e),""},t.injectFontScript=function(){var e;if(null===(e=t.vm.theme)||void 0===e?void 0:e.settings.fontFamily.name){var o=t.vm.theme.settings.fontFamily,n=document.getElementById("ikas-font");n&&n.remove();var r=d(o);if(r){var i=document.createElement("link");i.setAttribute("id","ikas-font"),i.setAttribute("rel","stylesheet"),i.setAttribute("href",r),document.getElementsByTagName("head")[0].appendChild(i),document.body.style.setProperty("font-family","'"+o.name+'\', -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',"important")}}else document.body.style.setProperty("font-family",'-apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif')},t.vm=new i(e.router),s(t,{headerPageComponent:p,footerPageComponent:p,otherComponents:p}),t}return e(u,n),u.prototype.componentDidMount=function(){var e=this;this.props.router.events.on("routeChangeStart",this.handleRouteChangeStart),document.addEventListener&&document.addEventListener("click",this.interceptClickEvent),this.disposer&&this.disposer(),this.disposer=l((function(){var t;return null===(t=e.vm.theme)||void 0===t?void 0:t.settings}),(function(){var t;null===(t=e.vm.theme)||void 0===t||t.settings.colors.map((function(e){return document.documentElement.style.setProperty(e.key,e.color)})),e.injectFontScript()}))},u.prototype.componentWillUnmount=function(){this.props.router.events.off("routeChangeStart",this.handleRouteChangeStart),document.removeEventListener("click",this.interceptClickEvent),this.disposer&&this.disposer()},Object.defineProperty(u.prototype,"headerPageComponent",{get:function(){var e,t=this.vm;return null===(e=t.pageComponents)||void 0===e?void 0:e.find((function(e){var o,n;return e.componentId===(null===(n=null===(o=t.theme)||void 0===o?void 0:o.headerComponent)||void 0===n?void 0:n.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"footerPageComponent",{get:function(){var e,t=this.vm;return null===(e=t.pageComponents)||void 0===e?void 0:e.find((function(e){var o,n;return e.componentId===(null===(n=null===(o=t.theme)||void 0===o?void 0:o.footerComponent)||void 0===n?void 0:n.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"otherComponents",{get:function(){var e,t=this.vm;return null===(e=t.pageComponents)||void 0===e?void 0:e.filter((function(e){var o,n,r,i;return e.componentId!==(null===(n=null===(o=t.theme)||void 0===o?void 0:o.headerComponent)||void 0===n?void 0:n.id)&&e.componentId!==(null===(i=null===(r=t.theme)||void 0===r?void 0:r.footerComponent)||void 0===i?void 0:i.id)}))},enumerable:!1,configurable:!0}),u.prototype.render=function(){var e=this,n=this.vm;return t.createElement(o,null,(function(){var o;return n.isLoading?t.createElement(m,{isFullPage:!0}):t.createElement(t.Fragment,null,!!n.page&&t.createElement(a,{pageType:n.page.type,pageTitle:n.page.pageTitle,pageDescription:n.page.description}),t.createElement("div",{style:c},t.createElement("div",null,!!e.headerPageComponent&&t.createElement(r,{key:e.headerPageComponent.id,vm:n,pageComponent:e.headerPageComponent}),null===(o=e.otherComponents)||void 0===o?void 0:o.map((function(e){return t.createElement(r,{key:e.id,vm:n,pageComponent:e})}))),!!e.footerPageComponent&&t.createElement(r,{key:e.footerPageComponent.id,vm:n,pageComponent:e.footerPageComponent})))}))},u}(t.Component)),c={minHeight:"100vh",width:"100vw",display:"flex",flexDirection:"column",justifyContent:"space-between"};export{u as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as t,__assign as o,__spreadArrays 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"../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"mobx";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{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/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/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{getGoogleFontHref as h}from"../utils/google-fonts.js";var x=function(){function x(){}return x.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))}))}))},x.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)}))}))},x.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,h,v,S,C,b,I,y,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,x.readLocalTheme()]):[2,n(null)];case 2:return s=t.sent(),a=x.createColorScript(s.settings),p=x.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,x.readSettingsFile()];case 4:if(!(j=t.sent())||!j.localizationMap)return[2,n(null)];if(h=new d(j.storefront),v=new l(j.salesChannel),S=j.localizationMap,C=j.storefrontJSScripts||[],b=j.domain,I=j.productBackInStockSettings?{customerLoginRequired:j.productBackInStockSettings.customerLoginRequired}:null,y=j.customerReviewSettings?{customerLoginRequired:j.customerReviewSettings.customerLoginRequired,customerPurchaseRequired:j.customerReviewSettings.customerPurchaseRequired}:null,w=S[o],k=h.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=x.createColorScript(r.themeJson.settings),d=x.createFontScript(r.themeJson.settings);a&&C.push(a),d&&C.push(d)}n({storefront:h,themeLocalization:r,salesChannel:v,routing:k,favicon:i,stockPreference:s,storefrontJSScripts:C,domain:b,productBackInStockSettings:I,customerReviewSettings:y})})),t.label=5;case 5:return[2]}}))}))}))},x.getPageData=function(i,s,d,l,m){var u,f;return e(this,void 0,void 0,(function(){var e,h,v,S,C,b,I,y,w,k,P,L,R,T,E,B,V,J,O,F,N,D,q,z,A,G;return t(this,(function(t){switch(t.label){case 0:return e="local"===process.env.NEXT_PUBLIC_ENV,h=!e&&m,v=n().serverRuntimeConfig,h?[3,7]:(S=i.locale)?[4,x.getSettings(S)]:[2,{props:{},notFound:!0}];case 1:return(C=t.sent())&&C.storefront.mainStorefrontThemeId&&C.storefront.salesChannelId?(b=C.storefront,I=C.themeLocalization,y=C.salesChannel,w=C.routing,k=C.favicon,P=C.stockPreference,L=C.storefrontJSScripts,R=C.domain,T=C.productBackInStockSettings,E=C.customerReviewSettings,c.storefrontId=b.id,c.storefrontRoutingId=w.id,c.storefrontThemeId=b.mainStorefrontThemeId,c.salesChannelId=b.salesChannelId,c.priceListId=w.priceListId||void 0,c.stockLocationIds=null===(u=y.stockLocations)||void 0===u?void 0:u.map((function(e){return e.id})),c.routings=b.routings,c.paymentGateways=y.paymentGateways||[],c.gtmId=b.gtmId||void 0,c.fbpId=b.fbpId||void 0,c.favicon=k||null,c.stockPreference=P||null,c.storefrontJSScripts=L||[],c.domain=R,c.productBackInStockSettings=T,c.customerReviewSettings=E,(B=new p(I.themeJson,i.params,d)).possiblePageTypes=l||(d?[d]:[]),m?[3,3]:[4,B.getPageData()]):[2,{props:{},notFound:!0}];case 2:if(t.sent(),!B.page)return[2,{props:{},notFound:!0}];t.label=3;case 3:return V=m?B.theme.components.map((function(e){return e.id})):B.page.components.map((function(e){return e.componentId})),J=I.themeJson.components.filter((function(e){return m||V.includes(e.id)})),O=r(["common"],J.map((function(e){return e.dir}))),(d===a.CHECKOUT||m)&&O.push("checkout-page"),F=v.nextI18nConf,N=w.locale,[4,new g(N,O,e?void 0:F.localePath).read()];case 4:return D=t.sent(),c.translations=D,q={},d!==a.CHECKOUT?[3,6]:(z=null===(f=B.page)||void 0===f?void 0:f.components[0])?[4,j.listCheckoutSettings()]:[3,6];case 5:A=t.sent(),G={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=I.returnPolicy,q.privacyPolicy=I.privacyPolicy,q.termsOfService=I.termsOfService,q.checkoutSettingsStr=(null==A?void 0:A.length)?JSON.stringify(A[0]):null,t.label=6;case 6:return s?[2,{props:o(o({},B.nextPageData.props),q)}]:[2,{props:o(o({},B.nextPageData.props),q),revalidate:60}];case 7:return[2,{props:{}}];case 8:return[2]}}))}))},x.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,x.getPageData(o,!1,r,i,n)];case 1:return[2,e.sent()]}}))}))},x.getServerSideProps=function(o,r){return e(this,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,x.getPageData(o,!0,r)];case 1:return[2,e.sent()]}}))}))},x.createColorScript=function(e){if(e.colors)return"<script>"+e.colors.map((function(e){return'document.documentElement.style.setProperty("'+e.key+'","'+e.color+'");'})).join("\r\n")+"<\/script> \n "},x.createFontScript=function(e){var t=h(e.fontFamily);if(t)return'<link id="ikas-font" rel="stylesheet" href="'+t+"\"> \n <style>\n body { \n font-family: '"+e.fontFamily.name+"', serif !important;\n } \n </style>"},x}();export{x as IkasNextPageDataProvider};
|
|
1
|
+
import{__awaiter as e,__generator as t,__assign as o,__spreadArrays 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"../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"mobx";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{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/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/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{getGoogleFontHref as h}from"../utils/google-fonts.js";var x=function(){function x(){}return x.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))}))}))},x.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)}))}))},x.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,h,v,S,C,b,y,I,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,x.readLocalTheme()]):[2,n(null)];case 2:return s=t.sent(),a=x.createColorScript(s.settings),p=x.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,x.readSettingsFile()];case 4:if(!(j=t.sent())||!j.localizationMap)return[2,n(null)];if(h=new d(j.storefront),v=new l(j.salesChannel),S=j.localizationMap,C=j.storefrontJSScripts||[],b=j.domain,y=j.productBackInStockSettings?{customerLoginRequired:j.productBackInStockSettings.customerLoginRequired}:null,I=j.customerReviewSettings?{customerLoginRequired:j.customerReviewSettings.customerLoginRequired,customerPurchaseRequired:j.customerReviewSettings.customerPurchaseRequired}:null,w=S[o],k=h.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=x.createColorScript(r.themeJson.settings),d=x.createFontScript(r.themeJson.settings);a&&C.push(a),d&&C.push(d)}n({storefront:h,themeLocalization:r,salesChannel:v,routing:k,favicon:i,stockPreference:s,storefrontJSScripts:C,domain:b,productBackInStockSettings:y,customerReviewSettings:I})})),t.label=5;case 5:return[2]}}))}))}))},x.getPageData=function(i,s,d,l,m){var u,f;return e(this,void 0,void 0,(function(){var e,h,v,S,C,b,y,I,w,k,P,R,L,T,B,E,V,J,F,O,N,D,q,A,z,M;return t(this,(function(t){switch(t.label){case 0:return e="local"===process.env.NEXT_PUBLIC_ENV,h=!e&&m,v=n().serverRuntimeConfig,h?[3,7]:(S=i.locale)?[4,x.getSettings(S)]:[2,{props:{},notFound:!0}];case 1:return(C=t.sent())&&C.storefront.mainStorefrontThemeId&&C.storefront.salesChannelId?(b=C.storefront,y=C.themeLocalization,I=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=b.id,c.storefrontRoutingId=w.id,c.storefrontThemeId=b.mainStorefrontThemeId,c.salesChannelId=b.salesChannelId,c.priceListId=w.priceListId||void 0,c.stockLocationIds=null===(u=I.stockLocations)||void 0===u?void 0:u.map((function(e){return e.id})),c.routings=b.routings,c.paymentGateways=I.paymentGateways||[],c.gtmId=b.gtmId||void 0,c.fbpId=b.fbpId||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(y.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=y.themeJson.components.filter((function(e){return m||V.includes(e.id)})),F=r(["common"],J.map((function(e){return e.dir}))),(d===a.CHECKOUT||m)&&F.push("checkout-page"),O=v.nextI18nConf,N=w.locale,[4,new g(N,F,e?void 0:O.localePath).read()];case 4:return D=t.sent(),c.translations=D,q={},d!==a.CHECKOUT?[3,6]:(A=null===(f=E.page)||void 0===f?void 0:f.components[0])?[4,j.listCheckoutSettings()]:[3,6];case 5:z=t.sent(),M={buttonBgColor:A.propValues.buttonBgColor,buttonTextColor:A.propValues.buttonTextColor,buttonDisabledBgColor:A.propValues.buttonDisabledBgColor,buttonDisabledTextColor:A.propValues.buttonDisabledTextColor,primaryTextColor:A.propValues.primaryTextColor,secondaryTextColor:A.propValues.secondaryTextColor,primaryBgColor:A.propValues.primaryBgColor,secondaryBgColor:A.propValues.secondaryBgColor,borderColor:A.propValues.borderColor,cardBgColor:A.propValues.cardBgColor,errorColor:A.propValues.errorColor,errorLightColor:A.propValues.errorLightColor,warningColor:A.propValues.warningColor,warningLightColor:A.propValues.warningLightColor,successColor:A.propValues.successColor,successLightColor:A.propValues.successLightColor},q.customizationProps=M,q.returnPolicy=y.returnPolicy,q.privacyPolicy=y.privacyPolicy,q.termsOfService=y.termsOfService,q.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),q)}]:[2,{props:o(o({},E.nextPageData.props),q),revalidate:60}];case 7:return[2,{props:{}}];case 8:return[2]}}))}))},x.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,x.getPageData(o,!1,r,i,n)];case 1:return[2,e.sent()]}}))}))},x.getServerSideProps=function(o,r){return e(this,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,x.getPageData(o,!0,r)];case 1:return[2,e.sent()]}}))}))},x.createColorScript=function(e){if(e.colors)return"<script>"+e.colors.map((function(e){return'document.documentElement.style.setProperty("'+e.key+'","'+e.color+'");'})).join("\r\n")+"<\/script> \n "},x.createFontScript=function(e){var t=h(e.fontFamily);if(t)return'<link id="ikas-font" rel="stylesheet" href="'+t+"\"> \n <style>\n body { \n font-family: '"+e.fontFamily.name+'\', -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;\n } \n </style>'},x}();export{x as IkasNextPageDataProvider};
|