@ikas/storefront 0.0.115 → 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
@@ -29403,7 +29403,7 @@ var IkasBaseStore = /** @class */ (function () {
29403
29403
  }
29404
29404
  IkasBaseStore.prototype.checkLocalization = function () {
29405
29405
  return __awaiter(this, void 0, void 0, function () {
29406
- var myCountryCode, currentRouting, otherCountriesRouting, correctRouting, isCorrectLocale, hasNoSpecificCountry, countries_1, localeOptions_1;
29406
+ var myCountryCode, currentRouting, isCorrectLocale, myCountryRouting, otherCountriesRouting, countries_1, localeOptions_1;
29407
29407
  return __generator(this, function (_a) {
29408
29408
  switch (_a.label) {
29409
29409
  case 0:
@@ -29418,14 +29418,21 @@ var IkasBaseStore = /** @class */ (function () {
29418
29418
  myCountryCode = _a.sent();
29419
29419
  currentRouting = IkasStorefrontConfig.routings.find(function (r) { return r.id === IkasStorefrontConfig.storefrontRoutingId; });
29420
29420
  if (!(currentRouting && myCountryCode)) return [3 /*break*/, 3];
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); });
29421
29423
  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;
29423
- isCorrectLocale = IkasStorefrontConfig.storefrontRoutingId === (correctRouting === null || correctRouting === void 0 ? void 0 : correctRouting.id);
29424
- if (!isCorrectLocale) {
29425
- hasNoSpecificCountry = IkasStorefrontConfig.routings.length === 0 ||
29426
- IkasStorefrontConfig.routings.every(function (r) { var _a; return !((_a = r.countryCodes) === null || _a === void 0 ? void 0 : _a.length); });
29427
- if (hasNoSpecificCountry)
29428
- isCorrectLocale = true;
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
+ }
29429
29436
  }
29430
29437
  return [4 /*yield*/, IkasCountryAPI.listCountries()];
29431
29438
  case 2:
@@ -29453,7 +29460,7 @@ var IkasBaseStore = /** @class */ (function () {
29453
29460
  });
29454
29461
  }
29455
29462
  });
29456
- this.localeOptions = localeOptions_1;
29463
+ this.localeOptions = sortBy_1(localeOptions_1, "countryName");
29457
29464
  if (!isCorrectLocale) {
29458
29465
  this.showLocaleOptions = true;
29459
29466
  }
package/build/index.js CHANGED
@@ -29383,7 +29383,7 @@ var IkasBaseStore = /** @class */ (function () {
29383
29383
  }
29384
29384
  IkasBaseStore.prototype.checkLocalization = function () {
29385
29385
  return __awaiter(this, void 0, void 0, function () {
29386
- var myCountryCode, currentRouting, otherCountriesRouting, correctRouting, isCorrectLocale, hasNoSpecificCountry, countries_1, localeOptions_1;
29386
+ var myCountryCode, currentRouting, isCorrectLocale, myCountryRouting, otherCountriesRouting, countries_1, localeOptions_1;
29387
29387
  return __generator(this, function (_a) {
29388
29388
  switch (_a.label) {
29389
29389
  case 0:
@@ -29398,14 +29398,21 @@ var IkasBaseStore = /** @class */ (function () {
29398
29398
  myCountryCode = _a.sent();
29399
29399
  currentRouting = IkasStorefrontConfig.routings.find(function (r) { return r.id === IkasStorefrontConfig.storefrontRoutingId; });
29400
29400
  if (!(currentRouting && myCountryCode)) return [3 /*break*/, 3];
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); });
29401
29403
  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;
29403
- isCorrectLocale = IkasStorefrontConfig.storefrontRoutingId === (correctRouting === null || correctRouting === void 0 ? void 0 : correctRouting.id);
29404
- if (!isCorrectLocale) {
29405
- hasNoSpecificCountry = IkasStorefrontConfig.routings.length === 0 ||
29406
- IkasStorefrontConfig.routings.every(function (r) { var _a; return !((_a = r.countryCodes) === null || _a === void 0 ? void 0 : _a.length); });
29407
- if (hasNoSpecificCountry)
29408
- isCorrectLocale = true;
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
+ }
29409
29416
  }
29410
29417
  return [4 /*yield*/, IkasCountryAPI.listCountries()];
29411
29418
  case 2:
@@ -29433,7 +29440,7 @@ var IkasBaseStore = /** @class */ (function () {
29433
29440
  });
29434
29441
  }
29435
29442
  });
29436
- this.localeOptions = localeOptions_1;
29443
+ this.localeOptions = sortBy_1(localeOptions_1, "countryName");
29437
29444
  if (!isCorrectLocale) {
29438
29445
  this.showLocaleOptions = true;
29439
29446
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "0.0.115",
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",