@ikas/storefront 0.0.161-alpha.16 → 0.0.161-alpha.17
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 +32 -22
- package/build/index.js +32 -22
- package/package.json +1 -1
package/build/index.es.js
CHANGED
|
@@ -38321,16 +38321,17 @@ var CheckoutPage = function (_a) {
|
|
|
38321
38321
|
};
|
|
38322
38322
|
var _id_ = observer(CheckoutPage);
|
|
38323
38323
|
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
|
-
|
|
38324
|
+
var id, locale, settings, storefront, themeLocalization, salesChannel, routing, redirect, checkout, checkoutSettings, componentDirs, isLocal, serverRuntimeConfig, routingLocales, defaultRoutingLocale, nextI18nConf, _a;
|
|
38325
|
+
var _b;
|
|
38326
|
+
var _c;
|
|
38327
|
+
return __generator(this, function (_d) {
|
|
38328
|
+
switch (_d.label) {
|
|
38328
38329
|
case 0:
|
|
38329
38330
|
id = context.query.id;
|
|
38330
38331
|
locale = context.locale || context.defaultLocale || "en";
|
|
38331
38332
|
return [4 /*yield*/, SettingsHelper.getSettings(locale)];
|
|
38332
38333
|
case 1:
|
|
38333
|
-
settings =
|
|
38334
|
+
settings = _d.sent();
|
|
38334
38335
|
// TODO maybe remove this and convert this page to static
|
|
38335
38336
|
if (!settings ||
|
|
38336
38337
|
!settings.storefront.mainStorefrontThemeId ||
|
|
@@ -38346,7 +38347,7 @@ var getServerSideProps = function (context) { return __awaiter(void 0, void 0, v
|
|
|
38346
38347
|
IkasStorefrontConfig.storefrontThemeId = storefront.mainStorefrontThemeId;
|
|
38347
38348
|
IkasStorefrontConfig.salesChannelId = storefront.salesChannelId;
|
|
38348
38349
|
IkasStorefrontConfig.priceListId = routing.priceListId || undefined;
|
|
38349
|
-
IkasStorefrontConfig.stockLocationIds = (
|
|
38350
|
+
IkasStorefrontConfig.stockLocationIds = (_c = salesChannel.stockLocations) === null || _c === void 0 ? void 0 : _c.map(function (sl) { return sl.id; });
|
|
38350
38351
|
IkasStorefrontConfig.routings = storefront.routings;
|
|
38351
38352
|
IkasStorefrontConfig.paymentGateways = salesChannel.paymentGateways || [];
|
|
38352
38353
|
IkasStorefrontConfig.gtmId = storefront.gtmId || undefined;
|
|
@@ -38362,24 +38363,33 @@ var getServerSideProps = function (context) { return __awaiter(void 0, void 0, v
|
|
|
38362
38363
|
}
|
|
38363
38364
|
return [4 /*yield*/, IkasCheckoutAPI.getCheckoutById(id)];
|
|
38364
38365
|
case 2:
|
|
38365
|
-
checkout =
|
|
38366
|
-
if (!checkout) return [3 /*break*/,
|
|
38366
|
+
checkout = _d.sent();
|
|
38367
|
+
if (!checkout) return [3 /*break*/, 5];
|
|
38367
38368
|
return [4 /*yield*/, IkasCheckoutAPI.listCheckoutSettings()];
|
|
38368
38369
|
case 3:
|
|
38369
|
-
checkoutSettings =
|
|
38370
|
-
|
|
38371
|
-
|
|
38372
|
-
|
|
38373
|
-
|
|
38374
|
-
|
|
38375
|
-
|
|
38376
|
-
|
|
38377
|
-
|
|
38378
|
-
|
|
38379
|
-
|
|
38380
|
-
|
|
38381
|
-
|
|
38382
|
-
|
|
38370
|
+
checkoutSettings = _d.sent();
|
|
38371
|
+
componentDirs = ["common", "checkout-page"];
|
|
38372
|
+
isLocal = process.env.NEXT_PUBLIC_ENV === "local";
|
|
38373
|
+
serverRuntimeConfig = getConfig().serverRuntimeConfig;
|
|
38374
|
+
routingLocales = uniq_1(storefront.routings.map(function (sr) { return sr.locale; }));
|
|
38375
|
+
defaultRoutingLocale = routing.locale;
|
|
38376
|
+
nextI18nConf = serverRuntimeConfig.nextI18nConf;
|
|
38377
|
+
_b = {};
|
|
38378
|
+
_a = [{}];
|
|
38379
|
+
return [4 /*yield*/, serverSideTranslations(routing.locale, componentDirs, isLocal
|
|
38380
|
+
? undefined
|
|
38381
|
+
: {
|
|
38382
|
+
i18n: {
|
|
38383
|
+
locales: routingLocales,
|
|
38384
|
+
defaultLocale: defaultRoutingLocale,
|
|
38385
|
+
},
|
|
38386
|
+
serializeConfig: false,
|
|
38387
|
+
localePath: nextI18nConf.localePath,
|
|
38388
|
+
})];
|
|
38389
|
+
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])
|
|
38390
|
+
: null, configJson: IkasStorefrontConfig.getJson(), returnPolicy: themeLocalization.returnPolicy || "", privacyPolicy: themeLocalization.privacyPolicy || "", termsOfService: themeLocalization.termsOfService || "", queryParams: context.query }]),
|
|
38391
|
+
_b)];
|
|
38392
|
+
case 5: return [2 /*return*/, redirect()];
|
|
38383
38393
|
}
|
|
38384
38394
|
});
|
|
38385
38395
|
}); };
|
package/build/index.js
CHANGED
|
@@ -38298,16 +38298,17 @@ var CheckoutPage = function (_a) {
|
|
|
38298
38298
|
};
|
|
38299
38299
|
var _id_ = mobxReactLite.observer(CheckoutPage);
|
|
38300
38300
|
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
|
-
|
|
38301
|
+
var id, locale, settings, storefront, themeLocalization, salesChannel, routing, redirect, checkout, checkoutSettings, componentDirs, isLocal, serverRuntimeConfig, routingLocales, defaultRoutingLocale, nextI18nConf, _a;
|
|
38302
|
+
var _b;
|
|
38303
|
+
var _c;
|
|
38304
|
+
return __generator(this, function (_d) {
|
|
38305
|
+
switch (_d.label) {
|
|
38305
38306
|
case 0:
|
|
38306
38307
|
id = context.query.id;
|
|
38307
38308
|
locale = context.locale || context.defaultLocale || "en";
|
|
38308
38309
|
return [4 /*yield*/, SettingsHelper.getSettings(locale)];
|
|
38309
38310
|
case 1:
|
|
38310
|
-
settings =
|
|
38311
|
+
settings = _d.sent();
|
|
38311
38312
|
// TODO maybe remove this and convert this page to static
|
|
38312
38313
|
if (!settings ||
|
|
38313
38314
|
!settings.storefront.mainStorefrontThemeId ||
|
|
@@ -38323,7 +38324,7 @@ var getServerSideProps = function (context) { return __awaiter(void 0, void 0, v
|
|
|
38323
38324
|
IkasStorefrontConfig.storefrontThemeId = storefront.mainStorefrontThemeId;
|
|
38324
38325
|
IkasStorefrontConfig.salesChannelId = storefront.salesChannelId;
|
|
38325
38326
|
IkasStorefrontConfig.priceListId = routing.priceListId || undefined;
|
|
38326
|
-
IkasStorefrontConfig.stockLocationIds = (
|
|
38327
|
+
IkasStorefrontConfig.stockLocationIds = (_c = salesChannel.stockLocations) === null || _c === void 0 ? void 0 : _c.map(function (sl) { return sl.id; });
|
|
38327
38328
|
IkasStorefrontConfig.routings = storefront.routings;
|
|
38328
38329
|
IkasStorefrontConfig.paymentGateways = salesChannel.paymentGateways || [];
|
|
38329
38330
|
IkasStorefrontConfig.gtmId = storefront.gtmId || undefined;
|
|
@@ -38339,24 +38340,33 @@ var getServerSideProps = function (context) { return __awaiter(void 0, void 0, v
|
|
|
38339
38340
|
}
|
|
38340
38341
|
return [4 /*yield*/, IkasCheckoutAPI.getCheckoutById(id)];
|
|
38341
38342
|
case 2:
|
|
38342
|
-
checkout =
|
|
38343
|
-
if (!checkout) return [3 /*break*/,
|
|
38343
|
+
checkout = _d.sent();
|
|
38344
|
+
if (!checkout) return [3 /*break*/, 5];
|
|
38344
38345
|
return [4 /*yield*/, IkasCheckoutAPI.listCheckoutSettings()];
|
|
38345
38346
|
case 3:
|
|
38346
|
-
checkoutSettings =
|
|
38347
|
-
|
|
38348
|
-
|
|
38349
|
-
|
|
38350
|
-
|
|
38351
|
-
|
|
38352
|
-
|
|
38353
|
-
|
|
38354
|
-
|
|
38355
|
-
|
|
38356
|
-
|
|
38357
|
-
|
|
38358
|
-
|
|
38359
|
-
|
|
38347
|
+
checkoutSettings = _d.sent();
|
|
38348
|
+
componentDirs = ["common", "checkout-page"];
|
|
38349
|
+
isLocal = process.env.NEXT_PUBLIC_ENV === "local";
|
|
38350
|
+
serverRuntimeConfig = getConfig__default['default']().serverRuntimeConfig;
|
|
38351
|
+
routingLocales = uniq_1(storefront.routings.map(function (sr) { return sr.locale; }));
|
|
38352
|
+
defaultRoutingLocale = routing.locale;
|
|
38353
|
+
nextI18nConf = serverRuntimeConfig.nextI18nConf;
|
|
38354
|
+
_b = {};
|
|
38355
|
+
_a = [{}];
|
|
38356
|
+
return [4 /*yield*/, serverSideTranslations.serverSideTranslations(routing.locale, componentDirs, isLocal
|
|
38357
|
+
? undefined
|
|
38358
|
+
: {
|
|
38359
|
+
i18n: {
|
|
38360
|
+
locales: routingLocales,
|
|
38361
|
+
defaultLocale: defaultRoutingLocale,
|
|
38362
|
+
},
|
|
38363
|
+
serializeConfig: false,
|
|
38364
|
+
localePath: nextI18nConf.localePath,
|
|
38365
|
+
})];
|
|
38366
|
+
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])
|
|
38367
|
+
: null, configJson: IkasStorefrontConfig.getJson(), returnPolicy: themeLocalization.returnPolicy || "", privacyPolicy: themeLocalization.privacyPolicy || "", termsOfService: themeLocalization.termsOfService || "", queryParams: context.query }]),
|
|
38368
|
+
_b)];
|
|
38369
|
+
case 5: return [2 /*return*/, redirect()];
|
|
38360
38370
|
}
|
|
38361
38371
|
});
|
|
38362
38372
|
}); };
|