@wix/form-public 0.45.0 → 0.47.0
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 +356 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +356 -7
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -908,6 +908,13 @@ var init_types_impl2 = __esm({
|
|
|
908
908
|
ErrorType2["MISSING_SERVICE_OPTION_ERROR"] = "MISSING_SERVICE_OPTION_ERROR";
|
|
909
909
|
ErrorType2["INVALID_SERVICE_OPTIONS_ERROR"] = "INVALID_SERVICE_OPTIONS_ERROR";
|
|
910
910
|
ErrorType2["NO_AVAILABLE_SERVICE_OPTIONS_ERROR"] = "NO_AVAILABLE_SERVICE_OPTIONS_ERROR";
|
|
911
|
+
ErrorType2["EXACT_CHARACTER_LENGTH_ERROR"] = "EXACT_CHARACTER_LENGTH_ERROR";
|
|
912
|
+
ErrorType2["CHARACTER_LENGTH_RANGE_ERROR"] = "CHARACTER_LENGTH_RANGE_ERROR";
|
|
913
|
+
ErrorType2["VALUE_RANGE_ERROR"] = "VALUE_RANGE_ERROR";
|
|
914
|
+
ErrorType2["EXACT_ITEMS_NUMBER_ERROR"] = "EXACT_ITEMS_NUMBER_ERROR";
|
|
915
|
+
ErrorType2["DECIMAL_POINT_ERROR"] = "DECIMAL_POINT_ERROR";
|
|
916
|
+
ErrorType2["INCOMPLETE_DATE_ERROR"] = "INCOMPLETE_DATE_ERROR";
|
|
917
|
+
ErrorType2["INVALID_VALUE_FOR_PATTERN_ERROR"] = "INVALID_VALUE_FOR_PATTERN_ERROR";
|
|
911
918
|
})(ErrorType || (ErrorType = {}));
|
|
912
919
|
(function(Format6) {
|
|
913
920
|
Format6["UNDEFINED"] = "UNDEFINED";
|
|
@@ -1720,6 +1727,267 @@ var init_errors = __esm({
|
|
|
1720
1727
|
}
|
|
1721
1728
|
});
|
|
1722
1729
|
|
|
1730
|
+
// ../form-validator/dist/esm/lib/error-derivation/types.js
|
|
1731
|
+
var DateFieldErrorSuffix, DateTimeFieldErrorSuffix;
|
|
1732
|
+
var init_types = __esm({
|
|
1733
|
+
"../form-validator/dist/esm/lib/error-derivation/types.js"() {
|
|
1734
|
+
(function(DateFieldErrorSuffix2) {
|
|
1735
|
+
DateFieldErrorSuffix2["YEAR_MONTH"] = "year-month";
|
|
1736
|
+
DateFieldErrorSuffix2["YEAR_DAY"] = "year-day";
|
|
1737
|
+
DateFieldErrorSuffix2["MONTH_DAY"] = "month-day";
|
|
1738
|
+
DateFieldErrorSuffix2["YEAR"] = "year";
|
|
1739
|
+
DateFieldErrorSuffix2["MONTH"] = "month";
|
|
1740
|
+
DateFieldErrorSuffix2["DAY"] = "day";
|
|
1741
|
+
})(DateFieldErrorSuffix || (DateFieldErrorSuffix = {}));
|
|
1742
|
+
(function(DateTimeFieldErrorSuffix2) {
|
|
1743
|
+
DateTimeFieldErrorSuffix2["YEAR_MONTH_TIME"] = "year-month-time";
|
|
1744
|
+
DateTimeFieldErrorSuffix2["YEAR_DAY_TIME"] = "year-day-time";
|
|
1745
|
+
DateTimeFieldErrorSuffix2["MONTH_DAY_TIME"] = "month-day-time";
|
|
1746
|
+
DateTimeFieldErrorSuffix2["YEAR_TIME"] = "year-time";
|
|
1747
|
+
DateTimeFieldErrorSuffix2["MONTH_TIME"] = "month-time";
|
|
1748
|
+
DateTimeFieldErrorSuffix2["DAY_TIME"] = "day-time";
|
|
1749
|
+
DateTimeFieldErrorSuffix2["TIME"] = "time";
|
|
1750
|
+
})(DateTimeFieldErrorSuffix || (DateTimeFieldErrorSuffix = {}));
|
|
1751
|
+
}
|
|
1752
|
+
});
|
|
1753
|
+
|
|
1754
|
+
// ../form-validator/dist/esm/lib/error-derivation/helpers.js
|
|
1755
|
+
function getDecimalPlacesCount(multipleOf) {
|
|
1756
|
+
return String(multipleOf).split(".")?.[1]?.length || 0;
|
|
1757
|
+
}
|
|
1758
|
+
function deserializeDate(value) {
|
|
1759
|
+
if (!value) {
|
|
1760
|
+
return {};
|
|
1761
|
+
}
|
|
1762
|
+
const parts = value.split("-");
|
|
1763
|
+
if (parts.length === 3) {
|
|
1764
|
+
const [year, month, day] = parts;
|
|
1765
|
+
return {
|
|
1766
|
+
YEAR: year || void 0,
|
|
1767
|
+
MONTH: month || void 0,
|
|
1768
|
+
DAY: day || void 0
|
|
1769
|
+
};
|
|
1770
|
+
}
|
|
1771
|
+
return {};
|
|
1772
|
+
}
|
|
1773
|
+
function parseDateTimeValue(value) {
|
|
1774
|
+
if (!value) {
|
|
1775
|
+
return ["", ""];
|
|
1776
|
+
}
|
|
1777
|
+
const separator = value.indexOf("T") > -1 ? "T" : " ";
|
|
1778
|
+
const [date, time] = value.split(separator);
|
|
1779
|
+
return [date || "", time || ""];
|
|
1780
|
+
}
|
|
1781
|
+
function isTimeComplete(time) {
|
|
1782
|
+
if (!time) {
|
|
1783
|
+
return false;
|
|
1784
|
+
}
|
|
1785
|
+
const [hours, minutes] = time.split(":");
|
|
1786
|
+
return !!hours && !!minutes;
|
|
1787
|
+
}
|
|
1788
|
+
var init_helpers = __esm({
|
|
1789
|
+
"../form-validator/dist/esm/lib/error-derivation/helpers.js"() {
|
|
1790
|
+
}
|
|
1791
|
+
});
|
|
1792
|
+
|
|
1793
|
+
// ../form-validator/dist/esm/lib/error-derivation/error-derivers.js
|
|
1794
|
+
function deriveError(validation, error, options) {
|
|
1795
|
+
if (!error) {
|
|
1796
|
+
return error;
|
|
1797
|
+
}
|
|
1798
|
+
return derivePatternError(error) ?? deriveCharacterLengthError(validation, error) ?? deriveItemsCountError(validation, error) ?? deriveNumericValueError(validation, error) ?? deriveDateFieldError(validation, error, options?.value) ?? deriveDateTimeFieldError(validation, error, options?.value) ?? error;
|
|
1799
|
+
}
|
|
1800
|
+
function derivePatternError(error) {
|
|
1801
|
+
if (!error || error.errorType !== ErrorType.PATTERN_ERROR) {
|
|
1802
|
+
return void 0;
|
|
1803
|
+
}
|
|
1804
|
+
return {
|
|
1805
|
+
...error,
|
|
1806
|
+
errorType: ErrorType.INVALID_VALUE_FOR_PATTERN_ERROR
|
|
1807
|
+
};
|
|
1808
|
+
}
|
|
1809
|
+
function deriveCharacterLengthError(validation, error) {
|
|
1810
|
+
if (!error) {
|
|
1811
|
+
return void 0;
|
|
1812
|
+
}
|
|
1813
|
+
const isMinMaxLengthError = error.errorType === ErrorType.MIN_LENGTH_ERROR || error.errorType === ErrorType.MAX_LENGTH_ERROR;
|
|
1814
|
+
if (!isMinMaxLengthError) {
|
|
1815
|
+
return void 0;
|
|
1816
|
+
}
|
|
1817
|
+
const minLength = validation?.string?.minLength;
|
|
1818
|
+
const maxLength = validation?.string?.maxLength;
|
|
1819
|
+
const hasMinMax = minLength && maxLength;
|
|
1820
|
+
if (hasMinMax && minLength === maxLength) {
|
|
1821
|
+
return {
|
|
1822
|
+
...error,
|
|
1823
|
+
errorType: ErrorType.EXACT_CHARACTER_LENGTH_ERROR,
|
|
1824
|
+
errorMessage: `must have exactly ${minLength} characters`
|
|
1825
|
+
};
|
|
1826
|
+
}
|
|
1827
|
+
if (hasMinMax && minLength !== maxLength) {
|
|
1828
|
+
return {
|
|
1829
|
+
...error,
|
|
1830
|
+
errorType: ErrorType.CHARACTER_LENGTH_RANGE_ERROR,
|
|
1831
|
+
errorMessage: `must have between ${minLength} and ${maxLength} characters`,
|
|
1832
|
+
params: {
|
|
1833
|
+
minLimit: minLength,
|
|
1834
|
+
maxLimit: maxLength
|
|
1835
|
+
}
|
|
1836
|
+
};
|
|
1837
|
+
}
|
|
1838
|
+
return void 0;
|
|
1839
|
+
}
|
|
1840
|
+
function deriveItemsCountError(validation, error) {
|
|
1841
|
+
if (!error) {
|
|
1842
|
+
return void 0;
|
|
1843
|
+
}
|
|
1844
|
+
const isMinMaxItemsError = error.errorType === ErrorType.MIN_ITEMS_ERROR || error.errorType === ErrorType.MAX_ITEMS_ERROR;
|
|
1845
|
+
if (!isMinMaxItemsError) {
|
|
1846
|
+
return void 0;
|
|
1847
|
+
}
|
|
1848
|
+
const minItems = validation?.array?.minItems;
|
|
1849
|
+
const maxItems = validation?.array?.maxItems;
|
|
1850
|
+
const hasMinMax = minItems && maxItems;
|
|
1851
|
+
if (hasMinMax && minItems === maxItems) {
|
|
1852
|
+
return {
|
|
1853
|
+
...error,
|
|
1854
|
+
errorType: ErrorType.EXACT_ITEMS_NUMBER_ERROR,
|
|
1855
|
+
errorMessage: `must choose ${minItems} options`
|
|
1856
|
+
};
|
|
1857
|
+
}
|
|
1858
|
+
return void 0;
|
|
1859
|
+
}
|
|
1860
|
+
function deriveNumericValueError(validation, error) {
|
|
1861
|
+
if (!error) {
|
|
1862
|
+
return void 0;
|
|
1863
|
+
}
|
|
1864
|
+
const isMinMaxValueError = error.errorType === ErrorType.MIN_VALUE_ERROR || error.errorType === ErrorType.MAX_VALUE_ERROR;
|
|
1865
|
+
const isMultipleOfValueError = error.errorType === ErrorType.MULTIPLE_OF_VALUE_ERROR;
|
|
1866
|
+
if (isMinMaxValueError) {
|
|
1867
|
+
const { minPrice, maxPrice } = validation?.predefined?.paymentOptions?.products?.[0]?.dynamicPriceOptions ?? {};
|
|
1868
|
+
const minimum = validation?.number?.minimum ?? minPrice;
|
|
1869
|
+
const maximum = validation?.number?.maximum ?? maxPrice;
|
|
1870
|
+
const hasMinMax = minimum !== void 0 && maximum !== void 0;
|
|
1871
|
+
if (hasMinMax && minimum !== maximum) {
|
|
1872
|
+
return {
|
|
1873
|
+
...error,
|
|
1874
|
+
errorType: ErrorType.VALUE_RANGE_ERROR,
|
|
1875
|
+
errorMessage: `must be from ${minimum} to ${maximum}`,
|
|
1876
|
+
params: {
|
|
1877
|
+
minLimit: minimum,
|
|
1878
|
+
maxLimit: maximum
|
|
1879
|
+
}
|
|
1880
|
+
};
|
|
1881
|
+
}
|
|
1882
|
+
}
|
|
1883
|
+
if (isMultipleOfValueError) {
|
|
1884
|
+
const multipleOf = validation?.number?.multipleOf;
|
|
1885
|
+
if (multipleOf) {
|
|
1886
|
+
const decimalPlaces = getDecimalPlacesCount(multipleOf);
|
|
1887
|
+
return {
|
|
1888
|
+
...error,
|
|
1889
|
+
errorType: ErrorType.DECIMAL_POINT_ERROR,
|
|
1890
|
+
errorMessage: `must have ${decimalPlaces} number(s) after the decimal point`,
|
|
1891
|
+
params: {
|
|
1892
|
+
number: decimalPlaces
|
|
1893
|
+
}
|
|
1894
|
+
};
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1897
|
+
return void 0;
|
|
1898
|
+
}
|
|
1899
|
+
function deriveDateFieldError(_validation, error, value) {
|
|
1900
|
+
const isFormatError = error?.errorType === ErrorType.FORMAT_ERROR;
|
|
1901
|
+
if (!error || !isFormatError) {
|
|
1902
|
+
return void 0;
|
|
1903
|
+
}
|
|
1904
|
+
const { YEAR: _YEAR, MONTH, DAY } = deserializeDate(value);
|
|
1905
|
+
const YEAR = _YEAR?.length === 4;
|
|
1906
|
+
if (!YEAR && !MONTH && !DAY) {
|
|
1907
|
+
return void 0;
|
|
1908
|
+
}
|
|
1909
|
+
const withErrorSuffix = (suffix) => ({
|
|
1910
|
+
...error,
|
|
1911
|
+
errorType: ErrorType.INCOMPLETE_DATE_ERROR,
|
|
1912
|
+
params: {
|
|
1913
|
+
suffix
|
|
1914
|
+
}
|
|
1915
|
+
});
|
|
1916
|
+
if (!YEAR && !MONTH) {
|
|
1917
|
+
return withErrorSuffix(DateFieldErrorSuffix.YEAR_MONTH);
|
|
1918
|
+
} else if (!YEAR && !DAY) {
|
|
1919
|
+
return withErrorSuffix(DateFieldErrorSuffix.YEAR_DAY);
|
|
1920
|
+
} else if (!MONTH && !DAY) {
|
|
1921
|
+
return withErrorSuffix(DateFieldErrorSuffix.MONTH_DAY);
|
|
1922
|
+
} else if (!YEAR) {
|
|
1923
|
+
return withErrorSuffix(DateFieldErrorSuffix.YEAR);
|
|
1924
|
+
} else if (!MONTH) {
|
|
1925
|
+
return withErrorSuffix(DateFieldErrorSuffix.MONTH);
|
|
1926
|
+
} else if (!DAY) {
|
|
1927
|
+
return withErrorSuffix(DateFieldErrorSuffix.DAY);
|
|
1928
|
+
} else {
|
|
1929
|
+
return void 0;
|
|
1930
|
+
}
|
|
1931
|
+
}
|
|
1932
|
+
function deriveDateTimeFieldError(validation, error, value) {
|
|
1933
|
+
const isFormatError = error?.errorType === ErrorType.FORMAT_ERROR;
|
|
1934
|
+
if (!error || !isFormatError) {
|
|
1935
|
+
return void 0;
|
|
1936
|
+
}
|
|
1937
|
+
const [date, time] = parseDateTimeValue(value);
|
|
1938
|
+
const dateValidationError = deriveDateFieldError(validation, error, date);
|
|
1939
|
+
const { YEAR, MONTH, DAY } = deserializeDate(date);
|
|
1940
|
+
const timeComplete = isTimeComplete(time);
|
|
1941
|
+
if (!timeComplete && YEAR?.length !== 4 && !MONTH && !DAY) {
|
|
1942
|
+
return void 0;
|
|
1943
|
+
}
|
|
1944
|
+
if (!timeComplete) {
|
|
1945
|
+
const withErrorSuffix = (suffix) => ({
|
|
1946
|
+
...error,
|
|
1947
|
+
errorType: ErrorType.INCOMPLETE_DATE_ERROR,
|
|
1948
|
+
params: {
|
|
1949
|
+
suffix
|
|
1950
|
+
}
|
|
1951
|
+
});
|
|
1952
|
+
const isDateFieldError = (validationError) => {
|
|
1953
|
+
return validationError?.errorType === ErrorType.INCOMPLETE_DATE_ERROR;
|
|
1954
|
+
};
|
|
1955
|
+
if (isDateFieldError(dateValidationError)) {
|
|
1956
|
+
switch (dateValidationError.params.suffix) {
|
|
1957
|
+
case DateFieldErrorSuffix.YEAR_MONTH:
|
|
1958
|
+
return withErrorSuffix(DateTimeFieldErrorSuffix.YEAR_MONTH_TIME);
|
|
1959
|
+
case DateFieldErrorSuffix.YEAR_DAY:
|
|
1960
|
+
return withErrorSuffix(DateTimeFieldErrorSuffix.YEAR_DAY_TIME);
|
|
1961
|
+
case DateFieldErrorSuffix.MONTH_DAY:
|
|
1962
|
+
return withErrorSuffix(DateTimeFieldErrorSuffix.MONTH_DAY_TIME);
|
|
1963
|
+
case DateFieldErrorSuffix.YEAR:
|
|
1964
|
+
return withErrorSuffix(DateTimeFieldErrorSuffix.YEAR_TIME);
|
|
1965
|
+
case DateFieldErrorSuffix.MONTH:
|
|
1966
|
+
return withErrorSuffix(DateTimeFieldErrorSuffix.MONTH_TIME);
|
|
1967
|
+
case DateFieldErrorSuffix.DAY:
|
|
1968
|
+
return withErrorSuffix(DateTimeFieldErrorSuffix.DAY_TIME);
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1971
|
+
return withErrorSuffix(DateTimeFieldErrorSuffix.TIME);
|
|
1972
|
+
}
|
|
1973
|
+
return dateValidationError;
|
|
1974
|
+
}
|
|
1975
|
+
var init_error_derivers = __esm({
|
|
1976
|
+
"../form-validator/dist/esm/lib/error-derivation/error-derivers.js"() {
|
|
1977
|
+
init_errors();
|
|
1978
|
+
init_types();
|
|
1979
|
+
init_helpers();
|
|
1980
|
+
}
|
|
1981
|
+
});
|
|
1982
|
+
|
|
1983
|
+
// ../form-validator/dist/esm/lib/error-derivation/index.js
|
|
1984
|
+
var init_error_derivation = __esm({
|
|
1985
|
+
"../form-validator/dist/esm/lib/error-derivation/index.js"() {
|
|
1986
|
+
init_error_derivers();
|
|
1987
|
+
init_types();
|
|
1988
|
+
}
|
|
1989
|
+
});
|
|
1990
|
+
|
|
1723
1991
|
// ../../node_modules/ajv/dist/compile/codegen/code.js
|
|
1724
1992
|
var require_code = __commonJS({
|
|
1725
1993
|
"../../node_modules/ajv/dist/compile/codegen/code.js"(exports) {
|
|
@@ -13316,6 +13584,7 @@ var init_form_validator = __esm({
|
|
|
13316
13584
|
"../form-validator/dist/esm/lib/submission-validation/form-validator.js"() {
|
|
13317
13585
|
init_errors();
|
|
13318
13586
|
init_types_impl();
|
|
13587
|
+
init_error_derivation();
|
|
13319
13588
|
init_create_ajv_schema_validator();
|
|
13320
13589
|
init_form_schema_mapper();
|
|
13321
13590
|
init_property_schema_mapper();
|
|
@@ -13416,10 +13685,11 @@ var init_form_validator = __esm({
|
|
|
13416
13685
|
throw new Error(`Missing precompiled schema for form ${formId}`);
|
|
13417
13686
|
}
|
|
13418
13687
|
validate2(fieldSubmission);
|
|
13419
|
-
|
|
13688
|
+
const baseErrors = makeValidationErrors(validate2.errors);
|
|
13689
|
+
return this.deriveErrors(formId, baseErrors, fieldSubmission);
|
|
13420
13690
|
}
|
|
13421
13691
|
validateSubmissionWithFieldMask(ajv, formId, fieldSubmission, fieldIdMasks) {
|
|
13422
|
-
|
|
13692
|
+
const baseErrors = fieldIdMasks.reduce((acc, mask) => {
|
|
13423
13693
|
const validate2 = ajv.getSchema(`${formId}#/properties/${mask}`);
|
|
13424
13694
|
if (!validate2) {
|
|
13425
13695
|
acc.push({
|
|
@@ -13435,6 +13705,82 @@ var init_form_validator = __esm({
|
|
|
13435
13705
|
}
|
|
13436
13706
|
return acc;
|
|
13437
13707
|
}, []);
|
|
13708
|
+
return this.deriveErrors(formId, baseErrors, fieldSubmission);
|
|
13709
|
+
}
|
|
13710
|
+
deriveErrors(formId, errors, submission) {
|
|
13711
|
+
return errors.map((error) => {
|
|
13712
|
+
const validation = this.getFieldValidation(formId, error.errorPath);
|
|
13713
|
+
const value = this.getFieldValue(submission, error.errorPath);
|
|
13714
|
+
return deriveError(validation, error, { value });
|
|
13715
|
+
}).filter((error) => error !== void 0);
|
|
13716
|
+
}
|
|
13717
|
+
getFieldValidation(formId, fieldPath) {
|
|
13718
|
+
const form = this.formSchemas.find((f) => f.id === formId);
|
|
13719
|
+
if (!form) {
|
|
13720
|
+
return void 0;
|
|
13721
|
+
}
|
|
13722
|
+
const pathParts = fieldPath.split("/");
|
|
13723
|
+
const rootFieldId = pathParts[0];
|
|
13724
|
+
const platformisedField = [
|
|
13725
|
+
...form.formFields ?? [],
|
|
13726
|
+
...form.deletedFormFields ?? []
|
|
13727
|
+
].find((f) => {
|
|
13728
|
+
if (f.id === rootFieldId) {
|
|
13729
|
+
return true;
|
|
13730
|
+
}
|
|
13731
|
+
const inputTarget = f.inputOptions?.target;
|
|
13732
|
+
if (inputTarget === rootFieldId) {
|
|
13733
|
+
return true;
|
|
13734
|
+
}
|
|
13735
|
+
return false;
|
|
13736
|
+
});
|
|
13737
|
+
const legacyField = [
|
|
13738
|
+
...form.fields ?? [],
|
|
13739
|
+
...form.deletedFields ?? []
|
|
13740
|
+
].find((f) => {
|
|
13741
|
+
if (f.id === rootFieldId || f.target === rootFieldId) {
|
|
13742
|
+
return true;
|
|
13743
|
+
}
|
|
13744
|
+
return false;
|
|
13745
|
+
});
|
|
13746
|
+
if (platformisedField) {
|
|
13747
|
+
return this.getPlatformisedFieldValidation(platformisedField);
|
|
13748
|
+
} else if (legacyField) {
|
|
13749
|
+
return this.getLegacyFieldValidation(legacyField);
|
|
13750
|
+
} else {
|
|
13751
|
+
return void 0;
|
|
13752
|
+
}
|
|
13753
|
+
}
|
|
13754
|
+
getLegacyFieldValidation(field) {
|
|
13755
|
+
return field.validation;
|
|
13756
|
+
}
|
|
13757
|
+
getPlatformisedFieldValidation(field) {
|
|
13758
|
+
const inputOptions = field.inputOptions;
|
|
13759
|
+
if (!inputOptions) {
|
|
13760
|
+
return void 0;
|
|
13761
|
+
}
|
|
13762
|
+
const validation = {};
|
|
13763
|
+
if (inputOptions.numberOptions?.validation) {
|
|
13764
|
+
validation.number = inputOptions.numberOptions.validation;
|
|
13765
|
+
}
|
|
13766
|
+
if (inputOptions.stringOptions?.validation) {
|
|
13767
|
+
validation.string = inputOptions.stringOptions.validation;
|
|
13768
|
+
}
|
|
13769
|
+
if (inputOptions.arrayOptions?.validation) {
|
|
13770
|
+
validation.array = inputOptions.arrayOptions.validation;
|
|
13771
|
+
}
|
|
13772
|
+
if (Object.keys(validation).length > 0) {
|
|
13773
|
+
return validation;
|
|
13774
|
+
}
|
|
13775
|
+
return void 0;
|
|
13776
|
+
}
|
|
13777
|
+
getFieldValue(submission, fieldPath) {
|
|
13778
|
+
const pathParts = fieldPath.split("/");
|
|
13779
|
+
let value = submission;
|
|
13780
|
+
for (const part of pathParts) {
|
|
13781
|
+
value = value?.[part];
|
|
13782
|
+
}
|
|
13783
|
+
return typeof value === "string" ? value : void 0;
|
|
13438
13784
|
}
|
|
13439
13785
|
isFormDisabled(formSchema) {
|
|
13440
13786
|
const isDeadlinePast = formSchema?.limitationRule?.dateTimeDeadline && new Date(formSchema.limitationRule.dateTimeDeadline).getTime() <= (/* @__PURE__ */ new Date()).getTime();
|
|
@@ -13474,7 +13820,7 @@ var init_form_validator = __esm({
|
|
|
13474
13820
|
});
|
|
13475
13821
|
|
|
13476
13822
|
// ../form-validator/dist/esm/lib/backward-compatibility/field-utils.js
|
|
13477
|
-
function
|
|
13823
|
+
function isInputField2(field) {
|
|
13478
13824
|
if (field.validation) {
|
|
13479
13825
|
asRequired(field.target, field, "target");
|
|
13480
13826
|
}
|
|
@@ -13496,7 +13842,7 @@ function compareSchemaBackwardCompatibility(newSchema, knownSchema) {
|
|
|
13496
13842
|
};
|
|
13497
13843
|
}
|
|
13498
13844
|
function getNonCompatibleFields(newSchema, knownSchema) {
|
|
13499
|
-
newSchema.fields?.forEach(
|
|
13845
|
+
newSchema.fields?.forEach(isInputField2);
|
|
13500
13846
|
const newFieldsWithTarget = (newSchema.fields ?? []).filter(fieldHasTarget);
|
|
13501
13847
|
const knownInputFields = [
|
|
13502
13848
|
...knownSchema.fields ?? [],
|
|
@@ -13855,6 +14201,8 @@ var init_form_schema_validator = __esm({
|
|
|
13855
14201
|
var esm_exports = {};
|
|
13856
14202
|
__export(esm_exports, {
|
|
13857
14203
|
CALLING_COUNTRY_CODES: () => CALLING_COUNTRY_CODES,
|
|
14204
|
+
DateFieldErrorSuffix: () => DateFieldErrorSuffix,
|
|
14205
|
+
DateTimeFieldErrorSuffix: () => DateTimeFieldErrorSuffix,
|
|
13858
14206
|
ErrorTypes: () => ErrorType,
|
|
13859
14207
|
FILE_UPLOAD_FIELD_TYPE: () => FILE_UPLOAD_FIELD_TYPE,
|
|
13860
14208
|
FormSchemaValidator: () => FormSchemaValidator,
|
|
@@ -13872,6 +14220,7 @@ var init_esm = __esm({
|
|
|
13872
14220
|
init_form_schema_validator();
|
|
13873
14221
|
init_errors();
|
|
13874
14222
|
init_calling_country_codes();
|
|
14223
|
+
init_error_derivation();
|
|
13875
14224
|
}
|
|
13876
14225
|
});
|
|
13877
14226
|
|
|
@@ -15822,7 +16171,7 @@ function useFormFields() {
|
|
|
15822
16171
|
var import_extends5 = __toESM(require_extends());
|
|
15823
16172
|
|
|
15824
16173
|
// ../form-fields/dist/esm/ui/form/types/form-view.js
|
|
15825
|
-
function
|
|
16174
|
+
function isInputField(field) {
|
|
15826
16175
|
return Boolean(field.target);
|
|
15827
16176
|
}
|
|
15828
16177
|
function isNestedFormField(field) {
|
|
@@ -16145,7 +16494,7 @@ var FormField = (_ref) => {
|
|
|
16145
16494
|
FieldLayout
|
|
16146
16495
|
}));
|
|
16147
16496
|
}
|
|
16148
|
-
if (
|
|
16497
|
+
if (isInputField(field)) {
|
|
16149
16498
|
return /* @__PURE__ */ React14__default.default.createElement(InputField, (0, import_extends5.default)({}, rest, {
|
|
16150
16499
|
field,
|
|
16151
16500
|
FieldLayout
|
|
@@ -16237,7 +16586,7 @@ var DefaultFieldLayout = (_ref) => {
|
|
|
16237
16586
|
layout,
|
|
16238
16587
|
fieldType
|
|
16239
16588
|
} = fieldView;
|
|
16240
|
-
const dataHook = `form-field-${
|
|
16589
|
+
const dataHook = `form-field-${isInputField(fieldView) ? fieldView.target : fieldView.id}`;
|
|
16241
16590
|
const dataAttributes = {
|
|
16242
16591
|
"data-hook": dataHook,
|
|
16243
16592
|
"data-field-type": fieldType
|