@sparrowengg/integrations-templates-frontend 2.1.0-beta.1 → 2.1.0-beta.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 (212) hide show
  1. package/dist/cjs/cascader-dropdown/cascader-dropdown-content.js +1 -1
  2. package/dist/cjs/cascader-dropdown/cascader-dropdown-content.js.map +1 -1
  3. package/dist/cjs/commons/components/NamingModal.js +34 -62
  4. package/dist/cjs/commons/components/NamingModal.js.map +1 -1
  5. package/dist/cjs/commons/components/confirmation-modal.js +12 -24
  6. package/dist/cjs/commons/components/confirmation-modal.js.map +1 -1
  7. package/dist/cjs/commons/components/custom-pill.js +12 -30
  8. package/dist/cjs/commons/components/custom-pill.js.map +1 -1
  9. package/dist/cjs/commons/components/draftModal.js +31 -45
  10. package/dist/cjs/commons/components/draftModal.js.map +1 -1
  11. package/dist/cjs/commons/components/edit-confirmation.js +17 -34
  12. package/dist/cjs/commons/components/edit-confirmation.js.map +1 -1
  13. package/dist/cjs/commons/components/import-modal.js +18 -49
  14. package/dist/cjs/commons/components/import-modal.js.map +1 -1
  15. package/dist/cjs/commons/components/spinner.js +2 -16
  16. package/dist/cjs/commons/components/spinner.js.map +1 -1
  17. package/dist/cjs/commons/components/theme-wrapper.js +12 -9
  18. package/dist/cjs/commons/components/theme-wrapper.js.map +1 -1
  19. package/dist/cjs/commons/constants/enhanced.js.map +1 -1
  20. package/dist/cjs/commons/helpers/index.js +52 -93
  21. package/dist/cjs/commons/helpers/index.js.map +1 -1
  22. package/dist/cjs/commons/icons/arrow.js +3 -38
  23. package/dist/cjs/commons/icons/arrow.js.map +1 -1
  24. package/dist/cjs/commons/icons/cursor.js +8 -21
  25. package/dist/cjs/commons/icons/cursor.js.map +1 -1
  26. package/dist/cjs/commons/icons/email-letter.js +12 -30
  27. package/dist/cjs/commons/icons/email-letter.js.map +1 -1
  28. package/dist/cjs/commons/icons/mapping.js +10 -23
  29. package/dist/cjs/commons/icons/mapping.js.map +1 -1
  30. package/dist/cjs/commons/icons/nested-add.js +14 -32
  31. package/dist/cjs/commons/icons/nested-add.js.map +1 -1
  32. package/dist/cjs/commons/icons/sms.js +18 -36
  33. package/dist/cjs/commons/icons/sms.js.map +1 -1
  34. package/dist/cjs/commons/icons/sync.js +3 -110
  35. package/dist/cjs/commons/icons/sync.js.map +1 -1
  36. package/dist/cjs/commons/icons/trash.js +15 -33
  37. package/dist/cjs/commons/icons/trash.js.map +1 -1
  38. package/dist/cjs/commons/icons/whatsapp.js +31 -49
  39. package/dist/cjs/commons/icons/whatsapp.js.map +1 -1
  40. package/dist/cjs/contact-import/components/ManageImport/Completed.js +41 -27
  41. package/dist/cjs/contact-import/components/ManageImport/Completed.js.map +1 -1
  42. package/dist/cjs/contact-import/components/ManageImport/Dashboard.js +43 -23
  43. package/dist/cjs/contact-import/components/ManageImport/Dashboard.js.map +1 -1
  44. package/dist/cjs/contact-import/components/ManageImport/NoDataState.js +6 -7
  45. package/dist/cjs/contact-import/components/ManageImport/NoDataState.js.map +1 -1
  46. package/dist/cjs/contact-import/components/ManageImport/Scheduled.js +46 -30
  47. package/dist/cjs/contact-import/components/ManageImport/Scheduled.js.map +1 -1
  48. package/dist/cjs/contact-import/components/ManageImport/icon.js +85 -0
  49. package/dist/cjs/contact-import/components/ManageImport/icon.js.map +1 -0
  50. package/dist/cjs/contact-import/components/Scheduling.js +27 -39
  51. package/dist/cjs/contact-import/components/Scheduling.js.map +1 -1
  52. package/dist/cjs/contact-import/components/TimePicker.js +102 -129
  53. package/dist/cjs/contact-import/components/TimePicker.js.map +1 -1
  54. package/dist/cjs/contact-import/components/conact-import-schedule.js +64 -0
  55. package/dist/cjs/contact-import/components/conact-import-schedule.js.map +1 -0
  56. package/dist/cjs/contact-import/components/contact-import-configure.js +75 -0
  57. package/dist/cjs/contact-import/components/contact-import-configure.js.map +1 -0
  58. package/dist/cjs/contact-import/components/contact-import-mapping.js +224 -0
  59. package/dist/cjs/contact-import/components/contact-import-mapping.js.map +1 -0
  60. package/dist/cjs/contact-import/constants.js +21 -0
  61. package/dist/cjs/contact-import/constants.js.map +1 -0
  62. package/dist/cjs/contact-import/index.js +242 -32
  63. package/dist/cjs/contact-import/index.js.map +1 -1
  64. package/dist/cjs/dynamic-mapping/components/Mapping.js +321 -203
  65. package/dist/cjs/dynamic-mapping/components/Mapping.js.map +1 -1
  66. package/dist/cjs/dynamic-mapping/index.js +972 -34
  67. package/dist/cjs/dynamic-mapping/index.js.map +1 -1
  68. package/dist/cjs/filter/filter-pill-value-selector.js +1 -1
  69. package/dist/cjs/filter/filter-pill-value-selector.js.map +1 -1
  70. package/dist/cjs/index.js +12 -159
  71. package/dist/cjs/index.js.map +1 -1
  72. package/dist/cjs/integration-template/components/dashboard.js +137 -130
  73. package/dist/cjs/integration-template/components/dashboard.js.map +1 -1
  74. package/dist/cjs/integration-template/index.js +343 -0
  75. package/dist/cjs/integration-template/index.js.map +1 -0
  76. package/dist/cjs/mapping/components/custom-menu.js +3 -4
  77. package/dist/cjs/mapping/components/custom-menu.js.map +1 -1
  78. package/dist/cjs/mapping/components/field.js +103 -121
  79. package/dist/cjs/mapping/components/field.js.map +1 -1
  80. package/dist/cjs/mapping/components/mapping.js +195 -106
  81. package/dist/cjs/mapping/components/mapping.js.map +1 -1
  82. package/dist/cjs/mapping/constants/index.js +2 -259
  83. package/dist/cjs/mapping/constants/index.js.map +1 -1
  84. package/dist/cjs/mapping/index.js +618 -38
  85. package/dist/cjs/mapping/index.js.map +1 -1
  86. package/dist/cjs/mapping/services/index.js +58 -96
  87. package/dist/cjs/mapping/services/index.js.map +1 -1
  88. package/dist/cjs/node_modules/@sparrowengg/twigs-react/dist/es/node_modules/@radix-ui/react-menu/dist/index.js +7 -7
  89. package/dist/cjs/single-mapping/components/mapping.js +490 -0
  90. package/dist/cjs/single-mapping/components/mapping.js.map +1 -0
  91. package/dist/cjs/single-mapping/index.js +987 -59
  92. package/dist/cjs/single-mapping/index.js.map +1 -1
  93. package/dist/cjs/triggers/components/subcomponents.js +1140 -0
  94. package/dist/cjs/triggers/components/subcomponents.js.map +1 -0
  95. package/dist/cjs/triggers/components/trigger.js +491 -0
  96. package/dist/cjs/triggers/components/trigger.js.map +1 -0
  97. package/dist/cjs/triggers/constants/index.js +0 -253
  98. package/dist/cjs/triggers/constants/index.js.map +1 -1
  99. package/dist/cjs/triggers/index.js +333 -0
  100. package/dist/cjs/triggers/index.js.map +1 -0
  101. package/dist/cjs/triggers/services/index.js +30 -0
  102. package/dist/cjs/triggers/services/index.js.map +1 -0
  103. package/dist/es/cascader-dropdown/cascader-dropdown-content.js +1 -1
  104. package/dist/es/cascader-dropdown/cascader-dropdown-content.js.map +1 -1
  105. package/dist/es/commons/components/NamingModal.js +35 -63
  106. package/dist/es/commons/components/NamingModal.js.map +1 -1
  107. package/dist/es/commons/components/confirmation-modal.js +13 -25
  108. package/dist/es/commons/components/confirmation-modal.js.map +1 -1
  109. package/dist/es/commons/components/custom-pill.js +13 -31
  110. package/dist/es/commons/components/custom-pill.js.map +1 -1
  111. package/dist/es/commons/components/draftModal.js +32 -46
  112. package/dist/es/commons/components/draftModal.js.map +1 -1
  113. package/dist/es/commons/components/edit-confirmation.js +18 -35
  114. package/dist/es/commons/components/edit-confirmation.js.map +1 -1
  115. package/dist/es/commons/components/import-modal.js +19 -50
  116. package/dist/es/commons/components/import-modal.js.map +1 -1
  117. package/dist/es/commons/components/spinner.js +2 -16
  118. package/dist/es/commons/components/spinner.js.map +1 -1
  119. package/dist/es/commons/components/theme-wrapper.js +12 -9
  120. package/dist/es/commons/components/theme-wrapper.js.map +1 -1
  121. package/dist/es/commons/constants/enhanced.js.map +1 -1
  122. package/dist/es/commons/helpers/index.js +52 -93
  123. package/dist/es/commons/helpers/index.js.map +1 -1
  124. package/dist/es/commons/icons/arrow.js +3 -38
  125. package/dist/es/commons/icons/arrow.js.map +1 -1
  126. package/dist/es/commons/icons/cursor.js +8 -21
  127. package/dist/es/commons/icons/cursor.js.map +1 -1
  128. package/dist/es/commons/icons/email-letter.js +12 -30
  129. package/dist/es/commons/icons/email-letter.js.map +1 -1
  130. package/dist/es/commons/icons/mapping.js +10 -23
  131. package/dist/es/commons/icons/mapping.js.map +1 -1
  132. package/dist/es/commons/icons/nested-add.js +14 -32
  133. package/dist/es/commons/icons/nested-add.js.map +1 -1
  134. package/dist/es/commons/icons/sms.js +18 -36
  135. package/dist/es/commons/icons/sms.js.map +1 -1
  136. package/dist/es/commons/icons/sync.js +3 -110
  137. package/dist/es/commons/icons/sync.js.map +1 -1
  138. package/dist/es/commons/icons/trash.js +15 -33
  139. package/dist/es/commons/icons/trash.js.map +1 -1
  140. package/dist/es/commons/icons/whatsapp.js +31 -49
  141. package/dist/es/commons/icons/whatsapp.js.map +1 -1
  142. package/dist/es/contact-import/components/ManageImport/Completed.js +41 -27
  143. package/dist/es/contact-import/components/ManageImport/Completed.js.map +1 -1
  144. package/dist/es/contact-import/components/ManageImport/Dashboard.js +45 -25
  145. package/dist/es/contact-import/components/ManageImport/Dashboard.js.map +1 -1
  146. package/dist/es/contact-import/components/ManageImport/NoDataState.js +4 -5
  147. package/dist/es/contact-import/components/ManageImport/NoDataState.js.map +1 -1
  148. package/dist/es/contact-import/components/ManageImport/Scheduled.js +46 -30
  149. package/dist/es/contact-import/components/ManageImport/Scheduled.js.map +1 -1
  150. package/dist/es/contact-import/components/ManageImport/icon.js +82 -0
  151. package/dist/es/contact-import/components/ManageImport/icon.js.map +1 -0
  152. package/dist/es/contact-import/components/Scheduling.js +27 -39
  153. package/dist/es/contact-import/components/Scheduling.js.map +1 -1
  154. package/dist/es/contact-import/components/TimePicker.js +103 -130
  155. package/dist/es/contact-import/components/TimePicker.js.map +1 -1
  156. package/dist/es/contact-import/components/conact-import-schedule.js +60 -0
  157. package/dist/es/contact-import/components/conact-import-schedule.js.map +1 -0
  158. package/dist/es/contact-import/components/contact-import-configure.js +71 -0
  159. package/dist/es/contact-import/components/contact-import-configure.js.map +1 -0
  160. package/dist/es/contact-import/components/contact-import-mapping.js +220 -0
  161. package/dist/es/contact-import/components/contact-import-mapping.js.map +1 -0
  162. package/dist/es/contact-import/constants.js +18 -0
  163. package/dist/es/contact-import/constants.js.map +1 -0
  164. package/dist/es/contact-import/index.js +240 -27
  165. package/dist/es/contact-import/index.js.map +1 -1
  166. package/dist/es/dynamic-mapping/components/Mapping.js +321 -203
  167. package/dist/es/dynamic-mapping/components/Mapping.js.map +1 -1
  168. package/dist/es/dynamic-mapping/index.js +972 -34
  169. package/dist/es/dynamic-mapping/index.js.map +1 -1
  170. package/dist/es/filter/filter-pill-value-selector.js +1 -1
  171. package/dist/es/filter/filter-pill-value-selector.js.map +1 -1
  172. package/dist/es/index.js +2 -23
  173. package/dist/es/index.js.map +1 -1
  174. package/dist/es/integration-template/components/dashboard.js +139 -132
  175. package/dist/es/integration-template/components/dashboard.js.map +1 -1
  176. package/dist/es/integration-template/index.js +341 -0
  177. package/dist/es/integration-template/index.js.map +1 -0
  178. package/dist/es/mapping/components/custom-menu.js +3 -4
  179. package/dist/es/mapping/components/custom-menu.js.map +1 -1
  180. package/dist/es/mapping/components/field.js +100 -118
  181. package/dist/es/mapping/components/field.js.map +1 -1
  182. package/dist/es/mapping/components/mapping.js +194 -105
  183. package/dist/es/mapping/components/mapping.js.map +1 -1
  184. package/dist/es/mapping/constants/index.js +3 -239
  185. package/dist/es/mapping/constants/index.js.map +1 -1
  186. package/dist/es/mapping/index.js +617 -12
  187. package/dist/es/mapping/index.js.map +1 -1
  188. package/dist/es/mapping/services/index.js +59 -96
  189. package/dist/es/mapping/services/index.js.map +1 -1
  190. package/dist/es/node_modules/@internationalized/date/dist/CalendarDate.js +3 -3
  191. package/dist/es/node_modules/@sparrowengg/twigs-react/dist/es/dialog/dialog.js +1 -1
  192. package/dist/es/node_modules/@sparrowengg/twigs-react/dist/es/dropdown/dropdown.js +2 -2
  193. package/dist/es/node_modules/@sparrowengg/twigs-react/dist/es/node_modules/@radix-ui/react-dropdown-menu/dist/index.js +1 -1
  194. package/dist/es/node_modules/@sparrowengg/twigs-react/dist/es/node_modules/@react-aria/calendar/dist/import.js +2 -2
  195. package/dist/es/node_modules/@sparrowengg/twigs-react/dist/es/node_modules/@react-aria/utils/dist/import.js +1 -1
  196. package/dist/es/node_modules/@sparrowengg/twigs-react/dist/es/node_modules/@react-stately/calendar/dist/import.js +1 -1
  197. package/dist/es/single-mapping/components/mapping.js +486 -0
  198. package/dist/es/single-mapping/components/mapping.js.map +1 -0
  199. package/dist/es/single-mapping/index.js +988 -60
  200. package/dist/es/single-mapping/index.js.map +1 -1
  201. package/dist/es/triggers/components/subcomponents.js +1134 -0
  202. package/dist/es/triggers/components/subcomponents.js.map +1 -0
  203. package/dist/es/triggers/components/trigger.js +487 -0
  204. package/dist/es/triggers/components/trigger.js.map +1 -0
  205. package/dist/es/triggers/constants/index.js +1 -228
  206. package/dist/es/triggers/constants/index.js.map +1 -1
  207. package/dist/es/triggers/index.js +331 -0
  208. package/dist/es/triggers/index.js.map +1 -0
  209. package/dist/es/triggers/services/index.js +28 -0
  210. package/dist/es/triggers/services/index.js.map +1 -0
  211. package/dist/index.d.ts +448 -2161
  212. package/package.json +1 -1
@@ -1,17 +1,55 @@
1
1
  'use strict';
2
2
 
3
+ var string = require('../node_modules/@internationalized/date/dist/string.js');
4
+ var editConfirmation = require('../commons/components/edit-confirmation.js');
3
5
  var React = require('react');
4
- var index$1 = require('../commons/constants/index.js');
5
- var MappingHeader = require('./components/MappingHeader.js');
6
- var ConfigurationSetup = require('./components/ConfigurationSetup.js');
7
- var MappingContent = require('./components/MappingContent.js');
8
- var useEditMode = require('./hooks/useEditMode.js');
9
- var index = require('./constants/index.js');
6
+ var arrow = require('../commons/icons/arrow.js');
7
+ var mapping = require('./components/mapping.js');
8
+ var index = require('../commons/constants/index.js');
9
+ var dayjs_min = require('../node_modules/dayjs/dayjs.min.js');
10
10
  var themeProvider = require('../node_modules/@sparrowengg/twigs-react/dist/es/theme-provider/theme-provider.js');
11
11
  var tooltip = require('../node_modules/@sparrowengg/twigs-react/dist/es/tooltip/tooltip.js');
12
12
  var box = require('../node_modules/@sparrowengg/twigs-react/dist/es/box/box.js');
13
13
  var flex = require('../node_modules/@sparrowengg/twigs-react/dist/es/flex/flex.js');
14
+ var iconButton = require('../node_modules/@sparrowengg/twigs-react/dist/es/button/icon-button.js');
15
+ var arrowLeft = require('../node_modules/@sparrowengg/twigs-react-icons/dist/es/icons/arrow-left.js');
16
+ var heading = require('../node_modules/@sparrowengg/twigs-react/dist/es/heading/heading.js');
17
+ var button = require('../node_modules/@sparrowengg/twigs-react/dist/es/button/button.js');
18
+ var text = require('../node_modules/@sparrowengg/twigs-react/dist/es/text/text.js');
19
+ var dropdown = require('../node_modules/@sparrowengg/twigs-react/dist/es/dropdown/dropdown.js');
20
+ var input = require('../node_modules/@sparrowengg/twigs-react/dist/es/input/input.js');
21
+ var chevronDown = require('../node_modules/@sparrowengg/twigs-react-icons/dist/es/icons/chevron-down.js');
22
+ var calendar = require('../node_modules/@sparrowengg/twigs-react/dist/es/calendar/calendar.js');
23
+ var radio = require('../node_modules/@sparrowengg/twigs-react/dist/es/radio/radio.js');
24
+ var formLabel = require('../node_modules/@sparrowengg/twigs-react/dist/es/form-label/form-label.js');
25
+ var formInput = require('../node_modules/@sparrowengg/twigs-react/dist/es/input/form-input.js');
26
+ var checkbox = require('../node_modules/@sparrowengg/twigs-react/dist/es/checkbox/checkbox.js');
27
+ var _switch = require('../node_modules/@sparrowengg/twigs-react/dist/es/switch/switch.js');
28
+ var select = require('../node_modules/@sparrowengg/twigs-react/dist/es/select/select.js');
29
+ var indexA301f526_esm = require('../node_modules/react-select/dist/index-a301f526.esm.js');
30
+ var plus = require('../node_modules/@sparrowengg/twigs-react-icons/dist/es/icons/plus.js');
31
+ var chip = require('../node_modules/@sparrowengg/twigs-react/dist/es/chip/chip.js');
32
+ var tickCircleFill = require('../node_modules/@sparrowengg/twigs-react-icons/dist/es/icons/tick-circle-fill.js');
14
33
 
34
+ var __defProp = Object.defineProperty;
35
+ var __defProps = Object.defineProperties;
36
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
37
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
38
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
39
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
40
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
41
+ var __spreadValues = (a, b) => {
42
+ for (var prop in b || (b = {}))
43
+ if (__hasOwnProp.call(b, prop))
44
+ __defNormalProp(a, prop, b[prop]);
45
+ if (__getOwnPropSymbols)
46
+ for (var prop of __getOwnPropSymbols(b)) {
47
+ if (__propIsEnum.call(b, prop))
48
+ __defNormalProp(a, prop, b[prop]);
49
+ }
50
+ return a;
51
+ };
52
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
15
53
  const SingleMapping = ({
16
54
  integrationFields,
17
55
  configuration,
@@ -19,27 +57,14 @@ const SingleMapping = ({
19
57
  navigateMappingPage,
20
58
  setIntegrationFields,
21
59
  token,
22
- apiURL = index$1.surveySparrowURL,
60
+ apiURL = index.surveySparrowURL,
23
61
  surveyDetails,
24
- importResponse,
62
+ importResponse: importResponse2,
25
63
  hasExistingMapping,
26
64
  onSaveHandler,
27
65
  editField,
28
66
  previousMappingHandler
29
67
  }) => {
30
- const [isEditConfirmationOpen, setIsEditConfirmationOpen] = React.useState(false);
31
- const {
32
- originalMappingData,
33
- setOriginalMappingData,
34
- isInitialLoad,
35
- setIsInitialLoad,
36
- hasFieldsChanged
37
- } = useEditMode.useEditMode({
38
- editField,
39
- importResponse,
40
- configuration,
41
- navigateMappingPage
42
- });
43
68
  const [ssMappingData, setSSMappingData] = React.useState({
44
69
  questions: [],
45
70
  variables: [],
@@ -48,57 +73,960 @@ const SingleMapping = ({
48
73
  property: [],
49
74
  derivedQuestions: []
50
75
  });
51
- return /* @__PURE__ */ React.createElement(themeProvider.ThemeProvider, { theme: index.THEME_CONFIG }, /* @__PURE__ */ React.createElement(tooltip.TooltipProvider, null, /* @__PURE__ */ React.createElement(box.Box, { css: { width: "100%" } }, /* @__PURE__ */ React.createElement(
52
- MappingHeader.MappingHeader,
76
+ const [isEditConfirmationOpen, setIsEditConfirmationOpen] = React.useState(false);
77
+ const [originalMappingData, setOriginalMappingData] = React.useState(null);
78
+ const [originalConfigurationFields, setOriginalConfigurationFields] = React.useState(null);
79
+ const [originalConfiguredFields, setOriginalConfiguredFields] = React.useState(null);
80
+ const [originalImportResponse, setOriginalImportResponse] = React.useState(null);
81
+ const [isInitialLoad, setIsInitialLoad] = React.useState(true);
82
+ React.useEffect(() => {
83
+ if (!!(editField == null ? void 0 : editField.id)) {
84
+ navigateMappingPage(true);
85
+ setOriginalConfigurationFields(
86
+ JSON.parse(JSON.stringify(configuration.configurationFields))
87
+ );
88
+ setOriginalConfiguredFields(
89
+ JSON.parse(JSON.stringify(configuration.configuredFields))
90
+ );
91
+ setOriginalImportResponse(JSON.parse(JSON.stringify(importResponse2)));
92
+ }
93
+ }, []);
94
+ const hasFieldsChanged = () => {
95
+ if (!(editField == null ? void 0 : editField.id) || !originalMappingData)
96
+ return true;
97
+ const mappingDataChanged = JSON.stringify(ssMappingData) !== JSON.stringify(originalMappingData);
98
+ JSON.stringify(JSON.parse(JSON.stringify(importResponse2))) !== JSON.stringify(originalImportResponse);
99
+ const configFieldsChanged = JSON.stringify(configuration.configurationFields) !== JSON.stringify(originalConfigurationFields);
100
+ const configuredFieldsChanged = JSON.stringify(configuration.configuredFields) !== JSON.stringify(originalConfiguredFields);
101
+ return configFieldsChanged || configuredFieldsChanged || !isInitialLoad && mappingDataChanged;
102
+ };
103
+ return /* @__PURE__ */ React.createElement(
104
+ themeProvider.ThemeProvider,
53
105
  {
54
- isEditConfirmationOpen,
55
- setIsEditConfirmationOpen,
56
- editField,
57
- importResponse,
58
- ssMappingData,
59
- configuration,
60
- hasFieldsChanged: hasFieldsChanged(ssMappingData),
61
- saveConfiguration: configuration.onSaveHandler,
62
- isMappingPage,
63
- hasExistingMapping,
64
- navigateConfigPage: () => navigateMappingPage(false),
65
- previousMappingHandler,
66
- onSaveHandler: () => {
67
- onSaveHandler((editField == null ? void 0 : editField.id) ? editField : {});
106
+ theme: {
107
+ fonts: {
108
+ body: "DM Sans, Roboto Mono, sans-serif",
109
+ heading: "DM Sans, Roboto Mono, sans-serif"
110
+ }
111
+ }
112
+ },
113
+ /* @__PURE__ */ React.createElement(tooltip.TooltipProvider, null, /* @__PURE__ */ React.createElement(box.Box, { css: { width: "100%" } }, /* @__PURE__ */ React.createElement(
114
+ MappingHeader,
115
+ {
116
+ isEditConfirmationOpen,
117
+ setIsEditConfirmationOpen,
118
+ editField,
119
+ importResponse: importResponse2,
120
+ ssMappingData,
121
+ configuration,
122
+ hasFieldsChanged: hasFieldsChanged(),
123
+ saveConfiguration: () => {
124
+ configuration.onSaveHandler();
125
+ },
126
+ isMappingPage,
127
+ hasExistingMapping,
128
+ navigateConfigPage: () => navigateMappingPage(false),
129
+ previousMappingHandler,
130
+ onSaveHandler: () => {
131
+ onSaveHandler((editField == null ? void 0 : editField.id) ? editField : {});
132
+ }
133
+ }
134
+ ), !isMappingPage && configuration.hasConfiguration ? /* @__PURE__ */ React.createElement(
135
+ flex.Flex,
136
+ {
137
+ justifyContent: "center",
138
+ alignItems: "center",
139
+ css: { marginTop: "$40" }
140
+ },
141
+ /* @__PURE__ */ React.createElement(
142
+ ConfigurationSetup,
143
+ {
144
+ configuration,
145
+ surveyName: surveyDetails.surveyName,
146
+ editField
147
+ }
148
+ )
149
+ ) : /* @__PURE__ */ React.createElement(
150
+ mapping.default,
151
+ {
152
+ setOriginalMappingData,
153
+ integrationFields,
154
+ setIntegrationFields,
155
+ token,
156
+ setIsInitialLoad,
157
+ apiURL,
158
+ surveyId: surveyDetails.surveyId,
159
+ surveyProperties: surveyDetails.surveyProperties,
160
+ importResponse: importResponse2,
161
+ ssMappingData,
162
+ setSSMappingData,
163
+ editField
164
+ }
165
+ )))
166
+ );
167
+ };
168
+ const MappingHeader = ({
169
+ isEditConfirmationOpen,
170
+ editField,
171
+ importResponse: importResponse2,
172
+ hasExistingMapping,
173
+ ssMappingData,
174
+ isMappingPage,
175
+ navigateConfigPage,
176
+ onSaveHandler,
177
+ previousMappingHandler,
178
+ saveConfiguration,
179
+ configuration,
180
+ setIsEditConfirmationOpen,
181
+ hasFieldsChanged
182
+ }) => {
183
+ const isButtonDisabled = () => {
184
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
185
+ if (isMappingPage) {
186
+ if (editField == null ? void 0 : editField.id) {
187
+ return !hasFieldsChanged;
188
+ }
189
+ if (((_a = importResponse2 == null ? void 0 : importResponse2.value) == null ? void 0 : _a.ImportMethod) === "SEND_ALL_DATA") {
190
+ return !(((_b = ssMappingData == null ? void 0 : ssMappingData.questions) == null ? void 0 : _b.length) || ((_c = ssMappingData == null ? void 0 : ssMappingData.variables) == null ? void 0 : _c.length) || ((_d = ssMappingData == null ? void 0 : ssMappingData.contactProperties) == null ? void 0 : _d.length) || ((_e = ssMappingData == null ? void 0 : ssMappingData.expressions) == null ? void 0 : _e.length) || ((_f = ssMappingData == null ? void 0 : ssMappingData.property) == null ? void 0 : _f.length) || ((_g = ssMappingData == null ? void 0 : ssMappingData.derivedQuestions) == null ? void 0 : _g.length));
191
+ } else {
192
+ const isMappingDisabled = ((_h = ssMappingData == null ? void 0 : ssMappingData.questions) == null ? void 0 : _h.some((question) => question.isEnabled)) || ((_i = ssMappingData == null ? void 0 : ssMappingData.variables) == null ? void 0 : _i.some((variable) => variable.isEnabled)) || ((_j = ssMappingData == null ? void 0 : ssMappingData.contactProperties) == null ? void 0 : _j.some(
193
+ (property) => property.isEnabled
194
+ )) || ((_k = ssMappingData == null ? void 0 : ssMappingData.expressions) == null ? void 0 : _k.some(
195
+ (expression) => expression.isEnabled
196
+ )) || ((_l = ssMappingData == null ? void 0 : ssMappingData.derivedQuestions) == null ? void 0 : _l.some(
197
+ (derivedQuestion) => derivedQuestion.isEnabled
198
+ )) || ((_m = ssMappingData == null ? void 0 : ssMappingData.property) == null ? void 0 : _m.some((property) => property.isEnabled));
199
+ return !isMappingDisabled;
200
+ }
201
+ } else {
202
+ const isAllFieldsDisabled = (_n = Object.values(
203
+ (configuration == null ? void 0 : configuration.configurationFields) || {}
204
+ )) == null ? void 0 : _n.some(
205
+ (field) => (field == null ? void 0 : field.value) === null || (field == null ? void 0 : field.value) === void 0
206
+ );
207
+ if ((_p = (_o = configuration == null ? void 0 : configuration.configurationFields) == null ? void 0 : _o.find(
208
+ (field) => (field == null ? void 0 : field.id) === "responseImportSettings"
209
+ )) == null ? void 0 : _p.value) {
210
+ return isAllFieldsDisabled || !((_q = configuration == null ? void 0 : configuration.configuredFields) == null ? void 0 : _q.responseImportType);
211
+ } else {
212
+ return isAllFieldsDisabled;
68
213
  }
69
214
  }
70
- ), !isMappingPage && configuration.hasConfiguration ? /* @__PURE__ */ React.createElement(
215
+ };
216
+ const isMappingPageDisabled = () => {
217
+ var _a, _b, _c, _d;
218
+ const isAllFieldsDisabled = (_a = Object.values(
219
+ (configuration == null ? void 0 : configuration.configurationFields) || {}
220
+ )) == null ? void 0 : _a.some(
221
+ (field) => (field == null ? void 0 : field.value) === null || (field == null ? void 0 : field.value) === void 0
222
+ );
223
+ if ((_c = (_b = configuration == null ? void 0 : configuration.configurationFields) == null ? void 0 : _b.find(
224
+ (field) => (field == null ? void 0 : field.id) === "responseImportSettings"
225
+ )) == null ? void 0 : _c.value) {
226
+ return isAllFieldsDisabled || !((_d = configuration == null ? void 0 : configuration.configuredFields) == null ? void 0 : _d.responseImportType);
227
+ } else {
228
+ return isAllFieldsDisabled;
229
+ }
230
+ };
231
+ return /* @__PURE__ */ React.createElement(
71
232
  flex.Flex,
72
233
  {
73
- justifyContent: "center",
74
234
  alignItems: "center",
75
- css: { marginTop: "$40" }
235
+ justifyContent: "space-between",
236
+ css: {
237
+ borderBottom: "$borderWidths$xs solid $neutral200",
238
+ padding: "$8 $12"
239
+ }
76
240
  },
77
241
  /* @__PURE__ */ React.createElement(
78
- ConfigurationSetup.ConfigurationSetup,
242
+ flex.Flex,
79
243
  {
80
- configuration,
81
- surveyName: surveyDetails.surveyName,
82
- editField
244
+ gap: "$6",
245
+ alignItems: "center",
246
+ css: { visibility: hasExistingMapping ? "visible" : "hidden" }
247
+ },
248
+ /* @__PURE__ */ React.createElement(
249
+ iconButton.IconButton,
250
+ {
251
+ onClick: () => previousMappingHandler == null ? void 0 : previousMappingHandler(),
252
+ color: "default",
253
+ icon: /* @__PURE__ */ React.createElement(arrowLeft.ArrowLeftIcon, null),
254
+ size: "lg"
255
+ }
256
+ ),
257
+ /* @__PURE__ */ React.createElement(heading.Heading, { size: "h6" }, (editField == null ? void 0 : editField.id) ? "Edit Mapping" : "New Mapping")
258
+ ),
259
+ /* @__PURE__ */ React.createElement(
260
+ flex.Flex,
261
+ {
262
+ alignItems: "center",
263
+ gap: "$4",
264
+ css: {
265
+ "& button": { background: "transparent !important", fontSize: "$md" }
266
+ }
267
+ },
268
+ /* @__PURE__ */ React.createElement(
269
+ button.Button,
270
+ {
271
+ css: { color: !isMappingPage ? "$neutral900" : "$neutral800" },
272
+ color: "default",
273
+ variant: "ghost",
274
+ size: "md",
275
+ onClick: () => isMappingPage && navigateConfigPage()
276
+ },
277
+ "Configuration"
278
+ ),
279
+ /* @__PURE__ */ React.createElement(arrow.default, null),
280
+ /* @__PURE__ */ React.createElement(
281
+ button.Button,
282
+ {
283
+ disabled: isMappingPageDisabled(),
284
+ css: {
285
+ color: isMappingPage ? "$neutral900" : "$neutral800",
286
+ cursor: isMappingPageDisabled() ? "not-allowed" : "pointer"
287
+ },
288
+ color: "default",
289
+ variant: "ghost",
290
+ onClick: () => {
291
+ if (isMappingPage) {
292
+ onSaveHandler({});
293
+ } else {
294
+ saveConfiguration();
295
+ }
296
+ },
297
+ size: "md"
298
+ },
299
+ "Mapping"
300
+ )
301
+ ),
302
+ /* @__PURE__ */ React.createElement(
303
+ flex.Flex,
304
+ {
305
+ justifyContent: "end",
306
+ css: {
307
+ width: "180px"
308
+ }
309
+ },
310
+ /* @__PURE__ */ React.createElement(
311
+ button.Button,
312
+ {
313
+ size: "lg",
314
+ disabled: isButtonDisabled(),
315
+ onClick: () => {
316
+ if (isMappingPage) {
317
+ if (editField == null ? void 0 : editField.id) {
318
+ setIsEditConfirmationOpen(true);
319
+ } else {
320
+ onSaveHandler({});
321
+ }
322
+ } else {
323
+ saveConfiguration();
324
+ }
325
+ }
326
+ },
327
+ isMappingPage ? (editField == null ? void 0 : editField.id) ? "Update Mapping" : "Save Mapping" : "Continue, Mapping"
328
+ )
329
+ ),
330
+ isEditConfirmationOpen && /* @__PURE__ */ React.createElement(
331
+ editConfirmation.default,
332
+ {
333
+ name: "Are you sure?",
334
+ description: "Saving this updated mapping properties will generate new sheet with the revised mapping.",
335
+ onConfirm: async () => {
336
+ await onSaveHandler({});
337
+ setIsEditConfirmationOpen(false);
338
+ },
339
+ onCancel: () => {
340
+ setIsEditConfirmationOpen(false);
341
+ }
83
342
  }
84
343
  )
85
- ) : /* @__PURE__ */ React.createElement(
86
- MappingContent.MappingContent,
344
+ );
345
+ };
346
+ const ConfigurationSetup = ({
347
+ configuration,
348
+ surveyName,
349
+ editField
350
+ }) => {
351
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
352
+ return /* @__PURE__ */ React.createElement(box.Box, { css: { maxWidth: 488, width: "100%" } }, /* @__PURE__ */ React.createElement(heading.Heading, { size: "h5" }, "Event Details"), /* @__PURE__ */ React.createElement(flex.Flex, { gap: "$2", css: { marginTop: "$4" } }, /* @__PURE__ */ React.createElement(text.Text, { size: "sm", css: { color: "$neutral500" } }, "Survey Name:"), /* @__PURE__ */ React.createElement(
353
+ tooltip.Tooltip,
87
354
  {
88
- setOriginalMappingData,
89
- integrationFields,
90
- setIntegrationFields,
91
- token,
92
- setIsInitialLoad,
93
- apiURL,
94
- surveyId: surveyDetails.surveyId,
95
- surveyProperties: surveyDetails.surveyProperties,
96
- importResponse,
97
- ssMappingData,
98
- setSSMappingData,
99
- editField
355
+ content: (surveyName == null ? void 0 : surveyName.length) > 25 ? surveyName : "",
356
+ css: {
357
+ zIndex: "9999999 !important",
358
+ fontFamily: "DM Sans !important"
359
+ }
360
+ },
361
+ /* @__PURE__ */ React.createElement(box.Box, null, /* @__PURE__ */ React.createElement(
362
+ text.Text,
363
+ {
364
+ size: "sm",
365
+ weight: "medium",
366
+ truncate: true,
367
+ css: { color: "$neutral800", maxWidth: "270px" }
368
+ },
369
+ surveyName
370
+ ))
371
+ )), /* @__PURE__ */ React.createElement(
372
+ flex.Flex,
373
+ {
374
+ flexDirection: "column",
375
+ gap: "$8",
376
+ css: {
377
+ marginTop: "$12",
378
+ "& label": {
379
+ color: "$neutral800"
380
+ }
381
+ }
382
+ },
383
+ (_a = configuration.configurationFields) == null ? void 0 : _a.map((field) => {
384
+ return /* @__PURE__ */ React.createElement(
385
+ Configuration,
386
+ {
387
+ field,
388
+ configuredFields: configuration.configuredFields
389
+ }
390
+ );
391
+ }),
392
+ configuration.importOptions.showImportOptions && /* @__PURE__ */ React.createElement(
393
+ flex.Flex,
394
+ {
395
+ gap: "$2",
396
+ flexDirection: "column",
397
+ css: {
398
+ marginTop: "-4px !important"
399
+ }
400
+ },
401
+ /* @__PURE__ */ React.createElement(
402
+ CustomDropdown,
403
+ {
404
+ editField,
405
+ data: configuration.importOptions.options,
406
+ value: (_d = (_c = (_b = configuration == null ? void 0 : configuration.configuredFields) == null ? void 0 : _b.responseImportType) == null ? void 0 : _c.value) != null ? _d : configuration.importOptions.options[0],
407
+ onChangeHandler: configuration.importOptions.onChangeHandler
408
+ }
409
+ )
410
+ ),
411
+ ((_g = (_f = (_e = configuration.configuredFields) == null ? void 0 : _e.responseImportType) == null ? void 0 : _f.value) == null ? void 0 : _g.type) === "date" && /* @__PURE__ */ React.createElement(
412
+ text.Text,
413
+ {
414
+ size: "sm",
415
+ weight: "regular",
416
+ css: { color: "$neutral600", marginTop: "-$6" }
417
+ },
418
+ `Existing responses from ${(_j = (_i = (_h = configuration.configuredFields) == null ? void 0 : _h.responseImportType) == null ? void 0 : _i.value) == null ? void 0 : _j.value} will be imported`
419
+ ),
420
+ configuration.importOptions.excludeResponse && ((_m = (_l = (_k = configuration.configuredFields) == null ? void 0 : _k.responseImportType) == null ? void 0 : _l.value) == null ? void 0 : _m.type) === "dateRange" && /* @__PURE__ */ React.createElement(
421
+ Configuration,
422
+ {
423
+ field: configuration.importOptions.excludeResponse,
424
+ configuredFields: configuration.configuredFields,
425
+ responseImportType: (_q = (_p = (_o = (_n = configuration.configuredFields) == null ? void 0 : _n.responseImportType) == null ? void 0 : _o.value) == null ? void 0 : _p.value) == null ? void 0 : _q.label
426
+ }
427
+ )
428
+ ));
429
+ };
430
+ const CustomDropdown = ({ data, onChangeHandler, value, editField }) => {
431
+ var _a, _b, _c, _d, _e;
432
+ const [date, setDate] = React.useState(() => {
433
+ try {
434
+ return value ? string.parseDate(dayjs_min.default(value).format("YYYY-MM-DD")) : string.parseDate(dayjs_min.default().format("YYYY-MM-DD"));
435
+ } catch (e) {
436
+ return string.parseDate(dayjs_min.default().format("YYYY-MM-DD"));
437
+ }
438
+ });
439
+ const [days, setDays] = React.useState((_b = (_a = value == null ? void 0 : value.value) == null ? void 0 : _a.value) != null ? _b : 0);
440
+ const [open, setOpen] = React.useState(false);
441
+ const [hasBeenOpened, setHasBeenOpened] = React.useState(false);
442
+ React.useEffect(() => {
443
+ if (!(editField == null ? void 0 : editField.id) && !hasBeenOpened) {
444
+ setOpen(true);
445
+ setHasBeenOpened(true);
100
446
  }
101
- ))));
447
+ }, [editField == null ? void 0 : editField.id, hasBeenOpened]);
448
+ return /* @__PURE__ */ React.createElement(dropdown.DropdownMenu, { open, onOpenChange: setOpen, modal: false }, /* @__PURE__ */ React.createElement(dropdown.DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(
449
+ input.Input,
450
+ {
451
+ size: "lg",
452
+ rightIcon: /* @__PURE__ */ React.createElement(chevronDown.ChevronDownIcon, { size: 30, color: "#6A6A6A" }),
453
+ placeholder: "Choose",
454
+ value: (value == null ? void 0 : value.type) === "date" ? `${value == null ? void 0 : value.label} > ${value == null ? void 0 : value.value}` : (value == null ? void 0 : value.type) === "dateRange" ? `${value == null ? void 0 : value.label} - ${((_c = value == null ? void 0 : value.value) == null ? void 0 : _c.type) === "custom" ? `${(_d = value == null ? void 0 : value.value) == null ? void 0 : _d.value} days` : (_e = value == null ? void 0 : value.value) == null ? void 0 : _e.label}` : value == null ? void 0 : value.label,
455
+ css: {
456
+ "& input": {
457
+ textAlign: "left !important"
458
+ }
459
+ }
460
+ }
461
+ )), /* @__PURE__ */ React.createElement(
462
+ dropdown.DropdownMenuContent,
463
+ {
464
+ css: {
465
+ width: "488px",
466
+ marginBlockStart: "$2",
467
+ p: {
468
+ margin: "0px !important"
469
+ },
470
+ zIndex: "99 !important"
471
+ },
472
+ className: "dm-sans"
473
+ },
474
+ data.map((option) => {
475
+ var _a2;
476
+ if (!option.type) {
477
+ return /* @__PURE__ */ React.createElement(
478
+ tooltip.Tooltip,
479
+ {
480
+ content: option.tooltip || "",
481
+ css: {
482
+ zIndex: "9999999 !important",
483
+ fontFamily: "DM Sans !important"
484
+ }
485
+ },
486
+ /* @__PURE__ */ React.createElement(box.Box, null, /* @__PURE__ */ React.createElement(
487
+ dropdown.DropdownMenuItem,
488
+ {
489
+ disabled: option == null ? void 0 : option.disabled,
490
+ css: {
491
+ cursor: (option == null ? void 0 : option.disabled) ? "not-allowed !important" : "pointer !important",
492
+ background: (value == null ? void 0 : value.type) === option.type ? "#4A9CA626 !important" : "transparent !important"
493
+ },
494
+ onClick: () => onChangeHandler({
495
+ id: "responseImportType",
496
+ value: option
497
+ })
498
+ },
499
+ /* @__PURE__ */ React.createElement(
500
+ flex.Flex,
501
+ {
502
+ justifyContent: "space-between",
503
+ alignItems: "center",
504
+ css: {
505
+ width: "100%"
506
+ }
507
+ },
508
+ /* @__PURE__ */ React.createElement(flex.Flex, { justifyContent: "center", flexDirection: "column" }, /* @__PURE__ */ React.createElement(
509
+ text.Text,
510
+ {
511
+ size: "sm",
512
+ weight: "regular",
513
+ css: { color: "$neutral900" }
514
+ },
515
+ option.label
516
+ ), /* @__PURE__ */ React.createElement(
517
+ text.Text,
518
+ {
519
+ size: "xs",
520
+ weight: "regular",
521
+ css: { color: "$neutral700" }
522
+ },
523
+ option.description
524
+ ))
525
+ )
526
+ ))
527
+ );
528
+ } else {
529
+ return /* @__PURE__ */ React.createElement(
530
+ tooltip.Tooltip,
531
+ {
532
+ content: option.tooltip || "",
533
+ css: {
534
+ fontFamily: "DM Sans !important",
535
+ zIndex: "9999999 !important"
536
+ }
537
+ },
538
+ /* @__PURE__ */ React.createElement(box.Box, null, /* @__PURE__ */ React.createElement(dropdown.DropdownMenuSub, null, /* @__PURE__ */ React.createElement(
539
+ dropdown.DropdownMenuSubTrigger,
540
+ {
541
+ disabled: option == null ? void 0 : option.disabled,
542
+ css: {
543
+ cursor: (option == null ? void 0 : option.disabled) ? "not-allowed !important" : "pointer !important",
544
+ background: (value == null ? void 0 : value.type) === option.type ? "#4A9CA626 !important" : "transparent !important"
545
+ }
546
+ },
547
+ " ",
548
+ /* @__PURE__ */ React.createElement(
549
+ flex.Flex,
550
+ {
551
+ justifyContent: "space-between",
552
+ alignItems: "center",
553
+ css: {
554
+ width: "100%"
555
+ }
556
+ },
557
+ /* @__PURE__ */ React.createElement(
558
+ flex.Flex,
559
+ {
560
+ css: { cursor: "pointer" },
561
+ justifyContent: "center",
562
+ flexDirection: "column"
563
+ },
564
+ /* @__PURE__ */ React.createElement(
565
+ text.Text,
566
+ {
567
+ size: "sm",
568
+ weight: "regular",
569
+ css: { color: "$neutral900" }
570
+ },
571
+ option.label
572
+ ),
573
+ /* @__PURE__ */ React.createElement(
574
+ text.Text,
575
+ {
576
+ size: "xs",
577
+ weight: "regular",
578
+ css: { color: "$neutral700" }
579
+ },
580
+ option.description
581
+ )
582
+ )
583
+ )
584
+ ), /* @__PURE__ */ React.createElement(
585
+ dropdown.DropdownMenuSubContent,
586
+ {
587
+ sideOffset: 10,
588
+ alignOffset: -5,
589
+ css: __spreadProps(__spreadValues({
590
+ padding: "0px !important",
591
+ maxHeight: "500px",
592
+ minWidth: "224px",
593
+ maxWidth: "260px",
594
+ margin: "0px !important"
595
+ }, option.type === "date" && {
596
+ border: "none !important"
597
+ }), {
598
+ p: {
599
+ margin: "0px !important"
600
+ },
601
+ marginBlockEnd: "$10 !important"
602
+ }),
603
+ className: "dm-sans"
604
+ },
605
+ option.type === "date" && /* @__PURE__ */ React.createElement(
606
+ calendar.Calendar,
607
+ __spreadProps(__spreadValues(__spreadValues({
608
+ footerActionText: "Apply",
609
+ size: "md",
610
+ value: date,
611
+ onChange: setDate
612
+ }, (option == null ? void 0 : option.minValue) && {
613
+ minValue: string.parseDate(option == null ? void 0 : option.minValue)
614
+ }), (option == null ? void 0 : option.maxValue) && {
615
+ maxValue: string.parseDate(option == null ? void 0 : option.maxValue)
616
+ }), {
617
+ footerAction: () => {
618
+ onChangeHandler({
619
+ id: "responseImportType",
620
+ value: __spreadProps(__spreadValues({}, option), {
621
+ value: dayjs_min.default(date.toString()).format(
622
+ "MMM D, YYYY"
623
+ )
624
+ })
625
+ });
626
+ setOpen(false);
627
+ }
628
+ })
629
+ ),
630
+ option.type === "dateRange" && /* @__PURE__ */ React.createElement(
631
+ flex.Flex,
632
+ {
633
+ css: {
634
+ paddingInline: "$4 !important",
635
+ paddingBlock: "$8 !important"
636
+ },
637
+ flexDirection: "column",
638
+ gap: "$4"
639
+ },
640
+ /* @__PURE__ */ React.createElement(
641
+ radio.RadioGroup,
642
+ {
643
+ defaultValue: value == null ? void 0 : value.value,
644
+ onChange: (value2) => {
645
+ var _a3;
646
+ onChangeHandler({
647
+ id: "responseImportType",
648
+ value: __spreadProps(__spreadValues({}, option), {
649
+ value: {
650
+ type: value2,
651
+ value: value2,
652
+ label: (_a3 = index.dynamicDateOptions.find(
653
+ (option2) => option2.value === value2
654
+ )) == null ? void 0 : _a3.label
655
+ }
656
+ })
657
+ });
658
+ }
659
+ },
660
+ index.dynamicDateOptions.map((option2) => /* @__PURE__ */ React.createElement(
661
+ box.Box,
662
+ {
663
+ css: {
664
+ padding: "$4 !important"
665
+ }
666
+ },
667
+ /* @__PURE__ */ React.createElement(radio.Radio, { value: option2.value }, " ", option2.label, " ")
668
+ ))
669
+ ),
670
+ ((_a2 = value == null ? void 0 : value.value) == null ? void 0 : _a2.type) === "custom" && /* @__PURE__ */ React.createElement(
671
+ box.Box,
672
+ {
673
+ css: {
674
+ paddingRight: "$4 !important",
675
+ position: "relative"
676
+ }
677
+ },
678
+ /* @__PURE__ */ React.createElement(
679
+ input.Input,
680
+ {
681
+ size: "md",
682
+ variant: "filled",
683
+ value: days,
684
+ onChange: (e) => setDays(e.target.value)
685
+ }
686
+ ),
687
+ /* @__PURE__ */ React.createElement(
688
+ text.Text,
689
+ {
690
+ css: {
691
+ position: "absolute",
692
+ right: "$8",
693
+ top: "$3"
694
+ }
695
+ },
696
+ "Days"
697
+ )
698
+ ),
699
+ /* @__PURE__ */ React.createElement(
700
+ flex.Flex,
701
+ {
702
+ justifyContent: "space-between",
703
+ css: {
704
+ borderBlockStart: "$borderWidths$xs, solid, $neutral200 !important",
705
+ padding: "$8"
706
+ }
707
+ },
708
+ /* @__PURE__ */ React.createElement(button.Button, { size: "sm", variant: "ghost", color: "secondary" }, "Cancel"),
709
+ /* @__PURE__ */ React.createElement(
710
+ button.Button,
711
+ {
712
+ size: "sm",
713
+ variant: "ghost",
714
+ color: "primary",
715
+ onClick: () => {
716
+ var _a3, _b2;
717
+ onChangeHandler({
718
+ id: "responseImportType",
719
+ value: __spreadProps(__spreadValues({}, option), {
720
+ value: {
721
+ type: (_a3 = value == null ? void 0 : value.value) == null ? void 0 : _a3.type,
722
+ value: days,
723
+ label: (_b2 = value == null ? void 0 : value.value) == null ? void 0 : _b2.label
724
+ }
725
+ })
726
+ });
727
+ setOpen(false);
728
+ }
729
+ },
730
+ "Apply"
731
+ )
732
+ )
733
+ )
734
+ )))
735
+ );
736
+ }
737
+ })
738
+ ));
739
+ };
740
+ const Configuration = ({
741
+ field,
742
+ configuredFields,
743
+ responseImportType = null
744
+ }) => {
745
+ var _a, _b, _c, _d;
746
+ let fieldValue = null;
747
+ fieldValue = (_b = (_a = configuredFields == null ? void 0 : configuredFields[field.id]) == null ? void 0 : _a.value) != null ? _b : null;
748
+ const [error, setError] = React.useState({
749
+ errorMessage: "",
750
+ error: false,
751
+ id: null
752
+ });
753
+ switch (field.fieldType) {
754
+ case "switch":
755
+ return /* @__PURE__ */ React.createElement(
756
+ flex.Flex,
757
+ {
758
+ gap: "$4",
759
+ alignItems: "center",
760
+ css: {
761
+ marginBlockStart: "$12",
762
+ borderTop: "$borderWidths$xs solid $neutral200",
763
+ paddingTop: "$16"
764
+ }
765
+ },
766
+ /* @__PURE__ */ React.createElement(
767
+ _switch.Switch,
768
+ {
769
+ disabled: field == null ? void 0 : field.disabled,
770
+ size: "sm",
771
+ checked: field == null ? void 0 : field.value,
772
+ onChange: (value) => field.onChangeHandler({
773
+ id: field.id,
774
+ value
775
+ })
776
+ }
777
+ ),
778
+ /* @__PURE__ */ React.createElement(text.Text, { size: "md", weight: "regular", css: { color: "$neutral900" } }, field.label)
779
+ );
780
+ case "checkbox":
781
+ return /* @__PURE__ */ React.createElement(flex.Flex, { flexDirection: "column", alignItems: "start", gap: "$4" }, /* @__PURE__ */ React.createElement(flex.Flex, { gap: "$4", alignItems: "center" }, /* @__PURE__ */ React.createElement(
782
+ checkbox.Checkbox,
783
+ {
784
+ disabled: field == null ? void 0 : field.disabled,
785
+ checked: !!fieldValue,
786
+ onChange: (value) => field.onChangeHandler({
787
+ id: field.id,
788
+ value
789
+ })
790
+ }
791
+ ), /* @__PURE__ */ React.createElement(text.Text, { size: "sm", weight: "regular", css: { color: "$neutral900" } }, field.label)), /* @__PURE__ */ React.createElement(text.Text, { size: "sm", weight: "regular", css: { color: "$neutral500" } }, field.value ? field.ifChecked() : field.ifUnchecked(responseImportType)));
792
+ case "input":
793
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, (field == null ? void 0 : field.id) === "spreadsheet" ? /* @__PURE__ */ React.createElement(React.Fragment, null, ((_c = configuredFields == null ? void 0 : configuredFields.action) == null ? void 0 : _c.value) ? /* @__PURE__ */ React.createElement(
794
+ box.Box,
795
+ {
796
+ className: "dm-sans",
797
+ css: {
798
+ label: {
799
+ fontSize: "$xs !important"
800
+ }
801
+ }
802
+ },
803
+ /* @__PURE__ */ React.createElement(
804
+ formInput.FormInput,
805
+ __spreadProps(__spreadValues(__spreadProps(__spreadValues({
806
+ disabled: field == null ? void 0 : field.disabled
807
+ }, error.id === field.id && {
808
+ error: error.errorMessage,
809
+ errorBorder: error.error
810
+ }), {
811
+ label: field.label,
812
+ value: typeof fieldValue === "object" ? "" : fieldValue || "",
813
+ size: "lg"
814
+ }), field.pattern && {
815
+ pattern: field.pattern
816
+ }), {
817
+ onChange: (event) => {
818
+ if (field == null ? void 0 : field.pattern) {
819
+ const pattern = new RegExp(field.pattern);
820
+ if (!pattern.test(event.currentTarget.value) && event.currentTarget.value !== "") {
821
+ setError({
822
+ errorMessage: field.errorMessage,
823
+ error: true,
824
+ id: field.id
825
+ });
826
+ } else {
827
+ setError({
828
+ errorMessage: "",
829
+ error: false,
830
+ id: null
831
+ });
832
+ }
833
+ field.onChangeHandler({
834
+ id: field.id,
835
+ value: event.currentTarget.value
836
+ });
837
+ } else {
838
+ field.onChangeHandler({
839
+ id: field.id,
840
+ value: event.currentTarget.value
841
+ });
842
+ }
843
+ }
844
+ })
845
+ )
846
+ ) : null) : /* @__PURE__ */ React.createElement(
847
+ box.Box,
848
+ {
849
+ className: "dm-sans",
850
+ css: {
851
+ label: {
852
+ fontSize: "$xs !important"
853
+ }
854
+ }
855
+ },
856
+ /* @__PURE__ */ React.createElement(
857
+ formInput.FormInput,
858
+ __spreadProps(__spreadValues(__spreadProps(__spreadValues({
859
+ disabled: field == null ? void 0 : field.disabled
860
+ }, error.id === field.id && {
861
+ error: error.errorMessage,
862
+ errorBorder: error.error
863
+ }), {
864
+ label: field.label,
865
+ value: typeof fieldValue === "object" ? "" : fieldValue || "",
866
+ size: "lg"
867
+ }), field.pattern && {
868
+ pattern: field.pattern
869
+ }), {
870
+ onChange: (event) => {
871
+ if (field == null ? void 0 : field.pattern) {
872
+ const pattern = new RegExp(field.pattern);
873
+ if (!pattern.test(event.currentTarget.value) && event.currentTarget.value !== "") {
874
+ setError({
875
+ errorMessage: field.errorMessage,
876
+ error: true,
877
+ id: field.id
878
+ });
879
+ } else {
880
+ setError({
881
+ errorMessage: "",
882
+ error: false,
883
+ id: null
884
+ });
885
+ }
886
+ field.onChangeHandler({
887
+ id: field.id,
888
+ value: event.currentTarget.value
889
+ });
890
+ } else {
891
+ field.onChangeHandler({
892
+ id: field.id,
893
+ value: event.currentTarget.value
894
+ });
895
+ }
896
+ }
897
+ })
898
+ )
899
+ ));
900
+ default:
901
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, field.id === "spreadsheet" ? /* @__PURE__ */ React.createElement(React.Fragment, null, ((_d = configuredFields == null ? void 0 : configuredFields.action) == null ? void 0 : _d.value) ? /* @__PURE__ */ React.createElement(
902
+ flex.Flex,
903
+ {
904
+ gap: "$2",
905
+ flexDirection: "column",
906
+ css: {
907
+ cursor: "pointer !important",
908
+ ".twigs-select__indicator": {
909
+ width: "14px !important",
910
+ color: "#848484 !important"
911
+ }
912
+ }
913
+ },
914
+ /* @__PURE__ */ React.createElement(formLabel.FormLabel, { size: "xs", css: { fontWeight: "$5" } }, field.label),
915
+ /* @__PURE__ */ React.createElement(CustomAddNewSelect, { field })
916
+ ) : null) : /* @__PURE__ */ React.createElement(
917
+ flex.Flex,
918
+ {
919
+ gap: "$2",
920
+ flexDirection: "column",
921
+ css: {
922
+ cursor: "pointer !important",
923
+ ".twigs-select__indicator": {
924
+ width: "14px !important",
925
+ color: "#848484 !important"
926
+ }
927
+ }
928
+ },
929
+ /* @__PURE__ */ React.createElement(formLabel.FormLabel, { size: "xs", css: { fontWeight: "$5" } }, field.label),
930
+ /* @__PURE__ */ React.createElement(CustomAddNewSelect, { field })
931
+ ));
932
+ }
933
+ };
934
+ const CustomAddNewSelect = ({ field }) => {
935
+ return /* @__PURE__ */ React.createElement(
936
+ select.Select,
937
+ {
938
+ isDisabled: field == null ? void 0 : field.disabled,
939
+ placeholder: "",
940
+ size: "lg",
941
+ css: {
942
+ cursor: "pointer"
943
+ },
944
+ components: {
945
+ Option: CustomShareOption,
946
+ SingleValue: CustomSingleValue
947
+ },
948
+ styles: {
949
+ singleValue: (provided, state) => __spreadProps(__spreadValues({}, provided), {
950
+ display: "flex",
951
+ alignItems: "center",
952
+ cursor: "pointer"
953
+ })
954
+ },
955
+ value: field.value,
956
+ onChange: (value) => {
957
+ var _a;
958
+ field.onChangeHandler({
959
+ id: (_a = field == null ? void 0 : field.id) != null ? _a : field == null ? void 0 : field.label,
960
+ value
961
+ });
962
+ },
963
+ options: field.options
964
+ }
965
+ );
966
+ };
967
+ const CustomShareOption = (props) => {
968
+ if (props.data.value === "ADD_NEW") {
969
+ return /* @__PURE__ */ React.createElement(
970
+ tooltip.Tooltip,
971
+ {
972
+ content: props.data.tooltip || "",
973
+ css: {
974
+ zIndex: 999999999,
975
+ fontFamily: "DM Sans !important"
976
+ }
977
+ },
978
+ /* @__PURE__ */ React.createElement(box.Box, null, /* @__PURE__ */ React.createElement(indexA301f526_esm.c.Option, __spreadValues({}, props), /* @__PURE__ */ React.createElement(
979
+ flex.Flex,
980
+ {
981
+ justifyContent: "center",
982
+ alignItems: "center",
983
+ css: { cursor: "pointer", zIndex: 999999999 }
984
+ },
985
+ /* @__PURE__ */ React.createElement(
986
+ flex.Flex,
987
+ {
988
+ gap: "$2",
989
+ alignItems: "center",
990
+ css: {
991
+ color: "$primary500",
992
+ fontSize: "$sm",
993
+ fontWeight: "$7"
994
+ }
995
+ },
996
+ /* @__PURE__ */ React.createElement(plus.PlusIcon, { size: 16, color: "#4A9CA6" }),
997
+ "Add Account"
998
+ )
999
+ )))
1000
+ );
1001
+ } else {
1002
+ return /* @__PURE__ */ React.createElement(indexA301f526_esm.c.Option, __spreadValues({}, props), /* @__PURE__ */ React.createElement(
1003
+ flex.Flex,
1004
+ {
1005
+ css: { cursor: "pointer", zIndex: 999999999 },
1006
+ alignItems: "center",
1007
+ justifyContent: "space-between",
1008
+ gap: "$2"
1009
+ },
1010
+ /* @__PURE__ */ React.createElement(text.Text, { size: "sm" }, props.label),
1011
+ " ",
1012
+ props.data.isAddonAccount && /* @__PURE__ */ React.createElement(
1013
+ chip.Chip,
1014
+ {
1015
+ color: "primary",
1016
+ size: "sm",
1017
+ leftElement: /* @__PURE__ */ React.createElement(tickCircleFill.TickCircleFillIcon, null)
1018
+ },
1019
+ "In Use (Add-on)"
1020
+ )
1021
+ ));
1022
+ }
1023
+ };
1024
+ const CustomSingleValue = (props) => {
1025
+ if (props.data.value === "ADD_NEW") {
1026
+ return /* @__PURE__ */ React.createElement(indexA301f526_esm.c.SingleValue, __spreadValues({}, props), /* @__PURE__ */ React.createElement(flex.Flex, { css: { cursor: "pointer" }, alignItems: "center", gap: "$2" }, /* @__PURE__ */ React.createElement(plus.PlusIcon, { size: 16 }), /* @__PURE__ */ React.createElement(text.Text, { size: "sm" }, props.data.label)));
1027
+ } else {
1028
+ return /* @__PURE__ */ React.createElement(indexA301f526_esm.c.SingleValue, __spreadValues({}, props), /* @__PURE__ */ React.createElement(flex.Flex, { css: { cursor: "pointer" }, alignItems: "center", gap: "$2" }, /* @__PURE__ */ React.createElement(text.Text, { size: "sm" }, props.data.label)));
1029
+ }
102
1030
  };
103
1031
 
104
1032
  exports.SingleMapping = SingleMapping;