@ikas/storefront 0.0.161-alpha.16 → 0.0.161-alpha.18
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/index.es.js +70 -47
- package/build/index.js +70 -47
- package/build/pages/editor.d.ts +2 -0
- package/build/utils/settings.d.ts +2 -2
- package/package.json +1 -1
package/build/index.es.js
CHANGED
|
@@ -37992,7 +37992,7 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
37992
37992
|
});
|
|
37993
37993
|
}); });
|
|
37994
37994
|
};
|
|
37995
|
-
SettingsHelper.getPageData = function (context, isServer, pageType, possiblePageTypes) {
|
|
37995
|
+
SettingsHelper.getPageData = function (context, isServer, pageType, possiblePageTypes, isEditor) {
|
|
37996
37996
|
var _a;
|
|
37997
37997
|
return __awaiter(this, void 0, void 0, function () {
|
|
37998
37998
|
var isLocal, locale, serverRuntimeConfig, settings, storefront, themeLocalization, salesChannel, routing, favicon, stockPreference, provider, componentIds, components, componentDirs, nextI18nConf, routingLocales, defaultRoutingLocale, _b, _c;
|
|
@@ -38035,24 +38035,28 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
38035
38035
|
IkasStorefrontConfig.stockPreference = stockPreference || null;
|
|
38036
38036
|
provider = new IkasPageDataProvider(themeLocalization.themeJson, context.params, pageType);
|
|
38037
38037
|
provider.possiblePageTypes = possiblePageTypes;
|
|
38038
|
+
if (!!isEditor) return [3 /*break*/, 3];
|
|
38038
38039
|
return [4 /*yield*/, provider.getPageData()];
|
|
38039
38040
|
case 2:
|
|
38040
38041
|
_f.sent();
|
|
38042
|
+
_f.label = 3;
|
|
38043
|
+
case 3:
|
|
38041
38044
|
if (!provider.page) {
|
|
38042
|
-
|
|
38043
|
-
|
|
38044
|
-
|
|
38045
|
-
|
|
38045
|
+
if (!isEditor)
|
|
38046
|
+
return [2 /*return*/, {
|
|
38047
|
+
props: {},
|
|
38048
|
+
notFound: true,
|
|
38049
|
+
}];
|
|
38046
38050
|
}
|
|
38047
|
-
componentIds =
|
|
38048
|
-
|
|
38049
|
-
|
|
38050
|
-
});
|
|
38051
|
+
componentIds = isEditor
|
|
38052
|
+
? provider.theme.components.map(function (c) { return c.id; })
|
|
38053
|
+
: provider.page.components.map(function (pc) { return pc.componentId; });
|
|
38054
|
+
components = themeLocalization.themeJson.components.filter(function (c) { return isEditor || componentIds.includes(c.id); });
|
|
38051
38055
|
componentDirs = __spreadArrays(["common"], components.map(function (c) { return c.dir; }));
|
|
38052
38056
|
nextI18nConf = serverRuntimeConfig.nextI18nConf;
|
|
38053
38057
|
routingLocales = uniq_1(storefront.routings.map(function (sr) { return sr.locale; }));
|
|
38054
38058
|
defaultRoutingLocale = routing.locale;
|
|
38055
|
-
if (!isServer) return [3 /*break*/,
|
|
38059
|
+
if (!isServer) return [3 /*break*/, 5];
|
|
38056
38060
|
_d = {};
|
|
38057
38061
|
_b = [{}];
|
|
38058
38062
|
return [4 /*yield*/, serverSideTranslations(routing.locale, componentDirs, isLocal
|
|
@@ -38065,9 +38069,9 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
38065
38069
|
serializeConfig: false,
|
|
38066
38070
|
localePath: nextI18nConf.localePath,
|
|
38067
38071
|
})];
|
|
38068
|
-
case
|
|
38072
|
+
case 4: return [2 /*return*/, (_d.props = __assign.apply(void 0, [__assign.apply(void 0, _b.concat([(_f.sent())])), provider.nextPageData.props]),
|
|
38069
38073
|
_d)];
|
|
38070
|
-
case
|
|
38074
|
+
case 5:
|
|
38071
38075
|
_e = {};
|
|
38072
38076
|
_c = [{}];
|
|
38073
38077
|
return [4 /*yield*/, serverSideTranslations(routing.locale, componentDirs, isLocal
|
|
@@ -38080,18 +38084,18 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
38080
38084
|
serializeConfig: false,
|
|
38081
38085
|
localePath: nextI18nConf.localePath,
|
|
38082
38086
|
})];
|
|
38083
|
-
case
|
|
38087
|
+
case 6: return [2 /*return*/, (_e.props = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_f.sent())])), provider.nextPageData.props]),
|
|
38084
38088
|
_e.revalidate = 60,
|
|
38085
38089
|
_e)];
|
|
38086
38090
|
}
|
|
38087
38091
|
});
|
|
38088
38092
|
});
|
|
38089
38093
|
};
|
|
38090
|
-
SettingsHelper.getStaticProps = function (context, pageType, possiblePageTypes) {
|
|
38094
|
+
SettingsHelper.getStaticProps = function (context, pageType, possiblePageTypes, isEditor) {
|
|
38091
38095
|
return __awaiter(this, void 0, void 0, function () {
|
|
38092
38096
|
return __generator(this, function (_a) {
|
|
38093
38097
|
switch (_a.label) {
|
|
38094
|
-
case 0: return [4 /*yield*/, SettingsHelper.getPageData(context, false, pageType, possiblePageTypes)];
|
|
38098
|
+
case 0: return [4 /*yield*/, SettingsHelper.getPageData(context, false, pageType, possiblePageTypes, isEditor)];
|
|
38095
38099
|
case 1: return [2 /*return*/, _a.sent()];
|
|
38096
38100
|
}
|
|
38097
38101
|
});
|
|
@@ -38321,16 +38325,17 @@ var CheckoutPage = function (_a) {
|
|
|
38321
38325
|
};
|
|
38322
38326
|
var _id_ = observer(CheckoutPage);
|
|
38323
38327
|
var getServerSideProps = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
38324
|
-
var id, locale, settings, storefront, themeLocalization, salesChannel, routing, redirect, checkout, checkoutSettings;
|
|
38325
|
-
var
|
|
38326
|
-
|
|
38327
|
-
|
|
38328
|
+
var id, locale, settings, storefront, themeLocalization, salesChannel, routing, redirect, checkout, checkoutSettings, componentDirs, isLocal, serverRuntimeConfig, routingLocales, defaultRoutingLocale, nextI18nConf, _a;
|
|
38329
|
+
var _b;
|
|
38330
|
+
var _c;
|
|
38331
|
+
return __generator(this, function (_d) {
|
|
38332
|
+
switch (_d.label) {
|
|
38328
38333
|
case 0:
|
|
38329
38334
|
id = context.query.id;
|
|
38330
38335
|
locale = context.locale || context.defaultLocale || "en";
|
|
38331
38336
|
return [4 /*yield*/, SettingsHelper.getSettings(locale)];
|
|
38332
38337
|
case 1:
|
|
38333
|
-
settings =
|
|
38338
|
+
settings = _d.sent();
|
|
38334
38339
|
// TODO maybe remove this and convert this page to static
|
|
38335
38340
|
if (!settings ||
|
|
38336
38341
|
!settings.storefront.mainStorefrontThemeId ||
|
|
@@ -38346,7 +38351,7 @@ var getServerSideProps = function (context) { return __awaiter(void 0, void 0, v
|
|
|
38346
38351
|
IkasStorefrontConfig.storefrontThemeId = storefront.mainStorefrontThemeId;
|
|
38347
38352
|
IkasStorefrontConfig.salesChannelId = storefront.salesChannelId;
|
|
38348
38353
|
IkasStorefrontConfig.priceListId = routing.priceListId || undefined;
|
|
38349
|
-
IkasStorefrontConfig.stockLocationIds = (
|
|
38354
|
+
IkasStorefrontConfig.stockLocationIds = (_c = salesChannel.stockLocations) === null || _c === void 0 ? void 0 : _c.map(function (sl) { return sl.id; });
|
|
38350
38355
|
IkasStorefrontConfig.routings = storefront.routings;
|
|
38351
38356
|
IkasStorefrontConfig.paymentGateways = salesChannel.paymentGateways || [];
|
|
38352
38357
|
IkasStorefrontConfig.gtmId = storefront.gtmId || undefined;
|
|
@@ -38362,24 +38367,33 @@ var getServerSideProps = function (context) { return __awaiter(void 0, void 0, v
|
|
|
38362
38367
|
}
|
|
38363
38368
|
return [4 /*yield*/, IkasCheckoutAPI.getCheckoutById(id)];
|
|
38364
38369
|
case 2:
|
|
38365
|
-
checkout =
|
|
38366
|
-
if (!checkout) return [3 /*break*/,
|
|
38370
|
+
checkout = _d.sent();
|
|
38371
|
+
if (!checkout) return [3 /*break*/, 5];
|
|
38367
38372
|
return [4 /*yield*/, IkasCheckoutAPI.listCheckoutSettings()];
|
|
38368
38373
|
case 3:
|
|
38369
|
-
checkoutSettings =
|
|
38370
|
-
|
|
38371
|
-
|
|
38372
|
-
|
|
38373
|
-
|
|
38374
|
-
|
|
38375
|
-
|
|
38376
|
-
|
|
38377
|
-
|
|
38378
|
-
|
|
38379
|
-
|
|
38380
|
-
|
|
38381
|
-
|
|
38382
|
-
|
|
38374
|
+
checkoutSettings = _d.sent();
|
|
38375
|
+
componentDirs = ["common", "checkout-page"];
|
|
38376
|
+
isLocal = process.env.NEXT_PUBLIC_ENV === "local";
|
|
38377
|
+
serverRuntimeConfig = getConfig().serverRuntimeConfig;
|
|
38378
|
+
routingLocales = uniq_1(storefront.routings.map(function (sr) { return sr.locale; }));
|
|
38379
|
+
defaultRoutingLocale = routing.locale;
|
|
38380
|
+
nextI18nConf = serverRuntimeConfig.nextI18nConf;
|
|
38381
|
+
_b = {};
|
|
38382
|
+
_a = [{}];
|
|
38383
|
+
return [4 /*yield*/, serverSideTranslations(routing.locale, componentDirs, isLocal
|
|
38384
|
+
? undefined
|
|
38385
|
+
: {
|
|
38386
|
+
i18n: {
|
|
38387
|
+
locales: routingLocales,
|
|
38388
|
+
defaultLocale: defaultRoutingLocale,
|
|
38389
|
+
},
|
|
38390
|
+
serializeConfig: false,
|
|
38391
|
+
localePath: nextI18nConf.localePath,
|
|
38392
|
+
})];
|
|
38393
|
+
case 4: return [2 /*return*/, (_b.props = __assign.apply(void 0, [__assign.apply(void 0, _a.concat([(_d.sent())])), { checkoutStr: JSON.stringify(checkout), checkoutSettingsStr: (checkoutSettings === null || checkoutSettings === void 0 ? void 0 : checkoutSettings.length) ? JSON.stringify(checkoutSettings[0])
|
|
38394
|
+
: null, configJson: IkasStorefrontConfig.getJson(), returnPolicy: themeLocalization.returnPolicy || "", privacyPolicy: themeLocalization.privacyPolicy || "", termsOfService: themeLocalization.termsOfService || "", queryParams: context.query }]),
|
|
38395
|
+
_b)];
|
|
38396
|
+
case 5: return [2 /*return*/, redirect()];
|
|
38383
38397
|
}
|
|
38384
38398
|
});
|
|
38385
38399
|
}); };
|
|
@@ -38614,10 +38628,19 @@ var IkasPageEditor$1 = dynamic(function () { return Promise.resolve().then(funct
|
|
|
38614
38628
|
var Page$c = function () {
|
|
38615
38629
|
return createElement(IkasPageEditor$1, null);
|
|
38616
38630
|
};
|
|
38631
|
+
var getStaticProps$b = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
38632
|
+
return __generator(this, function (_a) {
|
|
38633
|
+
switch (_a.label) {
|
|
38634
|
+
case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, undefined, undefined, true)];
|
|
38635
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
38636
|
+
}
|
|
38637
|
+
});
|
|
38638
|
+
}); };
|
|
38617
38639
|
var editor = observer(Page$c);
|
|
38618
38640
|
|
|
38619
38641
|
var editor$1 = /*#__PURE__*/Object.freeze({
|
|
38620
38642
|
__proto__: null,
|
|
38643
|
+
getStaticProps: getStaticProps$b,
|
|
38621
38644
|
'default': editor
|
|
38622
38645
|
});
|
|
38623
38646
|
|
|
@@ -38630,7 +38653,7 @@ var Page$d = function (_a) {
|
|
|
38630
38653
|
}, [propValuesStr]);
|
|
38631
38654
|
return (createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
|
|
38632
38655
|
};
|
|
38633
|
-
var getStaticProps$
|
|
38656
|
+
var getStaticProps$c = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
38634
38657
|
return __generator(this, function (_a) {
|
|
38635
38658
|
switch (_a.label) {
|
|
38636
38659
|
case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, IkasThemePageType.FAVORITE_PRODUCTS)];
|
|
@@ -38642,7 +38665,7 @@ var getStaticProps$b = function (context) { return __awaiter(void 0, void 0, voi
|
|
|
38642
38665
|
var favoriteProducts = /*#__PURE__*/Object.freeze({
|
|
38643
38666
|
__proto__: null,
|
|
38644
38667
|
'default': Page$d,
|
|
38645
|
-
getStaticProps: getStaticProps$
|
|
38668
|
+
getStaticProps: getStaticProps$c
|
|
38646
38669
|
});
|
|
38647
38670
|
|
|
38648
38671
|
var Page$e = function (_a) {
|
|
@@ -38662,7 +38685,7 @@ var Page$e = function (_a) {
|
|
|
38662
38685
|
}, [isBrowser, propValuesStr]);
|
|
38663
38686
|
return (createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues, addOgpMetas: true }));
|
|
38664
38687
|
};
|
|
38665
|
-
var getStaticProps$
|
|
38688
|
+
var getStaticProps$d = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
38666
38689
|
return __generator(this, function (_a) {
|
|
38667
38690
|
switch (_a.label) {
|
|
38668
38691
|
case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, IkasThemePageType.SEARCH)];
|
|
@@ -38674,7 +38697,7 @@ var getStaticProps$c = function (context) { return __awaiter(void 0, void 0, voi
|
|
|
38674
38697
|
var search = /*#__PURE__*/Object.freeze({
|
|
38675
38698
|
__proto__: null,
|
|
38676
38699
|
'default': Page$e,
|
|
38677
|
-
getStaticProps: getStaticProps$
|
|
38700
|
+
getStaticProps: getStaticProps$d
|
|
38678
38701
|
});
|
|
38679
38702
|
|
|
38680
38703
|
var Page$f = function (_a) {
|
|
@@ -38688,7 +38711,7 @@ var Page$f = function (_a) {
|
|
|
38688
38711
|
}, [propValuesStr]);
|
|
38689
38712
|
return (createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues }));
|
|
38690
38713
|
};
|
|
38691
|
-
var getStaticProps$
|
|
38714
|
+
var getStaticProps$e = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
38692
38715
|
var props;
|
|
38693
38716
|
return __generator(this, function (_a) {
|
|
38694
38717
|
switch (_a.label) {
|
|
@@ -38710,7 +38733,7 @@ var getStaticProps$d = function (context) { return __awaiter(void 0, void 0, voi
|
|
|
38710
38733
|
var _404 = /*#__PURE__*/Object.freeze({
|
|
38711
38734
|
__proto__: null,
|
|
38712
38735
|
'default': Page$f,
|
|
38713
|
-
getStaticProps: getStaticProps$
|
|
38736
|
+
getStaticProps: getStaticProps$e
|
|
38714
38737
|
});
|
|
38715
38738
|
|
|
38716
38739
|
var Page$g = function (_a) {
|
|
@@ -38722,7 +38745,7 @@ var Page$g = function (_a) {
|
|
|
38722
38745
|
}, [propValuesStr]);
|
|
38723
38746
|
return (createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues, addOgpMetas: true }));
|
|
38724
38747
|
};
|
|
38725
|
-
var getStaticProps$
|
|
38748
|
+
var getStaticProps$f = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
38726
38749
|
return __generator(this, function (_a) {
|
|
38727
38750
|
switch (_a.label) {
|
|
38728
38751
|
case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, IkasThemePageType.BLOG_INDEX)];
|
|
@@ -38734,7 +38757,7 @@ var getStaticProps$e = function (context) { return __awaiter(void 0, void 0, voi
|
|
|
38734
38757
|
var index$5 = /*#__PURE__*/Object.freeze({
|
|
38735
38758
|
__proto__: null,
|
|
38736
38759
|
'default': Page$g,
|
|
38737
|
-
getStaticProps: getStaticProps$
|
|
38760
|
+
getStaticProps: getStaticProps$f
|
|
38738
38761
|
});
|
|
38739
38762
|
|
|
38740
38763
|
var Page$h = function (_a) {
|
|
@@ -38763,7 +38786,7 @@ var getStaticPaths$2 = function (context) { return __awaiter(void 0, void 0, voi
|
|
|
38763
38786
|
}];
|
|
38764
38787
|
});
|
|
38765
38788
|
}); };
|
|
38766
|
-
var getStaticProps$
|
|
38789
|
+
var getStaticProps$g = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
38767
38790
|
return __generator(this, function (_a) {
|
|
38768
38791
|
switch (_a.label) {
|
|
38769
38792
|
case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, undefined, [
|
|
@@ -38779,7 +38802,7 @@ var _slug_$2 = /*#__PURE__*/Object.freeze({
|
|
|
38779
38802
|
__proto__: null,
|
|
38780
38803
|
'default': _slug_$1,
|
|
38781
38804
|
getStaticPaths: getStaticPaths$2,
|
|
38782
|
-
getStaticProps: getStaticProps$
|
|
38805
|
+
getStaticProps: getStaticProps$g
|
|
38783
38806
|
});
|
|
38784
38807
|
|
|
38785
38808
|
/**
|
package/build/index.js
CHANGED
|
@@ -37969,7 +37969,7 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
37969
37969
|
});
|
|
37970
37970
|
}); });
|
|
37971
37971
|
};
|
|
37972
|
-
SettingsHelper.getPageData = function (context, isServer, pageType, possiblePageTypes) {
|
|
37972
|
+
SettingsHelper.getPageData = function (context, isServer, pageType, possiblePageTypes, isEditor) {
|
|
37973
37973
|
var _a;
|
|
37974
37974
|
return __awaiter(this, void 0, void 0, function () {
|
|
37975
37975
|
var isLocal, locale, serverRuntimeConfig, settings, storefront, themeLocalization, salesChannel, routing, favicon, stockPreference, provider, componentIds, components, componentDirs, nextI18nConf, routingLocales, defaultRoutingLocale, _b, _c;
|
|
@@ -38012,24 +38012,28 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
38012
38012
|
IkasStorefrontConfig.stockPreference = stockPreference || null;
|
|
38013
38013
|
provider = new IkasPageDataProvider(themeLocalization.themeJson, context.params, pageType);
|
|
38014
38014
|
provider.possiblePageTypes = possiblePageTypes;
|
|
38015
|
+
if (!!isEditor) return [3 /*break*/, 3];
|
|
38015
38016
|
return [4 /*yield*/, provider.getPageData()];
|
|
38016
38017
|
case 2:
|
|
38017
38018
|
_f.sent();
|
|
38019
|
+
_f.label = 3;
|
|
38020
|
+
case 3:
|
|
38018
38021
|
if (!provider.page) {
|
|
38019
|
-
|
|
38020
|
-
|
|
38021
|
-
|
|
38022
|
-
|
|
38022
|
+
if (!isEditor)
|
|
38023
|
+
return [2 /*return*/, {
|
|
38024
|
+
props: {},
|
|
38025
|
+
notFound: true,
|
|
38026
|
+
}];
|
|
38023
38027
|
}
|
|
38024
|
-
componentIds =
|
|
38025
|
-
|
|
38026
|
-
|
|
38027
|
-
});
|
|
38028
|
+
componentIds = isEditor
|
|
38029
|
+
? provider.theme.components.map(function (c) { return c.id; })
|
|
38030
|
+
: provider.page.components.map(function (pc) { return pc.componentId; });
|
|
38031
|
+
components = themeLocalization.themeJson.components.filter(function (c) { return isEditor || componentIds.includes(c.id); });
|
|
38028
38032
|
componentDirs = __spreadArrays(["common"], components.map(function (c) { return c.dir; }));
|
|
38029
38033
|
nextI18nConf = serverRuntimeConfig.nextI18nConf;
|
|
38030
38034
|
routingLocales = uniq_1(storefront.routings.map(function (sr) { return sr.locale; }));
|
|
38031
38035
|
defaultRoutingLocale = routing.locale;
|
|
38032
|
-
if (!isServer) return [3 /*break*/,
|
|
38036
|
+
if (!isServer) return [3 /*break*/, 5];
|
|
38033
38037
|
_d = {};
|
|
38034
38038
|
_b = [{}];
|
|
38035
38039
|
return [4 /*yield*/, serverSideTranslations.serverSideTranslations(routing.locale, componentDirs, isLocal
|
|
@@ -38042,9 +38046,9 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
38042
38046
|
serializeConfig: false,
|
|
38043
38047
|
localePath: nextI18nConf.localePath,
|
|
38044
38048
|
})];
|
|
38045
|
-
case
|
|
38049
|
+
case 4: return [2 /*return*/, (_d.props = __assign.apply(void 0, [__assign.apply(void 0, _b.concat([(_f.sent())])), provider.nextPageData.props]),
|
|
38046
38050
|
_d)];
|
|
38047
|
-
case
|
|
38051
|
+
case 5:
|
|
38048
38052
|
_e = {};
|
|
38049
38053
|
_c = [{}];
|
|
38050
38054
|
return [4 /*yield*/, serverSideTranslations.serverSideTranslations(routing.locale, componentDirs, isLocal
|
|
@@ -38057,18 +38061,18 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
38057
38061
|
serializeConfig: false,
|
|
38058
38062
|
localePath: nextI18nConf.localePath,
|
|
38059
38063
|
})];
|
|
38060
|
-
case
|
|
38064
|
+
case 6: return [2 /*return*/, (_e.props = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_f.sent())])), provider.nextPageData.props]),
|
|
38061
38065
|
_e.revalidate = 60,
|
|
38062
38066
|
_e)];
|
|
38063
38067
|
}
|
|
38064
38068
|
});
|
|
38065
38069
|
});
|
|
38066
38070
|
};
|
|
38067
|
-
SettingsHelper.getStaticProps = function (context, pageType, possiblePageTypes) {
|
|
38071
|
+
SettingsHelper.getStaticProps = function (context, pageType, possiblePageTypes, isEditor) {
|
|
38068
38072
|
return __awaiter(this, void 0, void 0, function () {
|
|
38069
38073
|
return __generator(this, function (_a) {
|
|
38070
38074
|
switch (_a.label) {
|
|
38071
|
-
case 0: return [4 /*yield*/, SettingsHelper.getPageData(context, false, pageType, possiblePageTypes)];
|
|
38075
|
+
case 0: return [4 /*yield*/, SettingsHelper.getPageData(context, false, pageType, possiblePageTypes, isEditor)];
|
|
38072
38076
|
case 1: return [2 /*return*/, _a.sent()];
|
|
38073
38077
|
}
|
|
38074
38078
|
});
|
|
@@ -38298,16 +38302,17 @@ var CheckoutPage = function (_a) {
|
|
|
38298
38302
|
};
|
|
38299
38303
|
var _id_ = mobxReactLite.observer(CheckoutPage);
|
|
38300
38304
|
var getServerSideProps = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
38301
|
-
var id, locale, settings, storefront, themeLocalization, salesChannel, routing, redirect, checkout, checkoutSettings;
|
|
38302
|
-
var
|
|
38303
|
-
|
|
38304
|
-
|
|
38305
|
+
var id, locale, settings, storefront, themeLocalization, salesChannel, routing, redirect, checkout, checkoutSettings, componentDirs, isLocal, serverRuntimeConfig, routingLocales, defaultRoutingLocale, nextI18nConf, _a;
|
|
38306
|
+
var _b;
|
|
38307
|
+
var _c;
|
|
38308
|
+
return __generator(this, function (_d) {
|
|
38309
|
+
switch (_d.label) {
|
|
38305
38310
|
case 0:
|
|
38306
38311
|
id = context.query.id;
|
|
38307
38312
|
locale = context.locale || context.defaultLocale || "en";
|
|
38308
38313
|
return [4 /*yield*/, SettingsHelper.getSettings(locale)];
|
|
38309
38314
|
case 1:
|
|
38310
|
-
settings =
|
|
38315
|
+
settings = _d.sent();
|
|
38311
38316
|
// TODO maybe remove this and convert this page to static
|
|
38312
38317
|
if (!settings ||
|
|
38313
38318
|
!settings.storefront.mainStorefrontThemeId ||
|
|
@@ -38323,7 +38328,7 @@ var getServerSideProps = function (context) { return __awaiter(void 0, void 0, v
|
|
|
38323
38328
|
IkasStorefrontConfig.storefrontThemeId = storefront.mainStorefrontThemeId;
|
|
38324
38329
|
IkasStorefrontConfig.salesChannelId = storefront.salesChannelId;
|
|
38325
38330
|
IkasStorefrontConfig.priceListId = routing.priceListId || undefined;
|
|
38326
|
-
IkasStorefrontConfig.stockLocationIds = (
|
|
38331
|
+
IkasStorefrontConfig.stockLocationIds = (_c = salesChannel.stockLocations) === null || _c === void 0 ? void 0 : _c.map(function (sl) { return sl.id; });
|
|
38327
38332
|
IkasStorefrontConfig.routings = storefront.routings;
|
|
38328
38333
|
IkasStorefrontConfig.paymentGateways = salesChannel.paymentGateways || [];
|
|
38329
38334
|
IkasStorefrontConfig.gtmId = storefront.gtmId || undefined;
|
|
@@ -38339,24 +38344,33 @@ var getServerSideProps = function (context) { return __awaiter(void 0, void 0, v
|
|
|
38339
38344
|
}
|
|
38340
38345
|
return [4 /*yield*/, IkasCheckoutAPI.getCheckoutById(id)];
|
|
38341
38346
|
case 2:
|
|
38342
|
-
checkout =
|
|
38343
|
-
if (!checkout) return [3 /*break*/,
|
|
38347
|
+
checkout = _d.sent();
|
|
38348
|
+
if (!checkout) return [3 /*break*/, 5];
|
|
38344
38349
|
return [4 /*yield*/, IkasCheckoutAPI.listCheckoutSettings()];
|
|
38345
38350
|
case 3:
|
|
38346
|
-
checkoutSettings =
|
|
38347
|
-
|
|
38348
|
-
|
|
38349
|
-
|
|
38350
|
-
|
|
38351
|
-
|
|
38352
|
-
|
|
38353
|
-
|
|
38354
|
-
|
|
38355
|
-
|
|
38356
|
-
|
|
38357
|
-
|
|
38358
|
-
|
|
38359
|
-
|
|
38351
|
+
checkoutSettings = _d.sent();
|
|
38352
|
+
componentDirs = ["common", "checkout-page"];
|
|
38353
|
+
isLocal = process.env.NEXT_PUBLIC_ENV === "local";
|
|
38354
|
+
serverRuntimeConfig = getConfig__default['default']().serverRuntimeConfig;
|
|
38355
|
+
routingLocales = uniq_1(storefront.routings.map(function (sr) { return sr.locale; }));
|
|
38356
|
+
defaultRoutingLocale = routing.locale;
|
|
38357
|
+
nextI18nConf = serverRuntimeConfig.nextI18nConf;
|
|
38358
|
+
_b = {};
|
|
38359
|
+
_a = [{}];
|
|
38360
|
+
return [4 /*yield*/, serverSideTranslations.serverSideTranslations(routing.locale, componentDirs, isLocal
|
|
38361
|
+
? undefined
|
|
38362
|
+
: {
|
|
38363
|
+
i18n: {
|
|
38364
|
+
locales: routingLocales,
|
|
38365
|
+
defaultLocale: defaultRoutingLocale,
|
|
38366
|
+
},
|
|
38367
|
+
serializeConfig: false,
|
|
38368
|
+
localePath: nextI18nConf.localePath,
|
|
38369
|
+
})];
|
|
38370
|
+
case 4: return [2 /*return*/, (_b.props = __assign.apply(void 0, [__assign.apply(void 0, _a.concat([(_d.sent())])), { checkoutStr: JSON.stringify(checkout), checkoutSettingsStr: (checkoutSettings === null || checkoutSettings === void 0 ? void 0 : checkoutSettings.length) ? JSON.stringify(checkoutSettings[0])
|
|
38371
|
+
: null, configJson: IkasStorefrontConfig.getJson(), returnPolicy: themeLocalization.returnPolicy || "", privacyPolicy: themeLocalization.privacyPolicy || "", termsOfService: themeLocalization.termsOfService || "", queryParams: context.query }]),
|
|
38372
|
+
_b)];
|
|
38373
|
+
case 5: return [2 /*return*/, redirect()];
|
|
38360
38374
|
}
|
|
38361
38375
|
});
|
|
38362
38376
|
}); };
|
|
@@ -38591,10 +38605,19 @@ var IkasPageEditor$1 = dynamic__default['default'](function () { return Promise.
|
|
|
38591
38605
|
var Page$c = function () {
|
|
38592
38606
|
return React.createElement(IkasPageEditor$1, null);
|
|
38593
38607
|
};
|
|
38608
|
+
var getStaticProps$b = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
38609
|
+
return __generator(this, function (_a) {
|
|
38610
|
+
switch (_a.label) {
|
|
38611
|
+
case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, undefined, undefined, true)];
|
|
38612
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
38613
|
+
}
|
|
38614
|
+
});
|
|
38615
|
+
}); };
|
|
38594
38616
|
var editor = mobxReactLite.observer(Page$c);
|
|
38595
38617
|
|
|
38596
38618
|
var editor$1 = /*#__PURE__*/Object.freeze({
|
|
38597
38619
|
__proto__: null,
|
|
38620
|
+
getStaticProps: getStaticProps$b,
|
|
38598
38621
|
'default': editor
|
|
38599
38622
|
});
|
|
38600
38623
|
|
|
@@ -38607,7 +38630,7 @@ var Page$d = function (_a) {
|
|
|
38607
38630
|
}, [propValuesStr]);
|
|
38608
38631
|
return (React.createElement(IkasPage, { settingsStr: settingsStr, page: page, propValues: propValues }));
|
|
38609
38632
|
};
|
|
38610
|
-
var getStaticProps$
|
|
38633
|
+
var getStaticProps$c = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
38611
38634
|
return __generator(this, function (_a) {
|
|
38612
38635
|
switch (_a.label) {
|
|
38613
38636
|
case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.FAVORITE_PRODUCTS)];
|
|
@@ -38619,7 +38642,7 @@ var getStaticProps$b = function (context) { return __awaiter(void 0, void 0, voi
|
|
|
38619
38642
|
var favoriteProducts = /*#__PURE__*/Object.freeze({
|
|
38620
38643
|
__proto__: null,
|
|
38621
38644
|
'default': Page$d,
|
|
38622
|
-
getStaticProps: getStaticProps$
|
|
38645
|
+
getStaticProps: getStaticProps$c
|
|
38623
38646
|
});
|
|
38624
38647
|
|
|
38625
38648
|
var Page$e = function (_a) {
|
|
@@ -38639,7 +38662,7 @@ var Page$e = function (_a) {
|
|
|
38639
38662
|
}, [isBrowser, propValuesStr]);
|
|
38640
38663
|
return (React.createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues, addOgpMetas: true }));
|
|
38641
38664
|
};
|
|
38642
|
-
var getStaticProps$
|
|
38665
|
+
var getStaticProps$d = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
38643
38666
|
return __generator(this, function (_a) {
|
|
38644
38667
|
switch (_a.label) {
|
|
38645
38668
|
case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.SEARCH)];
|
|
@@ -38651,7 +38674,7 @@ var getStaticProps$c = function (context) { return __awaiter(void 0, void 0, voi
|
|
|
38651
38674
|
var search = /*#__PURE__*/Object.freeze({
|
|
38652
38675
|
__proto__: null,
|
|
38653
38676
|
'default': Page$e,
|
|
38654
|
-
getStaticProps: getStaticProps$
|
|
38677
|
+
getStaticProps: getStaticProps$d
|
|
38655
38678
|
});
|
|
38656
38679
|
|
|
38657
38680
|
var Page$f = function (_a) {
|
|
@@ -38665,7 +38688,7 @@ var Page$f = function (_a) {
|
|
|
38665
38688
|
}, [propValuesStr]);
|
|
38666
38689
|
return (React.createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues }));
|
|
38667
38690
|
};
|
|
38668
|
-
var getStaticProps$
|
|
38691
|
+
var getStaticProps$e = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
38669
38692
|
var props;
|
|
38670
38693
|
return __generator(this, function (_a) {
|
|
38671
38694
|
switch (_a.label) {
|
|
@@ -38687,7 +38710,7 @@ var getStaticProps$d = function (context) { return __awaiter(void 0, void 0, voi
|
|
|
38687
38710
|
var _404 = /*#__PURE__*/Object.freeze({
|
|
38688
38711
|
__proto__: null,
|
|
38689
38712
|
'default': Page$f,
|
|
38690
|
-
getStaticProps: getStaticProps$
|
|
38713
|
+
getStaticProps: getStaticProps$e
|
|
38691
38714
|
});
|
|
38692
38715
|
|
|
38693
38716
|
var Page$g = function (_a) {
|
|
@@ -38699,7 +38722,7 @@ var Page$g = function (_a) {
|
|
|
38699
38722
|
}, [propValuesStr]);
|
|
38700
38723
|
return (React.createElement(IkasPage, { merchantSettings: merchantSettings, settingsStr: settingsStr, page: page, propValues: propValues, addOgpMetas: true }));
|
|
38701
38724
|
};
|
|
38702
|
-
var getStaticProps$
|
|
38725
|
+
var getStaticProps$f = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
38703
38726
|
return __generator(this, function (_a) {
|
|
38704
38727
|
switch (_a.label) {
|
|
38705
38728
|
case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, exports.IkasThemePageType.BLOG_INDEX)];
|
|
@@ -38711,7 +38734,7 @@ var getStaticProps$e = function (context) { return __awaiter(void 0, void 0, voi
|
|
|
38711
38734
|
var index$5 = /*#__PURE__*/Object.freeze({
|
|
38712
38735
|
__proto__: null,
|
|
38713
38736
|
'default': Page$g,
|
|
38714
|
-
getStaticProps: getStaticProps$
|
|
38737
|
+
getStaticProps: getStaticProps$f
|
|
38715
38738
|
});
|
|
38716
38739
|
|
|
38717
38740
|
var Page$h = function (_a) {
|
|
@@ -38740,7 +38763,7 @@ var getStaticPaths$2 = function (context) { return __awaiter(void 0, void 0, voi
|
|
|
38740
38763
|
}];
|
|
38741
38764
|
});
|
|
38742
38765
|
}); };
|
|
38743
|
-
var getStaticProps$
|
|
38766
|
+
var getStaticProps$g = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
38744
38767
|
return __generator(this, function (_a) {
|
|
38745
38768
|
switch (_a.label) {
|
|
38746
38769
|
case 0: return [4 /*yield*/, SettingsHelper.getStaticProps(context, undefined, [
|
|
@@ -38756,7 +38779,7 @@ var _slug_$2 = /*#__PURE__*/Object.freeze({
|
|
|
38756
38779
|
__proto__: null,
|
|
38757
38780
|
'default': _slug_$1,
|
|
38758
38781
|
getStaticPaths: getStaticPaths$2,
|
|
38759
|
-
getStaticProps: getStaticProps$
|
|
38782
|
+
getStaticProps: getStaticProps$g
|
|
38760
38783
|
});
|
|
38761
38784
|
|
|
38762
38785
|
/**
|
package/build/pages/editor.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare class SettingsHelper {
|
|
|
12
12
|
static readLocalTheme(): Promise<IkasTheme>;
|
|
13
13
|
static readSettingsFile(): Promise<any>;
|
|
14
14
|
static getSettings(locale: string): Promise<SettingsData | null>;
|
|
15
|
-
static getPageData(context: GetStaticPropsContext<ParsedUrlQuery> | GetServerSidePropsContext<ParsedUrlQuery>, isServer: boolean, pageType?: IkasThemePageType, possiblePageTypes?: IkasThemePageType[]): Promise<{
|
|
15
|
+
static getPageData(context: GetStaticPropsContext<ParsedUrlQuery> | GetServerSidePropsContext<ParsedUrlQuery>, isServer: boolean, pageType?: IkasThemePageType, possiblePageTypes?: IkasThemePageType[], isEditor?: boolean): Promise<{
|
|
16
16
|
props: {};
|
|
17
17
|
notFound: boolean;
|
|
18
18
|
revalidate?: undefined;
|
|
@@ -75,7 +75,7 @@ export declare class SettingsHelper {
|
|
|
75
75
|
revalidate: number;
|
|
76
76
|
notFound?: undefined;
|
|
77
77
|
}>;
|
|
78
|
-
static getStaticProps(context: GetStaticPropsContext<ParsedUrlQuery>, pageType?: IkasThemePageType, possiblePageTypes?: IkasThemePageType[]): Promise<{
|
|
78
|
+
static getStaticProps(context: GetStaticPropsContext<ParsedUrlQuery>, pageType?: IkasThemePageType, possiblePageTypes?: IkasThemePageType[], isEditor?: boolean): Promise<{
|
|
79
79
|
props: {};
|
|
80
80
|
notFound: boolean;
|
|
81
81
|
revalidate?: undefined;
|