@bigbinary/neeto-message-templates-frontend 0.0.8 → 0.0.9

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/README.md CHANGED
@@ -78,6 +78,8 @@ yarn add @bigbinary/neeto-message-templates-frontend
78
78
 
79
79
  - `type`: Type can be `email`, `sms` or `whatsapp`.
80
80
 
81
+ - `templateVariables`: (optional) To add dynamic variables to form body field.
82
+
81
83
  ### Usage
82
84
 
83
85
  ```javascript
@@ -96,12 +98,20 @@ const App = () => {
96
98
  //api call
97
99
  };
98
100
 
101
+ const TEMPLATE_VARIABLES = [
102
+ {
103
+ key: "name",
104
+ label: "Name",
105
+ },
106
+ ];
107
+
99
108
  return (
100
109
  <MessageTemplates
101
110
  shouldIncludeTestTemplate
102
111
  breadcrumbs={breadcrumbs}
103
112
  handleSubmitTestTemplate={handleSubmit}
104
113
  isTestMessageLoading={isTestMessageLoading}
114
+ templateVariables={TEMPLATE_VARIABLES}
105
115
  type={type}
106
116
  />
107
117
  );
@@ -129,6 +139,8 @@ const App = () => {
129
139
  - `customFieldsValidationSchema`: (optional) To provide validation schema for
130
140
  the custom fields.
131
141
 
142
+ - `templateVariables`: (optional) To add dynamic variables to form body field.
143
+
132
144
  ### Usage
133
145
 
134
146
  ```js
package/dist/index.cjs.js CHANGED
@@ -5401,10 +5401,6 @@ var MESSAGE_TEMPLATES = {
5401
5401
  }
5402
5402
  };
5403
5403
  var DEFAULT_EDITOR_ROW_COUNT = 15;
5404
- var TEMPLATE_VARIABLES = [{
5405
- key: "name",
5406
- label: t$1("template.name")
5407
- }];
5408
5404
 
5409
5405
  var MESSAGE_TEMPLATE_INITIAL_STATE = {
5410
5406
  isOpen: false,
@@ -6099,7 +6095,8 @@ var Form$1 = function Form(_ref) {
6099
6095
  setInitialFocusField = _ref.setInitialFocusField,
6100
6096
  handleSubmitTestTemplate = _ref.handleSubmitTestTemplate,
6101
6097
  isTestMessageLoading = _ref.isTestMessageLoading,
6102
- shouldIncludeTestTemplate = _ref.shouldIncludeTestTemplate;
6098
+ shouldIncludeTestTemplate = _ref.shouldIncludeTestTemplate,
6099
+ templateVariables = _ref.templateVariables;
6103
6100
  var _useTranslation = useTranslation(),
6104
6101
  t = _useTranslation.t;
6105
6102
  var editorRef = React.useRef(null);
@@ -6161,7 +6158,7 @@ var Form$1 = function Form(_ref) {
6161
6158
  name: "body",
6162
6159
  ref: editorRef,
6163
6160
  rows: DEFAULT_EDITOR_ROW_COUNT,
6164
- variables: TEMPLATE_VARIABLES
6161
+ variables: templateVariables
6165
6162
  }), isTestTemplateVisible && /*#__PURE__*/React__default["default"].createElement(TestMessage, {
6166
6163
  handleSubmitTestTemplate: handleSubmitTestTemplate,
6167
6164
  isEmailTemplate: isEmailTemplate,
@@ -6190,7 +6187,8 @@ var AddEdit = function AddEdit(_ref) {
6190
6187
  handleSubmitTestTemplate = _ref.handleSubmitTestTemplate,
6191
6188
  shouldIncludeTestTemplate = _ref.shouldIncludeTestTemplate,
6192
6189
  addText = _ref.addText,
6193
- editText = _ref.editText;
6190
+ editText = _ref.editText,
6191
+ templateVariables = _ref.templateVariables;
6194
6192
  var initialFocusField = React.useRef();
6195
6193
  var setInitialFocusField = function setInitialFocusField(fieldRef) {
6196
6194
  return initialFocusField.current = fieldRef;
@@ -6214,6 +6212,7 @@ var AddEdit = function AddEdit(_ref) {
6214
6212
  setInitialFocusField: setInitialFocusField,
6215
6213
  shouldIncludeTestTemplate: shouldIncludeTestTemplate,
6216
6214
  template: template,
6215
+ templateVariables: templateVariables,
6217
6216
  onClose: onClose
6218
6217
  })));
6219
6218
  };
@@ -6379,7 +6378,9 @@ var MessageTemplates = function MessageTemplates(_ref) {
6379
6378
  _ref$isTestMessageLoa = _ref.isTestMessageLoading,
6380
6379
  isTestMessageLoading = _ref$isTestMessageLoa === void 0 ? false : _ref$isTestMessageLoa,
6381
6380
  _ref$shouldIncludeTes = _ref.shouldIncludeTestTemplate,
6382
- shouldIncludeTestTemplate = _ref$shouldIncludeTes === void 0 ? true : _ref$shouldIncludeTes;
6381
+ shouldIncludeTestTemplate = _ref$shouldIncludeTes === void 0 ? true : _ref$shouldIncludeTes,
6382
+ _ref$templateVariable = _ref.templateVariables,
6383
+ templateVariables = _ref$templateVariable === void 0 ? {} : _ref$templateVariable;
6383
6384
  var _useState = React.useState(MESSAGE_TEMPLATE_INITIAL_STATE),
6384
6385
  _useState2 = _slicedToArray(_useState, 2),
6385
6386
  manageTemplatePane = _useState2[0],
@@ -6466,6 +6467,7 @@ var MessageTemplates = function MessageTemplates(_ref) {
6466
6467
  isTestMessageLoading: isTestMessageLoading,
6467
6468
  manageTemplatePane: manageTemplatePane,
6468
6469
  shouldIncludeTestTemplate: shouldIncludeTestTemplate,
6470
+ templateVariables: templateVariables,
6469
6471
  onClose: function onClose() {
6470
6472
  return setManageTemplatePane(ramda.assoc("isOpen", false));
6471
6473
  }
@@ -6500,6 +6502,7 @@ var Form = function Form(_ref) {
6500
6502
  templates = _ref.templates,
6501
6503
  handleSubmit = _ref.handleSubmit,
6502
6504
  setInitialFocusField = _ref.setInitialFocusField,
6505
+ templateVariables = _ref.templateVariables,
6503
6506
  customFields = _ref.customFields,
6504
6507
  customFieldsInitialValues = _ref.customFieldsInitialValues,
6505
6508
  customFieldsValidationSchema = _ref.customFieldsValidationSchema;
@@ -6565,7 +6568,7 @@ var Form = function Form(_ref) {
6565
6568
  name: "body",
6566
6569
  ref: editorRef,
6567
6570
  rows: DEFAULT_EDITOR_ROW_COUNT,
6568
- variables: TEMPLATE_VARIABLES
6571
+ variables: templateVariables
6569
6572
  }), /*#__PURE__*/React__default["default"].createElement(neetoui.Pane.Footer, {
6570
6573
  className: "absolute bottom-0 left-0 flex gap-x-2"
6571
6574
  }, /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
@@ -6596,7 +6599,9 @@ var SendMessagePane = function SendMessagePane(_ref) {
6596
6599
  _ref$customFieldsInit = _ref.customFieldsInitialValues,
6597
6600
  customFieldsInitialValues = _ref$customFieldsInit === void 0 ? {} : _ref$customFieldsInit,
6598
6601
  _ref$customFieldsVali = _ref.customFieldsValidationSchema,
6599
- customFieldsValidationSchema = _ref$customFieldsVali === void 0 ? {} : _ref$customFieldsVali;
6602
+ customFieldsValidationSchema = _ref$customFieldsVali === void 0 ? {} : _ref$customFieldsVali,
6603
+ _ref$templateVariable = _ref.templateVariables,
6604
+ templateVariables = _ref$templateVariable === void 0 ? {} : _ref$templateVariable;
6600
6605
  var _useTranslation = useTranslation(),
6601
6606
  t = _useTranslation.t;
6602
6607
  var initialFocusField = React.useRef();
@@ -6628,6 +6633,7 @@ var SendMessagePane = function SendMessagePane(_ref) {
6628
6633
  handleSubmit: handleSubmit,
6629
6634
  isEmailTemplate: isEmailTemplate,
6630
6635
  setInitialFocusField: setInitialFocusField,
6636
+ templateVariables: templateVariables,
6631
6637
  templates: templates,
6632
6638
  onClose: onClose
6633
6639
  })));