@pelcro/react-pelcro-js 3.9.0-beta.3 → 3.9.0-beta.4

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
@@ -12345,11 +12345,18 @@ function FirstName({
12345
12345
  type: SET_FIRST_NAME,
12346
12346
  payload: firstName
12347
12347
  });
12348
- } else if (finishedTyping && otherProps.required) {
12349
- dispatch({
12350
- type: SET_FIRST_NAME_ERROR,
12351
- payload: t("validation.enterFirstName")
12352
- });
12348
+ } else {
12349
+ if (finishedTyping && otherProps.required) {
12350
+ dispatch({
12351
+ type: SET_FIRST_NAME_ERROR,
12352
+ payload: t("validation.enterFirstName")
12353
+ });
12354
+ } else {
12355
+ dispatch({
12356
+ type: SET_FIRST_NAME,
12357
+ payload: firstName
12358
+ });
12359
+ }
12353
12360
  }
12354
12361
  }, [dispatch, firstName, finishedTyping]);
12355
12362
  React.useEffect(() => {
@@ -12410,11 +12417,18 @@ function LastName({
12410
12417
  type: SET_LAST_NAME,
12411
12418
  payload: lastName
12412
12419
  });
12413
- } else if (finishedTyping && otherProps.required) {
12414
- dispatch({
12415
- type: SET_LAST_NAME_ERROR,
12416
- payload: t("validation.enterLastName")
12417
- });
12420
+ } else {
12421
+ if (finishedTyping && otherProps.required) {
12422
+ dispatch({
12423
+ type: SET_LAST_NAME_ERROR,
12424
+ payload: t("validation.enterLastName")
12425
+ });
12426
+ } else {
12427
+ dispatch({
12428
+ type: SET_LAST_NAME,
12429
+ payload: lastName
12430
+ });
12431
+ }
12418
12432
  }
12419
12433
  }, [dispatch, lastName, finishedTyping]);
12420
12434
  React.useEffect(() => {
@@ -12475,11 +12489,18 @@ function Phone({
12475
12489
  type: SET_PHONE,
12476
12490
  payload: phone
12477
12491
  });
12478
- } else if (finishedTyping && otherProps.required) {
12479
- dispatch({
12480
- type: SET_PHONE_ERROR,
12481
- payload: t("validation.enterPhone")
12482
- });
12492
+ } else {
12493
+ if (finishedTyping && otherProps.required) {
12494
+ dispatch({
12495
+ type: SET_PHONE_ERROR,
12496
+ payload: t("validation.enterPhone")
12497
+ });
12498
+ } else {
12499
+ dispatch({
12500
+ type: SET_PHONE,
12501
+ payload: phone
12502
+ });
12503
+ }
12483
12504
  }
12484
12505
  }, [dispatch, phone, finishedTyping]);
12485
12506
  React.useEffect(() => {
@@ -15437,9 +15458,6 @@ const PaymentMethodContainerWithoutStripe = ({
15437
15458
  }
15438
15459
  });
15439
15460
  } else {
15440
- console.log("First Name", state.firstName);
15441
- console.log("Last Name", state.lastName);
15442
- console.log("Phone", state.phone);
15443
15461
  window.Pelcro.payment.authorize({
15444
15462
  auth_token: window.Pelcro.user.read().auth_token,
15445
15463
  first_name: window.Pelcro.user.read().first_name || state.firstName,
@@ -17254,7 +17272,7 @@ const SubmitPaymentMethod = ({
17254
17272
  if (supportsTap && isUserFirstName && isUserLastName && isUserPhone) {
17255
17273
  setDisabled(disableSubmit);
17256
17274
  } else {
17257
- setDisabled(disableSubmit || supportsTap && firstNameError || supportsTap && lastNameError || supportsTap && phoneError || supportsTap && !firstName.length || supportsTap && !lastName.length || supportsTap && !phone.length);
17275
+ setDisabled(disableSubmit || supportsTap && firstNameError || supportsTap && lastNameError || supportsTap && phoneError || supportsTap && !(firstName !== null && firstName !== void 0 && firstName.length) || supportsTap && !(lastName !== null && lastName !== void 0 && lastName.length) || supportsTap && !(phone !== null && phone !== void 0 && phone.length));
17258
17276
  }
17259
17277
  }, [disableSubmit, firstNameError, lastNameError, phoneError, firstName, lastName, phone]);
17260
17278
  return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
package/dist/index.esm.js CHANGED
@@ -12315,11 +12315,18 @@ function FirstName({
12315
12315
  type: SET_FIRST_NAME,
12316
12316
  payload: firstName
12317
12317
  });
12318
- } else if (finishedTyping && otherProps.required) {
12319
- dispatch({
12320
- type: SET_FIRST_NAME_ERROR,
12321
- payload: t("validation.enterFirstName")
12322
- });
12318
+ } else {
12319
+ if (finishedTyping && otherProps.required) {
12320
+ dispatch({
12321
+ type: SET_FIRST_NAME_ERROR,
12322
+ payload: t("validation.enterFirstName")
12323
+ });
12324
+ } else {
12325
+ dispatch({
12326
+ type: SET_FIRST_NAME,
12327
+ payload: firstName
12328
+ });
12329
+ }
12323
12330
  }
12324
12331
  }, [dispatch, firstName, finishedTyping]);
12325
12332
  useEffect(() => {
@@ -12380,11 +12387,18 @@ function LastName({
12380
12387
  type: SET_LAST_NAME,
12381
12388
  payload: lastName
12382
12389
  });
12383
- } else if (finishedTyping && otherProps.required) {
12384
- dispatch({
12385
- type: SET_LAST_NAME_ERROR,
12386
- payload: t("validation.enterLastName")
12387
- });
12390
+ } else {
12391
+ if (finishedTyping && otherProps.required) {
12392
+ dispatch({
12393
+ type: SET_LAST_NAME_ERROR,
12394
+ payload: t("validation.enterLastName")
12395
+ });
12396
+ } else {
12397
+ dispatch({
12398
+ type: SET_LAST_NAME,
12399
+ payload: lastName
12400
+ });
12401
+ }
12388
12402
  }
12389
12403
  }, [dispatch, lastName, finishedTyping]);
12390
12404
  useEffect(() => {
@@ -12445,11 +12459,18 @@ function Phone({
12445
12459
  type: SET_PHONE,
12446
12460
  payload: phone
12447
12461
  });
12448
- } else if (finishedTyping && otherProps.required) {
12449
- dispatch({
12450
- type: SET_PHONE_ERROR,
12451
- payload: t("validation.enterPhone")
12452
- });
12462
+ } else {
12463
+ if (finishedTyping && otherProps.required) {
12464
+ dispatch({
12465
+ type: SET_PHONE_ERROR,
12466
+ payload: t("validation.enterPhone")
12467
+ });
12468
+ } else {
12469
+ dispatch({
12470
+ type: SET_PHONE,
12471
+ payload: phone
12472
+ });
12473
+ }
12453
12474
  }
12454
12475
  }, [dispatch, phone, finishedTyping]);
12455
12476
  useEffect(() => {
@@ -15407,9 +15428,6 @@ const PaymentMethodContainerWithoutStripe = ({
15407
15428
  }
15408
15429
  });
15409
15430
  } else {
15410
- console.log("First Name", state.firstName);
15411
- console.log("Last Name", state.lastName);
15412
- console.log("Phone", state.phone);
15413
15431
  window.Pelcro.payment.authorize({
15414
15432
  auth_token: window.Pelcro.user.read().auth_token,
15415
15433
  first_name: window.Pelcro.user.read().first_name || state.firstName,
@@ -17224,7 +17242,7 @@ const SubmitPaymentMethod = ({
17224
17242
  if (supportsTap && isUserFirstName && isUserLastName && isUserPhone) {
17225
17243
  setDisabled(disableSubmit);
17226
17244
  } else {
17227
- setDisabled(disableSubmit || supportsTap && firstNameError || supportsTap && lastNameError || supportsTap && phoneError || supportsTap && !firstName.length || supportsTap && !lastName.length || supportsTap && !phone.length);
17245
+ setDisabled(disableSubmit || supportsTap && firstNameError || supportsTap && lastNameError || supportsTap && phoneError || supportsTap && !(firstName !== null && firstName !== void 0 && firstName.length) || supportsTap && !(lastName !== null && lastName !== void 0 && lastName.length) || supportsTap && !(phone !== null && phone !== void 0 && phone.length));
17228
17246
  }
17229
17247
  }, [disableSubmit, firstNameError, lastNameError, phoneError, firstName, lastName, phone]);
17230
17248
  return /*#__PURE__*/React__default.createElement(Button, 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": "3.9.0-beta.3",
4
+ "version": "3.9.0-beta.4",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",