@modainteract/moda-interact-shared 0.6.2 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-TEA7Q3KY.js → chunk-B6Y3QQLI.js} +123 -2
- package/dist/chunk-B6Y3QQLI.js.map +1 -0
- package/dist/{chunk-NITMQG6P.js → chunk-JZVD5O5P.js} +2 -2
- package/dist/chunk-X7NKF3ZC.js +152 -0
- package/dist/chunk-X7NKF3ZC.js.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +60 -4
- package/dist/internationalization.d.ts +28 -1
- package/dist/internationalization.js +9 -3
- package/dist/merchant-communications/node.d.ts +7 -0
- package/dist/merchant-communications/node.js +39 -0
- package/dist/merchant-communications/node.js.map +1 -0
- package/dist/merchant-communications.d.ts +158 -0
- package/dist/merchant-communications.js +54 -0
- package/dist/merchant-communications.js.map +1 -0
- package/dist/shopify/index.js +2 -2
- package/package.json +11 -1
- package/dist/chunk-TEA7Q3KY.js.map +0 -1
- /package/dist/{chunk-NITMQG6P.js.map → chunk-JZVD5O5P.js.map} +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// src/internationalization.ts
|
|
2
2
|
import { z } from "zod";
|
|
3
|
+
import { IntlMessageFormat } from "intl-messageformat";
|
|
3
4
|
var ISO_COUNTRY_CODE_PATTERN = /^[A-Z]{2}$/;
|
|
4
5
|
var ISO_CURRENCY_CODE_PATTERN = /^[A-Z]{3}$/;
|
|
5
6
|
var ISO_3166_ALPHA_2_CODES = /* @__PURE__ */ new Set([
|
|
@@ -323,6 +324,123 @@ function mergeInternationalContext(base, override) {
|
|
|
323
324
|
timeZone: override.timeZone ?? base.timeZone
|
|
324
325
|
};
|
|
325
326
|
}
|
|
327
|
+
var DEFAULT_ICU_CACHE_SIZE = 256;
|
|
328
|
+
function assertPositiveInteger(value, name) {
|
|
329
|
+
if (!Number.isInteger(value) || value < 1) {
|
|
330
|
+
throw new RangeError(`${name} must be a positive integer`);
|
|
331
|
+
}
|
|
332
|
+
return value;
|
|
333
|
+
}
|
|
334
|
+
var BoundedMessageCache = class extends Map {
|
|
335
|
+
constructor(maxSize) {
|
|
336
|
+
super();
|
|
337
|
+
this.maxSize = maxSize;
|
|
338
|
+
}
|
|
339
|
+
maxSize;
|
|
340
|
+
get(key) {
|
|
341
|
+
const value = super.get(key);
|
|
342
|
+
if (value) {
|
|
343
|
+
super.delete(key);
|
|
344
|
+
super.set(key, value);
|
|
345
|
+
}
|
|
346
|
+
return value;
|
|
347
|
+
}
|
|
348
|
+
set(key, value) {
|
|
349
|
+
super.delete(key);
|
|
350
|
+
super.set(key, value);
|
|
351
|
+
while (this.size > this.maxSize) this.delete(this.keys().next().value);
|
|
352
|
+
return this;
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
function createMessageCache(maxSize) {
|
|
356
|
+
return new BoundedMessageCache(maxSize);
|
|
357
|
+
}
|
|
358
|
+
function resolveLocaleDirection(locale) {
|
|
359
|
+
const canonicalLocale = canonicaliseLanguageTag(locale);
|
|
360
|
+
const localeWithTextInfo = new Intl.Locale(canonicalLocale);
|
|
361
|
+
const direction = localeWithTextInfo.getTextInfo?.()?.direction ?? localeWithTextInfo.textInfo?.direction;
|
|
362
|
+
if (direction === "rtl") return "rtl";
|
|
363
|
+
if (direction === "ltr") return "ltr";
|
|
364
|
+
const rtlLanguageOrScript = /^(ar|fa|he|ur)(?:-|$)|-(?:Arab|Hebr|Nkoo|Adlm)(?:-|$)/i;
|
|
365
|
+
return rtlLanguageOrScript.test(canonicalLocale) ? "rtl" : "ltr";
|
|
366
|
+
}
|
|
367
|
+
function validateIcuCatalogue(catalogue, requiredKeys, options = {}) {
|
|
368
|
+
const locale = options.locale ? canonicaliseLanguageTag(options.locale) : "en";
|
|
369
|
+
const missingKeys = requiredKeys.filter((key) => typeof catalogue[key] !== "string");
|
|
370
|
+
if (missingKeys.length > 0) {
|
|
371
|
+
throw new Error(`Catalogue is missing required keys: ${missingKeys.join(", ")}`);
|
|
372
|
+
}
|
|
373
|
+
for (const key of requiredKeys) {
|
|
374
|
+
try {
|
|
375
|
+
new IntlMessageFormat(catalogue[key], locale);
|
|
376
|
+
} catch (error) {
|
|
377
|
+
throw new Error(`Invalid ICU message for key ${key}: ${error instanceof Error ? error.message : String(error)}`);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
function createInternationalizationRuntime({
|
|
382
|
+
locale,
|
|
383
|
+
catalogue,
|
|
384
|
+
fallbackCatalogue,
|
|
385
|
+
timeZone,
|
|
386
|
+
cacheSize = DEFAULT_ICU_CACHE_SIZE
|
|
387
|
+
}) {
|
|
388
|
+
const resolvedLocale = canonicaliseLanguageTag(locale);
|
|
389
|
+
const resolvedTimeZone = timeZone === void 0 ? void 0 : normalizeTimeZone(timeZone);
|
|
390
|
+
const maxCacheSize = assertPositiveInteger(cacheSize, "cacheSize");
|
|
391
|
+
const messageCache = createMessageCache(maxCacheSize);
|
|
392
|
+
const compile = (message) => {
|
|
393
|
+
const cached = messageCache.get(message);
|
|
394
|
+
if (cached) {
|
|
395
|
+
messageCache.delete(message);
|
|
396
|
+
messageCache.set(message, cached);
|
|
397
|
+
return cached;
|
|
398
|
+
}
|
|
399
|
+
const compiled = new IntlMessageFormat(message, resolvedLocale);
|
|
400
|
+
messageCache.set(message, compiled);
|
|
401
|
+
return compiled;
|
|
402
|
+
};
|
|
403
|
+
const formatMessage = (message, values = {}) => {
|
|
404
|
+
const formatted = compile(message).format(values);
|
|
405
|
+
return Array.isArray(formatted) ? formatted.join("") : String(formatted);
|
|
406
|
+
};
|
|
407
|
+
const t = (key, values = {}) => {
|
|
408
|
+
const message = catalogue[key] ?? fallbackCatalogue?.[key];
|
|
409
|
+
if (message === void 0) throw new Error(`Missing ICU catalogue key: ${key}`);
|
|
410
|
+
return formatMessage(message, values);
|
|
411
|
+
};
|
|
412
|
+
const formatNumber = (value, options = {}) => new Intl.NumberFormat(resolvedLocale, options).format(value);
|
|
413
|
+
const formatPercent = (value, options = {}) => {
|
|
414
|
+
const { style: _style, ...presentationOptions } = options;
|
|
415
|
+
return formatNumber(value, { ...presentationOptions, style: "percent" });
|
|
416
|
+
};
|
|
417
|
+
const formatDateTime = (value, options = {}) => {
|
|
418
|
+
const { timeZone: optionTimeZone, ...presentationOptions } = options;
|
|
419
|
+
return new Intl.DateTimeFormat(resolvedLocale, {
|
|
420
|
+
...presentationOptions,
|
|
421
|
+
timeZone: resolvedTimeZone ?? optionTimeZone
|
|
422
|
+
}).format(new Date(value));
|
|
423
|
+
};
|
|
424
|
+
const formatMoney = (value, currencyCode, options = {}) => {
|
|
425
|
+
const { style: _style, currency: _currency, ...presentationOptions } = options;
|
|
426
|
+
return formatNumber(value, {
|
|
427
|
+
...presentationOptions,
|
|
428
|
+
style: "currency",
|
|
429
|
+
currency: normalizeCurrencyCode(currencyCode)
|
|
430
|
+
});
|
|
431
|
+
};
|
|
432
|
+
return {
|
|
433
|
+
locale: resolvedLocale,
|
|
434
|
+
timeZone: resolvedTimeZone,
|
|
435
|
+
direction: resolveLocaleDirection(resolvedLocale),
|
|
436
|
+
formatMessage,
|
|
437
|
+
t,
|
|
438
|
+
formatNumber,
|
|
439
|
+
formatPercent,
|
|
440
|
+
formatDateTime,
|
|
441
|
+
formatMoney
|
|
442
|
+
};
|
|
443
|
+
}
|
|
326
444
|
|
|
327
445
|
export {
|
|
328
446
|
LanguageSourceSchema,
|
|
@@ -335,6 +453,9 @@ export {
|
|
|
335
453
|
CurrencyCodeSchema,
|
|
336
454
|
TimeZoneIdSchema,
|
|
337
455
|
InternationalContextSchema,
|
|
338
|
-
mergeInternationalContext
|
|
456
|
+
mergeInternationalContext,
|
|
457
|
+
resolveLocaleDirection,
|
|
458
|
+
validateIcuCatalogue,
|
|
459
|
+
createInternationalizationRuntime
|
|
339
460
|
};
|
|
340
|
-
//# sourceMappingURL=chunk-
|
|
461
|
+
//# sourceMappingURL=chunk-B6Y3QQLI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/internationalization.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { IntlMessageFormat, type PrimitiveType } from \"intl-messageformat\";\n\nconst ISO_COUNTRY_CODE_PATTERN = /^[A-Z]{2}$/;\nconst ISO_CURRENCY_CODE_PATTERN = /^[A-Z]{3}$/;\nconst ISO_3166_ALPHA_2_CODES = new Set([\n \"AF\", \"AL\", \"DZ\", \"AS\", \"AD\", \"AO\", \"AI\", \"AQ\", \"AG\", \"AR\", \"AM\", \"AW\", \"AU\", \"AX\", \"AT\", \"AZ\",\n \"BS\", \"BH\", \"BD\", \"BB\", \"BY\", \"BE\", \"BZ\", \"BJ\", \"BM\", \"BT\", \"BO\", \"BQ\", \"BA\", \"BW\", \"BV\", \"BR\", \"IO\", \"BN\", \"BG\", \"BF\", \"BI\", \"CV\", \"KH\", \"CM\", \"CA\", \"KY\", \"CF\", \"TD\", \"CL\", \"CN\", \"CX\", \"CC\", \"CO\", \"KM\", \"CG\", \"CD\", \"CK\", \"CR\", \"CI\", \"HR\", \"CU\", \"CW\", \"CY\", \"CZ\", \"DK\", \"DJ\", \"DM\", \"DO\", \"EC\", \"EG\", \"SV\", \"GQ\", \"ER\", \"EE\", \"SZ\", \"ET\", \"FK\", \"FO\", \"FJ\", \"FI\", \"FR\", \"GF\", \"PF\", \"TF\", \"GA\", \"GM\", \"GE\", \"DE\", \"GH\", \"GI\", \"GR\", \"GL\", \"GD\", \"GP\", \"GU\", \"GT\", \"GG\", \"GN\", \"GW\", \"GY\", \"HT\", \"HM\", \"VA\", \"HN\", \"HK\", \"HU\", \"IS\", \"IN\", \"ID\", \"IR\", \"IQ\", \"IE\", \"IM\", \"IL\", \"IT\", \"JM\", \"JP\", \"JE\", \"JO\", \"KZ\", \"KE\", \"KI\", \"KP\", \"KR\", \"KW\", \"KG\", \"LA\", \"LV\", \"LB\", \"LS\", \"LR\", \"LY\", \"LI\", \"LT\", \"LU\", \"MO\", \"MG\", \"MW\", \"MY\", \"MV\", \"ML\", \"MT\", \"MH\", \"MQ\", \"MR\", \"MU\", \"YT\", \"MX\", \"FM\", \"MD\", \"MC\", \"MN\", \"ME\", \"MS\", \"MA\", \"MZ\", \"MM\", \"NA\", \"NR\", \"NP\", \"NL\", \"NC\", \"NZ\", \"NI\", \"NE\", \"NG\", \"NU\", \"NF\", \"MK\", \"MP\", \"NO\", \"OM\", \"PK\", \"PW\", \"PS\", \"PA\", \"PG\", \"PY\", \"PE\", \"PH\", \"PN\", \"PL\", \"PT\", \"PR\", \"QA\", \"RE\", \"RO\", \"RU\", \"RW\", \"BL\", \"SH\", \"KN\", \"LC\", \"MF\", \"PM\", \"VC\", \"WS\", \"SM\", \"ST\", \"SA\", \"SN\", \"RS\", \"SC\", \"SL\", \"SG\", \"SX\", \"SK\", \"SI\", \"SB\", \"SO\", \"ZA\", \"GS\", \"SS\", \"ES\", \"LK\", \"SD\", \"SR\", \"SJ\", \"SE\", \"CH\", \"SY\", \"TW\", \"TJ\", \"TZ\", \"TH\", \"TL\", \"TG\", \"TK\", \"TO\", \"TT\", \"TN\", \"TR\", \"TM\", \"TC\", \"TV\", \"UG\", \"UA\", \"AE\", \"GB\", \"US\", \"UM\", \"UY\", \"UZ\", \"VU\", \"VE\", \"VN\", \"VG\", \"VI\", \"WF\", \"EH\", \"YE\", \"ZM\", \"ZW\",\n]);\nconst supportedCurrencies = new Set(Intl.supportedValuesOf(\"currency\"));\n\nexport const LanguageSourceSchema = z.enum([\n \"customer-explicit\",\n \"detected\",\n \"shopify\",\n \"merchant-default\",\n \"platform-default\",\n]);\n\nexport type LanguageSource = z.infer<typeof LanguageSourceSchema>;\n\nfunction invalidValue(kind: string, value: string): TypeError {\n return new TypeError(`Invalid ${kind}: ${value}`);\n}\n\nexport function canonicaliseLanguageTag(value: string): string {\n if (typeof value !== \"string\" || !value.trim()) {\n throw invalidValue(\"BCP-47 language tag\", value);\n }\n\n try {\n return new Intl.Locale(value.trim()).toString();\n } catch {\n throw invalidValue(\"BCP-47 language tag\", value);\n }\n}\n\nexport function normalizeCountryCode(value: string): string {\n if (typeof value !== \"string\") throw invalidValue(\"ISO 3166-1 alpha-2 country code\", value);\n const code = value.trim().toUpperCase();\n if (!ISO_COUNTRY_CODE_PATTERN.test(code)) {\n throw invalidValue(\"ISO 3166-1 alpha-2 country code\", value);\n }\n\n if (!ISO_3166_ALPHA_2_CODES.has(code)) {\n throw invalidValue(\"ISO 3166-1 alpha-2 country code\", value);\n }\n\n return code;\n}\n\nexport function normalizeCurrencyCode(value: string): string {\n if (typeof value !== \"string\") throw invalidValue(\"ISO 4217 currency code\", value);\n const code = value.trim().toUpperCase();\n if (!ISO_CURRENCY_CODE_PATTERN.test(code) || !supportedCurrencies.has(code)) {\n throw invalidValue(\"ISO 4217 currency code\", value);\n }\n return code;\n}\n\nexport function normalizeTimeZone(value: string): string {\n if (typeof value !== \"string\" || !value.trim()) {\n throw invalidValue(\"IANA time-zone identifier\", value);\n }\n\n try {\n return new Intl.DateTimeFormat(\"en\", { timeZone: value.trim() }).resolvedOptions().timeZone;\n } catch {\n throw invalidValue(\"IANA time-zone identifier\", value);\n }\n}\n\nexport const LanguageTagSchema = z.string().trim().transform(canonicaliseLanguageTag);\nexport const CountryCodeSchema = z.string().trim().transform(normalizeCountryCode);\nexport const CurrencyCodeSchema = z.string().trim().transform(normalizeCurrencyCode);\nexport const TimeZoneIdSchema = z.string().trim().transform(normalizeTimeZone);\n\nexport const InternationalContextSchema = z\n .object({\n languageTag: LanguageTagSchema.nullable(),\n languageSource: LanguageSourceSchema.nullable(),\n countryCode: CountryCodeSchema.nullable(),\n currencyCode: CurrencyCodeSchema.nullable(),\n timeZone: TimeZoneIdSchema.nullable(),\n })\n .strict();\n\nexport type LanguageTag = z.infer<typeof LanguageTagSchema>;\nexport type CountryCode = z.infer<typeof CountryCodeSchema>;\nexport type CurrencyCode = z.infer<typeof CurrencyCodeSchema>;\nexport type TimeZoneId = z.infer<typeof TimeZoneIdSchema>;\nexport type InternationalContext = z.infer<typeof InternationalContextSchema>;\n\nexport function mergeInternationalContext(\n base: InternationalContext,\n override: InternationalContext,\n): InternationalContext {\n return {\n languageTag: override.languageTag ?? base.languageTag,\n languageSource: override.languageSource ?? base.languageSource,\n countryCode: override.countryCode ?? base.countryCode,\n currencyCode: override.currencyCode ?? base.currencyCode,\n timeZone: override.timeZone ?? base.timeZone,\n };\n}\n\nexport type IcuMessageCatalogue = Readonly<Record<string, string>>;\nexport type IcuMessageValues = Record<string, PrimitiveType | Date | null | undefined>;\n\nexport interface CatalogueValidationOptions {\n locale?: string;\n}\n\nexport interface InternationalizationRuntimeOptions {\n locale: string;\n catalogue: IcuMessageCatalogue;\n fallbackCatalogue?: IcuMessageCatalogue;\n timeZone?: string;\n cacheSize?: number;\n}\n\nexport interface InternationalizationRuntime {\n locale: string;\n timeZone?: string;\n direction: \"ltr\" | \"rtl\";\n formatMessage(message: string, values?: IcuMessageValues): string;\n t(key: string, values?: IcuMessageValues): string;\n formatNumber(value: number, options?: Intl.NumberFormatOptions): string;\n formatPercent(value: number, options?: Intl.NumberFormatOptions): string;\n formatDateTime(value: Date | string | number, options?: Intl.DateTimeFormatOptions): string;\n formatMoney(value: number, currencyCode: string, options?: Intl.NumberFormatOptions): string;\n}\n\nconst DEFAULT_ICU_CACHE_SIZE = 256;\n\nfunction assertPositiveInteger(value: number, name: string): number {\n if (!Number.isInteger(value) || value < 1) {\n throw new RangeError(`${name} must be a positive integer`);\n }\n return value;\n}\n\nclass BoundedMessageCache extends Map<string, IntlMessageFormat> {\n constructor(private readonly maxSize: number) {\n super();\n }\n\n override get(key: string): IntlMessageFormat | undefined {\n const value = super.get(key);\n if (value) {\n super.delete(key);\n super.set(key, value);\n }\n return value;\n }\n\n override set(key: string, value: IntlMessageFormat): this {\n super.delete(key);\n super.set(key, value);\n while (this.size > this.maxSize) this.delete(this.keys().next().value as string);\n return this;\n }\n}\n\nfunction createMessageCache(maxSize: number): BoundedMessageCache {\n return new BoundedMessageCache(maxSize);\n}\n\nexport function resolveLocaleDirection(locale: string): \"ltr\" | \"rtl\" {\n const canonicalLocale = canonicaliseLanguageTag(locale);\n const localeWithTextInfo = new Intl.Locale(canonicalLocale) as Intl.Locale & {\n getTextInfo?: () => { direction?: \"ltr\" | \"rtl\" };\n textInfo?: { direction?: \"ltr\" | \"rtl\" };\n };\n const direction = localeWithTextInfo.getTextInfo?.()?.direction ?? localeWithTextInfo.textInfo?.direction;\n if (direction === \"rtl\") return \"rtl\";\n if (direction === \"ltr\") return \"ltr\";\n\n const rtlLanguageOrScript = /^(ar|fa|he|ur)(?:-|$)|-(?:Arab|Hebr|Nkoo|Adlm)(?:-|$)/i;\n return rtlLanguageOrScript.test(canonicalLocale) ? \"rtl\" : \"ltr\";\n}\n\nexport function validateIcuCatalogue(\n catalogue: IcuMessageCatalogue,\n requiredKeys: readonly string[],\n options: CatalogueValidationOptions = {},\n): void {\n const locale = options.locale ? canonicaliseLanguageTag(options.locale) : \"en\";\n const missingKeys = requiredKeys.filter((key) => typeof catalogue[key] !== \"string\");\n if (missingKeys.length > 0) {\n throw new Error(`Catalogue is missing required keys: ${missingKeys.join(\", \")}`);\n }\n\n for (const key of requiredKeys) {\n try {\n new IntlMessageFormat(catalogue[key], locale);\n } catch (error) {\n throw new Error(`Invalid ICU message for key ${key}: ${error instanceof Error ? error.message : String(error)}`);\n }\n }\n}\n\nexport function createInternationalizationRuntime({\n locale,\n catalogue,\n fallbackCatalogue,\n timeZone,\n cacheSize = DEFAULT_ICU_CACHE_SIZE,\n}: InternationalizationRuntimeOptions): InternationalizationRuntime {\n const resolvedLocale = canonicaliseLanguageTag(locale);\n const resolvedTimeZone = timeZone === undefined ? undefined : normalizeTimeZone(timeZone);\n const maxCacheSize = assertPositiveInteger(cacheSize, \"cacheSize\");\n const messageCache = createMessageCache(maxCacheSize);\n\n const compile = (message: string): IntlMessageFormat => {\n const cached = messageCache.get(message);\n if (cached) {\n messageCache.delete(message);\n messageCache.set(message, cached);\n return cached;\n }\n const compiled = new IntlMessageFormat(message, resolvedLocale);\n messageCache.set(message, compiled);\n return compiled;\n };\n\n const formatMessage = (message: string, values: IcuMessageValues = {}): string => {\n const formatted = compile(message).format(values);\n return Array.isArray(formatted) ? formatted.join(\"\") : String(formatted);\n };\n\n const t = (key: string, values: IcuMessageValues = {}): string => {\n const message = catalogue[key] ?? fallbackCatalogue?.[key];\n if (message === undefined) throw new Error(`Missing ICU catalogue key: ${key}`);\n return formatMessage(message, values);\n };\n\n const formatNumber = (value: number, options: Intl.NumberFormatOptions = {}): string =>\n new Intl.NumberFormat(resolvedLocale, options).format(value);\n\n const formatPercent = (value: number, options: Intl.NumberFormatOptions = {}): string => {\n const { style: _style, ...presentationOptions } = options;\n return formatNumber(value, { ...presentationOptions, style: \"percent\" });\n };\n\n const formatDateTime = (value: Date | string | number, options: Intl.DateTimeFormatOptions = {}): string => {\n const { timeZone: optionTimeZone, ...presentationOptions } = options;\n return new Intl.DateTimeFormat(resolvedLocale, {\n ...presentationOptions,\n timeZone: resolvedTimeZone ?? optionTimeZone,\n }).format(new Date(value));\n };\n\n const formatMoney = (value: number, currencyCode: string, options: Intl.NumberFormatOptions = {}): string => {\n const { style: _style, currency: _currency, ...presentationOptions } = options;\n return formatNumber(value, {\n ...presentationOptions,\n style: \"currency\",\n currency: normalizeCurrencyCode(currencyCode),\n });\n };\n\n return {\n locale: resolvedLocale,\n timeZone: resolvedTimeZone,\n direction: resolveLocaleDirection(resolvedLocale),\n formatMessage,\n t,\n formatNumber,\n formatPercent,\n formatDateTime,\n formatMoney,\n };\n}"],"mappings":";AAAA,SAAS,SAAS;AAClB,SAAS,yBAA6C;AAEtD,IAAM,2BAA2B;AACjC,IAAM,4BAA4B;AAClC,IAAM,yBAAyB,oBAAI,IAAI;AAAA,EACrC;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,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OPIFY_COMMERCE_EVENT_SCHEMA_VERSION_V1 = 1;
|
|
@@ -342,4 +342,4 @@ export {
|
|
|
342
342
|
createShopifyOrderCorrelationOrderingKey,
|
|
343
343
|
SHOPIFY_WEBHOOK_QUEUE_CONTRACTS
|
|
344
344
|
};
|
|
345
|
-
//# sourceMappingURL=chunk-
|
|
345
|
+
//# sourceMappingURL=chunk-JZVD5O5P.js.map
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LanguageTagSchema,
|
|
3
|
+
canonicaliseLanguageTag
|
|
4
|
+
} from "./chunk-B6Y3QQLI.js";
|
|
5
|
+
|
|
6
|
+
// src/merchant-communications.ts
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
var PLATFORM_SUPPORT_LANGUAGE_TAG = "en-GB";
|
|
9
|
+
var MERCHANT_COMMUNICATIONS_QUEUE_NAME = "merchant-communications";
|
|
10
|
+
var MERCHANT_COMMUNICATIONS_SCHEMA_VERSION = 1;
|
|
11
|
+
var MerchantSupportMessageKindSchema = z.enum([
|
|
12
|
+
"ADMINISTRATIVE",
|
|
13
|
+
"SYSTEM",
|
|
14
|
+
"MERCHANT"
|
|
15
|
+
]);
|
|
16
|
+
var MerchantSupportMessageStateSchema = z.enum([
|
|
17
|
+
"PROCESSING",
|
|
18
|
+
"AVAILABLE",
|
|
19
|
+
"FAILED"
|
|
20
|
+
]);
|
|
21
|
+
var MerchantTranslationDirectionSchema = z.enum([
|
|
22
|
+
"MERCHANT_TO_ADMIN",
|
|
23
|
+
"ADMIN_TO_MERCHANT",
|
|
24
|
+
"SYSTEM_TO_MERCHANT"
|
|
25
|
+
]);
|
|
26
|
+
var MerchantMessageTranslationStatusSchema = z.enum([
|
|
27
|
+
"PENDING",
|
|
28
|
+
"AVAILABLE",
|
|
29
|
+
"FAILED"
|
|
30
|
+
]);
|
|
31
|
+
var MerchantTranslationBatchStatusSchema = z.enum([
|
|
32
|
+
"READY",
|
|
33
|
+
"SUBMITTING",
|
|
34
|
+
"SUBMISSION_UNKNOWN",
|
|
35
|
+
"SUBMITTED",
|
|
36
|
+
"PROVIDER_COMPLETED",
|
|
37
|
+
"COMPLETED",
|
|
38
|
+
"FAILED",
|
|
39
|
+
"EXPIRED",
|
|
40
|
+
"CANCELLED"
|
|
41
|
+
]);
|
|
42
|
+
var MerchantTranslationReconciliationScopeSchema = z.enum([
|
|
43
|
+
"TRANSLATION",
|
|
44
|
+
"FAILED_TRANSLATIONS"
|
|
45
|
+
]);
|
|
46
|
+
var MerchantTranslationReconciliationStatusSchema = z.enum([
|
|
47
|
+
"PENDING",
|
|
48
|
+
"PROCESSING",
|
|
49
|
+
"COMPLETED",
|
|
50
|
+
"FAILED"
|
|
51
|
+
]);
|
|
52
|
+
var graphemeSegmenter = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
53
|
+
function countUnicodeGraphemes(value) {
|
|
54
|
+
return Array.from(graphemeSegmenter.segment(value)).length;
|
|
55
|
+
}
|
|
56
|
+
var AuthoredSupportBodySchema = z.string().refine(
|
|
57
|
+
(value) => {
|
|
58
|
+
const graphemeCount = countUnicodeGraphemes(value);
|
|
59
|
+
return graphemeCount >= 1 && graphemeCount <= 500;
|
|
60
|
+
},
|
|
61
|
+
"Support body must contain 1 to 500 user-perceived characters"
|
|
62
|
+
);
|
|
63
|
+
var TranslatedSupportBodySchema = z.string();
|
|
64
|
+
var MerchantSupportMessageContractSchema = z.object({
|
|
65
|
+
kind: MerchantSupportMessageKindSchema,
|
|
66
|
+
state: MerchantSupportMessageStateSchema,
|
|
67
|
+
originalBody: AuthoredSupportBodySchema,
|
|
68
|
+
sourceLanguageTag: LanguageTagSchema,
|
|
69
|
+
displayLanguageTag: LanguageTagSchema.nullable()
|
|
70
|
+
}).strict();
|
|
71
|
+
var MerchantMessageTranslationContractSchema = z.object({
|
|
72
|
+
direction: MerchantTranslationDirectionSchema,
|
|
73
|
+
sourceLanguageTag: LanguageTagSchema,
|
|
74
|
+
targetLanguageTag: LanguageTagSchema,
|
|
75
|
+
status: MerchantMessageTranslationStatusSchema,
|
|
76
|
+
translatedBody: TranslatedSupportBodySchema.nullable()
|
|
77
|
+
}).strict();
|
|
78
|
+
var MerchantTranslationBatchContractSchema = z.object({
|
|
79
|
+
provider: z.string().min(1),
|
|
80
|
+
model: z.string().min(1),
|
|
81
|
+
status: MerchantTranslationBatchStatusSchema,
|
|
82
|
+
providerBatchId: z.string().min(1).nullable(),
|
|
83
|
+
inputFileId: z.string().min(1).nullable(),
|
|
84
|
+
outputFileId: z.string().min(1).nullable(),
|
|
85
|
+
errorFileId: z.string().min(1).nullable()
|
|
86
|
+
}).strict();
|
|
87
|
+
var MerchantTranslationReconciliationRequestContractSchema = z.object({
|
|
88
|
+
scope: MerchantTranslationReconciliationScopeSchema,
|
|
89
|
+
translationId: z.string().min(1).nullable(),
|
|
90
|
+
status: MerchantTranslationReconciliationStatusSchema
|
|
91
|
+
}).strict();
|
|
92
|
+
function requiresMerchantTranslation(sourceLanguageTag, targetLanguageTag) {
|
|
93
|
+
const sourceLanguage = new Intl.Locale(canonicaliseLanguageTag(sourceLanguageTag)).language;
|
|
94
|
+
const targetLanguage = new Intl.Locale(canonicaliseLanguageTag(targetLanguageTag)).language;
|
|
95
|
+
return sourceLanguage !== targetLanguage;
|
|
96
|
+
}
|
|
97
|
+
var TranslationDispatchJobSchema = z.object({
|
|
98
|
+
schemaVersion: z.literal(MERCHANT_COMMUNICATIONS_SCHEMA_VERSION),
|
|
99
|
+
translationId: z.string().min(1)
|
|
100
|
+
}).strict();
|
|
101
|
+
var TranslationBatchSubmitJobSchema = z.object({
|
|
102
|
+
schemaVersion: z.literal(MERCHANT_COMMUNICATIONS_SCHEMA_VERSION),
|
|
103
|
+
translationBatchId: z.string().min(1)
|
|
104
|
+
}).strict();
|
|
105
|
+
var TranslationBatchPollJobSchema = z.object({
|
|
106
|
+
schemaVersion: z.literal(MERCHANT_COMMUNICATIONS_SCHEMA_VERSION),
|
|
107
|
+
translationBatchId: z.string().min(1),
|
|
108
|
+
pollSequence: z.number().int().nonnegative()
|
|
109
|
+
}).strict();
|
|
110
|
+
var TranslationBatchResultsJobSchema = z.object({
|
|
111
|
+
schemaVersion: z.literal(MERCHANT_COMMUNICATIONS_SCHEMA_VERSION),
|
|
112
|
+
translationBatchId: z.string().min(1)
|
|
113
|
+
}).strict();
|
|
114
|
+
var TranslationReconcileJobSchema = z.object({
|
|
115
|
+
schemaVersion: z.literal(MERCHANT_COMMUNICATIONS_SCHEMA_VERSION),
|
|
116
|
+
reconciliationRequestId: z.string().min(1).optional()
|
|
117
|
+
}).strict();
|
|
118
|
+
var MERCHANT_COMMUNICATIONS_JOB_NAMES = {
|
|
119
|
+
TRANSLATION_DISPATCH: "translation-dispatch",
|
|
120
|
+
TRANSLATION_BATCH_SUBMIT: "translation-batch-submit",
|
|
121
|
+
TRANSLATION_BATCH_POLL: "translation-batch-poll",
|
|
122
|
+
TRANSLATION_BATCH_RESULTS: "translation-batch-results",
|
|
123
|
+
TRANSLATION_RECONCILE: "translation-reconcile"
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export {
|
|
127
|
+
PLATFORM_SUPPORT_LANGUAGE_TAG,
|
|
128
|
+
MERCHANT_COMMUNICATIONS_QUEUE_NAME,
|
|
129
|
+
MERCHANT_COMMUNICATIONS_SCHEMA_VERSION,
|
|
130
|
+
MerchantSupportMessageKindSchema,
|
|
131
|
+
MerchantSupportMessageStateSchema,
|
|
132
|
+
MerchantTranslationDirectionSchema,
|
|
133
|
+
MerchantMessageTranslationStatusSchema,
|
|
134
|
+
MerchantTranslationBatchStatusSchema,
|
|
135
|
+
MerchantTranslationReconciliationScopeSchema,
|
|
136
|
+
MerchantTranslationReconciliationStatusSchema,
|
|
137
|
+
countUnicodeGraphemes,
|
|
138
|
+
AuthoredSupportBodySchema,
|
|
139
|
+
TranslatedSupportBodySchema,
|
|
140
|
+
MerchantSupportMessageContractSchema,
|
|
141
|
+
MerchantMessageTranslationContractSchema,
|
|
142
|
+
MerchantTranslationBatchContractSchema,
|
|
143
|
+
MerchantTranslationReconciliationRequestContractSchema,
|
|
144
|
+
requiresMerchantTranslation,
|
|
145
|
+
TranslationDispatchJobSchema,
|
|
146
|
+
TranslationBatchSubmitJobSchema,
|
|
147
|
+
TranslationBatchPollJobSchema,
|
|
148
|
+
TranslationBatchResultsJobSchema,
|
|
149
|
+
TranslationReconcileJobSchema,
|
|
150
|
+
MERCHANT_COMMUNICATIONS_JOB_NAMES
|
|
151
|
+
};
|
|
152
|
+
//# sourceMappingURL=chunk-X7NKF3ZC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/merchant-communications.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { LanguageTagSchema, canonicaliseLanguageTag } from \"./internationalization.js\";\n\nexport const PLATFORM_SUPPORT_LANGUAGE_TAG = \"en-GB\" as const;\nexport const MERCHANT_COMMUNICATIONS_QUEUE_NAME = \"merchant-communications\" as const;\nexport const MERCHANT_COMMUNICATIONS_SCHEMA_VERSION = 1 as const;\n\nexport const MerchantSupportMessageKindSchema = z.enum([\n \"ADMINISTRATIVE\",\n \"SYSTEM\",\n \"MERCHANT\",\n]);\n\nexport const MerchantSupportMessageStateSchema = z.enum([\n \"PROCESSING\",\n \"AVAILABLE\",\n \"FAILED\",\n]);\n\nexport const MerchantTranslationDirectionSchema = z.enum([\n \"MERCHANT_TO_ADMIN\",\n \"ADMIN_TO_MERCHANT\",\n \"SYSTEM_TO_MERCHANT\",\n]);\n\nexport const MerchantMessageTranslationStatusSchema = z.enum([\n \"PENDING\",\n \"AVAILABLE\",\n \"FAILED\",\n]);\n\nexport const MerchantTranslationBatchStatusSchema = z.enum([\n \"READY\",\n \"SUBMITTING\",\n \"SUBMISSION_UNKNOWN\",\n \"SUBMITTED\",\n \"PROVIDER_COMPLETED\",\n \"COMPLETED\",\n \"FAILED\",\n \"EXPIRED\",\n \"CANCELLED\",\n]);\n\nexport const MerchantTranslationReconciliationScopeSchema = z.enum([\n \"TRANSLATION\",\n \"FAILED_TRANSLATIONS\",\n]);\n\nexport const MerchantTranslationReconciliationStatusSchema = z.enum([\n \"PENDING\",\n \"PROCESSING\",\n \"COMPLETED\",\n \"FAILED\",\n]);\n\nexport type MerchantSupportMessageKind = z.infer<typeof MerchantSupportMessageKindSchema>;\nexport type MerchantSupportMessageState = z.infer<typeof MerchantSupportMessageStateSchema>;\nexport type MerchantTranslationDirection = z.infer<typeof MerchantTranslationDirectionSchema>;\nexport type MerchantMessageTranslationStatus = z.infer<typeof MerchantMessageTranslationStatusSchema>;\nexport type MerchantTranslationBatchStatus = z.infer<typeof MerchantTranslationBatchStatusSchema>;\nexport type MerchantTranslationReconciliationScope = z.infer<\n typeof MerchantTranslationReconciliationScopeSchema\n>;\nexport type MerchantTranslationReconciliationStatus = z.infer<\n typeof MerchantTranslationReconciliationStatusSchema\n>;\n\nconst graphemeSegmenter = new Intl.Segmenter(undefined, { granularity: \"grapheme\" });\n\nexport function countUnicodeGraphemes(value: string): number {\n return Array.from(graphemeSegmenter.segment(value)).length;\n}\n\nexport const AuthoredSupportBodySchema = z.string().refine(\n (value) => {\n const graphemeCount = countUnicodeGraphemes(value);\n return graphemeCount >= 1 && graphemeCount <= 500;\n },\n \"Support body must contain 1 to 500 user-perceived characters\",\n);\n\nexport const TranslatedSupportBodySchema = z.string();\n\nexport const MerchantSupportMessageContractSchema = z\n .object({\n kind: MerchantSupportMessageKindSchema,\n state: MerchantSupportMessageStateSchema,\n originalBody: AuthoredSupportBodySchema,\n sourceLanguageTag: LanguageTagSchema,\n displayLanguageTag: LanguageTagSchema.nullable(),\n })\n .strict();\n\nexport const MerchantMessageTranslationContractSchema = z\n .object({\n direction: MerchantTranslationDirectionSchema,\n sourceLanguageTag: LanguageTagSchema,\n targetLanguageTag: LanguageTagSchema,\n status: MerchantMessageTranslationStatusSchema,\n translatedBody: TranslatedSupportBodySchema.nullable(),\n })\n .strict();\n\nexport const MerchantTranslationBatchContractSchema = z\n .object({\n provider: z.string().min(1),\n model: z.string().min(1),\n status: MerchantTranslationBatchStatusSchema,\n providerBatchId: z.string().min(1).nullable(),\n inputFileId: z.string().min(1).nullable(),\n outputFileId: z.string().min(1).nullable(),\n errorFileId: z.string().min(1).nullable(),\n })\n .strict();\n\nexport const MerchantTranslationReconciliationRequestContractSchema = z\n .object({\n scope: MerchantTranslationReconciliationScopeSchema,\n translationId: z.string().min(1).nullable(),\n status: MerchantTranslationReconciliationStatusSchema,\n })\n .strict();\n\nexport type MerchantSupportMessageContract = z.infer<typeof MerchantSupportMessageContractSchema>;\nexport type MerchantMessageTranslationContract = z.infer<\n typeof MerchantMessageTranslationContractSchema\n>;\nexport type MerchantTranslationBatchContract = z.infer<typeof MerchantTranslationBatchContractSchema>;\nexport type MerchantTranslationReconciliationRequestContract = z.infer<\n typeof MerchantTranslationReconciliationRequestContractSchema\n>;\n\nexport function requiresMerchantTranslation(\n sourceLanguageTag: string,\n targetLanguageTag: string,\n): boolean {\n const sourceLanguage = new Intl.Locale(canonicaliseLanguageTag(sourceLanguageTag)).language;\n const targetLanguage = new Intl.Locale(canonicaliseLanguageTag(targetLanguageTag)).language;\n return sourceLanguage !== targetLanguage;\n}\n\nexport const TranslationDispatchJobSchema = z\n .object({\n schemaVersion: z.literal(MERCHANT_COMMUNICATIONS_SCHEMA_VERSION),\n translationId: z.string().min(1),\n })\n .strict();\n\nexport const TranslationBatchSubmitJobSchema = z\n .object({\n schemaVersion: z.literal(MERCHANT_COMMUNICATIONS_SCHEMA_VERSION),\n translationBatchId: z.string().min(1),\n })\n .strict();\n\nexport const TranslationBatchPollJobSchema = z\n .object({\n schemaVersion: z.literal(MERCHANT_COMMUNICATIONS_SCHEMA_VERSION),\n translationBatchId: z.string().min(1),\n pollSequence: z.number().int().nonnegative(),\n })\n .strict();\n\nexport const TranslationBatchResultsJobSchema = z\n .object({\n schemaVersion: z.literal(MERCHANT_COMMUNICATIONS_SCHEMA_VERSION),\n translationBatchId: z.string().min(1),\n })\n .strict();\n\nexport const TranslationReconcileJobSchema = z\n .object({\n schemaVersion: z.literal(MERCHANT_COMMUNICATIONS_SCHEMA_VERSION),\n reconciliationRequestId: z.string().min(1).optional(),\n })\n .strict();\n\nexport const MERCHANT_COMMUNICATIONS_JOB_NAMES = {\n TRANSLATION_DISPATCH: \"translation-dispatch\",\n TRANSLATION_BATCH_SUBMIT: \"translation-batch-submit\",\n TRANSLATION_BATCH_POLL: \"translation-batch-poll\",\n TRANSLATION_BATCH_RESULTS: \"translation-batch-results\",\n TRANSLATION_RECONCILE: \"translation-reconcile\",\n} as const;\n\nexport type TranslationDispatchJob = z.infer<typeof TranslationDispatchJobSchema>;\nexport type TranslationBatchSubmitJob = z.infer<typeof TranslationBatchSubmitJobSchema>;\nexport type TranslationBatchPollJob = z.infer<typeof TranslationBatchPollJobSchema>;\nexport type TranslationBatchResultsJob = z.infer<typeof TranslationBatchResultsJobSchema>;\nexport type TranslationReconcileJob = z.infer<typeof TranslationReconcileJobSchema>;"],"mappings":";;;;;;AAAA,SAAS,SAAS;AAGX,IAAM,gCAAgC;AACtC,IAAM,qCAAqC;AAC3C,IAAM,yCAAyC;AAE/C,IAAM,mCAAmC,EAAE,KAAK;AAAA,EACrD;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEM,IAAM,oCAAoC,EAAE,KAAK;AAAA,EACtD;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEM,IAAM,qCAAqC,EAAE,KAAK;AAAA,EACvD;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEM,IAAM,yCAAyC,EAAE,KAAK;AAAA,EAC3D;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEM,IAAM,uCAAuC,EAAE,KAAK;AAAA,EACzD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEM,IAAM,+CAA+C,EAAE,KAAK;AAAA,EACjE;AAAA,EACA;AACF,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[]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
export { CountryCode, CountryCodeSchema, CurrencyCode, CurrencyCodeSchema, InternationalContext, InternationalContextSchema, LanguageSource, LanguageSourceSchema, LanguageTag, LanguageTagSchema, TimeZoneId, TimeZoneIdSchema, canonicaliseLanguageTag, mergeInternationalContext, normalizeCountryCode, normalizeCurrencyCode, normalizeTimeZone } from './internationalization.js';
|
|
1
|
+
export { CatalogueValidationOptions, CountryCode, CountryCodeSchema, CurrencyCode, CurrencyCodeSchema, IcuMessageCatalogue, IcuMessageValues, InternationalContext, InternationalContextSchema, InternationalizationRuntime, InternationalizationRuntimeOptions, LanguageSource, LanguageSourceSchema, LanguageTag, LanguageTagSchema, TimeZoneId, TimeZoneIdSchema, canonicaliseLanguageTag, createInternationalizationRuntime, mergeInternationalContext, normalizeCountryCode, normalizeCurrencyCode, normalizeTimeZone, resolveLocaleDirection, validateIcuCatalogue } from './internationalization.js';
|
|
2
|
+
export { AuthoredSupportBodySchema, MERCHANT_COMMUNICATIONS_JOB_NAMES, MERCHANT_COMMUNICATIONS_QUEUE_NAME, MERCHANT_COMMUNICATIONS_SCHEMA_VERSION, MerchantMessageTranslationContract, MerchantMessageTranslationContractSchema, MerchantMessageTranslationStatus, MerchantMessageTranslationStatusSchema, MerchantSupportMessageContract, MerchantSupportMessageContractSchema, MerchantSupportMessageKind, MerchantSupportMessageKindSchema, MerchantSupportMessageState, MerchantSupportMessageStateSchema, MerchantTranslationBatchContract, MerchantTranslationBatchContractSchema, MerchantTranslationBatchStatus, MerchantTranslationBatchStatusSchema, MerchantTranslationDirection, MerchantTranslationDirectionSchema, MerchantTranslationReconciliationRequestContract, MerchantTranslationReconciliationRequestContractSchema, MerchantTranslationReconciliationScope, MerchantTranslationReconciliationScopeSchema, MerchantTranslationReconciliationStatus, MerchantTranslationReconciliationStatusSchema, PLATFORM_SUPPORT_LANGUAGE_TAG, TranslatedSupportBodySchema, TranslationBatchPollJob, TranslationBatchPollJobSchema, TranslationBatchResultsJob, TranslationBatchResultsJobSchema, TranslationBatchSubmitJob, TranslationBatchSubmitJobSchema, TranslationDispatchJob, TranslationDispatchJobSchema, TranslationReconcileJob, TranslationReconcileJobSchema, countUnicodeGraphemes, requiresMerchantTranslation } from './merchant-communications.js';
|
|
2
3
|
export { CheckoutCreatedPayloadV2, CheckoutCreatedPayloadV2Schema, CheckoutObservedPayload, CheckoutObservedPayloadSchema, CheckoutUpdatedPayloadV2, CheckoutUpdatedPayloadV2Schema, MAX_LINE_ITEMS, MAX_URL_LENGTH, OrderCompletedPayload, OrderCompletedPayloadSchema, OrderCompletedPayloadV2, OrderCompletedPayloadV2Schema, SHOPIFY_COMMERCE_EVENT_SCHEMA_VERSION, SHOPIFY_COMMERCE_EVENT_SCHEMA_VERSION_V1, SHOPIFY_COMMERCE_EVENT_SCHEMA_VERSION_V2, SHOPIFY_COMMERCE_EVENT_TYPES, SHOPIFY_RECOVERY_EVENT_TYPES_V2, SHOPIFY_WEBHOOK_OUTBOX_DESTINATIONS, SHOPIFY_WEBHOOK_QUEUE_CONTRACTS, ShopifyCartActivityEventV2, ShopifyCartActivityEventV2Schema, ShopifyCartActivityPayloadV2, ShopifyCartActivityPayloadV2Schema, ShopifyCheckoutCreatedEventV2, ShopifyCheckoutCreatedEventV2Schema, ShopifyCheckoutLineItem, ShopifyCheckoutLineItemSchema, ShopifyCheckoutLineItemsSchema, ShopifyCheckoutObservedEvent, ShopifyCheckoutObservedEventSchema, ShopifyCheckoutUpdatedEventV2, ShopifyCheckoutUpdatedEventV2Schema, ShopifyCommerceEvent, ShopifyCommerceEventSchema, ShopifyCommerceEventType, ShopifyCustomerReference, ShopifyCustomerReferenceSchema, ShopifyMoney, ShopifyMoneySchema, ShopifyOrderCompletedEvent, ShopifyOrderCompletedEventSchema, ShopifyOrderCompletedEventV2, ShopifyOrderCompletedEventV2Schema, ShopifyRecoveryEventTypeV2, ShopifyRecoveryEventV2, ShopifyRecoveryEventV2Schema, ShopifyTenant, ShopifyTenantSchema, createShopifyCartActivityOrderingKey, createShopifyCommerceOrderingKey, createShopifyOrderCorrelationOrderingKey, createShopifyOrderOrderingKey, createShopifyPendingRecoveryOrderingKey, isCartActivityEventV2, isCheckoutCreatedEventV2, isCheckoutObservedEvent, isCheckoutUpdatedEventV2, isOrderCompletedEvent, isOrderCompletedEventV2, parseShopifyCommerceEvent, parseShopifyRecoveryEventV2, safeParseShopifyCommerceEvent, safeParseShopifyRecoveryEventV2 } from './shopify/index.js';
|
|
3
4
|
import 'zod';
|
|
5
|
+
import 'intl-messageformat';
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AuthoredSupportBodySchema,
|
|
3
|
+
MERCHANT_COMMUNICATIONS_JOB_NAMES,
|
|
4
|
+
MERCHANT_COMMUNICATIONS_QUEUE_NAME,
|
|
5
|
+
MERCHANT_COMMUNICATIONS_SCHEMA_VERSION,
|
|
6
|
+
MerchantMessageTranslationContractSchema,
|
|
7
|
+
MerchantMessageTranslationStatusSchema,
|
|
8
|
+
MerchantSupportMessageContractSchema,
|
|
9
|
+
MerchantSupportMessageKindSchema,
|
|
10
|
+
MerchantSupportMessageStateSchema,
|
|
11
|
+
MerchantTranslationBatchContractSchema,
|
|
12
|
+
MerchantTranslationBatchStatusSchema,
|
|
13
|
+
MerchantTranslationDirectionSchema,
|
|
14
|
+
MerchantTranslationReconciliationRequestContractSchema,
|
|
15
|
+
MerchantTranslationReconciliationScopeSchema,
|
|
16
|
+
MerchantTranslationReconciliationStatusSchema,
|
|
17
|
+
PLATFORM_SUPPORT_LANGUAGE_TAG,
|
|
18
|
+
TranslatedSupportBodySchema,
|
|
19
|
+
TranslationBatchPollJobSchema,
|
|
20
|
+
TranslationBatchResultsJobSchema,
|
|
21
|
+
TranslationBatchSubmitJobSchema,
|
|
22
|
+
TranslationDispatchJobSchema,
|
|
23
|
+
TranslationReconcileJobSchema,
|
|
24
|
+
countUnicodeGraphemes,
|
|
25
|
+
requiresMerchantTranslation
|
|
26
|
+
} from "./chunk-X7NKF3ZC.js";
|
|
1
27
|
import {
|
|
2
28
|
CheckoutCreatedPayloadV2Schema,
|
|
3
29
|
CheckoutObservedPayloadSchema,
|
|
@@ -42,7 +68,7 @@ import {
|
|
|
42
68
|
parseShopifyRecoveryEventV2,
|
|
43
69
|
safeParseShopifyCommerceEvent,
|
|
44
70
|
safeParseShopifyRecoveryEventV2
|
|
45
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-JZVD5O5P.js";
|
|
46
72
|
import {
|
|
47
73
|
CountryCodeSchema,
|
|
48
74
|
CurrencyCodeSchema,
|
|
@@ -51,12 +77,16 @@ import {
|
|
|
51
77
|
LanguageTagSchema,
|
|
52
78
|
TimeZoneIdSchema,
|
|
53
79
|
canonicaliseLanguageTag,
|
|
80
|
+
createInternationalizationRuntime,
|
|
54
81
|
mergeInternationalContext,
|
|
55
82
|
normalizeCountryCode,
|
|
56
83
|
normalizeCurrencyCode,
|
|
57
|
-
normalizeTimeZone
|
|
58
|
-
|
|
84
|
+
normalizeTimeZone,
|
|
85
|
+
resolveLocaleDirection,
|
|
86
|
+
validateIcuCatalogue
|
|
87
|
+
} from "./chunk-B6Y3QQLI.js";
|
|
59
88
|
export {
|
|
89
|
+
AuthoredSupportBodySchema,
|
|
60
90
|
CheckoutCreatedPayloadV2Schema,
|
|
61
91
|
CheckoutObservedPayloadSchema,
|
|
62
92
|
CheckoutUpdatedPayloadV2Schema,
|
|
@@ -67,8 +97,23 @@ export {
|
|
|
67
97
|
LanguageTagSchema,
|
|
68
98
|
MAX_LINE_ITEMS,
|
|
69
99
|
MAX_URL_LENGTH,
|
|
100
|
+
MERCHANT_COMMUNICATIONS_JOB_NAMES,
|
|
101
|
+
MERCHANT_COMMUNICATIONS_QUEUE_NAME,
|
|
102
|
+
MERCHANT_COMMUNICATIONS_SCHEMA_VERSION,
|
|
103
|
+
MerchantMessageTranslationContractSchema,
|
|
104
|
+
MerchantMessageTranslationStatusSchema,
|
|
105
|
+
MerchantSupportMessageContractSchema,
|
|
106
|
+
MerchantSupportMessageKindSchema,
|
|
107
|
+
MerchantSupportMessageStateSchema,
|
|
108
|
+
MerchantTranslationBatchContractSchema,
|
|
109
|
+
MerchantTranslationBatchStatusSchema,
|
|
110
|
+
MerchantTranslationDirectionSchema,
|
|
111
|
+
MerchantTranslationReconciliationRequestContractSchema,
|
|
112
|
+
MerchantTranslationReconciliationScopeSchema,
|
|
113
|
+
MerchantTranslationReconciliationStatusSchema,
|
|
70
114
|
OrderCompletedPayloadSchema,
|
|
71
115
|
OrderCompletedPayloadV2Schema,
|
|
116
|
+
PLATFORM_SUPPORT_LANGUAGE_TAG,
|
|
72
117
|
SHOPIFY_COMMERCE_EVENT_SCHEMA_VERSION,
|
|
73
118
|
SHOPIFY_COMMERCE_EVENT_SCHEMA_VERSION_V1,
|
|
74
119
|
SHOPIFY_COMMERCE_EVENT_SCHEMA_VERSION_V2,
|
|
@@ -91,7 +136,15 @@ export {
|
|
|
91
136
|
ShopifyRecoveryEventV2Schema,
|
|
92
137
|
ShopifyTenantSchema,
|
|
93
138
|
TimeZoneIdSchema,
|
|
139
|
+
TranslatedSupportBodySchema,
|
|
140
|
+
TranslationBatchPollJobSchema,
|
|
141
|
+
TranslationBatchResultsJobSchema,
|
|
142
|
+
TranslationBatchSubmitJobSchema,
|
|
143
|
+
TranslationDispatchJobSchema,
|
|
144
|
+
TranslationReconcileJobSchema,
|
|
94
145
|
canonicaliseLanguageTag,
|
|
146
|
+
countUnicodeGraphemes,
|
|
147
|
+
createInternationalizationRuntime,
|
|
95
148
|
createShopifyCartActivityOrderingKey,
|
|
96
149
|
createShopifyCommerceOrderingKey,
|
|
97
150
|
createShopifyOrderCorrelationOrderingKey,
|
|
@@ -109,7 +162,10 @@ export {
|
|
|
109
162
|
normalizeTimeZone,
|
|
110
163
|
parseShopifyCommerceEvent,
|
|
111
164
|
parseShopifyRecoveryEventV2,
|
|
165
|
+
requiresMerchantTranslation,
|
|
166
|
+
resolveLocaleDirection,
|
|
112
167
|
safeParseShopifyCommerceEvent,
|
|
113
|
-
safeParseShopifyRecoveryEventV2
|
|
168
|
+
safeParseShopifyRecoveryEventV2,
|
|
169
|
+
validateIcuCatalogue
|
|
114
170
|
};
|
|
115
171
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { PrimitiveType } from 'intl-messageformat';
|
|
2
3
|
|
|
3
4
|
declare const LanguageSourceSchema: z.ZodEnum<{
|
|
4
5
|
"customer-explicit": "customer-explicit";
|
|
@@ -35,5 +36,31 @@ type CurrencyCode = z.infer<typeof CurrencyCodeSchema>;
|
|
|
35
36
|
type TimeZoneId = z.infer<typeof TimeZoneIdSchema>;
|
|
36
37
|
type InternationalContext = z.infer<typeof InternationalContextSchema>;
|
|
37
38
|
declare function mergeInternationalContext(base: InternationalContext, override: InternationalContext): InternationalContext;
|
|
39
|
+
type IcuMessageCatalogue = Readonly<Record<string, string>>;
|
|
40
|
+
type IcuMessageValues = Record<string, PrimitiveType | Date | null | undefined>;
|
|
41
|
+
interface CatalogueValidationOptions {
|
|
42
|
+
locale?: string;
|
|
43
|
+
}
|
|
44
|
+
interface InternationalizationRuntimeOptions {
|
|
45
|
+
locale: string;
|
|
46
|
+
catalogue: IcuMessageCatalogue;
|
|
47
|
+
fallbackCatalogue?: IcuMessageCatalogue;
|
|
48
|
+
timeZone?: string;
|
|
49
|
+
cacheSize?: number;
|
|
50
|
+
}
|
|
51
|
+
interface InternationalizationRuntime {
|
|
52
|
+
locale: string;
|
|
53
|
+
timeZone?: string;
|
|
54
|
+
direction: "ltr" | "rtl";
|
|
55
|
+
formatMessage(message: string, values?: IcuMessageValues): string;
|
|
56
|
+
t(key: string, values?: IcuMessageValues): string;
|
|
57
|
+
formatNumber(value: number, options?: Intl.NumberFormatOptions): string;
|
|
58
|
+
formatPercent(value: number, options?: Intl.NumberFormatOptions): string;
|
|
59
|
+
formatDateTime(value: Date | string | number, options?: Intl.DateTimeFormatOptions): string;
|
|
60
|
+
formatMoney(value: number, currencyCode: string, options?: Intl.NumberFormatOptions): string;
|
|
61
|
+
}
|
|
62
|
+
declare function resolveLocaleDirection(locale: string): "ltr" | "rtl";
|
|
63
|
+
declare function validateIcuCatalogue(catalogue: IcuMessageCatalogue, requiredKeys: readonly string[], options?: CatalogueValidationOptions): void;
|
|
64
|
+
declare function createInternationalizationRuntime({ locale, catalogue, fallbackCatalogue, timeZone, cacheSize, }: InternationalizationRuntimeOptions): InternationalizationRuntime;
|
|
38
65
|
|
|
39
|
-
export { type CountryCode, CountryCodeSchema, type CurrencyCode, CurrencyCodeSchema, type InternationalContext, InternationalContextSchema, type LanguageSource, LanguageSourceSchema, type LanguageTag, LanguageTagSchema, type TimeZoneId, TimeZoneIdSchema, canonicaliseLanguageTag, mergeInternationalContext, normalizeCountryCode, normalizeCurrencyCode, normalizeTimeZone };
|
|
66
|
+
export { type CatalogueValidationOptions, type CountryCode, CountryCodeSchema, type CurrencyCode, CurrencyCodeSchema, type IcuMessageCatalogue, type IcuMessageValues, type InternationalContext, InternationalContextSchema, type InternationalizationRuntime, type InternationalizationRuntimeOptions, type LanguageSource, LanguageSourceSchema, type LanguageTag, LanguageTagSchema, type TimeZoneId, TimeZoneIdSchema, canonicaliseLanguageTag, createInternationalizationRuntime, mergeInternationalContext, normalizeCountryCode, normalizeCurrencyCode, normalizeTimeZone, resolveLocaleDirection, validateIcuCatalogue };
|
|
@@ -6,11 +6,14 @@ import {
|
|
|
6
6
|
LanguageTagSchema,
|
|
7
7
|
TimeZoneIdSchema,
|
|
8
8
|
canonicaliseLanguageTag,
|
|
9
|
+
createInternationalizationRuntime,
|
|
9
10
|
mergeInternationalContext,
|
|
10
11
|
normalizeCountryCode,
|
|
11
12
|
normalizeCurrencyCode,
|
|
12
|
-
normalizeTimeZone
|
|
13
|
-
|
|
13
|
+
normalizeTimeZone,
|
|
14
|
+
resolveLocaleDirection,
|
|
15
|
+
validateIcuCatalogue
|
|
16
|
+
} from "./chunk-B6Y3QQLI.js";
|
|
14
17
|
export {
|
|
15
18
|
CountryCodeSchema,
|
|
16
19
|
CurrencyCodeSchema,
|
|
@@ -19,9 +22,12 @@ export {
|
|
|
19
22
|
LanguageTagSchema,
|
|
20
23
|
TimeZoneIdSchema,
|
|
21
24
|
canonicaliseLanguageTag,
|
|
25
|
+
createInternationalizationRuntime,
|
|
22
26
|
mergeInternationalContext,
|
|
23
27
|
normalizeCountryCode,
|
|
24
28
|
normalizeCurrencyCode,
|
|
25
|
-
normalizeTimeZone
|
|
29
|
+
normalizeTimeZone,
|
|
30
|
+
resolveLocaleDirection,
|
|
31
|
+
validateIcuCatalogue
|
|
26
32
|
};
|
|
27
33
|
//# sourceMappingURL=internationalization.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare function createTranslationDispatchJobId(translationId: string): string;
|
|
2
|
+
declare function createTranslationBatchSubmitJobId(translationBatchId: string): string;
|
|
3
|
+
declare function createTranslationBatchPollJobId(translationBatchId: string, pollSequence: number): string;
|
|
4
|
+
declare function createTranslationBatchResultsJobId(translationBatchId: string): string;
|
|
5
|
+
declare function createTranslationReconcileJobId(reconciliationRequestId?: string): string;
|
|
6
|
+
|
|
7
|
+
export { createTranslationBatchPollJobId, createTranslationBatchResultsJobId, createTranslationBatchSubmitJobId, createTranslationDispatchJobId, createTranslationReconcileJobId };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// src/merchant-communications.node.ts
|
|
2
|
+
import { createHash } from "crypto";
|
|
3
|
+
function createMerchantCommunicationsJobId(prefix, ...parts) {
|
|
4
|
+
if (parts.some((part) => typeof part !== "string" || part.length === 0)) {
|
|
5
|
+
throw new Error(`${prefix}: identifiers must be non-empty strings`);
|
|
6
|
+
}
|
|
7
|
+
const digest = createHash("sha256").update(parts.join("")).digest("hex");
|
|
8
|
+
return `${prefix}-${digest}`;
|
|
9
|
+
}
|
|
10
|
+
function createTranslationDispatchJobId(translationId) {
|
|
11
|
+
return createMerchantCommunicationsJobId("translation-dispatch", translationId);
|
|
12
|
+
}
|
|
13
|
+
function createTranslationBatchSubmitJobId(translationBatchId) {
|
|
14
|
+
return createMerchantCommunicationsJobId("translation-batch-submit", translationBatchId);
|
|
15
|
+
}
|
|
16
|
+
function createTranslationBatchPollJobId(translationBatchId, pollSequence) {
|
|
17
|
+
if (!Number.isInteger(pollSequence) || pollSequence < 0) {
|
|
18
|
+
throw new Error("translation-batch-poll: poll sequence must be a non-negative integer");
|
|
19
|
+
}
|
|
20
|
+
return createMerchantCommunicationsJobId(
|
|
21
|
+
"translation-batch-poll",
|
|
22
|
+
translationBatchId,
|
|
23
|
+
String(pollSequence)
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
function createTranslationBatchResultsJobId(translationBatchId) {
|
|
27
|
+
return createMerchantCommunicationsJobId("translation-batch-results", translationBatchId);
|
|
28
|
+
}
|
|
29
|
+
function createTranslationReconcileJobId(reconciliationRequestId = "periodic") {
|
|
30
|
+
return createMerchantCommunicationsJobId("translation-reconcile", reconciliationRequestId);
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
createTranslationBatchPollJobId,
|
|
34
|
+
createTranslationBatchResultsJobId,
|
|
35
|
+
createTranslationBatchSubmitJobId,
|
|
36
|
+
createTranslationDispatchJobId,
|
|
37
|
+
createTranslationReconcileJobId
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/merchant-communications.node.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\n\nfunction createMerchantCommunicationsJobId(prefix: string, ...parts: string[]): string {\n if (parts.some((part) => typeof part !== \"string\" || part.length === 0)) {\n throw new Error(`${prefix}: identifiers must be non-empty strings`);\n }\n\n const digest = createHash(\"sha256\").update(parts.join(\"\\u001f\")).digest(\"hex\");\n return `${prefix}-${digest}`;\n}\n\nexport function createTranslationDispatchJobId(translationId: string): string {\n return createMerchantCommunicationsJobId(\"translation-dispatch\", translationId);\n}\n\nexport function createTranslationBatchSubmitJobId(translationBatchId: string): string {\n return createMerchantCommunicationsJobId(\"translation-batch-submit\", translationBatchId);\n}\n\nexport function createTranslationBatchPollJobId(\n translationBatchId: string,\n pollSequence: number,\n): string {\n if (!Number.isInteger(pollSequence) || pollSequence < 0) {\n throw new Error(\"translation-batch-poll: poll sequence must be a non-negative integer\");\n }\n\n return createMerchantCommunicationsJobId(\n \"translation-batch-poll\",\n translationBatchId,\n String(pollSequence),\n );\n}\n\nexport function createTranslationBatchResultsJobId(translationBatchId: string): string {\n return createMerchantCommunicationsJobId(\"translation-batch-results\", translationBatchId);\n}\n\nexport function createTranslationReconcileJobId(reconciliationRequestId = \"periodic\"): string {\n return createMerchantCommunicationsJobId(\"translation-reconcile\", reconciliationRequestId);\n}"],"mappings":";AAAA,SAAS,kBAAkB;AAE3B,SAAS,kCAAkC,WAAmB,OAAyB;AACrF,MAAI,MAAM,KAAK,CAAC,SAAS,OAAO,SAAS,YAAY,KAAK,WAAW,CAAC,GAAG;AACvE,UAAM,IAAI,MAAM,GAAG,MAAM,yCAAyC;AAAA,EACpE;AAEA,QAAM,SAAS,WAAW,QAAQ,EAAE,OAAO,MAAM,KAAK,GAAQ,CAAC,EAAE,OAAO,KAAK;AAC7E,SAAO,GAAG,MAAM,IAAI,MAAM;AAC5B;AAEO,SAAS,+BAA+B,eAA+B;AAC5E,SAAO,kCAAkC,wBAAwB,aAAa;AAChF;AAEO,SAAS,kCAAkC,oBAAoC;AACpF,SAAO,kCAAkC,4BAA4B,kBAAkB;AACzF;AAEO,SAAS,gCACd,oBACA,cACQ;AACR,MAAI,CAAC,OAAO,UAAU,YAAY,KAAK,eAAe,GAAG;AACvD,UAAM,IAAI,MAAM,sEAAsE;AAAA,EACxF;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,OAAO,YAAY;AAAA,EACrB;AACF;AAEO,SAAS,mCAAmC,oBAAoC;AACrF,SAAO,kCAAkC,6BAA6B,kBAAkB;AAC1F;AAEO,SAAS,gCAAgC,0BAA0B,YAAoB;AAC5F,SAAO,kCAAkC,yBAAyB,uBAAuB;AAC3F;","names":[]}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const PLATFORM_SUPPORT_LANGUAGE_TAG: "en-GB";
|
|
4
|
+
declare const MERCHANT_COMMUNICATIONS_QUEUE_NAME: "merchant-communications";
|
|
5
|
+
declare const MERCHANT_COMMUNICATIONS_SCHEMA_VERSION: 1;
|
|
6
|
+
declare const MerchantSupportMessageKindSchema: z.ZodEnum<{
|
|
7
|
+
ADMINISTRATIVE: "ADMINISTRATIVE";
|
|
8
|
+
SYSTEM: "SYSTEM";
|
|
9
|
+
MERCHANT: "MERCHANT";
|
|
10
|
+
}>;
|
|
11
|
+
declare const MerchantSupportMessageStateSchema: z.ZodEnum<{
|
|
12
|
+
PROCESSING: "PROCESSING";
|
|
13
|
+
AVAILABLE: "AVAILABLE";
|
|
14
|
+
FAILED: "FAILED";
|
|
15
|
+
}>;
|
|
16
|
+
declare const MerchantTranslationDirectionSchema: z.ZodEnum<{
|
|
17
|
+
MERCHANT_TO_ADMIN: "MERCHANT_TO_ADMIN";
|
|
18
|
+
ADMIN_TO_MERCHANT: "ADMIN_TO_MERCHANT";
|
|
19
|
+
SYSTEM_TO_MERCHANT: "SYSTEM_TO_MERCHANT";
|
|
20
|
+
}>;
|
|
21
|
+
declare const MerchantMessageTranslationStatusSchema: z.ZodEnum<{
|
|
22
|
+
AVAILABLE: "AVAILABLE";
|
|
23
|
+
FAILED: "FAILED";
|
|
24
|
+
PENDING: "PENDING";
|
|
25
|
+
}>;
|
|
26
|
+
declare const MerchantTranslationBatchStatusSchema: z.ZodEnum<{
|
|
27
|
+
FAILED: "FAILED";
|
|
28
|
+
READY: "READY";
|
|
29
|
+
SUBMITTING: "SUBMITTING";
|
|
30
|
+
SUBMISSION_UNKNOWN: "SUBMISSION_UNKNOWN";
|
|
31
|
+
SUBMITTED: "SUBMITTED";
|
|
32
|
+
PROVIDER_COMPLETED: "PROVIDER_COMPLETED";
|
|
33
|
+
COMPLETED: "COMPLETED";
|
|
34
|
+
EXPIRED: "EXPIRED";
|
|
35
|
+
CANCELLED: "CANCELLED";
|
|
36
|
+
}>;
|
|
37
|
+
declare const MerchantTranslationReconciliationScopeSchema: z.ZodEnum<{
|
|
38
|
+
TRANSLATION: "TRANSLATION";
|
|
39
|
+
FAILED_TRANSLATIONS: "FAILED_TRANSLATIONS";
|
|
40
|
+
}>;
|
|
41
|
+
declare const MerchantTranslationReconciliationStatusSchema: z.ZodEnum<{
|
|
42
|
+
PROCESSING: "PROCESSING";
|
|
43
|
+
FAILED: "FAILED";
|
|
44
|
+
PENDING: "PENDING";
|
|
45
|
+
COMPLETED: "COMPLETED";
|
|
46
|
+
}>;
|
|
47
|
+
type MerchantSupportMessageKind = z.infer<typeof MerchantSupportMessageKindSchema>;
|
|
48
|
+
type MerchantSupportMessageState = z.infer<typeof MerchantSupportMessageStateSchema>;
|
|
49
|
+
type MerchantTranslationDirection = z.infer<typeof MerchantTranslationDirectionSchema>;
|
|
50
|
+
type MerchantMessageTranslationStatus = z.infer<typeof MerchantMessageTranslationStatusSchema>;
|
|
51
|
+
type MerchantTranslationBatchStatus = z.infer<typeof MerchantTranslationBatchStatusSchema>;
|
|
52
|
+
type MerchantTranslationReconciliationScope = z.infer<typeof MerchantTranslationReconciliationScopeSchema>;
|
|
53
|
+
type MerchantTranslationReconciliationStatus = z.infer<typeof MerchantTranslationReconciliationStatusSchema>;
|
|
54
|
+
declare function countUnicodeGraphemes(value: string): number;
|
|
55
|
+
declare const AuthoredSupportBodySchema: z.ZodString;
|
|
56
|
+
declare const TranslatedSupportBodySchema: z.ZodString;
|
|
57
|
+
declare const MerchantSupportMessageContractSchema: z.ZodObject<{
|
|
58
|
+
kind: z.ZodEnum<{
|
|
59
|
+
ADMINISTRATIVE: "ADMINISTRATIVE";
|
|
60
|
+
SYSTEM: "SYSTEM";
|
|
61
|
+
MERCHANT: "MERCHANT";
|
|
62
|
+
}>;
|
|
63
|
+
state: z.ZodEnum<{
|
|
64
|
+
PROCESSING: "PROCESSING";
|
|
65
|
+
AVAILABLE: "AVAILABLE";
|
|
66
|
+
FAILED: "FAILED";
|
|
67
|
+
}>;
|
|
68
|
+
originalBody: z.ZodString;
|
|
69
|
+
sourceLanguageTag: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
70
|
+
displayLanguageTag: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
71
|
+
}, z.core.$strict>;
|
|
72
|
+
declare const MerchantMessageTranslationContractSchema: z.ZodObject<{
|
|
73
|
+
direction: z.ZodEnum<{
|
|
74
|
+
MERCHANT_TO_ADMIN: "MERCHANT_TO_ADMIN";
|
|
75
|
+
ADMIN_TO_MERCHANT: "ADMIN_TO_MERCHANT";
|
|
76
|
+
SYSTEM_TO_MERCHANT: "SYSTEM_TO_MERCHANT";
|
|
77
|
+
}>;
|
|
78
|
+
sourceLanguageTag: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
79
|
+
targetLanguageTag: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
80
|
+
status: z.ZodEnum<{
|
|
81
|
+
AVAILABLE: "AVAILABLE";
|
|
82
|
+
FAILED: "FAILED";
|
|
83
|
+
PENDING: "PENDING";
|
|
84
|
+
}>;
|
|
85
|
+
translatedBody: z.ZodNullable<z.ZodString>;
|
|
86
|
+
}, z.core.$strict>;
|
|
87
|
+
declare const MerchantTranslationBatchContractSchema: z.ZodObject<{
|
|
88
|
+
provider: z.ZodString;
|
|
89
|
+
model: z.ZodString;
|
|
90
|
+
status: z.ZodEnum<{
|
|
91
|
+
FAILED: "FAILED";
|
|
92
|
+
READY: "READY";
|
|
93
|
+
SUBMITTING: "SUBMITTING";
|
|
94
|
+
SUBMISSION_UNKNOWN: "SUBMISSION_UNKNOWN";
|
|
95
|
+
SUBMITTED: "SUBMITTED";
|
|
96
|
+
PROVIDER_COMPLETED: "PROVIDER_COMPLETED";
|
|
97
|
+
COMPLETED: "COMPLETED";
|
|
98
|
+
EXPIRED: "EXPIRED";
|
|
99
|
+
CANCELLED: "CANCELLED";
|
|
100
|
+
}>;
|
|
101
|
+
providerBatchId: z.ZodNullable<z.ZodString>;
|
|
102
|
+
inputFileId: z.ZodNullable<z.ZodString>;
|
|
103
|
+
outputFileId: z.ZodNullable<z.ZodString>;
|
|
104
|
+
errorFileId: z.ZodNullable<z.ZodString>;
|
|
105
|
+
}, z.core.$strict>;
|
|
106
|
+
declare const MerchantTranslationReconciliationRequestContractSchema: z.ZodObject<{
|
|
107
|
+
scope: z.ZodEnum<{
|
|
108
|
+
TRANSLATION: "TRANSLATION";
|
|
109
|
+
FAILED_TRANSLATIONS: "FAILED_TRANSLATIONS";
|
|
110
|
+
}>;
|
|
111
|
+
translationId: z.ZodNullable<z.ZodString>;
|
|
112
|
+
status: z.ZodEnum<{
|
|
113
|
+
PROCESSING: "PROCESSING";
|
|
114
|
+
FAILED: "FAILED";
|
|
115
|
+
PENDING: "PENDING";
|
|
116
|
+
COMPLETED: "COMPLETED";
|
|
117
|
+
}>;
|
|
118
|
+
}, z.core.$strict>;
|
|
119
|
+
type MerchantSupportMessageContract = z.infer<typeof MerchantSupportMessageContractSchema>;
|
|
120
|
+
type MerchantMessageTranslationContract = z.infer<typeof MerchantMessageTranslationContractSchema>;
|
|
121
|
+
type MerchantTranslationBatchContract = z.infer<typeof MerchantTranslationBatchContractSchema>;
|
|
122
|
+
type MerchantTranslationReconciliationRequestContract = z.infer<typeof MerchantTranslationReconciliationRequestContractSchema>;
|
|
123
|
+
declare function requiresMerchantTranslation(sourceLanguageTag: string, targetLanguageTag: string): boolean;
|
|
124
|
+
declare const TranslationDispatchJobSchema: z.ZodObject<{
|
|
125
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
126
|
+
translationId: z.ZodString;
|
|
127
|
+
}, z.core.$strict>;
|
|
128
|
+
declare const TranslationBatchSubmitJobSchema: z.ZodObject<{
|
|
129
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
130
|
+
translationBatchId: z.ZodString;
|
|
131
|
+
}, z.core.$strict>;
|
|
132
|
+
declare const TranslationBatchPollJobSchema: z.ZodObject<{
|
|
133
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
134
|
+
translationBatchId: z.ZodString;
|
|
135
|
+
pollSequence: z.ZodNumber;
|
|
136
|
+
}, z.core.$strict>;
|
|
137
|
+
declare const TranslationBatchResultsJobSchema: z.ZodObject<{
|
|
138
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
139
|
+
translationBatchId: z.ZodString;
|
|
140
|
+
}, z.core.$strict>;
|
|
141
|
+
declare const TranslationReconcileJobSchema: z.ZodObject<{
|
|
142
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
143
|
+
reconciliationRequestId: z.ZodOptional<z.ZodString>;
|
|
144
|
+
}, z.core.$strict>;
|
|
145
|
+
declare const MERCHANT_COMMUNICATIONS_JOB_NAMES: {
|
|
146
|
+
readonly TRANSLATION_DISPATCH: "translation-dispatch";
|
|
147
|
+
readonly TRANSLATION_BATCH_SUBMIT: "translation-batch-submit";
|
|
148
|
+
readonly TRANSLATION_BATCH_POLL: "translation-batch-poll";
|
|
149
|
+
readonly TRANSLATION_BATCH_RESULTS: "translation-batch-results";
|
|
150
|
+
readonly TRANSLATION_RECONCILE: "translation-reconcile";
|
|
151
|
+
};
|
|
152
|
+
type TranslationDispatchJob = z.infer<typeof TranslationDispatchJobSchema>;
|
|
153
|
+
type TranslationBatchSubmitJob = z.infer<typeof TranslationBatchSubmitJobSchema>;
|
|
154
|
+
type TranslationBatchPollJob = z.infer<typeof TranslationBatchPollJobSchema>;
|
|
155
|
+
type TranslationBatchResultsJob = z.infer<typeof TranslationBatchResultsJobSchema>;
|
|
156
|
+
type TranslationReconcileJob = z.infer<typeof TranslationReconcileJobSchema>;
|
|
157
|
+
|
|
158
|
+
export { AuthoredSupportBodySchema, MERCHANT_COMMUNICATIONS_JOB_NAMES, MERCHANT_COMMUNICATIONS_QUEUE_NAME, MERCHANT_COMMUNICATIONS_SCHEMA_VERSION, type MerchantMessageTranslationContract, MerchantMessageTranslationContractSchema, type MerchantMessageTranslationStatus, MerchantMessageTranslationStatusSchema, type MerchantSupportMessageContract, MerchantSupportMessageContractSchema, type MerchantSupportMessageKind, MerchantSupportMessageKindSchema, type MerchantSupportMessageState, MerchantSupportMessageStateSchema, type MerchantTranslationBatchContract, MerchantTranslationBatchContractSchema, type MerchantTranslationBatchStatus, MerchantTranslationBatchStatusSchema, type MerchantTranslationDirection, MerchantTranslationDirectionSchema, type MerchantTranslationReconciliationRequestContract, MerchantTranslationReconciliationRequestContractSchema, type MerchantTranslationReconciliationScope, MerchantTranslationReconciliationScopeSchema, type MerchantTranslationReconciliationStatus, MerchantTranslationReconciliationStatusSchema, PLATFORM_SUPPORT_LANGUAGE_TAG, TranslatedSupportBodySchema, type TranslationBatchPollJob, TranslationBatchPollJobSchema, type TranslationBatchResultsJob, TranslationBatchResultsJobSchema, type TranslationBatchSubmitJob, TranslationBatchSubmitJobSchema, type TranslationDispatchJob, TranslationDispatchJobSchema, type TranslationReconcileJob, TranslationReconcileJobSchema, countUnicodeGraphemes, requiresMerchantTranslation };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AuthoredSupportBodySchema,
|
|
3
|
+
MERCHANT_COMMUNICATIONS_JOB_NAMES,
|
|
4
|
+
MERCHANT_COMMUNICATIONS_QUEUE_NAME,
|
|
5
|
+
MERCHANT_COMMUNICATIONS_SCHEMA_VERSION,
|
|
6
|
+
MerchantMessageTranslationContractSchema,
|
|
7
|
+
MerchantMessageTranslationStatusSchema,
|
|
8
|
+
MerchantSupportMessageContractSchema,
|
|
9
|
+
MerchantSupportMessageKindSchema,
|
|
10
|
+
MerchantSupportMessageStateSchema,
|
|
11
|
+
MerchantTranslationBatchContractSchema,
|
|
12
|
+
MerchantTranslationBatchStatusSchema,
|
|
13
|
+
MerchantTranslationDirectionSchema,
|
|
14
|
+
MerchantTranslationReconciliationRequestContractSchema,
|
|
15
|
+
MerchantTranslationReconciliationScopeSchema,
|
|
16
|
+
MerchantTranslationReconciliationStatusSchema,
|
|
17
|
+
PLATFORM_SUPPORT_LANGUAGE_TAG,
|
|
18
|
+
TranslatedSupportBodySchema,
|
|
19
|
+
TranslationBatchPollJobSchema,
|
|
20
|
+
TranslationBatchResultsJobSchema,
|
|
21
|
+
TranslationBatchSubmitJobSchema,
|
|
22
|
+
TranslationDispatchJobSchema,
|
|
23
|
+
TranslationReconcileJobSchema,
|
|
24
|
+
countUnicodeGraphemes,
|
|
25
|
+
requiresMerchantTranslation
|
|
26
|
+
} from "./chunk-X7NKF3ZC.js";
|
|
27
|
+
import "./chunk-B6Y3QQLI.js";
|
|
28
|
+
export {
|
|
29
|
+
AuthoredSupportBodySchema,
|
|
30
|
+
MERCHANT_COMMUNICATIONS_JOB_NAMES,
|
|
31
|
+
MERCHANT_COMMUNICATIONS_QUEUE_NAME,
|
|
32
|
+
MERCHANT_COMMUNICATIONS_SCHEMA_VERSION,
|
|
33
|
+
MerchantMessageTranslationContractSchema,
|
|
34
|
+
MerchantMessageTranslationStatusSchema,
|
|
35
|
+
MerchantSupportMessageContractSchema,
|
|
36
|
+
MerchantSupportMessageKindSchema,
|
|
37
|
+
MerchantSupportMessageStateSchema,
|
|
38
|
+
MerchantTranslationBatchContractSchema,
|
|
39
|
+
MerchantTranslationBatchStatusSchema,
|
|
40
|
+
MerchantTranslationDirectionSchema,
|
|
41
|
+
MerchantTranslationReconciliationRequestContractSchema,
|
|
42
|
+
MerchantTranslationReconciliationScopeSchema,
|
|
43
|
+
MerchantTranslationReconciliationStatusSchema,
|
|
44
|
+
PLATFORM_SUPPORT_LANGUAGE_TAG,
|
|
45
|
+
TranslatedSupportBodySchema,
|
|
46
|
+
TranslationBatchPollJobSchema,
|
|
47
|
+
TranslationBatchResultsJobSchema,
|
|
48
|
+
TranslationBatchSubmitJobSchema,
|
|
49
|
+
TranslationDispatchJobSchema,
|
|
50
|
+
TranslationReconcileJobSchema,
|
|
51
|
+
countUnicodeGraphemes,
|
|
52
|
+
requiresMerchantTranslation
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=merchant-communications.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/shopify/index.js
CHANGED
|
@@ -42,8 +42,8 @@ import {
|
|
|
42
42
|
parseShopifyRecoveryEventV2,
|
|
43
43
|
safeParseShopifyCommerceEvent,
|
|
44
44
|
safeParseShopifyRecoveryEventV2
|
|
45
|
-
} from "../chunk-
|
|
46
|
-
import "../chunk-
|
|
45
|
+
} from "../chunk-JZVD5O5P.js";
|
|
46
|
+
import "../chunk-B6Y3QQLI.js";
|
|
47
47
|
export {
|
|
48
48
|
CheckoutCreatedPayloadV2Schema,
|
|
49
49
|
CheckoutObservedPayloadSchema,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modainteract/moda-interact-shared",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -16,6 +16,14 @@
|
|
|
16
16
|
"types": "./dist/internationalization.d.ts",
|
|
17
17
|
"import": "./dist/internationalization.js"
|
|
18
18
|
},
|
|
19
|
+
"./merchant-communications": {
|
|
20
|
+
"types": "./dist/merchant-communications.d.ts",
|
|
21
|
+
"import": "./dist/merchant-communications.js"
|
|
22
|
+
},
|
|
23
|
+
"./merchant-communications/node": {
|
|
24
|
+
"types": "./dist/merchant-communications.node.d.ts",
|
|
25
|
+
"import": "./dist/merchant-communications.node.js"
|
|
26
|
+
},
|
|
19
27
|
"./shopify": {
|
|
20
28
|
"types": "./dist/shopify/index.d.ts",
|
|
21
29
|
"import": "./dist/shopify/index.js"
|
|
@@ -56,6 +64,7 @@
|
|
|
56
64
|
"build": "tsup",
|
|
57
65
|
"typecheck": "tsc --noEmit",
|
|
58
66
|
"test": "tsx --test \"src/**/*.test.ts\"",
|
|
67
|
+
"validate:internationalization-entrypoint": "npm run build && node scripts/validate-internationalization-entrypoint.mjs",
|
|
59
68
|
"prepack": "npm run build"
|
|
60
69
|
},
|
|
61
70
|
"dependencies": {
|
|
@@ -74,6 +83,7 @@
|
|
|
74
83
|
"@opentelemetry/sdk-trace-base": "^2.10.0",
|
|
75
84
|
"@prisma/instrumentation": "^6.19.3",
|
|
76
85
|
"bullmq-otel": "^2.0.1",
|
|
86
|
+
"intl-messageformat": "^10.7.18",
|
|
77
87
|
"winston": "3.19.0",
|
|
78
88
|
"winston-loki": "6.1.7",
|
|
79
89
|
"zod": "^4.0.0"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/internationalization.ts"],"sourcesContent":["import { z } from \"zod\";\n\nconst ISO_COUNTRY_CODE_PATTERN = /^[A-Z]{2}$/;\nconst ISO_CURRENCY_CODE_PATTERN = /^[A-Z]{3}$/;\nconst ISO_3166_ALPHA_2_CODES = new Set([\n \"AF\", \"AL\", \"DZ\", \"AS\", \"AD\", \"AO\", \"AI\", \"AQ\", \"AG\", \"AR\", \"AM\", \"AW\", \"AU\", \"AX\", \"AT\", \"AZ\",\n \"BS\", \"BH\", \"BD\", \"BB\", \"BY\", \"BE\", \"BZ\", \"BJ\", \"BM\", \"BT\", \"BO\", \"BQ\", \"BA\", \"BW\", \"BV\", \"BR\", \"IO\", \"BN\", \"BG\", \"BF\", \"BI\", \"CV\", \"KH\", \"CM\", \"CA\", \"KY\", \"CF\", \"TD\", \"CL\", \"CN\", \"CX\", \"CC\", \"CO\", \"KM\", \"CG\", \"CD\", \"CK\", \"CR\", \"CI\", \"HR\", \"CU\", \"CW\", \"CY\", \"CZ\", \"DK\", \"DJ\", \"DM\", \"DO\", \"EC\", \"EG\", \"SV\", \"GQ\", \"ER\", \"EE\", \"SZ\", \"ET\", \"FK\", \"FO\", \"FJ\", \"FI\", \"FR\", \"GF\", \"PF\", \"TF\", \"GA\", \"GM\", \"GE\", \"DE\", \"GH\", \"GI\", \"GR\", \"GL\", \"GD\", \"GP\", \"GU\", \"GT\", \"GG\", \"GN\", \"GW\", \"GY\", \"HT\", \"HM\", \"VA\", \"HN\", \"HK\", \"HU\", \"IS\", \"IN\", \"ID\", \"IR\", \"IQ\", \"IE\", \"IM\", \"IL\", \"IT\", \"JM\", \"JP\", \"JE\", \"JO\", \"KZ\", \"KE\", \"KI\", \"KP\", \"KR\", \"KW\", \"KG\", \"LA\", \"LV\", \"LB\", \"LS\", \"LR\", \"LY\", \"LI\", \"LT\", \"LU\", \"MO\", \"MG\", \"MW\", \"MY\", \"MV\", \"ML\", \"MT\", \"MH\", \"MQ\", \"MR\", \"MU\", \"YT\", \"MX\", \"FM\", \"MD\", \"MC\", \"MN\", \"ME\", \"MS\", \"MA\", \"MZ\", \"MM\", \"NA\", \"NR\", \"NP\", \"NL\", \"NC\", \"NZ\", \"NI\", \"NE\", \"NG\", \"NU\", \"NF\", \"MK\", \"MP\", \"NO\", \"OM\", \"PK\", \"PW\", \"PS\", \"PA\", \"PG\", \"PY\", \"PE\", \"PH\", \"PN\", \"PL\", \"PT\", \"PR\", \"QA\", \"RE\", \"RO\", \"RU\", \"RW\", \"BL\", \"SH\", \"KN\", \"LC\", \"MF\", \"PM\", \"VC\", \"WS\", \"SM\", \"ST\", \"SA\", \"SN\", \"RS\", \"SC\", \"SL\", \"SG\", \"SX\", \"SK\", \"SI\", \"SB\", \"SO\", \"ZA\", \"GS\", \"SS\", \"ES\", \"LK\", \"SD\", \"SR\", \"SJ\", \"SE\", \"CH\", \"SY\", \"TW\", \"TJ\", \"TZ\", \"TH\", \"TL\", \"TG\", \"TK\", \"TO\", \"TT\", \"TN\", \"TR\", \"TM\", \"TC\", \"TV\", \"UG\", \"UA\", \"AE\", \"GB\", \"US\", \"UM\", \"UY\", \"UZ\", \"VU\", \"VE\", \"VN\", \"VG\", \"VI\", \"WF\", \"EH\", \"YE\", \"ZM\", \"ZW\",\n]);\nconst supportedCurrencies = new Set(Intl.supportedValuesOf(\"currency\"));\n\nexport const LanguageSourceSchema = z.enum([\n \"customer-explicit\",\n \"detected\",\n \"shopify\",\n \"merchant-default\",\n \"platform-default\",\n]);\n\nexport type LanguageSource = z.infer<typeof LanguageSourceSchema>;\n\nfunction invalidValue(kind: string, value: string): TypeError {\n return new TypeError(`Invalid ${kind}: ${value}`);\n}\n\nexport function canonicaliseLanguageTag(value: string): string {\n if (typeof value !== \"string\" || !value.trim()) {\n throw invalidValue(\"BCP-47 language tag\", value);\n }\n\n try {\n return new Intl.Locale(value.trim()).toString();\n } catch {\n throw invalidValue(\"BCP-47 language tag\", value);\n }\n}\n\nexport function normalizeCountryCode(value: string): string {\n if (typeof value !== \"string\") throw invalidValue(\"ISO 3166-1 alpha-2 country code\", value);\n const code = value.trim().toUpperCase();\n if (!ISO_COUNTRY_CODE_PATTERN.test(code)) {\n throw invalidValue(\"ISO 3166-1 alpha-2 country code\", value);\n }\n\n if (!ISO_3166_ALPHA_2_CODES.has(code)) {\n throw invalidValue(\"ISO 3166-1 alpha-2 country code\", value);\n }\n\n return code;\n}\n\nexport function normalizeCurrencyCode(value: string): string {\n if (typeof value !== \"string\") throw invalidValue(\"ISO 4217 currency code\", value);\n const code = value.trim().toUpperCase();\n if (!ISO_CURRENCY_CODE_PATTERN.test(code) || !supportedCurrencies.has(code)) {\n throw invalidValue(\"ISO 4217 currency code\", value);\n }\n return code;\n}\n\nexport function normalizeTimeZone(value: string): string {\n if (typeof value !== \"string\" || !value.trim()) {\n throw invalidValue(\"IANA time-zone identifier\", value);\n }\n\n try {\n return new Intl.DateTimeFormat(\"en\", { timeZone: value.trim() }).resolvedOptions().timeZone;\n } catch {\n throw invalidValue(\"IANA time-zone identifier\", value);\n }\n}\n\nexport const LanguageTagSchema = z.string().trim().transform(canonicaliseLanguageTag);\nexport const CountryCodeSchema = z.string().trim().transform(normalizeCountryCode);\nexport const CurrencyCodeSchema = z.string().trim().transform(normalizeCurrencyCode);\nexport const TimeZoneIdSchema = z.string().trim().transform(normalizeTimeZone);\n\nexport const InternationalContextSchema = z\n .object({\n languageTag: LanguageTagSchema.nullable(),\n languageSource: LanguageSourceSchema.nullable(),\n countryCode: CountryCodeSchema.nullable(),\n currencyCode: CurrencyCodeSchema.nullable(),\n timeZone: TimeZoneIdSchema.nullable(),\n })\n .strict();\n\nexport type LanguageTag = z.infer<typeof LanguageTagSchema>;\nexport type CountryCode = z.infer<typeof CountryCodeSchema>;\nexport type CurrencyCode = z.infer<typeof CurrencyCodeSchema>;\nexport type TimeZoneId = z.infer<typeof TimeZoneIdSchema>;\nexport type InternationalContext = z.infer<typeof InternationalContextSchema>;\n\nexport function mergeInternationalContext(\n base: InternationalContext,\n override: InternationalContext,\n): InternationalContext {\n return {\n languageTag: override.languageTag ?? base.languageTag,\n languageSource: override.languageSource ?? base.languageSource,\n countryCode: override.countryCode ?? base.countryCode,\n currencyCode: override.currencyCode ?? base.currencyCode,\n timeZone: override.timeZone ?? base.timeZone,\n };\n}"],"mappings":";AAAA,SAAS,SAAS;AAElB,IAAM,2BAA2B;AACjC,IAAM,4BAA4B;AAClC,IAAM,yBAAyB,oBAAI,IAAI;AAAA,EACrC;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAC1F;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAA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