@pelcro/react-pelcro-js 3.6.0-beta.22 → 3.6.0-beta.24

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
@@ -15249,44 +15249,54 @@ const PaymentMethodContainerWithoutStripe = ({
15249
15249
  tap_token: result.id,
15250
15250
  redirect_url: `${window.Pelcro.environment.domain}/webhook/tap/callback/3dsecure?auth_token=${window.Pelcro.user.read().auth_token}`
15251
15251
  }, (err, res) => {
15252
- toggleAuthenticationPendingView(true, res);
15253
-
15254
- const listenFor3DSecureCompletionMessage = () => {
15255
- const retrieveSourceInfoFromIframe = event => {
15256
- const {
15257
- data
15258
- } = event;
15259
-
15260
- if (data.message === "3DS-authentication-complete") {
15261
- const tapID = data.tapID;
15262
- toggleAuthenticationPendingView(false);
15263
- window.removeEventListener("message", retrieveSourceInfoFromIframe);
15264
- handleTapPayment(tapID);
15252
+ if (err) {
15253
+ // Inform the user if there was an error
15254
+ onFailure(err);
15255
+ dispatch({
15256
+ type: DISABLE_SUBMIT,
15257
+ payload: false
15258
+ });
15259
+ dispatch({
15260
+ type: LOADING,
15261
+ payload: false
15262
+ });
15263
+ return dispatch({
15264
+ type: SHOW_ALERT,
15265
+ payload: {
15266
+ type: "error",
15267
+ content: getErrorMessages(err)
15265
15268
  }
15266
- }; // listen to injected iframe for authentication complete message
15267
-
15268
-
15269
- window.addEventListener("message", retrieveSourceInfoFromIframe);
15270
- };
15269
+ });
15270
+ } else {
15271
+ toggleAuthenticationPendingView(true, res);
15272
+
15273
+ const listenFor3DSecureCompletionMessage = () => {
15274
+ const retrieveSourceInfoFromIframe = event => {
15275
+ const {
15276
+ data
15277
+ } = event;
15278
+
15279
+ if (data.message === "3DS-authentication-complete") {
15280
+ const tapID = data.tapID;
15281
+ toggleAuthenticationPendingView(false);
15282
+ window.removeEventListener("message", retrieveSourceInfoFromIframe);
15283
+ dispatch({
15284
+ type: SHOW_ALERT,
15285
+ payload: {
15286
+ type: "error",
15287
+ content: null
15288
+ }
15289
+ });
15290
+ handleTapPayment(tapID);
15291
+ }
15292
+ }; // listen to injected iframe for authentication complete message
15293
+
15294
+
15295
+ window.addEventListener("message", retrieveSourceInfoFromIframe);
15296
+ };
15271
15297
 
15272
- listenFor3DSecureCompletionMessage(); // if (err) {
15273
- // onFailure(err);
15274
- // return dispatch({
15275
- // type: SHOW_ALERT,
15276
- // payload: {
15277
- // type: "error",
15278
- // content: getErrorMessages(err)
15279
- // }
15280
- // });
15281
- // }
15282
- // dispatch({
15283
- // type: SHOW_ALERT,
15284
- // payload: {
15285
- // type: "success",
15286
- // content: t("messages.sourceUpdated")
15287
- // }
15288
- // });
15289
- // onSuccess(res);
15298
+ listenFor3DSecureCompletionMessage();
15299
+ }
15290
15300
  });
15291
15301
  }
15292
15302
  });
package/dist/index.esm.js CHANGED
@@ -15219,44 +15219,54 @@ const PaymentMethodContainerWithoutStripe = ({
15219
15219
  tap_token: result.id,
15220
15220
  redirect_url: `${window.Pelcro.environment.domain}/webhook/tap/callback/3dsecure?auth_token=${window.Pelcro.user.read().auth_token}`
15221
15221
  }, (err, res) => {
15222
- toggleAuthenticationPendingView(true, res);
15223
-
15224
- const listenFor3DSecureCompletionMessage = () => {
15225
- const retrieveSourceInfoFromIframe = event => {
15226
- const {
15227
- data
15228
- } = event;
15229
-
15230
- if (data.message === "3DS-authentication-complete") {
15231
- const tapID = data.tapID;
15232
- toggleAuthenticationPendingView(false);
15233
- window.removeEventListener("message", retrieveSourceInfoFromIframe);
15234
- handleTapPayment(tapID);
15222
+ if (err) {
15223
+ // Inform the user if there was an error
15224
+ onFailure(err);
15225
+ dispatch({
15226
+ type: DISABLE_SUBMIT,
15227
+ payload: false
15228
+ });
15229
+ dispatch({
15230
+ type: LOADING,
15231
+ payload: false
15232
+ });
15233
+ return dispatch({
15234
+ type: SHOW_ALERT,
15235
+ payload: {
15236
+ type: "error",
15237
+ content: getErrorMessages(err)
15235
15238
  }
15236
- }; // listen to injected iframe for authentication complete message
15237
-
15238
-
15239
- window.addEventListener("message", retrieveSourceInfoFromIframe);
15240
- };
15239
+ });
15240
+ } else {
15241
+ toggleAuthenticationPendingView(true, res);
15242
+
15243
+ const listenFor3DSecureCompletionMessage = () => {
15244
+ const retrieveSourceInfoFromIframe = event => {
15245
+ const {
15246
+ data
15247
+ } = event;
15248
+
15249
+ if (data.message === "3DS-authentication-complete") {
15250
+ const tapID = data.tapID;
15251
+ toggleAuthenticationPendingView(false);
15252
+ window.removeEventListener("message", retrieveSourceInfoFromIframe);
15253
+ dispatch({
15254
+ type: SHOW_ALERT,
15255
+ payload: {
15256
+ type: "error",
15257
+ content: null
15258
+ }
15259
+ });
15260
+ handleTapPayment(tapID);
15261
+ }
15262
+ }; // listen to injected iframe for authentication complete message
15263
+
15264
+
15265
+ window.addEventListener("message", retrieveSourceInfoFromIframe);
15266
+ };
15241
15267
 
15242
- listenFor3DSecureCompletionMessage(); // if (err) {
15243
- // onFailure(err);
15244
- // return dispatch({
15245
- // type: SHOW_ALERT,
15246
- // payload: {
15247
- // type: "error",
15248
- // content: getErrorMessages(err)
15249
- // }
15250
- // });
15251
- // }
15252
- // dispatch({
15253
- // type: SHOW_ALERT,
15254
- // payload: {
15255
- // type: "success",
15256
- // content: t("messages.sourceUpdated")
15257
- // }
15258
- // });
15259
- // onSuccess(res);
15268
+ listenFor3DSecureCompletionMessage();
15269
+ }
15260
15270
  });
15261
15271
  }
15262
15272
  });
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.6.0-beta.22",
4
+ "version": "3.6.0-beta.24",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",