@pelcro/react-pelcro-js 3.2.0-beta.8 → 3.2.0-beta.9
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 +66 -15
- package/dist/index.esm.js +66 -15
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -4684,17 +4684,17 @@ var invoiceDetails_en = {
|
|
|
4684
4684
|
buttons: buttons$1
|
|
4685
4685
|
};
|
|
4686
4686
|
|
|
4687
|
-
var title$2 = "
|
|
4687
|
+
var title$2 = "Détails de la facture";
|
|
4688
4688
|
var labels = {
|
|
4689
|
-
summary: "
|
|
4689
|
+
summary: "Résumé",
|
|
4690
4690
|
total: "Total",
|
|
4691
|
-
amountPaid: "
|
|
4692
|
-
amountDue: "
|
|
4693
|
-
creationDate: "
|
|
4691
|
+
amountPaid: "Montant payé",
|
|
4692
|
+
amountDue: "Montant dû",
|
|
4693
|
+
creationDate: "Créé le:"
|
|
4694
4694
|
};
|
|
4695
4695
|
var buttons = {
|
|
4696
|
-
download: "
|
|
4697
|
-
pay: "
|
|
4696
|
+
download: "Télécharger",
|
|
4697
|
+
pay: "Payer"
|
|
4698
4698
|
};
|
|
4699
4699
|
var invoiceDetails_fr = {
|
|
4700
4700
|
title: title$2,
|
|
@@ -13600,8 +13600,11 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
13600
13600
|
updateTotalAmountWithTax();
|
|
13601
13601
|
}, []);
|
|
13602
13602
|
|
|
13603
|
-
const
|
|
13604
|
-
|
|
13603
|
+
const submitUsingVantiv = () => {
|
|
13604
|
+
const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
|
|
13605
|
+
|
|
13606
|
+
if (isUsingExistingPaymentMethod) {
|
|
13607
|
+
// no need to create a new source using vantiv
|
|
13605
13608
|
return handleVantivPayment(null);
|
|
13606
13609
|
}
|
|
13607
13610
|
|
|
@@ -13609,7 +13612,10 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
13609
13612
|
return console.error("Vantiv sdk script wasn't loaded, you need to load vantiv sdk before rendering the vantiv payment flow");
|
|
13610
13613
|
}
|
|
13611
13614
|
|
|
13612
|
-
const orderId = `pelcro-${new Date().getTime()}`;
|
|
13615
|
+
const orderId = `pelcro-${new Date().getTime()}`;
|
|
13616
|
+
/*
|
|
13617
|
+
calls handleVantivPayment to either handle a payment or update a source by simply creating a new source
|
|
13618
|
+
*/
|
|
13613
13619
|
|
|
13614
13620
|
vantivInstanceRef.current.getPaypageRegistrationId({
|
|
13615
13621
|
id: orderId,
|
|
@@ -13636,6 +13642,45 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
13636
13642
|
purchase(new VantivGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, state, dispatch);
|
|
13637
13643
|
} else if (type === "invoicePayment") {
|
|
13638
13644
|
payInvoice(new VantivGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, dispatch);
|
|
13645
|
+
} else if (type === "updatePaymentSource") {
|
|
13646
|
+
createNewVantivCard();
|
|
13647
|
+
}
|
|
13648
|
+
|
|
13649
|
+
function createNewVantivCard() {
|
|
13650
|
+
window.Pelcro.source.create({
|
|
13651
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
13652
|
+
token: paymentRequest,
|
|
13653
|
+
gateway: "vantiv"
|
|
13654
|
+
}, (err, res) => {
|
|
13655
|
+
dispatch({
|
|
13656
|
+
type: DISABLE_SUBMIT,
|
|
13657
|
+
payload: false
|
|
13658
|
+
});
|
|
13659
|
+
dispatch({
|
|
13660
|
+
type: LOADING,
|
|
13661
|
+
payload: false
|
|
13662
|
+
});
|
|
13663
|
+
|
|
13664
|
+
if (err) {
|
|
13665
|
+
onFailure(err);
|
|
13666
|
+
return dispatch({
|
|
13667
|
+
type: SHOW_ALERT,
|
|
13668
|
+
payload: {
|
|
13669
|
+
type: "error",
|
|
13670
|
+
content: getErrorMessages(err)
|
|
13671
|
+
}
|
|
13672
|
+
});
|
|
13673
|
+
}
|
|
13674
|
+
|
|
13675
|
+
dispatch({
|
|
13676
|
+
type: SHOW_ALERT,
|
|
13677
|
+
payload: {
|
|
13678
|
+
type: "success",
|
|
13679
|
+
content: t("messages.sourceUpdated")
|
|
13680
|
+
}
|
|
13681
|
+
});
|
|
13682
|
+
onSuccess(res);
|
|
13683
|
+
});
|
|
13639
13684
|
}
|
|
13640
13685
|
|
|
13641
13686
|
function handleVantivSubscription() {
|
|
@@ -14357,7 +14402,9 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
14357
14402
|
|
|
14358
14403
|
if ((source === null || source === void 0 ? void 0 : (_source$card2 = source.card) === null || _source$card2 === void 0 ? void 0 : _source$card2.three_d_secure) === "required") {
|
|
14359
14404
|
return handlePaymentError({
|
|
14360
|
-
|
|
14405
|
+
error: {
|
|
14406
|
+
message: t("messages.cardAuthNotSupported")
|
|
14407
|
+
}
|
|
14361
14408
|
});
|
|
14362
14409
|
}
|
|
14363
14410
|
|
|
@@ -14602,7 +14649,9 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
14602
14649
|
|
|
14603
14650
|
if ((source === null || source === void 0 ? void 0 : source.status) === "failed") {
|
|
14604
14651
|
return handlePaymentError({
|
|
14605
|
-
|
|
14652
|
+
error: {
|
|
14653
|
+
message: t("messages.cardAuthFailed")
|
|
14654
|
+
}
|
|
14606
14655
|
});
|
|
14607
14656
|
}
|
|
14608
14657
|
|
|
@@ -14674,7 +14723,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
14674
14723
|
isLoading: true
|
|
14675
14724
|
}, (state, dispatch) => {
|
|
14676
14725
|
if (getSiteCardProcessor() === "vantiv") {
|
|
14677
|
-
return
|
|
14726
|
+
return submitUsingVantiv();
|
|
14678
14727
|
}
|
|
14679
14728
|
|
|
14680
14729
|
if (selectedPaymentMethodId) {
|
|
@@ -25716,6 +25765,8 @@ const InvoiceDetailsView = props => {
|
|
|
25716
25765
|
invoice
|
|
25717
25766
|
} = usePelcro();
|
|
25718
25767
|
const showPayButton = canPayInvoice(invoice);
|
|
25768
|
+
const showDownloadButton = Boolean(invoice === null || invoice === void 0 ? void 0 : invoice.invoice_pdf);
|
|
25769
|
+
const hasPlanDetails = Boolean(invoice.plan);
|
|
25719
25770
|
const creationDate = new Date(invoice === null || invoice === void 0 ? void 0 : invoice.created_at);
|
|
25720
25771
|
const formattedCreationDate = new Intl.DateTimeFormat("en-CA").format(creationDate);
|
|
25721
25772
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
@@ -25733,7 +25784,7 @@ const InvoiceDetailsView = props => {
|
|
|
25733
25784
|
className: "plc-font-bold pelcro-invoice-summary-title"
|
|
25734
25785
|
}, t("labels.summary")), invoice && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("p", {
|
|
25735
25786
|
className: "plc-mr-2 pelcro-invoice-creation-date"
|
|
25736
|
-
}, `${t("labels.creationDate")} ${formattedCreationDate}`), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
25787
|
+
}, `${t("labels.creationDate")} ${formattedCreationDate}`), hasPlanDetails && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
25737
25788
|
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"
|
|
25738
25789
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
25739
25790
|
className: "plc-break-words pelcro-invoice-plan-name"
|
|
@@ -25759,7 +25810,7 @@ const InvoiceDetailsView = props => {
|
|
|
25759
25810
|
className: "plc-font-semibold pelcro-invoice-total"
|
|
25760
25811
|
}, getFormattedPriceByLocal(invoice.amount_remaining, invoice.currency, getPageOrDefaultLanguage())))))), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
25761
25812
|
className: "plc-flex plc-items-center plc-justify-center plc-mt-4"
|
|
25762
|
-
}, /*#__PURE__*/React__default['default'].createElement(InvoiceDetailsDownloadButton, {
|
|
25813
|
+
}, showDownloadButton && /*#__PURE__*/React__default['default'].createElement(InvoiceDetailsDownloadButton, {
|
|
25763
25814
|
url: invoice === null || invoice === void 0 ? void 0 : invoice.invoice_pdf,
|
|
25764
25815
|
className: "plc-w-full plc-text-center"
|
|
25765
25816
|
}), showPayButton && /*#__PURE__*/React__default['default'].createElement(InvoiceDetailsPayButton, {
|
package/dist/index.esm.js
CHANGED
|
@@ -4654,17 +4654,17 @@ var invoiceDetails_en = {
|
|
|
4654
4654
|
buttons: buttons$1
|
|
4655
4655
|
};
|
|
4656
4656
|
|
|
4657
|
-
var title$2 = "
|
|
4657
|
+
var title$2 = "Détails de la facture";
|
|
4658
4658
|
var labels = {
|
|
4659
|
-
summary: "
|
|
4659
|
+
summary: "Résumé",
|
|
4660
4660
|
total: "Total",
|
|
4661
|
-
amountPaid: "
|
|
4662
|
-
amountDue: "
|
|
4663
|
-
creationDate: "
|
|
4661
|
+
amountPaid: "Montant payé",
|
|
4662
|
+
amountDue: "Montant dû",
|
|
4663
|
+
creationDate: "Créé le:"
|
|
4664
4664
|
};
|
|
4665
4665
|
var buttons = {
|
|
4666
|
-
download: "
|
|
4667
|
-
pay: "
|
|
4666
|
+
download: "Télécharger",
|
|
4667
|
+
pay: "Payer"
|
|
4668
4668
|
};
|
|
4669
4669
|
var invoiceDetails_fr = {
|
|
4670
4670
|
title: title$2,
|
|
@@ -13570,8 +13570,11 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
13570
13570
|
updateTotalAmountWithTax();
|
|
13571
13571
|
}, []);
|
|
13572
13572
|
|
|
13573
|
-
const
|
|
13574
|
-
|
|
13573
|
+
const submitUsingVantiv = () => {
|
|
13574
|
+
const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
|
|
13575
|
+
|
|
13576
|
+
if (isUsingExistingPaymentMethod) {
|
|
13577
|
+
// no need to create a new source using vantiv
|
|
13575
13578
|
return handleVantivPayment(null);
|
|
13576
13579
|
}
|
|
13577
13580
|
|
|
@@ -13579,7 +13582,10 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
13579
13582
|
return console.error("Vantiv sdk script wasn't loaded, you need to load vantiv sdk before rendering the vantiv payment flow");
|
|
13580
13583
|
}
|
|
13581
13584
|
|
|
13582
|
-
const orderId = `pelcro-${new Date().getTime()}`;
|
|
13585
|
+
const orderId = `pelcro-${new Date().getTime()}`;
|
|
13586
|
+
/*
|
|
13587
|
+
calls handleVantivPayment to either handle a payment or update a source by simply creating a new source
|
|
13588
|
+
*/
|
|
13583
13589
|
|
|
13584
13590
|
vantivInstanceRef.current.getPaypageRegistrationId({
|
|
13585
13591
|
id: orderId,
|
|
@@ -13606,6 +13612,45 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
13606
13612
|
purchase(new VantivGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, state, dispatch);
|
|
13607
13613
|
} else if (type === "invoicePayment") {
|
|
13608
13614
|
payInvoice(new VantivGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, dispatch);
|
|
13615
|
+
} else if (type === "updatePaymentSource") {
|
|
13616
|
+
createNewVantivCard();
|
|
13617
|
+
}
|
|
13618
|
+
|
|
13619
|
+
function createNewVantivCard() {
|
|
13620
|
+
window.Pelcro.source.create({
|
|
13621
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
13622
|
+
token: paymentRequest,
|
|
13623
|
+
gateway: "vantiv"
|
|
13624
|
+
}, (err, res) => {
|
|
13625
|
+
dispatch({
|
|
13626
|
+
type: DISABLE_SUBMIT,
|
|
13627
|
+
payload: false
|
|
13628
|
+
});
|
|
13629
|
+
dispatch({
|
|
13630
|
+
type: LOADING,
|
|
13631
|
+
payload: false
|
|
13632
|
+
});
|
|
13633
|
+
|
|
13634
|
+
if (err) {
|
|
13635
|
+
onFailure(err);
|
|
13636
|
+
return dispatch({
|
|
13637
|
+
type: SHOW_ALERT,
|
|
13638
|
+
payload: {
|
|
13639
|
+
type: "error",
|
|
13640
|
+
content: getErrorMessages(err)
|
|
13641
|
+
}
|
|
13642
|
+
});
|
|
13643
|
+
}
|
|
13644
|
+
|
|
13645
|
+
dispatch({
|
|
13646
|
+
type: SHOW_ALERT,
|
|
13647
|
+
payload: {
|
|
13648
|
+
type: "success",
|
|
13649
|
+
content: t("messages.sourceUpdated")
|
|
13650
|
+
}
|
|
13651
|
+
});
|
|
13652
|
+
onSuccess(res);
|
|
13653
|
+
});
|
|
13609
13654
|
}
|
|
13610
13655
|
|
|
13611
13656
|
function handleVantivSubscription() {
|
|
@@ -14327,7 +14372,9 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
14327
14372
|
|
|
14328
14373
|
if ((source === null || source === void 0 ? void 0 : (_source$card2 = source.card) === null || _source$card2 === void 0 ? void 0 : _source$card2.three_d_secure) === "required") {
|
|
14329
14374
|
return handlePaymentError({
|
|
14330
|
-
|
|
14375
|
+
error: {
|
|
14376
|
+
message: t("messages.cardAuthNotSupported")
|
|
14377
|
+
}
|
|
14331
14378
|
});
|
|
14332
14379
|
}
|
|
14333
14380
|
|
|
@@ -14572,7 +14619,9 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
14572
14619
|
|
|
14573
14620
|
if ((source === null || source === void 0 ? void 0 : source.status) === "failed") {
|
|
14574
14621
|
return handlePaymentError({
|
|
14575
|
-
|
|
14622
|
+
error: {
|
|
14623
|
+
message: t("messages.cardAuthFailed")
|
|
14624
|
+
}
|
|
14576
14625
|
});
|
|
14577
14626
|
}
|
|
14578
14627
|
|
|
@@ -14644,7 +14693,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
14644
14693
|
isLoading: true
|
|
14645
14694
|
}, (state, dispatch) => {
|
|
14646
14695
|
if (getSiteCardProcessor() === "vantiv") {
|
|
14647
|
-
return
|
|
14696
|
+
return submitUsingVantiv();
|
|
14648
14697
|
}
|
|
14649
14698
|
|
|
14650
14699
|
if (selectedPaymentMethodId) {
|
|
@@ -25686,6 +25735,8 @@ const InvoiceDetailsView = props => {
|
|
|
25686
25735
|
invoice
|
|
25687
25736
|
} = usePelcro();
|
|
25688
25737
|
const showPayButton = canPayInvoice(invoice);
|
|
25738
|
+
const showDownloadButton = Boolean(invoice === null || invoice === void 0 ? void 0 : invoice.invoice_pdf);
|
|
25739
|
+
const hasPlanDetails = Boolean(invoice.plan);
|
|
25689
25740
|
const creationDate = new Date(invoice === null || invoice === void 0 ? void 0 : invoice.created_at);
|
|
25690
25741
|
const formattedCreationDate = new Intl.DateTimeFormat("en-CA").format(creationDate);
|
|
25691
25742
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -25703,7 +25754,7 @@ const InvoiceDetailsView = props => {
|
|
|
25703
25754
|
className: "plc-font-bold pelcro-invoice-summary-title"
|
|
25704
25755
|
}, t("labels.summary")), invoice && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("p", {
|
|
25705
25756
|
className: "plc-mr-2 pelcro-invoice-creation-date"
|
|
25706
|
-
}, `${t("labels.creationDate")} ${formattedCreationDate}`), /*#__PURE__*/React__default.createElement("div", {
|
|
25757
|
+
}, `${t("labels.creationDate")} ${formattedCreationDate}`), hasPlanDetails && /*#__PURE__*/React__default.createElement("div", {
|
|
25707
25758
|
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"
|
|
25708
25759
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
25709
25760
|
className: "plc-break-words pelcro-invoice-plan-name"
|
|
@@ -25729,7 +25780,7 @@ const InvoiceDetailsView = props => {
|
|
|
25729
25780
|
className: "plc-font-semibold pelcro-invoice-total"
|
|
25730
25781
|
}, getFormattedPriceByLocal(invoice.amount_remaining, invoice.currency, getPageOrDefaultLanguage())))))), /*#__PURE__*/React__default.createElement("div", {
|
|
25731
25782
|
className: "plc-flex plc-items-center plc-justify-center plc-mt-4"
|
|
25732
|
-
}, /*#__PURE__*/React__default.createElement(InvoiceDetailsDownloadButton, {
|
|
25783
|
+
}, showDownloadButton && /*#__PURE__*/React__default.createElement(InvoiceDetailsDownloadButton, {
|
|
25733
25784
|
url: invoice === null || invoice === void 0 ? void 0 : invoice.invoice_pdf,
|
|
25734
25785
|
className: "plc-w-full plc-text-center"
|
|
25735
25786
|
}), showPayButton && /*#__PURE__*/React__default.createElement(InvoiceDetailsPayButton, {
|