@botonic/react 0.42.0 → 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/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/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 +2 -3
- package/src/components/{whatsapp-template.jsx → whatsapp-template.tsx} +17 -4
|
@@ -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"}
|
|
@@ -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.0",
|
|
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",
|
|
@@ -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)}
|