regions-config 1.4.0 → 1.6.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 +44 -11
- package/dist/index.d.mts +64 -1
- package/dist/index.d.ts +64 -1
- package/dist/index.js +45 -0
- package/dist/index.mjs +41 -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 }>;
|
|
@@ -140,6 +168,9 @@ type RegionConfig = {
|
|
|
140
168
|
documentTypeOptionsByOrigin?: DocumentTypeOptionsByOrigin;
|
|
141
169
|
paymentCardTypes: Array<{ id: number; name: string; imagePath: string }>;
|
|
142
170
|
countriesToRedirect?: CountriesToRedirectMap;
|
|
171
|
+
residenceCountries?: Array<{ countryId: string; name?: string }>;
|
|
172
|
+
hasDefaultResidenceCountry: boolean;
|
|
173
|
+
usdPricingForNonResidents?: boolean;
|
|
143
174
|
regionsToGroup?: RegionToGroup[];
|
|
144
175
|
regionUrls?: { staging: string; production: string };
|
|
145
176
|
webSitePath?: string;
|
|
@@ -179,6 +210,8 @@ src/
|
|
|
179
210
|
│ ├── getRegionConfig.ts
|
|
180
211
|
│ ├── getRegionConfigById.ts
|
|
181
212
|
│ ├── getRegionConfigByRegionCode.ts
|
|
213
|
+
│ ├── getRegionConfigByWebsiteAppName.ts
|
|
214
|
+
│ ├── getRegionCodeByWebsiteAppName.ts
|
|
182
215
|
│ └── resolveDocumentTypeOptions.ts
|
|
183
216
|
└── validators/
|
|
184
217
|
└── 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";
|
|
@@ -121,6 +122,7 @@ declare const regions: {
|
|
|
121
122
|
readonly name: "Uruguay";
|
|
122
123
|
}];
|
|
123
124
|
readonly usdPricingForNonResidents: true;
|
|
125
|
+
readonly hasDefaultResidenceCountry: false;
|
|
124
126
|
readonly regionUrls: {
|
|
125
127
|
readonly staging: "https://iatiglobal.iatidev.link/co/";
|
|
126
128
|
readonly production: "https://www.iatiglobal.com/co/";
|
|
@@ -183,6 +185,7 @@ declare const regions: {
|
|
|
183
185
|
readonly comen: {
|
|
184
186
|
readonly id: 5;
|
|
185
187
|
readonly name: "world";
|
|
188
|
+
readonly websiteAppName: "row";
|
|
186
189
|
readonly countryCode: "WR";
|
|
187
190
|
readonly defaultCurrency: "EUR";
|
|
188
191
|
readonly marketRegion: "world";
|
|
@@ -271,6 +274,7 @@ declare const regions: {
|
|
|
271
274
|
}];
|
|
272
275
|
};
|
|
273
276
|
};
|
|
277
|
+
readonly hasDefaultResidenceCountry: false;
|
|
274
278
|
readonly regionUrls: {
|
|
275
279
|
readonly staging: "https://stg.iatiglobal.com/en/";
|
|
276
280
|
readonly production: "https://www.iatiglobal.com/en/";
|
|
@@ -345,6 +349,7 @@ declare const regions: {
|
|
|
345
349
|
readonly comeneu: {
|
|
346
350
|
readonly id: 6;
|
|
347
351
|
readonly name: "europe";
|
|
352
|
+
readonly websiteAppName: "eu";
|
|
348
353
|
readonly countryCode: "EU";
|
|
349
354
|
readonly defaultCurrency: "EUR";
|
|
350
355
|
readonly marketRegion: "europe";
|
|
@@ -433,6 +438,7 @@ declare const regions: {
|
|
|
433
438
|
}];
|
|
434
439
|
};
|
|
435
440
|
};
|
|
441
|
+
readonly hasDefaultResidenceCountry: false;
|
|
436
442
|
readonly regionUrls: {
|
|
437
443
|
readonly staging: "https://stg.iatiglobal.com/en-eu/";
|
|
438
444
|
readonly production: "https://www.iatiglobal.com/en-eu/";
|
|
@@ -507,6 +513,7 @@ declare const regions: {
|
|
|
507
513
|
readonly commx: {
|
|
508
514
|
readonly id: 7;
|
|
509
515
|
readonly name: "mexico";
|
|
516
|
+
readonly websiteAppName: "mexico";
|
|
510
517
|
readonly countryCode: "MX";
|
|
511
518
|
readonly defaultCurrency: "USD";
|
|
512
519
|
readonly marketRegion: "latam";
|
|
@@ -595,6 +602,7 @@ declare const regions: {
|
|
|
595
602
|
}];
|
|
596
603
|
};
|
|
597
604
|
};
|
|
605
|
+
readonly hasDefaultResidenceCountry: true;
|
|
598
606
|
readonly regionUrls: {
|
|
599
607
|
readonly staging: "https://stg.iatiglobal.com/mx/";
|
|
600
608
|
readonly production: "https://www.iatiglobal.com/mx/";
|
|
@@ -657,6 +665,7 @@ declare const regions: {
|
|
|
657
665
|
readonly compe: {
|
|
658
666
|
readonly id: 8;
|
|
659
667
|
readonly name: "peru";
|
|
668
|
+
readonly websiteAppName: "peru";
|
|
660
669
|
readonly countryCode: "PE";
|
|
661
670
|
readonly defaultCurrency: "USD";
|
|
662
671
|
readonly marketRegion: "latam";
|
|
@@ -745,6 +754,7 @@ declare const regions: {
|
|
|
745
754
|
}];
|
|
746
755
|
};
|
|
747
756
|
};
|
|
757
|
+
readonly hasDefaultResidenceCountry: true;
|
|
748
758
|
readonly regionUrls: {
|
|
749
759
|
readonly staging: "https://stg.iatiglobal.com/pe/";
|
|
750
760
|
readonly production: "https://www.iatiglobal.com/pe/";
|
|
@@ -807,6 +817,7 @@ declare const regions: {
|
|
|
807
817
|
readonly es: {
|
|
808
818
|
readonly id: 1;
|
|
809
819
|
readonly name: "spain";
|
|
820
|
+
readonly websiteAppName: "spain";
|
|
810
821
|
readonly countryCode: "ES";
|
|
811
822
|
readonly defaultCurrency: "EUR";
|
|
812
823
|
readonly marketRegion: "europe";
|
|
@@ -895,6 +906,7 @@ declare const regions: {
|
|
|
895
906
|
}];
|
|
896
907
|
};
|
|
897
908
|
};
|
|
909
|
+
readonly hasDefaultResidenceCountry: true;
|
|
898
910
|
readonly regionUrls: {
|
|
899
911
|
readonly staging: "https://stg.iatiseguros.com";
|
|
900
912
|
readonly production: "https://www.iatiseguros.com";
|
|
@@ -984,6 +996,7 @@ declare const regions: {
|
|
|
984
996
|
readonly it: {
|
|
985
997
|
readonly id: 10;
|
|
986
998
|
readonly name: "italy";
|
|
999
|
+
readonly websiteAppName: "italy";
|
|
987
1000
|
readonly countryCode: "IT";
|
|
988
1001
|
readonly defaultCurrency: "EUR";
|
|
989
1002
|
readonly marketRegion: "europe";
|
|
@@ -1072,6 +1085,7 @@ declare const regions: {
|
|
|
1072
1085
|
}];
|
|
1073
1086
|
};
|
|
1074
1087
|
};
|
|
1088
|
+
readonly hasDefaultResidenceCountry: true;
|
|
1075
1089
|
readonly regionUrls: {
|
|
1076
1090
|
readonly staging: "https://stg.iatiassicurazioni.it";
|
|
1077
1091
|
readonly production: "https://www.iatiassicurazioni.it";
|
|
@@ -1142,6 +1156,7 @@ declare const regions: {
|
|
|
1142
1156
|
readonly pt: {
|
|
1143
1157
|
readonly id: 2;
|
|
1144
1158
|
readonly name: "portugal";
|
|
1159
|
+
readonly websiteAppName: "portugal";
|
|
1145
1160
|
readonly countryCode: "PT";
|
|
1146
1161
|
readonly defaultCurrency: "EUR";
|
|
1147
1162
|
readonly marketRegion: "europe";
|
|
@@ -1230,6 +1245,7 @@ declare const regions: {
|
|
|
1230
1245
|
}];
|
|
1231
1246
|
};
|
|
1232
1247
|
};
|
|
1248
|
+
readonly hasDefaultResidenceCountry: false;
|
|
1233
1249
|
readonly regionUrls: {
|
|
1234
1250
|
readonly staging: "https://stg.iatiseguros.pt";
|
|
1235
1251
|
readonly production: "https://www.iatiseguros.pt";
|
|
@@ -1319,6 +1335,7 @@ type RegionCountryCode = RegionConfigSource['countryCode'];
|
|
|
1319
1335
|
type MarketRegion = RegionConfigSource['marketRegion'];
|
|
1320
1336
|
type RegionCode = RegionConfigSource['regionCode'];
|
|
1321
1337
|
type DefaultCurrency = RegionConfigSource['defaultCurrency'];
|
|
1338
|
+
type WebsiteAppName = RegionConfigSource['websiteAppName'];
|
|
1322
1339
|
declare const RegionNameSchema: z.ZodEnum<{
|
|
1323
1340
|
colombia: "colombia";
|
|
1324
1341
|
world: "world";
|
|
@@ -1349,6 +1366,16 @@ declare const RegionCodeSchema: z.ZodEnum<{
|
|
|
1349
1366
|
"it-IT": "it-IT";
|
|
1350
1367
|
"pt-PT": "pt-PT";
|
|
1351
1368
|
}>;
|
|
1369
|
+
declare const WebsiteAppNameSchema: z.ZodEnum<{
|
|
1370
|
+
colombia: "colombia";
|
|
1371
|
+
row: "row";
|
|
1372
|
+
eu: "eu";
|
|
1373
|
+
mexico: "mexico";
|
|
1374
|
+
peru: "peru";
|
|
1375
|
+
spain: "spain";
|
|
1376
|
+
italy: "italy";
|
|
1377
|
+
portugal: "portugal";
|
|
1378
|
+
}>;
|
|
1352
1379
|
declare const MarketRegionSchema: z.ZodEnum<{
|
|
1353
1380
|
latam: "latam";
|
|
1354
1381
|
world: "world";
|
|
@@ -1383,6 +1410,16 @@ declare const MarketRegionEnum: {
|
|
|
1383
1410
|
world: "world";
|
|
1384
1411
|
europe: "europe";
|
|
1385
1412
|
};
|
|
1413
|
+
declare const WebsiteAppNameEnum: {
|
|
1414
|
+
colombia: "colombia";
|
|
1415
|
+
row: "row";
|
|
1416
|
+
eu: "eu";
|
|
1417
|
+
mexico: "mexico";
|
|
1418
|
+
peru: "peru";
|
|
1419
|
+
spain: "spain";
|
|
1420
|
+
italy: "italy";
|
|
1421
|
+
portugal: "portugal";
|
|
1422
|
+
};
|
|
1386
1423
|
type DocumentTypeOption = {
|
|
1387
1424
|
label: string;
|
|
1388
1425
|
value: string;
|
|
@@ -1433,6 +1470,7 @@ declare const RegionConfigSchema: z.ZodObject<{
|
|
|
1433
1470
|
countryId: z.ZodString;
|
|
1434
1471
|
name: z.ZodOptional<z.ZodString>;
|
|
1435
1472
|
}, z.core.$strip>>>;
|
|
1473
|
+
hasDefaultResidenceCountry: z.ZodBoolean;
|
|
1436
1474
|
usdPricingForNonResidents: z.ZodOptional<z.ZodBoolean>;
|
|
1437
1475
|
regionUrls: z.ZodOptional<z.ZodObject<{
|
|
1438
1476
|
staging: z.ZodURL;
|
|
@@ -1494,6 +1532,16 @@ declare const RegionConfigSchema: z.ZodObject<{
|
|
|
1494
1532
|
italy: "italy";
|
|
1495
1533
|
portugal: "portugal";
|
|
1496
1534
|
}>;
|
|
1535
|
+
websiteAppName: z.ZodEnum<{
|
|
1536
|
+
colombia: "colombia";
|
|
1537
|
+
row: "row";
|
|
1538
|
+
eu: "eu";
|
|
1539
|
+
mexico: "mexico";
|
|
1540
|
+
peru: "peru";
|
|
1541
|
+
spain: "spain";
|
|
1542
|
+
italy: "italy";
|
|
1543
|
+
portugal: "portugal";
|
|
1544
|
+
}>;
|
|
1497
1545
|
countryCode: z.ZodEnum<{
|
|
1498
1546
|
CO: "CO";
|
|
1499
1547
|
WR: "WR";
|
|
@@ -1550,6 +1598,21 @@ declare const getRegionConfigByName: (name: string) => RegionConfig | undefined;
|
|
|
1550
1598
|
|
|
1551
1599
|
declare const getRegionConfigByRegionCode: (regionCode: RegionConfig["regionCode"]) => RegionConfig;
|
|
1552
1600
|
|
|
1601
|
+
/**
|
|
1602
|
+
* Resolve the region config served by a website app.
|
|
1603
|
+
*
|
|
1604
|
+
* Returns `undefined` for apps that are not region-scoped (e.g. `studio`,
|
|
1605
|
+
* `dispatcher`, `docs`), so callers can treat "no region" as a valid state.
|
|
1606
|
+
*/
|
|
1607
|
+
declare const getRegionConfigByWebsiteAppName: (websiteAppName: string) => RegionConfig | undefined;
|
|
1608
|
+
|
|
1609
|
+
/**
|
|
1610
|
+
* Resolve just the region code (e.g. `es-ES`, `en-ROW`) served by a website app.
|
|
1611
|
+
*
|
|
1612
|
+
* Returns `undefined` for apps that are not region-scoped.
|
|
1613
|
+
*/
|
|
1614
|
+
declare const getRegionCodeByWebsiteAppName: (websiteAppName: string) => RegionCode | undefined;
|
|
1615
|
+
|
|
1553
1616
|
declare const COUNTRIES_TO_REDIRECT: {
|
|
1554
1617
|
readonly es: {
|
|
1555
1618
|
readonly label: "Spain";
|
|
@@ -1731,4 +1794,4 @@ declare const resolvePostalCodeFormat: (postalCodeFormat?: string, originCountry
|
|
|
1731
1794
|
|
|
1732
1795
|
declare const validateRegion: (region: RegionConfig["regionCode"]) => void;
|
|
1733
1796
|
|
|
1734
|
-
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 };
|
|
1797
|
+
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";
|
|
@@ -121,6 +122,7 @@ declare const regions: {
|
|
|
121
122
|
readonly name: "Uruguay";
|
|
122
123
|
}];
|
|
123
124
|
readonly usdPricingForNonResidents: true;
|
|
125
|
+
readonly hasDefaultResidenceCountry: false;
|
|
124
126
|
readonly regionUrls: {
|
|
125
127
|
readonly staging: "https://iatiglobal.iatidev.link/co/";
|
|
126
128
|
readonly production: "https://www.iatiglobal.com/co/";
|
|
@@ -183,6 +185,7 @@ declare const regions: {
|
|
|
183
185
|
readonly comen: {
|
|
184
186
|
readonly id: 5;
|
|
185
187
|
readonly name: "world";
|
|
188
|
+
readonly websiteAppName: "row";
|
|
186
189
|
readonly countryCode: "WR";
|
|
187
190
|
readonly defaultCurrency: "EUR";
|
|
188
191
|
readonly marketRegion: "world";
|
|
@@ -271,6 +274,7 @@ declare const regions: {
|
|
|
271
274
|
}];
|
|
272
275
|
};
|
|
273
276
|
};
|
|
277
|
+
readonly hasDefaultResidenceCountry: false;
|
|
274
278
|
readonly regionUrls: {
|
|
275
279
|
readonly staging: "https://stg.iatiglobal.com/en/";
|
|
276
280
|
readonly production: "https://www.iatiglobal.com/en/";
|
|
@@ -345,6 +349,7 @@ declare const regions: {
|
|
|
345
349
|
readonly comeneu: {
|
|
346
350
|
readonly id: 6;
|
|
347
351
|
readonly name: "europe";
|
|
352
|
+
readonly websiteAppName: "eu";
|
|
348
353
|
readonly countryCode: "EU";
|
|
349
354
|
readonly defaultCurrency: "EUR";
|
|
350
355
|
readonly marketRegion: "europe";
|
|
@@ -433,6 +438,7 @@ declare const regions: {
|
|
|
433
438
|
}];
|
|
434
439
|
};
|
|
435
440
|
};
|
|
441
|
+
readonly hasDefaultResidenceCountry: false;
|
|
436
442
|
readonly regionUrls: {
|
|
437
443
|
readonly staging: "https://stg.iatiglobal.com/en-eu/";
|
|
438
444
|
readonly production: "https://www.iatiglobal.com/en-eu/";
|
|
@@ -507,6 +513,7 @@ declare const regions: {
|
|
|
507
513
|
readonly commx: {
|
|
508
514
|
readonly id: 7;
|
|
509
515
|
readonly name: "mexico";
|
|
516
|
+
readonly websiteAppName: "mexico";
|
|
510
517
|
readonly countryCode: "MX";
|
|
511
518
|
readonly defaultCurrency: "USD";
|
|
512
519
|
readonly marketRegion: "latam";
|
|
@@ -595,6 +602,7 @@ declare const regions: {
|
|
|
595
602
|
}];
|
|
596
603
|
};
|
|
597
604
|
};
|
|
605
|
+
readonly hasDefaultResidenceCountry: true;
|
|
598
606
|
readonly regionUrls: {
|
|
599
607
|
readonly staging: "https://stg.iatiglobal.com/mx/";
|
|
600
608
|
readonly production: "https://www.iatiglobal.com/mx/";
|
|
@@ -657,6 +665,7 @@ declare const regions: {
|
|
|
657
665
|
readonly compe: {
|
|
658
666
|
readonly id: 8;
|
|
659
667
|
readonly name: "peru";
|
|
668
|
+
readonly websiteAppName: "peru";
|
|
660
669
|
readonly countryCode: "PE";
|
|
661
670
|
readonly defaultCurrency: "USD";
|
|
662
671
|
readonly marketRegion: "latam";
|
|
@@ -745,6 +754,7 @@ declare const regions: {
|
|
|
745
754
|
}];
|
|
746
755
|
};
|
|
747
756
|
};
|
|
757
|
+
readonly hasDefaultResidenceCountry: true;
|
|
748
758
|
readonly regionUrls: {
|
|
749
759
|
readonly staging: "https://stg.iatiglobal.com/pe/";
|
|
750
760
|
readonly production: "https://www.iatiglobal.com/pe/";
|
|
@@ -807,6 +817,7 @@ declare const regions: {
|
|
|
807
817
|
readonly es: {
|
|
808
818
|
readonly id: 1;
|
|
809
819
|
readonly name: "spain";
|
|
820
|
+
readonly websiteAppName: "spain";
|
|
810
821
|
readonly countryCode: "ES";
|
|
811
822
|
readonly defaultCurrency: "EUR";
|
|
812
823
|
readonly marketRegion: "europe";
|
|
@@ -895,6 +906,7 @@ declare const regions: {
|
|
|
895
906
|
}];
|
|
896
907
|
};
|
|
897
908
|
};
|
|
909
|
+
readonly hasDefaultResidenceCountry: true;
|
|
898
910
|
readonly regionUrls: {
|
|
899
911
|
readonly staging: "https://stg.iatiseguros.com";
|
|
900
912
|
readonly production: "https://www.iatiseguros.com";
|
|
@@ -984,6 +996,7 @@ declare const regions: {
|
|
|
984
996
|
readonly it: {
|
|
985
997
|
readonly id: 10;
|
|
986
998
|
readonly name: "italy";
|
|
999
|
+
readonly websiteAppName: "italy";
|
|
987
1000
|
readonly countryCode: "IT";
|
|
988
1001
|
readonly defaultCurrency: "EUR";
|
|
989
1002
|
readonly marketRegion: "europe";
|
|
@@ -1072,6 +1085,7 @@ declare const regions: {
|
|
|
1072
1085
|
}];
|
|
1073
1086
|
};
|
|
1074
1087
|
};
|
|
1088
|
+
readonly hasDefaultResidenceCountry: true;
|
|
1075
1089
|
readonly regionUrls: {
|
|
1076
1090
|
readonly staging: "https://stg.iatiassicurazioni.it";
|
|
1077
1091
|
readonly production: "https://www.iatiassicurazioni.it";
|
|
@@ -1142,6 +1156,7 @@ declare const regions: {
|
|
|
1142
1156
|
readonly pt: {
|
|
1143
1157
|
readonly id: 2;
|
|
1144
1158
|
readonly name: "portugal";
|
|
1159
|
+
readonly websiteAppName: "portugal";
|
|
1145
1160
|
readonly countryCode: "PT";
|
|
1146
1161
|
readonly defaultCurrency: "EUR";
|
|
1147
1162
|
readonly marketRegion: "europe";
|
|
@@ -1230,6 +1245,7 @@ declare const regions: {
|
|
|
1230
1245
|
}];
|
|
1231
1246
|
};
|
|
1232
1247
|
};
|
|
1248
|
+
readonly hasDefaultResidenceCountry: false;
|
|
1233
1249
|
readonly regionUrls: {
|
|
1234
1250
|
readonly staging: "https://stg.iatiseguros.pt";
|
|
1235
1251
|
readonly production: "https://www.iatiseguros.pt";
|
|
@@ -1319,6 +1335,7 @@ type RegionCountryCode = RegionConfigSource['countryCode'];
|
|
|
1319
1335
|
type MarketRegion = RegionConfigSource['marketRegion'];
|
|
1320
1336
|
type RegionCode = RegionConfigSource['regionCode'];
|
|
1321
1337
|
type DefaultCurrency = RegionConfigSource['defaultCurrency'];
|
|
1338
|
+
type WebsiteAppName = RegionConfigSource['websiteAppName'];
|
|
1322
1339
|
declare const RegionNameSchema: z.ZodEnum<{
|
|
1323
1340
|
colombia: "colombia";
|
|
1324
1341
|
world: "world";
|
|
@@ -1349,6 +1366,16 @@ declare const RegionCodeSchema: z.ZodEnum<{
|
|
|
1349
1366
|
"it-IT": "it-IT";
|
|
1350
1367
|
"pt-PT": "pt-PT";
|
|
1351
1368
|
}>;
|
|
1369
|
+
declare const WebsiteAppNameSchema: z.ZodEnum<{
|
|
1370
|
+
colombia: "colombia";
|
|
1371
|
+
row: "row";
|
|
1372
|
+
eu: "eu";
|
|
1373
|
+
mexico: "mexico";
|
|
1374
|
+
peru: "peru";
|
|
1375
|
+
spain: "spain";
|
|
1376
|
+
italy: "italy";
|
|
1377
|
+
portugal: "portugal";
|
|
1378
|
+
}>;
|
|
1352
1379
|
declare const MarketRegionSchema: z.ZodEnum<{
|
|
1353
1380
|
latam: "latam";
|
|
1354
1381
|
world: "world";
|
|
@@ -1383,6 +1410,16 @@ declare const MarketRegionEnum: {
|
|
|
1383
1410
|
world: "world";
|
|
1384
1411
|
europe: "europe";
|
|
1385
1412
|
};
|
|
1413
|
+
declare const WebsiteAppNameEnum: {
|
|
1414
|
+
colombia: "colombia";
|
|
1415
|
+
row: "row";
|
|
1416
|
+
eu: "eu";
|
|
1417
|
+
mexico: "mexico";
|
|
1418
|
+
peru: "peru";
|
|
1419
|
+
spain: "spain";
|
|
1420
|
+
italy: "italy";
|
|
1421
|
+
portugal: "portugal";
|
|
1422
|
+
};
|
|
1386
1423
|
type DocumentTypeOption = {
|
|
1387
1424
|
label: string;
|
|
1388
1425
|
value: string;
|
|
@@ -1433,6 +1470,7 @@ declare const RegionConfigSchema: z.ZodObject<{
|
|
|
1433
1470
|
countryId: z.ZodString;
|
|
1434
1471
|
name: z.ZodOptional<z.ZodString>;
|
|
1435
1472
|
}, z.core.$strip>>>;
|
|
1473
|
+
hasDefaultResidenceCountry: z.ZodBoolean;
|
|
1436
1474
|
usdPricingForNonResidents: z.ZodOptional<z.ZodBoolean>;
|
|
1437
1475
|
regionUrls: z.ZodOptional<z.ZodObject<{
|
|
1438
1476
|
staging: z.ZodURL;
|
|
@@ -1494,6 +1532,16 @@ declare const RegionConfigSchema: z.ZodObject<{
|
|
|
1494
1532
|
italy: "italy";
|
|
1495
1533
|
portugal: "portugal";
|
|
1496
1534
|
}>;
|
|
1535
|
+
websiteAppName: z.ZodEnum<{
|
|
1536
|
+
colombia: "colombia";
|
|
1537
|
+
row: "row";
|
|
1538
|
+
eu: "eu";
|
|
1539
|
+
mexico: "mexico";
|
|
1540
|
+
peru: "peru";
|
|
1541
|
+
spain: "spain";
|
|
1542
|
+
italy: "italy";
|
|
1543
|
+
portugal: "portugal";
|
|
1544
|
+
}>;
|
|
1497
1545
|
countryCode: z.ZodEnum<{
|
|
1498
1546
|
CO: "CO";
|
|
1499
1547
|
WR: "WR";
|
|
@@ -1550,6 +1598,21 @@ declare const getRegionConfigByName: (name: string) => RegionConfig | undefined;
|
|
|
1550
1598
|
|
|
1551
1599
|
declare const getRegionConfigByRegionCode: (regionCode: RegionConfig["regionCode"]) => RegionConfig;
|
|
1552
1600
|
|
|
1601
|
+
/**
|
|
1602
|
+
* Resolve the region config served by a website app.
|
|
1603
|
+
*
|
|
1604
|
+
* Returns `undefined` for apps that are not region-scoped (e.g. `studio`,
|
|
1605
|
+
* `dispatcher`, `docs`), so callers can treat "no region" as a valid state.
|
|
1606
|
+
*/
|
|
1607
|
+
declare const getRegionConfigByWebsiteAppName: (websiteAppName: string) => RegionConfig | undefined;
|
|
1608
|
+
|
|
1609
|
+
/**
|
|
1610
|
+
* Resolve just the region code (e.g. `es-ES`, `en-ROW`) served by a website app.
|
|
1611
|
+
*
|
|
1612
|
+
* Returns `undefined` for apps that are not region-scoped.
|
|
1613
|
+
*/
|
|
1614
|
+
declare const getRegionCodeByWebsiteAppName: (websiteAppName: string) => RegionCode | undefined;
|
|
1615
|
+
|
|
1553
1616
|
declare const COUNTRIES_TO_REDIRECT: {
|
|
1554
1617
|
readonly es: {
|
|
1555
1618
|
readonly label: "Spain";
|
|
@@ -1731,4 +1794,4 @@ declare const resolvePostalCodeFormat: (postalCodeFormat?: string, originCountry
|
|
|
1731
1794
|
|
|
1732
1795
|
declare const validateRegion: (region: RegionConfig["regionCode"]) => void;
|
|
1733
1796
|
|
|
1734
|
-
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 };
|
|
1797
|
+
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,6 +375,7 @@ 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",
|
|
@@ -378,6 +383,7 @@ var comco_default = {
|
|
|
378
383
|
countriesToRedirect: getCountriesToRedirect("comco"),
|
|
379
384
|
residenceCountries: COUNTRIES_TO_REDIRECT.comco.countries,
|
|
380
385
|
usdPricingForNonResidents: true,
|
|
386
|
+
hasDefaultResidenceCountry: false,
|
|
381
387
|
regionUrls: {
|
|
382
388
|
staging: "https://iatiglobal.iatidev.link/co/",
|
|
383
389
|
production: "https://www.iatiglobal.com/co/"
|
|
@@ -458,11 +464,13 @@ var comco_default = {
|
|
|
458
464
|
var comen_default = {
|
|
459
465
|
id: 5,
|
|
460
466
|
name: "world",
|
|
467
|
+
websiteAppName: "row",
|
|
461
468
|
countryCode: "WR",
|
|
462
469
|
defaultCurrency: "EUR",
|
|
463
470
|
marketRegion: "world",
|
|
464
471
|
emoji: "\u{1F310}",
|
|
465
472
|
countriesToRedirect: getCountriesToRedirect("comen"),
|
|
473
|
+
hasDefaultResidenceCountry: false,
|
|
466
474
|
regionUrls: {
|
|
467
475
|
staging: "https://stg.iatiglobal.com/en/",
|
|
468
476
|
production: "https://www.iatiglobal.com/en/"
|
|
@@ -558,11 +566,13 @@ var comen_default = {
|
|
|
558
566
|
var comeneu_default = {
|
|
559
567
|
id: 6,
|
|
560
568
|
name: "europe",
|
|
569
|
+
websiteAppName: "eu",
|
|
561
570
|
countryCode: "EU",
|
|
562
571
|
defaultCurrency: "EUR",
|
|
563
572
|
marketRegion: "europe",
|
|
564
573
|
emoji: "\u{1F1EA}\u{1F1FA}",
|
|
565
574
|
countriesToRedirect: getCountriesToRedirect("comeneu"),
|
|
575
|
+
hasDefaultResidenceCountry: false,
|
|
566
576
|
regionUrls: {
|
|
567
577
|
staging: "https://stg.iatiglobal.com/en-eu/",
|
|
568
578
|
production: "https://www.iatiglobal.com/en-eu/"
|
|
@@ -658,11 +668,13 @@ var comeneu_default = {
|
|
|
658
668
|
var commx_default = {
|
|
659
669
|
id: 7,
|
|
660
670
|
name: "mexico",
|
|
671
|
+
websiteAppName: "mexico",
|
|
661
672
|
countryCode: "MX",
|
|
662
673
|
defaultCurrency: "USD",
|
|
663
674
|
marketRegion: "latam",
|
|
664
675
|
emoji: "\u{1F1F2}\u{1F1FD}",
|
|
665
676
|
countriesToRedirect: getCountriesToRedirect("commx"),
|
|
677
|
+
hasDefaultResidenceCountry: true,
|
|
666
678
|
regionUrls: {
|
|
667
679
|
staging: "https://stg.iatiglobal.com/mx/",
|
|
668
680
|
production: "https://www.iatiglobal.com/mx/"
|
|
@@ -743,11 +755,13 @@ var commx_default = {
|
|
|
743
755
|
var compe_default = {
|
|
744
756
|
id: 8,
|
|
745
757
|
name: "peru",
|
|
758
|
+
websiteAppName: "peru",
|
|
746
759
|
countryCode: "PE",
|
|
747
760
|
defaultCurrency: "USD",
|
|
748
761
|
marketRegion: "latam",
|
|
749
762
|
emoji: "\u{1F1F5}\u{1F1EA}",
|
|
750
763
|
countriesToRedirect: getCountriesToRedirect("compe"),
|
|
764
|
+
hasDefaultResidenceCountry: true,
|
|
751
765
|
regionUrls: {
|
|
752
766
|
staging: "https://stg.iatiglobal.com/pe/",
|
|
753
767
|
production: "https://www.iatiglobal.com/pe/"
|
|
@@ -828,11 +842,13 @@ var compe_default = {
|
|
|
828
842
|
var es_default = {
|
|
829
843
|
id: 1,
|
|
830
844
|
name: "spain",
|
|
845
|
+
websiteAppName: "spain",
|
|
831
846
|
countryCode: "ES",
|
|
832
847
|
defaultCurrency: "EUR",
|
|
833
848
|
marketRegion: "europe",
|
|
834
849
|
emoji: "\u{1F1EA}\u{1F1F8}",
|
|
835
850
|
countriesToRedirect: getCountriesToRedirect("es"),
|
|
851
|
+
hasDefaultResidenceCountry: true,
|
|
836
852
|
regionUrls: {
|
|
837
853
|
staging: "https://stg.iatiseguros.com",
|
|
838
854
|
production: "https://www.iatiseguros.com"
|
|
@@ -949,11 +965,13 @@ var es_default = {
|
|
|
949
965
|
var it_default = {
|
|
950
966
|
id: 10,
|
|
951
967
|
name: "italy",
|
|
968
|
+
websiteAppName: "italy",
|
|
952
969
|
countryCode: "IT",
|
|
953
970
|
defaultCurrency: "EUR",
|
|
954
971
|
marketRegion: "europe",
|
|
955
972
|
emoji: "\u{1F1EE}\u{1F1F9}",
|
|
956
973
|
countriesToRedirect: getCountriesToRedirect("it"),
|
|
974
|
+
hasDefaultResidenceCountry: true,
|
|
957
975
|
regionUrls: {
|
|
958
976
|
staging: "https://stg.iatiassicurazioni.it",
|
|
959
977
|
production: "https://www.iatiassicurazioni.it"
|
|
@@ -1044,11 +1062,13 @@ var it_default = {
|
|
|
1044
1062
|
var pt_default = {
|
|
1045
1063
|
id: 2,
|
|
1046
1064
|
name: "portugal",
|
|
1065
|
+
websiteAppName: "portugal",
|
|
1047
1066
|
countryCode: "PT",
|
|
1048
1067
|
defaultCurrency: "EUR",
|
|
1049
1068
|
marketRegion: "europe",
|
|
1050
1069
|
emoji: "\u{1F1F5}\u{1F1F9}",
|
|
1051
1070
|
countriesToRedirect: getCountriesToRedirect("pt"),
|
|
1071
|
+
hasDefaultResidenceCountry: false,
|
|
1052
1072
|
regionUrls: {
|
|
1053
1073
|
staging: "https://stg.iatiseguros.pt",
|
|
1054
1074
|
production: "https://www.iatiseguros.pt"
|
|
@@ -1180,6 +1200,7 @@ var RegionNameSchema = import_zod.z.enum(uniqueSorted(Object.values(regions).map
|
|
|
1180
1200
|
var RegionCountryCodeSchema = import_zod.z.enum(uniqueSorted(Object.values(regions).map((region) => region.countryCode)));
|
|
1181
1201
|
var regionEmojiSchema = import_zod.z.enum(uniqueSorted(Object.values(regions).map((region) => region.emoji)));
|
|
1182
1202
|
var RegionCodeSchema = import_zod.z.enum(uniqueSorted(Object.values(regions).map((region) => region.regionCode)));
|
|
1203
|
+
var WebsiteAppNameSchema = import_zod.z.enum(uniqueSorted(Object.values(regions).map((region) => region.websiteAppName)));
|
|
1183
1204
|
var MarketRegionSchema = import_zod.z.enum(uniqueSorted(Object.values(regions).map((region) => region.marketRegion)));
|
|
1184
1205
|
var DefaultCurrencySchema = import_zod.z.enum(
|
|
1185
1206
|
uniqueSorted(Object.values(regions).map((region) => region.defaultCurrency))
|
|
@@ -1187,6 +1208,7 @@ var DefaultCurrencySchema = import_zod.z.enum(
|
|
|
1187
1208
|
var RegionNameEnum = RegionNameSchema.enum;
|
|
1188
1209
|
var RegionCountryCodeEnum = RegionCountryCodeSchema.enum;
|
|
1189
1210
|
var MarketRegionEnum = MarketRegionSchema.enum;
|
|
1211
|
+
var WebsiteAppNameEnum = WebsiteAppNameSchema.enum;
|
|
1190
1212
|
var CountryReferenceSchema = import_zod.z.object({
|
|
1191
1213
|
countryId: import_zod.z.string(),
|
|
1192
1214
|
name: import_zod.z.string().optional()
|
|
@@ -1205,6 +1227,7 @@ var RegionConfigSchema = import_zod.z.strictObject({
|
|
|
1205
1227
|
})
|
|
1206
1228
|
).optional(),
|
|
1207
1229
|
residenceCountries: import_zod.z.array(CountryReferenceSchema).optional(),
|
|
1230
|
+
hasDefaultResidenceCountry: import_zod.z.boolean(),
|
|
1208
1231
|
usdPricingForNonResidents: import_zod.z.boolean().optional(),
|
|
1209
1232
|
regionUrls: import_zod.z.object({
|
|
1210
1233
|
staging: import_zod.z.url(),
|
|
@@ -1246,6 +1269,12 @@ var RegionConfigSchema = import_zod.z.strictObject({
|
|
|
1246
1269
|
),
|
|
1247
1270
|
webSitePath: import_zod.z.string().optional(),
|
|
1248
1271
|
name: RegionNameSchema,
|
|
1272
|
+
/**
|
|
1273
|
+
* Name of the app in iati-websites-monorepo that serves this region.
|
|
1274
|
+
* Matches that repo's `APP_NAME` (its package name minus the `@repo/` prefix),
|
|
1275
|
+
* which is also the `appName` its Sanity documents are filtered by.
|
|
1276
|
+
*/
|
|
1277
|
+
websiteAppName: WebsiteAppNameSchema,
|
|
1249
1278
|
countryCode: RegionCountryCodeSchema,
|
|
1250
1279
|
defaultCurrency: DefaultCurrencySchema,
|
|
1251
1280
|
marketRegion: MarketRegionSchema,
|
|
@@ -1288,6 +1317,18 @@ var getRegionConfigByRegionCode = (regionCode) => {
|
|
|
1288
1317
|
return region;
|
|
1289
1318
|
};
|
|
1290
1319
|
|
|
1320
|
+
// src/utils/getRegionConfigByWebsiteAppName.ts
|
|
1321
|
+
var getRegionConfigByWebsiteAppName = (websiteAppName) => {
|
|
1322
|
+
const normalized = websiteAppName.trim().toLowerCase();
|
|
1323
|
+
return Object.values(regionsConfig_default).find((region) => region.websiteAppName === normalized);
|
|
1324
|
+
};
|
|
1325
|
+
|
|
1326
|
+
// src/utils/getRegionCodeByWebsiteAppName.ts
|
|
1327
|
+
var getRegionCodeByWebsiteAppName = (websiteAppName) => {
|
|
1328
|
+
var _a;
|
|
1329
|
+
return (_a = getRegionConfigByWebsiteAppName(websiteAppName)) == null ? void 0 : _a.regionCode;
|
|
1330
|
+
};
|
|
1331
|
+
|
|
1291
1332
|
// src/utils/resolveDocumentTypeOptions.ts
|
|
1292
1333
|
var resolveDocumentTypeOptions = (documentTypeOptions, documentTypeOptionsByOrigin, originCountryId, siteCountryId) => {
|
|
1293
1334
|
if (!documentTypeOptionsByOrigin) return documentTypeOptions;
|
|
@@ -1327,12 +1368,16 @@ var validateRegion = (region) => {
|
|
|
1327
1368
|
US_CANADA_COUNTRIES,
|
|
1328
1369
|
US_CANADA_JAPAN_COUNTRIES,
|
|
1329
1370
|
WORLD_COUNTRIES,
|
|
1371
|
+
WebsiteAppNameEnum,
|
|
1372
|
+
WebsiteAppNameSchema,
|
|
1330
1373
|
getAllRegions,
|
|
1331
1374
|
getCountriesToRedirect,
|
|
1375
|
+
getRegionCodeByWebsiteAppName,
|
|
1332
1376
|
getRegionConfig,
|
|
1333
1377
|
getRegionConfigById,
|
|
1334
1378
|
getRegionConfigByName,
|
|
1335
1379
|
getRegionConfigByRegionCode,
|
|
1380
|
+
getRegionConfigByWebsiteAppName,
|
|
1336
1381
|
regionsConfig,
|
|
1337
1382
|
resolveDocumentTypeOptions,
|
|
1338
1383
|
resolvePostalCodeFormat,
|
package/dist/index.mjs
CHANGED
|
@@ -321,6 +321,7 @@ 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",
|
|
@@ -328,6 +329,7 @@ var comco_default = {
|
|
|
328
329
|
countriesToRedirect: getCountriesToRedirect("comco"),
|
|
329
330
|
residenceCountries: COUNTRIES_TO_REDIRECT.comco.countries,
|
|
330
331
|
usdPricingForNonResidents: true,
|
|
332
|
+
hasDefaultResidenceCountry: false,
|
|
331
333
|
regionUrls: {
|
|
332
334
|
staging: "https://iatiglobal.iatidev.link/co/",
|
|
333
335
|
production: "https://www.iatiglobal.com/co/"
|
|
@@ -408,11 +410,13 @@ var comco_default = {
|
|
|
408
410
|
var comen_default = {
|
|
409
411
|
id: 5,
|
|
410
412
|
name: "world",
|
|
413
|
+
websiteAppName: "row",
|
|
411
414
|
countryCode: "WR",
|
|
412
415
|
defaultCurrency: "EUR",
|
|
413
416
|
marketRegion: "world",
|
|
414
417
|
emoji: "\u{1F310}",
|
|
415
418
|
countriesToRedirect: getCountriesToRedirect("comen"),
|
|
419
|
+
hasDefaultResidenceCountry: false,
|
|
416
420
|
regionUrls: {
|
|
417
421
|
staging: "https://stg.iatiglobal.com/en/",
|
|
418
422
|
production: "https://www.iatiglobal.com/en/"
|
|
@@ -508,11 +512,13 @@ var comen_default = {
|
|
|
508
512
|
var comeneu_default = {
|
|
509
513
|
id: 6,
|
|
510
514
|
name: "europe",
|
|
515
|
+
websiteAppName: "eu",
|
|
511
516
|
countryCode: "EU",
|
|
512
517
|
defaultCurrency: "EUR",
|
|
513
518
|
marketRegion: "europe",
|
|
514
519
|
emoji: "\u{1F1EA}\u{1F1FA}",
|
|
515
520
|
countriesToRedirect: getCountriesToRedirect("comeneu"),
|
|
521
|
+
hasDefaultResidenceCountry: false,
|
|
516
522
|
regionUrls: {
|
|
517
523
|
staging: "https://stg.iatiglobal.com/en-eu/",
|
|
518
524
|
production: "https://www.iatiglobal.com/en-eu/"
|
|
@@ -608,11 +614,13 @@ var comeneu_default = {
|
|
|
608
614
|
var commx_default = {
|
|
609
615
|
id: 7,
|
|
610
616
|
name: "mexico",
|
|
617
|
+
websiteAppName: "mexico",
|
|
611
618
|
countryCode: "MX",
|
|
612
619
|
defaultCurrency: "USD",
|
|
613
620
|
marketRegion: "latam",
|
|
614
621
|
emoji: "\u{1F1F2}\u{1F1FD}",
|
|
615
622
|
countriesToRedirect: getCountriesToRedirect("commx"),
|
|
623
|
+
hasDefaultResidenceCountry: true,
|
|
616
624
|
regionUrls: {
|
|
617
625
|
staging: "https://stg.iatiglobal.com/mx/",
|
|
618
626
|
production: "https://www.iatiglobal.com/mx/"
|
|
@@ -693,11 +701,13 @@ var commx_default = {
|
|
|
693
701
|
var compe_default = {
|
|
694
702
|
id: 8,
|
|
695
703
|
name: "peru",
|
|
704
|
+
websiteAppName: "peru",
|
|
696
705
|
countryCode: "PE",
|
|
697
706
|
defaultCurrency: "USD",
|
|
698
707
|
marketRegion: "latam",
|
|
699
708
|
emoji: "\u{1F1F5}\u{1F1EA}",
|
|
700
709
|
countriesToRedirect: getCountriesToRedirect("compe"),
|
|
710
|
+
hasDefaultResidenceCountry: true,
|
|
701
711
|
regionUrls: {
|
|
702
712
|
staging: "https://stg.iatiglobal.com/pe/",
|
|
703
713
|
production: "https://www.iatiglobal.com/pe/"
|
|
@@ -778,11 +788,13 @@ var compe_default = {
|
|
|
778
788
|
var es_default = {
|
|
779
789
|
id: 1,
|
|
780
790
|
name: "spain",
|
|
791
|
+
websiteAppName: "spain",
|
|
781
792
|
countryCode: "ES",
|
|
782
793
|
defaultCurrency: "EUR",
|
|
783
794
|
marketRegion: "europe",
|
|
784
795
|
emoji: "\u{1F1EA}\u{1F1F8}",
|
|
785
796
|
countriesToRedirect: getCountriesToRedirect("es"),
|
|
797
|
+
hasDefaultResidenceCountry: true,
|
|
786
798
|
regionUrls: {
|
|
787
799
|
staging: "https://stg.iatiseguros.com",
|
|
788
800
|
production: "https://www.iatiseguros.com"
|
|
@@ -899,11 +911,13 @@ var es_default = {
|
|
|
899
911
|
var it_default = {
|
|
900
912
|
id: 10,
|
|
901
913
|
name: "italy",
|
|
914
|
+
websiteAppName: "italy",
|
|
902
915
|
countryCode: "IT",
|
|
903
916
|
defaultCurrency: "EUR",
|
|
904
917
|
marketRegion: "europe",
|
|
905
918
|
emoji: "\u{1F1EE}\u{1F1F9}",
|
|
906
919
|
countriesToRedirect: getCountriesToRedirect("it"),
|
|
920
|
+
hasDefaultResidenceCountry: true,
|
|
907
921
|
regionUrls: {
|
|
908
922
|
staging: "https://stg.iatiassicurazioni.it",
|
|
909
923
|
production: "https://www.iatiassicurazioni.it"
|
|
@@ -994,11 +1008,13 @@ var it_default = {
|
|
|
994
1008
|
var pt_default = {
|
|
995
1009
|
id: 2,
|
|
996
1010
|
name: "portugal",
|
|
1011
|
+
websiteAppName: "portugal",
|
|
997
1012
|
countryCode: "PT",
|
|
998
1013
|
defaultCurrency: "EUR",
|
|
999
1014
|
marketRegion: "europe",
|
|
1000
1015
|
emoji: "\u{1F1F5}\u{1F1F9}",
|
|
1001
1016
|
countriesToRedirect: getCountriesToRedirect("pt"),
|
|
1017
|
+
hasDefaultResidenceCountry: false,
|
|
1002
1018
|
regionUrls: {
|
|
1003
1019
|
staging: "https://stg.iatiseguros.pt",
|
|
1004
1020
|
production: "https://www.iatiseguros.pt"
|
|
@@ -1130,6 +1146,7 @@ var RegionNameSchema = z.enum(uniqueSorted(Object.values(regions).map((region) =
|
|
|
1130
1146
|
var RegionCountryCodeSchema = z.enum(uniqueSorted(Object.values(regions).map((region) => region.countryCode)));
|
|
1131
1147
|
var regionEmojiSchema = z.enum(uniqueSorted(Object.values(regions).map((region) => region.emoji)));
|
|
1132
1148
|
var RegionCodeSchema = z.enum(uniqueSorted(Object.values(regions).map((region) => region.regionCode)));
|
|
1149
|
+
var WebsiteAppNameSchema = z.enum(uniqueSorted(Object.values(regions).map((region) => region.websiteAppName)));
|
|
1133
1150
|
var MarketRegionSchema = z.enum(uniqueSorted(Object.values(regions).map((region) => region.marketRegion)));
|
|
1134
1151
|
var DefaultCurrencySchema = z.enum(
|
|
1135
1152
|
uniqueSorted(Object.values(regions).map((region) => region.defaultCurrency))
|
|
@@ -1137,6 +1154,7 @@ var DefaultCurrencySchema = z.enum(
|
|
|
1137
1154
|
var RegionNameEnum = RegionNameSchema.enum;
|
|
1138
1155
|
var RegionCountryCodeEnum = RegionCountryCodeSchema.enum;
|
|
1139
1156
|
var MarketRegionEnum = MarketRegionSchema.enum;
|
|
1157
|
+
var WebsiteAppNameEnum = WebsiteAppNameSchema.enum;
|
|
1140
1158
|
var CountryReferenceSchema = z.object({
|
|
1141
1159
|
countryId: z.string(),
|
|
1142
1160
|
name: z.string().optional()
|
|
@@ -1155,6 +1173,7 @@ var RegionConfigSchema = z.strictObject({
|
|
|
1155
1173
|
})
|
|
1156
1174
|
).optional(),
|
|
1157
1175
|
residenceCountries: z.array(CountryReferenceSchema).optional(),
|
|
1176
|
+
hasDefaultResidenceCountry: z.boolean(),
|
|
1158
1177
|
usdPricingForNonResidents: z.boolean().optional(),
|
|
1159
1178
|
regionUrls: z.object({
|
|
1160
1179
|
staging: z.url(),
|
|
@@ -1196,6 +1215,12 @@ var RegionConfigSchema = z.strictObject({
|
|
|
1196
1215
|
),
|
|
1197
1216
|
webSitePath: z.string().optional(),
|
|
1198
1217
|
name: RegionNameSchema,
|
|
1218
|
+
/**
|
|
1219
|
+
* Name of the app in iati-websites-monorepo that serves this region.
|
|
1220
|
+
* Matches that repo's `APP_NAME` (its package name minus the `@repo/` prefix),
|
|
1221
|
+
* which is also the `appName` its Sanity documents are filtered by.
|
|
1222
|
+
*/
|
|
1223
|
+
websiteAppName: WebsiteAppNameSchema,
|
|
1199
1224
|
countryCode: RegionCountryCodeSchema,
|
|
1200
1225
|
defaultCurrency: DefaultCurrencySchema,
|
|
1201
1226
|
marketRegion: MarketRegionSchema,
|
|
@@ -1238,6 +1263,18 @@ var getRegionConfigByRegionCode = (regionCode) => {
|
|
|
1238
1263
|
return region;
|
|
1239
1264
|
};
|
|
1240
1265
|
|
|
1266
|
+
// src/utils/getRegionConfigByWebsiteAppName.ts
|
|
1267
|
+
var getRegionConfigByWebsiteAppName = (websiteAppName) => {
|
|
1268
|
+
const normalized = websiteAppName.trim().toLowerCase();
|
|
1269
|
+
return Object.values(regionsConfig_default).find((region) => region.websiteAppName === normalized);
|
|
1270
|
+
};
|
|
1271
|
+
|
|
1272
|
+
// src/utils/getRegionCodeByWebsiteAppName.ts
|
|
1273
|
+
var getRegionCodeByWebsiteAppName = (websiteAppName) => {
|
|
1274
|
+
var _a;
|
|
1275
|
+
return (_a = getRegionConfigByWebsiteAppName(websiteAppName)) == null ? void 0 : _a.regionCode;
|
|
1276
|
+
};
|
|
1277
|
+
|
|
1241
1278
|
// src/utils/resolveDocumentTypeOptions.ts
|
|
1242
1279
|
var resolveDocumentTypeOptions = (documentTypeOptions, documentTypeOptionsByOrigin, originCountryId, siteCountryId) => {
|
|
1243
1280
|
if (!documentTypeOptionsByOrigin) return documentTypeOptions;
|
|
@@ -1276,12 +1313,16 @@ export {
|
|
|
1276
1313
|
US_CANADA_COUNTRIES,
|
|
1277
1314
|
US_CANADA_JAPAN_COUNTRIES,
|
|
1278
1315
|
WORLD_COUNTRIES,
|
|
1316
|
+
WebsiteAppNameEnum,
|
|
1317
|
+
WebsiteAppNameSchema,
|
|
1279
1318
|
getAllRegions,
|
|
1280
1319
|
getCountriesToRedirect,
|
|
1320
|
+
getRegionCodeByWebsiteAppName,
|
|
1281
1321
|
getRegionConfig,
|
|
1282
1322
|
getRegionConfigById,
|
|
1283
1323
|
getRegionConfigByName,
|
|
1284
1324
|
getRegionConfigByRegionCode,
|
|
1325
|
+
getRegionConfigByWebsiteAppName,
|
|
1285
1326
|
regionsConfig_default as regionsConfig,
|
|
1286
1327
|
resolveDocumentTypeOptions,
|
|
1287
1328
|
resolvePostalCodeFormat,
|