@ikatec/digisac-api-sdk 4.8.0 → 4.9.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/apis/interactiveMessages/types.d.ts +61 -3
- package/dist/apis/interactiveMessages/types.d.ts.map +1 -1
- package/dist/apis/services/types.d.ts +53 -1
- package/dist/apis/services/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/apis/interactiveMessages/types.ts +67 -1
- package/src/apis/payloads.test-d.ts +161 -0
- package/src/apis/payloads.test.ts +41 -0
- package/src/apis/services/types.ts +47 -1
|
@@ -10,6 +10,33 @@ type InteractiveMessageButton = {
|
|
|
10
10
|
type InteractiveMessageBodyFooter = string | {
|
|
11
11
|
text: string;
|
|
12
12
|
};
|
|
13
|
+
export type ChannelRedirectChannel = 'whatsapp' | 'telegram' | 'instagram' | 'webchat';
|
|
14
|
+
export type ChannelRedirectIdentifierType = 'phone' | 'botName';
|
|
15
|
+
/**
|
|
16
|
+
* Digisac-only setting of a `cta_url` message: the channel its URL was built for. It sits next to
|
|
17
|
+
* `action`, never inside `action.parameters`, and is stripped before the message reaches Meta. The
|
|
18
|
+
* backend reads it to add the ticket parameters to the URL on send. A missing key means
|
|
19
|
+
* `{ enabled: false }`.
|
|
20
|
+
*/
|
|
21
|
+
export type ChannelRedirect = {
|
|
22
|
+
enabled: boolean;
|
|
23
|
+
channel?: ChannelRedirectChannel;
|
|
24
|
+
/** `'phone'` for WhatsApp; `'phone'` or `'botName'` for Telegram; unset for the others. */
|
|
25
|
+
identifierType?: ChannelRedirectIdentifierType;
|
|
26
|
+
/** Phone as `+<DDI><number>` without mask, or the Telegram bot / Instagram user name. */
|
|
27
|
+
identifier?: string;
|
|
28
|
+
/** Id of the Webchat service, when `channel` is `'webchat'`. */
|
|
29
|
+
serviceId?: string;
|
|
30
|
+
};
|
|
31
|
+
type CtaUrlAction = {
|
|
32
|
+
name: 'cta_url';
|
|
33
|
+
parameters: {
|
|
34
|
+
/** 1–20 characters after trim, without `{{…}}` variables. */
|
|
35
|
+
display_text: string;
|
|
36
|
+
/** 1–2000 characters after trim, starting with `http://` or `https://`. */
|
|
37
|
+
url: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
13
40
|
type InteractiveMedia = {
|
|
14
41
|
id?: string;
|
|
15
42
|
link?: string;
|
|
@@ -57,7 +84,23 @@ type ButtonInteractiveMessageContent = {
|
|
|
57
84
|
buttons: InteractiveMessageButton[];
|
|
58
85
|
};
|
|
59
86
|
};
|
|
60
|
-
export type
|
|
87
|
+
export type CtaUrlInteractiveMessageContent = {
|
|
88
|
+
type: 'cta_url';
|
|
89
|
+
header?: ButtonInteractiveMessageContent['header'];
|
|
90
|
+
body: InteractiveMessageBodyFooter;
|
|
91
|
+
footer?: InteractiveMessageBodyFooter;
|
|
92
|
+
action: CtaUrlAction;
|
|
93
|
+
channelRedirect?: ChannelRedirect;
|
|
94
|
+
};
|
|
95
|
+
/** Has no header or footer: WhatsApp refuses them on this type. */
|
|
96
|
+
export type RequestContactInfoInteractiveMessageContent = {
|
|
97
|
+
type: 'request_contact_info';
|
|
98
|
+
body: InteractiveMessageBodyFooter;
|
|
99
|
+
action: {
|
|
100
|
+
name?: string;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
export type InteractiveMessageContent = ListInteractiveMessageContent | ButtonInteractiveMessageContent | CtaUrlInteractiveMessageContent | RequestContactInfoInteractiveMessageContent;
|
|
61
104
|
type ListInteractiveMessageContentInput = {
|
|
62
105
|
type: 'list';
|
|
63
106
|
header?: {
|
|
@@ -85,7 +128,22 @@ type ButtonInteractiveMessageContentInput = {
|
|
|
85
128
|
buttons: InteractiveMessageButton[];
|
|
86
129
|
};
|
|
87
130
|
};
|
|
88
|
-
type
|
|
131
|
+
type CtaUrlInteractiveMessageContentInput = {
|
|
132
|
+
type: 'cta_url';
|
|
133
|
+
header?: ButtonInteractiveMessageContentInput['header'];
|
|
134
|
+
body: InteractiveMessageBodyFooter;
|
|
135
|
+
footer?: InteractiveMessageBodyFooter;
|
|
136
|
+
action: CtaUrlAction;
|
|
137
|
+
channelRedirect?: ChannelRedirect;
|
|
138
|
+
};
|
|
139
|
+
type RequestContactInfoInteractiveMessageContentInput = {
|
|
140
|
+
type: 'request_contact_info';
|
|
141
|
+
body: InteractiveMessageBodyFooter;
|
|
142
|
+
action: {
|
|
143
|
+
name: 'request_contact_info';
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
type InteractiveMessageContentInput = ListInteractiveMessageContentInput | ButtonInteractiveMessageContentInput | CtaUrlInteractiveMessageContentInput | RequestContactInfoInteractiveMessageContentInput;
|
|
89
147
|
type InteractiveMessageFilePayload = {
|
|
90
148
|
id: string;
|
|
91
149
|
} | {
|
|
@@ -96,7 +154,7 @@ type InteractiveMessageFilePayload = {
|
|
|
96
154
|
export type InteractiveMessage = {
|
|
97
155
|
id: string;
|
|
98
156
|
name: string;
|
|
99
|
-
type: 'list' | 'button';
|
|
157
|
+
type: 'list' | 'button' | 'cta_url' | 'request_contact_info';
|
|
100
158
|
interactive: InteractiveMessageContent;
|
|
101
159
|
archivedAt: string | null;
|
|
102
160
|
accountId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/apis/interactiveMessages/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAIpC,KAAK,wBAAwB,GAAG;IAC9B,IAAI,EAAE,OAAO,CAAA;IACb,KAAK,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;CACrC,CAAA;AAED,KAAK,4BAA4B,GAAG,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot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AAE,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IAC9B,IAAI,CAAC,EAAE,6BAA6B,CAAA;CACrC,CAAA;AAED,MAAM,MAAM,+BAA+B,GAAG;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,8BAA8B,CAAA;IAC5C,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;IACxB,WAAW,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IAC9B,IAAI,CAAC,EAAE,6BAA6B,CAAA;CACrC,CAAA"}
|
|
@@ -33,6 +33,58 @@ export type ServiceConnectionStatus = {
|
|
|
33
33
|
state?: string;
|
|
34
34
|
timestamp?: string;
|
|
35
35
|
};
|
|
36
|
+
/**
|
|
37
|
+
* `data.webchat` of a Webchat service. Every key is optional: the object only fills up once the
|
|
38
|
+
* service is set up, and older services lack the keys added later (e.g. `instagram`). The backend
|
|
39
|
+
* stores what the forms send without normalizing it, so `null` and `{}` show up where the web
|
|
40
|
+
* forms write them.
|
|
41
|
+
*/
|
|
42
|
+
export type WebchatServiceData = {
|
|
43
|
+
/** Widget id in the webchat API; the page link is `${webchatUrl}/${id}`. Absent before setup. */
|
|
44
|
+
id?: string;
|
|
45
|
+
name?: string | null;
|
|
46
|
+
/** WhatsApp channel of the widget: DDI + number, without mask. `null` once cleared. */
|
|
47
|
+
phone?: string | null;
|
|
48
|
+
/** Telegram channel of the widget, without `@`. `null` once cleared. */
|
|
49
|
+
telegram?: string | null;
|
|
50
|
+
/** Instagram channel of the widget, without `@`. `null` once cleared. */
|
|
51
|
+
instagram?: string | null;
|
|
52
|
+
isOpenForm?: boolean;
|
|
53
|
+
isOpenChat?: boolean;
|
|
54
|
+
/** `{}` when no picture was picked in the legacy form. */
|
|
55
|
+
file?: {
|
|
56
|
+
base64Url?: string;
|
|
57
|
+
mimetype?: string;
|
|
58
|
+
fileName?: string;
|
|
59
|
+
};
|
|
60
|
+
googleId?: string | null;
|
|
61
|
+
desktopChatOpen?: boolean;
|
|
62
|
+
mobileChatOpen?: boolean;
|
|
63
|
+
getClientData?: boolean;
|
|
64
|
+
closeTicketByClient?: boolean;
|
|
65
|
+
phoneClient?: boolean;
|
|
66
|
+
phoneClientRequired?: boolean;
|
|
67
|
+
clientName?: boolean;
|
|
68
|
+
clientNameRequired?: boolean;
|
|
69
|
+
/** `null` or `{}` when no custom field is asked for. */
|
|
70
|
+
customField?: {
|
|
71
|
+
id?: string;
|
|
72
|
+
name?: string;
|
|
73
|
+
} | null;
|
|
74
|
+
customFieldRequired?: boolean;
|
|
75
|
+
custom?: {
|
|
76
|
+
webchatBalloon?: boolean;
|
|
77
|
+
webchatBalloonText?: string | null;
|
|
78
|
+
webchatColor?: string;
|
|
79
|
+
/** File id. */
|
|
80
|
+
logo?: string;
|
|
81
|
+
/** File id. */
|
|
82
|
+
profilePhoto?: string;
|
|
83
|
+
/** File id. */
|
|
84
|
+
webchatIcon?: string;
|
|
85
|
+
typeIcon?: string;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
36
88
|
export type ServiceData = {
|
|
37
89
|
token?: string;
|
|
38
90
|
myId?: string;
|
|
@@ -93,7 +145,7 @@ export type ServiceData = {
|
|
|
93
145
|
mimetype: string;
|
|
94
146
|
fileName: string;
|
|
95
147
|
};
|
|
96
|
-
webchat?:
|
|
148
|
+
webchat?: WebchatServiceData;
|
|
97
149
|
driverId?: string;
|
|
98
150
|
apiURL?: string;
|
|
99
151
|
error?: unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/apis/services/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEtD,MAAM,MAAM,WAAW,GACnB,UAAU,GACV,OAAO,GACP,SAAS,GACT,UAAU,GACV,UAAU,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AM,oBAAoB,GAAG,KAAK,GAAG,mBAAmB,CAAA;AAE9D,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,WAAW,CAAA;IACjB,IAAI,CAAC,EAAE,WAAW,CAAA;IAClB,QAAQ,CAAC,EAAE,eAAe,CAAA;IAC1B,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,WAAW,CAAA;IAClB,QAAQ,CAAC,EAAE,eAAe,CAAA;IAC1B,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACnC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,4EAA4E;AAC5E,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -10,6 +10,37 @@ type InteractiveMessageButton = {
|
|
|
10
10
|
|
|
11
11
|
type InteractiveMessageBodyFooter = string | { text: string }
|
|
12
12
|
|
|
13
|
+
export type ChannelRedirectChannel = 'whatsapp' | 'telegram' | 'instagram' | 'webchat'
|
|
14
|
+
|
|
15
|
+
export type ChannelRedirectIdentifierType = 'phone' | 'botName'
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Digisac-only setting of a `cta_url` message: the channel its URL was built for. It sits next to
|
|
19
|
+
* `action`, never inside `action.parameters`, and is stripped before the message reaches Meta. The
|
|
20
|
+
* backend reads it to add the ticket parameters to the URL on send. A missing key means
|
|
21
|
+
* `{ enabled: false }`.
|
|
22
|
+
*/
|
|
23
|
+
export type ChannelRedirect = {
|
|
24
|
+
enabled: boolean
|
|
25
|
+
channel?: ChannelRedirectChannel
|
|
26
|
+
/** `'phone'` for WhatsApp; `'phone'` or `'botName'` for Telegram; unset for the others. */
|
|
27
|
+
identifierType?: ChannelRedirectIdentifierType
|
|
28
|
+
/** Phone as `+<DDI><number>` without mask, or the Telegram bot / Instagram user name. */
|
|
29
|
+
identifier?: string
|
|
30
|
+
/** Id of the Webchat service, when `channel` is `'webchat'`. */
|
|
31
|
+
serviceId?: string
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
type CtaUrlAction = {
|
|
35
|
+
name: 'cta_url'
|
|
36
|
+
parameters: {
|
|
37
|
+
/** 1–20 characters after trim, without `{{…}}` variables. */
|
|
38
|
+
display_text: string
|
|
39
|
+
/** 1–2000 characters after trim, starting with `http://` or `https://`. */
|
|
40
|
+
url: string
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
13
44
|
// --- Response types ---
|
|
14
45
|
|
|
15
46
|
type InteractiveMedia = {
|
|
@@ -60,9 +91,27 @@ type ButtonInteractiveMessageContent = {
|
|
|
60
91
|
}
|
|
61
92
|
}
|
|
62
93
|
|
|
94
|
+
export type CtaUrlInteractiveMessageContent = {
|
|
95
|
+
type: 'cta_url'
|
|
96
|
+
header?: ButtonInteractiveMessageContent['header']
|
|
97
|
+
body: InteractiveMessageBodyFooter
|
|
98
|
+
footer?: InteractiveMessageBodyFooter
|
|
99
|
+
action: CtaUrlAction
|
|
100
|
+
channelRedirect?: ChannelRedirect
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** Has no header or footer: WhatsApp refuses them on this type. */
|
|
104
|
+
export type RequestContactInfoInteractiveMessageContent = {
|
|
105
|
+
type: 'request_contact_info'
|
|
106
|
+
body: InteractiveMessageBodyFooter
|
|
107
|
+
action: { name?: string }
|
|
108
|
+
}
|
|
109
|
+
|
|
63
110
|
export type InteractiveMessageContent =
|
|
64
111
|
| ListInteractiveMessageContent
|
|
65
112
|
| ButtonInteractiveMessageContent
|
|
113
|
+
| CtaUrlInteractiveMessageContent
|
|
114
|
+
| RequestContactInfoInteractiveMessageContent
|
|
66
115
|
|
|
67
116
|
// --- Input types (create/update) ---
|
|
68
117
|
|
|
@@ -90,9 +139,26 @@ type ButtonInteractiveMessageContentInput = {
|
|
|
90
139
|
}
|
|
91
140
|
}
|
|
92
141
|
|
|
142
|
+
type CtaUrlInteractiveMessageContentInput = {
|
|
143
|
+
type: 'cta_url'
|
|
144
|
+
header?: ButtonInteractiveMessageContentInput['header']
|
|
145
|
+
body: InteractiveMessageBodyFooter
|
|
146
|
+
footer?: InteractiveMessageBodyFooter
|
|
147
|
+
action: CtaUrlAction
|
|
148
|
+
channelRedirect?: ChannelRedirect
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
type RequestContactInfoInteractiveMessageContentInput = {
|
|
152
|
+
type: 'request_contact_info'
|
|
153
|
+
body: InteractiveMessageBodyFooter
|
|
154
|
+
action: { name: 'request_contact_info' }
|
|
155
|
+
}
|
|
156
|
+
|
|
93
157
|
type InteractiveMessageContentInput =
|
|
94
158
|
| ListInteractiveMessageContentInput
|
|
95
159
|
| ButtonInteractiveMessageContentInput
|
|
160
|
+
| CtaUrlInteractiveMessageContentInput
|
|
161
|
+
| RequestContactInfoInteractiveMessageContentInput
|
|
96
162
|
|
|
97
163
|
type InteractiveMessageFilePayload =
|
|
98
164
|
| { id: string }
|
|
@@ -103,7 +169,7 @@ type InteractiveMessageFilePayload =
|
|
|
103
169
|
export type InteractiveMessage = {
|
|
104
170
|
id: string
|
|
105
171
|
name: string
|
|
106
|
-
type: 'list' | 'button'
|
|
172
|
+
type: 'list' | 'button' | 'cta_url' | 'request_contact_info'
|
|
107
173
|
interactive: InteractiveMessageContent
|
|
108
174
|
archivedAt: string | null
|
|
109
175
|
accountId: string
|
|
@@ -17,6 +17,13 @@ import type {
|
|
|
17
17
|
} from './campaigns/types'
|
|
18
18
|
import { CardsApi } from './cards/CardsApi'
|
|
19
19
|
import { ContactsApi } from './contacts/ContactsApi'
|
|
20
|
+
import { InteractiveMessagesApi } from './interactiveMessages/InteractiveMessagesApi'
|
|
21
|
+
import type {
|
|
22
|
+
ChannelRedirect,
|
|
23
|
+
CtaUrlInteractiveMessageContent,
|
|
24
|
+
InteractiveMessage,
|
|
25
|
+
RequestContactInfoInteractiveMessageContent,
|
|
26
|
+
} from './interactiveMessages'
|
|
20
27
|
import { KanbanColumnsApi } from './kanbanColumns/KanbanColumnsApi'
|
|
21
28
|
import { PipelineApi } from './pipeline/PipelineApi'
|
|
22
29
|
import type { PermissionName } from './permissions/types'
|
|
@@ -26,6 +33,12 @@ import { QuickRepliesApi } from './quickReplies/QuickRepliesApi'
|
|
|
26
33
|
import { RolesApi } from './roles/RolesApi'
|
|
27
34
|
import { ScheduleApi } from './schedule/ScheduleApi'
|
|
28
35
|
import type { ScheduleRecord } from './schedule/types'
|
|
36
|
+
import type {
|
|
37
|
+
CreateServicePayload,
|
|
38
|
+
Service,
|
|
39
|
+
UpdateServicePayload,
|
|
40
|
+
WebchatServiceData,
|
|
41
|
+
} from './services'
|
|
29
42
|
import { TagsApi } from './tags/TagsApi'
|
|
30
43
|
import { TicketTopicsApi } from './ticketTopics/TicketTopicsApi'
|
|
31
44
|
import { TicketsApi } from './tickets/TicketsApi'
|
|
@@ -67,6 +80,154 @@ expectError(tokens.create({ name: 'CI', accessTokenExpiresAt: '2030-01-01T00:00:
|
|
|
67
80
|
expectError(tokens.create({ name: 'CI', expiresIn: '7d' }))
|
|
68
81
|
expectError(tokens.updateById('t-1', { scope: '*' }))
|
|
69
82
|
|
|
83
|
+
// ── interactive messages: cta_url and request_contact_info ──────────
|
|
84
|
+
|
|
85
|
+
const interactiveMessages = new InteractiveMessagesApi(client)
|
|
86
|
+
interactiveMessages.create({
|
|
87
|
+
name: 'Boleto',
|
|
88
|
+
interactive: {
|
|
89
|
+
type: 'cta_url',
|
|
90
|
+
header: { type: 'text', text: 'Seu boleto' },
|
|
91
|
+
body: { text: 'Clique para continuar' },
|
|
92
|
+
footer: { text: 'Digisac' },
|
|
93
|
+
action: {
|
|
94
|
+
name: 'cta_url',
|
|
95
|
+
parameters: { display_text: 'Continuar', url: 'https://wa.me/5541999999999' },
|
|
96
|
+
},
|
|
97
|
+
channelRedirect: {
|
|
98
|
+
enabled: true,
|
|
99
|
+
channel: 'whatsapp',
|
|
100
|
+
identifierType: 'phone',
|
|
101
|
+
identifier: '+5541999999999',
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
})
|
|
105
|
+
interactiveMessages.create({
|
|
106
|
+
name: 'Webchat',
|
|
107
|
+
interactive: {
|
|
108
|
+
type: 'cta_url',
|
|
109
|
+
header: { type: 'image' },
|
|
110
|
+
body: { text: 'Fale conosco' },
|
|
111
|
+
action: {
|
|
112
|
+
name: 'cta_url',
|
|
113
|
+
parameters: { display_text: 'Abrir', url: 'https://webchat.digisac.app/w-1' },
|
|
114
|
+
},
|
|
115
|
+
channelRedirect: { enabled: true, channel: 'webchat', serviceId: 's-1' },
|
|
116
|
+
},
|
|
117
|
+
})
|
|
118
|
+
interactiveMessages.updateById('im-1', {
|
|
119
|
+
interactive: {
|
|
120
|
+
type: 'cta_url',
|
|
121
|
+
body: { text: 'Site' },
|
|
122
|
+
action: { name: 'cta_url', parameters: { display_text: 'Abrir', url: 'https://exemplo.com' } },
|
|
123
|
+
},
|
|
124
|
+
})
|
|
125
|
+
interactiveMessages.create({
|
|
126
|
+
name: 'Dados',
|
|
127
|
+
interactive: {
|
|
128
|
+
type: 'request_contact_info',
|
|
129
|
+
body: { text: 'Compartilhe seu contato' },
|
|
130
|
+
action: { name: 'request_contact_info' },
|
|
131
|
+
},
|
|
132
|
+
})
|
|
133
|
+
// `channelRedirect` is a sibling of `action`, never inside `action.parameters`
|
|
134
|
+
expectError(
|
|
135
|
+
interactiveMessages.create({
|
|
136
|
+
name: 'Boleto',
|
|
137
|
+
interactive: {
|
|
138
|
+
type: 'cta_url',
|
|
139
|
+
body: { text: 'Clique' },
|
|
140
|
+
action: {
|
|
141
|
+
name: 'cta_url',
|
|
142
|
+
parameters: {
|
|
143
|
+
display_text: 'Continuar',
|
|
144
|
+
url: 'https://wa.me/5541999999999',
|
|
145
|
+
channelRedirect: { enabled: true },
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
}),
|
|
150
|
+
)
|
|
151
|
+
expectError(
|
|
152
|
+
interactiveMessages.create({
|
|
153
|
+
name: 'Boleto',
|
|
154
|
+
interactive: {
|
|
155
|
+
type: 'cta_url',
|
|
156
|
+
body: { text: 'Clique' },
|
|
157
|
+
action: { name: 'cta_url', parameters: { url: 'https://exemplo.com' } },
|
|
158
|
+
},
|
|
159
|
+
}),
|
|
160
|
+
)
|
|
161
|
+
expectError(
|
|
162
|
+
interactiveMessages.create({
|
|
163
|
+
name: 'Boleto',
|
|
164
|
+
interactive: {
|
|
165
|
+
type: 'cta_url',
|
|
166
|
+
body: { text: 'Clique' },
|
|
167
|
+
action: { name: 'cta_url', parameters: { display_text: 'Abrir', url: 'https://x.com' } },
|
|
168
|
+
channelRedirect: { enabled: true, channel: 'email' },
|
|
169
|
+
},
|
|
170
|
+
}),
|
|
171
|
+
)
|
|
172
|
+
// WhatsApp refuses header and footer on request_contact_info
|
|
173
|
+
expectError(
|
|
174
|
+
interactiveMessages.create({
|
|
175
|
+
name: 'Dados',
|
|
176
|
+
interactive: {
|
|
177
|
+
type: 'request_contact_info',
|
|
178
|
+
header: { type: 'text', text: 'Olá' },
|
|
179
|
+
body: { text: 'Compartilhe seu contato' },
|
|
180
|
+
action: { name: 'request_contact_info' },
|
|
181
|
+
},
|
|
182
|
+
}),
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
declare const interactiveMessage: InteractiveMessage
|
|
186
|
+
expectType<'list' | 'button' | 'cta_url' | 'request_contact_info'>(interactiveMessage.type)
|
|
187
|
+
if (interactiveMessage.interactive.type === 'cta_url') {
|
|
188
|
+
expectType<CtaUrlInteractiveMessageContent>(interactiveMessage.interactive)
|
|
189
|
+
expectType<string>(interactiveMessage.interactive.action.parameters.url)
|
|
190
|
+
expectType<ChannelRedirect | undefined>(interactiveMessage.interactive.channelRedirect)
|
|
191
|
+
}
|
|
192
|
+
if (interactiveMessage.interactive.type === 'request_contact_info') {
|
|
193
|
+
expectType<RequestContactInfoInteractiveMessageContent>(interactiveMessage.interactive)
|
|
194
|
+
}
|
|
195
|
+
expectAssignable<ChannelRedirect>({ enabled: false })
|
|
196
|
+
expectAssignable<ChannelRedirect>({
|
|
197
|
+
enabled: true,
|
|
198
|
+
channel: 'telegram',
|
|
199
|
+
identifierType: 'botName',
|
|
200
|
+
identifier: '@lojabot',
|
|
201
|
+
})
|
|
202
|
+
expectNotAssignable<ChannelRedirect>({ enabled: true, channel: 'telegram', identifierType: 'user' })
|
|
203
|
+
expectNotAssignable<ChannelRedirect>({ channel: 'whatsapp' })
|
|
204
|
+
|
|
205
|
+
// ── services: data.webchat of a Webchat service ─────────────────────
|
|
206
|
+
|
|
207
|
+
declare const service: Service
|
|
208
|
+
expectType<WebchatServiceData | undefined>(service.data.webchat)
|
|
209
|
+
expectType<string | undefined>(service.data.webchat?.id)
|
|
210
|
+
expectType<string | null | undefined>(service.data.webchat?.instagram)
|
|
211
|
+
expectAssignable<WebchatServiceData>({})
|
|
212
|
+
expectAssignable<WebchatServiceData>({ id: 'w-1', phone: '5541999999999', telegram: null })
|
|
213
|
+
expectNotAssignable<WebchatServiceData>({ id: 1 })
|
|
214
|
+
// values the web forms already store: the new form sends `null`, the legacy one `{}`
|
|
215
|
+
expectType<{ id?: string; name?: string } | null | undefined>(service.data.webchat?.customField)
|
|
216
|
+
expectAssignable<WebchatServiceData>({ customField: null })
|
|
217
|
+
expectAssignable<WebchatServiceData>({ customField: {} })
|
|
218
|
+
expectAssignable<WebchatServiceData>({ customField: { id: 'cf-1', name: 'CPF' } })
|
|
219
|
+
expectAssignable<WebchatServiceData>({ name: null, googleId: null, file: {} })
|
|
220
|
+
expectAssignable<WebchatServiceData>({
|
|
221
|
+
file: { base64Url: 'aGVsbG8=', mimetype: 'image/png', fileName: 'perfil.png' },
|
|
222
|
+
})
|
|
223
|
+
expectAssignable<WebchatServiceData>({ custom: { webchatBalloonText: null } })
|
|
224
|
+
expectNotAssignable<WebchatServiceData>({ customField: 'cf-1' })
|
|
225
|
+
// the same shape types the `data` of the create and update payloads
|
|
226
|
+
expectAssignable<CreateServicePayload['data']>({
|
|
227
|
+
webchat: { customField: null, googleId: null, name: null, custom: { webchatBalloonText: null } },
|
|
228
|
+
})
|
|
229
|
+
expectAssignable<UpdateServicePayload['data']>({ webchat: { customField: {}, file: {} } })
|
|
230
|
+
|
|
70
231
|
// ── users: the dedicated archive route takes a boolean, not a date ──
|
|
71
232
|
|
|
72
233
|
const users = new UsersApi(client)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
|
2
2
|
import type { ApiClient } from '../core/ApiClient'
|
|
3
|
+
import { InteractiveMessagesApi } from './interactiveMessages/InteractiveMessagesApi'
|
|
3
4
|
import { PersonalAccessTokensApi } from './personalAccessTokens/PersonalAccessTokensApi'
|
|
4
5
|
import { RolesApi } from './roles/RolesApi'
|
|
5
6
|
import { TimetableApi } from './timetable/TimetableApi'
|
|
@@ -78,4 +79,44 @@ describe('payloads sent to the backend', () => {
|
|
|
78
79
|
)
|
|
79
80
|
})
|
|
80
81
|
})
|
|
82
|
+
|
|
83
|
+
describe('InteractiveMessagesApi', () => {
|
|
84
|
+
it('create sends a cta_url with channelRedirect next to action, not inside parameters', async () => {
|
|
85
|
+
const body = {
|
|
86
|
+
name: 'Boleto',
|
|
87
|
+
departments: [{ id: 'd-1' }],
|
|
88
|
+
interactive: {
|
|
89
|
+
type: 'cta_url' as const,
|
|
90
|
+
header: { type: 'text' as const, text: 'Seu boleto' },
|
|
91
|
+
body: { text: 'Clique para continuar' },
|
|
92
|
+
footer: { text: 'Digisac' },
|
|
93
|
+
action: {
|
|
94
|
+
name: 'cta_url' as const,
|
|
95
|
+
parameters: { display_text: 'Continuar', url: 'https://wa.me/5541999999999' },
|
|
96
|
+
},
|
|
97
|
+
channelRedirect: {
|
|
98
|
+
enabled: true,
|
|
99
|
+
channel: 'whatsapp' as const,
|
|
100
|
+
identifierType: 'phone' as const,
|
|
101
|
+
identifier: '+5541999999999',
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
}
|
|
105
|
+
await new InteractiveMessagesApi(client).create(body)
|
|
106
|
+
expect(client.post).toHaveBeenCalledWith('/interactive-messages', body, undefined)
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
it('create sends a request_contact_info with only body and action', async () => {
|
|
110
|
+
const body = {
|
|
111
|
+
name: 'Dados',
|
|
112
|
+
interactive: {
|
|
113
|
+
type: 'request_contact_info' as const,
|
|
114
|
+
body: { text: 'Compartilhe seu contato' },
|
|
115
|
+
action: { name: 'request_contact_info' as const },
|
|
116
|
+
},
|
|
117
|
+
}
|
|
118
|
+
await new InteractiveMessagesApi(client).create(body)
|
|
119
|
+
expect(client.post).toHaveBeenCalledWith('/interactive-messages', body, undefined)
|
|
120
|
+
})
|
|
121
|
+
})
|
|
81
122
|
})
|
|
@@ -47,6 +47,52 @@ export type ServiceConnectionStatus = {
|
|
|
47
47
|
timestamp?: string
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
/**
|
|
51
|
+
* `data.webchat` of a Webchat service. Every key is optional: the object only fills up once the
|
|
52
|
+
* service is set up, and older services lack the keys added later (e.g. `instagram`). The backend
|
|
53
|
+
* stores what the forms send without normalizing it, so `null` and `{}` show up where the web
|
|
54
|
+
* forms write them.
|
|
55
|
+
*/
|
|
56
|
+
export type WebchatServiceData = {
|
|
57
|
+
/** Widget id in the webchat API; the page link is `${webchatUrl}/${id}`. Absent before setup. */
|
|
58
|
+
id?: string
|
|
59
|
+
name?: string | null
|
|
60
|
+
/** WhatsApp channel of the widget: DDI + number, without mask. `null` once cleared. */
|
|
61
|
+
phone?: string | null
|
|
62
|
+
/** Telegram channel of the widget, without `@`. `null` once cleared. */
|
|
63
|
+
telegram?: string | null
|
|
64
|
+
/** Instagram channel of the widget, without `@`. `null` once cleared. */
|
|
65
|
+
instagram?: string | null
|
|
66
|
+
isOpenForm?: boolean
|
|
67
|
+
isOpenChat?: boolean
|
|
68
|
+
/** `{}` when no picture was picked in the legacy form. */
|
|
69
|
+
file?: { base64Url?: string; mimetype?: string; fileName?: string }
|
|
70
|
+
googleId?: string | null
|
|
71
|
+
desktopChatOpen?: boolean
|
|
72
|
+
mobileChatOpen?: boolean
|
|
73
|
+
getClientData?: boolean
|
|
74
|
+
closeTicketByClient?: boolean
|
|
75
|
+
phoneClient?: boolean
|
|
76
|
+
phoneClientRequired?: boolean
|
|
77
|
+
clientName?: boolean
|
|
78
|
+
clientNameRequired?: boolean
|
|
79
|
+
/** `null` or `{}` when no custom field is asked for. */
|
|
80
|
+
customField?: { id?: string; name?: string } | null
|
|
81
|
+
customFieldRequired?: boolean
|
|
82
|
+
custom?: {
|
|
83
|
+
webchatBalloon?: boolean
|
|
84
|
+
webchatBalloonText?: string | null
|
|
85
|
+
webchatColor?: string
|
|
86
|
+
/** File id. */
|
|
87
|
+
logo?: string
|
|
88
|
+
/** File id. */
|
|
89
|
+
profilePhoto?: string
|
|
90
|
+
/** File id. */
|
|
91
|
+
webchatIcon?: string
|
|
92
|
+
typeIcon?: string
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
50
96
|
export type ServiceData = {
|
|
51
97
|
// ─── Common ───────────────────────────────────────────────────────────────
|
|
52
98
|
token?: string
|
|
@@ -106,7 +152,7 @@ export type ServiceData = {
|
|
|
106
152
|
mimetype: string
|
|
107
153
|
fileName: string
|
|
108
154
|
}
|
|
109
|
-
webchat?:
|
|
155
|
+
webchat?: WebchatServiceData
|
|
110
156
|
|
|
111
157
|
// ─── Other ────────────────────────────────────────────────────────────────
|
|
112
158
|
driverId?: string
|