@ikas/storefront 0.0.158-alpha.5 → 0.0.158-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.es.js +27 -1
- package/build/index.js +27 -1
- package/build/store/customer.d.ts +6 -0
- package/package.json +1 -1
package/build/index.es.js
CHANGED
|
@@ -17473,6 +17473,7 @@ var LS_TOKEN_EXPIRY = "customerTokenExpiry";
|
|
|
17473
17473
|
var LS_CUSTOMER_KEY = "customer";
|
|
17474
17474
|
var LS_CUSTOMER_SUB_KEY = "customerEmailSubscription";
|
|
17475
17475
|
var LS_LAST_VIEWED_PRODUCTS_KEY = "lastViewedProducts";
|
|
17476
|
+
var LS_CUSTOMER_CONSENT = "customerConsent";
|
|
17476
17477
|
var IkasCustomerStore = /** @class */ (function () {
|
|
17477
17478
|
function IkasCustomerStore(baseStore) {
|
|
17478
17479
|
var _this = this;
|
|
@@ -17483,6 +17484,7 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
17483
17484
|
this._initialized = false;
|
|
17484
17485
|
this._visitorSubscribedEmail = false;
|
|
17485
17486
|
this._lastViewedProducts = [];
|
|
17487
|
+
this._customerConsentGranted = false;
|
|
17486
17488
|
this.login = function (email, password) { return __awaiter(_this, void 0, void 0, function () {
|
|
17487
17489
|
var response, cart;
|
|
17488
17490
|
var _a;
|
|
@@ -17735,6 +17737,9 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
17735
17737
|
}
|
|
17736
17738
|
});
|
|
17737
17739
|
}); };
|
|
17740
|
+
this.onCustomerConsentGrant = function () {
|
|
17741
|
+
_this.saveCustomerConsent();
|
|
17742
|
+
};
|
|
17738
17743
|
this.baseStore = baseStore;
|
|
17739
17744
|
this.init();
|
|
17740
17745
|
makeAutoObservable(this);
|
|
@@ -17757,6 +17762,13 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
17757
17762
|
enumerable: false,
|
|
17758
17763
|
configurable: true
|
|
17759
17764
|
});
|
|
17765
|
+
Object.defineProperty(IkasCustomerStore.prototype, "customerConsentGranted", {
|
|
17766
|
+
get: function () {
|
|
17767
|
+
return this._customerConsentGranted;
|
|
17768
|
+
},
|
|
17769
|
+
enumerable: false,
|
|
17770
|
+
configurable: true
|
|
17771
|
+
});
|
|
17760
17772
|
IkasCustomerStore.prototype.init = function () {
|
|
17761
17773
|
return __awaiter(this, void 0, void 0, function () {
|
|
17762
17774
|
return __generator(this, function (_a) {
|
|
@@ -17765,6 +17777,7 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
17765
17777
|
this.loadToken();
|
|
17766
17778
|
this.loadCustomer();
|
|
17767
17779
|
this.loadLastViewedProducts();
|
|
17780
|
+
this.loadCustomerConsent();
|
|
17768
17781
|
return [4 /*yield*/, this.refreshToken()];
|
|
17769
17782
|
case 1:
|
|
17770
17783
|
_a.sent();
|
|
@@ -17928,6 +17941,16 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
17928
17941
|
});
|
|
17929
17942
|
});
|
|
17930
17943
|
};
|
|
17944
|
+
IkasCustomerStore.prototype.saveCustomerConsent = function () {
|
|
17945
|
+
this._customerConsentGranted = true;
|
|
17946
|
+
window.localStorage.setItem(LS_CUSTOMER_CONSENT, "true");
|
|
17947
|
+
};
|
|
17948
|
+
IkasCustomerStore.prototype.loadCustomerConsent = function () {
|
|
17949
|
+
this._customerConsentGranted = !!window.localStorage.getItem(LS_CUSTOMER_CONSENT);
|
|
17950
|
+
};
|
|
17951
|
+
IkasCustomerStore.prototype.removeCustomerConsent = function () {
|
|
17952
|
+
window.localStorage.removeItem(LS_CUSTOMER_CONSENT);
|
|
17953
|
+
};
|
|
17931
17954
|
IkasCustomerStore.prototype.setToken = function (token, tokenExpiry) {
|
|
17932
17955
|
if (isServer$3)
|
|
17933
17956
|
return;
|
|
@@ -21442,6 +21465,7 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21442
21465
|
if (this.isStatic ||
|
|
21443
21466
|
this.isDiscounted ||
|
|
21444
21467
|
this.isRecommended ||
|
|
21468
|
+
this.isLastViewed ||
|
|
21445
21469
|
this._isLoading ||
|
|
21446
21470
|
!this.hasPrev)
|
|
21447
21471
|
return [2 /*return*/];
|
|
@@ -21481,6 +21505,7 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21481
21505
|
if (this.isStatic ||
|
|
21482
21506
|
this.isDiscounted ||
|
|
21483
21507
|
this.isRecommended ||
|
|
21508
|
+
this.isLastViewed ||
|
|
21484
21509
|
this._isLoading ||
|
|
21485
21510
|
!this.hasNext)
|
|
21486
21511
|
return [2 /*return*/];
|
|
@@ -21519,7 +21544,8 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21519
21544
|
if (this._isLoading ||
|
|
21520
21545
|
this.isStatic ||
|
|
21521
21546
|
this.isDiscounted ||
|
|
21522
|
-
this.isRecommended
|
|
21547
|
+
this.isRecommended ||
|
|
21548
|
+
this.isLastViewed)
|
|
21523
21549
|
return [2 /*return*/];
|
|
21524
21550
|
this._isLoading = true;
|
|
21525
21551
|
_a.label = 1;
|
package/build/index.js
CHANGED
|
@@ -17479,6 +17479,7 @@ var LS_TOKEN_EXPIRY = "customerTokenExpiry";
|
|
|
17479
17479
|
var LS_CUSTOMER_KEY = "customer";
|
|
17480
17480
|
var LS_CUSTOMER_SUB_KEY = "customerEmailSubscription";
|
|
17481
17481
|
var LS_LAST_VIEWED_PRODUCTS_KEY = "lastViewedProducts";
|
|
17482
|
+
var LS_CUSTOMER_CONSENT = "customerConsent";
|
|
17482
17483
|
var IkasCustomerStore = /** @class */ (function () {
|
|
17483
17484
|
function IkasCustomerStore(baseStore) {
|
|
17484
17485
|
var _this = this;
|
|
@@ -17489,6 +17490,7 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
17489
17490
|
this._initialized = false;
|
|
17490
17491
|
this._visitorSubscribedEmail = false;
|
|
17491
17492
|
this._lastViewedProducts = [];
|
|
17493
|
+
this._customerConsentGranted = false;
|
|
17492
17494
|
this.login = function (email, password) { return __awaiter(_this, void 0, void 0, function () {
|
|
17493
17495
|
var response, cart;
|
|
17494
17496
|
var _a;
|
|
@@ -17741,6 +17743,9 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
17741
17743
|
}
|
|
17742
17744
|
});
|
|
17743
17745
|
}); };
|
|
17746
|
+
this.onCustomerConsentGrant = function () {
|
|
17747
|
+
_this.saveCustomerConsent();
|
|
17748
|
+
};
|
|
17744
17749
|
this.baseStore = baseStore;
|
|
17745
17750
|
this.init();
|
|
17746
17751
|
mobx.makeAutoObservable(this);
|
|
@@ -17763,6 +17768,13 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
17763
17768
|
enumerable: false,
|
|
17764
17769
|
configurable: true
|
|
17765
17770
|
});
|
|
17771
|
+
Object.defineProperty(IkasCustomerStore.prototype, "customerConsentGranted", {
|
|
17772
|
+
get: function () {
|
|
17773
|
+
return this._customerConsentGranted;
|
|
17774
|
+
},
|
|
17775
|
+
enumerable: false,
|
|
17776
|
+
configurable: true
|
|
17777
|
+
});
|
|
17766
17778
|
IkasCustomerStore.prototype.init = function () {
|
|
17767
17779
|
return __awaiter(this, void 0, void 0, function () {
|
|
17768
17780
|
return __generator(this, function (_a) {
|
|
@@ -17771,6 +17783,7 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
17771
17783
|
this.loadToken();
|
|
17772
17784
|
this.loadCustomer();
|
|
17773
17785
|
this.loadLastViewedProducts();
|
|
17786
|
+
this.loadCustomerConsent();
|
|
17774
17787
|
return [4 /*yield*/, this.refreshToken()];
|
|
17775
17788
|
case 1:
|
|
17776
17789
|
_a.sent();
|
|
@@ -17934,6 +17947,16 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
17934
17947
|
});
|
|
17935
17948
|
});
|
|
17936
17949
|
};
|
|
17950
|
+
IkasCustomerStore.prototype.saveCustomerConsent = function () {
|
|
17951
|
+
this._customerConsentGranted = true;
|
|
17952
|
+
window.localStorage.setItem(LS_CUSTOMER_CONSENT, "true");
|
|
17953
|
+
};
|
|
17954
|
+
IkasCustomerStore.prototype.loadCustomerConsent = function () {
|
|
17955
|
+
this._customerConsentGranted = !!window.localStorage.getItem(LS_CUSTOMER_CONSENT);
|
|
17956
|
+
};
|
|
17957
|
+
IkasCustomerStore.prototype.removeCustomerConsent = function () {
|
|
17958
|
+
window.localStorage.removeItem(LS_CUSTOMER_CONSENT);
|
|
17959
|
+
};
|
|
17937
17960
|
IkasCustomerStore.prototype.setToken = function (token, tokenExpiry) {
|
|
17938
17961
|
if (isServer$3)
|
|
17939
17962
|
return;
|
|
@@ -21425,6 +21448,7 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21425
21448
|
if (this.isStatic ||
|
|
21426
21449
|
this.isDiscounted ||
|
|
21427
21450
|
this.isRecommended ||
|
|
21451
|
+
this.isLastViewed ||
|
|
21428
21452
|
this._isLoading ||
|
|
21429
21453
|
!this.hasPrev)
|
|
21430
21454
|
return [2 /*return*/];
|
|
@@ -21464,6 +21488,7 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21464
21488
|
if (this.isStatic ||
|
|
21465
21489
|
this.isDiscounted ||
|
|
21466
21490
|
this.isRecommended ||
|
|
21491
|
+
this.isLastViewed ||
|
|
21467
21492
|
this._isLoading ||
|
|
21468
21493
|
!this.hasNext)
|
|
21469
21494
|
return [2 /*return*/];
|
|
@@ -21502,7 +21527,8 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21502
21527
|
if (this._isLoading ||
|
|
21503
21528
|
this.isStatic ||
|
|
21504
21529
|
this.isDiscounted ||
|
|
21505
|
-
this.isRecommended
|
|
21530
|
+
this.isRecommended ||
|
|
21531
|
+
this.isLastViewed)
|
|
21506
21532
|
return [2 /*return*/];
|
|
21507
21533
|
this._isLoading = true;
|
|
21508
21534
|
_a.label = 1;
|
|
@@ -8,9 +8,11 @@ export declare class IkasCustomerStore {
|
|
|
8
8
|
private _initialized;
|
|
9
9
|
private _visitorSubscribedEmail;
|
|
10
10
|
private _lastViewedProducts;
|
|
11
|
+
private _customerConsentGranted;
|
|
11
12
|
constructor(baseStore?: IkasBaseStore);
|
|
12
13
|
get initialized(): boolean;
|
|
13
14
|
get canCreateEmailSubscription(): boolean;
|
|
15
|
+
get customerConsentGranted(): boolean;
|
|
14
16
|
login: (email: string, password: string) => Promise<boolean>;
|
|
15
17
|
register: (firstName: string, lastName: string, email: string, password: string) => Promise<boolean>;
|
|
16
18
|
saveContactForm: (input: SaveContactForm) => Promise<boolean | undefined>;
|
|
@@ -32,6 +34,7 @@ export declare class IkasCustomerStore {
|
|
|
32
34
|
removeItemFromFavorite: (productId: string) => Promise<boolean>;
|
|
33
35
|
isProductFavorite: (productId: string) => Promise<boolean>;
|
|
34
36
|
createEmailSubscription: (email: string) => Promise<boolean>;
|
|
37
|
+
onCustomerConsentGrant: () => void;
|
|
35
38
|
private init;
|
|
36
39
|
private getCustomer;
|
|
37
40
|
private refreshToken;
|
|
@@ -43,6 +46,9 @@ export declare class IkasCustomerStore {
|
|
|
43
46
|
private removeLastViewedProducts;
|
|
44
47
|
private onProductView;
|
|
45
48
|
private saveLocalLastViewedProducts;
|
|
49
|
+
private saveCustomerConsent;
|
|
50
|
+
private loadCustomerConsent;
|
|
51
|
+
private removeCustomerConsent;
|
|
46
52
|
private setToken;
|
|
47
53
|
private loadToken;
|
|
48
54
|
private clearLocalData;
|