regions-config 1.1.0 → 1.2.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.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +10 -0
- package/dist/index.mjs +9 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1452,6 +1452,8 @@ declare const getCountriesToRedirect: (currentSite?: string) => {
|
|
|
1452
1452
|
|
|
1453
1453
|
declare const resolveDocumentTypeOptions: (documentTypeOptions: Array<DocumentTypeOption>, documentTypeOptionsByOrigin?: DocumentTypeOptionsByOrigin, originCountryId?: string | number, siteCountryId?: number) => Array<DocumentTypeOption>;
|
|
1454
1454
|
|
|
1455
|
+
declare const resolvePostalCodeFormat: (postalCodeFormat?: string, originCountryId?: string | number, siteCountryId?: number) => string | undefined;
|
|
1456
|
+
|
|
1455
1457
|
declare const validateRegion: (region: RegionConfig["regionCode"]) => void;
|
|
1456
1458
|
|
|
1457
|
-
export { COUNTRIES_TO_REDIRECT, type CountriesToRedirectMap, type CountryToRedirect, type DefaultCurrency, DefaultCurrencySchema, type DocumentTypeOption, type DocumentTypeOptionsByOrigin, EUROPE_COUNTRIES, GROUP_REGIONS, type MarketRegion, MarketRegionEnum, MarketRegionSchema, type PaymentCardType, type RedirectCountry, type RedirectGroup, type RedirectSiteKey, type RegionCode, RegionCodeSchema, type RegionConfig, RegionConfigSchema, type RegionCountryCode, RegionCountryCodeEnum, RegionCountryCodeSchema, type RegionName, RegionNameEnum, RegionNameSchema, type RegionToGroup, type RegionsConfig, US_CANADA_COUNTRIES, US_CANADA_JAPAN_COUNTRIES, WORLD_COUNTRIES, getAllRegions, getCountriesToRedirect, getRegionConfig, getRegionConfigById, getRegionConfigByName, getRegionConfigByRegionCode, regionsConfig, resolveDocumentTypeOptions, validateRegion };
|
|
1459
|
+
export { COUNTRIES_TO_REDIRECT, type CountriesToRedirectMap, type CountryToRedirect, type DefaultCurrency, DefaultCurrencySchema, type DocumentTypeOption, type DocumentTypeOptionsByOrigin, EUROPE_COUNTRIES, GROUP_REGIONS, type MarketRegion, MarketRegionEnum, MarketRegionSchema, type PaymentCardType, type RedirectCountry, type RedirectGroup, type RedirectSiteKey, type RegionCode, RegionCodeSchema, type RegionConfig, RegionConfigSchema, type RegionCountryCode, RegionCountryCodeEnum, RegionCountryCodeSchema, type RegionName, RegionNameEnum, RegionNameSchema, type RegionToGroup, type RegionsConfig, US_CANADA_COUNTRIES, US_CANADA_JAPAN_COUNTRIES, WORLD_COUNTRIES, getAllRegions, getCountriesToRedirect, getRegionConfig, getRegionConfigById, getRegionConfigByName, getRegionConfigByRegionCode, regionsConfig, resolveDocumentTypeOptions, resolvePostalCodeFormat, validateRegion };
|
package/dist/index.d.ts
CHANGED
|
@@ -1452,6 +1452,8 @@ declare const getCountriesToRedirect: (currentSite?: string) => {
|
|
|
1452
1452
|
|
|
1453
1453
|
declare const resolveDocumentTypeOptions: (documentTypeOptions: Array<DocumentTypeOption>, documentTypeOptionsByOrigin?: DocumentTypeOptionsByOrigin, originCountryId?: string | number, siteCountryId?: number) => Array<DocumentTypeOption>;
|
|
1454
1454
|
|
|
1455
|
+
declare const resolvePostalCodeFormat: (postalCodeFormat?: string, originCountryId?: string | number, siteCountryId?: number) => string | undefined;
|
|
1456
|
+
|
|
1455
1457
|
declare const validateRegion: (region: RegionConfig["regionCode"]) => void;
|
|
1456
1458
|
|
|
1457
|
-
export { COUNTRIES_TO_REDIRECT, type CountriesToRedirectMap, type CountryToRedirect, type DefaultCurrency, DefaultCurrencySchema, type DocumentTypeOption, type DocumentTypeOptionsByOrigin, EUROPE_COUNTRIES, GROUP_REGIONS, type MarketRegion, MarketRegionEnum, MarketRegionSchema, type PaymentCardType, type RedirectCountry, type RedirectGroup, type RedirectSiteKey, type RegionCode, RegionCodeSchema, type RegionConfig, RegionConfigSchema, type RegionCountryCode, RegionCountryCodeEnum, RegionCountryCodeSchema, type RegionName, RegionNameEnum, RegionNameSchema, type RegionToGroup, type RegionsConfig, US_CANADA_COUNTRIES, US_CANADA_JAPAN_COUNTRIES, WORLD_COUNTRIES, getAllRegions, getCountriesToRedirect, getRegionConfig, getRegionConfigById, getRegionConfigByName, getRegionConfigByRegionCode, regionsConfig, resolveDocumentTypeOptions, validateRegion };
|
|
1459
|
+
export { COUNTRIES_TO_REDIRECT, type CountriesToRedirectMap, type CountryToRedirect, type DefaultCurrency, DefaultCurrencySchema, type DocumentTypeOption, type DocumentTypeOptionsByOrigin, EUROPE_COUNTRIES, GROUP_REGIONS, type MarketRegion, MarketRegionEnum, MarketRegionSchema, type PaymentCardType, type RedirectCountry, type RedirectGroup, type RedirectSiteKey, type RegionCode, RegionCodeSchema, type RegionConfig, RegionConfigSchema, type RegionCountryCode, RegionCountryCodeEnum, RegionCountryCodeSchema, type RegionName, RegionNameEnum, RegionNameSchema, type RegionToGroup, type RegionsConfig, US_CANADA_COUNTRIES, US_CANADA_JAPAN_COUNTRIES, WORLD_COUNTRIES, getAllRegions, getCountriesToRedirect, getRegionConfig, getRegionConfigById, getRegionConfigByName, getRegionConfigByRegionCode, regionsConfig, resolveDocumentTypeOptions, resolvePostalCodeFormat, validateRegion };
|
package/dist/index.js
CHANGED
|
@@ -43,6 +43,7 @@ __export(index_exports, {
|
|
|
43
43
|
getRegionConfigByRegionCode: () => getRegionConfigByRegionCode,
|
|
44
44
|
regionsConfig: () => regionsConfig_default,
|
|
45
45
|
resolveDocumentTypeOptions: () => resolveDocumentTypeOptions,
|
|
46
|
+
resolvePostalCodeFormat: () => resolvePostalCodeFormat,
|
|
46
47
|
validateRegion: () => validateRegion
|
|
47
48
|
});
|
|
48
49
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -1282,6 +1283,14 @@ var resolveDocumentTypeOptions = (documentTypeOptions, documentTypeOptionsByOrig
|
|
|
1282
1283
|
return isLocal ? documentTypeOptionsByOrigin.local : documentTypeOptionsByOrigin.foreign;
|
|
1283
1284
|
};
|
|
1284
1285
|
|
|
1286
|
+
// src/utils/resolvePostalCodeFormat.ts
|
|
1287
|
+
var resolvePostalCodeFormat = (postalCodeFormat, originCountryId, siteCountryId) => {
|
|
1288
|
+
if (!postalCodeFormat) return void 0;
|
|
1289
|
+
if (!originCountryId || !siteCountryId) return void 0;
|
|
1290
|
+
const isLocal = String(originCountryId) === String(siteCountryId);
|
|
1291
|
+
return isLocal ? postalCodeFormat : void 0;
|
|
1292
|
+
};
|
|
1293
|
+
|
|
1285
1294
|
// src/validators/validateRegion.ts
|
|
1286
1295
|
var validateRegion = (region) => {
|
|
1287
1296
|
if (!Object.values(regionsConfig_default).some((regionConfig) => regionConfig.regionCode === region)) {
|
|
@@ -1313,5 +1322,6 @@ var validateRegion = (region) => {
|
|
|
1313
1322
|
getRegionConfigByRegionCode,
|
|
1314
1323
|
regionsConfig,
|
|
1315
1324
|
resolveDocumentTypeOptions,
|
|
1325
|
+
resolvePostalCodeFormat,
|
|
1316
1326
|
validateRegion
|
|
1317
1327
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -1233,6 +1233,14 @@ var resolveDocumentTypeOptions = (documentTypeOptions, documentTypeOptionsByOrig
|
|
|
1233
1233
|
return isLocal ? documentTypeOptionsByOrigin.local : documentTypeOptionsByOrigin.foreign;
|
|
1234
1234
|
};
|
|
1235
1235
|
|
|
1236
|
+
// src/utils/resolvePostalCodeFormat.ts
|
|
1237
|
+
var resolvePostalCodeFormat = (postalCodeFormat, originCountryId, siteCountryId) => {
|
|
1238
|
+
if (!postalCodeFormat) return void 0;
|
|
1239
|
+
if (!originCountryId || !siteCountryId) return void 0;
|
|
1240
|
+
const isLocal = String(originCountryId) === String(siteCountryId);
|
|
1241
|
+
return isLocal ? postalCodeFormat : void 0;
|
|
1242
|
+
};
|
|
1243
|
+
|
|
1236
1244
|
// src/validators/validateRegion.ts
|
|
1237
1245
|
var validateRegion = (region) => {
|
|
1238
1246
|
if (!Object.values(regionsConfig_default).some((regionConfig) => regionConfig.regionCode === region)) {
|
|
@@ -1263,5 +1271,6 @@ export {
|
|
|
1263
1271
|
getRegionConfigByRegionCode,
|
|
1264
1272
|
regionsConfig_default as regionsConfig,
|
|
1265
1273
|
resolveDocumentTypeOptions,
|
|
1274
|
+
resolvePostalCodeFormat,
|
|
1266
1275
|
validateRegion
|
|
1267
1276
|
};
|