@sparrowengg/integrations-templates-frontend 1.9.0 → 1.9.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.
Files changed (76) hide show
  1. package/dist/cjs/commons/components/draftModal.js +40 -0
  2. package/dist/cjs/commons/components/draftModal.js.map +1 -0
  3. package/dist/cjs/integration-template/components/dashboard.js +230 -133
  4. package/dist/cjs/integration-template/components/dashboard.js.map +1 -1
  5. package/dist/cjs/integration-template/index.js +28 -1
  6. package/dist/cjs/integration-template/index.js.map +1 -1
  7. package/dist/cjs/mapping/index.js +10 -5
  8. package/dist/cjs/mapping/index.js.map +1 -1
  9. package/dist/cjs/node_modules/@sparrowengg/twigs-react/dist/es/alert-dialog/alert-dialog.js +114 -0
  10. package/dist/cjs/node_modules/@sparrowengg/twigs-react/dist/es/alert-dialog/alert-dialog.js.map +1 -0
  11. package/dist/cjs/node_modules/@sparrowengg/twigs-react/dist/es/dialog/dialog.js +8 -2
  12. package/dist/cjs/node_modules/@sparrowengg/twigs-react/dist/es/dialog/dialog.js.map +1 -1
  13. package/dist/cjs/node_modules/@sparrowengg/twigs-react/dist/es/dialog/dialogs-manager/default-alert.js +119 -0
  14. package/dist/cjs/node_modules/@sparrowengg/twigs-react/dist/es/dialog/dialogs-manager/default-alert.js.map +1 -0
  15. package/dist/cjs/node_modules/@sparrowengg/twigs-react/dist/es/dialog/dialogs-manager/default-confirm.js +133 -0
  16. package/dist/cjs/node_modules/@sparrowengg/twigs-react/dist/es/dialog/dialogs-manager/default-confirm.js.map +1 -0
  17. package/dist/cjs/node_modules/@sparrowengg/twigs-react/dist/es/dialog/dialogs-manager/default-modal.js +117 -0
  18. package/dist/cjs/node_modules/@sparrowengg/twigs-react/dist/es/dialog/dialogs-manager/default-modal.js.map +1 -0
  19. package/dist/cjs/node_modules/@sparrowengg/twigs-react/dist/es/dialog/dialogs-manager/index.js +110 -0
  20. package/dist/cjs/node_modules/@sparrowengg/twigs-react/dist/es/dialog/dialogs-manager/index.js.map +1 -0
  21. package/dist/cjs/node_modules/@sparrowengg/twigs-react/dist/es/dialog/dialogs-manager/store.js +49 -0
  22. package/dist/cjs/node_modules/@sparrowengg/twigs-react/dist/es/dialog/dialogs-manager/store.js.map +1 -0
  23. package/dist/cjs/node_modules/@sparrowengg/twigs-react/dist/es/grid/grid.js +83 -0
  24. package/dist/cjs/node_modules/@sparrowengg/twigs-react/dist/es/grid/grid.js.map +1 -0
  25. package/dist/cjs/node_modules/@sparrowengg/twigs-react/dist/es/node_modules/@radix-ui/react-alert-dialog/dist/index.js +184 -0
  26. package/dist/cjs/node_modules/@sparrowengg/twigs-react/dist/es/node_modules/@radix-ui/react-alert-dialog/dist/index.js.map +1 -0
  27. package/dist/cjs/node_modules/@sparrowengg/twigs-react/dist/es/node_modules/@radix-ui/react-dialog/dist/index.js +4 -0
  28. package/dist/cjs/node_modules/@sparrowengg/twigs-react/dist/es/node_modules/@radix-ui/react-dialog/dist/index.js.map +1 -1
  29. package/dist/cjs/node_modules/@sparrowengg/twigs-react/dist/es/packages/react-icons/dist/es/icons/close.js +86 -0
  30. package/dist/cjs/node_modules/@sparrowengg/twigs-react/dist/es/packages/react-icons/dist/es/icons/close.js.map +1 -0
  31. package/dist/cjs/triggers/components/subcomponents.js +160 -25
  32. package/dist/cjs/triggers/components/subcomponents.js.map +1 -1
  33. package/dist/cjs/triggers/components/trigger.js +1 -0
  34. package/dist/cjs/triggers/components/trigger.js.map +1 -1
  35. package/dist/cjs/triggers/constants/index.js.map +1 -1
  36. package/dist/cjs/triggers/index.js +7 -12
  37. package/dist/cjs/triggers/index.js.map +1 -1
  38. package/dist/es/commons/components/draftModal.js +36 -0
  39. package/dist/es/commons/components/draftModal.js.map +1 -0
  40. package/dist/es/integration-template/components/dashboard.js +230 -133
  41. package/dist/es/integration-template/components/dashboard.js.map +1 -1
  42. package/dist/es/integration-template/index.js +28 -1
  43. package/dist/es/integration-template/index.js.map +1 -1
  44. package/dist/es/mapping/index.js +10 -5
  45. package/dist/es/mapping/index.js.map +1 -1
  46. package/dist/es/node_modules/@sparrowengg/twigs-react/dist/es/alert-dialog/alert-dialog.js +106 -0
  47. package/dist/es/node_modules/@sparrowengg/twigs-react/dist/es/alert-dialog/alert-dialog.js.map +1 -0
  48. package/dist/es/node_modules/@sparrowengg/twigs-react/dist/es/dialog/dialog.js +7 -4
  49. package/dist/es/node_modules/@sparrowengg/twigs-react/dist/es/dialog/dialog.js.map +1 -1
  50. package/dist/es/node_modules/@sparrowengg/twigs-react/dist/es/dialog/dialogs-manager/default-alert.js +117 -0
  51. package/dist/es/node_modules/@sparrowengg/twigs-react/dist/es/dialog/dialogs-manager/default-alert.js.map +1 -0
  52. package/dist/es/node_modules/@sparrowengg/twigs-react/dist/es/dialog/dialogs-manager/default-confirm.js +131 -0
  53. package/dist/es/node_modules/@sparrowengg/twigs-react/dist/es/dialog/dialogs-manager/default-confirm.js.map +1 -0
  54. package/dist/es/node_modules/@sparrowengg/twigs-react/dist/es/dialog/dialogs-manager/default-modal.js +115 -0
  55. package/dist/es/node_modules/@sparrowengg/twigs-react/dist/es/dialog/dialogs-manager/default-modal.js.map +1 -0
  56. package/dist/es/node_modules/@sparrowengg/twigs-react/dist/es/dialog/dialogs-manager/index.js +107 -0
  57. package/dist/es/node_modules/@sparrowengg/twigs-react/dist/es/dialog/dialogs-manager/index.js.map +1 -0
  58. package/dist/es/node_modules/@sparrowengg/twigs-react/dist/es/dialog/dialogs-manager/store.js +46 -0
  59. package/dist/es/node_modules/@sparrowengg/twigs-react/dist/es/dialog/dialogs-manager/store.js.map +1 -0
  60. package/dist/es/node_modules/@sparrowengg/twigs-react/dist/es/grid/grid.js +81 -0
  61. package/dist/es/node_modules/@sparrowengg/twigs-react/dist/es/grid/grid.js.map +1 -0
  62. package/dist/es/node_modules/@sparrowengg/twigs-react/dist/es/node_modules/@radix-ui/react-alert-dialog/dist/index.js +146 -0
  63. package/dist/es/node_modules/@sparrowengg/twigs-react/dist/es/node_modules/@radix-ui/react-alert-dialog/dist/index.js.map +1 -0
  64. package/dist/es/node_modules/@sparrowengg/twigs-react/dist/es/node_modules/@radix-ui/react-dialog/dist/index.js +3 -1
  65. package/dist/es/node_modules/@sparrowengg/twigs-react/dist/es/node_modules/@radix-ui/react-dialog/dist/index.js.map +1 -1
  66. package/dist/es/node_modules/@sparrowengg/twigs-react/dist/es/packages/react-icons/dist/es/icons/close.js +84 -0
  67. package/dist/es/node_modules/@sparrowengg/twigs-react/dist/es/packages/react-icons/dist/es/icons/close.js.map +1 -0
  68. package/dist/es/triggers/components/subcomponents.js +160 -25
  69. package/dist/es/triggers/components/subcomponents.js.map +1 -1
  70. package/dist/es/triggers/components/trigger.js +1 -0
  71. package/dist/es/triggers/components/trigger.js.map +1 -1
  72. package/dist/es/triggers/constants/index.js.map +1 -1
  73. package/dist/es/triggers/index.js +8 -13
  74. package/dist/es/triggers/index.js.map +1 -1
  75. package/dist/index.d.ts +2 -1
  76. package/package.json +1 -1
@@ -0,0 +1,40 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var React = require('react');
6
+ var index = require('../../node_modules/@sparrowengg/twigs-react/dist/es/dialog/dialogs-manager/index.js');
7
+
8
+ function DraftModal({ onSaveHandler, onCloseHandler }) {
9
+ index.dialogs.open("confirm", {
10
+ title: "You will be redirected",
11
+ content: "To create a new share channel, we'll navigate you to the Share section. Your changes will be saved as a draft",
12
+ labels: {
13
+ confirm: "Yes, Proceed",
14
+ cancel: "Cancel"
15
+ },
16
+ css: {
17
+ "*": {
18
+ fontFamily: "DM Sans !important"
19
+ },
20
+ minWidth: "464px",
21
+ '[class$="variant-solid"]:nth-child(1)': {
22
+ width: "106px",
23
+ marginLeft: "auto"
24
+ }
25
+ },
26
+ confirmButtonProps: {
27
+ color: "primary"
28
+ },
29
+ onConfirm: () => {
30
+ onSaveHandler();
31
+ },
32
+ onClose: () => {
33
+ onCloseHandler();
34
+ }
35
+ });
36
+ return /* @__PURE__ */ React.createElement(index.DialogsManager, null);
37
+ }
38
+
39
+ exports.default = DraftModal;
40
+ //# sourceMappingURL=draftModal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"draftModal.js","sources":["../../../../src/commons/components/draftModal.tsx"],"sourcesContent":["import React from 'react'\nimport { dialogs, DialogsManager } from '@sparrowengg/twigs-react'\n\nexport default function DraftModal({onSaveHandler, onCloseHandler}: {onSaveHandler: any, onCloseHandler: any}) {\n dialogs.open('confirm', {\n \n title: \"You will be redirected\",\n content: \"To create a new share channel, we'll navigate you to the Share section. Your changes will be saved as a draft\",\n labels: {\n confirm: \"Yes, Proceed\",\n cancel: \"Cancel\",\n },\n css: {\n '*': {\n fontFamily: 'DM Sans !important'\n },\n minWidth: '464px',\n '[class$=\"variant-solid\"]:nth-child(1)': {\n width: '106px',\n marginLeft: 'auto'\n }\n },\n confirmButtonProps: {\n color: 'primary',\n },\n onConfirm: () => {\n onSaveHandler();\n },\n onClose: () => {\n onCloseHandler();\n }\n });\n return (\n <DialogsManager />\n )\n}\n"],"names":["dialogs","DialogsManager"],"mappings":";;;;;;;AAGA,SAAwB,UAAW,CAAA,EAAC,aAAe,EAAA,cAAA,EAA4D,EAAA;AAC7G,EAAAA,aAAA,CAAQ,KAAK,SAAW,EAAA;AAAA,IAEtB,KAAO,EAAA,wBAAA;AAAA,IACP,OAAS,EAAA,+GAAA;AAAA,IACT,MAAQ,EAAA;AAAA,MACN,OAAS,EAAA,cAAA;AAAA,MACT,MAAQ,EAAA,QAAA;AAAA,KACV;AAAA,IACA,GAAK,EAAA;AAAA,MACH,GAAK,EAAA;AAAA,QACH,UAAY,EAAA,oBAAA;AAAA,OACd;AAAA,MACA,QAAU,EAAA,OAAA;AAAA,MACV,uCAAyC,EAAA;AAAA,QACvC,KAAO,EAAA,OAAA;AAAA,QACP,UAAY,EAAA,MAAA;AAAA,OACd;AAAA,KACF;AAAA,IACA,kBAAoB,EAAA;AAAA,MAClB,KAAO,EAAA,SAAA;AAAA,KACT;AAAA,IACA,WAAW,MAAM;AACf,MAAc,aAAA,EAAA,CAAA;AAAA,KAChB;AAAA,IACA,SAAS,MAAM;AACb,MAAe,cAAA,EAAA,CAAA;AAAA,KACjB;AAAA,GACD,CAAA,CAAA;AACD,EAAA,2CACGC,oBAAe,EAAA,IAAA,CAAA,CAAA;AAEpB;;;;"}
@@ -19,14 +19,23 @@ var tooltip = require('../../node_modules/@sparrowengg/twigs-react/dist/es/toolt
19
19
  var chevronDown = require('../../node_modules/@sparrowengg/twigs-react-icons/dist/es/icons/chevron-down.js');
20
20
  var tabs = require('../../node_modules/@sparrowengg/twigs-react/dist/es/tabs/tabs.js');
21
21
  var chevronRight = require('../../node_modules/@sparrowengg/twigs-react-icons/dist/es/icons/chevron-right.js');
22
+ var chip = require('../../node_modules/@sparrowengg/twigs-react/dist/es/chip/chip.js');
22
23
  var _switch = require('../../node_modules/@sparrowengg/twigs-react/dist/es/switch/switch.js');
23
24
  var iconButton = require('../../node_modules/@sparrowengg/twigs-react/dist/es/button/icon-button.js');
24
25
  var ellipsisVertical = require('../../node_modules/@sparrowengg/twigs-react-icons/dist/es/icons/ellipsis-vertical.js');
25
26
  var pencil = require('../../node_modules/@sparrowengg/twigs-react-icons/dist/es/icons/pencil.js');
26
27
  var _delete = require('../../node_modules/@sparrowengg/twigs-react-icons/dist/es/icons/delete.js');
27
- var chip = require('../../node_modules/@sparrowengg/twigs-react/dist/es/chip/chip.js');
28
28
  var table = require('../../node_modules/@sparrowengg/twigs-react/dist/es/table/table.js');
29
29
 
30
+ const trasformToPastTense = (value) => {
31
+ if (value.endsWith("e")) {
32
+ return value + "d";
33
+ } else if (value.endsWith("y")) {
34
+ return value.slice(0, -1) + "ied";
35
+ } else {
36
+ return value + "ed";
37
+ }
38
+ };
30
39
  const Dashboard = ({
31
40
  onMappingEditHandler,
32
41
  fieldOptions,
@@ -96,40 +105,46 @@ const Dashboard = ({
96
105
  }
97
106
  ) : null
98
107
  )))
99
- ), /* @__PURE__ */ React.createElement(box.Box, { css: {
100
- marginBottom: "$20 !important"
101
- } }, hasMultiAccounts ? /* @__PURE__ */ React.createElement(
102
- MultiAccountDashboard,
103
- {
104
- onMappingEditHandler,
105
- fieldOptions,
106
- triggerEnabled,
107
- mappingEnabled,
108
- mappingFields,
109
- triggerFields,
110
- integrationName,
111
- handleDashboardPage,
112
- handleEditField,
113
- handleConfigurationType,
114
- toggleDashboardField,
115
- deleteFieldHandler
116
- }
117
- ) : /* @__PURE__ */ React.createElement(
118
- SingleAccountDashboard,
108
+ ), /* @__PURE__ */ React.createElement(
109
+ box.Box,
119
110
  {
120
- onMappingEditHandler,
121
- fieldOptions,
122
- triggerEnabled,
123
- mappingEnabled,
124
- mappingFields,
125
- triggerFields,
126
- integrationName,
127
- handleDashboardPage,
128
- handleEditField,
129
- toggleDashboardField,
130
- deleteFieldHandler
131
- }
132
- ))));
111
+ css: {
112
+ marginBottom: "$20 !important"
113
+ }
114
+ },
115
+ hasMultiAccounts ? /* @__PURE__ */ React.createElement(
116
+ MultiAccountDashboard,
117
+ {
118
+ onMappingEditHandler,
119
+ fieldOptions,
120
+ triggerEnabled,
121
+ mappingEnabled,
122
+ mappingFields,
123
+ triggerFields,
124
+ integrationName,
125
+ handleDashboardPage,
126
+ handleEditField,
127
+ handleConfigurationType,
128
+ toggleDashboardField,
129
+ deleteFieldHandler
130
+ }
131
+ ) : /* @__PURE__ */ React.createElement(
132
+ SingleAccountDashboard,
133
+ {
134
+ onMappingEditHandler,
135
+ fieldOptions,
136
+ triggerEnabled,
137
+ mappingEnabled,
138
+ mappingFields,
139
+ triggerFields,
140
+ integrationName,
141
+ handleDashboardPage,
142
+ handleEditField,
143
+ toggleDashboardField,
144
+ deleteFieldHandler
145
+ }
146
+ )
147
+ )));
133
148
  };
134
149
  const MultiAccountDashboard = ({
135
150
  onMappingEditHandler,
@@ -162,15 +177,16 @@ const MultiAccountDashboard = ({
162
177
  css: { paddingBlock: "$12", paddingInline: 0 }
163
178
  },
164
179
  /* @__PURE__ */ React.createElement(flex.Flex, { flexDirection: "column", gap: "$8" }, !!(triggerFields == null ? void 0 : triggerFields.length) ? /* @__PURE__ */ React.createElement(React.Fragment, null, triggerFields == null ? void 0 : triggerFields.map((field) => {
165
- var _a2;
180
+ var _a2, _b2, _c2;
166
181
  return /* @__PURE__ */ React.createElement(
167
182
  DashboardItem,
168
183
  {
184
+ isDraft: field == null ? void 0 : field.isDraft,
169
185
  onMappingEditHandler,
170
186
  icon: /* @__PURE__ */ React.createElement(cursor.default, { size: 32, color: "#56B0BB" }),
171
187
  heading: (_a2 = field.domain) != null ? _a2 : field.email,
172
188
  id: field.id,
173
- description: `Trigger survey when an event happens in ${integrationName}`,
189
+ description: `Trigger survey when an ${(_b2 = field == null ? void 0 : field.object) == null ? void 0 : _b2.toLowerCase()} event is ${(_c2 = field == null ? void 0 : field.action) == null ? void 0 : _c2.toLowerCase()} in ${integrationName}`,
174
190
  fields: field.fields,
175
191
  isEnabled: field.isEnabled,
176
192
  integrationName,
@@ -182,15 +198,16 @@ const MultiAccountDashboard = ({
182
198
  }
183
199
  );
184
200
  })) : null, !!((_a = mappingFields == null ? void 0 : mappingFields.fields) == null ? void 0 : _a.length) ? /* @__PURE__ */ React.createElement(React.Fragment, null, (_b = mappingFields == null ? void 0 : mappingFields.fields) == null ? void 0 : _b.map((field) => {
185
- var _a2;
201
+ var _a2, _b2, _c2, _d2, _e;
186
202
  return /* @__PURE__ */ React.createElement(React.Fragment, null, mappingFields.type === "MULTI_MAPPING" ? /* @__PURE__ */ React.createElement(
187
203
  DashboardItem,
188
204
  {
205
+ isDraft: field == null ? void 0 : field.isDraft,
189
206
  onMappingEditHandler,
190
207
  icon: /* @__PURE__ */ React.createElement(mapping.default, { size: 32, color: "#56B0BB" }),
191
208
  heading: (_a2 = field.domain) != null ? _a2 : field.email,
192
209
  id: field.id,
193
- description: `Sync survey responses to ${integrationName}`,
210
+ description: `Sync survey responses to ${integrationName} when ${(_c2 = (_b2 = field == null ? void 0 : field.events) == null ? void 0 : _b2.value) == null ? void 0 : _c2.toLowerCase()} is ${trasformToPastTense(`${(_e = (_d2 = field == null ? void 0 : field.actions) == null ? void 0 : _d2.value) == null ? void 0 : _e.toLowerCase()}`)}`,
194
211
  fields: field.fields,
195
212
  isEnabled: field.isEnabled,
196
213
  integrationName,
@@ -220,24 +237,28 @@ const MultiAccountDashboard = ({
220
237
  value: "TRIGGER",
221
238
  css: { paddingBlock: "$12", paddingInline: 0 }
222
239
  },
223
- !!(triggerFields == null ? void 0 : triggerFields.length) ? /* @__PURE__ */ React.createElement(flex.Flex, { flexDirection: "column", gap: "$8" }, triggerFields == null ? void 0 : triggerFields.map((field) => /* @__PURE__ */ React.createElement(
224
- DashboardItem,
225
- {
226
- onMappingEditHandler,
227
- icon: /* @__PURE__ */ React.createElement(cursor.default, { size: 32, color: "#56B0BB" }),
228
- heading: "Trigger",
229
- id: field.id,
230
- description: `Trigger survey when an event happens in ${integrationName}`,
231
- fields: field.fields,
232
- isEnabled: field.isEnabled,
233
- integrationName,
234
- handleDashboardPage,
235
- handleEditField,
236
- type: "TRIGGER",
237
- toggleDashboardField,
238
- deleteFieldHandler
239
- }
240
- ))) : /* @__PURE__ */ React.createElement(
240
+ !!(triggerFields == null ? void 0 : triggerFields.length) ? /* @__PURE__ */ React.createElement(flex.Flex, { flexDirection: "column", gap: "$8" }, triggerFields == null ? void 0 : triggerFields.map((field) => {
241
+ var _a2, _b2;
242
+ return /* @__PURE__ */ React.createElement(
243
+ DashboardItem,
244
+ {
245
+ isDraft: field == null ? void 0 : field.isDraft,
246
+ onMappingEditHandler,
247
+ icon: /* @__PURE__ */ React.createElement(cursor.default, { size: 32, color: "#56B0BB" }),
248
+ heading: "Trigger",
249
+ id: field.id,
250
+ description: `Trigger survey when an ${(_a2 = field == null ? void 0 : field.object) == null ? void 0 : _a2.toLowerCase()} event is ${(_b2 = field == null ? void 0 : field.action) == null ? void 0 : _b2.toLowerCase()} in ${integrationName}`,
251
+ fields: field.fields,
252
+ isEnabled: field.isEnabled,
253
+ integrationName,
254
+ handleDashboardPage,
255
+ handleEditField,
256
+ type: "TRIGGER",
257
+ toggleDashboardField,
258
+ deleteFieldHandler
259
+ }
260
+ );
261
+ })) : /* @__PURE__ */ React.createElement(
241
262
  MultiAccountFallback,
242
263
  {
243
264
  title: "Trigger",
@@ -250,36 +271,40 @@ const MultiAccountDashboard = ({
250
271
  value: "MAPPING",
251
272
  css: { paddingBlock: "$12", paddingInline: 0 }
252
273
  },
253
- !!((_c = mappingFields == null ? void 0 : mappingFields.fields) == null ? void 0 : _c.length) ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(flex.Flex, { flexDirection: "column", gap: "$8" }, (_d = mappingFields == null ? void 0 : mappingFields.fields) == null ? void 0 : _d.map((field) => /* @__PURE__ */ React.createElement(React.Fragment, null, mappingFields.type === "MULTI_MAPPING" ? /* @__PURE__ */ React.createElement(
254
- DashboardItem,
255
- {
256
- onMappingEditHandler,
257
- icon: /* @__PURE__ */ React.createElement(mapping.default, { size: 32, color: "#56B0BB" }),
258
- heading: "Mapping",
259
- id: field.id,
260
- description: `Sync survey responses to ${integrationName}`,
261
- fields: field.fields,
262
- isEnabled: field.isEnabled,
263
- integrationName,
264
- handleDashboardPage,
265
- handleEditField,
266
- type: "MAPPING",
267
- toggleDashboardField,
268
- deleteFieldHandler
269
- }
270
- ) : /* @__PURE__ */ React.createElement(
271
- SingleMappingDashboardItem,
272
- {
273
- field,
274
- key: field.id,
275
- integrationName,
276
- icon: /* @__PURE__ */ React.createElement(mapping.default, { size: 32, color: "#56B0BB" }),
277
- handleEditField,
278
- handleDashboardPage,
279
- toggleDashboardField,
280
- deleteFieldHandler
281
- }
282
- ))))) : /* @__PURE__ */ React.createElement(
274
+ !!((_c = mappingFields == null ? void 0 : mappingFields.fields) == null ? void 0 : _c.length) ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(flex.Flex, { flexDirection: "column", gap: "$8" }, (_d = mappingFields == null ? void 0 : mappingFields.fields) == null ? void 0 : _d.map((field) => {
275
+ var _a2, _b2, _c2, _d2;
276
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, mappingFields.type === "MULTI_MAPPING" ? /* @__PURE__ */ React.createElement(
277
+ DashboardItem,
278
+ {
279
+ isDraft: field == null ? void 0 : field.isDraft,
280
+ onMappingEditHandler,
281
+ icon: /* @__PURE__ */ React.createElement(mapping.default, { size: 32, color: "#56B0BB" }),
282
+ heading: "Mapping",
283
+ id: field.id,
284
+ description: `Sync survey responses to ${integrationName} when ${(_b2 = (_a2 = field == null ? void 0 : field.events) == null ? void 0 : _a2.value) == null ? void 0 : _b2.toLowerCase()} is ${trasformToPastTense(`${(_d2 = (_c2 = field == null ? void 0 : field.actions) == null ? void 0 : _c2.value) == null ? void 0 : _d2.toLowerCase()}`)}`,
285
+ fields: field.fields,
286
+ isEnabled: field.isEnabled,
287
+ integrationName,
288
+ handleDashboardPage,
289
+ handleEditField,
290
+ type: "MAPPING",
291
+ toggleDashboardField,
292
+ deleteFieldHandler
293
+ }
294
+ ) : /* @__PURE__ */ React.createElement(
295
+ SingleMappingDashboardItem,
296
+ {
297
+ field,
298
+ key: field.id,
299
+ integrationName,
300
+ icon: /* @__PURE__ */ React.createElement(mapping.default, { size: 32, color: "#56B0BB" }),
301
+ handleEditField,
302
+ handleDashboardPage,
303
+ toggleDashboardField,
304
+ deleteFieldHandler
305
+ }
306
+ ));
307
+ }))) : /* @__PURE__ */ React.createElement(
283
308
  MultiAccountFallback,
284
309
  {
285
310
  title: "Mapping",
@@ -340,38 +365,46 @@ const SingleAccountDashboard = ({
340
365
  deleteFieldHandler
341
366
  }) => {
342
367
  var _a, _b, _c, _d;
343
- return /* @__PURE__ */ React.createElement(React.Fragment, null, !!(triggerFields == null ? void 0 : triggerFields.length) ? /* @__PURE__ */ React.createElement(box.Box, { css: { marginTop: "$20" } }, triggerFields == null ? void 0 : triggerFields.map((field) => /* @__PURE__ */ React.createElement(
344
- TriggerDasboardItem,
345
- {
346
- fieldOptions,
347
- field,
348
- description: `Trigger survey when an event happens in ${integrationName}`,
349
- key: field.id,
350
- integrationName,
351
- icon: /* @__PURE__ */ React.createElement(cursor.default, { size: 32, color: "#56B0BB" }),
352
- handleEditField,
353
- handleDashboardPage,
354
- toggleDashboardField,
355
- deleteFieldHandler
356
- }
357
- ))) : null, !!((_a = mappingFields == null ? void 0 : mappingFields.fields) == null ? void 0 : _a.length) && (mappingFields == null ? void 0 : mappingFields.type) === "MULTI_MAPPING" ? /* @__PURE__ */ React.createElement(box.Box, { css: { marginTop: !(triggerFields == null ? void 0 : triggerFields.length) ? "$20" : "$8" } }, (_b = mappingFields == null ? void 0 : mappingFields.fields) == null ? void 0 : _b.map((field) => /* @__PURE__ */ React.createElement(
358
- DashboardItem,
359
- {
360
- onMappingEditHandler,
361
- icon: /* @__PURE__ */ React.createElement(mapping.default, { size: 32, color: "#56B0BB" }),
362
- heading: "Mapping",
363
- id: field.id,
364
- description: `Sync survey responses to ${integrationName}`,
365
- fields: field.fields,
366
- isEnabled: field.isEnabled,
367
- integrationName,
368
- handleDashboardPage,
369
- handleEditField,
370
- type: "MAPPING",
371
- toggleDashboardField,
372
- deleteFieldHandler
373
- }
374
- ))) : null, (mappingFields == null ? void 0 : mappingFields.type) !== "MULTI_MAPPING" && !!((_c = mappingFields == null ? void 0 : mappingFields.fields) == null ? void 0 : _c.length) ? /* @__PURE__ */ React.createElement(box.Box, { css: { marginTop: !(triggerFields == null ? void 0 : triggerFields.length) ? "$20" : "$8" } }, (_d = mappingFields == null ? void 0 : mappingFields.fields) == null ? void 0 : _d.map((field) => /* @__PURE__ */ React.createElement(
368
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, !!(triggerFields == null ? void 0 : triggerFields.length) ? /* @__PURE__ */ React.createElement(box.Box, { css: { marginTop: "$20" } }, triggerFields == null ? void 0 : triggerFields.map((field) => {
369
+ var _a2, _b2;
370
+ return /* @__PURE__ */ React.createElement(
371
+ TriggerDasboardItem,
372
+ {
373
+ isDraft: field == null ? void 0 : field.isDraft,
374
+ fieldOptions,
375
+ field,
376
+ description: `Trigger survey when ${/^[aeiouAEIOU]$/.test(field == null ? void 0 : field.object[0]) ? "an" : "a"} ${(_a2 = field == null ? void 0 : field.object) == null ? void 0 : _a2.toLowerCase()} event is ${(_b2 = field == null ? void 0 : field.action) == null ? void 0 : _b2.toLowerCase()} in ${integrationName}`,
377
+ key: field.id,
378
+ integrationName,
379
+ icon: /* @__PURE__ */ React.createElement(cursor.default, { size: 32, color: "#56B0BB" }),
380
+ handleEditField,
381
+ handleDashboardPage,
382
+ toggleDashboardField,
383
+ deleteFieldHandler
384
+ }
385
+ );
386
+ })) : null, !!((_a = mappingFields == null ? void 0 : mappingFields.fields) == null ? void 0 : _a.length) && (mappingFields == null ? void 0 : mappingFields.type) === "MULTI_MAPPING" ? /* @__PURE__ */ React.createElement(box.Box, { css: { marginTop: !(triggerFields == null ? void 0 : triggerFields.length) ? "$20" : "$8" } }, (_b = mappingFields == null ? void 0 : mappingFields.fields) == null ? void 0 : _b.map((field) => {
387
+ var _a2, _b2, _c2, _d2;
388
+ return /* @__PURE__ */ React.createElement(
389
+ DashboardItem,
390
+ {
391
+ isDraft: field == null ? void 0 : field.isDraft,
392
+ onMappingEditHandler,
393
+ icon: /* @__PURE__ */ React.createElement(mapping.default, { size: 32, color: "#56B0BB" }),
394
+ heading: "Mapping",
395
+ id: field.id,
396
+ description: `Sync survey responses to ${integrationName} when ${(_b2 = (_a2 = field == null ? void 0 : field.events) == null ? void 0 : _a2.value) == null ? void 0 : _b2.toLowerCase()} is ${trasformToPastTense(`${(_d2 = (_c2 = field == null ? void 0 : field.actions) == null ? void 0 : _c2.value) == null ? void 0 : _d2.toLowerCase()}`)}`,
397
+ fields: field.fields,
398
+ isEnabled: field.isEnabled,
399
+ integrationName,
400
+ handleDashboardPage,
401
+ handleEditField,
402
+ type: "MAPPING",
403
+ toggleDashboardField,
404
+ deleteFieldHandler
405
+ }
406
+ );
407
+ })) : null, (mappingFields == null ? void 0 : mappingFields.type) !== "MULTI_MAPPING" && !!((_c = mappingFields == null ? void 0 : mappingFields.fields) == null ? void 0 : _c.length) ? /* @__PURE__ */ React.createElement(box.Box, { css: { marginTop: !(triggerFields == null ? void 0 : triggerFields.length) ? "$20" : "$8" } }, (_d = mappingFields == null ? void 0 : mappingFields.fields) == null ? void 0 : _d.map((field) => /* @__PURE__ */ React.createElement(
375
408
  SingleMappingDashboardItem,
376
409
  {
377
410
  field,
@@ -386,6 +419,7 @@ const SingleAccountDashboard = ({
386
419
  ))) : null);
387
420
  };
388
421
  const TriggerDasboardItem = ({
422
+ isDraft,
389
423
  fieldOptions,
390
424
  icon,
391
425
  field,
@@ -407,7 +441,9 @@ const TriggerDasboardItem = ({
407
441
  const comparator = filter.comparator;
408
442
  const value = filter.value;
409
443
  const formattedComparator = ((_a3 = index$1.operatorOptions.find((option) => option.value === comparator)) == null ? void 0 : _a3.label) || comparator;
410
- const fieldLabel = (_b2 = fieldOptions.find((options) => options.value === field2)) == null ? void 0 : _b2.label;
444
+ const fieldLabel = (_b2 = fieldOptions.find(
445
+ (options) => options.value === field2
446
+ )) == null ? void 0 : _b2.label;
411
447
  return `${fieldLabel} ${formattedComparator === "NO_PREFERENCE" ? "has no preference" : formattedComparator} ${value}`;
412
448
  })) == null ? void 0 : _a2.join(
413
449
  ` <span style="color: #6A6A6A;font-weight: 600;">${filterGroup.condition.toLowerCase()}</span> `
@@ -447,7 +483,32 @@ const TriggerDasboardItem = ({
447
483
  isMappingDisplayed ? /* @__PURE__ */ React.createElement(chevronDown.ChevronDownIcon, { size: 40, color: "#848484" }) : /* @__PURE__ */ React.createElement(chevronRight.ChevronRightIcon, { size: 40, color: "#848484" }),
448
484
  /* @__PURE__ */ React.createElement(flex.Flex, { alignItems: "center", gap: "$4" }, icon, /* @__PURE__ */ React.createElement(flex.Flex, { gap: "$1", flexDirection: "column" }, /* @__PURE__ */ React.createElement(text.Text, { size: "md", weight: "bold" }, (_a = field == null ? void 0 : field.email) != null ? _a : "Trigger"), /* @__PURE__ */ React.createElement(text.Text, { size: "sm", css: { color: "$neutral600" } }, description != null ? description : `Trigger survey when an event happens in ${integrationName}`)))
449
485
  ),
450
- /* @__PURE__ */ React.createElement(flex.Flex, { alignItems: "center", gap: "$12" }, /* @__PURE__ */ React.createElement(
486
+ /* @__PURE__ */ React.createElement(flex.Flex, { alignItems: "center", gap: "$12" }, isDraft && /* @__PURE__ */ React.createElement(flex.Flex, { alignItems: "center", gap: "$12" }, /* @__PURE__ */ React.createElement(chip.Chip, { rounded: "full", size: "sm" }, /* @__PURE__ */ React.createElement(
487
+ box.Box,
488
+ {
489
+ css: {
490
+ background: "$neutral500",
491
+ borderRadius: "50%",
492
+ marginRight: "$1",
493
+ width: "$4",
494
+ height: "$4"
495
+ }
496
+ }
497
+ ), /* @__PURE__ */ React.createElement(
498
+ text.Text,
499
+ {
500
+ size: "sm",
501
+ weight: "bold",
502
+ css: {
503
+ color: "$neutral800"
504
+ }
505
+ },
506
+ "DRAFT"
507
+ )), /* @__PURE__ */ React.createElement(box.Box, { css: {
508
+ width: "1px",
509
+ height: "20px",
510
+ background: "#64748B20"
511
+ } })), /* @__PURE__ */ React.createElement(
451
512
  _switch.Switch,
452
513
  {
453
514
  size: "md",
@@ -792,7 +853,10 @@ const SingleMappingEventWrapper = ({
792
853
  EventComponent,
793
854
  {
794
855
  heading: "Object:",
795
- description: (_a = field.object) == null ? void 0 : _a.replace(/^./, (char) => char == null ? void 0 : char.toUpperCase())
856
+ description: (_a = field.object) == null ? void 0 : _a.replace(
857
+ /^./,
858
+ (char) => char == null ? void 0 : char.toUpperCase()
859
+ )
796
860
  }
797
861
  ) : null, !!field.action ? /* @__PURE__ */ React.createElement(
798
862
  EventComponent,
@@ -878,6 +942,7 @@ const SingleMappingChipWrapper = ({
878
942
  ));
879
943
  };
880
944
  const DashboardItem = ({
945
+ isDraft,
881
946
  onMappingEditHandler,
882
947
  icon,
883
948
  heading,
@@ -946,7 +1011,32 @@ const DashboardItem = ({
946
1011
  isMappingDisplayed ? /* @__PURE__ */ React.createElement(chevronDown.ChevronDownIcon, { size: 40, color: "#848484" }) : /* @__PURE__ */ React.createElement(chevronRight.ChevronRightIcon, { size: 40, color: "#848484" }),
947
1012
  /* @__PURE__ */ React.createElement(flex.Flex, { alignItems: "center", gap: "$4" }, icon, /* @__PURE__ */ React.createElement(flex.Flex, { gap: "$1", flexDirection: "column" }, /* @__PURE__ */ React.createElement(text.Text, { size: "md", weight: "bold" }, heading), /* @__PURE__ */ React.createElement(text.Text, { size: "sm", css: { color: "$neutral600" } }, description)))
948
1013
  ),
949
- /* @__PURE__ */ React.createElement(flex.Flex, { alignItems: "center", gap: "$12" }, /* @__PURE__ */ React.createElement(
1014
+ /* @__PURE__ */ React.createElement(flex.Flex, { alignItems: "center", gap: "$12" }, isDraft && /* @__PURE__ */ React.createElement(flex.Flex, { alignItems: "center", gap: "$12" }, /* @__PURE__ */ React.createElement(chip.Chip, { rounded: "full", size: "sm" }, /* @__PURE__ */ React.createElement(
1015
+ box.Box,
1016
+ {
1017
+ css: {
1018
+ background: "$neutral500",
1019
+ borderRadius: "50%",
1020
+ marginRight: "$1",
1021
+ width: "$4",
1022
+ height: "$4"
1023
+ }
1024
+ }
1025
+ ), /* @__PURE__ */ React.createElement(
1026
+ text.Text,
1027
+ {
1028
+ size: "sm",
1029
+ weight: "bold",
1030
+ css: {
1031
+ color: "$neutral800"
1032
+ }
1033
+ },
1034
+ "DRAFT"
1035
+ )), /* @__PURE__ */ React.createElement(box.Box, { css: {
1036
+ width: "1px",
1037
+ height: "20px",
1038
+ background: "#64748B20"
1039
+ } })), /* @__PURE__ */ React.createElement(
950
1040
  _switch.Switch,
951
1041
  {
952
1042
  size: "md",
@@ -1111,19 +1201,26 @@ const DropdownItem = ({
1111
1201
  isDisabled,
1112
1202
  toolTipContent
1113
1203
  }) => {
1114
- return /* @__PURE__ */ React.createElement(tooltip.Tooltip, { content: isDisabled ? toolTipContent : "", css: {
1115
- zIndex: "99999999",
1116
- minWidth: "280px",
1117
- textAlign: "center"
1118
- } }, /* @__PURE__ */ React.createElement(flex.Flex, null, /* @__PURE__ */ React.createElement(
1119
- dropdown.DropdownMenuItem,
1204
+ return /* @__PURE__ */ React.createElement(
1205
+ tooltip.Tooltip,
1120
1206
  {
1121
- css: { cursor: isDisabled ? "not-allowed !important" : "pointer" },
1122
- onClick: onClickHandler,
1123
- disabled: isDisabled
1207
+ content: isDisabled ? toolTipContent : "",
1208
+ css: {
1209
+ zIndex: "99999999",
1210
+ minWidth: "280px",
1211
+ textAlign: "center"
1212
+ }
1124
1213
  },
1125
- /* @__PURE__ */ React.createElement(flex.Flex, { alignItems: "flex-start", gap: "$4" }, /* @__PURE__ */ React.createElement(box.Box, { css: { width: "$6" } }, icon), /* @__PURE__ */ React.createElement(flex.Flex, { flexDirection: "column" }, /* @__PURE__ */ React.createElement(text.Text, { size: "md" }, heading), /* @__PURE__ */ React.createElement(text.Text, { size: "sm", css: { color: "$neutral700" } }, description)))
1126
- )));
1214
+ /* @__PURE__ */ React.createElement(flex.Flex, null, /* @__PURE__ */ React.createElement(
1215
+ dropdown.DropdownMenuItem,
1216
+ {
1217
+ css: { cursor: isDisabled ? "not-allowed !important" : "pointer" },
1218
+ onClick: onClickHandler,
1219
+ disabled: isDisabled
1220
+ },
1221
+ /* @__PURE__ */ React.createElement(flex.Flex, { alignItems: "flex-start", gap: "$4" }, /* @__PURE__ */ React.createElement(box.Box, { css: { width: "$6" } }, icon), /* @__PURE__ */ React.createElement(flex.Flex, { flexDirection: "column" }, /* @__PURE__ */ React.createElement(text.Text, { size: "md" }, heading), /* @__PURE__ */ React.createElement(text.Text, { size: "sm", css: { color: "$neutral700" } }, description)))
1222
+ ))
1223
+ );
1127
1224
  };
1128
1225
 
1129
1226
  exports.default = Dashboard;