regions-config 1.0.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 +202 -0
- package/dist/index.d.mts +294 -0
- package/dist/index.d.ts +294 -0
- package/dist/index.js +1570 -0
- package/dist/index.mjs +1539 -0
- package/package.json +32 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const GROUP_REGIONS: Record<string, number>;
|
|
4
|
+
declare const EUROPE_COUNTRIES: number[];
|
|
5
|
+
declare const US_CANADA_JAPAN_COUNTRIES: number[];
|
|
6
|
+
declare const US_CANADA_COUNTRIES: number[];
|
|
7
|
+
declare const WORLD_COUNTRIES: number[];
|
|
8
|
+
|
|
9
|
+
type DocumentTypeOption = {
|
|
10
|
+
label: string;
|
|
11
|
+
value: string;
|
|
12
|
+
};
|
|
13
|
+
type DocumentTypeOptionsByOrigin = {
|
|
14
|
+
local: Array<DocumentTypeOption>;
|
|
15
|
+
foreign: Array<DocumentTypeOption>;
|
|
16
|
+
};
|
|
17
|
+
type RedirectCountry = {
|
|
18
|
+
countryId: string;
|
|
19
|
+
name?: string;
|
|
20
|
+
};
|
|
21
|
+
type RedirectGroup = {
|
|
22
|
+
label: string;
|
|
23
|
+
countries: Array<RedirectCountry>;
|
|
24
|
+
};
|
|
25
|
+
type CountryToRedirect = {
|
|
26
|
+
countryId: string;
|
|
27
|
+
countryRegion: string;
|
|
28
|
+
regionLabel: string;
|
|
29
|
+
name?: string;
|
|
30
|
+
};
|
|
31
|
+
type RegionToGroup = {
|
|
32
|
+
priority: 'high' | 'medium' | 'low';
|
|
33
|
+
countries: number[];
|
|
34
|
+
regionId: number;
|
|
35
|
+
};
|
|
36
|
+
type PaymentCardType = {
|
|
37
|
+
id: number;
|
|
38
|
+
name: string;
|
|
39
|
+
imagePath: string;
|
|
40
|
+
};
|
|
41
|
+
declare const RegionConfigSchema: z.ZodObject<{
|
|
42
|
+
id: z.ZodNumber;
|
|
43
|
+
gtmId: z.ZodString;
|
|
44
|
+
countriesToRedirect: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
45
|
+
label: z.ZodString;
|
|
46
|
+
countries: z.ZodArray<z.ZodObject<{
|
|
47
|
+
countryId: z.ZodString;
|
|
48
|
+
name: z.ZodOptional<z.ZodString>;
|
|
49
|
+
}, "strip", z.ZodTypeAny, {
|
|
50
|
+
countryId: string;
|
|
51
|
+
name?: string | undefined;
|
|
52
|
+
}, {
|
|
53
|
+
countryId: string;
|
|
54
|
+
name?: string | undefined;
|
|
55
|
+
}>, "many">;
|
|
56
|
+
}, "strip", z.ZodTypeAny, {
|
|
57
|
+
label: string;
|
|
58
|
+
countries: {
|
|
59
|
+
countryId: string;
|
|
60
|
+
name?: string | undefined;
|
|
61
|
+
}[];
|
|
62
|
+
}, {
|
|
63
|
+
label: string;
|
|
64
|
+
countries: {
|
|
65
|
+
countryId: string;
|
|
66
|
+
name?: string | undefined;
|
|
67
|
+
}[];
|
|
68
|
+
}>>>;
|
|
69
|
+
regionUrls: z.ZodOptional<z.ZodObject<{
|
|
70
|
+
staging: z.ZodString;
|
|
71
|
+
production: z.ZodString;
|
|
72
|
+
}, "strip", z.ZodTypeAny, {
|
|
73
|
+
staging: string;
|
|
74
|
+
production: string;
|
|
75
|
+
}, {
|
|
76
|
+
staging: string;
|
|
77
|
+
production: string;
|
|
78
|
+
}>>;
|
|
79
|
+
timeZone: z.ZodString;
|
|
80
|
+
regionsToGroup: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
81
|
+
priority: z.ZodEnum<["high", "medium", "low"]>;
|
|
82
|
+
countries: z.ZodArray<z.ZodNumber, "many">;
|
|
83
|
+
regionId: z.ZodNumber;
|
|
84
|
+
}, "strip", z.ZodTypeAny, {
|
|
85
|
+
countries: number[];
|
|
86
|
+
priority: "high" | "medium" | "low";
|
|
87
|
+
regionId: number;
|
|
88
|
+
}, {
|
|
89
|
+
countries: number[];
|
|
90
|
+
priority: "high" | "medium" | "low";
|
|
91
|
+
regionId: number;
|
|
92
|
+
}>, "many">>;
|
|
93
|
+
footer: z.ZodArray<z.ZodObject<{
|
|
94
|
+
href: z.ZodString;
|
|
95
|
+
label: z.ZodString;
|
|
96
|
+
}, "strip", z.ZodTypeAny, {
|
|
97
|
+
label: string;
|
|
98
|
+
href: string;
|
|
99
|
+
}, {
|
|
100
|
+
label: string;
|
|
101
|
+
href: string;
|
|
102
|
+
}>, "many">;
|
|
103
|
+
documentTypeOptions: z.ZodArray<z.ZodObject<{
|
|
104
|
+
label: z.ZodString;
|
|
105
|
+
value: z.ZodString;
|
|
106
|
+
}, "strip", z.ZodTypeAny, {
|
|
107
|
+
value: string;
|
|
108
|
+
label: string;
|
|
109
|
+
}, {
|
|
110
|
+
value: string;
|
|
111
|
+
label: string;
|
|
112
|
+
}>, "many">;
|
|
113
|
+
documentTypeOptionsByOrigin: z.ZodOptional<z.ZodObject<{
|
|
114
|
+
local: z.ZodArray<z.ZodObject<{
|
|
115
|
+
label: z.ZodString;
|
|
116
|
+
value: z.ZodString;
|
|
117
|
+
}, "strip", z.ZodTypeAny, {
|
|
118
|
+
value: string;
|
|
119
|
+
label: string;
|
|
120
|
+
}, {
|
|
121
|
+
value: string;
|
|
122
|
+
label: string;
|
|
123
|
+
}>, "many">;
|
|
124
|
+
foreign: z.ZodArray<z.ZodObject<{
|
|
125
|
+
label: z.ZodString;
|
|
126
|
+
value: z.ZodString;
|
|
127
|
+
}, "strip", z.ZodTypeAny, {
|
|
128
|
+
value: string;
|
|
129
|
+
label: string;
|
|
130
|
+
}, {
|
|
131
|
+
value: string;
|
|
132
|
+
label: string;
|
|
133
|
+
}>, "many">;
|
|
134
|
+
}, "strip", z.ZodTypeAny, {
|
|
135
|
+
local: {
|
|
136
|
+
value: string;
|
|
137
|
+
label: string;
|
|
138
|
+
}[];
|
|
139
|
+
foreign: {
|
|
140
|
+
value: string;
|
|
141
|
+
label: string;
|
|
142
|
+
}[];
|
|
143
|
+
}, {
|
|
144
|
+
local: {
|
|
145
|
+
value: string;
|
|
146
|
+
label: string;
|
|
147
|
+
}[];
|
|
148
|
+
foreign: {
|
|
149
|
+
value: string;
|
|
150
|
+
label: string;
|
|
151
|
+
}[];
|
|
152
|
+
}>>;
|
|
153
|
+
dateFormat: z.ZodString;
|
|
154
|
+
regionCode: z.ZodEnum<["es-ES", "es-MX", "en-EU", "en-ROW", "it-IT", "pt-PT", "es-CO", "es-PE"]>;
|
|
155
|
+
paymentCardTypes: z.ZodArray<z.ZodObject<{
|
|
156
|
+
id: z.ZodNumber;
|
|
157
|
+
name: z.ZodString;
|
|
158
|
+
imagePath: z.ZodString;
|
|
159
|
+
}, "strip", z.ZodTypeAny, {
|
|
160
|
+
id: number;
|
|
161
|
+
name: string;
|
|
162
|
+
imagePath: string;
|
|
163
|
+
}, {
|
|
164
|
+
id: number;
|
|
165
|
+
name: string;
|
|
166
|
+
imagePath: string;
|
|
167
|
+
}>, "many">;
|
|
168
|
+
webSitePath: z.ZodOptional<z.ZodString>;
|
|
169
|
+
}, "strict", z.ZodTypeAny, {
|
|
170
|
+
id: number;
|
|
171
|
+
gtmId: string;
|
|
172
|
+
timeZone: string;
|
|
173
|
+
footer: {
|
|
174
|
+
label: string;
|
|
175
|
+
href: string;
|
|
176
|
+
}[];
|
|
177
|
+
documentTypeOptions: {
|
|
178
|
+
value: string;
|
|
179
|
+
label: string;
|
|
180
|
+
}[];
|
|
181
|
+
dateFormat: string;
|
|
182
|
+
regionCode: "es-ES" | "es-MX" | "en-EU" | "en-ROW" | "it-IT" | "pt-PT" | "es-CO" | "es-PE";
|
|
183
|
+
paymentCardTypes: {
|
|
184
|
+
id: number;
|
|
185
|
+
name: string;
|
|
186
|
+
imagePath: string;
|
|
187
|
+
}[];
|
|
188
|
+
countriesToRedirect?: Record<string, {
|
|
189
|
+
label: string;
|
|
190
|
+
countries: {
|
|
191
|
+
countryId: string;
|
|
192
|
+
name?: string | undefined;
|
|
193
|
+
}[];
|
|
194
|
+
}> | undefined;
|
|
195
|
+
regionUrls?: {
|
|
196
|
+
staging: string;
|
|
197
|
+
production: string;
|
|
198
|
+
} | undefined;
|
|
199
|
+
regionsToGroup?: {
|
|
200
|
+
countries: number[];
|
|
201
|
+
priority: "high" | "medium" | "low";
|
|
202
|
+
regionId: number;
|
|
203
|
+
}[] | undefined;
|
|
204
|
+
documentTypeOptionsByOrigin?: {
|
|
205
|
+
local: {
|
|
206
|
+
value: string;
|
|
207
|
+
label: string;
|
|
208
|
+
}[];
|
|
209
|
+
foreign: {
|
|
210
|
+
value: string;
|
|
211
|
+
label: string;
|
|
212
|
+
}[];
|
|
213
|
+
} | undefined;
|
|
214
|
+
webSitePath?: string | undefined;
|
|
215
|
+
}, {
|
|
216
|
+
id: number;
|
|
217
|
+
gtmId: string;
|
|
218
|
+
timeZone: string;
|
|
219
|
+
footer: {
|
|
220
|
+
label: string;
|
|
221
|
+
href: string;
|
|
222
|
+
}[];
|
|
223
|
+
documentTypeOptions: {
|
|
224
|
+
value: string;
|
|
225
|
+
label: string;
|
|
226
|
+
}[];
|
|
227
|
+
dateFormat: string;
|
|
228
|
+
regionCode: "es-ES" | "es-MX" | "en-EU" | "en-ROW" | "it-IT" | "pt-PT" | "es-CO" | "es-PE";
|
|
229
|
+
paymentCardTypes: {
|
|
230
|
+
id: number;
|
|
231
|
+
name: string;
|
|
232
|
+
imagePath: string;
|
|
233
|
+
}[];
|
|
234
|
+
countriesToRedirect?: Record<string, {
|
|
235
|
+
label: string;
|
|
236
|
+
countries: {
|
|
237
|
+
countryId: string;
|
|
238
|
+
name?: string | undefined;
|
|
239
|
+
}[];
|
|
240
|
+
}> | undefined;
|
|
241
|
+
regionUrls?: {
|
|
242
|
+
staging: string;
|
|
243
|
+
production: string;
|
|
244
|
+
} | undefined;
|
|
245
|
+
regionsToGroup?: {
|
|
246
|
+
countries: number[];
|
|
247
|
+
priority: "high" | "medium" | "low";
|
|
248
|
+
regionId: number;
|
|
249
|
+
}[] | undefined;
|
|
250
|
+
documentTypeOptionsByOrigin?: {
|
|
251
|
+
local: {
|
|
252
|
+
value: string;
|
|
253
|
+
label: string;
|
|
254
|
+
}[];
|
|
255
|
+
foreign: {
|
|
256
|
+
value: string;
|
|
257
|
+
label: string;
|
|
258
|
+
}[];
|
|
259
|
+
} | undefined;
|
|
260
|
+
webSitePath?: string | undefined;
|
|
261
|
+
}>;
|
|
262
|
+
type CountriesToRedirectMap = Record<string, RedirectGroup>;
|
|
263
|
+
type RegionConfig = Omit<z.infer<typeof RegionConfigSchema>, 'countriesToRedirect'> & {
|
|
264
|
+
countriesToRedirect?: CountriesToRedirectMap;
|
|
265
|
+
};
|
|
266
|
+
type RegionsConfig = {
|
|
267
|
+
[key: string]: RegionConfig;
|
|
268
|
+
};
|
|
269
|
+
type RegionConfigJson = Omit<RegionConfig, 'regionsToGroup' | 'footer' | 'regionCode'> & {
|
|
270
|
+
regionCode: string;
|
|
271
|
+
regionsToGroup?: Array<{
|
|
272
|
+
priority: string;
|
|
273
|
+
countries: string;
|
|
274
|
+
regionId: string;
|
|
275
|
+
}>;
|
|
276
|
+
footer: Array<{
|
|
277
|
+
href: string;
|
|
278
|
+
label: string;
|
|
279
|
+
}>;
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
declare const regionsConfig: RegionsConfig;
|
|
283
|
+
|
|
284
|
+
declare const getRegionConfig: (name: string) => RegionConfig;
|
|
285
|
+
|
|
286
|
+
declare const getRegionConfigById: (id: number) => RegionConfig;
|
|
287
|
+
|
|
288
|
+
declare const getRegionConfigByRegionCode: (regionCode: RegionConfig["regionCode"]) => RegionConfig;
|
|
289
|
+
|
|
290
|
+
declare const resolveDocumentTypeOptions: (documentTypeOptions: Array<DocumentTypeOption>, documentTypeOptionsByOrigin?: DocumentTypeOptionsByOrigin, originCountryId?: string | number, siteCountryId?: number) => Array<DocumentTypeOption>;
|
|
291
|
+
|
|
292
|
+
declare const validateRegion: (region: RegionConfig["regionCode"]) => void;
|
|
293
|
+
|
|
294
|
+
export { type CountriesToRedirectMap, type CountryToRedirect, type DocumentTypeOption, type DocumentTypeOptionsByOrigin, EUROPE_COUNTRIES, GROUP_REGIONS, type PaymentCardType, type RedirectCountry, type RedirectGroup, type RegionConfig, type RegionConfigJson, RegionConfigSchema, type RegionToGroup, type RegionsConfig, US_CANADA_COUNTRIES, US_CANADA_JAPAN_COUNTRIES, WORLD_COUNTRIES, getRegionConfig, getRegionConfigById, getRegionConfigByRegionCode, regionsConfig, resolveDocumentTypeOptions, validateRegion };
|