@pelcro/react-pelcro-js 3.22.0-beta.23 → 3.22.0-beta.25

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
@@ -3596,7 +3596,8 @@ var gift$3 = {
3596
3596
  enterEmail: "Please enter the gift recipient's email.",
3597
3597
  invalidDate: "The gift date needs to be between today and a year from now.",
3598
3598
  giftDateInfo: "The recipient will receive a gift email notification with your message on the date you select in order to redeem the gift.",
3599
- giftMessageInfo: "Leave a message to the recipient and don't forget to sign your name."
3599
+ giftMessageInfo: "Leave a message to the recipient and don't forget to sign your name.",
3600
+ giftMessageAllowedCharacters: "Special characters and emojis are not allowed."
3600
3601
  }
3601
3602
  };
3602
3603
  var redeem$3 = {
@@ -4594,7 +4595,8 @@ var gift$2 = {
4594
4595
  enterEmail: "Veuillez entrer l’adresse courriel du destinataire du cadeau.",
4595
4596
  invalidDate: "La date du cadeau doit être comprise entre aujourd'hui et un an.",
4596
4597
  giftDateInfo: "Le destinataire recevra un courriel à la date déterminée afin d'activer leur abonnement cadeau.",
4597
- giftMessageInfo: "Laissez un message au destinataire sans oublier de signer votre nom."
4598
+ giftMessageInfo: "Laissez un message au destinataire sans oublier de signer votre nom.",
4599
+ giftMessageAllowedCharacters: "Les caractères spéciaux et les emojis ne sont pas autorisés."
4598
4600
  }
4599
4601
  };
4600
4602
  var redeem$2 = {
@@ -5475,7 +5477,8 @@ var gift$1 = {
5475
5477
  enterEmail: "선물을 받을 분의 이메일을 입력해주세요.",
5476
5478
  invalidDate: "선물 날짜는 오늘로부터 1년 이내여야 합니다.",
5477
5479
  giftDateInfo: "받는 분이 선물을 사용하실 수 있도록, 선택된 날짜에 귀하의 선물 메시지가 담겨 있는 이메일 알림이 전송됩니다.",
5478
- giftMessageInfo: "받는 분을 위한 선물 메시지와 서명을 남기는 것을 잊지 마시기 바랍니다."
5480
+ giftMessageInfo: "받는 분을 위한 선물 메시지와 서명을 남기는 것을 잊지 마시기 바랍니다.",
5481
+ giftMessageAllowedCharacters: "특수문자 및 이모티콘 사용 불가."
5479
5482
  }
5480
5483
  };
5481
5484
  var redeem$1 = {
@@ -6459,7 +6462,8 @@ var gift = {
6459
6462
  enterEmail: "Por favor, ingresa el correo del destinatario del regalo",
6460
6463
  invalidDate: "La fecha del regalo debe ser entre hoy y un año a partir de ahora.",
6461
6464
  giftDateInfo: "El destinatario recibirá un correo de notificación del regalo con tu mensaje en la fecha que seleccionaste en la orden para redimir el regalo.",
6462
- giftMessageInfo: "Deja un mensaje para el destinatario y no olvides firmar con tu nombre."
6465
+ giftMessageInfo: "Deja un mensaje para el destinatario y no olvides firmar con tu nombre.",
6466
+ giftMessageAllowedCharacters: "No se permiten caracteres especiales ni emojis."
6463
6467
  }
6464
6468
  };
6465
6469
  var redeem = {
@@ -9149,6 +9153,13 @@ function notifyBugsnag(callback, startOptions) {
9149
9153
  }
9150
9154
  callback();
9151
9155
  }
9156
+ function isStringValid(str) {
9157
+ // Define the regular expression to match only letters, numbers and spaces
9158
+ var regex = /^[a-zA-Z0-9\s]+$/;
9159
+
9160
+ // Test the string against the regular expression
9161
+ return regex.test(str);
9162
+ }
9152
9163
 
9153
9164
  const resources = {
9154
9165
  en: {
@@ -19704,7 +19715,7 @@ const SubmitPaymentMethod = _ref => {
19704
19715
  } = React.useContext(store$k);
19705
19716
  const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
19706
19717
  const price = updatedPrice !== null && updatedPrice !== void 0 ? updatedPrice : plan === null || plan === void 0 ? void 0 : plan.amount;
19707
- const priceFormatted = plan.type === "donation" && (selectedDonationAmount || customDonationAmount) ? getFormattedPriceByLocal(selectedDonationAmount ? selectedDonationAmount * (plan === null || plan === void 0 ? void 0 : plan.amount) * ((_plan$quantity2 = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity2 !== void 0 ? _plan$quantity2 : 1) : customDonationAmount * (plan === null || plan === void 0 ? void 0 : plan.amount) * ((_plan$quantity3 = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity3 !== void 0 ? _plan$quantity3 : 1), plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage()) : getFormattedPriceByLocal(price * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
19718
+ const priceFormatted = (plan === null || plan === void 0 ? void 0 : plan.type) === "donation" && (selectedDonationAmount || customDonationAmount) ? getFormattedPriceByLocal(selectedDonationAmount ? selectedDonationAmount * (plan === null || plan === void 0 ? void 0 : plan.amount) * ((_plan$quantity2 = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity2 !== void 0 ? _plan$quantity2 : 1) : customDonationAmount * (plan === null || plan === void 0 ? void 0 : plan.amount) * ((_plan$quantity3 = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity3 !== void 0 ? _plan$quantity3 : 1), plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage()) : getFormattedPriceByLocal(price * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
19708
19719
  const supportsTap = Boolean((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.tap_gateway_settings);
19709
19720
  const isUserFirstName = Boolean(window.Pelcro.user.read().first_name);
19710
19721
  const isUserLastName = Boolean(window.Pelcro.user.read().last_name);
@@ -26002,6 +26013,16 @@ const GiftCreateContainer = _ref => {
26002
26013
  return onFailure();
26003
26014
  }
26004
26015
  }
26016
+ if (giftRecipient.giftMessage && !isStringValid(giftRecipient.giftMessage)) {
26017
+ dispatch({
26018
+ type: SHOW_ALERT,
26019
+ payload: {
26020
+ type: "error",
26021
+ content: t("gift.messages.giftMessageAllowedCharacters")
26022
+ }
26023
+ });
26024
+ return onFailure();
26025
+ }
26005
26026
  set({
26006
26027
  giftRecipient
26007
26028
  });
package/dist/index.esm.js CHANGED
@@ -3566,7 +3566,8 @@ var gift$3 = {
3566
3566
  enterEmail: "Please enter the gift recipient's email.",
3567
3567
  invalidDate: "The gift date needs to be between today and a year from now.",
3568
3568
  giftDateInfo: "The recipient will receive a gift email notification with your message on the date you select in order to redeem the gift.",
3569
- giftMessageInfo: "Leave a message to the recipient and don't forget to sign your name."
3569
+ giftMessageInfo: "Leave a message to the recipient and don't forget to sign your name.",
3570
+ giftMessageAllowedCharacters: "Special characters and emojis are not allowed."
3570
3571
  }
3571
3572
  };
3572
3573
  var redeem$3 = {
@@ -4564,7 +4565,8 @@ var gift$2 = {
4564
4565
  enterEmail: "Veuillez entrer l’adresse courriel du destinataire du cadeau.",
4565
4566
  invalidDate: "La date du cadeau doit être comprise entre aujourd'hui et un an.",
4566
4567
  giftDateInfo: "Le destinataire recevra un courriel à la date déterminée afin d'activer leur abonnement cadeau.",
4567
- giftMessageInfo: "Laissez un message au destinataire sans oublier de signer votre nom."
4568
+ giftMessageInfo: "Laissez un message au destinataire sans oublier de signer votre nom.",
4569
+ giftMessageAllowedCharacters: "Les caractères spéciaux et les emojis ne sont pas autorisés."
4568
4570
  }
4569
4571
  };
4570
4572
  var redeem$2 = {
@@ -5445,7 +5447,8 @@ var gift$1 = {
5445
5447
  enterEmail: "선물을 받을 분의 이메일을 입력해주세요.",
5446
5448
  invalidDate: "선물 날짜는 오늘로부터 1년 이내여야 합니다.",
5447
5449
  giftDateInfo: "받는 분이 선물을 사용하실 수 있도록, 선택된 날짜에 귀하의 선물 메시지가 담겨 있는 이메일 알림이 전송됩니다.",
5448
- giftMessageInfo: "받는 분을 위한 선물 메시지와 서명을 남기는 것을 잊지 마시기 바랍니다."
5450
+ giftMessageInfo: "받는 분을 위한 선물 메시지와 서명을 남기는 것을 잊지 마시기 바랍니다.",
5451
+ giftMessageAllowedCharacters: "특수문자 및 이모티콘 사용 불가."
5449
5452
  }
5450
5453
  };
5451
5454
  var redeem$1 = {
@@ -6429,7 +6432,8 @@ var gift = {
6429
6432
  enterEmail: "Por favor, ingresa el correo del destinatario del regalo",
6430
6433
  invalidDate: "La fecha del regalo debe ser entre hoy y un año a partir de ahora.",
6431
6434
  giftDateInfo: "El destinatario recibirá un correo de notificación del regalo con tu mensaje en la fecha que seleccionaste en la orden para redimir el regalo.",
6432
- giftMessageInfo: "Deja un mensaje para el destinatario y no olvides firmar con tu nombre."
6435
+ giftMessageInfo: "Deja un mensaje para el destinatario y no olvides firmar con tu nombre.",
6436
+ giftMessageAllowedCharacters: "No se permiten caracteres especiales ni emojis."
6433
6437
  }
6434
6438
  };
6435
6439
  var redeem = {
@@ -9119,6 +9123,13 @@ function notifyBugsnag(callback, startOptions) {
9119
9123
  }
9120
9124
  callback();
9121
9125
  }
9126
+ function isStringValid(str) {
9127
+ // Define the regular expression to match only letters, numbers and spaces
9128
+ var regex = /^[a-zA-Z0-9\s]+$/;
9129
+
9130
+ // Test the string against the regular expression
9131
+ return regex.test(str);
9132
+ }
9122
9133
 
9123
9134
  const resources = {
9124
9135
  en: {
@@ -19674,7 +19685,7 @@ const SubmitPaymentMethod = _ref => {
19674
19685
  } = useContext(store$k);
19675
19686
  const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
19676
19687
  const price = updatedPrice !== null && updatedPrice !== void 0 ? updatedPrice : plan === null || plan === void 0 ? void 0 : plan.amount;
19677
- const priceFormatted = plan.type === "donation" && (selectedDonationAmount || customDonationAmount) ? getFormattedPriceByLocal(selectedDonationAmount ? selectedDonationAmount * (plan === null || plan === void 0 ? void 0 : plan.amount) * ((_plan$quantity2 = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity2 !== void 0 ? _plan$quantity2 : 1) : customDonationAmount * (plan === null || plan === void 0 ? void 0 : plan.amount) * ((_plan$quantity3 = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity3 !== void 0 ? _plan$quantity3 : 1), plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage()) : getFormattedPriceByLocal(price * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
19688
+ const priceFormatted = (plan === null || plan === void 0 ? void 0 : plan.type) === "donation" && (selectedDonationAmount || customDonationAmount) ? getFormattedPriceByLocal(selectedDonationAmount ? selectedDonationAmount * (plan === null || plan === void 0 ? void 0 : plan.amount) * ((_plan$quantity2 = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity2 !== void 0 ? _plan$quantity2 : 1) : customDonationAmount * (plan === null || plan === void 0 ? void 0 : plan.amount) * ((_plan$quantity3 = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity3 !== void 0 ? _plan$quantity3 : 1), plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage()) : getFormattedPriceByLocal(price * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
19678
19689
  const supportsTap = Boolean((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.tap_gateway_settings);
19679
19690
  const isUserFirstName = Boolean(window.Pelcro.user.read().first_name);
19680
19691
  const isUserLastName = Boolean(window.Pelcro.user.read().last_name);
@@ -25972,6 +25983,16 @@ const GiftCreateContainer = _ref => {
25972
25983
  return onFailure();
25973
25984
  }
25974
25985
  }
25986
+ if (giftRecipient.giftMessage && !isStringValid(giftRecipient.giftMessage)) {
25987
+ dispatch({
25988
+ type: SHOW_ALERT,
25989
+ payload: {
25990
+ type: "error",
25991
+ content: t("gift.messages.giftMessageAllowedCharacters")
25992
+ }
25993
+ });
25994
+ return onFailure();
25995
+ }
25975
25996
  set({
25976
25997
  giftRecipient
25977
25998
  });
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.22.0-beta.23",
4
+ "version": "3.22.0-beta.25",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",