regions-config 1.3.0 → 1.5.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/README.md +41 -11
- package/dist/index.d.mts +57 -1
- package/dist/index.d.ts +57 -1
- package/dist/index.js +38 -0
- package/dist/index.mjs +34 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,20 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
Paquete de configuración de regiones para las aplicaciones de IATI. Proporciona la configuración completa de cada región (zona horaria, tipos de documento, métodos de pago, links de footer, países a redirigir, etc.) junto con utilidades tipadas para acceder a ella.
|
|
4
4
|
|
|
5
|
-
> ℹ️ Esta config la consumen los proyectos de purchase-funnel-widget y purchase-funnel (iati-backoffice-monorepo)
|
|
5
|
+
> ℹ️ Esta config la consumen los proyectos de purchase-funnel-widget y purchase-funnel (iati-backoffice-monorepo), y las webs de iati-websites-monorepo
|
|
6
6
|
|
|
7
7
|
## Regiones disponibles
|
|
8
8
|
|
|
9
|
-
| Clave | `regionCode` | Descripción |
|
|
10
|
-
| --------- | ------------ | ----------------------------- |
|
|
11
|
-
| `es` | `es-ES` | España |
|
|
12
|
-
| `commx` | `es-MX` | México |
|
|
13
|
-
| `comeneu` | `en-EU` | Internacional Europa (EN) |
|
|
14
|
-
| `comen` | `en-ROW` | Internacional resto del mundo |
|
|
15
|
-
| `it` | `it-IT` | Italia |
|
|
16
|
-
| `pt` | `pt-PT` | Portugal |
|
|
17
|
-
| `comco` | `es-CO` | Colombia |
|
|
18
|
-
| `compe` | `es-PE` | Perú |
|
|
9
|
+
| Clave | `regionCode` | `websiteAppName` | Descripción |
|
|
10
|
+
| --------- | ------------ | ---------------- | ----------------------------- |
|
|
11
|
+
| `es` | `es-ES` | `spain` | España |
|
|
12
|
+
| `commx` | `es-MX` | `mexico` | México |
|
|
13
|
+
| `comeneu` | `en-EU` | `eu` | Internacional Europa (EN) |
|
|
14
|
+
| `comen` | `en-ROW` | `row` | Internacional resto del mundo |
|
|
15
|
+
| `it` | `it-IT` | `italy` | Italia |
|
|
16
|
+
| `pt` | `pt-PT` | `portugal` | Portugal |
|
|
17
|
+
| `comco` | `es-CO` | `colombia` | Colombia |
|
|
18
|
+
| `compe` | `es-PE` | `peru` | Perú |
|
|
19
|
+
|
|
20
|
+
`websiteAppName` es el nombre de la app de `iati-websites-monorepo` que sirve cada región: coincide con el `APP_NAME` de ese repo (el nombre del package sin el prefijo `@repo/`), que es también el `appName` por el que se filtran sus documentos de Sanity.
|
|
19
21
|
|
|
20
22
|
## Instalación
|
|
21
23
|
|
|
@@ -94,6 +96,31 @@ const config = getRegionConfigByRegionCode('es-ES');
|
|
|
94
96
|
|
|
95
97
|
---
|
|
96
98
|
|
|
99
|
+
### `getRegionConfigByWebsiteAppName(websiteAppName: string): RegionConfig | undefined`
|
|
100
|
+
|
|
101
|
+
Obtiene la configuración de la región que sirve una app de `iati-websites-monorepo`. Devuelve `undefined` si la app no está asociada a ninguna región (por ejemplo `studio`, `dispatcher` o `docs`), de modo que "sin región" sea un estado válido para el consumidor.
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
import { getRegionConfigByWebsiteAppName } from 'regions-config';
|
|
105
|
+
|
|
106
|
+
const config = getRegionConfigByWebsiteAppName('italy'); // Config Italia
|
|
107
|
+
const none = getRegionConfigByWebsiteAppName('studio'); // undefined
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
### `getRegionCodeByWebsiteAppName(websiteAppName: string): RegionCode | undefined`
|
|
113
|
+
|
|
114
|
+
Atajo que devuelve únicamente el `regionCode` que corresponde a una app de `iati-websites-monorepo`.
|
|
115
|
+
|
|
116
|
+
```ts
|
|
117
|
+
import { getRegionCodeByWebsiteAppName } from 'regions-config';
|
|
118
|
+
|
|
119
|
+
const regionCode = getRegionCodeByWebsiteAppName('eu'); // 'en-EU'
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
97
124
|
### `validateRegion(region: RegionCode): void`
|
|
98
125
|
|
|
99
126
|
Valida que un `regionCode` sea válido. Lanza un error si no corresponde a ninguna región configurada.
|
|
@@ -133,6 +160,7 @@ type RegionConfig = {
|
|
|
133
160
|
id: number;
|
|
134
161
|
gtmId: string; // Formato: GTM-XXXXXXX
|
|
135
162
|
regionCode: 'es-ES' | 'es-MX' | 'en-EU' | 'en-ROW' | 'it-IT' | 'pt-PT' | 'es-CO' | 'es-PE';
|
|
163
|
+
websiteAppName: 'spain' | 'mexico' | 'eu' | 'row' | 'italy' | 'portugal' | 'colombia' | 'peru';
|
|
136
164
|
timeZone: string;
|
|
137
165
|
dateFormat: string;
|
|
138
166
|
footer: Array<{ href: string; label: string }>;
|
|
@@ -179,6 +207,8 @@ src/
|
|
|
179
207
|
│ ├── getRegionConfig.ts
|
|
180
208
|
│ ├── getRegionConfigById.ts
|
|
181
209
|
│ ├── getRegionConfigByRegionCode.ts
|
|
210
|
+
│ ├── getRegionConfigByWebsiteAppName.ts
|
|
211
|
+
│ ├── getRegionCodeByWebsiteAppName.ts
|
|
182
212
|
│ └── resolveDocumentTypeOptions.ts
|
|
183
213
|
└── validators/
|
|
184
214
|
└── validateRegion.ts
|
package/dist/index.d.mts
CHANGED
|
@@ -4,6 +4,7 @@ declare const regions: {
|
|
|
4
4
|
readonly comco: {
|
|
5
5
|
readonly id: 9;
|
|
6
6
|
readonly name: "colombia";
|
|
7
|
+
readonly websiteAppName: "colombia";
|
|
7
8
|
readonly countryCode: "CO";
|
|
8
9
|
readonly defaultCurrency: "USD";
|
|
9
10
|
readonly marketRegion: "latam";
|
|
@@ -120,6 +121,7 @@ declare const regions: {
|
|
|
120
121
|
readonly countryId: "246";
|
|
121
122
|
readonly name: "Uruguay";
|
|
122
123
|
}];
|
|
124
|
+
readonly usdPricingForNonResidents: true;
|
|
123
125
|
readonly regionUrls: {
|
|
124
126
|
readonly staging: "https://iatiglobal.iatidev.link/co/";
|
|
125
127
|
readonly production: "https://www.iatiglobal.com/co/";
|
|
@@ -182,6 +184,7 @@ declare const regions: {
|
|
|
182
184
|
readonly comen: {
|
|
183
185
|
readonly id: 5;
|
|
184
186
|
readonly name: "world";
|
|
187
|
+
readonly websiteAppName: "row";
|
|
185
188
|
readonly countryCode: "WR";
|
|
186
189
|
readonly defaultCurrency: "EUR";
|
|
187
190
|
readonly marketRegion: "world";
|
|
@@ -344,6 +347,7 @@ declare const regions: {
|
|
|
344
347
|
readonly comeneu: {
|
|
345
348
|
readonly id: 6;
|
|
346
349
|
readonly name: "europe";
|
|
350
|
+
readonly websiteAppName: "eu";
|
|
347
351
|
readonly countryCode: "EU";
|
|
348
352
|
readonly defaultCurrency: "EUR";
|
|
349
353
|
readonly marketRegion: "europe";
|
|
@@ -506,6 +510,7 @@ declare const regions: {
|
|
|
506
510
|
readonly commx: {
|
|
507
511
|
readonly id: 7;
|
|
508
512
|
readonly name: "mexico";
|
|
513
|
+
readonly websiteAppName: "mexico";
|
|
509
514
|
readonly countryCode: "MX";
|
|
510
515
|
readonly defaultCurrency: "USD";
|
|
511
516
|
readonly marketRegion: "latam";
|
|
@@ -656,6 +661,7 @@ declare const regions: {
|
|
|
656
661
|
readonly compe: {
|
|
657
662
|
readonly id: 8;
|
|
658
663
|
readonly name: "peru";
|
|
664
|
+
readonly websiteAppName: "peru";
|
|
659
665
|
readonly countryCode: "PE";
|
|
660
666
|
readonly defaultCurrency: "USD";
|
|
661
667
|
readonly marketRegion: "latam";
|
|
@@ -806,6 +812,7 @@ declare const regions: {
|
|
|
806
812
|
readonly es: {
|
|
807
813
|
readonly id: 1;
|
|
808
814
|
readonly name: "spain";
|
|
815
|
+
readonly websiteAppName: "spain";
|
|
809
816
|
readonly countryCode: "ES";
|
|
810
817
|
readonly defaultCurrency: "EUR";
|
|
811
818
|
readonly marketRegion: "europe";
|
|
@@ -983,6 +990,7 @@ declare const regions: {
|
|
|
983
990
|
readonly it: {
|
|
984
991
|
readonly id: 10;
|
|
985
992
|
readonly name: "italy";
|
|
993
|
+
readonly websiteAppName: "italy";
|
|
986
994
|
readonly countryCode: "IT";
|
|
987
995
|
readonly defaultCurrency: "EUR";
|
|
988
996
|
readonly marketRegion: "europe";
|
|
@@ -1141,6 +1149,7 @@ declare const regions: {
|
|
|
1141
1149
|
readonly pt: {
|
|
1142
1150
|
readonly id: 2;
|
|
1143
1151
|
readonly name: "portugal";
|
|
1152
|
+
readonly websiteAppName: "portugal";
|
|
1144
1153
|
readonly countryCode: "PT";
|
|
1145
1154
|
readonly defaultCurrency: "EUR";
|
|
1146
1155
|
readonly marketRegion: "europe";
|
|
@@ -1318,6 +1327,7 @@ type RegionCountryCode = RegionConfigSource['countryCode'];
|
|
|
1318
1327
|
type MarketRegion = RegionConfigSource['marketRegion'];
|
|
1319
1328
|
type RegionCode = RegionConfigSource['regionCode'];
|
|
1320
1329
|
type DefaultCurrency = RegionConfigSource['defaultCurrency'];
|
|
1330
|
+
type WebsiteAppName = RegionConfigSource['websiteAppName'];
|
|
1321
1331
|
declare const RegionNameSchema: z.ZodEnum<{
|
|
1322
1332
|
colombia: "colombia";
|
|
1323
1333
|
world: "world";
|
|
@@ -1348,6 +1358,16 @@ declare const RegionCodeSchema: z.ZodEnum<{
|
|
|
1348
1358
|
"it-IT": "it-IT";
|
|
1349
1359
|
"pt-PT": "pt-PT";
|
|
1350
1360
|
}>;
|
|
1361
|
+
declare const WebsiteAppNameSchema: z.ZodEnum<{
|
|
1362
|
+
colombia: "colombia";
|
|
1363
|
+
row: "row";
|
|
1364
|
+
eu: "eu";
|
|
1365
|
+
mexico: "mexico";
|
|
1366
|
+
peru: "peru";
|
|
1367
|
+
spain: "spain";
|
|
1368
|
+
italy: "italy";
|
|
1369
|
+
portugal: "portugal";
|
|
1370
|
+
}>;
|
|
1351
1371
|
declare const MarketRegionSchema: z.ZodEnum<{
|
|
1352
1372
|
latam: "latam";
|
|
1353
1373
|
world: "world";
|
|
@@ -1382,6 +1402,16 @@ declare const MarketRegionEnum: {
|
|
|
1382
1402
|
world: "world";
|
|
1383
1403
|
europe: "europe";
|
|
1384
1404
|
};
|
|
1405
|
+
declare const WebsiteAppNameEnum: {
|
|
1406
|
+
colombia: "colombia";
|
|
1407
|
+
row: "row";
|
|
1408
|
+
eu: "eu";
|
|
1409
|
+
mexico: "mexico";
|
|
1410
|
+
peru: "peru";
|
|
1411
|
+
spain: "spain";
|
|
1412
|
+
italy: "italy";
|
|
1413
|
+
portugal: "portugal";
|
|
1414
|
+
};
|
|
1385
1415
|
type DocumentTypeOption = {
|
|
1386
1416
|
label: string;
|
|
1387
1417
|
value: string;
|
|
@@ -1432,6 +1462,7 @@ declare const RegionConfigSchema: z.ZodObject<{
|
|
|
1432
1462
|
countryId: z.ZodString;
|
|
1433
1463
|
name: z.ZodOptional<z.ZodString>;
|
|
1434
1464
|
}, z.core.$strip>>>;
|
|
1465
|
+
usdPricingForNonResidents: z.ZodOptional<z.ZodBoolean>;
|
|
1435
1466
|
regionUrls: z.ZodOptional<z.ZodObject<{
|
|
1436
1467
|
staging: z.ZodURL;
|
|
1437
1468
|
production: z.ZodURL;
|
|
@@ -1492,6 +1523,16 @@ declare const RegionConfigSchema: z.ZodObject<{
|
|
|
1492
1523
|
italy: "italy";
|
|
1493
1524
|
portugal: "portugal";
|
|
1494
1525
|
}>;
|
|
1526
|
+
websiteAppName: z.ZodEnum<{
|
|
1527
|
+
colombia: "colombia";
|
|
1528
|
+
row: "row";
|
|
1529
|
+
eu: "eu";
|
|
1530
|
+
mexico: "mexico";
|
|
1531
|
+
peru: "peru";
|
|
1532
|
+
spain: "spain";
|
|
1533
|
+
italy: "italy";
|
|
1534
|
+
portugal: "portugal";
|
|
1535
|
+
}>;
|
|
1495
1536
|
countryCode: z.ZodEnum<{
|
|
1496
1537
|
CO: "CO";
|
|
1497
1538
|
WR: "WR";
|
|
@@ -1548,6 +1589,21 @@ declare const getRegionConfigByName: (name: string) => RegionConfig | undefined;
|
|
|
1548
1589
|
|
|
1549
1590
|
declare const getRegionConfigByRegionCode: (regionCode: RegionConfig["regionCode"]) => RegionConfig;
|
|
1550
1591
|
|
|
1592
|
+
/**
|
|
1593
|
+
* Resolve the region config served by a website app.
|
|
1594
|
+
*
|
|
1595
|
+
* Returns `undefined` for apps that are not region-scoped (e.g. `studio`,
|
|
1596
|
+
* `dispatcher`, `docs`), so callers can treat "no region" as a valid state.
|
|
1597
|
+
*/
|
|
1598
|
+
declare const getRegionConfigByWebsiteAppName: (websiteAppName: string) => RegionConfig | undefined;
|
|
1599
|
+
|
|
1600
|
+
/**
|
|
1601
|
+
* Resolve just the region code (e.g. `es-ES`, `en-ROW`) served by a website app.
|
|
1602
|
+
*
|
|
1603
|
+
* Returns `undefined` for apps that are not region-scoped.
|
|
1604
|
+
*/
|
|
1605
|
+
declare const getRegionCodeByWebsiteAppName: (websiteAppName: string) => RegionCode | undefined;
|
|
1606
|
+
|
|
1551
1607
|
declare const COUNTRIES_TO_REDIRECT: {
|
|
1552
1608
|
readonly es: {
|
|
1553
1609
|
readonly label: "Spain";
|
|
@@ -1729,4 +1785,4 @@ declare const resolvePostalCodeFormat: (postalCodeFormat?: string, originCountry
|
|
|
1729
1785
|
|
|
1730
1786
|
declare const validateRegion: (region: RegionConfig["regionCode"]) => void;
|
|
1731
1787
|
|
|
1732
|
-
export { COUNTRIES_TO_REDIRECT, type CountriesToRedirectMap, type CountryReference, type CountryToRedirect, type DefaultCurrency, DefaultCurrencySchema, type DocumentTypeOption, type DocumentTypeOptionsByOrigin, EUROPE_COUNTRIES, GROUP_REGIONS, type MarketRegion, MarketRegionEnum, MarketRegionSchema, type PaymentCardType, 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 };
|
|
1788
|
+
export { COUNTRIES_TO_REDIRECT, type CountriesToRedirectMap, type CountryReference, type CountryToRedirect, type DefaultCurrency, DefaultCurrencySchema, type DocumentTypeOption, type DocumentTypeOptionsByOrigin, EUROPE_COUNTRIES, GROUP_REGIONS, type MarketRegion, MarketRegionEnum, MarketRegionSchema, type PaymentCardType, 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, type WebsiteAppName, WebsiteAppNameEnum, WebsiteAppNameSchema, getAllRegions, getCountriesToRedirect, getRegionCodeByWebsiteAppName, getRegionConfig, getRegionConfigById, getRegionConfigByName, getRegionConfigByRegionCode, getRegionConfigByWebsiteAppName, regionsConfig, resolveDocumentTypeOptions, resolvePostalCodeFormat, validateRegion };
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ declare const regions: {
|
|
|
4
4
|
readonly comco: {
|
|
5
5
|
readonly id: 9;
|
|
6
6
|
readonly name: "colombia";
|
|
7
|
+
readonly websiteAppName: "colombia";
|
|
7
8
|
readonly countryCode: "CO";
|
|
8
9
|
readonly defaultCurrency: "USD";
|
|
9
10
|
readonly marketRegion: "latam";
|
|
@@ -120,6 +121,7 @@ declare const regions: {
|
|
|
120
121
|
readonly countryId: "246";
|
|
121
122
|
readonly name: "Uruguay";
|
|
122
123
|
}];
|
|
124
|
+
readonly usdPricingForNonResidents: true;
|
|
123
125
|
readonly regionUrls: {
|
|
124
126
|
readonly staging: "https://iatiglobal.iatidev.link/co/";
|
|
125
127
|
readonly production: "https://www.iatiglobal.com/co/";
|
|
@@ -182,6 +184,7 @@ declare const regions: {
|
|
|
182
184
|
readonly comen: {
|
|
183
185
|
readonly id: 5;
|
|
184
186
|
readonly name: "world";
|
|
187
|
+
readonly websiteAppName: "row";
|
|
185
188
|
readonly countryCode: "WR";
|
|
186
189
|
readonly defaultCurrency: "EUR";
|
|
187
190
|
readonly marketRegion: "world";
|
|
@@ -344,6 +347,7 @@ declare const regions: {
|
|
|
344
347
|
readonly comeneu: {
|
|
345
348
|
readonly id: 6;
|
|
346
349
|
readonly name: "europe";
|
|
350
|
+
readonly websiteAppName: "eu";
|
|
347
351
|
readonly countryCode: "EU";
|
|
348
352
|
readonly defaultCurrency: "EUR";
|
|
349
353
|
readonly marketRegion: "europe";
|
|
@@ -506,6 +510,7 @@ declare const regions: {
|
|
|
506
510
|
readonly commx: {
|
|
507
511
|
readonly id: 7;
|
|
508
512
|
readonly name: "mexico";
|
|
513
|
+
readonly websiteAppName: "mexico";
|
|
509
514
|
readonly countryCode: "MX";
|
|
510
515
|
readonly defaultCurrency: "USD";
|
|
511
516
|
readonly marketRegion: "latam";
|
|
@@ -656,6 +661,7 @@ declare const regions: {
|
|
|
656
661
|
readonly compe: {
|
|
657
662
|
readonly id: 8;
|
|
658
663
|
readonly name: "peru";
|
|
664
|
+
readonly websiteAppName: "peru";
|
|
659
665
|
readonly countryCode: "PE";
|
|
660
666
|
readonly defaultCurrency: "USD";
|
|
661
667
|
readonly marketRegion: "latam";
|
|
@@ -806,6 +812,7 @@ declare const regions: {
|
|
|
806
812
|
readonly es: {
|
|
807
813
|
readonly id: 1;
|
|
808
814
|
readonly name: "spain";
|
|
815
|
+
readonly websiteAppName: "spain";
|
|
809
816
|
readonly countryCode: "ES";
|
|
810
817
|
readonly defaultCurrency: "EUR";
|
|
811
818
|
readonly marketRegion: "europe";
|
|
@@ -983,6 +990,7 @@ declare const regions: {
|
|
|
983
990
|
readonly it: {
|
|
984
991
|
readonly id: 10;
|
|
985
992
|
readonly name: "italy";
|
|
993
|
+
readonly websiteAppName: "italy";
|
|
986
994
|
readonly countryCode: "IT";
|
|
987
995
|
readonly defaultCurrency: "EUR";
|
|
988
996
|
readonly marketRegion: "europe";
|
|
@@ -1141,6 +1149,7 @@ declare const regions: {
|
|
|
1141
1149
|
readonly pt: {
|
|
1142
1150
|
readonly id: 2;
|
|
1143
1151
|
readonly name: "portugal";
|
|
1152
|
+
readonly websiteAppName: "portugal";
|
|
1144
1153
|
readonly countryCode: "PT";
|
|
1145
1154
|
readonly defaultCurrency: "EUR";
|
|
1146
1155
|
readonly marketRegion: "europe";
|
|
@@ -1318,6 +1327,7 @@ type RegionCountryCode = RegionConfigSource['countryCode'];
|
|
|
1318
1327
|
type MarketRegion = RegionConfigSource['marketRegion'];
|
|
1319
1328
|
type RegionCode = RegionConfigSource['regionCode'];
|
|
1320
1329
|
type DefaultCurrency = RegionConfigSource['defaultCurrency'];
|
|
1330
|
+
type WebsiteAppName = RegionConfigSource['websiteAppName'];
|
|
1321
1331
|
declare const RegionNameSchema: z.ZodEnum<{
|
|
1322
1332
|
colombia: "colombia";
|
|
1323
1333
|
world: "world";
|
|
@@ -1348,6 +1358,16 @@ declare const RegionCodeSchema: z.ZodEnum<{
|
|
|
1348
1358
|
"it-IT": "it-IT";
|
|
1349
1359
|
"pt-PT": "pt-PT";
|
|
1350
1360
|
}>;
|
|
1361
|
+
declare const WebsiteAppNameSchema: z.ZodEnum<{
|
|
1362
|
+
colombia: "colombia";
|
|
1363
|
+
row: "row";
|
|
1364
|
+
eu: "eu";
|
|
1365
|
+
mexico: "mexico";
|
|
1366
|
+
peru: "peru";
|
|
1367
|
+
spain: "spain";
|
|
1368
|
+
italy: "italy";
|
|
1369
|
+
portugal: "portugal";
|
|
1370
|
+
}>;
|
|
1351
1371
|
declare const MarketRegionSchema: z.ZodEnum<{
|
|
1352
1372
|
latam: "latam";
|
|
1353
1373
|
world: "world";
|
|
@@ -1382,6 +1402,16 @@ declare const MarketRegionEnum: {
|
|
|
1382
1402
|
world: "world";
|
|
1383
1403
|
europe: "europe";
|
|
1384
1404
|
};
|
|
1405
|
+
declare const WebsiteAppNameEnum: {
|
|
1406
|
+
colombia: "colombia";
|
|
1407
|
+
row: "row";
|
|
1408
|
+
eu: "eu";
|
|
1409
|
+
mexico: "mexico";
|
|
1410
|
+
peru: "peru";
|
|
1411
|
+
spain: "spain";
|
|
1412
|
+
italy: "italy";
|
|
1413
|
+
portugal: "portugal";
|
|
1414
|
+
};
|
|
1385
1415
|
type DocumentTypeOption = {
|
|
1386
1416
|
label: string;
|
|
1387
1417
|
value: string;
|
|
@@ -1432,6 +1462,7 @@ declare const RegionConfigSchema: z.ZodObject<{
|
|
|
1432
1462
|
countryId: z.ZodString;
|
|
1433
1463
|
name: z.ZodOptional<z.ZodString>;
|
|
1434
1464
|
}, z.core.$strip>>>;
|
|
1465
|
+
usdPricingForNonResidents: z.ZodOptional<z.ZodBoolean>;
|
|
1435
1466
|
regionUrls: z.ZodOptional<z.ZodObject<{
|
|
1436
1467
|
staging: z.ZodURL;
|
|
1437
1468
|
production: z.ZodURL;
|
|
@@ -1492,6 +1523,16 @@ declare const RegionConfigSchema: z.ZodObject<{
|
|
|
1492
1523
|
italy: "italy";
|
|
1493
1524
|
portugal: "portugal";
|
|
1494
1525
|
}>;
|
|
1526
|
+
websiteAppName: z.ZodEnum<{
|
|
1527
|
+
colombia: "colombia";
|
|
1528
|
+
row: "row";
|
|
1529
|
+
eu: "eu";
|
|
1530
|
+
mexico: "mexico";
|
|
1531
|
+
peru: "peru";
|
|
1532
|
+
spain: "spain";
|
|
1533
|
+
italy: "italy";
|
|
1534
|
+
portugal: "portugal";
|
|
1535
|
+
}>;
|
|
1495
1536
|
countryCode: z.ZodEnum<{
|
|
1496
1537
|
CO: "CO";
|
|
1497
1538
|
WR: "WR";
|
|
@@ -1548,6 +1589,21 @@ declare const getRegionConfigByName: (name: string) => RegionConfig | undefined;
|
|
|
1548
1589
|
|
|
1549
1590
|
declare const getRegionConfigByRegionCode: (regionCode: RegionConfig["regionCode"]) => RegionConfig;
|
|
1550
1591
|
|
|
1592
|
+
/**
|
|
1593
|
+
* Resolve the region config served by a website app.
|
|
1594
|
+
*
|
|
1595
|
+
* Returns `undefined` for apps that are not region-scoped (e.g. `studio`,
|
|
1596
|
+
* `dispatcher`, `docs`), so callers can treat "no region" as a valid state.
|
|
1597
|
+
*/
|
|
1598
|
+
declare const getRegionConfigByWebsiteAppName: (websiteAppName: string) => RegionConfig | undefined;
|
|
1599
|
+
|
|
1600
|
+
/**
|
|
1601
|
+
* Resolve just the region code (e.g. `es-ES`, `en-ROW`) served by a website app.
|
|
1602
|
+
*
|
|
1603
|
+
* Returns `undefined` for apps that are not region-scoped.
|
|
1604
|
+
*/
|
|
1605
|
+
declare const getRegionCodeByWebsiteAppName: (websiteAppName: string) => RegionCode | undefined;
|
|
1606
|
+
|
|
1551
1607
|
declare const COUNTRIES_TO_REDIRECT: {
|
|
1552
1608
|
readonly es: {
|
|
1553
1609
|
readonly label: "Spain";
|
|
@@ -1729,4 +1785,4 @@ declare const resolvePostalCodeFormat: (postalCodeFormat?: string, originCountry
|
|
|
1729
1785
|
|
|
1730
1786
|
declare const validateRegion: (region: RegionConfig["regionCode"]) => void;
|
|
1731
1787
|
|
|
1732
|
-
export { COUNTRIES_TO_REDIRECT, type CountriesToRedirectMap, type CountryReference, type CountryToRedirect, type DefaultCurrency, DefaultCurrencySchema, type DocumentTypeOption, type DocumentTypeOptionsByOrigin, EUROPE_COUNTRIES, GROUP_REGIONS, type MarketRegion, MarketRegionEnum, MarketRegionSchema, type PaymentCardType, 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 };
|
|
1788
|
+
export { COUNTRIES_TO_REDIRECT, type CountriesToRedirectMap, type CountryReference, type CountryToRedirect, type DefaultCurrency, DefaultCurrencySchema, type DocumentTypeOption, type DocumentTypeOptionsByOrigin, EUROPE_COUNTRIES, GROUP_REGIONS, type MarketRegion, MarketRegionEnum, MarketRegionSchema, type PaymentCardType, 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, type WebsiteAppName, WebsiteAppNameEnum, WebsiteAppNameSchema, getAllRegions, getCountriesToRedirect, getRegionCodeByWebsiteAppName, getRegionConfig, getRegionConfigById, getRegionConfigByName, getRegionConfigByRegionCode, getRegionConfigByWebsiteAppName, regionsConfig, resolveDocumentTypeOptions, resolvePostalCodeFormat, validateRegion };
|
package/dist/index.js
CHANGED
|
@@ -35,12 +35,16 @@ __export(index_exports, {
|
|
|
35
35
|
US_CANADA_COUNTRIES: () => US_CANADA_COUNTRIES,
|
|
36
36
|
US_CANADA_JAPAN_COUNTRIES: () => US_CANADA_JAPAN_COUNTRIES,
|
|
37
37
|
WORLD_COUNTRIES: () => WORLD_COUNTRIES,
|
|
38
|
+
WebsiteAppNameEnum: () => WebsiteAppNameEnum,
|
|
39
|
+
WebsiteAppNameSchema: () => WebsiteAppNameSchema,
|
|
38
40
|
getAllRegions: () => getAllRegions,
|
|
39
41
|
getCountriesToRedirect: () => getCountriesToRedirect,
|
|
42
|
+
getRegionCodeByWebsiteAppName: () => getRegionCodeByWebsiteAppName,
|
|
40
43
|
getRegionConfig: () => getRegionConfig,
|
|
41
44
|
getRegionConfigById: () => getRegionConfigById,
|
|
42
45
|
getRegionConfigByName: () => getRegionConfigByName,
|
|
43
46
|
getRegionConfigByRegionCode: () => getRegionConfigByRegionCode,
|
|
47
|
+
getRegionConfigByWebsiteAppName: () => getRegionConfigByWebsiteAppName,
|
|
44
48
|
regionsConfig: () => regionsConfig_default,
|
|
45
49
|
resolveDocumentTypeOptions: () => resolveDocumentTypeOptions,
|
|
46
50
|
resolvePostalCodeFormat: () => resolvePostalCodeFormat,
|
|
@@ -371,12 +375,14 @@ var getCountriesToRedirect = (currentSite) => Object.fromEntries(Object.entries(
|
|
|
371
375
|
var comco_default = {
|
|
372
376
|
id: 9,
|
|
373
377
|
name: "colombia",
|
|
378
|
+
websiteAppName: "colombia",
|
|
374
379
|
countryCode: "CO",
|
|
375
380
|
defaultCurrency: "USD",
|
|
376
381
|
marketRegion: "latam",
|
|
377
382
|
emoji: "\u{1F1E8}\u{1F1F4}",
|
|
378
383
|
countriesToRedirect: getCountriesToRedirect("comco"),
|
|
379
384
|
residenceCountries: COUNTRIES_TO_REDIRECT.comco.countries,
|
|
385
|
+
usdPricingForNonResidents: true,
|
|
380
386
|
regionUrls: {
|
|
381
387
|
staging: "https://iatiglobal.iatidev.link/co/",
|
|
382
388
|
production: "https://www.iatiglobal.com/co/"
|
|
@@ -457,6 +463,7 @@ var comco_default = {
|
|
|
457
463
|
var comen_default = {
|
|
458
464
|
id: 5,
|
|
459
465
|
name: "world",
|
|
466
|
+
websiteAppName: "row",
|
|
460
467
|
countryCode: "WR",
|
|
461
468
|
defaultCurrency: "EUR",
|
|
462
469
|
marketRegion: "world",
|
|
@@ -557,6 +564,7 @@ var comen_default = {
|
|
|
557
564
|
var comeneu_default = {
|
|
558
565
|
id: 6,
|
|
559
566
|
name: "europe",
|
|
567
|
+
websiteAppName: "eu",
|
|
560
568
|
countryCode: "EU",
|
|
561
569
|
defaultCurrency: "EUR",
|
|
562
570
|
marketRegion: "europe",
|
|
@@ -657,6 +665,7 @@ var comeneu_default = {
|
|
|
657
665
|
var commx_default = {
|
|
658
666
|
id: 7,
|
|
659
667
|
name: "mexico",
|
|
668
|
+
websiteAppName: "mexico",
|
|
660
669
|
countryCode: "MX",
|
|
661
670
|
defaultCurrency: "USD",
|
|
662
671
|
marketRegion: "latam",
|
|
@@ -742,6 +751,7 @@ var commx_default = {
|
|
|
742
751
|
var compe_default = {
|
|
743
752
|
id: 8,
|
|
744
753
|
name: "peru",
|
|
754
|
+
websiteAppName: "peru",
|
|
745
755
|
countryCode: "PE",
|
|
746
756
|
defaultCurrency: "USD",
|
|
747
757
|
marketRegion: "latam",
|
|
@@ -827,6 +837,7 @@ var compe_default = {
|
|
|
827
837
|
var es_default = {
|
|
828
838
|
id: 1,
|
|
829
839
|
name: "spain",
|
|
840
|
+
websiteAppName: "spain",
|
|
830
841
|
countryCode: "ES",
|
|
831
842
|
defaultCurrency: "EUR",
|
|
832
843
|
marketRegion: "europe",
|
|
@@ -948,6 +959,7 @@ var es_default = {
|
|
|
948
959
|
var it_default = {
|
|
949
960
|
id: 10,
|
|
950
961
|
name: "italy",
|
|
962
|
+
websiteAppName: "italy",
|
|
951
963
|
countryCode: "IT",
|
|
952
964
|
defaultCurrency: "EUR",
|
|
953
965
|
marketRegion: "europe",
|
|
@@ -1043,6 +1055,7 @@ var it_default = {
|
|
|
1043
1055
|
var pt_default = {
|
|
1044
1056
|
id: 2,
|
|
1045
1057
|
name: "portugal",
|
|
1058
|
+
websiteAppName: "portugal",
|
|
1046
1059
|
countryCode: "PT",
|
|
1047
1060
|
defaultCurrency: "EUR",
|
|
1048
1061
|
marketRegion: "europe",
|
|
@@ -1179,6 +1192,7 @@ var RegionNameSchema = import_zod.z.enum(uniqueSorted(Object.values(regions).map
|
|
|
1179
1192
|
var RegionCountryCodeSchema = import_zod.z.enum(uniqueSorted(Object.values(regions).map((region) => region.countryCode)));
|
|
1180
1193
|
var regionEmojiSchema = import_zod.z.enum(uniqueSorted(Object.values(regions).map((region) => region.emoji)));
|
|
1181
1194
|
var RegionCodeSchema = import_zod.z.enum(uniqueSorted(Object.values(regions).map((region) => region.regionCode)));
|
|
1195
|
+
var WebsiteAppNameSchema = import_zod.z.enum(uniqueSorted(Object.values(regions).map((region) => region.websiteAppName)));
|
|
1182
1196
|
var MarketRegionSchema = import_zod.z.enum(uniqueSorted(Object.values(regions).map((region) => region.marketRegion)));
|
|
1183
1197
|
var DefaultCurrencySchema = import_zod.z.enum(
|
|
1184
1198
|
uniqueSorted(Object.values(regions).map((region) => region.defaultCurrency))
|
|
@@ -1186,6 +1200,7 @@ var DefaultCurrencySchema = import_zod.z.enum(
|
|
|
1186
1200
|
var RegionNameEnum = RegionNameSchema.enum;
|
|
1187
1201
|
var RegionCountryCodeEnum = RegionCountryCodeSchema.enum;
|
|
1188
1202
|
var MarketRegionEnum = MarketRegionSchema.enum;
|
|
1203
|
+
var WebsiteAppNameEnum = WebsiteAppNameSchema.enum;
|
|
1189
1204
|
var CountryReferenceSchema = import_zod.z.object({
|
|
1190
1205
|
countryId: import_zod.z.string(),
|
|
1191
1206
|
name: import_zod.z.string().optional()
|
|
@@ -1204,6 +1219,7 @@ var RegionConfigSchema = import_zod.z.strictObject({
|
|
|
1204
1219
|
})
|
|
1205
1220
|
).optional(),
|
|
1206
1221
|
residenceCountries: import_zod.z.array(CountryReferenceSchema).optional(),
|
|
1222
|
+
usdPricingForNonResidents: import_zod.z.boolean().optional(),
|
|
1207
1223
|
regionUrls: import_zod.z.object({
|
|
1208
1224
|
staging: import_zod.z.url(),
|
|
1209
1225
|
production: import_zod.z.url()
|
|
@@ -1244,6 +1260,12 @@ var RegionConfigSchema = import_zod.z.strictObject({
|
|
|
1244
1260
|
),
|
|
1245
1261
|
webSitePath: import_zod.z.string().optional(),
|
|
1246
1262
|
name: RegionNameSchema,
|
|
1263
|
+
/**
|
|
1264
|
+
* Name of the app in iati-websites-monorepo that serves this region.
|
|
1265
|
+
* Matches that repo's `APP_NAME` (its package name minus the `@repo/` prefix),
|
|
1266
|
+
* which is also the `appName` its Sanity documents are filtered by.
|
|
1267
|
+
*/
|
|
1268
|
+
websiteAppName: WebsiteAppNameSchema,
|
|
1247
1269
|
countryCode: RegionCountryCodeSchema,
|
|
1248
1270
|
defaultCurrency: DefaultCurrencySchema,
|
|
1249
1271
|
marketRegion: MarketRegionSchema,
|
|
@@ -1286,6 +1308,18 @@ var getRegionConfigByRegionCode = (regionCode) => {
|
|
|
1286
1308
|
return region;
|
|
1287
1309
|
};
|
|
1288
1310
|
|
|
1311
|
+
// src/utils/getRegionConfigByWebsiteAppName.ts
|
|
1312
|
+
var getRegionConfigByWebsiteAppName = (websiteAppName) => {
|
|
1313
|
+
const normalized = websiteAppName.trim().toLowerCase();
|
|
1314
|
+
return Object.values(regionsConfig_default).find((region) => region.websiteAppName === normalized);
|
|
1315
|
+
};
|
|
1316
|
+
|
|
1317
|
+
// src/utils/getRegionCodeByWebsiteAppName.ts
|
|
1318
|
+
var getRegionCodeByWebsiteAppName = (websiteAppName) => {
|
|
1319
|
+
var _a;
|
|
1320
|
+
return (_a = getRegionConfigByWebsiteAppName(websiteAppName)) == null ? void 0 : _a.regionCode;
|
|
1321
|
+
};
|
|
1322
|
+
|
|
1289
1323
|
// src/utils/resolveDocumentTypeOptions.ts
|
|
1290
1324
|
var resolveDocumentTypeOptions = (documentTypeOptions, documentTypeOptionsByOrigin, originCountryId, siteCountryId) => {
|
|
1291
1325
|
if (!documentTypeOptionsByOrigin) return documentTypeOptions;
|
|
@@ -1325,12 +1359,16 @@ var validateRegion = (region) => {
|
|
|
1325
1359
|
US_CANADA_COUNTRIES,
|
|
1326
1360
|
US_CANADA_JAPAN_COUNTRIES,
|
|
1327
1361
|
WORLD_COUNTRIES,
|
|
1362
|
+
WebsiteAppNameEnum,
|
|
1363
|
+
WebsiteAppNameSchema,
|
|
1328
1364
|
getAllRegions,
|
|
1329
1365
|
getCountriesToRedirect,
|
|
1366
|
+
getRegionCodeByWebsiteAppName,
|
|
1330
1367
|
getRegionConfig,
|
|
1331
1368
|
getRegionConfigById,
|
|
1332
1369
|
getRegionConfigByName,
|
|
1333
1370
|
getRegionConfigByRegionCode,
|
|
1371
|
+
getRegionConfigByWebsiteAppName,
|
|
1334
1372
|
regionsConfig,
|
|
1335
1373
|
resolveDocumentTypeOptions,
|
|
1336
1374
|
resolvePostalCodeFormat,
|
package/dist/index.mjs
CHANGED
|
@@ -321,12 +321,14 @@ var getCountriesToRedirect = (currentSite) => Object.fromEntries(Object.entries(
|
|
|
321
321
|
var comco_default = {
|
|
322
322
|
id: 9,
|
|
323
323
|
name: "colombia",
|
|
324
|
+
websiteAppName: "colombia",
|
|
324
325
|
countryCode: "CO",
|
|
325
326
|
defaultCurrency: "USD",
|
|
326
327
|
marketRegion: "latam",
|
|
327
328
|
emoji: "\u{1F1E8}\u{1F1F4}",
|
|
328
329
|
countriesToRedirect: getCountriesToRedirect("comco"),
|
|
329
330
|
residenceCountries: COUNTRIES_TO_REDIRECT.comco.countries,
|
|
331
|
+
usdPricingForNonResidents: true,
|
|
330
332
|
regionUrls: {
|
|
331
333
|
staging: "https://iatiglobal.iatidev.link/co/",
|
|
332
334
|
production: "https://www.iatiglobal.com/co/"
|
|
@@ -407,6 +409,7 @@ var comco_default = {
|
|
|
407
409
|
var comen_default = {
|
|
408
410
|
id: 5,
|
|
409
411
|
name: "world",
|
|
412
|
+
websiteAppName: "row",
|
|
410
413
|
countryCode: "WR",
|
|
411
414
|
defaultCurrency: "EUR",
|
|
412
415
|
marketRegion: "world",
|
|
@@ -507,6 +510,7 @@ var comen_default = {
|
|
|
507
510
|
var comeneu_default = {
|
|
508
511
|
id: 6,
|
|
509
512
|
name: "europe",
|
|
513
|
+
websiteAppName: "eu",
|
|
510
514
|
countryCode: "EU",
|
|
511
515
|
defaultCurrency: "EUR",
|
|
512
516
|
marketRegion: "europe",
|
|
@@ -607,6 +611,7 @@ var comeneu_default = {
|
|
|
607
611
|
var commx_default = {
|
|
608
612
|
id: 7,
|
|
609
613
|
name: "mexico",
|
|
614
|
+
websiteAppName: "mexico",
|
|
610
615
|
countryCode: "MX",
|
|
611
616
|
defaultCurrency: "USD",
|
|
612
617
|
marketRegion: "latam",
|
|
@@ -692,6 +697,7 @@ var commx_default = {
|
|
|
692
697
|
var compe_default = {
|
|
693
698
|
id: 8,
|
|
694
699
|
name: "peru",
|
|
700
|
+
websiteAppName: "peru",
|
|
695
701
|
countryCode: "PE",
|
|
696
702
|
defaultCurrency: "USD",
|
|
697
703
|
marketRegion: "latam",
|
|
@@ -777,6 +783,7 @@ var compe_default = {
|
|
|
777
783
|
var es_default = {
|
|
778
784
|
id: 1,
|
|
779
785
|
name: "spain",
|
|
786
|
+
websiteAppName: "spain",
|
|
780
787
|
countryCode: "ES",
|
|
781
788
|
defaultCurrency: "EUR",
|
|
782
789
|
marketRegion: "europe",
|
|
@@ -898,6 +905,7 @@ var es_default = {
|
|
|
898
905
|
var it_default = {
|
|
899
906
|
id: 10,
|
|
900
907
|
name: "italy",
|
|
908
|
+
websiteAppName: "italy",
|
|
901
909
|
countryCode: "IT",
|
|
902
910
|
defaultCurrency: "EUR",
|
|
903
911
|
marketRegion: "europe",
|
|
@@ -993,6 +1001,7 @@ var it_default = {
|
|
|
993
1001
|
var pt_default = {
|
|
994
1002
|
id: 2,
|
|
995
1003
|
name: "portugal",
|
|
1004
|
+
websiteAppName: "portugal",
|
|
996
1005
|
countryCode: "PT",
|
|
997
1006
|
defaultCurrency: "EUR",
|
|
998
1007
|
marketRegion: "europe",
|
|
@@ -1129,6 +1138,7 @@ var RegionNameSchema = z.enum(uniqueSorted(Object.values(regions).map((region) =
|
|
|
1129
1138
|
var RegionCountryCodeSchema = z.enum(uniqueSorted(Object.values(regions).map((region) => region.countryCode)));
|
|
1130
1139
|
var regionEmojiSchema = z.enum(uniqueSorted(Object.values(regions).map((region) => region.emoji)));
|
|
1131
1140
|
var RegionCodeSchema = z.enum(uniqueSorted(Object.values(regions).map((region) => region.regionCode)));
|
|
1141
|
+
var WebsiteAppNameSchema = z.enum(uniqueSorted(Object.values(regions).map((region) => region.websiteAppName)));
|
|
1132
1142
|
var MarketRegionSchema = z.enum(uniqueSorted(Object.values(regions).map((region) => region.marketRegion)));
|
|
1133
1143
|
var DefaultCurrencySchema = z.enum(
|
|
1134
1144
|
uniqueSorted(Object.values(regions).map((region) => region.defaultCurrency))
|
|
@@ -1136,6 +1146,7 @@ var DefaultCurrencySchema = z.enum(
|
|
|
1136
1146
|
var RegionNameEnum = RegionNameSchema.enum;
|
|
1137
1147
|
var RegionCountryCodeEnum = RegionCountryCodeSchema.enum;
|
|
1138
1148
|
var MarketRegionEnum = MarketRegionSchema.enum;
|
|
1149
|
+
var WebsiteAppNameEnum = WebsiteAppNameSchema.enum;
|
|
1139
1150
|
var CountryReferenceSchema = z.object({
|
|
1140
1151
|
countryId: z.string(),
|
|
1141
1152
|
name: z.string().optional()
|
|
@@ -1154,6 +1165,7 @@ var RegionConfigSchema = z.strictObject({
|
|
|
1154
1165
|
})
|
|
1155
1166
|
).optional(),
|
|
1156
1167
|
residenceCountries: z.array(CountryReferenceSchema).optional(),
|
|
1168
|
+
usdPricingForNonResidents: z.boolean().optional(),
|
|
1157
1169
|
regionUrls: z.object({
|
|
1158
1170
|
staging: z.url(),
|
|
1159
1171
|
production: z.url()
|
|
@@ -1194,6 +1206,12 @@ var RegionConfigSchema = z.strictObject({
|
|
|
1194
1206
|
),
|
|
1195
1207
|
webSitePath: z.string().optional(),
|
|
1196
1208
|
name: RegionNameSchema,
|
|
1209
|
+
/**
|
|
1210
|
+
* Name of the app in iati-websites-monorepo that serves this region.
|
|
1211
|
+
* Matches that repo's `APP_NAME` (its package name minus the `@repo/` prefix),
|
|
1212
|
+
* which is also the `appName` its Sanity documents are filtered by.
|
|
1213
|
+
*/
|
|
1214
|
+
websiteAppName: WebsiteAppNameSchema,
|
|
1197
1215
|
countryCode: RegionCountryCodeSchema,
|
|
1198
1216
|
defaultCurrency: DefaultCurrencySchema,
|
|
1199
1217
|
marketRegion: MarketRegionSchema,
|
|
@@ -1236,6 +1254,18 @@ var getRegionConfigByRegionCode = (regionCode) => {
|
|
|
1236
1254
|
return region;
|
|
1237
1255
|
};
|
|
1238
1256
|
|
|
1257
|
+
// src/utils/getRegionConfigByWebsiteAppName.ts
|
|
1258
|
+
var getRegionConfigByWebsiteAppName = (websiteAppName) => {
|
|
1259
|
+
const normalized = websiteAppName.trim().toLowerCase();
|
|
1260
|
+
return Object.values(regionsConfig_default).find((region) => region.websiteAppName === normalized);
|
|
1261
|
+
};
|
|
1262
|
+
|
|
1263
|
+
// src/utils/getRegionCodeByWebsiteAppName.ts
|
|
1264
|
+
var getRegionCodeByWebsiteAppName = (websiteAppName) => {
|
|
1265
|
+
var _a;
|
|
1266
|
+
return (_a = getRegionConfigByWebsiteAppName(websiteAppName)) == null ? void 0 : _a.regionCode;
|
|
1267
|
+
};
|
|
1268
|
+
|
|
1239
1269
|
// src/utils/resolveDocumentTypeOptions.ts
|
|
1240
1270
|
var resolveDocumentTypeOptions = (documentTypeOptions, documentTypeOptionsByOrigin, originCountryId, siteCountryId) => {
|
|
1241
1271
|
if (!documentTypeOptionsByOrigin) return documentTypeOptions;
|
|
@@ -1274,12 +1304,16 @@ export {
|
|
|
1274
1304
|
US_CANADA_COUNTRIES,
|
|
1275
1305
|
US_CANADA_JAPAN_COUNTRIES,
|
|
1276
1306
|
WORLD_COUNTRIES,
|
|
1307
|
+
WebsiteAppNameEnum,
|
|
1308
|
+
WebsiteAppNameSchema,
|
|
1277
1309
|
getAllRegions,
|
|
1278
1310
|
getCountriesToRedirect,
|
|
1311
|
+
getRegionCodeByWebsiteAppName,
|
|
1279
1312
|
getRegionConfig,
|
|
1280
1313
|
getRegionConfigById,
|
|
1281
1314
|
getRegionConfigByName,
|
|
1282
1315
|
getRegionConfigByRegionCode,
|
|
1316
|
+
getRegionConfigByWebsiteAppName,
|
|
1283
1317
|
regionsConfig_default as regionsConfig,
|
|
1284
1318
|
resolveDocumentTypeOptions,
|
|
1285
1319
|
resolvePostalCodeFormat,
|