@ikas/storefront 0.0.162-alpha.5 → 0.0.162-alpha.6

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
@@ -37385,6 +37385,91 @@ var style = {
37385
37385
  backgroundColor: "rgba(255, 0, 0, 0.5)",
37386
37386
  };
37387
37387
 
37388
+ var IkasStorefrontLocalization = /** @class */ (function () {
37389
+ function IkasStorefrontLocalization(data) {
37390
+ this.id = data.id || "";
37391
+ this.isDefault = data.isDefault || false;
37392
+ this.locale = data.locale || "";
37393
+ this.name = data.name || "";
37394
+ }
37395
+ return IkasStorefrontLocalization;
37396
+ }());
37397
+
37398
+ var IkasStorefrontDomain = /** @class */ (function () {
37399
+ function IkasStorefrontDomain(data) {
37400
+ if (data === void 0) { data = {}; }
37401
+ this.id = data.id || "";
37402
+ this.merchantDomainId = data.merchantDomainId || "";
37403
+ this.name = data.name || "";
37404
+ this.redirectDomainName = data.redirectDomainName || null;
37405
+ this.isDefault = data.isDefault || false;
37406
+ makeAutoObservable(this);
37407
+ }
37408
+ return IkasStorefrontDomain;
37409
+ }());
37410
+
37411
+ var IkasStorefrontRouting = /** @class */ (function () {
37412
+ function IkasStorefrontRouting(data) {
37413
+ this.id = data.id || "";
37414
+ this.countryCodes = data.countryCodes || null;
37415
+ this.domain = data.domain || null;
37416
+ this.locale = data.locale || "";
37417
+ this.path = data.path || null;
37418
+ this.priceListId = data.priceListId || null;
37419
+ }
37420
+ return IkasStorefrontRouting;
37421
+ }());
37422
+
37423
+ var IkasStorefrontThemeStatus;
37424
+ (function (IkasStorefrontThemeStatus) {
37425
+ IkasStorefrontThemeStatus["WAITING"] = "WAITING";
37426
+ IkasStorefrontThemeStatus["READY"] = "READY";
37427
+ })(IkasStorefrontThemeStatus || (IkasStorefrontThemeStatus = {}));
37428
+ var IkasStorefrontTheme = /** @class */ (function () {
37429
+ function IkasStorefrontTheme(data) {
37430
+ this.id = data.id || "";
37431
+ this.isMainTheme = data.isMainTheme || false;
37432
+ this.name = data.name || "";
37433
+ this.status = data.status || IkasStorefrontThemeStatus.WAITING;
37434
+ this.themeId = data.themeId || "";
37435
+ this.themeVersionId = data.themeVersionId || "";
37436
+ }
37437
+ return IkasStorefrontTheme;
37438
+ }());
37439
+
37440
+ var StorefrontStatus;
37441
+ (function (StorefrontStatus) {
37442
+ StorefrontStatus["WAITING"] = "WAITING";
37443
+ StorefrontStatus["READY"] = "READY";
37444
+ })(StorefrontStatus || (StorefrontStatus = {}));
37445
+ var IkasStorefront = /** @class */ (function () {
37446
+ function IkasStorefront(data) {
37447
+ if (data === void 0) { data = {}; }
37448
+ this.id = data.id || "";
37449
+ this.name = data.name || "";
37450
+ this.status = data.status || StorefrontStatus.WAITING;
37451
+ this.mainStorefrontThemeId = data.mainStorefrontThemeId || null;
37452
+ this.emailSettingsId = data.emailSettingsId || null;
37453
+ this.salesChannelId = data.salesChannelId || null;
37454
+ this.gtmId = data.gtmId || null;
37455
+ this.fbpId = data.fbpId || null;
37456
+ // Sub Models
37457
+ this.localizations = data.localizations
37458
+ ? data.localizations.map(function (l) { return new IkasStorefrontLocalization(l); })
37459
+ : [];
37460
+ this.routings = data.routings
37461
+ ? data.routings.map(function (r) { return new IkasStorefrontRouting(r); })
37462
+ : [];
37463
+ this.domains = data.domains
37464
+ ? data.domains.map(function (o) { return new IkasStorefrontDomain(o); })
37465
+ : [];
37466
+ this.themes = data.themes
37467
+ ? data.themes.map(function (t) { return new IkasStorefrontTheme(t); })
37468
+ : [];
37469
+ }
37470
+ return IkasStorefront;
37471
+ }());
37472
+
37388
37473
  var PACKAGE_VERSION = "0.0.161";
37389
37474
  var PageViewModel = /** @class */ (function () {
37390
37475
  function PageViewModel(router) {
@@ -37541,6 +37626,8 @@ var PageViewModel = /** @class */ (function () {
37541
37626
  };
37542
37627
  // Message Handlers
37543
37628
  this.handleUpdateFrameData = function (data) { return __awaiter(_this, void 0, void 0, function () {
37629
+ var storefront, _storefront, routing;
37630
+ var _this = this;
37544
37631
  return __generator(this, function (_a) {
37545
37632
  switch (_a.label) {
37546
37633
  case 0:
@@ -37551,6 +37638,22 @@ var PageViewModel = /** @class */ (function () {
37551
37638
  this.apiKey = data.apiKey;
37552
37639
  this.locale = data.locale || "en";
37553
37640
  this.translations = data.translations || undefined;
37641
+ storefront = data.storefront;
37642
+ if (storefront) {
37643
+ _storefront = new IkasStorefront(storefront);
37644
+ routing = _storefront.routings.find(function (sr) { return sr.locale === _this.locale; });
37645
+ IkasStorefrontConfig.storefrontId = _storefront.id;
37646
+ IkasStorefrontConfig.storefrontRoutingId = routing === null || routing === void 0 ? void 0 : routing.id;
37647
+ if (_storefront.mainStorefrontThemeId)
37648
+ IkasStorefrontConfig.storefrontThemeId =
37649
+ _storefront.mainStorefrontThemeId;
37650
+ if (_storefront.salesChannelId)
37651
+ IkasStorefrontConfig.salesChannelId = _storefront.salesChannelId;
37652
+ if (routing === null || routing === void 0 ? void 0 : routing.priceListId)
37653
+ IkasStorefrontConfig.priceListId = routing.priceListId;
37654
+ IkasStorefrontConfig.routings = _storefront.routings;
37655
+ IkasStorefrontConfig.stockPreference = this.theme.settings.stockPreference;
37656
+ }
37554
37657
  // Production editor mode
37555
37658
  if (this.translations)
37556
37659
  IkasStorefrontConfig.translations = this.translations;
@@ -37877,91 +37980,6 @@ var index = /*#__PURE__*/Object.freeze({
37877
37980
  Image: Image
37878
37981
  });
37879
37982
 
37880
- var IkasStorefrontLocalization = /** @class */ (function () {
37881
- function IkasStorefrontLocalization(data) {
37882
- this.id = data.id || "";
37883
- this.isDefault = data.isDefault || false;
37884
- this.locale = data.locale || "";
37885
- this.name = data.name || "";
37886
- }
37887
- return IkasStorefrontLocalization;
37888
- }());
37889
-
37890
- var IkasStorefrontDomain = /** @class */ (function () {
37891
- function IkasStorefrontDomain(data) {
37892
- if (data === void 0) { data = {}; }
37893
- this.id = data.id || "";
37894
- this.merchantDomainId = data.merchantDomainId || "";
37895
- this.name = data.name || "";
37896
- this.redirectDomainName = data.redirectDomainName || null;
37897
- this.isDefault = data.isDefault || false;
37898
- makeAutoObservable(this);
37899
- }
37900
- return IkasStorefrontDomain;
37901
- }());
37902
-
37903
- var IkasStorefrontRouting = /** @class */ (function () {
37904
- function IkasStorefrontRouting(data) {
37905
- this.id = data.id || "";
37906
- this.countryCodes = data.countryCodes || null;
37907
- this.domain = data.domain || null;
37908
- this.locale = data.locale || "";
37909
- this.path = data.path || null;
37910
- this.priceListId = data.priceListId || null;
37911
- }
37912
- return IkasStorefrontRouting;
37913
- }());
37914
-
37915
- var IkasStorefrontThemeStatus;
37916
- (function (IkasStorefrontThemeStatus) {
37917
- IkasStorefrontThemeStatus["WAITING"] = "WAITING";
37918
- IkasStorefrontThemeStatus["READY"] = "READY";
37919
- })(IkasStorefrontThemeStatus || (IkasStorefrontThemeStatus = {}));
37920
- var IkasStorefrontTheme = /** @class */ (function () {
37921
- function IkasStorefrontTheme(data) {
37922
- this.id = data.id || "";
37923
- this.isMainTheme = data.isMainTheme || false;
37924
- this.name = data.name || "";
37925
- this.status = data.status || IkasStorefrontThemeStatus.WAITING;
37926
- this.themeId = data.themeId || "";
37927
- this.themeVersionId = data.themeVersionId || "";
37928
- }
37929
- return IkasStorefrontTheme;
37930
- }());
37931
-
37932
- var StorefrontStatus;
37933
- (function (StorefrontStatus) {
37934
- StorefrontStatus["WAITING"] = "WAITING";
37935
- StorefrontStatus["READY"] = "READY";
37936
- })(StorefrontStatus || (StorefrontStatus = {}));
37937
- var IkasStorefront = /** @class */ (function () {
37938
- function IkasStorefront(data) {
37939
- if (data === void 0) { data = {}; }
37940
- this.id = data.id || "";
37941
- this.name = data.name || "";
37942
- this.status = data.status || StorefrontStatus.WAITING;
37943
- this.mainStorefrontThemeId = data.mainStorefrontThemeId || null;
37944
- this.emailSettingsId = data.emailSettingsId || null;
37945
- this.salesChannelId = data.salesChannelId || null;
37946
- this.gtmId = data.gtmId || null;
37947
- this.fbpId = data.fbpId || null;
37948
- // Sub Models
37949
- this.localizations = data.localizations
37950
- ? data.localizations.map(function (l) { return new IkasStorefrontLocalization(l); })
37951
- : [];
37952
- this.routings = data.routings
37953
- ? data.routings.map(function (r) { return new IkasStorefrontRouting(r); })
37954
- : [];
37955
- this.domains = data.domains
37956
- ? data.domains.map(function (o) { return new IkasStorefrontDomain(o); })
37957
- : [];
37958
- this.themes = data.themes
37959
- ? data.themes.map(function (t) { return new IkasStorefrontTheme(t); })
37960
- : [];
37961
- }
37962
- return IkasStorefront;
37963
- }());
37964
-
37965
37983
  var IkasSalesChannel = /** @class */ (function () {
37966
37984
  function IkasSalesChannel(data) {
37967
37985
  if (data === void 0) { data = {}; }
package/build/index.js CHANGED
@@ -37363,6 +37363,91 @@ var style = {
37363
37363
  backgroundColor: "rgba(255, 0, 0, 0.5)",
37364
37364
  };
37365
37365
 
37366
+ var IkasStorefrontLocalization = /** @class */ (function () {
37367
+ function IkasStorefrontLocalization(data) {
37368
+ this.id = data.id || "";
37369
+ this.isDefault = data.isDefault || false;
37370
+ this.locale = data.locale || "";
37371
+ this.name = data.name || "";
37372
+ }
37373
+ return IkasStorefrontLocalization;
37374
+ }());
37375
+
37376
+ var IkasStorefrontDomain = /** @class */ (function () {
37377
+ function IkasStorefrontDomain(data) {
37378
+ if (data === void 0) { data = {}; }
37379
+ this.id = data.id || "";
37380
+ this.merchantDomainId = data.merchantDomainId || "";
37381
+ this.name = data.name || "";
37382
+ this.redirectDomainName = data.redirectDomainName || null;
37383
+ this.isDefault = data.isDefault || false;
37384
+ mobx.makeAutoObservable(this);
37385
+ }
37386
+ return IkasStorefrontDomain;
37387
+ }());
37388
+
37389
+ var IkasStorefrontRouting = /** @class */ (function () {
37390
+ function IkasStorefrontRouting(data) {
37391
+ this.id = data.id || "";
37392
+ this.countryCodes = data.countryCodes || null;
37393
+ this.domain = data.domain || null;
37394
+ this.locale = data.locale || "";
37395
+ this.path = data.path || null;
37396
+ this.priceListId = data.priceListId || null;
37397
+ }
37398
+ return IkasStorefrontRouting;
37399
+ }());
37400
+
37401
+ var IkasStorefrontThemeStatus;
37402
+ (function (IkasStorefrontThemeStatus) {
37403
+ IkasStorefrontThemeStatus["WAITING"] = "WAITING";
37404
+ IkasStorefrontThemeStatus["READY"] = "READY";
37405
+ })(IkasStorefrontThemeStatus || (IkasStorefrontThemeStatus = {}));
37406
+ var IkasStorefrontTheme = /** @class */ (function () {
37407
+ function IkasStorefrontTheme(data) {
37408
+ this.id = data.id || "";
37409
+ this.isMainTheme = data.isMainTheme || false;
37410
+ this.name = data.name || "";
37411
+ this.status = data.status || IkasStorefrontThemeStatus.WAITING;
37412
+ this.themeId = data.themeId || "";
37413
+ this.themeVersionId = data.themeVersionId || "";
37414
+ }
37415
+ return IkasStorefrontTheme;
37416
+ }());
37417
+
37418
+ var StorefrontStatus;
37419
+ (function (StorefrontStatus) {
37420
+ StorefrontStatus["WAITING"] = "WAITING";
37421
+ StorefrontStatus["READY"] = "READY";
37422
+ })(StorefrontStatus || (StorefrontStatus = {}));
37423
+ var IkasStorefront = /** @class */ (function () {
37424
+ function IkasStorefront(data) {
37425
+ if (data === void 0) { data = {}; }
37426
+ this.id = data.id || "";
37427
+ this.name = data.name || "";
37428
+ this.status = data.status || StorefrontStatus.WAITING;
37429
+ this.mainStorefrontThemeId = data.mainStorefrontThemeId || null;
37430
+ this.emailSettingsId = data.emailSettingsId || null;
37431
+ this.salesChannelId = data.salesChannelId || null;
37432
+ this.gtmId = data.gtmId || null;
37433
+ this.fbpId = data.fbpId || null;
37434
+ // Sub Models
37435
+ this.localizations = data.localizations
37436
+ ? data.localizations.map(function (l) { return new IkasStorefrontLocalization(l); })
37437
+ : [];
37438
+ this.routings = data.routings
37439
+ ? data.routings.map(function (r) { return new IkasStorefrontRouting(r); })
37440
+ : [];
37441
+ this.domains = data.domains
37442
+ ? data.domains.map(function (o) { return new IkasStorefrontDomain(o); })
37443
+ : [];
37444
+ this.themes = data.themes
37445
+ ? data.themes.map(function (t) { return new IkasStorefrontTheme(t); })
37446
+ : [];
37447
+ }
37448
+ return IkasStorefront;
37449
+ }());
37450
+
37366
37451
  var PACKAGE_VERSION = "0.0.161";
37367
37452
  var PageViewModel = /** @class */ (function () {
37368
37453
  function PageViewModel(router) {
@@ -37519,6 +37604,8 @@ var PageViewModel = /** @class */ (function () {
37519
37604
  };
37520
37605
  // Message Handlers
37521
37606
  this.handleUpdateFrameData = function (data) { return __awaiter(_this, void 0, void 0, function () {
37607
+ var storefront, _storefront, routing;
37608
+ var _this = this;
37522
37609
  return __generator(this, function (_a) {
37523
37610
  switch (_a.label) {
37524
37611
  case 0:
@@ -37529,6 +37616,22 @@ var PageViewModel = /** @class */ (function () {
37529
37616
  this.apiKey = data.apiKey;
37530
37617
  this.locale = data.locale || "en";
37531
37618
  this.translations = data.translations || undefined;
37619
+ storefront = data.storefront;
37620
+ if (storefront) {
37621
+ _storefront = new IkasStorefront(storefront);
37622
+ routing = _storefront.routings.find(function (sr) { return sr.locale === _this.locale; });
37623
+ IkasStorefrontConfig.storefrontId = _storefront.id;
37624
+ IkasStorefrontConfig.storefrontRoutingId = routing === null || routing === void 0 ? void 0 : routing.id;
37625
+ if (_storefront.mainStorefrontThemeId)
37626
+ IkasStorefrontConfig.storefrontThemeId =
37627
+ _storefront.mainStorefrontThemeId;
37628
+ if (_storefront.salesChannelId)
37629
+ IkasStorefrontConfig.salesChannelId = _storefront.salesChannelId;
37630
+ if (routing === null || routing === void 0 ? void 0 : routing.priceListId)
37631
+ IkasStorefrontConfig.priceListId = routing.priceListId;
37632
+ IkasStorefrontConfig.routings = _storefront.routings;
37633
+ IkasStorefrontConfig.stockPreference = this.theme.settings.stockPreference;
37634
+ }
37532
37635
  // Production editor mode
37533
37636
  if (this.translations)
37534
37637
  IkasStorefrontConfig.translations = this.translations;
@@ -37855,91 +37958,6 @@ var index = /*#__PURE__*/Object.freeze({
37855
37958
  Image: Image
37856
37959
  });
37857
37960
 
37858
- var IkasStorefrontLocalization = /** @class */ (function () {
37859
- function IkasStorefrontLocalization(data) {
37860
- this.id = data.id || "";
37861
- this.isDefault = data.isDefault || false;
37862
- this.locale = data.locale || "";
37863
- this.name = data.name || "";
37864
- }
37865
- return IkasStorefrontLocalization;
37866
- }());
37867
-
37868
- var IkasStorefrontDomain = /** @class */ (function () {
37869
- function IkasStorefrontDomain(data) {
37870
- if (data === void 0) { data = {}; }
37871
- this.id = data.id || "";
37872
- this.merchantDomainId = data.merchantDomainId || "";
37873
- this.name = data.name || "";
37874
- this.redirectDomainName = data.redirectDomainName || null;
37875
- this.isDefault = data.isDefault || false;
37876
- mobx.makeAutoObservable(this);
37877
- }
37878
- return IkasStorefrontDomain;
37879
- }());
37880
-
37881
- var IkasStorefrontRouting = /** @class */ (function () {
37882
- function IkasStorefrontRouting(data) {
37883
- this.id = data.id || "";
37884
- this.countryCodes = data.countryCodes || null;
37885
- this.domain = data.domain || null;
37886
- this.locale = data.locale || "";
37887
- this.path = data.path || null;
37888
- this.priceListId = data.priceListId || null;
37889
- }
37890
- return IkasStorefrontRouting;
37891
- }());
37892
-
37893
- var IkasStorefrontThemeStatus;
37894
- (function (IkasStorefrontThemeStatus) {
37895
- IkasStorefrontThemeStatus["WAITING"] = "WAITING";
37896
- IkasStorefrontThemeStatus["READY"] = "READY";
37897
- })(IkasStorefrontThemeStatus || (IkasStorefrontThemeStatus = {}));
37898
- var IkasStorefrontTheme = /** @class */ (function () {
37899
- function IkasStorefrontTheme(data) {
37900
- this.id = data.id || "";
37901
- this.isMainTheme = data.isMainTheme || false;
37902
- this.name = data.name || "";
37903
- this.status = data.status || IkasStorefrontThemeStatus.WAITING;
37904
- this.themeId = data.themeId || "";
37905
- this.themeVersionId = data.themeVersionId || "";
37906
- }
37907
- return IkasStorefrontTheme;
37908
- }());
37909
-
37910
- var StorefrontStatus;
37911
- (function (StorefrontStatus) {
37912
- StorefrontStatus["WAITING"] = "WAITING";
37913
- StorefrontStatus["READY"] = "READY";
37914
- })(StorefrontStatus || (StorefrontStatus = {}));
37915
- var IkasStorefront = /** @class */ (function () {
37916
- function IkasStorefront(data) {
37917
- if (data === void 0) { data = {}; }
37918
- this.id = data.id || "";
37919
- this.name = data.name || "";
37920
- this.status = data.status || StorefrontStatus.WAITING;
37921
- this.mainStorefrontThemeId = data.mainStorefrontThemeId || null;
37922
- this.emailSettingsId = data.emailSettingsId || null;
37923
- this.salesChannelId = data.salesChannelId || null;
37924
- this.gtmId = data.gtmId || null;
37925
- this.fbpId = data.fbpId || null;
37926
- // Sub Models
37927
- this.localizations = data.localizations
37928
- ? data.localizations.map(function (l) { return new IkasStorefrontLocalization(l); })
37929
- : [];
37930
- this.routings = data.routings
37931
- ? data.routings.map(function (r) { return new IkasStorefrontRouting(r); })
37932
- : [];
37933
- this.domains = data.domains
37934
- ? data.domains.map(function (o) { return new IkasStorefrontDomain(o); })
37935
- : [];
37936
- this.themes = data.themes
37937
- ? data.themes.map(function (t) { return new IkasStorefrontTheme(t); })
37938
- : [];
37939
- }
37940
- return IkasStorefront;
37941
- }());
37942
-
37943
37961
  var IkasSalesChannel = /** @class */ (function () {
37944
37962
  function IkasSalesChannel(data) {
37945
37963
  if (data === void 0) { data = {}; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "0.0.162-alpha.5",
3
+ "version": "0.0.162-alpha.6",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.es.js",
6
6
  "author": "Umut Ozan Yıldırım",