@bigbinary/neeto-form-frontend 4.2.6 → 4.2.7

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.
@@ -31,7 +31,6 @@
31
31
  "invalidURL": "Invalid URL",
32
32
  "generateLink": "Generate link",
33
33
  "paragraphCantBeEmpty": "Paragraph can't be empty",
34
- "fillTheFormToChat": "Please fill in the form to start chatting.",
35
34
  "phoneNumberValidation": "phone number starting with country code",
36
35
  "yes": "Yes",
37
36
  "count": "Count",
@@ -152,19 +151,18 @@
152
151
  "changeLanguage": "Change language"
153
152
  },
154
153
  "error": {
155
- "invalidField": "Please enter a valid {{label}}",
154
+ "invalidField": "{{label}} is invalid",
156
155
  "invalidFieldCode": "This field code cannot be used",
157
- "requiredField": "Please enter {{label}}",
158
- "selectMin": "Please select {{min}} {{entity}}",
156
+ "requiredField": "{{label}} is required",
159
157
  "invalidType": "{{label}} should be a valid {{type}}",
160
158
  "fieldCantBeEmpty": "{{field, anyCase}} can't be empty",
161
- "incompleteCaptcha": "Please complete captcha",
162
- "captchaVerificationFailed": "Captcha verification failed. Please try again.",
159
+ "incompleteCaptcha": "Captcha is incomplete",
160
+ "captchaVerificationFailed": "Captcha verification failed. Try again.",
163
161
  "invalidDomain": "Domain name is invalid",
164
- "minOneEntity": "Please add atleast one {{entity}}",
162
+ "minOneEntity": "At least one {{entity}} is required",
165
163
  "emailFromRestrictedDomain": "Emails with domain {{domain}} aren't accepted.",
166
164
  "mustBeASixDigitNumber": "{{entity}} must be a 6 digit number",
167
- "pleaseVerifyEmail": "Please verify your email"
165
+ "emailNotVerified": "Email verification is required"
168
166
  },
169
167
  "fileTypes": {
170
168
  "documents": "Documents",
@@ -175,10 +173,10 @@
175
173
  "enableMultipleFilesUpload": "Enable multiple files upload",
176
174
  "fileTypes": "File types",
177
175
  "validations": {
178
- "waitForUpload": "Please wait till upload is finished",
179
- "atLeastOneFileRequired": "Please upload at least one file",
180
- "removeDuplicates": "Please remove duplicate entries",
181
- "fileIsRequired": "Please upload a file"
176
+ "waitForUpload": "Wait till upload is finished",
177
+ "atLeastOneFileRequired": "Upload at least one file",
178
+ "removeDuplicates": "Remove duplicate entries",
179
+ "fileIsRequired": "Upload a file"
182
180
  },
183
181
  "dropzone": {
184
182
  "errors": {
@@ -189,7 +187,7 @@
189
187
  },
190
188
  "maxFileSize": "Maximum allowed size is {{size}} {{unit, anyCase}}",
191
189
  "allowedFileTypes": "Allowed file types are {{types}}",
192
- "oneFileAllowed": "Please upload only 1 file",
190
+ "oneFileAllowed": "Upload only one file",
193
191
  "chooseOrDragFile": "<typography>Choose file <span>or</span> drag here.</typography>"
194
192
  },
195
193
  "fileSizeInMb": "{{fileSize}} MB",
@@ -208,7 +206,7 @@
208
206
  },
209
207
  "helpText": "Press space, tab or enter key after adding a domain.",
210
208
  "removeInvalidDomains": "Click here to remove invalid domains.",
211
- "placeholder": "Please enter the email domains"
209
+ "placeholder": "Enter the email domains"
212
210
  },
213
211
  "emailVerification": {
214
212
  "label": "Email verification",
@@ -26,7 +26,7 @@ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProper
26
26
  import Check from '@bigbinary/neeto-icons/Check';
27
27
  import { jsx, jsxs } from 'react/jsx-runtime';
28
28
  import { C as CALLOUT_STYLES, b as CALLOUT_POSITIONS, L as LAST_ELEMENTS_THRESHOLD } from './constants-QPLZ_r-D.js';
29
- import { c as clientI18nInstance, d as getWithExpiry, e as clearEmailVerificationDetails, g as generateInitValues, F as FormikWrap, a as getFieldComponent, b as buildAutoCompleteAttribute, r as renderButtonsInOrder, m as mergeRefs, f as generateFormResponse, h as clearLocalStorageValues } from './utils-GRfGBny0.js';
29
+ import { c as clientI18nInstance, d as getWithExpiry, e as clearEmailVerificationDetails, g as generateInitValues, F as FormikWrap, a as getFieldComponent, b as buildAutoCompleteAttribute, r as renderButtonsInOrder, m as mergeRefs, f as generateFormResponse, h as clearLocalStorageValues } from './utils-Dn-q4QBc.js';
30
30
  import { withT } from '@bigbinary/neeto-commons-frontend/react-utils';
31
31
  import '@babel/runtime/helpers/toConsumableArray';
32
32
  import '@bigbinary/neeto-commons-frontend/constants';
@@ -10,7 +10,7 @@ import Button from '@bigbinary/neetoui/Button';
10
10
  import NoData from '@bigbinary/neetoui/NoData';
11
11
  import { map, mergeLeft, filter, pluck, isEmpty } from 'ramda';
12
12
  import { useTranslation } from 'react-i18next';
13
- import { g as generateInitValues, F as FormikWrap, a as getFieldComponent, b as buildAutoCompleteAttribute, m as mergeRefs } from './utils-GRfGBny0.js';
13
+ import { g as generateInitValues, F as FormikWrap, a as getFieldComponent, b as buildAutoCompleteAttribute, m as mergeRefs } from './utils-Dn-q4QBc.js';
14
14
  import { b as usePublicForm } from './constants-51SEJjzI.js';
15
15
  import { parsePhoneNumber } from 'libphonenumber-js';
16
16
  import { Q as QUESTIONS_WITHOUT_FIELD_CODE, a as QUESTION_KIND } from './constants-QPLZ_r-D.js';
@@ -28,7 +28,7 @@ var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProp
28
28
  var Check = require('@bigbinary/neeto-icons/Check');
29
29
  var jsxRuntime = require('react/jsx-runtime');
30
30
  var constants = require('../constants-BjWWA3Oq.js');
31
- var utils = require('../utils-BwFLBXs2.js');
31
+ var utils = require('../utils-Ch7Ggngj.js');
32
32
  var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
33
33
  require('@babel/runtime/helpers/toConsumableArray');
34
34
  require('@bigbinary/neeto-commons-frontend/constants');
@@ -12,7 +12,7 @@ var Button = require('@bigbinary/neetoui/Button');
12
12
  var NoData = require('@bigbinary/neetoui/NoData');
13
13
  var ramda = require('ramda');
14
14
  var reactI18next = require('react-i18next');
15
- var utils = require('../utils-BwFLBXs2.js');
15
+ var utils = require('../utils-Ch7Ggngj.js');
16
16
  var constants$1 = require('../constants-C9wKMfgo.js');
17
17
  var libphonenumberJs = require('libphonenumber-js');
18
18
  var constants = require('../constants-BjWWA3Oq.js');
package/dist/cjs/index.js CHANGED
@@ -70,7 +70,7 @@ require('@bigbinary/neeto-icons/Warning');
70
70
  require('@bigbinary/neeto-molecules/PageLoader');
71
71
  require('@bigbinary/neetoui/Callout');
72
72
  require('@bigbinary/neeto-icons/Check');
73
- require('../utils-BwFLBXs2.js');
73
+ require('../utils-Ch7Ggngj.js');
74
74
  require('libphonenumber-js');
75
75
  require('@bigbinary/neeto-editor/EditorContent');
76
76
  require('@bigbinary/neetoui/MultiEmailInput');
package/dist/index.js CHANGED
@@ -68,7 +68,7 @@ import '@bigbinary/neeto-icons/Warning';
68
68
  import '@bigbinary/neeto-molecules/PageLoader';
69
69
  import '@bigbinary/neetoui/Callout';
70
70
  import '@bigbinary/neeto-icons/Check';
71
- import './utils-GRfGBny0.js';
71
+ import './utils-Dn-q4QBc.js';
72
72
  import 'libphonenumber-js';
73
73
  import '@bigbinary/neeto-editor/EditorContent';
74
74
  import '@bigbinary/neetoui/MultiEmailInput';
@@ -234,10 +234,9 @@ var getRequiredFieldError = function getRequiredFieldError(label) {
234
234
  label: label
235
235
  });
236
236
  };
237
- var getSelectMinError = function getSelectMinError(min) {
238
- var entity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : t$1("neetoForm.common.option");
239
- return t$1("neetoForm.error.selectMin", {
240
- min: min,
237
+ var getSelectMinError = function getSelectMinError() {
238
+ var entity = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : t$1("neetoForm.common.option");
239
+ return t$1("neetoForm.error.minOneEntity", {
241
240
  entity: entity
242
241
  });
243
242
  };
@@ -250,6 +249,7 @@ var getInvalidTypeError = function getInvalidTypeError(label, type) {
250
249
 
251
250
  function ownKeys$h(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
252
251
  function _objectSpread$h(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$h(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$h(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
252
+ var resolveQueryParamValue = ramda.when(ramda.is(Array), ramda.last);
253
253
  var toEmailValues = function toEmailValues() {
254
254
  var values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
255
255
  return values.map(function (value) {
@@ -261,10 +261,10 @@ var toEmailValues = function toEmailValues() {
261
261
  });
262
262
  };
263
263
  var getPhoneNumberFromUrl = function getPhoneNumberFromUrl(fieldCodes, fieldCode) {
264
- var _fieldCodes$fieldCode;
265
- var countryCode = fieldCodes["".concat(fieldCode, ".country")];
266
- var phoneNumber = fieldCodes["".concat(fieldCode, ".number")];
267
- var phoneNumberWithCountryCode = (_fieldCodes$fieldCode = fieldCodes[fieldCode]) === null || _fieldCodes$fieldCode === void 0 ? void 0 : _fieldCodes$fieldCode.replace(constants.PARENTHESES_REGEX, "");
264
+ var _resolveQueryParamVal;
265
+ var countryCode = resolveQueryParamValue(fieldCodes["".concat(fieldCode, ".country")]);
266
+ var phoneNumber = resolveQueryParamValue(fieldCodes["".concat(fieldCode, ".number")]);
267
+ var phoneNumberWithCountryCode = (_resolveQueryParamVal = resolveQueryParamValue(fieldCodes[fieldCode])) === null || _resolveQueryParamVal === void 0 ? void 0 : _resolveQueryParamVal.replace(constants.PARENTHESES_REGEX, "");
268
268
  if (phoneNumberWithCountryCode) return phoneNumberWithCountryCode;
269
269
  if (!countryCode || !phoneNumber) return undefined;
270
270
  var formattedValue = getPhoneData(phoneNumber, countryCode);
@@ -276,7 +276,7 @@ var getOptionFromURL = function getOptionFromURL(_ref) {
276
276
  var optionsAttributes = _ref.optionsAttributes,
277
277
  fieldCodes = _ref.fieldCodes,
278
278
  fieldCode = _ref.fieldCode;
279
- var preFillOption = fieldCodes[fieldCode];
279
+ var preFillOption = resolveQueryParamValue(fieldCodes[fieldCode]);
280
280
  return (_findBy = neetoCist.findBy({
281
281
  label: preFillOption
282
282
  }, optionsAttributes)) === null || _findBy === void 0 ? void 0 : _findBy.id;
@@ -285,7 +285,7 @@ var getMultipleOptionsFromURL = function getMultipleOptionsFromURL(_ref2) {
285
285
  var optionsAttributes = _ref2.optionsAttributes,
286
286
  fieldCodes = _ref2.fieldCodes,
287
287
  fieldCode = _ref2.fieldCode;
288
- var fieldCodeValue = fieldCodes[fieldCode];
288
+ var fieldCodeValue = resolveQueryParamValue(fieldCodes[fieldCode]);
289
289
  if (!fieldCodeValue) return new Array(optionsAttributes.length).fill(false);
290
290
  var allOptions = fieldCodeValue.split(",").map(ramda.trim);
291
291
  return optionsAttributes.map(function (option) {
@@ -297,14 +297,14 @@ var getStarRatingFromUrl = function getStarRatingFromUrl(_ref3) {
297
297
  maxValue = _ref3.maxValue,
298
298
  fieldCodes = _ref3.fieldCodes,
299
299
  fieldCode = _ref3.fieldCode;
300
- var fieldCodeValue = fieldCodes[fieldCode];
300
+ var fieldCodeValue = resolveQueryParamValue(fieldCodes[fieldCode]);
301
301
  var rating = parseInt(fieldCodeValue);
302
302
  return ramda.isNil(rating) || isNaN(rating) ? "" : ramda.clamp(minValue, maxValue, rating);
303
303
  };
304
304
  var getAdditionalGuestsFromUrl = function getAdditionalGuestsFromUrl(_ref4) {
305
305
  var fieldCodes = _ref4.fieldCodes,
306
306
  fieldCode = _ref4.fieldCode;
307
- var fieldCodeValue = fieldCodes[fieldCode];
307
+ var fieldCodeValue = resolveQueryParamValue(fieldCodes[fieldCode]);
308
308
  var allEmails = fieldCodeValue === null || fieldCodeValue === void 0 ? void 0 : fieldCodeValue.split(",");
309
309
  if (!allEmails) return [];
310
310
  return allEmails.map(function (email) {
@@ -318,7 +318,7 @@ var getAdditionalGuestsFromUrl = function getAdditionalGuestsFromUrl(_ref4) {
318
318
  var getRatingFromUrl = function getRatingFromUrl(_ref5) {
319
319
  var fieldCodes = _ref5.fieldCodes,
320
320
  fieldCode = _ref5.fieldCode;
321
- var fieldCodeValue = fieldCodes[fieldCode];
321
+ var fieldCodeValue = resolveQueryParamValue(fieldCodes[fieldCode]);
322
322
  var allowedValues = Object.values(constants.RATING_VALUES).map(ramda.prop("value"));
323
323
  return allowedValues.includes(fieldCodeValue) ? fieldCodeValue : "";
324
324
  };
@@ -326,19 +326,19 @@ var getNumberFromUrl = function getNumberFromUrl(_ref6) {
326
326
  var fieldCodes = _ref6.fieldCodes,
327
327
  fieldCode = _ref6.fieldCode,
328
328
  kind = _ref6.kind;
329
- var fieldCodeValue = fieldCodes[fieldCode];
329
+ var fieldCodeValue = resolveQueryParamValue(fieldCodes[fieldCode]);
330
330
  var parsedValue = kind === constants.QUESTION_KIND.INTEGER.value ? parseInt(fieldCodeValue) : parseFloat(fieldCodeValue);
331
331
  return parsedValue || "";
332
332
  };
333
333
  var getNameFromUrl = function getNameFromUrl(_ref7, fieldCodes) {
334
334
  var isSplitMode = _ref7.isSplitMode,
335
335
  fieldCode = _ref7.fieldCode;
336
- var fullName = fieldCodes[fieldCode] || "";
337
- var firstName = fieldCodes["".concat(fieldCode, ".first_name")] || "";
338
- var lastName = fieldCodes["".concat(fieldCode, ".last_name")] || "";
336
+ var fullName = resolveQueryParamValue(fieldCodes[fieldCode]) || "";
339
337
  if (!isSplitMode) return {
340
338
  fullName: fullName
341
339
  };
340
+ var firstName = resolveQueryParamValue(fieldCodes["".concat(fieldCode, ".first_name")]) || "";
341
+ var lastName = resolveQueryParamValue(fieldCodes["".concat(fieldCode, ".last_name")]) || "";
342
342
  if (neetoCist.isPresent(firstName) || neetoCist.isPresent(lastName)) {
343
343
  return {
344
344
  firstName: firstName,
@@ -504,7 +504,7 @@ var generateInitValues = function generateInitValues(_ref9) {
504
504
  default:
505
505
  {
506
506
  var _valuesMap$id$value6, _valuesMap9;
507
- initValues[id] = (_valuesMap$id$value6 = (_valuesMap9 = valuesMap) === null || _valuesMap9 === void 0 || (_valuesMap9 = _valuesMap9[id]) === null || _valuesMap9 === void 0 ? void 0 : _valuesMap9.value) !== null && _valuesMap$id$value6 !== void 0 ? _valuesMap$id$value6 : fieldCodes[fieldCode] || "";
507
+ initValues[id] = (_valuesMap$id$value6 = (_valuesMap9 = valuesMap) === null || _valuesMap9 === void 0 || (_valuesMap9 = _valuesMap9[id]) === null || _valuesMap9 === void 0 ? void 0 : _valuesMap9.value) !== null && _valuesMap$id$value6 !== void 0 ? _valuesMap$id$value6 : resolveQueryParamValue(fieldCodes[fieldCode] || "");
508
508
  return;
509
509
  }
510
510
  }
@@ -690,20 +690,20 @@ var validateSingleChoiceField = function validateSingleChoiceField(_ref5) {
690
690
  var label = _ref5.label,
691
691
  isRequired = _ref5.isRequired;
692
692
  var schema = yup__namespace.string().typeError(getInvalidTypeError(label, "string"));
693
- if (isRequired) schema = schema.required(getSelectMinError("an"));
693
+ if (isRequired) schema = schema.required(getSelectMinError());
694
694
  return schema.trim();
695
695
  };
696
696
  var validateMultiChoiceField = function validateMultiChoiceField(_ref6) {
697
697
  var isRequired = _ref6.isRequired;
698
698
  var schema = yup__namespace.array().of(yup__namespace["boolean"]());
699
- if (isRequired) schema = schema.compact().min(1, getSelectMinError("an"));
699
+ if (isRequired) schema = schema.compact().min(1, getSelectMinError());
700
700
  return schema;
701
701
  };
702
702
  var validateRatingField = function validateRatingField(_ref7) {
703
703
  var label = _ref7.label,
704
704
  isRequired = _ref7.isRequired;
705
705
  var schema = yup__namespace.string().typeError(getInvalidTypeError(label, "string"));
706
- if (isRequired) schema = schema.required(getSelectMinError("an"));
706
+ if (isRequired) schema = schema.required(getSelectMinError());
707
707
  return schema.trim();
708
708
  };
709
709
  var validateStarRatingField = function validateStarRatingField(_ref8) {
@@ -711,7 +711,7 @@ var validateStarRatingField = function validateStarRatingField(_ref8) {
711
711
  isRequired = _ref8.isRequired;
712
712
  var schema = yup__namespace.string().typeError(getInvalidTypeError(label, "string"));
713
713
  if (isRequired) {
714
- schema = schema.required(getSelectMinError("a", t("neetoForm.common.rating")));
714
+ schema = schema.required(getSelectMinError(t("neetoForm.common.rating")));
715
715
  }
716
716
  return schema.trim();
717
717
  };
@@ -742,7 +742,7 @@ var validateMultiEmailField = function validateMultiEmailField(_ref12) {
742
742
  value: yup__namespace.string().email(getInvalidFieldError("Email")).trim()
743
743
  })).nullable();
744
744
  if (isRequired) {
745
- schema = schema.compact().min(1, getSelectMinError("an", t("neetoForm.common.email")));
745
+ schema = schema.compact().min(1, getSelectMinError(t("neetoForm.common.email")));
746
746
  }
747
747
  return schema;
748
748
  };
@@ -841,7 +841,7 @@ var validateVerificationCode = function validateVerificationCode(context) {
841
841
  entity: entity
842
842
  }), function (value) {
843
843
  return neetoCist.isNotPresent(value) || constants.SIX_DIGIT_NUMBER_REGEX.test(value);
844
- }).test("verify code", t("neetoForm.error.pleaseVerifyEmail"), function () {
844
+ }).test("verify code", t("neetoForm.error.emailNotVerified"), function () {
845
845
  var _this$options;
846
846
  return this === null || this === void 0 || (_this$options = this.options) === null || _this$options === void 0 || (_this$options = _this$options.context) === null || _this$options === void 0 ? void 0 : _this$options.isCodeVerified;
847
847
  });
@@ -2431,4 +2431,4 @@ exports.getFieldComponent = getFieldComponent;
2431
2431
  exports.getWithExpiry = getWithExpiry;
2432
2432
  exports.mergeRefs = mergeRefs;
2433
2433
  exports.renderButtonsInOrder = renderButtonsInOrder;
2434
- //# sourceMappingURL=utils-BwFLBXs2.js.map
2434
+ //# sourceMappingURL=utils-Ch7Ggngj.js.map