@ikas/storefront 0.0.155 → 0.0.156

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.
@@ -320,6 +320,13 @@ export interface CheckoutCustomerInput {
320
320
  id?: string | null;
321
321
  lastName?: string | null;
322
322
  }
323
+ export interface CreateCustomerEmailSubscriptionInput {
324
+ createdAt?: any | null;
325
+ deleted?: boolean | null;
326
+ email: string;
327
+ id?: string | null;
328
+ updatedAt?: any | null;
329
+ }
323
330
  export interface CreateSaleTransactionWithCheckoutInput {
324
331
  checkoutId: string;
325
332
  paymentGatewayId: string;
@@ -22,8 +22,10 @@ export interface getBlog_listBlog_data_category_metadata {
22
22
  export interface getBlog_listBlog_data_category {
23
23
  __typename: "BlogCategory";
24
24
  createdAt: any | null;
25
+ updatedAt: any | null;
25
26
  deleted: boolean | null;
26
27
  id: string;
28
+ name: string;
27
29
  imageId: string;
28
30
  metadata: getBlog_listBlog_data_category_metadata;
29
31
  }
@@ -14,10 +14,11 @@ export interface listBlog_listBlog_data_category_metadata {
14
14
  export interface listBlog_listBlog_data_category {
15
15
  __typename: "BlogCategory";
16
16
  createdAt: any | null;
17
+ updatedAt: any | null;
17
18
  deleted: boolean | null;
18
19
  id: string;
19
- imageId: string;
20
20
  name: string;
21
+ imageId: string;
21
22
  metadata: listBlog_listBlog_data_category_metadata;
22
23
  }
23
24
  export interface listBlog_listBlog_data_tags {
@@ -0,0 +1,11 @@
1
+ import { CreateCustomerEmailSubscriptionInput } from "../../../__generated__/global-types";
2
+ export interface createCustomerEmailSubscription_createCustomerEmailSubscription {
3
+ __typename: "Customer";
4
+ id: string;
5
+ }
6
+ export interface createCustomerEmailSubscription {
7
+ createCustomerEmailSubscription: createCustomerEmailSubscription_createCustomerEmailSubscription;
8
+ }
9
+ export interface createCustomerEmailSubscriptionVariables {
10
+ input: CreateCustomerEmailSubscriptionInput;
11
+ }
@@ -27,4 +27,5 @@ export declare class IkasCustomerAPI {
27
27
  orderId?: string;
28
28
  }): Promise<any>;
29
29
  static saveIkasOrderRefund(input: IkasRefund): Promise<IkasOrder | undefined>;
30
+ static createCustomerEmailSubscription(email: string): Promise<boolean>;
30
31
  }
package/build/index.es.js CHANGED
@@ -11658,8 +11658,19 @@ var IkasCustomer = /** @class */ (function () {
11658
11658
  this.addresses = data.addresses
11659
11659
  ? data.addresses.map(function (a) { return new IkasCustomerAddress(a); })
11660
11660
  : [];
11661
+ this.subscriptionStatus = data.subscriptionStatus || null;
11661
11662
  makeAutoObservable(this);
11662
11663
  }
11664
+ Object.defineProperty(IkasCustomer.prototype, "isSubscribed", {
11665
+ get: function () {
11666
+ return (this.subscriptionStatus ===
11667
+ IkasCustomerEmailSubscriptionStatus.SUBSCRIBED ||
11668
+ this.subscriptionStatus ===
11669
+ IkasCustomerEmailSubscriptionStatus.PENDING_CONFIRMATION);
11670
+ },
11671
+ enumerable: false,
11672
+ configurable: true
11673
+ });
11663
11674
  return IkasCustomer;
11664
11675
  }());
11665
11676
  var IkasCustomerAccountStatus;
@@ -11668,7 +11679,13 @@ var IkasCustomerAccountStatus;
11668
11679
  IkasCustomerAccountStatus["DECLINED_ACCOUNT_INVITATION"] = "DECLINED_ACCOUNT_INVITATION";
11669
11680
  IkasCustomerAccountStatus["DISABLED_ACCOUNT"] = "DISABLED_ACCOUNT";
11670
11681
  IkasCustomerAccountStatus["INVITED_TO_CREATE_ACCOUNT"] = "INVITED_TO_CREATE_ACCOUNT";
11671
- })(IkasCustomerAccountStatus || (IkasCustomerAccountStatus = {}));
11682
+ })(IkasCustomerAccountStatus || (IkasCustomerAccountStatus = {}));
11683
+ var IkasCustomerEmailSubscriptionStatus;
11684
+ (function (IkasCustomerEmailSubscriptionStatus) {
11685
+ IkasCustomerEmailSubscriptionStatus["NOT_SUBSCRIBED"] = "NOT_SUBSCRIBED";
11686
+ IkasCustomerEmailSubscriptionStatus["PENDING_CONFIRMATION"] = "PENDING_CONFIRMATION";
11687
+ IkasCustomerEmailSubscriptionStatus["SUBSCRIBED"] = "SUBSCRIBED";
11688
+ })(IkasCustomerEmailSubscriptionStatus || (IkasCustomerEmailSubscriptionStatus = {}));
11672
11689
 
11673
11690
  var IkasCardAssociation;
11674
11691
  (function (IkasCardAssociation) {
@@ -17450,6 +17467,7 @@ var isServer$3 = typeof localStorage === "undefined";
17450
17467
  var LS_TOKEN_KEY = "customerToken";
17451
17468
  var LS_TOKEN_EXPIRY = "customerTokenExpiry";
17452
17469
  var LS_CUSTOMER_KEY = "customer";
17470
+ var LS_CUSTOMER_SUB_KEY = "customerEmailSubscription";
17453
17471
  var IkasCustomerStore = /** @class */ (function () {
17454
17472
  function IkasCustomerStore(baseStore) {
17455
17473
  var _this = this;
@@ -17688,6 +17706,19 @@ var IkasCustomerStore = /** @class */ (function () {
17688
17706
  }
17689
17707
  });
17690
17708
  }); };
17709
+ this.createEmailSubscription = function (email) { return __awaiter(_this, void 0, void 0, function () {
17710
+ var isSuccess;
17711
+ return __generator(this, function (_a) {
17712
+ switch (_a.label) {
17713
+ case 0: return [4 /*yield*/, IkasCustomerAPI.createCustomerEmailSubscription(email)];
17714
+ case 1:
17715
+ isSuccess = _a.sent();
17716
+ if (isSuccess)
17717
+ window.localStorage.setItem(LS_CUSTOMER_SUB_KEY, "true");
17718
+ return [2 /*return*/, isSuccess];
17719
+ }
17720
+ });
17721
+ }); };
17691
17722
  this.baseStore = baseStore;
17692
17723
  this.init();
17693
17724
  makeAutoObservable(this);
@@ -17699,6 +17730,17 @@ var IkasCustomerStore = /** @class */ (function () {
17699
17730
  enumerable: false,
17700
17731
  configurable: true
17701
17732
  });
17733
+ Object.defineProperty(IkasCustomerStore.prototype, "canCreateEmailSubscription", {
17734
+ get: function () {
17735
+ var _a;
17736
+ if (((_a = this.customer) === null || _a === void 0 ? void 0 : _a.isSubscribed) || isServer$3)
17737
+ return false;
17738
+ var alreadySubbed = window.localStorage.getItem(LS_CUSTOMER_SUB_KEY);
17739
+ return !alreadySubbed;
17740
+ },
17741
+ enumerable: false,
17742
+ configurable: true
17743
+ });
17702
17744
  IkasCustomerStore.prototype.init = function () {
17703
17745
  return __awaiter(this, void 0, void 0, function () {
17704
17746
  return __generator(this, function (_a) {
@@ -21177,7 +21219,7 @@ var IkasProductList = /** @class */ (function () {
21177
21219
  }
21178
21220
  });
21179
21221
  }); };
21180
- this.getInitial = function (queryParams) { return __awaiter(_this, void 0, void 0, function () {
21222
+ this.getInitial = function (queryParams, isInfiteScrollReturn) { return __awaiter(_this, void 0, void 0, function () {
21181
21223
  var fetchRequestTime, page, limit, response_1, data, err_1;
21182
21224
  var _a;
21183
21225
  return __generator(this, function (_b) {
@@ -21189,7 +21231,7 @@ var IkasProductList = /** @class */ (function () {
21189
21231
  _b.label = 1;
21190
21232
  case 1:
21191
21233
  _b.trys.push([1, 5, 6, 7]);
21192
- page = this._page || 1;
21234
+ page = isInfiteScrollReturn ? this._page : 1;
21193
21235
  limit = this._limit;
21194
21236
  if (!(this.isFilterable && !this.filters)) return [3 /*break*/, 3];
21195
21237
  return [4 /*yield*/, this.getFilters()];
@@ -21419,7 +21461,7 @@ var IkasProductList = /** @class */ (function () {
21419
21461
  this.getInitial(queryParams);
21420
21462
  }
21421
21463
  else if (this._page > 1) {
21422
- this.getInitial();
21464
+ this.getInitial(undefined, true);
21423
21465
  }
21424
21466
  }
21425
21467
  }
@@ -27208,7 +27250,7 @@ var IkasCustomerAPI = /** @class */ (function () {
27208
27250
  return __generator(this, function (_b) {
27209
27251
  switch (_b.label) {
27210
27252
  case 0:
27211
- MUTATION = src(templateObject_1$7 || (templateObject_1$7 = __makeTemplateObject(["\n mutation customerLogin($email: String!, $password: String!) {\n customerLogin(email: $email, password: $password) {\n token\n tokenExpiry\n customer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\n addressLine1\n addressLine2\n identityNumber\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n }\n district {\n id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n }\n phone\n accountStatus\n email\n firstName\n }\n }\n }\n "], ["\n mutation customerLogin($email: String!, $password: String!) {\n customerLogin(email: $email, password: $password) {\n token\n tokenExpiry\n customer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\n addressLine1\n addressLine2\n identityNumber\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n }\n district {\n id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n }\n phone\n accountStatus\n email\n firstName\n }\n }\n }\n "])));
27253
+ MUTATION = src(templateObject_1$7 || (templateObject_1$7 = __makeTemplateObject(["\n mutation customerLogin($email: String!, $password: String!) {\n customerLogin(email: $email, password: $password) {\n token\n tokenExpiry\n customer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\n addressLine1\n addressLine2\n identityNumber\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n }\n district {\n id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n }\n phone\n accountStatus\n email\n firstName\n subscriptionStatus\n }\n }\n }\n "], ["\n mutation customerLogin($email: String!, $password: String!) {\n customerLogin(email: $email, password: $password) {\n token\n tokenExpiry\n customer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\n addressLine1\n addressLine2\n identityNumber\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n }\n district {\n id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n }\n phone\n accountStatus\n email\n firstName\n subscriptionStatus\n }\n }\n }\n "])));
27212
27254
  _b.label = 1;
27213
27255
  case 1:
27214
27256
  _b.trys.push([1, 3, , 4]);
@@ -27596,9 +27638,43 @@ var IkasCustomerAPI = /** @class */ (function () {
27596
27638
  });
27597
27639
  });
27598
27640
  };
27641
+ IkasCustomerAPI.createCustomerEmailSubscription = function (email) {
27642
+ return __awaiter(this, void 0, void 0, function () {
27643
+ var MUTATION, errors, err_11;
27644
+ return __generator(this, function (_a) {
27645
+ switch (_a.label) {
27646
+ case 0:
27647
+ MUTATION = src(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n mutation createCustomerEmailSubscription(\n $input: CreateCustomerEmailSubscriptionInput!\n ) {\n createCustomerEmailSubscription(input: $input) {\n id\n }\n }\n "], ["\n mutation createCustomerEmailSubscription(\n $input: CreateCustomerEmailSubscriptionInput!\n ) {\n createCustomerEmailSubscription(input: $input) {\n id\n }\n }\n "])));
27648
+ _a.label = 1;
27649
+ case 1:
27650
+ _a.trys.push([1, 3, , 4]);
27651
+ return [4 /*yield*/, apollo
27652
+ .getClient()
27653
+ .mutate({
27654
+ mutation: MUTATION,
27655
+ variables: {
27656
+ input: {
27657
+ email: email,
27658
+ },
27659
+ },
27660
+ })];
27661
+ case 2:
27662
+ errors = (_a.sent()).errors;
27663
+ if (errors && errors.length)
27664
+ return [2 /*return*/, false];
27665
+ return [3 /*break*/, 4];
27666
+ case 3:
27667
+ err_11 = _a.sent();
27668
+ console.log(err_11);
27669
+ return [3 /*break*/, 4];
27670
+ case 4: return [2 /*return*/, true];
27671
+ }
27672
+ });
27673
+ });
27674
+ };
27599
27675
  return IkasCustomerAPI;
27600
27676
  }());
27601
- var templateObject_1$7, templateObject_2$5, templateObject_3$3, templateObject_4$2, templateObject_5$1, templateObject_6$1, templateObject_7$1, templateObject_8$1, templateObject_9, templateObject_10, templateObject_11;
27677
+ var templateObject_1$7, templateObject_2$5, templateObject_3$3, templateObject_4$2, templateObject_5$1, templateObject_6$1, templateObject_7$1, templateObject_8$1, templateObject_9, templateObject_10, templateObject_11, templateObject_12;
27602
27678
 
27603
27679
  var IkasDistrictAPI = /** @class */ (function () {
27604
27680
  function IkasDistrictAPI() {
package/build/index.js CHANGED
@@ -11666,8 +11666,19 @@ var IkasCustomer = /** @class */ (function () {
11666
11666
  this.addresses = data.addresses
11667
11667
  ? data.addresses.map(function (a) { return new IkasCustomerAddress(a); })
11668
11668
  : [];
11669
+ this.subscriptionStatus = data.subscriptionStatus || null;
11669
11670
  mobx.makeAutoObservable(this);
11670
11671
  }
11672
+ Object.defineProperty(IkasCustomer.prototype, "isSubscribed", {
11673
+ get: function () {
11674
+ return (this.subscriptionStatus ===
11675
+ IkasCustomerEmailSubscriptionStatus.SUBSCRIBED ||
11676
+ this.subscriptionStatus ===
11677
+ IkasCustomerEmailSubscriptionStatus.PENDING_CONFIRMATION);
11678
+ },
11679
+ enumerable: false,
11680
+ configurable: true
11681
+ });
11671
11682
  return IkasCustomer;
11672
11683
  }());
11673
11684
  var IkasCustomerAccountStatus;
@@ -11676,7 +11687,13 @@ var IkasCustomerAccountStatus;
11676
11687
  IkasCustomerAccountStatus["DECLINED_ACCOUNT_INVITATION"] = "DECLINED_ACCOUNT_INVITATION";
11677
11688
  IkasCustomerAccountStatus["DISABLED_ACCOUNT"] = "DISABLED_ACCOUNT";
11678
11689
  IkasCustomerAccountStatus["INVITED_TO_CREATE_ACCOUNT"] = "INVITED_TO_CREATE_ACCOUNT";
11679
- })(IkasCustomerAccountStatus || (IkasCustomerAccountStatus = {}));
11690
+ })(IkasCustomerAccountStatus || (IkasCustomerAccountStatus = {}));
11691
+ var IkasCustomerEmailSubscriptionStatus;
11692
+ (function (IkasCustomerEmailSubscriptionStatus) {
11693
+ IkasCustomerEmailSubscriptionStatus["NOT_SUBSCRIBED"] = "NOT_SUBSCRIBED";
11694
+ IkasCustomerEmailSubscriptionStatus["PENDING_CONFIRMATION"] = "PENDING_CONFIRMATION";
11695
+ IkasCustomerEmailSubscriptionStatus["SUBSCRIBED"] = "SUBSCRIBED";
11696
+ })(IkasCustomerEmailSubscriptionStatus || (IkasCustomerEmailSubscriptionStatus = {}));
11680
11697
 
11681
11698
  (function (IkasCardAssociation) {
11682
11699
  IkasCardAssociation["AMERICAN_EXPRESS"] = "AMERICAN_EXPRESS";
@@ -17456,6 +17473,7 @@ var isServer$3 = typeof localStorage === "undefined";
17456
17473
  var LS_TOKEN_KEY = "customerToken";
17457
17474
  var LS_TOKEN_EXPIRY = "customerTokenExpiry";
17458
17475
  var LS_CUSTOMER_KEY = "customer";
17476
+ var LS_CUSTOMER_SUB_KEY = "customerEmailSubscription";
17459
17477
  var IkasCustomerStore = /** @class */ (function () {
17460
17478
  function IkasCustomerStore(baseStore) {
17461
17479
  var _this = this;
@@ -17694,6 +17712,19 @@ var IkasCustomerStore = /** @class */ (function () {
17694
17712
  }
17695
17713
  });
17696
17714
  }); };
17715
+ this.createEmailSubscription = function (email) { return __awaiter(_this, void 0, void 0, function () {
17716
+ var isSuccess;
17717
+ return __generator(this, function (_a) {
17718
+ switch (_a.label) {
17719
+ case 0: return [4 /*yield*/, IkasCustomerAPI.createCustomerEmailSubscription(email)];
17720
+ case 1:
17721
+ isSuccess = _a.sent();
17722
+ if (isSuccess)
17723
+ window.localStorage.setItem(LS_CUSTOMER_SUB_KEY, "true");
17724
+ return [2 /*return*/, isSuccess];
17725
+ }
17726
+ });
17727
+ }); };
17697
17728
  this.baseStore = baseStore;
17698
17729
  this.init();
17699
17730
  mobx.makeAutoObservable(this);
@@ -17705,6 +17736,17 @@ var IkasCustomerStore = /** @class */ (function () {
17705
17736
  enumerable: false,
17706
17737
  configurable: true
17707
17738
  });
17739
+ Object.defineProperty(IkasCustomerStore.prototype, "canCreateEmailSubscription", {
17740
+ get: function () {
17741
+ var _a;
17742
+ if (((_a = this.customer) === null || _a === void 0 ? void 0 : _a.isSubscribed) || isServer$3)
17743
+ return false;
17744
+ var alreadySubbed = window.localStorage.getItem(LS_CUSTOMER_SUB_KEY);
17745
+ return !alreadySubbed;
17746
+ },
17747
+ enumerable: false,
17748
+ configurable: true
17749
+ });
17708
17750
  IkasCustomerStore.prototype.init = function () {
17709
17751
  return __awaiter(this, void 0, void 0, function () {
17710
17752
  return __generator(this, function (_a) {
@@ -21160,7 +21202,7 @@ var IkasProductList = /** @class */ (function () {
21160
21202
  }
21161
21203
  });
21162
21204
  }); };
21163
- this.getInitial = function (queryParams) { return __awaiter(_this, void 0, void 0, function () {
21205
+ this.getInitial = function (queryParams, isInfiteScrollReturn) { return __awaiter(_this, void 0, void 0, function () {
21164
21206
  var fetchRequestTime, page, limit, response_1, data, err_1;
21165
21207
  var _a;
21166
21208
  return __generator(this, function (_b) {
@@ -21172,7 +21214,7 @@ var IkasProductList = /** @class */ (function () {
21172
21214
  _b.label = 1;
21173
21215
  case 1:
21174
21216
  _b.trys.push([1, 5, 6, 7]);
21175
- page = this._page || 1;
21217
+ page = isInfiteScrollReturn ? this._page : 1;
21176
21218
  limit = this._limit;
21177
21219
  if (!(this.isFilterable && !this.filters)) return [3 /*break*/, 3];
21178
21220
  return [4 /*yield*/, this.getFilters()];
@@ -21402,7 +21444,7 @@ var IkasProductList = /** @class */ (function () {
21402
21444
  this.getInitial(queryParams);
21403
21445
  }
21404
21446
  else if (this._page > 1) {
21405
- this.getInitial();
21447
+ this.getInitial(undefined, true);
21406
21448
  }
21407
21449
  }
21408
21450
  }
@@ -27187,7 +27229,7 @@ var IkasCustomerAPI = /** @class */ (function () {
27187
27229
  return __generator(this, function (_b) {
27188
27230
  switch (_b.label) {
27189
27231
  case 0:
27190
- MUTATION = src(templateObject_1$7 || (templateObject_1$7 = __makeTemplateObject(["\n mutation customerLogin($email: String!, $password: String!) {\n customerLogin(email: $email, password: $password) {\n token\n tokenExpiry\n customer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\n addressLine1\n addressLine2\n identityNumber\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n }\n district {\n id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n }\n phone\n accountStatus\n email\n firstName\n }\n }\n }\n "], ["\n mutation customerLogin($email: String!, $password: String!) {\n customerLogin(email: $email, password: $password) {\n token\n tokenExpiry\n customer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\n addressLine1\n addressLine2\n identityNumber\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n }\n district {\n id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n }\n phone\n accountStatus\n email\n firstName\n }\n }\n }\n "])));
27232
+ MUTATION = src(templateObject_1$7 || (templateObject_1$7 = __makeTemplateObject(["\n mutation customerLogin($email: String!, $password: String!) {\n customerLogin(email: $email, password: $password) {\n token\n tokenExpiry\n customer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\n addressLine1\n addressLine2\n identityNumber\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n }\n district {\n id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n }\n phone\n accountStatus\n email\n firstName\n subscriptionStatus\n }\n }\n }\n "], ["\n mutation customerLogin($email: String!, $password: String!) {\n customerLogin(email: $email, password: $password) {\n token\n tokenExpiry\n customer {\n id\n isEmailVerified\n isPhoneVerified\n lastName\n addresses {\n addressLine1\n addressLine2\n identityNumber\n city {\n code\n id\n name\n }\n company\n country {\n code\n id\n name\n }\n district {\n id\n name\n code\n }\n id\n firstName\n isDefault\n lastName\n postalCode\n state {\n name\n id\n code\n }\n taxNumber\n taxOffice\n title\n }\n phone\n accountStatus\n email\n firstName\n subscriptionStatus\n }\n }\n }\n "])));
27191
27233
  _b.label = 1;
27192
27234
  case 1:
27193
27235
  _b.trys.push([1, 3, , 4]);
@@ -27575,9 +27617,43 @@ var IkasCustomerAPI = /** @class */ (function () {
27575
27617
  });
27576
27618
  });
27577
27619
  };
27620
+ IkasCustomerAPI.createCustomerEmailSubscription = function (email) {
27621
+ return __awaiter(this, void 0, void 0, function () {
27622
+ var MUTATION, errors, err_11;
27623
+ return __generator(this, function (_a) {
27624
+ switch (_a.label) {
27625
+ case 0:
27626
+ MUTATION = src(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n mutation createCustomerEmailSubscription(\n $input: CreateCustomerEmailSubscriptionInput!\n ) {\n createCustomerEmailSubscription(input: $input) {\n id\n }\n }\n "], ["\n mutation createCustomerEmailSubscription(\n $input: CreateCustomerEmailSubscriptionInput!\n ) {\n createCustomerEmailSubscription(input: $input) {\n id\n }\n }\n "])));
27627
+ _a.label = 1;
27628
+ case 1:
27629
+ _a.trys.push([1, 3, , 4]);
27630
+ return [4 /*yield*/, apollo
27631
+ .getClient()
27632
+ .mutate({
27633
+ mutation: MUTATION,
27634
+ variables: {
27635
+ input: {
27636
+ email: email,
27637
+ },
27638
+ },
27639
+ })];
27640
+ case 2:
27641
+ errors = (_a.sent()).errors;
27642
+ if (errors && errors.length)
27643
+ return [2 /*return*/, false];
27644
+ return [3 /*break*/, 4];
27645
+ case 3:
27646
+ err_11 = _a.sent();
27647
+ console.log(err_11);
27648
+ return [3 /*break*/, 4];
27649
+ case 4: return [2 /*return*/, true];
27650
+ }
27651
+ });
27652
+ });
27653
+ };
27578
27654
  return IkasCustomerAPI;
27579
27655
  }());
27580
- var templateObject_1$7, templateObject_2$5, templateObject_3$3, templateObject_4$2, templateObject_5$1, templateObject_6$1, templateObject_7$1, templateObject_8$1, templateObject_9, templateObject_10, templateObject_11;
27656
+ var templateObject_1$7, templateObject_2$5, templateObject_3$3, templateObject_4$2, templateObject_5$1, templateObject_6$1, templateObject_7$1, templateObject_8$1, templateObject_9, templateObject_10, templateObject_11, templateObject_12;
27581
27657
 
27582
27658
  var IkasDistrictAPI = /** @class */ (function () {
27583
27659
  function IkasDistrictAPI() {
@@ -9,7 +9,9 @@ export declare class IkasCustomer {
9
9
  isPhoneVerified: boolean;
10
10
  accountStatus: IkasCustomerAccountStatus;
11
11
  addresses: IkasCustomerAddress[];
12
+ subscriptionStatus: IkasCustomerEmailSubscriptionStatus | null;
12
13
  constructor(data: Partial<IkasCustomer>);
14
+ get isSubscribed(): boolean;
13
15
  }
14
16
  export declare enum IkasCustomerAccountStatus {
15
17
  ACTIVE_ACCOUNT = "ACTIVE_ACCOUNT",
@@ -17,3 +19,8 @@ export declare enum IkasCustomerAccountStatus {
17
19
  DISABLED_ACCOUNT = "DISABLED_ACCOUNT",
18
20
  INVITED_TO_CREATE_ACCOUNT = "INVITED_TO_CREATE_ACCOUNT"
19
21
  }
22
+ export declare enum IkasCustomerEmailSubscriptionStatus {
23
+ NOT_SUBSCRIBED = "NOT_SUBSCRIBED",
24
+ PENDING_CONFIRMATION = "PENDING_CONFIRMATION",
25
+ SUBSCRIBED = "SUBSCRIBED"
26
+ }
@@ -14,6 +14,7 @@ export declare class IkasCustomerStore {
14
14
  private _initialized;
15
15
  constructor(baseStore?: IkasBaseStore);
16
16
  get initialized(): boolean;
17
+ get canCreateEmailSubscription(): boolean;
17
18
  login: (email: string, password: string) => Promise<boolean>;
18
19
  register: (firstName: string, lastName: string, email: string, password: string) => Promise<boolean>;
19
20
  saveContactForm: (input: SaveContactForm) => Promise<boolean | undefined>;
@@ -34,6 +35,7 @@ export declare class IkasCustomerStore {
34
35
  addItemToFavorite: (productId: string) => Promise<boolean>;
35
36
  removeItemFromFavorite: (productId: string) => Promise<boolean>;
36
37
  isProductFavorite: (productId: string) => Promise<boolean>;
38
+ createEmailSubscription: (email: string) => Promise<boolean>;
37
39
  private init;
38
40
  private getCustomer;
39
41
  private refreshToken;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "0.0.155",
3
+ "version": "0.0.156",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.es.js",
6
6
  "author": "Umut Ozan Yıldırım",