@pelcro/react-pelcro-js 4.0.0-alpha.73 → 4.0.0-alpha.74

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
@@ -25262,7 +25262,8 @@ const PaymentMethodContainer = props => {
25262
25262
 
25263
25263
  const [isStripeLoaded, setIsStripeLoaded] = React.useState(Boolean(window.Stripe));
25264
25264
  const {
25265
- whenUserReady
25265
+ whenUserReady,
25266
+ selectedPaymentMethodId
25266
25267
  } = usePelcro.getStore();
25267
25268
  const cardProcessor = getSiteCardProcessor(); // Create the Stripe object
25268
25269
 
@@ -25284,7 +25285,7 @@ const PaymentMethodContainer = props => {
25284
25285
  loader: "always"
25285
25286
  };
25286
25287
  React.useEffect(() => {
25287
- if (isStripeLoaded) {
25288
+ if (isStripeLoaded && !selectedPaymentMethodId) {
25288
25289
  window.Pelcro.user.createSetupIntent({
25289
25290
  auth_token: window.Pelcro.user.read().auth_token
25290
25291
  }, (err, res) => {
@@ -25310,7 +25311,7 @@ const PaymentMethodContainer = props => {
25310
25311
  }, []); // eslint-disable-line react-hooks/exhaustive-deps
25311
25312
 
25312
25313
  if (isStripeLoaded) {
25313
- return /*#__PURE__*/React__default['default'].createElement("div", null, clientSecret ? /*#__PURE__*/React__default['default'].createElement(Elements, {
25314
+ return /*#__PURE__*/React__default['default'].createElement("div", null, clientSecret || selectedPaymentMethodId ? /*#__PURE__*/React__default['default'].createElement(Elements, {
25314
25315
  options: options,
25315
25316
  stripe: stripePromise
25316
25317
  }, /*#__PURE__*/React__default['default'].createElement(PaymentMethodContainerWithoutStripe, Object.assign({
package/dist/index.esm.js CHANGED
@@ -25232,7 +25232,8 @@ const PaymentMethodContainer = props => {
25232
25232
 
25233
25233
  const [isStripeLoaded, setIsStripeLoaded] = useState(Boolean(window.Stripe));
25234
25234
  const {
25235
- whenUserReady
25235
+ whenUserReady,
25236
+ selectedPaymentMethodId
25236
25237
  } = usePelcro.getStore();
25237
25238
  const cardProcessor = getSiteCardProcessor(); // Create the Stripe object
25238
25239
 
@@ -25254,7 +25255,7 @@ const PaymentMethodContainer = props => {
25254
25255
  loader: "always"
25255
25256
  };
25256
25257
  useEffect(() => {
25257
- if (isStripeLoaded) {
25258
+ if (isStripeLoaded && !selectedPaymentMethodId) {
25258
25259
  window.Pelcro.user.createSetupIntent({
25259
25260
  auth_token: window.Pelcro.user.read().auth_token
25260
25261
  }, (err, res) => {
@@ -25280,7 +25281,7 @@ const PaymentMethodContainer = props => {
25280
25281
  }, []); // eslint-disable-line react-hooks/exhaustive-deps
25281
25282
 
25282
25283
  if (isStripeLoaded) {
25283
- return /*#__PURE__*/React__default.createElement("div", null, clientSecret ? /*#__PURE__*/React__default.createElement(Elements, {
25284
+ return /*#__PURE__*/React__default.createElement("div", null, clientSecret || selectedPaymentMethodId ? /*#__PURE__*/React__default.createElement(Elements, {
25284
25285
  options: options,
25285
25286
  stripe: stripePromise
25286
25287
  }, /*#__PURE__*/React__default.createElement(PaymentMethodContainerWithoutStripe, Object.assign({
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": "4.0.0-alpha.73",
4
+ "version": "4.0.0-alpha.74",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",