@pelcro/react-pelcro-js 3.52.0 → 3.54.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
@@ -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) {
package/dist/index.esm.js CHANGED
@@ -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) {
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.54.0",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",