@ikas/storefront 0.0.154 → 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.
- 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 +132 -7
- package/build/index.js +132 -7
- package/build/models/data/customer/index.d.ts +7 -0
- package/build/models/data/product/variant/index.d.ts +1 -0
- package/build/models/ui/index.d.ts +1 -1
- package/build/models/ui/product-detail/index.d.ts +13 -1
- package/build/store/customer.d.ts +2 -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;
|
|
@@ -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) {
|
|
@@ -17881,7 +17923,13 @@ var IkasOrder = /** @class */ (function () {
|
|
|
17881
17923
|
}
|
|
17882
17924
|
Object.defineProperty(IkasOrder.prototype, "refundableItems", {
|
|
17883
17925
|
get: function () {
|
|
17884
|
-
return this.orderLineItems.filter(function (item) {
|
|
17926
|
+
return this.orderLineItems.filter(function (item) {
|
|
17927
|
+
return [
|
|
17928
|
+
OrderLineItemStatusEnum$1.FULFILLED,
|
|
17929
|
+
OrderLineItemStatusEnum$1.UNFULFILLED,
|
|
17930
|
+
OrderLineItemStatusEnum$1.DELIVERED,
|
|
17931
|
+
].includes(item.status);
|
|
17932
|
+
});
|
|
17885
17933
|
},
|
|
17886
17934
|
enumerable: false,
|
|
17887
17935
|
configurable: true
|
|
@@ -18125,6 +18173,7 @@ var IkasProductVariant = /** @class */ (function () {
|
|
|
18125
18173
|
? new IkasProductPrice(data.price)
|
|
18126
18174
|
: new IkasProductPrice();
|
|
18127
18175
|
this.stock = data.stock || 0;
|
|
18176
|
+
this.isActive = data.isActive !== undefined ? data.isActive : true;
|
|
18128
18177
|
makeAutoObservable(this);
|
|
18129
18178
|
}
|
|
18130
18179
|
Object.defineProperty(IkasProductVariant.prototype, "mainImage", {
|
|
@@ -19953,6 +20002,47 @@ var IkasProductDetail = /** @class */ (function () {
|
|
|
19953
20002
|
enumerable: false,
|
|
19954
20003
|
configurable: true
|
|
19955
20004
|
});
|
|
20005
|
+
Object.defineProperty(IkasProductDetail.prototype, "displayedVariantTypes", {
|
|
20006
|
+
get: function () {
|
|
20007
|
+
var _this = this;
|
|
20008
|
+
var displayedVariantTypes = this.product.variantTypes.map(function (productVariantType) {
|
|
20009
|
+
var variantType = productVariantType.variantType;
|
|
20010
|
+
var displayedVariantValues = [];
|
|
20011
|
+
variantType.values.forEach(function (variantValue) {
|
|
20012
|
+
var otherSelectedVariantValues = _this.selectedVariantValues.filter(function (vv) { return vv.variantTypeId !== variantType.id; });
|
|
20013
|
+
var allVariantValues = otherSelectedVariantValues.concat(variantValue);
|
|
20014
|
+
var variant = _this.product.variants.find(function (v) {
|
|
20015
|
+
return v.variantValues.every(function (vv) {
|
|
20016
|
+
return allVariantValues.some(function (avv) { return avv.id === vv.id; });
|
|
20017
|
+
});
|
|
20018
|
+
});
|
|
20019
|
+
var isSelected = _this.selectedVariant.variantValues.some(function (vv) { return vv.id === variantValue.id; });
|
|
20020
|
+
var hasStock = variant
|
|
20021
|
+
? variant.stock > 0 && variant.isActive
|
|
20022
|
+
: true;
|
|
20023
|
+
if (variant) {
|
|
20024
|
+
displayedVariantValues.push({
|
|
20025
|
+
variant: variant,
|
|
20026
|
+
variantValue: variantValue,
|
|
20027
|
+
hasStock: hasStock,
|
|
20028
|
+
isSelected: isSelected,
|
|
20029
|
+
});
|
|
20030
|
+
}
|
|
20031
|
+
});
|
|
20032
|
+
return {
|
|
20033
|
+
variantType: variantType,
|
|
20034
|
+
displayedVariantValues: displayedVariantValues,
|
|
20035
|
+
};
|
|
20036
|
+
});
|
|
20037
|
+
// Filter inactive variantValues if there is only a single variant type
|
|
20038
|
+
if (displayedVariantTypes.length === 1) {
|
|
20039
|
+
displayedVariantTypes[0].displayedVariantValues = displayedVariantTypes[0].displayedVariantValues.filter(function (dvv) { return dvv.variant.isActive; });
|
|
20040
|
+
}
|
|
20041
|
+
return displayedVariantTypes;
|
|
20042
|
+
},
|
|
20043
|
+
enumerable: false,
|
|
20044
|
+
configurable: true
|
|
20045
|
+
});
|
|
19956
20046
|
IkasProductDetail.prototype.selectVariantValue = function (variantValue) {
|
|
19957
20047
|
var _a;
|
|
19958
20048
|
var metaData = this.product.metaData;
|
|
@@ -21129,7 +21219,7 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21129
21219
|
}
|
|
21130
21220
|
});
|
|
21131
21221
|
}); };
|
|
21132
|
-
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 () {
|
|
21133
21223
|
var fetchRequestTime, page, limit, response_1, data, err_1;
|
|
21134
21224
|
var _a;
|
|
21135
21225
|
return __generator(this, function (_b) {
|
|
@@ -21141,7 +21231,7 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21141
21231
|
_b.label = 1;
|
|
21142
21232
|
case 1:
|
|
21143
21233
|
_b.trys.push([1, 5, 6, 7]);
|
|
21144
|
-
page = this._page
|
|
21234
|
+
page = isInfiteScrollReturn ? this._page : 1;
|
|
21145
21235
|
limit = this._limit;
|
|
21146
21236
|
if (!(this.isFilterable && !this.filters)) return [3 /*break*/, 3];
|
|
21147
21237
|
return [4 /*yield*/, this.getFilters()];
|
|
@@ -21371,7 +21461,7 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21371
21461
|
this.getInitial(queryParams);
|
|
21372
21462
|
}
|
|
21373
21463
|
else if (this._page > 1) {
|
|
21374
|
-
this.getInitial();
|
|
21464
|
+
this.getInitial(undefined, true);
|
|
21375
21465
|
}
|
|
21376
21466
|
}
|
|
21377
21467
|
}
|
|
@@ -27160,7 +27250,7 @@ var IkasCustomerAPI = /** @class */ (function () {
|
|
|
27160
27250
|
return __generator(this, function (_b) {
|
|
27161
27251
|
switch (_b.label) {
|
|
27162
27252
|
case 0:
|
|
27163
|
-
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 "])));
|
|
27164
27254
|
_b.label = 1;
|
|
27165
27255
|
case 1:
|
|
27166
27256
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -27548,9 +27638,43 @@ var IkasCustomerAPI = /** @class */ (function () {
|
|
|
27548
27638
|
});
|
|
27549
27639
|
});
|
|
27550
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
|
+
};
|
|
27551
27675
|
return IkasCustomerAPI;
|
|
27552
27676
|
}());
|
|
27553
|
-
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;
|
|
27554
27678
|
|
|
27555
27679
|
var IkasDistrictAPI = /** @class */ (function () {
|
|
27556
27680
|
function IkasDistrictAPI() {
|
|
@@ -27923,6 +28047,7 @@ function simpleToProduct(simple) {
|
|
|
27923
28047
|
variantTypeId: pvt === null || pvt === void 0 ? void 0 : pvt.variantType.id,
|
|
27924
28048
|
});
|
|
27925
28049
|
}),
|
|
28050
|
+
isActive: v.isActive,
|
|
27926
28051
|
});
|
|
27927
28052
|
}),
|
|
27928
28053
|
});
|
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) {
|
|
@@ -17887,7 +17929,13 @@ var IkasOrder = /** @class */ (function () {
|
|
|
17887
17929
|
}
|
|
17888
17930
|
Object.defineProperty(IkasOrder.prototype, "refundableItems", {
|
|
17889
17931
|
get: function () {
|
|
17890
|
-
return this.orderLineItems.filter(function (item) {
|
|
17932
|
+
return this.orderLineItems.filter(function (item) {
|
|
17933
|
+
return [
|
|
17934
|
+
exports.OrderLineItemStatusEnum.FULFILLED,
|
|
17935
|
+
exports.OrderLineItemStatusEnum.UNFULFILLED,
|
|
17936
|
+
exports.OrderLineItemStatusEnum.DELIVERED,
|
|
17937
|
+
].includes(item.status);
|
|
17938
|
+
});
|
|
17891
17939
|
},
|
|
17892
17940
|
enumerable: false,
|
|
17893
17941
|
configurable: true
|
|
@@ -18123,6 +18171,7 @@ var IkasProductVariant = /** @class */ (function () {
|
|
|
18123
18171
|
? new IkasProductPrice(data.price)
|
|
18124
18172
|
: new IkasProductPrice();
|
|
18125
18173
|
this.stock = data.stock || 0;
|
|
18174
|
+
this.isActive = data.isActive !== undefined ? data.isActive : true;
|
|
18126
18175
|
mobx.makeAutoObservable(this);
|
|
18127
18176
|
}
|
|
18128
18177
|
Object.defineProperty(IkasProductVariant.prototype, "mainImage", {
|
|
@@ -19936,6 +19985,47 @@ var IkasProductDetail = /** @class */ (function () {
|
|
|
19936
19985
|
enumerable: false,
|
|
19937
19986
|
configurable: true
|
|
19938
19987
|
});
|
|
19988
|
+
Object.defineProperty(IkasProductDetail.prototype, "displayedVariantTypes", {
|
|
19989
|
+
get: function () {
|
|
19990
|
+
var _this = this;
|
|
19991
|
+
var displayedVariantTypes = this.product.variantTypes.map(function (productVariantType) {
|
|
19992
|
+
var variantType = productVariantType.variantType;
|
|
19993
|
+
var displayedVariantValues = [];
|
|
19994
|
+
variantType.values.forEach(function (variantValue) {
|
|
19995
|
+
var otherSelectedVariantValues = _this.selectedVariantValues.filter(function (vv) { return vv.variantTypeId !== variantType.id; });
|
|
19996
|
+
var allVariantValues = otherSelectedVariantValues.concat(variantValue);
|
|
19997
|
+
var variant = _this.product.variants.find(function (v) {
|
|
19998
|
+
return v.variantValues.every(function (vv) {
|
|
19999
|
+
return allVariantValues.some(function (avv) { return avv.id === vv.id; });
|
|
20000
|
+
});
|
|
20001
|
+
});
|
|
20002
|
+
var isSelected = _this.selectedVariant.variantValues.some(function (vv) { return vv.id === variantValue.id; });
|
|
20003
|
+
var hasStock = variant
|
|
20004
|
+
? variant.stock > 0 && variant.isActive
|
|
20005
|
+
: true;
|
|
20006
|
+
if (variant) {
|
|
20007
|
+
displayedVariantValues.push({
|
|
20008
|
+
variant: variant,
|
|
20009
|
+
variantValue: variantValue,
|
|
20010
|
+
hasStock: hasStock,
|
|
20011
|
+
isSelected: isSelected,
|
|
20012
|
+
});
|
|
20013
|
+
}
|
|
20014
|
+
});
|
|
20015
|
+
return {
|
|
20016
|
+
variantType: variantType,
|
|
20017
|
+
displayedVariantValues: displayedVariantValues,
|
|
20018
|
+
};
|
|
20019
|
+
});
|
|
20020
|
+
// Filter inactive variantValues if there is only a single variant type
|
|
20021
|
+
if (displayedVariantTypes.length === 1) {
|
|
20022
|
+
displayedVariantTypes[0].displayedVariantValues = displayedVariantTypes[0].displayedVariantValues.filter(function (dvv) { return dvv.variant.isActive; });
|
|
20023
|
+
}
|
|
20024
|
+
return displayedVariantTypes;
|
|
20025
|
+
},
|
|
20026
|
+
enumerable: false,
|
|
20027
|
+
configurable: true
|
|
20028
|
+
});
|
|
19939
20029
|
IkasProductDetail.prototype.selectVariantValue = function (variantValue) {
|
|
19940
20030
|
var _a;
|
|
19941
20031
|
var metaData = this.product.metaData;
|
|
@@ -21112,7 +21202,7 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21112
21202
|
}
|
|
21113
21203
|
});
|
|
21114
21204
|
}); };
|
|
21115
|
-
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 () {
|
|
21116
21206
|
var fetchRequestTime, page, limit, response_1, data, err_1;
|
|
21117
21207
|
var _a;
|
|
21118
21208
|
return __generator(this, function (_b) {
|
|
@@ -21124,7 +21214,7 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21124
21214
|
_b.label = 1;
|
|
21125
21215
|
case 1:
|
|
21126
21216
|
_b.trys.push([1, 5, 6, 7]);
|
|
21127
|
-
page = this._page
|
|
21217
|
+
page = isInfiteScrollReturn ? this._page : 1;
|
|
21128
21218
|
limit = this._limit;
|
|
21129
21219
|
if (!(this.isFilterable && !this.filters)) return [3 /*break*/, 3];
|
|
21130
21220
|
return [4 /*yield*/, this.getFilters()];
|
|
@@ -21354,7 +21444,7 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21354
21444
|
this.getInitial(queryParams);
|
|
21355
21445
|
}
|
|
21356
21446
|
else if (this._page > 1) {
|
|
21357
|
-
this.getInitial();
|
|
21447
|
+
this.getInitial(undefined, true);
|
|
21358
21448
|
}
|
|
21359
21449
|
}
|
|
21360
21450
|
}
|
|
@@ -27139,7 +27229,7 @@ var IkasCustomerAPI = /** @class */ (function () {
|
|
|
27139
27229
|
return __generator(this, function (_b) {
|
|
27140
27230
|
switch (_b.label) {
|
|
27141
27231
|
case 0:
|
|
27142
|
-
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 "])));
|
|
27143
27233
|
_b.label = 1;
|
|
27144
27234
|
case 1:
|
|
27145
27235
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -27527,9 +27617,43 @@ var IkasCustomerAPI = /** @class */ (function () {
|
|
|
27527
27617
|
});
|
|
27528
27618
|
});
|
|
27529
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
|
+
};
|
|
27530
27654
|
return IkasCustomerAPI;
|
|
27531
27655
|
}());
|
|
27532
|
-
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;
|
|
27533
27657
|
|
|
27534
27658
|
var IkasDistrictAPI = /** @class */ (function () {
|
|
27535
27659
|
function IkasDistrictAPI() {
|
|
@@ -27902,6 +28026,7 @@ function simpleToProduct(simple) {
|
|
|
27902
28026
|
variantTypeId: pvt === null || pvt === void 0 ? void 0 : pvt.variantType.id,
|
|
27903
28027
|
});
|
|
27904
28028
|
}),
|
|
28029
|
+
isActive: v.isActive,
|
|
27905
28030
|
});
|
|
27906
28031
|
}),
|
|
27907
28032
|
});
|
|
@@ -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
|
+
}
|
|
@@ -3,7 +3,7 @@ export { IkasBrandList, IkasBrandListType, IkasBrandListSortType, } from "./bran
|
|
|
3
3
|
export { IkasCategoryList, IkasCategoryListType, IkasCategoryListSortType, } from "./category-list/index";
|
|
4
4
|
export type { IkasBrandListParams } from "./brand-list/index";
|
|
5
5
|
export { IkasNavigationLink } from "./navigation-link/index";
|
|
6
|
-
export { IkasProductDetail } from "./product-detail/index";
|
|
6
|
+
export { IkasProductDetail, IkasDisplayedVariantType, IkasDisplayedVariantValue, } from "./product-detail/index";
|
|
7
7
|
export { IkasProductList, IkasProductListType, IkasProductListSortType, } from "./product-list/index";
|
|
8
8
|
export { Validator, ValidationStatus } from "./validator/index";
|
|
9
9
|
export * from "./validator/rules/index";
|
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
import { IkasProduct, IkasVariantValue } from "../../index";
|
|
2
2
|
import { NextRouter } from "next/router";
|
|
3
|
+
import { IkasProductVariant, IkasVariantType } from "../../data/index";
|
|
3
4
|
export declare class IkasProductDetail {
|
|
4
5
|
product: IkasProduct;
|
|
5
6
|
selectedVariantValues: IkasVariantValue[];
|
|
6
7
|
private router?;
|
|
7
8
|
constructor(product: IkasProduct, selectedVariantValues: IkasVariantValue[], router?: NextRouter);
|
|
8
9
|
get mainVariantValue(): IkasVariantValue | undefined;
|
|
9
|
-
get selectedVariant():
|
|
10
|
+
get selectedVariant(): IkasProductVariant;
|
|
10
11
|
get href(): string;
|
|
12
|
+
get displayedVariantTypes(): IkasDisplayedVariantType[];
|
|
11
13
|
selectVariantValue(variantValue: IkasVariantValue): void;
|
|
12
14
|
}
|
|
15
|
+
export declare type IkasDisplayedVariantValue = {
|
|
16
|
+
variant: IkasProductVariant;
|
|
17
|
+
variantValue: IkasVariantValue;
|
|
18
|
+
hasStock: boolean;
|
|
19
|
+
isSelected: boolean;
|
|
20
|
+
};
|
|
21
|
+
export declare type IkasDisplayedVariantType = {
|
|
22
|
+
variantType: IkasVariantType;
|
|
23
|
+
displayedVariantValues: IkasDisplayedVariantValue[];
|
|
24
|
+
};
|
|
@@ -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;
|