@ikas/storefront 0.0.114 → 0.0.116

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 CHANGED
@@ -18114,8 +18114,9 @@ var CheckoutViewModel = /** @class */ (function () {
18114
18114
  }); };
18115
18115
  this.performPayment = function () { return __awaiter(_this, void 0, void 0, function () {
18116
18116
  var response, transactionStatus, err_4;
18117
- return __generator(this, function (_a) {
18118
- switch (_a.label) {
18117
+ var _a;
18118
+ return __generator(this, function (_b) {
18119
+ switch (_b.label) {
18119
18120
  case 0:
18120
18121
  if (!this.useDifferentAddress) {
18121
18122
  this.checkout.billingAddress = this.checkout.shippingAddress;
@@ -18124,20 +18125,23 @@ var CheckoutViewModel = /** @class */ (function () {
18124
18125
  this.isErrorsVisible = true;
18125
18126
  return [2 /*return*/];
18126
18127
  }
18127
- _a.label = 1;
18128
+ _b.label = 1;
18128
18129
  case 1:
18129
- _a.trys.push([1, 5, , 6]);
18130
+ _b.trys.push([1, 5, , 6]);
18130
18131
  this.isErrorsVisible = false;
18131
18132
  this.isStepLoading = true;
18132
18133
  return [4 /*yield*/, this.checkStocks()];
18133
18134
  case 2:
18134
- _a.sent();
18135
+ _b.sent();
18135
18136
  return [4 /*yield*/, this.saveCheckout()];
18136
18137
  case 3:
18137
- _a.sent();
18138
- return [4 /*yield*/, IkasCheckoutAPI.createSaleTransactionWithCheckout(this.checkout.id, this.paymentGatewayId, this.cardData ? this.cardData.toInput() : undefined)];
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)];
18139
18143
  case 4:
18140
- response = _a.sent();
18144
+ response = _b.sent();
18141
18145
  transactionStatus = response === null || response === void 0 ? void 0 : response.transactionStatus;
18142
18146
  if (transactionStatus &&
18143
18147
  [
@@ -18160,7 +18164,7 @@ var CheckoutViewModel = /** @class */ (function () {
18160
18164
  }
18161
18165
  return [3 /*break*/, 6];
18162
18166
  case 5:
18163
- err_4 = _a.sent();
18167
+ err_4 = _b.sent();
18164
18168
  if (err_4.type) {
18165
18169
  console.log(err_4);
18166
18170
  this.error = err_4;
@@ -29399,7 +29403,7 @@ var IkasBaseStore = /** @class */ (function () {
29399
29403
  }
29400
29404
  IkasBaseStore.prototype.checkLocalization = function () {
29401
29405
  return __awaiter(this, void 0, void 0, function () {
29402
- var myCountryCode, currentRouting, correctRouting, isCorrectLocale, hasNoSpecificCountry, countries_1, localeOptions_1;
29406
+ var myCountryCode, currentRouting, isCorrectLocale, myCountryRouting, otherCountriesRouting, countries_1, localeOptions_1;
29403
29407
  return __generator(this, function (_a) {
29404
29408
  switch (_a.label) {
29405
29409
  case 0:
@@ -29414,13 +29418,21 @@ var IkasBaseStore = /** @class */ (function () {
29414
29418
  myCountryCode = _a.sent();
29415
29419
  currentRouting = IkasStorefrontConfig.routings.find(function (r) { return r.id === IkasStorefrontConfig.storefrontRoutingId; });
29416
29420
  if (!(currentRouting && myCountryCode)) return [3 /*break*/, 3];
29417
- correctRouting = IkasStorefrontConfig.routings.find(function (r) { var _a; return (_a = r.countryCodes) === null || _a === void 0 ? void 0 : _a.includes(myCountryCode); });
29418
- isCorrectLocale = IkasStorefrontConfig.storefrontRoutingId === (correctRouting === null || correctRouting === void 0 ? void 0 : correctRouting.id);
29419
- if (!isCorrectLocale) {
29420
- hasNoSpecificCountry = IkasStorefrontConfig.routings.length === 0 ||
29421
- IkasStorefrontConfig.routings.every(function (r) { var _a; return !((_a = r.countryCodes) === null || _a === void 0 ? void 0 : _a.length); });
29422
- if (hasNoSpecificCountry)
29423
- isCorrectLocale = true;
29421
+ isCorrectLocale = true;
29422
+ myCountryRouting = IkasStorefrontConfig.routings.find(function (r) { var _a; return (_a = r.countryCodes) === null || _a === void 0 ? void 0 : _a.includes(myCountryCode); });
29423
+ otherCountriesRouting = IkasStorefrontConfig.routings.find(function (r) { var _a; return !((_a = r.countryCodes) === null || _a === void 0 ? void 0 : _a.length); });
29424
+ // Current country has spefic routing
29425
+ if (myCountryRouting) {
29426
+ if (currentRouting.id !== myCountryRouting.id) {
29427
+ isCorrectLocale = false;
29428
+ }
29429
+ }
29430
+ // Current country does not have specific routing
29431
+ else {
29432
+ if (otherCountriesRouting &&
29433
+ currentRouting.id !== otherCountriesRouting.id) {
29434
+ isCorrectLocale = false;
29435
+ }
29424
29436
  }
29425
29437
  return [4 /*yield*/, IkasCountryAPI.listCountries()];
29426
29438
  case 2:
@@ -29448,7 +29460,7 @@ var IkasBaseStore = /** @class */ (function () {
29448
29460
  });
29449
29461
  }
29450
29462
  });
29451
- this.localeOptions = localeOptions_1;
29463
+ this.localeOptions = sortBy_1(localeOptions_1, "countryName");
29452
29464
  if (!isCorrectLocale) {
29453
29465
  this.showLocaleOptions = true;
29454
29466
  }
package/build/index.js CHANGED
@@ -18120,8 +18120,9 @@ var CheckoutViewModel = /** @class */ (function () {
18120
18120
  }); };
18121
18121
  this.performPayment = function () { return __awaiter(_this, void 0, void 0, function () {
18122
18122
  var response, transactionStatus, err_4;
18123
- return __generator(this, function (_a) {
18124
- switch (_a.label) {
18123
+ var _a;
18124
+ return __generator(this, function (_b) {
18125
+ switch (_b.label) {
18125
18126
  case 0:
18126
18127
  if (!this.useDifferentAddress) {
18127
18128
  this.checkout.billingAddress = this.checkout.shippingAddress;
@@ -18130,20 +18131,23 @@ var CheckoutViewModel = /** @class */ (function () {
18130
18131
  this.isErrorsVisible = true;
18131
18132
  return [2 /*return*/];
18132
18133
  }
18133
- _a.label = 1;
18134
+ _b.label = 1;
18134
18135
  case 1:
18135
- _a.trys.push([1, 5, , 6]);
18136
+ _b.trys.push([1, 5, , 6]);
18136
18137
  this.isErrorsVisible = false;
18137
18138
  this.isStepLoading = true;
18138
18139
  return [4 /*yield*/, this.checkStocks()];
18139
18140
  case 2:
18140
- _a.sent();
18141
+ _b.sent();
18141
18142
  return [4 /*yield*/, this.saveCheckout()];
18142
18143
  case 3:
18143
- _a.sent();
18144
- return [4 /*yield*/, IkasCheckoutAPI.createSaleTransactionWithCheckout(this.checkout.id, this.paymentGatewayId, this.cardData ? this.cardData.toInput() : undefined)];
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)];
18145
18149
  case 4:
18146
- response = _a.sent();
18150
+ response = _b.sent();
18147
18151
  transactionStatus = response === null || response === void 0 ? void 0 : response.transactionStatus;
18148
18152
  if (transactionStatus &&
18149
18153
  [
@@ -18166,7 +18170,7 @@ var CheckoutViewModel = /** @class */ (function () {
18166
18170
  }
18167
18171
  return [3 /*break*/, 6];
18168
18172
  case 5:
18169
- err_4 = _a.sent();
18173
+ err_4 = _b.sent();
18170
18174
  if (err_4.type) {
18171
18175
  console.log(err_4);
18172
18176
  this.error = err_4;
@@ -29379,7 +29383,7 @@ var IkasBaseStore = /** @class */ (function () {
29379
29383
  }
29380
29384
  IkasBaseStore.prototype.checkLocalization = function () {
29381
29385
  return __awaiter(this, void 0, void 0, function () {
29382
- var myCountryCode, currentRouting, correctRouting, isCorrectLocale, hasNoSpecificCountry, countries_1, localeOptions_1;
29386
+ var myCountryCode, currentRouting, isCorrectLocale, myCountryRouting, otherCountriesRouting, countries_1, localeOptions_1;
29383
29387
  return __generator(this, function (_a) {
29384
29388
  switch (_a.label) {
29385
29389
  case 0:
@@ -29394,13 +29398,21 @@ var IkasBaseStore = /** @class */ (function () {
29394
29398
  myCountryCode = _a.sent();
29395
29399
  currentRouting = IkasStorefrontConfig.routings.find(function (r) { return r.id === IkasStorefrontConfig.storefrontRoutingId; });
29396
29400
  if (!(currentRouting && myCountryCode)) return [3 /*break*/, 3];
29397
- correctRouting = IkasStorefrontConfig.routings.find(function (r) { var _a; return (_a = r.countryCodes) === null || _a === void 0 ? void 0 : _a.includes(myCountryCode); });
29398
- isCorrectLocale = IkasStorefrontConfig.storefrontRoutingId === (correctRouting === null || correctRouting === void 0 ? void 0 : correctRouting.id);
29399
- if (!isCorrectLocale) {
29400
- hasNoSpecificCountry = IkasStorefrontConfig.routings.length === 0 ||
29401
- IkasStorefrontConfig.routings.every(function (r) { var _a; return !((_a = r.countryCodes) === null || _a === void 0 ? void 0 : _a.length); });
29402
- if (hasNoSpecificCountry)
29403
- isCorrectLocale = true;
29401
+ isCorrectLocale = true;
29402
+ myCountryRouting = IkasStorefrontConfig.routings.find(function (r) { var _a; return (_a = r.countryCodes) === null || _a === void 0 ? void 0 : _a.includes(myCountryCode); });
29403
+ otherCountriesRouting = IkasStorefrontConfig.routings.find(function (r) { var _a; return !((_a = r.countryCodes) === null || _a === void 0 ? void 0 : _a.length); });
29404
+ // Current country has spefic routing
29405
+ if (myCountryRouting) {
29406
+ if (currentRouting.id !== myCountryRouting.id) {
29407
+ isCorrectLocale = false;
29408
+ }
29409
+ }
29410
+ // Current country does not have specific routing
29411
+ else {
29412
+ if (otherCountriesRouting &&
29413
+ currentRouting.id !== otherCountriesRouting.id) {
29414
+ isCorrectLocale = false;
29415
+ }
29404
29416
  }
29405
29417
  return [4 /*yield*/, IkasCountryAPI.listCountries()];
29406
29418
  case 2:
@@ -29428,7 +29440,7 @@ var IkasBaseStore = /** @class */ (function () {
29428
29440
  });
29429
29441
  }
29430
29442
  });
29431
- this.localeOptions = localeOptions_1;
29443
+ this.localeOptions = sortBy_1(localeOptions_1, "countryName");
29432
29444
  if (!isCorrectLocale) {
29433
29445
  this.showLocaleOptions = true;
29434
29446
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "0.0.114",
3
+ "version": "0.0.116",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.es.js",
6
6
  "author": "Umut Ozan Yıldırım",