@pelcro/react-pelcro-js 3.0.0-beta.11 → 3.0.0-beta.12
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 +33 -15
- package/dist/index.esm.js +33 -15
- 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 = {
|
|
@@ -9154,6 +9158,17 @@ const showInvoiceDetailsFromUrl = () => {
|
|
|
9154
9158
|
return notify.error(errorMessage);
|
|
9155
9159
|
}
|
|
9156
9160
|
|
|
9161
|
+
const {
|
|
9162
|
+
invoice
|
|
9163
|
+
} = usePelcro.getStore();
|
|
9164
|
+
|
|
9165
|
+
if (invoice.total === 0) {
|
|
9166
|
+
const errorMessage = i18next.t("messages:zeroTotalInvoice", {
|
|
9167
|
+
returnObjects: true
|
|
9168
|
+
});
|
|
9169
|
+
return notify.error(errorMessage);
|
|
9170
|
+
}
|
|
9171
|
+
|
|
9157
9172
|
return switchView("invoice-details");
|
|
9158
9173
|
});
|
|
9159
9174
|
};
|
|
@@ -12810,6 +12825,7 @@ class Subscription {
|
|
|
12810
12825
|
* @property {number} [quantity]
|
|
12811
12826
|
* @property {string} addressId
|
|
12812
12827
|
* @property {number} invoiceId
|
|
12828
|
+
* @property {boolean} isExistingSource
|
|
12813
12829
|
*/
|
|
12814
12830
|
|
|
12815
12831
|
/**
|
|
@@ -12995,11 +13011,15 @@ class StripeGateway {
|
|
|
12995
13011
|
token,
|
|
12996
13012
|
invoiceId
|
|
12997
13013
|
} = options;
|
|
12998
|
-
|
|
13014
|
+
const params = options.isExistingSource ? {
|
|
13015
|
+
source_id: token,
|
|
13016
|
+
invoice_id: invoiceId
|
|
13017
|
+
} : {
|
|
12999
13018
|
payment_gateway: _classPrivateFieldGet(this, _paymentGateway),
|
|
13000
13019
|
gateway_token: token,
|
|
13001
13020
|
invoice_id: invoiceId
|
|
13002
|
-
}
|
|
13021
|
+
};
|
|
13022
|
+
window.Pelcro.invoice.pay(params, (err, res) => {
|
|
13003
13023
|
callback(err, res);
|
|
13004
13024
|
});
|
|
13005
13025
|
}
|
|
@@ -13889,6 +13909,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
13889
13909
|
return subscription.execute({
|
|
13890
13910
|
type: SUBSCRIPTION_TYPES.PAY_INVOICE,
|
|
13891
13911
|
token: gatewayToken,
|
|
13912
|
+
isExistingSource: Boolean(selectedPaymentMethodId),
|
|
13892
13913
|
invoiceId: invoice.id
|
|
13893
13914
|
}, (err, res) => {
|
|
13894
13915
|
dispatch({
|
|
@@ -13911,9 +13932,6 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
13911
13932
|
});
|
|
13912
13933
|
}
|
|
13913
13934
|
|
|
13914
|
-
set({
|
|
13915
|
-
invoice: null
|
|
13916
|
-
});
|
|
13917
13935
|
onSuccess(res);
|
|
13918
13936
|
});
|
|
13919
13937
|
};
|
|
@@ -14271,7 +14289,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
14271
14289
|
case HANDLE_PAYPAL_SUBSCRIPTION:
|
|
14272
14290
|
return lib_5(state, (state, dispatch) => {
|
|
14273
14291
|
if (type === "invoicePayment") {
|
|
14274
|
-
payInvoice(new
|
|
14292
|
+
payInvoice(new PaypalGateway(), action.payload, dispatch);
|
|
14275
14293
|
} else {
|
|
14276
14294
|
handlePaypalSubscription(state, action.payload);
|
|
14277
14295
|
}
|
|
@@ -22405,7 +22423,7 @@ const InvoicesMenu = props => {
|
|
|
22405
22423
|
};
|
|
22406
22424
|
|
|
22407
22425
|
const InvoicesItems = () => {
|
|
22408
|
-
var _window$Pelcro$invoic;
|
|
22426
|
+
var _window$Pelcro$invoic, _window$Pelcro$invoic2;
|
|
22409
22427
|
|
|
22410
22428
|
const {
|
|
22411
22429
|
t
|
|
@@ -22414,7 +22432,7 @@ const InvoicesItems = () => {
|
|
|
22414
22432
|
setInvoice,
|
|
22415
22433
|
switchView
|
|
22416
22434
|
} = usePelcro();
|
|
22417
|
-
const invoices = (_window$Pelcro$invoic = window.Pelcro.invoice.list()) !== null && _window$Pelcro$invoic !== void 0 ? _window$Pelcro$invoic : [];
|
|
22435
|
+
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 : [];
|
|
22418
22436
|
|
|
22419
22437
|
const showInvoiceDetails = event => {
|
|
22420
22438
|
if (setInvoice(event.target.dataset.id)) {
|
|
@@ -23090,9 +23108,9 @@ class Dashboard extends React.Component {
|
|
|
23090
23108
|
}
|
|
23091
23109
|
|
|
23092
23110
|
function hasInvoices() {
|
|
23093
|
-
var _window$Pelcro$invoic;
|
|
23111
|
+
var _window$Pelcro$invoic, _window$Pelcro$invoic2;
|
|
23094
23112
|
|
|
23095
|
-
const invoices = (_window$Pelcro$invoic = window.Pelcro.invoice.list()) !== null && _window$Pelcro$invoic !== void 0 ? _window$Pelcro$invoic : [];
|
|
23113
|
+
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 : [];
|
|
23096
23114
|
return invoices.length > 0;
|
|
23097
23115
|
}
|
|
23098
23116
|
|
|
@@ -25287,11 +25305,11 @@ const InvoiceDetailsView = props => {
|
|
|
25287
25305
|
}, t("labels.summary")), invoice && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("p", {
|
|
25288
25306
|
className: "plc-mr-2 pelcro-invoice-creation-date"
|
|
25289
25307
|
}, `${t("labels.creationDate")} ${formattedCreationDate}`), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
25290
|
-
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-
|
|
25308
|
+
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"
|
|
25291
25309
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
25292
|
-
className: "plc-
|
|
25310
|
+
className: "plc-break-words pelcro-invoice-plan-name"
|
|
25293
25311
|
}, invoice.plan.nickname), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
25294
|
-
className: "plc-
|
|
25312
|
+
className: "plc-text-center pelcro-invoice-summary-price"
|
|
25295
25313
|
}, calcAndFormatItemsTotal([invoice.plan], invoice.currency))), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
25296
25314
|
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"
|
|
25297
25315
|
}, /*#__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 = {
|
|
@@ -9124,6 +9128,17 @@ const showInvoiceDetailsFromUrl = () => {
|
|
|
9124
9128
|
return notify.error(errorMessage);
|
|
9125
9129
|
}
|
|
9126
9130
|
|
|
9131
|
+
const {
|
|
9132
|
+
invoice
|
|
9133
|
+
} = usePelcro.getStore();
|
|
9134
|
+
|
|
9135
|
+
if (invoice.total === 0) {
|
|
9136
|
+
const errorMessage = i18next.t("messages:zeroTotalInvoice", {
|
|
9137
|
+
returnObjects: true
|
|
9138
|
+
});
|
|
9139
|
+
return notify.error(errorMessage);
|
|
9140
|
+
}
|
|
9141
|
+
|
|
9127
9142
|
return switchView("invoice-details");
|
|
9128
9143
|
});
|
|
9129
9144
|
};
|
|
@@ -12780,6 +12795,7 @@ class Subscription {
|
|
|
12780
12795
|
* @property {number} [quantity]
|
|
12781
12796
|
* @property {string} addressId
|
|
12782
12797
|
* @property {number} invoiceId
|
|
12798
|
+
* @property {boolean} isExistingSource
|
|
12783
12799
|
*/
|
|
12784
12800
|
|
|
12785
12801
|
/**
|
|
@@ -12965,11 +12981,15 @@ class StripeGateway {
|
|
|
12965
12981
|
token,
|
|
12966
12982
|
invoiceId
|
|
12967
12983
|
} = options;
|
|
12968
|
-
|
|
12984
|
+
const params = options.isExistingSource ? {
|
|
12985
|
+
source_id: token,
|
|
12986
|
+
invoice_id: invoiceId
|
|
12987
|
+
} : {
|
|
12969
12988
|
payment_gateway: _classPrivateFieldGet(this, _paymentGateway),
|
|
12970
12989
|
gateway_token: token,
|
|
12971
12990
|
invoice_id: invoiceId
|
|
12972
|
-
}
|
|
12991
|
+
};
|
|
12992
|
+
window.Pelcro.invoice.pay(params, (err, res) => {
|
|
12973
12993
|
callback(err, res);
|
|
12974
12994
|
});
|
|
12975
12995
|
}
|
|
@@ -13859,6 +13879,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
13859
13879
|
return subscription.execute({
|
|
13860
13880
|
type: SUBSCRIPTION_TYPES.PAY_INVOICE,
|
|
13861
13881
|
token: gatewayToken,
|
|
13882
|
+
isExistingSource: Boolean(selectedPaymentMethodId),
|
|
13862
13883
|
invoiceId: invoice.id
|
|
13863
13884
|
}, (err, res) => {
|
|
13864
13885
|
dispatch({
|
|
@@ -13881,9 +13902,6 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
13881
13902
|
});
|
|
13882
13903
|
}
|
|
13883
13904
|
|
|
13884
|
-
set({
|
|
13885
|
-
invoice: null
|
|
13886
|
-
});
|
|
13887
13905
|
onSuccess(res);
|
|
13888
13906
|
});
|
|
13889
13907
|
};
|
|
@@ -14241,7 +14259,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
14241
14259
|
case HANDLE_PAYPAL_SUBSCRIPTION:
|
|
14242
14260
|
return lib_5(state, (state, dispatch) => {
|
|
14243
14261
|
if (type === "invoicePayment") {
|
|
14244
|
-
payInvoice(new
|
|
14262
|
+
payInvoice(new PaypalGateway(), action.payload, dispatch);
|
|
14245
14263
|
} else {
|
|
14246
14264
|
handlePaypalSubscription(state, action.payload);
|
|
14247
14265
|
}
|
|
@@ -22375,7 +22393,7 @@ const InvoicesMenu = props => {
|
|
|
22375
22393
|
};
|
|
22376
22394
|
|
|
22377
22395
|
const InvoicesItems = () => {
|
|
22378
|
-
var _window$Pelcro$invoic;
|
|
22396
|
+
var _window$Pelcro$invoic, _window$Pelcro$invoic2;
|
|
22379
22397
|
|
|
22380
22398
|
const {
|
|
22381
22399
|
t
|
|
@@ -22384,7 +22402,7 @@ const InvoicesItems = () => {
|
|
|
22384
22402
|
setInvoice,
|
|
22385
22403
|
switchView
|
|
22386
22404
|
} = usePelcro();
|
|
22387
|
-
const invoices = (_window$Pelcro$invoic = window.Pelcro.invoice.list()) !== null && _window$Pelcro$invoic !== void 0 ? _window$Pelcro$invoic : [];
|
|
22405
|
+
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 : [];
|
|
22388
22406
|
|
|
22389
22407
|
const showInvoiceDetails = event => {
|
|
22390
22408
|
if (setInvoice(event.target.dataset.id)) {
|
|
@@ -23060,9 +23078,9 @@ class Dashboard extends Component {
|
|
|
23060
23078
|
}
|
|
23061
23079
|
|
|
23062
23080
|
function hasInvoices() {
|
|
23063
|
-
var _window$Pelcro$invoic;
|
|
23081
|
+
var _window$Pelcro$invoic, _window$Pelcro$invoic2;
|
|
23064
23082
|
|
|
23065
|
-
const invoices = (_window$Pelcro$invoic = window.Pelcro.invoice.list()) !== null && _window$Pelcro$invoic !== void 0 ? _window$Pelcro$invoic : [];
|
|
23083
|
+
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 : [];
|
|
23066
23084
|
return invoices.length > 0;
|
|
23067
23085
|
}
|
|
23068
23086
|
|
|
@@ -25257,11 +25275,11 @@ const InvoiceDetailsView = props => {
|
|
|
25257
25275
|
}, t("labels.summary")), invoice && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("p", {
|
|
25258
25276
|
className: "plc-mr-2 pelcro-invoice-creation-date"
|
|
25259
25277
|
}, `${t("labels.creationDate")} ${formattedCreationDate}`), /*#__PURE__*/React__default.createElement("div", {
|
|
25260
|
-
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-
|
|
25278
|
+
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"
|
|
25261
25279
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
25262
|
-
className: "plc-
|
|
25280
|
+
className: "plc-break-words pelcro-invoice-plan-name"
|
|
25263
25281
|
}, invoice.plan.nickname), /*#__PURE__*/React__default.createElement("div", {
|
|
25264
|
-
className: "plc-
|
|
25282
|
+
className: "plc-text-center pelcro-invoice-summary-price"
|
|
25265
25283
|
}, calcAndFormatItemsTotal([invoice.plan], invoice.currency))), /*#__PURE__*/React__default.createElement("div", {
|
|
25266
25284
|
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"
|
|
25267
25285
|
}, /*#__PURE__*/React__default.createElement("div", {
|