@ikas/storefront 0.0.113 → 0.0.115
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 +30 -20
- package/build/index.js +30 -20
- package/package.json +1 -1
package/build/index.es.js
CHANGED
|
@@ -17854,7 +17854,6 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
17854
17854
|
return __generator(this, function (_a) {
|
|
17855
17855
|
switch (_a.label) {
|
|
17856
17856
|
case 0:
|
|
17857
|
-
console.log(IkasStorefrontConfig.paymentGateways);
|
|
17858
17857
|
isLocal = process.env.NEXT_PUBLIC_ENV === "local";
|
|
17859
17858
|
idList = IkasStorefrontConfig.paymentGateways.map(function (pg) { return pg.id; });
|
|
17860
17859
|
return [4 /*yield*/, IkasCheckoutAPI.listPaymentGateway(isLocal ? undefined : idList)];
|
|
@@ -17872,7 +17871,6 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
17872
17871
|
if (_pg)
|
|
17873
17872
|
orderedPaymentGateways.push(_pg);
|
|
17874
17873
|
});
|
|
17875
|
-
console.log(orderedPaymentGateways);
|
|
17876
17874
|
this.paymentGateways = orderedPaymentGateways;
|
|
17877
17875
|
if (!this.paymentGatewayId)
|
|
17878
17876
|
this.setPaymentGateway(0);
|
|
@@ -18116,8 +18114,9 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
18116
18114
|
}); };
|
|
18117
18115
|
this.performPayment = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
18118
18116
|
var response, transactionStatus, err_4;
|
|
18119
|
-
|
|
18120
|
-
|
|
18117
|
+
var _a;
|
|
18118
|
+
return __generator(this, function (_b) {
|
|
18119
|
+
switch (_b.label) {
|
|
18121
18120
|
case 0:
|
|
18122
18121
|
if (!this.useDifferentAddress) {
|
|
18123
18122
|
this.checkout.billingAddress = this.checkout.shippingAddress;
|
|
@@ -18126,20 +18125,23 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
18126
18125
|
this.isErrorsVisible = true;
|
|
18127
18126
|
return [2 /*return*/];
|
|
18128
18127
|
}
|
|
18129
|
-
|
|
18128
|
+
_b.label = 1;
|
|
18130
18129
|
case 1:
|
|
18131
|
-
|
|
18130
|
+
_b.trys.push([1, 5, , 6]);
|
|
18132
18131
|
this.isErrorsVisible = false;
|
|
18133
18132
|
this.isStepLoading = true;
|
|
18134
18133
|
return [4 /*yield*/, this.checkStocks()];
|
|
18135
18134
|
case 2:
|
|
18136
|
-
|
|
18135
|
+
_b.sent();
|
|
18137
18136
|
return [4 /*yield*/, this.saveCheckout()];
|
|
18138
18137
|
case 3:
|
|
18139
|
-
|
|
18140
|
-
return [4 /*yield*/, IkasCheckoutAPI.createSaleTransactionWithCheckout(this.checkout.id, this.paymentGatewayId,
|
|
18138
|
+
_b.sent();
|
|
18139
|
+
return [4 /*yield*/, IkasCheckoutAPI.createSaleTransactionWithCheckout(this.checkout.id, this.paymentGatewayId, ((_a = this.selectedPaymentGateway) === null || _a === void 0 ? void 0 : _a.paymentMethodType) ===
|
|
18140
|
+
IkasPaymentMethodType.CREDIT_CARD && this.cardData
|
|
18141
|
+
? this.cardData.toInput()
|
|
18142
|
+
: undefined)];
|
|
18141
18143
|
case 4:
|
|
18142
|
-
response =
|
|
18144
|
+
response = _b.sent();
|
|
18143
18145
|
transactionStatus = response === null || response === void 0 ? void 0 : response.transactionStatus;
|
|
18144
18146
|
if (transactionStatus &&
|
|
18145
18147
|
[
|
|
@@ -18162,7 +18164,7 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
18162
18164
|
}
|
|
18163
18165
|
return [3 /*break*/, 6];
|
|
18164
18166
|
case 5:
|
|
18165
|
-
err_4 =
|
|
18167
|
+
err_4 = _b.sent();
|
|
18166
18168
|
if (err_4.type) {
|
|
18167
18169
|
console.log(err_4);
|
|
18168
18170
|
this.error = err_4;
|
|
@@ -29015,15 +29017,16 @@ var CheckoutPage = function (_a) {
|
|
|
29015
29017
|
};
|
|
29016
29018
|
var _id_ = observer(CheckoutPage);
|
|
29017
29019
|
var getServerSideProps = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
29018
|
-
var id, locale, settings, storefront, themeLocalization, routing, redirect, checkout, checkoutSettings;
|
|
29019
|
-
|
|
29020
|
-
|
|
29020
|
+
var id, locale, settings, storefront, themeLocalization, salesChannel, routing, redirect, checkout, checkoutSettings;
|
|
29021
|
+
var _a;
|
|
29022
|
+
return __generator(this, function (_b) {
|
|
29023
|
+
switch (_b.label) {
|
|
29021
29024
|
case 0:
|
|
29022
29025
|
id = context.query.id;
|
|
29023
29026
|
locale = context.locale || context.defaultLocale || "en";
|
|
29024
29027
|
return [4 /*yield*/, SettingsHelper.getSettings(locale)];
|
|
29025
29028
|
case 1:
|
|
29026
|
-
settings =
|
|
29029
|
+
settings = _b.sent();
|
|
29027
29030
|
// TODO maybe remove this and convert this page to static
|
|
29028
29031
|
if (!settings ||
|
|
29029
29032
|
!settings.storefront.mainStorefrontThemeId ||
|
|
@@ -29033,11 +29036,17 @@ var getServerSideProps = function (context) { return __awaiter(void 0, void 0, v
|
|
|
29033
29036
|
notFound: true,
|
|
29034
29037
|
}];
|
|
29035
29038
|
}
|
|
29036
|
-
storefront = settings.storefront, themeLocalization = settings.themeLocalization, routing = settings.routing;
|
|
29039
|
+
storefront = settings.storefront, themeLocalization = settings.themeLocalization, salesChannel = settings.salesChannel, routing = settings.routing;
|
|
29037
29040
|
IkasStorefrontConfig.storefrontId = storefront.id;
|
|
29038
29041
|
IkasStorefrontConfig.storefrontRoutingId = routing.id;
|
|
29039
29042
|
IkasStorefrontConfig.storefrontThemeId = storefront.mainStorefrontThemeId;
|
|
29040
29043
|
IkasStorefrontConfig.salesChannelId = storefront.salesChannelId;
|
|
29044
|
+
IkasStorefrontConfig.priceListId = routing.priceListId || undefined;
|
|
29045
|
+
IkasStorefrontConfig.stockLocationIds = (_a = salesChannel.stockLocations) === null || _a === void 0 ? void 0 : _a.map(function (sl) { return sl.id; });
|
|
29046
|
+
IkasStorefrontConfig.routings = storefront.routings;
|
|
29047
|
+
IkasStorefrontConfig.paymentGateways = salesChannel.paymentGateways || [];
|
|
29048
|
+
IkasStorefrontConfig.gtmId = storefront.gtmId || undefined;
|
|
29049
|
+
IkasStorefrontConfig.fbpId = storefront.fbpId || undefined;
|
|
29041
29050
|
redirect = function () {
|
|
29042
29051
|
context.res.writeHead(302, { Location: "/" });
|
|
29043
29052
|
context.res.end();
|
|
@@ -29048,11 +29057,11 @@ var getServerSideProps = function (context) { return __awaiter(void 0, void 0, v
|
|
|
29048
29057
|
}
|
|
29049
29058
|
return [4 /*yield*/, IkasCheckoutAPI.getCheckoutById(id)];
|
|
29050
29059
|
case 2:
|
|
29051
|
-
checkout =
|
|
29060
|
+
checkout = _b.sent();
|
|
29052
29061
|
if (!checkout) return [3 /*break*/, 4];
|
|
29053
29062
|
return [4 /*yield*/, IkasCheckoutAPI.listCheckoutSettings()];
|
|
29054
29063
|
case 3:
|
|
29055
|
-
checkoutSettings =
|
|
29064
|
+
checkoutSettings = _b.sent();
|
|
29056
29065
|
return [2 /*return*/, {
|
|
29057
29066
|
props: {
|
|
29058
29067
|
checkoutStr: JSON.stringify(checkout),
|
|
@@ -29394,7 +29403,7 @@ var IkasBaseStore = /** @class */ (function () {
|
|
|
29394
29403
|
}
|
|
29395
29404
|
IkasBaseStore.prototype.checkLocalization = function () {
|
|
29396
29405
|
return __awaiter(this, void 0, void 0, function () {
|
|
29397
|
-
var myCountryCode, currentRouting, correctRouting, isCorrectLocale, hasNoSpecificCountry, countries_1, localeOptions_1;
|
|
29406
|
+
var myCountryCode, currentRouting, otherCountriesRouting, correctRouting, isCorrectLocale, hasNoSpecificCountry, countries_1, localeOptions_1;
|
|
29398
29407
|
return __generator(this, function (_a) {
|
|
29399
29408
|
switch (_a.label) {
|
|
29400
29409
|
case 0:
|
|
@@ -29409,7 +29418,8 @@ var IkasBaseStore = /** @class */ (function () {
|
|
|
29409
29418
|
myCountryCode = _a.sent();
|
|
29410
29419
|
currentRouting = IkasStorefrontConfig.routings.find(function (r) { return r.id === IkasStorefrontConfig.storefrontRoutingId; });
|
|
29411
29420
|
if (!(currentRouting && myCountryCode)) return [3 /*break*/, 3];
|
|
29412
|
-
|
|
29421
|
+
otherCountriesRouting = IkasStorefrontConfig.routings.find(function (r) { var _a; return !((_a = r.countryCodes) === null || _a === void 0 ? void 0 : _a.length); });
|
|
29422
|
+
correctRouting = IkasStorefrontConfig.routings.find(function (r) { var _a; return (_a = r.countryCodes) === null || _a === void 0 ? void 0 : _a.includes(myCountryCode); }) || otherCountriesRouting;
|
|
29413
29423
|
isCorrectLocale = IkasStorefrontConfig.storefrontRoutingId === (correctRouting === null || correctRouting === void 0 ? void 0 : correctRouting.id);
|
|
29414
29424
|
if (!isCorrectLocale) {
|
|
29415
29425
|
hasNoSpecificCountry = IkasStorefrontConfig.routings.length === 0 ||
|
package/build/index.js
CHANGED
|
@@ -17860,7 +17860,6 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
17860
17860
|
return __generator(this, function (_a) {
|
|
17861
17861
|
switch (_a.label) {
|
|
17862
17862
|
case 0:
|
|
17863
|
-
console.log(IkasStorefrontConfig.paymentGateways);
|
|
17864
17863
|
isLocal = process.env.NEXT_PUBLIC_ENV === "local";
|
|
17865
17864
|
idList = IkasStorefrontConfig.paymentGateways.map(function (pg) { return pg.id; });
|
|
17866
17865
|
return [4 /*yield*/, IkasCheckoutAPI.listPaymentGateway(isLocal ? undefined : idList)];
|
|
@@ -17878,7 +17877,6 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
17878
17877
|
if (_pg)
|
|
17879
17878
|
orderedPaymentGateways.push(_pg);
|
|
17880
17879
|
});
|
|
17881
|
-
console.log(orderedPaymentGateways);
|
|
17882
17880
|
this.paymentGateways = orderedPaymentGateways;
|
|
17883
17881
|
if (!this.paymentGatewayId)
|
|
17884
17882
|
this.setPaymentGateway(0);
|
|
@@ -18122,8 +18120,9 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
18122
18120
|
}); };
|
|
18123
18121
|
this.performPayment = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
18124
18122
|
var response, transactionStatus, err_4;
|
|
18125
|
-
|
|
18126
|
-
|
|
18123
|
+
var _a;
|
|
18124
|
+
return __generator(this, function (_b) {
|
|
18125
|
+
switch (_b.label) {
|
|
18127
18126
|
case 0:
|
|
18128
18127
|
if (!this.useDifferentAddress) {
|
|
18129
18128
|
this.checkout.billingAddress = this.checkout.shippingAddress;
|
|
@@ -18132,20 +18131,23 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
18132
18131
|
this.isErrorsVisible = true;
|
|
18133
18132
|
return [2 /*return*/];
|
|
18134
18133
|
}
|
|
18135
|
-
|
|
18134
|
+
_b.label = 1;
|
|
18136
18135
|
case 1:
|
|
18137
|
-
|
|
18136
|
+
_b.trys.push([1, 5, , 6]);
|
|
18138
18137
|
this.isErrorsVisible = false;
|
|
18139
18138
|
this.isStepLoading = true;
|
|
18140
18139
|
return [4 /*yield*/, this.checkStocks()];
|
|
18141
18140
|
case 2:
|
|
18142
|
-
|
|
18141
|
+
_b.sent();
|
|
18143
18142
|
return [4 /*yield*/, this.saveCheckout()];
|
|
18144
18143
|
case 3:
|
|
18145
|
-
|
|
18146
|
-
return [4 /*yield*/, IkasCheckoutAPI.createSaleTransactionWithCheckout(this.checkout.id, this.paymentGatewayId,
|
|
18144
|
+
_b.sent();
|
|
18145
|
+
return [4 /*yield*/, IkasCheckoutAPI.createSaleTransactionWithCheckout(this.checkout.id, this.paymentGatewayId, ((_a = this.selectedPaymentGateway) === null || _a === void 0 ? void 0 : _a.paymentMethodType) ===
|
|
18146
|
+
IkasPaymentMethodType.CREDIT_CARD && this.cardData
|
|
18147
|
+
? this.cardData.toInput()
|
|
18148
|
+
: undefined)];
|
|
18147
18149
|
case 4:
|
|
18148
|
-
response =
|
|
18150
|
+
response = _b.sent();
|
|
18149
18151
|
transactionStatus = response === null || response === void 0 ? void 0 : response.transactionStatus;
|
|
18150
18152
|
if (transactionStatus &&
|
|
18151
18153
|
[
|
|
@@ -18168,7 +18170,7 @@ var CheckoutViewModel = /** @class */ (function () {
|
|
|
18168
18170
|
}
|
|
18169
18171
|
return [3 /*break*/, 6];
|
|
18170
18172
|
case 5:
|
|
18171
|
-
err_4 =
|
|
18173
|
+
err_4 = _b.sent();
|
|
18172
18174
|
if (err_4.type) {
|
|
18173
18175
|
console.log(err_4);
|
|
18174
18176
|
this.error = err_4;
|
|
@@ -28995,15 +28997,16 @@ var CheckoutPage = function (_a) {
|
|
|
28995
28997
|
};
|
|
28996
28998
|
var _id_ = mobxReactLite.observer(CheckoutPage);
|
|
28997
28999
|
var getServerSideProps = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
28998
|
-
var id, locale, settings, storefront, themeLocalization, routing, redirect, checkout, checkoutSettings;
|
|
28999
|
-
|
|
29000
|
-
|
|
29000
|
+
var id, locale, settings, storefront, themeLocalization, salesChannel, routing, redirect, checkout, checkoutSettings;
|
|
29001
|
+
var _a;
|
|
29002
|
+
return __generator(this, function (_b) {
|
|
29003
|
+
switch (_b.label) {
|
|
29001
29004
|
case 0:
|
|
29002
29005
|
id = context.query.id;
|
|
29003
29006
|
locale = context.locale || context.defaultLocale || "en";
|
|
29004
29007
|
return [4 /*yield*/, SettingsHelper.getSettings(locale)];
|
|
29005
29008
|
case 1:
|
|
29006
|
-
settings =
|
|
29009
|
+
settings = _b.sent();
|
|
29007
29010
|
// TODO maybe remove this and convert this page to static
|
|
29008
29011
|
if (!settings ||
|
|
29009
29012
|
!settings.storefront.mainStorefrontThemeId ||
|
|
@@ -29013,11 +29016,17 @@ var getServerSideProps = function (context) { return __awaiter(void 0, void 0, v
|
|
|
29013
29016
|
notFound: true,
|
|
29014
29017
|
}];
|
|
29015
29018
|
}
|
|
29016
|
-
storefront = settings.storefront, themeLocalization = settings.themeLocalization, routing = settings.routing;
|
|
29019
|
+
storefront = settings.storefront, themeLocalization = settings.themeLocalization, salesChannel = settings.salesChannel, routing = settings.routing;
|
|
29017
29020
|
IkasStorefrontConfig.storefrontId = storefront.id;
|
|
29018
29021
|
IkasStorefrontConfig.storefrontRoutingId = routing.id;
|
|
29019
29022
|
IkasStorefrontConfig.storefrontThemeId = storefront.mainStorefrontThemeId;
|
|
29020
29023
|
IkasStorefrontConfig.salesChannelId = storefront.salesChannelId;
|
|
29024
|
+
IkasStorefrontConfig.priceListId = routing.priceListId || undefined;
|
|
29025
|
+
IkasStorefrontConfig.stockLocationIds = (_a = salesChannel.stockLocations) === null || _a === void 0 ? void 0 : _a.map(function (sl) { return sl.id; });
|
|
29026
|
+
IkasStorefrontConfig.routings = storefront.routings;
|
|
29027
|
+
IkasStorefrontConfig.paymentGateways = salesChannel.paymentGateways || [];
|
|
29028
|
+
IkasStorefrontConfig.gtmId = storefront.gtmId || undefined;
|
|
29029
|
+
IkasStorefrontConfig.fbpId = storefront.fbpId || undefined;
|
|
29021
29030
|
redirect = function () {
|
|
29022
29031
|
context.res.writeHead(302, { Location: "/" });
|
|
29023
29032
|
context.res.end();
|
|
@@ -29028,11 +29037,11 @@ var getServerSideProps = function (context) { return __awaiter(void 0, void 0, v
|
|
|
29028
29037
|
}
|
|
29029
29038
|
return [4 /*yield*/, IkasCheckoutAPI.getCheckoutById(id)];
|
|
29030
29039
|
case 2:
|
|
29031
|
-
checkout =
|
|
29040
|
+
checkout = _b.sent();
|
|
29032
29041
|
if (!checkout) return [3 /*break*/, 4];
|
|
29033
29042
|
return [4 /*yield*/, IkasCheckoutAPI.listCheckoutSettings()];
|
|
29034
29043
|
case 3:
|
|
29035
|
-
checkoutSettings =
|
|
29044
|
+
checkoutSettings = _b.sent();
|
|
29036
29045
|
return [2 /*return*/, {
|
|
29037
29046
|
props: {
|
|
29038
29047
|
checkoutStr: JSON.stringify(checkout),
|
|
@@ -29374,7 +29383,7 @@ var IkasBaseStore = /** @class */ (function () {
|
|
|
29374
29383
|
}
|
|
29375
29384
|
IkasBaseStore.prototype.checkLocalization = function () {
|
|
29376
29385
|
return __awaiter(this, void 0, void 0, function () {
|
|
29377
|
-
var myCountryCode, currentRouting, correctRouting, isCorrectLocale, hasNoSpecificCountry, countries_1, localeOptions_1;
|
|
29386
|
+
var myCountryCode, currentRouting, otherCountriesRouting, correctRouting, isCorrectLocale, hasNoSpecificCountry, countries_1, localeOptions_1;
|
|
29378
29387
|
return __generator(this, function (_a) {
|
|
29379
29388
|
switch (_a.label) {
|
|
29380
29389
|
case 0:
|
|
@@ -29389,7 +29398,8 @@ var IkasBaseStore = /** @class */ (function () {
|
|
|
29389
29398
|
myCountryCode = _a.sent();
|
|
29390
29399
|
currentRouting = IkasStorefrontConfig.routings.find(function (r) { return r.id === IkasStorefrontConfig.storefrontRoutingId; });
|
|
29391
29400
|
if (!(currentRouting && myCountryCode)) return [3 /*break*/, 3];
|
|
29392
|
-
|
|
29401
|
+
otherCountriesRouting = IkasStorefrontConfig.routings.find(function (r) { var _a; return !((_a = r.countryCodes) === null || _a === void 0 ? void 0 : _a.length); });
|
|
29402
|
+
correctRouting = IkasStorefrontConfig.routings.find(function (r) { var _a; return (_a = r.countryCodes) === null || _a === void 0 ? void 0 : _a.includes(myCountryCode); }) || otherCountriesRouting;
|
|
29393
29403
|
isCorrectLocale = IkasStorefrontConfig.storefrontRoutingId === (correctRouting === null || correctRouting === void 0 ? void 0 : correctRouting.id);
|
|
29394
29404
|
if (!isCorrectLocale) {
|
|
29395
29405
|
hasNoSpecificCountry = IkasStorefrontConfig.routings.length === 0 ||
|