@inploi/plugin-chatbot 3.4.0 → 3.4.2
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/cdn/index.js +9 -9
- package/dist/chatbot.utils.d.ts +12 -23
- package/dist/{index-935adefa.cjs → index-b2d395bb.cjs} +4 -4
- package/dist/{index-1cfd3c7f.js → index-c0d5e29a.js} +4 -4
- package/dist/{job-application-content-49d6003b.cjs → job-application-content-d37b54a8.cjs} +37 -9
- package/dist/{job-application-content-e1778fb5.js → job-application-content-e7ea0d04.js} +37 -9
- package/dist/plugin-chatbot.cjs +1 -1
- package/dist/plugin-chatbot.js +1 -1
- package/package.json +4 -4
package/dist/chatbot.utils.d.ts
CHANGED
|
@@ -4,10 +4,9 @@ export type DistributivePick<T, K extends keyof T> = T extends unknown ? Pick<T,
|
|
|
4
4
|
export declare const getHeadOrThrow: (nodes: FlowNode[]) => {
|
|
5
5
|
id: string;
|
|
6
6
|
data: {
|
|
7
|
-
|
|
7
|
+
text: string;
|
|
8
8
|
};
|
|
9
|
-
type: "
|
|
10
|
-
server: true;
|
|
9
|
+
type: "text";
|
|
11
10
|
isHead?: boolean | undefined;
|
|
12
11
|
nextId?: string | undefined;
|
|
13
12
|
} | {
|
|
@@ -16,35 +15,34 @@ export declare const getHeadOrThrow: (nodes: FlowNode[]) => {
|
|
|
16
15
|
systemMessage?: string | undefined;
|
|
17
16
|
};
|
|
18
17
|
type: "end-flow";
|
|
19
|
-
server: boolean;
|
|
20
18
|
isHead?: boolean | undefined;
|
|
21
19
|
nextId?: string | undefined;
|
|
22
20
|
} | {
|
|
23
21
|
id: string;
|
|
24
22
|
data: {
|
|
25
|
-
type: "
|
|
23
|
+
type: "partial" | "full";
|
|
24
|
+
ats: "cornerstone";
|
|
25
|
+
integrationId: string;
|
|
26
26
|
};
|
|
27
|
-
type: "submit";
|
|
28
|
-
server: boolean;
|
|
27
|
+
type: "integration-application-submit";
|
|
29
28
|
isHead?: boolean | undefined;
|
|
30
29
|
nextId?: string | undefined;
|
|
31
30
|
} | {
|
|
32
31
|
id: string;
|
|
33
32
|
data: {
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
ats: "cornerstone";
|
|
34
|
+
integrationId: string;
|
|
36
35
|
};
|
|
37
|
-
type: "
|
|
38
|
-
server: boolean;
|
|
36
|
+
type: "integration-workflow-get";
|
|
39
37
|
isHead?: boolean | undefined;
|
|
40
38
|
nextId?: string | undefined;
|
|
41
39
|
} | {
|
|
42
40
|
id: string;
|
|
43
41
|
data: {
|
|
44
|
-
|
|
42
|
+
href: string;
|
|
43
|
+
cta: string;
|
|
45
44
|
};
|
|
46
|
-
type: "
|
|
47
|
-
server: boolean;
|
|
45
|
+
type: "link";
|
|
48
46
|
isHead?: boolean | undefined;
|
|
49
47
|
nextId?: string | undefined;
|
|
50
48
|
} | {
|
|
@@ -55,7 +53,6 @@ export declare const getHeadOrThrow: (nodes: FlowNode[]) => {
|
|
|
55
53
|
height: number;
|
|
56
54
|
};
|
|
57
55
|
type: "image";
|
|
58
|
-
server: boolean;
|
|
59
56
|
isHead?: boolean | undefined;
|
|
60
57
|
nextId?: string | undefined;
|
|
61
58
|
} | {
|
|
@@ -67,7 +64,6 @@ export declare const getHeadOrThrow: (nodes: FlowNode[]) => {
|
|
|
67
64
|
falseLabel: string;
|
|
68
65
|
};
|
|
69
66
|
type: "question-boolean";
|
|
70
|
-
server: boolean;
|
|
71
67
|
isHead?: boolean | undefined;
|
|
72
68
|
nextId?: string | undefined;
|
|
73
69
|
} | {
|
|
@@ -79,7 +75,6 @@ export declare const getHeadOrThrow: (nodes: FlowNode[]) => {
|
|
|
79
75
|
placeholder?: string | undefined;
|
|
80
76
|
};
|
|
81
77
|
type: "question-text";
|
|
82
|
-
server: boolean;
|
|
83
78
|
isHead?: boolean | undefined;
|
|
84
79
|
nextId?: string | undefined;
|
|
85
80
|
} | {
|
|
@@ -93,7 +88,6 @@ export declare const getHeadOrThrow: (nodes: FlowNode[]) => {
|
|
|
93
88
|
max?: number | undefined;
|
|
94
89
|
};
|
|
95
90
|
type: "question-number";
|
|
96
|
-
server: boolean;
|
|
97
91
|
isHead?: boolean | undefined;
|
|
98
92
|
nextId?: string | undefined;
|
|
99
93
|
} | {
|
|
@@ -109,7 +103,6 @@ export declare const getHeadOrThrow: (nodes: FlowNode[]) => {
|
|
|
109
103
|
minSelected: number;
|
|
110
104
|
};
|
|
111
105
|
type: "question-enum";
|
|
112
|
-
server: boolean;
|
|
113
106
|
isHead?: boolean | undefined;
|
|
114
107
|
nextId?: string | undefined;
|
|
115
108
|
} | {
|
|
@@ -122,7 +115,6 @@ export declare const getHeadOrThrow: (nodes: FlowNode[]) => {
|
|
|
122
115
|
maxSizeKb?: number | undefined;
|
|
123
116
|
};
|
|
124
117
|
type: "question-file";
|
|
125
|
-
server: boolean;
|
|
126
118
|
isHead?: boolean | undefined;
|
|
127
119
|
nextId?: string | undefined;
|
|
128
120
|
} | {
|
|
@@ -141,7 +133,6 @@ export declare const getHeadOrThrow: (nodes: FlowNode[]) => {
|
|
|
141
133
|
placeholder?: string | undefined;
|
|
142
134
|
};
|
|
143
135
|
type: "question-address";
|
|
144
|
-
server: boolean;
|
|
145
136
|
isHead?: boolean | undefined;
|
|
146
137
|
nextId?: string | undefined;
|
|
147
138
|
} | {
|
|
@@ -152,7 +143,6 @@ export declare const getHeadOrThrow: (nodes: FlowNode[]) => {
|
|
|
152
143
|
compare: "equals" | "notEquals" | "contains" | "notContains";
|
|
153
144
|
};
|
|
154
145
|
type: "if-block";
|
|
155
|
-
server: boolean;
|
|
156
146
|
isHead?: boolean | undefined;
|
|
157
147
|
nextId?: string | undefined;
|
|
158
148
|
branchId?: string | undefined;
|
|
@@ -162,7 +152,6 @@ export declare const getHeadOrThrow: (nodes: FlowNode[]) => {
|
|
|
162
152
|
targetId: string;
|
|
163
153
|
};
|
|
164
154
|
type: "jump";
|
|
165
|
-
server: boolean;
|
|
166
155
|
isHead?: boolean | undefined;
|
|
167
156
|
nextId?: string | undefined;
|
|
168
157
|
};
|
|
@@ -1039,7 +1039,7 @@ function useSignal(n2) {
|
|
|
1039
1039
|
return a$1(n2);
|
|
1040
1040
|
}, []);
|
|
1041
1041
|
}
|
|
1042
|
-
|
|
1042
|
+
var exhaustive = (value) => {
|
|
1043
1043
|
throw new Error(`Unhandled discriminated union member: ${JSON.stringify(value)}`);
|
|
1044
1044
|
};
|
|
1045
1045
|
function invariant$1(condition, message) {
|
|
@@ -8298,7 +8298,7 @@ const ChatbotHeader = ({
|
|
|
8298
8298
|
})]
|
|
8299
8299
|
});
|
|
8300
8300
|
};
|
|
8301
|
-
const JobApplicationContent = M$1(() => Promise.resolve().then(() => require("./job-application-content-
|
|
8301
|
+
const JobApplicationContent = M$1(() => Promise.resolve().then(() => require("./job-application-content-d37b54a8.cjs")).then((module2) => module2.JobApplicationContent));
|
|
8302
8302
|
const MotionProvider = ({
|
|
8303
8303
|
children
|
|
8304
8304
|
}) => {
|
|
@@ -8976,8 +8976,8 @@ const ApplicationSchema = object({
|
|
|
8976
8976
|
}),
|
|
8977
8977
|
flow: object({
|
|
8978
8978
|
id: coerce(string(), String),
|
|
8979
|
-
|
|
8980
|
-
|
|
8979
|
+
version: number(),
|
|
8980
|
+
nodes: array(any())
|
|
8981
8981
|
})
|
|
8982
8982
|
});
|
|
8983
8983
|
async function getApplicationData({
|
|
@@ -1038,7 +1038,7 @@ function useSignal(n2) {
|
|
|
1038
1038
|
return a$1(n2);
|
|
1039
1039
|
}, []);
|
|
1040
1040
|
}
|
|
1041
|
-
|
|
1041
|
+
var exhaustive = (value) => {
|
|
1042
1042
|
throw new Error(`Unhandled discriminated union member: ${JSON.stringify(value)}`);
|
|
1043
1043
|
};
|
|
1044
1044
|
function invariant$1(condition, message) {
|
|
@@ -8297,7 +8297,7 @@ const ChatbotHeader = ({
|
|
|
8297
8297
|
})]
|
|
8298
8298
|
});
|
|
8299
8299
|
};
|
|
8300
|
-
const JobApplicationContent = M$1(() => import("./job-application-content-
|
|
8300
|
+
const JobApplicationContent = M$1(() => import("./job-application-content-e7ea0d04.js").then((module) => module.JobApplicationContent));
|
|
8301
8301
|
const MotionProvider = ({
|
|
8302
8302
|
children
|
|
8303
8303
|
}) => {
|
|
@@ -8975,8 +8975,8 @@ const ApplicationSchema = object({
|
|
|
8975
8975
|
}),
|
|
8976
8976
|
flow: object({
|
|
8977
8977
|
id: coerce(string(), String),
|
|
8978
|
-
|
|
8979
|
-
|
|
8978
|
+
version: number(),
|
|
8979
|
+
nodes: array(any())
|
|
8980
8980
|
})
|
|
8981
8981
|
});
|
|
8982
8982
|
async function getApplicationData({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const index = require("./index-
|
|
3
|
+
const index = require("./index-b2d395bb.cjs");
|
|
4
4
|
require("@inploi/sdk");
|
|
5
5
|
const followNodes = ({
|
|
6
6
|
node,
|
|
@@ -156,9 +156,13 @@ async function interpret(params) {
|
|
|
156
156
|
}
|
|
157
157
|
}, interpretLinkNode).with({
|
|
158
158
|
node: {
|
|
159
|
-
type: "submit"
|
|
159
|
+
type: "integration-application-submit"
|
|
160
160
|
}
|
|
161
|
-
}, interpretSubmitNode).
|
|
161
|
+
}, interpretSubmitNode).with({
|
|
162
|
+
node: {
|
|
163
|
+
type: "integration-workflow-get"
|
|
164
|
+
}
|
|
165
|
+
}, () => Error("Unreachable")).exhaustive();
|
|
162
166
|
}
|
|
163
167
|
async function interpretSubmitNode({
|
|
164
168
|
chat,
|
|
@@ -167,7 +171,8 @@ async function interpretSubmitNode({
|
|
|
167
171
|
logger,
|
|
168
172
|
apiClient,
|
|
169
173
|
submissions,
|
|
170
|
-
context
|
|
174
|
+
context,
|
|
175
|
+
analytics
|
|
171
176
|
}) {
|
|
172
177
|
await chat.userInput({
|
|
173
178
|
type: "multiple-choice",
|
|
@@ -181,6 +186,17 @@ async function interpretSubmitNode({
|
|
|
181
186
|
minSelected: 1
|
|
182
187
|
}
|
|
183
188
|
});
|
|
189
|
+
const logApplyComplete = () => {
|
|
190
|
+
const contextJobId = typeof context.jobId === "string" ? context.jobId : void 0;
|
|
191
|
+
if (contextJobId) {
|
|
192
|
+
analytics.log({
|
|
193
|
+
event: "APPLY_COMPLETE",
|
|
194
|
+
properties: {
|
|
195
|
+
job_id: contextJobId
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
};
|
|
184
200
|
await chat.sendMessage({
|
|
185
201
|
type: "system",
|
|
186
202
|
variant: "info",
|
|
@@ -190,25 +206,37 @@ async function interpretSubmitNode({
|
|
|
190
206
|
method: "POST",
|
|
191
207
|
body: JSON.stringify({
|
|
192
208
|
...context,
|
|
209
|
+
type: node.data.type,
|
|
210
|
+
ats: node.data.ats,
|
|
211
|
+
integration_id: node.data.integrationId,
|
|
193
212
|
submissions: index.getApplicationSubmissionsPayload(submissions || {})
|
|
194
213
|
})
|
|
195
214
|
}).catch((e) => e);
|
|
196
215
|
await index.N(response).with({
|
|
197
|
-
|
|
216
|
+
ats_data: {
|
|
217
|
+
redirect_url: index._.string
|
|
218
|
+
}
|
|
198
219
|
}, async (response2) => {
|
|
199
220
|
await chat.sendMessage({
|
|
200
221
|
type: "text",
|
|
201
222
|
author: "bot",
|
|
202
223
|
text: "Almost there! Please finalise your application on our partner’s website."
|
|
203
224
|
});
|
|
225
|
+
const currentAnonymousId = analytics.getAnonymousId();
|
|
226
|
+
const href = new URL(response2.ats_data.redirect_url);
|
|
227
|
+
if (currentAnonymousId && !href.searchParams.has("anonymous_id")) {
|
|
228
|
+
href.searchParams.set("anonymous_id", currentAnonymousId);
|
|
229
|
+
}
|
|
230
|
+
logApplyComplete();
|
|
204
231
|
await chat.sendMessage({
|
|
205
232
|
type: "link",
|
|
206
|
-
href:
|
|
233
|
+
href: href.toString(),
|
|
207
234
|
text: "Finalise application on partner"
|
|
208
235
|
});
|
|
209
236
|
}).with({
|
|
210
|
-
|
|
237
|
+
success: true
|
|
211
238
|
}, async () => {
|
|
239
|
+
logApplyComplete();
|
|
212
240
|
await chat.sendMessage({
|
|
213
241
|
type: "system",
|
|
214
242
|
variant: "success",
|
|
@@ -339,7 +367,7 @@ async function interpretQuestionEnumNode({
|
|
|
339
367
|
await chat.sendMessage({
|
|
340
368
|
author: "user",
|
|
341
369
|
type: "text",
|
|
342
|
-
text: reply.value.join(", ")
|
|
370
|
+
text: node.data.options.filter((o2) => reply.value.includes(o2.value)).map((o2) => o2.label).join(", ")
|
|
343
371
|
});
|
|
344
372
|
next(node.nextId);
|
|
345
373
|
}
|
|
@@ -2751,7 +2779,7 @@ const useChatService = () => {
|
|
|
2751
2779
|
if (signal == null ? void 0 : signal.aborted)
|
|
2752
2780
|
throw new index.AbortedError();
|
|
2753
2781
|
setIsBotTyping(true);
|
|
2754
|
-
const typingTime = Math.max(20, message2.text.length) * TYPING_SPEED_MS_PER_CHARACTER;
|
|
2782
|
+
const typingTime = Math.min(Math.max(20, message2.text.length), 100) * TYPING_SPEED_MS_PER_CHARACTER;
|
|
2755
2783
|
await new Promise((resolve) => {
|
|
2756
2784
|
return setTimeout(resolve, typingTime, {
|
|
2757
2785
|
signal
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _, g as getHeadOrThrow, A as AbortedError, N, a as getApplicationSubmissionsPayload, o as o$1, c as clsx, b as _$1, p, d as parse, e as picklist, m, f as AnimatePresence, h as application, i as h, k, j as invariant, l as isSubmissionOfType, C as Cn, n as parseAsync, V as ValiError, q as object, t as transform, r as maxLength, s as minLength, u as record, v as boolean, w as string, x as email, y as url, z as regex, B as y, T, D as inputHeight, F, E as viewState, G as ERROR_MESSAGES } from "./index-
|
|
1
|
+
import { _, g as getHeadOrThrow, A as AbortedError, N, a as getApplicationSubmissionsPayload, o as o$1, c as clsx, b as _$1, p, d as parse, e as picklist, m, f as AnimatePresence, h as application, i as h, k, j as invariant, l as isSubmissionOfType, C as Cn, n as parseAsync, V as ValiError, q as object, t as transform, r as maxLength, s as minLength, u as record, v as boolean, w as string, x as email, y as url, z as regex, B as y, T, D as inputHeight, F, E as viewState, G as ERROR_MESSAGES } from "./index-c0d5e29a.js";
|
|
2
2
|
import "@inploi/sdk";
|
|
3
3
|
const followNodes = ({
|
|
4
4
|
node,
|
|
@@ -154,9 +154,13 @@ async function interpret(params) {
|
|
|
154
154
|
}
|
|
155
155
|
}, interpretLinkNode).with({
|
|
156
156
|
node: {
|
|
157
|
-
type: "submit"
|
|
157
|
+
type: "integration-application-submit"
|
|
158
158
|
}
|
|
159
|
-
}, interpretSubmitNode).
|
|
159
|
+
}, interpretSubmitNode).with({
|
|
160
|
+
node: {
|
|
161
|
+
type: "integration-workflow-get"
|
|
162
|
+
}
|
|
163
|
+
}, () => Error("Unreachable")).exhaustive();
|
|
160
164
|
}
|
|
161
165
|
async function interpretSubmitNode({
|
|
162
166
|
chat,
|
|
@@ -165,7 +169,8 @@ async function interpretSubmitNode({
|
|
|
165
169
|
logger,
|
|
166
170
|
apiClient,
|
|
167
171
|
submissions,
|
|
168
|
-
context
|
|
172
|
+
context,
|
|
173
|
+
analytics
|
|
169
174
|
}) {
|
|
170
175
|
await chat.userInput({
|
|
171
176
|
type: "multiple-choice",
|
|
@@ -179,6 +184,17 @@ async function interpretSubmitNode({
|
|
|
179
184
|
minSelected: 1
|
|
180
185
|
}
|
|
181
186
|
});
|
|
187
|
+
const logApplyComplete = () => {
|
|
188
|
+
const contextJobId = typeof context.jobId === "string" ? context.jobId : void 0;
|
|
189
|
+
if (contextJobId) {
|
|
190
|
+
analytics.log({
|
|
191
|
+
event: "APPLY_COMPLETE",
|
|
192
|
+
properties: {
|
|
193
|
+
job_id: contextJobId
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
};
|
|
182
198
|
await chat.sendMessage({
|
|
183
199
|
type: "system",
|
|
184
200
|
variant: "info",
|
|
@@ -188,25 +204,37 @@ async function interpretSubmitNode({
|
|
|
188
204
|
method: "POST",
|
|
189
205
|
body: JSON.stringify({
|
|
190
206
|
...context,
|
|
207
|
+
type: node.data.type,
|
|
208
|
+
ats: node.data.ats,
|
|
209
|
+
integration_id: node.data.integrationId,
|
|
191
210
|
submissions: getApplicationSubmissionsPayload(submissions || {})
|
|
192
211
|
})
|
|
193
212
|
}).catch((e) => e);
|
|
194
213
|
await N(response).with({
|
|
195
|
-
|
|
214
|
+
ats_data: {
|
|
215
|
+
redirect_url: _.string
|
|
216
|
+
}
|
|
196
217
|
}, async (response2) => {
|
|
197
218
|
await chat.sendMessage({
|
|
198
219
|
type: "text",
|
|
199
220
|
author: "bot",
|
|
200
221
|
text: "Almost there! Please finalise your application on our partner’s website."
|
|
201
222
|
});
|
|
223
|
+
const currentAnonymousId = analytics.getAnonymousId();
|
|
224
|
+
const href = new URL(response2.ats_data.redirect_url);
|
|
225
|
+
if (currentAnonymousId && !href.searchParams.has("anonymous_id")) {
|
|
226
|
+
href.searchParams.set("anonymous_id", currentAnonymousId);
|
|
227
|
+
}
|
|
228
|
+
logApplyComplete();
|
|
202
229
|
await chat.sendMessage({
|
|
203
230
|
type: "link",
|
|
204
|
-
href:
|
|
231
|
+
href: href.toString(),
|
|
205
232
|
text: "Finalise application on partner"
|
|
206
233
|
});
|
|
207
234
|
}).with({
|
|
208
|
-
|
|
235
|
+
success: true
|
|
209
236
|
}, async () => {
|
|
237
|
+
logApplyComplete();
|
|
210
238
|
await chat.sendMessage({
|
|
211
239
|
type: "system",
|
|
212
240
|
variant: "success",
|
|
@@ -337,7 +365,7 @@ async function interpretQuestionEnumNode({
|
|
|
337
365
|
await chat.sendMessage({
|
|
338
366
|
author: "user",
|
|
339
367
|
type: "text",
|
|
340
|
-
text: reply.value.join(", ")
|
|
368
|
+
text: node.data.options.filter((o2) => reply.value.includes(o2.value)).map((o2) => o2.label).join(", ")
|
|
341
369
|
});
|
|
342
370
|
next(node.nextId);
|
|
343
371
|
}
|
|
@@ -2749,7 +2777,7 @@ const useChatService = () => {
|
|
|
2749
2777
|
if (signal == null ? void 0 : signal.aborted)
|
|
2750
2778
|
throw new AbortedError();
|
|
2751
2779
|
setIsBotTyping(true);
|
|
2752
|
-
const typingTime = Math.max(20, message2.text.length) * TYPING_SPEED_MS_PER_CHARACTER;
|
|
2780
|
+
const typingTime = Math.min(Math.max(20, message2.text.length), 100) * TYPING_SPEED_MS_PER_CHARACTER;
|
|
2753
2781
|
await new Promise((resolve) => {
|
|
2754
2782
|
return setTimeout(resolve, typingTime, {
|
|
2755
2783
|
signal
|
package/dist/plugin-chatbot.cjs
CHANGED
package/dist/plugin-chatbot.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inploi/plugin-chatbot",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/plugin-chatbot.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -63,10 +63,10 @@
|
|
|
63
63
|
"vite": "^4.4.5",
|
|
64
64
|
"vite-plugin-dts": "^3.7.0",
|
|
65
65
|
"vite-tsconfig-paths": "^4.2.1",
|
|
66
|
-
"@inploi/core": "1.
|
|
67
|
-
"@inploi/sdk": "1.9.0",
|
|
66
|
+
"@inploi/core": "1.11.0",
|
|
68
67
|
"eslint-config-custom": "0.1.0",
|
|
69
|
-
"tsconfig": "0.1.0"
|
|
68
|
+
"tsconfig": "0.1.0",
|
|
69
|
+
"@inploi/sdk": "1.10.0"
|
|
70
70
|
},
|
|
71
71
|
"msw": {
|
|
72
72
|
"workerDirectory": "public"
|