@pelcro/react-pelcro-js 3.2.0-beta.10 → 3.2.0-beta.11

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 CHANGED
@@ -4715,11 +4715,11 @@ var subscriptionOptions_en = {
4715
4715
  renew: renew$1
4716
4716
  };
4717
4717
 
4718
- var title = "Renewal options";
4719
- var subtitle = "Select one of the options below to continue";
4720
- var next = "Next";
4721
- var addNew = "Add Another Subscription";
4722
- var renew = "Renew Existing Subscription";
4718
+ var title = "Choix de renouvellement";
4719
+ var subtitle = "Veuillez choisir un des choix ci-dessous";
4720
+ var next = "Prochain";
4721
+ var addNew = "S'abonner à un autre forfait maintenant";
4722
+ var renew = "Renouveler l'abonnement actuel ";
4723
4723
  var subscriptionOptions_fr = {
4724
4724
  title: title,
4725
4725
  subtitle: subtitle,
@@ -15437,7 +15437,7 @@ const PaypalSubscribeButton = props => {
15437
15437
  const selectedAddress = getAddressById((_props$selectedAddres = props.selectedAddressId) !== null && _props$selectedAddres !== void 0 ? _props$selectedAddres : selectedAddressId); // initialize paypal client, then render paypal button.
15438
15438
 
15439
15439
  const initializePaypal = async () => {
15440
- var _props$buttonElementI, _props$product$addres, _props$product, _props$plan2;
15440
+ var _props$buttonElementI, _props$product$addres, _props$product;
15441
15441
 
15442
15442
  const paypalCheckoutInstance = new PaypalClient({
15443
15443
  buttonElementID: (_props$buttonElementI = props.buttonElementID) !== null && _props$buttonElementI !== void 0 ? _props$buttonElementI : "pelcro-paypal-button",
@@ -15447,12 +15447,33 @@ const PaypalSubscribeButton = props => {
15447
15447
  displayName: props.merchantDisplayName,
15448
15448
  locale: props.locale,
15449
15449
  billingAgreementDescription: props.billingDescription
15450
- }); // Await building paypal instance
15450
+ });
15451
+
15452
+ const getProduct = () => {
15453
+ if (invoice) {
15454
+ invoice.plan = null;
15455
+
15456
+ if (invoice.plan) {
15457
+ return invoice.plan;
15458
+ } else {
15459
+ // standalone invoices dont have a plan
15460
+ return {
15461
+ currency: invoice.currency,
15462
+ nickname: `invoice #${invoice.id}`
15463
+ };
15464
+ }
15465
+ } else if (props.plan) {
15466
+ return props.plan;
15467
+ } else {
15468
+ return plan;
15469
+ }
15470
+ }; // Await building paypal instance
15471
+
15451
15472
 
15452
15473
  await paypalCheckoutInstance.build(); // Create paypal payment
15453
15474
 
15454
15475
  paypalCheckoutInstance.createPayment({
15455
- product: invoice ? invoice.plan : (_props$plan2 = props.plan) !== null && _props$plan2 !== void 0 ? _props$plan2 : plan,
15476
+ product: getProduct(),
15456
15477
  amount: updatedPrice,
15457
15478
  address: invoice ? null : selectedAddress,
15458
15479
  onButtonClick: () => {
package/dist/index.esm.js CHANGED
@@ -4685,11 +4685,11 @@ var subscriptionOptions_en = {
4685
4685
  renew: renew$1
4686
4686
  };
4687
4687
 
4688
- var title = "Renewal options";
4689
- var subtitle = "Select one of the options below to continue";
4690
- var next = "Next";
4691
- var addNew = "Add Another Subscription";
4692
- var renew = "Renew Existing Subscription";
4688
+ var title = "Choix de renouvellement";
4689
+ var subtitle = "Veuillez choisir un des choix ci-dessous";
4690
+ var next = "Prochain";
4691
+ var addNew = "S'abonner à un autre forfait maintenant";
4692
+ var renew = "Renouveler l'abonnement actuel ";
4693
4693
  var subscriptionOptions_fr = {
4694
4694
  title: title,
4695
4695
  subtitle: subtitle,
@@ -15407,7 +15407,7 @@ const PaypalSubscribeButton = props => {
15407
15407
  const selectedAddress = getAddressById((_props$selectedAddres = props.selectedAddressId) !== null && _props$selectedAddres !== void 0 ? _props$selectedAddres : selectedAddressId); // initialize paypal client, then render paypal button.
15408
15408
 
15409
15409
  const initializePaypal = async () => {
15410
- var _props$buttonElementI, _props$product$addres, _props$product, _props$plan2;
15410
+ var _props$buttonElementI, _props$product$addres, _props$product;
15411
15411
 
15412
15412
  const paypalCheckoutInstance = new PaypalClient({
15413
15413
  buttonElementID: (_props$buttonElementI = props.buttonElementID) !== null && _props$buttonElementI !== void 0 ? _props$buttonElementI : "pelcro-paypal-button",
@@ -15417,12 +15417,33 @@ const PaypalSubscribeButton = props => {
15417
15417
  displayName: props.merchantDisplayName,
15418
15418
  locale: props.locale,
15419
15419
  billingAgreementDescription: props.billingDescription
15420
- }); // Await building paypal instance
15420
+ });
15421
+
15422
+ const getProduct = () => {
15423
+ if (invoice) {
15424
+ invoice.plan = null;
15425
+
15426
+ if (invoice.plan) {
15427
+ return invoice.plan;
15428
+ } else {
15429
+ // standalone invoices dont have a plan
15430
+ return {
15431
+ currency: invoice.currency,
15432
+ nickname: `invoice #${invoice.id}`
15433
+ };
15434
+ }
15435
+ } else if (props.plan) {
15436
+ return props.plan;
15437
+ } else {
15438
+ return plan;
15439
+ }
15440
+ }; // Await building paypal instance
15441
+
15421
15442
 
15422
15443
  await paypalCheckoutInstance.build(); // Create paypal payment
15423
15444
 
15424
15445
  paypalCheckoutInstance.createPayment({
15425
- product: invoice ? invoice.plan : (_props$plan2 = props.plan) !== null && _props$plan2 !== void 0 ? _props$plan2 : plan,
15446
+ product: getProduct(),
15426
15447
  amount: updatedPrice,
15427
15448
  address: invoice ? null : selectedAddress,
15428
15449
  onButtonClick: () => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pelcro/react-pelcro-js",
3
3
  "description": "Pelcro's React UI Elements",
4
- "version": "3.2.0-beta.10",
4
+ "version": "3.2.0-beta.11",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",