@sparrowengg/integrations-templates-frontend 2.1.0-notion-release.34 → 2.1.0-notion-release.35

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 (234) hide show
  1. package/dist/cjs/_virtual/index5.js +2 -2
  2. package/dist/cjs/_virtual/index8.js +2 -2
  3. package/dist/cjs/_virtual/index9.js +2 -2
  4. package/dist/cjs/commons/constants/index.js +0 -2
  5. package/dist/cjs/commons/constants/index.js.map +1 -1
  6. package/dist/cjs/contact-import/components/ContactImportHeader.js +27 -37
  7. package/dist/cjs/contact-import/components/ContactImportHeader.js.map +1 -1
  8. package/dist/cjs/contact-import/components/ContactImportModal.js +53 -54
  9. package/dist/cjs/contact-import/components/ContactImportModal.js.map +1 -1
  10. package/dist/cjs/contact-import/constants/ui-strings.js +18 -0
  11. package/dist/cjs/contact-import/constants/ui-strings.js.map +1 -0
  12. package/dist/cjs/contact-import/index.js +13 -230
  13. package/dist/cjs/contact-import/index.js.map +1 -1
  14. package/dist/cjs/contact-import/utils/validation.utils.js +18 -0
  15. package/dist/cjs/contact-import/utils/validation.utils.js.map +1 -0
  16. package/dist/cjs/dynamic-mapping/constants/ui-strings.js +52 -0
  17. package/dist/cjs/dynamic-mapping/constants/ui-strings.js.map +1 -0
  18. package/dist/cjs/dynamic-mapping/index.js +4 -3
  19. package/dist/cjs/dynamic-mapping/index.js.map +1 -1
  20. package/dist/cjs/index.js +10 -12
  21. package/dist/cjs/index.js.map +1 -1
  22. package/dist/cjs/integration-template/components/ConfigureTemplate.js +43 -31
  23. package/dist/cjs/integration-template/components/ConfigureTemplate.js.map +1 -1
  24. package/dist/cjs/integration-template/components/TemplateCard.js +2 -3
  25. package/dist/cjs/integration-template/components/TemplateCard.js.map +1 -1
  26. package/dist/cjs/integration-template/components/dashboard/DashboardItem.js +273 -0
  27. package/dist/cjs/integration-template/components/dashboard/DashboardItem.js.map +1 -0
  28. package/dist/cjs/integration-template/components/dashboard/DropdownItem.js +1 -2
  29. package/dist/cjs/integration-template/components/dashboard/DropdownItem.js.map +1 -1
  30. package/dist/cjs/integration-template/components/dashboard/EventComponent.js +1 -1
  31. package/dist/cjs/integration-template/components/dashboard/EventComponent.js.map +1 -1
  32. package/dist/cjs/integration-template/components/dashboard/MultiAccountFallback.js +4 -4
  33. package/dist/cjs/integration-template/components/dashboard/MultiAccountFallback.js.map +1 -1
  34. package/dist/cjs/integration-template/components/dashboard/SingleMappingChipWrapper.js +75 -0
  35. package/dist/cjs/integration-template/components/dashboard/SingleMappingChipWrapper.js.map +1 -0
  36. package/dist/cjs/integration-template/components/dashboard/SingleMappingDashboardItem.js +346 -0
  37. package/dist/cjs/integration-template/components/dashboard/SingleMappingDashboardItem.js.map +1 -0
  38. package/dist/cjs/integration-template/components/dashboard/SingleMappingEventWrapper.js +79 -0
  39. package/dist/cjs/integration-template/components/dashboard/SingleMappingEventWrapper.js.map +1 -0
  40. package/dist/cjs/integration-template/components/dashboard/TriggerDashboardItem.js +214 -0
  41. package/dist/cjs/integration-template/components/dashboard/TriggerDashboardItem.js.map +1 -0
  42. package/dist/cjs/integration-template/components/dashboard-constants.js +92 -0
  43. package/dist/cjs/integration-template/components/dashboard-constants.js.map +1 -0
  44. package/dist/cjs/integration-template/components/dashboard-utils.js +39 -0
  45. package/dist/cjs/integration-template/components/dashboard-utils.js.map +1 -0
  46. package/dist/cjs/integration-template/components/dashboard.js +55 -1195
  47. package/dist/cjs/integration-template/components/dashboard.js.map +1 -1
  48. package/dist/cjs/integration-template/constants/index.js +1 -41
  49. package/dist/cjs/integration-template/constants/index.js.map +1 -1
  50. package/dist/cjs/integration-template/constants/ui-strings.js +15 -0
  51. package/dist/cjs/integration-template/constants/ui-strings.js.map +1 -0
  52. package/dist/cjs/integration-template/index.js +155 -217
  53. package/dist/cjs/integration-template/index.js.map +1 -1
  54. package/dist/cjs/integration-template/utils/component.utils.js +22 -0
  55. package/dist/cjs/integration-template/utils/component.utils.js.map +1 -0
  56. package/dist/cjs/integration-template/utils/url.utils.js +16 -0
  57. package/dist/cjs/integration-template/utils/url.utils.js.map +1 -0
  58. package/dist/cjs/mapping/components/ConfigurationField.js +178 -0
  59. package/dist/cjs/mapping/components/ConfigurationField.js.map +1 -0
  60. package/dist/cjs/mapping/components/ConfigurationSetup.js +19 -16
  61. package/dist/cjs/mapping/components/ConfigurationSetup.js.map +1 -1
  62. package/dist/cjs/mapping/components/CustomAddNewSelect.js +64 -61
  63. package/dist/cjs/mapping/components/CustomAddNewSelect.js.map +1 -1
  64. package/dist/cjs/mapping/components/EventSetup.js +25 -22
  65. package/dist/cjs/mapping/components/EventSetup.js.map +1 -1
  66. package/dist/cjs/mapping/components/MappingHeader.js +24 -24
  67. package/dist/cjs/mapping/components/MappingHeader.js.map +1 -1
  68. package/dist/cjs/mapping/constants/index.js.map +1 -1
  69. package/dist/cjs/mapping/constants/ui-strings.js +39 -0
  70. package/dist/cjs/mapping/constants/ui-strings.js.map +1 -0
  71. package/dist/cjs/mapping/index.js +7 -612
  72. package/dist/cjs/mapping/index.js.map +1 -1
  73. package/dist/cjs/mapping/utils/validation.utils.js +32 -0
  74. package/dist/cjs/mapping/utils/validation.utils.js.map +1 -0
  75. package/dist/cjs/node_modules/domelementtype/lib/index.js +1 -1
  76. package/dist/cjs/node_modules/hoist-non-react-statics/node_modules/react-is/index.js +1 -1
  77. package/dist/cjs/node_modules/html-dom-parser/lib/server/html-to-dom.js +2 -2
  78. package/dist/cjs/node_modules/html-dom-parser/node_modules/dom-serializer/lib/index.js +1 -1
  79. package/dist/cjs/node_modules/html-dom-parser/node_modules/domhandler/lib/index.js +2 -2
  80. package/dist/cjs/node_modules/html-dom-parser/node_modules/domhandler/lib/node.js +1 -1
  81. package/dist/cjs/node_modules/html-dom-parser/node_modules/domutils/lib/helpers.js +1 -1
  82. package/dist/cjs/node_modules/html-dom-parser/node_modules/domutils/lib/index.js +1 -1
  83. package/dist/cjs/node_modules/html-dom-parser/node_modules/domutils/lib/legacy.js +1 -1
  84. package/dist/cjs/node_modules/html-dom-parser/node_modules/domutils/lib/querying.js +1 -1
  85. package/dist/cjs/node_modules/html-dom-parser/node_modules/domutils/lib/stringify.js +2 -2
  86. package/dist/cjs/node_modules/html-dom-parser/node_modules/domutils/lib/traversal.js +1 -1
  87. package/dist/cjs/node_modules/html-dom-parser/node_modules/htmlparser2/lib/index.js +3 -3
  88. package/dist/cjs/node_modules/html-react-parser/node_modules/domhandler/lib/index.js +1 -1
  89. package/dist/cjs/node_modules/html-react-parser/node_modules/domhandler/lib/node.js +1 -1
  90. package/dist/cjs/node_modules/style-to-js/cjs/index.js +1 -1
  91. package/dist/cjs/node_modules/style-to-object/cjs/index.js +1 -1
  92. package/dist/cjs/single-mapping/components/ConfigurationField.js +243 -0
  93. package/dist/cjs/single-mapping/components/ConfigurationField.js.map +1 -0
  94. package/dist/cjs/single-mapping/components/ConfigurationSetup.js +14 -13
  95. package/dist/cjs/single-mapping/components/ConfigurationSetup.js.map +1 -1
  96. package/dist/cjs/single-mapping/components/CustomDropdown.js +157 -228
  97. package/dist/cjs/single-mapping/components/CustomDropdown.js.map +1 -1
  98. package/dist/cjs/single-mapping/components/MappingHeader.js +67 -48
  99. package/dist/cjs/single-mapping/components/MappingHeader.js.map +1 -1
  100. package/dist/cjs/single-mapping/hooks/useEditState.js +58 -0
  101. package/dist/cjs/single-mapping/hooks/useEditState.js.map +1 -0
  102. package/dist/cjs/single-mapping/index.js +32 -940
  103. package/dist/cjs/single-mapping/index.js.map +1 -1
  104. package/dist/cjs/single-mapping/utils/validation.utils.js +36 -30
  105. package/dist/cjs/single-mapping/utils/validation.utils.js.map +1 -1
  106. package/dist/cjs/triggers/components/EventSetup.js +64 -58
  107. package/dist/cjs/triggers/components/EventSetup.js.map +1 -1
  108. package/dist/cjs/triggers/components/TriggerHeader.js +26 -30
  109. package/dist/cjs/triggers/components/TriggerHeader.js.map +1 -1
  110. package/dist/cjs/triggers/constants/index.js.map +1 -1
  111. package/dist/cjs/triggers/constants/ui-strings.js +28 -0
  112. package/dist/cjs/triggers/constants/ui-strings.js.map +1 -0
  113. package/dist/cjs/triggers/index.js +6 -252
  114. package/dist/cjs/triggers/index.js.map +1 -1
  115. package/dist/cjs/triggers/utils/validation.utils.js +36 -0
  116. package/dist/cjs/triggers/utils/validation.utils.js.map +1 -0
  117. package/dist/es/_virtual/index5.js +2 -2
  118. package/dist/es/_virtual/index8.js +2 -2
  119. package/dist/es/_virtual/index9.js +2 -2
  120. package/dist/es/commons/constants/index.js +1 -2
  121. package/dist/es/commons/constants/index.js.map +1 -1
  122. package/dist/es/contact-import/components/ContactImportHeader.js +30 -38
  123. package/dist/es/contact-import/components/ContactImportHeader.js.map +1 -1
  124. package/dist/es/contact-import/components/ContactImportModal.js +51 -50
  125. package/dist/es/contact-import/components/ContactImportModal.js.map +1 -1
  126. package/dist/es/contact-import/constants/ui-strings.js +16 -0
  127. package/dist/es/contact-import/constants/ui-strings.js.map +1 -0
  128. package/dist/es/contact-import/index.js +12 -229
  129. package/dist/es/contact-import/index.js.map +1 -1
  130. package/dist/es/contact-import/utils/validation.utils.js +15 -0
  131. package/dist/es/contact-import/utils/validation.utils.js.map +1 -0
  132. package/dist/es/dynamic-mapping/constants/ui-strings.js +50 -0
  133. package/dist/es/dynamic-mapping/constants/ui-strings.js.map +1 -0
  134. package/dist/es/dynamic-mapping/index.js +4 -3
  135. package/dist/es/dynamic-mapping/index.js.map +1 -1
  136. package/dist/es/index.js +0 -1
  137. package/dist/es/index.js.map +1 -1
  138. package/dist/es/integration-template/components/ConfigureTemplate.js +43 -31
  139. package/dist/es/integration-template/components/ConfigureTemplate.js.map +1 -1
  140. package/dist/es/integration-template/components/TemplateCard.js +2 -3
  141. package/dist/es/integration-template/components/TemplateCard.js.map +1 -1
  142. package/dist/es/integration-template/components/dashboard/DashboardItem.js +271 -0
  143. package/dist/es/integration-template/components/dashboard/DashboardItem.js.map +1 -0
  144. package/dist/es/integration-template/components/dashboard/DropdownItem.js +1 -2
  145. package/dist/es/integration-template/components/dashboard/DropdownItem.js.map +1 -1
  146. package/dist/es/integration-template/components/dashboard/EventComponent.js +1 -1
  147. package/dist/es/integration-template/components/dashboard/EventComponent.js.map +1 -1
  148. package/dist/es/integration-template/components/dashboard/MultiAccountFallback.js +4 -4
  149. package/dist/es/integration-template/components/dashboard/MultiAccountFallback.js.map +1 -1
  150. package/dist/es/integration-template/components/dashboard/SingleMappingChipWrapper.js +73 -0
  151. package/dist/es/integration-template/components/dashboard/SingleMappingChipWrapper.js.map +1 -0
  152. package/dist/es/integration-template/components/dashboard/SingleMappingDashboardItem.js +344 -0
  153. package/dist/es/integration-template/components/dashboard/SingleMappingDashboardItem.js.map +1 -0
  154. package/dist/es/integration-template/components/dashboard/SingleMappingEventWrapper.js +77 -0
  155. package/dist/es/integration-template/components/dashboard/SingleMappingEventWrapper.js.map +1 -0
  156. package/dist/es/integration-template/components/dashboard/TriggerDashboardItem.js +212 -0
  157. package/dist/es/integration-template/components/dashboard/TriggerDashboardItem.js.map +1 -0
  158. package/dist/es/integration-template/components/dashboard-constants.js +88 -0
  159. package/dist/es/integration-template/components/dashboard-constants.js.map +1 -0
  160. package/dist/es/integration-template/components/dashboard-utils.js +36 -0
  161. package/dist/es/integration-template/components/dashboard-utils.js.map +1 -0
  162. package/dist/es/integration-template/components/dashboard.js +43 -1183
  163. package/dist/es/integration-template/components/dashboard.js.map +1 -1
  164. package/dist/es/integration-template/constants/index.js +2 -36
  165. package/dist/es/integration-template/constants/index.js.map +1 -1
  166. package/dist/es/integration-template/constants/ui-strings.js +13 -0
  167. package/dist/es/integration-template/constants/ui-strings.js.map +1 -0
  168. package/dist/es/integration-template/index.js +154 -216
  169. package/dist/es/integration-template/index.js.map +1 -1
  170. package/dist/es/integration-template/utils/component.utils.js +18 -0
  171. package/dist/es/integration-template/utils/component.utils.js.map +1 -0
  172. package/dist/es/integration-template/utils/url.utils.js +13 -0
  173. package/dist/es/integration-template/utils/url.utils.js.map +1 -0
  174. package/dist/es/mapping/components/ConfigurationField.js +174 -0
  175. package/dist/es/mapping/components/ConfigurationField.js.map +1 -0
  176. package/dist/es/mapping/components/ConfigurationSetup.js +17 -16
  177. package/dist/es/mapping/components/ConfigurationSetup.js.map +1 -1
  178. package/dist/es/mapping/components/CustomAddNewSelect.js +62 -61
  179. package/dist/es/mapping/components/CustomAddNewSelect.js.map +1 -1
  180. package/dist/es/mapping/components/EventSetup.js +23 -22
  181. package/dist/es/mapping/components/EventSetup.js.map +1 -1
  182. package/dist/es/mapping/components/MappingHeader.js +23 -25
  183. package/dist/es/mapping/components/MappingHeader.js.map +1 -1
  184. package/dist/es/mapping/constants/index.js.map +1 -1
  185. package/dist/es/mapping/constants/ui-strings.js +37 -0
  186. package/dist/es/mapping/constants/ui-strings.js.map +1 -0
  187. package/dist/es/mapping/index.js +5 -610
  188. package/dist/es/mapping/index.js.map +1 -1
  189. package/dist/es/mapping/utils/validation.utils.js +28 -0
  190. package/dist/es/mapping/utils/validation.utils.js.map +1 -0
  191. package/dist/es/node_modules/domelementtype/lib/index.js +1 -1
  192. package/dist/es/node_modules/hoist-non-react-statics/node_modules/react-is/index.js +1 -1
  193. package/dist/es/node_modules/html-dom-parser/lib/server/html-to-dom.js +2 -2
  194. package/dist/es/node_modules/html-dom-parser/node_modules/dom-serializer/lib/index.js +1 -1
  195. package/dist/es/node_modules/html-dom-parser/node_modules/domhandler/lib/index.js +2 -2
  196. package/dist/es/node_modules/html-dom-parser/node_modules/domhandler/lib/node.js +1 -1
  197. package/dist/es/node_modules/html-dom-parser/node_modules/domutils/lib/helpers.js +1 -1
  198. package/dist/es/node_modules/html-dom-parser/node_modules/domutils/lib/index.js +1 -1
  199. package/dist/es/node_modules/html-dom-parser/node_modules/domutils/lib/legacy.js +1 -1
  200. package/dist/es/node_modules/html-dom-parser/node_modules/domutils/lib/querying.js +1 -1
  201. package/dist/es/node_modules/html-dom-parser/node_modules/domutils/lib/stringify.js +2 -2
  202. package/dist/es/node_modules/html-dom-parser/node_modules/domutils/lib/traversal.js +1 -1
  203. package/dist/es/node_modules/html-dom-parser/node_modules/htmlparser2/lib/index.js +3 -3
  204. package/dist/es/node_modules/html-react-parser/node_modules/domhandler/lib/index.js +1 -1
  205. package/dist/es/node_modules/html-react-parser/node_modules/domhandler/lib/node.js +1 -1
  206. package/dist/es/node_modules/style-to-js/cjs/index.js +1 -1
  207. package/dist/es/node_modules/style-to-object/cjs/index.js +1 -1
  208. package/dist/es/single-mapping/components/ConfigurationField.js +241 -0
  209. package/dist/es/single-mapping/components/ConfigurationField.js.map +1 -0
  210. package/dist/es/single-mapping/components/ConfigurationSetup.js +14 -13
  211. package/dist/es/single-mapping/components/ConfigurationSetup.js.map +1 -1
  212. package/dist/es/single-mapping/components/CustomDropdown.js +156 -227
  213. package/dist/es/single-mapping/components/CustomDropdown.js.map +1 -1
  214. package/dist/es/single-mapping/components/MappingHeader.js +68 -49
  215. package/dist/es/single-mapping/components/MappingHeader.js.map +1 -1
  216. package/dist/es/single-mapping/hooks/useEditState.js +56 -0
  217. package/dist/es/single-mapping/hooks/useEditState.js.map +1 -0
  218. package/dist/es/single-mapping/index.js +30 -941
  219. package/dist/es/single-mapping/index.js.map +1 -1
  220. package/dist/es/single-mapping/utils/validation.utils.js +31 -27
  221. package/dist/es/single-mapping/utils/validation.utils.js.map +1 -1
  222. package/dist/es/triggers/components/EventSetup.js +62 -58
  223. package/dist/es/triggers/components/EventSetup.js.map +1 -1
  224. package/dist/es/triggers/components/TriggerHeader.js +26 -32
  225. package/dist/es/triggers/components/TriggerHeader.js.map +1 -1
  226. package/dist/es/triggers/constants/index.js.map +1 -1
  227. package/dist/es/triggers/constants/ui-strings.js +26 -0
  228. package/dist/es/triggers/constants/ui-strings.js.map +1 -0
  229. package/dist/es/triggers/index.js +5 -251
  230. package/dist/es/triggers/index.js.map +1 -1
  231. package/dist/es/triggers/utils/validation.utils.js +30 -0
  232. package/dist/es/triggers/utils/validation.utils.js.map +1 -0
  233. package/dist/index.d.ts +216 -143
  234. package/package.json +1 -1
@@ -1,55 +1,18 @@
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
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
5
  var React = require('react');
6
- var arrow = require('../commons/icons/arrow.js');
7
- var mapping = require('./components/mapping.js');
8
6
  var index = require('../commons/constants/index.js');
9
- var dayjs_min = require('../node_modules/dayjs/dayjs.min.js');
7
+ var mapping = require('./components/mapping.js');
8
+ var MappingHeader = require('./components/MappingHeader.js');
9
+ var ConfigurationSetup = require('./components/ConfigurationSetup.js');
10
+ var useEditState = require('./hooks/useEditState.js');
10
11
  var themeProvider = require('../node_modules/@sparrowengg/twigs-react/dist/es/theme-provider/theme-provider.js');
11
12
  var tooltip = require('../node_modules/@sparrowengg/twigs-react/dist/es/tooltip/tooltip.js');
12
13
  var box = require('../node_modules/@sparrowengg/twigs-react/dist/es/box/box.js');
13
14
  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');
33
15
 
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));
53
16
  const SingleMapping = ({
54
17
  integrationFields,
55
18
  configuration,
@@ -74,31 +37,26 @@ const SingleMapping = ({
74
37
  derivedQuestions: []
75
38
  });
76
39
  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(importResponse)));
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(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;
40
+ const {
41
+ originalMappingData,
42
+ setOriginalMappingData,
43
+ isInitialLoad,
44
+ setIsInitialLoad,
45
+ hasFieldsChanged
46
+ } = useEditState.useEditState({
47
+ editField,
48
+ configuration,
49
+ importResponse,
50
+ navigateMappingPage
51
+ });
52
+ const handleSaveConfiguration = () => {
53
+ configuration.onSaveHandler();
54
+ };
55
+ const handleNavigateConfigPage = () => {
56
+ navigateMappingPage(false);
57
+ };
58
+ const handleSaveMapping = () => {
59
+ onSaveHandler((editField == null ? void 0 : editField.id) ? editField : {});
102
60
  };
103
61
  return /* @__PURE__ */ React.createElement(
104
62
  themeProvider.ThemeProvider,
@@ -111,7 +69,7 @@ const SingleMapping = ({
111
69
  }
112
70
  },
113
71
  /* @__PURE__ */ React.createElement(tooltip.TooltipProvider, null, /* @__PURE__ */ React.createElement(box.Box, { css: { width: "100%" } }, /* @__PURE__ */ React.createElement(
114
- MappingHeader,
72
+ MappingHeader.MappingHeader,
115
73
  {
116
74
  isEditConfirmationOpen,
117
75
  setIsEditConfirmationOpen,
@@ -120,16 +78,12 @@ const SingleMapping = ({
120
78
  ssMappingData,
121
79
  configuration,
122
80
  hasFieldsChanged: hasFieldsChanged(),
123
- saveConfiguration: () => {
124
- configuration.onSaveHandler();
125
- },
81
+ saveConfiguration: handleSaveConfiguration,
126
82
  isMappingPage,
127
83
  hasExistingMapping,
128
- navigateConfigPage: () => navigateMappingPage(false),
84
+ navigateConfigPage: handleNavigateConfigPage,
129
85
  previousMappingHandler,
130
- onSaveHandler: () => {
131
- onSaveHandler((editField == null ? void 0 : editField.id) ? editField : {});
132
- }
86
+ onSaveHandler: handleSaveMapping
133
87
  }
134
88
  ), !isMappingPage && configuration.hasConfiguration ? /* @__PURE__ */ React.createElement(
135
89
  flex.Flex,
@@ -139,7 +93,7 @@ const SingleMapping = ({
139
93
  css: { marginTop: "$40" }
140
94
  },
141
95
  /* @__PURE__ */ React.createElement(
142
- ConfigurationSetup,
96
+ ConfigurationSetup.ConfigurationSetup,
143
97
  {
144
98
  configuration,
145
99
  surveyName: surveyDetails.surveyName,
@@ -165,869 +119,7 @@ const SingleMapping = ({
165
119
  )))
166
120
  );
167
121
  };
168
- const MappingHeader = ({
169
- isEditConfirmationOpen,
170
- editField,
171
- importResponse,
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 = importResponse == null ? void 0 : importResponse.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;
213
- }
214
- }
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(
232
- flex.Flex,
233
- {
234
- alignItems: "center",
235
- justifyContent: "space-between",
236
- css: {
237
- borderBottom: "$borderWidths$xs solid $neutral200",
238
- padding: "$8 $12"
239
- }
240
- },
241
- /* @__PURE__ */ React.createElement(
242
- flex.Flex,
243
- {
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
- }
342
- }
343
- )
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,
354
- {
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);
446
- }
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
- }
1030
- };
1031
122
 
1032
123
  exports.SingleMapping = SingleMapping;
124
+ exports.default = SingleMapping;
1033
125
  //# sourceMappingURL=index.js.map