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