@placeshakr/config 10.20.2-alpha.0 → 10.20.2-alpha.1

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,113 @@
1
+ type NotifyQuoteStatusApprovedMessage = {
2
+ name: 'notify_quote_status_approved';
3
+ variables: {
4
+ header?: string[];
5
+ // 1. quoteTitle; 2. project address;
6
+ body: string[];
7
+ buttons?: ButtonArgs[];
8
+ };
9
+ };
10
+
11
+ type SendQuotePro = {
12
+ name: 'send_quote_pro';
13
+ variables: {
14
+ header?: string[];
15
+ // 1. quote name; 2. project address;
16
+ body: string[];
17
+ buttons?: ButtonArgs[];
18
+ };
19
+ };
20
+
21
+ type SendMediaRequest = {
22
+ name: 'send_media_request';
23
+ variables: {
24
+ header?: string[];
25
+ // 1. sender name; 2. project name; 3. project address;
26
+ body: string[];
27
+ buttons: ButtonArgs[];
28
+ };
29
+ };
30
+
31
+ type SendPlanRequest = {
32
+ name: 'send_plan_request';
33
+ variables: {
34
+ header?: string[];
35
+ // 1. sender name; 2. project name; 3. project address;
36
+ body: string[];
37
+ buttons: ButtonArgs[];
38
+ };
39
+ };
40
+
41
+ type QuoteReady = {
42
+ name: 'quote_ready';
43
+ variables: {
44
+ header?: string[];
45
+ // 1. sender name; 2. quote name; 3. project address
46
+ body: string[];
47
+ buttons: ButtonArgs[];
48
+ };
49
+ };
50
+
51
+ type WelcomeClient = {
52
+ name: 'welcome_client';
53
+ variables: {
54
+ header?: string[];
55
+ body?: string[];
56
+ buttons?: ButtonArgs[];
57
+ };
58
+ };
59
+
60
+ type ButtonArgs = {
61
+ type: 'button';
62
+ sub_type: 'quick_reply' | 'url';
63
+ index?: number;
64
+ parameters: { type: 'payload' | 'text'; value: string }[];
65
+ };
66
+
67
+ export type WhatsAppTemplate =
68
+ | NotifyQuoteStatusApprovedMessage
69
+ | SendQuotePro
70
+ | SendMediaRequest
71
+ | SendPlanRequest
72
+ | WelcomeClient
73
+ | QuoteReady;
74
+
75
+ type TemplatePayloadArgs = {
76
+ type: 'template';
77
+ recipientPhone: string;
78
+ template: WhatsAppTemplate;
79
+ };
80
+
81
+ export type WhatsAppRequestPayloadType =
82
+ | 'audio'
83
+ | 'document'
84
+ | 'image'
85
+ | 'sticker'
86
+ | 'video'
87
+ | 'template'
88
+ | 'text';
89
+
90
+ type CommonMultimediaPayload<T extends WhatsAppRequestPayloadType> = {
91
+ [key in T]: {
92
+ link: string;
93
+ filename: string;
94
+ };
95
+ };
96
+
97
+ type TextPayloadArgs = {
98
+ type: 'text';
99
+ recipientPhone: string;
100
+ message: string;
101
+ };
102
+
103
+ type MultimediaPayloadArgs<T extends WhatsAppRequestPayloadType> = {
104
+ type: T;
105
+ recipientPhone: string;
106
+ } & CommonMultimediaPayload<T>;
107
+
108
+ export type WABuildPayloadType<Type extends WhatsAppRequestPayloadType> =
109
+ Type extends 'text'
110
+ ? TextPayloadArgs
111
+ : Type extends 'template'
112
+ ? TemplatePayloadArgs
113
+ : MultimediaPayloadArgs<Type>;
@@ -0,0 +1,198 @@
1
+ export type WhatsAppNotificationPayload = {
2
+ object: 'whatsapp_business_account';
3
+ entry: [
4
+ {
5
+ id: string;
6
+ changes: WhatAppNotificationValue[];
7
+ }
8
+ ];
9
+ };
10
+
11
+ export type WhatAppNotificationValue = {
12
+ value: {
13
+ contacts: WhatsAppContact[];
14
+ errors?: WhatsAppResponseError[];
15
+ messaging_product: 'whatsapp';
16
+ metadata: WhatsAppMetadata;
17
+ messages?: WhatsAppMessage[];
18
+ statuses?: WhatsAppStatus[];
19
+ };
20
+ field: 'messages';
21
+ };
22
+
23
+ type WhatsAppContact = {
24
+ wa_id: string;
25
+ profile: {
26
+ name: string;
27
+ };
28
+ };
29
+
30
+ type WhatsAppResponseError = {
31
+ code: number;
32
+ title: string;
33
+ message: string;
34
+ error_data: {
35
+ details: string;
36
+ };
37
+ };
38
+
39
+ type WhatsAppMetadata = {
40
+ display_phone_number: string;
41
+ phone_number_id: string;
42
+ };
43
+
44
+ export type WhatsAppMessage = {
45
+ audio?: {
46
+ id: string;
47
+ mime_type: string;
48
+ };
49
+ button?: {
50
+ payload: string;
51
+ text: string;
52
+ };
53
+ context?: {
54
+ forwarded: boolean;
55
+ frequently_forwarded: boolean;
56
+ from: string;
57
+ id: string;
58
+ referred_product: {
59
+ catalog_id: string;
60
+ product_retailer_id: string;
61
+ };
62
+ };
63
+ document?: {
64
+ caption?: string;
65
+ filename: string;
66
+ sha256: string;
67
+ mime_type: string;
68
+ id: string;
69
+ };
70
+ errors: {
71
+ code: number;
72
+ title: string;
73
+ message: string;
74
+ error_data: {
75
+ details: string;
76
+ };
77
+ };
78
+ from: string;
79
+ id: string;
80
+ image?: {
81
+ caption?: string;
82
+ sha256: string;
83
+ id: string;
84
+ mime_type: string;
85
+ };
86
+ interactive?: {
87
+ type: string;
88
+ button_reply: {
89
+ id: string;
90
+ title: string;
91
+ };
92
+ list_reply: {
93
+ id: string;
94
+ title: string;
95
+ description: string;
96
+ };
97
+ };
98
+ order?: {
99
+ catalog_id: string;
100
+ text: string;
101
+ product_items: {
102
+ product_retailer_id: string;
103
+ quantity: string;
104
+ item_price: string;
105
+ currency: string;
106
+ }[];
107
+ };
108
+ referral?: {
109
+ source_url: string;
110
+ source_type: 'ad' | 'post';
111
+ source_id: string;
112
+ headline: string;
113
+ body: string;
114
+ media_type: 'image' | 'video';
115
+ image_url?: string;
116
+ video_url?: string;
117
+ thumbnail_url?: string;
118
+ ctwa_clid: string;
119
+ };
120
+ sticker?: {
121
+ mime_type: string;
122
+ sha256: string;
123
+ id: string;
124
+ animated: boolean;
125
+ };
126
+ system?: {
127
+ body: string;
128
+ identity: string;
129
+ new_wa_id: string;
130
+ wa_id: string;
131
+ type: 'customer_changed_number' | 'customer_identity_changed';
132
+ customer: string;
133
+ };
134
+ text?: {
135
+ body: string;
136
+ };
137
+ timestamp: string;
138
+ type: WhatsAppMessageType;
139
+ video?: {
140
+ caption: string;
141
+ filename: string;
142
+ sha256: string;
143
+ id: string;
144
+ mime_type: string;
145
+ };
146
+ };
147
+
148
+ type WhatsAppStatus = {
149
+ biz_opaque_callback_data: string;
150
+ conversation: {
151
+ id: string;
152
+ origin: {
153
+ type:
154
+ | 'authentication'
155
+ | 'marketing'
156
+ | 'utility'
157
+ | 'service'
158
+ | 'referral_conversion';
159
+ };
160
+ expiration_timestamp?: string;
161
+ };
162
+ errors: {
163
+ code: number;
164
+ title: string;
165
+ message: string;
166
+ error_data: {
167
+ details: string;
168
+ };
169
+ }[];
170
+ id: string;
171
+ pricing: {
172
+ category:
173
+ | 'authentication'
174
+ | 'marketing'
175
+ | 'utility'
176
+ | 'service'
177
+ | 'referral_conversion';
178
+ pricing_model: 'CBP';
179
+ };
180
+ recipient_id: string;
181
+ status: 'delivered' | 'read' | 'sent';
182
+ timestamp: string;
183
+ };
184
+
185
+ export enum WhatsAppMessageType {
186
+ audio = 'audio',
187
+ button = 'button',
188
+ document = 'document',
189
+ text = 'text',
190
+ image = 'image',
191
+ interactive = 'interactive',
192
+ order = 'order',
193
+ sticker = 'sticker',
194
+ system = 'system',
195
+ unknown = 'unknown',
196
+ video = 'video',
197
+ location = 'location',
198
+ }