@inploi/plugin-chatbot 3.23.0 → 3.23.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 +6 -6
- package/dist/{chatbot-body-364c9383.js → chatbot-body-234455b9.js} +12 -8
- package/dist/{chatbot-body-e518eb9a.cjs → chatbot-body-f736e128.cjs} +12 -8
- package/dist/chatbot.d.ts +7 -4
- package/dist/chatbot.state.d.ts +2 -1
- package/dist/{index-d8265e0a.cjs → index-2748d0ca.cjs} +10 -18
- package/dist/{index-6e48d6e0.js → index-b086bc88.js} +10 -18
- package/dist/interpreter.d.ts +0 -2
- package/dist/plugin-chatbot.cjs +1 -1
- package/dist/plugin-chatbot.js +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as get$1, i as isString$1, k as kbToReadableSize, a as getHeadOrThrow, b as invariant, A as AbortedError, N, c as getFlowSubmissionsPayload, _, d as getDefaultExportFromCjs, h, e as _$1, p, F, o as o$1, f as clsx, y, s as store, j as a$2, l as debounce$1, m as k, n as k$1, q as getFormSubmitter, r as parse, t as picklist, u as isSubmissionOfType, C as Cn, v as parseAsync, V as ValiError, w as object, x as transform, z as cva, B as maxLength, D as minLength, E as record, G as boolean, H as number, I as minValue, J as maxValue, K as custom, L as string, M as email, O as url, P as regex, Q as ERROR_MESSAGES } from "./index-
|
|
1
|
+
import { g as get$1, i as isString$1, k as kbToReadableSize, a as getHeadOrThrow, b as invariant, A as AbortedError, N, c as getFlowSubmissionsPayload, _, d as getDefaultExportFromCjs, h, e as _$1, p, F, o as o$1, f as clsx, y, s as store, j as a$2, l as debounce$1, m as k, n as k$1, q as getFormSubmitter, r as parse, t as picklist, u as isSubmissionOfType, C as Cn, v as parseAsync, V as ValiError, w as object, x as transform, z as cva, B as maxLength, D as minLength, E as record, G as boolean, H as number, I as minValue, J as maxValue, K as custom, L as string, M as email, O as url, P as regex, Q as ERROR_MESSAGES } from "./index-b086bc88.js";
|
|
2
2
|
import "@inploi/sdk";
|
|
3
3
|
const isIfBlockConditionMet = (ifBlock, {
|
|
4
4
|
context,
|
|
@@ -414,7 +414,6 @@ async function interpretSubmitNode({
|
|
|
414
414
|
logger,
|
|
415
415
|
apiClient,
|
|
416
416
|
submissions,
|
|
417
|
-
context,
|
|
418
417
|
analytics,
|
|
419
418
|
flow
|
|
420
419
|
}) {
|
|
@@ -444,7 +443,7 @@ async function interpretSubmitNode({
|
|
|
444
443
|
integration_id: node.data.integrationId,
|
|
445
444
|
anonymous_id,
|
|
446
445
|
session_id,
|
|
447
|
-
|
|
446
|
+
job: flow.job,
|
|
448
447
|
submissions: getFlowSubmissionsPayload(submissions || {})
|
|
449
448
|
})
|
|
450
449
|
}).catch((e) => e);
|
|
@@ -475,7 +474,8 @@ async function interpretSubmitNode({
|
|
|
475
474
|
response: {
|
|
476
475
|
status: integrationResponse.status,
|
|
477
476
|
payload: "data" in integrationResponse ? integrationResponse.data : integrationResponse.error.data ?? null
|
|
478
|
-
}
|
|
477
|
+
},
|
|
478
|
+
job: flow.job
|
|
479
479
|
}
|
|
480
480
|
});
|
|
481
481
|
}).otherwise(() => {
|
|
@@ -508,7 +508,8 @@ async function interpretSubmitNode({
|
|
|
508
508
|
flow_id: flow.id,
|
|
509
509
|
flow_session_id: session_id,
|
|
510
510
|
flow_version: flow.version,
|
|
511
|
-
href: href.toString()
|
|
511
|
+
href: href.toString(),
|
|
512
|
+
job: flow.job
|
|
512
513
|
}
|
|
513
514
|
});
|
|
514
515
|
}
|
|
@@ -4083,7 +4084,8 @@ const ChatbotBody = ({
|
|
|
4083
4084
|
flow_id: flow.id,
|
|
4084
4085
|
flow_version: flow.version,
|
|
4085
4086
|
flow_session_id: currentApplication.data.flowSessionId,
|
|
4086
|
-
flow_build: flow.build
|
|
4087
|
+
flow_build: flow.build,
|
|
4088
|
+
job: flow.job
|
|
4087
4089
|
},
|
|
4088
4090
|
customProperties: (_a = flow.analytics) == null ? void 0 : _a.customProperties
|
|
4089
4091
|
});
|
|
@@ -4124,7 +4126,8 @@ const ChatbotBody = ({
|
|
|
4124
4126
|
flow_build: flow.build,
|
|
4125
4127
|
to_node_id: node.id,
|
|
4126
4128
|
sequence: currentState.data.sequence,
|
|
4127
|
-
flow_session_id: currentState.data.flowSessionId
|
|
4129
|
+
flow_session_id: currentState.data.flowSessionId,
|
|
4130
|
+
job: flow.job
|
|
4128
4131
|
},
|
|
4129
4132
|
customProperties: (_a2 = flow.analytics) == null ? void 0 : _a2.customProperties
|
|
4130
4133
|
});
|
|
@@ -4142,7 +4145,8 @@ const ChatbotBody = ({
|
|
|
4142
4145
|
flow_id: flow.id,
|
|
4143
4146
|
flow_version: flow.version,
|
|
4144
4147
|
flow_session_id: currentState.data.flowSessionId,
|
|
4145
|
-
flow_build: flow.build
|
|
4148
|
+
flow_build: flow.build,
|
|
4149
|
+
job: flow.job
|
|
4146
4150
|
},
|
|
4147
4151
|
customProperties: (_a2 = flow.analytics) == null ? void 0 : _a2.customProperties
|
|
4148
4152
|
});
|
|
@@ -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-2748d0ca.cjs");
|
|
4
4
|
require("@inploi/sdk");
|
|
5
5
|
const isIfBlockConditionMet = (ifBlock, {
|
|
6
6
|
context,
|
|
@@ -416,7 +416,6 @@ async function interpretSubmitNode({
|
|
|
416
416
|
logger,
|
|
417
417
|
apiClient,
|
|
418
418
|
submissions,
|
|
419
|
-
context,
|
|
420
419
|
analytics,
|
|
421
420
|
flow
|
|
422
421
|
}) {
|
|
@@ -446,7 +445,7 @@ async function interpretSubmitNode({
|
|
|
446
445
|
integration_id: node.data.integrationId,
|
|
447
446
|
anonymous_id,
|
|
448
447
|
session_id,
|
|
449
|
-
|
|
448
|
+
job: flow.job,
|
|
450
449
|
submissions: index.getFlowSubmissionsPayload(submissions || {})
|
|
451
450
|
})
|
|
452
451
|
}).catch((e) => e);
|
|
@@ -477,7 +476,8 @@ async function interpretSubmitNode({
|
|
|
477
476
|
response: {
|
|
478
477
|
status: integrationResponse.status,
|
|
479
478
|
payload: "data" in integrationResponse ? integrationResponse.data : integrationResponse.error.data ?? null
|
|
480
|
-
}
|
|
479
|
+
},
|
|
480
|
+
job: flow.job
|
|
481
481
|
}
|
|
482
482
|
});
|
|
483
483
|
}).otherwise(() => {
|
|
@@ -510,7 +510,8 @@ async function interpretSubmitNode({
|
|
|
510
510
|
flow_id: flow.id,
|
|
511
511
|
flow_session_id: session_id,
|
|
512
512
|
flow_version: flow.version,
|
|
513
|
-
href: href.toString()
|
|
513
|
+
href: href.toString(),
|
|
514
|
+
job: flow.job
|
|
514
515
|
}
|
|
515
516
|
});
|
|
516
517
|
}
|
|
@@ -4085,7 +4086,8 @@ const ChatbotBody = ({
|
|
|
4085
4086
|
flow_id: flow.id,
|
|
4086
4087
|
flow_version: flow.version,
|
|
4087
4088
|
flow_session_id: currentApplication.data.flowSessionId,
|
|
4088
|
-
flow_build: flow.build
|
|
4089
|
+
flow_build: flow.build,
|
|
4090
|
+
job: flow.job
|
|
4089
4091
|
},
|
|
4090
4092
|
customProperties: (_a = flow.analytics) == null ? void 0 : _a.customProperties
|
|
4091
4093
|
});
|
|
@@ -4126,7 +4128,8 @@ const ChatbotBody = ({
|
|
|
4126
4128
|
flow_build: flow.build,
|
|
4127
4129
|
to_node_id: node.id,
|
|
4128
4130
|
sequence: currentState.data.sequence,
|
|
4129
|
-
flow_session_id: currentState.data.flowSessionId
|
|
4131
|
+
flow_session_id: currentState.data.flowSessionId,
|
|
4132
|
+
job: flow.job
|
|
4130
4133
|
},
|
|
4131
4134
|
customProperties: (_a2 = flow.analytics) == null ? void 0 : _a2.customProperties
|
|
4132
4135
|
});
|
|
@@ -4144,7 +4147,8 @@ const ChatbotBody = ({
|
|
|
4144
4147
|
flow_id: flow.id,
|
|
4145
4148
|
flow_version: flow.version,
|
|
4146
4149
|
flow_session_id: currentState.data.flowSessionId,
|
|
4147
|
-
flow_build: flow.build
|
|
4150
|
+
flow_build: flow.build,
|
|
4151
|
+
job: flow.job
|
|
4148
4152
|
},
|
|
4149
4153
|
customProperties: (_a2 = flow.analytics) == null ? void 0 : _a2.customProperties
|
|
4150
4154
|
});
|
package/dist/chatbot.d.ts
CHANGED
|
@@ -22,6 +22,12 @@ export type OpenChatbotParams = {
|
|
|
22
22
|
context?: Record<string, unknown>;
|
|
23
23
|
/** Title to display in the status bar */
|
|
24
24
|
title: string;
|
|
25
|
+
job?: {
|
|
26
|
+
id: string;
|
|
27
|
+
/** Whether the job id is an internal (inploi) or external.
|
|
28
|
+
* Use `external` if unsure */
|
|
29
|
+
id_type: 'internal' | 'external';
|
|
30
|
+
};
|
|
25
31
|
};
|
|
26
32
|
export declare const chatbotPlugin: ({ _internal_domManager: dom, theme, }: {
|
|
27
33
|
theme: {
|
|
@@ -34,6 +40,7 @@ export declare const chatbotPlugin: ({ _internal_domManager: dom, theme, }: {
|
|
|
34
40
|
/** @deprecated For internal usage only */
|
|
35
41
|
_internal_domManager?: ChatbotDomManager;
|
|
36
42
|
}) => ({ apiClient, logger, analytics }: {
|
|
43
|
+
/** Optionally eagerly renders the interface ahead of needing the chatbot. */
|
|
37
44
|
apiClient: import("@inploi/sdk").ApiClient;
|
|
38
45
|
logger: Logger;
|
|
39
46
|
analytics: import("@inploi/sdk").AnalyticsService;
|
|
@@ -46,10 +53,6 @@ export declare const chatbotPlugin: ({ _internal_domManager: dom, theme, }: {
|
|
|
46
53
|
fetchFlowByJobId: (jobId: string, additionalProperties?: Partial<OpenChatbotParams>) => Promise<OpenChatbotParams>;
|
|
47
54
|
fetchFlowById: (flowId: string, additionalProperties?: Partial<OpenChatbotParams>) => Promise<OpenChatbotParams>;
|
|
48
55
|
open: (params: OpenChatbotParams | Promise<OpenChatbotParams>) => Promise<void>;
|
|
49
|
-
/** @deprecated - Please use `open` instead. */
|
|
50
|
-
startApplication: never;
|
|
51
|
-
/** @deprecated - Please use `close` instead */
|
|
52
|
-
closeApplication: never;
|
|
53
56
|
close: () => Promise<void>;
|
|
54
57
|
};
|
|
55
58
|
export {};
|
package/dist/chatbot.state.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export type StartedFlow = Flow & {
|
|
|
9
9
|
data: FlowStateData;
|
|
10
10
|
startedAt: Date;
|
|
11
11
|
context: Record<string, unknown>;
|
|
12
|
+
job: OpenChatbotParams['job'];
|
|
12
13
|
nodeIdToProgress: Record<string, ChatbotFlowProgress>;
|
|
13
14
|
analytics: OpenChatbotParams['analytics'];
|
|
14
15
|
};
|
|
@@ -33,7 +34,7 @@ export declare const store: {
|
|
|
33
34
|
current$: import("@preact/signals").Signal<CurrentFlow>;
|
|
34
35
|
viewState$: import("@preact/signals").Signal<"maximised" | "minimised" | "closed">;
|
|
35
36
|
inputHeight$: import("@preact/signals").Signal<number>;
|
|
36
|
-
startFlow: ({ flow, context, flowKeys, title, analytics }: OpenChatbotParams) => Promise<void>;
|
|
37
|
+
startFlow: ({ flow, context, flowKeys, title, analytics, job }: OpenChatbotParams) => Promise<void>;
|
|
37
38
|
cancelCurrentFlow: () => void;
|
|
38
39
|
markAsFinished: () => void;
|
|
39
40
|
setCurrentNodeId: (currentNodeId: string) => void;
|
|
@@ -4973,7 +4973,8 @@ const store = {
|
|
|
4973
4973
|
context = {},
|
|
4974
4974
|
flowKeys,
|
|
4975
4975
|
title,
|
|
4976
|
-
analytics
|
|
4976
|
+
analytics,
|
|
4977
|
+
job
|
|
4977
4978
|
}) => {
|
|
4978
4979
|
const data = await idb.getStateData(flow, flowKeys) ?? initialiseFlowStateData();
|
|
4979
4980
|
const startedFlow = {
|
|
@@ -4987,7 +4988,8 @@ const store = {
|
|
|
4987
4988
|
build: flow.build,
|
|
4988
4989
|
context,
|
|
4989
4990
|
title,
|
|
4990
|
-
analytics
|
|
4991
|
+
analytics,
|
|
4992
|
+
job
|
|
4991
4993
|
};
|
|
4992
4994
|
currentFlow.value = {
|
|
4993
4995
|
state: "loaded",
|
|
@@ -5313,7 +5315,7 @@ const StatusBar = ({
|
|
|
5313
5315
|
})
|
|
5314
5316
|
});
|
|
5315
5317
|
};
|
|
5316
|
-
const ChatbotBody = M(() => Promise.resolve().then(() => require("./chatbot-body-
|
|
5318
|
+
const ChatbotBody = M(() => Promise.resolve().then(() => require("./chatbot-body-f736e128.cjs")).then((module2) => module2.ChatbotBody));
|
|
5317
5319
|
const chatbotContentClass = cva("selection:bg-accent-4 selection:text-accent-12 fixed bottom-2 left-2 right-2 isolate mx-auto max-h-full max-w-[450px] focus:outline-none", {
|
|
5318
5320
|
variants: {
|
|
5319
5321
|
view: {
|
|
@@ -5735,22 +5737,16 @@ const chatbotPlugin = ({
|
|
|
5735
5737
|
* @param jobId - The job ID to fetch the flow for. This is the job ID according to the **ATS**, and not the inploi job ID.
|
|
5736
5738
|
*/
|
|
5737
5739
|
fetchFlowByJobId: async (jobId, additionalProperties) => apiClient.fetch(`/flow/job/${jobId}`).then((res) => {
|
|
5738
|
-
var _a;
|
|
5739
5740
|
const data = parse$1(FlowByJobPayloadSchema, res);
|
|
5740
5741
|
return {
|
|
5741
5742
|
flow: data.flow,
|
|
5742
5743
|
title: `Applying for “${data.job.title}”`,
|
|
5743
5744
|
flowKeys: [data.job.id, ...(additionalProperties == null ? void 0 : additionalProperties.flowKeys) ?? []],
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
|
|
5747
|
-
|
|
5748
|
-
|
|
5749
|
-
flow_id: data.flow.id,
|
|
5750
|
-
flow_version: data.flow.version,
|
|
5751
|
-
...(_a = additionalProperties == null ? void 0 : additionalProperties.analytics) == null ? void 0 : _a.customProperties
|
|
5752
|
-
}
|
|
5753
|
-
}
|
|
5745
|
+
job: {
|
|
5746
|
+
id: data.job.id,
|
|
5747
|
+
id_type: "external"
|
|
5748
|
+
},
|
|
5749
|
+
...additionalProperties
|
|
5754
5750
|
};
|
|
5755
5751
|
}),
|
|
5756
5752
|
fetchFlowById: async (flowId, additionalProperties) => apiClient.fetch(`/flow/id/${flowId}`).then((res) => {
|
|
@@ -5808,10 +5804,6 @@ const chatbotPlugin = ({
|
|
|
5808
5804
|
logger.error("Error starting flow", error);
|
|
5809
5805
|
}
|
|
5810
5806
|
},
|
|
5811
|
-
/** @deprecated - Please use `open` instead. */
|
|
5812
|
-
startApplication: void 0,
|
|
5813
|
-
/** @deprecated - Please use `close` instead */
|
|
5814
|
-
closeApplication: void 0,
|
|
5815
5807
|
close: async () => {
|
|
5816
5808
|
if (typeof window === "undefined")
|
|
5817
5809
|
return;
|
|
@@ -4972,7 +4972,8 @@ const store = {
|
|
|
4972
4972
|
context = {},
|
|
4973
4973
|
flowKeys,
|
|
4974
4974
|
title,
|
|
4975
|
-
analytics
|
|
4975
|
+
analytics,
|
|
4976
|
+
job
|
|
4976
4977
|
}) => {
|
|
4977
4978
|
const data = await idb.getStateData(flow, flowKeys) ?? initialiseFlowStateData();
|
|
4978
4979
|
const startedFlow = {
|
|
@@ -4986,7 +4987,8 @@ const store = {
|
|
|
4986
4987
|
build: flow.build,
|
|
4987
4988
|
context,
|
|
4988
4989
|
title,
|
|
4989
|
-
analytics
|
|
4990
|
+
analytics,
|
|
4991
|
+
job
|
|
4990
4992
|
};
|
|
4991
4993
|
currentFlow.value = {
|
|
4992
4994
|
state: "loaded",
|
|
@@ -5312,7 +5314,7 @@ const StatusBar = ({
|
|
|
5312
5314
|
})
|
|
5313
5315
|
});
|
|
5314
5316
|
};
|
|
5315
|
-
const ChatbotBody = M(() => import("./chatbot-body-
|
|
5317
|
+
const ChatbotBody = M(() => import("./chatbot-body-234455b9.js").then((module) => module.ChatbotBody));
|
|
5316
5318
|
const chatbotContentClass = cva("selection:bg-accent-4 selection:text-accent-12 fixed bottom-2 left-2 right-2 isolate mx-auto max-h-full max-w-[450px] focus:outline-none", {
|
|
5317
5319
|
variants: {
|
|
5318
5320
|
view: {
|
|
@@ -5734,22 +5736,16 @@ const chatbotPlugin = ({
|
|
|
5734
5736
|
* @param jobId - The job ID to fetch the flow for. This is the job ID according to the **ATS**, and not the inploi job ID.
|
|
5735
5737
|
*/
|
|
5736
5738
|
fetchFlowByJobId: async (jobId, additionalProperties) => apiClient.fetch(`/flow/job/${jobId}`).then((res) => {
|
|
5737
|
-
var _a;
|
|
5738
5739
|
const data = parse$1(FlowByJobPayloadSchema, res);
|
|
5739
5740
|
return {
|
|
5740
5741
|
flow: data.flow,
|
|
5741
5742
|
title: `Applying for “${data.job.title}”`,
|
|
5742
5743
|
flowKeys: [data.job.id, ...(additionalProperties == null ? void 0 : additionalProperties.flowKeys) ?? []],
|
|
5743
|
-
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
|
|
5747
|
-
|
|
5748
|
-
flow_id: data.flow.id,
|
|
5749
|
-
flow_version: data.flow.version,
|
|
5750
|
-
...(_a = additionalProperties == null ? void 0 : additionalProperties.analytics) == null ? void 0 : _a.customProperties
|
|
5751
|
-
}
|
|
5752
|
-
}
|
|
5744
|
+
job: {
|
|
5745
|
+
id: data.job.id,
|
|
5746
|
+
id_type: "external"
|
|
5747
|
+
},
|
|
5748
|
+
...additionalProperties
|
|
5753
5749
|
};
|
|
5754
5750
|
}),
|
|
5755
5751
|
fetchFlowById: async (flowId, additionalProperties) => apiClient.fetch(`/flow/id/${flowId}`).then((res) => {
|
|
@@ -5807,10 +5803,6 @@ const chatbotPlugin = ({
|
|
|
5807
5803
|
logger.error("Error starting flow", error);
|
|
5808
5804
|
}
|
|
5809
5805
|
},
|
|
5810
|
-
/** @deprecated - Please use `open` instead. */
|
|
5811
|
-
startApplication: void 0,
|
|
5812
|
-
/** @deprecated - Please use `close` instead */
|
|
5813
|
-
closeApplication: void 0,
|
|
5814
5806
|
close: async () => {
|
|
5815
5807
|
if (typeof window === "undefined")
|
|
5816
5808
|
return;
|
package/dist/interpreter.d.ts
CHANGED
|
@@ -35,8 +35,6 @@ type ChatbotInterpreterParams = {
|
|
|
35
35
|
flow: StartedFlow;
|
|
36
36
|
getSubmissions: () => KeyToSubmissionMap | undefined;
|
|
37
37
|
chatService: ChatService;
|
|
38
|
-
/** When interpreter starts */
|
|
39
|
-
beforeStart?: (firstNode: FlowNode) => Promise<void>;
|
|
40
38
|
/** When flow has no more nodes to interpret */
|
|
41
39
|
onFlowEnd?: (lastNode: FlowNode) => void;
|
|
42
40
|
/** When node is interpreted */
|
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.23.
|
|
3
|
+
"version": "3.23.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/plugin-chatbot.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"vite-tsconfig-paths": "^4.2.1",
|
|
69
69
|
"@inploi/core": "1.14.2",
|
|
70
70
|
"@inploi/design-tokens": "0.2.1",
|
|
71
|
-
"@inploi/sdk": "1.14.
|
|
71
|
+
"@inploi/sdk": "1.14.4",
|
|
72
72
|
"eslint-config-custom": "0.1.0",
|
|
73
73
|
"tsconfig": "0.1.0"
|
|
74
74
|
},
|