@botonic/react 0.42.0-alpha.4 → 0.42.1-campaigns.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/lib/cjs/components/system-debug-trace/events/conditional-queue-status.d.ts +1 -0
- package/lib/cjs/components/system-debug-trace/events/conditional-queue-status.js +12 -7
- package/lib/cjs/components/system-debug-trace/events/conditional-queue-status.js.map +1 -1
- package/lib/cjs/components/system-debug-trace/events/constants.d.ts +6 -0
- package/lib/cjs/components/system-debug-trace/events/constants.js +6 -0
- package/lib/cjs/components/system-debug-trace/events/constants.js.map +1 -1
- package/lib/cjs/components/whatsapp-template.d.ts +9 -1
- package/lib/cjs/components/whatsapp-template.js +9 -9
- package/lib/cjs/components/whatsapp-template.js.map +1 -1
- package/lib/esm/components/system-debug-trace/events/conditional-queue-status.d.ts +1 -0
- package/lib/esm/components/system-debug-trace/events/conditional-queue-status.js +11 -7
- package/lib/esm/components/system-debug-trace/events/conditional-queue-status.js.map +1 -1
- package/lib/esm/components/system-debug-trace/events/constants.d.ts +6 -0
- package/lib/esm/components/system-debug-trace/events/constants.js +6 -0
- package/lib/esm/components/system-debug-trace/events/constants.js.map +1 -1
- package/lib/esm/components/whatsapp-template.d.ts +9 -1
- package/lib/esm/components/whatsapp-template.js +7 -6
- package/lib/esm/components/whatsapp-template.js.map +1 -1
- package/package.json +4 -5
- package/src/components/system-debug-trace/events/conditional-queue-status.tsx +33 -10
- package/src/components/system-debug-trace/events/constants.ts +6 -0
- package/src/components/{whatsapp-template.jsx → whatsapp-template.tsx} +17 -4
|
@@ -7,4 +7,5 @@ export interface ConditionalQueueStatusDebugEvent {
|
|
|
7
7
|
is_queue_open: boolean;
|
|
8
8
|
is_available_agent: boolean;
|
|
9
9
|
}
|
|
10
|
+
export declare const ConditionalQueueStatus: (props: ConditionalQueueStatusDebugEvent) => import("react/jsx-runtime").JSX.Element;
|
|
10
11
|
export declare const getConditionalQueueStatusEventConfig: (data: ConditionalQueueStatusDebugEvent) => DebugEventConfig;
|
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getConditionalQueueStatusEventConfig = void 0;
|
|
3
|
+
exports.getConditionalQueueStatusEventConfig = exports.ConditionalQueueStatus = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const core_1 = require("@botonic/core");
|
|
6
6
|
const split_1 = require("../icons/split");
|
|
7
|
+
const styles_1 = require("../styles");
|
|
8
|
+
const constants_1 = require("./constants");
|
|
9
|
+
const ConditionalQueueStatus = (props) => {
|
|
10
|
+
const queueStatus = props.is_queue_open ? constants_1.LABELS.OPEN : constants_1.LABELS.CLOSED;
|
|
11
|
+
const agentStatus = props.is_available_agent ? constants_1.LABELS.YES : constants_1.LABELS.NO;
|
|
12
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(styles_1.StyledDebugDetail, { children: [(0, jsx_runtime_1.jsx)(styles_1.StyledDebugLabel, { children: constants_1.LABELS.QUEUE }), (0, jsx_runtime_1.jsx)(styles_1.StyledDebugValue, { children: props.queue_name })] }), (0, jsx_runtime_1.jsxs)(styles_1.StyledDebugDetail, { children: [(0, jsx_runtime_1.jsx)(styles_1.StyledDebugLabel, { children: constants_1.LABELS.STATUS }), (0, jsx_runtime_1.jsx)(styles_1.StyledDebugValue, { children: queueStatus })] }), (0, jsx_runtime_1.jsxs)(styles_1.StyledDebugDetail, { children: [(0, jsx_runtime_1.jsx)(styles_1.StyledDebugLabel, { children: constants_1.LABELS.AGENTS_AVAILABLE }), (0, jsx_runtime_1.jsx)(styles_1.StyledDebugValue, { children: agentStatus })] })] }));
|
|
13
|
+
};
|
|
14
|
+
exports.ConditionalQueueStatus = ConditionalQueueStatus;
|
|
7
15
|
const getConditionalQueueStatusEventConfig = (data) => {
|
|
8
|
-
const
|
|
9
|
-
const agentStatus = data.is_available_agent ? 'Available' : 'Unavailable';
|
|
10
|
-
const statusText = `${queueStatus}${queueStatus === 'Open' ? ` (Agent ${agentStatus})` : ''}`;
|
|
11
|
-
const title = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Queue status checked", ' ', (0, jsx_runtime_1.jsxs)("span", { children: ["- ", statusText, " ( Queue: ", data.queue_name, ")"] })] }));
|
|
16
|
+
const title = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Queue status checked ", (0, jsx_runtime_1.jsxs)("span", { children: ["- ", data.queue_name] })] }));
|
|
12
17
|
return {
|
|
13
18
|
action: core_1.EventAction.ConditionalQueueStatus,
|
|
14
19
|
title,
|
|
15
|
-
component:
|
|
20
|
+
component: exports.ConditionalQueueStatus,
|
|
16
21
|
icon: (0, jsx_runtime_1.jsx)(split_1.SplitSvg, {}),
|
|
17
|
-
collapsible:
|
|
22
|
+
collapsible: true,
|
|
18
23
|
};
|
|
19
24
|
};
|
|
20
25
|
exports.getConditionalQueueStatusEventConfig = getConditionalQueueStatusEventConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conditional-queue-status.js","sourceRoot":"","sources":["../../../../../src/components/system-debug-trace/events/conditional-queue-status.tsx"],"names":[],"mappings":";;;;AAAA,wCAA2C;AAG3C,0CAAyC;
|
|
1
|
+
{"version":3,"file":"conditional-queue-status.js","sourceRoot":"","sources":["../../../../../src/components/system-debug-trace/events/conditional-queue-status.tsx"],"names":[],"mappings":";;;;AAAA,wCAA2C;AAG3C,0CAAyC;AACzC,sCAIkB;AAElB,2CAAoC;AAU7B,MAAM,sBAAsB,GAAG,CACpC,KAAuC,EACvC,EAAE;IACF,MAAM,WAAW,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,kBAAM,CAAC,IAAI,CAAC,CAAC,CAAC,kBAAM,CAAC,MAAM,CAAA;IACrE,MAAM,WAAW,GAAG,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC,kBAAM,CAAC,GAAG,CAAC,CAAC,CAAC,kBAAM,CAAC,EAAE,CAAA;IAErE,OAAO,CACL,6DACE,wBAAC,0BAAiB,eAChB,uBAAC,yBAAgB,cAAE,kBAAM,CAAC,KAAK,GAAoB,EACnD,uBAAC,yBAAgB,cAAE,KAAK,CAAC,UAAU,GAAoB,IACrC,EACpB,wBAAC,0BAAiB,eAChB,uBAAC,yBAAgB,cAAE,kBAAM,CAAC,MAAM,GAAoB,EACpD,uBAAC,yBAAgB,cAAE,WAAW,GAAoB,IAChC,EACpB,wBAAC,0BAAiB,eAChB,uBAAC,yBAAgB,cAAE,kBAAM,CAAC,gBAAgB,GAAoB,EAC9D,uBAAC,yBAAgB,cAAE,WAAW,GAAoB,IAChC,IACnB,CACJ,CAAA;AACH,CAAC,CAAA;AAtBY,QAAA,sBAAsB,0BAsBlC;AAEM,MAAM,oCAAoC,GAAG,CAClD,IAAsC,EACpB,EAAE;IACpB,MAAM,KAAK,GAAG,CACZ,sFACuB,mDAAS,IAAI,CAAC,UAAU,IAAQ,IACpD,CACJ,CAAA;IAED,OAAO;QACL,MAAM,EAAE,kBAAW,CAAC,sBAAsB;QAC1C,KAAK;QACL,SAAS,EAAE,8BAAsB;QACjC,IAAI,EAAE,uBAAC,gBAAQ,KAAG;QAClB,WAAW,EAAE,IAAI;KAClB,CAAA;AACH,CAAC,CAAA;AAhBY,QAAA,oCAAoC,wCAgBhD"}
|
|
@@ -16,4 +16,10 @@ export declare const LABELS: {
|
|
|
16
16
|
readonly NOTE: "Note";
|
|
17
17
|
readonly KNOWLEDGE_BASE_FAIL_REASON: "Knowledge Base Fail Reason";
|
|
18
18
|
readonly SEE_CHUNKS_BUTTON: "See chunks";
|
|
19
|
+
readonly STATUS: "Status";
|
|
20
|
+
readonly YES: "Yes";
|
|
21
|
+
readonly NO: "No";
|
|
22
|
+
readonly OPEN: "Open";
|
|
23
|
+
readonly CLOSED: "Closed";
|
|
24
|
+
readonly AGENTS_AVAILABLE: "Agents available";
|
|
19
25
|
};
|
|
@@ -19,5 +19,11 @@ exports.LABELS = {
|
|
|
19
19
|
NOTE: 'Note',
|
|
20
20
|
KNOWLEDGE_BASE_FAIL_REASON: 'Knowledge Base Fail Reason',
|
|
21
21
|
SEE_CHUNKS_BUTTON: 'See chunks',
|
|
22
|
+
STATUS: 'Status',
|
|
23
|
+
YES: 'Yes',
|
|
24
|
+
NO: 'No',
|
|
25
|
+
OPEN: 'Open',
|
|
26
|
+
CLOSED: 'Closed',
|
|
27
|
+
AGENTS_AVAILABLE: 'Agents available',
|
|
22
28
|
};
|
|
23
29
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/components/system-debug-trace/events/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,MAAM,GAAG;IACpB,mBAAmB,EAAE,qBAAqB;IAC1C,eAAe,EAAE,iBAAiB;IAClC,eAAe,EAAE,iBAAiB;IAClC,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;IAClB,kBAAkB,EAAE,oBAAoB;IACxC,cAAc,EAAE,gBAAgB;IAChC,iBAAiB,EAAE,mBAAmB;IACtC,cAAc,EAAE,IAAI;IACpB,eAAe,EAAE,KAAK;IACtB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,aAAa;IAC1B,IAAI,EAAE,MAAM;IACZ,0BAA0B,EAAE,4BAA4B;IACxD,iBAAiB,EAAE,YAAY;
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/components/system-debug-trace/events/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,MAAM,GAAG;IACpB,mBAAmB,EAAE,qBAAqB;IAC1C,eAAe,EAAE,iBAAiB;IAClC,eAAe,EAAE,iBAAiB;IAClC,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;IAClB,kBAAkB,EAAE,oBAAoB;IACxC,cAAc,EAAE,gBAAgB;IAChC,iBAAiB,EAAE,mBAAmB;IACtC,cAAc,EAAE,IAAI;IACpB,eAAe,EAAE,KAAK;IACtB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,aAAa;IAC1B,IAAI,EAAE,MAAM;IACZ,0BAA0B,EAAE,4BAA4B;IACxD,iBAAiB,EAAE,YAAY;IAC/B,MAAM,EAAE,QAAQ;IAChB,GAAG,EAAE,KAAK;IACV,EAAE,EAAE,IAAI;IACR,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAAQ;IAChB,gBAAgB,EAAE,kBAAkB;CAC5B,CAAA"}
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
export
|
|
1
|
+
export interface WhatsappTemplateProps {
|
|
2
|
+
name: string;
|
|
3
|
+
language: string;
|
|
4
|
+
namespace?: string;
|
|
5
|
+
header?: Record<string, any>;
|
|
6
|
+
body?: Record<string, any>;
|
|
7
|
+
footer?: Record<string, any>;
|
|
8
|
+
}
|
|
9
|
+
export declare const WhatsappTemplate: (props: WhatsappTemplateProps) => any;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WhatsappTemplate = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
5
|
const core_1 = require("@botonic/core");
|
|
7
|
-
const react_1 =
|
|
8
|
-
const react_2 = require("../util/react");
|
|
6
|
+
const react_1 = require("../util/react");
|
|
9
7
|
const message_1 = require("./message");
|
|
10
|
-
const serialize =
|
|
11
|
-
return { text:
|
|
8
|
+
const serialize = (message) => {
|
|
9
|
+
return { text: message };
|
|
12
10
|
};
|
|
13
|
-
const WhatsappTemplate = props => {
|
|
11
|
+
const WhatsappTemplate = (props) => {
|
|
14
12
|
const renderBrowser = () => {
|
|
15
13
|
// Return a dummy message for browser
|
|
16
|
-
const message = `Template ${props.name} with namespace ${props.namespace} would be sent to the user.`;
|
|
14
|
+
const message = `Template ${props.name} with language ${props.language} and namespace ${props.namespace} would be sent to the user.`;
|
|
17
15
|
return ((0, jsx_runtime_1.jsx)(message_1.Message, Object.assign({ json: serialize(message) }, props, { type: core_1.INPUT.TEXT }, { children: message })));
|
|
18
16
|
};
|
|
19
17
|
const renderNode = () => {
|
|
20
|
-
return (
|
|
18
|
+
return (
|
|
19
|
+
// @ts-ignore Property 'message' does not exist on type 'JSX.IntrinsicElements'.
|
|
20
|
+
(0, jsx_runtime_1.jsx)("message", Object.assign({}, props, { name: props.name, language: props.language, namespace: props.namespace, header: props.header && JSON.stringify(props.header), body: props.body && JSON.stringify(props.body), footer: props.footer && JSON.stringify(props.footer), type: core_1.INPUT.WHATSAPP_TEMPLATE })));
|
|
21
21
|
};
|
|
22
|
-
return (0,
|
|
22
|
+
return (0, react_1.renderComponent)({ renderBrowser, renderNode });
|
|
23
23
|
};
|
|
24
24
|
exports.WhatsappTemplate = WhatsappTemplate;
|
|
25
25
|
//# sourceMappingURL=whatsapp-template.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"whatsapp-template.js","sourceRoot":"","sources":["../../../src/components/whatsapp-template.
|
|
1
|
+
{"version":3,"file":"whatsapp-template.js","sourceRoot":"","sources":["../../../src/components/whatsapp-template.tsx"],"names":[],"mappings":";;;;AAAA,wCAAqC;AAGrC,yCAA+C;AAC/C,uCAAmC;AAEnC,MAAM,SAAS,GAAG,CAAC,OAAe,EAAE,EAAE;IACpC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAA;AAC1B,CAAC,CAAA;AAWM,MAAM,gBAAgB,GAAG,CAAC,KAA4B,EAAE,EAAE;IAC/D,MAAM,aAAa,GAAG,GAAG,EAAE;QACzB,qCAAqC;QACrC,MAAM,OAAO,GAAG,YAAY,KAAK,CAAC,IAAI,kBAAkB,KAAK,CAAC,QAAQ,kBAAkB,KAAK,CAAC,SAAS,6BAA6B,CAAA;QACpI,OAAO,CACL,uBAAC,iBAAO,kBAAC,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,IAAM,KAAK,IAAE,IAAI,EAAE,YAAK,CAAC,IAAI,gBAC3D,OAAO,IACA,CACX,CAAA;IACH,CAAC,CAAA;IAED,MAAM,UAAU,GAAG,GAAG,EAAE;QACtB,OAAO;QACL,gFAAgF;QAChF,oDACM,KAAK,IACT,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,EACpD,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,EAC9C,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,EACpD,IAAI,EAAE,YAAK,CAAC,iBAAiB,IAC7B,CACH,CAAA;IACH,CAAC,CAAA;IAED,OAAO,IAAA,uBAAe,EAAC,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC,CAAA;AACvD,CAAC,CAAA;AA5BY,QAAA,gBAAgB,oBA4B5B"}
|
|
@@ -7,4 +7,5 @@ export interface ConditionalQueueStatusDebugEvent {
|
|
|
7
7
|
is_queue_open: boolean;
|
|
8
8
|
is_available_agent: boolean;
|
|
9
9
|
}
|
|
10
|
+
export declare const ConditionalQueueStatus: (props: ConditionalQueueStatusDebugEvent) => import("react/jsx-runtime").JSX.Element;
|
|
10
11
|
export declare const getConditionalQueueStatusEventConfig: (data: ConditionalQueueStatusDebugEvent) => DebugEventConfig;
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { EventAction } from '@botonic/core';
|
|
3
3
|
import { SplitSvg } from '../icons/split';
|
|
4
|
+
import { StyledDebugDetail, StyledDebugLabel, StyledDebugValue, } from '../styles';
|
|
5
|
+
import { LABELS } from './constants';
|
|
6
|
+
export const ConditionalQueueStatus = (props) => {
|
|
7
|
+
const queueStatus = props.is_queue_open ? LABELS.OPEN : LABELS.CLOSED;
|
|
8
|
+
const agentStatus = props.is_available_agent ? LABELS.YES : LABELS.NO;
|
|
9
|
+
return (_jsxs(_Fragment, { children: [_jsxs(StyledDebugDetail, { children: [_jsx(StyledDebugLabel, { children: LABELS.QUEUE }), _jsx(StyledDebugValue, { children: props.queue_name })] }), _jsxs(StyledDebugDetail, { children: [_jsx(StyledDebugLabel, { children: LABELS.STATUS }), _jsx(StyledDebugValue, { children: queueStatus })] }), _jsxs(StyledDebugDetail, { children: [_jsx(StyledDebugLabel, { children: LABELS.AGENTS_AVAILABLE }), _jsx(StyledDebugValue, { children: agentStatus })] })] }));
|
|
10
|
+
};
|
|
4
11
|
export const getConditionalQueueStatusEventConfig = (data) => {
|
|
5
|
-
const
|
|
6
|
-
const agentStatus = data.is_available_agent ? 'Available' : 'Unavailable';
|
|
7
|
-
const statusText = `${queueStatus}${queueStatus === 'Open' ? ` (Agent ${agentStatus})` : ''}`;
|
|
8
|
-
const title = (_jsxs(_Fragment, { children: ["Queue status checked", ' ', _jsxs("span", { children: ["- ", statusText, " ( Queue: ", data.queue_name, ")"] })] }));
|
|
12
|
+
const title = (_jsxs(_Fragment, { children: ["Queue status checked ", _jsxs("span", { children: ["- ", data.queue_name] })] }));
|
|
9
13
|
return {
|
|
10
14
|
action: EventAction.ConditionalQueueStatus,
|
|
11
15
|
title,
|
|
12
|
-
component:
|
|
16
|
+
component: ConditionalQueueStatus,
|
|
13
17
|
icon: _jsx(SplitSvg, {}),
|
|
14
|
-
collapsible:
|
|
18
|
+
collapsible: true,
|
|
15
19
|
};
|
|
16
20
|
};
|
|
17
21
|
//# sourceMappingURL=conditional-queue-status.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conditional-queue-status.js","sourceRoot":"","sources":["../../../../../src/components/system-debug-trace/events/conditional-queue-status.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAG3C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"conditional-queue-status.js","sourceRoot":"","sources":["../../../../../src/components/system-debug-trace/events/conditional-queue-status.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAG3C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,WAAW,CAAA;AAElB,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAUpC,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,KAAuC,EACvC,EAAE;IACF,MAAM,WAAW,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAA;IACrE,MAAM,WAAW,GAAG,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAA;IAErE,OAAO,CACL,8BACE,MAAC,iBAAiB,eAChB,KAAC,gBAAgB,cAAE,MAAM,CAAC,KAAK,GAAoB,EACnD,KAAC,gBAAgB,cAAE,KAAK,CAAC,UAAU,GAAoB,IACrC,EACpB,MAAC,iBAAiB,eAChB,KAAC,gBAAgB,cAAE,MAAM,CAAC,MAAM,GAAoB,EACpD,KAAC,gBAAgB,cAAE,WAAW,GAAoB,IAChC,EACpB,MAAC,iBAAiB,eAChB,KAAC,gBAAgB,cAAE,MAAM,CAAC,gBAAgB,GAAoB,EAC9D,KAAC,gBAAgB,cAAE,WAAW,GAAoB,IAChC,IACnB,CACJ,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAClD,IAAsC,EACpB,EAAE;IACpB,MAAM,KAAK,GAAG,CACZ,uDACuB,iCAAS,IAAI,CAAC,UAAU,IAAQ,IACpD,CACJ,CAAA;IAED,OAAO;QACL,MAAM,EAAE,WAAW,CAAC,sBAAsB;QAC1C,KAAK;QACL,SAAS,EAAE,sBAAsB;QACjC,IAAI,EAAE,KAAC,QAAQ,KAAG;QAClB,WAAW,EAAE,IAAI;KAClB,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -16,4 +16,10 @@ export declare const LABELS: {
|
|
|
16
16
|
readonly NOTE: "Note";
|
|
17
17
|
readonly KNOWLEDGE_BASE_FAIL_REASON: "Knowledge Base Fail Reason";
|
|
18
18
|
readonly SEE_CHUNKS_BUTTON: "See chunks";
|
|
19
|
+
readonly STATUS: "Status";
|
|
20
|
+
readonly YES: "Yes";
|
|
21
|
+
readonly NO: "No";
|
|
22
|
+
readonly OPEN: "Open";
|
|
23
|
+
readonly CLOSED: "Closed";
|
|
24
|
+
readonly AGENTS_AVAILABLE: "Agents available";
|
|
19
25
|
};
|
|
@@ -16,5 +16,11 @@ export const LABELS = {
|
|
|
16
16
|
NOTE: 'Note',
|
|
17
17
|
KNOWLEDGE_BASE_FAIL_REASON: 'Knowledge Base Fail Reason',
|
|
18
18
|
SEE_CHUNKS_BUTTON: 'See chunks',
|
|
19
|
+
STATUS: 'Status',
|
|
20
|
+
YES: 'Yes',
|
|
21
|
+
NO: 'No',
|
|
22
|
+
OPEN: 'Open',
|
|
23
|
+
CLOSED: 'Closed',
|
|
24
|
+
AGENTS_AVAILABLE: 'Agents available',
|
|
19
25
|
};
|
|
20
26
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/components/system-debug-trace/events/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,mBAAmB,EAAE,qBAAqB;IAC1C,eAAe,EAAE,iBAAiB;IAClC,eAAe,EAAE,iBAAiB;IAClC,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;IAClB,kBAAkB,EAAE,oBAAoB;IACxC,cAAc,EAAE,gBAAgB;IAChC,iBAAiB,EAAE,mBAAmB;IACtC,cAAc,EAAE,IAAI;IACpB,eAAe,EAAE,KAAK;IACtB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,aAAa;IAC1B,IAAI,EAAE,MAAM;IACZ,0BAA0B,EAAE,4BAA4B;IACxD,iBAAiB,EAAE,YAAY;
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/components/system-debug-trace/events/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,mBAAmB,EAAE,qBAAqB;IAC1C,eAAe,EAAE,iBAAiB;IAClC,eAAe,EAAE,iBAAiB;IAClC,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;IAClB,kBAAkB,EAAE,oBAAoB;IACxC,cAAc,EAAE,gBAAgB;IAChC,iBAAiB,EAAE,mBAAmB;IACtC,cAAc,EAAE,IAAI;IACpB,eAAe,EAAE,KAAK;IACtB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,aAAa;IAC1B,IAAI,EAAE,MAAM;IACZ,0BAA0B,EAAE,4BAA4B;IACxD,iBAAiB,EAAE,YAAY;IAC/B,MAAM,EAAE,QAAQ;IAChB,GAAG,EAAE,KAAK;IACV,EAAE,EAAE,IAAI;IACR,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAAQ;IAChB,gBAAgB,EAAE,kBAAkB;CAC5B,CAAA"}
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
export
|
|
1
|
+
export interface WhatsappTemplateProps {
|
|
2
|
+
name: string;
|
|
3
|
+
language: string;
|
|
4
|
+
namespace?: string;
|
|
5
|
+
header?: Record<string, any>;
|
|
6
|
+
body?: Record<string, any>;
|
|
7
|
+
footer?: Record<string, any>;
|
|
8
|
+
}
|
|
9
|
+
export declare const WhatsappTemplate: (props: WhatsappTemplateProps) => any;
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { INPUT } from '@botonic/core';
|
|
3
|
-
import React from 'react';
|
|
4
3
|
import { renderComponent } from '../util/react';
|
|
5
4
|
import { Message } from './message';
|
|
6
|
-
const serialize =
|
|
7
|
-
return { text:
|
|
5
|
+
const serialize = (message) => {
|
|
6
|
+
return { text: message };
|
|
8
7
|
};
|
|
9
|
-
export const WhatsappTemplate = props => {
|
|
8
|
+
export const WhatsappTemplate = (props) => {
|
|
10
9
|
const renderBrowser = () => {
|
|
11
10
|
// Return a dummy message for browser
|
|
12
|
-
const message = `Template ${props.name} with namespace ${props.namespace} would be sent to the user.`;
|
|
11
|
+
const message = `Template ${props.name} with language ${props.language} and namespace ${props.namespace} would be sent to the user.`;
|
|
13
12
|
return (_jsx(Message, Object.assign({ json: serialize(message) }, props, { type: INPUT.TEXT }, { children: message })));
|
|
14
13
|
};
|
|
15
14
|
const renderNode = () => {
|
|
16
|
-
return (
|
|
15
|
+
return (
|
|
16
|
+
// @ts-ignore Property 'message' does not exist on type 'JSX.IntrinsicElements'.
|
|
17
|
+
_jsx("message", Object.assign({}, props, { name: props.name, language: props.language, namespace: props.namespace, header: props.header && JSON.stringify(props.header), body: props.body && JSON.stringify(props.body), footer: props.footer && JSON.stringify(props.footer), type: INPUT.WHATSAPP_TEMPLATE })));
|
|
17
18
|
};
|
|
18
19
|
return renderComponent({ renderBrowser, renderNode });
|
|
19
20
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"whatsapp-template.js","sourceRoot":"","sources":["../../../src/components/whatsapp-template.
|
|
1
|
+
{"version":3,"file":"whatsapp-template.js","sourceRoot":"","sources":["../../../src/components/whatsapp-template.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAGrC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,MAAM,SAAS,GAAG,CAAC,OAAe,EAAE,EAAE;IACpC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAA;AAC1B,CAAC,CAAA;AAWD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAA4B,EAAE,EAAE;IAC/D,MAAM,aAAa,GAAG,GAAG,EAAE;QACzB,qCAAqC;QACrC,MAAM,OAAO,GAAG,YAAY,KAAK,CAAC,IAAI,kBAAkB,KAAK,CAAC,QAAQ,kBAAkB,KAAK,CAAC,SAAS,6BAA6B,CAAA;QACpI,OAAO,CACL,KAAC,OAAO,kBAAC,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,IAAM,KAAK,IAAE,IAAI,EAAE,KAAK,CAAC,IAAI,gBAC3D,OAAO,IACA,CACX,CAAA;IACH,CAAC,CAAA;IAED,MAAM,UAAU,GAAG,GAAG,EAAE;QACtB,OAAO;QACL,gFAAgF;QAChF,kCACM,KAAK,IACT,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,EACpD,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,EAC9C,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,EACpD,IAAI,EAAE,KAAK,CAAC,iBAAiB,IAC7B,CACH,CAAA;IACH,CAAC,CAAA;IAED,OAAO,eAAe,CAAC,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC,CAAA;AACvD,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botonic/react",
|
|
3
|
-
"version": "0.42.
|
|
3
|
+
"version": "0.42.1-campaigns.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Build Chatbots using React",
|
|
6
6
|
"main": "./lib/cjs",
|
|
@@ -11,8 +11,7 @@
|
|
|
11
11
|
"test": "../../node_modules/.bin/jest -c ./jest.config.js --coverage",
|
|
12
12
|
"updateSnapshot": "../../node_modules/.bin/jest -c ./jest.config.js --updateSnapshot",
|
|
13
13
|
"cloc": "../../scripts/qa/cloc-package.sh .",
|
|
14
|
-
"prepublishOnly": "
|
|
15
|
-
"clean": "rm -rf ./lib/",
|
|
14
|
+
"prepublishOnly": "rm -rf lib && npm i && npm run build && npm run copy-files;",
|
|
16
15
|
"copy-files": "copyfiles -u 1 src/**/*.svg src/**/*.png src/**/*.scss src/**/*.html lib/esm/; copyfiles -u 1 src/**/*.svg src/**/*.png src/**/*.scss src/**/*.html lib/cjs/;",
|
|
17
16
|
"build": "../../node_modules/.bin/tsc -p tsconfig.json && ../../node_modules/.bin/tsc -p tsconfig.esm.json",
|
|
18
17
|
"build:watch": "npm run build -- --watch",
|
|
@@ -21,7 +20,7 @@
|
|
|
21
20
|
"lint_core": "../../node_modules/.bin/eslint_d --cache --quiet '.*.js' '*.js' 'src/**/*.js*' --fix"
|
|
22
21
|
},
|
|
23
22
|
"dependencies": {
|
|
24
|
-
"@botonic/core": "0.42.0
|
|
23
|
+
"@botonic/core": "^0.42.0",
|
|
25
24
|
"axios": "^1.12.2",
|
|
26
25
|
"emoji-picker-react": "^4.12.0",
|
|
27
26
|
"lodash.merge": "^4.6.2",
|
|
@@ -81,4 +80,4 @@
|
|
|
81
80
|
"javascript",
|
|
82
81
|
"react"
|
|
83
82
|
]
|
|
84
|
-
}
|
|
83
|
+
}
|
|
@@ -2,7 +2,13 @@ import { EventAction } from '@botonic/core'
|
|
|
2
2
|
import React from 'react'
|
|
3
3
|
|
|
4
4
|
import { SplitSvg } from '../icons/split'
|
|
5
|
+
import {
|
|
6
|
+
StyledDebugDetail,
|
|
7
|
+
StyledDebugLabel,
|
|
8
|
+
StyledDebugValue,
|
|
9
|
+
} from '../styles'
|
|
5
10
|
import { DebugEventConfig } from '../types'
|
|
11
|
+
import { LABELS } from './constants'
|
|
6
12
|
|
|
7
13
|
export interface ConditionalQueueStatusDebugEvent {
|
|
8
14
|
action: EventAction.ConditionalQueueStatus
|
|
@@ -12,27 +18,44 @@ export interface ConditionalQueueStatusDebugEvent {
|
|
|
12
18
|
is_available_agent: boolean
|
|
13
19
|
}
|
|
14
20
|
|
|
21
|
+
export const ConditionalQueueStatus = (
|
|
22
|
+
props: ConditionalQueueStatusDebugEvent
|
|
23
|
+
) => {
|
|
24
|
+
const queueStatus = props.is_queue_open ? LABELS.OPEN : LABELS.CLOSED
|
|
25
|
+
const agentStatus = props.is_available_agent ? LABELS.YES : LABELS.NO
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<>
|
|
29
|
+
<StyledDebugDetail>
|
|
30
|
+
<StyledDebugLabel>{LABELS.QUEUE}</StyledDebugLabel>
|
|
31
|
+
<StyledDebugValue>{props.queue_name}</StyledDebugValue>
|
|
32
|
+
</StyledDebugDetail>
|
|
33
|
+
<StyledDebugDetail>
|
|
34
|
+
<StyledDebugLabel>{LABELS.STATUS}</StyledDebugLabel>
|
|
35
|
+
<StyledDebugValue>{queueStatus}</StyledDebugValue>
|
|
36
|
+
</StyledDebugDetail>
|
|
37
|
+
<StyledDebugDetail>
|
|
38
|
+
<StyledDebugLabel>{LABELS.AGENTS_AVAILABLE}</StyledDebugLabel>
|
|
39
|
+
<StyledDebugValue>{agentStatus}</StyledDebugValue>
|
|
40
|
+
</StyledDebugDetail>
|
|
41
|
+
</>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
|
|
15
45
|
export const getConditionalQueueStatusEventConfig = (
|
|
16
46
|
data: ConditionalQueueStatusDebugEvent
|
|
17
47
|
): DebugEventConfig => {
|
|
18
|
-
const queueStatus = data.is_queue_open ? 'Open' : 'Closed'
|
|
19
|
-
const agentStatus = data.is_available_agent ? 'Available' : 'Unavailable'
|
|
20
|
-
const statusText = `${queueStatus}${queueStatus === 'Open' ? ` (Agent ${agentStatus})` : ''}`
|
|
21
|
-
|
|
22
48
|
const title = (
|
|
23
49
|
<>
|
|
24
|
-
Queue status checked{
|
|
25
|
-
<span>
|
|
26
|
-
- {statusText} ( Queue: {data.queue_name})
|
|
27
|
-
</span>
|
|
50
|
+
Queue status checked <span>- {data.queue_name}</span>
|
|
28
51
|
</>
|
|
29
52
|
)
|
|
30
53
|
|
|
31
54
|
return {
|
|
32
55
|
action: EventAction.ConditionalQueueStatus,
|
|
33
56
|
title,
|
|
34
|
-
component:
|
|
57
|
+
component: ConditionalQueueStatus,
|
|
35
58
|
icon: <SplitSvg />,
|
|
36
|
-
collapsible:
|
|
59
|
+
collapsible: true,
|
|
37
60
|
}
|
|
38
61
|
}
|
|
@@ -16,4 +16,10 @@ export const LABELS = {
|
|
|
16
16
|
NOTE: 'Note',
|
|
17
17
|
KNOWLEDGE_BASE_FAIL_REASON: 'Knowledge Base Fail Reason',
|
|
18
18
|
SEE_CHUNKS_BUTTON: 'See chunks',
|
|
19
|
+
STATUS: 'Status',
|
|
20
|
+
YES: 'Yes',
|
|
21
|
+
NO: 'No',
|
|
22
|
+
OPEN: 'Open',
|
|
23
|
+
CLOSED: 'Closed',
|
|
24
|
+
AGENTS_AVAILABLE: 'Agents available',
|
|
19
25
|
} as const
|
|
@@ -4,14 +4,23 @@ import React from 'react'
|
|
|
4
4
|
import { renderComponent } from '../util/react'
|
|
5
5
|
import { Message } from './message'
|
|
6
6
|
|
|
7
|
-
const serialize =
|
|
8
|
-
return { text:
|
|
7
|
+
const serialize = (message: string) => {
|
|
8
|
+
return { text: message }
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export
|
|
11
|
+
export interface WhatsappTemplateProps {
|
|
12
|
+
name: string
|
|
13
|
+
language: string
|
|
14
|
+
namespace?: string
|
|
15
|
+
header?: Record<string, any>
|
|
16
|
+
body?: Record<string, any>
|
|
17
|
+
footer?: Record<string, any>
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const WhatsappTemplate = (props: WhatsappTemplateProps) => {
|
|
12
21
|
const renderBrowser = () => {
|
|
13
22
|
// Return a dummy message for browser
|
|
14
|
-
const message = `Template ${props.name} with namespace ${props.namespace} would be sent to the user.`
|
|
23
|
+
const message = `Template ${props.name} with language ${props.language} and namespace ${props.namespace} would be sent to the user.`
|
|
15
24
|
return (
|
|
16
25
|
<Message json={serialize(message)} {...props} type={INPUT.TEXT}>
|
|
17
26
|
{message}
|
|
@@ -21,8 +30,12 @@ export const WhatsappTemplate = props => {
|
|
|
21
30
|
|
|
22
31
|
const renderNode = () => {
|
|
23
32
|
return (
|
|
33
|
+
// @ts-ignore Property 'message' does not exist on type 'JSX.IntrinsicElements'.
|
|
24
34
|
<message
|
|
25
35
|
{...props}
|
|
36
|
+
name={props.name}
|
|
37
|
+
language={props.language}
|
|
38
|
+
namespace={props.namespace}
|
|
26
39
|
header={props.header && JSON.stringify(props.header)}
|
|
27
40
|
body={props.body && JSON.stringify(props.body)}
|
|
28
41
|
footer={props.footer && JSON.stringify(props.footer)}
|