@pelcro/react-pelcro-js 3.0.0-beta.8 → 3.1.0-beta.1
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 +46 -22
- package/dist/index.esm.js +46 -22
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -3670,6 +3670,7 @@ var successfully$1 = "successfully";
|
|
|
3670
3670
|
var entitlement$1 = "Some of the content on this page is available with one or more of our plans. <1>Subscribe</1> now to get full page access.";
|
|
3671
3671
|
var recaptcha$1 = "This site is protected by reCAPTCHA and the Google <1>Privacy Policy</1> and <3>Terms of Service</3> apply.";
|
|
3672
3672
|
var invalidInvoice$1 = "Invalid invoice ID, please contact support";
|
|
3673
|
+
var zeroTotalInvoice$1 = "You can't view an invoice of 0$";
|
|
3673
3674
|
var messages_en = {
|
|
3674
3675
|
youAreSafe: youAreSafe$1,
|
|
3675
3676
|
cancel: cancel$1,
|
|
@@ -3677,7 +3678,8 @@ var messages_en = {
|
|
|
3677
3678
|
successfully: successfully$1,
|
|
3678
3679
|
entitlement: entitlement$1,
|
|
3679
3680
|
recaptcha: recaptcha$1,
|
|
3680
|
-
invalidInvoice: invalidInvoice$1
|
|
3681
|
+
invalidInvoice: invalidInvoice$1,
|
|
3682
|
+
zeroTotalInvoice: zeroTotalInvoice$1
|
|
3681
3683
|
};
|
|
3682
3684
|
|
|
3683
3685
|
var youAreSafe = "Vous êtes en sécurité - PCI conforme 128 SSL par";
|
|
@@ -3687,6 +3689,7 @@ var successfully = "avec succès.";
|
|
|
3687
3689
|
var entitlement = "Une partie du contenu de cette page est disponible sous un ou plusieurs de nos plans. <1>Abonnez-vous</1> à l'un de nos plans disponibles pour accéder à plus de contenu";
|
|
3688
3690
|
var recaptcha = "Ce site est protégé par reCAPTCHA - les <1>règles de confidentialité</1> Google ainsi que les <3>conditions d'utilisation</3> s'appliquent.";
|
|
3689
3691
|
var invalidInvoice = "Invalid invoice ID, please contact support";
|
|
3692
|
+
var zeroTotalInvoice = "You can't view an invoice of 0$";
|
|
3690
3693
|
var messages_fr = {
|
|
3691
3694
|
youAreSafe: youAreSafe,
|
|
3692
3695
|
cancel: cancel,
|
|
@@ -3694,7 +3697,8 @@ var messages_fr = {
|
|
|
3694
3697
|
successfully: successfully,
|
|
3695
3698
|
entitlement: entitlement,
|
|
3696
3699
|
recaptcha: recaptcha,
|
|
3697
|
-
invalidInvoice: invalidInvoice
|
|
3700
|
+
invalidInvoice: invalidInvoice,
|
|
3701
|
+
zeroTotalInvoice: zeroTotalInvoice
|
|
3698
3702
|
};
|
|
3699
3703
|
|
|
3700
3704
|
var labels$j = {
|
|
@@ -3808,7 +3812,7 @@ var gift$1 = {
|
|
|
3808
3812
|
lastName: "Last name",
|
|
3809
3813
|
email: "Email",
|
|
3810
3814
|
startDate: "Gift date",
|
|
3811
|
-
giftMessage: "Gift message (
|
|
3815
|
+
giftMessage: "Gift message ({{count}} characters remaining)",
|
|
3812
3816
|
required: "required",
|
|
3813
3817
|
firstNamePlaceholder: "First name",
|
|
3814
3818
|
lastNamePlaceholder: "Last name",
|
|
@@ -3904,7 +3908,7 @@ var gift = {
|
|
|
3904
3908
|
lastName: "Nom de famille",
|
|
3905
3909
|
email: "Adresse courriel",
|
|
3906
3910
|
startDate: "Date de début",
|
|
3907
|
-
giftMessage: "Message du cadeau (
|
|
3911
|
+
giftMessage: "Message du cadeau ({{count}} caractères restants)",
|
|
3908
3912
|
required: "Champs obligatoires",
|
|
3909
3913
|
firstNamePlaceholder: "Prénom",
|
|
3910
3914
|
lastNamePlaceholder: "Nom de famille",
|
|
@@ -9126,6 +9130,17 @@ const showInvoiceDetailsFromUrl = () => {
|
|
|
9126
9130
|
return notify.error(errorMessage);
|
|
9127
9131
|
}
|
|
9128
9132
|
|
|
9133
|
+
const {
|
|
9134
|
+
invoice
|
|
9135
|
+
} = usePelcro.getStore();
|
|
9136
|
+
|
|
9137
|
+
if (invoice.total === 0) {
|
|
9138
|
+
const errorMessage = i18next.t("messages:zeroTotalInvoice", {
|
|
9139
|
+
returnObjects: true
|
|
9140
|
+
});
|
|
9141
|
+
return notify.error(errorMessage);
|
|
9142
|
+
}
|
|
9143
|
+
|
|
9129
9144
|
return switchView("invoice-details");
|
|
9130
9145
|
});
|
|
9131
9146
|
};
|
|
@@ -12782,6 +12797,7 @@ class Subscription {
|
|
|
12782
12797
|
* @property {number} [quantity]
|
|
12783
12798
|
* @property {string} addressId
|
|
12784
12799
|
* @property {number} invoiceId
|
|
12800
|
+
* @property {boolean} isExistingSource
|
|
12785
12801
|
*/
|
|
12786
12802
|
|
|
12787
12803
|
/**
|
|
@@ -12966,11 +12982,15 @@ class StripeGateway {
|
|
|
12966
12982
|
token,
|
|
12967
12983
|
invoiceId
|
|
12968
12984
|
} = options;
|
|
12969
|
-
|
|
12985
|
+
const params = options.isExistingSource ? {
|
|
12986
|
+
source_id: token,
|
|
12987
|
+
invoice_id: invoiceId
|
|
12988
|
+
} : {
|
|
12970
12989
|
payment_gateway: _classPrivateFieldGet(this, _paymentGateway),
|
|
12971
12990
|
gateway_token: token,
|
|
12972
12991
|
invoice_id: invoiceId
|
|
12973
|
-
}
|
|
12992
|
+
};
|
|
12993
|
+
window.Pelcro.invoice.pay(params, (err, res) => {
|
|
12974
12994
|
callback(err, res);
|
|
12975
12995
|
});
|
|
12976
12996
|
}
|
|
@@ -13737,6 +13757,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
13737
13757
|
return subscription.execute({
|
|
13738
13758
|
type: SUBSCRIPTION_TYPES.PAY_INVOICE,
|
|
13739
13759
|
token: gatewayToken,
|
|
13760
|
+
isExistingSource: Boolean(selectedPaymentMethodId),
|
|
13740
13761
|
invoiceId: invoice.id
|
|
13741
13762
|
}, (err, res) => {
|
|
13742
13763
|
dispatch({
|
|
@@ -13759,9 +13780,6 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
13759
13780
|
});
|
|
13760
13781
|
}
|
|
13761
13782
|
|
|
13762
|
-
set({
|
|
13763
|
-
invoice: null
|
|
13764
|
-
});
|
|
13765
13783
|
onSuccess(res);
|
|
13766
13784
|
});
|
|
13767
13785
|
};
|
|
@@ -13866,7 +13884,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
13866
13884
|
}, 0);
|
|
13867
13885
|
};
|
|
13868
13886
|
|
|
13869
|
-
const totalAmount = (_ref = (_ref2 = (_state$updatedPrice = state === null || state === void 0 ? void 0 : state.updatedPrice) !== null && _state$updatedPrice !== void 0 ? _state$updatedPrice : plan === null || plan === void 0 ? void 0 : plan.amount) !== null && _ref2 !== void 0 ? _ref2 : invoice.amount_remaining) !== null && _ref !== void 0 ? _ref : getOrderItemsTotal();
|
|
13887
|
+
const totalAmount = (_ref = (_ref2 = (_state$updatedPrice = state === null || state === void 0 ? void 0 : state.updatedPrice) !== null && _state$updatedPrice !== void 0 ? _state$updatedPrice : plan === null || plan === void 0 ? void 0 : plan.amount) !== null && _ref2 !== void 0 ? _ref2 : invoice === null || invoice === void 0 ? void 0 : invoice.amount_remaining) !== null && _ref !== void 0 ? _ref : getOrderItemsTotal();
|
|
13870
13888
|
|
|
13871
13889
|
if ((source === null || source === void 0 ? void 0 : (_source$card3 = source.card) === null || _source$card3 === void 0 ? void 0 : _source$card3.three_d_secure) === "required" && totalAmount > 0) {
|
|
13872
13890
|
return resolveTaxCalculation().then(res => {
|
|
@@ -14113,7 +14131,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
14113
14131
|
case HANDLE_PAYPAL_SUBSCRIPTION:
|
|
14114
14132
|
return lib_5(state, (state, dispatch) => {
|
|
14115
14133
|
if (type === "invoicePayment") {
|
|
14116
|
-
payInvoice(new
|
|
14134
|
+
payInvoice(new PaypalGateway(), action.payload, dispatch);
|
|
14117
14135
|
} else {
|
|
14118
14136
|
handlePaypalSubscription(state, action.payload);
|
|
14119
14137
|
}
|
|
@@ -19378,6 +19396,8 @@ function TextArea({
|
|
|
19378
19396
|
*/
|
|
19379
19397
|
|
|
19380
19398
|
function GiftCreateMessage(props) {
|
|
19399
|
+
var _ref, _state$giftMessage;
|
|
19400
|
+
|
|
19381
19401
|
const {
|
|
19382
19402
|
t
|
|
19383
19403
|
} = useTranslation("register");
|
|
@@ -19385,6 +19405,8 @@ function GiftCreateMessage(props) {
|
|
|
19385
19405
|
dispatch,
|
|
19386
19406
|
state
|
|
19387
19407
|
} = React.useContext(store$6);
|
|
19408
|
+
const MAX_CHARS_COUNT = 200;
|
|
19409
|
+
const remainingCharsCount = (_ref = MAX_CHARS_COUNT - ((_state$giftMessage = state.giftMessage) === null || _state$giftMessage === void 0 ? void 0 : _state$giftMessage.length)) !== null && _ref !== void 0 ? _ref : 0;
|
|
19388
19410
|
|
|
19389
19411
|
const handleInputChange = value => {
|
|
19390
19412
|
dispatch({
|
|
@@ -19402,6 +19424,9 @@ function GiftCreateMessage(props) {
|
|
|
19402
19424
|
value: state.giftMessage,
|
|
19403
19425
|
maxLength: "200",
|
|
19404
19426
|
rows: 3,
|
|
19427
|
+
label: t("gift.labels.giftMessage", {
|
|
19428
|
+
count: remainingCharsCount
|
|
19429
|
+
}),
|
|
19405
19430
|
tooltipText: t("gift.messages.giftMessageInfo")
|
|
19406
19431
|
}, props));
|
|
19407
19432
|
}
|
|
@@ -19451,8 +19476,7 @@ const GiftCreateView = props => {
|
|
|
19451
19476
|
}, /*#__PURE__*/React__default['default'].createElement(GiftCreateMessage, {
|
|
19452
19477
|
autoComplete: "gift-message",
|
|
19453
19478
|
id: "pelcro-input-gift-message",
|
|
19454
|
-
errorId: "pelcro-input-gift-message-error"
|
|
19455
|
-
label: t("gift.labels.giftMessage")
|
|
19479
|
+
errorId: "pelcro-input-gift-message-error"
|
|
19456
19480
|
})), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
19457
19481
|
className: "plc-text-gray-900 pelcro-footnote"
|
|
19458
19482
|
}, "* ", t("gift.labels.required")), /*#__PURE__*/React__default['default'].createElement(GiftCreateSubmitButton, {
|
|
@@ -22194,7 +22218,7 @@ const DonationsMenu = () => {
|
|
|
22194
22218
|
function getDonationSubs() {
|
|
22195
22219
|
var _window$Pelcro$subscr, _window$Pelcro$subscr2, _window$Pelcro$subscr3, _window$Pelcro$user$r, _window$Pelcro$user$r2;
|
|
22196
22220
|
|
|
22197
|
-
const donations = (_window$Pelcro$subscr = (_window$Pelcro$subscr2 = window.Pelcro.subscription) === null || _window$Pelcro$subscr2 === void 0 ? void 0 : (_window$Pelcro$subscr3 = _window$Pelcro$subscr2.list()) === null || _window$Pelcro$subscr3 === void 0 ? void 0 : _window$Pelcro$subscr3.filter(sub => sub.plan.is_donation)) !== null && _window$Pelcro$subscr !== void 0 ? _window$Pelcro$subscr : [];
|
|
22221
|
+
const donations = (_window$Pelcro$subscr = (_window$Pelcro$subscr2 = window.Pelcro.subscription) === null || _window$Pelcro$subscr2 === void 0 ? void 0 : (_window$Pelcro$subscr3 = _window$Pelcro$subscr2.list()) === null || _window$Pelcro$subscr3 === void 0 ? void 0 : _window$Pelcro$subscr3.filter(sub => sub.plan.is_donation && !sub.is_gift_donor)) !== null && _window$Pelcro$subscr !== void 0 ? _window$Pelcro$subscr : [];
|
|
22198
22222
|
const canceledDonations = (_window$Pelcro$user$r = (_window$Pelcro$user$r2 = window.Pelcro.user.read().expired_subscriptions) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : _window$Pelcro$user$r2.filter(sub => sub.plan.is_donation && !sub.is_gift_donor)) !== null && _window$Pelcro$user$r !== void 0 ? _window$Pelcro$user$r : [];
|
|
22199
22223
|
return [...donations, ...canceledDonations];
|
|
22200
22224
|
}
|
|
@@ -22224,7 +22248,7 @@ const InvoicesMenu = props => {
|
|
|
22224
22248
|
};
|
|
22225
22249
|
|
|
22226
22250
|
const InvoicesItems = () => {
|
|
22227
|
-
var _window$Pelcro$invoic;
|
|
22251
|
+
var _window$Pelcro$invoic, _window$Pelcro$invoic2;
|
|
22228
22252
|
|
|
22229
22253
|
const {
|
|
22230
22254
|
t
|
|
@@ -22233,7 +22257,7 @@ const InvoicesItems = () => {
|
|
|
22233
22257
|
setInvoice,
|
|
22234
22258
|
switchView
|
|
22235
22259
|
} = usePelcro();
|
|
22236
|
-
const invoices = (_window$Pelcro$invoic = window.Pelcro.invoice.list()) !== null && _window$Pelcro$invoic !== void 0 ? _window$Pelcro$invoic : [];
|
|
22260
|
+
const invoices = (_window$Pelcro$invoic = (_window$Pelcro$invoic2 = window.Pelcro.invoice.list()) === null || _window$Pelcro$invoic2 === void 0 ? void 0 : _window$Pelcro$invoic2.filter(invoice => invoice.total > 0)) !== null && _window$Pelcro$invoic !== void 0 ? _window$Pelcro$invoic : [];
|
|
22237
22261
|
|
|
22238
22262
|
const showInvoiceDetails = event => {
|
|
22239
22263
|
if (setInvoice(event.target.dataset.id)) {
|
|
@@ -22909,16 +22933,16 @@ class Dashboard extends React.Component {
|
|
|
22909
22933
|
}
|
|
22910
22934
|
|
|
22911
22935
|
function hasInvoices() {
|
|
22912
|
-
var _window$Pelcro$invoic;
|
|
22936
|
+
var _window$Pelcro$invoic, _window$Pelcro$invoic2;
|
|
22913
22937
|
|
|
22914
|
-
const invoices = (_window$Pelcro$invoic = window.Pelcro.invoice.list()) !== null && _window$Pelcro$invoic !== void 0 ? _window$Pelcro$invoic : [];
|
|
22938
|
+
const invoices = (_window$Pelcro$invoic = (_window$Pelcro$invoic2 = window.Pelcro.invoice.list()) === null || _window$Pelcro$invoic2 === void 0 ? void 0 : _window$Pelcro$invoic2.filter(invoice => invoice.total > 0)) !== null && _window$Pelcro$invoic !== void 0 ? _window$Pelcro$invoic : [];
|
|
22915
22939
|
return invoices.length > 0;
|
|
22916
22940
|
}
|
|
22917
22941
|
|
|
22918
22942
|
function hasDonationSubs() {
|
|
22919
22943
|
var _window$Pelcro$subscr, _window$Pelcro$subscr2, _window$Pelcro$subscr3, _window$Pelcro$user$r4, _window$Pelcro$user$r5;
|
|
22920
22944
|
|
|
22921
|
-
const donations = (_window$Pelcro$subscr = (_window$Pelcro$subscr2 = window.Pelcro.subscription) === null || _window$Pelcro$subscr2 === void 0 ? void 0 : (_window$Pelcro$subscr3 = _window$Pelcro$subscr2.list()) === null || _window$Pelcro$subscr3 === void 0 ? void 0 : _window$Pelcro$subscr3.filter(sub => sub.plan.is_donation)) !== null && _window$Pelcro$subscr !== void 0 ? _window$Pelcro$subscr : [];
|
|
22945
|
+
const donations = (_window$Pelcro$subscr = (_window$Pelcro$subscr2 = window.Pelcro.subscription) === null || _window$Pelcro$subscr2 === void 0 ? void 0 : (_window$Pelcro$subscr3 = _window$Pelcro$subscr2.list()) === null || _window$Pelcro$subscr3 === void 0 ? void 0 : _window$Pelcro$subscr3.filter(sub => sub.plan.is_donation && !sub.is_gift_donor)) !== null && _window$Pelcro$subscr !== void 0 ? _window$Pelcro$subscr : [];
|
|
22922
22946
|
const canceledDonations = (_window$Pelcro$user$r4 = (_window$Pelcro$user$r5 = window.Pelcro.user.read().expired_subscriptions) === null || _window$Pelcro$user$r5 === void 0 ? void 0 : _window$Pelcro$user$r5.filter(sub => sub.plan.is_donation && !sub.is_gift_donor)) !== null && _window$Pelcro$user$r4 !== void 0 ? _window$Pelcro$user$r4 : [];
|
|
22923
22947
|
return donations.length > 0 || canceledDonations.length > 0;
|
|
22924
22948
|
}
|
|
@@ -25106,11 +25130,11 @@ const InvoiceDetailsView = props => {
|
|
|
25106
25130
|
}, t("labels.summary")), invoice && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("p", {
|
|
25107
25131
|
className: "plc-mr-2 pelcro-invoice-creation-date"
|
|
25108
25132
|
}, `${t("labels.creationDate")} ${formattedCreationDate}`), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
25109
|
-
className: "plc-flex plc-items-center plc-pt-2 plc-mt-2 plc-border-t plc-border-gray-400 plc-min-h-12 plc-justify-
|
|
25133
|
+
className: "plc-flex plc-items-center plc-pt-2 plc-mt-2 plc-border-t plc-border-gray-400 plc-min-h-12 plc-justify-between pelcro-invoice-plan-wrapper"
|
|
25110
25134
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
25111
|
-
className: "plc-
|
|
25135
|
+
className: "plc-break-words pelcro-invoice-plan-name"
|
|
25112
25136
|
}, invoice.plan.nickname), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
25113
|
-
className: "plc-
|
|
25137
|
+
className: "plc-text-center pelcro-invoice-summary-price"
|
|
25114
25138
|
}, calcAndFormatItemsTotal([invoice.plan], invoice.currency))), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
25115
25139
|
className: "plc-flex plc-justify-end plc-pt-2 plc-mt-2 plc-font-bold plc-border-t plc-border-gray-400 pelcro-invoice-total-wrapper"
|
|
25116
25140
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
package/dist/index.esm.js
CHANGED
|
@@ -3640,6 +3640,7 @@ var successfully$1 = "successfully";
|
|
|
3640
3640
|
var entitlement$1 = "Some of the content on this page is available with one or more of our plans. <1>Subscribe</1> now to get full page access.";
|
|
3641
3641
|
var recaptcha$1 = "This site is protected by reCAPTCHA and the Google <1>Privacy Policy</1> and <3>Terms of Service</3> apply.";
|
|
3642
3642
|
var invalidInvoice$1 = "Invalid invoice ID, please contact support";
|
|
3643
|
+
var zeroTotalInvoice$1 = "You can't view an invoice of 0$";
|
|
3643
3644
|
var messages_en = {
|
|
3644
3645
|
youAreSafe: youAreSafe$1,
|
|
3645
3646
|
cancel: cancel$1,
|
|
@@ -3647,7 +3648,8 @@ var messages_en = {
|
|
|
3647
3648
|
successfully: successfully$1,
|
|
3648
3649
|
entitlement: entitlement$1,
|
|
3649
3650
|
recaptcha: recaptcha$1,
|
|
3650
|
-
invalidInvoice: invalidInvoice$1
|
|
3651
|
+
invalidInvoice: invalidInvoice$1,
|
|
3652
|
+
zeroTotalInvoice: zeroTotalInvoice$1
|
|
3651
3653
|
};
|
|
3652
3654
|
|
|
3653
3655
|
var youAreSafe = "Vous êtes en sécurité - PCI conforme 128 SSL par";
|
|
@@ -3657,6 +3659,7 @@ var successfully = "avec succès.";
|
|
|
3657
3659
|
var entitlement = "Une partie du contenu de cette page est disponible sous un ou plusieurs de nos plans. <1>Abonnez-vous</1> à l'un de nos plans disponibles pour accéder à plus de contenu";
|
|
3658
3660
|
var recaptcha = "Ce site est protégé par reCAPTCHA - les <1>règles de confidentialité</1> Google ainsi que les <3>conditions d'utilisation</3> s'appliquent.";
|
|
3659
3661
|
var invalidInvoice = "Invalid invoice ID, please contact support";
|
|
3662
|
+
var zeroTotalInvoice = "You can't view an invoice of 0$";
|
|
3660
3663
|
var messages_fr = {
|
|
3661
3664
|
youAreSafe: youAreSafe,
|
|
3662
3665
|
cancel: cancel,
|
|
@@ -3664,7 +3667,8 @@ var messages_fr = {
|
|
|
3664
3667
|
successfully: successfully,
|
|
3665
3668
|
entitlement: entitlement,
|
|
3666
3669
|
recaptcha: recaptcha,
|
|
3667
|
-
invalidInvoice: invalidInvoice
|
|
3670
|
+
invalidInvoice: invalidInvoice,
|
|
3671
|
+
zeroTotalInvoice: zeroTotalInvoice
|
|
3668
3672
|
};
|
|
3669
3673
|
|
|
3670
3674
|
var labels$j = {
|
|
@@ -3778,7 +3782,7 @@ var gift$1 = {
|
|
|
3778
3782
|
lastName: "Last name",
|
|
3779
3783
|
email: "Email",
|
|
3780
3784
|
startDate: "Gift date",
|
|
3781
|
-
giftMessage: "Gift message (
|
|
3785
|
+
giftMessage: "Gift message ({{count}} characters remaining)",
|
|
3782
3786
|
required: "required",
|
|
3783
3787
|
firstNamePlaceholder: "First name",
|
|
3784
3788
|
lastNamePlaceholder: "Last name",
|
|
@@ -3874,7 +3878,7 @@ var gift = {
|
|
|
3874
3878
|
lastName: "Nom de famille",
|
|
3875
3879
|
email: "Adresse courriel",
|
|
3876
3880
|
startDate: "Date de début",
|
|
3877
|
-
giftMessage: "Message du cadeau (
|
|
3881
|
+
giftMessage: "Message du cadeau ({{count}} caractères restants)",
|
|
3878
3882
|
required: "Champs obligatoires",
|
|
3879
3883
|
firstNamePlaceholder: "Prénom",
|
|
3880
3884
|
lastNamePlaceholder: "Nom de famille",
|
|
@@ -9096,6 +9100,17 @@ const showInvoiceDetailsFromUrl = () => {
|
|
|
9096
9100
|
return notify.error(errorMessage);
|
|
9097
9101
|
}
|
|
9098
9102
|
|
|
9103
|
+
const {
|
|
9104
|
+
invoice
|
|
9105
|
+
} = usePelcro.getStore();
|
|
9106
|
+
|
|
9107
|
+
if (invoice.total === 0) {
|
|
9108
|
+
const errorMessage = i18next.t("messages:zeroTotalInvoice", {
|
|
9109
|
+
returnObjects: true
|
|
9110
|
+
});
|
|
9111
|
+
return notify.error(errorMessage);
|
|
9112
|
+
}
|
|
9113
|
+
|
|
9099
9114
|
return switchView("invoice-details");
|
|
9100
9115
|
});
|
|
9101
9116
|
};
|
|
@@ -12752,6 +12767,7 @@ class Subscription {
|
|
|
12752
12767
|
* @property {number} [quantity]
|
|
12753
12768
|
* @property {string} addressId
|
|
12754
12769
|
* @property {number} invoiceId
|
|
12770
|
+
* @property {boolean} isExistingSource
|
|
12755
12771
|
*/
|
|
12756
12772
|
|
|
12757
12773
|
/**
|
|
@@ -12936,11 +12952,15 @@ class StripeGateway {
|
|
|
12936
12952
|
token,
|
|
12937
12953
|
invoiceId
|
|
12938
12954
|
} = options;
|
|
12939
|
-
|
|
12955
|
+
const params = options.isExistingSource ? {
|
|
12956
|
+
source_id: token,
|
|
12957
|
+
invoice_id: invoiceId
|
|
12958
|
+
} : {
|
|
12940
12959
|
payment_gateway: _classPrivateFieldGet(this, _paymentGateway),
|
|
12941
12960
|
gateway_token: token,
|
|
12942
12961
|
invoice_id: invoiceId
|
|
12943
|
-
}
|
|
12962
|
+
};
|
|
12963
|
+
window.Pelcro.invoice.pay(params, (err, res) => {
|
|
12944
12964
|
callback(err, res);
|
|
12945
12965
|
});
|
|
12946
12966
|
}
|
|
@@ -13707,6 +13727,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
13707
13727
|
return subscription.execute({
|
|
13708
13728
|
type: SUBSCRIPTION_TYPES.PAY_INVOICE,
|
|
13709
13729
|
token: gatewayToken,
|
|
13730
|
+
isExistingSource: Boolean(selectedPaymentMethodId),
|
|
13710
13731
|
invoiceId: invoice.id
|
|
13711
13732
|
}, (err, res) => {
|
|
13712
13733
|
dispatch({
|
|
@@ -13729,9 +13750,6 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
13729
13750
|
});
|
|
13730
13751
|
}
|
|
13731
13752
|
|
|
13732
|
-
set({
|
|
13733
|
-
invoice: null
|
|
13734
|
-
});
|
|
13735
13753
|
onSuccess(res);
|
|
13736
13754
|
});
|
|
13737
13755
|
};
|
|
@@ -13836,7 +13854,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
13836
13854
|
}, 0);
|
|
13837
13855
|
};
|
|
13838
13856
|
|
|
13839
|
-
const totalAmount = (_ref = (_ref2 = (_state$updatedPrice = state === null || state === void 0 ? void 0 : state.updatedPrice) !== null && _state$updatedPrice !== void 0 ? _state$updatedPrice : plan === null || plan === void 0 ? void 0 : plan.amount) !== null && _ref2 !== void 0 ? _ref2 : invoice.amount_remaining) !== null && _ref !== void 0 ? _ref : getOrderItemsTotal();
|
|
13857
|
+
const totalAmount = (_ref = (_ref2 = (_state$updatedPrice = state === null || state === void 0 ? void 0 : state.updatedPrice) !== null && _state$updatedPrice !== void 0 ? _state$updatedPrice : plan === null || plan === void 0 ? void 0 : plan.amount) !== null && _ref2 !== void 0 ? _ref2 : invoice === null || invoice === void 0 ? void 0 : invoice.amount_remaining) !== null && _ref !== void 0 ? _ref : getOrderItemsTotal();
|
|
13840
13858
|
|
|
13841
13859
|
if ((source === null || source === void 0 ? void 0 : (_source$card3 = source.card) === null || _source$card3 === void 0 ? void 0 : _source$card3.three_d_secure) === "required" && totalAmount > 0) {
|
|
13842
13860
|
return resolveTaxCalculation().then(res => {
|
|
@@ -14083,7 +14101,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
14083
14101
|
case HANDLE_PAYPAL_SUBSCRIPTION:
|
|
14084
14102
|
return lib_5(state, (state, dispatch) => {
|
|
14085
14103
|
if (type === "invoicePayment") {
|
|
14086
|
-
payInvoice(new
|
|
14104
|
+
payInvoice(new PaypalGateway(), action.payload, dispatch);
|
|
14087
14105
|
} else {
|
|
14088
14106
|
handlePaypalSubscription(state, action.payload);
|
|
14089
14107
|
}
|
|
@@ -19348,6 +19366,8 @@ function TextArea({
|
|
|
19348
19366
|
*/
|
|
19349
19367
|
|
|
19350
19368
|
function GiftCreateMessage(props) {
|
|
19369
|
+
var _ref, _state$giftMessage;
|
|
19370
|
+
|
|
19351
19371
|
const {
|
|
19352
19372
|
t
|
|
19353
19373
|
} = useTranslation("register");
|
|
@@ -19355,6 +19375,8 @@ function GiftCreateMessage(props) {
|
|
|
19355
19375
|
dispatch,
|
|
19356
19376
|
state
|
|
19357
19377
|
} = useContext(store$6);
|
|
19378
|
+
const MAX_CHARS_COUNT = 200;
|
|
19379
|
+
const remainingCharsCount = (_ref = MAX_CHARS_COUNT - ((_state$giftMessage = state.giftMessage) === null || _state$giftMessage === void 0 ? void 0 : _state$giftMessage.length)) !== null && _ref !== void 0 ? _ref : 0;
|
|
19358
19380
|
|
|
19359
19381
|
const handleInputChange = value => {
|
|
19360
19382
|
dispatch({
|
|
@@ -19372,6 +19394,9 @@ function GiftCreateMessage(props) {
|
|
|
19372
19394
|
value: state.giftMessage,
|
|
19373
19395
|
maxLength: "200",
|
|
19374
19396
|
rows: 3,
|
|
19397
|
+
label: t("gift.labels.giftMessage", {
|
|
19398
|
+
count: remainingCharsCount
|
|
19399
|
+
}),
|
|
19375
19400
|
tooltipText: t("gift.messages.giftMessageInfo")
|
|
19376
19401
|
}, props));
|
|
19377
19402
|
}
|
|
@@ -19421,8 +19446,7 @@ const GiftCreateView = props => {
|
|
|
19421
19446
|
}, /*#__PURE__*/React__default.createElement(GiftCreateMessage, {
|
|
19422
19447
|
autoComplete: "gift-message",
|
|
19423
19448
|
id: "pelcro-input-gift-message",
|
|
19424
|
-
errorId: "pelcro-input-gift-message-error"
|
|
19425
|
-
label: t("gift.labels.giftMessage")
|
|
19449
|
+
errorId: "pelcro-input-gift-message-error"
|
|
19426
19450
|
})), /*#__PURE__*/React__default.createElement("p", {
|
|
19427
19451
|
className: "plc-text-gray-900 pelcro-footnote"
|
|
19428
19452
|
}, "* ", t("gift.labels.required")), /*#__PURE__*/React__default.createElement(GiftCreateSubmitButton, {
|
|
@@ -22164,7 +22188,7 @@ const DonationsMenu = () => {
|
|
|
22164
22188
|
function getDonationSubs() {
|
|
22165
22189
|
var _window$Pelcro$subscr, _window$Pelcro$subscr2, _window$Pelcro$subscr3, _window$Pelcro$user$r, _window$Pelcro$user$r2;
|
|
22166
22190
|
|
|
22167
|
-
const donations = (_window$Pelcro$subscr = (_window$Pelcro$subscr2 = window.Pelcro.subscription) === null || _window$Pelcro$subscr2 === void 0 ? void 0 : (_window$Pelcro$subscr3 = _window$Pelcro$subscr2.list()) === null || _window$Pelcro$subscr3 === void 0 ? void 0 : _window$Pelcro$subscr3.filter(sub => sub.plan.is_donation)) !== null && _window$Pelcro$subscr !== void 0 ? _window$Pelcro$subscr : [];
|
|
22191
|
+
const donations = (_window$Pelcro$subscr = (_window$Pelcro$subscr2 = window.Pelcro.subscription) === null || _window$Pelcro$subscr2 === void 0 ? void 0 : (_window$Pelcro$subscr3 = _window$Pelcro$subscr2.list()) === null || _window$Pelcro$subscr3 === void 0 ? void 0 : _window$Pelcro$subscr3.filter(sub => sub.plan.is_donation && !sub.is_gift_donor)) !== null && _window$Pelcro$subscr !== void 0 ? _window$Pelcro$subscr : [];
|
|
22168
22192
|
const canceledDonations = (_window$Pelcro$user$r = (_window$Pelcro$user$r2 = window.Pelcro.user.read().expired_subscriptions) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : _window$Pelcro$user$r2.filter(sub => sub.plan.is_donation && !sub.is_gift_donor)) !== null && _window$Pelcro$user$r !== void 0 ? _window$Pelcro$user$r : [];
|
|
22169
22193
|
return [...donations, ...canceledDonations];
|
|
22170
22194
|
}
|
|
@@ -22194,7 +22218,7 @@ const InvoicesMenu = props => {
|
|
|
22194
22218
|
};
|
|
22195
22219
|
|
|
22196
22220
|
const InvoicesItems = () => {
|
|
22197
|
-
var _window$Pelcro$invoic;
|
|
22221
|
+
var _window$Pelcro$invoic, _window$Pelcro$invoic2;
|
|
22198
22222
|
|
|
22199
22223
|
const {
|
|
22200
22224
|
t
|
|
@@ -22203,7 +22227,7 @@ const InvoicesItems = () => {
|
|
|
22203
22227
|
setInvoice,
|
|
22204
22228
|
switchView
|
|
22205
22229
|
} = usePelcro();
|
|
22206
|
-
const invoices = (_window$Pelcro$invoic = window.Pelcro.invoice.list()) !== null && _window$Pelcro$invoic !== void 0 ? _window$Pelcro$invoic : [];
|
|
22230
|
+
const invoices = (_window$Pelcro$invoic = (_window$Pelcro$invoic2 = window.Pelcro.invoice.list()) === null || _window$Pelcro$invoic2 === void 0 ? void 0 : _window$Pelcro$invoic2.filter(invoice => invoice.total > 0)) !== null && _window$Pelcro$invoic !== void 0 ? _window$Pelcro$invoic : [];
|
|
22207
22231
|
|
|
22208
22232
|
const showInvoiceDetails = event => {
|
|
22209
22233
|
if (setInvoice(event.target.dataset.id)) {
|
|
@@ -22879,16 +22903,16 @@ class Dashboard extends Component {
|
|
|
22879
22903
|
}
|
|
22880
22904
|
|
|
22881
22905
|
function hasInvoices() {
|
|
22882
|
-
var _window$Pelcro$invoic;
|
|
22906
|
+
var _window$Pelcro$invoic, _window$Pelcro$invoic2;
|
|
22883
22907
|
|
|
22884
|
-
const invoices = (_window$Pelcro$invoic = window.Pelcro.invoice.list()) !== null && _window$Pelcro$invoic !== void 0 ? _window$Pelcro$invoic : [];
|
|
22908
|
+
const invoices = (_window$Pelcro$invoic = (_window$Pelcro$invoic2 = window.Pelcro.invoice.list()) === null || _window$Pelcro$invoic2 === void 0 ? void 0 : _window$Pelcro$invoic2.filter(invoice => invoice.total > 0)) !== null && _window$Pelcro$invoic !== void 0 ? _window$Pelcro$invoic : [];
|
|
22885
22909
|
return invoices.length > 0;
|
|
22886
22910
|
}
|
|
22887
22911
|
|
|
22888
22912
|
function hasDonationSubs() {
|
|
22889
22913
|
var _window$Pelcro$subscr, _window$Pelcro$subscr2, _window$Pelcro$subscr3, _window$Pelcro$user$r4, _window$Pelcro$user$r5;
|
|
22890
22914
|
|
|
22891
|
-
const donations = (_window$Pelcro$subscr = (_window$Pelcro$subscr2 = window.Pelcro.subscription) === null || _window$Pelcro$subscr2 === void 0 ? void 0 : (_window$Pelcro$subscr3 = _window$Pelcro$subscr2.list()) === null || _window$Pelcro$subscr3 === void 0 ? void 0 : _window$Pelcro$subscr3.filter(sub => sub.plan.is_donation)) !== null && _window$Pelcro$subscr !== void 0 ? _window$Pelcro$subscr : [];
|
|
22915
|
+
const donations = (_window$Pelcro$subscr = (_window$Pelcro$subscr2 = window.Pelcro.subscription) === null || _window$Pelcro$subscr2 === void 0 ? void 0 : (_window$Pelcro$subscr3 = _window$Pelcro$subscr2.list()) === null || _window$Pelcro$subscr3 === void 0 ? void 0 : _window$Pelcro$subscr3.filter(sub => sub.plan.is_donation && !sub.is_gift_donor)) !== null && _window$Pelcro$subscr !== void 0 ? _window$Pelcro$subscr : [];
|
|
22892
22916
|
const canceledDonations = (_window$Pelcro$user$r4 = (_window$Pelcro$user$r5 = window.Pelcro.user.read().expired_subscriptions) === null || _window$Pelcro$user$r5 === void 0 ? void 0 : _window$Pelcro$user$r5.filter(sub => sub.plan.is_donation && !sub.is_gift_donor)) !== null && _window$Pelcro$user$r4 !== void 0 ? _window$Pelcro$user$r4 : [];
|
|
22893
22917
|
return donations.length > 0 || canceledDonations.length > 0;
|
|
22894
22918
|
}
|
|
@@ -25076,11 +25100,11 @@ const InvoiceDetailsView = props => {
|
|
|
25076
25100
|
}, t("labels.summary")), invoice && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("p", {
|
|
25077
25101
|
className: "plc-mr-2 pelcro-invoice-creation-date"
|
|
25078
25102
|
}, `${t("labels.creationDate")} ${formattedCreationDate}`), /*#__PURE__*/React__default.createElement("div", {
|
|
25079
|
-
className: "plc-flex plc-items-center plc-pt-2 plc-mt-2 plc-border-t plc-border-gray-400 plc-min-h-12 plc-justify-
|
|
25103
|
+
className: "plc-flex plc-items-center plc-pt-2 plc-mt-2 plc-border-t plc-border-gray-400 plc-min-h-12 plc-justify-between pelcro-invoice-plan-wrapper"
|
|
25080
25104
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
25081
|
-
className: "plc-
|
|
25105
|
+
className: "plc-break-words pelcro-invoice-plan-name"
|
|
25082
25106
|
}, invoice.plan.nickname), /*#__PURE__*/React__default.createElement("div", {
|
|
25083
|
-
className: "plc-
|
|
25107
|
+
className: "plc-text-center pelcro-invoice-summary-price"
|
|
25084
25108
|
}, calcAndFormatItemsTotal([invoice.plan], invoice.currency))), /*#__PURE__*/React__default.createElement("div", {
|
|
25085
25109
|
className: "plc-flex plc-justify-end plc-pt-2 plc-mt-2 plc-font-bold plc-border-t plc-border-gray-400 pelcro-invoice-total-wrapper"
|
|
25086
25110
|
}, /*#__PURE__*/React__default.createElement("div", {
|