@wix/l10n 1.198.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 +139 -0
- package/dist/cjs/__tests__/address.spec.js +365 -0
- package/dist/cjs/__tests__/address.spec.js.map +1 -0
- package/dist/cjs/__tests__/currency.spec.js +225 -0
- package/dist/cjs/__tests__/currency.spec.js.map +1 -0
- package/dist/cjs/__tests__/spec-setup.js +2 -0
- package/dist/cjs/__tests__/spec-setup.js.map +1 -0
- package/dist/cjs/address/formats.js +210 -0
- package/dist/cjs/address/formats.js.map +1 -0
- package/dist/cjs/address/formatsOverrides.js +23 -0
- package/dist/cjs/address/formatsOverrides.js.map +1 -0
- package/dist/cjs/address/formatter.js +21 -0
- package/dist/cjs/address/formatter.js.map +1 -0
- package/dist/cjs/address/index.js +8 -0
- package/dist/cjs/address/index.js.map +1 -0
- package/dist/cjs/address/model.js +2 -0
- package/dist/cjs/address/model.js.map +1 -0
- package/dist/cjs/address/parser.js +267 -0
- package/dist/cjs/address/parser.js.map +1 -0
- package/dist/cjs/currency/currencyCode.js +2 -0
- package/dist/cjs/currency/currencyCode.js.map +1 -0
- package/dist/cjs/currency/factory.js +37 -0
- package/dist/cjs/currency/factory.js.map +1 -0
- package/dist/cjs/currency/formatter.js +28 -0
- package/dist/cjs/currency/formatter.js.map +1 -0
- package/dist/cjs/external-types.d.js +3 -0
- package/dist/cjs/external-types.d.js.map +1 -0
- package/dist/cjs/generated/proto-generated.d.js +4 -0
- package/dist/cjs/generated/proto-generated.d.js.map +1 -0
- package/dist/cjs/index.js +18 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/test-types.d.js +2 -0
- package/dist/cjs/test-types.d.js.map +1 -0
- package/dist/esm/__tests__/address.spec.js +464 -0
- package/dist/esm/__tests__/address.spec.js.map +1 -0
- package/dist/esm/__tests__/currency.spec.js +178 -0
- package/dist/esm/__tests__/currency.spec.js.map +1 -0
- package/dist/esm/__tests__/spec-setup.js +2 -0
- package/dist/esm/__tests__/spec-setup.js.map +1 -0
- package/dist/esm/address/formats.js +8 -0
- package/dist/esm/address/formats.js.map +1 -0
- package/dist/esm/address/formatsOverrides.js +18 -0
- package/dist/esm/address/formatsOverrides.js.map +1 -0
- package/dist/esm/address/formatter.js +11 -0
- package/dist/esm/address/formatter.js.map +1 -0
- package/dist/esm/address/index.js +2 -0
- package/dist/esm/address/index.js.map +1 -0
- package/dist/esm/address/model.js +2 -0
- package/dist/esm/address/model.js.map +1 -0
- package/dist/esm/address/parser.js +227 -0
- package/dist/esm/address/parser.js.map +1 -0
- package/dist/esm/currency/currencyCode.js +2 -0
- package/dist/esm/currency/currencyCode.js.map +1 -0
- package/dist/esm/currency/factory.js +31 -0
- package/dist/esm/currency/factory.js.map +1 -0
- package/dist/esm/currency/formatter.js +18 -0
- package/dist/esm/currency/formatter.js.map +1 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/__tests__/address.spec.d.ts +2 -0
- package/dist/types/__tests__/address.spec.d.ts.map +1 -0
- package/dist/types/__tests__/currency.spec.d.ts +2 -0
- package/dist/types/__tests__/currency.spec.d.ts.map +1 -0
- package/dist/types/__tests__/spec-setup.d.ts +1 -0
- package/dist/types/__tests__/spec-setup.d.ts.map +1 -0
- package/dist/types/address/formats.d.ts +8 -0
- package/dist/types/address/formats.d.ts.map +1 -0
- package/dist/types/address/formatsOverrides.d.ts +5 -0
- package/dist/types/address/formatsOverrides.d.ts.map +1 -0
- package/dist/types/address/formatter.d.ts +10 -0
- package/dist/types/address/formatter.d.ts.map +1 -0
- package/dist/types/address/index.d.ts +4 -0
- package/dist/types/address/index.d.ts.map +1 -0
- package/dist/types/address/model.d.ts +21 -0
- package/dist/types/address/model.d.ts.map +1 -0
- package/dist/types/address/parser.d.ts +24 -0
- package/dist/types/address/parser.d.ts.map +1 -0
- package/dist/types/currency/currencyCode.d.ts +7 -0
- package/dist/types/currency/currencyCode.d.ts.map +1 -0
- package/dist/types/currency/factory.d.ts +15 -0
- package/dist/types/currency/factory.d.ts.map +1 -0
- package/dist/types/currency/formatter.d.ts +18 -0
- package/dist/types/currency/formatter.d.ts.map +1 -0
- package/dist/types/generated/proto-generated.d.ts +1198 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.trimGoogleTemplate = exports.streetNameFirstCountries = exports.parseGoogleTemplate = exports.isAddressFieldToken = exports.getTokenName = exports.getGoogleTemplate = exports.convertWixAdressToGoogleAddress = exports.applyTemplate = exports.apartmentNumberFirstCountries = exports.apartmentNumberAfterStreetNameCountries = void 0;
|
|
5
|
+
var _formats = require("./formats");
|
|
6
|
+
const libaddressFields = {
|
|
7
|
+
'%N': 'name',
|
|
8
|
+
'%O': 'organization',
|
|
9
|
+
'%A': 'addressLines',
|
|
10
|
+
'%D': 'dependentLocality',
|
|
11
|
+
'%C': 'locality',
|
|
12
|
+
'%S': 'administrativeArea',
|
|
13
|
+
'%Z': 'postalCode',
|
|
14
|
+
'%X': 'sortingCode',
|
|
15
|
+
'%R': 'postalCountry'
|
|
16
|
+
};
|
|
17
|
+
const streetNameFirstCountries = exports.streetNameFirstCountries = ['AU',
|
|
18
|
+
// Australia
|
|
19
|
+
'AT',
|
|
20
|
+
// Austria
|
|
21
|
+
'BG',
|
|
22
|
+
// Bulgaria
|
|
23
|
+
'HR',
|
|
24
|
+
// Croatia
|
|
25
|
+
'CZ',
|
|
26
|
+
// Czech Republic
|
|
27
|
+
'DK',
|
|
28
|
+
// Denmark
|
|
29
|
+
'EE',
|
|
30
|
+
// Estonia
|
|
31
|
+
'FI',
|
|
32
|
+
// Finland
|
|
33
|
+
'FR',
|
|
34
|
+
// France
|
|
35
|
+
'DE',
|
|
36
|
+
// Germany
|
|
37
|
+
'GR',
|
|
38
|
+
// Greece
|
|
39
|
+
'HU',
|
|
40
|
+
// Hungary
|
|
41
|
+
'IS',
|
|
42
|
+
// Iceland
|
|
43
|
+
'IT',
|
|
44
|
+
// Italy
|
|
45
|
+
'LV',
|
|
46
|
+
// Latvia
|
|
47
|
+
'LT',
|
|
48
|
+
// Lithuania
|
|
49
|
+
'LU',
|
|
50
|
+
// Luxembourg
|
|
51
|
+
'NL',
|
|
52
|
+
// Netherlands
|
|
53
|
+
'NZ',
|
|
54
|
+
// New Zealand
|
|
55
|
+
'NO',
|
|
56
|
+
// Norway
|
|
57
|
+
'PL',
|
|
58
|
+
// Poland
|
|
59
|
+
'PT',
|
|
60
|
+
// Portugal
|
|
61
|
+
'RO',
|
|
62
|
+
// Romania
|
|
63
|
+
'SK',
|
|
64
|
+
// Slovakia
|
|
65
|
+
'SI',
|
|
66
|
+
// Slovenia
|
|
67
|
+
'ES',
|
|
68
|
+
// Spain
|
|
69
|
+
'SE',
|
|
70
|
+
// Sweden
|
|
71
|
+
'CH',
|
|
72
|
+
// Switzerland
|
|
73
|
+
'TR',
|
|
74
|
+
// Turkey
|
|
75
|
+
'IE',
|
|
76
|
+
// Ireland
|
|
77
|
+
'JP',
|
|
78
|
+
// Japan
|
|
79
|
+
'BR' // Brazil
|
|
80
|
+
];
|
|
81
|
+
const apartmentNumberFirstCountries = exports.apartmentNumberFirstCountries = ['CA' // Canada
|
|
82
|
+
];
|
|
83
|
+
const apartmentNumberAfterStreetNameCountries = exports.apartmentNumberAfterStreetNameCountries = ['US' // United States
|
|
84
|
+
];
|
|
85
|
+
const convertStreetAddressToAddressLine = ({
|
|
86
|
+
name,
|
|
87
|
+
number,
|
|
88
|
+
apt
|
|
89
|
+
}, countryCode) => {
|
|
90
|
+
if (!name && !number) {
|
|
91
|
+
return '';
|
|
92
|
+
}
|
|
93
|
+
if (!name || !number) {
|
|
94
|
+
return name || number;
|
|
95
|
+
}
|
|
96
|
+
if (apt && apartmentNumberAfterStreetNameCountries.includes(countryCode)) {
|
|
97
|
+
return `${number} ${name} ${apt}`.trim();
|
|
98
|
+
}
|
|
99
|
+
const formattedNumber = formatStreetApartmentNumber({
|
|
100
|
+
number,
|
|
101
|
+
apt
|
|
102
|
+
}, countryCode);
|
|
103
|
+
if (streetNameFirstCountries.includes(countryCode)) {
|
|
104
|
+
return `${name} ${formattedNumber}`.trim();
|
|
105
|
+
}
|
|
106
|
+
return `${formattedNumber} ${name}`.trim();
|
|
107
|
+
};
|
|
108
|
+
const formatStreetApartmentNumber = ({
|
|
109
|
+
number,
|
|
110
|
+
apt = ''
|
|
111
|
+
}, countryCode) => {
|
|
112
|
+
if (number && apt) {
|
|
113
|
+
return apartmentNumberFirstCountries.includes(countryCode) ? `${apt}-${number}` : `${number}-${apt}`;
|
|
114
|
+
}
|
|
115
|
+
if (number) {
|
|
116
|
+
return number;
|
|
117
|
+
}
|
|
118
|
+
return apt;
|
|
119
|
+
};
|
|
120
|
+
const convertWixAdressToGoogleAddress = (address, addressContactDetails) => {
|
|
121
|
+
const addressLines = [];
|
|
122
|
+
|
|
123
|
+
// keep backward compatibility with previous version of API
|
|
124
|
+
const addressLine2 = address.addressLine2 ?? address.addressLine_2 ?? undefined;
|
|
125
|
+
if (address.streetAddress) {
|
|
126
|
+
const streetAddress = convertStreetAddressToAddressLine(address.streetAddress, address.country);
|
|
127
|
+
addressLines.push(streetAddress);
|
|
128
|
+
} else {
|
|
129
|
+
if (address.addressLine) {
|
|
130
|
+
addressLines.push(address.addressLine);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
if (addressLine2) {
|
|
134
|
+
addressLines.push(addressLine2);
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
name: addressContactDetails == null ? void 0 : addressContactDetails.fullName,
|
|
138
|
+
organization: addressContactDetails == null ? void 0 : addressContactDetails.company,
|
|
139
|
+
postalCountry: address.country,
|
|
140
|
+
administrativeArea: address.subdivision,
|
|
141
|
+
locality: address.city,
|
|
142
|
+
country: address.countryFullname,
|
|
143
|
+
postalCode: address.postalCode,
|
|
144
|
+
addressLines
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
exports.convertWixAdressToGoogleAddress = convertWixAdressToGoogleAddress;
|
|
148
|
+
const getGoogleTemplate = countryCode => {
|
|
149
|
+
const code = countryCode == null ? void 0 : countryCode.toUpperCase();
|
|
150
|
+
if (code && code in _formats.formats) {
|
|
151
|
+
return _formats.formats[code];
|
|
152
|
+
}
|
|
153
|
+
return _formats.defaultFormat;
|
|
154
|
+
};
|
|
155
|
+
exports.getGoogleTemplate = getGoogleTemplate;
|
|
156
|
+
const isAddressFieldToken = token => {
|
|
157
|
+
return token[0] === '%' && token !== '%n';
|
|
158
|
+
};
|
|
159
|
+
exports.isAddressFieldToken = isAddressFieldToken;
|
|
160
|
+
const getTokenName = token => {
|
|
161
|
+
return libaddressFields[token];
|
|
162
|
+
};
|
|
163
|
+
exports.getTokenName = getTokenName;
|
|
164
|
+
const hasFieldToken = (address, field) => {
|
|
165
|
+
if (field === 'addressLines') {
|
|
166
|
+
return address.addressLines !== undefined && address.addressLines.length > 0;
|
|
167
|
+
}
|
|
168
|
+
return address[field] !== undefined && address[field] !== '';
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* A function to parse a Google's open-source address metadata templates into tokens
|
|
173
|
+
* @example
|
|
174
|
+
* '%N%n%O%n%A%n%C, %S %Z' -> ['%N', '%n', '%O', '%n', '%A', '%n', '%C', ', ', '%S', ' ', '%Z']
|
|
175
|
+
*/
|
|
176
|
+
const parseGoogleTemplate = template => {
|
|
177
|
+
const parts = [];
|
|
178
|
+
let i = 0;
|
|
179
|
+
while (i < template.length) {
|
|
180
|
+
if (template[i] === '%') {
|
|
181
|
+
parts.push(template.slice(i, i + 2));
|
|
182
|
+
i += 1;
|
|
183
|
+
} else {
|
|
184
|
+
let j = i;
|
|
185
|
+
while (template[j] !== '%' && j < template.length) {
|
|
186
|
+
j += 1;
|
|
187
|
+
}
|
|
188
|
+
parts.push(template.slice(i, j));
|
|
189
|
+
i = j - 1;
|
|
190
|
+
}
|
|
191
|
+
i += 1;
|
|
192
|
+
}
|
|
193
|
+
return parts;
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* A function to "trim" the template, ie to safely remove unused template fields.
|
|
198
|
+
*/
|
|
199
|
+
exports.parseGoogleTemplate = parseGoogleTemplate;
|
|
200
|
+
const trimGoogleTemplate = (address, tokens) => {
|
|
201
|
+
const parts = [];
|
|
202
|
+
let i = 0;
|
|
203
|
+
while (i < tokens.length) {
|
|
204
|
+
const token = tokens[i];
|
|
205
|
+
if (token === '%n') {
|
|
206
|
+
parts.push(token);
|
|
207
|
+
} else if (isAddressFieldToken(token)) {
|
|
208
|
+
const tokenName = getTokenName(token);
|
|
209
|
+
if (hasFieldToken(address, tokenName)) {
|
|
210
|
+
parts.push(token);
|
|
211
|
+
}
|
|
212
|
+
} else {
|
|
213
|
+
const notFollowingRemovedField = i === 0 || !isAddressFieldToken(tokens[i - 1]) || parts.length > 0 && isAddressFieldToken(parts[parts.length - 1]);
|
|
214
|
+
const notPrecedingEmptyField = i === token.length - 1 || token[i + 1] === '%n' || hasFieldToken(address, getTokenName(tokens[i + 1]));
|
|
215
|
+
if (notFollowingRemovedField && notPrecedingEmptyField) {
|
|
216
|
+
parts.push(token);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
i += 1;
|
|
220
|
+
}
|
|
221
|
+
while (parts.length > 0 && parts[0] === '%n') {
|
|
222
|
+
parts.shift(); // Remove the first part if it is %n
|
|
223
|
+
}
|
|
224
|
+
return parts;
|
|
225
|
+
};
|
|
226
|
+
exports.trimGoogleTemplate = trimGoogleTemplate;
|
|
227
|
+
const applyTemplate = (address, tokens, options) => {
|
|
228
|
+
const lines = [];
|
|
229
|
+
let line = '';
|
|
230
|
+
for (const token of tokens) {
|
|
231
|
+
if (token === '%n') {
|
|
232
|
+
// Line break is inserted only in case the prvious line is not empty.
|
|
233
|
+
if (line.length > 0) {
|
|
234
|
+
lines.push(line);
|
|
235
|
+
line = '';
|
|
236
|
+
}
|
|
237
|
+
} else if (!isAddressFieldToken(token)) {
|
|
238
|
+
line += token;
|
|
239
|
+
} else {
|
|
240
|
+
const field = getTokenName(token);
|
|
241
|
+
if (field === 'postalCountry') {
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
|
+
if (field === 'addressLines') {
|
|
245
|
+
if (address.addressLines && address.addressLines.length > 0) {
|
|
246
|
+
line += address.addressLines[0];
|
|
247
|
+
lines.push(line);
|
|
248
|
+
line = '';
|
|
249
|
+
if (address.addressLines.length === 2) {
|
|
250
|
+
lines.push(address.addressLines[1]);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
continue;
|
|
254
|
+
}
|
|
255
|
+
line += address[field];
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
if (line.length > 0) {
|
|
259
|
+
lines.push(line);
|
|
260
|
+
}
|
|
261
|
+
if (options.appendCountry && address.country) {
|
|
262
|
+
lines.push(address.country);
|
|
263
|
+
}
|
|
264
|
+
return lines;
|
|
265
|
+
};
|
|
266
|
+
exports.applyTemplate = applyTemplate;
|
|
267
|
+
//# sourceMappingURL=parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_formats","require","libaddressFields","streetNameFirstCountries","exports","apartmentNumberFirstCountries","apartmentNumberAfterStreetNameCountries","convertStreetAddressToAddressLine","name","number","apt","countryCode","includes","trim","formattedNumber","formatStreetApartmentNumber","convertWixAdressToGoogleAddress","address","addressContactDetails","addressLines","addressLine2","addressLine_2","undefined","streetAddress","country","push","addressLine","fullName","organization","company","postalCountry","administrativeArea","subdivision","locality","city","countryFullname","postalCode","getGoogleTemplate","code","toUpperCase","formats","defaultFormat","isAddressFieldToken","token","getTokenName","hasFieldToken","field","length","parseGoogleTemplate","template","parts","i","slice","j","trimGoogleTemplate","tokens","tokenName","notFollowingRemovedField","notPrecedingEmptyField","shift","applyTemplate","options","lines","line","appendCountry"],"sources":["../../../src/address/parser.ts"],"sourcesContent":["import type {\n Address,\n StreetAddress,\n GoogleAddressFormat,\n AddressContactDetails,\n} from './model';\nimport { formats, defaultFormat } from './formats';\n\ntype LibAddressField =\n | '%N'\n | '%O'\n | '%A'\n | '%D'\n | '%C'\n | '%S'\n | '%Z'\n | '%X'\n | '%R';\n\nconst libaddressFields: Record<LibAddressField, keyof GoogleAddressFormat> = {\n '%N': 'name',\n '%O': 'organization',\n '%A': 'addressLines',\n '%D': 'dependentLocality',\n '%C': 'locality',\n '%S': 'administrativeArea',\n '%Z': 'postalCode',\n '%X': 'sortingCode',\n '%R': 'postalCountry',\n};\n\nexport const streetNameFirstCountries = [\n 'AU', // Australia\n 'AT', // Austria\n 'BG', // Bulgaria\n 'HR', // Croatia\n 'CZ', // Czech Republic\n 'DK', // Denmark\n 'EE', // Estonia\n 'FI', // Finland\n 'FR', // France\n 'DE', // Germany\n 'GR', // Greece\n 'HU', // Hungary\n 'IS', // Iceland\n 'IT', // Italy\n 'LV', // Latvia\n 'LT', // Lithuania\n 'LU', // Luxembourg\n 'NL', // Netherlands\n 'NZ', // New Zealand\n 'NO', // Norway\n 'PL', // Poland\n 'PT', // Portugal\n 'RO', // Romania\n 'SK', // Slovakia\n 'SI', // Slovenia\n 'ES', // Spain\n 'SE', // Sweden\n 'CH', // Switzerland\n 'TR', // Turkey\n 'IE', // Ireland\n 'JP', // Japan\n 'BR', // Brazil\n];\n\nexport const apartmentNumberFirstCountries = [\n 'CA', // Canada\n];\n\nexport const apartmentNumberAfterStreetNameCountries = [\n 'US', // United States\n];\n\nconst convertStreetAddressToAddressLine = (\n { name, number, apt }: StreetAddress,\n countryCode: string,\n) => {\n if (!name && !number) {\n return '';\n }\n\n if (!name || !number) {\n return name! || number!;\n }\n\n if (apt && apartmentNumberAfterStreetNameCountries.includes(countryCode)) {\n return `${number} ${name} ${apt}`.trim();\n }\n\n const formattedNumber = formatStreetApartmentNumber(\n { number, apt },\n countryCode,\n );\n\n if (streetNameFirstCountries.includes(countryCode)) {\n return `${name} ${formattedNumber}`.trim();\n }\n\n return `${formattedNumber} ${name}`.trim();\n};\n\nconst formatStreetApartmentNumber = (\n { number, apt = '' }: StreetAddress,\n countryCode: string,\n) => {\n if (number && apt) {\n return apartmentNumberFirstCountries.includes(countryCode)\n ? `${apt}-${number}`\n : `${number}-${apt}`;\n }\n\n if (number) {\n return number;\n }\n\n return apt;\n};\n\nexport const convertWixAdressToGoogleAddress = (\n address: Address,\n addressContactDetails?: AddressContactDetails,\n): GoogleAddressFormat => {\n const addressLines: string[] = [];\n\n // keep backward compatibility with previous version of API\n const addressLine2 =\n address.addressLine2 ?? (address as any).addressLine_2 ?? undefined;\n\n if (address.streetAddress) {\n const streetAddress = convertStreetAddressToAddressLine(\n address.streetAddress as StreetAddress,\n address.country!,\n );\n\n addressLines.push(streetAddress);\n } else {\n if (address.addressLine) {\n addressLines.push(address.addressLine);\n }\n }\n\n if (addressLine2) {\n addressLines.push(addressLine2);\n }\n\n return {\n name: addressContactDetails?.fullName,\n organization: addressContactDetails?.company,\n postalCountry: address.country,\n administrativeArea: address.subdivision,\n locality: address.city,\n country: address.countryFullname,\n postalCode: address.postalCode,\n addressLines,\n };\n};\n\nexport const getGoogleTemplate = (countryCode?: string) => {\n const code = countryCode?.toUpperCase();\n\n if (code && code in formats) {\n return formats[code];\n }\n\n return defaultFormat;\n};\n\nexport const isAddressFieldToken = (\n token: string,\n): token is LibAddressField => {\n return token[0] === '%' && token !== '%n';\n};\n\nexport const getTokenName = (token: LibAddressField) => {\n return libaddressFields[token];\n};\n\nconst hasFieldToken = (\n address: GoogleAddressFormat,\n field: keyof GoogleAddressFormat,\n): field is keyof GoogleAddressFormat => {\n if (field === 'addressLines') {\n return (\n address.addressLines !== undefined && address.addressLines.length > 0\n );\n }\n\n return address[field] !== undefined && address[field] !== '';\n};\n\n/**\n * A function to parse a Google's open-source address metadata templates into tokens\n * @example\n * '%N%n%O%n%A%n%C, %S %Z' -> ['%N', '%n', '%O', '%n', '%A', '%n', '%C', ', ', '%S', ' ', '%Z']\n */\nexport const parseGoogleTemplate = (template: string): string[] => {\n const parts: string[] = [];\n let i = 0;\n\n while (i < template.length) {\n if (template[i] === '%') {\n parts.push(template.slice(i, i + 2));\n i += 1;\n } else {\n let j = i;\n while (template[j] !== '%' && j < template.length) {\n j += 1;\n }\n parts.push(template.slice(i, j));\n i = j - 1;\n }\n\n i += 1;\n }\n\n return parts;\n};\n\n/**\n * A function to \"trim\" the template, ie to safely remove unused template fields.\n */\nexport const trimGoogleTemplate = (\n address: GoogleAddressFormat,\n tokens: string[],\n) => {\n const parts: string[] = [];\n let i = 0;\n\n while (i < tokens.length) {\n const token = tokens[i];\n\n if (token === '%n') {\n parts.push(token);\n } else if (isAddressFieldToken(token)) {\n const tokenName = getTokenName(token);\n\n if (hasFieldToken(address, tokenName)) {\n parts.push(token);\n }\n } else {\n const notFollowingRemovedField =\n i === 0 ||\n !isAddressFieldToken(tokens[i - 1]) ||\n (parts.length > 0 && isAddressFieldToken(parts[parts.length - 1]));\n const notPrecedingEmptyField =\n i === token.length - 1 ||\n token[i + 1] === '%n' ||\n hasFieldToken(address, getTokenName(tokens[i + 1] as LibAddressField));\n\n if (notFollowingRemovedField && notPrecedingEmptyField) {\n parts.push(token);\n }\n }\n\n i += 1;\n }\n\n while (parts.length > 0 && parts[0] === '%n') {\n parts.shift(); // Remove the first part if it is %n\n }\n\n return parts;\n};\n\nexport const applyTemplate = (\n address: GoogleAddressFormat,\n tokens: string[],\n options: { appendCountry: boolean },\n) => {\n const lines: string[] = [];\n let line = '';\n\n for (const token of tokens) {\n if (token === '%n') {\n // Line break is inserted only in case the prvious line is not empty.\n if (line.length > 0) {\n lines.push(line);\n line = '';\n }\n } else if (!isAddressFieldToken(token)) {\n line += token;\n } else {\n const field = getTokenName(token);\n\n if (field === 'postalCountry') {\n continue;\n }\n\n if (field === 'addressLines') {\n if (address.addressLines && address.addressLines.length > 0) {\n line += address.addressLines[0];\n lines.push(line);\n line = '';\n if (address.addressLines.length === 2) {\n lines.push(address.addressLines[1]);\n }\n }\n\n continue;\n }\n\n line += address[field];\n }\n }\n\n if (line.length > 0) {\n lines.push(line);\n }\n\n if (options.appendCountry && address.country) {\n lines.push(address.country);\n }\n\n return lines;\n};\n"],"mappings":";;;;AAMA,IAAAA,QAAA,GAAAC,OAAA;AAaA,MAAMC,gBAAoE,GAAG;EAC3E,IAAI,EAAE,MAAM;EACZ,IAAI,EAAE,cAAc;EACpB,IAAI,EAAE,cAAc;EACpB,IAAI,EAAE,mBAAmB;EACzB,IAAI,EAAE,UAAU;EAChB,IAAI,EAAE,oBAAoB;EAC1B,IAAI,EAAE,YAAY;EAClB,IAAI,EAAE,aAAa;EACnB,IAAI,EAAE;AACR,CAAC;AAEM,MAAMC,wBAAwB,GAAAC,OAAA,CAAAD,wBAAA,GAAG,CACtC,IAAI;AAAE;AACN,IAAI;AAAE;AACN,IAAI;AAAE;AACN,IAAI;AAAE;AACN,IAAI;AAAE;AACN,IAAI;AAAE;AACN,IAAI;AAAE;AACN,IAAI;AAAE;AACN,IAAI;AAAE;AACN,IAAI;AAAE;AACN,IAAI;AAAE;AACN,IAAI;AAAE;AACN,IAAI;AAAE;AACN,IAAI;AAAE;AACN,IAAI;AAAE;AACN,IAAI;AAAE;AACN,IAAI;AAAE;AACN,IAAI;AAAE;AACN,IAAI;AAAE;AACN,IAAI;AAAE;AACN,IAAI;AAAE;AACN,IAAI;AAAE;AACN,IAAI;AAAE;AACN,IAAI;AAAE;AACN,IAAI;AAAE;AACN,IAAI;AAAE;AACN,IAAI;AAAE;AACN,IAAI;AAAE;AACN,IAAI;AAAE;AACN,IAAI;AAAE;AACN,IAAI;AAAE;AACN,IAAI,CAAE;AAAA,CACP;AAEM,MAAME,6BAA6B,GAAAD,OAAA,CAAAC,6BAAA,GAAG,CAC3C,IAAI,CAAE;AAAA,CACP;AA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CAAC;UACrC;QACF;QAEA;MACF;MAEA4C,IAAI,IAAI9C,OAAO,CAAC6B,KAAK,CAAC;IACxB;EACF;EAEA,IAAIiB,IAAI,CAAChB,MAAM,GAAG,CAAC,EAAE;IACnBe,KAAK,CAACrC,IAAI,CAACsC,IAAI,CAAC;EAClB;EAEA,IAAIF,OAAO,CAACG,aAAa,IAAI/C,OAAO,CAACO,OAAO,EAAE;IAC5CsC,KAAK,CAACrC,IAAI,CAACR,OAAO,CAACO,OAAO,CAAC;EAC7B;EAEA,OAAOsC,KAAK;AACd,CAAC;AAAC1D,OAAA,CAAAwD,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/currency/currencyCode.ts"],"sourcesContent":["type LiteralUnion<LiteralType, BaseType extends string> =\n | LiteralType\n | (BaseType & Record<never, never>);\n\n/**\n * A list of active localization codes according to ISO 4217.\n */\nexport type CurrencyCode = LiteralUnion<\n | 'AED'\n | 'AFN'\n | 'ALL'\n | 'AMD'\n | 'ANG'\n | 'AOA'\n | 'ARS'\n | 'AUD'\n | 'AWG'\n | 'AZN'\n | 'BAM'\n | 'BBD'\n | 'BDT'\n | 'BGN'\n | 'BHD'\n | 'BIF'\n | 'BMD'\n | 'BND'\n | 'BOB'\n | 'BOV'\n | 'BRL'\n | 'BSD'\n | 'BTN'\n | 'BWP'\n | 'BYN'\n | 'BZD'\n | 'CAD'\n | 'CDF'\n | 'CHE'\n | 'CHF'\n | 'CHW'\n | 'CLF'\n | 'CLP'\n | 'CNY'\n | 'COP'\n | 'COU'\n | 'CRC'\n | 'CUC'\n | 'CUP'\n | 'CVE'\n | 'CZK'\n | 'DJF'\n | 'DKK'\n | 'DOP'\n | 'DZD'\n | 'EGP'\n | 'ERN'\n | 'ETB'\n | 'EUR'\n | 'FJD'\n | 'FKP'\n | 'GBP'\n | 'GEL'\n | 'GHS'\n | 'GIP'\n | 'GMD'\n | 'GNF'\n | 'GTQ'\n | 'GYD'\n | 'HKD'\n | 'HNL'\n | 'HRK'\n | 'HTG'\n | 'HUF'\n | 'IDR'\n | 'ILS'\n | 'INR'\n | 'IQD'\n | 'IRR'\n | 'ISK'\n | 'JMD'\n | 'JOD'\n | 'JPY'\n | 'KES'\n | 'KGS'\n | 'KHR'\n | 'KMF'\n | 'KPW'\n | 'KRW'\n | 'KWD'\n | 'KYD'\n | 'KZT'\n | 'LAK'\n | 'LBP'\n | 'LKR'\n | 'LRD'\n | 'LSL'\n | 'LYD'\n | 'MAD'\n | 'MDL'\n | 'MGA'\n | 'MKD'\n | 'MMK'\n | 'MNT'\n | 'MOP'\n | 'MRU'\n | 'MUR'\n | 'MVR'\n | 'MWK'\n | 'MXN'\n | 'MXV'\n | 'MYR'\n | 'MZN'\n | 'NAD'\n | 'NGN'\n | 'NIO'\n | 'NOK'\n | 'NPR'\n | 'NZD'\n | 'OMR'\n | 'PAB'\n | 'PEN'\n | 'PGK'\n | 'PHP'\n | 'PKR'\n | 'PLN'\n | 'PYG'\n | 'QAR'\n | 'RON'\n | 'RSD'\n | 'RUB'\n | 'RWF'\n | 'SAR'\n | 'SBD'\n | 'SCR'\n | 'SDG'\n | 'SEK'\n | 'SGD'\n | 'SHP'\n | 'SLL'\n | 'SOS'\n | 'SRD'\n | 'SSP'\n | 'STN'\n | 'SVC'\n | 'SYP'\n | 'SZL'\n | 'THB'\n | 'TJS'\n | 'TMT'\n | 'TND'\n | 'TOP'\n | 'TRY'\n | 'TTD'\n | 'TWD'\n | 'TZS'\n | 'UAH'\n | 'UGX'\n | 'USD'\n | 'USN'\n | 'UYI'\n | 'UYU'\n | 'UYW'\n | 'UZS'\n | 'VED'\n | 'VES'\n | 'VND'\n | 'VUV'\n | 'WST'\n | 'XAF'\n | 'XAG'\n | 'XAU'\n | 'XBA'\n | 'XBB'\n | 'XBC'\n | 'XBD'\n | 'XCD'\n | 'XDR'\n | 'XOF'\n | 'XPD'\n | 'XPF'\n | 'XPT'\n | 'XSU'\n | 'XTS'\n | 'XUA'\n | 'YER'\n | 'ZAR'\n | 'ZMW'\n | 'ZWL',\n string\n>;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.currencyFormatterFactory = void 0;
|
|
5
|
+
const extractLanguageCode = language => {
|
|
6
|
+
return language.split('-')[0];
|
|
7
|
+
};
|
|
8
|
+
const _currencyFormatterFactory = ({
|
|
9
|
+
language,
|
|
10
|
+
country,
|
|
11
|
+
...options
|
|
12
|
+
}) => {
|
|
13
|
+
var _Intl;
|
|
14
|
+
if (typeof ((_Intl = Intl) == null ? void 0 : _Intl.NumberFormat) === 'undefined') {
|
|
15
|
+
throw new Error('Intl.NumberFormat is not available.');
|
|
16
|
+
}
|
|
17
|
+
const languageCode = extractLanguageCode(language);
|
|
18
|
+
const locale = country ? `${languageCode}-${country}` : language;
|
|
19
|
+
return Intl.NumberFormat(locale, {
|
|
20
|
+
style: 'currency',
|
|
21
|
+
...options
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
const cache = new Map();
|
|
25
|
+
const resolver = options => Object.keys(options).filter(key => options[key] !== undefined).sort().map(key => `${key}=${options[key]}`).join('&');
|
|
26
|
+
const currencyFormatterFactory = params => {
|
|
27
|
+
const key = resolver(params);
|
|
28
|
+
if (cache.has(key)) {
|
|
29
|
+
return cache.get(key);
|
|
30
|
+
}
|
|
31
|
+
const result = _currencyFormatterFactory(params);
|
|
32
|
+
cache.set(key, result);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
exports.currencyFormatterFactory = currencyFormatterFactory;
|
|
36
|
+
currencyFormatterFactory.cache = cache;
|
|
37
|
+
//# sourceMappingURL=factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["extractLanguageCode","language","split","_currencyFormatterFactory","country","options","_Intl","Intl","NumberFormat","Error","languageCode","locale","style","cache","Map","resolver","Object","keys","filter","key","undefined","sort","map","join","currencyFormatterFactory","params","has","get","result","set","exports"],"sources":["../../../src/currency/factory.ts"],"sourcesContent":["import type { CurrencyCode } from './currencyCode';\n\ninterface CurrencyFormatterLocale {\n language: string;\n country?: string;\n}\n\ntype CurrencyFormatterOptions = Intl.NumberFormatOptions & {\n currency: CurrencyCode;\n};\n\nexport type CurrenyFormatterArgs = CurrencyFormatterLocale &\n CurrencyFormatterOptions;\n\nconst extractLanguageCode = (language: string) => {\n return language.split('-')[0];\n};\n\nconst _currencyFormatterFactory = ({\n language,\n country,\n ...options\n}: CurrenyFormatterArgs) => {\n if (typeof Intl?.NumberFormat === 'undefined') {\n throw new Error('Intl.NumberFormat is not available.');\n }\n\n const languageCode = extractLanguageCode(language);\n\n const locale = country ? `${languageCode}-${country}` : language;\n\n return Intl.NumberFormat(locale, {\n style: 'currency',\n ...options,\n });\n};\n\nconst cache = new Map<string, Intl.NumberFormat>();\n\nconst resolver = (options: CurrenyFormatterArgs) =>\n (Object.keys(options) as (keyof CurrenyFormatterArgs)[])\n .filter((key) => options[key] !== undefined)\n .sort()\n .map((key) => `${key}=${options[key]}`)\n .join('&');\n\nexport const currencyFormatterFactory = (\n params: CurrenyFormatterArgs,\n): Intl.NumberFormat => {\n const key = resolver(params);\n\n if (cache.has(key)) {\n return cache.get(key)!;\n }\n\n const result = _currencyFormatterFactory(params);\n cache.set(key, result);\n return result;\n};\n\ncurrencyFormatterFactory.cache = cache;\n"],"mappings":";;;;AAcA,MAAMA,mBAAmB,GAAIC,QAAgB,IAAK;EAChD,OAAOA,QAAQ,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC/B,CAAC;AAED,MAAMC,yBAAyB,GAAGA,CAAC;EACjCF,QAAQ;EACRG,OAAO;EACP,GAAGC;AACiB,CAAC,KAAK;EAAA,IAAAC,KAAA;EAC1B,IAAI,SAAAA,KAAA,GAAOC,IAAI,qBAAJD,KAAA,CAAME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createCurrencyFormatterWithDefaults = createCurrencyFormatterWithDefaults;
|
|
5
|
+
var _factory = require("./factory");
|
|
6
|
+
function createCurrencyFormatterWithDefaults(defaults) {
|
|
7
|
+
return function createCurrencyFormatter(params) {
|
|
8
|
+
const overrides = {
|
|
9
|
+
...defaults,
|
|
10
|
+
...params
|
|
11
|
+
};
|
|
12
|
+
return function format({
|
|
13
|
+
value,
|
|
14
|
+
currency
|
|
15
|
+
}) {
|
|
16
|
+
const instance = (0, _factory.currencyFormatterFactory)({
|
|
17
|
+
...overrides,
|
|
18
|
+
currency
|
|
19
|
+
});
|
|
20
|
+
const input = typeof value === 'string' ? Number(value) : value;
|
|
21
|
+
if (overrides.parts) {
|
|
22
|
+
return instance.formatToParts(input);
|
|
23
|
+
}
|
|
24
|
+
return instance.format(input);
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=formatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_factory","require","createCurrencyFormatterWithDefaults","defaults","createCurrencyFormatter","params","overrides","format","value","currency","instance","currencyFormatterFactory","input","Number","parts","formatToParts"],"sources":["../../../src/currency/formatter.ts"],"sourcesContent":["import type { CurrencyCode } from './currencyCode';\nimport type { CurrenyFormatterArgs } from './factory';\nimport { currencyFormatterFactory } from './factory';\n\nexport interface Money {\n value: string | number | bigint;\n currency: CurrencyCode;\n}\n\nexport type CreateCurrencyFormatterArgs<P> = Omit<\n CurrenyFormatterArgs,\n 'currency' | 'language'\n> & {\n parts?: P;\n language?: string;\n};\n\nexport type FormattedCurrencyResult<P> = P extends true\n ? Intl.NumberFormatPart[]\n : P extends false\n ? string\n : never;\n\nexport type CreateCurrencyFormatter = <P extends boolean = false>(\n params?: Partial<CreateCurrencyFormatterArgs<P>>,\n) => (money: Money) => FormattedCurrencyResult<P>;\n\ninterface RequiredCreateCurrencyFormatterDefaults {\n language: string;\n}\n\nexport function createCurrencyFormatterWithDefaults(\n defaults: RequiredCreateCurrencyFormatterDefaults,\n) {\n return function createCurrencyFormatter<P extends boolean = false>(\n params?: CreateCurrencyFormatterArgs<P>,\n ) {\n const overrides = {\n ...defaults,\n ...params,\n };\n\n return function format({\n value,\n currency,\n }: Money): FormattedCurrencyResult<P> {\n const instance = currencyFormatterFactory({ ...overrides, currency });\n const input = typeof value === 'string' ? Number(value) : value;\n\n if (overrides.parts) {\n return instance.formatToParts(input) as FormattedCurrencyResult<P>;\n }\n\n return instance.format(input) as FormattedCurrencyResult<P>;\n };\n };\n}\n"],"mappings":";;;;AAEA,IAAAA,QAAA,GAAAC,OAAA;AA6BO,SAASC,mCAAmCA,CACjDC,QAAiD,EACjD;EACA,OAAO,SAASC,uBAAuBA,CACrCC,MAAuC,EACvC;IACA,MAAMC,SAAS,GAAG;MAChB,GAAGH,QAAQ;MACX,GAAGE;IACL,CAAC;IAED,OAAO,SAASE,MAAMA,CAAC;MACrBC,KAAK;MACLC;IACK,CAAC,EAA8B;MACpC,MAAMC,QAAQ,GAAG,IAAAC,iCAAwB,EAAC;QAAE,GAAGL,SAAS;QAAEG;MAAS,CAAC,CAAC;MACrE,MAAMG,KAAK,GAAG,OAAOJ,KAAK,KAAK,QAAQ,GAAGK,MAAM,CAACL,KAAK,CAAC,GAAGA,KAAK;MAE/D,IAAIF,SAAS,CAACQ,KAAK,EAAE;QACnB,OAAOJ,QAAQ,CAACK,aAAa,CAACH,KAAK,CAAC;MACtC;MAEA,OAAOF,QAAQ,CAACH,MAAM,CAACK,KAAK,CAAC;IAC/B,CAAC;EACH,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["../../src/external-types.d.ts"],"sourcesContent":["/// <reference types=\"@wix/yoshi-flow-library/types\" />\n/// <reference types=\"@wix/jest-yoshi-preset/types\" />\n"],"mappings":"AAAA;AACA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/generated/proto-generated.d.ts"],"sourcesContent":["\n\ndeclare namespace $wrapper {\n export namespace wix {\n export namespace common {\n export interface Address {\n country?: (string | null);\n subdivision?: (string | null);\n subdivisionIso31662?: (string | null);\n city?: (string | null);\n postalCode?: (string | null);\n streetAddress?: ($wrapper.wix.common.StreetAddress | null);\n addressLine?: (string | null);\n addressLine2?: (string | null);\n formattedAddress?: (string | null);\n hint?: (string | null);\n geocode?: ($wrapper.wix.common.AddressLocation | null);\n countryFullname?: (string | null);\n subdivisionFullname?: (string | null);\n subdivisions?: ($wrapper.wix.common.Subdivision[] | null);\n }\n export interface Subdivision {\n code?: (string | null);\n name?: (string | null);\n type?: ($wrapper.wix.common.Subdivision.SubdivisionType | null);\n typeInfo?: (string | null);\n standardDetails?: ($wrapper.wix.common.Subdivision.StandardDetails | null);\n }\n export namespace Subdivision {\n export enum SubdivisionType {\n UNKNOWN_SUBDIVISION_TYPE = \"UNKNOWN_SUBDIVISION_TYPE\",\n ADMINISTRATIVE_AREA_LEVEL_1 = \"ADMINISTRATIVE_AREA_LEVEL_1\",\n ADMINISTRATIVE_AREA_LEVEL_2 = \"ADMINISTRATIVE_AREA_LEVEL_2\",\n ADMINISTRATIVE_AREA_LEVEL_3 = \"ADMINISTRATIVE_AREA_LEVEL_3\",\n ADMINISTRATIVE_AREA_LEVEL_4 = \"ADMINISTRATIVE_AREA_LEVEL_4\",\n ADMINISTRATIVE_AREA_LEVEL_5 = \"ADMINISTRATIVE_AREA_LEVEL_5\",\n COUNTRY = \"COUNTRY\",\n }\n export interface StandardDetails {\n iso31662?: (string | null);\n }\n }\n export interface StreetAddress {\n number?: (string | null);\n name?: (string | null);\n apt?: (string | null);\n formattedAddressLine?: (string | null);\n }\n export interface AddressContactDetails {\n fullName?: (string | null);\n phone?: (string | null);\n company?: (string | null);\n email?: (string | null);\n }\n export interface FullAddressContactDetails {\n firstName?: (string | null);\n lastName?: (string | null);\n fullName?: (string | null);\n phone?: (string | null);\n company?: (string | null);\n email?: (string | null);\n vatId?: ($wrapper.wix.common.VatId | null);\n }\n export interface VatId {\n id?: (string | null);\n type?: ($wrapper.wix.common.VatType | null);\n }\n export enum VatType {\n UNSPECIFIED = \"UNSPECIFIED\",\n CPF = \"CPF\",\n CNPJ = \"CNPJ\",\n }\n export interface AddressLocation {\n latitude?: (number | null);\n longitude?: (number | null);\n }\n export interface BulkActionMetadata {\n totalSuccesses?: (number | null);\n totalFailures?: (number | null);\n undetailedFailures?: (number | null);\n }\n export interface ItemMetadata {\n id?: (string | null);\n originalIndex?: (number | null);\n success?: (boolean | null);\n error?: ($wrapper.wix.api.ApplicationError | null);\n }\n export enum BulkActionType {\n UNKNOWN_ACTION_TYPE = \"UNKNOWN_ACTION_TYPE\",\n INSERT = \"INSERT\",\n UPDATE = \"UPDATE\",\n DELETE = \"DELETE\",\n }\n export interface IdentificationData {\n contactId?: (string | null);\n identityType?: ($wrapper.wix.common.IdentificationData.IdentityType | null);\n anonymousVisitorId?: (string | null);\n memberId?: (string | null);\n wixUserId?: (string | null);\n appId?: (string | null);\n }\n export namespace IdentificationData {\n export enum IdentityType {\n UNKNOWN = \"UNKNOWN\",\n ANONYMOUS_VISITOR = \"ANONYMOUS_VISITOR\",\n MEMBER = \"MEMBER\",\n WIX_USER = \"WIX_USER\",\n APP = \"APP\",\n }\n }\n export interface Image {\n id?: (string | null);\n url?: (string | null);\n height?: (number | null);\n width?: (number | null);\n altText?: (string | null);\n urlExpirationDate?: (Date | null);\n filename?: (string | null);\n sizeInBytes?: (string | null);\n focalPoint?: ($wrapper.wix.common.FocalPoint | null);\n }\n export interface Video {\n id?: (string | null);\n url?: (string | null);\n height?: (number | null);\n width?: (number | null);\n thumbnail?: ($wrapper.wix.common.Image | null);\n }\n export interface VideoV2 {\n id?: (string | null);\n url?: (string | null);\n resolutions?: ($wrapper.wix.common.VideoResolution[] | null);\n filename?: (string | null);\n posters?: ($wrapper.wix.common.Image[] | null);\n sizeInBytes?: (string | null);\n urlExpirationDate?: (Date | null);\n durationInMilliseconds?: (number | null);\n title?: (string | null);\n description?: (string | null);\n height?: (number | null);\n width?: (number | null);\n }\n export interface VideoResolution {\n url?: (string | null);\n height?: (number | null);\n width?: (number | null);\n poster?: ($wrapper.wix.common.Image | null);\n format?: (string | null);\n urlExpirationDate?: (Date | null);\n sizeInBytes?: (string | null);\n quality?: (string | null);\n filename?: (string | null);\n durationInSeconds?: (number | null);\n durationInMilliseconds?: (number | null);\n private?: (boolean | null);\n assetKey?: (string | null);\n }\n export interface Audio {\n id?: (string | null);\n url?: (string | null);\n urlExpirationDate?: (Date | null);\n sizeInBytes?: (string | null);\n filename?: (string | null);\n duration?: (number | null);\n private?: (boolean | null);\n assetKey?: (string | null);\n format?: (string | null);\n quality?: (string | null);\n }\n export interface Document {\n id?: (string | null);\n url?: (string | null);\n urlExpirationDate?: (Date | null);\n sizeInBytes?: (string | null);\n filename?: (string | null);\n thumbnail?: ($wrapper.wix.common.Image | null);\n }\n export interface Model3D {\n id?: (string | null);\n url?: (string | null);\n thumbnail?: ($wrapper.wix.common.Image | null);\n altText?: (string | null);\n urlExpirationDate?: (Date | null);\n filename?: (string | null);\n sizeInBytes?: (string | null);\n }\n export interface Archive {\n id?: (string | null);\n url?: (string | null);\n urlExpirationDate?: (Date | null);\n sizeInBytes?: (string | null);\n filename?: (string | null);\n }\n export interface MediaItem {\n image?: ($wrapper.wix.common.Image | null);\n video?: ($wrapper.wix.common.Video | null);\n document?: ($wrapper.wix.common.Document | null);\n }\n export interface FocalPoint {\n x?: (number | null);\n y?: (number | null);\n height?: (number | null);\n width?: (number | null);\n }\n export interface Money {\n value?: (string | null);\n currency?: (string | null);\n formattedValue?: (string | null);\n }\n export interface PageUrl {\n base?: (string | null);\n path?: (string | null);\n }\n export interface PageUrlV2 {\n relativePath?: (string | null);\n url?: (string | null);\n }\n export interface Paging {\n limit?: (number | null);\n offset?: (number | null);\n }\n export interface CursorPaging {\n limit?: (number | null);\n cursor?: (string | null);\n }\n export interface PagingMetadata {\n count?: (number | null);\n offset?: (number | null);\n total?: (number | null);\n tooManyToCount?: (boolean | null);\n hasNext?: (boolean | null);\n }\n export interface PagingMetadataV2 {\n count?: (number | null);\n offset?: (number | null);\n total?: (number | null);\n tooManyToCount?: (boolean | null);\n cursors?: ($wrapper.wix.common.Cursors | null);\n hasNext?: (boolean | null);\n }\n export interface CursorPagingMetadata {\n count?: (number | null);\n cursors?: ($wrapper.wix.common.Cursors | null);\n hasNext?: (boolean | null);\n total?: (number | null);\n }\n export interface Cursors {\n next?: (string | null);\n prev?: (string | null);\n }\n export interface Sorting {\n fieldName?: (string | null);\n order?: ($wrapper.wix.common.SortOrder | null);\n selectItemsBy?: ({ [key: string]: any }[] | null);\n }\n export enum SortOrder {\n ASC = \"ASC\",\n DESC = \"DESC\",\n }\n export namespace spi {\n export interface SpiBaseUri {\n baseUri?: (string | null);\n alternativeUris?: ($wrapper.wix.common.spi.SpiBaseUri.AlternativeUri[] | null);\n }\n export namespace SpiBaseUri {\n export interface AlternativeUri {\n methodName?: (string | null);\n absoluteUri?: (string | null);\n }\n }\n /**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n * \n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\n export interface Context {\n requestId?: (string | null);\n currency?: (string | null);\n identity?: ($wrapper.wix.common.spi.Context.IdentificationData | null);\n languages?: (string[] | null);\n instanceId?: (string | null);\n appExtensionId?: (string | null);\n appExtensionType?: (string | null);\n functionName?: (string | null);\n }\n export namespace Context {\n export interface IdentificationData {\n identityType?: ($wrapper.wix.common.spi.Context.IdentificationData.IdentityType | null);\n anonymousVisitorId?: (string | null);\n memberId?: (string | null);\n wixUserId?: (string | null);\n appId?: (string | null);\n }\n export namespace IdentificationData {\n export enum IdentityType {\n UNKNOWN = \"UNKNOWN\",\n ANONYMOUS_VISITOR = \"ANONYMOUS_VISITOR\",\n MEMBER = \"MEMBER\",\n WIX_USER = \"WIX_USER\",\n APP = \"APP\",\n }\n }\n }\n }\n export namespace tags {\n export interface Tags {\n privateTags?: ($wrapper.wix.common.tags.Tags.TagList | null);\n tags?: ($wrapper.wix.common.tags.Tags.TagList | null);\n }\n export namespace Tags {\n export interface TagList {\n tagIds?: (string[] | null);\n }\n }\n export interface PublicTags {\n tags?: ($wrapper.wix.common.tags.PublicTags.TagList | null);\n }\n export namespace PublicTags {\n export interface TagList {\n tagIds?: (string[] | null);\n }\n }\n }\n export interface WixLink {\n external?: ($wrapper.wix.common.ExternalLink | null);\n page?: ($wrapper.wix.common.PageLink | null);\n anchor?: ($wrapper.wix.common.AnchorLink | null);\n dynamicPage?: ($wrapper.wix.common.DynamicPageLink | null);\n document?: ($wrapper.wix.common.DocumentLink | null);\n email?: ($wrapper.wix.common.EmailLink | null);\n phone?: ($wrapper.wix.common.PhoneLink | null);\n address?: ($wrapper.wix.common.AddressLink | null);\n whatsApp?: ($wrapper.wix.common.WhatsAppLink | null);\n tpaPage?: ($wrapper.wix.common.TpaPageLink | null);\n }\n export interface ExternalLink {\n url?: (string | null);\n target?: (string | null);\n rel?: ($wrapper.wix.common.LinkRel[] | null);\n }\n export interface PageLink {\n pageId?: (string | null);\n target?: (string | null);\n rel?: ($wrapper.wix.common.LinkRel[] | null);\n }\n export interface AnchorLink {\n anchorName?: (string | null);\n anchorDataId?: (string | null);\n pageId?: (string | null);\n rel?: ($wrapper.wix.common.LinkRel[] | null);\n }\n export interface DynamicPageLink {\n routerId?: (string | null);\n innerRoute?: (string | null);\n anchorDataId?: (string | null);\n rel?: ($wrapper.wix.common.LinkRel[] | null);\n }\n export interface DocumentLink {\n docId?: (string | null);\n name?: (string | null);\n indexable?: (boolean | null);\n }\n export interface EmailLink {\n recipient?: (string | null);\n subject?: (string | null);\n body?: (string | null);\n }\n export interface PhoneLink {\n phoneNumber?: (string | null);\n }\n export interface AddressLink {\n address?: (string | null);\n }\n export interface WhatsAppLink {\n phoneNumber?: (string | null);\n }\n export interface TpaPageLink {\n itemTypeIdentifier?: (string | null);\n itemId?: (string | null);\n pageId?: (string | null);\n appDefinitionId?: (string | null);\n path?: (string | null);\n rel?: ($wrapper.wix.common.LinkRel[] | null);\n }\n export enum LinkRel {\n unknown_link_rel = \"unknown_link_rel\",\n nofollow = \"nofollow\",\n noopener = \"noopener\",\n noreferrer = \"noreferrer\",\n sponsored = \"sponsored\",\n }\n }\n export namespace api {\n export interface ReferenceEntityField {\n path?: (string | null);\n }\n export interface CacheSettings {\n maxAgeSeconds?: (number | null);\n manual?: (boolean | null);\n }\n export interface FieldSet {\n field?: (string[] | null);\n }\n export interface Deprecated {\n replacedBy?: (string | null);\n targetRemovalDate?: (string | null);\n }\n export interface Unique {\n field?: (string[] | null);\n }\n export interface Crud {\n method?: ($wrapper.wix.api.Crud.Method | null);\n createOptions?: ($wrapper.wix.api.CreateMethodOptions | null);\n getOptions?: ($wrapper.wix.api.GetItemMethodOptions | null);\n updateOptions?: ($wrapper.wix.api.UpdateMethodOptions | null);\n deleteOptions?: ($wrapper.wix.api.DeleteMethodOptions | null);\n listOptions?: ($wrapper.wix.api.ListMethodOptions | null);\n queryOptions?: ($wrapper.wix.api.QueryMethodOptions | null);\n searchOptions?: ($wrapper.wix.api.SearchMethodOptions | null);\n bulkCreateOptions?: ($wrapper.wix.api.BulkCreateMethodOptions | null);\n bulkUpdateOptions?: ($wrapper.wix.api.BulkUpdateMethodOptions | null);\n bulkUpdateByFilterOptions?: ($wrapper.wix.api.BulkUpdateByFilterMethodOptions | null);\n bulkDeleteOptions?: ($wrapper.wix.api.BulkDeleteMethodOptions | null);\n bulkDeleteByFilterOptions?: ($wrapper.wix.api.BulkDeleteByFilterMethodOptions | null);\n upsertOptions?: ($wrapper.wix.api.UpsertMethodOptions | null);\n bulkUpsertOptions?: ($wrapper.wix.api.BulkUpsertMethodOptions | null);\n listDeletedOptions?: ($wrapper.wix.api.ListDeletedMethodOptions | null);\n getDeletedOptions?: ($wrapper.wix.api.GetDeletedMethodOptions | null);\n restoreFromTrashbinOptions?: ($wrapper.wix.api.RestoreFromTrashbinMethodOptions | null);\n removeFromTrashbinOptions?: ($wrapper.wix.api.RemoveFromTrashbinMethodOptions | null);\n countOptions?: ($wrapper.wix.api.CountOptions | null);\n searchRelatedOptions?: ($wrapper.wix.api.SearchRelatedOptions | null);\n updateExtendedFieldsOptions?: ($wrapper.wix.api.UpdateExtendedFieldsOptions | null);\n customActionOptions?: ($wrapper.wix.api.CustomActionOptions | null);\n bulkUpdateTagsOptions?: ($wrapper.wix.api.BulkUpdateTagsMethodOptions | null);\n bulkUpdateTagsByFilterOptions?: ($wrapper.wix.api.BulkUpdateTagsByFilterMethodOptions | null);\n }\n export namespace Crud {\n export enum Method {\n UNKNOWN_METHOD = \"UNKNOWN_METHOD\",\n CREATE = \"CREATE\",\n GET_ITEM = \"GET_ITEM\",\n UPDATE = \"UPDATE\",\n DELETE = \"DELETE\",\n UPSERT = \"UPSERT\",\n LIST = \"LIST\",\n QUERY = \"QUERY\",\n SEARCH = \"SEARCH\",\n BULK_CREATE = \"BULK_CREATE\",\n BULK_UPDATE = \"BULK_UPDATE\",\n BULK_UPDATE_BY_FILTER = \"BULK_UPDATE_BY_FILTER\",\n BULK_DELETE = \"BULK_DELETE\",\n BULK_DELETE_BY_FILTER = \"BULK_DELETE_BY_FILTER\",\n BULK_UPSERT = \"BULK_UPSERT\",\n LIST_DELETED = \"LIST_DELETED\",\n GET_DELETED = \"GET_DELETED\",\n RESTORE_FROM_TRASHBIN = \"RESTORE_FROM_TRASHBIN\",\n REMOVE_FROM_TRASHBIN = \"REMOVE_FROM_TRASHBIN\",\n COUNT = \"COUNT\",\n SEARCH_RELATED = \"SEARCH_RELATED\",\n UPDATE_EXTENDED_FIELDS = \"UPDATE_EXTENDED_FIELDS\",\n BULK_UPDATE_TAGS = \"BULK_UPDATE_TAGS\",\n BULK_UPDATE_TAGS_BY_FILTER = \"BULK_UPDATE_TAGS_BY_FILTER\",\n CUSTOM_ACTION = \"CUSTOM_ACTION\",\n }\n }\n export interface Paging {\n type?: ($wrapper.wix.api.Paging.Type | null);\n pagingMetadataField?: (string | null);\n cursorPagingMetadataField?: (string | null);\n offsetPagingMetadataField?: (string | null);\n }\n export namespace Paging {\n export enum Type {\n UNKNOWN_TYPE = \"UNKNOWN_TYPE\",\n OFFSET = \"OFFSET\",\n CURSOR = \"CURSOR\",\n BOTH = \"BOTH\",\n }\n }\n export interface CustomActionOptions {\n readOperation?: (boolean | null);\n wql?: ($wrapper.wix.api.WqlOptions | null);\n }\n export interface WqlOptions {\n queryOptionsName?: (string | null);\n filterField?: (string | null);\n queryField?: (string | null);\n searchField?: (string | null);\n }\n export interface CreateMethodOptions {\n itemField?: (string | null);\n }\n export interface GetItemMethodOptions {\n itemField?: (string | null);\n idField?: (string | null);\n }\n export interface UpdateMethodOptions {\n itemField?: (string | null);\n fieldmaskField?: (string | null);\n }\n export interface UpsertMethodOptions {\n itemField?: (string | null);\n fieldmaskField?: (string | null);\n }\n export interface DeleteMethodOptions {\n idField?: (string | null);\n }\n export interface ListMethodOptions {\n idsField?: (string | null);\n itemsField?: (string | null);\n paging?: ($wrapper.wix.api.Paging | null);\n meAliasableField?: (string[] | null);\n }\n export interface QueryMethodOptions {\n queryField?: (string | null);\n cursorQueryField?: (string | null);\n offsetQueryField?: (string | null);\n itemsField?: (string | null);\n paging?: ($wrapper.wix.api.Paging | null);\n wql?: ($wrapper.wix.api.Wql | null);\n queryOptionsName?: (string | null);\n meAliasableField?: (string[] | null);\n }\n export interface SearchMethodOptions {\n searchField?: (string | null);\n cursorSearchField?: (string | null);\n offsetSearchField?: (string | null);\n itemsField?: (string | null);\n paging?: ($wrapper.wix.api.Paging | null);\n wql?: ($wrapper.wix.api.Wql | null);\n queryOptionsName?: (string | null);\n meAliasableField?: (string[] | null);\n search?: ($wrapper.wix.api.Search[] | null);\n }\n export interface BulkCreateMethodOptions {\n itemField?: (string | null);\n }\n export interface BulkUpdateMethodOptions {\n itemsField?: (string | null);\n itemField?: (string | null);\n fieldmaskField?: (string | null);\n }\n export interface BulkUpdateByFilterMethodOptions {\n itemField?: (string | null);\n fieldmaskField?: (string | null);\n filterField?: (string | null);\n queryOptionsName?: (string | null);\n }\n export interface BulkUpdateTagsMethodOptions {\n idsField?: (string | null);\n }\n export interface BulkUpdateTagsByFilterMethodOptions {\n filterField?: (string | null);\n queryOptionsName?: (string | null);\n }\n export interface BulkUpsertMethodOptions {\n itemField?: (string | null);\n fieldmaskField?: (string | null);\n }\n export interface BulkDeleteMethodOptions {\n idsField?: (string | null);\n }\n export interface BulkDeleteByFilterMethodOptions {\n filterField?: (string | null);\n queryOptionsName?: (string | null);\n }\n export interface ListDeletedMethodOptions {\n idsField?: (string | null);\n itemsField?: (string | null);\n paging?: ($wrapper.wix.api.Paging | null);\n meAliasableField?: (string[] | null);\n }\n export interface GetDeletedMethodOptions {\n itemField?: (string | null);\n idField?: (string | null);\n }\n export interface RestoreFromTrashbinMethodOptions {\n itemField?: (string | null);\n idField?: (string | null);\n }\n export interface RemoveFromTrashbinMethodOptions {\n idField?: (string | null);\n }\n export interface CountOptions {\n inheritWqlFrom?: (string | null);\n queryOptionsName?: (string | null);\n filterField?: (string | null);\n countField?: (string | null);\n }\n export interface SearchRelatedOptions {\n inheritWqlFrom?: (string | null);\n queryOptionsName?: (string | null);\n }\n export interface UpdateExtendedFieldsOptions {\n itemField?: (string | null);\n }\n export interface Wql {\n operatorFieldSupport?: ($wrapper.wix.api.Wql.OperatorFieldSupport[] | null);\n pattern?: ($wrapper.wix.api.Wql.OperatorFieldSupport[] | null);\n validateQuery?: (boolean | null);\n }\n export namespace Wql {\n export enum Operator {\n ALL_APPLICABLE_OPERATORS = \"ALL_APPLICABLE_OPERATORS\",\n EQ = \"EQ\",\n GT = \"GT\",\n GTE = \"GTE\",\n IN = \"IN\",\n LT = \"LT\",\n LTE = \"LTE\",\n NE = \"NE\",\n NIN = \"NIN\",\n BEGINS = \"BEGINS\",\n EXISTS = \"EXISTS\",\n HAS_ALL = \"HAS_ALL\",\n ALL = \"ALL\",\n HAS_SOME = \"HAS_SOME\",\n ANY = \"ANY\",\n EMPTY = \"EMPTY\",\n MATCH_ALL = \"MATCH_ALL\",\n MATCH_ITEMS = \"MATCH_ITEMS\",\n ENHANCED_DATE = \"ENHANCED_DATE\",\n }\n export enum Sort {\n NONE = \"NONE\",\n ASC = \"ASC\",\n DESC = \"DESC\",\n BOTH = \"BOTH\",\n }\n export interface RequiredFields {\n field?: (string[] | null);\n requiredField?: ($wrapper.wix.api.Wql.RequiredFields.RequiredField[] | null);\n }\n export namespace RequiredFields {\n export interface RequiredField {\n path?: (string | null);\n sort?: ($wrapper.wix.api.Wql.Sort | null);\n }\n }\n export enum VirtualSubfields {\n NO_VIRTUAL_SUBFIELDS = \"NO_VIRTUAL_SUBFIELDS\",\n DATE = \"DATE\",\n EMAIL = \"EMAIL\",\n }\n export interface OperatorFieldSupport {\n operator?: ($wrapper.wix.api.Wql.Operator[] | null);\n glob?: (string | null);\n field?: (string[] | null);\n sort?: ($wrapper.wix.api.Wql.Sort | null);\n requiredFields?: ($wrapper.wix.api.Wql.RequiredFields[] | null);\n maturity?: ($wrapper.wix.api.Maturity | null);\n virtualSubfields?: ($wrapper.wix.api.Wql.VirtualSubfields | null);\n }\n }\n export interface Search {\n field?: (string[] | null);\n maturity?: ($wrapper.wix.api.Maturity | null);\n }\n export interface Translatable {\n name?: (string | null);\n hidden?: (boolean | null);\n grouping?: (string | null);\n type?: ($wrapper.wix.api.Translatable.Type | null);\n displayOnly?: (boolean | null);\n }\n export namespace Translatable {\n export enum Type {\n UNDEFINED_TYPE = \"UNDEFINED_TYPE\",\n SHORT_TEXT = \"SHORT_TEXT\",\n LONG_TEXT = \"LONG_TEXT\",\n RICH_TEXT = \"RICH_TEXT\",\n RICH_CONTENT_EDITOR = \"RICH_CONTENT_EDITOR\",\n SELECTION = \"SELECTION\",\n MULTI_SELECTION = \"MULTI_SELECTION\",\n DOCUMENT = \"DOCUMENT\",\n IMAGE = \"IMAGE\",\n VIDEO = \"VIDEO\",\n IMAGE_LINK = \"IMAGE_LINK\",\n }\n }\n export interface Conditional {\n permission?: (string | null);\n requestedField?: (string | null);\n }\n export interface ServiceAppendix {\n type?: ($wrapper.wix.api.ServiceAppendix.Type | null);\n path?: (string | null);\n }\n export namespace ServiceAppendix {\n export enum Type {\n UNKNOWN_APPENDIX_TYPE = \"UNKNOWN_APPENDIX_TYPE\",\n NILE = \"NILE\",\n MESSAGE_BUS = \"MESSAGE_BUS\",\n }\n }\n export enum Exposure {\n PRIVATE = \"PRIVATE\",\n INTERNAL = \"INTERNAL\",\n PUBLIC = \"PUBLIC\",\n }\n export enum Maturity {\n ALPHA = \"ALPHA\",\n BETA = \"BETA\",\n IA = \"IA\",\n GA = \"GA\",\n NOT_IMPLEMENTED = \"NOT_IMPLEMENTED\",\n }\n /**\n * Decimal value validation rules.\n * Based on java.math.BigDecimal, implies (wix.api.format) = DECIMAL_VALUE\n */\n export interface DecimalValueOptions {\n lte?: (string | null);\n gte?: (string | null);\n lt?: (string | null);\n gt?: (string | null);\n maxScale?: (number | null);\n }\n export interface AlignedWithEnum {\n field?: (string | null);\n suffix?: (string | null);\n }\n export enum Format {\n EMAIL = \"EMAIL\",\n HOSTNAME = \"HOSTNAME\",\n IPV4 = \"IPV4\",\n IPV6 = \"IPV6\",\n URI = \"URI\",\n WEB_URL = \"WEB_URL\",\n PHONE = \"PHONE\",\n CREDIT_CARD = \"CREDIT_CARD\",\n GUID = \"GUID\",\n COUNTRY = \"COUNTRY\",\n LANGUAGE = \"LANGUAGE\",\n DECIMAL_VALUE = \"DECIMAL_VALUE\",\n CURRENCY = \"CURRENCY\",\n LANGUAGE_TAG = \"LANGUAGE_TAG\",\n COLOR_HEX = \"COLOR_HEX\",\n LOCAL_DATE = \"LOCAL_DATE\",\n LOCAL_TIME = \"LOCAL_TIME\",\n LOCAL_DATE_TIME = \"LOCAL_DATE_TIME\",\n URL_SLUG = \"URL_SLUG\",\n SYSTEM_SLUG = \"SYSTEM_SLUG\",\n SECURE_WEB_URL = \"SECURE_WEB_URL\",\n SUBDIVISION = \"SUBDIVISION\",\n }\n /**\n * ApplicationError: named Error for backwards compatibility\n */\n export interface Error {\n httpCode?: ($wrapper.wix.api.StatusCodes.HttpStatusCode | null);\n applicationCode?: (string | null);\n data?: (string | null);\n }\n /**\n * Method-level reference to a service-level error.\n */\n export interface ErrorRef {\n applicationCode?: (string | null);\n }\n /**\n * CustomValidationError: field level validation, only declare when you have specific validation in your service that is not coming from infra\n */\n export interface CustomValidationError {\n ruleName?: (string | null);\n data?: (string | null);\n }\n /**\n * InheritCrudErrors: does this method throw standard crud errors?\n */\n export interface InheritCrudErrors {\n method?: ($wrapper.wix.api.Crud.Method | null);\n }\n export interface StatusCodes {\n }\n export namespace StatusCodes {\n export enum HttpStatusCode {\n OK = \"OK\",\n UNAUTHENTICATED = \"UNAUTHENTICATED\",\n PERMISSION_DENIED = \"PERMISSION_DENIED\",\n INVALID_ARGUMENT = \"INVALID_ARGUMENT\",\n NOT_FOUND = \"NOT_FOUND\",\n INTERNAL = \"INTERNAL\",\n UNAVAILABLE = \"UNAVAILABLE\",\n RESOURCE_EXHAUSTED = \"RESOURCE_EXHAUSTED\",\n CANCELED = \"CANCELED\",\n ALREADY_EXISTS = \"ALREADY_EXISTS\",\n FAILED_PRECONDITION = \"FAILED_PRECONDITION\",\n }\n }\n export interface Details {\n applicationError?: ($wrapper.wix.api.ApplicationError | null);\n validationError?: ($wrapper.wix.api.ValidationError | null);\n systemError?: ($wrapper.wix.api.SystemError | null);\n tracing?: ({ [k: string]: string } | null);\n }\n export interface ApplicationError {\n code?: (string | null);\n description?: (string | null);\n data?: ({ [key: string]: any } | null);\n }\n export interface SystemError {\n errorCode?: (string | null);\n }\n /**\n * example result:\n * {\n * \"fieldViolations\": [\n * {\n * \"field\": \"fieldA\",\n * \"description\": \"invalid music note. supported notes: [do,re,mi,fa,sol,la,ti]\",\n * \"violatedRule\": \"OTHER\",\n * \"ruleName\": \"INVALID_NOTE\",\n * \"data\": {\n * \"value\": \"FI\"\n * }\n * },\n * {\n * \"field\": \"fieldB\",\n * \"description\": \"field value out of range. supported range: [0-20]\",\n * \"violatedRule\": \"MAX\",\n * \"data\": {\n * \"threshold\": 20\n * }\n * },\n * {\n * \"field\": \"fieldC\",\n * \"description\": \"invalid phone number. provide a valid phone number of size: [7-12], supported characters: [0-9, +, -, (, )]\",\n * \"violatedRule\": \"FORMAT\",\n * \"data\": {\n * \"type\": \"PHONE\"\n * }\n * }\n * ]\n * }\n */\n export interface ValidationError {\n fieldViolations?: ($wrapper.wix.api.ValidationError.FieldViolation[] | null);\n }\n export namespace ValidationError {\n export enum RuleType {\n VALIDATION = \"VALIDATION\",\n OTHER = \"OTHER\",\n MAX = \"MAX\",\n MIN = \"MIN\",\n MAX_LENGTH = \"MAX_LENGTH\",\n MIN_LENGTH = \"MIN_LENGTH\",\n MAX_SIZE = \"MAX_SIZE\",\n MIN_SIZE = \"MIN_SIZE\",\n FORMAT = \"FORMAT\",\n DECIMAL_LTE = \"DECIMAL_LTE\",\n DECIMAL_GTE = \"DECIMAL_GTE\",\n DECIMAL_LT = \"DECIMAL_LT\",\n DECIMAL_GT = \"DECIMAL_GT\",\n DECIMAL_MAX_SCALE = \"DECIMAL_MAX_SCALE\",\n INVALID_ENUM_VALUE = \"INVALID_ENUM_VALUE\",\n REQUIRED_FIELD = \"REQUIRED_FIELD\",\n FIELD_NOT_ALLOWED = \"FIELD_NOT_ALLOWED\",\n ONE_OF_ALIGNMENT = \"ONE_OF_ALIGNMENT\",\n EXACT_LENGTH = \"EXACT_LENGTH\",\n EXACT_SIZE = \"EXACT_SIZE\",\n REQUIRED_ONE_OF_FIELD = \"REQUIRED_ONE_OF_FIELD\",\n }\n export interface FieldViolation {\n field?: (string | null);\n description?: (string | null);\n violatedRule?: ($wrapper.wix.api.ValidationError.RuleType | null);\n ruleName?: (string | null);\n data?: ({ [key: string]: any } | null);\n }\n }\n export interface LimitRuleInt32DataPayload {\n threshold?: (number | null);\n }\n export interface LimitRuleDoubleDataPayload {\n threshold?: (number | null);\n }\n export interface LimitRuleStringDataPayload {\n threshold?: (string | null);\n }\n export interface FormatRuleDataPayload {\n type?: (string | null);\n }\n export interface EnumRuleDataPayload {\n supported?: (string[] | null);\n }\n export interface RequiredOneOfRuleDataPayload {\n supported?: (string[] | null);\n }\n }\n }\n export namespace google {\n export namespace protobuf {\n export interface FileDescriptorSet {\n file?: ($wrapper.google.protobuf.FileDescriptorProto[] | null);\n }\n export interface FileDescriptorProto {\n name?: (string | null);\n package?: (string | null);\n dependency?: (string[] | null);\n publicDependency?: (number[] | null);\n weakDependency?: (number[] | null);\n messageType?: ($wrapper.google.protobuf.DescriptorProto[] | null);\n enumType?: ($wrapper.google.protobuf.EnumDescriptorProto[] | null);\n service?: ($wrapper.google.protobuf.ServiceDescriptorProto[] | null);\n extension?: ($wrapper.google.protobuf.FieldDescriptorProto[] | null);\n options?: ($wrapper.google.protobuf.FileOptions | null);\n sourceCodeInfo?: ($wrapper.google.protobuf.SourceCodeInfo | null);\n syntax?: (string | null);\n }\n export interface DescriptorProto {\n name?: (string | null);\n field?: ($wrapper.google.protobuf.FieldDescriptorProto[] | null);\n extension?: ($wrapper.google.protobuf.FieldDescriptorProto[] | null);\n nestedType?: ($wrapper.google.protobuf.DescriptorProto[] | null);\n enumType?: ($wrapper.google.protobuf.EnumDescriptorProto[] | null);\n extensionRange?: ($wrapper.google.protobuf.DescriptorProto.ExtensionRange[] | null);\n oneofDecl?: ($wrapper.google.protobuf.OneofDescriptorProto[] | null);\n options?: ($wrapper.google.protobuf.MessageOptions | null);\n reservedRange?: ($wrapper.google.protobuf.DescriptorProto.ReservedRange[] | null);\n reservedName?: (string[] | null);\n }\n export namespace DescriptorProto {\n export interface ExtensionRange {\n start?: (number | null);\n end?: (number | null);\n options?: ($wrapper.google.protobuf.ExtensionRangeOptions | null);\n }\n export interface ReservedRange {\n start?: (number | null);\n end?: (number | null);\n }\n }\n export interface ExtensionRangeOptions {\n uninterpretedOption?: ($wrapper.google.protobuf.UninterpretedOption[] | null);\n }\n export interface FieldDescriptorProto {\n name?: (string | null);\n number?: (number | null);\n label?: ($wrapper.google.protobuf.FieldDescriptorProto.Label | null);\n type?: ($wrapper.google.protobuf.FieldDescriptorProto.Type | null);\n typeName?: (string | null);\n extendee?: (string | null);\n defaultValue?: (string | null);\n oneofIndex?: (number | null);\n jsonName?: (string | null);\n options?: ($wrapper.google.protobuf.FieldOptions | null);\n proto3Optional?: (boolean | null);\n }\n export namespace FieldDescriptorProto {\n export enum Type {\n TYPE_DOUBLE = \"TYPE_DOUBLE\",\n TYPE_FLOAT = \"TYPE_FLOAT\",\n TYPE_INT64 = \"TYPE_INT64\",\n TYPE_UINT64 = \"TYPE_UINT64\",\n TYPE_INT32 = \"TYPE_INT32\",\n TYPE_FIXED64 = \"TYPE_FIXED64\",\n TYPE_FIXED32 = \"TYPE_FIXED32\",\n TYPE_BOOL = \"TYPE_BOOL\",\n TYPE_STRING = \"TYPE_STRING\",\n TYPE_GROUP = \"TYPE_GROUP\",\n TYPE_MESSAGE = \"TYPE_MESSAGE\",\n TYPE_BYTES = \"TYPE_BYTES\",\n TYPE_UINT32 = \"TYPE_UINT32\",\n TYPE_ENUM = \"TYPE_ENUM\",\n TYPE_SFIXED32 = \"TYPE_SFIXED32\",\n TYPE_SFIXED64 = \"TYPE_SFIXED64\",\n TYPE_SINT32 = \"TYPE_SINT32\",\n TYPE_SINT64 = \"TYPE_SINT64\",\n }\n export enum Label {\n LABEL_OPTIONAL = \"LABEL_OPTIONAL\",\n LABEL_REQUIRED = \"LABEL_REQUIRED\",\n LABEL_REPEATED = \"LABEL_REPEATED\",\n }\n }\n export interface OneofDescriptorProto {\n name?: (string | null);\n options?: ($wrapper.google.protobuf.OneofOptions | null);\n }\n export interface EnumDescriptorProto {\n name?: (string | null);\n value?: ($wrapper.google.protobuf.EnumValueDescriptorProto[] | null);\n options?: ($wrapper.google.protobuf.EnumOptions | null);\n reservedRange?: ($wrapper.google.protobuf.EnumDescriptorProto.EnumReservedRange[] | null);\n reservedName?: (string[] | null);\n }\n export namespace EnumDescriptorProto {\n export interface EnumReservedRange {\n start?: (number | null);\n end?: (number | null);\n }\n }\n export interface EnumValueDescriptorProto {\n name?: (string | null);\n number?: (number | null);\n options?: ($wrapper.google.protobuf.EnumValueOptions | null);\n }\n export interface ServiceDescriptorProto {\n name?: (string | null);\n method?: ($wrapper.google.protobuf.MethodDescriptorProto[] | null);\n options?: ($wrapper.google.protobuf.ServiceOptions | null);\n }\n export interface MethodDescriptorProto {\n name?: (string | null);\n inputType?: (string | null);\n outputType?: (string | null);\n options?: ($wrapper.google.protobuf.MethodOptions | null);\n clientStreaming?: (boolean | null);\n serverStreaming?: (boolean | null);\n }\n export interface FileOptions {\n javaPackage?: (string | null);\n javaOuterClassname?: (string | null);\n javaMultipleFiles?: (boolean | null);\n javaGenerateEqualsAndHash?: (boolean | null);\n javaStringCheckUtf8?: (boolean | null);\n optimizeFor?: ($wrapper.google.protobuf.FileOptions.OptimizeMode | null);\n goPackage?: (string | null);\n ccGenericServices?: (boolean | null);\n javaGenericServices?: (boolean | null);\n pyGenericServices?: (boolean | null);\n phpGenericServices?: (boolean | null);\n deprecated?: (boolean | null);\n ccEnableArenas?: (boolean | null);\n objcClassPrefix?: (string | null);\n csharpNamespace?: (string | null);\n swiftPrefix?: (string | null);\n phpClassPrefix?: (string | null);\n phpNamespace?: (string | null);\n phpMetadataNamespace?: (string | null);\n rubyPackage?: (string | null);\n uninterpretedOption?: ($wrapper.google.protobuf.UninterpretedOption[] | null);\n }\n export namespace FileOptions {\n export enum OptimizeMode {\n SPEED = \"SPEED\",\n CODE_SIZE = \"CODE_SIZE\",\n LITE_RUNTIME = \"LITE_RUNTIME\",\n }\n }\n export interface MessageOptions {\n messageSetWireFormat?: (boolean | null);\n noStandardDescriptorAccessor?: (boolean | null);\n deprecated?: (boolean | null);\n mapEntry?: (boolean | null);\n uninterpretedOption?: ($wrapper.google.protobuf.UninterpretedOption[] | null);\n '.wix.api.decompositeOf'?: (string | null);\n '.wix.api.decompositionMinimumFields'?: ($wrapper.wix.api.FieldSet[] | null);\n '.wix.api.unwrapArrayValue'?: (boolean | null);\n '.wix.api.messageDeprecated'?: ($wrapper.wix.api.Deprecated | null);\n '.wix.api.unique'?: ($wrapper.wix.api.Unique[] | null);\n }\n export interface FieldOptions {\n ctype?: ($wrapper.google.protobuf.FieldOptions.CType | null);\n packed?: (boolean | null);\n jstype?: ($wrapper.google.protobuf.FieldOptions.JSType | null);\n lazy?: (boolean | null);\n deprecated?: (boolean | null);\n weak?: (boolean | null);\n uninterpretedOption?: ($wrapper.google.protobuf.UninterpretedOption[] | null);\n '.wix.api.fieldExposure'?: ($wrapper.wix.api.Exposure | null);\n '.wix.api.fieldMaturity'?: ($wrapper.wix.api.Maturity | null);\n '.wix.api.pii'?: (boolean | null);\n '.wix.api.referencedEntity'?: (string | null);\n '.wix.api.referencedEntityField'?: ($wrapper.wix.api.ReferenceEntityField | null);\n '.wix.api.fieldDeprecated'?: ($wrapper.wix.api.Deprecated | null);\n '.wix.api.translatable'?: ($wrapper.wix.api.Translatable | null);\n '.wix.api.sampleData'?: (string | null);\n '.wix.api.conditional'?: ($wrapper.wix.api.Conditional | null);\n '.wix.api.nullable'?: (boolean | null);\n '.wix.api.max'?: (number | null);\n '.wix.api.min'?: (number | null);\n '.wix.api.maxLength'?: (number | null);\n '.wix.api.minLength'?: (number | null);\n '.wix.api.exactLength'?: (number | null);\n '.wix.api.maxSize'?: (number | null);\n '.wix.api.minSize'?: (number | null);\n '.wix.api.exactSize'?: (number | null);\n '.wix.api.format'?: ($wrapper.wix.api.Format | null);\n '.wix.api.readOnly'?: (boolean | null);\n '.wix.api.immutable'?: (boolean | null);\n '.wix.api.writeOnly'?: (boolean | null);\n '.wix.api.decimalValue'?: ($wrapper.wix.api.DecimalValueOptions | null);\n '.wix.api.customValidation'?: ($wrapper.wix.api.CustomValidationError | null);\n }\n export namespace FieldOptions {\n export enum CType {\n STRING = \"STRING\",\n CORD = \"CORD\",\n STRING_PIECE = \"STRING_PIECE\",\n }\n export enum JSType {\n JS_NORMAL = \"JS_NORMAL\",\n JS_STRING = \"JS_STRING\",\n JS_NUMBER = \"JS_NUMBER\",\n }\n }\n export interface OneofOptions {\n uninterpretedOption?: ($wrapper.google.protobuf.UninterpretedOption[] | null);\n '.wix.api.alignedWithEnum'?: ($wrapper.wix.api.AlignedWithEnum | null);\n }\n export interface EnumOptions {\n allowAlias?: (boolean | null);\n deprecated?: (boolean | null);\n uninterpretedOption?: ($wrapper.google.protobuf.UninterpretedOption[] | null);\n }\n export interface EnumValueOptions {\n deprecated?: (boolean | null);\n uninterpretedOption?: ($wrapper.google.protobuf.UninterpretedOption[] | null);\n '.wix.api.enumMaturity'?: ($wrapper.wix.api.Maturity | null);\n '.wix.api.enumExposure'?: ($wrapper.wix.api.Exposure | null);\n }\n export interface ServiceOptions {\n deprecated?: (boolean | null);\n uninterpretedOption?: ($wrapper.google.protobuf.UninterpretedOption[] | null);\n '.wix.api.serviceMaturity'?: ($wrapper.wix.api.Maturity | null);\n '.wix.api.serviceExposure'?: ($wrapper.wix.api.Exposure | null);\n '.wix.api.serviceDeprecated'?: ($wrapper.wix.api.Deprecated | null);\n '.wix.api.appendixFiles'?: ($wrapper.wix.api.ServiceAppendix[] | null);\n '.wix.api.errorDef'?: ($wrapper.wix.api.Error[] | null);\n }\n export interface MethodOptions {\n deprecated?: (boolean | null);\n idempotencyLevel?: ($wrapper.google.protobuf.MethodOptions.IdempotencyLevel | null);\n uninterpretedOption?: ($wrapper.google.protobuf.UninterpretedOption[] | null);\n '.wix.api.exposure'?: ($wrapper.wix.api.Exposure | null);\n '.wix.api.maturity'?: ($wrapper.wix.api.Maturity | null);\n '.wix.api.cacheable'?: ($wrapper.wix.api.CacheSettings | null);\n '.wix.api.deprecated'?: ($wrapper.wix.api.Deprecated | null);\n '.wix.api.crud'?: ($wrapper.wix.api.Crud | null);\n '.wix.api.acceptsLinguist'?: (boolean | null);\n '.wix.api.required'?: (string[] | null);\n '.wix.api.writable'?: (string[] | null);\n '.wix.api.error'?: ($wrapper.wix.api.Error[] | null);\n '.wix.api.customValidationError'?: ($wrapper.wix.api.CustomValidationError[] | null);\n '.wix.api.inheritCrudErrors'?: ($wrapper.wix.api.InheritCrudErrors[] | null);\n '.wix.api.errorRef'?: ($wrapper.wix.api.ErrorRef[] | null);\n }\n export namespace MethodOptions {\n export enum IdempotencyLevel {\n IDEMPOTENCY_UNKNOWN = \"IDEMPOTENCY_UNKNOWN\",\n NO_SIDE_EFFECTS = \"NO_SIDE_EFFECTS\",\n IDEMPOTENT = \"IDEMPOTENT\",\n }\n }\n export interface UninterpretedOption {\n name?: ($wrapper.google.protobuf.UninterpretedOption.NamePart[] | null);\n identifierValue?: (string | null);\n positiveIntValue?: ((number | string) | null);\n negativeIntValue?: ((number | string) | null);\n doubleValue?: (number | null);\n stringValue?: (Uint8Array | null);\n aggregateValue?: (string | null);\n }\n export namespace UninterpretedOption {\n export interface NamePart {\n namePart?: (string | null);\n isExtension?: (boolean | null);\n }\n }\n export interface SourceCodeInfo {\n location?: ($wrapper.google.protobuf.SourceCodeInfo.Location[] | null);\n }\n export namespace SourceCodeInfo {\n export interface Location {\n path?: (number[] | null);\n span?: (number[] | null);\n leadingComments?: (string | null);\n trailingComments?: (string | null);\n leadingDetachedComments?: (string[] | null);\n }\n }\n export interface GeneratedCodeInfo {\n annotation?: ($wrapper.google.protobuf.GeneratedCodeInfo.Annotation[] | null);\n }\n export namespace GeneratedCodeInfo {\n export interface Annotation {\n path?: (number[] | null);\n sourceFile?: (string | null);\n begin?: (number | null);\n end?: (number | null);\n }\n }\n }\n }\n}\n\nexport default $wrapper;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.formatAddress = exports.currencyFormatterFactory = exports.createCurrencyFormatterWithDefaults = exports.Money = exports.FormattedCurrencyResult = exports.FormatAddress = exports.CreateCurrencyFormatterArgs = exports.CreateCurrencyFormatter = exports.AddressContactDetails = exports.Address = void 0;
|
|
5
|
+
var _formatter = require("./currency/formatter");
|
|
6
|
+
exports.createCurrencyFormatterWithDefaults = _formatter.createCurrencyFormatterWithDefaults;
|
|
7
|
+
exports.CreateCurrencyFormatterArgs = _formatter.CreateCurrencyFormatterArgs;
|
|
8
|
+
exports.CreateCurrencyFormatter = _formatter.CreateCurrencyFormatter;
|
|
9
|
+
exports.FormattedCurrencyResult = _formatter.FormattedCurrencyResult;
|
|
10
|
+
exports.Money = _formatter.Money;
|
|
11
|
+
var _factory = require("./currency/factory");
|
|
12
|
+
exports.currencyFormatterFactory = _factory.currencyFormatterFactory;
|
|
13
|
+
var _address = require("./address");
|
|
14
|
+
exports.formatAddress = _address.formatAddress;
|
|
15
|
+
exports.Address = _address.Address;
|
|
16
|
+
exports.AddressContactDetails = _address.AddressContactDetails;
|
|
17
|
+
exports.FormatAddress = _address.FormatAddress;
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_formatter","require","exports","createCurrencyFormatterWithDefaults","CreateCurrencyFormatterArgs","CreateCurrencyFormatter","FormattedCurrencyResult","Money","_factory","currencyFormatterFactory","_address","formatAddress","Address","AddressContactDetails","FormatAddress"],"sources":["../../src/index.ts"],"sourcesContent":["export {\n createCurrencyFormatterWithDefaults,\n CreateCurrencyFormatterArgs,\n CreateCurrencyFormatter,\n FormattedCurrencyResult,\n Money,\n} from './currency/formatter';\nexport { currencyFormatterFactory } from './currency/factory';\nexport {\n formatAddress,\n Address,\n AddressContactDetails,\n FormatAddress,\n} from './address';\n"],"mappings":";;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAM8BC,OAAA,CAAAC,mCAAA,GAAAH,UAAA,CAAAG,mCAAA;AAAAD,OAAA,CAAAE,2BAAA,GAAAJ,UAAA,CAAAI,2BAAA;AAAAF,OAAA,CAAAG,uBAAA,GAAAL,UAAA,CAAAK,uBAAA;AAAAH,OAAA,CAAAI,uBAAA,GAAAN,UAAA,CAAAM,uBAAA;AAAAJ,OAAA,CAAAK,KAAA,GAAAP,UAAA,CAAAO,KAAA;AAC9B,IAAAC,QAAA,GAAAP,OAAA;AAA8DC,OAAA,CAAAO,wBAAA,GAAAD,QAAA,CAAAC,wBAAA;AAC9D,IAAAC,QAAA,GAAAT,OAAA;AAKmBC,OAAA,CAAAS,aAAA,GAAAD,QAAA,CAAAC,aAAA;AAAAT,OAAA,CAAAU,OAAA,GAAAF,QAAA,CAAAE,OAAA;AAAAV,OAAA,CAAAW,qBAAA,GAAAH,QAAA,CAAAG,qBAAA;AAAAX,OAAA,CAAAY,aAAA,GAAAJ,QAAA,CAAAI,aAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["../../src/test-types.d.ts"],"sourcesContent":["/// <reference types=\"@wix/jest-yoshi-preset/types\" />\n"],"mappings":"AAAA","ignoreList":[]}
|