@pelcro/react-pelcro-js 3.9.0-beta.1 → 3.9.0-beta.2

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
@@ -12319,6 +12319,7 @@ const RegisterButton = ({
12319
12319
  };
12320
12320
 
12321
12321
  function FirstName({
12322
+ initWithUserFirstName = true,
12322
12323
  store,
12323
12324
  ...otherProps
12324
12325
  }) {
@@ -12351,7 +12352,23 @@ function FirstName({
12351
12352
  }, [dispatch, firstName, finishedTyping]);
12352
12353
  React.useEffect(() => {
12353
12354
  handleInputChange(firstName);
12354
- }, [finishedTyping, firstName, handleInputChange]);
12355
+ }, [finishedTyping, firstName, handleInputChange]); // Initialize first name field with user's first name
12356
+
12357
+ const loadFirstNameIntoField = () => {
12358
+ handleInputChange(window.Pelcro.user.read().first_name);
12359
+ };
12360
+
12361
+ React.useEffect(() => {
12362
+ if (initWithUserFirstName) {
12363
+ document.addEventListener("PelcroUserLoaded", () => {
12364
+ loadFirstNameIntoField();
12365
+ });
12366
+ loadFirstNameIntoField();
12367
+ return () => {
12368
+ document.removeEventListener("PelcroUserLoaded", handleInputChange);
12369
+ };
12370
+ }
12371
+ }, []);
12355
12372
  return /*#__PURE__*/React__default['default'].createElement(Input, Object.assign({
12356
12373
  type: "text",
12357
12374
  error: firstNameError,
@@ -12367,6 +12384,7 @@ const RegisterFirstName = props => /*#__PURE__*/React__default['default'].create
12367
12384
  }, props));
12368
12385
 
12369
12386
  function LastName({
12387
+ initWithUserLastName = true,
12370
12388
  store,
12371
12389
  ...otherProps
12372
12390
  }) {
@@ -12399,7 +12417,23 @@ function LastName({
12399
12417
  }, [dispatch, lastName, finishedTyping]);
12400
12418
  React.useEffect(() => {
12401
12419
  handleInputChange(lastName);
12402
- }, [finishedTyping, lastName, handleInputChange]);
12420
+ }, [finishedTyping, lastName, handleInputChange]); // Initialize last name field with user's last name
12421
+
12422
+ const loadLastNameIntoField = () => {
12423
+ handleInputChange(window.Pelcro.user.read().last_name);
12424
+ };
12425
+
12426
+ React.useEffect(() => {
12427
+ if (initWithUserLastName) {
12428
+ document.addEventListener("PelcroUserLoaded", () => {
12429
+ loadLastNameIntoField();
12430
+ });
12431
+ loadLastNameIntoField();
12432
+ return () => {
12433
+ document.removeEventListener("PelcroUserLoaded", handleInputChange);
12434
+ };
12435
+ }
12436
+ }, []);
12403
12437
  return /*#__PURE__*/React__default['default'].createElement(Input, Object.assign({
12404
12438
  type: "text",
12405
12439
  error: lastNameError,
@@ -12415,6 +12449,7 @@ const RegisterLastName = props => /*#__PURE__*/React__default['default'].createE
12415
12449
  }, props));
12416
12450
 
12417
12451
  function Phone({
12452
+ initWithUserPhone = true,
12418
12453
  store,
12419
12454
  ...otherProps
12420
12455
  }) {
@@ -12447,7 +12482,23 @@ function Phone({
12447
12482
  }, [dispatch, phone, finishedTyping]);
12448
12483
  React.useEffect(() => {
12449
12484
  handleInputChange(phone);
12450
- }, [finishedTyping, phone, handleInputChange]);
12485
+ }, [finishedTyping, phone, handleInputChange]); // Initialize phone field with user's phone
12486
+
12487
+ const loadPhoneIntoField = () => {
12488
+ handleInputChange(window.Pelcro.user.read().phone);
12489
+ };
12490
+
12491
+ React.useEffect(() => {
12492
+ if (initWithUserPhone) {
12493
+ document.addEventListener("PelcroUserLoaded", () => {
12494
+ loadPhoneIntoField();
12495
+ });
12496
+ loadPhoneIntoField();
12497
+ return () => {
12498
+ document.removeEventListener("PelcroUserLoaded", handleInputChange);
12499
+ };
12500
+ }
12501
+ }, []);
12451
12502
  return /*#__PURE__*/React__default['default'].createElement(Input, Object.assign({
12452
12503
  type: "tel",
12453
12504
  error: phoneError,
package/dist/index.esm.js CHANGED
@@ -12289,6 +12289,7 @@ const RegisterButton = ({
12289
12289
  };
12290
12290
 
12291
12291
  function FirstName({
12292
+ initWithUserFirstName = true,
12292
12293
  store,
12293
12294
  ...otherProps
12294
12295
  }) {
@@ -12321,7 +12322,23 @@ function FirstName({
12321
12322
  }, [dispatch, firstName, finishedTyping]);
12322
12323
  useEffect(() => {
12323
12324
  handleInputChange(firstName);
12324
- }, [finishedTyping, firstName, handleInputChange]);
12325
+ }, [finishedTyping, firstName, handleInputChange]); // Initialize first name field with user's first name
12326
+
12327
+ const loadFirstNameIntoField = () => {
12328
+ handleInputChange(window.Pelcro.user.read().first_name);
12329
+ };
12330
+
12331
+ useEffect(() => {
12332
+ if (initWithUserFirstName) {
12333
+ document.addEventListener("PelcroUserLoaded", () => {
12334
+ loadFirstNameIntoField();
12335
+ });
12336
+ loadFirstNameIntoField();
12337
+ return () => {
12338
+ document.removeEventListener("PelcroUserLoaded", handleInputChange);
12339
+ };
12340
+ }
12341
+ }, []);
12325
12342
  return /*#__PURE__*/React__default.createElement(Input, Object.assign({
12326
12343
  type: "text",
12327
12344
  error: firstNameError,
@@ -12337,6 +12354,7 @@ const RegisterFirstName = props => /*#__PURE__*/React__default.createElement(Fir
12337
12354
  }, props));
12338
12355
 
12339
12356
  function LastName({
12357
+ initWithUserLastName = true,
12340
12358
  store,
12341
12359
  ...otherProps
12342
12360
  }) {
@@ -12369,7 +12387,23 @@ function LastName({
12369
12387
  }, [dispatch, lastName, finishedTyping]);
12370
12388
  useEffect(() => {
12371
12389
  handleInputChange(lastName);
12372
- }, [finishedTyping, lastName, handleInputChange]);
12390
+ }, [finishedTyping, lastName, handleInputChange]); // Initialize last name field with user's last name
12391
+
12392
+ const loadLastNameIntoField = () => {
12393
+ handleInputChange(window.Pelcro.user.read().last_name);
12394
+ };
12395
+
12396
+ useEffect(() => {
12397
+ if (initWithUserLastName) {
12398
+ document.addEventListener("PelcroUserLoaded", () => {
12399
+ loadLastNameIntoField();
12400
+ });
12401
+ loadLastNameIntoField();
12402
+ return () => {
12403
+ document.removeEventListener("PelcroUserLoaded", handleInputChange);
12404
+ };
12405
+ }
12406
+ }, []);
12373
12407
  return /*#__PURE__*/React__default.createElement(Input, Object.assign({
12374
12408
  type: "text",
12375
12409
  error: lastNameError,
@@ -12385,6 +12419,7 @@ const RegisterLastName = props => /*#__PURE__*/React__default.createElement(Last
12385
12419
  }, props));
12386
12420
 
12387
12421
  function Phone({
12422
+ initWithUserPhone = true,
12388
12423
  store,
12389
12424
  ...otherProps
12390
12425
  }) {
@@ -12417,7 +12452,23 @@ function Phone({
12417
12452
  }, [dispatch, phone, finishedTyping]);
12418
12453
  useEffect(() => {
12419
12454
  handleInputChange(phone);
12420
- }, [finishedTyping, phone, handleInputChange]);
12455
+ }, [finishedTyping, phone, handleInputChange]); // Initialize phone field with user's phone
12456
+
12457
+ const loadPhoneIntoField = () => {
12458
+ handleInputChange(window.Pelcro.user.read().phone);
12459
+ };
12460
+
12461
+ useEffect(() => {
12462
+ if (initWithUserPhone) {
12463
+ document.addEventListener("PelcroUserLoaded", () => {
12464
+ loadPhoneIntoField();
12465
+ });
12466
+ loadPhoneIntoField();
12467
+ return () => {
12468
+ document.removeEventListener("PelcroUserLoaded", handleInputChange);
12469
+ };
12470
+ }
12471
+ }, []);
12421
12472
  return /*#__PURE__*/React__default.createElement(Input, Object.assign({
12422
12473
  type: "tel",
12423
12474
  error: phoneError,
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.1",
4
+ "version": "3.9.0-beta.2",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",