@zonos/amino 5.5.39 → 5.5.41
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/components/file-upload/FileUpload.d.ts +2 -1
- package/components/file-upload/FileUpload.js +1 -1
- package/package.json +1 -1
- package/tsconfig.emitDeclarationOnly.tsbuildinfo +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/utils/hooks/useCountryOptions.d.ts +4 -1
- package/utils/hooks/useCountryOptions.js +1 -1
|
@@ -67,5 +67,8 @@ export type UnavailableCountry = {
|
|
|
67
67
|
export type GetCountriesResponse<CountryCode extends string = string> = {
|
|
68
68
|
[key: string]: Country<CountryCode>;
|
|
69
69
|
};
|
|
70
|
-
export declare const useCountryOptions: <TCountryCode extends string>(dashboardUrl
|
|
70
|
+
export declare const useCountryOptions: <TCountryCode extends string>({ dashboardUrl, languageCode, }: {
|
|
71
|
+
dashboardUrl: string;
|
|
72
|
+
languageCode?: string;
|
|
73
|
+
}) => CountryOption<TCountryCode>[];
|
|
71
74
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("../../tslib.es6-8c21e256.js"),r=require("dayjs"),n=require("zod"),t=require("../handleFetch.js"),
|
|
1
|
+
"use strict";var e=require("../../tslib.es6-8c21e256.js"),r=require("dayjs"),n=require("zod"),t=require("../handleFetch.js"),a=require("./useSwrt.js"),s=require("../prepCountryOptions.js"),o=require("./useStorage.js");function i(e){return e&&e.__esModule?e:{default:e}}require("lodash/isEqual"),require("swr"),require("../countryPhoneCodes.js"),require("react"),require("../storage.js");var u=i(r),l=["Africa","Americas","Asia","Central America","Europe","North America","Oceania","South America"],c=n.z.object({active:n.z.boolean(),code:n.z.string(),code3:n.z.string().nullable(),currencyCode:n.z.string(),displayName:n.z.string(),fraudRisk:n.z.number(),label:n.z.string(),languageCode:n.z.string().nullable(),numericCode:n.z.string().nullable(),phoneCode:n.z.array(n.z.string()),region:n.z.enum(l),upsCode:n.z.string().nullable(),value:n.z.string(),zipRegex:n.z.string().nullable()}),d=n.z.array(c);exports.regions=l,exports.useCountryOptions=function(r){var n=r.dashboardUrl,i=r.languageCode,l=o.useStorageWithLifetime({defaultValue:[],key:"__zn_country_options",lifetime:u.default().endOf("week"),schema:d,type:"local"}),c=l.setValue,g=l.value,p=a.useSwrt("".concat(n,"/api/address/getCountries").concat(i?"?languageCode=".concat(i):""),{fetcher:function(r){return e.__awaiter(void 0,void 0,void 0,(function(){var n,a,o,i;return e.__generator(this,(function(e){switch(e.label){case 0:return g.length?[3,2]:[4,t.fetcher(r,{headers:{"cache-control":"no-cache"}})];case 1:return n=e.sent(),a=n.json,o=n.response,i=a?s.prepCountryOptions({json:a}):[],c(i),[2,{json:i,response:o}];case 2:return[2,{json:g,response:null}]}}))}))}}).data;return(null==p?void 0:p.json)||[]};
|