@nuskin/shipping-address-form 1.7.9 → 1.7.10-6614-dev.2

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.
Files changed (28) hide show
  1. package/dist/addressLookup/components/SmartyIntlResults.js +6 -4
  2. package/dist/addressLookup/components/SmartyIntlResults.js.map +1 -1
  3. package/dist/addressLookup/components/SmartyUSResults.js +6 -4
  4. package/dist/addressLookup/components/SmartyUSResults.js.map +1 -1
  5. package/dist/addressLookup/components/smartyResults/useSmartyAddressController.js +6 -2
  6. package/dist/addressLookup/components/smartyResults/useSmartyAddressController.js.map +1 -1
  7. package/dist/addressLookup/components/smartyResults/useSmartyServiceErrors.js.map +1 -1
  8. package/dist/addressLookup/hooks/useAddressValidationBase.js +4 -1
  9. package/dist/addressLookup/hooks/useAddressValidationBase.js.map +1 -1
  10. package/dist/addressLookup/hooks/useIntlAddressValidation.js +24 -6
  11. package/dist/addressLookup/hooks/useIntlAddressValidation.js.map +1 -1
  12. package/dist/addressLookup/hooks/useSmartyInternationalLookup.js +47 -7
  13. package/dist/addressLookup/hooks/useSmartyInternationalLookup.js.map +1 -1
  14. package/dist/addressLookup/hooks/useSmartyLookupBase.js +6 -1
  15. package/dist/addressLookup/hooks/useSmartyLookupBase.js.map +1 -1
  16. package/dist/addressLookup/hooks/useSmartyUSLookup.js +30 -8
  17. package/dist/addressLookup/hooks/useSmartyUSLookup.js.map +1 -1
  18. package/dist/addressLookup/hooks/useUSAddressValidation.js +25 -6
  19. package/dist/addressLookup/hooks/useUSAddressValidation.js.map +1 -1
  20. package/dist/addressLookup/utils/addressForm.js +86 -2
  21. package/dist/addressLookup/utils/addressForm.js.map +1 -1
  22. package/dist/addressLookup/utils/smartyConfig.js +240 -5
  23. package/dist/addressLookup/utils/smartyConfig.js.map +1 -1
  24. package/dist/index.js +7 -0
  25. package/dist/index.js.map +1 -1
  26. package/dist/shippingAddressForm/utils/shippingAddressForm.js +13 -0
  27. package/dist/shippingAddressForm/utils/shippingAddressForm.js.map +1 -1
  28. package/package.json +1 -1
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_ShippingAddressForm","_interopRequireDefault","require","_addressLookup","_addressForm","_countries","e","__esModule","default"],"sources":["../src/index.js"],"sourcesContent":["export { default as ShippingAddressForm } from './shippingAddressForm/ShippingAddressForm';\nexport { default } from './shippingAddressForm/ShippingAddressForm';\nexport { default as AddressLookup } from './addressLookup';\nexport { normalizeAddressForm, DEFAULT_ADDRESS_FORM } from './addressLookup/utils/addressForm';\nexport { SUPPORTED_COUNTRIES } from './addressLookup/countries';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,oBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAAgE,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_ShippingAddressForm","_interopRequireDefault","require","_addressLookup","_addressForm","_countries","_smartyConfig","e","__esModule","default"],"sources":["../src/index.js"],"sourcesContent":["export { default as ShippingAddressForm } from './shippingAddressForm/ShippingAddressForm';\nexport { default } from './shippingAddressForm/ShippingAddressForm';\nexport { default as AddressLookup } from './addressLookup';\nexport { normalizeAddressForm, DEFAULT_ADDRESS_FORM } from './addressLookup/utils/addressForm';\nexport { SUPPORTED_COUNTRIES } from './addressLookup/countries';\nexport { setStreetAddressApiUrl } from './addressLookup/utils/smartyConfig';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,oBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AAA4E,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.normalizeShippingAddressForm = exports.getShippingAddressForm = exports.clearShippingAddressFormCache = exports.DEFAULT_SHIPPING_ADDRESS_FORM = void 0;
7
7
  var _contentstackLib = require("@nuskin/contentstack-lib");
8
8
  var _addressForm = require("../../addressLookup/utils/addressForm");
9
+ var _smartyConfig = require("../../addressLookup/utils/smartyConfig");
9
10
  const cache = {};
10
11
  const DEFAULT_SHIPPING_ADDRESS_FORM = exports.DEFAULT_SHIPPING_ADDRESS_FORM = {
11
12
  countries: [],
@@ -131,11 +132,22 @@ const normalizeShippingAddressForm = (result = {}) => {
131
132
  };
132
133
  };
133
134
  exports.normalizeShippingAddressForm = normalizeShippingAddressForm;
135
+ const applySmartyRuntimeConfig = (normalizedForm = {}) => {
136
+ var _window$location;
137
+ const addressForm = normalizedForm.addressForm || {};
138
+ const hostname = typeof window !== 'undefined' && ((_window$location = window.location) === null || _window$location === void 0 ? void 0 : _window$location.hostname) || '';
139
+ (0, _smartyConfig.applyStreetAddressApiDomains)(addressForm.urlDomains, hostname);
140
+ (0, _smartyConfig.setSmartyLambdaEnabled)(addressForm.smartyLambdaEnabled);
141
+ (0, _smartyConfig.setSkipCache)(addressForm.skipCache);
142
+ (0, _smartyConfig.setSmartyResponseEnabled)(addressForm.smartyResponse);
143
+ (0, _smartyConfig.applySmartyKeys)(addressForm.smartyKeys);
144
+ };
134
145
  const getShippingAddressForm = async (country, type = 'shipping') => {
135
146
  const countryCode = country || 'US';
136
147
  const formType = type || 'shipping';
137
148
  const cacheKey = `${countryCode}_${formType}`;
138
149
  if (cache[cacheKey]) {
150
+ applySmartyRuntimeConfig(cache[cacheKey]);
139
151
  return cache[cacheKey];
140
152
  }
141
153
  try {
@@ -145,6 +157,7 @@ const getShippingAddressForm = async (country, type = 'shipping') => {
145
157
  type: formType
146
158
  }, true);
147
159
  const normalizedForm = normalizeShippingAddressForm(result || {});
160
+ applySmartyRuntimeConfig(normalizedForm);
148
161
  cache[cacheKey] = normalizedForm;
149
162
  return normalizedForm;
150
163
  } catch (err) {
@@ -1 +1 @@
1
- {"version":3,"file":"shippingAddressForm.js","names":["_contentstackLib","require","_addressForm","cache","DEFAULT_SHIPPING_ADDRESS_FORM","exports","countries","preAddressFields","addressForm","DEFAULT_ADDRESS_FORM","postAddressFields","layout","type","component","normalizeRegex","value","RegExp","err","normalizeMaxLength","field","max_length","trim","parsedMaxLength","Number","isNaN","maxLength","normalizeField","width","editable","required","Boolean","allowedCharacters","allowed_characters","inputType","normalizeFields","fields","Array","isArray","map","filter","normalizeCountries","country","code","country_code","name","country_name","buildLayout","length","push","forEach","extractCountries","result","_result$countries$","extractAddressForm","address_form","adaptShippingAddressFormEntry","normalizeShippingAddressForm","adaptedResult","pre_address_fields","post_address_fields","normalizeAddressForm","getShippingAddressForm","countryCode","formType","cacheKey","stack","getStack","getMultiEntryByFields","normalizedForm","fallback","clearShippingAddressFormCache","Object","keys"],"sources":["../../../src/shippingAddressForm/utils/shippingAddressForm.js"],"sourcesContent":["import { getStack } from '@nuskin/contentstack-lib';\nimport { normalizeAddressForm, DEFAULT_ADDRESS_FORM } from '../../addressLookup/utils/addressForm';\n\nconst cache = {};\n\nconst DEFAULT_SHIPPING_ADDRESS_FORM = {\n countries: [],\n preAddressFields: [],\n addressForm: DEFAULT_ADDRESS_FORM,\n postAddressFields: [],\n layout: [\n { type: 'component', component: 'addressLookup' }\n ]\n};\n\nconst normalizeRegex = (value) => {\n if (!value) {\n return null;\n }\n\n if (value instanceof RegExp) {\n return value;\n }\n\n if (typeof value !== 'string') {\n return null;\n }\n\n try {\n return new RegExp(value);\n } catch (err) {\n return null;\n }\n};\n\nconst normalizeMaxLength = (field = {}) => {\n if (typeof field.max_length === 'number') {\n return field.max_length;\n }\n\n if (typeof field.max_length === 'string' && field.max_length.trim() !== '') {\n const parsedMaxLength = Number(field.max_length);\n return Number.isNaN(parsedMaxLength) ? null : parsedMaxLength;\n }\n\n if (typeof field.maxLength === 'number') {\n return field.maxLength;\n }\n\n if (typeof field.maxLength === 'string' && field.maxLength.trim() !== '') {\n const parsedMaxLength = Number(field.maxLength);\n return Number.isNaN(parsedMaxLength) ? null : parsedMaxLength;\n }\n\n return null;\n};\n\nconst normalizeField = (field = {}) => ({\n field: field.field || '',\n width: field.width === 'half' ? 'half' : 'full',\n editable: field.editable !== false,\n maxLength: normalizeMaxLength(field),\n required: Boolean(field.required),\n allowedCharacters: normalizeRegex(field.allowed_characters || field.allowedCharacters),\n inputType: field.field === 'mobilePhone' ? 'phone' : 'text'\n});\n\nconst normalizeFields = (fields = []) =>\n (Array.isArray(fields) ? fields : [])\n .map(normalizeField)\n .filter((field) => field.field);\n\nconst normalizeCountries = (countries = []) =>\n (Array.isArray(countries) ? countries : [])\n .map((country) => ({\n code: country?.code || country?.country_code || '',\n name: country?.name || country?.country_name || country?.code || country?.country_code || ''\n }))\n .filter((country) => country.code);\n\nconst buildLayout = ({ countries, preAddressFields, postAddressFields }) => {\n const layout = [];\n\n if (countries.length > 0) {\n layout.push({ type: 'component', component: 'countrySelector' });\n }\n\n preAddressFields.forEach((field) => {\n layout.push({ type: 'field', field: field.field });\n });\n\n layout.push({ type: 'component', component: 'addressLookup' });\n\n postAddressFields.forEach((field) => {\n layout.push({ type: 'field', field: field.field });\n });\n\n return layout;\n};\n\nconst extractCountries = (result = {}) => {\n if (Array.isArray(result.countries) && Array.isArray(result.countries[0]?.countries)) {\n return result.countries[0].countries;\n }\n\n return result.countries;\n};\n\nconst extractAddressForm = (result = {}) => {\n if (Array.isArray(result.address_form)) {\n return result.address_form[0] || {};\n }\n\n return result.address_form || result.addressForm || {};\n};\n\nconst adaptShippingAddressFormEntry = (result = {}) => ({\n ...result,\n countries: extractCountries(result),\n address_form: extractAddressForm(result)\n});\n\nexport const normalizeShippingAddressForm = (result = {}) => {\n const adaptedResult = adaptShippingAddressFormEntry(result);\n const countries = normalizeCountries(adaptedResult.countries);\n const preAddressFields = normalizeFields(adaptedResult.pre_address_fields || adaptedResult.preAddressFields);\n const postAddressFields = normalizeFields(adaptedResult.post_address_fields || adaptedResult.postAddressFields);\n const addressForm = normalizeAddressForm(adaptedResult.address_form || adaptedResult.addressForm || {});\n\n return {\n countries,\n preAddressFields,\n addressForm,\n postAddressFields,\n layout: buildLayout({ countries, preAddressFields, postAddressFields })\n };\n};\n\nexport const getShippingAddressForm = async (country, type = 'shipping') => {\n const countryCode = country || 'US';\n const formType = type || 'shipping';\n const cacheKey = `${countryCode}_${formType}`;\n\n if (cache[cacheKey]) {\n return cache[cacheKey];\n }\n\n try {\n const stack = getStack();\n const result = await stack.getMultiEntryByFields(\n 'shipping_address_form',\n {\n country: countryCode,\n type: formType\n },\n true\n );\n const normalizedForm = normalizeShippingAddressForm(result || {});\n\n cache[cacheKey] = normalizedForm;\n return normalizedForm;\n } catch (err) {\n const fallback = { ...DEFAULT_SHIPPING_ADDRESS_FORM };\n cache[cacheKey] = fallback;\n return fallback;\n }\n};\n\nexport const clearShippingAddressFormCache = () => {\n Object.keys(cache).forEach((cacheKey) => {\n delete cache[cacheKey];\n });\n};\n\nexport { DEFAULT_SHIPPING_ADDRESS_FORM };\n"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,MAAME,KAAK,GAAG,CAAC,CAAC;AAEhB,MAAMC,6BAA6B,GAAAC,OAAA,CAAAD,6BAAA,GAAG;EACpCE,SAAS,EAAE,EAAE;EACbC,gBAAgB,EAAE,EAAE;EACpBC,WAAW,EAAEC,iCAAoB;EACjCC,iBAAi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,GAAAA,6BAAA","ignoreList":[]}
1
+ {"version":3,"file":"shippingAddressForm.js","names":["_contentstackLib","require","_addressForm","_smartyConfig","cache","DEFAULT_SHIPPING_ADDRESS_FORM","exports","countries","preAddressFields","addressForm","DEFAULT_ADDRESS_FORM","postAddressFields","layout","type","component","normalizeRegex","value","RegExp","err","normalizeMaxLength","field","max_length","trim","parsedMaxLength","Number","isNaN","maxLength","normalizeField","width","editable","required","Boolean","allowedCharacters","allowed_characters","inputType","normalizeFields","fields","Array","isArray","map","filter","normalizeCountries","country","code","country_code","name","country_name","buildLayout","length","push","forEach","extractCountries","result","_result$countries$","extractAddressForm","address_form","adaptShippingAddressFormEntry","normalizeShippingAddressForm","adaptedResult","pre_address_fields","post_address_fields","normalizeAddressForm","applySmartyRuntimeConfig","normalizedForm","_window$location","hostname","window","location","applyStreetAddressApiDomains","urlDomains","setSmartyLambdaEnabled","smartyLambdaEnabled","setSkipCache","skipCache","setSmartyResponseEnabled","smartyResponse","applySmartyKeys","smartyKeys","getShippingAddressForm","countryCode","formType","cacheKey","stack","getStack","getMultiEntryByFields","fallback","clearShippingAddressFormCache","Object","keys"],"sources":["../../../src/shippingAddressForm/utils/shippingAddressForm.js"],"sourcesContent":["import { getStack } from '@nuskin/contentstack-lib';\nimport { normalizeAddressForm, DEFAULT_ADDRESS_FORM } from '../../addressLookup/utils/addressForm';\nimport {\n applyStreetAddressApiDomains,\n setSmartyLambdaEnabled,\n applySmartyKeys,\n setSkipCache,\n setSmartyResponseEnabled\n} from '../../addressLookup/utils/smartyConfig';\n\nconst cache = {};\n\nconst DEFAULT_SHIPPING_ADDRESS_FORM = {\n countries: [],\n preAddressFields: [],\n addressForm: DEFAULT_ADDRESS_FORM,\n postAddressFields: [],\n layout: [\n { type: 'component', component: 'addressLookup' }\n ]\n};\n\nconst normalizeRegex = (value) => {\n if (!value) {\n return null;\n }\n\n if (value instanceof RegExp) {\n return value;\n }\n\n if (typeof value !== 'string') {\n return null;\n }\n\n try {\n return new RegExp(value);\n } catch (err) {\n return null;\n }\n};\n\nconst normalizeMaxLength = (field = {}) => {\n if (typeof field.max_length === 'number') {\n return field.max_length;\n }\n\n if (typeof field.max_length === 'string' && field.max_length.trim() !== '') {\n const parsedMaxLength = Number(field.max_length);\n return Number.isNaN(parsedMaxLength) ? null : parsedMaxLength;\n }\n\n if (typeof field.maxLength === 'number') {\n return field.maxLength;\n }\n\n if (typeof field.maxLength === 'string' && field.maxLength.trim() !== '') {\n const parsedMaxLength = Number(field.maxLength);\n return Number.isNaN(parsedMaxLength) ? null : parsedMaxLength;\n }\n\n return null;\n};\n\nconst normalizeField = (field = {}) => ({\n field: field.field || '',\n width: field.width === 'half' ? 'half' : 'full',\n editable: field.editable !== false,\n maxLength: normalizeMaxLength(field),\n required: Boolean(field.required),\n allowedCharacters: normalizeRegex(field.allowed_characters || field.allowedCharacters),\n inputType: field.field === 'mobilePhone' ? 'phone' : 'text'\n});\n\nconst normalizeFields = (fields = []) =>\n (Array.isArray(fields) ? fields : [])\n .map(normalizeField)\n .filter((field) => field.field);\n\nconst normalizeCountries = (countries = []) =>\n (Array.isArray(countries) ? countries : [])\n .map((country) => ({\n code: country?.code || country?.country_code || '',\n name: country?.name || country?.country_name || country?.code || country?.country_code || ''\n }))\n .filter((country) => country.code);\n\nconst buildLayout = ({ countries, preAddressFields, postAddressFields }) => {\n const layout = [];\n\n if (countries.length > 0) {\n layout.push({ type: 'component', component: 'countrySelector' });\n }\n\n preAddressFields.forEach((field) => {\n layout.push({ type: 'field', field: field.field });\n });\n\n layout.push({ type: 'component', component: 'addressLookup' });\n\n postAddressFields.forEach((field) => {\n layout.push({ type: 'field', field: field.field });\n });\n\n return layout;\n};\n\nconst extractCountries = (result = {}) => {\n if (Array.isArray(result.countries) && Array.isArray(result.countries[0]?.countries)) {\n return result.countries[0].countries;\n }\n\n return result.countries;\n};\n\nconst extractAddressForm = (result = {}) => {\n if (Array.isArray(result.address_form)) {\n return result.address_form[0] || {};\n }\n\n return result.address_form || result.addressForm || {};\n};\n\nconst adaptShippingAddressFormEntry = (result = {}) => ({\n ...result,\n countries: extractCountries(result),\n address_form: extractAddressForm(result)\n});\n\nexport const normalizeShippingAddressForm = (result = {}) => {\n const adaptedResult = adaptShippingAddressFormEntry(result);\n const countries = normalizeCountries(adaptedResult.countries);\n const preAddressFields = normalizeFields(adaptedResult.pre_address_fields || adaptedResult.preAddressFields);\n const postAddressFields = normalizeFields(adaptedResult.post_address_fields || adaptedResult.postAddressFields);\n const addressForm = normalizeAddressForm(adaptedResult.address_form || adaptedResult.addressForm || {});\n\n return {\n countries,\n preAddressFields,\n addressForm,\n postAddressFields,\n layout: buildLayout({ countries, preAddressFields, postAddressFields })\n };\n};\n\nconst applySmartyRuntimeConfig = (normalizedForm = {}) => {\n const addressForm = normalizedForm.addressForm || {};\n const hostname = (typeof window !== 'undefined' && window.location?.hostname) || '';\n applyStreetAddressApiDomains(addressForm.urlDomains, hostname);\n setSmartyLambdaEnabled(addressForm.smartyLambdaEnabled);\n setSkipCache(addressForm.skipCache);\n setSmartyResponseEnabled(addressForm.smartyResponse);\n applySmartyKeys(addressForm.smartyKeys);\n};\n\nexport const getShippingAddressForm = async (country, type = 'shipping') => {\n const countryCode = country || 'US';\n const formType = type || 'shipping';\n const cacheKey = `${countryCode}_${formType}`;\n\n if (cache[cacheKey]) {\n applySmartyRuntimeConfig(cache[cacheKey]);\n return cache[cacheKey];\n }\n\n try {\n const stack = getStack();\n const result = await stack.getMultiEntryByFields(\n 'shipping_address_form',\n {\n country: countryCode,\n type: formType\n },\n true\n );\n const normalizedForm = normalizeShippingAddressForm(result || {});\n\n applySmartyRuntimeConfig(normalizedForm);\n cache[cacheKey] = normalizedForm;\n return normalizedForm;\n } catch (err) {\n const fallback = { ...DEFAULT_SHIPPING_ADDRESS_FORM };\n cache[cacheKey] = fallback;\n return fallback;\n }\n};\n\nexport const clearShippingAddressFormCache = () => {\n Object.keys(cache).forEach((cacheKey) => {\n delete cache[cacheKey];\n });\n};\n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QAAQ,GAAG,GAAGF,WAAW,IAAIC,QAAQ,EAAE;EAE7C,IAAI5E,KAAK,CAAC6E,QAAQ,CAAC,EAAE;IACnBnB,wBAAwB,CAAC1D,KAAK,CAAC6E,QAAQ,CAAC,CAAC;IACzC,OAAO7E,KAAK,CAAC6E,QAAQ,CAAC;EACxB;EAEA,IAAI;IACF,MAAMC,KAAK,GAAG,IAAAC,yBAAQ,EAAC,CAAC;IACxB,MAAM/B,MAAM,GAAG,MAAM8B,KAAK,CAACE,qBAAqB,CAC9C,uBAAuB,EACvB;MACE1C,OAAO,EAAEqC,WAAW;MACpBlE,IAAI,EAAEmE;IACR,CAAC,EACD,IACF,CAAC;IACD,MAAMjB,cAAc,GAAGN,4BAA4B,CAACL,MAAM,IAAI,CAAC,CAAC,CAAC;IAEjEU,wBAAwB,CAACC,cAAc,CAAC;IACxC3D,KAAK,CAAC6E,QAAQ,CAAC,GAAGlB,cAAc;IAChC,OAAOA,cAAc;EACvB,CAAC,CAAC,OAAO7C,GAAG,EAAE;IACZ,MAAMmE,QAAQ,GAAG;MAAE,GAAGhF;IAA8B,CAAC;IACrDD,KAAK,CAAC6E,QAAQ,CAAC,GAAGI,QAAQ;IAC1B,OAAOA,QAAQ;EACjB;AACF,CAAC;AAAC/E,OAAA,CAAAwE,sBAAA,GAAAA,sBAAA;AAEK,MAAMQ,6BAA6B,GAAGA,CAAA,KAAM;EACjDC,MAAM,CAACC,IAAI,CAACpF,KAAK,CAAC,CAAC8C,OAAO,CAAE+B,QAAQ,IAAK;IACvC,OAAO7E,KAAK,CAAC6E,QAAQ,CAAC;EACxB,CAAC,CAAC;AACJ,CAAC;AAAC3E,OAAA,CAAAgF,6BAAA,GAAAA,6BAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/shipping-address-form",
3
- "version": "1.7.9",
3
+ "version": "1.7.10-6614-dev.2",
4
4
  "description": "React components for standalone address lookup and shipping address forms",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {