@sparrowengg/integrations-templates-frontend 1.2.7 → 1.2.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.
@@ -36,8 +36,8 @@ const Dashboard = ({
36
36
  handleConfigurationType,
37
37
  handleEditField,
38
38
  handleDashboardPage,
39
- handleDashboardField,
40
- deleteFieldHandler
39
+ deleteFieldHandler,
40
+ toggleDashboardField
41
41
  }) => {
42
42
  const isSingleAccountMappingCompleted = !hasMultiAccounts && !!(mappingFields == null ? void 0 : mappingFields.fields.length);
43
43
  const isSingleAccountTriggerCompleted = !hasMultiAccounts && !!(triggerFields == null ? void 0 : triggerFields.length);
@@ -86,7 +86,7 @@ const Dashboard = ({
86
86
  handleDashboardPage,
87
87
  handleEditField,
88
88
  handleConfigurationType,
89
- handleDashboardField,
89
+ toggleDashboardField,
90
90
  deleteFieldHandler
91
91
  }
92
92
  ) : /* @__PURE__ */ React.createElement(
@@ -97,7 +97,7 @@ const Dashboard = ({
97
97
  integrationName,
98
98
  handleDashboardPage,
99
99
  handleEditField,
100
- handleDashboardField,
100
+ toggleDashboardField,
101
101
  deleteFieldHandler
102
102
  }
103
103
  )));
@@ -109,9 +109,10 @@ const MultiAccountDashboard = ({
109
109
  handleDashboardPage,
110
110
  handleEditField,
111
111
  handleConfigurationType,
112
- handleDashboardField,
112
+ toggleDashboardField,
113
113
  deleteFieldHandler
114
114
  }) => {
115
+ var _a, _b, _c, _d;
115
116
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(tabs.Tabs, { defaultValue: "ALL" }, /* @__PURE__ */ React.createElement(
116
117
  tabs.TabsList,
117
118
  {
@@ -130,13 +131,13 @@ const MultiAccountDashboard = ({
130
131
  value: "ALL",
131
132
  css: { paddingBlock: "$12", paddingInline: 0 }
132
133
  },
133
- /* @__PURE__ */ React.createElement(flex.Flex, { flexDirection: "column", gap: "$8" }, !!triggerFields.length ? /* @__PURE__ */ React.createElement(React.Fragment, null, triggerFields.map((field) => {
134
- var _a;
134
+ /* @__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) => {
135
+ var _a2;
135
136
  return /* @__PURE__ */ React.createElement(
136
137
  DashboardItem,
137
138
  {
138
139
  icon: /* @__PURE__ */ React.createElement(cursor.default, { size: 32, color: "#56B0BB" }),
139
- heading: (_a = field.domain) != null ? _a : field.email,
140
+ heading: (_a2 = field.domain) != null ? _a2 : field.email,
140
141
  id: field.id,
141
142
  description: `Trigger survey when an event happens in ${integrationName}`,
142
143
  fields: field.fields,
@@ -145,17 +146,17 @@ const MultiAccountDashboard = ({
145
146
  handleDashboardPage,
146
147
  handleEditField,
147
148
  type: "TRIGGER",
148
- handleDashboardField,
149
+ toggleDashboardField,
149
150
  deleteFieldHandler
150
151
  }
151
152
  );
152
- })) : null, !!mappingFields.fields.length ? /* @__PURE__ */ React.createElement(React.Fragment, null, mappingFields.fields.map((field) => {
153
- var _a;
153
+ })) : 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) => {
154
+ var _a2;
154
155
  return /* @__PURE__ */ React.createElement(React.Fragment, null, mappingFields.type === "MULTI_MAPPING" ? /* @__PURE__ */ React.createElement(
155
156
  DashboardItem,
156
157
  {
157
158
  icon: /* @__PURE__ */ React.createElement(mapping.default, { size: 32, color: "#56B0BB" }),
158
- heading: (_a = field.domain) != null ? _a : field.email,
159
+ heading: (_a2 = field.domain) != null ? _a2 : field.email,
159
160
  id: field.id,
160
161
  description: `Sync survey responses to ${integrationName}`,
161
162
  fields: field.fields,
@@ -164,7 +165,7 @@ const MultiAccountDashboard = ({
164
165
  handleDashboardPage,
165
166
  handleEditField,
166
167
  type: "MAPPING",
167
- handleDashboardField,
168
+ toggleDashboardField,
168
169
  deleteFieldHandler
169
170
  }
170
171
  ) : /* @__PURE__ */ React.createElement(
@@ -176,7 +177,7 @@ const MultiAccountDashboard = ({
176
177
  icon: /* @__PURE__ */ React.createElement(mapping.default, { size: 32, color: "#56B0BB" }),
177
178
  handleEditField,
178
179
  handleDashboardPage,
179
- handleDashboardField
180
+ toggleDashboardField
180
181
  }
181
182
  ));
182
183
  })) : null)
@@ -186,7 +187,7 @@ const MultiAccountDashboard = ({
186
187
  value: "TRIGGER",
187
188
  css: { paddingBlock: "$12", paddingInline: 0 }
188
189
  },
189
- !!triggerFields.length ? /* @__PURE__ */ React.createElement(flex.Flex, { flexDirection: "column", gap: "$8" }, triggerFields.map((field) => /* @__PURE__ */ React.createElement(
190
+ !!(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(
190
191
  DashboardItem,
191
192
  {
192
193
  icon: /* @__PURE__ */ React.createElement(cursor.default, { size: 32, color: "#56B0BB" }),
@@ -199,7 +200,7 @@ const MultiAccountDashboard = ({
199
200
  handleDashboardPage,
200
201
  handleEditField,
201
202
  type: "TRIGGER",
202
- handleDashboardField,
203
+ toggleDashboardField,
203
204
  deleteFieldHandler
204
205
  }
205
206
  ))) : /* @__PURE__ */ React.createElement(
@@ -215,7 +216,7 @@ const MultiAccountDashboard = ({
215
216
  value: "MAPPING",
216
217
  css: { paddingBlock: "$12", paddingInline: 0 }
217
218
  },
218
- !!mappingFields.fields.length ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(flex.Flex, { flexDirection: "column", gap: "$8" }, mappingFields.fields.map((field) => /* @__PURE__ */ React.createElement(React.Fragment, null, mappingFields.type === "MULTI_MAPPING" ? /* @__PURE__ */ React.createElement(
219
+ !!((_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(
219
220
  DashboardItem,
220
221
  {
221
222
  icon: /* @__PURE__ */ React.createElement(mapping.default, { size: 32, color: "#56B0BB" }),
@@ -228,7 +229,7 @@ const MultiAccountDashboard = ({
228
229
  handleDashboardPage,
229
230
  handleEditField,
230
231
  type: "MAPPING",
231
- handleDashboardField,
232
+ toggleDashboardField,
232
233
  deleteFieldHandler
233
234
  }
234
235
  ) : /* @__PURE__ */ React.createElement(
@@ -240,7 +241,7 @@ const MultiAccountDashboard = ({
240
241
  icon: /* @__PURE__ */ React.createElement(mapping.default, { size: 32, color: "#56B0BB" }),
241
242
  handleEditField,
242
243
  handleDashboardPage,
243
- handleDashboardField
244
+ toggleDashboardField
244
245
  }
245
246
  ))))) : /* @__PURE__ */ React.createElement(
246
247
  MultiAccountFallback,
@@ -277,7 +278,7 @@ const MultiAccountFallback = ({
277
278
  },
278
279
  "Creating one is as easy as a breeze. Just a click away to get started."
279
280
  ),
280
- /* @__PURE__ */ React.createElement(button.Button, { size: "lg", leftIcon: /* @__PURE__ */ React.createElement(plus.PlusIcon, null), variant: "outline" }, `New ${title}`)
281
+ /* @__PURE__ */ React.createElement(button.Button, { size: "lg", leftIcon: /* @__PURE__ */ React.createElement(plus.PlusIcon, null), variant: "outline", onClick: onClickHandler }, `New ${title}`)
281
282
  );
282
283
  };
283
284
  const SingleAccountDashboard = ({
@@ -286,11 +287,11 @@ const SingleAccountDashboard = ({
286
287
  integrationName,
287
288
  handleEditField,
288
289
  handleDashboardPage,
289
- handleDashboardField,
290
+ toggleDashboardField,
290
291
  deleteFieldHandler
291
292
  }) => {
292
- var _a, _b;
293
- return /* @__PURE__ */ React.createElement(React.Fragment, null, !!triggerFields.length ? /* @__PURE__ */ React.createElement(box.Box, { css: { marginTop: "$20" } }, triggerFields.map((field) => /* @__PURE__ */ React.createElement(
293
+ var _a, _b, _c, _d;
294
+ 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(
294
295
  TriggerDasboardItem,
295
296
  {
296
297
  field,
@@ -299,9 +300,9 @@ const SingleAccountDashboard = ({
299
300
  icon: /* @__PURE__ */ React.createElement(cursor.default, { size: 32, color: "#56B0BB" }),
300
301
  handleEditField,
301
302
  handleDashboardPage,
302
- handleDashboardField
303
+ toggleDashboardField
303
304
  }
304
- ))) : null, !!((_a = mappingFields.fields) == null ? void 0 : _a.length) && mappingFields.type === "MULTI_MAPPING" ? /* @__PURE__ */ React.createElement(box.Box, { css: { marginTop: !triggerFields.length ? "$20" : "$8" } }, mappingFields.fields.map((field) => /* @__PURE__ */ React.createElement(
305
+ ))) : 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(
305
306
  DashboardItem,
306
307
  {
307
308
  icon: /* @__PURE__ */ React.createElement(mapping.default, { size: 32, color: "#56B0BB" }),
@@ -314,10 +315,10 @@ const SingleAccountDashboard = ({
314
315
  handleDashboardPage,
315
316
  handleEditField,
316
317
  type: "MAPPING",
317
- handleDashboardField,
318
+ toggleDashboardField,
318
319
  deleteFieldHandler
319
320
  }
320
- ))) : null, mappingFields.type !== "MULTI_MAPPING" && !!((_b = mappingFields.fields) == null ? void 0 : _b.length) ? /* @__PURE__ */ React.createElement(box.Box, { css: { marginTop: !triggerFields.length ? "$20" : "$8" } }, mappingFields.fields.map((field) => /* @__PURE__ */ React.createElement(
321
+ ))) : 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(
321
322
  SingleMappingDashboardItem,
322
323
  {
323
324
  field,
@@ -326,7 +327,7 @@ const SingleAccountDashboard = ({
326
327
  icon: /* @__PURE__ */ React.createElement(mapping.default, { size: 32, color: "#56B0BB" }),
327
328
  handleEditField,
328
329
  handleDashboardPage,
329
- handleDashboardField
330
+ toggleDashboardField
330
331
  }
331
332
  ))) : null);
332
333
  };
@@ -335,7 +336,7 @@ const TriggerDasboardItem = ({
335
336
  field,
336
337
  handleEditField,
337
338
  handleDashboardPage,
338
- handleDashboardField
339
+ toggleDashboardField
339
340
  }) => {
340
341
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
341
342
  const [isMappingDisplayed, setIsMappingDisplayed] = React.useState(false);
@@ -392,7 +393,7 @@ const TriggerDasboardItem = ({
392
393
  {
393
394
  size: "md",
394
395
  checked: field.isEnabled,
395
- onChange: (value) => handleDashboardField(value, field.id, "TRIGGER")
396
+ onChange: (value) => toggleDashboardField(field.id, value)
396
397
  }
397
398
  ), /* @__PURE__ */ React.createElement(dropdown.DropdownMenu, null, /* @__PURE__ */ React.createElement(dropdown.DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
398
399
  iconButton.IconButton,
@@ -541,7 +542,7 @@ const SingleMappingDashboardItem = ({
541
542
  field,
542
543
  handleEditField,
543
544
  handleDashboardPage,
544
- handleDashboardField
545
+ toggleDashboardField
545
546
  }) => {
546
547
  var _a, _b;
547
548
  const [isMappingDisplayed, setIsMappingDisplayed] = React.useState(false);
@@ -580,7 +581,7 @@ const SingleMappingDashboardItem = ({
580
581
  {
581
582
  size: "md",
582
583
  checked: field.isEnabled,
583
- onChange: (value) => handleDashboardField(value, field.id, "MAPPING")
584
+ onChange: (value) => toggleDashboardField(field.id, value)
584
585
  }
585
586
  ), /* @__PURE__ */ React.createElement(dropdown.DropdownMenu, null, /* @__PURE__ */ React.createElement(dropdown.DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
586
587
  iconButton.IconButton,
@@ -833,7 +834,7 @@ const DashboardItem = ({
833
834
  id,
834
835
  handleDashboardPage,
835
836
  type,
836
- handleDashboardField,
837
+ toggleDashboardField,
837
838
  deleteFieldHandler
838
839
  }) => {
839
840
  const [isMappingDisplayed, setIsMappingDisplayed] = React.useState(false);
@@ -893,7 +894,7 @@ const DashboardItem = ({
893
894
  {
894
895
  size: "md",
895
896
  checked: isEnabled,
896
- onChange: (value) => handleDashboardField(value, id, type)
897
+ onChange: (value) => toggleDashboardField(id, value)
897
898
  }
898
899
  ), /* @__PURE__ */ React.createElement(dropdown.DropdownMenu, null, /* @__PURE__ */ React.createElement(dropdown.DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
899
900
  iconButton.IconButton,
@@ -972,12 +973,15 @@ const DashboardItem = ({
972
973
  {
973
974
  css: {
974
975
  "& tr:last-child": {
975
- borderBottom: 0
976
+ borderBottom: 0,
977
+ "& td": {
978
+ borderBottom: 0
979
+ }
976
980
  }
977
981
  }
978
982
  },
979
983
  fields.map((field) => {
980
- var _a, _b, _c;
984
+ var _a, _b, _c, _d, _e, _f, _g;
981
985
  return /* @__PURE__ */ React.createElement(
982
986
  table.Tr,
983
987
  {
@@ -997,10 +1001,10 @@ const DashboardItem = ({
997
1001
  }
998
1002
  }
999
1003
  },
1000
- /* @__PURE__ */ React.createElement(table.Td, null, (_a = field.mappedType) == null ? void 0 : _a.label),
1001
- /* @__PURE__ */ React.createElement(table.Td, null, (_b = field.surveySparrowField) == null ? void 0 : _b.label),
1002
- /* @__PURE__ */ React.createElement(table.Td, null, (_c = field.integrationField) == null ? void 0 : _c.label),
1003
- /* @__PURE__ */ React.createElement(table.Td, null, getDefaultFieldValue(field.defaultValue))
1004
+ /* @__PURE__ */ React.createElement(table.Td, null, (_b = (_a = field.mappedType) == null ? void 0 : _a.label) != null ? _b : "--"),
1005
+ /* @__PURE__ */ React.createElement(table.Td, null, (_d = (_c = field.surveySparrowField) == null ? void 0 : _c.label) != null ? _d : "--"),
1006
+ /* @__PURE__ */ React.createElement(table.Td, null, (_f = (_e = field.integrationField) == null ? void 0 : _e.label) != null ? _f : "--"),
1007
+ /* @__PURE__ */ React.createElement(table.Td, null, (_g = getDefaultFieldValue(field.defaultValue)) != null ? _g : "--")
1004
1008
  );
1005
1009
  })
1006
1010
  )) : null