@ikas/storefront 0.0.168-alpha.9 → 0.0.169-alpha.2

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.
Files changed (27) hide show
  1. package/build/__generated__/global-types.d.ts +39 -24
  2. package/build/analytics/analytics.d.ts +1 -0
  3. package/build/analytics/events.d.ts +1 -0
  4. package/build/api/brand/__generated__/listProductBrand.d.ts +7 -0
  5. package/build/api/cart/__generated__/saveItemToCart.d.ts +6 -0
  6. package/build/api/category/__generated__/listCategory.d.ts +7 -0
  7. package/build/api/checkout/__generated__/getCheckoutById.d.ts +8 -2
  8. package/build/api/checkout/__generated__/getOrder.d.ts +2 -2
  9. package/build/api/checkout/__generated__/listCheckoutSettings.d.ts +1 -0
  10. package/build/api/checkout/__generated__/listPaymentGateway.d.ts +3 -1
  11. package/build/api/customer/__generated__/createOrderRefundRequest.d.ts +2 -2
  12. package/build/api/customer/__generated__/customerLogin.d.ts +1 -1
  13. package/build/api/customer/__generated__/getCustomerOrders.d.ts +2 -2
  14. package/build/api/customer/__generated__/getLastViewedProducts.d.ts +1 -1
  15. package/build/api/customer/__generated__/getMyCustomer.d.ts +1 -1
  16. package/build/api/customer/__generated__/registerCustomer.d.ts +1 -1
  17. package/build/api/customer/__generated__/saveMyCustomer.d.ts +1 -1
  18. package/build/api/storefront/__generated__/getStorefront.d.ts +1 -1
  19. package/build/components/checkout/components/external.d.ts +6 -0
  20. package/build/components/image/index.d.ts +1 -0
  21. package/build/index.es.js +205 -100
  22. package/build/index.js +205 -99
  23. package/build/models/data/payment-gateway/index.d.ts +6 -0
  24. package/build/models/ui/index.d.ts +1 -0
  25. package/build/models/ui/product-list/index.d.ts +1 -1
  26. package/build/store/cart.d.ts +1 -0
  27. package/package.json +1 -1
package/build/index.js CHANGED
@@ -11044,7 +11044,7 @@ var Apollo = /** @class */ (function () {
11044
11044
  });
11045
11045
  var authLink = setContext(function (_request, _a) {
11046
11046
  var headers = _a.headers;
11047
- var newHeaders = __assign(__assign({}, headers), { "x-api-key": apiKey || IkasStorefrontConfig.config.apiKey });
11047
+ var newHeaders = __assign(__assign({}, headers), { "x-api-key": apiKey || IkasStorefrontConfig.config.apiKey, "x-sfid": IkasStorefrontConfig.storefrontId, "x-sfrid": IkasStorefrontConfig.storefrontRoutingId });
11048
11048
  if (Apollo.customerToken) {
11049
11049
  newHeaders.Authorization = "Bearer " + Apollo.customerToken;
11050
11050
  }
@@ -12085,15 +12085,14 @@ function formatDate(date) {
12085
12085
  minute: "numeric",
12086
12086
  hour12: false,
12087
12087
  };
12088
+ var locale = IkasStorefrontConfig.getCurrentLocale();
12088
12089
  if (typeof navigator !== "undefined") {
12089
12090
  options.hour12 = is12Hour(navigator.language);
12090
- return new Intl.DateTimeFormat(navigator.language, options).format(date);
12091
12091
  }
12092
12092
  else {
12093
- var locale = IkasStorefrontConfig.getCurrentLocale();
12094
12093
  options.hour12 = is12Hour(locale);
12095
- return new Intl.DateTimeFormat(locale, options).format(date);
12096
12094
  }
12095
+ return new Intl.DateTimeFormat(locale, options).format(date);
12097
12096
  }
12098
12097
  function tryForEach(items, callback, printErrors) {
12099
12098
  if (printErrors === void 0) { printErrors = false; }
@@ -19843,6 +19842,8 @@ var IkasPaymentGateway = /** @class */ (function () {
19843
19842
  this.id = data.id || null;
19844
19843
  this.name = data.name || "";
19845
19844
  this.code = data.code || "";
19845
+ this.type = data.type || IkasPaymentGatewayType.INTERNAL;
19846
+ this.logoUrl = data.logoUrl || null;
19846
19847
  this.testMode = data.testMode || null;
19847
19848
  this.description = data.description || null;
19848
19849
  this.additionalPrices =
@@ -19920,7 +19921,12 @@ var IkasPaymentGatewayAdditionalPriceAmountType;
19920
19921
  (function (IkasPaymentGatewayAdditionalPriceAmountType) {
19921
19922
  IkasPaymentGatewayAdditionalPriceAmountType["AMOUNT"] = "AMOUNT";
19922
19923
  IkasPaymentGatewayAdditionalPriceAmountType["RATIO"] = "RATIO";
19923
- })(IkasPaymentGatewayAdditionalPriceAmountType || (IkasPaymentGatewayAdditionalPriceAmountType = {}));
19924
+ })(IkasPaymentGatewayAdditionalPriceAmountType || (IkasPaymentGatewayAdditionalPriceAmountType = {}));
19925
+ var IkasPaymentGatewayType;
19926
+ (function (IkasPaymentGatewayType) {
19927
+ IkasPaymentGatewayType["EXTERNAL"] = "EXTERNAL";
19928
+ IkasPaymentGatewayType["INTERNAL"] = "INTERNAL";
19929
+ })(IkasPaymentGatewayType || (IkasPaymentGatewayType = {}));
19924
19930
 
19925
19931
  var IkasCheckout = /** @class */ (function () {
19926
19932
  function IkasCheckout(data) {
@@ -23279,6 +23285,16 @@ var IkasCartStore = /** @class */ (function () {
23279
23285
  _this.cart = undefined;
23280
23286
  _this._checkoutId = undefined;
23281
23287
  };
23288
+ this.waitUntilInitialized = function () {
23289
+ return new Promise(function (resolve) {
23290
+ var interval = setInterval(function () {
23291
+ if (_this.cartLoadFinished) {
23292
+ clearInterval(interval);
23293
+ resolve(null);
23294
+ }
23295
+ }, 100);
23296
+ });
23297
+ };
23282
23298
  this.baseStore = baseStore;
23283
23299
  mobx.makeAutoObservable(this);
23284
23300
  }
@@ -23576,6 +23592,7 @@ var CheckoutViewModel = /** @class */ (function () {
23576
23592
  _b.label = 11;
23577
23593
  case 11:
23578
23594
  this.isCheckoutLoaded = true;
23595
+ Analytics.checkoutStep(this.checkout, this.step);
23579
23596
  return [2 /*return*/];
23580
23597
  }
23581
23598
  });
@@ -24150,7 +24167,10 @@ var CheckoutViewModel = /** @class */ (function () {
24150
24167
  if (!this.checkout.selectedPaymentGateway)
24151
24168
  return [2 /*return*/];
24152
24169
  return [4 /*yield*/, IkasCheckoutAPI.createSaleTransactionWithCheckout(this.checkout.id, this.checkout.selectedPaymentGateway.id, this.checkout.selectedPaymentGateway.paymentMethodType ===
24153
- IkasPaymentMethodType.CREDIT_CARD && this.cardData
24170
+ IkasPaymentMethodType.CREDIT_CARD &&
24171
+ this.checkout.selectedPaymentGateway.type ===
24172
+ IkasPaymentGatewayType.INTERNAL &&
24173
+ this.cardData
24154
24174
  ? this.cardData.toInput()
24155
24175
  : undefined)];
24156
24176
  case 1:
@@ -24229,7 +24249,9 @@ var CheckoutViewModel = /** @class */ (function () {
24229
24249
  var paymentGateway = _this.paymentGateways[index];
24230
24250
  _this.checkout.selectedPaymentGateway = paymentGateway;
24231
24251
  if (_this.step !== CheckoutStep.SUCCESS) {
24232
- if (paymentGateway.paymentMethodType === IkasPaymentMethodType.CREDIT_CARD) {
24252
+ if (paymentGateway.paymentMethodType ===
24253
+ IkasPaymentMethodType.CREDIT_CARD &&
24254
+ paymentGateway.type === IkasPaymentGatewayType.INTERNAL) {
24233
24255
  _this.cardData = new CreditCardData();
24234
24256
  }
24235
24257
  _this.installmentInfo = undefined;
@@ -24389,15 +24411,16 @@ var CheckoutViewModel = /** @class */ (function () {
24389
24411
  });
24390
24412
  Object.defineProperty(CheckoutViewModel.prototype, "canPerformPayment", {
24391
24413
  get: function () {
24392
- var _a, _b, _c;
24414
+ var _a, _b;
24393
24415
  if (this.checkoutSettings.showTermsAndConditionsCheckbox &&
24394
24416
  !this.isTermsAndConditionsChecked)
24395
24417
  return false;
24418
+ var pg = this.checkout.selectedPaymentGateway;
24396
24419
  return (this.canProceedToShipping &&
24397
24420
  !!((_a = this.checkout.billingAddress) === null || _a === void 0 ? void 0 : _a.isValid) &&
24398
- (((_b = this.checkout.selectedPaymentGateway) === null || _b === void 0 ? void 0 : _b.paymentMethodType) ===
24399
- IkasPaymentMethodType.CREDIT_CARD
24400
- ? (_c = this.cardData) === null || _c === void 0 ? void 0 : _c.isValid : true));
24421
+ ((pg === null || pg === void 0 ? void 0 : pg.paymentMethodType) === IkasPaymentMethodType.CREDIT_CARD &&
24422
+ pg.type === IkasPaymentGatewayType.INTERNAL
24423
+ ? (_b = this.cardData) === null || _b === void 0 ? void 0 : _b.isValid : true));
24401
24424
  },
24402
24425
  enumerable: false,
24403
24426
  configurable: true
@@ -24806,6 +24829,7 @@ var IkasEventType;
24806
24829
  IkasEventType["VIEW_CART"] = "VIEW_CART";
24807
24830
  IkasEventType["VIEW_CATEGORY"] = "VIEW_CATEGORY";
24808
24831
  IkasEventType["VIEW_SEARCH_RESULTS"] = "VIEW_SEARCH_RESULTS";
24832
+ IkasEventType["VIEW_LISTING"] = "VIEW_LISTING";
24809
24833
  IkasEventType["CONTACT_FORM"] = "CONTACT_FORM";
24810
24834
  })(IkasEventType || (IkasEventType = {}));
24811
24835
 
@@ -25209,6 +25233,24 @@ var Analytics = /** @class */ (function () {
25209
25233
  console.error(err);
25210
25234
  }
25211
25235
  };
25236
+ Analytics.viewListing = function (productDetails) {
25237
+ try {
25238
+ if (Analytics.subscribers.length) {
25239
+ var cloneProductDetails_2 = cloneDeep_1(productDetails).map(function (p) { return new IkasProductDetail(p.product, p.selectedVariantValues); });
25240
+ tryForEach(Analytics.subscribers, function (s) {
25241
+ s.callback({
25242
+ type: IkasEventType.VIEW_LISTING,
25243
+ data: {
25244
+ productDetails: cloneProductDetails_2,
25245
+ },
25246
+ });
25247
+ });
25248
+ }
25249
+ }
25250
+ catch (err) {
25251
+ console.error(err);
25252
+ }
25253
+ };
25212
25254
  Analytics.contactForm = function (form) {
25213
25255
  try {
25214
25256
  FacebookPixel.contactForm();
@@ -37626,6 +37668,7 @@ var CheckoutRequirementEnum;
37626
37668
  var CheckoutStatusEnum;
37627
37669
  (function (CheckoutStatusEnum) {
37628
37670
  CheckoutStatusEnum["COMPLETED"] = "COMPLETED";
37671
+ CheckoutStatusEnum["KILLED"] = "KILLED";
37629
37672
  CheckoutStatusEnum["OPEN"] = "OPEN";
37630
37673
  })(CheckoutStatusEnum || (CheckoutStatusEnum = {}));
37631
37674
  /**
@@ -37745,6 +37788,12 @@ var PaymentGatewayTransactionFeeTypeEnum;
37745
37788
  PaymentGatewayTransactionFeeTypeEnum["AMOUNT"] = "AMOUNT";
37746
37789
  PaymentGatewayTransactionFeeTypeEnum["RATIO"] = "RATIO";
37747
37790
  })(PaymentGatewayTransactionFeeTypeEnum || (PaymentGatewayTransactionFeeTypeEnum = {}));
37791
+ var PaymentGatewayTypeEnum;
37792
+ (function (PaymentGatewayTypeEnum) {
37793
+ PaymentGatewayTypeEnum["EXTERNAL"] = "EXTERNAL";
37794
+ PaymentGatewayTypeEnum["INTERNAL"] = "INTERNAL";
37795
+ PaymentGatewayTypeEnum["THIRD_PARTY"] = "THIRD_PARTY";
37796
+ })(PaymentGatewayTypeEnum || (PaymentGatewayTypeEnum = {}));
37748
37797
  var PaymentMethodEnum;
37749
37798
  (function (PaymentMethodEnum) {
37750
37799
  PaymentMethodEnum["APP_PAYMENT"] = "APP_PAYMENT";
@@ -37768,6 +37817,7 @@ var ProductAttributeTypeEnum;
37768
37817
  ProductAttributeTypeEnum["HTML"] = "HTML";
37769
37818
  ProductAttributeTypeEnum["MULTIPLE_CHOICE"] = "MULTIPLE_CHOICE";
37770
37819
  ProductAttributeTypeEnum["NUMERIC"] = "NUMERIC";
37820
+ ProductAttributeTypeEnum["PRODUCT"] = "PRODUCT";
37771
37821
  ProductAttributeTypeEnum["TABLE"] = "TABLE";
37772
37822
  ProductAttributeTypeEnum["TEXT"] = "TEXT";
37773
37823
  })(ProductAttributeTypeEnum || (ProductAttributeTypeEnum = {}));
@@ -38025,7 +38075,7 @@ var IkasProductList = /** @class */ (function () {
38025
38075
  this._minPage = this.page;
38026
38076
  if (!isInfiteScrollReturn)
38027
38077
  this._infiniteScrollPage = null;
38028
- this.handleViewSearchResults();
38078
+ this.handleListingEvent();
38029
38079
  return [2 /*return*/, true];
38030
38080
  case 12:
38031
38081
  err_1 = _a.sent();
@@ -38221,6 +38271,9 @@ var IkasProductList = /** @class */ (function () {
38221
38271
  else if (this.isLastViewed) {
38222
38272
  this.getInitial();
38223
38273
  }
38274
+ else {
38275
+ this.handleListingEvent();
38276
+ }
38224
38277
  }
38225
38278
  }
38226
38279
  Object.defineProperty(IkasProductList.prototype, "sort", {
@@ -38666,9 +38719,9 @@ var IkasProductList = /** @class */ (function () {
38666
38719
  this._searchKeyword = "";
38667
38720
  if (this._pageType !== exports.IkasThemePageType.CATEGORY) {
38668
38721
  this._filterCategoryId = undefined;
38669
- //@ts-ignore
38670
- (_b = this._filterCategories) === null || _b === void 0 ? void 0 : _b.forEach(function (fc) { return (fc._isSelected = false); });
38671
38722
  }
38723
+ //@ts-ignore
38724
+ (_b = this._filterCategories) === null || _b === void 0 ? void 0 : _b.forEach(function (fc) { return (fc._isSelected = false); });
38672
38725
  this.applyFilters();
38673
38726
  };
38674
38727
  IkasProductList.prototype.setSortType = function (sortType) {
@@ -38762,10 +38815,13 @@ var IkasProductList = /** @class */ (function () {
38762
38815
  }, 1000);
38763
38816
  });
38764
38817
  };
38765
- IkasProductList.prototype.handleViewSearchResults = function () {
38818
+ IkasProductList.prototype.handleListingEvent = function () {
38766
38819
  if (this.searchKeyword && this.data.length) {
38767
38820
  Analytics.viewSearchResults(this._searchKeyword, this.data);
38768
38821
  }
38822
+ else if (this.data.length && this._type === exports.IkasProductListType.ALL) {
38823
+ Analytics.viewListing(this.data);
38824
+ }
38769
38825
  };
38770
38826
  return IkasProductList;
38771
38827
  }());
@@ -38913,6 +38969,37 @@ var groupBy = _createAggregator(function(result, value, key) {
38913
38969
 
38914
38970
  var groupBy_1 = groupBy;
38915
38971
 
38972
+ var IkasAttributeList = /** @class */ (function () {
38973
+ function IkasAttributeList(productDetail, attributeListPropValue) {
38974
+ this.productDetail = null;
38975
+ this.productDetail = productDetail;
38976
+ this.attributeListPropValue = attributeListPropValue;
38977
+ mobx.makeAutoObservable(this);
38978
+ }
38979
+ Object.defineProperty(IkasAttributeList.prototype, "values", {
38980
+ get: function () {
38981
+ var _this = this;
38982
+ var _a;
38983
+ if (!this.productDetail)
38984
+ return [];
38985
+ var groupedValues = this.productDetail.product.hasVariant
38986
+ ? groupBy_1(this.productDetail.selectedVariant.attributes.filter(function (a) { var _a; return (_a = _this.attributeListPropValue.attributeIds) === null || _a === void 0 ? void 0 : _a.includes(a.productAttributeId || ""); }), "productAttributeId")
38987
+ : groupBy_1(this.productDetail.product.attributes.filter(function (a) { var _a; return (_a = _this.attributeListPropValue.attributeIds) === null || _a === void 0 ? void 0 : _a.includes(a.productAttributeId || ""); }), "productAttributeId");
38988
+ return (((_a = this.attributeListPropValue.attributeIds) === null || _a === void 0 ? void 0 : _a.map(function (attributeId) {
38989
+ var values = groupedValues[attributeId];
38990
+ if ((values === null || values === void 0 ? void 0 : values.length) && values[0].productAttribute)
38991
+ return {
38992
+ attribute: values[0].productAttribute,
38993
+ values: values,
38994
+ };
38995
+ }).filter(function (v) { return !!v; })) || []);
38996
+ },
38997
+ enumerable: false,
38998
+ configurable: true
38999
+ });
39000
+ return IkasAttributeList;
39001
+ }());
39002
+
38916
39003
  var Validator = /** @class */ (function () {
38917
39004
  function Validator(model, rules) {
38918
39005
  var _this = this;
@@ -41410,7 +41497,7 @@ var IkasCheckoutAPI = /** @class */ (function () {
41410
41497
  return __generator(this, function (_b) {
41411
41498
  switch (_b.label) {
41412
41499
  case 0:
41413
- QUERY = src(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n query listPaymentGateway($id: StringFilterInput, $locale: String) {\n listPaymentGateway(id: $id, locale: $locale) {\n paymentMethods {\n name\n logoUrl\n }\n paymentMethodType\n id\n name\n description\n testMode\n code\n additionalPrices {\n amount\n amountType\n name\n type\n }\n translations {\n description\n locale\n name\n }\n }\n }\n "], ["\n query listPaymentGateway($id: StringFilterInput, $locale: String) {\n listPaymentGateway(id: $id, locale: $locale) {\n paymentMethods {\n name\n logoUrl\n }\n paymentMethodType\n id\n name\n description\n testMode\n code\n additionalPrices {\n amount\n amountType\n name\n type\n }\n translations {\n description\n locale\n name\n }\n }\n }\n "])));
41500
+ QUERY = src(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n query listPaymentGateway($id: StringFilterInput, $locale: String) {\n listPaymentGateway(id: $id, locale: $locale) {\n paymentMethods {\n name\n logoUrl\n }\n paymentMethodType\n id\n name\n description\n testMode\n code\n type\n logoUrl\n additionalPrices {\n amount\n amountType\n name\n type\n }\n translations {\n description\n locale\n name\n }\n }\n }\n "], ["\n query listPaymentGateway($id: StringFilterInput, $locale: String) {\n listPaymentGateway(id: $id, locale: $locale) {\n paymentMethods {\n name\n logoUrl\n }\n paymentMethodType\n id\n name\n description\n testMode\n code\n type\n logoUrl\n additionalPrices {\n amount\n amountType\n name\n type\n }\n translations {\n description\n locale\n name\n }\n }\n }\n "])));
41414
41501
  _b.label = 1;
41415
41502
  case 1:
41416
41503
  _b.trys.push([1, 3, , 4]);
@@ -42152,15 +42239,16 @@ var IkasCustomerAPI = /** @class */ (function () {
42152
42239
  });
42153
42240
  };
42154
42241
  IkasCustomerAPI.getLastViewedProducts = function (customerId) {
42242
+ var _a;
42155
42243
  return __awaiter(this, void 0, void 0, function () {
42156
- var QUERY, _a, data, errors, error_2;
42157
- return __generator(this, function (_b) {
42158
- switch (_b.label) {
42244
+ var QUERY, _b, data, errors, error_2;
42245
+ return __generator(this, function (_c) {
42246
+ switch (_c.label) {
42159
42247
  case 0:
42160
42248
  QUERY = src(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n query getLastViewedProducts($customerId: String) {\n getLastViewedProducts(customerId: $customerId) {\n products {\n productId\n variantId\n }\n }\n }\n "], ["\n query getLastViewedProducts($customerId: String) {\n getLastViewedProducts(customerId: $customerId) {\n products {\n productId\n variantId\n }\n }\n }\n "])));
42161
- _b.label = 1;
42249
+ _c.label = 1;
42162
42250
  case 1:
42163
- _b.trys.push([1, 3, , 4]);
42251
+ _c.trys.push([1, 3, , 4]);
42164
42252
  return [4 /*yield*/, apollo
42165
42253
  .getClient()
42166
42254
  .query({
@@ -42170,12 +42258,12 @@ var IkasCustomerAPI = /** @class */ (function () {
42170
42258
  },
42171
42259
  })];
42172
42260
  case 2:
42173
- _a = _b.sent(), data = _a.data, errors = _a.errors;
42261
+ _b = _c.sent(), data = _b.data, errors = _b.errors;
42174
42262
  if (errors && errors.length)
42175
42263
  return [2 /*return*/, []];
42176
- return [2 /*return*/, data.getLastViewedProducts.products];
42264
+ return [2 /*return*/, ((_a = data.getLastViewedProducts) === null || _a === void 0 ? void 0 : _a.products) || []];
42177
42265
  case 3:
42178
- error_2 = _b.sent();
42266
+ error_2 = _c.sent();
42179
42267
  console.log(error_2);
42180
42268
  return [2 /*return*/, []];
42181
42269
  case 4: return [2 /*return*/];
@@ -42926,37 +43014,6 @@ var IkasVariantTypeAPI = /** @class */ (function () {
42926
43014
  }());
42927
43015
  var templateObject_1$g;
42928
43016
 
42929
- var IkasAttributeList = /** @class */ (function () {
42930
- function IkasAttributeList(productDetail, attributeListPropValue) {
42931
- this.productDetail = null;
42932
- this.productDetail = productDetail;
42933
- this.attributeListPropValue = attributeListPropValue;
42934
- mobx.makeAutoObservable(this);
42935
- }
42936
- Object.defineProperty(IkasAttributeList.prototype, "values", {
42937
- get: function () {
42938
- var _this = this;
42939
- var _a;
42940
- if (!this.productDetail)
42941
- return [];
42942
- var groupedValues = this.productDetail.product.hasVariant
42943
- ? groupBy_1(this.productDetail.selectedVariant.attributes.filter(function (a) { var _a; return (_a = _this.attributeListPropValue.attributeIds) === null || _a === void 0 ? void 0 : _a.includes(a.productAttributeId || ""); }), "productAttributeId")
42944
- : groupBy_1(this.productDetail.product.attributes.filter(function (a) { var _a; return (_a = _this.attributeListPropValue.attributeIds) === null || _a === void 0 ? void 0 : _a.includes(a.productAttributeId || ""); }), "productAttributeId");
42945
- return (((_a = this.attributeListPropValue.attributeIds) === null || _a === void 0 ? void 0 : _a.map(function (attributeId) {
42946
- var values = groupedValues[attributeId];
42947
- if ((values === null || values === void 0 ? void 0 : values.length) && values[0].productAttribute)
42948
- return {
42949
- attribute: values[0].productAttribute,
42950
- values: values,
42951
- };
42952
- }).filter(function (v) { return !!v; })) || []);
42953
- },
42954
- enumerable: false,
42955
- configurable: true
42956
- });
42957
- return IkasAttributeList;
42958
- }());
42959
-
42960
43017
  var IkasProductListPropValueProvider = /** @class */ (function () {
42961
43018
  function IkasProductListPropValueProvider(pageType, productListPropValue, pageSpecificData) {
42962
43019
  this.pageType = pageType;
@@ -44726,7 +44783,7 @@ var IkasPageDataProvider = /** @class */ (function () {
44726
44783
  propValueProvider = new IkasImageListPropValueProvider(propValue);
44727
44784
  return [3 /*break*/, 24];
44728
44785
  case 6:
44729
- propValueProvider = new IkasBrandPropValueProvider(propValue, this.pageSpecificData);
44786
+ propValueProvider = new IkasBrandPropValueProvider(propValue);
44730
44787
  return [3 /*break*/, 24];
44731
44788
  case 7:
44732
44789
  propValueProvider = new IkasBrandListPropValueProvider(propValue);
@@ -44766,13 +44823,13 @@ var IkasPageDataProvider = /** @class */ (function () {
44766
44823
  return [4 /*yield*/, Promise.all(pageComponents.map(function (tp) { return _this.getPageComponentPropValues(tp); }))];
44767
44824
  case 18: return [2 /*return*/, _b.sent()];
44768
44825
  case 19:
44769
- propValueProvider = new IkasBlogPropValueProvider(propValue, this.pageSpecificData);
44826
+ propValueProvider = new IkasBlogPropValueProvider(propValue);
44770
44827
  return [3 /*break*/, 24];
44771
44828
  case 20:
44772
44829
  propValueProvider = new IkasBlogListPropValueProvider(this.pageType, propValue, this.pageSpecificData);
44773
44830
  return [3 /*break*/, 24];
44774
44831
  case 21:
44775
- propValueProvider = new IkasBlogCategoryPropValueProvider(propValue, this.pageSpecificData);
44832
+ propValueProvider = new IkasBlogCategoryPropValueProvider(propValue);
44776
44833
  return [3 /*break*/, 24];
44777
44834
  case 22:
44778
44835
  propValueProvider = new IkasBlogCategoryListPropValueProvider(propValue);
@@ -45448,7 +45505,7 @@ var IkasPage = mobxReactLite.observer(function (_a) {
45448
45505
  var propValues = React.useMemo(function () {
45449
45506
  IkasPageDataInit.setPageSpecificData(pageSpecificDataStr, pageType, isBrowser);
45450
45507
  return IkasPageDataInit.initPropValues(propValuesStr, router$1, settingsStr, isBrowser);
45451
- }, [isBrowser, propValuesStr, pageType, settingsStr]);
45508
+ }, [isBrowser, propValuesStr, pageType, settingsStr, pageSpecificDataStr]);
45452
45509
  store.currentPageType = pageType;
45453
45510
  React.useEffect(function () {
45454
45511
  if (reInitOnBrowser)
@@ -45490,37 +45547,52 @@ var renderComponent = function (pageComponentPropValue, settings, index) {
45490
45547
  return (React.createElement(ThemeComponent, { key: pageComponentPropValue.pageComponent.id, index: index, pageComponentPropValue: pageComponentPropValue, settings: settings }));
45491
45548
  };
45492
45549
  function handleAnalytics(pageType, pageSpecificDataStr, store) {
45493
- Analytics.pageView(pageType);
45494
- try {
45495
- if (pageType === exports.IkasThemePageType.PRODUCT) {
45496
- var productDetailParsed = JSON.parse(pageSpecificDataStr);
45497
- var productDetail = new IkasProductDetail(productDetailParsed.product, productDetailParsed.selectedVariantValues);
45498
- var isBrowser = typeof window !== "undefined";
45499
- if (isBrowser) {
45500
- IkasPageDataInit._initProductDetailOnBrowser(productDetail);
45501
- }
45502
- Analytics.productView(productDetail);
45503
- // @ts-ignore
45504
- IkasStorefrontConfig.store.customerStore.onProductView(productDetail.product.id, productDetail.selectedVariant.id);
45505
- }
45506
- if (pageType === exports.IkasThemePageType.CATEGORY) {
45507
- var category = JSON.parse(pageSpecificDataStr);
45508
- var categoryPath = category.path.map(function (cat) { return cat.name; }).join(" > ");
45509
- if (category.path.length > 0) {
45510
- categoryPath = categoryPath + " > " + category.name;
45511
- }
45512
- else {
45513
- categoryPath = category.name;
45550
+ return __awaiter(this, void 0, void 0, function () {
45551
+ var productDetailParsed, productDetail, isBrowser, category, categoryPath, err_1;
45552
+ return __generator(this, function (_a) {
45553
+ switch (_a.label) {
45554
+ case 0:
45555
+ Analytics.pageView(pageType);
45556
+ _a.label = 1;
45557
+ case 1:
45558
+ _a.trys.push([1, 4, , 5]);
45559
+ if (pageType === exports.IkasThemePageType.PRODUCT) {
45560
+ productDetailParsed = JSON.parse(pageSpecificDataStr);
45561
+ productDetail = new IkasProductDetail(productDetailParsed.product, productDetailParsed.selectedVariantValues);
45562
+ isBrowser = typeof window !== "undefined";
45563
+ if (isBrowser) {
45564
+ IkasPageDataInit._initProductDetailOnBrowser(productDetail);
45565
+ }
45566
+ Analytics.productView(productDetail);
45567
+ // @ts-ignore
45568
+ IkasStorefrontConfig.store.customerStore.onProductView(productDetail.product.id, productDetail.selectedVariant.id);
45569
+ }
45570
+ if (pageType === exports.IkasThemePageType.CATEGORY) {
45571
+ category = JSON.parse(pageSpecificDataStr);
45572
+ categoryPath = category.path.map(function (cat) { return cat.name; }).join(" > ");
45573
+ if (category.path.length > 0) {
45574
+ categoryPath = categoryPath + " > " + category.name;
45575
+ }
45576
+ else {
45577
+ categoryPath = category.name;
45578
+ }
45579
+ Analytics.viewCategory(categoryPath, category);
45580
+ }
45581
+ if (!(pageType === exports.IkasThemePageType.CART)) return [3 /*break*/, 3];
45582
+ return [4 /*yield*/, store.cartStore.waitUntilInitialized()];
45583
+ case 2:
45584
+ _a.sent();
45585
+ Analytics.viewCart(store.cartStore.cart);
45586
+ _a.label = 3;
45587
+ case 3: return [3 /*break*/, 5];
45588
+ case 4:
45589
+ err_1 = _a.sent();
45590
+ console.error(err_1);
45591
+ return [3 /*break*/, 5];
45592
+ case 5: return [2 /*return*/];
45514
45593
  }
45515
- Analytics.viewCategory(categoryPath, category);
45516
- }
45517
- if (pageType === exports.IkasThemePageType.CART) {
45518
- Analytics.viewCart(store.cartStore.cart);
45519
- }
45520
- }
45521
- catch (err) {
45522
- console.error(err);
45523
- }
45594
+ });
45595
+ });
45524
45596
  }
45525
45597
 
45526
45598
  function ErrorComponent(_a) {
@@ -69469,6 +69541,30 @@ var Installments = mobxReactLite.observer(function (_a) {
69469
69541
 
69470
69542
  var styles$b = {"PaymentLogoContainer":"style-module_PaymentLogoContainer__224HZ","AdditionalPrice":"style-module_AdditionalPrice__gW28c"};
69471
69543
 
69544
+ var SVGExternal = function (_a) {
69545
+ var className = _a.className;
69546
+ return (React.createElement("svg", { width: "82", height: "52", viewBox: "0 0 82 52", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className },
69547
+ React.createElement("mask", { id: "path-1-inside-1_1206:13861", fill: "white" },
69548
+ React.createElement("rect", { y: "7", width: "46", height: "36.8", rx: "0.925786" })),
69549
+ React.createElement("rect", { y: "7", width: "46", height: "36.8", rx: "0.925786", fill: "#F7F7F9" }),
69550
+ React.createElement("rect", { y: "7", width: "46", height: "6.9697", fill: "#F7F7F9" }),
69551
+ React.createElement("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M3.65531 11.3106C4.01723 11.3106 4.31062 11.0172 4.31062 10.6553C4.31062 10.2934 4.01723 10 3.65531 10C3.29339 10 3 10.2934 3 10.6553C3 11.0172 3.29339 11.3106 3.65531 11.3106Z", fill: "#272727" }),
69552
+ React.createElement("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M6.27543 11.3106C6.63735 11.3106 6.93074 11.0172 6.93074 10.6553C6.93074 10.2934 6.63735 10 6.27543 10C5.91351 10 5.62012 10.2934 5.62012 10.6553C5.62012 11.0172 5.91351 11.3106 6.27543 11.3106Z", fill: "#272727" }),
69553
+ React.createElement("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M8.89554 11.3106C9.25746 11.3106 9.55085 11.0172 9.55085 10.6553C9.55085 10.2934 9.25746 10 8.89554 10C8.53363 10 8.24023 10.2934 8.24023 10.6553C8.24023 11.0172 8.53363 11.3106 8.89554 11.3106Z", fill: "#272727" }),
69554
+ React.createElement("rect", { x: "0.697266", y: "13.2727", width: "44.6061", height: "1", fill: "#272727" }),
69555
+ React.createElement("rect", { y: "7", width: "46", height: "36.8", rx: "0.925786", stroke: "#272727", "stroke-width": "2", mask: "url(#path-1-inside-1_1206:13861)" }),
69556
+ React.createElement("rect", { x: "16.5", y: "0.5", width: "65", height: "51", rx: "0.828302", fill: "#F7F7F9" }),
69557
+ React.createElement("rect", { x: "16", width: "66", height: "9.84848", fill: "#F7F7F9" }),
69558
+ React.createElement("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M20.9402 5.88045C21.4595 5.88045 21.8805 5.4595 21.8805 4.94023C21.8805 4.42095 21.4595 4 20.9402 4C20.421 4 20 4.42095 20 4.94023C20 5.4595 20.421 5.88045 20.9402 5.88045Z", fill: "#272727" }),
69559
+ React.createElement("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M24.7 5.88045C25.2193 5.88045 25.6402 5.4595 25.6402 4.94023C25.6402 4.42095 25.2193 4 24.7 4C24.1807 4 23.7598 4.42095 23.7598 4.94023C23.7598 5.4595 24.1807 5.88045 24.7 5.88045Z", fill: "#272727" }),
69560
+ React.createElement("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M28.4588 5.88045C28.9781 5.88045 29.399 5.4595 29.399 4.94023C29.399 4.42095 28.9781 4 28.4588 4C27.9395 4 27.5186 4.42095 27.5186 4.94023C27.5186 5.4595 27.9395 5.88045 28.4588 5.88045Z", fill: "#272727" }),
69561
+ React.createElement("rect", { x: "17", y: "9", width: "64", height: "1", fill: "#272727" }),
69562
+ React.createElement("rect", { x: "16.5", y: "0.5", width: "65", height: "51", rx: "0.828302", stroke: "#272727" }),
69563
+ React.createElement("rect", { width: "16", height: "16", transform: "translate(9 21)", fill: "#F7F7F9" }),
69564
+ React.createElement("path", { d: "M19.333 28L22.6663 31.3333L19.333 34.6667", stroke: "#272727", "stroke-linecap": "round", "stroke-linejoin": "round" }),
69565
+ React.createElement("path", { d: "M12 23.5V28.6667C12 29.3739 12.281 30.0522 12.781 30.5523C13.2811 31.0524 13.9594 31.3333 14.6667 31.3333H22.6667", stroke: "#272727", "stroke-linecap": "round", "stroke-linejoin": "round" })));
69566
+ };
69567
+
69472
69568
  var PaymentGateways = mobxReactLite.observer(function (_a) {
69473
69569
  var vm = _a.vm;
69474
69570
  var t = useTranslation().t;
@@ -69490,14 +69586,22 @@ var PaymentGateways = mobxReactLite.observer(function (_a) {
69490
69586
  };
69491
69587
  return (React.createElement(React.Fragment, null, vm.paymentGateways.map(function (pg, index) {
69492
69588
  var _a;
69493
- return (React.createElement(SelectBox$1, { key: pg.id, label: pg.paymentMethodType === IkasPaymentMethodType.CREDIT_CARD
69589
+ return (React.createElement(SelectBox$1, { key: pg.id, label: pg.paymentMethodType === IkasPaymentMethodType.CREDIT_CARD &&
69590
+ pg.type === IkasPaymentGatewayType.INTERNAL
69494
69591
  ? t("checkout-page:creditCard")
69495
- : pg.name, isSelected: vm.selectedPaymentGatewayIndex === index, rightContent: ((_a = pg.additionalPrices) === null || _a === void 0 ? void 0 : _a.length) ? (React.createElement(PaymentMethodAdjustment, null, getAdditionalPriceText(pg.additionalPrices[0]))) : (React.createElement(PaymentMethodLogos, null, pg.paymentMethods.map(function (pm, index) {
69496
- return pm.logoUrl ? (React.createElement("div", { className: styles$b.PaymentLogoContainer, key: index },
69497
- React.createElement("img", { src: pm.logoUrl }))) : (React.createElement("div", { className: styles$b.PaymentLogoContainer, key: index }));
69498
- }))), bottomContent: pg.paymentMethodType === IkasPaymentMethodType.CREDIT_CARD ? (React.createElement("div", null,
69592
+ : pg.name, isSelected: vm.selectedPaymentGatewayIndex === index, rightContent: ((_a = pg.additionalPrices) === null || _a === void 0 ? void 0 : _a.length) ? (React.createElement(PaymentMethodAdjustment, null, getAdditionalPriceText(pg.additionalPrices[0]))) : (React.createElement(PaymentMethodLogos, null, !!pg.logoUrl && (React.createElement("div", { className: styles$b.PaymentLogoContainer },
69593
+ React.createElement("img", { src: pg.logoUrl }))))), bottomContent: pg.paymentMethodType === IkasPaymentMethodType.CREDIT_CARD &&
69594
+ pg.type === IkasPaymentGatewayType.INTERNAL ? (React.createElement("div", null,
69499
69595
  React.createElement(CreditCardForm, { vm: vm }),
69500
- vm.installmentInfo && React.createElement(Installments, { vm: vm }))) : pg.description ? (React.createElement("div", { dangerouslySetInnerHTML: { __html: pg.description } })) : undefined, onClick: function () {
69596
+ vm.installmentInfo && React.createElement(Installments, { vm: vm }))) : pg.description ? (React.createElement(React.Fragment, null,
69597
+ pg.type === IkasPaymentGatewayType.EXTERNAL && (React.createElement("div", { style: {
69598
+ height: "52px",
69599
+ display: "flex",
69600
+ justifyContent: "center",
69601
+ margin: "24px 0",
69602
+ } },
69603
+ React.createElement(SVGExternal, null))),
69604
+ React.createElement("div", { dangerouslySetInnerHTML: { __html: pg.description } }))) : undefined, onClick: function () {
69501
69605
  return vm.selectedPaymentGatewayIndex !== index &&
69502
69606
  vm.setPaymentGateway(index);
69503
69607
  } }));
@@ -69964,7 +70068,8 @@ var StepSuccess = mobxReactLite.observer(function (_a) {
69964
70068
  React.createElement("div", { className: styles$h.InfoTitle }, t("checkout-page:paymentMethod")),
69965
70069
  paymentGateway && (React.createElement(React.Fragment, null,
69966
70070
  React.createElement("div", { className: styles$h.InfoText }, paymentGateway.name),
69967
- !!paymentGateway.description && (React.createElement("div", { className: styles$h.InfoText },
70071
+ !!paymentGateway.description &&
70072
+ paymentGateway.type !== IkasPaymentGatewayType.EXTERNAL && (React.createElement("div", { className: styles$h.InfoText },
69968
70073
  React.createElement("div", { dangerouslySetInnerHTML: {
69969
70074
  __html: paymentGateway.description,
69970
70075
  } }))))),
@@ -70168,7 +70273,7 @@ var IMAGE_SIZES = [
70168
70273
  3840,
70169
70274
  ];
70170
70275
  var Image = function (_a) {
70171
- var image = _a.image, others = __rest(_a, ["image"]);
70276
+ var image = _a.image, useBlur = _a.useBlur, others = __rest(_a, ["image", "useBlur"]);
70172
70277
  var loader = function (_a) {
70173
70278
  var width = _a.width;
70174
70279
  var closest = IMAGE_SIZES.reduce(function (prev, curr) {
@@ -70176,7 +70281,7 @@ var Image = function (_a) {
70176
70281
  });
70177
70282
  return image.getSrc(closest);
70178
70283
  };
70179
- return (React.createElement(NextImage__default['default'], __assign({}, others, { loader: loader, quality: 100, src: image.src, alt: others.alt || "Image" })));
70284
+ return (React.createElement(NextImage__default['default'], __assign({}, others, { loader: loader, quality: 100, src: image.src, alt: others.alt || "Image", placeholder: useBlur ? "blur" : "empty", blurDataURL: useBlur ? image.getSrc(180) : undefined })));
70180
70285
  };
70181
70286
 
70182
70287
  var styles$k = {"StepContainer":"style-module_StepContainer__1O2dD","Step":"style-module_Step__1iOYA","StepTitleContainer":"style-module_StepTitleContainer__2GUg2","First":"style-module_First__cAzdJ","StepTitleTop":"style-module_StepTitleTop__3zfsj","WithRightContent":"style-module_WithRightContent__2fqb1","StepCircle":"style-module_StepCircle__36A5q","Selected":"style-module_Selected__3j91L","StepTitle":"style-module_StepTitle__10YDP","Light":"style-module_Light__15wSX","StepTitleRightContent":"style-module_StepTitleRightContent__2Q43m","StepContent":"style-module_StepContent__20QIi"};
@@ -70291,7 +70396,7 @@ var IkasCheckoutPage = function (_a) {
70291
70396
  router$1.push("/account/login?redirect=" + encodeURIComponent(vm.checkoutUrl));
70292
70397
  }
70293
70398
  Analytics.beginCheckout(vm.checkout);
70294
- Analytics.checkoutStep(vm.checkout, vm.step);
70399
+ Analytics.pageView(exports.IkasThemePageType.CHECKOUT);
70295
70400
  }, []);
70296
70401
  React.useEffect(function () {
70297
70402
  document.documentElement.style.setProperty("--checkout-button-bg-color", (customizationProps === null || customizationProps === void 0 ? void 0 : customizationProps.buttonBgColor) || "#272727");
@@ -71798,6 +71903,7 @@ exports.ForgotPasswordForm = ForgotPasswordForm;
71798
71903
  exports.ForgotPasswordPage = forgotPassword$1;
71799
71904
  exports.IkasApplicableProductFilterValue = IkasApplicableProductFilterValue;
71800
71905
  exports.IkasAttributeDetail = IkasAttributeDetail;
71906
+ exports.IkasAttributeList = IkasAttributeList;
71801
71907
  exports.IkasBaseStore = IkasBaseStore;
71802
71908
  exports.IkasBlog = IkasBlog;
71803
71909
  exports.IkasBlogAPI = IkasBlogAPI;
@@ -5,6 +5,8 @@ export declare class IkasPaymentGateway {
5
5
  id: string | null;
6
6
  name: string;
7
7
  code: string;
8
+ type: IkasPaymentGatewayType;
9
+ logoUrl: string | null;
8
10
  testMode: boolean | null;
9
11
  description: string | null;
10
12
  additionalPrices: IkasPaymentGatewayAdditionalPrice[] | null;
@@ -45,6 +47,10 @@ export declare enum IkasPaymentGatewayAdditionalPriceAmountType {
45
47
  AMOUNT = "AMOUNT",
46
48
  RATIO = "RATIO"
47
49
  }
50
+ export declare enum IkasPaymentGatewayType {
51
+ EXTERNAL = "EXTERNAL",
52
+ INTERNAL = "INTERNAL"
53
+ }
48
54
  declare type IkasPaymentGatewayTranslation = {
49
55
  description: string | null;
50
56
  locale: string;
@@ -7,6 +7,7 @@ export { IkasNavigationLink } from "./navigation-link/index";
7
7
  export { IkasProductDetail, IkasDisplayedVariantType, IkasDisplayedVariantValue, } from "./product-detail/index";
8
8
  export { IkasProductList, IkasProductListType, IkasProductListSortType, } from "./product-list/index";
9
9
  export * from "./product-attribute-detail/index";
10
+ export * from "./product-attribute-list/index";
10
11
  export { Validator, ValidationStatus } from "./validator/index";
11
12
  export * from "./validator/rules/index";
12
13
  export { LoginForm } from "./validator/form/login";
@@ -89,7 +89,7 @@ export declare class IkasProductList {
89
89
  private getQueryParams;
90
90
  private isBrowser;
91
91
  private waitForCustomerStoreInit;
92
- private handleViewSearchResults;
92
+ private handleListingEvent;
93
93
  private searchDebouncer;
94
94
  private searchAnalyticsDebouncer;
95
95
  }
@@ -22,4 +22,5 @@ export declare class IkasCartStore {
22
22
  removeItem: (item: IkasOrderLineItem) => Promise<void>;
23
23
  removeCardIfEmpty: () => void;
24
24
  removeCart: () => void;
25
+ waitUntilInitialized: () => Promise<unknown>;
25
26
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "0.0.168-alpha.9",
3
+ "version": "0.0.169-alpha.2",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.es.js",
6
6
  "author": "Umut Ozan Yıldırım",