@modainteract/moda-interact-shared 0.7.2 → 0.7.4

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.
@@ -0,0 +1,86 @@
1
+ import { z } from 'zod';
2
+
3
+ declare const ARCH007_BILLING_CONTRACT_SCHEMA_VERSION: 1;
4
+ declare const WHATSAPP_PROVIDER_STATUS_SCHEMA_VERSION: 2;
5
+ declare const BILLING_PLAN_KINDS: readonly ["FREE", "PAID_METERED"];
6
+ declare const BillingPlanKindSchema: z.ZodEnum<{
7
+ FREE: "FREE";
8
+ PAID_METERED: "PAID_METERED";
9
+ }>;
10
+ type BillingPlanKind = z.infer<typeof BillingPlanKindSchema>;
11
+ declare const BILLING_USAGE_METRICS: readonly ["RECOVERY_CONVERSATION", "OUTBOUND_AUTOMATED_MESSAGE", "DELIVERED_WHATSAPP_MESSAGE"];
12
+ declare const BillingUsageMetricSchema: z.ZodEnum<{
13
+ RECOVERY_CONVERSATION: "RECOVERY_CONVERSATION";
14
+ OUTBOUND_AUTOMATED_MESSAGE: "OUTBOUND_AUTOMATED_MESSAGE";
15
+ DELIVERED_WHATSAPP_MESSAGE: "DELIVERED_WHATSAPP_MESSAGE";
16
+ }>;
17
+ type BillingUsageMetric = z.infer<typeof BillingUsageMetricSchema>;
18
+ declare const BILLING_SYSTEM_MESSAGE_CODES: {
19
+ readonly FREE_ALLOWANCE_WARNING: "BILLING_FREE_ALLOWANCE_WARNING";
20
+ readonly FREE_ALLOWANCE_EXHAUSTED: "BILLING_FREE_ALLOWANCE_EXHAUSTED";
21
+ readonly PLAN_UPGRADED: "BILLING_PLAN_UPGRADED";
22
+ readonly PLAN_DOWNGRADE_SCHEDULED: "BILLING_PLAN_DOWNGRADE_SCHEDULED";
23
+ readonly SUBSCRIPTION_ENDED: "BILLING_SUBSCRIPTION_ENDED";
24
+ readonly SAFETY_LIMIT_REACHED: "BILLING_SAFETY_LIMIT_REACHED";
25
+ };
26
+ declare const BillingSystemMessageCodeSchema: z.ZodEnum<{
27
+ BILLING_FREE_ALLOWANCE_WARNING: "BILLING_FREE_ALLOWANCE_WARNING";
28
+ BILLING_FREE_ALLOWANCE_EXHAUSTED: "BILLING_FREE_ALLOWANCE_EXHAUSTED";
29
+ BILLING_PLAN_UPGRADED: "BILLING_PLAN_UPGRADED";
30
+ BILLING_PLAN_DOWNGRADE_SCHEDULED: "BILLING_PLAN_DOWNGRADE_SCHEDULED";
31
+ BILLING_SUBSCRIPTION_ENDED: "BILLING_SUBSCRIPTION_ENDED";
32
+ BILLING_SAFETY_LIMIT_REACHED: "BILLING_SAFETY_LIMIT_REACHED";
33
+ }>;
34
+ type BillingSystemMessageCode = z.infer<typeof BillingSystemMessageCodeSchema>;
35
+ declare const WHATSAPP_PROVIDER_STATUSES: readonly ["SENT", "DELIVERED", "READ", "FAILED"];
36
+ declare const WhatsAppProviderStatusSchema: z.ZodEnum<{
37
+ SENT: "SENT";
38
+ DELIVERED: "DELIVERED";
39
+ READ: "READ";
40
+ FAILED: "FAILED";
41
+ }>;
42
+ type WhatsAppProviderStatus = z.infer<typeof WhatsAppProviderStatusSchema>;
43
+ declare const WhatsAppProviderPricingMetadataSchema: z.ZodObject<{
44
+ billable: z.ZodOptional<z.ZodBoolean>;
45
+ category: z.ZodOptional<z.ZodString>;
46
+ model: z.ZodOptional<z.ZodString>;
47
+ }, z.core.$strict>;
48
+ type WhatsAppProviderPricingMetadata = z.infer<typeof WhatsAppProviderPricingMetadataSchema>;
49
+ declare const NormalizedWhatsAppStatusSchema: z.ZodObject<{
50
+ schemaVersion: z.ZodLiteral<2>;
51
+ providerAccountId: z.ZodString;
52
+ providerPhoneNumberId: z.ZodString;
53
+ providerMessageId: z.ZodString;
54
+ status: z.ZodEnum<{
55
+ SENT: "SENT";
56
+ DELIVERED: "DELIVERED";
57
+ READ: "READ";
58
+ FAILED: "FAILED";
59
+ }>;
60
+ occurredAt: z.ZodISODateTime;
61
+ pricing: z.ZodOptional<z.ZodObject<{
62
+ billable: z.ZodOptional<z.ZodBoolean>;
63
+ category: z.ZodOptional<z.ZodString>;
64
+ model: z.ZodOptional<z.ZodString>;
65
+ }, z.core.$strict>>;
66
+ }, z.core.$strict>;
67
+ type NormalizedWhatsAppStatus = z.infer<typeof NormalizedWhatsAppStatusSchema>;
68
+ declare function parseNormalizedWhatsAppStatus(input: unknown): NormalizedWhatsAppStatus;
69
+ declare function safeParseNormalizedWhatsAppStatus(input: unknown): z.ZodSafeParseResult<{
70
+ schemaVersion: 2;
71
+ providerAccountId: string;
72
+ providerPhoneNumberId: string;
73
+ providerMessageId: string;
74
+ status: "SENT" | "DELIVERED" | "READ" | "FAILED";
75
+ occurredAt: string;
76
+ pricing?: {
77
+ billable?: boolean | undefined;
78
+ category?: string | undefined;
79
+ model?: string | undefined;
80
+ } | undefined;
81
+ }>;
82
+ declare function createMerchantBillingSystemSourceKey(shopId: string, code: BillingSystemMessageCode, eventIdentity: string, version?: number): string;
83
+ declare function createRecoveryIdempotencyKey(shopId: string, recoveryId: string): string;
84
+ declare function createShopifyUsageIdempotencyKey(shopId: string, usageEventId: string): string;
85
+
86
+ export { ARCH007_BILLING_CONTRACT_SCHEMA_VERSION, BILLING_PLAN_KINDS, BILLING_SYSTEM_MESSAGE_CODES, BILLING_USAGE_METRICS, type BillingPlanKind, BillingPlanKindSchema, type BillingSystemMessageCode, BillingSystemMessageCodeSchema, type BillingUsageMetric, BillingUsageMetricSchema, type NormalizedWhatsAppStatus, NormalizedWhatsAppStatusSchema, WHATSAPP_PROVIDER_STATUSES, WHATSAPP_PROVIDER_STATUS_SCHEMA_VERSION, type WhatsAppProviderPricingMetadata, WhatsAppProviderPricingMetadataSchema, type WhatsAppProviderStatus, WhatsAppProviderStatusSchema, createMerchantBillingSystemSourceKey, createRecoveryIdempotencyKey, createShopifyUsageIdempotencyKey, parseNormalizedWhatsAppStatus, safeParseNormalizedWhatsAppStatus };
@@ -0,0 +1,39 @@
1
+ import {
2
+ ARCH007_BILLING_CONTRACT_SCHEMA_VERSION,
3
+ BILLING_PLAN_KINDS,
4
+ BILLING_SYSTEM_MESSAGE_CODES,
5
+ BILLING_USAGE_METRICS,
6
+ BillingPlanKindSchema,
7
+ BillingSystemMessageCodeSchema,
8
+ BillingUsageMetricSchema,
9
+ NormalizedWhatsAppStatusSchema,
10
+ WHATSAPP_PROVIDER_STATUSES,
11
+ WHATSAPP_PROVIDER_STATUS_SCHEMA_VERSION,
12
+ WhatsAppProviderPricingMetadataSchema,
13
+ WhatsAppProviderStatusSchema,
14
+ createMerchantBillingSystemSourceKey,
15
+ createRecoveryIdempotencyKey,
16
+ createShopifyUsageIdempotencyKey,
17
+ parseNormalizedWhatsAppStatus,
18
+ safeParseNormalizedWhatsAppStatus
19
+ } from "./chunk-LT2MFACA.js";
20
+ export {
21
+ ARCH007_BILLING_CONTRACT_SCHEMA_VERSION,
22
+ BILLING_PLAN_KINDS,
23
+ BILLING_SYSTEM_MESSAGE_CODES,
24
+ BILLING_USAGE_METRICS,
25
+ BillingPlanKindSchema,
26
+ BillingSystemMessageCodeSchema,
27
+ BillingUsageMetricSchema,
28
+ NormalizedWhatsAppStatusSchema,
29
+ WHATSAPP_PROVIDER_STATUSES,
30
+ WHATSAPP_PROVIDER_STATUS_SCHEMA_VERSION,
31
+ WhatsAppProviderPricingMetadataSchema,
32
+ WhatsAppProviderStatusSchema,
33
+ createMerchantBillingSystemSourceKey,
34
+ createRecoveryIdempotencyKey,
35
+ createShopifyUsageIdempotencyKey,
36
+ parseNormalizedWhatsAppStatus,
37
+ safeParseNormalizedWhatsAppStatus
38
+ };
39
+ //# sourceMappingURL=billing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,117 @@
1
+ // src/billing.ts
2
+ import { z } from "zod";
3
+ var ARCH007_BILLING_CONTRACT_SCHEMA_VERSION = 1;
4
+ var WHATSAPP_PROVIDER_STATUS_SCHEMA_VERSION = 2;
5
+ var BILLING_PLAN_KINDS = ["FREE", "PAID_METERED"];
6
+ var BillingPlanKindSchema = z.enum(BILLING_PLAN_KINDS);
7
+ var BILLING_USAGE_METRICS = [
8
+ "RECOVERY_CONVERSATION",
9
+ "OUTBOUND_AUTOMATED_MESSAGE",
10
+ "DELIVERED_WHATSAPP_MESSAGE"
11
+ ];
12
+ var BillingUsageMetricSchema = z.enum(BILLING_USAGE_METRICS);
13
+ var BILLING_SYSTEM_MESSAGE_CODES = {
14
+ FREE_ALLOWANCE_WARNING: "BILLING_FREE_ALLOWANCE_WARNING",
15
+ FREE_ALLOWANCE_EXHAUSTED: "BILLING_FREE_ALLOWANCE_EXHAUSTED",
16
+ PLAN_UPGRADED: "BILLING_PLAN_UPGRADED",
17
+ PLAN_DOWNGRADE_SCHEDULED: "BILLING_PLAN_DOWNGRADE_SCHEDULED",
18
+ SUBSCRIPTION_ENDED: "BILLING_SUBSCRIPTION_ENDED",
19
+ SAFETY_LIMIT_REACHED: "BILLING_SAFETY_LIMIT_REACHED"
20
+ };
21
+ var BILLING_SYSTEM_MESSAGE_CODE_VALUES = [
22
+ BILLING_SYSTEM_MESSAGE_CODES.FREE_ALLOWANCE_WARNING,
23
+ BILLING_SYSTEM_MESSAGE_CODES.FREE_ALLOWANCE_EXHAUSTED,
24
+ BILLING_SYSTEM_MESSAGE_CODES.PLAN_UPGRADED,
25
+ BILLING_SYSTEM_MESSAGE_CODES.PLAN_DOWNGRADE_SCHEDULED,
26
+ BILLING_SYSTEM_MESSAGE_CODES.SUBSCRIPTION_ENDED,
27
+ BILLING_SYSTEM_MESSAGE_CODES.SAFETY_LIMIT_REACHED
28
+ ];
29
+ var BillingSystemMessageCodeSchema = z.enum(BILLING_SYSTEM_MESSAGE_CODE_VALUES);
30
+ var WHATSAPP_PROVIDER_STATUSES = [
31
+ "SENT",
32
+ "DELIVERED",
33
+ "READ",
34
+ "FAILED"
35
+ ];
36
+ var WhatsAppProviderStatusSchema = z.enum(WHATSAPP_PROVIDER_STATUSES);
37
+ var MAX_ID_LENGTH = 128;
38
+ var MAX_SHORT_TEXT_LENGTH = 128;
39
+ var WhatsAppProviderPricingMetadataSchema = z.object({
40
+ billable: z.boolean().optional(),
41
+ category: z.string().trim().min(1).max(MAX_SHORT_TEXT_LENGTH).optional(),
42
+ model: z.string().trim().min(1).max(MAX_SHORT_TEXT_LENGTH).optional()
43
+ }).strict().refine((value) => Object.keys(value).length > 0, "pricing metadata must not be empty");
44
+ var NormalizedWhatsAppStatusSchema = z.object({
45
+ schemaVersion: z.literal(WHATSAPP_PROVIDER_STATUS_SCHEMA_VERSION),
46
+ providerAccountId: z.string().trim().min(1).max(MAX_ID_LENGTH),
47
+ providerPhoneNumberId: z.string().trim().min(1).max(MAX_ID_LENGTH),
48
+ providerMessageId: z.string().trim().min(1).max(MAX_ID_LENGTH),
49
+ status: WhatsAppProviderStatusSchema,
50
+ occurredAt: z.iso.datetime({ offset: true }),
51
+ pricing: WhatsAppProviderPricingMetadataSchema.optional()
52
+ }).strict();
53
+ function parseNormalizedWhatsAppStatus(input) {
54
+ return NormalizedWhatsAppStatusSchema.parse(input);
55
+ }
56
+ function safeParseNormalizedWhatsAppStatus(input) {
57
+ return NormalizedWhatsAppStatusSchema.safeParse(input);
58
+ }
59
+ function assertKeyPart(name, value) {
60
+ if (typeof value !== "string" || value.trim().length === 0) {
61
+ throw new Error(`${name} must be a non-empty string`);
62
+ }
63
+ }
64
+ function fnv1a64(value) {
65
+ let hash = 0xcbf29ce484222325n;
66
+ for (const character of value) {
67
+ hash ^= BigInt(character.codePointAt(0) ?? 0);
68
+ hash = BigInt.asUintN(64, hash * 0x100000001b3n);
69
+ }
70
+ return hash.toString(16).padStart(16, "0");
71
+ }
72
+ function boundedKey(prefix, parts, maxLength) {
73
+ const canonical = parts.map((part) => part.trim()).join(":");
74
+ const readable = `${prefix}:${canonical}`;
75
+ if (readable.length <= maxLength) return readable;
76
+ return `${prefix}:h${fnv1a64(canonical)}`;
77
+ }
78
+ function createMerchantBillingSystemSourceKey(shopId, code, eventIdentity, version = 1) {
79
+ assertKeyPart("shopId", shopId);
80
+ assertKeyPart("code", code);
81
+ assertKeyPart("eventIdentity", eventIdentity);
82
+ if (!Number.isInteger(version) || version < 1) {
83
+ throw new Error("version must be a positive integer");
84
+ }
85
+ return boundedKey("billing-system", [shopId, code, eventIdentity, String(version)], 255);
86
+ }
87
+ function createRecoveryIdempotencyKey(shopId, recoveryId) {
88
+ assertKeyPart("shopId", shopId);
89
+ assertKeyPart("recoveryId", recoveryId);
90
+ return boundedKey("recovery", [shopId, recoveryId], 255);
91
+ }
92
+ function createShopifyUsageIdempotencyKey(shopId, usageEventId) {
93
+ assertKeyPart("shopId", shopId);
94
+ assertKeyPart("usageEventId", usageEventId);
95
+ return boundedKey("shopify", [shopId, usageEventId], 64);
96
+ }
97
+
98
+ export {
99
+ ARCH007_BILLING_CONTRACT_SCHEMA_VERSION,
100
+ WHATSAPP_PROVIDER_STATUS_SCHEMA_VERSION,
101
+ BILLING_PLAN_KINDS,
102
+ BillingPlanKindSchema,
103
+ BILLING_USAGE_METRICS,
104
+ BillingUsageMetricSchema,
105
+ BILLING_SYSTEM_MESSAGE_CODES,
106
+ BillingSystemMessageCodeSchema,
107
+ WHATSAPP_PROVIDER_STATUSES,
108
+ WhatsAppProviderStatusSchema,
109
+ WhatsAppProviderPricingMetadataSchema,
110
+ NormalizedWhatsAppStatusSchema,
111
+ parseNormalizedWhatsAppStatus,
112
+ safeParseNormalizedWhatsAppStatus,
113
+ createMerchantBillingSystemSourceKey,
114
+ createRecoveryIdempotencyKey,
115
+ createShopifyUsageIdempotencyKey
116
+ };
117
+ //# sourceMappingURL=chunk-LT2MFACA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/billing.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const ARCH007_BILLING_CONTRACT_SCHEMA_VERSION = 1 as const;\nexport const WHATSAPP_PROVIDER_STATUS_SCHEMA_VERSION = 2 as const;\n\nexport const BILLING_PLAN_KINDS = [\"FREE\", \"PAID_METERED\"] as const;\nexport const BillingPlanKindSchema = z.enum(BILLING_PLAN_KINDS);\nexport type BillingPlanKind = z.infer<typeof BillingPlanKindSchema>;\n\nexport const BILLING_USAGE_METRICS = [\n \"RECOVERY_CONVERSATION\",\n \"OUTBOUND_AUTOMATED_MESSAGE\",\n \"DELIVERED_WHATSAPP_MESSAGE\",\n] as const;\nexport const BillingUsageMetricSchema = z.enum(BILLING_USAGE_METRICS);\nexport type BillingUsageMetric = z.infer<typeof BillingUsageMetricSchema>;\n\nexport const BILLING_SYSTEM_MESSAGE_CODES = {\n FREE_ALLOWANCE_WARNING: \"BILLING_FREE_ALLOWANCE_WARNING\",\n FREE_ALLOWANCE_EXHAUSTED: \"BILLING_FREE_ALLOWANCE_EXHAUSTED\",\n PLAN_UPGRADED: \"BILLING_PLAN_UPGRADED\",\n PLAN_DOWNGRADE_SCHEDULED: \"BILLING_PLAN_DOWNGRADE_SCHEDULED\",\n SUBSCRIPTION_ENDED: \"BILLING_SUBSCRIPTION_ENDED\",\n SAFETY_LIMIT_REACHED: \"BILLING_SAFETY_LIMIT_REACHED\",\n} as const;\n\nconst BILLING_SYSTEM_MESSAGE_CODE_VALUES = [\n BILLING_SYSTEM_MESSAGE_CODES.FREE_ALLOWANCE_WARNING,\n BILLING_SYSTEM_MESSAGE_CODES.FREE_ALLOWANCE_EXHAUSTED,\n BILLING_SYSTEM_MESSAGE_CODES.PLAN_UPGRADED,\n BILLING_SYSTEM_MESSAGE_CODES.PLAN_DOWNGRADE_SCHEDULED,\n BILLING_SYSTEM_MESSAGE_CODES.SUBSCRIPTION_ENDED,\n BILLING_SYSTEM_MESSAGE_CODES.SAFETY_LIMIT_REACHED,\n] as const;\n\nexport const BillingSystemMessageCodeSchema = z.enum(BILLING_SYSTEM_MESSAGE_CODE_VALUES);\nexport type BillingSystemMessageCode = z.infer<typeof BillingSystemMessageCodeSchema>;\n\nexport const WHATSAPP_PROVIDER_STATUSES = [\n \"SENT\",\n \"DELIVERED\",\n \"READ\",\n \"FAILED\",\n] as const;\nexport const WhatsAppProviderStatusSchema = z.enum(WHATSAPP_PROVIDER_STATUSES);\nexport type WhatsAppProviderStatus = z.infer<typeof WhatsAppProviderStatusSchema>;\n\nconst MAX_ID_LENGTH = 128;\nconst MAX_SHORT_TEXT_LENGTH = 128;\n\nexport const WhatsAppProviderPricingMetadataSchema = z\n .object({\n billable: z.boolean().optional(),\n category: z.string().trim().min(1).max(MAX_SHORT_TEXT_LENGTH).optional(),\n model: z.string().trim().min(1).max(MAX_SHORT_TEXT_LENGTH).optional(),\n })\n .strict()\n .refine((value) => Object.keys(value).length > 0, \"pricing metadata must not be empty\");\n\nexport type WhatsAppProviderPricingMetadata = z.infer<\n typeof WhatsAppProviderPricingMetadataSchema\n>;\n\nexport const NormalizedWhatsAppStatusSchema = z\n .object({\n schemaVersion: z.literal(WHATSAPP_PROVIDER_STATUS_SCHEMA_VERSION),\n providerAccountId: z.string().trim().min(1).max(MAX_ID_LENGTH),\n providerPhoneNumberId: z.string().trim().min(1).max(MAX_ID_LENGTH),\n providerMessageId: z.string().trim().min(1).max(MAX_ID_LENGTH),\n status: WhatsAppProviderStatusSchema,\n occurredAt: z.iso.datetime({ offset: true }),\n pricing: WhatsAppProviderPricingMetadataSchema.optional(),\n })\n .strict();\n\nexport type NormalizedWhatsAppStatus = z.infer<typeof NormalizedWhatsAppStatusSchema>;\n\nexport function parseNormalizedWhatsAppStatus(input: unknown): NormalizedWhatsAppStatus {\n return NormalizedWhatsAppStatusSchema.parse(input);\n}\n\nexport function safeParseNormalizedWhatsAppStatus(input: unknown) {\n return NormalizedWhatsAppStatusSchema.safeParse(input);\n}\n\nfunction assertKeyPart(name: string, value: string): void {\n if (typeof value !== \"string\" || value.trim().length === 0) {\n throw new Error(`${name} must be a non-empty string`);\n }\n}\n\nfunction fnv1a64(value: string): string {\n let hash = 0xcbf29ce484222325n;\n for (const character of value) {\n hash ^= BigInt(character.codePointAt(0) ?? 0);\n hash = BigInt.asUintN(64, hash * 0x100000001b3n);\n }\n return hash.toString(16).padStart(16, \"0\");\n}\n\nfunction boundedKey(prefix: string, parts: string[], maxLength: number): string {\n const canonical = parts.map((part) => part.trim()).join(\":\");\n const readable = `${prefix}:${canonical}`;\n if (readable.length <= maxLength) return readable;\n return `${prefix}:h${fnv1a64(canonical)}`;\n}\n\nexport function createMerchantBillingSystemSourceKey(\n shopId: string,\n code: BillingSystemMessageCode,\n eventIdentity: string,\n version = 1,\n): string {\n assertKeyPart(\"shopId\", shopId);\n assertKeyPart(\"code\", code);\n assertKeyPart(\"eventIdentity\", eventIdentity);\n if (!Number.isInteger(version) || version < 1) {\n throw new Error(\"version must be a positive integer\");\n }\n return boundedKey(\"billing-system\", [shopId, code, eventIdentity, String(version)], 255);\n}\n\nexport function createRecoveryIdempotencyKey(shopId: string, recoveryId: string): string {\n assertKeyPart(\"shopId\", shopId);\n assertKeyPart(\"recoveryId\", recoveryId);\n return boundedKey(\"recovery\", [shopId, recoveryId], 255);\n}\n\nexport function createShopifyUsageIdempotencyKey(\n shopId: string,\n usageEventId: string,\n): string {\n assertKeyPart(\"shopId\", shopId);\n assertKeyPart(\"usageEventId\", usageEventId);\n return boundedKey(\"shopify\", [shopId, usageEventId], 64);\n}"],"mappings":";AAAA,SAAS,SAAS;AAEX,IAAM,0CAA0C;AAChD,IAAM,0CAA0C;AAEhD,IAAM,qBAAqB,CAAC,QAAQ,cAAc;AAClD,IAAM,wBAAwB,EAAE,KAAK,kBAAkB;AAGvD,IAAM,wBAAwB;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AACF;AACO,IAAM,2BAA2B,EAAE,KAAK,qBAAqB;AAG7D,IAAM,+BAA+B;AAAA,EAC1C,wBAAwB;AAAA,EACxB,0BAA0B;AAAA,EAC1B,eAAe;AAAA,EACf,0BAA0B;AAAA,EAC1B,oBAAoB;AAAA,EACpB,sBAAsB;AACxB;AAEA,IAAM,qCAAqC;AAAA,EACzC,6BAA6B;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QAAQ,YAAY,GAAG,EAAE;AACzD;","names":[]}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
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 { ARCH007_BILLING_CONTRACT_SCHEMA_VERSION, BILLING_PLAN_KINDS, BILLING_SYSTEM_MESSAGE_CODES, BILLING_USAGE_METRICS, BillingPlanKind, BillingPlanKindSchema, BillingSystemMessageCode, BillingSystemMessageCodeSchema, BillingUsageMetric, BillingUsageMetricSchema, NormalizedWhatsAppStatus, NormalizedWhatsAppStatusSchema, WHATSAPP_PROVIDER_STATUSES, WHATSAPP_PROVIDER_STATUS_SCHEMA_VERSION, WhatsAppProviderPricingMetadata, WhatsAppProviderPricingMetadataSchema, WhatsAppProviderStatus, WhatsAppProviderStatusSchema, createMerchantBillingSystemSourceKey, createRecoveryIdempotencyKey, createShopifyUsageIdempotencyKey, parseNormalizedWhatsAppStatus, safeParseNormalizedWhatsAppStatus } from './billing.js';
2
3
  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';
3
4
  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';
4
5
  import 'zod';
package/dist/index.js CHANGED
@@ -1,3 +1,22 @@
1
+ import {
2
+ ARCH007_BILLING_CONTRACT_SCHEMA_VERSION,
3
+ BILLING_PLAN_KINDS,
4
+ BILLING_SYSTEM_MESSAGE_CODES,
5
+ BILLING_USAGE_METRICS,
6
+ BillingPlanKindSchema,
7
+ BillingSystemMessageCodeSchema,
8
+ BillingUsageMetricSchema,
9
+ NormalizedWhatsAppStatusSchema,
10
+ WHATSAPP_PROVIDER_STATUSES,
11
+ WHATSAPP_PROVIDER_STATUS_SCHEMA_VERSION,
12
+ WhatsAppProviderPricingMetadataSchema,
13
+ WhatsAppProviderStatusSchema,
14
+ createMerchantBillingSystemSourceKey,
15
+ createRecoveryIdempotencyKey,
16
+ createShopifyUsageIdempotencyKey,
17
+ parseNormalizedWhatsAppStatus,
18
+ safeParseNormalizedWhatsAppStatus
19
+ } from "./chunk-LT2MFACA.js";
1
20
  import {
2
21
  AuthoredSupportBodySchema,
3
22
  MERCHANT_COMMUNICATIONS_JOB_NAMES,
@@ -86,7 +105,14 @@ import {
86
105
  validateIcuCatalogue
87
106
  } from "./chunk-B6Y3QQLI.js";
88
107
  export {
108
+ ARCH007_BILLING_CONTRACT_SCHEMA_VERSION,
89
109
  AuthoredSupportBodySchema,
110
+ BILLING_PLAN_KINDS,
111
+ BILLING_SYSTEM_MESSAGE_CODES,
112
+ BILLING_USAGE_METRICS,
113
+ BillingPlanKindSchema,
114
+ BillingSystemMessageCodeSchema,
115
+ BillingUsageMetricSchema,
90
116
  CheckoutCreatedPayloadV2Schema,
91
117
  CheckoutObservedPayloadSchema,
92
118
  CheckoutUpdatedPayloadV2Schema,
@@ -111,6 +137,7 @@ export {
111
137
  MerchantTranslationReconciliationRequestContractSchema,
112
138
  MerchantTranslationReconciliationScopeSchema,
113
139
  MerchantTranslationReconciliationStatusSchema,
140
+ NormalizedWhatsAppStatusSchema,
114
141
  OrderCompletedPayloadSchema,
115
142
  OrderCompletedPayloadV2Schema,
116
143
  PLATFORM_SUPPORT_LANGUAGE_TAG,
@@ -142,14 +169,21 @@ export {
142
169
  TranslationBatchSubmitJobSchema,
143
170
  TranslationDispatchJobSchema,
144
171
  TranslationReconcileJobSchema,
172
+ WHATSAPP_PROVIDER_STATUSES,
173
+ WHATSAPP_PROVIDER_STATUS_SCHEMA_VERSION,
174
+ WhatsAppProviderPricingMetadataSchema,
175
+ WhatsAppProviderStatusSchema,
145
176
  canonicaliseLanguageTag,
146
177
  countUnicodeGraphemes,
147
178
  createInternationalizationRuntime,
179
+ createMerchantBillingSystemSourceKey,
180
+ createRecoveryIdempotencyKey,
148
181
  createShopifyCartActivityOrderingKey,
149
182
  createShopifyCommerceOrderingKey,
150
183
  createShopifyOrderCorrelationOrderingKey,
151
184
  createShopifyOrderOrderingKey,
152
185
  createShopifyPendingRecoveryOrderingKey,
186
+ createShopifyUsageIdempotencyKey,
153
187
  isCartActivityEventV2,
154
188
  isCheckoutCreatedEventV2,
155
189
  isCheckoutObservedEvent,
@@ -160,10 +194,12 @@ export {
160
194
  normalizeCountryCode,
161
195
  normalizeCurrencyCode,
162
196
  normalizeTimeZone,
197
+ parseNormalizedWhatsAppStatus,
163
198
  parseShopifyCommerceEvent,
164
199
  parseShopifyRecoveryEventV2,
165
200
  requiresMerchantTranslation,
166
201
  resolveLocaleDirection,
202
+ safeParseNormalizedWhatsAppStatus,
167
203
  safeParseShopifyCommerceEvent,
168
204
  safeParseShopifyRecoveryEventV2,
169
205
  validateIcuCatalogue
@@ -9,9 +9,9 @@ declare const MerchantSupportMessageKindSchema: z.ZodEnum<{
9
9
  MERCHANT: "MERCHANT";
10
10
  }>;
11
11
  declare const MerchantSupportMessageStateSchema: z.ZodEnum<{
12
+ FAILED: "FAILED";
12
13
  PROCESSING: "PROCESSING";
13
14
  AVAILABLE: "AVAILABLE";
14
- FAILED: "FAILED";
15
15
  }>;
16
16
  declare const MerchantTranslationDirectionSchema: z.ZodEnum<{
17
17
  MERCHANT_TO_ADMIN: "MERCHANT_TO_ADMIN";
@@ -19,8 +19,8 @@ declare const MerchantTranslationDirectionSchema: z.ZodEnum<{
19
19
  SYSTEM_TO_MERCHANT: "SYSTEM_TO_MERCHANT";
20
20
  }>;
21
21
  declare const MerchantMessageTranslationStatusSchema: z.ZodEnum<{
22
- AVAILABLE: "AVAILABLE";
23
22
  FAILED: "FAILED";
23
+ AVAILABLE: "AVAILABLE";
24
24
  PENDING: "PENDING";
25
25
  }>;
26
26
  declare const MerchantTranslationBatchStatusSchema: z.ZodEnum<{
@@ -39,8 +39,8 @@ declare const MerchantTranslationReconciliationScopeSchema: z.ZodEnum<{
39
39
  FAILED_TRANSLATIONS: "FAILED_TRANSLATIONS";
40
40
  }>;
41
41
  declare const MerchantTranslationReconciliationStatusSchema: z.ZodEnum<{
42
- PROCESSING: "PROCESSING";
43
42
  FAILED: "FAILED";
43
+ PROCESSING: "PROCESSING";
44
44
  PENDING: "PENDING";
45
45
  COMPLETED: "COMPLETED";
46
46
  }>;
@@ -61,9 +61,9 @@ declare const MerchantSupportMessageContractSchema: z.ZodObject<{
61
61
  MERCHANT: "MERCHANT";
62
62
  }>;
63
63
  state: z.ZodEnum<{
64
+ FAILED: "FAILED";
64
65
  PROCESSING: "PROCESSING";
65
66
  AVAILABLE: "AVAILABLE";
66
- FAILED: "FAILED";
67
67
  }>;
68
68
  originalBody: z.ZodString;
69
69
  sourceLanguageTag: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
@@ -78,8 +78,8 @@ declare const MerchantMessageTranslationContractSchema: z.ZodObject<{
78
78
  sourceLanguageTag: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
79
79
  targetLanguageTag: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
80
80
  status: z.ZodEnum<{
81
- AVAILABLE: "AVAILABLE";
82
81
  FAILED: "FAILED";
82
+ AVAILABLE: "AVAILABLE";
83
83
  PENDING: "PENDING";
84
84
  }>;
85
85
  translatedBody: z.ZodNullable<z.ZodString>;
@@ -110,8 +110,8 @@ declare const MerchantTranslationReconciliationRequestContractSchema: z.ZodObjec
110
110
  }>;
111
111
  translationId: z.ZodNullable<z.ZodString>;
112
112
  status: z.ZodEnum<{
113
- PROCESSING: "PROCESSING";
114
113
  FAILED: "FAILED";
114
+ PROCESSING: "PROCESSING";
115
115
  PENDING: "PENDING";
116
116
  COMPLETED: "COMPLETED";
117
117
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modainteract/moda-interact-shared",
3
- "version": "0.7.2",
3
+ "version": "0.7.4",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -16,6 +16,10 @@
16
16
  "types": "./dist/internationalization.d.ts",
17
17
  "import": "./dist/internationalization.js"
18
18
  },
19
+ "./billing": {
20
+ "types": "./dist/billing.d.ts",
21
+ "import": "./dist/billing.js"
22
+ },
19
23
  "./merchant-communications": {
20
24
  "types": "./dist/merchant-communications.d.ts",
21
25
  "import": "./dist/merchant-communications.js"