@pelcro/react-pelcro-js 3.52.0 → 3.55.0

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
@@ -4087,7 +4087,7 @@ var labels$R = {
4087
4087
  cancelReason: "Cancellation reason",
4088
4088
  endOn: "End on",
4089
4089
  endImmediately: "End immediately",
4090
- cancel: "Cancel",
4090
+ cancel: "Cancel subscription",
4091
4091
  subCancellation: {
4092
4092
  goBack: "Go back"
4093
4093
  }
@@ -18672,7 +18672,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18672
18672
  payload: true
18673
18673
  });
18674
18674
  try {
18675
- var _window$Pelcro$site$r7, _window$Pelcro$site$r8;
18675
+ var _window$Pelcro$site$r7, _window$Pelcro$site$r8, _window$Pelcro$site$r9;
18676
18676
  // Ensure the DOM element exists before creating Drop-in UI
18677
18677
  const dropinContainer = document.querySelector("#dropin-container");
18678
18678
  if (!dropinContainer) {
@@ -18727,22 +18727,25 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18727
18727
  // Enable Google Pay for both orders and subscriptions
18728
18728
  googlePay: {
18729
18729
  googlePayVersion: 2,
18730
- merchantId: (_window$Pelcro$site$r8 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r8 === void 0 ? void 0 : _window$Pelcro$site$r8.google_merchant_id,
18730
+ merchantId: (_window$Pelcro$site$r8 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r8 === void 0 ? void 0 : (_window$Pelcro$site$r9 = _window$Pelcro$site$r8.braintree_gateway_settings) === null || _window$Pelcro$site$r9 === void 0 ? void 0 : _window$Pelcro$site$r9.google_pay_merchant_id,
18731
18731
  transactionInfo: {
18732
18732
  totalPriceStatus: "FINAL",
18733
18733
  totalPrice: googlePayAmount,
18734
18734
  currencyCode: (() => {
18735
18735
  const currency = getCurrencyFromPaymentType(plan, order, invoice);
18736
18736
  return (currency === null || currency === void 0 ? void 0 : currency.toUpperCase()) || "USD";
18737
- })()
18737
+ })(),
18738
+ countryCode: "US" // Required for production Google Pay
18738
18739
  },
18740
+
18739
18741
  // Add button configuration
18740
18742
  button: {
18741
18743
  color: "black",
18742
- type: type === "createPayment" ? "subscribe" : "buy"
18744
+ type: "buy" // Always use "buy" - "subscribe" type causes OR_BIBED_11 error
18743
18745
  }
18744
18746
  }
18745
18747
  });
18748
+
18746
18749
  console.log("Setting skeleton loader to false after successful Braintree initialization");
18747
18750
  dispatch({
18748
18751
  type: SKELETON_LOADER,
@@ -18758,11 +18761,11 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18758
18761
  }
18759
18762
  });
18760
18763
  } catch (error) {
18761
- var _error$message, _error$message2, _error$message3, _error$message4;
18764
+ var _error$message, _error$message2, _error$message3, _error$message4, _error$message5, _error$message6;
18762
18765
  console.error("Failed to initialize Braintree Drop-in UI:", error);
18763
18766
 
18764
18767
  // Check if it's a Google Pay specific error
18765
- if (error !== null && error !== void 0 && (_error$message = error.message) !== null && _error$message !== void 0 && _error$message.includes("OR_BIBED_06") || error !== null && error !== void 0 && (_error$message2 = error.message) !== null && _error$message2 !== void 0 && _error$message2.includes("Google Pay")) {
18768
+ if (error !== null && error !== void 0 && (_error$message = error.message) !== null && _error$message !== void 0 && _error$message.includes("OR_BIBED_06") || error !== null && error !== void 0 && (_error$message2 = error.message) !== null && _error$message2 !== void 0 && _error$message2.includes("OR_BIBED_11") || error !== null && error !== void 0 && (_error$message3 = error.message) !== null && _error$message3 !== void 0 && _error$message3.includes("Google Pay")) {
18766
18769
  console.warn("Google Pay configuration issue detected. " + `Transaction type: ${type}. ` + "This might be due to merchant settings or unsupported payment flow.");
18767
18770
  }
18768
18771
  dispatch({
@@ -18772,7 +18775,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18772
18775
 
18773
18776
  // Don't show error to user for Google Pay configuration issues
18774
18777
  // as it's expected for subscriptions
18775
- if (!(error !== null && error !== void 0 && (_error$message3 = error.message) !== null && _error$message3 !== void 0 && _error$message3.includes("OR_BIBED_06")) && !(error !== null && error !== void 0 && (_error$message4 = error.message) !== null && _error$message4 !== void 0 && _error$message4.includes("Google Pay"))) {
18778
+ if (!(error !== null && error !== void 0 && (_error$message4 = error.message) !== null && _error$message4 !== void 0 && _error$message4.includes("OR_BIBED_06")) && !(error !== null && error !== void 0 && (_error$message5 = error.message) !== null && _error$message5 !== void 0 && _error$message5.includes("OR_BIBED_11")) && !(error !== null && error !== void 0 && (_error$message6 = error.message) !== null && _error$message6 !== void 0 && _error$message6.includes("Google Pay"))) {
18776
18779
  dispatch({
18777
18780
  type: SHOW_ALERT,
18778
18781
  payload: {
@@ -19471,9 +19474,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
19471
19474
  React.useEffect(() => {
19472
19475
  if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || props !== null && props !== void 0 && props.freeOrders)) return;
19473
19476
  if (cardProcessor === "vantiv" && !selectedPaymentMethodId) {
19474
- var _window$Pelcro$site$r9, _window$Pelcro$site$r10;
19475
- const payPageId = (_window$Pelcro$site$r9 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r9 === void 0 ? void 0 : _window$Pelcro$site$r9.vantiv_gateway_settings.pay_page_id;
19476
- const reportGroup = (_window$Pelcro$site$r10 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r10 === void 0 ? void 0 : _window$Pelcro$site$r10.vantiv_gateway_settings.report_group;
19477
+ var _window$Pelcro$site$r10, _window$Pelcro$site$r11;
19478
+ const payPageId = (_window$Pelcro$site$r10 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r10 === void 0 ? void 0 : _window$Pelcro$site$r10.vantiv_gateway_settings.pay_page_id;
19479
+ const reportGroup = (_window$Pelcro$site$r11 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r11 === void 0 ? void 0 : _window$Pelcro$site$r11.vantiv_gateway_settings.report_group;
19477
19480
  vantivInstanceRef.current = new window.EprotectIframeClient({
19478
19481
  paypageId: payPageId,
19479
19482
  reportGroup: reportGroup,
@@ -19593,9 +19596,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
19593
19596
  * Updates the total amount after adding taxes only if site taxes are enabled
19594
19597
  */
19595
19598
  const updateTotalAmountWithTax = () => {
19596
- var _window$Pelcro$site$r11;
19599
+ var _window$Pelcro$site$r12;
19597
19600
  if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || props !== null && props !== void 0 && props.freeOrders)) return;
19598
- const taxesEnabled = (_window$Pelcro$site$r11 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r11 === void 0 ? void 0 : _window$Pelcro$site$r11.taxes_enabled;
19601
+ const taxesEnabled = (_window$Pelcro$site$r12 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r12 === void 0 ? void 0 : _window$Pelcro$site$r12.taxes_enabled;
19599
19602
  if (taxesEnabled && type === "createPayment") {
19600
19603
  dispatch({
19601
19604
  type: DISABLE_SUBMIT,
@@ -20542,11 +20545,11 @@ const PaymentMethodContainerWithoutStripe = _ref => {
20542
20545
  * @return {Promise}
20543
20546
  */
20544
20547
  const resolveTaxCalculation = () => {
20545
- var _window$Pelcro$site$r12;
20548
+ var _window$Pelcro$site$r13;
20546
20549
  if (type === "invoicePayment") {
20547
20550
  return new Promise(resolve => resolve());
20548
20551
  }
20549
- const taxesEnabled = (_window$Pelcro$site$r12 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r12 === void 0 ? void 0 : _window$Pelcro$site$r12.taxes_enabled;
20552
+ const taxesEnabled = (_window$Pelcro$site$r13 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r13 === void 0 ? void 0 : _window$Pelcro$site$r13.taxes_enabled;
20550
20553
  return new Promise((resolve, reject) => {
20551
20554
  // resolve early if taxes isn't enabled
20552
20555
  if (!taxesEnabled) {
@@ -22907,13 +22910,13 @@ const SubscriptionCancelView = props => {
22907
22910
  subscription: subscriptionToCancel,
22908
22911
  hasPhases: hasPhases
22909
22912
  }), /*#__PURE__*/React__default['default'].createElement(SubscriptionCancelReason, null), /*#__PURE__*/React__default['default'].createElement("div", {
22910
- 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"
22913
+ className: "plc-gap-3 plc-w-full plc-flex plc-flex-row plc-items-center plc-justify-center"
22911
22914
  }, /*#__PURE__*/React__default['default'].createElement(SubscriptionCancelButton, {
22912
- className: "plc-w-3/4 md:plc-w-2/5",
22915
+ className: "plc-whitespace-nowrap",
22913
22916
  subscription: subscriptionToCancel
22914
22917
  }), /*#__PURE__*/React__default['default'].createElement(Button, {
22915
22918
  variant: "outline",
22916
- className: "plc-w-3/4 md:plc-w-2/5",
22919
+ className: "plc-whitespace-nowrap",
22917
22920
  onClick: () => {
22918
22921
  switchView("dashboard");
22919
22922
  }
package/dist/index.esm.js CHANGED
@@ -4057,7 +4057,7 @@ var labels$R = {
4057
4057
  cancelReason: "Cancellation reason",
4058
4058
  endOn: "End on",
4059
4059
  endImmediately: "End immediately",
4060
- cancel: "Cancel",
4060
+ cancel: "Cancel subscription",
4061
4061
  subCancellation: {
4062
4062
  goBack: "Go back"
4063
4063
  }
@@ -18642,7 +18642,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18642
18642
  payload: true
18643
18643
  });
18644
18644
  try {
18645
- var _window$Pelcro$site$r7, _window$Pelcro$site$r8;
18645
+ var _window$Pelcro$site$r7, _window$Pelcro$site$r8, _window$Pelcro$site$r9;
18646
18646
  // Ensure the DOM element exists before creating Drop-in UI
18647
18647
  const dropinContainer = document.querySelector("#dropin-container");
18648
18648
  if (!dropinContainer) {
@@ -18697,22 +18697,25 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18697
18697
  // Enable Google Pay for both orders and subscriptions
18698
18698
  googlePay: {
18699
18699
  googlePayVersion: 2,
18700
- merchantId: (_window$Pelcro$site$r8 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r8 === void 0 ? void 0 : _window$Pelcro$site$r8.google_merchant_id,
18700
+ merchantId: (_window$Pelcro$site$r8 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r8 === void 0 ? void 0 : (_window$Pelcro$site$r9 = _window$Pelcro$site$r8.braintree_gateway_settings) === null || _window$Pelcro$site$r9 === void 0 ? void 0 : _window$Pelcro$site$r9.google_pay_merchant_id,
18701
18701
  transactionInfo: {
18702
18702
  totalPriceStatus: "FINAL",
18703
18703
  totalPrice: googlePayAmount,
18704
18704
  currencyCode: (() => {
18705
18705
  const currency = getCurrencyFromPaymentType(plan, order, invoice);
18706
18706
  return (currency === null || currency === void 0 ? void 0 : currency.toUpperCase()) || "USD";
18707
- })()
18707
+ })(),
18708
+ countryCode: "US" // Required for production Google Pay
18708
18709
  },
18710
+
18709
18711
  // Add button configuration
18710
18712
  button: {
18711
18713
  color: "black",
18712
- type: type === "createPayment" ? "subscribe" : "buy"
18714
+ type: "buy" // Always use "buy" - "subscribe" type causes OR_BIBED_11 error
18713
18715
  }
18714
18716
  }
18715
18717
  });
18718
+
18716
18719
  console.log("Setting skeleton loader to false after successful Braintree initialization");
18717
18720
  dispatch({
18718
18721
  type: SKELETON_LOADER,
@@ -18728,11 +18731,11 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18728
18731
  }
18729
18732
  });
18730
18733
  } catch (error) {
18731
- var _error$message, _error$message2, _error$message3, _error$message4;
18734
+ var _error$message, _error$message2, _error$message3, _error$message4, _error$message5, _error$message6;
18732
18735
  console.error("Failed to initialize Braintree Drop-in UI:", error);
18733
18736
 
18734
18737
  // Check if it's a Google Pay specific error
18735
- if (error !== null && error !== void 0 && (_error$message = error.message) !== null && _error$message !== void 0 && _error$message.includes("OR_BIBED_06") || error !== null && error !== void 0 && (_error$message2 = error.message) !== null && _error$message2 !== void 0 && _error$message2.includes("Google Pay")) {
18738
+ if (error !== null && error !== void 0 && (_error$message = error.message) !== null && _error$message !== void 0 && _error$message.includes("OR_BIBED_06") || error !== null && error !== void 0 && (_error$message2 = error.message) !== null && _error$message2 !== void 0 && _error$message2.includes("OR_BIBED_11") || error !== null && error !== void 0 && (_error$message3 = error.message) !== null && _error$message3 !== void 0 && _error$message3.includes("Google Pay")) {
18736
18739
  console.warn("Google Pay configuration issue detected. " + `Transaction type: ${type}. ` + "This might be due to merchant settings or unsupported payment flow.");
18737
18740
  }
18738
18741
  dispatch({
@@ -18742,7 +18745,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18742
18745
 
18743
18746
  // Don't show error to user for Google Pay configuration issues
18744
18747
  // as it's expected for subscriptions
18745
- if (!(error !== null && error !== void 0 && (_error$message3 = error.message) !== null && _error$message3 !== void 0 && _error$message3.includes("OR_BIBED_06")) && !(error !== null && error !== void 0 && (_error$message4 = error.message) !== null && _error$message4 !== void 0 && _error$message4.includes("Google Pay"))) {
18748
+ if (!(error !== null && error !== void 0 && (_error$message4 = error.message) !== null && _error$message4 !== void 0 && _error$message4.includes("OR_BIBED_06")) && !(error !== null && error !== void 0 && (_error$message5 = error.message) !== null && _error$message5 !== void 0 && _error$message5.includes("OR_BIBED_11")) && !(error !== null && error !== void 0 && (_error$message6 = error.message) !== null && _error$message6 !== void 0 && _error$message6.includes("Google Pay"))) {
18746
18749
  dispatch({
18747
18750
  type: SHOW_ALERT,
18748
18751
  payload: {
@@ -19441,9 +19444,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
19441
19444
  useEffect(() => {
19442
19445
  if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || props !== null && props !== void 0 && props.freeOrders)) return;
19443
19446
  if (cardProcessor === "vantiv" && !selectedPaymentMethodId) {
19444
- var _window$Pelcro$site$r9, _window$Pelcro$site$r10;
19445
- const payPageId = (_window$Pelcro$site$r9 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r9 === void 0 ? void 0 : _window$Pelcro$site$r9.vantiv_gateway_settings.pay_page_id;
19446
- const reportGroup = (_window$Pelcro$site$r10 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r10 === void 0 ? void 0 : _window$Pelcro$site$r10.vantiv_gateway_settings.report_group;
19447
+ var _window$Pelcro$site$r10, _window$Pelcro$site$r11;
19448
+ const payPageId = (_window$Pelcro$site$r10 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r10 === void 0 ? void 0 : _window$Pelcro$site$r10.vantiv_gateway_settings.pay_page_id;
19449
+ const reportGroup = (_window$Pelcro$site$r11 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r11 === void 0 ? void 0 : _window$Pelcro$site$r11.vantiv_gateway_settings.report_group;
19447
19450
  vantivInstanceRef.current = new window.EprotectIframeClient({
19448
19451
  paypageId: payPageId,
19449
19452
  reportGroup: reportGroup,
@@ -19563,9 +19566,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
19563
19566
  * Updates the total amount after adding taxes only if site taxes are enabled
19564
19567
  */
19565
19568
  const updateTotalAmountWithTax = () => {
19566
- var _window$Pelcro$site$r11;
19569
+ var _window$Pelcro$site$r12;
19567
19570
  if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || props !== null && props !== void 0 && props.freeOrders)) return;
19568
- const taxesEnabled = (_window$Pelcro$site$r11 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r11 === void 0 ? void 0 : _window$Pelcro$site$r11.taxes_enabled;
19571
+ const taxesEnabled = (_window$Pelcro$site$r12 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r12 === void 0 ? void 0 : _window$Pelcro$site$r12.taxes_enabled;
19569
19572
  if (taxesEnabled && type === "createPayment") {
19570
19573
  dispatch({
19571
19574
  type: DISABLE_SUBMIT,
@@ -20512,11 +20515,11 @@ const PaymentMethodContainerWithoutStripe = _ref => {
20512
20515
  * @return {Promise}
20513
20516
  */
20514
20517
  const resolveTaxCalculation = () => {
20515
- var _window$Pelcro$site$r12;
20518
+ var _window$Pelcro$site$r13;
20516
20519
  if (type === "invoicePayment") {
20517
20520
  return new Promise(resolve => resolve());
20518
20521
  }
20519
- const taxesEnabled = (_window$Pelcro$site$r12 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r12 === void 0 ? void 0 : _window$Pelcro$site$r12.taxes_enabled;
20522
+ const taxesEnabled = (_window$Pelcro$site$r13 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r13 === void 0 ? void 0 : _window$Pelcro$site$r13.taxes_enabled;
20520
20523
  return new Promise((resolve, reject) => {
20521
20524
  // resolve early if taxes isn't enabled
20522
20525
  if (!taxesEnabled) {
@@ -22877,13 +22880,13 @@ const SubscriptionCancelView = props => {
22877
22880
  subscription: subscriptionToCancel,
22878
22881
  hasPhases: hasPhases
22879
22882
  }), /*#__PURE__*/React__default.createElement(SubscriptionCancelReason, null), /*#__PURE__*/React__default.createElement("div", {
22880
- 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"
22883
+ className: "plc-gap-3 plc-w-full plc-flex plc-flex-row plc-items-center plc-justify-center"
22881
22884
  }, /*#__PURE__*/React__default.createElement(SubscriptionCancelButton, {
22882
- className: "plc-w-3/4 md:plc-w-2/5",
22885
+ className: "plc-whitespace-nowrap",
22883
22886
  subscription: subscriptionToCancel
22884
22887
  }), /*#__PURE__*/React__default.createElement(Button, {
22885
22888
  variant: "outline",
22886
- className: "plc-w-3/4 md:plc-w-2/5",
22889
+ className: "plc-whitespace-nowrap",
22887
22890
  onClick: () => {
22888
22891
  switchView("dashboard");
22889
22892
  }
package/dist/pelcro.css CHANGED
@@ -2983,6 +2983,10 @@ apple-pay-button {
2983
2983
  vertical-align: middle;
2984
2984
  }
2985
2985
 
2986
+ .pelcro-root .plc-whitespace-nowrap {
2987
+ white-space: nowrap;
2988
+ }
2989
+
2986
2990
  .pelcro-root .plc-whitespace-pre-line {
2987
2991
  white-space: pre-line;
2988
2992
  }
@@ -3115,6 +3119,10 @@ apple-pay-button {
3115
3119
  z-index: 999999;
3116
3120
  }
3117
3121
 
3122
+ .pelcro-root .plc-gap-3 {
3123
+ gap: 0.75rem;
3124
+ }
3125
+
3118
3126
  .pelcro-root .plc-gap-x-3 {
3119
3127
  column-gap: 0.75rem;
3120
3128
  }
@@ -3324,25 +3332,6 @@ apple-pay-button {
3324
3332
  }
3325
3333
 
3326
3334
  @media (min-width: 768px) {
3327
- .pelcro-root .md\:plc-space-y-0 > :not([hidden]) ~ :not([hidden]) {
3328
- --tw-space-y-reverse: 0;
3329
- margin-top: calc(0px * calc(1 - var(--tw-space-y-reverse)));
3330
- margin-bottom: calc(0px * var(--tw-space-y-reverse));
3331
- }
3332
-
3333
- .pelcro-root .md\:plc-space-x-3 > :not([hidden]) ~ :not([hidden]) {
3334
- --tw-space-x-reverse: 0;
3335
- margin-right: calc(0.75rem * var(--tw-space-x-reverse));
3336
- margin-left: calc(0.75rem * calc(1 - var(--tw-space-x-reverse)));
3337
- }
3338
-
3339
- .pelcro-root .md\:plc-flex-row {
3340
- flex-direction: row;
3341
- }
3342
-
3343
- .pelcro-root .md\:plc-w-2\/5 {
3344
- width: 40%;
3345
- }
3346
3335
  }
3347
3336
 
3348
3337
  @media (min-width: 1024px) {
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.52.0",
4
+ "version": "3.55.0",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",