@modainteract/moda-interact-shared 2.5.0 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -0
- package/dist/{chunk-QJNZJACH.js → chunk-GFAARCMY.js} +208 -225
- package/dist/chunk-GFAARCMY.js.map +1 -0
- package/dist/chunk-QVPEX7KY.js +54 -0
- package/dist/chunk-QVPEX7KY.js.map +1 -0
- package/dist/{chunk-XUTUA6JD.js → chunk-YI62KDTG.js} +5 -3
- package/dist/{chunk-XUTUA6JD.js.map → chunk-YI62KDTG.js.map} +1 -1
- package/dist/commerce/index.d.ts +10 -3
- package/dist/commerce/index.js +25 -12
- package/dist/commerce/index.js.map +1 -1
- package/dist/commerce/model/node.d.ts +2 -2
- package/dist/commerce/model/node.js +2 -1
- package/dist/commerce/model/node.js.map +1 -1
- package/dist/commerce/runner/index.d.ts +3 -3
- package/dist/commerce/runner/index.js +5 -3
- package/dist/commerce/runner/index.js.map +1 -1
- package/dist/recovery-offer-proof.d.ts +133 -0
- package/dist/recovery-offer-proof.js +70 -0
- package/dist/recovery-offer-proof.js.map +1 -0
- package/dist/recovery-template-bindings.d.ts +142 -0
- package/dist/recovery-template-bindings.js +62 -0
- package/dist/recovery-template-bindings.js.map +1 -0
- package/dist/{response-DjZkLFT7.d.ts → response-B0UmFDrU.d.ts} +67 -1
- package/dist/{types-LT58TPMW.d.ts → types-D89lgpvg.d.ts} +1 -1
- package/dist/whatsapp-template-events.d.ts +29 -0
- package/dist/whatsapp-template-events.js +93 -0
- package/dist/whatsapp-template-events.js.map +1 -0
- package/fixtures/meta-template-status-v2.json +91 -0
- package/package.json +18 -3
- package/dist/chunk-QJNZJACH.js.map +0 -1
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const RecoveryTemplateSemanticKeySchema: z.ZodEnum<{
|
|
4
|
+
"customer.firstName": "customer.firstName";
|
|
5
|
+
"shop.name": "shop.name";
|
|
6
|
+
"shop.categoryName": "shop.categoryName";
|
|
7
|
+
"checkout.url": "checkout.url";
|
|
8
|
+
"checkout.itemsSummary": "checkout.itemsSummary";
|
|
9
|
+
"offer.code": "offer.code";
|
|
10
|
+
"offer.description": "offer.description";
|
|
11
|
+
"promotion.productName": "promotion.productName";
|
|
12
|
+
"promotion.productUrl": "promotion.productUrl";
|
|
13
|
+
"promotion.offerDescription": "promotion.offerDescription";
|
|
14
|
+
"promotion.code": "promotion.code";
|
|
15
|
+
"shopBrand.brandName": "shopBrand.brandName";
|
|
16
|
+
"shopBrand.logoUrl": "shopBrand.logoUrl";
|
|
17
|
+
"shopBrand.logoAltText": "shopBrand.logoAltText";
|
|
18
|
+
"shopBrand.logoWidth": "shopBrand.logoWidth";
|
|
19
|
+
"shopBrand.logoHeight": "shopBrand.logoHeight";
|
|
20
|
+
"shopBrand.squareLogoUrl": "shopBrand.squareLogoUrl";
|
|
21
|
+
"shopBrand.squareLogoAltText": "shopBrand.squareLogoAltText";
|
|
22
|
+
"shopBrand.coverImageUrl": "shopBrand.coverImageUrl";
|
|
23
|
+
}>;
|
|
24
|
+
type RecoveryTemplateSemanticKey = z.infer<typeof RecoveryTemplateSemanticKeySchema>;
|
|
25
|
+
declare const RecoveryPromotionTargetSchema: z.ZodEnum<{
|
|
26
|
+
CHECKOUT: "CHECKOUT";
|
|
27
|
+
ALTERNATIVE_PRODUCT: "ALTERNATIVE_PRODUCT";
|
|
28
|
+
}>;
|
|
29
|
+
type RecoveryPromotionTarget = z.infer<typeof RecoveryPromotionTargetSchema>;
|
|
30
|
+
declare const RecoveryTemplateHeaderMediaRoleSchema: z.ZodEnum<{
|
|
31
|
+
LOGO: "LOGO";
|
|
32
|
+
SQUARE_LOGO: "SQUARE_LOGO";
|
|
33
|
+
COVER_IMAGE: "COVER_IMAGE";
|
|
34
|
+
CHECKOUT_PRODUCT: "CHECKOUT_PRODUCT";
|
|
35
|
+
}>;
|
|
36
|
+
type RecoveryTemplateHeaderMediaRole = z.infer<typeof RecoveryTemplateHeaderMediaRoleSchema>;
|
|
37
|
+
declare const RecoveryTemplateTextBindingSchema: z.ZodObject<{
|
|
38
|
+
position: z.ZodNumber;
|
|
39
|
+
variable: z.ZodEnum<{
|
|
40
|
+
"customer.firstName": "customer.firstName";
|
|
41
|
+
"shop.name": "shop.name";
|
|
42
|
+
"shop.categoryName": "shop.categoryName";
|
|
43
|
+
"checkout.url": "checkout.url";
|
|
44
|
+
"checkout.itemsSummary": "checkout.itemsSummary";
|
|
45
|
+
"offer.code": "offer.code";
|
|
46
|
+
"offer.description": "offer.description";
|
|
47
|
+
"promotion.productName": "promotion.productName";
|
|
48
|
+
"promotion.productUrl": "promotion.productUrl";
|
|
49
|
+
"promotion.offerDescription": "promotion.offerDescription";
|
|
50
|
+
"promotion.code": "promotion.code";
|
|
51
|
+
"shopBrand.brandName": "shopBrand.brandName";
|
|
52
|
+
"shopBrand.logoUrl": "shopBrand.logoUrl";
|
|
53
|
+
"shopBrand.logoAltText": "shopBrand.logoAltText";
|
|
54
|
+
"shopBrand.logoWidth": "shopBrand.logoWidth";
|
|
55
|
+
"shopBrand.logoHeight": "shopBrand.logoHeight";
|
|
56
|
+
"shopBrand.squareLogoUrl": "shopBrand.squareLogoUrl";
|
|
57
|
+
"shopBrand.squareLogoAltText": "shopBrand.squareLogoAltText";
|
|
58
|
+
"shopBrand.coverImageUrl": "shopBrand.coverImageUrl";
|
|
59
|
+
}>;
|
|
60
|
+
}, z.core.$strict>;
|
|
61
|
+
type RecoveryTemplateTextBinding = z.infer<typeof RecoveryTemplateTextBindingSchema>;
|
|
62
|
+
declare const RecoveryTemplateUrlButtonBindingSchema: z.ZodObject<{
|
|
63
|
+
index: z.ZodNumber;
|
|
64
|
+
subType: z.ZodLiteral<"url">;
|
|
65
|
+
variable: z.ZodEnum<{
|
|
66
|
+
"checkout.url": "checkout.url";
|
|
67
|
+
"promotion.productUrl": "promotion.productUrl";
|
|
68
|
+
}>;
|
|
69
|
+
}, z.core.$strict>;
|
|
70
|
+
type RecoveryTemplateUrlButtonBinding = z.infer<typeof RecoveryTemplateUrlButtonBindingSchema>;
|
|
71
|
+
declare const RecoveryTemplateFrozenBindingsSchema: z.ZodObject<{
|
|
72
|
+
schemaVersion: z.ZodOptional<z.ZodLiteral<1>>;
|
|
73
|
+
promotionTarget: z.ZodOptional<z.ZodEnum<{
|
|
74
|
+
CHECKOUT: "CHECKOUT";
|
|
75
|
+
ALTERNATIVE_PRODUCT: "ALTERNATIVE_PRODUCT";
|
|
76
|
+
}>>;
|
|
77
|
+
headerMediaRole: z.ZodOptional<z.ZodEnum<{
|
|
78
|
+
LOGO: "LOGO";
|
|
79
|
+
SQUARE_LOGO: "SQUARE_LOGO";
|
|
80
|
+
COVER_IMAGE: "COVER_IMAGE";
|
|
81
|
+
CHECKOUT_PRODUCT: "CHECKOUT_PRODUCT";
|
|
82
|
+
}>>;
|
|
83
|
+
header: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
84
|
+
position: z.ZodNumber;
|
|
85
|
+
variable: z.ZodEnum<{
|
|
86
|
+
"customer.firstName": "customer.firstName";
|
|
87
|
+
"shop.name": "shop.name";
|
|
88
|
+
"shop.categoryName": "shop.categoryName";
|
|
89
|
+
"checkout.url": "checkout.url";
|
|
90
|
+
"checkout.itemsSummary": "checkout.itemsSummary";
|
|
91
|
+
"offer.code": "offer.code";
|
|
92
|
+
"offer.description": "offer.description";
|
|
93
|
+
"promotion.productName": "promotion.productName";
|
|
94
|
+
"promotion.productUrl": "promotion.productUrl";
|
|
95
|
+
"promotion.offerDescription": "promotion.offerDescription";
|
|
96
|
+
"promotion.code": "promotion.code";
|
|
97
|
+
"shopBrand.brandName": "shopBrand.brandName";
|
|
98
|
+
"shopBrand.logoUrl": "shopBrand.logoUrl";
|
|
99
|
+
"shopBrand.logoAltText": "shopBrand.logoAltText";
|
|
100
|
+
"shopBrand.logoWidth": "shopBrand.logoWidth";
|
|
101
|
+
"shopBrand.logoHeight": "shopBrand.logoHeight";
|
|
102
|
+
"shopBrand.squareLogoUrl": "shopBrand.squareLogoUrl";
|
|
103
|
+
"shopBrand.squareLogoAltText": "shopBrand.squareLogoAltText";
|
|
104
|
+
"shopBrand.coverImageUrl": "shopBrand.coverImageUrl";
|
|
105
|
+
}>;
|
|
106
|
+
}, z.core.$strict>>>;
|
|
107
|
+
body: z.ZodArray<z.ZodObject<{
|
|
108
|
+
position: z.ZodNumber;
|
|
109
|
+
variable: z.ZodEnum<{
|
|
110
|
+
"customer.firstName": "customer.firstName";
|
|
111
|
+
"shop.name": "shop.name";
|
|
112
|
+
"shop.categoryName": "shop.categoryName";
|
|
113
|
+
"checkout.url": "checkout.url";
|
|
114
|
+
"checkout.itemsSummary": "checkout.itemsSummary";
|
|
115
|
+
"offer.code": "offer.code";
|
|
116
|
+
"offer.description": "offer.description";
|
|
117
|
+
"promotion.productName": "promotion.productName";
|
|
118
|
+
"promotion.productUrl": "promotion.productUrl";
|
|
119
|
+
"promotion.offerDescription": "promotion.offerDescription";
|
|
120
|
+
"promotion.code": "promotion.code";
|
|
121
|
+
"shopBrand.brandName": "shopBrand.brandName";
|
|
122
|
+
"shopBrand.logoUrl": "shopBrand.logoUrl";
|
|
123
|
+
"shopBrand.logoAltText": "shopBrand.logoAltText";
|
|
124
|
+
"shopBrand.logoWidth": "shopBrand.logoWidth";
|
|
125
|
+
"shopBrand.logoHeight": "shopBrand.logoHeight";
|
|
126
|
+
"shopBrand.squareLogoUrl": "shopBrand.squareLogoUrl";
|
|
127
|
+
"shopBrand.squareLogoAltText": "shopBrand.squareLogoAltText";
|
|
128
|
+
"shopBrand.coverImageUrl": "shopBrand.coverImageUrl";
|
|
129
|
+
}>;
|
|
130
|
+
}, z.core.$strict>>;
|
|
131
|
+
buttons: z.ZodArray<z.ZodObject<{
|
|
132
|
+
index: z.ZodNumber;
|
|
133
|
+
subType: z.ZodLiteral<"url">;
|
|
134
|
+
variable: z.ZodEnum<{
|
|
135
|
+
"checkout.url": "checkout.url";
|
|
136
|
+
"promotion.productUrl": "promotion.productUrl";
|
|
137
|
+
}>;
|
|
138
|
+
}, z.core.$strict>>;
|
|
139
|
+
}, z.core.$strict>;
|
|
140
|
+
type RecoveryTemplateFrozenBindings = z.infer<typeof RecoveryTemplateFrozenBindingsSchema>;
|
|
141
|
+
|
|
142
|
+
export { type RecoveryPromotionTarget, RecoveryPromotionTargetSchema, type RecoveryTemplateFrozenBindings, RecoveryTemplateFrozenBindingsSchema, type RecoveryTemplateHeaderMediaRole, RecoveryTemplateHeaderMediaRoleSchema, type RecoveryTemplateSemanticKey, RecoveryTemplateSemanticKeySchema, type RecoveryTemplateTextBinding, RecoveryTemplateTextBindingSchema, type RecoveryTemplateUrlButtonBinding, RecoveryTemplateUrlButtonBindingSchema };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// src/recovery-template-bindings.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
var RecoveryTemplateSemanticKeySchema = z.enum([
|
|
4
|
+
"customer.firstName",
|
|
5
|
+
"shop.name",
|
|
6
|
+
"shop.categoryName",
|
|
7
|
+
"checkout.url",
|
|
8
|
+
"checkout.itemsSummary",
|
|
9
|
+
"offer.code",
|
|
10
|
+
"offer.description",
|
|
11
|
+
"promotion.productName",
|
|
12
|
+
"promotion.productUrl",
|
|
13
|
+
"promotion.offerDescription",
|
|
14
|
+
"promotion.code",
|
|
15
|
+
"shopBrand.brandName",
|
|
16
|
+
"shopBrand.logoUrl",
|
|
17
|
+
"shopBrand.logoAltText",
|
|
18
|
+
"shopBrand.logoWidth",
|
|
19
|
+
"shopBrand.logoHeight",
|
|
20
|
+
"shopBrand.squareLogoUrl",
|
|
21
|
+
"shopBrand.squareLogoAltText",
|
|
22
|
+
"shopBrand.coverImageUrl"
|
|
23
|
+
]);
|
|
24
|
+
var RecoveryPromotionTargetSchema = z.enum([
|
|
25
|
+
"CHECKOUT",
|
|
26
|
+
"ALTERNATIVE_PRODUCT"
|
|
27
|
+
]);
|
|
28
|
+
var RecoveryTemplateHeaderMediaRoleSchema = z.enum([
|
|
29
|
+
"LOGO",
|
|
30
|
+
"SQUARE_LOGO",
|
|
31
|
+
"COVER_IMAGE",
|
|
32
|
+
"CHECKOUT_PRODUCT"
|
|
33
|
+
]);
|
|
34
|
+
var RecoveryTemplateTextBindingSchema = z.strictObject({
|
|
35
|
+
position: z.number().int(),
|
|
36
|
+
variable: RecoveryTemplateSemanticKeySchema
|
|
37
|
+
});
|
|
38
|
+
var RecoveryTemplateUrlButtonBindingSchema = z.strictObject({
|
|
39
|
+
index: z.number().int(),
|
|
40
|
+
subType: z.literal("url"),
|
|
41
|
+
variable: z.enum([
|
|
42
|
+
"checkout.url",
|
|
43
|
+
"promotion.productUrl"
|
|
44
|
+
])
|
|
45
|
+
});
|
|
46
|
+
var RecoveryTemplateFrozenBindingsSchema = z.strictObject({
|
|
47
|
+
schemaVersion: z.literal(1).optional(),
|
|
48
|
+
promotionTarget: RecoveryPromotionTargetSchema.optional(),
|
|
49
|
+
headerMediaRole: RecoveryTemplateHeaderMediaRoleSchema.optional(),
|
|
50
|
+
header: z.array(RecoveryTemplateTextBindingSchema).optional(),
|
|
51
|
+
body: z.array(RecoveryTemplateTextBindingSchema),
|
|
52
|
+
buttons: z.array(RecoveryTemplateUrlButtonBindingSchema)
|
|
53
|
+
});
|
|
54
|
+
export {
|
|
55
|
+
RecoveryPromotionTargetSchema,
|
|
56
|
+
RecoveryTemplateFrozenBindingsSchema,
|
|
57
|
+
RecoveryTemplateHeaderMediaRoleSchema,
|
|
58
|
+
RecoveryTemplateSemanticKeySchema,
|
|
59
|
+
RecoveryTemplateTextBindingSchema,
|
|
60
|
+
RecoveryTemplateUrlButtonBindingSchema
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=recovery-template-bindings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/recovery-template-bindings.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const RecoveryTemplateSemanticKeySchema = z.enum([\n \"customer.firstName\",\n \"shop.name\",\n \"shop.categoryName\",\n \"checkout.url\",\n \"checkout.itemsSummary\",\n \"offer.code\",\n \"offer.description\",\n \"promotion.productName\",\n \"promotion.productUrl\",\n \"promotion.offerDescription\",\n \"promotion.code\",\n \"shopBrand.brandName\",\n \"shopBrand.logoUrl\",\n \"shopBrand.logoAltText\",\n \"shopBrand.logoWidth\",\n \"shopBrand.logoHeight\",\n \"shopBrand.squareLogoUrl\",\n \"shopBrand.squareLogoAltText\",\n \"shopBrand.coverImageUrl\",\n]);\nexport type RecoveryTemplateSemanticKey =\n z.infer<typeof RecoveryTemplateSemanticKeySchema>;\n\nexport const RecoveryPromotionTargetSchema = z.enum([\n \"CHECKOUT\",\n \"ALTERNATIVE_PRODUCT\",\n]);\nexport type RecoveryPromotionTarget =\n z.infer<typeof RecoveryPromotionTargetSchema>;\n\nexport const RecoveryTemplateHeaderMediaRoleSchema = z.enum([\n \"LOGO\",\n \"SQUARE_LOGO\",\n \"COVER_IMAGE\",\n \"CHECKOUT_PRODUCT\",\n]);\nexport type RecoveryTemplateHeaderMediaRole =\n z.infer<typeof RecoveryTemplateHeaderMediaRoleSchema>;\n\nexport const RecoveryTemplateTextBindingSchema = z.strictObject({\n position: z.number().int(),\n variable: RecoveryTemplateSemanticKeySchema,\n});\nexport type RecoveryTemplateTextBinding =\n z.infer<typeof RecoveryTemplateTextBindingSchema>;\n\nexport const RecoveryTemplateUrlButtonBindingSchema = z.strictObject({\n index: z.number().int(),\n subType: z.literal(\"url\"),\n variable: z.enum([\n \"checkout.url\",\n \"promotion.productUrl\",\n ]),\n});\nexport type RecoveryTemplateUrlButtonBinding =\n z.infer<typeof RecoveryTemplateUrlButtonBindingSchema>;\n\nexport const RecoveryTemplateFrozenBindingsSchema = z.strictObject({\n schemaVersion: z.literal(1).optional(),\n promotionTarget: RecoveryPromotionTargetSchema.optional(),\n headerMediaRole: RecoveryTemplateHeaderMediaRoleSchema.optional(),\n header: z.array(RecoveryTemplateTextBindingSchema).optional(),\n body: z.array(RecoveryTemplateTextBindingSchema),\n buttons: z.array(RecoveryTemplateUrlButtonBindingSchema),\n});\nexport type RecoveryTemplateFrozenBindings =\n z.infer<typeof RecoveryTemplateFrozenBindingsSchema>;\n"],"mappings":";AAAA,SAAS,SAAS;AAEX,IAAM,oCAAoC,EAAE,KAAK;AAAA,EACtD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAIM,IAAM,gCAAgC,EAAE,KAAK;AAAA,EAClD;AAAA,EACA;AACF,CAAC;AAIM,IAAM,wCAAwC,EAAE,KAAK;AAAA,EAC1D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAIM,IAAM,oCAAoC,EAAE,aAAa;AAAA,EAC9D,UAAU,EAAE,OAAO,EAAE,IAAI;AAAA,EACzB,UAAU;AACZ,CAAC;AAIM,IAAM,yCAAyC,EAAE,aAAa;AAAA,EACnE,OAAO,EAAE,OAAO,EAAE,IAAI;AAAA,EACtB,SAAS,EAAE,QAAQ,KAAK;AAAA,EACxB,UAAU,EAAE,KAAK;AAAA,IACf;AAAA,IACA;AAAA,EACF,CAAC;AACH,CAAC;AAIM,IAAM,uCAAuC,EAAE,aAAa;AAAA,EACjE,eAAe,EAAE,QAAQ,CAAC,EAAE,SAAS;AAAA,EACrC,iBAAiB,8BAA8B,SAAS;AAAA,EACxD,iBAAiB,sCAAsC,SAAS;AAAA,EAChE,QAAQ,EAAE,MAAM,iCAAiC,EAAE,SAAS;AAAA,EAC5D,MAAM,EAAE,MAAM,iCAAiC;AAAA,EAC/C,SAAS,EAAE,MAAM,sCAAsC;AACzD,CAAC;","names":[]}
|
|
@@ -710,6 +710,12 @@ declare const CommerceBasketSchema: z.ZodObject<{
|
|
|
710
710
|
fingerprint: z.ZodString;
|
|
711
711
|
unknownFields: z.ZodArray<z.ZodString>;
|
|
712
712
|
}, z.core.$strict>;
|
|
713
|
+
declare const CommerceProductSaleEvidenceSchema: z.ZodObject<{
|
|
714
|
+
regularPrice: z.ZodNullable<z.ZodString>;
|
|
715
|
+
salePrice: z.ZodNullable<z.ZodString>;
|
|
716
|
+
observedAt: z.ZodISODateTime;
|
|
717
|
+
}, z.core.$strict>;
|
|
718
|
+
type CommerceProductSaleEvidence = z.infer<typeof CommerceProductSaleEvidenceSchema>;
|
|
713
719
|
declare const CommerceProductSchema: z.ZodObject<{
|
|
714
720
|
productId: z.ZodString;
|
|
715
721
|
variantId: z.ZodString;
|
|
@@ -720,6 +726,13 @@ declare const CommerceProductSchema: z.ZodObject<{
|
|
|
720
726
|
currency: z.ZodNullable<z.ZodString>;
|
|
721
727
|
productType: z.ZodNullable<z.ZodString>;
|
|
722
728
|
vendor: z.ZodNullable<z.ZodString>;
|
|
729
|
+
categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
730
|
+
imageUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
731
|
+
saleEvidence: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
732
|
+
regularPrice: z.ZodNullable<z.ZodString>;
|
|
733
|
+
salePrice: z.ZodNullable<z.ZodString>;
|
|
734
|
+
observedAt: z.ZodISODateTime;
|
|
735
|
+
}, z.core.$strict>>>;
|
|
723
736
|
observedAt: z.ZodISODateTime;
|
|
724
737
|
}, z.core.$strict>;
|
|
725
738
|
declare const CommerceOfferSchema: z.ZodObject<{
|
|
@@ -797,6 +810,13 @@ declare const CommerceAlternativeSchema: z.ZodObject<{
|
|
|
797
810
|
currency: z.ZodNullable<z.ZodString>;
|
|
798
811
|
productType: z.ZodNullable<z.ZodString>;
|
|
799
812
|
vendor: z.ZodNullable<z.ZodString>;
|
|
813
|
+
categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
814
|
+
imageUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
815
|
+
saleEvidence: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
816
|
+
regularPrice: z.ZodNullable<z.ZodString>;
|
|
817
|
+
salePrice: z.ZodNullable<z.ZodString>;
|
|
818
|
+
observedAt: z.ZodISODateTime;
|
|
819
|
+
}, z.core.$strict>>>;
|
|
800
820
|
observedAt: z.ZodISODateTime;
|
|
801
821
|
}, z.core.$strict>;
|
|
802
822
|
proposal: z.ZodObject<{
|
|
@@ -924,6 +944,10 @@ declare const CommerceToolInputs: {
|
|
|
924
944
|
limit: z.ZodDefault<z.ZodNumber>;
|
|
925
945
|
cursor: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
926
946
|
}, z.core.$strict>;
|
|
947
|
+
commerce_get_product: z.ZodObject<{
|
|
948
|
+
productId: z.ZodString;
|
|
949
|
+
variantId: z.ZodNullable<z.ZodString>;
|
|
950
|
+
}, z.core.$strict>;
|
|
927
951
|
commerce_get_discount_options: z.ZodObject<{}, z.core.$strict>;
|
|
928
952
|
commerce_evaluate_discount: z.ZodObject<{
|
|
929
953
|
offerId: z.ZodString;
|
|
@@ -981,11 +1005,39 @@ declare const CommerceToolOutputs: {
|
|
|
981
1005
|
currency: z.ZodNullable<z.ZodString>;
|
|
982
1006
|
productType: z.ZodNullable<z.ZodString>;
|
|
983
1007
|
vendor: z.ZodNullable<z.ZodString>;
|
|
1008
|
+
categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1009
|
+
imageUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1010
|
+
saleEvidence: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1011
|
+
regularPrice: z.ZodNullable<z.ZodString>;
|
|
1012
|
+
salePrice: z.ZodNullable<z.ZodString>;
|
|
1013
|
+
observedAt: z.ZodISODateTime;
|
|
1014
|
+
}, z.core.$strict>>>;
|
|
984
1015
|
observedAt: z.ZodISODateTime;
|
|
985
1016
|
}, z.core.$strict>>;
|
|
986
1017
|
cursor: z.ZodNullable<z.ZodString>;
|
|
987
1018
|
truncated: z.ZodBoolean;
|
|
988
1019
|
}, z.core.$strict>;
|
|
1020
|
+
commerce_get_product: z.ZodObject<{
|
|
1021
|
+
product: z.ZodNullable<z.ZodObject<{
|
|
1022
|
+
productId: z.ZodString;
|
|
1023
|
+
variantId: z.ZodString;
|
|
1024
|
+
title: z.ZodString;
|
|
1025
|
+
url: z.ZodNullable<z.ZodURL>;
|
|
1026
|
+
available: z.ZodNullable<z.ZodBoolean>;
|
|
1027
|
+
unitPrice: z.ZodNullable<z.ZodString>;
|
|
1028
|
+
currency: z.ZodNullable<z.ZodString>;
|
|
1029
|
+
productType: z.ZodNullable<z.ZodString>;
|
|
1030
|
+
vendor: z.ZodNullable<z.ZodString>;
|
|
1031
|
+
categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1032
|
+
imageUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1033
|
+
saleEvidence: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1034
|
+
regularPrice: z.ZodNullable<z.ZodString>;
|
|
1035
|
+
salePrice: z.ZodNullable<z.ZodString>;
|
|
1036
|
+
observedAt: z.ZodISODateTime;
|
|
1037
|
+
}, z.core.$strict>>>;
|
|
1038
|
+
observedAt: z.ZodISODateTime;
|
|
1039
|
+
}, z.core.$strict>>;
|
|
1040
|
+
}, z.core.$strict>;
|
|
989
1041
|
commerce_get_discount_options: z.ZodObject<{
|
|
990
1042
|
mode: z.ZodEnum<{
|
|
991
1043
|
NONE: "NONE";
|
|
@@ -1069,6 +1121,13 @@ declare const CommerceToolOutputs: {
|
|
|
1069
1121
|
currency: z.ZodNullable<z.ZodString>;
|
|
1070
1122
|
productType: z.ZodNullable<z.ZodString>;
|
|
1071
1123
|
vendor: z.ZodNullable<z.ZodString>;
|
|
1124
|
+
categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1125
|
+
imageUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1126
|
+
saleEvidence: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1127
|
+
regularPrice: z.ZodNullable<z.ZodString>;
|
|
1128
|
+
salePrice: z.ZodNullable<z.ZodString>;
|
|
1129
|
+
observedAt: z.ZodISODateTime;
|
|
1130
|
+
}, z.core.$strict>>>;
|
|
1072
1131
|
observedAt: z.ZodISODateTime;
|
|
1073
1132
|
}, z.core.$strict>;
|
|
1074
1133
|
proposal: z.ZodObject<{
|
|
@@ -1148,6 +1207,13 @@ declare const CommerceToolOutputs: {
|
|
|
1148
1207
|
currency: z.ZodNullable<z.ZodString>;
|
|
1149
1208
|
productType: z.ZodNullable<z.ZodString>;
|
|
1150
1209
|
vendor: z.ZodNullable<z.ZodString>;
|
|
1210
|
+
categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1211
|
+
imageUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1212
|
+
saleEvidence: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1213
|
+
regularPrice: z.ZodNullable<z.ZodString>;
|
|
1214
|
+
salePrice: z.ZodNullable<z.ZodString>;
|
|
1215
|
+
observedAt: z.ZodISODateTime;
|
|
1216
|
+
}, z.core.$strict>>>;
|
|
1151
1217
|
observedAt: z.ZodISODateTime;
|
|
1152
1218
|
}, z.core.$strict>;
|
|
1153
1219
|
proposal: z.ZodObject<{
|
|
@@ -1274,4 +1340,4 @@ declare function verifyResponseContract(definition: unknown, hash: string, diges
|
|
|
1274
1340
|
/** JSON Schema branches retain the immutable envelope; only ANSWER details vary. */
|
|
1275
1341
|
declare function finalResponseToolSchema(definition: CommerceResponseContract): Json;
|
|
1276
1342
|
|
|
1277
|
-
export {
|
|
1343
|
+
export { ToolDescriptorSchema as $, CommerceToolDefinitionSchema as A, type CommerceToolDraftDefinition as B, type CommerceTurnIdentity as C, type Digest as D, CommerceToolDraftDefinitionSchema as E, CommerceToolIdentitySchema as F, type GrantedTool as G, CommerceToolInputs as H, CommerceToolOutputs as I, CommerceToolResultSchema as J, CommerceToolRevisionIdentitySchema as K, CommerceTurnIdentitySchema as L, DetailsSchemaSchema as M, EMPTY_RESPONSE_CONTRACT as N, type ExternalHttpExecution as O, ExternalHttpExecutionSchema as P, GrantedToolSchema as Q, GrantedToolsSchema as R, type SubsetSchema as S, type ToolDescriptor as T, InputSchemaSchema as U, type Json as V, MONEY_PATTERN as W, POLICY_OPERATIONS as X, POLICY_OPERATION_DESCRIPTORS as Y, ReferralReasonSchema as Z, ResponseTemplateSchema as _, type CommerceConversationGrant as a, ToolNameSchema as a0, canonicalJson as a1, commerceToolResultSchema as a2, compileSubset as a3, definitionToMcpDescriptor as a4, finalResponseSchema as a5, finalResponseToolSchema as a6, jsonBytes as a7, mapToolArguments as a8, matchesSubset as a9, productBelongsToDomain as aa, responseContractCanonicalJson as ab, safeName as ac, safePath as ad, toolHashInput as ae, validateDefinitionForPublication as af, validateDefinitionVersion as ag, validateSubset as ah, verifyResponseContract as ai, type CommerceManifest as b, type CommerceToolResult as c, type CommerceFinalResponse as d, type CommerceToolDefinition as e, CommerceAlternativeSchema as f, CommerceAssertionSchema as g, CommerceBasketSchema as h, CommerceConversationGrantSchema as i, type CommerceDefinitionCompiler as j, CommerceErrorCodeSchema as k, type CommerceEvidence as l, CommerceEvidenceSchema as m, CommerceExecuteAssertionSchema as n, CommerceExecutionSchema as o, CommerceFinalResponseSchema as p, CommerceManifestSchema as q, CommerceOfferSchema as r, type CommerceProductSaleEvidence as s, CommerceProductSaleEvidenceSchema as t, CommerceProductSchema as u, CommerceProposalSchema as v, CommerceReleaseIdentitySchema as w, CommerceResolveAssertionSchema as x, type CommerceResponseContract as y, CommerceResponseContractSchema as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as CommerceTurnIdentity, a as CommerceConversationGrant, b as CommerceManifest, T as ToolDescriptor, G as GrantedTool, c as CommerceToolResult, D as Digest, d as CommerceFinalResponse } from './response-
|
|
1
|
+
import { C as CommerceTurnIdentity, a as CommerceConversationGrant, b as CommerceManifest, T as ToolDescriptor, G as GrantedTool, c as CommerceToolResult, D as Digest, d as CommerceFinalResponse } from './response-B0UmFDrU.js';
|
|
2
2
|
import { S as StructuredLogger } from './types-B32wDMLO.js';
|
|
3
3
|
|
|
4
4
|
/** Finite, non-customer-facing failure taxonomy for Commerce hosts and logs. */
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/** The existing WhatsApp event queue; this observation is a distinct job type. */
|
|
4
|
+
declare const META_TEMPLATE_STATUS_QUEUE: "whatsapp-events";
|
|
5
|
+
declare const META_TEMPLATE_STATUS_JOB: "meta-template-status-update";
|
|
6
|
+
declare const META_TEMPLATE_STATUS_SCHEMA_VERSION: 2;
|
|
7
|
+
/**
|
|
8
|
+
* Consumer and producer boundary schema. Preflight checks the *actual* UTF-8
|
|
9
|
+
* JSON encoding and exact own-key set before the typed, non-coercing Zod parse.
|
|
10
|
+
* It does not log rejected payloads or parse Meta business status semantics.
|
|
11
|
+
*/
|
|
12
|
+
declare const MetaTemplateStatusObservationV2Schema: z.ZodPipe<z.ZodUnknown, z.ZodObject<{
|
|
13
|
+
schemaVersion: z.ZodLiteral<2>;
|
|
14
|
+
eventIdentity: z.ZodString;
|
|
15
|
+
wabaId: z.ZodString;
|
|
16
|
+
providerTemplateId: z.ZodNullable<z.ZodString>;
|
|
17
|
+
providerTemplateName: z.ZodString;
|
|
18
|
+
providerLanguageCode: z.ZodString;
|
|
19
|
+
providerStatus: z.ZodString;
|
|
20
|
+
reasonCode: z.ZodNullable<z.ZodString>;
|
|
21
|
+
receivedAt: z.ZodString;
|
|
22
|
+
}, z.core.$strict>>;
|
|
23
|
+
type MetaTemplateStatusObservationV2 = z.infer<typeof MetaTemplateStatusObservationV2Schema>;
|
|
24
|
+
/** Identity of one authenticated observation; never a content fingerprint. */
|
|
25
|
+
declare function formatMetaTemplateStatusEventIdentity(observationId: string): string;
|
|
26
|
+
/** BullMQ-compatible job ID: the same UUID, without ':' separators. */
|
|
27
|
+
declare function formatMetaTemplateStatusJobId(observationId: string): string;
|
|
28
|
+
|
|
29
|
+
export { META_TEMPLATE_STATUS_JOB, META_TEMPLATE_STATUS_QUEUE, META_TEMPLATE_STATUS_SCHEMA_VERSION, type MetaTemplateStatusObservationV2, MetaTemplateStatusObservationV2Schema, formatMetaTemplateStatusEventIdentity, formatMetaTemplateStatusJobId };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// src/whatsapp-template-events.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
var META_TEMPLATE_STATUS_QUEUE = "whatsapp-events";
|
|
4
|
+
var META_TEMPLATE_STATUS_JOB = "meta-template-status-update";
|
|
5
|
+
var META_TEMPLATE_STATUS_SCHEMA_VERSION = 2;
|
|
6
|
+
var MAX_JSON_BYTES = 4096;
|
|
7
|
+
var REQUIRED_JSON_KEYS = [
|
|
8
|
+
"schemaVersion",
|
|
9
|
+
"eventIdentity",
|
|
10
|
+
"wabaId",
|
|
11
|
+
"providerTemplateId",
|
|
12
|
+
"providerTemplateName",
|
|
13
|
+
"providerLanguageCode",
|
|
14
|
+
"providerStatus",
|
|
15
|
+
"reasonCode",
|
|
16
|
+
"receivedAt"
|
|
17
|
+
];
|
|
18
|
+
var UUID_V4 = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
|
|
19
|
+
var EVENT_IDENTITY_PREFIX = "meta-template-status:v2:";
|
|
20
|
+
var JOB_ID_PREFIX = "meta-template-status-v2-";
|
|
21
|
+
var EVENT_IDENTITY = /^meta-template-status:v2:[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
|
|
22
|
+
var DECIMAL_PROVIDER_ID = /^[0-9]{1,32}$/;
|
|
23
|
+
var CANONICAL_UTC_RECEIPT = /^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d\.\d{3}Z$/;
|
|
24
|
+
var CONTROL_CHARACTERS = /[\u0000-\u001f\u007f]/;
|
|
25
|
+
function providerText(maxLength) {
|
|
26
|
+
return z.string().min(1).max(maxLength).refine(
|
|
27
|
+
(value) => value.trim().length > 0 && !CONTROL_CHARACTERS.test(value),
|
|
28
|
+
{ message: "Invalid Meta provider text" }
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
var canonicalReceivedAt = z.string().regex(CANONICAL_UTC_RECEIPT).refine(
|
|
32
|
+
(value) => {
|
|
33
|
+
const date = new Date(value);
|
|
34
|
+
return !Number.isNaN(date.getTime()) && date.toISOString() === value;
|
|
35
|
+
},
|
|
36
|
+
{ message: "receivedAt must be a valid canonical UTC millisecond timestamp" }
|
|
37
|
+
);
|
|
38
|
+
var observationFields = z.object({
|
|
39
|
+
schemaVersion: z.literal(META_TEMPLATE_STATUS_SCHEMA_VERSION),
|
|
40
|
+
eventIdentity: z.string().regex(EVENT_IDENTITY),
|
|
41
|
+
wabaId: z.string().regex(DECIMAL_PROVIDER_ID),
|
|
42
|
+
providerTemplateId: z.string().regex(DECIMAL_PROVIDER_ID).nullable(),
|
|
43
|
+
providerTemplateName: providerText(255),
|
|
44
|
+
providerLanguageCode: providerText(16),
|
|
45
|
+
// Unknown but well-formed provider statuses remain text. The Background
|
|
46
|
+
// consumer, not this transport contract, interprets provider state.
|
|
47
|
+
providerStatus: providerText(32),
|
|
48
|
+
reasonCode: providerText(128).nullable(),
|
|
49
|
+
// Receipt time is diagnostic, never a provider-status ordering authority.
|
|
50
|
+
receivedAt: canonicalReceivedAt
|
|
51
|
+
}).strict();
|
|
52
|
+
var MetaTemplateStatusObservationV2Schema = z.unknown().superRefine(
|
|
53
|
+
(input, ctx) => {
|
|
54
|
+
let json;
|
|
55
|
+
try {
|
|
56
|
+
json = JSON.stringify(input);
|
|
57
|
+
} catch {
|
|
58
|
+
}
|
|
59
|
+
if (typeof json !== "string") {
|
|
60
|
+
ctx.addIssue({ code: "custom", message: "Meta template-status observation must be JSON-serializable" });
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (new TextEncoder().encode(json).byteLength > MAX_JSON_BYTES) {
|
|
64
|
+
ctx.addIssue({ code: "custom", message: "Meta template-status observation exceeds 4096 UTF-8 bytes" });
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (input === null || typeof input !== "object" || Array.isArray(input) || Object.keys(input).length !== REQUIRED_JSON_KEYS.length || !REQUIRED_JSON_KEYS.every((key) => Object.prototype.hasOwnProperty.call(input, key))) {
|
|
68
|
+
ctx.addIssue({ code: "custom", message: "Meta template-status observation requires exactly nine own JSON fields" });
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
).pipe(observationFields);
|
|
72
|
+
function validateObservationId(observationId) {
|
|
73
|
+
if (typeof observationId !== "string" || !UUID_V4.test(observationId)) {
|
|
74
|
+
throw new TypeError("observationId must be a lowercase UUID v4");
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function formatMetaTemplateStatusEventIdentity(observationId) {
|
|
78
|
+
validateObservationId(observationId);
|
|
79
|
+
return `${EVENT_IDENTITY_PREFIX}${observationId}`;
|
|
80
|
+
}
|
|
81
|
+
function formatMetaTemplateStatusJobId(observationId) {
|
|
82
|
+
validateObservationId(observationId);
|
|
83
|
+
return `${JOB_ID_PREFIX}${observationId}`;
|
|
84
|
+
}
|
|
85
|
+
export {
|
|
86
|
+
META_TEMPLATE_STATUS_JOB,
|
|
87
|
+
META_TEMPLATE_STATUS_QUEUE,
|
|
88
|
+
META_TEMPLATE_STATUS_SCHEMA_VERSION,
|
|
89
|
+
MetaTemplateStatusObservationV2Schema,
|
|
90
|
+
formatMetaTemplateStatusEventIdentity,
|
|
91
|
+
formatMetaTemplateStatusJobId
|
|
92
|
+
};
|
|
93
|
+
//# sourceMappingURL=whatsapp-template-events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/whatsapp-template-events.ts"],"sourcesContent":["import { z } from \"zod\";\n\n/** The existing WhatsApp event queue; this observation is a distinct job type. */\nexport const META_TEMPLATE_STATUS_QUEUE = \"whatsapp-events\" as const;\nexport const META_TEMPLATE_STATUS_JOB = \"meta-template-status-update\" as const;\nexport const META_TEMPLATE_STATUS_SCHEMA_VERSION = 2 as const;\n\nconst MAX_JSON_BYTES = 4096;\nconst REQUIRED_JSON_KEYS = [\n \"schemaVersion\",\n \"eventIdentity\",\n \"wabaId\",\n \"providerTemplateId\",\n \"providerTemplateName\",\n \"providerLanguageCode\",\n \"providerStatus\",\n \"reasonCode\",\n \"receivedAt\",\n] as const;\n\n// Explicitly require a lowercase, RFC 4122 / RFC 9562 variant UUID *version 4*.\n// Meta does not supply an occurrence ID for this webhook: the authenticated\n// Messaging producer creates a fresh random UUID v4, not Shared.\nconst UUID_V4 = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;\nconst EVENT_IDENTITY_PREFIX = \"meta-template-status:v2:\";\nconst JOB_ID_PREFIX = \"meta-template-status-v2-\";\nconst EVENT_IDENTITY = /^meta-template-status:v2:[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;\nconst DECIMAL_PROVIDER_ID = /^[0-9]{1,32}$/;\nconst CANONICAL_UTC_RECEIPT = /^\\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\\d|3[01])T(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{3}Z$/;\nconst CONTROL_CHARACTERS = /[\\u0000-\\u001f\\u007f]/;\n\nfunction providerText(maxLength: number) {\n return z.string().min(1).max(maxLength).refine(\n (value) => value.trim().length > 0 && !CONTROL_CHARACTERS.test(value),\n { message: \"Invalid Meta provider text\" },\n );\n}\n\nconst canonicalReceivedAt = z.string().regex(CANONICAL_UTC_RECEIPT).refine(\n (value) => {\n const date = new Date(value);\n return !Number.isNaN(date.getTime()) && date.toISOString() === value;\n },\n { message: \"receivedAt must be a valid canonical UTC millisecond timestamp\" },\n);\n\nconst observationFields = z.object({\n schemaVersion: z.literal(META_TEMPLATE_STATUS_SCHEMA_VERSION),\n eventIdentity: z.string().regex(EVENT_IDENTITY),\n wabaId: z.string().regex(DECIMAL_PROVIDER_ID),\n providerTemplateId: z.string().regex(DECIMAL_PROVIDER_ID).nullable(),\n providerTemplateName: providerText(255),\n providerLanguageCode: providerText(16),\n // Unknown but well-formed provider statuses remain text. The Background\n // consumer, not this transport contract, interprets provider state.\n providerStatus: providerText(32),\n reasonCode: providerText(128).nullable(),\n // Receipt time is diagnostic, never a provider-status ordering authority.\n receivedAt: canonicalReceivedAt,\n}).strict();\n\n/**\n * Consumer and producer boundary schema. Preflight checks the *actual* UTF-8\n * JSON encoding and exact own-key set before the typed, non-coercing Zod parse.\n * It does not log rejected payloads or parse Meta business status semantics.\n */\nexport const MetaTemplateStatusObservationV2Schema = z.unknown().superRefine(\n (input, ctx) => {\n let json: string | undefined;\n try {\n json = JSON.stringify(input);\n } catch {\n // A circular / non-JSON payload is not a valid BullMQ wire observation.\n }\n if (typeof json !== \"string\") {\n ctx.addIssue({ code: \"custom\", message: \"Meta template-status observation must be JSON-serializable\" });\n return;\n }\n if (new TextEncoder().encode(json).byteLength > MAX_JSON_BYTES) {\n ctx.addIssue({ code: \"custom\", message: \"Meta template-status observation exceeds 4096 UTF-8 bytes\" });\n return;\n }\n if (input === null || typeof input !== \"object\" || Array.isArray(input)\n || Object.keys(input).length !== REQUIRED_JSON_KEYS.length\n || !REQUIRED_JSON_KEYS.every((key) => Object.prototype.hasOwnProperty.call(input, key))) {\n ctx.addIssue({ code: \"custom\", message: \"Meta template-status observation requires exactly nine own JSON fields\" });\n }\n },\n).pipe(observationFields);\n\nexport type MetaTemplateStatusObservationV2 = z.infer<typeof MetaTemplateStatusObservationV2Schema>;\n\nfunction validateObservationId(observationId: string): void {\n if (typeof observationId !== \"string\" || !UUID_V4.test(observationId)) {\n // Do not interpolate potentially untrusted identifiers into exceptions.\n throw new TypeError(\"observationId must be a lowercase UUID v4\");\n }\n}\n\n/** Identity of one authenticated observation; never a content fingerprint. */\nexport function formatMetaTemplateStatusEventIdentity(observationId: string): string {\n validateObservationId(observationId);\n return `${EVENT_IDENTITY_PREFIX}${observationId}`;\n}\n\n/** BullMQ-compatible job ID: the same UUID, without ':' separators. */\nexport function formatMetaTemplateStatusJobId(observationId: string): string {\n validateObservationId(observationId);\n return `${JOB_ID_PREFIX}${observationId}`;\n}\n"],"mappings":";AAAA,SAAS,SAAS;AAGX,IAAM,6BAA6B;AACnC,IAAM,2BAA2B;AACjC,IAAM,sCAAsC;AAEnD,IAAM,iBAAiB;AACvB,IAAM,qBAAqB;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAKA,IAAM,UAAU;AAChB,IAAM,wBAAwB;AAC9B,IAAM,gBAAgB;AACtB,IAAM,iBAAiB;AACvB,IAAM,sBAAsB;AAC5B,IAAM,wBAAwB;AAC9B,IAAM,qBAAqB;AAE3B,SAAS,aAAa,WAAmB;AACvC,SAAO,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,SAAS,EAAE;AAAA,IACtC,CAAC,UAAU,MAAM,KAAK,EAAE,SAAS,KAAK,CAAC,mBAAmB,KAAK,KAAK;AAAA,IACpE,EAAE,SAAS,6BAA6B;AAAA,EAC1C;AACF;AAEA,IAAM,sBAAsB,EAAE,OAAO,EAAE,MAAM,qBAAqB,EAAE;AAAA,EAClE,CAAC,UAAU;AACT,UAAM,OAAO,IAAI,KAAK,KAAK;AAC3B,WAAO,CAAC,OAAO,MAAM,KAAK,QAAQ,CAAC,KAAK,KAAK,YAAY,MAAM;AAAA,EACjE;AAAA,EACA,EAAE,SAAS,iEAAiE;AAC9E;AAEA,IAAM,oBAAoB,EAAE,OAAO;AAAA,EACjC,eAAe,EAAE,QAAQ,mCAAmC;AAAA,EAC5D,eAAe,EAAE,OAAO,EAAE,MAAM,cAAc;AAAA,EAC9C,QAAQ,EAAE,OAAO,EAAE,MAAM,mBAAmB;AAAA,EAC5C,oBAAoB,EAAE,OAAO,EAAE,MAAM,mBAAmB,EAAE,SAAS;AAAA,EACnE,sBAAsB,aAAa,GAAG;AAAA,EACtC,sBAAsB,aAAa,EAAE;AAAA;AAAA;AAAA,EAGrC,gBAAgB,aAAa,EAAE;AAAA,EAC/B,YAAY,aAAa,GAAG,EAAE,SAAS;AAAA;AAAA,EAEvC,YAAY;AACd,CAAC,EAAE,OAAO;AAOH,IAAM,wCAAwC,EAAE,QAAQ,EAAE;AAAA,EAC/D,CAAC,OAAO,QAAQ;AACd,QAAI;AACJ,QAAI;AACF,aAAO,KAAK,UAAU,KAAK;AAAA,IAC7B,QAAQ;AAAA,IAER;AACA,QAAI,OAAO,SAAS,UAAU;AAC5B,UAAI,SAAS,EAAE,MAAM,UAAU,SAAS,6DAA6D,CAAC;AACtG;AAAA,IACF;AACA,QAAI,IAAI,YAAY,EAAE,OAAO,IAAI,EAAE,aAAa,gBAAgB;AAC9D,UAAI,SAAS,EAAE,MAAM,UAAU,SAAS,4DAA4D,CAAC;AACrG;AAAA,IACF;AACA,QAAI,UAAU,QAAQ,OAAO,UAAU,YAAY,MAAM,QAAQ,KAAK,KACjE,OAAO,KAAK,KAAK,EAAE,WAAW,mBAAmB,UACjD,CAAC,mBAAmB,MAAM,CAAC,QAAQ,OAAO,UAAU,eAAe,KAAK,OAAO,GAAG,CAAC,GAAG;AACzF,UAAI,SAAS,EAAE,MAAM,UAAU,SAAS,yEAAyE,CAAC;AAAA,IACpH;AAAA,EACF;AACF,EAAE,KAAK,iBAAiB;AAIxB,SAAS,sBAAsB,eAA6B;AAC1D,MAAI,OAAO,kBAAkB,YAAY,CAAC,QAAQ,KAAK,aAAa,GAAG;AAErE,UAAM,IAAI,UAAU,2CAA2C;AAAA,EACjE;AACF;AAGO,SAAS,sCAAsC,eAA+B;AACnF,wBAAsB,aAAa;AACnC,SAAO,GAAG,qBAAqB,GAAG,aAAa;AACjD;AAGO,SAAS,8BAA8B,eAA+B;AAC3E,wBAAsB,aAAa;AACnC,SAAO,GAAG,aAAa,GAAG,aAAa;AACzC;","names":[]}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
{
|
|
2
|
+
"observation": {
|
|
3
|
+
"schemaVersion": 2,
|
|
4
|
+
"eventIdentity": "meta-template-status:v2:550e8400-e29b-41d4-a716-446655440000",
|
|
5
|
+
"wabaId": "123456789",
|
|
6
|
+
"providerTemplateId": "987654321",
|
|
7
|
+
"providerTemplateName": "checkout_recovery_initial_v2",
|
|
8
|
+
"providerLanguageCode": "en_GB",
|
|
9
|
+
"providerStatus": "APPROVED",
|
|
10
|
+
"reasonCode": "NONE",
|
|
11
|
+
"receivedAt": "2026-10-25T19:00:00.000Z"
|
|
12
|
+
},
|
|
13
|
+
"expectedJobId": "meta-template-status-v2-550e8400-e29b-41d4-a716-446655440000",
|
|
14
|
+
"additionalObservations": [
|
|
15
|
+
{
|
|
16
|
+
"case": "identical-content-other-occurrence",
|
|
17
|
+
"observation": {
|
|
18
|
+
"schemaVersion": 2,
|
|
19
|
+
"eventIdentity": "meta-template-status:v2:550e8400-e29b-41d4-a716-446655440001",
|
|
20
|
+
"wabaId": "123456789",
|
|
21
|
+
"providerTemplateId": "987654321",
|
|
22
|
+
"providerTemplateName": "checkout_recovery_initial_v2",
|
|
23
|
+
"providerLanguageCode": "en_GB",
|
|
24
|
+
"providerStatus": "APPROVED",
|
|
25
|
+
"reasonCode": "NONE",
|
|
26
|
+
"receivedAt": "2026-10-25T19:00:00.000Z"
|
|
27
|
+
},
|
|
28
|
+
"expectedJobId": "meta-template-status-v2-550e8400-e29b-41d4-a716-446655440001"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"case": "transition-paused",
|
|
32
|
+
"observation": {
|
|
33
|
+
"schemaVersion": 2,
|
|
34
|
+
"eventIdentity": "meta-template-status:v2:550e8400-e29b-41d4-a716-446655440002",
|
|
35
|
+
"wabaId": "123456789",
|
|
36
|
+
"providerTemplateId": "987654321",
|
|
37
|
+
"providerTemplateName": "checkout_recovery_initial_v2",
|
|
38
|
+
"providerLanguageCode": "en_GB",
|
|
39
|
+
"providerStatus": "PAUSED",
|
|
40
|
+
"reasonCode": "NONE",
|
|
41
|
+
"receivedAt": "2026-10-25T19:01:00.000Z"
|
|
42
|
+
},
|
|
43
|
+
"expectedJobId": "meta-template-status-v2-550e8400-e29b-41d4-a716-446655440002"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"case": "transition-approved-again",
|
|
47
|
+
"observation": {
|
|
48
|
+
"schemaVersion": 2,
|
|
49
|
+
"eventIdentity": "meta-template-status:v2:550e8400-e29b-41d4-a716-446655440003",
|
|
50
|
+
"wabaId": "123456789",
|
|
51
|
+
"providerTemplateId": "987654321",
|
|
52
|
+
"providerTemplateName": "checkout_recovery_initial_v2",
|
|
53
|
+
"providerLanguageCode": "en_GB",
|
|
54
|
+
"providerStatus": "APPROVED",
|
|
55
|
+
"reasonCode": "NONE",
|
|
56
|
+
"receivedAt": "2026-10-25T19:02:00.000Z"
|
|
57
|
+
},
|
|
58
|
+
"expectedJobId": "meta-template-status-v2-550e8400-e29b-41d4-a716-446655440003"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"case": "identical-delivery-first",
|
|
62
|
+
"observation": {
|
|
63
|
+
"schemaVersion": 2,
|
|
64
|
+
"eventIdentity": "meta-template-status:v2:550e8400-e29b-41d4-a716-446655440004",
|
|
65
|
+
"wabaId": "123456789",
|
|
66
|
+
"providerTemplateId": "987654321",
|
|
67
|
+
"providerTemplateName": "checkout_recovery_initial_v2",
|
|
68
|
+
"providerLanguageCode": "en_GB",
|
|
69
|
+
"providerStatus": "APPROVED",
|
|
70
|
+
"reasonCode": "NONE",
|
|
71
|
+
"receivedAt": "2026-10-25T19:00:00.000Z"
|
|
72
|
+
},
|
|
73
|
+
"expectedJobId": "meta-template-status-v2-550e8400-e29b-41d4-a716-446655440004"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"case": "identical-delivery-second",
|
|
77
|
+
"observation": {
|
|
78
|
+
"schemaVersion": 2,
|
|
79
|
+
"eventIdentity": "meta-template-status:v2:550e8400-e29b-41d4-a716-446655440005",
|
|
80
|
+
"wabaId": "123456789",
|
|
81
|
+
"providerTemplateId": "987654321",
|
|
82
|
+
"providerTemplateName": "checkout_recovery_initial_v2",
|
|
83
|
+
"providerLanguageCode": "en_GB",
|
|
84
|
+
"providerStatus": "APPROVED",
|
|
85
|
+
"reasonCode": "NONE",
|
|
86
|
+
"receivedAt": "2026-10-25T19:00:00.000Z"
|
|
87
|
+
},
|
|
88
|
+
"expectedJobId": "meta-template-status-v2-550e8400-e29b-41d4-a716-446655440005"
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modainteract/moda-interact-shared",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -24,10 +24,19 @@
|
|
|
24
24
|
"types": "./dist/recovery-policy.d.ts",
|
|
25
25
|
"import": "./dist/recovery-policy.js"
|
|
26
26
|
},
|
|
27
|
+
"./recovery-offer-proof": {
|
|
28
|
+
"types": "./dist/recovery-offer-proof.d.ts",
|
|
29
|
+
"import": "./dist/recovery-offer-proof.js"
|
|
30
|
+
},
|
|
27
31
|
"./whatsapp": {
|
|
28
32
|
"types": "./dist/whatsapp.d.ts",
|
|
29
33
|
"import": "./dist/whatsapp.js"
|
|
30
34
|
},
|
|
35
|
+
"./whatsapp-template-events": {
|
|
36
|
+
"types": "./dist/whatsapp-template-events.d.ts",
|
|
37
|
+
"import": "./dist/whatsapp-template-events.js"
|
|
38
|
+
},
|
|
39
|
+
"./whatsapp-template-events/fixtures": "./fixtures/meta-template-status-v2.json",
|
|
31
40
|
"./merchant-communications": {
|
|
32
41
|
"types": "./dist/merchant-communications.d.ts",
|
|
33
42
|
"import": "./dist/merchant-communications.js"
|
|
@@ -108,11 +117,16 @@
|
|
|
108
117
|
"./security/credentials/node": {
|
|
109
118
|
"types": "./dist/security/credentials/node.d.ts",
|
|
110
119
|
"import": "./dist/security/credentials/node.js"
|
|
120
|
+
},
|
|
121
|
+
"./recovery-template-bindings": {
|
|
122
|
+
"types": "./dist/recovery-template-bindings.d.ts",
|
|
123
|
+
"import": "./dist/recovery-template-bindings.js"
|
|
111
124
|
}
|
|
112
125
|
},
|
|
113
126
|
"files": [
|
|
114
127
|
"dist",
|
|
115
|
-
"fixtures/identity-v1.json"
|
|
128
|
+
"fixtures/identity-v1.json",
|
|
129
|
+
"fixtures/meta-template-status-v2.json"
|
|
116
130
|
],
|
|
117
131
|
"scripts": {
|
|
118
132
|
"build": "tsup",
|
|
@@ -129,7 +143,8 @@
|
|
|
129
143
|
"validate:commerce-entrypoints": "node scripts/validate-commerce-entrypoints.mjs",
|
|
130
144
|
"validate:arch023-shared-entrypoints": "npm run build && node scripts/validate-arch023-shared-entrypoints.mjs",
|
|
131
145
|
"validate:arch024-model-entrypoints": "npm run build && node scripts/validate-arch024-model-entrypoints.mjs",
|
|
132
|
-
"test:arch033-incidents:postgres": "node scripts/test-arch033-incidents-postgres.mjs"
|
|
146
|
+
"test:arch033-incidents:postgres": "node scripts/test-arch033-incidents-postgres.mjs",
|
|
147
|
+
"validate:arch047-whatsapp-template-events": "node scripts/validate-whatsapp-template-events-entrypoint.mjs"
|
|
133
148
|
},
|
|
134
149
|
"dependencies": {
|
|
135
150
|
"@opentelemetry/api": "^1.9.0",
|