@pelcro/react-pelcro-js 3.26.0-beta.2 → 3.26.0-beta.21
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 +618 -207
- package/dist/index.esm.js +618 -208
- package/dist/pelcro.css +43 -0
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -3422,7 +3422,7 @@ var labels$15 = {
|
|
|
3422
3422
|
code: "Coupon code",
|
|
3423
3423
|
"for": "for",
|
|
3424
3424
|
interval: "{{count}} {{interval}}",
|
|
3425
|
-
interval_plural: "{{count}} {{interval}}
|
|
3425
|
+
interval_plural: "{{count}} {{interval}}",
|
|
3426
3426
|
tax: "Tax",
|
|
3427
3427
|
removeCoupon: "REMOVE",
|
|
3428
3428
|
firstName: "First name",
|
|
@@ -4073,12 +4073,16 @@ var invoiceDetails_en = {
|
|
|
4073
4073
|
var labels$U = {
|
|
4074
4074
|
title: "Cancel subscription",
|
|
4075
4075
|
cancelReason: "Cancellation reason",
|
|
4076
|
+
endOn: "End on",
|
|
4077
|
+
endImmediately: "End immediately",
|
|
4078
|
+
cancel: "Cancel",
|
|
4076
4079
|
subCancellation: {
|
|
4077
4080
|
goBack: "Go back"
|
|
4078
4081
|
}
|
|
4079
4082
|
};
|
|
4080
4083
|
var messages$W = {
|
|
4081
4084
|
subscriptionEnd: "This subscription is set to expire on",
|
|
4085
|
+
cancelWhen: "When would you like to cancel?",
|
|
4082
4086
|
cancelNow: "Cancel Subscription Now",
|
|
4083
4087
|
cancelLater: "Cancel at Period End",
|
|
4084
4088
|
subCancellation: {
|
|
@@ -4344,7 +4348,7 @@ var labels$P = {
|
|
|
4344
4348
|
code: "Code promo",
|
|
4345
4349
|
"for": "pour",
|
|
4346
4350
|
interval: "{{count}} {{interval}}",
|
|
4347
|
-
interval_plural: "{{count}} {{interval}}
|
|
4351
|
+
interval_plural: "{{count}} {{interval}}",
|
|
4348
4352
|
tax: "Taxe",
|
|
4349
4353
|
removeCoupon: "RETIRER",
|
|
4350
4354
|
firstName: "Prénom",
|
|
@@ -4995,12 +4999,16 @@ var invoiceDetails_fr = {
|
|
|
4995
4999
|
var labels$C = {
|
|
4996
5000
|
title: "Annuler l'abonnement",
|
|
4997
5001
|
cancelReason: "Motif d'annulation",
|
|
5002
|
+
endOn: "Fin sur",
|
|
5003
|
+
endImmediately: "Fin immédiate",
|
|
5004
|
+
cancel: "Annuler",
|
|
4998
5005
|
subCancellation: {
|
|
4999
5006
|
goBack: "Retourner"
|
|
5000
5007
|
}
|
|
5001
5008
|
};
|
|
5002
5009
|
var messages$D = {
|
|
5003
5010
|
subscriptionEnd: "Cet abonnement doit expirer le",
|
|
5011
|
+
cancelWhen: "Quand voulez-vous annuler?",
|
|
5004
5012
|
cancelNow: "Cancel Subscription Now",
|
|
5005
5013
|
cancelLater: "Annuler l'abonnement maintenant",
|
|
5006
5014
|
subCancellation: {
|
|
@@ -6024,12 +6032,16 @@ var invoiceDetails_ko = {
|
|
|
6024
6032
|
var labels$k = {
|
|
6025
6033
|
title: "구독 취소",
|
|
6026
6034
|
cancelReason: "취소 사유",
|
|
6035
|
+
endOn: "종료",
|
|
6036
|
+
endImmediately: "즉시 종료",
|
|
6037
|
+
cancel: "취소",
|
|
6027
6038
|
subCancellation: {
|
|
6028
6039
|
goBack: "돌아가기"
|
|
6029
6040
|
}
|
|
6030
6041
|
};
|
|
6031
6042
|
var messages$k = {
|
|
6032
6043
|
subscriptionEnd: "이 구독은 다음 날짜에 만료되도록 설정되었습니다.",
|
|
6044
|
+
cancelWhen: "언제 취소하시겠습니까?",
|
|
6033
6045
|
cancelNow: "지금 구독 취소",
|
|
6034
6046
|
cancelLater: "기간 종료 시 취소",
|
|
6035
6047
|
subCancellation: {
|
|
@@ -6291,7 +6303,7 @@ var labels$f = {
|
|
|
6291
6303
|
code: "Código de cupón",
|
|
6292
6304
|
"for": "por",
|
|
6293
6305
|
interval: "{{count}} {{interval}}",
|
|
6294
|
-
interval_plural: "{{count}} {{interval}}
|
|
6306
|
+
interval_plural: "{{count}} {{interval}}",
|
|
6295
6307
|
tax: "Impuesto",
|
|
6296
6308
|
removeCoupon: "ELIMINAR",
|
|
6297
6309
|
firstName: "Nombre",
|
|
@@ -6938,12 +6950,16 @@ var invoiceDetails_es = {
|
|
|
6938
6950
|
var labels$2 = {
|
|
6939
6951
|
title: "Cancelar suscripción",
|
|
6940
6952
|
cancelReason: "Razón de la cancelación",
|
|
6953
|
+
endOn: "Fin de",
|
|
6954
|
+
endImmediately: "Fin inmediato",
|
|
6955
|
+
cancel: "Cancelar",
|
|
6941
6956
|
subCancellation: {
|
|
6942
6957
|
goBack: "Volver"
|
|
6943
6958
|
}
|
|
6944
6959
|
};
|
|
6945
6960
|
var messages$1 = {
|
|
6946
6961
|
subscriptionEnd: "Esta suscripción expirará el",
|
|
6962
|
+
cancelWhen: "¿Cuándo desea cancelar?",
|
|
6947
6963
|
cancelNow: "Cancelar Suscripción Ahora",
|
|
6948
6964
|
cancelLater: "Cancelar al Final del Periodo",
|
|
6949
6965
|
subCancellation: {
|
|
@@ -8920,8 +8936,6 @@ exports["default"] = _default;
|
|
|
8920
8936
|
var ReactGA4 = unwrapExports(dist);
|
|
8921
8937
|
dist.ReactGAImplementation;
|
|
8922
8938
|
|
|
8923
|
-
var _window$f, _window$Pelcro$f, _window$Pelcro$uiSett$f;
|
|
8924
|
-
const enableReactGA4$f = (_window$f = window) === null || _window$f === void 0 ? void 0 : (_window$Pelcro$f = _window$f.Pelcro) === null || _window$Pelcro$f === void 0 ? void 0 : (_window$Pelcro$uiSett$f = _window$Pelcro$f.uiSettings) === null || _window$Pelcro$uiSett$f === void 0 ? void 0 : _window$Pelcro$uiSett$f.enableReactGA4;
|
|
8925
8939
|
class PelcroActions {
|
|
8926
8940
|
constructor(storeSetter, storeGetter) {
|
|
8927
8941
|
var _this = this;
|
|
@@ -9101,18 +9115,20 @@ class PelcroActions {
|
|
|
9101
9115
|
});
|
|
9102
9116
|
});
|
|
9103
9117
|
_defineProperty$3(this, "logout", function () {
|
|
9118
|
+
var _window, _window$Pelcro, _window$Pelcro$uiSett;
|
|
9104
9119
|
let displayLogin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
9105
9120
|
const {
|
|
9106
9121
|
switchView,
|
|
9107
9122
|
resetView,
|
|
9108
9123
|
isAuthenticated
|
|
9109
9124
|
} = _this.get();
|
|
9125
|
+
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;
|
|
9110
9126
|
// if user is not authenticated function execution is terminated
|
|
9111
9127
|
if (!isAuthenticated()) {
|
|
9112
9128
|
return console.warn("You are already logged out.");
|
|
9113
9129
|
}
|
|
9114
9130
|
window.Pelcro.user.logout();
|
|
9115
|
-
if (enableReactGA4
|
|
9131
|
+
if (enableReactGA4) {
|
|
9116
9132
|
ReactGA4.event("Logged out", {
|
|
9117
9133
|
nonInteraction: true
|
|
9118
9134
|
});
|
|
@@ -9348,9 +9364,6 @@ if (process.env.NODE_ENV === "development") {
|
|
|
9348
9364
|
c$1("Pelcro Store", usePelcro);
|
|
9349
9365
|
}
|
|
9350
9366
|
|
|
9351
|
-
var _window$e, _window$Pelcro$e, _window$Pelcro$uiSett$e;
|
|
9352
|
-
const enableReactGA4$e = (_window$e = window) === null || _window$e === void 0 ? void 0 : (_window$Pelcro$e = _window$e.Pelcro) === null || _window$Pelcro$e === void 0 ? void 0 : (_window$Pelcro$uiSett$e = _window$Pelcro$e.uiSettings) === null || _window$Pelcro$uiSett$e === void 0 ? void 0 : _window$Pelcro$uiSett$e.enableReactGA4;
|
|
9353
|
-
|
|
9354
9367
|
/**
|
|
9355
9368
|
* List of zero-decimal currencies.
|
|
9356
9369
|
* @see https://stripe.com/docs/currencies#zero-decimal
|
|
@@ -9436,8 +9449,8 @@ const getLanguageWithoutRegion = localeName => {
|
|
|
9436
9449
|
* @return {string | undefined}
|
|
9437
9450
|
*/
|
|
9438
9451
|
const getPageOrDefaultLanguage = () => {
|
|
9439
|
-
var _window$Pelcro$helper, _window$
|
|
9440
|
-
return (_window$Pelcro$helper = window.Pelcro.helpers.getHtmlLanguageAttribute()) !== null && _window$Pelcro$helper !== void 0 ? _window$Pelcro$helper : getLanguageWithoutRegion((_window$
|
|
9452
|
+
var _window$Pelcro$helper, _window$Pelcro, _window$Pelcro$site, _window$Pelcro$site$r, _window$Pelcro$site$r2;
|
|
9453
|
+
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);
|
|
9441
9454
|
};
|
|
9442
9455
|
|
|
9443
9456
|
/**
|
|
@@ -9490,9 +9503,9 @@ const isValidViewFromURL = viewID => {
|
|
|
9490
9503
|
*
|
|
9491
9504
|
*/
|
|
9492
9505
|
function hasValidNewsletterUpdateUrl() {
|
|
9493
|
-
var _window$
|
|
9506
|
+
var _window$Pelcro2, _window$Pelcro2$uiSet;
|
|
9494
9507
|
if (viewID !== "newsletter-update") return false;
|
|
9495
|
-
const newsletters = (_window$
|
|
9508
|
+
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;
|
|
9496
9509
|
const siteHasNewslettersDefined = Array.isArray(newsletters) && newsletters.length > 0;
|
|
9497
9510
|
if (!siteHasNewslettersDefined) {
|
|
9498
9511
|
return false;
|
|
@@ -9538,7 +9551,7 @@ const disableScroll = () => {
|
|
|
9538
9551
|
}
|
|
9539
9552
|
};
|
|
9540
9553
|
const trackSubscriptionOnGA = () => {
|
|
9541
|
-
var _window$Pelcro$user$r5, _window$Pelcro$user$r6;
|
|
9554
|
+
var _window, _window$Pelcro3, _window$Pelcro3$uiSet, _window$Pelcro$user$r5, _window$Pelcro$user$r6;
|
|
9542
9555
|
const {
|
|
9543
9556
|
product,
|
|
9544
9557
|
plan,
|
|
@@ -9553,11 +9566,12 @@ const trackSubscriptionOnGA = () => {
|
|
|
9553
9566
|
invoices
|
|
9554
9567
|
} = window.Pelcro.user.read();
|
|
9555
9568
|
const lastSubscriptionId = invoices === null || invoices === void 0 ? void 0 : invoices[invoices.length - 1].subscription_id;
|
|
9569
|
+
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;
|
|
9556
9570
|
if (!lastSubscriptionId) {
|
|
9557
9571
|
return;
|
|
9558
9572
|
}
|
|
9559
9573
|
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;
|
|
9560
|
-
if (enableReactGA4
|
|
9574
|
+
if (enableReactGA4) {
|
|
9561
9575
|
ReactGA4.event("purchase", {
|
|
9562
9576
|
transaction_id: lastSubscriptionId,
|
|
9563
9577
|
affiliation: "Pelcro",
|
|
@@ -9685,8 +9699,8 @@ function getDateWithoutTime(dateObject) {
|
|
|
9685
9699
|
return date;
|
|
9686
9700
|
}
|
|
9687
9701
|
function userMustVerifyEmail() {
|
|
9688
|
-
var _window$Pelcro$site$
|
|
9689
|
-
const isEmailVerificationEnabled = (_window$Pelcro$site$
|
|
9702
|
+
var _window$Pelcro$site$r3, _window$Pelcro$site$r4, _window$Pelcro$user$r9, _window$Pelcro$user$r10;
|
|
9703
|
+
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;
|
|
9690
9704
|
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;
|
|
9691
9705
|
return window.Pelcro.user.isAuthenticated() && isEmailVerificationEnabled && !isUserEmailVerified;
|
|
9692
9706
|
}
|
|
@@ -10055,10 +10069,8 @@ function _classPrivateFieldGet(receiver, privateMap) {
|
|
|
10055
10069
|
return descriptor.value;
|
|
10056
10070
|
}
|
|
10057
10071
|
|
|
10058
|
-
var _window$d, _window$Pelcro$d, _window$Pelcro$uiSett$d;
|
|
10059
10072
|
function _classPrivateFieldInitSpec$2(obj, privateMap, value) { _checkPrivateRedeclaration$2(obj, privateMap); privateMap.set(obj, value); }
|
|
10060
10073
|
function _checkPrivateRedeclaration$2(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
10061
|
-
const enableReactGA4$d = (_window$d = window) === null || _window$d === void 0 ? void 0 : (_window$Pelcro$d = _window$d.Pelcro) === null || _window$Pelcro$d === void 0 ? void 0 : (_window$Pelcro$uiSett$d = _window$Pelcro$d.uiSettings) === null || _window$Pelcro$uiSett$d === void 0 ? void 0 : _window$Pelcro$uiSett$d.enableReactGA4;
|
|
10062
10074
|
var _isAlreadySaved = /*#__PURE__*/new WeakMap();
|
|
10063
10075
|
var _markButtonAsLoading = /*#__PURE__*/new WeakMap();
|
|
10064
10076
|
var _removeLoadingState = /*#__PURE__*/new WeakMap();
|
|
@@ -10142,7 +10154,7 @@ class SaveToMetadataButtonClass {
|
|
|
10142
10154
|
_classPrivateFieldInitSpec$2(this, _saveToMetadata, {
|
|
10143
10155
|
writable: true,
|
|
10144
10156
|
value: event => {
|
|
10145
|
-
var _user$metadata;
|
|
10157
|
+
var _window, _window$Pelcro, _window$Pelcro$uiSett, _user$metadata;
|
|
10146
10158
|
const button = event.currentTarget;
|
|
10147
10159
|
const user = window.Pelcro.user.read();
|
|
10148
10160
|
const {
|
|
@@ -10152,6 +10164,7 @@ class SaveToMetadataButtonClass {
|
|
|
10152
10164
|
key,
|
|
10153
10165
|
...buttonMetadata
|
|
10154
10166
|
} = button.dataset;
|
|
10167
|
+
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;
|
|
10155
10168
|
if (userMustVerifyEmail()) {
|
|
10156
10169
|
return switchView("email-verify");
|
|
10157
10170
|
}
|
|
@@ -10180,7 +10193,7 @@ class SaveToMetadataButtonClass {
|
|
|
10180
10193
|
return _classPrivateFieldGet(this, _removeLoadingState).call(this, button);
|
|
10181
10194
|
}
|
|
10182
10195
|
_classPrivateFieldGet(this, _markButtonAsSaved).call(this, button);
|
|
10183
|
-
if (enableReactGA4
|
|
10196
|
+
if (enableReactGA4) {
|
|
10184
10197
|
ReactGA4.event("Save/Follow", {
|
|
10185
10198
|
event_label: buttonMetadata === null || buttonMetadata === void 0 ? void 0 : buttonMetadata.title
|
|
10186
10199
|
});
|
|
@@ -10199,6 +10212,7 @@ class SaveToMetadataButtonClass {
|
|
|
10199
10212
|
_classPrivateFieldInitSpec$2(this, _removeMetaData, {
|
|
10200
10213
|
writable: true,
|
|
10201
10214
|
value: event => {
|
|
10215
|
+
var _window2, _window2$Pelcro, _window2$Pelcro$uiSet;
|
|
10202
10216
|
const button = event.currentTarget;
|
|
10203
10217
|
const user = window.Pelcro.user.read();
|
|
10204
10218
|
const {
|
|
@@ -10206,6 +10220,7 @@ class SaveToMetadataButtonClass {
|
|
|
10206
10220
|
title
|
|
10207
10221
|
} = button.dataset;
|
|
10208
10222
|
const oldValue = user.metadata[`metadata_saved_${key}`];
|
|
10223
|
+
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;
|
|
10209
10224
|
const newMetadataValue = oldValue.filter(metadata => !((metadata === null || metadata === void 0 ? void 0 : metadata.title) === title));
|
|
10210
10225
|
if (window.Pelcro.user.isAuthenticated()) {
|
|
10211
10226
|
_classPrivateFieldGet(this, _markButtonAsLoading).call(this, button);
|
|
@@ -10218,7 +10233,7 @@ class SaveToMetadataButtonClass {
|
|
|
10218
10233
|
return _classPrivateFieldGet(this, _removeLoadingState).call(this, button);
|
|
10219
10234
|
}
|
|
10220
10235
|
_classPrivateFieldGet(this, _unmarkSavedButton).call(this, button);
|
|
10221
|
-
if (enableReactGA4
|
|
10236
|
+
if (enableReactGA4) {
|
|
10222
10237
|
ReactGA4.event("Unsave/Unfollow", {
|
|
10223
10238
|
event_label: title
|
|
10224
10239
|
});
|
|
@@ -11752,9 +11767,6 @@ function getSiteCardProcessor() {
|
|
|
11752
11767
|
return "stripe";
|
|
11753
11768
|
}
|
|
11754
11769
|
|
|
11755
|
-
var _window$c, _window$Pelcro$c, _window$Pelcro$uiSett$c;
|
|
11756
|
-
const enableReactGA4$c = (_window$c = window) === null || _window$c === void 0 ? void 0 : (_window$Pelcro$c = _window$c.Pelcro) === null || _window$Pelcro$c === void 0 ? void 0 : (_window$Pelcro$uiSett$c = _window$Pelcro$c.uiSettings) === null || _window$Pelcro$uiSett$c === void 0 ? void 0 : _window$Pelcro$uiSett$c.enableReactGA4;
|
|
11757
|
-
|
|
11758
11770
|
/**
|
|
11759
11771
|
* @typedef {Object} OptionsType
|
|
11760
11772
|
* @property {boolean} loadPaymentSDKs
|
|
@@ -11806,21 +11818,33 @@ const initPaywalls = () => {
|
|
|
11806
11818
|
return;
|
|
11807
11819
|
}
|
|
11808
11820
|
const {
|
|
11809
|
-
switchView
|
|
11821
|
+
switchView,
|
|
11822
|
+
isAuthenticated
|
|
11810
11823
|
} = usePelcro.getStore();
|
|
11811
|
-
|
|
11812
|
-
|
|
11813
|
-
|
|
11814
|
-
|
|
11815
|
-
|
|
11816
|
-
|
|
11817
|
-
|
|
11818
|
-
|
|
11824
|
+
|
|
11825
|
+
// eslint-disable-next-line no-inner-declarations
|
|
11826
|
+
function displayPaywalls() {
|
|
11827
|
+
if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayMeterPaywall()) {
|
|
11828
|
+
/*
|
|
11829
|
+
showing both the meter and the entitlements notification doesn't make sense from
|
|
11830
|
+
a product prespective + they would take half the screen on mobile devies, so we're
|
|
11831
|
+
not showing the meter, and only showing the entitlements notification.
|
|
11832
|
+
*/
|
|
11833
|
+
if (!didBlurContent) {
|
|
11834
|
+
switchView("meter");
|
|
11835
|
+
}
|
|
11836
|
+
} else if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayNewsletterPaywall()) {
|
|
11837
|
+
switchView("newsletter");
|
|
11838
|
+
} else if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayPaywall()) {
|
|
11839
|
+
switchView("plan-select");
|
|
11819
11840
|
}
|
|
11820
|
-
}
|
|
11821
|
-
|
|
11822
|
-
|
|
11823
|
-
|
|
11841
|
+
}
|
|
11842
|
+
if ("id" in Pelcro.user.read() || !isAuthenticated()) {
|
|
11843
|
+
displayPaywalls();
|
|
11844
|
+
} else {
|
|
11845
|
+
addEventListener("PelcroUserLoaded", function () {
|
|
11846
|
+
displayPaywalls();
|
|
11847
|
+
}, true);
|
|
11824
11848
|
}
|
|
11825
11849
|
}
|
|
11826
11850
|
};
|
|
@@ -11832,6 +11856,7 @@ const loadPaymentSDKs = () => {
|
|
|
11832
11856
|
if (!window.Stripe && !supportsVantiv && !supportsTap) {
|
|
11833
11857
|
pure_1(window.Pelcro.environment.stripe);
|
|
11834
11858
|
}
|
|
11859
|
+
window.Pelcro.helpers.loadSDK("https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js", "apple-pay-sdk");
|
|
11835
11860
|
|
|
11836
11861
|
// Load PayPal SDKs
|
|
11837
11862
|
const supportsPaypal = Boolean(window.Pelcro.site.read().braintree_tokenization);
|
|
@@ -11845,6 +11870,11 @@ const loadPaymentSDKs = () => {
|
|
|
11845
11870
|
if (!window.jQuery) {
|
|
11846
11871
|
window.Pelcro.helpers.loadSDK("https://code.jquery.com/jquery-3.6.0.slim.min.js", "vantiv-jquery-sdk");
|
|
11847
11872
|
}
|
|
11873
|
+
window.Pelcro.helpers.loadSDK("https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js", "vantiv-jquery-sdk");
|
|
11874
|
+
const eProtectApi3PreLiveURL = "https://request.eprotect.vantivprelive.com/eProtect/eProtect-api3.js";
|
|
11875
|
+
const eProtectApi3ProductionURL = "https://request.eprotect.vantivcnp.com/eProtect/eProtect-api3.js";
|
|
11876
|
+
const eProtectApi3scriptUrlToUse = window.Pelcro.site.read().vantiv_gateway_settings.environment === "production" ? eProtectApi3ProductionURL : eProtectApi3PreLiveURL;
|
|
11877
|
+
window.Pelcro.helpers.loadSDK(eProtectApi3scriptUrlToUse, "vantiv-eprotect-api");
|
|
11848
11878
|
if (!window.EprotectIframeClient) {
|
|
11849
11879
|
const PRELIVE_URL = "https://request.eprotect.vantivprelive.com/eProtect/js/eProtect-iframe-client.min.js";
|
|
11850
11880
|
const PRODUCTION_URL = "https://request.eprotect.vantivcnp.com/eProtect/js/eProtect-iframe-client3.min.js";
|
|
@@ -11877,8 +11907,10 @@ const initSecuritySdk = () => {
|
|
|
11877
11907
|
});
|
|
11878
11908
|
};
|
|
11879
11909
|
const initGATracking = () => {
|
|
11910
|
+
var _window, _window$Pelcro, _window$Pelcro$uiSett;
|
|
11911
|
+
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;
|
|
11880
11912
|
if (window.Pelcro.site.read().google_analytics_id) {
|
|
11881
|
-
if (enableReactGA4
|
|
11913
|
+
if (enableReactGA4) {
|
|
11882
11914
|
// Initialize ReactGA4 with your tracking ID
|
|
11883
11915
|
ReactGA4.initialize(window.Pelcro.site.read().google_analytics_id);
|
|
11884
11916
|
// Enable e-commerce tracking
|
|
@@ -11898,9 +11930,10 @@ const initGATracking = () => {
|
|
|
11898
11930
|
}
|
|
11899
11931
|
};
|
|
11900
11932
|
const dispatchModalDisplayEvents = modalName => {
|
|
11901
|
-
var _modalName$replace, _modalName$replace2;
|
|
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;
|
|
11902
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("-", " ");
|
|
11903
|
-
if (enableReactGA4
|
|
11936
|
+
if (enableReactGA4) {
|
|
11904
11937
|
ReactGA4.event(`${formattedAction} viewed`, {
|
|
11905
11938
|
nonInteraction: true
|
|
11906
11939
|
});
|
|
@@ -12713,6 +12746,7 @@ const LOADING = "LOADING";
|
|
|
12713
12746
|
const SUBMIT_PAYMENT = "SUBMIT_PAYMENT";
|
|
12714
12747
|
const SUBSCRIBE = "CREATE_SUBSCRIPTION";
|
|
12715
12748
|
const HANDLE_PAYPAL_SUBSCRIPTION = "HANDLE_PAYPAL_SUBSCRIPTION";
|
|
12749
|
+
const HANDLE_APPLEPAY_SUBSCRIPTION = "HANDLE_APPLEPAY_SUBSCRIPTION";
|
|
12716
12750
|
const DISABLE_COUPON_BUTTON = "DISABLE_COUPON_BUTTON";
|
|
12717
12751
|
const APPLY_COUPON_CODE = "APPLY_COUPON_CODE";
|
|
12718
12752
|
const REMOVE_APPLIED_COUPON = "REMOVE_APPLIED_COUPON";
|
|
@@ -12774,6 +12808,7 @@ const GET_NEWSLETTERS_SUCCESS = "GET_NEWSLETTERS_SUCCESS";
|
|
|
12774
12808
|
const SWITCH_TO_UPDATE = "SWITCH_TO_UPDATE";
|
|
12775
12809
|
const LINK_TOKEN_VERIFY = "LINK_TOKEN_VERIFY";
|
|
12776
12810
|
const SET_CANCEL_SUBSCRIPTION_REASON = "SET_CANCEL_SUBSCRIPTION_REASON";
|
|
12811
|
+
const SET_CANCEL_SUBSCRIPTION_OPTION = "SET_CANCEL_SUBSCRIPTION_OPTION";
|
|
12777
12812
|
const HANDLE_CHECKBOX_CHANGE = "HANDLE_CHECKBOX_CHANGE";
|
|
12778
12813
|
const SET_SUBSCRIPTION_SUSPEND_DATE = "SET_SUBSCRIPTION_SUSPEND_DATE";
|
|
12779
12814
|
const SET_EMAILS = "SET_EMAILS";
|
|
@@ -12786,8 +12821,6 @@ const UPDATE_MEMBERS = "UPDATE_MEMBERS";
|
|
|
12786
12821
|
const UPDATE_REMOVE_MEMBER_ID = "UPDATE_REMOVE_MEMBER_ID";
|
|
12787
12822
|
const UPDATE_CYBERSOURCE_SESSION_ID = "UPDATE_CYBERSOURCE_SESSION_ID";
|
|
12788
12823
|
|
|
12789
|
-
var _window$b, _window$Pelcro$b, _window$Pelcro$uiSett$b;
|
|
12790
|
-
const enableReactGA4$b = (_window$b = window) === null || _window$b === void 0 ? void 0 : (_window$Pelcro$b = _window$b.Pelcro) === null || _window$Pelcro$b === void 0 ? void 0 : (_window$Pelcro$uiSett$b = _window$Pelcro$b.uiSettings) === null || _window$Pelcro$uiSett$b === void 0 ? void 0 : _window$Pelcro$uiSett$b.enableReactGA4;
|
|
12791
12824
|
const initialState$m = {
|
|
12792
12825
|
email: "",
|
|
12793
12826
|
username: "",
|
|
@@ -12806,6 +12839,7 @@ const {
|
|
|
12806
12839
|
Provider: Provider$m
|
|
12807
12840
|
} = store$m;
|
|
12808
12841
|
const LoginContainer = _ref => {
|
|
12842
|
+
var _window, _window$Pelcro, _window$Pelcro$uiSett;
|
|
12809
12843
|
let {
|
|
12810
12844
|
style,
|
|
12811
12845
|
className = "",
|
|
@@ -12813,6 +12847,7 @@ const LoginContainer = _ref => {
|
|
|
12813
12847
|
onFailure = () => {},
|
|
12814
12848
|
children
|
|
12815
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;
|
|
12816
12851
|
const handleLogin = (_ref2, dispatch) => {
|
|
12817
12852
|
let {
|
|
12818
12853
|
email,
|
|
@@ -12843,7 +12878,7 @@ const LoginContainer = _ref => {
|
|
|
12843
12878
|
onFailure(err);
|
|
12844
12879
|
} else {
|
|
12845
12880
|
onSuccess(res);
|
|
12846
|
-
if (enableReactGA4
|
|
12881
|
+
if (enableReactGA4) {
|
|
12847
12882
|
ReactGA4.event("Logged in", {
|
|
12848
12883
|
nonInteraction: true
|
|
12849
12884
|
});
|
|
@@ -13240,12 +13275,12 @@ function ConfirmPassword(_ref) {
|
|
|
13240
13275
|
}, otherProps));
|
|
13241
13276
|
}
|
|
13242
13277
|
|
|
13243
|
-
var _window$a, _window$Pelcro$a, _window$Pelcro$uiSett$a;
|
|
13244
|
-
const enableReactGA4$a = (_window$a = window) === null || _window$a === void 0 ? void 0 : (_window$Pelcro$a = _window$a.Pelcro) === null || _window$Pelcro$a === void 0 ? void 0 : (_window$Pelcro$uiSett$a = _window$Pelcro$a.uiSettings) === null || _window$Pelcro$uiSett$a === void 0 ? void 0 : _window$Pelcro$uiSett$a.enableReactGA4;
|
|
13245
13278
|
const Logout = props => {
|
|
13246
13279
|
const handleLogout = () => {
|
|
13280
|
+
var _window, _window$Pelcro, _window$Pelcro$uiSett;
|
|
13247
13281
|
window.Pelcro.user.logout();
|
|
13248
|
-
|
|
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) {
|
|
13249
13284
|
ReactGA4.event("Logged out", {
|
|
13250
13285
|
nonInteraction: true
|
|
13251
13286
|
});
|
|
@@ -14814,13 +14849,11 @@ const RegisterCompany = props => {
|
|
|
14814
14849
|
}, props));
|
|
14815
14850
|
};
|
|
14816
14851
|
|
|
14817
|
-
var _window$9, _window$Pelcro$9, _window$Pelcro$uiSett$9;
|
|
14818
|
-
const enableReactGA4$9 = (_window$9 = window) === null || _window$9 === void 0 ? void 0 : (_window$Pelcro$9 = _window$9.Pelcro) === null || _window$Pelcro$9 === void 0 ? void 0 : (_window$Pelcro$uiSett$9 = _window$Pelcro$9.uiSettings) === null || _window$Pelcro$uiSett$9 === void 0 ? void 0 : _window$Pelcro$uiSett$9.enableReactGA4;
|
|
14819
|
-
|
|
14820
14852
|
/**
|
|
14821
14853
|
*
|
|
14822
14854
|
*/
|
|
14823
14855
|
function RegisterModal(props) {
|
|
14856
|
+
var _window, _window$Pelcro, _window$Pelcro$uiSett;
|
|
14824
14857
|
const {
|
|
14825
14858
|
t
|
|
14826
14859
|
} = useTranslation("register");
|
|
@@ -14835,6 +14868,7 @@ function RegisterModal(props) {
|
|
|
14835
14868
|
giftCode,
|
|
14836
14869
|
isGift
|
|
14837
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;
|
|
14838
14872
|
const onSuccess = res => {
|
|
14839
14873
|
var _props$onSuccess;
|
|
14840
14874
|
(_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
|
|
@@ -14842,7 +14876,7 @@ function RegisterModal(props) {
|
|
|
14842
14876
|
};
|
|
14843
14877
|
const handleAfterRegistrationLogic = () => {
|
|
14844
14878
|
var _window$Pelcro$site$r, _window$Pelcro$site$r2;
|
|
14845
|
-
if (enableReactGA4
|
|
14879
|
+
if (enableReactGA4) {
|
|
14846
14880
|
ReactGA4.event("Registered", {
|
|
14847
14881
|
nonInteraction: true
|
|
14848
14882
|
});
|
|
@@ -14940,9 +14974,6 @@ function Radio(_ref) {
|
|
|
14940
14974
|
}, children));
|
|
14941
14975
|
}
|
|
14942
14976
|
|
|
14943
|
-
var _window$8, _window$Pelcro$8, _window$Pelcro$uiSett$8;
|
|
14944
|
-
const enableReactGA4$8 = (_window$8 = window) === null || _window$8 === void 0 ? void 0 : (_window$Pelcro$8 = _window$8.Pelcro) === null || _window$Pelcro$8 === void 0 ? void 0 : (_window$Pelcro$uiSett$8 = _window$Pelcro$8.uiSettings) === null || _window$Pelcro$uiSett$8 === void 0 ? void 0 : _window$Pelcro$uiSett$8.enableReactGA4;
|
|
14945
|
-
|
|
14946
14977
|
/**
|
|
14947
14978
|
*
|
|
14948
14979
|
*/
|
|
@@ -15002,6 +15033,7 @@ function productMatchPageLanguage(product) {
|
|
|
15002
15033
|
SelectModalWithHook.viewId = "plan-select";
|
|
15003
15034
|
class SelectModal extends Component {
|
|
15004
15035
|
constructor(props) {
|
|
15036
|
+
var _window, _window$Pelcro11, _window$Pelcro11$uiSe;
|
|
15005
15037
|
super(props);
|
|
15006
15038
|
_defineProperty$3(this, "componentDidMount", () => {
|
|
15007
15039
|
if (this.props.product) {
|
|
@@ -15036,11 +15068,11 @@ class SelectModal extends Component {
|
|
|
15036
15068
|
}
|
|
15037
15069
|
document.addEventListener("keydown", this.handleSubmit);
|
|
15038
15070
|
if (!document.querySelector("#pelcro-selection-view") || !document.querySelector(".pelcro-select-product-wrapper")) {
|
|
15039
|
-
var _window$
|
|
15040
|
-
const userCurrency = (_window$
|
|
15041
|
-
const userCountry = (_window$
|
|
15042
|
-
const userLanguage = (_window$
|
|
15043
|
-
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 => {
|
|
15044
15076
|
const filteredPlans = product.plans.filter(plan => plan.currency === userCurrency || !userCurrency);
|
|
15045
15077
|
if (filteredPlans.length) return filteredPlans;
|
|
15046
15078
|
});
|
|
@@ -15053,12 +15085,12 @@ class SelectModal extends Component {
|
|
|
15053
15085
|
});
|
|
15054
15086
|
notifyBugsnag(() => {
|
|
15055
15087
|
Bugsnag.notify("SelectModal - No data viewed", event => {
|
|
15056
|
-
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;
|
|
15057
15089
|
event.addMetadata("MetaData", {
|
|
15058
|
-
site: (_window$
|
|
15059
|
-
user: (_window$
|
|
15060
|
-
uiVersion: (_window$
|
|
15061
|
-
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,
|
|
15062
15094
|
matchingEntitlementsProps: (_this$props = this.props) === null || _this$props === void 0 ? void 0 : _this$props.matchingEntitlements,
|
|
15063
15095
|
productListState: this.state.productList,
|
|
15064
15096
|
methods: {
|
|
@@ -15069,8 +15101,8 @@ class SelectModal extends Component {
|
|
|
15069
15101
|
userCurrency: userCurrency,
|
|
15070
15102
|
userCountry: userCountry,
|
|
15071
15103
|
userLanguage: userLanguage,
|
|
15072
|
-
siteLanguage: (_window$
|
|
15073
|
-
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,
|
|
15074
15106
|
currency_matching_filter: `${productsMatchingUserCurrency.length} Products Passed`,
|
|
15075
15107
|
country_matching_filter: `${productsMatchingUserCountry.length} Products Passed`,
|
|
15076
15108
|
language_matching_filter: `${productsMatchingUserCountry.filter(productMatchPageLanguage).length} Products Passed`
|
|
@@ -15109,7 +15141,7 @@ class SelectModal extends Component {
|
|
|
15109
15141
|
startingPlan = plan;
|
|
15110
15142
|
}
|
|
15111
15143
|
}
|
|
15112
|
-
return `${startingPlan.amount_formatted}/${startingPlan.interval_count > 1 ? `${startingPlan.interval_count} ${startingPlan.
|
|
15144
|
+
return `${startingPlan.amount_formatted}/${startingPlan.interval_count > 1 ? `${startingPlan.interval_count} ${startingPlan.interval_translated}` : `${startingPlan.interval_translated}`}`;
|
|
15113
15145
|
});
|
|
15114
15146
|
_defineProperty$3(this, "renderOneProduct", (product, index, options) => {
|
|
15115
15147
|
const isPlanMode = Boolean(this.state.mode === "plan");
|
|
@@ -15282,6 +15314,7 @@ class SelectModal extends Component {
|
|
|
15282
15314
|
this.product = this.props.product || window.Pelcro.paywall.getProduct();
|
|
15283
15315
|
this.locale = this.props.t;
|
|
15284
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;
|
|
15285
15318
|
}
|
|
15286
15319
|
render() {
|
|
15287
15320
|
var _window$Pelcro$produc2, _window$Pelcro$produc3, _window$Pelcro$site$r;
|
|
@@ -15289,7 +15322,7 @@ class SelectModal extends Component {
|
|
|
15289
15322
|
disableGifting
|
|
15290
15323
|
} = this.props;
|
|
15291
15324
|
if (this.state.mode === "product") {
|
|
15292
|
-
if (enableReactGA4
|
|
15325
|
+
if (this.enableReactGA4) {
|
|
15293
15326
|
ReactGA4.event("Product Modal Viewed", {
|
|
15294
15327
|
nonInteraction: true
|
|
15295
15328
|
});
|
|
@@ -15302,7 +15335,7 @@ class SelectModal extends Component {
|
|
|
15302
15335
|
});
|
|
15303
15336
|
}
|
|
15304
15337
|
} else if (this.state.mode === "plan") {
|
|
15305
|
-
if (enableReactGA4
|
|
15338
|
+
if (this.enableReactGA4) {
|
|
15306
15339
|
ReactGA4.event("Plan Modal Viewed", {
|
|
15307
15340
|
nonInteraction: true
|
|
15308
15341
|
});
|
|
@@ -18088,7 +18121,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18088
18121
|
});
|
|
18089
18122
|
};
|
|
18090
18123
|
|
|
18091
|
-
|
|
18124
|
+
/* ====== Start Cybersource integration ======== */
|
|
18092
18125
|
const cybersourceErrorHandle = err => {
|
|
18093
18126
|
var _err$details, _err$details$response, _err$details$response2;
|
|
18094
18127
|
if ((err === null || err === void 0 ? void 0 : (_err$details = err.details) === null || _err$details === void 0 ? void 0 : (_err$details$response = _err$details.responseStatus) === null || _err$details$response === void 0 ? void 0 : (_err$details$response2 = _err$details$response.details) === null || _err$details$response2 === void 0 ? void 0 : _err$details$response2.length) > 0) {
|
|
@@ -18153,7 +18186,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18153
18186
|
} else if (type === "orderCreate") {
|
|
18154
18187
|
purchase(new CybersourceGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, state, dispatch);
|
|
18155
18188
|
} else if (type === "invoicePayment") {
|
|
18156
|
-
payInvoice(new CybersourceGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest);
|
|
18189
|
+
payInvoice(new CybersourceGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, dispatch);
|
|
18157
18190
|
} else if (type === "updatePaymentSource") {
|
|
18158
18191
|
createNewCybersourceCard();
|
|
18159
18192
|
}
|
|
@@ -18357,9 +18390,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18357
18390
|
});
|
|
18358
18391
|
};
|
|
18359
18392
|
|
|
18360
|
-
|
|
18393
|
+
/* ====== End Cybersource integration ======== */
|
|
18361
18394
|
|
|
18362
|
-
|
|
18395
|
+
/* ====== Start Tap integration ======== */
|
|
18363
18396
|
const submitUsingTap = state => {
|
|
18364
18397
|
var _ref4, _ref5, _getPlanAmount;
|
|
18365
18398
|
const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
|
|
@@ -18483,7 +18516,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18483
18516
|
} else if (type === "orderCreate") {
|
|
18484
18517
|
purchase(new TapGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, state, dispatch);
|
|
18485
18518
|
} else if (type === "invoicePayment") {
|
|
18486
|
-
payInvoice(new TapGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest);
|
|
18519
|
+
payInvoice(new TapGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, dispatch);
|
|
18487
18520
|
} else if (type === "updatePaymentSource") {
|
|
18488
18521
|
createNewTapCard();
|
|
18489
18522
|
}
|
|
@@ -18631,28 +18664,28 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18631
18664
|
cardHolder: "Card Holder Name"
|
|
18632
18665
|
};
|
|
18633
18666
|
|
|
18634
|
-
//payment options
|
|
18667
|
+
// payment options
|
|
18635
18668
|
let paymentOptions = {
|
|
18636
18669
|
labels: labels,
|
|
18637
18670
|
TextDirection: "ltr"
|
|
18638
18671
|
};
|
|
18639
18672
|
|
|
18640
|
-
//create element, pass style and payment options
|
|
18673
|
+
// create element, pass style and payment options
|
|
18641
18674
|
let card = elements.create("card", {
|
|
18642
18675
|
style: style
|
|
18643
18676
|
}, paymentOptions);
|
|
18644
18677
|
|
|
18645
|
-
//mount element
|
|
18678
|
+
// mount element
|
|
18646
18679
|
card.mount("#tapPaymentIframe");
|
|
18647
18680
|
|
|
18648
|
-
//card change event listener
|
|
18681
|
+
// card change event listener
|
|
18649
18682
|
card.addEventListener("change", function (event) {
|
|
18650
|
-
//If needed
|
|
18683
|
+
// If needed
|
|
18651
18684
|
});
|
|
18652
18685
|
tapInstanceRef.current = tapKey;
|
|
18653
18686
|
tapInstanceCard.current = card;
|
|
18654
18687
|
};
|
|
18655
|
-
|
|
18688
|
+
/* ====== End Tap integration ======== */
|
|
18656
18689
|
|
|
18657
18690
|
const submitUsingVantiv = state => {
|
|
18658
18691
|
const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
|
|
@@ -18694,7 +18727,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18694
18727
|
} else if (type === "orderCreate") {
|
|
18695
18728
|
purchase(new VantivGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, state, dispatch);
|
|
18696
18729
|
} else if (type === "invoicePayment") {
|
|
18697
|
-
payInvoice(new VantivGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest);
|
|
18730
|
+
payInvoice(new VantivGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, dispatch);
|
|
18698
18731
|
} else if (type === "updatePaymentSource") {
|
|
18699
18732
|
createNewVantivCard();
|
|
18700
18733
|
}
|
|
@@ -18840,7 +18873,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18840
18873
|
}
|
|
18841
18874
|
}, [selectedPaymentMethodId]);
|
|
18842
18875
|
|
|
18843
|
-
//Trigger the handleVantivPayment method when a
|
|
18876
|
+
// Trigger the handleVantivPayment method when a vantivPaymentRequest is present
|
|
18844
18877
|
useEffect(() => {
|
|
18845
18878
|
if (vantivPaymentRequest) {
|
|
18846
18879
|
handleVantivPayment(vantivPaymentRequest, updatedCouponCode);
|
|
@@ -19000,7 +19033,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19000
19033
|
if (err) {
|
|
19001
19034
|
onFailure(err);
|
|
19002
19035
|
|
|
19003
|
-
//reset the coupon code in local state
|
|
19036
|
+
// reset the coupon code in local state
|
|
19004
19037
|
setUpdatedCouponCode("");
|
|
19005
19038
|
dispatch({
|
|
19006
19039
|
type: SET_COUPON_ERROR,
|
|
@@ -19061,7 +19094,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19061
19094
|
payload: res.data.coupon
|
|
19062
19095
|
});
|
|
19063
19096
|
|
|
19064
|
-
//set the coupon code in local state to be able to use with Vantiv
|
|
19097
|
+
// set the coupon code in local state to be able to use with Vantiv
|
|
19065
19098
|
setUpdatedCouponCode(res.data.coupon.code);
|
|
19066
19099
|
dispatch({
|
|
19067
19100
|
type: SET_PERCENT_OFF,
|
|
@@ -19134,7 +19167,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19134
19167
|
const removeAppliedCoupon = state => {
|
|
19135
19168
|
state.couponCode = "";
|
|
19136
19169
|
|
|
19137
|
-
//reset the coupon code in local state
|
|
19170
|
+
// reset the coupon code in local state
|
|
19138
19171
|
setUpdatedCouponCode("");
|
|
19139
19172
|
dispatch({
|
|
19140
19173
|
type: SET_COUPON_ERROR,
|
|
@@ -19526,7 +19559,8 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19526
19559
|
});
|
|
19527
19560
|
});
|
|
19528
19561
|
};
|
|
19529
|
-
const payInvoice = (gatewayService, gatewayToken, dispatch)
|
|
19562
|
+
const payInvoice = function (gatewayService, gatewayToken, dispatch) {
|
|
19563
|
+
let cb = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
19530
19564
|
const payment = new Payment(gatewayService);
|
|
19531
19565
|
return payment.execute({
|
|
19532
19566
|
type: PAYMENT_TYPES.PAY_INVOICE,
|
|
@@ -19534,7 +19568,29 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19534
19568
|
isExistingSource: Boolean(selectedPaymentMethodId),
|
|
19535
19569
|
invoiceId: invoice.id
|
|
19536
19570
|
}, (err, res) => {
|
|
19537
|
-
|
|
19571
|
+
if (cb && typeof cb == "function") {
|
|
19572
|
+
cb(res, err);
|
|
19573
|
+
} else {
|
|
19574
|
+
dispatch({
|
|
19575
|
+
type: DISABLE_SUBMIT,
|
|
19576
|
+
payload: false
|
|
19577
|
+
});
|
|
19578
|
+
dispatch({
|
|
19579
|
+
type: LOADING,
|
|
19580
|
+
payload: false
|
|
19581
|
+
});
|
|
19582
|
+
if (err) {
|
|
19583
|
+
onFailure(err);
|
|
19584
|
+
return dispatch({
|
|
19585
|
+
type: SHOW_ALERT,
|
|
19586
|
+
payload: {
|
|
19587
|
+
type: "error",
|
|
19588
|
+
content: getErrorMessages(err)
|
|
19589
|
+
}
|
|
19590
|
+
});
|
|
19591
|
+
}
|
|
19592
|
+
onSuccess(res);
|
|
19593
|
+
}
|
|
19538
19594
|
});
|
|
19539
19595
|
};
|
|
19540
19596
|
const updatePaymentSource = (state, dispatch) => {
|
|
@@ -19778,7 +19834,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19778
19834
|
} else if (stripeSource && type === "orderCreate") {
|
|
19779
19835
|
purchase(new StripeGateway(), stripeSource.id, state, dispatch);
|
|
19780
19836
|
} else if (stripeSource && type === "invoicePayment") {
|
|
19781
|
-
payInvoice(new StripeGateway(), stripeSource.id);
|
|
19837
|
+
payInvoice(new StripeGateway(), stripeSource.id, dispatch, confirmStripeCardPayment);
|
|
19782
19838
|
}
|
|
19783
19839
|
};
|
|
19784
19840
|
const handlePaymentError = error => {
|
|
@@ -19950,11 +20006,15 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19950
20006
|
case HANDLE_PAYPAL_SUBSCRIPTION:
|
|
19951
20007
|
return lib_5(state, (state, dispatch) => {
|
|
19952
20008
|
if (type === "invoicePayment") {
|
|
19953
|
-
payInvoice(new PaypalGateway(), action.payload);
|
|
20009
|
+
payInvoice(new PaypalGateway(), action.payload, dispatch);
|
|
19954
20010
|
} else {
|
|
19955
20011
|
handlePaypalSubscription(state, action.payload);
|
|
19956
20012
|
}
|
|
19957
20013
|
});
|
|
20014
|
+
case HANDLE_APPLEPAY_SUBSCRIPTION:
|
|
20015
|
+
return lib_5(state, (state, dispatch) => {
|
|
20016
|
+
setVantivPaymentRequest(action.payload);
|
|
20017
|
+
});
|
|
19958
20018
|
case SET_UPDATED_PRICE:
|
|
19959
20019
|
return lib_7({
|
|
19960
20020
|
...state,
|
|
@@ -21096,6 +21156,341 @@ const DonationEmail = props => /*#__PURE__*/React__default.createElement(Email,
|
|
|
21096
21156
|
store: store$k
|
|
21097
21157
|
}, props));
|
|
21098
21158
|
|
|
21159
|
+
/**
|
|
21160
|
+
* ApplePayButton component
|
|
21161
|
+
* @return {JSX}
|
|
21162
|
+
*/
|
|
21163
|
+
const ApplePayButton = _ref => {
|
|
21164
|
+
var _window$Pelcro$site$r;
|
|
21165
|
+
let {
|
|
21166
|
+
onClick,
|
|
21167
|
+
props,
|
|
21168
|
+
...otherProps
|
|
21169
|
+
} = _ref;
|
|
21170
|
+
const {
|
|
21171
|
+
dispatch,
|
|
21172
|
+
state
|
|
21173
|
+
} = useContext(store$k);
|
|
21174
|
+
const {
|
|
21175
|
+
plan,
|
|
21176
|
+
invoice,
|
|
21177
|
+
order
|
|
21178
|
+
} = usePelcro();
|
|
21179
|
+
const {
|
|
21180
|
+
pay_page_id: payPageId,
|
|
21181
|
+
report_group: reportGroup,
|
|
21182
|
+
apple_pay_merchant_id: ApplePayMerchantId,
|
|
21183
|
+
apple_pay_enabled: ApplePayEnabled
|
|
21184
|
+
} = (_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.vantiv_gateway_settings;
|
|
21185
|
+
const getOrderInfo = () => {
|
|
21186
|
+
if (!order) {
|
|
21187
|
+
return {
|
|
21188
|
+
price: null,
|
|
21189
|
+
currency: null,
|
|
21190
|
+
label: null
|
|
21191
|
+
};
|
|
21192
|
+
}
|
|
21193
|
+
const isQuickPurchase = !Array.isArray(order);
|
|
21194
|
+
if (isQuickPurchase) {
|
|
21195
|
+
return {
|
|
21196
|
+
price: order.price * order.quantity,
|
|
21197
|
+
currency: order.currency,
|
|
21198
|
+
label: order.name
|
|
21199
|
+
};
|
|
21200
|
+
}
|
|
21201
|
+
if (order.length === 0) {
|
|
21202
|
+
return {
|
|
21203
|
+
price: null,
|
|
21204
|
+
currency: null,
|
|
21205
|
+
label: null
|
|
21206
|
+
};
|
|
21207
|
+
}
|
|
21208
|
+
const price = order.reduce((total, item) => total + item.price * item.quantity, 0);
|
|
21209
|
+
return {
|
|
21210
|
+
price,
|
|
21211
|
+
currency: order[0].currency,
|
|
21212
|
+
label: "Order"
|
|
21213
|
+
};
|
|
21214
|
+
};
|
|
21215
|
+
const orderPrice = getOrderInfo().price;
|
|
21216
|
+
const orderCurrency = getOrderInfo().currency;
|
|
21217
|
+
const orderLabel = getOrderInfo().label;
|
|
21218
|
+
useEffect(() => {
|
|
21219
|
+
if (window.ApplePaySession) {
|
|
21220
|
+
// Indicates whether the device supports Apple Pay and whether the user has an active card in Wallet.
|
|
21221
|
+
// eslint-disable-next-line no-undef
|
|
21222
|
+
const promise = ApplePaySession.canMakePaymentsWithActiveCard(ApplePayMerchantId);
|
|
21223
|
+
promise.then(function (canMakePayments) {
|
|
21224
|
+
if (canMakePayments && ApplePayEnabled) {
|
|
21225
|
+
// Display Apple Pay Buttons here…
|
|
21226
|
+
const pelcroApplyPayButton = document.getElementById("pelcro-apple-pay-button");
|
|
21227
|
+
if (pelcroApplyPayButton) {
|
|
21228
|
+
pelcroApplyPayButton.style.display = "block";
|
|
21229
|
+
}
|
|
21230
|
+
console.log("canMakePayments", canMakePayments);
|
|
21231
|
+
}
|
|
21232
|
+
});
|
|
21233
|
+
} else {
|
|
21234
|
+
console.error("ApplePay is not available on this browser");
|
|
21235
|
+
}
|
|
21236
|
+
}, []);
|
|
21237
|
+
useEffect(() => {
|
|
21238
|
+
function onApplePayButtonClicked() {
|
|
21239
|
+
var _ref2, _ref3, _ref4, _ref5, _state$updatedPrice, _props$plan, _window, _window$Pelcro, _window$Pelcro$user, _window$Pelcro$user$l;
|
|
21240
|
+
// eslint-disable-next-line no-undef
|
|
21241
|
+
if (!ApplePaySession) {
|
|
21242
|
+
return;
|
|
21243
|
+
}
|
|
21244
|
+
const updatedPrice = (_ref2 = (_ref3 = (_ref4 = (_ref5 = (_state$updatedPrice = state.updatedPrice) !== null && _state$updatedPrice !== void 0 ? _state$updatedPrice : props === null || props === void 0 ? void 0 : (_props$plan = props.plan) === null || _props$plan === void 0 ? void 0 : _props$plan.amount) !== null && _ref5 !== void 0 ? _ref5 : plan === null || plan === void 0 ? void 0 : plan.amount) !== null && _ref4 !== void 0 ? _ref4 : orderPrice) !== null && _ref3 !== void 0 ? _ref3 : invoice === null || invoice === void 0 ? void 0 : invoice.amount_remaining) !== null && _ref2 !== void 0 ? _ref2 : null;
|
|
21245
|
+
const getCurrencyCode = () => {
|
|
21246
|
+
if (plan) {
|
|
21247
|
+
return plan === null || plan === void 0 ? void 0 : plan.currency.toUpperCase();
|
|
21248
|
+
} else if (order) {
|
|
21249
|
+
return orderCurrency.toUpperCase();
|
|
21250
|
+
} else if (invoice) {
|
|
21251
|
+
return invoice === null || invoice === void 0 ? void 0 : invoice.currency.toUpperCase();
|
|
21252
|
+
}
|
|
21253
|
+
};
|
|
21254
|
+
dispatch({
|
|
21255
|
+
type: DISABLE_SUBMIT,
|
|
21256
|
+
payload: true
|
|
21257
|
+
});
|
|
21258
|
+
|
|
21259
|
+
// Define ApplePayPaymentRequest
|
|
21260
|
+
// @see https://developer.apple.com/documentation/apple_pay_on_the_web/apple_pay_js_api/creating_an_apple_pay_session
|
|
21261
|
+
const ApplePayPaymentRequest = {
|
|
21262
|
+
countryCode: ((_window = window) === null || _window === void 0 ? void 0 : (_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$l = _window$Pelcro$user.location) === null || _window$Pelcro$user$l === void 0 ? void 0 : _window$Pelcro$user$l.countryCode) || "US",
|
|
21263
|
+
currencyCode: getCurrencyCode(),
|
|
21264
|
+
merchantCapabilities: ["supports3DS"],
|
|
21265
|
+
supportedNetworks: ["visa", "masterCard", "amex", "discover"],
|
|
21266
|
+
total: {
|
|
21267
|
+
label: (plan === null || plan === void 0 ? void 0 : plan.nickname) || orderLabel || `invoice #${invoice === null || invoice === void 0 ? void 0 : invoice.id}`,
|
|
21268
|
+
type: "final",
|
|
21269
|
+
amount: updatedPrice / 100
|
|
21270
|
+
}
|
|
21271
|
+
};
|
|
21272
|
+
console.log(ApplePayPaymentRequest);
|
|
21273
|
+
// Create ApplePaySession
|
|
21274
|
+
// @todo - Clarify supported version parameter
|
|
21275
|
+
// @odo - Apple Pay demo uses version 6 (https://applepaydemo.apple.com/)
|
|
21276
|
+
const session = new ApplePaySession(3, ApplePayPaymentRequest); // eslint-disable-line no-undef
|
|
21277
|
+
|
|
21278
|
+
// @todo - Detect whether web browser supports a particular Apple Pay version.
|
|
21279
|
+
// @see https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/1778014-supportsversion
|
|
21280
|
+
|
|
21281
|
+
session.onvalidatemerchant = async event => {
|
|
21282
|
+
const {
|
|
21283
|
+
validationURL
|
|
21284
|
+
} = event;
|
|
21285
|
+
console.log("then merchantSession step", event);
|
|
21286
|
+
// Call your own server to request a new merchant session.
|
|
21287
|
+
window.Pelcro.payment.startSession({
|
|
21288
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
21289
|
+
site_id: window.Pelcro.siteid,
|
|
21290
|
+
validation_url: validationURL
|
|
21291
|
+
}, (err, res) => {
|
|
21292
|
+
if (err) {
|
|
21293
|
+
// Handle any errors during merchant validation
|
|
21294
|
+
console.error("Merchant validation SDK error: ", err);
|
|
21295
|
+
session.abort();
|
|
21296
|
+
return dispatch({
|
|
21297
|
+
type: SHOW_ALERT,
|
|
21298
|
+
payload: {
|
|
21299
|
+
type: "error",
|
|
21300
|
+
content: getErrorMessages(err)
|
|
21301
|
+
}
|
|
21302
|
+
});
|
|
21303
|
+
}
|
|
21304
|
+
// Complete merchant validation with the merchant session object
|
|
21305
|
+
console.log("Merchant validation SDK response: ", res);
|
|
21306
|
+
const merchantSession = res;
|
|
21307
|
+
session.completeMerchantValidation(merchantSession);
|
|
21308
|
+
});
|
|
21309
|
+
};
|
|
21310
|
+
session.onpaymentmethodselected = event => {
|
|
21311
|
+
console.log("payment method selected step", event);
|
|
21312
|
+
// Define ApplePayPaymentMethodUpdate based on the selected payment method.
|
|
21313
|
+
// No updates or errors are needed, pass an empty object.
|
|
21314
|
+
const newTotal = {
|
|
21315
|
+
label: (plan === null || plan === void 0 ? void 0 : plan.nickname) || orderLabel || `invoice #${invoice === null || invoice === void 0 ? void 0 : invoice.id}`,
|
|
21316
|
+
type: "final",
|
|
21317
|
+
amount: updatedPrice / 100
|
|
21318
|
+
};
|
|
21319
|
+
const newLineItems = [{
|
|
21320
|
+
label: (plan === null || plan === void 0 ? void 0 : plan.nickname) || orderLabel || `invoice #${invoice === null || invoice === void 0 ? void 0 : invoice.id}`,
|
|
21321
|
+
type: "final",
|
|
21322
|
+
amount: updatedPrice / 100
|
|
21323
|
+
}];
|
|
21324
|
+
session.completePaymentMethodSelection(newTotal, newLineItems);
|
|
21325
|
+
};
|
|
21326
|
+
|
|
21327
|
+
// TODO: Check if onshippingmethodselected it should be implemented
|
|
21328
|
+
// session.onshippingmethodselected = (event) => {
|
|
21329
|
+
// console.log("on shipping method selected step", event);
|
|
21330
|
+
// // Define ApplePayShippingMethodUpdate based on the selected shipping method.
|
|
21331
|
+
// // No updates or errors are needed, pass an empty object.
|
|
21332
|
+
// const newTotal = {
|
|
21333
|
+
// label: plan?.nickname || orderLabel || `invoice #${invoice?.id}`,
|
|
21334
|
+
// type: "final",
|
|
21335
|
+
// amount: updatedPrice / 100
|
|
21336
|
+
// };
|
|
21337
|
+
|
|
21338
|
+
// const newLineItems = [
|
|
21339
|
+
// {
|
|
21340
|
+
// label: plan?.nickname || orderLabel || `invoice #${invoice?.id}`,
|
|
21341
|
+
// type: "final",
|
|
21342
|
+
// amount: updatedPrice / 100
|
|
21343
|
+
// }
|
|
21344
|
+
// ];
|
|
21345
|
+
|
|
21346
|
+
// session.completeShippingMethodSelection(newTotal, newLineItems);
|
|
21347
|
+
// };
|
|
21348
|
+
|
|
21349
|
+
// TODO: Check if onshippingcontactselected it should be implemented
|
|
21350
|
+
// session.onshippingcontactselected = (event) => {
|
|
21351
|
+
// console.log("on shipping contact selected step", event);
|
|
21352
|
+
// // Define ApplePayShippingContactUpdate based on the selected shipping contact.
|
|
21353
|
+
// const update = {};
|
|
21354
|
+
// session.completeShippingContactSelection(update);
|
|
21355
|
+
// };
|
|
21356
|
+
|
|
21357
|
+
session.onpaymentauthorized = event => {
|
|
21358
|
+
console.log("on payment authorized step", event);
|
|
21359
|
+
// Define ApplePayPaymentAuthorizationResult
|
|
21360
|
+
const result = {
|
|
21361
|
+
status: ApplePaySession.STATUS_SUCCESS // eslint-disable-line no-undef
|
|
21362
|
+
};
|
|
21363
|
+
|
|
21364
|
+
const {
|
|
21365
|
+
paymentData
|
|
21366
|
+
} = event.payment.token;
|
|
21367
|
+
const {
|
|
21368
|
+
data,
|
|
21369
|
+
signature,
|
|
21370
|
+
version
|
|
21371
|
+
} = paymentData;
|
|
21372
|
+
const {
|
|
21373
|
+
ephemeralPublicKey,
|
|
21374
|
+
publicKeyHash,
|
|
21375
|
+
transactionId
|
|
21376
|
+
} = paymentData.header;
|
|
21377
|
+
const applePayToken = {
|
|
21378
|
+
data: data,
|
|
21379
|
+
signature: signature,
|
|
21380
|
+
version: version,
|
|
21381
|
+
header: {
|
|
21382
|
+
ephemeralPublicKey: ephemeralPublicKey,
|
|
21383
|
+
publicKeyHash: publicKeyHash,
|
|
21384
|
+
transactionId: transactionId
|
|
21385
|
+
}
|
|
21386
|
+
};
|
|
21387
|
+
console.log(applePayToken);
|
|
21388
|
+
const orderId = `pelcro-${new Date().getTime()}`;
|
|
21389
|
+
const eProtectRequest = {
|
|
21390
|
+
paypageId: payPageId,
|
|
21391
|
+
reportGroup: reportGroup,
|
|
21392
|
+
orderId: orderId,
|
|
21393
|
+
id: orderId,
|
|
21394
|
+
applepay: applePayToken,
|
|
21395
|
+
url: "https://request.eprotect.vantivprelive.com"
|
|
21396
|
+
};
|
|
21397
|
+
|
|
21398
|
+
// successCallback function to handle the response from WorldPay.
|
|
21399
|
+
function successCallback(vantivResponse) {
|
|
21400
|
+
const {
|
|
21401
|
+
expDate
|
|
21402
|
+
} = vantivResponse;
|
|
21403
|
+
console.log("Response:", vantivResponse);
|
|
21404
|
+
const expMonth = expDate.substring(0, 2);
|
|
21405
|
+
const expYear = expDate.substring(2);
|
|
21406
|
+
const vantivPaymentRequest = {
|
|
21407
|
+
...vantivResponse,
|
|
21408
|
+
expMonth: expMonth,
|
|
21409
|
+
expYear: expYear,
|
|
21410
|
+
applePay: true
|
|
21411
|
+
};
|
|
21412
|
+
|
|
21413
|
+
// Process the registrationId or continue with further payment processing.
|
|
21414
|
+
dispatch({
|
|
21415
|
+
type: HANDLE_APPLEPAY_SUBSCRIPTION,
|
|
21416
|
+
payload: vantivPaymentRequest
|
|
21417
|
+
});
|
|
21418
|
+
dispatch({
|
|
21419
|
+
type: LOADING,
|
|
21420
|
+
payload: true
|
|
21421
|
+
});
|
|
21422
|
+
session.completePayment(result);
|
|
21423
|
+
}
|
|
21424
|
+
|
|
21425
|
+
// errorCallback function to handle any errors that may occur during the tokenization process.
|
|
21426
|
+
function errorCallback(error) {
|
|
21427
|
+
console.error("Error retrieving Registration ID:", error);
|
|
21428
|
+
// Handle error appropriately.
|
|
21429
|
+
}
|
|
21430
|
+
// errorCallback function to handle any errors that may occur during the tokenization process.
|
|
21431
|
+
function timeoutCallback() {
|
|
21432
|
+
console.error("eProtect Timeout");
|
|
21433
|
+
// Handle error appropriately.
|
|
21434
|
+
}
|
|
21435
|
+
|
|
21436
|
+
// eslint-disable-next-line no-undef
|
|
21437
|
+
new eProtect().sendToEprotect(eProtectRequest, {}, successCallback, errorCallback, timeoutCallback, 15000);
|
|
21438
|
+
};
|
|
21439
|
+
|
|
21440
|
+
// TODO: Check if oncouponcodechanged it should be implemented
|
|
21441
|
+
// session.oncouponcodechanged = (event) => {
|
|
21442
|
+
// console.log("on coupon code changed step", event);
|
|
21443
|
+
// // Define ApplePayCouponCodeUpdate
|
|
21444
|
+
// const newTotal = calculateNewTotal(event.couponCode);
|
|
21445
|
+
// const newLineItems = calculateNewLineItems(event.couponCode);
|
|
21446
|
+
// const newShippingMethods = calculateNewShippingMethods(
|
|
21447
|
+
// event.couponCode
|
|
21448
|
+
// );
|
|
21449
|
+
// const errors = calculateErrors(event.couponCode);
|
|
21450
|
+
|
|
21451
|
+
// session.completeCouponCodeChange({
|
|
21452
|
+
// newTotal: newTotal,
|
|
21453
|
+
// newLineItems: newLineItems,
|
|
21454
|
+
// newShippingMethods: newShippingMethods,
|
|
21455
|
+
// errors: errors
|
|
21456
|
+
// });
|
|
21457
|
+
// };
|
|
21458
|
+
|
|
21459
|
+
session.oncancel = event => {
|
|
21460
|
+
// Payment cancelled by WebKit
|
|
21461
|
+
console.log("on cancel step", event);
|
|
21462
|
+
dispatch({
|
|
21463
|
+
type: LOADING,
|
|
21464
|
+
payload: false
|
|
21465
|
+
});
|
|
21466
|
+
dispatch({
|
|
21467
|
+
type: DISABLE_SUBMIT,
|
|
21468
|
+
payload: false
|
|
21469
|
+
});
|
|
21470
|
+
};
|
|
21471
|
+
session.begin();
|
|
21472
|
+
}
|
|
21473
|
+
const pelcroApplyPayButton = document.getElementById("pelcro-apple-pay-button");
|
|
21474
|
+
if (pelcroApplyPayButton) {
|
|
21475
|
+
pelcroApplyPayButton.addEventListener("click", onApplePayButtonClicked);
|
|
21476
|
+
}
|
|
21477
|
+
return () => {
|
|
21478
|
+
if (pelcroApplyPayButton) {
|
|
21479
|
+
pelcroApplyPayButton.removeEventListener("click", onApplePayButtonClicked);
|
|
21480
|
+
}
|
|
21481
|
+
};
|
|
21482
|
+
}, [state.updatedPrice]);
|
|
21483
|
+
return /*#__PURE__*/React__default.createElement("apple-pay-button", {
|
|
21484
|
+
id: "pelcro-apple-pay-button",
|
|
21485
|
+
style: {
|
|
21486
|
+
display: "none"
|
|
21487
|
+
},
|
|
21488
|
+
buttonstyle: "black",
|
|
21489
|
+
type: "plain",
|
|
21490
|
+
locale: "en-US"
|
|
21491
|
+
});
|
|
21492
|
+
};
|
|
21493
|
+
|
|
21099
21494
|
/**
|
|
21100
21495
|
*
|
|
21101
21496
|
*/
|
|
@@ -21110,6 +21505,7 @@ function PaymentMethodView(_ref) {
|
|
|
21110
21505
|
showExternalPaymentMethods,
|
|
21111
21506
|
showSubscriptionButton,
|
|
21112
21507
|
showOrderButton,
|
|
21508
|
+
showApplePayButton,
|
|
21113
21509
|
order
|
|
21114
21510
|
} = _ref;
|
|
21115
21511
|
const {
|
|
@@ -21186,7 +21582,7 @@ function PaymentMethodView(_ref) {
|
|
|
21186
21582
|
className: "plc-mb-2"
|
|
21187
21583
|
}, /*#__PURE__*/React__default.createElement(CouponCode, null), /*#__PURE__*/React__default.createElement(DiscountedPrice, null)), /*#__PURE__*/React__default.createElement(TaxAmount, null), /*#__PURE__*/React__default.createElement("div", {
|
|
21188
21584
|
className: "plc-grid plc-mt-4 plc-gap-y-2"
|
|
21189
|
-
}, /*#__PURE__*/React__default.createElement(SubmitPaymentMethod, null), showExternalPaymentMethods && !supportsVantiv && !supportsCybersource && !supportsTap ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(PelcroPaymentRequestButton, null), /*#__PURE__*/React__default.createElement(PaypalSubscribeButton, null)) : showExternalPaymentMethods && supportsVantiv ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(PaypalSubscribeButton, null)) : null)))));
|
|
21585
|
+
}, /*#__PURE__*/React__default.createElement(SubmitPaymentMethod, null), showExternalPaymentMethods && !supportsVantiv && !supportsCybersource && !supportsTap ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(PelcroPaymentRequestButton, null), /*#__PURE__*/React__default.createElement(PaypalSubscribeButton, null)) : showExternalPaymentMethods && supportsVantiv ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(PaypalSubscribeButton, null)) : null, showApplePayButton && supportsVantiv ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ApplePayButton, null)) : null)))));
|
|
21190
21586
|
}
|
|
21191
21587
|
|
|
21192
21588
|
const SubscriptionRenewView = _ref => {
|
|
@@ -21208,11 +21604,11 @@ const SubscriptionRenewView = _ref => {
|
|
|
21208
21604
|
const getPricingText = plan => {
|
|
21209
21605
|
const autoRenewed = plan.auto_renew;
|
|
21210
21606
|
const {
|
|
21211
|
-
|
|
21607
|
+
interval_translated,
|
|
21212
21608
|
interval_count
|
|
21213
21609
|
} = plan;
|
|
21214
21610
|
const intervalText = t("labels.interval", {
|
|
21215
|
-
interval,
|
|
21611
|
+
interval: interval_translated,
|
|
21216
21612
|
count: interval_count
|
|
21217
21613
|
});
|
|
21218
21614
|
return /*#__PURE__*/React__default.createElement("p", {
|
|
@@ -21237,6 +21633,7 @@ const SubscriptionRenewView = _ref => {
|
|
|
21237
21633
|
type: "createPayment",
|
|
21238
21634
|
showCoupon: true,
|
|
21239
21635
|
showExternalPaymentMethods: false,
|
|
21636
|
+
showApplePayButton: true,
|
|
21240
21637
|
onSuccess: onSuccess,
|
|
21241
21638
|
onGiftRenewalSuccess: onGiftRenewalSuccess,
|
|
21242
21639
|
onFailure: onFailure,
|
|
@@ -21244,13 +21641,11 @@ const SubscriptionRenewView = _ref => {
|
|
|
21244
21641
|
}));
|
|
21245
21642
|
};
|
|
21246
21643
|
|
|
21247
|
-
var _window$7, _window$Pelcro$7, _window$Pelcro$uiSett$7;
|
|
21248
|
-
const enableReactGA4$7 = (_window$7 = window) === null || _window$7 === void 0 ? void 0 : (_window$Pelcro$7 = _window$7.Pelcro) === null || _window$Pelcro$7 === void 0 ? void 0 : (_window$Pelcro$uiSett$7 = _window$Pelcro$7.uiSettings) === null || _window$Pelcro$uiSett$7 === void 0 ? void 0 : _window$Pelcro$uiSett$7.enableReactGA4;
|
|
21249
|
-
|
|
21250
21644
|
/**
|
|
21251
21645
|
*
|
|
21252
21646
|
*/
|
|
21253
21647
|
function SubscriptionRenewModal(_ref) {
|
|
21648
|
+
var _window, _window$Pelcro, _window$Pelcro$uiSett;
|
|
21254
21649
|
let {
|
|
21255
21650
|
onDisplay,
|
|
21256
21651
|
onClose,
|
|
@@ -21259,10 +21654,11 @@ function SubscriptionRenewModal(_ref) {
|
|
|
21259
21654
|
const {
|
|
21260
21655
|
switchView
|
|
21261
21656
|
} = usePelcro();
|
|
21657
|
+
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;
|
|
21262
21658
|
const onSuccess = res => {
|
|
21263
21659
|
var _otherProps$onSuccess;
|
|
21264
21660
|
(_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps, res);
|
|
21265
|
-
if (enableReactGA4
|
|
21661
|
+
if (enableReactGA4) {
|
|
21266
21662
|
ReactGA4.event("Renewed", {
|
|
21267
21663
|
nonInteraction: true
|
|
21268
21664
|
});
|
|
@@ -21279,7 +21675,7 @@ function SubscriptionRenewModal(_ref) {
|
|
|
21279
21675
|
const onGiftRenewalSuccess = () => {
|
|
21280
21676
|
var _otherProps$onGiftRen;
|
|
21281
21677
|
(_otherProps$onGiftRen = otherProps.onGiftRenewalSuccess) === null || _otherProps$onGiftRen === void 0 ? void 0 : _otherProps$onGiftRen.call(otherProps);
|
|
21282
|
-
if (enableReactGA4
|
|
21678
|
+
if (enableReactGA4) {
|
|
21283
21679
|
ReactGA4.event("Renewed Gift", {
|
|
21284
21680
|
nonInteraction: true
|
|
21285
21681
|
});
|
|
@@ -21305,7 +21701,8 @@ function SubscriptionRenewModal(_ref) {
|
|
|
21305
21701
|
SubscriptionRenewModal.viewId = "subscription-renew";
|
|
21306
21702
|
|
|
21307
21703
|
const initialState$j = {
|
|
21308
|
-
cancelationReason: ""
|
|
21704
|
+
cancelationReason: "",
|
|
21705
|
+
cancelationOption: ""
|
|
21309
21706
|
};
|
|
21310
21707
|
const store$j = /*#__PURE__*/createContext(initialState$j);
|
|
21311
21708
|
const {
|
|
@@ -21320,7 +21717,6 @@ const SubscriptionCancelContainer = _ref => {
|
|
|
21320
21717
|
children,
|
|
21321
21718
|
...props
|
|
21322
21719
|
} = _ref;
|
|
21323
|
-
useTranslation("verifyEmail");
|
|
21324
21720
|
const [state, dispatch] = useReducerWithSideEffects((state, action) => {
|
|
21325
21721
|
switch (action.type) {
|
|
21326
21722
|
case SET_CANCEL_SUBSCRIPTION_REASON:
|
|
@@ -21328,6 +21724,11 @@ const SubscriptionCancelContainer = _ref => {
|
|
|
21328
21724
|
...state,
|
|
21329
21725
|
cancelationReason: action.payload
|
|
21330
21726
|
});
|
|
21727
|
+
case SET_CANCEL_SUBSCRIPTION_OPTION:
|
|
21728
|
+
return lib_7({
|
|
21729
|
+
...state,
|
|
21730
|
+
cancelationOption: action.payload
|
|
21731
|
+
});
|
|
21331
21732
|
default:
|
|
21332
21733
|
return state;
|
|
21333
21734
|
}
|
|
@@ -21427,8 +21828,7 @@ const SubscriptionCancelReason = props => {
|
|
|
21427
21828
|
t
|
|
21428
21829
|
} = useTranslation("subscriptionCancel");
|
|
21429
21830
|
const {
|
|
21430
|
-
dispatch
|
|
21431
|
-
state
|
|
21831
|
+
dispatch
|
|
21432
21832
|
} = useContext(store$j);
|
|
21433
21833
|
const handleOnTextAreaBlur = e => {
|
|
21434
21834
|
dispatch({
|
|
@@ -21460,9 +21860,7 @@ function SvgSubscription(props) {
|
|
|
21460
21860
|
}))))));
|
|
21461
21861
|
}
|
|
21462
21862
|
|
|
21463
|
-
|
|
21464
|
-
const enableReactGA4$6 = (_window$6 = window) === null || _window$6 === void 0 ? void 0 : (_window$Pelcro$6 = _window$6.Pelcro) === null || _window$Pelcro$6 === void 0 ? void 0 : (_window$Pelcro$uiSett$6 = _window$Pelcro$6.uiSettings) === null || _window$Pelcro$uiSett$6 === void 0 ? void 0 : _window$Pelcro$uiSett$6.enableReactGA4;
|
|
21465
|
-
const SubscriptionCancelNowButton = _ref => {
|
|
21863
|
+
const SubscriptionCancelButton = _ref => {
|
|
21466
21864
|
let {
|
|
21467
21865
|
subscription,
|
|
21468
21866
|
onClick,
|
|
@@ -21473,14 +21871,16 @@ const SubscriptionCancelNowButton = _ref => {
|
|
|
21473
21871
|
} = usePelcro();
|
|
21474
21872
|
const {
|
|
21475
21873
|
state: {
|
|
21476
|
-
cancelationReason
|
|
21477
|
-
|
|
21478
|
-
|
|
21874
|
+
cancelationReason,
|
|
21875
|
+
cancelationOption
|
|
21876
|
+
}
|
|
21479
21877
|
} = useContext(store$j);
|
|
21480
21878
|
const {
|
|
21481
21879
|
t
|
|
21482
21880
|
} = useTranslation("subscriptionCancel");
|
|
21483
21881
|
const cancelSubscription = (payload, onSuccess, onFailure) => {
|
|
21882
|
+
var _window, _window$Pelcro, _window$Pelcro$uiSett;
|
|
21883
|
+
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;
|
|
21484
21884
|
window.Pelcro.subscription.cancel({
|
|
21485
21885
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
21486
21886
|
subscription_id: payload.subscription_id,
|
|
@@ -21492,7 +21892,7 @@ const SubscriptionCancelNowButton = _ref => {
|
|
|
21492
21892
|
if (err) {
|
|
21493
21893
|
return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
|
|
21494
21894
|
}
|
|
21495
|
-
if (enableReactGA4
|
|
21895
|
+
if (enableReactGA4) {
|
|
21496
21896
|
ReactGA4.event("Canceled", {
|
|
21497
21897
|
nonInteraction: true
|
|
21498
21898
|
});
|
|
@@ -21507,10 +21907,10 @@ const SubscriptionCancelNowButton = _ref => {
|
|
|
21507
21907
|
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
|
|
21508
21908
|
});
|
|
21509
21909
|
};
|
|
21510
|
-
const
|
|
21910
|
+
const handleCancelClick = () => {
|
|
21511
21911
|
const payload = {
|
|
21512
21912
|
subscription_id: subscription.id,
|
|
21513
|
-
mode:
|
|
21913
|
+
mode: cancelationOption,
|
|
21514
21914
|
...(cancelationReason && {
|
|
21515
21915
|
reason: cancelationReason
|
|
21516
21916
|
})
|
|
@@ -21524,7 +21924,7 @@ const SubscriptionCancelNowButton = _ref => {
|
|
|
21524
21924
|
notify.confirm((onSuccess, onFailure) => {
|
|
21525
21925
|
cancelSubscription(payload, onSuccess, onFailure);
|
|
21526
21926
|
}, {
|
|
21527
|
-
confirmMessage: t("messages.subCancellation.isSureToCancelNow"),
|
|
21927
|
+
confirmMessage: cancelationOption === "now" ? t("messages.subCancellation.isSureToCancelNow") : t("messages.subCancellation.isSureToCancel"),
|
|
21528
21928
|
loadingMessage: t("messages.subCancellation.loading"),
|
|
21529
21929
|
successMessage: t("messages.subCancellation.success"),
|
|
21530
21930
|
errorMessage: t("messages.subCancellation.error")
|
|
@@ -21533,96 +21933,89 @@ const SubscriptionCancelNowButton = _ref => {
|
|
|
21533
21933
|
});
|
|
21534
21934
|
};
|
|
21535
21935
|
return /*#__PURE__*/React__default.createElement(Button, {
|
|
21536
|
-
onClick:
|
|
21537
|
-
className: `${className}
|
|
21538
|
-
|
|
21936
|
+
onClick: handleCancelClick,
|
|
21937
|
+
className: `${className}`,
|
|
21938
|
+
disabled: !cancelationOption
|
|
21939
|
+
}, t("labels.cancel"));
|
|
21539
21940
|
};
|
|
21540
21941
|
|
|
21541
|
-
|
|
21542
|
-
const
|
|
21543
|
-
|
|
21942
|
+
// New cancellation option modal
|
|
21943
|
+
const SubscriptionCancelOptions = _ref => {
|
|
21944
|
+
var _subscription$schedul;
|
|
21544
21945
|
let {
|
|
21545
21946
|
subscription,
|
|
21947
|
+
hasPhases,
|
|
21546
21948
|
onClick,
|
|
21547
21949
|
className
|
|
21548
21950
|
} = _ref;
|
|
21549
|
-
const {
|
|
21550
|
-
switchView
|
|
21551
|
-
} = usePelcro();
|
|
21552
21951
|
const {
|
|
21553
21952
|
state: {
|
|
21554
|
-
|
|
21953
|
+
cancelationOption
|
|
21555
21954
|
},
|
|
21556
21955
|
dispatch
|
|
21557
21956
|
} = useContext(store$j);
|
|
21558
21957
|
const {
|
|
21559
21958
|
t
|
|
21560
21959
|
} = useTranslation("subscriptionCancel");
|
|
21561
|
-
const
|
|
21562
|
-
|
|
21563
|
-
|
|
21564
|
-
|
|
21565
|
-
|
|
21566
|
-
|
|
21567
|
-
reason: payload.reason
|
|
21568
|
-
})
|
|
21569
|
-
}, (err, res) => {
|
|
21570
|
-
if (err) {
|
|
21571
|
-
return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
|
|
21572
|
-
}
|
|
21573
|
-
if (enableReactGA4$5) {
|
|
21574
|
-
ReactGA4.event("Canceled", {
|
|
21575
|
-
nonInteraction: true
|
|
21576
|
-
});
|
|
21577
|
-
} else {
|
|
21578
|
-
var _ReactGA$event;
|
|
21579
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
21580
|
-
category: "ACTIONS",
|
|
21581
|
-
action: "Canceled",
|
|
21582
|
-
nonInteraction: true
|
|
21583
|
-
});
|
|
21584
|
-
}
|
|
21585
|
-
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
|
|
21586
|
-
});
|
|
21587
|
-
};
|
|
21588
|
-
const handleCancelNowClick = () => {
|
|
21589
|
-
const payload = {
|
|
21590
|
-
subscription_id: subscription.id,
|
|
21591
|
-
mode: "period_end",
|
|
21592
|
-
...(cancelationReason && {
|
|
21593
|
-
reason: cancelationReason
|
|
21594
|
-
})
|
|
21595
|
-
};
|
|
21596
|
-
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
21597
|
-
|
|
21598
|
-
// Close the modal
|
|
21599
|
-
switchView(null);
|
|
21600
|
-
|
|
21601
|
-
// Show confirmation alert after closing the modal
|
|
21602
|
-
notify.confirm((onSuccess, onFailure) => {
|
|
21603
|
-
cancelSubscription(payload, onSuccess, onFailure);
|
|
21604
|
-
}, {
|
|
21605
|
-
confirmMessage: t("messages.subCancellation.isSureToCancel"),
|
|
21606
|
-
loadingMessage: t("messages.subCancellation.loading"),
|
|
21607
|
-
successMessage: t("messages.subCancellation.success"),
|
|
21608
|
-
errorMessage: t("messages.subCancellation.error")
|
|
21609
|
-
}, {
|
|
21610
|
-
closeButtonLabel: t("labels.subCancellation.goBack")
|
|
21960
|
+
const phases = subscription === null || subscription === void 0 ? void 0 : (_subscription$schedul = subscription.schedule) === null || _subscription$schedul === void 0 ? void 0 : _subscription$schedul.phases;
|
|
21961
|
+
const lastPhase = !phases ? [] : phases[(phases === null || phases === void 0 ? void 0 : phases.length) - 1];
|
|
21962
|
+
const handleOptionSelect = event => {
|
|
21963
|
+
dispatch({
|
|
21964
|
+
type: SET_CANCEL_SUBSCRIPTION_OPTION,
|
|
21965
|
+
payload: event.target.value
|
|
21611
21966
|
});
|
|
21612
21967
|
};
|
|
21613
|
-
return /*#__PURE__*/React__default.createElement(
|
|
21614
|
-
|
|
21615
|
-
|
|
21616
|
-
|
|
21968
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
21969
|
+
className: "plc-text-left plc-mr-auto plc-mb-6"
|
|
21970
|
+
}, /*#__PURE__*/React__default.createElement("p", {
|
|
21971
|
+
className: "plc-mb-3"
|
|
21972
|
+
}, t("messages.cancelWhen")), subscription.cancel_at_period_end === 0 && hasPhases && /*#__PURE__*/React__default.createElement(Radio, {
|
|
21973
|
+
onChange: handleOptionSelect,
|
|
21974
|
+
checked: cancelationOption === "period_end",
|
|
21975
|
+
value: "period_end"
|
|
21976
|
+
}, t("labels.endOn"), " ", new Date(Number(`${lastPhase === null || lastPhase === void 0 ? void 0 : lastPhase.end_date}000`)).toLocaleDateString("en-CA", {
|
|
21977
|
+
year: "numeric",
|
|
21978
|
+
month: "short",
|
|
21979
|
+
day: "numeric"
|
|
21980
|
+
})), subscription.cancel_at_period_end === 0 && /*#__PURE__*/React__default.createElement(Radio, {
|
|
21981
|
+
onChange: handleOptionSelect,
|
|
21982
|
+
checked: cancelationOption === "current_period_end",
|
|
21983
|
+
value: "current_period_end"
|
|
21984
|
+
}, t("labels.endOn"), " ", new Date(subscription === null || subscription === void 0 ? void 0 : subscription.current_period_end).toLocaleDateString("en-CA", {
|
|
21985
|
+
year: "numeric",
|
|
21986
|
+
month: "short",
|
|
21987
|
+
day: "numeric"
|
|
21988
|
+
})), /*#__PURE__*/React__default.createElement(Radio, {
|
|
21989
|
+
onChange: handleOptionSelect,
|
|
21990
|
+
checked: cancelationOption === "now",
|
|
21991
|
+
value: "now"
|
|
21992
|
+
}, t("labels.endImmediately")));
|
|
21617
21993
|
};
|
|
21618
21994
|
|
|
21619
21995
|
const SubscriptionCancelView = props => {
|
|
21996
|
+
var _subscriptionToCancel7, _subscriptionToCancel8;
|
|
21620
21997
|
const {
|
|
21621
|
-
subscriptionToCancel
|
|
21998
|
+
subscriptionToCancel,
|
|
21999
|
+
switchView
|
|
21622
22000
|
} = usePelcro();
|
|
21623
22001
|
const {
|
|
21624
22002
|
t
|
|
21625
22003
|
} = useTranslation("subscriptionCancel");
|
|
22004
|
+
const getPhases = () => {
|
|
22005
|
+
var _subscriptionToCancel, _subscriptionToCancel2, _subscriptionToCancel3, _subscriptionToCancel4, _subscriptionToCancel5, _subscriptionToCancel6;
|
|
22006
|
+
if (!subscriptionToCancel.schedule) return [];
|
|
22007
|
+
const currentPhaseStartDate = subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : (_subscriptionToCancel = subscriptionToCancel.schedule) === null || _subscriptionToCancel === void 0 ? void 0 : (_subscriptionToCancel2 = _subscriptionToCancel.current_phase) === null || _subscriptionToCancel2 === void 0 ? void 0 : _subscriptionToCancel2.start_date;
|
|
22008
|
+
const currentPhase = subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : (_subscriptionToCancel3 = subscriptionToCancel.schedule) === null || _subscriptionToCancel3 === void 0 ? void 0 : (_subscriptionToCancel4 = _subscriptionToCancel3.phases) === null || _subscriptionToCancel4 === void 0 ? void 0 : _subscriptionToCancel4.find(phase => {
|
|
22009
|
+
return (phase === null || phase === void 0 ? void 0 : phase.start_date) === currentPhaseStartDate;
|
|
22010
|
+
});
|
|
22011
|
+
const futurePhases = subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : (_subscriptionToCancel5 = subscriptionToCancel.schedule) === null || _subscriptionToCancel5 === void 0 ? void 0 : (_subscriptionToCancel6 = _subscriptionToCancel5.phases) === null || _subscriptionToCancel6 === void 0 ? void 0 : _subscriptionToCancel6.filter(phase => {
|
|
22012
|
+
return (phase === null || phase === void 0 ? void 0 : phase.start_date) > currentPhaseStartDate;
|
|
22013
|
+
});
|
|
22014
|
+
return [currentPhase, ...futurePhases];
|
|
22015
|
+
};
|
|
22016
|
+
const hasPhases = getPhases().length > 0;
|
|
22017
|
+
const phases = subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : (_subscriptionToCancel7 = subscriptionToCancel.schedule) === null || _subscriptionToCancel7 === void 0 ? void 0 : _subscriptionToCancel7.phases;
|
|
22018
|
+
const lastPhase = !phases ? [] : phases[(phases === null || phases === void 0 ? void 0 : phases.length) - 1];
|
|
21626
22019
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
21627
22020
|
id: "pelcro-subscription-cancel-view"
|
|
21628
22021
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -21631,22 +22024,35 @@ const SubscriptionCancelView = props => {
|
|
|
21631
22024
|
className: "plc-text-2xl plc-font-semibold"
|
|
21632
22025
|
}, t("labels.title"), /*#__PURE__*/React__default.createElement("span", {
|
|
21633
22026
|
className: "plc-text-gray-400 plc-text-base plc-block"
|
|
21634
|
-
}, "(", subscriptionToCancel.plan.nickname, ")"))), /*#__PURE__*/React__default.createElement(SubscriptionCancelContainer, props, /*#__PURE__*/React__default.createElement("div", {
|
|
22027
|
+
}, "(", subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : (_subscriptionToCancel8 = subscriptionToCancel.plan) === null || _subscriptionToCancel8 === void 0 ? void 0 : _subscriptionToCancel8.nickname, ")"))), /*#__PURE__*/React__default.createElement(SubscriptionCancelContainer, props, /*#__PURE__*/React__default.createElement("div", {
|
|
21635
22028
|
className: "plc-flex plc-flex-col plc-items-center plc-justify-center plc-mt-4"
|
|
21636
22029
|
}, /*#__PURE__*/React__default.createElement(SvgSubscription, {
|
|
21637
22030
|
className: "plc-w-32 plc-h-32"
|
|
21638
22031
|
}), /*#__PURE__*/React__default.createElement("p", {
|
|
21639
|
-
className: "plc-mb-3 plc-text-gray-900 plc-text-
|
|
21640
|
-
}, t("messages.subscriptionEnd"), " ", new Date(
|
|
22032
|
+
className: "plc-mb-3 plc-text-gray-900 plc-text-left plc-mr-auto plc-whitespace-pre-line"
|
|
22033
|
+
}, t("messages.subscriptionEnd"), " ", hasPhases ? new Date(Number(`${lastPhase === null || lastPhase === void 0 ? void 0 : lastPhase.end_date}000`)).toLocaleDateString("en-CA", {
|
|
21641
22034
|
year: "numeric",
|
|
21642
22035
|
month: "short",
|
|
21643
22036
|
day: "numeric"
|
|
21644
|
-
})
|
|
21645
|
-
|
|
21646
|
-
|
|
21647
|
-
|
|
22037
|
+
}) : new Date(subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : subscriptionToCancel.current_period_end).toLocaleDateString("en-CA", {
|
|
22038
|
+
year: "numeric",
|
|
22039
|
+
month: "short",
|
|
22040
|
+
day: "numeric"
|
|
22041
|
+
}), "."), /*#__PURE__*/React__default.createElement(SubscriptionCancelOptions, {
|
|
22042
|
+
subscription: subscriptionToCancel,
|
|
22043
|
+
hasPhases: hasPhases
|
|
22044
|
+
}), /*#__PURE__*/React__default.createElement(SubscriptionCancelReason, null), /*#__PURE__*/React__default.createElement("div", {
|
|
22045
|
+
className: "plc-space-x-0 plc-space-y-3 md:plc-space-x-3 md:plc-space-y-0 plc-w-full plc-flex plc-flex-col md:plc-flex-row plc-items-center plc-justify-center"
|
|
22046
|
+
}, /*#__PURE__*/React__default.createElement(SubscriptionCancelButton, {
|
|
22047
|
+
className: "plc-w-3/4 md:plc-w-2/5",
|
|
21648
22048
|
subscription: subscriptionToCancel
|
|
21649
|
-
})
|
|
22049
|
+
}), /*#__PURE__*/React__default.createElement(Button, {
|
|
22050
|
+
variant: "outline",
|
|
22051
|
+
className: "plc-w-3/4 md:plc-w-2/5",
|
|
22052
|
+
onClick: () => {
|
|
22053
|
+
switchView("dashboard");
|
|
22054
|
+
}
|
|
22055
|
+
}, t("labels.subCancellation.goBack"))))));
|
|
21650
22056
|
};
|
|
21651
22057
|
|
|
21652
22058
|
const SubscriptionCancelModal = _ref => {
|
|
@@ -21786,9 +22192,8 @@ const SubscriptionSuspendDate = props => {
|
|
|
21786
22192
|
}, props));
|
|
21787
22193
|
};
|
|
21788
22194
|
|
|
21789
|
-
var _window$4, _window$Pelcro$4, _window$Pelcro$uiSett$4;
|
|
21790
|
-
const enableReactGA4$4 = (_window$4 = window) === null || _window$4 === void 0 ? void 0 : (_window$Pelcro$4 = _window$4.Pelcro) === null || _window$Pelcro$4 === void 0 ? void 0 : (_window$Pelcro$uiSett$4 = _window$Pelcro$4.uiSettings) === null || _window$Pelcro$uiSett$4 === void 0 ? void 0 : _window$Pelcro$uiSett$4.enableReactGA4;
|
|
21791
22195
|
const SubscriptionSuspendButton = _ref => {
|
|
22196
|
+
var _window, _window$Pelcro, _window$Pelcro$uiSett;
|
|
21792
22197
|
let {
|
|
21793
22198
|
subscription,
|
|
21794
22199
|
onClick,
|
|
@@ -21807,6 +22212,7 @@ const SubscriptionSuspendButton = _ref => {
|
|
|
21807
22212
|
const {
|
|
21808
22213
|
t
|
|
21809
22214
|
} = useTranslation("subscriptionSuspend");
|
|
22215
|
+
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;
|
|
21810
22216
|
const suspendSubscription = (payload, onSuccess, onFailure) => {
|
|
21811
22217
|
window.Pelcro.subscription.update({
|
|
21812
22218
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
@@ -21817,7 +22223,7 @@ const SubscriptionSuspendButton = _ref => {
|
|
|
21817
22223
|
if (err) {
|
|
21818
22224
|
return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
|
|
21819
22225
|
}
|
|
21820
|
-
if (enableReactGA4
|
|
22226
|
+
if (enableReactGA4) {
|
|
21821
22227
|
ReactGA4.event("Suspended", {
|
|
21822
22228
|
nonInteraction: true
|
|
21823
22229
|
});
|
|
@@ -22572,11 +22978,11 @@ const SubscriptionCreateView = _ref => {
|
|
|
22572
22978
|
var _plan$quantity, _plan$quantity2, _plan$quantity3;
|
|
22573
22979
|
const autoRenewed = plan.auto_renew;
|
|
22574
22980
|
const {
|
|
22575
|
-
|
|
22981
|
+
interval_translated,
|
|
22576
22982
|
interval_count
|
|
22577
22983
|
} = plan;
|
|
22578
22984
|
const intervalText = t("labels.interval", {
|
|
22579
|
-
interval,
|
|
22985
|
+
interval: interval_translated,
|
|
22580
22986
|
count: interval_count
|
|
22581
22987
|
});
|
|
22582
22988
|
const priceFormatted = plan.type === "donation" && (selectedDonationAmount || customDonationAmount) ? getFormattedPriceByLocal(selectedDonationAmount ? selectedDonationAmount * (plan === null || plan === void 0 ? void 0 : plan.amount) * ((_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1) : customDonationAmount * (plan === null || plan === void 0 ? void 0 : plan.amount) * ((_plan$quantity2 = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity2 !== void 0 ? _plan$quantity2 : 1), plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage()) : getFormattedPriceByLocal((plan === null || plan === void 0 ? void 0 : plan.amount) * ((_plan$quantity3 = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity3 !== void 0 ? _plan$quantity3 : 1), plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
|
|
@@ -22602,6 +23008,7 @@ const SubscriptionCreateView = _ref => {
|
|
|
22602
23008
|
type: "createPayment",
|
|
22603
23009
|
showCoupon: true,
|
|
22604
23010
|
showExternalPaymentMethods: true,
|
|
23011
|
+
showApplePayButton: true,
|
|
22605
23012
|
onSuccess: onSuccess,
|
|
22606
23013
|
onFailure: onFailure,
|
|
22607
23014
|
showSubscriptionButton: showSubscriptionButton
|
|
@@ -24541,8 +24948,6 @@ const AddressCreateLine2 = props => {
|
|
|
24541
24948
|
}, props));
|
|
24542
24949
|
};
|
|
24543
24950
|
|
|
24544
|
-
var _window$3, _window$Pelcro$3, _window$Pelcro$uiSett$3;
|
|
24545
|
-
const enableReactGA4$3 = (_window$3 = window) === null || _window$3 === void 0 ? void 0 : (_window$Pelcro$3 = _window$3.Pelcro) === null || _window$Pelcro$3 === void 0 ? void 0 : (_window$Pelcro$uiSett$3 = _window$Pelcro$3.uiSettings) === null || _window$Pelcro$uiSett$3 === void 0 ? void 0 : _window$Pelcro$uiSett$3.enableReactGA4;
|
|
24546
24951
|
const initialState$d = {
|
|
24547
24952
|
isSubmitting: false,
|
|
24548
24953
|
firstName: "",
|
|
@@ -24574,7 +24979,7 @@ const {
|
|
|
24574
24979
|
Provider: Provider$d
|
|
24575
24980
|
} = store$d;
|
|
24576
24981
|
const AddressUpdateContainer = _ref => {
|
|
24577
|
-
var _props$addressId;
|
|
24982
|
+
var _props$addressId, _window, _window$Pelcro, _window$Pelcro$uiSett;
|
|
24578
24983
|
let {
|
|
24579
24984
|
style,
|
|
24580
24985
|
className = "",
|
|
@@ -24588,6 +24993,7 @@ const AddressUpdateContainer = _ref => {
|
|
|
24588
24993
|
addressIdToEdit
|
|
24589
24994
|
} = usePelcro();
|
|
24590
24995
|
const addressId = (_props$addressId = props === null || props === void 0 ? void 0 : props.addressId) !== null && _props$addressId !== void 0 ? _props$addressId : addressIdToEdit;
|
|
24996
|
+
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;
|
|
24591
24997
|
const [t] = useTranslation("address");
|
|
24592
24998
|
useEffect(() => {
|
|
24593
24999
|
const getCountries = () => {
|
|
@@ -24686,7 +25092,7 @@ const AddressUpdateContainer = _ref => {
|
|
|
24686
25092
|
}
|
|
24687
25093
|
});
|
|
24688
25094
|
onSuccess(res);
|
|
24689
|
-
if (enableReactGA4
|
|
25095
|
+
if (enableReactGA4) {
|
|
24690
25096
|
ReactGA4.event("Updated address", {
|
|
24691
25097
|
nonInteraction: true
|
|
24692
25098
|
});
|
|
@@ -25215,19 +25621,20 @@ function PaymentMethodUpdateView(props) {
|
|
|
25215
25621
|
type: "updatePaymentSource",
|
|
25216
25622
|
showCoupon: false,
|
|
25217
25623
|
showExternalPaymentMethods: false,
|
|
25624
|
+
showApplePayButton: false,
|
|
25218
25625
|
onDisplay: props.onDisplay,
|
|
25219
25626
|
onFailure: props.onFailure,
|
|
25220
25627
|
onSuccess: props.onSuccess
|
|
25221
25628
|
}));
|
|
25222
25629
|
}
|
|
25223
25630
|
|
|
25224
|
-
var _window$2, _window$Pelcro$2, _window$Pelcro$uiSett$2;
|
|
25225
|
-
const enableReactGA4$2 = (_window$2 = window) === null || _window$2 === void 0 ? void 0 : (_window$Pelcro$2 = _window$2.Pelcro) === null || _window$Pelcro$2 === void 0 ? void 0 : (_window$Pelcro$uiSett$2 = _window$Pelcro$2.uiSettings) === null || _window$Pelcro$uiSett$2 === void 0 ? void 0 : _window$Pelcro$uiSett$2.enableReactGA4;
|
|
25226
25631
|
const PaymentMethodUpdateModal = props => {
|
|
25632
|
+
var _window, _window$Pelcro, _window$Pelcro$uiSett;
|
|
25633
|
+
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;
|
|
25227
25634
|
const onSuccess = res => {
|
|
25228
25635
|
var _props$onSuccess;
|
|
25229
25636
|
(_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
|
|
25230
|
-
if (enableReactGA4
|
|
25637
|
+
if (enableReactGA4) {
|
|
25231
25638
|
ReactGA4.event("Updated payment card", {
|
|
25232
25639
|
nonInteraction: true
|
|
25233
25640
|
});
|
|
@@ -26368,7 +26775,9 @@ const CartRemoveItemButton = _ref => {
|
|
|
26368
26775
|
"data-key": itemId,
|
|
26369
26776
|
icon: /*#__PURE__*/React__default.createElement(SvgXIcon, {
|
|
26370
26777
|
"aria-hidden": "true",
|
|
26371
|
-
focusable: "false"
|
|
26778
|
+
focusable: "false",
|
|
26779
|
+
height: "20",
|
|
26780
|
+
width: "20"
|
|
26372
26781
|
}),
|
|
26373
26782
|
className: "plc-bg-transparent plc-w-9 plc-h-9 plc-p-2",
|
|
26374
26783
|
onClick: () => {
|
|
@@ -26638,6 +27047,7 @@ const OrderCreateView = props => {
|
|
|
26638
27047
|
type: "orderCreate",
|
|
26639
27048
|
showCoupon: true,
|
|
26640
27049
|
showExternalPaymentMethods: false,
|
|
27050
|
+
showApplePayButton: true,
|
|
26641
27051
|
showOrderButton: showOrderButton,
|
|
26642
27052
|
order: order
|
|
26643
27053
|
}, props))));
|
|
@@ -29115,8 +29525,6 @@ const OrderItems = _ref => {
|
|
|
29115
29525
|
});
|
|
29116
29526
|
};
|
|
29117
29527
|
|
|
29118
|
-
var _window$1, _window$Pelcro$1, _window$Pelcro$uiSett$1;
|
|
29119
|
-
const enableReactGA4$1 = (_window$1 = window) === null || _window$1 === void 0 ? void 0 : (_window$Pelcro$1 = _window$1.Pelcro) === null || _window$Pelcro$1 === void 0 ? void 0 : (_window$Pelcro$uiSett$1 = _window$Pelcro$1.uiSettings) === null || _window$Pelcro$uiSett$1 === void 0 ? void 0 : _window$Pelcro$uiSett$1.enableReactGA4;
|
|
29120
29528
|
const SavedItemsMenu = () => {
|
|
29121
29529
|
const {
|
|
29122
29530
|
t
|
|
@@ -29165,8 +29573,10 @@ const SavedItems = _ref3 => {
|
|
|
29165
29573
|
isAuthenticated
|
|
29166
29574
|
} = usePelcro();
|
|
29167
29575
|
const removeItemFromMetadata = (category, title) => {
|
|
29576
|
+
var _window, _window$Pelcro, _window$Pelcro$uiSett;
|
|
29168
29577
|
const user = window.Pelcro.user.read();
|
|
29169
29578
|
const oldValue = user.metadata[`metadata_saved_${category}`];
|
|
29579
|
+
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;
|
|
29170
29580
|
const newMetadataValue = oldValue.filter(metadata => !((metadata === null || metadata === void 0 ? void 0 : metadata.title) === title));
|
|
29171
29581
|
if (isAuthenticated()) {
|
|
29172
29582
|
setLoading(true);
|
|
@@ -29181,7 +29591,7 @@ const SavedItems = _ref3 => {
|
|
|
29181
29591
|
return;
|
|
29182
29592
|
}
|
|
29183
29593
|
setItems(response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.metadata);
|
|
29184
|
-
if (enableReactGA4
|
|
29594
|
+
if (enableReactGA4) {
|
|
29185
29595
|
ReactGA4.event("Unsave/Unfollow", {
|
|
29186
29596
|
event_label: title
|
|
29187
29597
|
});
|
|
@@ -30145,8 +30555,6 @@ function getMemberShipStatus(status) {
|
|
|
30145
30555
|
};
|
|
30146
30556
|
}
|
|
30147
30557
|
|
|
30148
|
-
var _window, _window$Pelcro, _window$Pelcro$uiSett;
|
|
30149
|
-
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;
|
|
30150
30558
|
const SUB_MENUS = {
|
|
30151
30559
|
PROFILE: "profile",
|
|
30152
30560
|
SUBSCRIPTIONS: "subscriptions",
|
|
@@ -30201,7 +30609,7 @@ function DashboardWithHook(props) {
|
|
|
30201
30609
|
DashboardWithHook.viewId = "dashboard";
|
|
30202
30610
|
class Dashboard extends Component {
|
|
30203
30611
|
constructor(props) {
|
|
30204
|
-
var _window$Pelcro$user$r, _window$Pelcro$user$r2;
|
|
30612
|
+
var _window$Pelcro$user$r, _window$Pelcro$user$r2, _window, _window$Pelcro, _window$Pelcro$uiSett;
|
|
30205
30613
|
super(props);
|
|
30206
30614
|
_defineProperty$3(this, "componentDidMount", () => {
|
|
30207
30615
|
this.setState({
|
|
@@ -30210,7 +30618,7 @@ class Dashboard extends Component {
|
|
|
30210
30618
|
window.Pelcro.insight.track("Modal Displayed", {
|
|
30211
30619
|
name: "dashboard"
|
|
30212
30620
|
});
|
|
30213
|
-
if (enableReactGA4) {
|
|
30621
|
+
if (this.enableReactGA4) {
|
|
30214
30622
|
ReactGA4.event("Dashboard Modal Viewed", {
|
|
30215
30623
|
nonInteraction: true
|
|
30216
30624
|
});
|
|
@@ -30252,7 +30660,7 @@ class Dashboard extends Component {
|
|
|
30252
30660
|
if (err) {
|
|
30253
30661
|
return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
|
|
30254
30662
|
}
|
|
30255
|
-
if (enableReactGA4) {
|
|
30663
|
+
if (this.enableReactGA4) {
|
|
30256
30664
|
ReactGA4.event("Canceled", {
|
|
30257
30665
|
nonInteraction: true
|
|
30258
30666
|
});
|
|
@@ -30276,7 +30684,7 @@ class Dashboard extends Component {
|
|
|
30276
30684
|
if (err) {
|
|
30277
30685
|
return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
|
|
30278
30686
|
}
|
|
30279
|
-
if (enableReactGA4) {
|
|
30687
|
+
if (this.enableReactGA4) {
|
|
30280
30688
|
ReactGA4.event("UnSuspended", {
|
|
30281
30689
|
nonInteraction: true
|
|
30282
30690
|
});
|
|
@@ -30572,6 +30980,7 @@ class Dashboard extends Component {
|
|
|
30572
30980
|
this.locale = this.props.t;
|
|
30573
30981
|
this.user = window.Pelcro.user.read();
|
|
30574
30982
|
this.menuRef = /*#__PURE__*/React__default.createRef();
|
|
30983
|
+
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;
|
|
30575
30984
|
}
|
|
30576
30985
|
render() {
|
|
30577
30986
|
var _window$Pelcro$user$r3, _window$Pelcro2, _window$Pelcro2$uiSet, _this$user$source, _this$user$source$pro, _this$user$source2, _this$user$source2$pr;
|
|
@@ -32985,7 +33394,8 @@ const InvoicePaymentView = props => {
|
|
|
32985
33394
|
}, /*#__PURE__*/React__default.createElement(PaymentMethodView, Object.assign({
|
|
32986
33395
|
type: "invoicePayment",
|
|
32987
33396
|
showCoupon: false,
|
|
32988
|
-
showExternalPaymentMethods: true
|
|
33397
|
+
showExternalPaymentMethods: true,
|
|
33398
|
+
showApplePayButton: true
|
|
32989
33399
|
}, props))));
|
|
32990
33400
|
};
|
|
32991
33401
|
|
|
@@ -34612,4 +35022,4 @@ const QrCodeModal = _ref => {
|
|
|
34612
35022
|
};
|
|
34613
35023
|
QrCodeModal.viewId = "qrcode";
|
|
34614
35024
|
|
|
34615
|
-
export { AddressCreateCity, AddressCreateContainer, AddressCreateCountrySelect, AddressCreateFirstName, AddressCreateLastName, AddressCreateLine1, AddressCreateLine2, AddressCreateModal, AddressCreatePostalCode, AddressCreateSetDefault, AddressCreateStateSelect, AddressCreateSubmit, AddressCreateTextInput, AddressCreateView, AddressSelectContainer, AddressSelectList, AddressSelectModal, AddressSelectSubmit, AddressSelectView, AddressUpdateCity, AddressUpdateContainer, AddressUpdateCountrySelect, AddressUpdateFirstName, AddressUpdateLastName, AddressUpdateLine1, AddressUpdateLine2, AddressUpdateModal, AddressUpdatePostalCode, AddressUpdateSetDefault, AddressUpdateStateSelect, AddressUpdateSubmit, AddressUpdateTextInput, AddressUpdateView, AlertWithContext as Alert, Alert as AlertElement, ApplyCouponButton, Auth0LoginButton, Badge, BankAuthenticationSuccess, BankRedirection, Button, CartContainer, CartModal, CartRemoveItemButton, CartSubmit, CartTotalPrice, CartView, Checkbox, CheckoutForm, ConfirmPassword, CouponCode, CouponCodeField, DashboardWithHook as Dashboard, DashboardOpenButton, DatePicker, DiscountedPrice, DonationModalWithHook as DonationModal, Email, EmailVerifyContainer, EmailVerifyModal, EmailVerifyResendButton, EmailVerifyView, FacebookLoginButton, GiftCreateContainer, GiftCreateEmail, GiftCreateFirstName, GiftCreateLastName, GiftCreateMessage, GiftCreateModal, GiftCreateStartDate, GiftCreateSubmitButton, GiftCreateView, GiftRedeemCode, GiftRedeemContainer, GiftRedeemModal, GiftRedeemSubmitButton, GiftRedeemView, GoogleLoginButton, IncludeFirstName, IncludeLastName, IncludePhone, Input, InvoiceDetailsContainer, InvoiceDetailsDownloadButton, InvoiceDetailsModal, InvoiceDetailsPayButton, InvoiceDetailsView, InvoicePaymentContainer, InvoicePaymentModal, InvoicePaymentView, Link, LoginButton, LoginContainer, LoginEmail, LoginModal, LoginPassword, LoginRequestLoginToken, LoginUsername, LoginView, Logout, MeterModal, MeterView, Modal, ModalBody, ModalFooter, NewsletterWithHook as NewsLetter, NewsletterUpdateButton, NewsletterUpdateContainer, NewsletterUpdateList, NewsletterUpdateModal, NewsletterUpdateView, Notification, OrderConfirmModal, OrderCreateContainer, OrderCreateFreeButton, OrderCreateModal, OrderCreateSubmitButton, OrderCreateView, Password, PasswordChangeButton, PasswordChangeConfirmNewPassword, PasswordChangeContainer, PasswordChangeCurrentPassword, PasswordChangeModal, PasswordChangeNewPassword, PasswordChangeView, PasswordForgotButton, PasswordForgotContainer, PasswordForgotEmail, PasswordForgotModal, PasswordForgotView, PasswordResetButton, PasswordResetConfirmPassword, PasswordResetContainer, PasswordResetEmail, PasswordResetModal, PasswordResetPassword, PasswordResetView, PasswordlessRequestContainer, PasswordlessRequestEmail, PasswordlessRequestModal, PasswordlessRequestView, PasswordlessRequestViewButton, PaymentCreateContainer, PaymentCreateView, PaymentMethodContainer, PaymentMethodSelectContainer, PaymentMethodSelectList, PaymentMethodSelectModal, PaymentMethodSelectSubmit, PaymentMethodSelectView, PaymentMethodUpdateContainer, PaymentMethodUpdateModal, PaymentMethodUpdateView, PaymentMethodView, PaymentSuccessModal, PaymentSuccessView, PaypalSubscribeButton, PelcroCardCVC, PelcroCardExpiry, PelcroCardNumber, PelcroModalController, PelcroPaymentRequestButton, ProfilePicChangeButton, ProfilePicChangeContainer, ProfilePicChangeCropper, ProfilePicChangeModal, ProfilePicChangeRemoveButton, ProfilePicChangeSelectButton, ProfilePicChangeView, ProfilePicChangeZoom, QrCodeModal, QrCodeView, Radio, RegisterButton, RegisterCompany, RegisterContainer, RegisterEmail, RegisterFirstName, RegisterJobTitle, RegisterLastName, RegisterModal, RegisterPassword, RegisterView, Select, SelectModalWithHook as SelectModal, SelectedPaymentMethod, ShopPurchaseButton, ShopSelectProductButton, ShopView, SubmitPaymentMethod, SubscriptionCancelModal, SubscriptionCreateContainer, SubscriptionCreateFreePlanButton, SubscriptionCreateModal, SubscriptionCreateView, SubscriptionManageMembersButton, SubscriptionManageMembersContainer, SubscriptionManageMembersEmails, SubscriptionManageMembersList, SubscriptionManageMembersModal, SubscriptionManageMembersView, SubscriptionRenewContainer, SubscriptionRenewModal, SubscriptionRenewView, SubscriptionSuspendContainer, SubscriptionSuspendModal, SubscriptionSuspendView, TaxAmount, TextArea, Tooltip, UserNameInput, UserUpdateButton, UserUpdateContainer, UserUpdateDisplayName, UserUpdateEmail, UserUpdateFirstName, UserUpdateLastName, UserUpdateModal, UserUpdatePhone, UserUpdateProfilePic, UserUpdateTextInput, UserUpdateTin, UserUpdateUsername, UserUpdateView, VerifyLinkTokenContainer, VerifyLinkTokenLoader, VerifyLinkTokenModal, VerifyLinkTokenView, authenticatedButtons, i18next as i18n, init$1 as initButtons, init as initContentEntitlement, invoicePaymentSubmitButton, notify, unauthenticatedButtons, usePelcro };
|
|
35025
|
+
export { AddressCreateCity, AddressCreateContainer, AddressCreateCountrySelect, AddressCreateFirstName, AddressCreateLastName, AddressCreateLine1, AddressCreateLine2, AddressCreateModal, AddressCreatePostalCode, AddressCreateSetDefault, AddressCreateStateSelect, AddressCreateSubmit, AddressCreateTextInput, AddressCreateView, AddressSelectContainer, AddressSelectList, AddressSelectModal, AddressSelectSubmit, AddressSelectView, AddressUpdateCity, AddressUpdateContainer, AddressUpdateCountrySelect, AddressUpdateFirstName, AddressUpdateLastName, AddressUpdateLine1, AddressUpdateLine2, AddressUpdateModal, AddressUpdatePostalCode, AddressUpdateSetDefault, AddressUpdateStateSelect, AddressUpdateSubmit, AddressUpdateTextInput, AddressUpdateView, AlertWithContext as Alert, Alert as AlertElement, ApplePayButton, ApplyCouponButton, Auth0LoginButton, Badge, BankAuthenticationSuccess, BankRedirection, Button, CartContainer, CartModal, CartRemoveItemButton, CartSubmit, CartTotalPrice, CartView, Checkbox, CheckoutForm, ConfirmPassword, CouponCode, CouponCodeField, DashboardWithHook as Dashboard, DashboardOpenButton, DatePicker, DiscountedPrice, DonationModalWithHook as DonationModal, Email, EmailVerifyContainer, EmailVerifyModal, EmailVerifyResendButton, EmailVerifyView, FacebookLoginButton, GiftCreateContainer, GiftCreateEmail, GiftCreateFirstName, GiftCreateLastName, GiftCreateMessage, GiftCreateModal, GiftCreateStartDate, GiftCreateSubmitButton, GiftCreateView, GiftRedeemCode, GiftRedeemContainer, GiftRedeemModal, GiftRedeemSubmitButton, GiftRedeemView, GoogleLoginButton, IncludeFirstName, IncludeLastName, IncludePhone, Input, InvoiceDetailsContainer, InvoiceDetailsDownloadButton, InvoiceDetailsModal, InvoiceDetailsPayButton, InvoiceDetailsView, InvoicePaymentContainer, InvoicePaymentModal, InvoicePaymentView, Link, LoginButton, LoginContainer, LoginEmail, LoginModal, LoginPassword, LoginRequestLoginToken, LoginUsername, LoginView, Logout, MeterModal, MeterView, Modal, ModalBody, ModalFooter, NewsletterWithHook as NewsLetter, NewsletterUpdateButton, NewsletterUpdateContainer, NewsletterUpdateList, NewsletterUpdateModal, NewsletterUpdateView, Notification, OrderConfirmModal, OrderCreateContainer, OrderCreateFreeButton, OrderCreateModal, OrderCreateSubmitButton, OrderCreateView, Password, PasswordChangeButton, PasswordChangeConfirmNewPassword, PasswordChangeContainer, PasswordChangeCurrentPassword, PasswordChangeModal, PasswordChangeNewPassword, PasswordChangeView, PasswordForgotButton, PasswordForgotContainer, PasswordForgotEmail, PasswordForgotModal, PasswordForgotView, PasswordResetButton, PasswordResetConfirmPassword, PasswordResetContainer, PasswordResetEmail, PasswordResetModal, PasswordResetPassword, PasswordResetView, PasswordlessRequestContainer, PasswordlessRequestEmail, PasswordlessRequestModal, PasswordlessRequestView, PasswordlessRequestViewButton, PaymentCreateContainer, PaymentCreateView, PaymentMethodContainer, PaymentMethodSelectContainer, PaymentMethodSelectList, PaymentMethodSelectModal, PaymentMethodSelectSubmit, PaymentMethodSelectView, PaymentMethodUpdateContainer, PaymentMethodUpdateModal, PaymentMethodUpdateView, PaymentMethodView, PaymentSuccessModal, PaymentSuccessView, PaypalSubscribeButton, PelcroCardCVC, PelcroCardExpiry, PelcroCardNumber, PelcroModalController, PelcroPaymentRequestButton, ProfilePicChangeButton, ProfilePicChangeContainer, ProfilePicChangeCropper, ProfilePicChangeModal, ProfilePicChangeRemoveButton, ProfilePicChangeSelectButton, ProfilePicChangeView, ProfilePicChangeZoom, QrCodeModal, QrCodeView, Radio, RegisterButton, RegisterCompany, RegisterContainer, RegisterEmail, RegisterFirstName, RegisterJobTitle, RegisterLastName, RegisterModal, RegisterPassword, RegisterView, Select, SelectModalWithHook as SelectModal, SelectedPaymentMethod, ShopPurchaseButton, ShopSelectProductButton, ShopView, SubmitPaymentMethod, SubscriptionCancelModal, SubscriptionCreateContainer, SubscriptionCreateFreePlanButton, SubscriptionCreateModal, SubscriptionCreateView, SubscriptionManageMembersButton, SubscriptionManageMembersContainer, SubscriptionManageMembersEmails, SubscriptionManageMembersList, SubscriptionManageMembersModal, SubscriptionManageMembersView, SubscriptionRenewContainer, SubscriptionRenewModal, SubscriptionRenewView, SubscriptionSuspendContainer, SubscriptionSuspendModal, SubscriptionSuspendView, TaxAmount, TextArea, Tooltip, UserNameInput, UserUpdateButton, UserUpdateContainer, UserUpdateDisplayName, UserUpdateEmail, UserUpdateFirstName, UserUpdateLastName, UserUpdateModal, UserUpdatePhone, UserUpdateProfilePic, UserUpdateTextInput, UserUpdateTin, UserUpdateUsername, UserUpdateView, VerifyLinkTokenContainer, VerifyLinkTokenLoader, VerifyLinkTokenModal, VerifyLinkTokenView, authenticatedButtons, i18next as i18n, init$1 as initButtons, init as initContentEntitlement, invoicePaymentSubmitButton, notify, unauthenticatedButtons, usePelcro };
|