@frankieone/one-sdk 1.9.38 → 1.9.39-rc
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/commit.txt +1 -1
- package/dist/esm/modules/biometrics/definition.d.ts +2 -1
- package/dist/esm/modules/biometrics/definition.d.ts.map +1 -1
- package/dist/esm/modules/common/shared/data/subdivisions/hkg.json +20 -0
- package/dist/esm/modules/common/shared/data/subdivisions/index.d.ts.map +1 -1
- package/dist/esm/modules/common/shared/data/subdivisions/index.js +46 -0
- package/dist/esm/modules/common/shared/data/subdivisions/index.js.map +1 -1
- package/dist/esm/modules/common/shared/data/subdivisions/phl.json +85 -0
- package/dist/esm/modules/common/shared/data/subdivisions/tha.json +79 -0
- package/dist/esm/modules/common/shared/data/subdivisions/twn.json +24 -0
- package/dist/esm/modules/common/shared/models/general.d.ts +1 -1
- package/dist/esm/modules/common/shared/models/general.d.ts.map +1 -1
- package/dist/esm/modules/common/shared/utils/date.d.ts.map +1 -1
- package/dist/esm/modules/common/shared/utils/date.js +27 -0
- package/dist/esm/modules/common/shared/utils/date.js.map +1 -1
- package/dist/esm/modules/form/vendors/react/appConfig.type.d.ts +2 -1
- package/dist/esm/modules/form/vendors/react/appConfig.type.d.ts.map +1 -1
- package/dist/esm/modules/form/vendors/react/appConfig.type.js +4 -0
- package/dist/esm/modules/form/vendors/react/appConfig.type.js.map +1 -1
- package/dist/esm/modules/form/vendors/react/components/base/SharedSelect/Select.d.ts.map +1 -1
- package/dist/esm/modules/form/vendors/react/components/base/SharedSelect/Select.js +6 -2
- package/dist/esm/modules/form/vendors/react/components/base/SharedSelect/Select.js.map +1 -1
- package/dist/esm/modules/form/vendors/react/components/base/StandardDate/StandardDate.d.ts.map +1 -1
- package/dist/esm/modules/form/vendors/react/components/base/StandardDate/StandardDate.js +13 -6
- package/dist/esm/modules/form/vendors/react/components/base/StandardDate/StandardDate.js.map +1 -1
- package/dist/esm/modules/form/vendors/react/constants/form.const.d.ts +66 -1
- package/dist/esm/modules/form/vendors/react/constants/form.const.d.ts.map +1 -1
- package/dist/esm/modules/form/vendors/react/constants/form.const.js +126 -2
- package/dist/esm/modules/form/vendors/react/constants/form.const.js.map +1 -1
- package/dist/esm/modules/form/vendors/react/constants/layoutMapper.const.d.ts +140 -140
- package/dist/esm/modules/form/vendors/react/features/PersonalDetails/personalDetails.config.d.ts.map +1 -1
- package/dist/esm/modules/form/vendors/react/features/Review/config/countries/can.d.ts.map +1 -1
- package/dist/esm/modules/form/vendors/react/features/Review/config/countries/can.js +16 -3
- package/dist/esm/modules/form/vendors/react/features/Review/config/countries/can.js.map +1 -1
- package/dist/esm/modules/form/vendors/react/features/Review/config/countries/col.d.ts.map +1 -1
- package/dist/esm/modules/form/vendors/react/features/Review/config/countries/col.js +46 -3
- package/dist/esm/modules/form/vendors/react/features/Review/config/countries/col.js.map +1 -1
- package/dist/esm/modules/form/vendors/react/features/Review/config/countries/esp.d.ts.map +1 -1
- package/dist/esm/modules/form/vendors/react/features/Review/config/countries/esp.js +45 -4
- package/dist/esm/modules/form/vendors/react/features/Review/config/countries/esp.js.map +1 -1
- package/dist/esm/modules/form/vendors/react/features/Review/config/countries/gbr.d.ts +3 -0
- package/dist/esm/modules/form/vendors/react/features/Review/config/countries/gbr.d.ts.map +1 -0
- package/dist/esm/modules/form/vendors/react/features/Review/config/countries/gbr.js +51 -0
- package/dist/esm/modules/form/vendors/react/features/Review/config/countries/gbr.js.map +1 -0
- package/dist/esm/modules/form/vendors/react/features/Review/config/countries/hkg.d.ts +3 -0
- package/dist/esm/modules/form/vendors/react/features/Review/config/countries/hkg.d.ts.map +1 -0
- package/dist/esm/modules/form/vendors/react/features/Review/config/countries/hkg.js +92 -0
- package/dist/esm/modules/form/vendors/react/features/Review/config/countries/hkg.js.map +1 -0
- package/dist/esm/modules/form/vendors/react/features/Review/config/countries/ind.d.ts.map +1 -1
- package/dist/esm/modules/form/vendors/react/features/Review/config/countries/ind.js +13 -3
- package/dist/esm/modules/form/vendors/react/features/Review/config/countries/ind.js.map +1 -1
- package/dist/esm/modules/form/vendors/react/features/Review/config/countries/mex.d.ts.map +1 -1
- package/dist/esm/modules/form/vendors/react/features/Review/config/countries/mex.js +46 -3
- package/dist/esm/modules/form/vendors/react/features/Review/config/countries/mex.js.map +1 -1
- package/dist/esm/modules/form/vendors/react/features/Review/config/countries/phl.d.ts +3 -0
- package/dist/esm/modules/form/vendors/react/features/Review/config/countries/phl.d.ts.map +1 -0
- package/dist/esm/modules/form/vendors/react/features/Review/config/countries/phl.js +77 -0
- package/dist/esm/modules/form/vendors/react/features/Review/config/countries/phl.js.map +1 -0
- package/dist/esm/modules/form/vendors/react/features/Review/config/countries/tha.d.ts +3 -0
- package/dist/esm/modules/form/vendors/react/features/Review/config/countries/tha.d.ts.map +1 -0
- package/dist/esm/modules/form/vendors/react/features/Review/config/countries/tha.js +136 -0
- package/dist/esm/modules/form/vendors/react/features/Review/config/countries/tha.js.map +1 -0
- package/dist/esm/modules/form/vendors/react/features/Review/config/countries/twn.d.ts +12 -0
- package/dist/esm/modules/form/vendors/react/features/Review/config/countries/twn.d.ts.map +1 -0
- package/dist/esm/modules/form/vendors/react/features/Review/config/countries/twn.js +174 -0
- package/dist/esm/modules/form/vendors/react/features/Review/config/countries/twn.js.map +1 -0
- package/dist/esm/modules/form/vendors/react/features/Review/config/fields/addressField.d.ts +39 -1
- package/dist/esm/modules/form/vendors/react/features/Review/config/fields/addressField.d.ts.map +1 -1
- package/dist/esm/modules/form/vendors/react/features/Review/config/fields/addressField.js +67 -6
- package/dist/esm/modules/form/vendors/react/features/Review/config/fields/addressField.js.map +1 -1
- package/dist/esm/modules/form/vendors/react/features/Review/config/index.d.ts +6 -1
- package/dist/esm/modules/form/vendors/react/features/Review/config/index.d.ts.map +1 -1
- package/dist/esm/modules/form/vendors/react/features/Review/config/index.js +11 -1
- package/dist/esm/modules/form/vendors/react/features/Review/config/index.js.map +1 -1
- package/dist/esm/modules/form/vendors/react/features/Review/fields/drivers-licence.config.d.ts.map +1 -1
- package/dist/esm/modules/form/vendors/react/features/Review/fields/drivers-licence.config.js +37 -0
- package/dist/esm/modules/form/vendors/react/features/Review/fields/drivers-licence.config.js.map +1 -1
- package/dist/esm/modules/form/vendors/react/features/Review/fields/national-id.config.d.ts.map +1 -1
- package/dist/esm/modules/form/vendors/react/features/Review/fields/national-id.config.js +177 -0
- package/dist/esm/modules/form/vendors/react/features/Review/fields/national-id.config.js.map +1 -1
- package/dist/esm/modules/form/vendors/react/features/Review/fields/tax-id.config.d.ts +21 -0
- package/dist/esm/modules/form/vendors/react/features/Review/fields/tax-id.config.d.ts.map +1 -0
- package/dist/esm/modules/form/vendors/react/features/Review/fields/tax-id.config.js +73 -0
- package/dist/esm/modules/form/vendors/react/features/Review/fields/tax-id.config.js.map +1 -0
- package/dist/esm/modules/form/vendors/react/features/Review/review.config.d.ts.map +1 -1
- package/dist/esm/modules/form/vendors/react/features/Review/review.config.js +2 -0
- package/dist/esm/modules/form/vendors/react/features/Review/review.config.js.map +1 -1
- package/dist/esm/modules/form/vendors/react/features/Welcome/docUploadWelcome.config.d.ts.map +1 -1
- package/dist/esm/modules/form/vendors/react/features/Welcome/hostedBusinessWelcome.config.d.ts.map +1 -1
- package/dist/esm/modules/form/vendors/react/features/Welcome/manualWelcome.config.d.ts +2 -2
- package/dist/esm/modules/form/vendors/react/hooks/useManualWrapperFactory.hook.d.ts.map +1 -1
- package/dist/esm/modules/form/vendors/react/hooks/useReviewUpdateFactory.hook.d.ts.map +1 -1
- package/dist/esm/modules/form/vendors/react/hooks/useReviewUpdateFactory.hook.js +56 -19
- package/dist/esm/modules/form/vendors/react/hooks/useReviewUpdateFactory.hook.js.map +1 -1
- package/dist/esm/modules/form/vendors/react/model/error.model.d.ts +2 -2
- package/dist/esm/modules/form/vendors/react/model/error.model.d.ts.map +1 -1
- package/dist/esm/modules/form/vendors/react/model/error.model.js.map +1 -1
- package/dist/esm/modules/form/vendors/react/model/review.model.d.ts.map +1 -1
- package/dist/esm/modules/form/vendors/react/model/review.model.js +18 -11
- package/dist/esm/modules/form/vendors/react/model/review.model.js.map +1 -1
- package/dist/esm/modules/form/vendors/react/utils/object.util.d.ts.map +1 -1
- package/dist/esm/modules/form/vendors/react/utils/object.util.js +5 -0
- package/dist/esm/modules/form/vendors/react/utils/object.util.js.map +1 -1
- package/dist/esm/modules/idv/vendors/common/initialiseSession.d.ts.map +1 -1
- package/dist/esm/modules/idv/vendors/common/initialiseSession.js +27 -8
- package/dist/esm/modules/idv/vendors/common/initialiseSession.js.map +1 -1
- package/dist/esm/modules/meta.json +1 -1
- package/dist/release.txt +1 -1
- package/dist/version.txt +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { ValidationRulesForForm } from '../../../../constants/form.const.js';
|
|
2
|
+
import { addressBlock, barangaySubfield, countrySubfield, localiseFieldMessages, postalCodeSubfield, stateSubfield, streetAddressSubfield, streetNameSubfield, streetNumberSubfield, townSubfield, unitNumberSubfield, } from '../fields/addressField.js';
|
|
3
|
+
import { basePersonalFields } from '../fields/personalFields.js';
|
|
4
|
+
/**
|
|
5
|
+
* Philippines (PHL) — FDEL-52331.
|
|
6
|
+
*
|
|
7
|
+
* English is an official language of the Philippines and PH identity documents
|
|
8
|
+
* print in it, so — like GBR and IND, and unlike HKG/THA/TWN — none of the
|
|
9
|
+
* bilingual-label or non-Gregorian-calendar rules apply. `basePersonalFields`
|
|
10
|
+
* is reused with a single label override.
|
|
11
|
+
*
|
|
12
|
+
* The KYC cascade behind this screen is GDC (GVT2, source `ph-cns3`) then
|
|
13
|
+
* DataZoo ("Philippines Credit Bureau"), dev-tested on FDEL-52364. Four things
|
|
14
|
+
* follow from what those two providers actually receive:
|
|
15
|
+
*
|
|
16
|
+
* 1. **Single family name.** GDC's `countries_surname_mapping` lists only
|
|
17
|
+
* MX/ES/PT, so there is no paternal/maternal split to mirror — unlike the
|
|
18
|
+
* Spanish-speaking countries.
|
|
19
|
+
* 2. **Middle name earns its place, but stays optional.** DataZoo is sent
|
|
20
|
+
* `middleName` (the dev test sent "CRUZ"), and on a Filipino document the
|
|
21
|
+
* middle name is conventionally the mother's maiden surname — worth
|
|
22
|
+
* labelling. GDC is not sent one at all, and an applicant without one must
|
|
23
|
+
* not be blocked, so no `required` rule.
|
|
24
|
+
* 3. **A Barangay field.** `address.suburb` maps to DataZoo's
|
|
25
|
+
* `addressElement2` for PHL (connectors PR #2427). No other country in this
|
|
26
|
+
* epic needed it.
|
|
27
|
+
* 4. **A 4-digit ZIP.** `con_gdc.json` PH sets
|
|
28
|
+
* `"postal_code_pattern": "^\\d{4}$"`; the dev test sent "1405".
|
|
29
|
+
*
|
|
30
|
+
* The province dropdown resolves from `subdivisions/phl.json`, where Metro
|
|
31
|
+
* Manila carries the code "NCR" — the value both providers were tested with.
|
|
32
|
+
*/
|
|
33
|
+
const PHL_PERSONAL_LABELS = {
|
|
34
|
+
// On a Philippine ID the middle name is conventionally the mother's maiden
|
|
35
|
+
// surname. Overridden here, not in personalFields.ts: basePersonalFields is
|
|
36
|
+
// shared by every other country.
|
|
37
|
+
middleName: "Middle Name (Mother's Maiden Name)",
|
|
38
|
+
};
|
|
39
|
+
const phlPersonalFields = basePersonalFields.map((field) => {
|
|
40
|
+
const label = PHL_PERSONAL_LABELS[field.name];
|
|
41
|
+
return (label ? Object.assign(Object.assign({}, field), { label }) : field);
|
|
42
|
+
});
|
|
43
|
+
/**
|
|
44
|
+
* The subfield helpers word their `required` messages after their own default
|
|
45
|
+
* labels, not after the label this country renamed the field to — so the form
|
|
46
|
+
* asked for a 'state' on a form whose field is Province. Localisation is not the issue here; the message simply names a
|
|
47
|
+
* field that is not on the screen. Surfaced by QE on Taiwan, where the same
|
|
48
|
+
* fields also needed translating (FDEL-52329).
|
|
49
|
+
*/
|
|
50
|
+
const PHL_ADDRESS_MESSAGES = {
|
|
51
|
+
'address.streetNumber': {
|
|
52
|
+
required: 'Please enter your house or building number',
|
|
53
|
+
},
|
|
54
|
+
'address.town': { required: 'Please enter your city or municipality' },
|
|
55
|
+
'address.state': { required: 'Please select your province' },
|
|
56
|
+
};
|
|
57
|
+
export const phlReviewFieldConfig = [
|
|
58
|
+
...phlPersonalFields,
|
|
59
|
+
addressBlock(localiseFieldMessages([
|
|
60
|
+
countrySubfield(),
|
|
61
|
+
unitNumberSubfield('Unit / Floor (optional)'),
|
|
62
|
+
streetNumberSubfield('House / Building Number'),
|
|
63
|
+
streetNameSubfield('Street Name'),
|
|
64
|
+
streetAddressSubfield('Street Address'),
|
|
65
|
+
barangaySubfield('Barangay'),
|
|
66
|
+
townSubfield('City / Municipality'),
|
|
67
|
+
stateSubfield('Province', 'Select your province'),
|
|
68
|
+
postalCodeSubfield({
|
|
69
|
+
label: 'ZIP Code',
|
|
70
|
+
digits: 4,
|
|
71
|
+
pattern: Object.assign({}, ValidationRulesForForm.onlyNumbers),
|
|
72
|
+
minMessage: 'ZIP code must be 4 digits',
|
|
73
|
+
maxMessage: 'ZIP code must be 4 digits',
|
|
74
|
+
}),
|
|
75
|
+
], PHL_ADDRESS_MESSAGES)),
|
|
76
|
+
];
|
|
77
|
+
//# sourceMappingURL=phl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phl.js","sourceRoot":"","sources":["../../../../../../../../../../modules/form/vendors/react/features/Review/config/countries/phl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EAClB,aAAa,EACb,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,EACpB,YAAY,EACZ,kBAAkB,GACnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAI9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,mBAAmB,GAA2B;IA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/form/vendors/react/features/Review/config/countries/tha.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAuK5D,eAAO,MAAM,oBAAoB,EAAE,SAAS,EAc3C,CAAC"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { ValidationRulesForForm } from '../../../../constants/form.const.js';
|
|
2
|
+
import { addressBlock, countrySubfield, localiseFieldMessages, postalCodeSubfield, stateSubfield, streetAddressSubfield, streetNameSubfield, streetNumberSubfield, townSubfield, unitNumberSubfield, } from '../fields/addressField.js';
|
|
3
|
+
import { basePersonalFields } from '../fields/personalFields.js';
|
|
4
|
+
// Bilingual labels follow the MEX/ESP/HKG convention: local script first, then
|
|
5
|
+
// English ("Calle / Street"). A fullwidth slash (/) is used *inside* the Thai
|
|
6
|
+
// segment so the ASCII " / " stays unambiguously the language separator.
|
|
7
|
+
const THA_PERSONAL_LABELS = {
|
|
8
|
+
givenName: 'ชื่อ / Given Name',
|
|
9
|
+
middleName: 'ชื่อกลาง / Middle Name',
|
|
10
|
+
familyName: 'นามสกุล / Family Name',
|
|
11
|
+
'extraData.otherName': 'ชื่ออื่น / Other Name(s)',
|
|
12
|
+
dateOfBirth: 'วันเกิด / Date of Birth',
|
|
13
|
+
};
|
|
14
|
+
// Bilingual label *and* a Thai-tolerant pattern. Every base name field ships a
|
|
15
|
+
// Latin-only pattern, so a Thai applicant correcting their name in Thai script —
|
|
16
|
+
// the only script it is written in on the card — was rejected by the form before
|
|
17
|
+
// the submit could reach any connector. Only the four name fields carry a
|
|
18
|
+
// pattern; dateOfBirth is skipped by the guard. (FDEL-52332)
|
|
19
|
+
const thaBaseFields = basePersonalFields.map((field) => {
|
|
20
|
+
var _a;
|
|
21
|
+
const label = THA_PERSONAL_LABELS[field.name];
|
|
22
|
+
const rules = ((_a = field.rules) === null || _a === void 0 ? void 0 : _a.pattern)
|
|
23
|
+
? Object.assign(Object.assign({}, field.rules), { pattern: Object.assign({}, ValidationRulesForForm.thaiOrLatinNameWithSpaceAndHyphen) }) : field.rules;
|
|
24
|
+
return Object.assign(Object.assign(Object.assign({}, field), (label ? { label } : {})), { rules });
|
|
25
|
+
});
|
|
26
|
+
// Every free-text address line comes off the scan in Thai script
|
|
27
|
+
// (ocr_scanned_address, _address_street, _address_city), and the shared
|
|
28
|
+
// subfields default to Latin-only patterns — which is what failed the review
|
|
29
|
+
// screen on a real Thai address. Applied to all five, not just streetAddress:
|
|
30
|
+
// which of streetAddress vs streetName/streetNumber is visible depends on the
|
|
31
|
+
// customer's street-split config. (FDEL-52332)
|
|
32
|
+
const thaText = Object.assign({}, ValidationRulesForForm.thaiOrLatinAlphaNumericSomeSpecialWords);
|
|
33
|
+
/**
|
|
34
|
+
* Home-country name, applicant-entered. Not a nicety: the th-nationalid (DOPA)
|
|
35
|
+
* check reads these as the names it sends, and the real Thai scan carries Thai
|
|
36
|
+
* script for the address and issuing authority but never for the name, so there
|
|
37
|
+
* is no OCR key to pre-fill them from. (FDEL-52332)
|
|
38
|
+
*
|
|
39
|
+
* Thai *or* English, matching what Thai KYC accepts. Note the connector is
|
|
40
|
+
* currently stricter than that: isThaiName()
|
|
41
|
+
* (connectors/driver/netbay/dopa/request.go) rejects any Latin character, so an
|
|
42
|
+
* English value here fails at the check rather than at the field until that gate
|
|
43
|
+
* is relaxed. Product call — the form no longer pretends the narrower rule is
|
|
44
|
+
* the product rule.
|
|
45
|
+
*
|
|
46
|
+
* The key names are DOPA's own: it reads home_country_givenname /
|
|
47
|
+
* home_country_familyname off the *entity's* extraData (request.go:173), which
|
|
48
|
+
* is why useReviewUpdateFactory routes them there rather than onto the document.
|
|
49
|
+
*/
|
|
50
|
+
const nativeNameField = (name, label, requiredMessage) => ({
|
|
51
|
+
fieldType: 'input',
|
|
52
|
+
dataType: 'text',
|
|
53
|
+
hide: false,
|
|
54
|
+
label,
|
|
55
|
+
name: `extraData.${name}`,
|
|
56
|
+
rules: {
|
|
57
|
+
required: { value: true, message: requiredMessage },
|
|
58
|
+
pattern: Object.assign({}, ValidationRulesForForm.thaiOrLatinNameWithSpaceAndHyphen),
|
|
59
|
+
},
|
|
60
|
+
testid: { input: `${name.replace(/_/g, '-')}-input` },
|
|
61
|
+
});
|
|
62
|
+
// Full address block, postcode included — unlike HKG, Thailand issues 5-digit
|
|
63
|
+
// postal codes and the scan returns one (ocr_scanned_address_postcode).
|
|
64
|
+
//
|
|
65
|
+
// ponytail: no sub-district (khwaeng/tambon) field. Incode does return it, but
|
|
66
|
+
// only as raw.checkedAddressBean.colony — a raw.* key the BFF ocr_scanned_*
|
|
67
|
+
// pass-through drops, exactly like Mexico's Colonia. Adding an unbacked field
|
|
68
|
+
// would fake a mapping that does not exist; reported on FDEL-52365 instead.
|
|
69
|
+
// Add it here once the connector emits it as an ocr_scanned_* key.
|
|
70
|
+
/**
|
|
71
|
+
* The `required` messages, in the same two scripts as the labels.
|
|
72
|
+
*
|
|
73
|
+
* The pattern messages were localised when the Thai-script rules landed
|
|
74
|
+
* (#1134); the required ones were missed, so เขต/อำเภอ / District rejected with
|
|
75
|
+
* 'Please enter your suburb/town.' and จังหวัด / Province with 'Please select
|
|
76
|
+
* your state' — English-only, and naming fields this form does not have. Same
|
|
77
|
+
* defect QE raised on Taiwan (FDEL-52329).
|
|
78
|
+
*
|
|
79
|
+
* Each Thai string reuses the noun from the label it belongs to rather than
|
|
80
|
+
* introducing new vocabulary.
|
|
81
|
+
*/
|
|
82
|
+
const THA_ADDRESS_MESSAGES = {
|
|
83
|
+
'address.country': {
|
|
84
|
+
required: 'กรุณาเลือกประเทศ / Please select your country',
|
|
85
|
+
},
|
|
86
|
+
'address.streetNumber': {
|
|
87
|
+
required: 'กรุณากรอกบ้านเลขที่ / Please enter your house number',
|
|
88
|
+
},
|
|
89
|
+
'address.streetName': { required: 'กรุณากรอกถนน / Please enter your street' },
|
|
90
|
+
'address.streetAddress': {
|
|
91
|
+
required: 'กรุณากรอกที่อยู่ / Please enter your street address',
|
|
92
|
+
},
|
|
93
|
+
'address.town': {
|
|
94
|
+
required: 'กรุณากรอกเขต/อำเภอ / Please enter your district',
|
|
95
|
+
},
|
|
96
|
+
'address.state': {
|
|
97
|
+
required: 'กรุณาเลือกจังหวัด / Please select your province',
|
|
98
|
+
},
|
|
99
|
+
'address.postalCode': {
|
|
100
|
+
required: 'กรุณากรอกรหัสไปรษณีย์ / Please enter your postal code',
|
|
101
|
+
pattern: 'รหัสไปรษณีย์ต้องเป็นตัวเลขเท่านั้น / Postal code must be numbers only',
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
const thaAddressBlock = Object.assign(Object.assign({}, addressBlock(localiseFieldMessages([
|
|
105
|
+
countrySubfield('ประเทศ / Country'),
|
|
106
|
+
unitNumberSubfield('ห้องเลขที่ / Unit Number', thaText),
|
|
107
|
+
streetNumberSubfield('บ้านเลขที่ / House Number', thaText),
|
|
108
|
+
streetNameSubfield('ถนน / Street', thaText),
|
|
109
|
+
streetAddressSubfield('ที่อยู่ / Street Address', thaText),
|
|
110
|
+
// เขต in Bangkok, อำเภอ everywhere else — both, fullwidth-separated.
|
|
111
|
+
townSubfield('เขต/อำเภอ / District', thaText),
|
|
112
|
+
stateSubfield('จังหวัด / Province', 'เลือกจังหวัด / Select your province'),
|
|
113
|
+
postalCodeSubfield({
|
|
114
|
+
label: 'รหัสไปรษณีย์ / Postal Code',
|
|
115
|
+
digits: 5,
|
|
116
|
+
pattern: Object.assign({}, ValidationRulesForForm.onlyNumbers),
|
|
117
|
+
minMessage: 'รหัสไปรษณีย์ต้องมี 5 หลัก / Postal code must be 5 digits',
|
|
118
|
+
maxMessage: 'รหัสไปรษณีย์ต้องมี 5 หลัก / Postal code must be 5 digits',
|
|
119
|
+
}),
|
|
120
|
+
], THA_ADDRESS_MESSAGES))), { label: 'ที่อยู่ / Residential Address', placeholder: 'พิมพ์ที่อยู่ของคุณ / Type in your address', helperText: 'ไม่สามารถใช้ตู้ ปณ. ได้ / Cannot be a PO Box', rules: {
|
|
121
|
+
required: {
|
|
122
|
+
value: true,
|
|
123
|
+
message: 'กรุณากรอกที่อยู่ / Please enter your residential address',
|
|
124
|
+
},
|
|
125
|
+
} });
|
|
126
|
+
// Single family name, like CAN/IND/HKG: the real scan sets
|
|
127
|
+
// ocr_scanned_paternal_last_name to a copy of ocr_scanned_last_name and emits no
|
|
128
|
+
// maternal key, so the Spanish split would only duplicate a value.
|
|
129
|
+
export const thaReviewFieldConfig = [
|
|
130
|
+
...thaBaseFields.slice(0, 3),
|
|
131
|
+
nativeNameField('home_country_givenname', 'ชื่อภาษาไทย / Given Name (Thai)', 'กรุณากรอกชื่อเป็นภาษาไทยหรืออังกฤษ / Please enter your given name'),
|
|
132
|
+
nativeNameField('home_country_familyname', 'นามสกุลภาษาไทย / Family Name (Thai)', 'กรุณากรอกนามสกุลเป็นภาษาไทยหรืออังกฤษ / Please enter your family name'),
|
|
133
|
+
...thaBaseFields.slice(3),
|
|
134
|
+
thaAddressBlock,
|
|
135
|
+
];
|
|
136
|
+
//# sourceMappingURL=tha.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tha.js","sourceRoot":"","sources":["../../../../../../../../../../modules/form/vendors/react/features/Review/config/countries/tha.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EACL,YAAY,EACZ,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EAClB,aAAa,EACb,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,EACpB,YAAY,EACZ,kBAAkB,GACnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAI9D,+EAA+E;AAC/E,8EAA8E;AAC9E,yEAAyE;AACzE,MAAM,mBAAmB,GAA2B;IAClD,SAAS,EAAE,mBAAmB;IAC9B,UAAU,EAAE,wBAAwB;IACpC,UAAU,EAAE,uBAAuB;IACnC,qBAAqB,EAAE,0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AE,2CAA2C,EACxD,UAAU,EAAE,8CAA8C,EAC1D,KAAK,EAAE;QACL,QAAQ,EAAE;YACR,KAAK,EAAE,IAAI;YACX,OAAO,EAAE,0DAA0D;SACpE;KACF,GACW,CAAC;AAEf,2DAA2D;AAC3D,iFAAiF;AACjF,mEAAmE;AACnE,MAAM,CAAC,MAAM,oBAAoB,GAAgB;IAC/C,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;IAC5B,eAAe,CACb,wBAAwB,EACxB,iCAAiC,EACjC,mEAAmE,CACpE;IACD,eAAe,CACb,yBAAyB,EACzB,qCAAqC,EACrC,uEAAuE,CACxE;IACD,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;IACzB,eAAe;CAChB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FormField } from '../../../../appConfig.type';
|
|
2
|
+
/**
|
|
3
|
+
* One name pair, in Chinese, and a single family name.
|
|
4
|
+
*
|
|
5
|
+
* A 中華民國國民身分證 prints 姓名 in Han characters and nothing else — no
|
|
6
|
+
* romanised name anywhere on the card — so the applicant is asked for their name
|
|
7
|
+
* once, in the script the document actually shows. The Spanish
|
|
8
|
+
* paternal/maternal split would only duplicate the single 姓, as for
|
|
9
|
+
* HKG/THA/CAN/IND.
|
|
10
|
+
*/
|
|
11
|
+
export declare const twnReviewFieldConfig: FormField[];
|
|
12
|
+
//# sourceMappingURL=twn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"twn.d.ts","sourceRoot":"","sources":["../../../../../../../../../../modules/form/vendors/react/features/Review/config/countries/twn.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAsN5D;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,EAAE,SAAS,EAG3C,CAAC"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { COUNTRY_CALENDAR, LocaleType, ValidationRulesForForm, } from '../../../../constants/form.const.js';
|
|
2
|
+
import { addressBlock, countrySubfield, localiseFieldMessages, postalCodeSubfield, stateSubfield, streetAddressSubfield, streetNameSubfield, streetNumberSubfield, townSubfield, unitNumberSubfield, } from '../fields/addressField.js';
|
|
3
|
+
import { basePersonalFields } from '../fields/personalFields.js';
|
|
4
|
+
// Bilingual labels follow the HKG/MEX/THA convention: local script first, then
|
|
5
|
+
// English. Fullwidth punctuation (/()) goes *inside* the Chinese segment so
|
|
6
|
+
// the ASCII " / " stays unambiguously the language separator.
|
|
7
|
+
const TWN_PERSONAL_LABELS = {
|
|
8
|
+
givenName: '中文名字 / Given Name (Chinese)',
|
|
9
|
+
familyName: '中文姓氏 / Family Name (Chinese)',
|
|
10
|
+
'extraData.otherName': '其他姓名 / Other Name(s)',
|
|
11
|
+
dateOfBirth: '出生日期(民國) / Date of Birth (ROC era)',
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* The name fields hold Han script, so they override the Latin-only pattern
|
|
15
|
+
* `basePersonalFields` carries — and its English-only messages with it, since a
|
|
16
|
+
* rejection has to explain itself in the script the applicant is typing.
|
|
17
|
+
*/
|
|
18
|
+
const TWN_NAME_MESSAGES = {
|
|
19
|
+
givenName: {
|
|
20
|
+
required: '請輸入您的中文名字 / Please enter your given name in Chinese',
|
|
21
|
+
pattern: '中文名字僅能使用中文字 / Given name must use Chinese characters only',
|
|
22
|
+
},
|
|
23
|
+
familyName: {
|
|
24
|
+
required: '請輸入您的中文姓氏 / Please enter your family name in Chinese',
|
|
25
|
+
pattern: '中文姓氏僅能使用中文字 / Family name must use Chinese characters only',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Han script on `givenName` / `familyName` — the ENTITY name — not on
|
|
30
|
+
* `extraData.home_country_*`.
|
|
31
|
+
*
|
|
32
|
+
* That placement is the whole point: `useReviewUpdateFactory` routes these to
|
|
33
|
+
* `name.givenName` / `name.familyName`, which is what the Taiwan check is built
|
|
34
|
+
* from (`entity.Name.GivenName`,
|
|
35
|
+
* connectors/driver/gdc/service/request.go:140). Parked on extraData instead,
|
|
36
|
+
* GDC would see an empty name and fall back to `DisplayName`.
|
|
37
|
+
*
|
|
38
|
+
* Accepted consequence: the GDC 2+ request now carries Han characters. GDC only
|
|
39
|
+
* length-validates names (request.go:504), so the request is accepted — but
|
|
40
|
+
* whether its Taiwan datasource matches on Han rather than a romanisation is
|
|
41
|
+
* unverified, and is the top item in the hand-off. (FDEL-52329)
|
|
42
|
+
*/
|
|
43
|
+
const localiseNameRules = (field) => {
|
|
44
|
+
var _a;
|
|
45
|
+
const messages = TWN_NAME_MESSAGES[field.name];
|
|
46
|
+
if (!messages)
|
|
47
|
+
return field;
|
|
48
|
+
const rules = (_a = field.rules) !== null && _a !== void 0 ? _a : {};
|
|
49
|
+
return Object.assign(Object.assign({}, field), { rules: Object.assign(Object.assign({}, rules), { required: { value: true, message: messages.required }, pattern: Object.assign(Object.assign({}, ValidationRulesForForm.hanScriptWithSeparators), { message: messages.pattern }) }) });
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* The DOB is displayed in the Minguo / 民國 era, because that is what the ROC
|
|
53
|
+
* national ID prints (民國114年 = 2025).
|
|
54
|
+
*
|
|
55
|
+
* The era comes from `COUNTRY_CALENDAR`, not a literal, because
|
|
56
|
+
* `useReviewUpdateFactory` reads the same list to convert the value on prefill
|
|
57
|
+
* and submit. If the form displayed one era while the submit path assumed
|
|
58
|
+
* another, the entity would be written a DOB 1911 years out — and the GDC 2+
|
|
59
|
+
* match would fail on every Taiwanese applicant. (FDEL-52329)
|
|
60
|
+
*
|
|
61
|
+
* The year placeholder says 民國年 on purpose: the applicant has to know the
|
|
62
|
+
* field wants 114, not 2025.
|
|
63
|
+
*/
|
|
64
|
+
const twnDobCalendarConfig = (base) => (Object.assign(Object.assign({}, base), { calendarConfig: Object.assign(Object.assign({}, base.calendarConfig), { type: COUNTRY_CALENDAR.TWN, locale: LocaleType.Chinese, day: { placeholder: '日 / Day', testid: { input: 'dob-day-input' } }, month: {
|
|
65
|
+
placeholder: '月 / Month',
|
|
66
|
+
testid: { input: 'dob-month-input' },
|
|
67
|
+
}, year: {
|
|
68
|
+
placeholder: '民國年 / Year (ROC)',
|
|
69
|
+
testid: { input: 'dob-year-input' },
|
|
70
|
+
}, message: '請輸入有效的出生日期 / Please enter a valid date of birth' }) }));
|
|
71
|
+
// Overridden here rather than in personalFields.ts: these labels are TWN-only
|
|
72
|
+
// data, and basePersonalFields is shared by every other country.
|
|
73
|
+
//
|
|
74
|
+
// Middle name is dropped outright. HKG keeps it because an HKID prints a
|
|
75
|
+
// romanised name that can carry one; a ROC card prints 姓名 as a single Han
|
|
76
|
+
// string, so the field is dead space on every Taiwanese application.
|
|
77
|
+
const twnBaseFields = basePersonalFields
|
|
78
|
+
.filter((field) => field.name !== 'middleName')
|
|
79
|
+
.map((field) => {
|
|
80
|
+
const label = TWN_PERSONAL_LABELS[field.name];
|
|
81
|
+
const localised = localiseNameRules((label ? Object.assign(Object.assign({}, field), { label }) : field));
|
|
82
|
+
return field.name === 'dateOfBirth'
|
|
83
|
+
? twnDobCalendarConfig(localised)
|
|
84
|
+
: localised;
|
|
85
|
+
});
|
|
86
|
+
/**
|
|
87
|
+
* Full address block with a postal code.
|
|
88
|
+
*
|
|
89
|
+
* The shape is pinned by the GDC TW rule
|
|
90
|
+
* (connectors/cmd/gdc/con_gdc.json soft_validation_rules.TW): street_name, town
|
|
91
|
+
* and postal_code are required, requires_house_number is false, and the postal
|
|
92
|
+
* code is `^\d{3,5}$` — Taiwan issues both the legacy 3-digit and the current
|
|
93
|
+
* 5-digit form, so a fixed-length rule would reject half of them.
|
|
94
|
+
*
|
|
95
|
+
* ponytail: no 里/鄰 (village/neighbourhood) field. Incode returns it only as
|
|
96
|
+
* raw.checkedAddressBean.colony, a raw.* key the BFF ocr_scanned_* pass-through
|
|
97
|
+
* drops — the same hole as Mexico's Colonia and Thailand's khwaeng. Adding an
|
|
98
|
+
* unbacked field would fake a mapping that does not exist. Add it once the
|
|
99
|
+
* connector emits it as an ocr_scanned_* key.
|
|
100
|
+
*/
|
|
101
|
+
/**
|
|
102
|
+
* Every `required` message the TWN address block can raise, bilingual and worded
|
|
103
|
+
* after the label the applicant is actually looking at.
|
|
104
|
+
*
|
|
105
|
+
* The subfield helpers word theirs after their own defaults, so 縣市 / County /
|
|
106
|
+
* City rejected with 'Please select your state' and 鄉鎮市區 / District with
|
|
107
|
+
* 'Please enter your suburb/town.' — English-only, and naming fields that do not
|
|
108
|
+
* exist on this form. (FDEL-52329, QE review)
|
|
109
|
+
*/
|
|
110
|
+
const TWN_REQUIRED_MESSAGES = {
|
|
111
|
+
'address.country': {
|
|
112
|
+
required: '請選擇國家或地區 / Please select your country or region',
|
|
113
|
+
},
|
|
114
|
+
'address.streetNumber': {
|
|
115
|
+
required: '請輸入門牌號碼 / Please enter your street number',
|
|
116
|
+
},
|
|
117
|
+
'address.streetName': {
|
|
118
|
+
required: '請輸入街道名稱 / Please enter your street name',
|
|
119
|
+
},
|
|
120
|
+
'address.streetAddress': {
|
|
121
|
+
required: '請輸入街道地址 / Please enter your street address',
|
|
122
|
+
},
|
|
123
|
+
'address.town': { required: '請輸入鄉鎮市區 / Please enter your district' },
|
|
124
|
+
'address.state': {
|
|
125
|
+
required: '請選擇縣市 / Please select your county or city',
|
|
126
|
+
},
|
|
127
|
+
'address.postalCode': {
|
|
128
|
+
required: '請輸入郵遞區號 / Please enter your postal code',
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
// A Taiwanese address is Han script with Arabic numerals ('民權東路六段 165 號'),
|
|
132
|
+
// which is what the scan pre-fills these fields with — so the shared Latin-only
|
|
133
|
+
// pattern rejects a value the applicant never typed and cannot correct without
|
|
134
|
+
// romanising their own address. Same override MEX makes for its accents.
|
|
135
|
+
const twnAddressPattern = Object.assign({}, ValidationRulesForForm.hanOrLatinAlphaNumericSomeSpecialWords);
|
|
136
|
+
const twnAddressBlock = Object.assign(Object.assign({}, addressBlock(localiseFieldMessages([
|
|
137
|
+
countrySubfield('國家/地區 / Country'),
|
|
138
|
+
unitNumberSubfield('樓/室(選填) / Floor / Unit (optional)', twnAddressPattern),
|
|
139
|
+
streetNumberSubfield('門牌號碼 / Street Number', twnAddressPattern),
|
|
140
|
+
streetNameSubfield('街道名稱 / Street Name', twnAddressPattern),
|
|
141
|
+
streetAddressSubfield('街道地址 / Street Address', twnAddressPattern),
|
|
142
|
+
// 鄉/鎮/市/區 are the four names for the same tier, fullwidth-joined.
|
|
143
|
+
townSubfield('鄉鎮市區 / District', twnAddressPattern),
|
|
144
|
+
stateSubfield('縣市 / County / City', '請選擇縣市 / Select your county or city'),
|
|
145
|
+
postalCodeSubfield({
|
|
146
|
+
label: '郵遞區號 / Postal Code',
|
|
147
|
+
pattern: {
|
|
148
|
+
value: '^[0-9]{3,5}$',
|
|
149
|
+
message: '郵遞區號須為3至5位數字 / Postal code must be 3 to 5 digits',
|
|
150
|
+
},
|
|
151
|
+
}),
|
|
152
|
+
], TWN_REQUIRED_MESSAGES))), {
|
|
153
|
+
// addressBlock() hardcodes English chrome for every country; override the
|
|
154
|
+
// applicant-visible strings here rather than widen its signature.
|
|
155
|
+
label: '居住地址 / Residential Address', placeholder: '輸入您的地址 / Type in your address', helperText: '不可使用郵政信箱 / Cannot be a PO Box', rules: {
|
|
156
|
+
required: {
|
|
157
|
+
value: true,
|
|
158
|
+
message: '請輸入居住地址 / Please enter your residential address',
|
|
159
|
+
},
|
|
160
|
+
} });
|
|
161
|
+
/**
|
|
162
|
+
* One name pair, in Chinese, and a single family name.
|
|
163
|
+
*
|
|
164
|
+
* A 中華民國國民身分證 prints 姓名 in Han characters and nothing else — no
|
|
165
|
+
* romanised name anywhere on the card — so the applicant is asked for their name
|
|
166
|
+
* once, in the script the document actually shows. The Spanish
|
|
167
|
+
* paternal/maternal split would only duplicate the single 姓, as for
|
|
168
|
+
* HKG/THA/CAN/IND.
|
|
169
|
+
*/
|
|
170
|
+
export const twnReviewFieldConfig = [
|
|
171
|
+
...twnBaseFields,
|
|
172
|
+
twnAddressBlock,
|
|
173
|
+
];
|
|
174
|
+
//# sourceMappingURL=twn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"twn.js","sourceRoot":"","sources":["../../../../../../../../../../modules/form/vendors/react/features/Review/config/countries/twn.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,UAAU,EACV,sBAAsB,GACvB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,YAAY,EACZ,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EAClB,aAAa,EACb,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,EACpB,YAAY,EACZ,kBAAkB,GACnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAI9D,+EAA+E;AAC/E,4EAA4E;AAC5E,8DAA8D;AAC9D,MAAM,mBAAmB,GAA2B;IAClD,SAAS,EAAE,6BAA6B;IACxC,UAAU,EAAE,8BAA8B;IAC1C,qBAAqB,EAAE,sBAAsB;IAC7C,WAAW,EAAE,oCAAoC;CAClD,CAAC;AAEF;;;;GAIG;AACH,MAAM,iBAAiB,GACrB;IACE,SAAS,EAAE;QACT,QAAQ,EAAE,qDAAqD;QAC/D,OAAO,EACL,2DAA2D;KAC9D;IACD,UAAU,EAAE;QACV,QAAQ,EAAE,sDAAsD;QAChE,OAAO,EACL,4DAA4D;KAC/D;CACF,CAAC;AAEJ;;;;;;;;;;;;;;GAcG;AACH,MAAM,iBAAiB,GAAG,CAAC,KAAgB,EAAa,EAAE;;IACxD,MAAM,QAAQ,GAAG,iBAAiB,CAAC,KAAK,CAAC,IAAc,CAAC,CAAC;IACzD,IAAI,CAAC,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5B,MAAM,KAAK,GAAG,MAAC,KAA6C,CAAC,KAAK,mCAA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rD;KACF,CAAC;CACH,EACD,qBAAqB,CACtB,CACF;IACD,0EAA0E;IAC1E,kEAAkE;IAClE,KAAK,EAAE,4BAA4B,EACnC,WAAW,EAAE,+BAA+B,EAC5C,UAAU,EAAE,+BAA+B,EAC3C,KAAK,EAAE;QACL,QAAQ,EAAE;YACR,KAAK,EAAE,IAAI;YACX,OAAO,EAAE,iDAAiD;SAC3D;KACF,GACW,CAAC;AAEf;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAgB;IAC/C,GAAG,aAAa;IAChB,eAAe;CAChB,CAAC"}
|
|
@@ -4,7 +4,10 @@ export declare function unitNumberSubfield(label?: string, pattern?: {
|
|
|
4
4
|
value: string;
|
|
5
5
|
message: string;
|
|
6
6
|
}): FormField;
|
|
7
|
-
export declare function streetNumberSubfield(label?: string
|
|
7
|
+
export declare function streetNumberSubfield(label?: string, pattern?: {
|
|
8
|
+
value: string;
|
|
9
|
+
message: string;
|
|
10
|
+
}): FormField;
|
|
8
11
|
export declare function streetNameSubfield(label?: string, pattern?: {
|
|
9
12
|
value: string;
|
|
10
13
|
message: string;
|
|
@@ -26,7 +29,42 @@ type PostalCodeOpts = {
|
|
|
26
29
|
maxMessage?: string;
|
|
27
30
|
};
|
|
28
31
|
export declare function postalCodeSubfield(opts?: PostalCodeOpts): FormField;
|
|
32
|
+
/**
|
|
33
|
+
* Barangay — the smallest Philippine administrative unit, printed between the
|
|
34
|
+
* street and the city on a PH address.
|
|
35
|
+
*
|
|
36
|
+
* Writes `address.suburb`, which the DataZoo connector maps to
|
|
37
|
+
* `addressElement2` for PHL (and IND) — see connectors PR #2427,
|
|
38
|
+
* `applyCountryAddressMapping`. Without this field the barangay never reaches
|
|
39
|
+
* the Philippines Credit Bureau address match.
|
|
40
|
+
*
|
|
41
|
+
* Optional: `address_required_fields` for PH in con_gdc.json is
|
|
42
|
+
* street_name/town/postal_code only, and the Eightcap dev-test entity matched
|
|
43
|
+
* on GDC with no suburb at all. (FDEL-52331)
|
|
44
|
+
*/
|
|
45
|
+
export declare function barangaySubfield(label?: string): FormField;
|
|
29
46
|
export declare function coloniaSubfield(): FormField;
|
|
47
|
+
/**
|
|
48
|
+
* Rewrites the applicant-visible validation messages on manual address
|
|
49
|
+
* subfields, keyed by field name.
|
|
50
|
+
*
|
|
51
|
+
* Every helper above hardcodes those messages in English *and* words them after
|
|
52
|
+
* its own default label — 'Please select your state', 'Please enter your
|
|
53
|
+
* suburb/town.' A country that renames the field therefore raises an error that
|
|
54
|
+
* is monolingual *and* about a field name the applicant never saw: TWN labels
|
|
55
|
+
* them 縣市 / County / City and 鄉鎮市區 / District, and QE read back 'state' and
|
|
56
|
+
* 'suburb/town' (FDEL-52329). The same holds for every localised country, and
|
|
57
|
+
* the wrong-field-name half holds for the English ones too — GBR's County field
|
|
58
|
+
* asked for a 'state'.
|
|
59
|
+
*
|
|
60
|
+
* ponytail: a post-pass rather than message parameters on all nine helpers —
|
|
61
|
+
* one function against nine positional signature widenings, and it leaves every
|
|
62
|
+
* existing caller untouched.
|
|
63
|
+
*/
|
|
64
|
+
export declare function localiseFieldMessages(fields: FormField[], messages: Record<string, {
|
|
65
|
+
required?: string;
|
|
66
|
+
pattern?: string;
|
|
67
|
+
}>): FormField[];
|
|
30
68
|
export declare function addressBlock(manualFields: FormField[]): FormField;
|
|
31
69
|
export {};
|
|
32
70
|
//# sourceMappingURL=addressField.d.ts.map
|
package/dist/esm/modules/form/vendors/react/features/Review/config/fields/addressField.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addressField.d.ts","sourceRoot":"","sources":["../../../../../../../../../../modules/form/vendors/react/features/Review/config/fields/addressField.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAE5D,wBAAgB,eAAe,CAAC,KAAK,SAAY,GAAG,SAAS,CAqB5D;AAED,wBAAgB,kBAAkB,CAChC,KAAK,SAA2B,EAChC,OAAO,CAAC,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC3C,SAAS,CAiBX;AAED,wBAAgB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"addressField.d.ts","sourceRoot":"","sources":["../../../../../../../../../../modules/form/vendors/react/features/Review/config/fields/addressField.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAE5D,wBAAgB,eAAe,CAAC,KAAK,SAAY,GAAG,SAAS,CAqB5D;AAED,wBAAgB,kBAAkB,CAChC,KAAK,SAA2B,EAChC,OAAO,CAAC,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC3C,SAAS,CAiBX;AAED,wBAAgB,oBAAoB,CAClC,KAAK,SAAkB,EACvB,OAAO,CAAC,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC3C,SAAS,CAoBX;AAED,wBAAgB,kBAAkB,CAChC,KAAK,SAAgB,EACrB,OAAO,CAAC,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC3C,SAAS,CAoBX;AAED,wBAAgB,qBAAqB,CACnC,KAAK,SAAmB,EACxB,OAAO,CAAC,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC3C,SAAS,CAoBX;AAED,wBAAgB,YAAY,CAC1B,KAAK,SAAkB,EACvB,OAAO,CAAC,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC3C,SAAS,CAoBX;AAED,wBAAgB,aAAa,CAC3B,KAAK,SAAU,EACf,WAAW,SAAsB,GAChC,SAAS,CAwBX;AAED,KAAK,cAAc,GAAG;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,IAAI,GAAE,cAAmB,GAAG,SAAS,CAiEvE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,SAAa,GAAG,SAAS,CAc9D;AAED,wBAAgB,eAAe,IAAI,SAAS,CAgB3C;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,SAAS,EAAE,EACnB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GAChE,SAAS,EAAE,CAYb;AAED,wBAAgB,YAAY,CAAC,YAAY,EAAE,SAAS,EAAE,GAAG,SAAS,CAkBjE"}
|
|
@@ -23,7 +23,7 @@ export function countrySubfield(label = 'Country') {
|
|
|
23
23
|
export function unitNumberSubfield(label = 'Unit Number (optional)', pattern) {
|
|
24
24
|
const rules = {
|
|
25
25
|
pattern: pattern
|
|
26
|
-
? Object.assign({}, pattern) : Object.assign({}, ValidationRulesForForm.
|
|
26
|
+
? Object.assign({}, pattern) : Object.assign({}, ValidationRulesForForm.alphaNumericSpaceAccented),
|
|
27
27
|
};
|
|
28
28
|
return {
|
|
29
29
|
fieldType: 'input',
|
|
@@ -37,7 +37,7 @@ export function unitNumberSubfield(label = 'Unit Number (optional)', pattern) {
|
|
|
37
37
|
},
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
|
-
export function streetNumberSubfield(label = 'Street Number') {
|
|
40
|
+
export function streetNumberSubfield(label = 'Street Number', pattern) {
|
|
41
41
|
return {
|
|
42
42
|
fieldType: 'input',
|
|
43
43
|
dataType: 'text',
|
|
@@ -49,7 +49,8 @@ export function streetNumberSubfield(label = 'Street Number') {
|
|
|
49
49
|
value: true,
|
|
50
50
|
message: 'Please enter your street number',
|
|
51
51
|
},
|
|
52
|
-
pattern:
|
|
52
|
+
pattern: pattern
|
|
53
|
+
? Object.assign({}, pattern) : Object.assign({}, ValidationRulesForForm.alphaNumericSomeSpecialWordsAccented),
|
|
53
54
|
},
|
|
54
55
|
testid: {
|
|
55
56
|
input: 'street-number-input',
|
|
@@ -69,7 +70,7 @@ export function streetNameSubfield(label = 'Street Name', pattern) {
|
|
|
69
70
|
message: 'Please enter your street name',
|
|
70
71
|
},
|
|
71
72
|
pattern: pattern
|
|
72
|
-
? Object.assign({}, pattern) : Object.assign({}, ValidationRulesForForm.
|
|
73
|
+
? Object.assign({}, pattern) : Object.assign({}, ValidationRulesForForm.alphaNumericSomeSpecialWordsAccented),
|
|
73
74
|
},
|
|
74
75
|
testid: {
|
|
75
76
|
input: 'street-name-input',
|
|
@@ -89,7 +90,7 @@ export function streetAddressSubfield(label = 'Street Address', pattern) {
|
|
|
89
90
|
message: 'Please enter your street address',
|
|
90
91
|
},
|
|
91
92
|
pattern: pattern
|
|
92
|
-
? Object.assign({}, pattern) : Object.assign({}, ValidationRulesForForm.
|
|
93
|
+
? Object.assign({}, pattern) : Object.assign({}, ValidationRulesForForm.alphaNumericSomeSpecialWordsAccented),
|
|
93
94
|
},
|
|
94
95
|
testid: {
|
|
95
96
|
input: 'street-input',
|
|
@@ -109,7 +110,7 @@ export function townSubfield(label = 'Suburb / Town', pattern) {
|
|
|
109
110
|
message: 'Please enter your suburb/town.',
|
|
110
111
|
},
|
|
111
112
|
pattern: pattern
|
|
112
|
-
? Object.assign({}, pattern) : Object.assign({}, ValidationRulesForForm.
|
|
113
|
+
? Object.assign({}, pattern) : Object.assign({}, ValidationRulesForForm.alphaNumericSpaceAccented),
|
|
113
114
|
},
|
|
114
115
|
testid: {
|
|
115
116
|
input: 'suburb-input',
|
|
@@ -199,6 +200,34 @@ export function postalCodeSubfield(opts = {}) {
|
|
|
199
200
|
},
|
|
200
201
|
};
|
|
201
202
|
}
|
|
203
|
+
/**
|
|
204
|
+
* Barangay — the smallest Philippine administrative unit, printed between the
|
|
205
|
+
* street and the city on a PH address.
|
|
206
|
+
*
|
|
207
|
+
* Writes `address.suburb`, which the DataZoo connector maps to
|
|
208
|
+
* `addressElement2` for PHL (and IND) — see connectors PR #2427,
|
|
209
|
+
* `applyCountryAddressMapping`. Without this field the barangay never reaches
|
|
210
|
+
* the Philippines Credit Bureau address match.
|
|
211
|
+
*
|
|
212
|
+
* Optional: `address_required_fields` for PH in con_gdc.json is
|
|
213
|
+
* street_name/town/postal_code only, and the Eightcap dev-test entity matched
|
|
214
|
+
* on GDC with no suburb at all. (FDEL-52331)
|
|
215
|
+
*/
|
|
216
|
+
export function barangaySubfield(label = 'Barangay') {
|
|
217
|
+
return {
|
|
218
|
+
fieldType: 'input',
|
|
219
|
+
dataType: 'text',
|
|
220
|
+
hide: false,
|
|
221
|
+
label,
|
|
222
|
+
name: 'address.suburb',
|
|
223
|
+
rules: {
|
|
224
|
+
pattern: Object.assign({}, ValidationRulesForForm.alphaNumericSpaceAccented),
|
|
225
|
+
},
|
|
226
|
+
testid: {
|
|
227
|
+
input: 'barangay-input',
|
|
228
|
+
},
|
|
229
|
+
};
|
|
230
|
+
}
|
|
202
231
|
export function coloniaSubfield() {
|
|
203
232
|
return {
|
|
204
233
|
fieldType: 'input',
|
|
@@ -216,6 +245,38 @@ export function coloniaSubfield() {
|
|
|
216
245
|
testid: { input: 'colonia-input' },
|
|
217
246
|
};
|
|
218
247
|
}
|
|
248
|
+
/**
|
|
249
|
+
* Rewrites the applicant-visible validation messages on manual address
|
|
250
|
+
* subfields, keyed by field name.
|
|
251
|
+
*
|
|
252
|
+
* Every helper above hardcodes those messages in English *and* words them after
|
|
253
|
+
* its own default label — 'Please select your state', 'Please enter your
|
|
254
|
+
* suburb/town.' A country that renames the field therefore raises an error that
|
|
255
|
+
* is monolingual *and* about a field name the applicant never saw: TWN labels
|
|
256
|
+
* them 縣市 / County / City and 鄉鎮市區 / District, and QE read back 'state' and
|
|
257
|
+
* 'suburb/town' (FDEL-52329). The same holds for every localised country, and
|
|
258
|
+
* the wrong-field-name half holds for the English ones too — GBR's County field
|
|
259
|
+
* asked for a 'state'.
|
|
260
|
+
*
|
|
261
|
+
* ponytail: a post-pass rather than message parameters on all nine helpers —
|
|
262
|
+
* one function against nine positional signature widenings, and it leaves every
|
|
263
|
+
* existing caller untouched.
|
|
264
|
+
*/
|
|
265
|
+
export function localiseFieldMessages(fields, messages) {
|
|
266
|
+
return fields.map((field) => {
|
|
267
|
+
const override = messages[field.name];
|
|
268
|
+
const rules = field.rules;
|
|
269
|
+
if (!override || !rules)
|
|
270
|
+
return field;
|
|
271
|
+
const next = Object.assign({}, rules);
|
|
272
|
+
['required', 'pattern'].forEach((key) => {
|
|
273
|
+
const message = override[key];
|
|
274
|
+
if (message && next[key])
|
|
275
|
+
next[key] = Object.assign(Object.assign({}, next[key]), { message });
|
|
276
|
+
});
|
|
277
|
+
return Object.assign(Object.assign({}, field), { rules: next });
|
|
278
|
+
});
|
|
279
|
+
}
|
|
219
280
|
export function addressBlock(manualFields) {
|
|
220
281
|
return {
|
|
221
282
|
fieldType: 'address',
|