@ikas/storefront 0.0.155 → 0.0.157
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/__generated__/global-types.d.ts +7 -0
- package/build/api/blog/__generated__/getBlog.d.ts +2 -0
- package/build/api/blog/__generated__/listBlog.d.ts +2 -1
- package/build/api/customer/__generated__/createCustomerEmailSubscription.d.ts +11 -0
- package/build/api/customer/index.d.ts +1 -0
- package/build/index.es.js +89 -6
- package/build/index.js +89 -6
- package/build/models/data/customer/index.d.ts +7 -0
- package/build/store/customer.d.ts +3 -0
- package/package.json +1 -1
|
@@ -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
|
+
}
|
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;
|
|
@@ -17458,6 +17476,7 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
17458
17476
|
this.tokenExpiry = null;
|
|
17459
17477
|
this.baseStore = null;
|
|
17460
17478
|
this._initialized = false;
|
|
17479
|
+
this._visitorSubscribedEmail = false;
|
|
17461
17480
|
this.login = function (email, password) { return __awaiter(_this, void 0, void 0, function () {
|
|
17462
17481
|
var response, cart;
|
|
17463
17482
|
var _a;
|
|
@@ -17688,6 +17707,25 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
17688
17707
|
}
|
|
17689
17708
|
});
|
|
17690
17709
|
}); };
|
|
17710
|
+
this.createEmailSubscription = function (email) { return __awaiter(_this, void 0, void 0, function () {
|
|
17711
|
+
var isSuccess;
|
|
17712
|
+
return __generator(this, function (_a) {
|
|
17713
|
+
switch (_a.label) {
|
|
17714
|
+
case 0: return [4 /*yield*/, IkasCustomerAPI.createCustomerEmailSubscription(email)];
|
|
17715
|
+
case 1:
|
|
17716
|
+
isSuccess = _a.sent();
|
|
17717
|
+
if (isSuccess) {
|
|
17718
|
+
window.localStorage.setItem(LS_CUSTOMER_SUB_KEY, "true");
|
|
17719
|
+
if (this.customer)
|
|
17720
|
+
this.customer.subscriptionStatus ===
|
|
17721
|
+
IkasCustomerEmailSubscriptionStatus.SUBSCRIBED;
|
|
17722
|
+
else
|
|
17723
|
+
this._visitorSubscribedEmail = true;
|
|
17724
|
+
}
|
|
17725
|
+
return [2 /*return*/, isSuccess];
|
|
17726
|
+
}
|
|
17727
|
+
});
|
|
17728
|
+
}); };
|
|
17691
17729
|
this.baseStore = baseStore;
|
|
17692
17730
|
this.init();
|
|
17693
17731
|
makeAutoObservable(this);
|
|
@@ -17699,6 +17737,17 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
17699
17737
|
enumerable: false,
|
|
17700
17738
|
configurable: true
|
|
17701
17739
|
});
|
|
17740
|
+
Object.defineProperty(IkasCustomerStore.prototype, "canCreateEmailSubscription", {
|
|
17741
|
+
get: function () {
|
|
17742
|
+
var _a;
|
|
17743
|
+
if (((_a = this.customer) === null || _a === void 0 ? void 0 : _a.isSubscribed) || isServer$3 || this._visitorSubscribedEmail)
|
|
17744
|
+
return false;
|
|
17745
|
+
var alreadySubbed = window.localStorage.getItem(LS_CUSTOMER_SUB_KEY);
|
|
17746
|
+
return !alreadySubbed;
|
|
17747
|
+
},
|
|
17748
|
+
enumerable: false,
|
|
17749
|
+
configurable: true
|
|
17750
|
+
});
|
|
17702
17751
|
IkasCustomerStore.prototype.init = function () {
|
|
17703
17752
|
return __awaiter(this, void 0, void 0, function () {
|
|
17704
17753
|
return __generator(this, function (_a) {
|
|
@@ -21177,7 +21226,7 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21177
21226
|
}
|
|
21178
21227
|
});
|
|
21179
21228
|
}); };
|
|
21180
|
-
this.getInitial = function (queryParams) { return __awaiter(_this, void 0, void 0, function () {
|
|
21229
|
+
this.getInitial = function (queryParams, isInfiteScrollReturn) { return __awaiter(_this, void 0, void 0, function () {
|
|
21181
21230
|
var fetchRequestTime, page, limit, response_1, data, err_1;
|
|
21182
21231
|
var _a;
|
|
21183
21232
|
return __generator(this, function (_b) {
|
|
@@ -21189,7 +21238,7 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21189
21238
|
_b.label = 1;
|
|
21190
21239
|
case 1:
|
|
21191
21240
|
_b.trys.push([1, 5, 6, 7]);
|
|
21192
|
-
page = this._page
|
|
21241
|
+
page = isInfiteScrollReturn ? this._page : 1;
|
|
21193
21242
|
limit = this._limit;
|
|
21194
21243
|
if (!(this.isFilterable && !this.filters)) return [3 /*break*/, 3];
|
|
21195
21244
|
return [4 /*yield*/, this.getFilters()];
|
|
@@ -21419,7 +21468,7 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21419
21468
|
this.getInitial(queryParams);
|
|
21420
21469
|
}
|
|
21421
21470
|
else if (this._page > 1) {
|
|
21422
|
-
this.getInitial();
|
|
21471
|
+
this.getInitial(undefined, true);
|
|
21423
21472
|
}
|
|
21424
21473
|
}
|
|
21425
21474
|
}
|
|
@@ -27208,7 +27257,7 @@ var IkasCustomerAPI = /** @class */ (function () {
|
|
|
27208
27257
|
return __generator(this, function (_b) {
|
|
27209
27258
|
switch (_b.label) {
|
|
27210
27259
|
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 "])));
|
|
27260
|
+
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
27261
|
_b.label = 1;
|
|
27213
27262
|
case 1:
|
|
27214
27263
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -27596,9 +27645,43 @@ var IkasCustomerAPI = /** @class */ (function () {
|
|
|
27596
27645
|
});
|
|
27597
27646
|
});
|
|
27598
27647
|
};
|
|
27648
|
+
IkasCustomerAPI.createCustomerEmailSubscription = function (email) {
|
|
27649
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
27650
|
+
var MUTATION, errors, err_11;
|
|
27651
|
+
return __generator(this, function (_a) {
|
|
27652
|
+
switch (_a.label) {
|
|
27653
|
+
case 0:
|
|
27654
|
+
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 "])));
|
|
27655
|
+
_a.label = 1;
|
|
27656
|
+
case 1:
|
|
27657
|
+
_a.trys.push([1, 3, , 4]);
|
|
27658
|
+
return [4 /*yield*/, apollo
|
|
27659
|
+
.getClient()
|
|
27660
|
+
.mutate({
|
|
27661
|
+
mutation: MUTATION,
|
|
27662
|
+
variables: {
|
|
27663
|
+
input: {
|
|
27664
|
+
email: email,
|
|
27665
|
+
},
|
|
27666
|
+
},
|
|
27667
|
+
})];
|
|
27668
|
+
case 2:
|
|
27669
|
+
errors = (_a.sent()).errors;
|
|
27670
|
+
if (errors && errors.length)
|
|
27671
|
+
return [2 /*return*/, false];
|
|
27672
|
+
return [3 /*break*/, 4];
|
|
27673
|
+
case 3:
|
|
27674
|
+
err_11 = _a.sent();
|
|
27675
|
+
console.log(err_11);
|
|
27676
|
+
return [2 /*return*/, false];
|
|
27677
|
+
case 4: return [2 /*return*/, true];
|
|
27678
|
+
}
|
|
27679
|
+
});
|
|
27680
|
+
});
|
|
27681
|
+
};
|
|
27599
27682
|
return IkasCustomerAPI;
|
|
27600
27683
|
}());
|
|
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;
|
|
27684
|
+
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
27685
|
|
|
27603
27686
|
var IkasDistrictAPI = /** @class */ (function () {
|
|
27604
27687
|
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;
|
|
@@ -17464,6 +17482,7 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
17464
17482
|
this.tokenExpiry = null;
|
|
17465
17483
|
this.baseStore = null;
|
|
17466
17484
|
this._initialized = false;
|
|
17485
|
+
this._visitorSubscribedEmail = false;
|
|
17467
17486
|
this.login = function (email, password) { return __awaiter(_this, void 0, void 0, function () {
|
|
17468
17487
|
var response, cart;
|
|
17469
17488
|
var _a;
|
|
@@ -17694,6 +17713,25 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
17694
17713
|
}
|
|
17695
17714
|
});
|
|
17696
17715
|
}); };
|
|
17716
|
+
this.createEmailSubscription = function (email) { return __awaiter(_this, void 0, void 0, function () {
|
|
17717
|
+
var isSuccess;
|
|
17718
|
+
return __generator(this, function (_a) {
|
|
17719
|
+
switch (_a.label) {
|
|
17720
|
+
case 0: return [4 /*yield*/, IkasCustomerAPI.createCustomerEmailSubscription(email)];
|
|
17721
|
+
case 1:
|
|
17722
|
+
isSuccess = _a.sent();
|
|
17723
|
+
if (isSuccess) {
|
|
17724
|
+
window.localStorage.setItem(LS_CUSTOMER_SUB_KEY, "true");
|
|
17725
|
+
if (this.customer)
|
|
17726
|
+
this.customer.subscriptionStatus ===
|
|
17727
|
+
IkasCustomerEmailSubscriptionStatus.SUBSCRIBED;
|
|
17728
|
+
else
|
|
17729
|
+
this._visitorSubscribedEmail = true;
|
|
17730
|
+
}
|
|
17731
|
+
return [2 /*return*/, isSuccess];
|
|
17732
|
+
}
|
|
17733
|
+
});
|
|
17734
|
+
}); };
|
|
17697
17735
|
this.baseStore = baseStore;
|
|
17698
17736
|
this.init();
|
|
17699
17737
|
mobx.makeAutoObservable(this);
|
|
@@ -17705,6 +17743,17 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
17705
17743
|
enumerable: false,
|
|
17706
17744
|
configurable: true
|
|
17707
17745
|
});
|
|
17746
|
+
Object.defineProperty(IkasCustomerStore.prototype, "canCreateEmailSubscription", {
|
|
17747
|
+
get: function () {
|
|
17748
|
+
var _a;
|
|
17749
|
+
if (((_a = this.customer) === null || _a === void 0 ? void 0 : _a.isSubscribed) || isServer$3 || this._visitorSubscribedEmail)
|
|
17750
|
+
return false;
|
|
17751
|
+
var alreadySubbed = window.localStorage.getItem(LS_CUSTOMER_SUB_KEY);
|
|
17752
|
+
return !alreadySubbed;
|
|
17753
|
+
},
|
|
17754
|
+
enumerable: false,
|
|
17755
|
+
configurable: true
|
|
17756
|
+
});
|
|
17708
17757
|
IkasCustomerStore.prototype.init = function () {
|
|
17709
17758
|
return __awaiter(this, void 0, void 0, function () {
|
|
17710
17759
|
return __generator(this, function (_a) {
|
|
@@ -21160,7 +21209,7 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21160
21209
|
}
|
|
21161
21210
|
});
|
|
21162
21211
|
}); };
|
|
21163
|
-
this.getInitial = function (queryParams) { return __awaiter(_this, void 0, void 0, function () {
|
|
21212
|
+
this.getInitial = function (queryParams, isInfiteScrollReturn) { return __awaiter(_this, void 0, void 0, function () {
|
|
21164
21213
|
var fetchRequestTime, page, limit, response_1, data, err_1;
|
|
21165
21214
|
var _a;
|
|
21166
21215
|
return __generator(this, function (_b) {
|
|
@@ -21172,7 +21221,7 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21172
21221
|
_b.label = 1;
|
|
21173
21222
|
case 1:
|
|
21174
21223
|
_b.trys.push([1, 5, 6, 7]);
|
|
21175
|
-
page = this._page
|
|
21224
|
+
page = isInfiteScrollReturn ? this._page : 1;
|
|
21176
21225
|
limit = this._limit;
|
|
21177
21226
|
if (!(this.isFilterable && !this.filters)) return [3 /*break*/, 3];
|
|
21178
21227
|
return [4 /*yield*/, this.getFilters()];
|
|
@@ -21402,7 +21451,7 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21402
21451
|
this.getInitial(queryParams);
|
|
21403
21452
|
}
|
|
21404
21453
|
else if (this._page > 1) {
|
|
21405
|
-
this.getInitial();
|
|
21454
|
+
this.getInitial(undefined, true);
|
|
21406
21455
|
}
|
|
21407
21456
|
}
|
|
21408
21457
|
}
|
|
@@ -27187,7 +27236,7 @@ var IkasCustomerAPI = /** @class */ (function () {
|
|
|
27187
27236
|
return __generator(this, function (_b) {
|
|
27188
27237
|
switch (_b.label) {
|
|
27189
27238
|
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 "])));
|
|
27239
|
+
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
27240
|
_b.label = 1;
|
|
27192
27241
|
case 1:
|
|
27193
27242
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -27575,9 +27624,43 @@ var IkasCustomerAPI = /** @class */ (function () {
|
|
|
27575
27624
|
});
|
|
27576
27625
|
});
|
|
27577
27626
|
};
|
|
27627
|
+
IkasCustomerAPI.createCustomerEmailSubscription = function (email) {
|
|
27628
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
27629
|
+
var MUTATION, errors, err_11;
|
|
27630
|
+
return __generator(this, function (_a) {
|
|
27631
|
+
switch (_a.label) {
|
|
27632
|
+
case 0:
|
|
27633
|
+
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 "])));
|
|
27634
|
+
_a.label = 1;
|
|
27635
|
+
case 1:
|
|
27636
|
+
_a.trys.push([1, 3, , 4]);
|
|
27637
|
+
return [4 /*yield*/, apollo
|
|
27638
|
+
.getClient()
|
|
27639
|
+
.mutate({
|
|
27640
|
+
mutation: MUTATION,
|
|
27641
|
+
variables: {
|
|
27642
|
+
input: {
|
|
27643
|
+
email: email,
|
|
27644
|
+
},
|
|
27645
|
+
},
|
|
27646
|
+
})];
|
|
27647
|
+
case 2:
|
|
27648
|
+
errors = (_a.sent()).errors;
|
|
27649
|
+
if (errors && errors.length)
|
|
27650
|
+
return [2 /*return*/, false];
|
|
27651
|
+
return [3 /*break*/, 4];
|
|
27652
|
+
case 3:
|
|
27653
|
+
err_11 = _a.sent();
|
|
27654
|
+
console.log(err_11);
|
|
27655
|
+
return [2 /*return*/, false];
|
|
27656
|
+
case 4: return [2 /*return*/, true];
|
|
27657
|
+
}
|
|
27658
|
+
});
|
|
27659
|
+
});
|
|
27660
|
+
};
|
|
27578
27661
|
return IkasCustomerAPI;
|
|
27579
27662
|
}());
|
|
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;
|
|
27663
|
+
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
27664
|
|
|
27582
27665
|
var IkasDistrictAPI = /** @class */ (function () {
|
|
27583
27666
|
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
|
+
}
|
|
@@ -12,8 +12,10 @@ export declare class IkasCustomerStore {
|
|
|
12
12
|
tokenExpiry?: number | null;
|
|
13
13
|
private baseStore?;
|
|
14
14
|
private _initialized;
|
|
15
|
+
private _visitorSubscribedEmail;
|
|
15
16
|
constructor(baseStore?: IkasBaseStore);
|
|
16
17
|
get initialized(): boolean;
|
|
18
|
+
get canCreateEmailSubscription(): boolean;
|
|
17
19
|
login: (email: string, password: string) => Promise<boolean>;
|
|
18
20
|
register: (firstName: string, lastName: string, email: string, password: string) => Promise<boolean>;
|
|
19
21
|
saveContactForm: (input: SaveContactForm) => Promise<boolean | undefined>;
|
|
@@ -34,6 +36,7 @@ export declare class IkasCustomerStore {
|
|
|
34
36
|
addItemToFavorite: (productId: string) => Promise<boolean>;
|
|
35
37
|
removeItemFromFavorite: (productId: string) => Promise<boolean>;
|
|
36
38
|
isProductFavorite: (productId: string) => Promise<boolean>;
|
|
39
|
+
createEmailSubscription: (email: string) => Promise<boolean>;
|
|
37
40
|
private init;
|
|
38
41
|
private getCustomer;
|
|
39
42
|
private refreshToken;
|