@ikas/storefront 0.0.156 → 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/index.es.js +10 -3
- package/build/index.js +10 -3
- package/build/store/customer.d.ts +1 -0
- package/package.json +1 -1
package/build/index.es.js
CHANGED
|
@@ -17476,6 +17476,7 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
17476
17476
|
this.tokenExpiry = null;
|
|
17477
17477
|
this.baseStore = null;
|
|
17478
17478
|
this._initialized = false;
|
|
17479
|
+
this._visitorSubscribedEmail = false;
|
|
17479
17480
|
this.login = function (email, password) { return __awaiter(_this, void 0, void 0, function () {
|
|
17480
17481
|
var response, cart;
|
|
17481
17482
|
var _a;
|
|
@@ -17713,8 +17714,14 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
17713
17714
|
case 0: return [4 /*yield*/, IkasCustomerAPI.createCustomerEmailSubscription(email)];
|
|
17714
17715
|
case 1:
|
|
17715
17716
|
isSuccess = _a.sent();
|
|
17716
|
-
if (isSuccess)
|
|
17717
|
+
if (isSuccess) {
|
|
17717
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
|
+
}
|
|
17718
17725
|
return [2 /*return*/, isSuccess];
|
|
17719
17726
|
}
|
|
17720
17727
|
});
|
|
@@ -17733,7 +17740,7 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
17733
17740
|
Object.defineProperty(IkasCustomerStore.prototype, "canCreateEmailSubscription", {
|
|
17734
17741
|
get: function () {
|
|
17735
17742
|
var _a;
|
|
17736
|
-
if (((_a = this.customer) === null || _a === void 0 ? void 0 : _a.isSubscribed) || isServer$3)
|
|
17743
|
+
if (((_a = this.customer) === null || _a === void 0 ? void 0 : _a.isSubscribed) || isServer$3 || this._visitorSubscribedEmail)
|
|
17737
17744
|
return false;
|
|
17738
17745
|
var alreadySubbed = window.localStorage.getItem(LS_CUSTOMER_SUB_KEY);
|
|
17739
17746
|
return !alreadySubbed;
|
|
@@ -27666,7 +27673,7 @@ var IkasCustomerAPI = /** @class */ (function () {
|
|
|
27666
27673
|
case 3:
|
|
27667
27674
|
err_11 = _a.sent();
|
|
27668
27675
|
console.log(err_11);
|
|
27669
|
-
return [
|
|
27676
|
+
return [2 /*return*/, false];
|
|
27670
27677
|
case 4: return [2 /*return*/, true];
|
|
27671
27678
|
}
|
|
27672
27679
|
});
|
package/build/index.js
CHANGED
|
@@ -17482,6 +17482,7 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
17482
17482
|
this.tokenExpiry = null;
|
|
17483
17483
|
this.baseStore = null;
|
|
17484
17484
|
this._initialized = false;
|
|
17485
|
+
this._visitorSubscribedEmail = false;
|
|
17485
17486
|
this.login = function (email, password) { return __awaiter(_this, void 0, void 0, function () {
|
|
17486
17487
|
var response, cart;
|
|
17487
17488
|
var _a;
|
|
@@ -17719,8 +17720,14 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
17719
17720
|
case 0: return [4 /*yield*/, IkasCustomerAPI.createCustomerEmailSubscription(email)];
|
|
17720
17721
|
case 1:
|
|
17721
17722
|
isSuccess = _a.sent();
|
|
17722
|
-
if (isSuccess)
|
|
17723
|
+
if (isSuccess) {
|
|
17723
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
|
+
}
|
|
17724
17731
|
return [2 /*return*/, isSuccess];
|
|
17725
17732
|
}
|
|
17726
17733
|
});
|
|
@@ -17739,7 +17746,7 @@ var IkasCustomerStore = /** @class */ (function () {
|
|
|
17739
17746
|
Object.defineProperty(IkasCustomerStore.prototype, "canCreateEmailSubscription", {
|
|
17740
17747
|
get: function () {
|
|
17741
17748
|
var _a;
|
|
17742
|
-
if (((_a = this.customer) === null || _a === void 0 ? void 0 : _a.isSubscribed) || isServer$3)
|
|
17749
|
+
if (((_a = this.customer) === null || _a === void 0 ? void 0 : _a.isSubscribed) || isServer$3 || this._visitorSubscribedEmail)
|
|
17743
17750
|
return false;
|
|
17744
17751
|
var alreadySubbed = window.localStorage.getItem(LS_CUSTOMER_SUB_KEY);
|
|
17745
17752
|
return !alreadySubbed;
|
|
@@ -27645,7 +27652,7 @@ var IkasCustomerAPI = /** @class */ (function () {
|
|
|
27645
27652
|
case 3:
|
|
27646
27653
|
err_11 = _a.sent();
|
|
27647
27654
|
console.log(err_11);
|
|
27648
|
-
return [
|
|
27655
|
+
return [2 /*return*/, false];
|
|
27649
27656
|
case 4: return [2 /*return*/, true];
|
|
27650
27657
|
}
|
|
27651
27658
|
});
|
|
@@ -12,6 +12,7 @@ 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;
|
|
17
18
|
get canCreateEmailSubscription(): boolean;
|