@ikas/storefront 0.0.161-alpha.15 → 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 -23
- package/build/index.js +32 -23
- package/package.json +1 -1
package/build/index.es.js
CHANGED
|
@@ -38052,7 +38052,6 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
38052
38052
|
nextI18nConf = serverRuntimeConfig.nextI18nConf;
|
|
38053
38053
|
routingLocales = uniq_1(storefront.routings.map(function (sr) { return sr.locale; }));
|
|
38054
38054
|
defaultRoutingLocale = routing.locale;
|
|
38055
|
-
console.log(isLocal, nextI18nConf);
|
|
38056
38055
|
if (!isServer) return [3 /*break*/, 4];
|
|
38057
38056
|
_d = {};
|
|
38058
38057
|
_b = [{}];
|
|
@@ -38322,16 +38321,17 @@ var CheckoutPage = function (_a) {
|
|
|
38322
38321
|
};
|
|
38323
38322
|
var _id_ = observer(CheckoutPage);
|
|
38324
38323
|
var getServerSideProps = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
38325
|
-
var id, locale, settings, storefront, themeLocalization, salesChannel, routing, redirect, checkout, checkoutSettings;
|
|
38326
|
-
var
|
|
38327
|
-
|
|
38328
|
-
|
|
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) {
|
|
38329
38329
|
case 0:
|
|
38330
38330
|
id = context.query.id;
|
|
38331
38331
|
locale = context.locale || context.defaultLocale || "en";
|
|
38332
38332
|
return [4 /*yield*/, SettingsHelper.getSettings(locale)];
|
|
38333
38333
|
case 1:
|
|
38334
|
-
settings =
|
|
38334
|
+
settings = _d.sent();
|
|
38335
38335
|
// TODO maybe remove this and convert this page to static
|
|
38336
38336
|
if (!settings ||
|
|
38337
38337
|
!settings.storefront.mainStorefrontThemeId ||
|
|
@@ -38347,7 +38347,7 @@ var getServerSideProps = function (context) { return __awaiter(void 0, void 0, v
|
|
|
38347
38347
|
IkasStorefrontConfig.storefrontThemeId = storefront.mainStorefrontThemeId;
|
|
38348
38348
|
IkasStorefrontConfig.salesChannelId = storefront.salesChannelId;
|
|
38349
38349
|
IkasStorefrontConfig.priceListId = routing.priceListId || undefined;
|
|
38350
|
-
IkasStorefrontConfig.stockLocationIds = (
|
|
38350
|
+
IkasStorefrontConfig.stockLocationIds = (_c = salesChannel.stockLocations) === null || _c === void 0 ? void 0 : _c.map(function (sl) { return sl.id; });
|
|
38351
38351
|
IkasStorefrontConfig.routings = storefront.routings;
|
|
38352
38352
|
IkasStorefrontConfig.paymentGateways = salesChannel.paymentGateways || [];
|
|
38353
38353
|
IkasStorefrontConfig.gtmId = storefront.gtmId || undefined;
|
|
@@ -38363,24 +38363,33 @@ var getServerSideProps = function (context) { return __awaiter(void 0, void 0, v
|
|
|
38363
38363
|
}
|
|
38364
38364
|
return [4 /*yield*/, IkasCheckoutAPI.getCheckoutById(id)];
|
|
38365
38365
|
case 2:
|
|
38366
|
-
checkout =
|
|
38367
|
-
if (!checkout) return [3 /*break*/,
|
|
38366
|
+
checkout = _d.sent();
|
|
38367
|
+
if (!checkout) return [3 /*break*/, 5];
|
|
38368
38368
|
return [4 /*yield*/, IkasCheckoutAPI.listCheckoutSettings()];
|
|
38369
38369
|
case 3:
|
|
38370
|
-
checkoutSettings =
|
|
38371
|
-
|
|
38372
|
-
|
|
38373
|
-
|
|
38374
|
-
|
|
38375
|
-
|
|
38376
|
-
|
|
38377
|
-
|
|
38378
|
-
|
|
38379
|
-
|
|
38380
|
-
|
|
38381
|
-
|
|
38382
|
-
|
|
38383
|
-
|
|
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()];
|
|
38384
38393
|
}
|
|
38385
38394
|
});
|
|
38386
38395
|
}); };
|
package/build/index.js
CHANGED
|
@@ -38029,7 +38029,6 @@ var SettingsHelper = /** @class */ (function () {
|
|
|
38029
38029
|
nextI18nConf = serverRuntimeConfig.nextI18nConf;
|
|
38030
38030
|
routingLocales = uniq_1(storefront.routings.map(function (sr) { return sr.locale; }));
|
|
38031
38031
|
defaultRoutingLocale = routing.locale;
|
|
38032
|
-
console.log(isLocal, nextI18nConf);
|
|
38033
38032
|
if (!isServer) return [3 /*break*/, 4];
|
|
38034
38033
|
_d = {};
|
|
38035
38034
|
_b = [{}];
|
|
@@ -38299,16 +38298,17 @@ var CheckoutPage = function (_a) {
|
|
|
38299
38298
|
};
|
|
38300
38299
|
var _id_ = mobxReactLite.observer(CheckoutPage);
|
|
38301
38300
|
var getServerSideProps = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
38302
|
-
var id, locale, settings, storefront, themeLocalization, salesChannel, routing, redirect, checkout, checkoutSettings;
|
|
38303
|
-
var
|
|
38304
|
-
|
|
38305
|
-
|
|
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) {
|
|
38306
38306
|
case 0:
|
|
38307
38307
|
id = context.query.id;
|
|
38308
38308
|
locale = context.locale || context.defaultLocale || "en";
|
|
38309
38309
|
return [4 /*yield*/, SettingsHelper.getSettings(locale)];
|
|
38310
38310
|
case 1:
|
|
38311
|
-
settings =
|
|
38311
|
+
settings = _d.sent();
|
|
38312
38312
|
// TODO maybe remove this and convert this page to static
|
|
38313
38313
|
if (!settings ||
|
|
38314
38314
|
!settings.storefront.mainStorefrontThemeId ||
|
|
@@ -38324,7 +38324,7 @@ var getServerSideProps = function (context) { return __awaiter(void 0, void 0, v
|
|
|
38324
38324
|
IkasStorefrontConfig.storefrontThemeId = storefront.mainStorefrontThemeId;
|
|
38325
38325
|
IkasStorefrontConfig.salesChannelId = storefront.salesChannelId;
|
|
38326
38326
|
IkasStorefrontConfig.priceListId = routing.priceListId || undefined;
|
|
38327
|
-
IkasStorefrontConfig.stockLocationIds = (
|
|
38327
|
+
IkasStorefrontConfig.stockLocationIds = (_c = salesChannel.stockLocations) === null || _c === void 0 ? void 0 : _c.map(function (sl) { return sl.id; });
|
|
38328
38328
|
IkasStorefrontConfig.routings = storefront.routings;
|
|
38329
38329
|
IkasStorefrontConfig.paymentGateways = salesChannel.paymentGateways || [];
|
|
38330
38330
|
IkasStorefrontConfig.gtmId = storefront.gtmId || undefined;
|
|
@@ -38340,24 +38340,33 @@ var getServerSideProps = function (context) { return __awaiter(void 0, void 0, v
|
|
|
38340
38340
|
}
|
|
38341
38341
|
return [4 /*yield*/, IkasCheckoutAPI.getCheckoutById(id)];
|
|
38342
38342
|
case 2:
|
|
38343
|
-
checkout =
|
|
38344
|
-
if (!checkout) return [3 /*break*/,
|
|
38343
|
+
checkout = _d.sent();
|
|
38344
|
+
if (!checkout) return [3 /*break*/, 5];
|
|
38345
38345
|
return [4 /*yield*/, IkasCheckoutAPI.listCheckoutSettings()];
|
|
38346
38346
|
case 3:
|
|
38347
|
-
checkoutSettings =
|
|
38348
|
-
|
|
38349
|
-
|
|
38350
|
-
|
|
38351
|
-
|
|
38352
|
-
|
|
38353
|
-
|
|
38354
|
-
|
|
38355
|
-
|
|
38356
|
-
|
|
38357
|
-
|
|
38358
|
-
|
|
38359
|
-
|
|
38360
|
-
|
|
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()];
|
|
38361
38370
|
}
|
|
38362
38371
|
});
|
|
38363
38372
|
}); };
|