@pelcro/react-pelcro-js 3.26.0-beta.1 → 3.26.0-beta.3
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/dist/index.cjs.js +381 -212
- package/dist/index.esm.js +381 -212
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -8411,7 +8411,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
8411
8411
|
OutboundLink$1.origTrackLink = OutboundLink$1.trackLink;
|
|
8412
8412
|
OutboundLink$1.trackLink = outboundLink;
|
|
8413
8413
|
var OutboundLink = OutboundLink$1;
|
|
8414
|
-
var
|
|
8414
|
+
var ReactGA = _objectSpread({}, Defaults, {
|
|
8415
8415
|
OutboundLink: OutboundLink
|
|
8416
8416
|
});
|
|
8417
8417
|
|
|
@@ -8950,8 +8950,6 @@ exports["default"] = _default;
|
|
|
8950
8950
|
var ReactGA4 = unwrapExports(dist);
|
|
8951
8951
|
dist.ReactGAImplementation;
|
|
8952
8952
|
|
|
8953
|
-
var _window$d, _window$Pelcro$d, _window$Pelcro$uiSett$d;
|
|
8954
|
-
const ReactGA$d = (_window$d = window) !== null && _window$d !== void 0 && (_window$Pelcro$d = _window$d.Pelcro) !== null && _window$Pelcro$d !== void 0 && (_window$Pelcro$uiSett$d = _window$Pelcro$d.uiSettings) !== null && _window$Pelcro$uiSett$d !== void 0 && _window$Pelcro$uiSett$d.enableReactGA4 ? ReactGA4 : ReactGA1;
|
|
8955
8953
|
class PelcroActions {
|
|
8956
8954
|
constructor(storeSetter, storeGetter) {
|
|
8957
8955
|
var _this = this;
|
|
@@ -9131,23 +9129,31 @@ class PelcroActions {
|
|
|
9131
9129
|
});
|
|
9132
9130
|
});
|
|
9133
9131
|
_defineProperty$3(this, "logout", function () {
|
|
9134
|
-
var
|
|
9132
|
+
var _window, _window$Pelcro, _window$Pelcro$uiSett;
|
|
9135
9133
|
let displayLogin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
9136
9134
|
const {
|
|
9137
9135
|
switchView,
|
|
9138
9136
|
resetView,
|
|
9139
9137
|
isAuthenticated
|
|
9140
9138
|
} = _this.get();
|
|
9139
|
+
const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
|
|
9141
9140
|
// if user is not authenticated function execution is terminated
|
|
9142
9141
|
if (!isAuthenticated()) {
|
|
9143
9142
|
return console.warn("You are already logged out.");
|
|
9144
9143
|
}
|
|
9145
9144
|
window.Pelcro.user.logout();
|
|
9146
|
-
|
|
9147
|
-
|
|
9148
|
-
|
|
9149
|
-
|
|
9150
|
-
}
|
|
9145
|
+
if (enableReactGA4) {
|
|
9146
|
+
ReactGA4.event("Logged out", {
|
|
9147
|
+
nonInteraction: true
|
|
9148
|
+
});
|
|
9149
|
+
} else {
|
|
9150
|
+
var _ReactGA$event;
|
|
9151
|
+
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
9152
|
+
category: "ACTIONS",
|
|
9153
|
+
action: "Logged out",
|
|
9154
|
+
nonInteraction: true
|
|
9155
|
+
});
|
|
9156
|
+
}
|
|
9151
9157
|
resetView();
|
|
9152
9158
|
if (displayLogin) {
|
|
9153
9159
|
switchView("login");
|
|
@@ -9160,7 +9166,7 @@ class PelcroActions {
|
|
|
9160
9166
|
return false;
|
|
9161
9167
|
}
|
|
9162
9168
|
|
|
9163
|
-
//Dispatch PelcroElementsCartItemAdded when an item added successfully to the
|
|
9169
|
+
// Dispatch PelcroElementsCartItemAdded when an item added successfully to the
|
|
9164
9170
|
document.dispatchEvent(cartItemAdded(itemToAdd));
|
|
9165
9171
|
const {
|
|
9166
9172
|
cartItems
|
|
@@ -9372,9 +9378,6 @@ if (process.env.NODE_ENV === "development") {
|
|
|
9372
9378
|
c$1("Pelcro Store", usePelcro);
|
|
9373
9379
|
}
|
|
9374
9380
|
|
|
9375
|
-
var _window$c, _window$Pelcro$c, _window$Pelcro$uiSett$c;
|
|
9376
|
-
const ReactGA$c = (_window$c = window) !== null && _window$c !== void 0 && (_window$Pelcro$c = _window$c.Pelcro) !== null && _window$Pelcro$c !== void 0 && (_window$Pelcro$uiSett$c = _window$Pelcro$c.uiSettings) !== null && _window$Pelcro$uiSett$c !== void 0 && _window$Pelcro$uiSett$c.enableReactGA4 ? ReactGA4 : ReactGA1;
|
|
9377
|
-
|
|
9378
9381
|
/**
|
|
9379
9382
|
* List of zero-decimal currencies.
|
|
9380
9383
|
* @see https://stripe.com/docs/currencies#zero-decimal
|
|
@@ -9460,8 +9463,8 @@ const getLanguageWithoutRegion = localeName => {
|
|
|
9460
9463
|
* @return {string | undefined}
|
|
9461
9464
|
*/
|
|
9462
9465
|
const getPageOrDefaultLanguage = () => {
|
|
9463
|
-
var _window$Pelcro$helper, _window$
|
|
9464
|
-
return (_window$Pelcro$helper = window.Pelcro.helpers.getHtmlLanguageAttribute()) !== null && _window$Pelcro$helper !== void 0 ? _window$Pelcro$helper : getLanguageWithoutRegion((_window$
|
|
9466
|
+
var _window$Pelcro$helper, _window$Pelcro, _window$Pelcro$site, _window$Pelcro$site$r, _window$Pelcro$site$r2;
|
|
9467
|
+
return (_window$Pelcro$helper = window.Pelcro.helpers.getHtmlLanguageAttribute()) !== null && _window$Pelcro$helper !== void 0 ? _window$Pelcro$helper : getLanguageWithoutRegion((_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$site = _window$Pelcro.site) === null || _window$Pelcro$site === void 0 ? void 0 : (_window$Pelcro$site$r = _window$Pelcro$site.read) === null || _window$Pelcro$site$r === void 0 ? void 0 : (_window$Pelcro$site$r2 = _window$Pelcro$site$r.call(_window$Pelcro$site)) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.default_locale);
|
|
9465
9468
|
};
|
|
9466
9469
|
|
|
9467
9470
|
/**
|
|
@@ -9514,9 +9517,9 @@ const isValidViewFromURL = viewID => {
|
|
|
9514
9517
|
*
|
|
9515
9518
|
*/
|
|
9516
9519
|
function hasValidNewsletterUpdateUrl() {
|
|
9517
|
-
var _window$
|
|
9520
|
+
var _window$Pelcro2, _window$Pelcro2$uiSet;
|
|
9518
9521
|
if (viewID !== "newsletter-update") return false;
|
|
9519
|
-
const newsletters = (_window$
|
|
9522
|
+
const newsletters = (_window$Pelcro2 = window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$uiSet = _window$Pelcro2.uiSettings) === null || _window$Pelcro2$uiSet === void 0 ? void 0 : _window$Pelcro2$uiSet.newsletters;
|
|
9520
9523
|
const siteHasNewslettersDefined = Array.isArray(newsletters) && newsletters.length > 0;
|
|
9521
9524
|
if (!siteHasNewslettersDefined) {
|
|
9522
9525
|
return false;
|
|
@@ -9562,7 +9565,7 @@ const disableScroll = () => {
|
|
|
9562
9565
|
}
|
|
9563
9566
|
};
|
|
9564
9567
|
const trackSubscriptionOnGA = () => {
|
|
9565
|
-
var _window
|
|
9568
|
+
var _window, _window$Pelcro3, _window$Pelcro3$uiSet, _window$Pelcro$user$r5, _window$Pelcro$user$r6;
|
|
9566
9569
|
const {
|
|
9567
9570
|
product,
|
|
9568
9571
|
plan,
|
|
@@ -9577,33 +9580,56 @@ const trackSubscriptionOnGA = () => {
|
|
|
9577
9580
|
invoices
|
|
9578
9581
|
} = window.Pelcro.user.read();
|
|
9579
9582
|
const lastSubscriptionId = invoices === null || invoices === void 0 ? void 0 : invoices[invoices.length - 1].subscription_id;
|
|
9583
|
+
const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro3 = _window.Pelcro) === null || _window$Pelcro3 === void 0 ? void 0 : (_window$Pelcro3$uiSet = _window$Pelcro3.uiSettings) === null || _window$Pelcro3$uiSet === void 0 ? void 0 : _window$Pelcro3$uiSet.enableReactGA4;
|
|
9580
9584
|
if (!lastSubscriptionId) {
|
|
9581
9585
|
return;
|
|
9582
9586
|
}
|
|
9583
9587
|
const currencyCode = (_window$Pelcro$user$r5 = (_window$Pelcro$user$r6 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r6 === void 0 ? void 0 : _window$Pelcro$user$r6.currency) !== null && _window$Pelcro$user$r5 !== void 0 ? _window$Pelcro$user$r5 : plan.currency;
|
|
9584
|
-
|
|
9585
|
-
|
|
9586
|
-
|
|
9587
|
-
|
|
9588
|
-
|
|
9589
|
-
|
|
9590
|
-
|
|
9591
|
-
|
|
9592
|
-
|
|
9593
|
-
|
|
9594
|
-
|
|
9595
|
-
|
|
9596
|
-
|
|
9597
|
-
|
|
9598
|
-
|
|
9599
|
-
|
|
9600
|
-
|
|
9601
|
-
|
|
9602
|
-
|
|
9603
|
-
|
|
9604
|
-
|
|
9605
|
-
|
|
9606
|
-
|
|
9588
|
+
if (enableReactGA4) {
|
|
9589
|
+
ReactGA4.event("purchase", {
|
|
9590
|
+
transaction_id: lastSubscriptionId,
|
|
9591
|
+
affiliation: "Pelcro",
|
|
9592
|
+
currency: currencyCode,
|
|
9593
|
+
value: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
|
|
9594
|
+
coupon: couponCode,
|
|
9595
|
+
items: [{
|
|
9596
|
+
item_id: lastSubscriptionId,
|
|
9597
|
+
item_name: product.name,
|
|
9598
|
+
item_category: product.description,
|
|
9599
|
+
item_variant: plan.nickname,
|
|
9600
|
+
price: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
|
|
9601
|
+
quantity: 1
|
|
9602
|
+
}]
|
|
9603
|
+
});
|
|
9604
|
+
ReactGA4.event("Subscribed", {
|
|
9605
|
+
nonInteraction: true
|
|
9606
|
+
});
|
|
9607
|
+
} else {
|
|
9608
|
+
var _ReactGA$set, _ReactGA$plugin, _ReactGA$plugin$execu, _ReactGA$plugin2, _ReactGA$plugin2$exec, _ReactGA$plugin3, _ReactGA$plugin3$exec, _ReactGA$event;
|
|
9609
|
+
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$set = ReactGA.set) === null || _ReactGA$set === void 0 ? void 0 : _ReactGA$set.call(ReactGA, {
|
|
9610
|
+
currencyCode: currencyCode
|
|
9611
|
+
});
|
|
9612
|
+
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$plugin = ReactGA.plugin) === null || _ReactGA$plugin === void 0 ? void 0 : (_ReactGA$plugin$execu = _ReactGA$plugin.execute) === null || _ReactGA$plugin$execu === void 0 ? void 0 : _ReactGA$plugin$execu.call(_ReactGA$plugin, "ecommerce", "addTransaction", {
|
|
9613
|
+
id: lastSubscriptionId,
|
|
9614
|
+
affiliation: "Pelcro",
|
|
9615
|
+
revenue: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
|
|
9616
|
+
coupon: couponCode
|
|
9617
|
+
});
|
|
9618
|
+
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$plugin2 = ReactGA.plugin) === null || _ReactGA$plugin2 === void 0 ? void 0 : (_ReactGA$plugin2$exec = _ReactGA$plugin2.execute) === null || _ReactGA$plugin2$exec === void 0 ? void 0 : _ReactGA$plugin2$exec.call(_ReactGA$plugin2, "ecommerce", "addItem", {
|
|
9619
|
+
id: lastSubscriptionId,
|
|
9620
|
+
name: product.name,
|
|
9621
|
+
category: product.description,
|
|
9622
|
+
variant: plan.nickname,
|
|
9623
|
+
price: plan !== null && plan !== void 0 && plan.amount ? isCurrencyZeroDecimal(currencyCode) ? plan.amount : plan.amount / 100 : 0,
|
|
9624
|
+
quantity: 1
|
|
9625
|
+
});
|
|
9626
|
+
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$plugin3 = ReactGA.plugin) === null || _ReactGA$plugin3 === void 0 ? void 0 : (_ReactGA$plugin3$exec = _ReactGA$plugin3.execute) === null || _ReactGA$plugin3$exec === void 0 ? void 0 : _ReactGA$plugin3$exec.call(_ReactGA$plugin3, "ecommerce", "send");
|
|
9627
|
+
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
9628
|
+
category: "ACTIONS",
|
|
9629
|
+
action: "Subscribed",
|
|
9630
|
+
nonInteraction: true
|
|
9631
|
+
});
|
|
9632
|
+
}
|
|
9607
9633
|
};
|
|
9608
9634
|
|
|
9609
9635
|
/** check wether or not the user have any existing payment method
|
|
@@ -9687,14 +9713,14 @@ function getDateWithoutTime(dateObject) {
|
|
|
9687
9713
|
return date;
|
|
9688
9714
|
}
|
|
9689
9715
|
function userMustVerifyEmail() {
|
|
9690
|
-
var _window$Pelcro$site$
|
|
9691
|
-
const isEmailVerificationEnabled = (_window$Pelcro$site$
|
|
9716
|
+
var _window$Pelcro$site$r3, _window$Pelcro$site$r4, _window$Pelcro$user$r9, _window$Pelcro$user$r10;
|
|
9717
|
+
const isEmailVerificationEnabled = (_window$Pelcro$site$r3 = (_window$Pelcro$site$r4 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r4 === void 0 ? void 0 : _window$Pelcro$site$r4.email_verify_enabled) !== null && _window$Pelcro$site$r3 !== void 0 ? _window$Pelcro$site$r3 : false;
|
|
9692
9718
|
const isUserEmailVerified = (_window$Pelcro$user$r9 = (_window$Pelcro$user$r10 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r10 === void 0 ? void 0 : _window$Pelcro$user$r10.email_confirm) !== null && _window$Pelcro$user$r9 !== void 0 ? _window$Pelcro$user$r9 : false;
|
|
9693
9719
|
return window.Pelcro.user.isAuthenticated() && isEmailVerificationEnabled && !isUserEmailVerified;
|
|
9694
9720
|
}
|
|
9695
9721
|
function notifyBugsnag(callback, startOptions) {
|
|
9696
9722
|
if (!window.Bugsnag && !document.querySelector('script[src="https://d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js"]')) {
|
|
9697
|
-
//load bugsnag CDN
|
|
9723
|
+
// load bugsnag CDN
|
|
9698
9724
|
window.Pelcro.helpers.loadSDK("https://d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js", "bugsnag-cdn");
|
|
9699
9725
|
document.querySelector('script[src="https://d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js"]').addEventListener("load", () => {
|
|
9700
9726
|
var _window$Pelcro$enviro, _window$Pelcro4, _window$Pelcro4$envir, _window$Pelcro5, _window$Pelcro5$envir;
|
|
@@ -10057,10 +10083,8 @@ function _classPrivateFieldGet(receiver, privateMap) {
|
|
|
10057
10083
|
return descriptor.value;
|
|
10058
10084
|
}
|
|
10059
10085
|
|
|
10060
|
-
var _window$b, _window$Pelcro$b, _window$Pelcro$uiSett$b;
|
|
10061
10086
|
function _classPrivateFieldInitSpec$2(obj, privateMap, value) { _checkPrivateRedeclaration$2(obj, privateMap); privateMap.set(obj, value); }
|
|
10062
10087
|
function _checkPrivateRedeclaration$2(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
10063
|
-
const ReactGA$b = (_window$b = window) !== null && _window$b !== void 0 && (_window$Pelcro$b = _window$b.Pelcro) !== null && _window$Pelcro$b !== void 0 && (_window$Pelcro$uiSett$b = _window$Pelcro$b.uiSettings) !== null && _window$Pelcro$uiSett$b !== void 0 && _window$Pelcro$uiSett$b.enableReactGA4 ? ReactGA4 : ReactGA1;
|
|
10064
10088
|
var _isAlreadySaved = /*#__PURE__*/new WeakMap();
|
|
10065
10089
|
var _markButtonAsLoading = /*#__PURE__*/new WeakMap();
|
|
10066
10090
|
var _removeLoadingState = /*#__PURE__*/new WeakMap();
|
|
@@ -10144,7 +10168,7 @@ class SaveToMetadataButtonClass {
|
|
|
10144
10168
|
_classPrivateFieldInitSpec$2(this, _saveToMetadata, {
|
|
10145
10169
|
writable: true,
|
|
10146
10170
|
value: event => {
|
|
10147
|
-
var _user$metadata;
|
|
10171
|
+
var _window, _window$Pelcro, _window$Pelcro$uiSett, _user$metadata;
|
|
10148
10172
|
const button = event.currentTarget;
|
|
10149
10173
|
const user = window.Pelcro.user.read();
|
|
10150
10174
|
const {
|
|
@@ -10154,6 +10178,7 @@ class SaveToMetadataButtonClass {
|
|
|
10154
10178
|
key,
|
|
10155
10179
|
...buttonMetadata
|
|
10156
10180
|
} = button.dataset;
|
|
10181
|
+
const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
|
|
10157
10182
|
if (userMustVerifyEmail()) {
|
|
10158
10183
|
return switchView("email-verify");
|
|
10159
10184
|
}
|
|
@@ -10178,16 +10203,22 @@ class SaveToMetadataButtonClass {
|
|
|
10178
10203
|
value: newMetadataValue,
|
|
10179
10204
|
auth_token: window.Pelcro.user.read().auth_token
|
|
10180
10205
|
}, (err, resp) => {
|
|
10181
|
-
var _ReactGA$event;
|
|
10182
10206
|
if (err) {
|
|
10183
10207
|
return _classPrivateFieldGet(this, _removeLoadingState).call(this, button);
|
|
10184
10208
|
}
|
|
10185
10209
|
_classPrivateFieldGet(this, _markButtonAsSaved).call(this, button);
|
|
10186
|
-
|
|
10187
|
-
|
|
10188
|
-
|
|
10189
|
-
|
|
10190
|
-
}
|
|
10210
|
+
if (enableReactGA4) {
|
|
10211
|
+
ReactGA4.event("Save/Follow", {
|
|
10212
|
+
event_label: buttonMetadata === null || buttonMetadata === void 0 ? void 0 : buttonMetadata.title
|
|
10213
|
+
});
|
|
10214
|
+
} else {
|
|
10215
|
+
var _ReactGA$event;
|
|
10216
|
+
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
10217
|
+
category: "ACTIONS",
|
|
10218
|
+
action: "Save/Follow",
|
|
10219
|
+
label: buttonMetadata === null || buttonMetadata === void 0 ? void 0 : buttonMetadata.title
|
|
10220
|
+
});
|
|
10221
|
+
}
|
|
10191
10222
|
});
|
|
10192
10223
|
}
|
|
10193
10224
|
}
|
|
@@ -10195,6 +10226,7 @@ class SaveToMetadataButtonClass {
|
|
|
10195
10226
|
_classPrivateFieldInitSpec$2(this, _removeMetaData, {
|
|
10196
10227
|
writable: true,
|
|
10197
10228
|
value: event => {
|
|
10229
|
+
var _window2, _window2$Pelcro, _window2$Pelcro$uiSet;
|
|
10198
10230
|
const button = event.currentTarget;
|
|
10199
10231
|
const user = window.Pelcro.user.read();
|
|
10200
10232
|
const {
|
|
@@ -10202,6 +10234,7 @@ class SaveToMetadataButtonClass {
|
|
|
10202
10234
|
title
|
|
10203
10235
|
} = button.dataset;
|
|
10204
10236
|
const oldValue = user.metadata[`metadata_saved_${key}`];
|
|
10237
|
+
const enableReactGA4 = (_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$Pelcro = _window2.Pelcro) === null || _window2$Pelcro === void 0 ? void 0 : (_window2$Pelcro$uiSet = _window2$Pelcro.uiSettings) === null || _window2$Pelcro$uiSet === void 0 ? void 0 : _window2$Pelcro$uiSet.enableReactGA4;
|
|
10205
10238
|
const newMetadataValue = oldValue.filter(metadata => !((metadata === null || metadata === void 0 ? void 0 : metadata.title) === title));
|
|
10206
10239
|
if (window.Pelcro.user.isAuthenticated()) {
|
|
10207
10240
|
_classPrivateFieldGet(this, _markButtonAsLoading).call(this, button);
|
|
@@ -10210,16 +10243,22 @@ class SaveToMetadataButtonClass {
|
|
|
10210
10243
|
value: newMetadataValue,
|
|
10211
10244
|
auth_token: window.Pelcro.user.read().auth_token
|
|
10212
10245
|
}, (err, resp) => {
|
|
10213
|
-
var _ReactGA$event2;
|
|
10214
10246
|
if (err) {
|
|
10215
10247
|
return _classPrivateFieldGet(this, _removeLoadingState).call(this, button);
|
|
10216
10248
|
}
|
|
10217
10249
|
_classPrivateFieldGet(this, _unmarkSavedButton).call(this, button);
|
|
10218
|
-
|
|
10219
|
-
|
|
10220
|
-
|
|
10221
|
-
|
|
10222
|
-
}
|
|
10250
|
+
if (enableReactGA4) {
|
|
10251
|
+
ReactGA4.event("Unsave/Unfollow", {
|
|
10252
|
+
event_label: title
|
|
10253
|
+
});
|
|
10254
|
+
} else {
|
|
10255
|
+
var _ReactGA$event2;
|
|
10256
|
+
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
|
|
10257
|
+
category: "ACTIONS",
|
|
10258
|
+
action: "Unsave/Unfollow",
|
|
10259
|
+
label: title
|
|
10260
|
+
});
|
|
10261
|
+
}
|
|
10223
10262
|
});
|
|
10224
10263
|
}
|
|
10225
10264
|
}
|
|
@@ -11742,9 +11781,6 @@ function getSiteCardProcessor() {
|
|
|
11742
11781
|
return "stripe";
|
|
11743
11782
|
}
|
|
11744
11783
|
|
|
11745
|
-
var _window$a, _window$Pelcro$a, _window$Pelcro$uiSett$a;
|
|
11746
|
-
const ReactGA$a = (_window$a = window) !== null && _window$a !== void 0 && (_window$Pelcro$a = _window$a.Pelcro) !== null && _window$Pelcro$a !== void 0 && (_window$Pelcro$uiSett$a = _window$Pelcro$a.uiSettings) !== null && _window$Pelcro$uiSett$a !== void 0 && _window$Pelcro$uiSett$a.enableReactGA4 ? ReactGA4 : ReactGA1;
|
|
11747
|
-
|
|
11748
11784
|
/**
|
|
11749
11785
|
* @typedef {Object} OptionsType
|
|
11750
11786
|
* @property {boolean} loadPaymentSDKs
|
|
@@ -11867,17 +11903,50 @@ const initSecuritySdk = () => {
|
|
|
11867
11903
|
});
|
|
11868
11904
|
};
|
|
11869
11905
|
const initGATracking = () => {
|
|
11870
|
-
var
|
|
11871
|
-
|
|
11872
|
-
|
|
11906
|
+
var _window, _window$Pelcro, _window$Pelcro$uiSett;
|
|
11907
|
+
const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
|
|
11908
|
+
if (window.Pelcro.site.read().google_analytics_id) {
|
|
11909
|
+
if (enableReactGA4) {
|
|
11910
|
+
// Initialize ReactGA4 with your tracking ID
|
|
11911
|
+
ReactGA4.initialize(window.Pelcro.site.read().google_analytics_id);
|
|
11912
|
+
// Enable e-commerce tracking
|
|
11913
|
+
ReactGA4.initialize(window.Pelcro.site.read().google_analytics_id, {
|
|
11914
|
+
gaOptions: {
|
|
11915
|
+
send_page_view: true,
|
|
11916
|
+
ecommerce: {
|
|
11917
|
+
enabled: true
|
|
11918
|
+
}
|
|
11919
|
+
}
|
|
11920
|
+
});
|
|
11921
|
+
console.log("enableReactGA4: ", enableReactGA4);
|
|
11922
|
+
console.log("GA4 is initialized");
|
|
11923
|
+
} else {
|
|
11924
|
+
var _ReactGA$initialize, _ReactGA$plugin, _ReactGA$plugin$requi;
|
|
11925
|
+
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$initialize = ReactGA.initialize) === null || _ReactGA$initialize === void 0 ? void 0 : _ReactGA$initialize.call(ReactGA, window.Pelcro.site.read().google_analytics_id);
|
|
11926
|
+
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$plugin = ReactGA.plugin) === null || _ReactGA$plugin === void 0 ? void 0 : (_ReactGA$plugin$requi = _ReactGA$plugin.require) === null || _ReactGA$plugin$requi === void 0 ? void 0 : _ReactGA$plugin$requi.call(_ReactGA$plugin, "ecommerce");
|
|
11927
|
+
console.log("enableReactGA4: " + enableReactGA4);
|
|
11928
|
+
console.log("GA3 is initialized");
|
|
11929
|
+
}
|
|
11930
|
+
}
|
|
11873
11931
|
};
|
|
11874
11932
|
const dispatchModalDisplayEvents = modalName => {
|
|
11875
|
-
var
|
|
11876
|
-
|
|
11877
|
-
|
|
11878
|
-
|
|
11879
|
-
|
|
11880
|
-
|
|
11933
|
+
var _window2, _window2$Pelcro, _window2$Pelcro$uiSet, _modalName$replace, _modalName$replace2;
|
|
11934
|
+
const enableReactGA4 = (_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$Pelcro = _window2.Pelcro) === null || _window2$Pelcro === void 0 ? void 0 : (_window2$Pelcro$uiSet = _window2$Pelcro.uiSettings) === null || _window2$Pelcro$uiSet === void 0 ? void 0 : _window2$Pelcro$uiSet.enableReactGA4;
|
|
11935
|
+
const formattedAction = modalName === null || modalName === void 0 ? void 0 : (_modalName$replace = modalName.replace("pelcro-", "")) === null || _modalName$replace === void 0 ? void 0 : _modalName$replace.replaceAll("-", " ");
|
|
11936
|
+
if (enableReactGA4) {
|
|
11937
|
+
ReactGA4.event(`${formattedAction} viewed`, {
|
|
11938
|
+
nonInteraction: true
|
|
11939
|
+
});
|
|
11940
|
+
console.log("GA4 view event is fired");
|
|
11941
|
+
} else {
|
|
11942
|
+
var _ReactGA$event;
|
|
11943
|
+
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
11944
|
+
category: "VIEWS",
|
|
11945
|
+
action: `${formattedAction} viewed`,
|
|
11946
|
+
nonInteraction: true
|
|
11947
|
+
});
|
|
11948
|
+
console.log("GA3 view event is fired");
|
|
11949
|
+
}
|
|
11881
11950
|
window.Pelcro.insight.track("Modal Displayed", {
|
|
11882
11951
|
name: `${modalName === null || modalName === void 0 ? void 0 : (_modalName$replace2 = modalName.replace("pelcro-", "")) === null || _modalName$replace2 === void 0 ? void 0 : _modalName$replace2.replaceAll("-", " ")}`
|
|
11883
11952
|
});
|
|
@@ -12770,6 +12839,7 @@ const {
|
|
|
12770
12839
|
Provider: Provider$m
|
|
12771
12840
|
} = store$m;
|
|
12772
12841
|
const LoginContainer = _ref => {
|
|
12842
|
+
var _window, _window$Pelcro, _window$Pelcro$uiSett;
|
|
12773
12843
|
let {
|
|
12774
12844
|
style,
|
|
12775
12845
|
className = "",
|
|
@@ -12777,6 +12847,7 @@ const LoginContainer = _ref => {
|
|
|
12777
12847
|
onFailure = () => {},
|
|
12778
12848
|
children
|
|
12779
12849
|
} = _ref;
|
|
12850
|
+
const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
|
|
12780
12851
|
const handleLogin = (_ref2, dispatch) => {
|
|
12781
12852
|
let {
|
|
12782
12853
|
email,
|
|
@@ -12806,13 +12877,19 @@ const LoginContainer = _ref => {
|
|
|
12806
12877
|
});
|
|
12807
12878
|
onFailure(err);
|
|
12808
12879
|
} else {
|
|
12809
|
-
var _ReactGA$event;
|
|
12810
12880
|
onSuccess(res);
|
|
12811
|
-
|
|
12812
|
-
|
|
12813
|
-
|
|
12814
|
-
|
|
12815
|
-
}
|
|
12881
|
+
if (enableReactGA4) {
|
|
12882
|
+
ReactGA4.event("Logged in", {
|
|
12883
|
+
nonInteraction: true
|
|
12884
|
+
});
|
|
12885
|
+
} else {
|
|
12886
|
+
var _ReactGA$event;
|
|
12887
|
+
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
12888
|
+
category: "ACTIONS",
|
|
12889
|
+
action: "Logged in",
|
|
12890
|
+
nonInteraction: true
|
|
12891
|
+
});
|
|
12892
|
+
}
|
|
12816
12893
|
}
|
|
12817
12894
|
});
|
|
12818
12895
|
};
|
|
@@ -13198,17 +13275,23 @@ function ConfirmPassword(_ref) {
|
|
|
13198
13275
|
}, otherProps));
|
|
13199
13276
|
}
|
|
13200
13277
|
|
|
13201
|
-
var _window$9, _window$Pelcro$9, _window$Pelcro$uiSett$9;
|
|
13202
|
-
const ReactGA$9 = (_window$9 = window) !== null && _window$9 !== void 0 && (_window$Pelcro$9 = _window$9.Pelcro) !== null && _window$Pelcro$9 !== void 0 && (_window$Pelcro$uiSett$9 = _window$Pelcro$9.uiSettings) !== null && _window$Pelcro$uiSett$9 !== void 0 && _window$Pelcro$uiSett$9.enableReactGA4 ? ReactGA4 : ReactGA1;
|
|
13203
13278
|
const Logout = props => {
|
|
13204
13279
|
const handleLogout = () => {
|
|
13205
|
-
var
|
|
13280
|
+
var _window, _window$Pelcro, _window$Pelcro$uiSett;
|
|
13206
13281
|
window.Pelcro.user.logout();
|
|
13207
|
-
|
|
13208
|
-
|
|
13209
|
-
|
|
13210
|
-
|
|
13211
|
-
|
|
13282
|
+
const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
|
|
13283
|
+
if (enableReactGA4) {
|
|
13284
|
+
ReactGA4.event("Logged out", {
|
|
13285
|
+
nonInteraction: true
|
|
13286
|
+
});
|
|
13287
|
+
} else {
|
|
13288
|
+
var _ReactGA$event;
|
|
13289
|
+
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
13290
|
+
category: "ACTIONS",
|
|
13291
|
+
action: "Logged out",
|
|
13292
|
+
nonInteraction: true
|
|
13293
|
+
});
|
|
13294
|
+
}
|
|
13212
13295
|
};
|
|
13213
13296
|
return /*#__PURE__*/React__default['default'].createElement("button", {
|
|
13214
13297
|
name: "logout",
|
|
@@ -14766,13 +14849,11 @@ const RegisterCompany = props => {
|
|
|
14766
14849
|
}, props));
|
|
14767
14850
|
};
|
|
14768
14851
|
|
|
14769
|
-
var _window$8, _window$Pelcro$8, _window$Pelcro$uiSett$8;
|
|
14770
|
-
const ReactGA$8 = (_window$8 = window) !== null && _window$8 !== void 0 && (_window$Pelcro$8 = _window$8.Pelcro) !== null && _window$Pelcro$8 !== void 0 && (_window$Pelcro$uiSett$8 = _window$Pelcro$8.uiSettings) !== null && _window$Pelcro$uiSett$8 !== void 0 && _window$Pelcro$uiSett$8.enableReactGA4 ? ReactGA4 : ReactGA1;
|
|
14771
|
-
|
|
14772
14852
|
/**
|
|
14773
14853
|
*
|
|
14774
14854
|
*/
|
|
14775
14855
|
function RegisterModal(props) {
|
|
14856
|
+
var _window, _window$Pelcro, _window$Pelcro$uiSett;
|
|
14776
14857
|
const {
|
|
14777
14858
|
t
|
|
14778
14859
|
} = useTranslation("register");
|
|
@@ -14787,18 +14868,26 @@ function RegisterModal(props) {
|
|
|
14787
14868
|
giftCode,
|
|
14788
14869
|
isGift
|
|
14789
14870
|
} = usePelcro();
|
|
14871
|
+
const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
|
|
14790
14872
|
const onSuccess = res => {
|
|
14791
14873
|
var _props$onSuccess;
|
|
14792
14874
|
(_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
|
|
14793
14875
|
handleAfterRegistrationLogic();
|
|
14794
14876
|
};
|
|
14795
14877
|
const handleAfterRegistrationLogic = () => {
|
|
14796
|
-
var
|
|
14797
|
-
|
|
14798
|
-
|
|
14799
|
-
|
|
14800
|
-
|
|
14801
|
-
}
|
|
14878
|
+
var _window$Pelcro$site$r, _window$Pelcro$site$r2;
|
|
14879
|
+
if (enableReactGA4) {
|
|
14880
|
+
ReactGA4.event("Registered", {
|
|
14881
|
+
nonInteraction: true
|
|
14882
|
+
});
|
|
14883
|
+
} else {
|
|
14884
|
+
var _ReactGA$event;
|
|
14885
|
+
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
14886
|
+
category: "ACTIONS",
|
|
14887
|
+
action: "Registered",
|
|
14888
|
+
nonInteraction: true
|
|
14889
|
+
});
|
|
14890
|
+
}
|
|
14802
14891
|
const isEmailVerificationEnabled = (_window$Pelcro$site$r = (_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.email_verify_enabled) !== null && _window$Pelcro$site$r !== void 0 ? _window$Pelcro$site$r : false;
|
|
14803
14892
|
if (isEmailVerificationEnabled) {
|
|
14804
14893
|
return switchView("email-verify");
|
|
@@ -14885,9 +14974,6 @@ function Radio(_ref) {
|
|
|
14885
14974
|
}, children));
|
|
14886
14975
|
}
|
|
14887
14976
|
|
|
14888
|
-
var _window$7, _window$Pelcro$7, _window$Pelcro$uiSett$7;
|
|
14889
|
-
const ReactGA$7 = (_window$7 = window) !== null && _window$7 !== void 0 && (_window$Pelcro$7 = _window$7.Pelcro) !== null && _window$Pelcro$7 !== void 0 && (_window$Pelcro$uiSett$7 = _window$Pelcro$7.uiSettings) !== null && _window$Pelcro$uiSett$7 !== void 0 && _window$Pelcro$uiSett$7.enableReactGA4 ? ReactGA4 : ReactGA1;
|
|
14890
|
-
|
|
14891
14977
|
/**
|
|
14892
14978
|
*
|
|
14893
14979
|
*/
|
|
@@ -14947,6 +15033,7 @@ function productMatchPageLanguage(product) {
|
|
|
14947
15033
|
SelectModalWithHook.viewId = "plan-select";
|
|
14948
15034
|
class SelectModal extends React.Component {
|
|
14949
15035
|
constructor(props) {
|
|
15036
|
+
var _window, _window$Pelcro11, _window$Pelcro11$uiSe;
|
|
14950
15037
|
super(props);
|
|
14951
15038
|
_defineProperty$3(this, "componentDidMount", () => {
|
|
14952
15039
|
if (this.props.product) {
|
|
@@ -14981,11 +15068,11 @@ class SelectModal extends React.Component {
|
|
|
14981
15068
|
}
|
|
14982
15069
|
document.addEventListener("keydown", this.handleSubmit);
|
|
14983
15070
|
if (!document.querySelector("#pelcro-selection-view") || !document.querySelector(".pelcro-select-product-wrapper")) {
|
|
14984
|
-
var _window$
|
|
14985
|
-
const userCurrency = (_window$
|
|
14986
|
-
const userCountry = (_window$
|
|
14987
|
-
const userLanguage = (_window$
|
|
14988
|
-
const productsMatchingUserCurrency = (_window$
|
|
15071
|
+
var _window$Pelcro, _window$Pelcro$user, _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro3, _window$Pelcro3$user, _window$Pelcro4, _window$Pelcro4$site;
|
|
15072
|
+
const userCurrency = (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$user = _window$Pelcro.user) === null || _window$Pelcro$user === void 0 ? void 0 : _window$Pelcro$user.read().currency;
|
|
15073
|
+
const userCountry = (_window$Pelcro2 = window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$user = _window$Pelcro2.user) === null || _window$Pelcro2$user === void 0 ? void 0 : _window$Pelcro2$user.location.countryCode;
|
|
15074
|
+
const userLanguage = (_window$Pelcro3 = window.Pelcro) === null || _window$Pelcro3 === void 0 ? void 0 : (_window$Pelcro3$user = _window$Pelcro3.user) === null || _window$Pelcro3$user === void 0 ? void 0 : _window$Pelcro3$user.read().language;
|
|
15075
|
+
const productsMatchingUserCurrency = (_window$Pelcro4 = window.Pelcro) === null || _window$Pelcro4 === void 0 ? void 0 : (_window$Pelcro4$site = _window$Pelcro4.site) === null || _window$Pelcro4$site === void 0 ? void 0 : _window$Pelcro4$site.read().products.filter(product => {
|
|
14989
15076
|
const filteredPlans = product.plans.filter(plan => plan.currency === userCurrency || !userCurrency);
|
|
14990
15077
|
if (filteredPlans.length) return filteredPlans;
|
|
14991
15078
|
});
|
|
@@ -14998,12 +15085,12 @@ class SelectModal extends React.Component {
|
|
|
14998
15085
|
});
|
|
14999
15086
|
notifyBugsnag(() => {
|
|
15000
15087
|
Bugsnag.notify("SelectModal - No data viewed", event => {
|
|
15001
|
-
var _window$
|
|
15088
|
+
var _window$Pelcro5, _window$Pelcro5$site, _window$Pelcro6, _window$Pelcro6$user, _window$Pelcro7, _window$Pelcro7$uiSet, _window$Pelcro8, _this$props, _window$Pelcro9, _window$Pelcro9$helpe, _window$Pelcro10, _window$Pelcro10$site;
|
|
15002
15089
|
event.addMetadata("MetaData", {
|
|
15003
|
-
site: (_window$
|
|
15004
|
-
user: (_window$
|
|
15005
|
-
uiVersion: (_window$
|
|
15006
|
-
environment: (_window$
|
|
15090
|
+
site: (_window$Pelcro5 = window.Pelcro) === null || _window$Pelcro5 === void 0 ? void 0 : (_window$Pelcro5$site = _window$Pelcro5.site) === null || _window$Pelcro5$site === void 0 ? void 0 : _window$Pelcro5$site.read(),
|
|
15091
|
+
user: (_window$Pelcro6 = window.Pelcro) === null || _window$Pelcro6 === void 0 ? void 0 : (_window$Pelcro6$user = _window$Pelcro6.user) === null || _window$Pelcro6$user === void 0 ? void 0 : _window$Pelcro6$user.read(),
|
|
15092
|
+
uiVersion: (_window$Pelcro7 = window.Pelcro) === null || _window$Pelcro7 === void 0 ? void 0 : (_window$Pelcro7$uiSet = _window$Pelcro7.uiSettings) === null || _window$Pelcro7$uiSet === void 0 ? void 0 : _window$Pelcro7$uiSet.uiVersion,
|
|
15093
|
+
environment: (_window$Pelcro8 = window.Pelcro) === null || _window$Pelcro8 === void 0 ? void 0 : _window$Pelcro8.environment,
|
|
15007
15094
|
matchingEntitlementsProps: (_this$props = this.props) === null || _this$props === void 0 ? void 0 : _this$props.matchingEntitlements,
|
|
15008
15095
|
productListState: this.state.productList,
|
|
15009
15096
|
methods: {
|
|
@@ -15014,8 +15101,8 @@ class SelectModal extends React.Component {
|
|
|
15014
15101
|
userCurrency: userCurrency,
|
|
15015
15102
|
userCountry: userCountry,
|
|
15016
15103
|
userLanguage: userLanguage,
|
|
15017
|
-
siteLanguage: (_window$
|
|
15018
|
-
products: (_window$
|
|
15104
|
+
siteLanguage: (_window$Pelcro9 = window.Pelcro) === null || _window$Pelcro9 === void 0 ? void 0 : (_window$Pelcro9$helpe = _window$Pelcro9.helpers) === null || _window$Pelcro9$helpe === void 0 ? void 0 : _window$Pelcro9$helpe.getHtmlLanguageAttribute(),
|
|
15105
|
+
products: (_window$Pelcro10 = window.Pelcro) === null || _window$Pelcro10 === void 0 ? void 0 : (_window$Pelcro10$site = _window$Pelcro10.site) === null || _window$Pelcro10$site === void 0 ? void 0 : _window$Pelcro10$site.read().products.length,
|
|
15019
15106
|
currency_matching_filter: `${productsMatchingUserCurrency.length} Products Passed`,
|
|
15020
15107
|
country_matching_filter: `${productsMatchingUserCountry.length} Products Passed`,
|
|
15021
15108
|
language_matching_filter: `${productsMatchingUserCountry.filter(productMatchPageLanguage).length} Products Passed`
|
|
@@ -15227,6 +15314,7 @@ class SelectModal extends React.Component {
|
|
|
15227
15314
|
this.product = this.props.product || window.Pelcro.paywall.getProduct();
|
|
15228
15315
|
this.locale = this.props.t;
|
|
15229
15316
|
this.closeButton = window.Pelcro.paywall.displayCloseButton();
|
|
15317
|
+
this.enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro11 = _window.Pelcro) === null || _window$Pelcro11 === void 0 ? void 0 : (_window$Pelcro11$uiSe = _window$Pelcro11.uiSettings) === null || _window$Pelcro11$uiSe === void 0 ? void 0 : _window$Pelcro11$uiSe.enableReactGA4;
|
|
15230
15318
|
}
|
|
15231
15319
|
render() {
|
|
15232
15320
|
var _window$Pelcro$produc2, _window$Pelcro$produc3, _window$Pelcro$site$r;
|
|
@@ -15234,19 +15322,31 @@ class SelectModal extends React.Component {
|
|
|
15234
15322
|
disableGifting
|
|
15235
15323
|
} = this.props;
|
|
15236
15324
|
if (this.state.mode === "product") {
|
|
15237
|
-
|
|
15238
|
-
|
|
15239
|
-
|
|
15240
|
-
|
|
15241
|
-
|
|
15242
|
-
|
|
15325
|
+
if (this.enableReactGA4) {
|
|
15326
|
+
ReactGA4.event("Product Modal Viewed", {
|
|
15327
|
+
nonInteraction: true
|
|
15328
|
+
});
|
|
15329
|
+
} else {
|
|
15330
|
+
var _ReactGA$event;
|
|
15331
|
+
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
15332
|
+
category: "VIEWS",
|
|
15333
|
+
action: "Product Modal Viewed",
|
|
15334
|
+
nonInteraction: true
|
|
15335
|
+
});
|
|
15336
|
+
}
|
|
15243
15337
|
} else if (this.state.mode === "plan") {
|
|
15244
|
-
|
|
15245
|
-
|
|
15246
|
-
|
|
15247
|
-
|
|
15248
|
-
|
|
15249
|
-
|
|
15338
|
+
if (this.enableReactGA4) {
|
|
15339
|
+
ReactGA4.event("Plan Modal Viewed", {
|
|
15340
|
+
nonInteraction: true
|
|
15341
|
+
});
|
|
15342
|
+
} else {
|
|
15343
|
+
var _ReactGA$event2;
|
|
15344
|
+
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
|
|
15345
|
+
category: "VIEWS",
|
|
15346
|
+
action: "Plan Modal Viewed",
|
|
15347
|
+
nonInteraction: true
|
|
15348
|
+
});
|
|
15349
|
+
}
|
|
15250
15350
|
}
|
|
15251
15351
|
return /*#__PURE__*/React__default['default'].createElement(Modal, {
|
|
15252
15352
|
hideCloseButton: !this.closeButton,
|
|
@@ -15677,14 +15777,14 @@ class DonationModal extends React.Component {
|
|
|
15677
15777
|
this.props;
|
|
15678
15778
|
if (this.state.mode === "product") {
|
|
15679
15779
|
var _ReactGA$event;
|
|
15680
|
-
|
|
15780
|
+
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
15681
15781
|
category: "VIEWS",
|
|
15682
15782
|
action: "Product Modal Viewed",
|
|
15683
15783
|
nonInteraction: true
|
|
15684
15784
|
});
|
|
15685
15785
|
} else if (this.state.mode === "plan") {
|
|
15686
15786
|
var _ReactGA$event2;
|
|
15687
|
-
|
|
15787
|
+
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
|
|
15688
15788
|
category: "VIEWS",
|
|
15689
15789
|
action: "Plan Modal Viewed",
|
|
15690
15790
|
nonInteraction: true
|
|
@@ -21177,13 +21277,11 @@ const SubscriptionRenewView = _ref => {
|
|
|
21177
21277
|
}));
|
|
21178
21278
|
};
|
|
21179
21279
|
|
|
21180
|
-
var _window$6, _window$Pelcro$6, _window$Pelcro$uiSett$6;
|
|
21181
|
-
const ReactGA$6 = (_window$6 = window) !== null && _window$6 !== void 0 && (_window$Pelcro$6 = _window$6.Pelcro) !== null && _window$Pelcro$6 !== void 0 && (_window$Pelcro$uiSett$6 = _window$Pelcro$6.uiSettings) !== null && _window$Pelcro$uiSett$6 !== void 0 && _window$Pelcro$uiSett$6.enableReactGA4 ? ReactGA4 : ReactGA1;
|
|
21182
|
-
|
|
21183
21280
|
/**
|
|
21184
21281
|
*
|
|
21185
21282
|
*/
|
|
21186
21283
|
function SubscriptionRenewModal(_ref) {
|
|
21284
|
+
var _window, _window$Pelcro, _window$Pelcro$uiSett;
|
|
21187
21285
|
let {
|
|
21188
21286
|
onDisplay,
|
|
21189
21287
|
onClose,
|
|
@@ -21192,24 +21290,39 @@ function SubscriptionRenewModal(_ref) {
|
|
|
21192
21290
|
const {
|
|
21193
21291
|
switchView
|
|
21194
21292
|
} = usePelcro();
|
|
21293
|
+
const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
|
|
21195
21294
|
const onSuccess = res => {
|
|
21196
|
-
var _otherProps$onSuccess
|
|
21295
|
+
var _otherProps$onSuccess;
|
|
21197
21296
|
(_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps, res);
|
|
21198
|
-
|
|
21199
|
-
|
|
21200
|
-
|
|
21201
|
-
|
|
21202
|
-
}
|
|
21297
|
+
if (enableReactGA4) {
|
|
21298
|
+
ReactGA4.event("Renewed", {
|
|
21299
|
+
nonInteraction: true
|
|
21300
|
+
});
|
|
21301
|
+
} else {
|
|
21302
|
+
var _ReactGA$event;
|
|
21303
|
+
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
21304
|
+
category: "ACTIONS",
|
|
21305
|
+
action: "Renewed",
|
|
21306
|
+
nonInteraction: true
|
|
21307
|
+
});
|
|
21308
|
+
}
|
|
21203
21309
|
return switchView("subscription-success");
|
|
21204
21310
|
};
|
|
21205
21311
|
const onGiftRenewalSuccess = () => {
|
|
21206
|
-
var _otherProps$onGiftRen
|
|
21312
|
+
var _otherProps$onGiftRen;
|
|
21207
21313
|
(_otherProps$onGiftRen = otherProps.onGiftRenewalSuccess) === null || _otherProps$onGiftRen === void 0 ? void 0 : _otherProps$onGiftRen.call(otherProps);
|
|
21208
|
-
|
|
21209
|
-
|
|
21210
|
-
|
|
21211
|
-
|
|
21212
|
-
}
|
|
21314
|
+
if (enableReactGA4) {
|
|
21315
|
+
ReactGA4.event("Renewed Gift", {
|
|
21316
|
+
nonInteraction: true
|
|
21317
|
+
});
|
|
21318
|
+
} else {
|
|
21319
|
+
var _ReactGA$event2;
|
|
21320
|
+
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
|
|
21321
|
+
category: "ACTIONS",
|
|
21322
|
+
action: "Renewed Gift",
|
|
21323
|
+
nonInteraction: true
|
|
21324
|
+
});
|
|
21325
|
+
}
|
|
21213
21326
|
return switchView("subscription-success");
|
|
21214
21327
|
};
|
|
21215
21328
|
return /*#__PURE__*/React__default['default'].createElement(Modal, {
|
|
@@ -21379,8 +21492,6 @@ function SvgSubscription(props) {
|
|
|
21379
21492
|
}))))));
|
|
21380
21493
|
}
|
|
21381
21494
|
|
|
21382
|
-
var _window$5, _window$Pelcro$5, _window$Pelcro$uiSett$5;
|
|
21383
|
-
const ReactGA$5 = (_window$5 = window) !== null && _window$5 !== void 0 && (_window$Pelcro$5 = _window$5.Pelcro) !== null && _window$Pelcro$5 !== void 0 && (_window$Pelcro$uiSett$5 = _window$Pelcro$5.uiSettings) !== null && _window$Pelcro$uiSett$5 !== void 0 && _window$Pelcro$uiSett$5.enableReactGA4 ? ReactGA4 : ReactGA1;
|
|
21384
21495
|
const SubscriptionCancelNowButton = _ref => {
|
|
21385
21496
|
let {
|
|
21386
21497
|
subscription,
|
|
@@ -21400,6 +21511,8 @@ const SubscriptionCancelNowButton = _ref => {
|
|
|
21400
21511
|
t
|
|
21401
21512
|
} = useTranslation("subscriptionCancel");
|
|
21402
21513
|
const cancelSubscription = (payload, onSuccess, onFailure) => {
|
|
21514
|
+
var _window, _window$Pelcro, _window$Pelcro$uiSett;
|
|
21515
|
+
const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
|
|
21403
21516
|
window.Pelcro.subscription.cancel({
|
|
21404
21517
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
21405
21518
|
subscription_id: payload.subscription_id,
|
|
@@ -21408,15 +21521,21 @@ const SubscriptionCancelNowButton = _ref => {
|
|
|
21408
21521
|
reason: payload.reason
|
|
21409
21522
|
})
|
|
21410
21523
|
}, (err, res) => {
|
|
21411
|
-
var _ReactGA$event;
|
|
21412
21524
|
if (err) {
|
|
21413
21525
|
return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
|
|
21414
21526
|
}
|
|
21415
|
-
|
|
21416
|
-
|
|
21417
|
-
|
|
21418
|
-
|
|
21419
|
-
}
|
|
21527
|
+
if (enableReactGA4) {
|
|
21528
|
+
ReactGA4.event("Canceled", {
|
|
21529
|
+
nonInteraction: true
|
|
21530
|
+
});
|
|
21531
|
+
} else {
|
|
21532
|
+
var _ReactGA$event;
|
|
21533
|
+
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
21534
|
+
category: "ACTIONS",
|
|
21535
|
+
action: "Canceled",
|
|
21536
|
+
nonInteraction: true
|
|
21537
|
+
});
|
|
21538
|
+
}
|
|
21420
21539
|
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
|
|
21421
21540
|
});
|
|
21422
21541
|
};
|
|
@@ -21430,10 +21549,10 @@ const SubscriptionCancelNowButton = _ref => {
|
|
|
21430
21549
|
};
|
|
21431
21550
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
21432
21551
|
|
|
21433
|
-
//Close the modal
|
|
21552
|
+
// Close the modal
|
|
21434
21553
|
switchView(null);
|
|
21435
21554
|
|
|
21436
|
-
//Show confirmation alert after closing the modal
|
|
21555
|
+
// Show confirmation alert after closing the modal
|
|
21437
21556
|
notify.confirm((onSuccess, onFailure) => {
|
|
21438
21557
|
cancelSubscription(payload, onSuccess, onFailure);
|
|
21439
21558
|
}, {
|
|
@@ -21451,8 +21570,6 @@ const SubscriptionCancelNowButton = _ref => {
|
|
|
21451
21570
|
}, t("messages.cancelNow"));
|
|
21452
21571
|
};
|
|
21453
21572
|
|
|
21454
|
-
var _window$4, _window$Pelcro$4, _window$Pelcro$uiSett$4;
|
|
21455
|
-
const ReactGA$4 = (_window$4 = window) !== null && _window$4 !== void 0 && (_window$Pelcro$4 = _window$4.Pelcro) !== null && _window$Pelcro$4 !== void 0 && (_window$Pelcro$uiSett$4 = _window$Pelcro$4.uiSettings) !== null && _window$Pelcro$uiSett$4 !== void 0 && _window$Pelcro$uiSett$4.enableReactGA4 ? ReactGA4 : ReactGA1;
|
|
21456
21573
|
const SubscriptionCancelLaterButton = _ref => {
|
|
21457
21574
|
let {
|
|
21458
21575
|
subscription,
|
|
@@ -21472,6 +21589,8 @@ const SubscriptionCancelLaterButton = _ref => {
|
|
|
21472
21589
|
t
|
|
21473
21590
|
} = useTranslation("subscriptionCancel");
|
|
21474
21591
|
const cancelSubscription = (payload, onSuccess, onFailure) => {
|
|
21592
|
+
var _window, _window$Pelcro, _window$Pelcro$uiSett;
|
|
21593
|
+
const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
|
|
21475
21594
|
window.Pelcro.subscription.cancel({
|
|
21476
21595
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
21477
21596
|
subscription_id: payload.subscription_id,
|
|
@@ -21480,15 +21599,21 @@ const SubscriptionCancelLaterButton = _ref => {
|
|
|
21480
21599
|
reason: payload.reason
|
|
21481
21600
|
})
|
|
21482
21601
|
}, (err, res) => {
|
|
21483
|
-
var _ReactGA$event;
|
|
21484
21602
|
if (err) {
|
|
21485
21603
|
return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
|
|
21486
21604
|
}
|
|
21487
|
-
|
|
21488
|
-
|
|
21489
|
-
|
|
21490
|
-
|
|
21491
|
-
}
|
|
21605
|
+
if (enableReactGA4) {
|
|
21606
|
+
ReactGA4.event("Canceled", {
|
|
21607
|
+
nonInteraction: true
|
|
21608
|
+
});
|
|
21609
|
+
} else {
|
|
21610
|
+
var _ReactGA$event;
|
|
21611
|
+
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
21612
|
+
category: "ACTIONS",
|
|
21613
|
+
action: "Canceled",
|
|
21614
|
+
nonInteraction: true
|
|
21615
|
+
});
|
|
21616
|
+
}
|
|
21492
21617
|
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
|
|
21493
21618
|
});
|
|
21494
21619
|
};
|
|
@@ -21502,10 +21627,10 @@ const SubscriptionCancelLaterButton = _ref => {
|
|
|
21502
21627
|
};
|
|
21503
21628
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
21504
21629
|
|
|
21505
|
-
//Close the modal
|
|
21630
|
+
// Close the modal
|
|
21506
21631
|
switchView(null);
|
|
21507
21632
|
|
|
21508
|
-
//Show confirmation alert after closing the modal
|
|
21633
|
+
// Show confirmation alert after closing the modal
|
|
21509
21634
|
notify.confirm((onSuccess, onFailure) => {
|
|
21510
21635
|
cancelSubscription(payload, onSuccess, onFailure);
|
|
21511
21636
|
}, {
|
|
@@ -21693,9 +21818,8 @@ const SubscriptionSuspendDate = props => {
|
|
|
21693
21818
|
}, props));
|
|
21694
21819
|
};
|
|
21695
21820
|
|
|
21696
|
-
var _window$3, _window$Pelcro$3, _window$Pelcro$uiSett$3;
|
|
21697
|
-
const ReactGA$3 = (_window$3 = window) !== null && _window$3 !== void 0 && (_window$Pelcro$3 = _window$3.Pelcro) !== null && _window$Pelcro$3 !== void 0 && (_window$Pelcro$uiSett$3 = _window$Pelcro$3.uiSettings) !== null && _window$Pelcro$uiSett$3 !== void 0 && _window$Pelcro$uiSett$3.enableReactGA4 ? ReactGA4 : ReactGA1;
|
|
21698
21821
|
const SubscriptionSuspendButton = _ref => {
|
|
21822
|
+
var _window, _window$Pelcro, _window$Pelcro$uiSett;
|
|
21699
21823
|
let {
|
|
21700
21824
|
subscription,
|
|
21701
21825
|
onClick,
|
|
@@ -21714,6 +21838,7 @@ const SubscriptionSuspendButton = _ref => {
|
|
|
21714
21838
|
const {
|
|
21715
21839
|
t
|
|
21716
21840
|
} = useTranslation("subscriptionSuspend");
|
|
21841
|
+
const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
|
|
21717
21842
|
const suspendSubscription = (payload, onSuccess, onFailure) => {
|
|
21718
21843
|
window.Pelcro.subscription.update({
|
|
21719
21844
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
@@ -21721,15 +21846,21 @@ const SubscriptionSuspendButton = _ref => {
|
|
|
21721
21846
|
suspend: 1,
|
|
21722
21847
|
shipments_suspended_until: suspendDate
|
|
21723
21848
|
}, (err, res) => {
|
|
21724
|
-
var _ReactGA$event;
|
|
21725
21849
|
if (err) {
|
|
21726
21850
|
return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
|
|
21727
21851
|
}
|
|
21728
|
-
|
|
21729
|
-
|
|
21730
|
-
|
|
21731
|
-
|
|
21732
|
-
}
|
|
21852
|
+
if (enableReactGA4) {
|
|
21853
|
+
ReactGA4.event("Suspended", {
|
|
21854
|
+
nonInteraction: true
|
|
21855
|
+
});
|
|
21856
|
+
} else {
|
|
21857
|
+
var _ReactGA$event;
|
|
21858
|
+
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
21859
|
+
category: "ACTIONS",
|
|
21860
|
+
action: "Suspended",
|
|
21861
|
+
nonInteraction: true
|
|
21862
|
+
});
|
|
21863
|
+
}
|
|
21733
21864
|
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
|
|
21734
21865
|
});
|
|
21735
21866
|
};
|
|
@@ -21739,10 +21870,10 @@ const SubscriptionSuspendButton = _ref => {
|
|
|
21739
21870
|
};
|
|
21740
21871
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
21741
21872
|
|
|
21742
|
-
//Close the modal
|
|
21873
|
+
// Close the modal
|
|
21743
21874
|
switchView(null);
|
|
21744
21875
|
|
|
21745
|
-
//Show confirmation alert after closing the modal
|
|
21876
|
+
// Show confirmation alert after closing the modal
|
|
21746
21877
|
notify.confirm((onSuccess, onFailure) => {
|
|
21747
21878
|
suspendSubscription(payload, onSuccess, onFailure);
|
|
21748
21879
|
}, {
|
|
@@ -24473,7 +24604,7 @@ const {
|
|
|
24473
24604
|
Provider: Provider$d
|
|
24474
24605
|
} = store$d;
|
|
24475
24606
|
const AddressUpdateContainer = _ref => {
|
|
24476
|
-
var _props$addressId;
|
|
24607
|
+
var _props$addressId, _window, _window$Pelcro, _window$Pelcro$uiSett;
|
|
24477
24608
|
let {
|
|
24478
24609
|
style,
|
|
24479
24610
|
className = "",
|
|
@@ -24487,6 +24618,7 @@ const AddressUpdateContainer = _ref => {
|
|
|
24487
24618
|
addressIdToEdit
|
|
24488
24619
|
} = usePelcro();
|
|
24489
24620
|
const addressId = (_props$addressId = props === null || props === void 0 ? void 0 : props.addressId) !== null && _props$addressId !== void 0 ? _props$addressId : addressIdToEdit;
|
|
24621
|
+
const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
|
|
24490
24622
|
const [t] = useTranslation("address");
|
|
24491
24623
|
React.useEffect(() => {
|
|
24492
24624
|
const getCountries = () => {
|
|
@@ -24577,7 +24709,6 @@ const AddressUpdateContainer = _ref => {
|
|
|
24577
24709
|
});
|
|
24578
24710
|
onFailure(err);
|
|
24579
24711
|
} else {
|
|
24580
|
-
var _ReactGA$event;
|
|
24581
24712
|
dispatch({
|
|
24582
24713
|
type: SHOW_ALERT,
|
|
24583
24714
|
payload: {
|
|
@@ -24586,11 +24717,18 @@ const AddressUpdateContainer = _ref => {
|
|
|
24586
24717
|
}
|
|
24587
24718
|
});
|
|
24588
24719
|
onSuccess(res);
|
|
24589
|
-
|
|
24590
|
-
|
|
24591
|
-
|
|
24592
|
-
|
|
24593
|
-
}
|
|
24720
|
+
if (enableReactGA4) {
|
|
24721
|
+
ReactGA4.event("Updated address", {
|
|
24722
|
+
nonInteraction: true
|
|
24723
|
+
});
|
|
24724
|
+
} else {
|
|
24725
|
+
var _ReactGA$event;
|
|
24726
|
+
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
24727
|
+
category: "ACTIONS",
|
|
24728
|
+
action: "Updated address",
|
|
24729
|
+
nonInteraction: true
|
|
24730
|
+
});
|
|
24731
|
+
}
|
|
24594
24732
|
}
|
|
24595
24733
|
});
|
|
24596
24734
|
};
|
|
@@ -25114,17 +25252,24 @@ function PaymentMethodUpdateView(props) {
|
|
|
25114
25252
|
}));
|
|
25115
25253
|
}
|
|
25116
25254
|
|
|
25117
|
-
var _window$2, _window$Pelcro$2, _window$Pelcro$uiSett$2;
|
|
25118
|
-
const ReactGA$2 = (_window$2 = window) !== null && _window$2 !== void 0 && (_window$Pelcro$2 = _window$2.Pelcro) !== null && _window$Pelcro$2 !== void 0 && (_window$Pelcro$uiSett$2 = _window$Pelcro$2.uiSettings) !== null && _window$Pelcro$uiSett$2 !== void 0 && _window$Pelcro$uiSett$2.enableReactGA4 ? ReactGA4 : ReactGA1;
|
|
25119
25255
|
const PaymentMethodUpdateModal = props => {
|
|
25256
|
+
var _window, _window$Pelcro, _window$Pelcro$uiSett;
|
|
25257
|
+
const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
|
|
25120
25258
|
const onSuccess = res => {
|
|
25121
|
-
var _props$onSuccess
|
|
25259
|
+
var _props$onSuccess;
|
|
25122
25260
|
(_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
|
|
25123
|
-
|
|
25124
|
-
|
|
25125
|
-
|
|
25126
|
-
|
|
25127
|
-
}
|
|
25261
|
+
if (enableReactGA4) {
|
|
25262
|
+
ReactGA4.event("Updated payment card", {
|
|
25263
|
+
nonInteraction: true
|
|
25264
|
+
});
|
|
25265
|
+
} else {
|
|
25266
|
+
var _ReactGA$event;
|
|
25267
|
+
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
25268
|
+
category: "ACTIONS",
|
|
25269
|
+
action: "Updated payment card",
|
|
25270
|
+
nonInteraction: true
|
|
25271
|
+
});
|
|
25272
|
+
}
|
|
25128
25273
|
};
|
|
25129
25274
|
return /*#__PURE__*/React__default['default'].createElement(Modal, {
|
|
25130
25275
|
id: "pelcro-payment-method-update-modal",
|
|
@@ -29001,8 +29146,6 @@ const OrderItems = _ref => {
|
|
|
29001
29146
|
});
|
|
29002
29147
|
};
|
|
29003
29148
|
|
|
29004
|
-
var _window$1, _window$Pelcro$1, _window$Pelcro$uiSett$1;
|
|
29005
|
-
const ReactGA$1 = (_window$1 = window) !== null && _window$1 !== void 0 && (_window$Pelcro$1 = _window$1.Pelcro) !== null && _window$Pelcro$1 !== void 0 && (_window$Pelcro$uiSett$1 = _window$Pelcro$1.uiSettings) !== null && _window$Pelcro$uiSett$1 !== void 0 && _window$Pelcro$uiSett$1.enableReactGA4 ? ReactGA4 : ReactGA1;
|
|
29006
29149
|
const SavedItemsMenu = () => {
|
|
29007
29150
|
const {
|
|
29008
29151
|
t
|
|
@@ -29051,8 +29194,10 @@ const SavedItems = _ref3 => {
|
|
|
29051
29194
|
isAuthenticated
|
|
29052
29195
|
} = usePelcro();
|
|
29053
29196
|
const removeItemFromMetadata = (category, title) => {
|
|
29197
|
+
var _window, _window$Pelcro, _window$Pelcro$uiSett;
|
|
29054
29198
|
const user = window.Pelcro.user.read();
|
|
29055
29199
|
const oldValue = user.metadata[`metadata_saved_${category}`];
|
|
29200
|
+
const enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
|
|
29056
29201
|
const newMetadataValue = oldValue.filter(metadata => !((metadata === null || metadata === void 0 ? void 0 : metadata.title) === title));
|
|
29057
29202
|
if (isAuthenticated()) {
|
|
29058
29203
|
setLoading(true);
|
|
@@ -29061,17 +29206,24 @@ const SavedItems = _ref3 => {
|
|
|
29061
29206
|
value: newMetadataValue,
|
|
29062
29207
|
auth_token: window.Pelcro.user.read().auth_token
|
|
29063
29208
|
}, (error, response) => {
|
|
29064
|
-
var _response$data
|
|
29209
|
+
var _response$data;
|
|
29065
29210
|
setLoading(false);
|
|
29066
29211
|
if (error) {
|
|
29067
29212
|
return;
|
|
29068
29213
|
}
|
|
29069
29214
|
setItems(response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.metadata);
|
|
29070
|
-
|
|
29071
|
-
|
|
29072
|
-
|
|
29073
|
-
|
|
29074
|
-
}
|
|
29215
|
+
if (enableReactGA4) {
|
|
29216
|
+
ReactGA4.event("Unsave/Unfollow", {
|
|
29217
|
+
event_label: title
|
|
29218
|
+
});
|
|
29219
|
+
} else {
|
|
29220
|
+
var _ReactGA$event;
|
|
29221
|
+
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
29222
|
+
category: "ACTIONS",
|
|
29223
|
+
action: "Unsave/Unfollow",
|
|
29224
|
+
label: title
|
|
29225
|
+
});
|
|
29226
|
+
}
|
|
29075
29227
|
});
|
|
29076
29228
|
}
|
|
29077
29229
|
};
|
|
@@ -30024,8 +30176,6 @@ function getMemberShipStatus(status) {
|
|
|
30024
30176
|
};
|
|
30025
30177
|
}
|
|
30026
30178
|
|
|
30027
|
-
var _window, _window$Pelcro, _window$Pelcro$uiSett;
|
|
30028
|
-
const ReactGA = (_window = window) !== null && _window !== void 0 && (_window$Pelcro = _window.Pelcro) !== null && _window$Pelcro !== void 0 && (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) !== null && _window$Pelcro$uiSett !== void 0 && _window$Pelcro$uiSett.enableReactGA4 ? ReactGA4 : ReactGA1;
|
|
30029
30179
|
const SUB_MENUS = {
|
|
30030
30180
|
PROFILE: "profile",
|
|
30031
30181
|
SUBSCRIPTIONS: "subscriptions",
|
|
@@ -30080,21 +30230,27 @@ function DashboardWithHook(props) {
|
|
|
30080
30230
|
DashboardWithHook.viewId = "dashboard";
|
|
30081
30231
|
class Dashboard extends React.Component {
|
|
30082
30232
|
constructor(props) {
|
|
30083
|
-
var _window$Pelcro$user$r, _window$Pelcro$user$r2;
|
|
30233
|
+
var _window$Pelcro$user$r, _window$Pelcro$user$r2, _window, _window$Pelcro, _window$Pelcro$uiSett;
|
|
30084
30234
|
super(props);
|
|
30085
30235
|
_defineProperty$3(this, "componentDidMount", () => {
|
|
30086
|
-
var _ReactGA$event;
|
|
30087
30236
|
this.setState({
|
|
30088
30237
|
isOpen: true
|
|
30089
30238
|
});
|
|
30090
30239
|
window.Pelcro.insight.track("Modal Displayed", {
|
|
30091
30240
|
name: "dashboard"
|
|
30092
30241
|
});
|
|
30093
|
-
|
|
30094
|
-
|
|
30095
|
-
|
|
30096
|
-
|
|
30097
|
-
}
|
|
30242
|
+
if (this.enableReactGA4) {
|
|
30243
|
+
ReactGA4.event("Dashboard Modal Viewed", {
|
|
30244
|
+
nonInteraction: true
|
|
30245
|
+
});
|
|
30246
|
+
} else {
|
|
30247
|
+
var _ReactGA$event;
|
|
30248
|
+
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
30249
|
+
category: "VIEWS",
|
|
30250
|
+
action: "Dashboard Modal Viewed",
|
|
30251
|
+
nonInteraction: true
|
|
30252
|
+
});
|
|
30253
|
+
}
|
|
30098
30254
|
const {
|
|
30099
30255
|
addresses
|
|
30100
30256
|
} = window.Pelcro.user.read();
|
|
@@ -30122,15 +30278,21 @@ class Dashboard extends React.Component {
|
|
|
30122
30278
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
30123
30279
|
subscription_id: subscription_id
|
|
30124
30280
|
}, (err, res) => {
|
|
30125
|
-
var _ReactGA$event2;
|
|
30126
30281
|
if (err) {
|
|
30127
30282
|
return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
|
|
30128
30283
|
}
|
|
30129
|
-
|
|
30130
|
-
|
|
30131
|
-
|
|
30132
|
-
|
|
30133
|
-
}
|
|
30284
|
+
if (this.enableReactGA4) {
|
|
30285
|
+
ReactGA4.event("Canceled", {
|
|
30286
|
+
nonInteraction: true
|
|
30287
|
+
});
|
|
30288
|
+
} else {
|
|
30289
|
+
var _ReactGA$event2;
|
|
30290
|
+
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event2 = ReactGA.event) === null || _ReactGA$event2 === void 0 ? void 0 : _ReactGA$event2.call(ReactGA, {
|
|
30291
|
+
category: "ACTIONS",
|
|
30292
|
+
action: "Canceled",
|
|
30293
|
+
nonInteraction: true
|
|
30294
|
+
});
|
|
30295
|
+
}
|
|
30134
30296
|
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
|
|
30135
30297
|
});
|
|
30136
30298
|
});
|
|
@@ -30140,15 +30302,21 @@ class Dashboard extends React.Component {
|
|
|
30140
30302
|
subscription_id: subscription_id,
|
|
30141
30303
|
suspend: 0
|
|
30142
30304
|
}, (err, res) => {
|
|
30143
|
-
var _ReactGA$event3;
|
|
30144
30305
|
if (err) {
|
|
30145
30306
|
return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
|
|
30146
30307
|
}
|
|
30147
|
-
|
|
30148
|
-
|
|
30149
|
-
|
|
30150
|
-
|
|
30151
|
-
}
|
|
30308
|
+
if (this.enableReactGA4) {
|
|
30309
|
+
ReactGA4.event("UnSuspended", {
|
|
30310
|
+
nonInteraction: true
|
|
30311
|
+
});
|
|
30312
|
+
} else {
|
|
30313
|
+
var _ReactGA$event3;
|
|
30314
|
+
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event3 = ReactGA.event) === null || _ReactGA$event3 === void 0 ? void 0 : _ReactGA$event3.call(ReactGA, {
|
|
30315
|
+
category: "ACTIONS",
|
|
30316
|
+
action: "UnSuspended",
|
|
30317
|
+
nonInteraction: true
|
|
30318
|
+
});
|
|
30319
|
+
}
|
|
30152
30320
|
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
|
|
30153
30321
|
});
|
|
30154
30322
|
});
|
|
@@ -30433,6 +30601,7 @@ class Dashboard extends React.Component {
|
|
|
30433
30601
|
this.locale = this.props.t;
|
|
30434
30602
|
this.user = window.Pelcro.user.read();
|
|
30435
30603
|
this.menuRef = /*#__PURE__*/React__default['default'].createRef();
|
|
30604
|
+
this.enableReactGA4 = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.enableReactGA4;
|
|
30436
30605
|
}
|
|
30437
30606
|
render() {
|
|
30438
30607
|
var _window$Pelcro$user$r3, _window$Pelcro2, _window$Pelcro2$uiSet, _this$user$source, _this$user$source$pro, _this$user$source2, _this$user$source2$pr;
|