@nuskin/shipping-address-form 1.7.8-state-dropdown.2 → 1.7.8-state-dropdown.4
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/README.md +55 -4
- package/dist/addressLookup/components/SmartyIntlResults.js +243 -1019
- package/dist/addressLookup/components/SmartyIntlResults.js.map +1 -1
- package/dist/addressLookup/components/SmartyUSResults.js +255 -1020
- package/dist/addressLookup/components/SmartyUSResults.js.map +1 -1
- package/dist/addressLookup/components/smartyResults/AddressFieldRow.js +155 -0
- package/dist/addressLookup/components/smartyResults/AddressFieldRow.js.map +1 -0
- package/dist/addressLookup/components/smartyResults/AddressMapModal.js +49 -0
- package/dist/addressLookup/components/smartyResults/AddressMapModal.js.map +1 -0
- package/dist/addressLookup/components/smartyResults/LookupActions.js +65 -0
- package/dist/addressLookup/components/smartyResults/LookupActions.js.map +1 -0
- package/dist/addressLookup/components/smartyResults/LookupResults.js +96 -0
- package/dist/addressLookup/components/smartyResults/LookupResults.js.map +1 -0
- package/dist/addressLookup/components/smartyResults/SuggestionList.js +40 -0
- package/dist/addressLookup/components/smartyResults/SuggestionList.js.map +1 -0
- package/dist/addressLookup/components/smartyResults/ValidationSuggestionList.js +53 -0
- package/dist/addressLookup/components/smartyResults/ValidationSuggestionList.js.map +1 -0
- package/dist/addressLookup/components/smartyResults/smartyResultsHandlers.js +286 -0
- package/dist/addressLookup/components/smartyResults/smartyResultsHandlers.js.map +1 -0
- package/dist/addressLookup/components/smartyResults/useSmartyAddressController.js +376 -0
- package/dist/addressLookup/components/smartyResults/useSmartyAddressController.js.map +1 -0
- package/dist/addressLookup/components/smartyResults/useSmartyResultsEffects.js +300 -0
- package/dist/addressLookup/components/smartyResults/useSmartyResultsEffects.js.map +1 -0
- package/dist/addressLookup/components/smartyResults/useSmartyServiceErrors.js +84 -0
- package/dist/addressLookup/components/smartyResults/useSmartyServiceErrors.js.map +1 -0
- package/dist/addressLookup/hooks/useAddressFieldValidation.js +113 -0
- package/dist/addressLookup/hooks/useAddressFieldValidation.js.map +1 -0
- package/dist/addressLookup/hooks/useAddressValidationBase.js +4 -0
- package/dist/addressLookup/hooks/useAddressValidationBase.js.map +1 -1
- package/dist/addressLookup/hooks/useSuggestionKeyboardNav.js +70 -0
- package/dist/addressLookup/hooks/useSuggestionKeyboardNav.js.map +1 -0
- package/dist/addressLookup/styles/addressLookup.css +45 -25
- package/dist/addressLookup/utils/addressMapping.js +5 -4
- package/dist/addressLookup/utils/addressMapping.js.map +1 -1
- package/dist/addressLookup/utils/addressStatus.js +2 -2
- package/dist/addressLookup/utils/addressStatus.js.map +1 -1
- package/dist/addressLookup/utils/addressStrings.js +2 -2
- package/dist/addressLookup/utils/addressStrings.js.map +1 -1
- package/dist/addressLookup/utils/smartyResultsFieldMeta.js +38 -0
- package/dist/addressLookup/utils/smartyResultsFieldMeta.js.map +1 -0
- package/dist/shippingAddressForm/ShippingAddressForm.js +41 -112
- package/dist/shippingAddressForm/ShippingAddressForm.js.map +1 -1
- package/dist/shippingAddressForm/components/CountrySelectorField.js +51 -0
- package/dist/shippingAddressForm/components/CountrySelectorField.js.map +1 -0
- package/dist/shippingAddressForm/components/ShippingCheckboxSection.js +71 -0
- package/dist/shippingAddressForm/components/ShippingCheckboxSection.js.map +1 -0
- package/dist/shippingAddressForm/components/ShippingField.js +2 -1
- package/dist/shippingAddressForm/components/ShippingField.js.map +1 -1
- package/dist/shippingAddressForm/components/ShippingFormActions.js +53 -0
- package/dist/shippingAddressForm/components/ShippingFormActions.js.map +1 -0
- package/dist/shippingAddressForm/components/shippingFormControls.js +31 -0
- package/dist/shippingAddressForm/components/shippingFormControls.js.map +1 -0
- package/dist/shippingAddressForm/hooks/useShippingFormState.js +3 -2
- package/dist/shippingAddressForm/hooks/useShippingFormState.js.map +1 -1
- package/dist/shippingAddressForm/styles/shippingAddressForm.css +16 -15
- package/dist/shippingAddressForm/utils/shippingStrings.js +3 -2
- package/dist/shippingAddressForm/utils/shippingStrings.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -87,11 +87,16 @@ import {
|
|
|
87
87
|
```
|
|
88
88
|
|
|
89
89
|
`AddressLookup` accepts `onAddressSelect`, `country`, `language`, `address`, `readOnlyView`,
|
|
90
|
-
`validationRequestId`, `strings`, `formDefinition`,
|
|
91
|
-
autocomplete and validation for US and international
|
|
90
|
+
`validationRequestId`, `strings`, `formDefinition`, `deferFormLookup`, `showValidFields`, and
|
|
91
|
+
`suppressRequiredFieldsHint`. It supports Smarty autocomplete and validation for US and international
|
|
92
92
|
addresses. `normalizeAddressForm`, `DEFAULT_ADDRESS_FORM`, and `SUPPORTED_COUNTRIES` are exported
|
|
93
93
|
for consumers that need to provide or reuse address form definitions.
|
|
94
94
|
|
|
95
|
+
`showValidFields` (default `false`) shows a success indicator on fields once they have a value and
|
|
96
|
+
pass validation. `suppressRequiredFieldsHint` (default `false`) hides `AddressLookup`'s own "Fields
|
|
97
|
+
marked with * are required" hint; use this when a parent component (such as `ShippingAddressForm`)
|
|
98
|
+
already renders that hint for the combined form.
|
|
99
|
+
|
|
95
100
|
## ShippingAddressForm Props
|
|
96
101
|
|
|
97
102
|
### `country`
|
|
@@ -217,6 +222,26 @@ When `true`, the wrapper renders in display-only mode:
|
|
|
217
222
|
|
|
218
223
|
Readonly mode is intended for displaying an existing address without allowing edits or validation actions.
|
|
219
224
|
|
|
225
|
+
### `showValidFields`
|
|
226
|
+
|
|
227
|
+
- Type: `boolean`
|
|
228
|
+
- Default: `false`
|
|
229
|
+
|
|
230
|
+
When `true`, shipping fields (and the underlying `AddressLookup` fields) show a success indicator
|
|
231
|
+
once a field has a value and passes its own validation. This is passed straight through to
|
|
232
|
+
`AddressLookup` as its own `showValidFields` prop.
|
|
233
|
+
|
|
234
|
+
### `gateSubmitUntilComplete`
|
|
235
|
+
|
|
236
|
+
- Type: `boolean`
|
|
237
|
+
- Default: `false`
|
|
238
|
+
|
|
239
|
+
When `true`, the Save/Continue button is disabled until the address is complete (per
|
|
240
|
+
`addressStatus.completeness`), all shipping-field validation passes, and the phone number (if
|
|
241
|
+
present) is in a valid format. When `false` (default), the button is only disabled while a save is
|
|
242
|
+
in progress; consumers can still attempt Save and rely on the `onAction` payloads described below
|
|
243
|
+
to react to incomplete or invalid state.
|
|
244
|
+
|
|
220
245
|
### Address Entry and Validation
|
|
221
246
|
|
|
222
247
|
Address entry and validation behavior are configured in the address form definition:
|
|
@@ -337,6 +362,29 @@ When Smarty autocomplete or validation is unavailable, the wrapper forwards the
|
|
|
337
362
|
|
|
338
363
|
Consumers can use this event to apply their own fail-open or fail-closed policy when Smarty is unavailable.
|
|
339
364
|
|
|
365
|
+
#### Validation-failed payload
|
|
366
|
+
|
|
367
|
+
Emitted when a Save attempt completes address validation but the address still cannot proceed
|
|
368
|
+
(for example, an unverified address under `validationMode: 'required'`):
|
|
369
|
+
|
|
370
|
+
```js
|
|
371
|
+
{
|
|
372
|
+
type: 'validation-failed',
|
|
373
|
+
address: {
|
|
374
|
+
address1: '123 Main St'
|
|
375
|
+
},
|
|
376
|
+
status: {
|
|
377
|
+
verification: 'unverified',
|
|
378
|
+
canProceed: false,
|
|
379
|
+
needsValidation: true,
|
|
380
|
+
validationAttempted: true
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
Unlike the AddressLookup error payload, this indicates validation ran successfully but the result
|
|
386
|
+
did not meet the configured `validationMode`/`minimumAcceptedLevel` requirements.
|
|
387
|
+
|
|
340
388
|
## Form Definition
|
|
341
389
|
|
|
342
390
|
Shipping form layout is loaded from Contentstack content type:
|
|
@@ -400,9 +448,11 @@ Shipping field validation is handled locally.
|
|
|
400
448
|
- Save is blocked only when email-verify explicitly reports invalid format or invalid domain.
|
|
401
449
|
- Email-verify service failures do not block save.
|
|
402
450
|
- The email-verify base URL resolves to `apis.test.nuskin.com` for local/test-like hosts and `apis.nuskin.com` otherwise.
|
|
403
|
-
- Phone validation uses `
|
|
451
|
+
- Phone validation uses `parsePhoneNumberFromString()` from `libphonenumber-js/max` and requires the
|
|
452
|
+
number to be valid and of type `MOBILE` or `FIXED_LINE_OR_MOBILE` for the selected phone country.
|
|
404
453
|
- Invalid phone numbers show an error message and red field styling.
|
|
405
|
-
- Invalid phone format
|
|
454
|
+
- Invalid phone format does not block save by default; set `gateSubmitUntilComplete` to disable
|
|
455
|
+
Save/Continue until the phone number is valid.
|
|
406
456
|
- When a non-empty phone value is present, `validationStatus.phone` is included in the save callback.
|
|
407
457
|
- If the phone format is invalid, the save callback includes `validationStatus.phone = { valid: false, reason: 'invalid_format' }`.
|
|
408
458
|
- Missing required shipping fields block save.
|
|
@@ -460,6 +510,7 @@ The stylesheet also exposes CSS variables for common overrides:
|
|
|
460
510
|
- `--nssf-border-color`
|
|
461
511
|
- `--nssf-disabled-surface-color`
|
|
462
512
|
- `--nssf-error-color`
|
|
513
|
+
- `--nssf-success-color`
|
|
463
514
|
- `--nssf-primary-color`
|
|
464
515
|
- `--nssf-surface-color`
|
|
465
516
|
- `--nssf-radius`
|