@123usmanhaider321/ui 0.1.6 → 1.0.0

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 (545) hide show
  1. package/README.md +416 -31
  2. package/dist/images/icon/1LINK.svg +50 -0
  3. package/dist/images/icon/CreditCard.svg +83 -0
  4. package/dist/images/icon/Easypaisa.png +0 -0
  5. package/dist/images/icon/MobileWallet.png +0 -0
  6. package/dist/images/icon/Raast-Logo.png +0 -0
  7. package/dist/images/icon/VISA.png +0 -0
  8. package/dist/images/icon/add-circle-1.svg +5 -0
  9. package/dist/images/icon/check-circle-broken.svg +3 -0
  10. package/dist/images/icon/close-circle.svg +5 -0
  11. package/dist/images/icon/jazzcash.png +0 -0
  12. package/dist/images/icon/loading_icon.json +3347 -0
  13. package/dist/images/icon/mastercard-logo.webp +0 -0
  14. package/dist/images/icon/paymo.jpeg +0 -0
  15. package/dist/images/icon/preview-svgrepo-com.svg +36 -0
  16. package/dist/images/icon/trash.svg +7 -0
  17. package/dist/images/icon/unionpay-logo.svg +9 -0
  18. package/dist/index-87FQZHOs.js +11119 -0
  19. package/dist/index-87FQZHOs.js.map +1 -0
  20. package/dist/index-Tl9g213f.js +60475 -0
  21. package/dist/index-Tl9g213f.js.map +1 -0
  22. package/dist/index.d.ts +1 -10
  23. package/dist/index.es-CpgTaa1Y.js +16734 -0
  24. package/dist/index.es-CpgTaa1Y.js.map +1 -0
  25. package/dist/index.js +40 -12
  26. package/dist/index.js.map +1 -1
  27. package/dist/loading_icon-n5H5dQBl.js +3375 -0
  28. package/dist/loading_icon-n5H5dQBl.js.map +1 -0
  29. package/dist/src/components/Alert/ErrorAlert.d.ts +6 -0
  30. package/dist/src/components/Alert/SuccessAlert.d.ts +6 -0
  31. package/dist/{components → src/components}/FormBuilder/DiscountInput.d.ts +3 -6
  32. package/dist/{components → src/components}/FormBuilder/FormBuilder.d.ts +2 -11
  33. package/dist/{components → src/components}/FormBuilder/QuestionCard.d.ts +0 -5
  34. package/dist/{components → src/components}/FormBuilder/QuestionEditor.d.ts +0 -5
  35. package/dist/{components → src/components}/FormBuilder/SortableQuestionList.d.ts +0 -5
  36. package/dist/src/components/FormBuilder/questionIcons.d.ts +5 -0
  37. package/dist/{components/EventAddForm → src/components/NewAddEvent}/AddEventLayout.d.ts +2 -1
  38. package/dist/{components/EventAddForm → src/components/NewAddEvent}/AddEventStepper.d.ts +2 -2
  39. package/dist/{components/EventAddForm → src/components/NewAddEvent}/common/ConfirmationModal.d.ts +1 -1
  40. package/dist/src/components/NewAddEvent/components/EventSubmissionConfirmationModal.d.ts +14 -0
  41. package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/StepTwo/TicketTierSection.d.ts +1 -1
  42. package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/TicketTierForm.d.ts +1 -1
  43. package/dist/{components/EventAddForm → src/components/NewAddEvent}/hooks/useStepperForm.d.ts +22 -22
  44. package/dist/{components/EventAddForm → src/components/NewAddEvent}/hooks/useTicketTierForm.d.ts +63 -15
  45. package/dist/src/components/NewAddEvent/schemas/step1.d.ts +211 -0
  46. package/dist/src/components/NewAddEvent/schemas/step2.d.ts +411 -0
  47. package/dist/{components/EventAddForm → src/components/NewAddEvent}/schemas/utils.d.ts +8 -2
  48. package/dist/{components/EventAddForm → src/components/NewAddEvent}/steps/IndividualFormStep.d.ts +1 -1
  49. package/dist/{components/EventAddForm → src/components/NewAddEvent}/steps/SocialProfilesStep.d.ts +1 -1
  50. package/dist/{components/EventAddForm → src/components/NewAddEvent}/steps/TeamFormStep.d.ts +1 -1
  51. package/dist/src/components/Spinner/spinner.d.ts +4 -0
  52. package/dist/src/components/TicketlyUIProvider.d.ts +35 -0
  53. package/dist/src/components/common/Loader/index.d.ts +8 -0
  54. package/dist/src/components/common/Modals/ConfirmationModal.d.ts +7 -0
  55. package/dist/{components/FormInput → src/components/ui}/FormInput.d.ts +1 -1
  56. package/dist/src/components/ui/Loader.d.ts +4 -0
  57. package/dist/{components/Button/Button.d.ts → src/components/ui/button.d.ts} +1 -1
  58. package/dist/src/index.d.ts +10 -0
  59. package/dist/{lib → src/lib}/actions.d.ts +0 -126
  60. package/dist/src/lib/dom-utils.d.ts +2 -0
  61. package/dist/src/lib/storage-utils.d.ts +5 -0
  62. package/dist/src/lib/types.d.ts +258 -0
  63. package/dist/src/redux/baseQuery.d.ts +16 -0
  64. package/dist/{services → src/redux/features}/eventApi.d.ts +1053 -1745
  65. package/dist/src/redux/features/globalSlice.d.ts +17 -0
  66. package/dist/{services → src/redux/features/single-event}/single-event-api.d.ts +856 -1190
  67. package/dist/src/redux/types.d.ts +2 -0
  68. package/dist/src/services/library-services.d.ts +15 -0
  69. package/dist/src/services/remote-config.d.ts +27 -0
  70. package/dist/{services → src/services}/utils.d.ts +1 -1
  71. package/dist/src/theme/colors.d.ts +127 -0
  72. package/dist/src/theme/typography.d.ts +13 -0
  73. package/dist/src/types/api.d.ts +18 -0
  74. package/dist/style.css +2984 -0
  75. package/dist/styles.css +3758 -3636
  76. package/package.json +78 -68
  77. package/dist/_virtual/_commonjsHelpers.js +0 -9
  78. package/dist/_virtual/_commonjsHelpers.js.map +0 -1
  79. package/dist/_virtual/customParseFormat.js +0 -5
  80. package/dist/_virtual/customParseFormat.js.map +0 -1
  81. package/dist/_virtual/dayjs.min.js +0 -5
  82. package/dist/_virtual/dayjs.min.js.map +0 -1
  83. package/dist/_virtual/duration.js +0 -5
  84. package/dist/_virtual/duration.js.map +0 -1
  85. package/dist/_virtual/index.js +0 -5
  86. package/dist/_virtual/index.js.map +0 -1
  87. package/dist/_virtual/isBetween.js +0 -5
  88. package/dist/_virtual/isBetween.js.map +0 -1
  89. package/dist/_virtual/relativeTime.js +0 -5
  90. package/dist/_virtual/relativeTime.js.map +0 -1
  91. package/dist/_virtual/use-sync-external-store-shim.development.js +0 -5
  92. package/dist/_virtual/use-sync-external-store-shim.development.js.map +0 -1
  93. package/dist/_virtual/use-sync-external-store-shim.production.js +0 -5
  94. package/dist/_virtual/use-sync-external-store-shim.production.js.map +0 -1
  95. package/dist/_virtual/with-selector.development.js +0 -5
  96. package/dist/_virtual/with-selector.development.js.map +0 -1
  97. package/dist/_virtual/with-selector.js +0 -5
  98. package/dist/_virtual/with-selector.js.map +0 -1
  99. package/dist/_virtual/with-selector.production.js +0 -5
  100. package/dist/_virtual/with-selector.production.js.map +0 -1
  101. package/dist/components/Alert/Alert.js +0 -51
  102. package/dist/components/Alert/Alert.js.map +0 -1
  103. package/dist/components/Button/Button.js +0 -52
  104. package/dist/components/Button/Button.js.map +0 -1
  105. package/dist/components/Button/Button.test.d.ts +0 -1
  106. package/dist/components/Button/index.d.ts +0 -1
  107. package/dist/components/Checkbox/Checkbox.js +0 -50
  108. package/dist/components/Checkbox/Checkbox.js.map +0 -1
  109. package/dist/components/Checkbox/Checkbox.test.d.ts +0 -1
  110. package/dist/components/Checkbox/index.d.ts +0 -1
  111. package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +0 -25
  112. package/dist/components/CheckboxGroup/CheckboxGroup.js +0 -99
  113. package/dist/components/CheckboxGroup/CheckboxGroup.js.map +0 -1
  114. package/dist/components/ConfirmationModal/ConfirmationModal.d.ts +0 -15
  115. package/dist/components/ConfirmationModal/ConfirmationModal.js +0 -136
  116. package/dist/components/ConfirmationModal/ConfirmationModal.js.map +0 -1
  117. package/dist/components/ConfirmationModal/index.d.ts +0 -2
  118. package/dist/components/CustomSelect/CustomSelect.js +0 -259
  119. package/dist/components/CustomSelect/CustomSelect.js.map +0 -1
  120. package/dist/components/EventAddForm/AddEventLayout.js +0 -227
  121. package/dist/components/EventAddForm/AddEventLayout.js.map +0 -1
  122. package/dist/components/EventAddForm/AddEventStepper.js +0 -719
  123. package/dist/components/EventAddForm/AddEventStepper.js.map +0 -1
  124. package/dist/components/EventAddForm/common/ConfirmationModal.js +0 -136
  125. package/dist/components/EventAddForm/common/ConfirmationModal.js.map +0 -1
  126. package/dist/components/EventAddForm/common/DescriptionModal.js +0 -70
  127. package/dist/components/EventAddForm/common/DescriptionModal.js.map +0 -1
  128. package/dist/components/EventAddForm/components/AnimatedBackground.d.ts +0 -8
  129. package/dist/components/EventAddForm/components/ApprovalConfirmationModal.d.ts +0 -7
  130. package/dist/components/EventAddForm/components/CheckboxGroup.js +0 -92
  131. package/dist/components/EventAddForm/components/CheckboxGroup.js.map +0 -1
  132. package/dist/components/EventAddForm/components/CustomMeetingForm.js +0 -237
  133. package/dist/components/EventAddForm/components/CustomMeetingForm.js.map +0 -1
  134. package/dist/components/EventAddForm/components/DateTimeField.js +0 -173
  135. package/dist/components/EventAddForm/components/DateTimeField.js.map +0 -1
  136. package/dist/components/EventAddForm/components/EventSubmissionConfirmationModal.d.ts +0 -33
  137. package/dist/components/EventAddForm/components/EventSubmissionConfirmationModal.js +0 -366
  138. package/dist/components/EventAddForm/components/EventSubmissionConfirmationModal.js.map +0 -1
  139. package/dist/components/EventAddForm/components/FileUpload.js +0 -412
  140. package/dist/components/EventAddForm/components/FileUpload.js.map +0 -1
  141. package/dist/components/EventAddForm/components/FormBuilderProceedModal.js +0 -197
  142. package/dist/components/EventAddForm/components/FormBuilderProceedModal.js.map +0 -1
  143. package/dist/components/EventAddForm/components/GoogleMapsAutocompleteInput.js +0 -1179
  144. package/dist/components/EventAddForm/components/GoogleMapsAutocompleteInput.js.map +0 -1
  145. package/dist/components/EventAddForm/components/InputField.d.ts +0 -15
  146. package/dist/components/EventAddForm/components/RadioGroupButton.d.ts +0 -14
  147. package/dist/components/EventAddForm/components/SelectField.d.ts +0 -19
  148. package/dist/components/EventAddForm/components/SingleDateTimeInput.js +0 -102
  149. package/dist/components/EventAddForm/components/SingleDateTimeInput.js.map +0 -1
  150. package/dist/components/EventAddForm/components/StepTwo/CustomFormSection.js +0 -277
  151. package/dist/components/EventAddForm/components/StepTwo/CustomFormSection.js.map +0 -1
  152. package/dist/components/EventAddForm/components/StepTwo/TicketTierSection.js +0 -148
  153. package/dist/components/EventAddForm/components/StepTwo/TicketTierSection.js.map +0 -1
  154. package/dist/components/EventAddForm/components/TicketTierForm.js +0 -418
  155. package/dist/components/EventAddForm/components/TicketTierForm.js.map +0 -1
  156. package/dist/components/EventAddForm/components/TicketTypeSelection.js +0 -93
  157. package/dist/components/EventAddForm/components/TicketTypeSelection.js.map +0 -1
  158. package/dist/components/EventAddForm/hooks/useStepperForm.js +0 -371
  159. package/dist/components/EventAddForm/hooks/useStepperForm.js.map +0 -1
  160. package/dist/components/EventAddForm/hooks/useTicketTierForm.js +0 -237
  161. package/dist/components/EventAddForm/hooks/useTicketTierForm.js.map +0 -1
  162. package/dist/components/EventAddForm/index.d.ts +0 -3
  163. package/dist/components/EventAddForm/index.js +0 -41
  164. package/dist/components/EventAddForm/index.js.map +0 -1
  165. package/dist/components/EventAddForm/schemas/index.d.ts +0 -2
  166. package/dist/components/EventAddForm/schemas/step1.d.ts +0 -47
  167. package/dist/components/EventAddForm/schemas/step1.js +0 -135
  168. package/dist/components/EventAddForm/schemas/step1.js.map +0 -1
  169. package/dist/components/EventAddForm/schemas/step2.d.ts +0 -138
  170. package/dist/components/EventAddForm/schemas/step2.js +0 -94
  171. package/dist/components/EventAddForm/schemas/step2.js.map +0 -1
  172. package/dist/components/EventAddForm/schemas/utils.js +0 -28
  173. package/dist/components/EventAddForm/schemas/utils.js.map +0 -1
  174. package/dist/components/EventAddForm/steps/IndividualFormStep.js +0 -85
  175. package/dist/components/EventAddForm/steps/IndividualFormStep.js.map +0 -1
  176. package/dist/components/EventAddForm/steps/SocialProfilesStep.js +0 -123
  177. package/dist/components/EventAddForm/steps/SocialProfilesStep.js.map +0 -1
  178. package/dist/components/EventAddForm/steps/StepOne.js +0 -462
  179. package/dist/components/EventAddForm/steps/StepOne.js.map +0 -1
  180. package/dist/components/EventAddForm/steps/StepTwo.js +0 -173
  181. package/dist/components/EventAddForm/steps/StepTwo.js.map +0 -1
  182. package/dist/components/EventAddForm/steps/TeamFormStep.js +0 -13
  183. package/dist/components/EventAddForm/steps/TeamFormStep.js.map +0 -1
  184. package/dist/components/FormBuilder/CategoryList.js +0 -242
  185. package/dist/components/FormBuilder/CategoryList.js.map +0 -1
  186. package/dist/components/FormBuilder/DiscountInput.js +0 -366
  187. package/dist/components/FormBuilder/DiscountInput.js.map +0 -1
  188. package/dist/components/FormBuilder/FormBuilder.js +0 -918
  189. package/dist/components/FormBuilder/FormBuilder.js.map +0 -1
  190. package/dist/components/FormBuilder/OptionList.js +0 -120
  191. package/dist/components/FormBuilder/OptionList.js.map +0 -1
  192. package/dist/components/FormBuilder/PaymentPreview.d.ts +0 -12
  193. package/dist/components/FormBuilder/PaymentPreview.js +0 -70
  194. package/dist/components/FormBuilder/PaymentPreview.js.map +0 -1
  195. package/dist/components/FormBuilder/PreviewInput.d.ts +0 -10
  196. package/dist/components/FormBuilder/PreviewInput.js +0 -143
  197. package/dist/components/FormBuilder/PreviewInput.js.map +0 -1
  198. package/dist/components/FormBuilder/QuestionCard.js +0 -252
  199. package/dist/components/FormBuilder/QuestionCard.js.map +0 -1
  200. package/dist/components/FormBuilder/QuestionEditor.js +0 -166
  201. package/dist/components/FormBuilder/QuestionEditor.js.map +0 -1
  202. package/dist/components/FormBuilder/RequiredToggle.js +0 -43
  203. package/dist/components/FormBuilder/RequiredToggle.js.map +0 -1
  204. package/dist/components/FormBuilder/SortableQuestionList.js +0 -137
  205. package/dist/components/FormBuilder/SortableQuestionList.js.map +0 -1
  206. package/dist/components/FormBuilder/index.d.ts +0 -4
  207. package/dist/components/FormBuilder/utils.js +0 -229
  208. package/dist/components/FormBuilder/utils.js.map +0 -1
  209. package/dist/components/FormInput/FormInput.js +0 -126
  210. package/dist/components/FormInput/FormInput.js.map +0 -1
  211. package/dist/components/FormInput/FormInput.test.d.ts +0 -1
  212. package/dist/components/FormInput/index.d.ts +0 -2
  213. package/dist/components/ImageCropModal/index.js +0 -464
  214. package/dist/components/ImageCropModal/index.js.map +0 -1
  215. package/dist/components/InformationPopover/InformationPopover.d.ts +0 -7
  216. package/dist/components/InformationPopover/InformationPopover.js +0 -19
  217. package/dist/components/InformationPopover/InformationPopover.js.map +0 -1
  218. package/dist/components/InformationPopover.js +0 -19
  219. package/dist/components/InformationPopover.js.map +0 -1
  220. package/dist/components/InputErrorMessage/InputErrorMessage.js +0 -21
  221. package/dist/components/InputErrorMessage/InputErrorMessage.js.map +0 -1
  222. package/dist/components/Modal/Modal.d.ts +0 -15
  223. package/dist/components/Modal/Modal.js +0 -73
  224. package/dist/components/Modal/Modal.js.map +0 -1
  225. package/dist/components/Radio/Radio.js +0 -35
  226. package/dist/components/Radio/Radio.js.map +0 -1
  227. package/dist/components/Spinner/spinner.d.ts +0 -2
  228. package/dist/components/Spinner/spinner.js +0 -22
  229. package/dist/components/Spinner/spinner.js.map +0 -1
  230. package/dist/components/Toggle/Toggle.d.ts +0 -16
  231. package/dist/components/Toggle/index.d.ts +0 -2
  232. package/dist/components/Tooltip/Tooltip.d.ts +0 -12
  233. package/dist/components/Tooltip/Tooltip.js +0 -134
  234. package/dist/components/Tooltip/Tooltip.js.map +0 -1
  235. package/dist/components/common/FallbackImage.js +0 -47
  236. package/dist/components/common/FallbackImage.js.map +0 -1
  237. package/dist/components/ui/Calendar/calendar-utils.js +0 -51
  238. package/dist/components/ui/Calendar/calendar-utils.js.map +0 -1
  239. package/dist/components/ui/Calendar/index.js +0 -142
  240. package/dist/components/ui/Calendar/index.js.map +0 -1
  241. package/dist/components/ui/Checkbox.d.ts +0 -9
  242. package/dist/components/ui/Checkbox.js +0 -50
  243. package/dist/components/ui/Checkbox.js.map +0 -1
  244. package/dist/components/ui/DatePicker/index.js +0 -188
  245. package/dist/components/ui/DatePicker/index.js.map +0 -1
  246. package/dist/components/ui/FormInput.js +0 -129
  247. package/dist/components/ui/FormInput.js.map +0 -1
  248. package/dist/components/ui/InputErrorMessage.d.ts +0 -7
  249. package/dist/components/ui/InputErrorMessage.js +0 -21
  250. package/dist/components/ui/InputErrorMessage.js.map +0 -1
  251. package/dist/components/ui/Modal/index.js +0 -73
  252. package/dist/components/ui/Modal/index.js.map +0 -1
  253. package/dist/components/ui/Radio.d.ts +0 -6
  254. package/dist/components/ui/Radio.js +0 -35
  255. package/dist/components/ui/Radio.js.map +0 -1
  256. package/dist/components/ui/RichTextEditor.js +0 -242
  257. package/dist/components/ui/RichTextEditor.js.map +0 -1
  258. package/dist/components/ui/TimePicker/index.js +0 -215
  259. package/dist/components/ui/TimePicker/index.js.map +0 -1
  260. package/dist/components/ui/TimeSelector/index.js +0 -138
  261. package/dist/components/ui/TimeSelector/index.js.map +0 -1
  262. package/dist/components/ui/Tooltip.d.ts +0 -12
  263. package/dist/components/ui/Tooltip.js +0 -136
  264. package/dist/components/ui/Tooltip.js.map +0 -1
  265. package/dist/hooks/useDropdownPosition.d.ts +0 -11
  266. package/dist/hooks/useFirebaseAuthState.d.ts +0 -6
  267. package/dist/hooks/useFirebaseAuthState.js +0 -23
  268. package/dist/hooks/useFirebaseAuthState.js.map +0 -1
  269. package/dist/hooks/useTicketTierForm.d.ts +0 -61
  270. package/dist/lib/actions.js +0 -32
  271. package/dist/lib/actions.js.map +0 -1
  272. package/dist/lib/cropImage.js +0 -113
  273. package/dist/lib/cropImage.js.map +0 -1
  274. package/dist/lib/imageAnalysis.js +0 -58
  275. package/dist/lib/imageAnalysis.js.map +0 -1
  276. package/dist/lib/utils.js +0 -9
  277. package/dist/lib/utils.js.map +0 -1
  278. package/dist/node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js +0 -60
  279. package/dist/node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js.map +0 -1
  280. package/dist/node_modules/@dnd-kit/core/dist/core.esm.js +0 -3458
  281. package/dist/node_modules/@dnd-kit/core/dist/core.esm.js.map +0 -1
  282. package/dist/node_modules/@dnd-kit/sortable/dist/sortable.esm.js +0 -593
  283. package/dist/node_modules/@dnd-kit/sortable/dist/sortable.esm.js.map +0 -1
  284. package/dist/node_modules/@dnd-kit/utilities/dist/utilities.esm.js +0 -302
  285. package/dist/node_modules/@dnd-kit/utilities/dist/utilities.esm.js.map +0 -1
  286. package/dist/node_modules/@firebase/app/dist/esm/index.esm.js +0 -768
  287. package/dist/node_modules/@firebase/app/dist/esm/index.esm.js.map +0 -1
  288. package/dist/node_modules/@firebase/component/dist/esm/index.esm.js +0 -340
  289. package/dist/node_modules/@firebase/component/dist/esm/index.esm.js.map +0 -1
  290. package/dist/node_modules/@firebase/logger/dist/esm/index.esm.js +0 -123
  291. package/dist/node_modules/@firebase/logger/dist/esm/index.esm.js.map +0 -1
  292. package/dist/node_modules/@firebase/storage/dist/index.esm.js +0 -2623
  293. package/dist/node_modules/@firebase/storage/dist/index.esm.js.map +0 -1
  294. package/dist/node_modules/@firebase/util/dist/index.esm.js +0 -658
  295. package/dist/node_modules/@firebase/util/dist/index.esm.js.map +0 -1
  296. package/dist/node_modules/@firebase/util/dist/postinstall.js +0 -5
  297. package/dist/node_modules/@firebase/util/dist/postinstall.js.map +0 -1
  298. package/dist/node_modules/@fortawesome/fontawesome-svg-core/index.js +0 -3179
  299. package/dist/node_modules/@fortawesome/fontawesome-svg-core/index.js.map +0 -1
  300. package/dist/node_modules/@fortawesome/free-solid-svg-icons/index.js +0 -60
  301. package/dist/node_modules/@fortawesome/free-solid-svg-icons/index.js.map +0 -1
  302. package/dist/node_modules/@fortawesome/react-fontawesome/dist/index.js +0 -400
  303. package/dist/node_modules/@fortawesome/react-fontawesome/dist/index.js.map +0 -1
  304. package/dist/node_modules/@heroicons/react/20/solid/esm/CheckIcon.js +0 -27
  305. package/dist/node_modules/@heroicons/react/20/solid/esm/CheckIcon.js.map +0 -1
  306. package/dist/node_modules/@heroicons/react/20/solid/esm/ChevronDownIcon.js +0 -27
  307. package/dist/node_modules/@heroicons/react/20/solid/esm/ChevronDownIcon.js.map +0 -1
  308. package/dist/node_modules/@heroicons/react/24/outline/esm/ArrowRightIcon.js +0 -29
  309. package/dist/node_modules/@heroicons/react/24/outline/esm/ArrowRightIcon.js.map +0 -1
  310. package/dist/node_modules/@heroicons/react/24/outline/esm/ClockIcon.js +0 -29
  311. package/dist/node_modules/@heroicons/react/24/outline/esm/ClockIcon.js.map +0 -1
  312. package/dist/node_modules/@heroicons/react/24/outline/esm/DocumentDuplicateIcon.js +0 -29
  313. package/dist/node_modules/@heroicons/react/24/outline/esm/DocumentDuplicateIcon.js.map +0 -1
  314. package/dist/node_modules/@heroicons/react/24/outline/esm/InformationCircleIcon.js +0 -29
  315. package/dist/node_modules/@heroicons/react/24/outline/esm/InformationCircleIcon.js.map +0 -1
  316. package/dist/node_modules/@heroicons/react/24/outline/esm/LinkIcon.js +0 -29
  317. package/dist/node_modules/@heroicons/react/24/outline/esm/LinkIcon.js.map +0 -1
  318. package/dist/node_modules/@heroicons/react/24/outline/esm/MagnifyingGlassIcon.js +0 -29
  319. package/dist/node_modules/@heroicons/react/24/outline/esm/MagnifyingGlassIcon.js.map +0 -1
  320. package/dist/node_modules/@heroicons/react/24/outline/esm/MapPinIcon.js +0 -33
  321. package/dist/node_modules/@heroicons/react/24/outline/esm/MapPinIcon.js.map +0 -1
  322. package/dist/node_modules/@heroicons/react/24/outline/esm/VideoCameraIcon.js +0 -29
  323. package/dist/node_modules/@heroicons/react/24/outline/esm/VideoCameraIcon.js.map +0 -1
  324. package/dist/node_modules/@heroicons/react/24/outline/esm/XMarkIcon.js +0 -29
  325. package/dist/node_modules/@heroicons/react/24/outline/esm/XMarkIcon.js.map +0 -1
  326. package/dist/node_modules/@tiptap/core/dist/index.js +0 -5446
  327. package/dist/node_modules/@tiptap/core/dist/index.js.map +0 -1
  328. package/dist/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js +0 -21
  329. package/dist/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js.map +0 -1
  330. package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js +0 -78
  331. package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js.map +0 -1
  332. package/dist/node_modules/@tiptap/extension-bold/dist/index.js +0 -100
  333. package/dist/node_modules/@tiptap/extension-bold/dist/index.js.map +0 -1
  334. package/dist/node_modules/@tiptap/extension-code/dist/index.js +0 -70
  335. package/dist/node_modules/@tiptap/extension-code/dist/index.js.map +0 -1
  336. package/dist/node_modules/@tiptap/extension-code-block/dist/index.js +0 -317
  337. package/dist/node_modules/@tiptap/extension-code-block/dist/index.js.map +0 -1
  338. package/dist/node_modules/@tiptap/extension-document/dist/index.js +0 -16
  339. package/dist/node_modules/@tiptap/extension-document/dist/index.js.map +0 -1
  340. package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js +0 -66
  341. package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js.map +0 -1
  342. package/dist/node_modules/@tiptap/extension-heading/dist/index.js +0 -86
  343. package/dist/node_modules/@tiptap/extension-heading/dist/index.js.map +0 -1
  344. package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js +0 -80
  345. package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js.map +0 -1
  346. package/dist/node_modules/@tiptap/extension-italic/dist/index.js +0 -98
  347. package/dist/node_modules/@tiptap/extension-italic/dist/index.js.map +0 -1
  348. package/dist/node_modules/@tiptap/extension-link/dist/index.js +0 -423
  349. package/dist/node_modules/@tiptap/extension-link/dist/index.js.map +0 -1
  350. package/dist/node_modules/@tiptap/extension-list/dist/index.js +0 -1039
  351. package/dist/node_modules/@tiptap/extension-list/dist/index.js.map +0 -1
  352. package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js +0 -61
  353. package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js.map +0 -1
  354. package/dist/node_modules/@tiptap/extension-placeholder/dist/index.js +0 -7
  355. package/dist/node_modules/@tiptap/extension-placeholder/dist/index.js.map +0 -1
  356. package/dist/node_modules/@tiptap/extension-strike/dist/index.js +0 -79
  357. package/dist/node_modules/@tiptap/extension-strike/dist/index.js.map +0 -1
  358. package/dist/node_modules/@tiptap/extension-text/dist/index.js +0 -16
  359. package/dist/node_modules/@tiptap/extension-text/dist/index.js.map +0 -1
  360. package/dist/node_modules/@tiptap/extension-underline/dist/index.js +0 -76
  361. package/dist/node_modules/@tiptap/extension-underline/dist/index.js.map +0 -1
  362. package/dist/node_modules/@tiptap/extensions/dist/index.js +0 -376
  363. package/dist/node_modules/@tiptap/extensions/dist/index.js.map +0 -1
  364. package/dist/node_modules/@tiptap/react/dist/index.js +0 -650
  365. package/dist/node_modules/@tiptap/react/dist/index.js.map +0 -1
  366. package/dist/node_modules/@tiptap/starter-kit/dist/index.js +0 -97
  367. package/dist/node_modules/@tiptap/starter-kit/dist/index.js.map +0 -1
  368. package/dist/node_modules/dayjs/dayjs.min.js +0 -283
  369. package/dist/node_modules/dayjs/dayjs.min.js.map +0 -1
  370. package/dist/node_modules/dayjs/plugin/customParseFormat.js +0 -130
  371. package/dist/node_modules/dayjs/plugin/customParseFormat.js.map +0 -1
  372. package/dist/node_modules/dayjs/plugin/duration.js +0 -137
  373. package/dist/node_modules/dayjs/plugin/duration.js.map +0 -1
  374. package/dist/node_modules/dayjs/plugin/isBetween.js +0 -20
  375. package/dist/node_modules/dayjs/plugin/isBetween.js.map +0 -1
  376. package/dist/node_modules/dayjs/plugin/relativeTime.js +0 -49
  377. package/dist/node_modules/dayjs/plugin/relativeTime.js.map +0 -1
  378. package/dist/node_modules/fast-equals/dist/es/index.js +0 -442
  379. package/dist/node_modules/fast-equals/dist/es/index.js.map +0 -1
  380. package/dist/node_modules/idb/build/index.js +0 -70
  381. package/dist/node_modules/idb/build/index.js.map +0 -1
  382. package/dist/node_modules/idb/build/wrap-idb-value.js +0 -149
  383. package/dist/node_modules/idb/build/wrap-idb-value.js.map +0 -1
  384. package/dist/node_modules/linkifyjs/dist/linkify.js +0 -1159
  385. package/dist/node_modules/linkifyjs/dist/linkify.js.map +0 -1
  386. package/dist/node_modules/orderedmap/dist/index.js +0 -120
  387. package/dist/node_modules/orderedmap/dist/index.js.map +0 -1
  388. package/dist/node_modules/prosemirror-commands/dist/index.js +0 -527
  389. package/dist/node_modules/prosemirror-commands/dist/index.js.map +0 -1
  390. package/dist/node_modules/prosemirror-dropcursor/dist/index.js +0 -137
  391. package/dist/node_modules/prosemirror-dropcursor/dist/index.js.map +0 -1
  392. package/dist/node_modules/prosemirror-gapcursor/dist/index.js +0 -221
  393. package/dist/node_modules/prosemirror-gapcursor/dist/index.js.map +0 -1
  394. package/dist/node_modules/prosemirror-history/dist/index.js +0 -357
  395. package/dist/node_modules/prosemirror-history/dist/index.js.map +0 -1
  396. package/dist/node_modules/prosemirror-keymap/dist/index.js +0 -84
  397. package/dist/node_modules/prosemirror-keymap/dist/index.js.map +0 -1
  398. package/dist/node_modules/prosemirror-model/dist/index.js +0 -3209
  399. package/dist/node_modules/prosemirror-model/dist/index.js.map +0 -1
  400. package/dist/node_modules/prosemirror-schema-list/dist/index.js +0 -131
  401. package/dist/node_modules/prosemirror-schema-list/dist/index.js.map +0 -1
  402. package/dist/node_modules/prosemirror-state/dist/index.js +0 -936
  403. package/dist/node_modules/prosemirror-state/dist/index.js.map +0 -1
  404. package/dist/node_modules/prosemirror-transform/dist/index.js +0 -1881
  405. package/dist/node_modules/prosemirror-transform/dist/index.js.map +0 -1
  406. package/dist/node_modules/prosemirror-view/dist/index.js +0 -5232
  407. package/dist/node_modules/prosemirror-view/dist/index.js.map +0 -1
  408. package/dist/node_modules/rope-sequence/dist/index.js +0 -184
  409. package/dist/node_modules/rope-sequence/dist/index.js.map +0 -1
  410. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +0 -82
  411. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js.map +0 -1
  412. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js +0 -78
  413. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js.map +0 -1
  414. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +0 -78
  415. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +0 -1
  416. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +0 -63
  417. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js.map +0 -1
  418. package/dist/node_modules/use-sync-external-store/shim/index.js +0 -13
  419. package/dist/node_modules/use-sync-external-store/shim/index.js.map +0 -1
  420. package/dist/node_modules/use-sync-external-store/shim/with-selector.js +0 -13
  421. package/dist/node_modules/use-sync-external-store/shim/with-selector.js.map +0 -1
  422. package/dist/node_modules/w3c-keyname/index.js +0 -106
  423. package/dist/node_modules/w3c-keyname/index.js.map +0 -1
  424. package/dist/node_modules/zod/v4/classic/coerce.js +0 -10
  425. package/dist/node_modules/zod/v4/classic/coerce.js.map +0 -1
  426. package/dist/node_modules/zod/v4/classic/compat.js +0 -8
  427. package/dist/node_modules/zod/v4/classic/compat.js.map +0 -1
  428. package/dist/node_modules/zod/v4/classic/errors.js +0 -45
  429. package/dist/node_modules/zod/v4/classic/errors.js.map +0 -1
  430. package/dist/node_modules/zod/v4/classic/iso.js +0 -44
  431. package/dist/node_modules/zod/v4/classic/iso.js.map +0 -1
  432. package/dist/node_modules/zod/v4/classic/parse.js +0 -30
  433. package/dist/node_modules/zod/v4/classic/parse.js.map +0 -1
  434. package/dist/node_modules/zod/v4/classic/schemas.js +0 -711
  435. package/dist/node_modules/zod/v4/classic/schemas.js.map +0 -1
  436. package/dist/node_modules/zod/v4/core/api.js +0 -588
  437. package/dist/node_modules/zod/v4/core/api.js.map +0 -1
  438. package/dist/node_modules/zod/v4/core/checks.js +0 -411
  439. package/dist/node_modules/zod/v4/core/checks.js.map +0 -1
  440. package/dist/node_modules/zod/v4/core/core.js +0 -75
  441. package/dist/node_modules/zod/v4/core/core.js.map +0 -1
  442. package/dist/node_modules/zod/v4/core/doc.js +0 -38
  443. package/dist/node_modules/zod/v4/core/doc.js.map +0 -1
  444. package/dist/node_modules/zod/v4/core/errors.js +0 -73
  445. package/dist/node_modules/zod/v4/core/errors.js.map +0 -1
  446. package/dist/node_modules/zod/v4/core/json-schema-processors.js +0 -359
  447. package/dist/node_modules/zod/v4/core/json-schema-processors.js.map +0 -1
  448. package/dist/node_modules/zod/v4/core/parse.js +0 -96
  449. package/dist/node_modules/zod/v4/core/parse.js.map +0 -1
  450. package/dist/node_modules/zod/v4/core/regexes.js +0 -84
  451. package/dist/node_modules/zod/v4/core/regexes.js.map +0 -1
  452. package/dist/node_modules/zod/v4/core/registries.js +0 -52
  453. package/dist/node_modules/zod/v4/core/registries.js.map +0 -1
  454. package/dist/node_modules/zod/v4/core/schemas.js +0 -1391
  455. package/dist/node_modules/zod/v4/core/schemas.js.map +0 -1
  456. package/dist/node_modules/zod/v4/core/to-json-schema.js +0 -363
  457. package/dist/node_modules/zod/v4/core/to-json-schema.js.map +0 -1
  458. package/dist/node_modules/zod/v4/core/util.js +0 -431
  459. package/dist/node_modules/zod/v4/core/util.js.map +0 -1
  460. package/dist/node_modules/zod/v4/core/versions.js +0 -9
  461. package/dist/node_modules/zod/v4/core/versions.js.map +0 -1
  462. package/dist/redux/baseQuery.d.ts +0 -1
  463. package/dist/redux/baseQuery.js +0 -24
  464. package/dist/redux/baseQuery.js.map +0 -1
  465. package/dist/services/eventApi.js +0 -411
  466. package/dist/services/eventApi.js.map +0 -1
  467. package/dist/services/helpers.js +0 -115
  468. package/dist/services/helpers.js.map +0 -1
  469. package/dist/services/initialize-firebase.d.ts +0 -2
  470. package/dist/services/initialize-firebase.js +0 -20
  471. package/dist/services/initialize-firebase.js.map +0 -1
  472. package/dist/services/process-image-on-server.js +0 -30
  473. package/dist/services/process-image-on-server.js.map +0 -1
  474. package/dist/services/remote-config.d.ts +0 -5
  475. package/dist/services/remote-config.js +0 -9
  476. package/dist/services/remote-config.js.map +0 -1
  477. package/dist/services/single-event-api.js +0 -301
  478. package/dist/services/single-event-api.js.map +0 -1
  479. package/dist/services/utils.js +0 -107
  480. package/dist/services/utils.js.map +0 -1
  481. package/dist/setupTests.d.ts +0 -1
  482. package/dist/stories/Alert.stories.d.ts +0 -10
  483. package/dist/stories/Button.stories.d.ts +0 -13
  484. package/dist/types/redux-types.d.ts +0 -15
  485. package/dist/types/types.d.ts +0 -60
  486. package/dist/types/types.js +0 -10
  487. package/dist/types/types.js.map +0 -1
  488. package/dist/utils/cn.d.ts +0 -6
  489. package/dist/utils/cn.js +0 -9
  490. package/dist/utils/cn.js.map +0 -1
  491. package/dist/utils/date-range.d.ts +0 -4
  492. package/dist/utils/date-range.js +0 -13
  493. package/dist/utils/date-range.js.map +0 -1
  494. package/dist/utils/single-event-helpers.d.ts +0 -50
  495. package/dist/utils/single-event-helpers.js +0 -18
  496. package/dist/utils/single-event-helpers.js.map +0 -1
  497. package/dist/utils/social-validation.js +0 -42
  498. package/dist/utils/social-validation.js.map +0 -1
  499. package/dist/utils/utils.js +0 -20
  500. package/dist/utils/utils.js.map +0 -1
  501. /package/dist/{components/Alert/Alert.d.ts → src/components/Alert/index.d.ts} +0 -0
  502. /package/dist/{components → src/components}/FormBuilder/CategoryList.d.ts +0 -0
  503. /package/dist/{components → src/components}/FormBuilder/OptionList.d.ts +0 -0
  504. /package/dist/{components → src/components}/FormBuilder/RequiredToggle.d.ts +0 -0
  505. /package/dist/{components → src/components}/FormBuilder/types.d.ts +0 -0
  506. /package/dist/{components → src/components}/FormBuilder/utils.d.ts +0 -0
  507. /package/dist/{components → src/components}/ImageCropModal/index.d.ts +0 -0
  508. /package/dist/{components → src/components}/InformationPopover.d.ts +0 -0
  509. /package/dist/{components/EventAddForm → src/components/NewAddEvent}/common/DescriptionModal.d.ts +0 -0
  510. /package/dist/{components/ui/FormInput.d.ts → src/components/NewAddEvent/components/AddEventFormInput.d.ts} +0 -0
  511. /package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/CheckboxGroup.d.ts +0 -0
  512. /package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/CustomMeetingForm.d.ts +0 -0
  513. /package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/DateTimeField.d.ts +0 -0
  514. /package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/FileUpload.d.ts +0 -0
  515. /package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/FormBuilderProceedModal.d.ts +0 -0
  516. /package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/GoogleMapsAutocompleteInput.d.ts +0 -0
  517. /package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/SingleDateTimeInput.d.ts +0 -0
  518. /package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/StepTwo/CustomFormSection.d.ts +0 -0
  519. /package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/TicketTypeSelection.d.ts +0 -0
  520. /package/dist/{components/EventAddForm → src/components/NewAddEvent}/steps/StepOne.d.ts +0 -0
  521. /package/dist/{components/EventAddForm → src/components/NewAddEvent}/steps/StepTwo.d.ts +0 -0
  522. /package/dist/{components/EventAddForm → src/components/NewAddEvent}/types.d.ts +0 -0
  523. /package/dist/{components → src/components}/common/FallbackImage.d.ts +0 -0
  524. /package/dist/{components → src/components}/ui/Calendar/calendar-utils.d.ts +0 -0
  525. /package/dist/{components → src/components}/ui/Calendar/index.d.ts +0 -0
  526. /package/dist/{components/Checkbox → src/components/ui}/Checkbox.d.ts +0 -0
  527. /package/dist/{components/CustomSelect → src/components/ui}/CustomSelect.d.ts +0 -0
  528. /package/dist/{components → src/components}/ui/DatePicker/index.d.ts +0 -0
  529. /package/dist/{components/InputErrorMessage → src/components/ui}/InputErrorMessage.d.ts +0 -0
  530. /package/dist/{components → src/components}/ui/Modal/index.d.ts +0 -0
  531. /package/dist/{components/Radio → src/components/ui}/Radio.d.ts +0 -0
  532. /package/dist/{components → src/components}/ui/RichTextEditor.d.ts +0 -0
  533. /package/dist/{components → src/components}/ui/TimePicker/index.d.ts +0 -0
  534. /package/dist/{components → src/components}/ui/TimeSelector/index.d.ts +0 -0
  535. /package/dist/{components → src/components}/ui/Tooltip/index.d.ts +0 -0
  536. /package/dist/{lib → src/lib}/constants.d.ts +0 -0
  537. /package/dist/{lib → src/lib}/cropImage.d.ts +0 -0
  538. /package/dist/{lib → src/lib}/imageAnalysis.d.ts +0 -0
  539. /package/dist/{utils → src/lib}/social-validation.d.ts +0 -0
  540. /package/dist/{lib/utils.d.ts → src/lib/tailwind-merge.d.ts} +0 -0
  541. /package/dist/{utils → src/lib}/utils.d.ts +0 -0
  542. /package/dist/{services → src/redux/features/single-event}/helpers.d.ts +0 -0
  543. /package/dist/{services → src/services}/process-image-on-server.d.ts +0 -0
  544. /package/dist/{types → src/types}/events.d.ts +0 -0
  545. /package/dist/{types → src/types}/question.d.ts +0 -0
@@ -1,918 +0,0 @@
1
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import { memo, forwardRef, useState, useRef, useEffect, useCallback, useMemo, useImperativeHandle } from "react";
3
- import { useSensors, useSensor, DndContext, closestCenter, DragOverlay, KeyboardSensor, PointerSensor } from "../../node_modules/@dnd-kit/core/dist/core.esm.js";
4
- import { SortableContext, verticalListSortingStrategy, arrayMove, sortableKeyboardCoordinates } from "../../node_modules/@dnd-kit/sortable/dist/sortable.esm.js";
5
- import { ChevronDown, Plus, ClipboardList } from "lucide-react";
6
- import { AnimatePresence, motion } from "framer-motion";
7
- import { SortableQuestionList } from "./SortableQuestionList.js";
8
- import QuestionCard from "./QuestionCard.js";
9
- import { normalizeFormSchema, denormalizeFormSchema, getDiscountFilePath, validateQuestionError } from "./utils.js";
10
- import Alert from "../Alert/Alert.js";
11
- import { Tooltip } from "../Tooltip/Tooltip.js";
12
- import { cn } from "../../utils/cn.js";
13
- import ForwardRef from "../../node_modules/@heroicons/react/24/outline/esm/InformationCircleIcon.js";
14
- import { Button } from "../Button/Button.js";
15
- const EmptyState = ({ onAdd, isAddingNew }) => /* @__PURE__ */ jsxs("div", { className: "ui-flex ui-flex-col ui-items-center ui-justify-center ui-py-12 ui-px-4 ui-border-2 ui-border-dashed ui-border-grey-200 ui-rounded-xl ui-bg-grey-50/50 ui-text-center", children: [
16
- /* @__PURE__ */ jsx("div", { className: "ui-bg-white ui-p-3 ui-rounded-full ui-shadow-sm ui-mb-4", children: /* @__PURE__ */ jsx(ClipboardList, { className: "ui-w-6 ui-h-6 ui-text-purple-600" }) }),
17
- /* @__PURE__ */ jsx("h3", { className: "ui-text-lg ui-font-semibold ui-text-gray-900 ui-mb-1", children: "No questions yet" }),
18
- /* @__PURE__ */ jsx("p", { className: "ui-text-sm ui-text-grey-500 ui-mb-6 ui-max-w-sm", children: "Start building your form by adding your first question." }),
19
- /* @__PURE__ */ jsxs(
20
- Button,
21
- {
22
- type: "button",
23
- onClick: (e) => {
24
- e.stopPropagation();
25
- if (!isAddingNew) onAdd();
26
- },
27
- disabled: isAddingNew,
28
- className: cn("ui-gap-2", isAddingNew && "ui-opacity-50 ui-cursor-not-allowed"),
29
- children: [
30
- /* @__PURE__ */ jsx(Plus, { className: "ui-w-4 ui-h-4" }),
31
- "Add Question"
32
- ]
33
- }
34
- )
35
- ] });
36
- const FormBuilder = forwardRef(({
37
- eventId,
38
- initialFields,
39
- participationType,
40
- scope,
41
- isSameQuestionTitleAllowed = true,
42
- allowedDiscountQuestions = 1,
43
- onQuestionsChange,
44
- onBusyStateChange,
45
- onPolluted,
46
- discountFilePath,
47
- individualDiscountFilePath,
48
- userUid,
49
- addQuestion,
50
- editQuestion,
51
- deleteQuestion,
52
- updateOrder,
53
- storageService
54
- }, ref) => {
55
- const [questions, setQuestions] = useState({});
56
- const [questionOrder, setQuestionOrder] = useState([]);
57
- const [isLocked, setIsLocked] = useState(false);
58
- const [isLoaded, setIsLoaded] = useState(false);
59
- const questionsRef = useRef(questions);
60
- const questionOrderRef = useRef(questionOrder);
61
- useEffect(() => {
62
- questionsRef.current = questions;
63
- }, [questions]);
64
- useEffect(() => {
65
- questionOrderRef.current = questionOrder;
66
- }, [questionOrder]);
67
- const dirtyQuestionsRef = useRef(/* @__PURE__ */ new Set());
68
- const newQuestionsRef = useRef(/* @__PURE__ */ new Set());
69
- const isOrderDirtyRef = useRef(false);
70
- const [isDirtyForUI, setIsDirtyForUI] = useState(false);
71
- const snapshotRef = useRef(null);
72
- const isCurrentSessionNewRef = useRef(false);
73
- const isSavingRef = useRef(false);
74
- const [editingQuestionId, setEditingQuestionId] = useState(null);
75
- const [showValidationErrors, setShowValidationErrors] = useState(false);
76
- const [activeId, setActiveId] = useState(null);
77
- const [alertState, setAlertState] = useState({
78
- isVisible: false,
79
- message: "",
80
- type: "success"
81
- });
82
- const [isTeamOpen, setIsTeamOpen] = useState(true);
83
- const [isIndividualOpen, setIsIndividualOpen] = useState(true);
84
- const [isTeamMemberOpen, setIsTeamMemberOpen] = useState(true);
85
- const isBusy = isSavingRef.current || isDirtyForUI;
86
- useEffect(() => {
87
- if (onBusyStateChange) {
88
- onBusyStateChange(isBusy);
89
- }
90
- }, [isBusy, onBusyStateChange]);
91
- const showAlert = useCallback((message, type) => {
92
- setAlertState({ isVisible: true, message, type });
93
- setTimeout(() => setAlertState((prev) => ({ ...prev, isVisible: false })), 3e3);
94
- }, []);
95
- const formId = useMemo(() => `event-form-${eventId || "new"}`, [eventId]);
96
- useEffect(() => {
97
- if (initialFields) {
98
- const hasUnsavedChanges = dirtyQuestionsRef.current.size > 0 || isOrderDirtyRef.current || newQuestionsRef.current.size > 0;
99
- if (!isLoaded || !hasUnsavedChanges) {
100
- const normalizedData = normalizeFormSchema(initialFields, discountFilePath, individualDiscountFilePath);
101
- setQuestions(normalizedData.questions || {});
102
- setQuestionOrder(normalizedData.questionOrder || []);
103
- setIsLocked(normalizedData.status === "LOCKED");
104
- if (!isLoaded) setIsLoaded(true);
105
- }
106
- }
107
- }, [initialFields, isLoaded]);
108
- const notifyParentOfChange = useCallback((newQuestions, newOrder) => {
109
- if (onQuestionsChange) {
110
- const arrayFormat = denormalizeFormSchema(newQuestions, newOrder);
111
- onQuestionsChange(arrayFormat);
112
- }
113
- }, [onQuestionsChange]);
114
- const isTeamEvent = participationType === "2" || participationType === "TEAM";
115
- const discountQuestionsCount = useMemo(() => {
116
- return Object.values(questions).filter((q) => {
117
- if (q.kind !== "DISCOUNT") return false;
118
- if (scope) {
119
- if (scope === "INDIVIDUAL") {
120
- const isBothParticipation = participationType === "3" || participationType === "BOTH";
121
- return q.scope === "INDIVIDUAL" || isBothParticipation && q.scope === "BOTH";
122
- } else if (scope === "TEAM") {
123
- return q.scope === "TEAM" || q.scope === "BOTH";
124
- }
125
- }
126
- if (participationType === "INDIVIDUAL") {
127
- return q.scope === "INDIVIDUAL" || q.scope === "BOTH";
128
- } else if (isTeamEvent) {
129
- return q.scope === "TEAM" || q.scope === "BOTH";
130
- }
131
- return true;
132
- }).length;
133
- }, [questions, scope, participationType, isTeamEvent]);
134
- const disableDiscountOption = discountQuestionsCount >= allowedDiscountQuestions;
135
- const { teamQuestionsOrder, teamMemberQuestionsOrder, individualQuestionsOrder } = useMemo(() => {
136
- const team = [];
137
- const teamMember = [];
138
- const individual = [];
139
- questionOrder.forEach((id) => {
140
- const q = questions[id];
141
- if (!q) return;
142
- if (scope) {
143
- if (scope === "INDIVIDUAL") {
144
- const isBothParticipation = participationType === "3" || participationType === "BOTH";
145
- if (q.scope === "INDIVIDUAL" || isBothParticipation && q.scope === "BOTH") {
146
- individual.push(id);
147
- }
148
- } else if (scope === "TEAM" && (q.scope === "TEAM" || q.scope === "BOTH")) {
149
- if (q.individual === false) team.push(id);
150
- else teamMember.push(id);
151
- }
152
- return;
153
- }
154
- if (participationType === "INDIVIDUAL") {
155
- if (q.scope === "INDIVIDUAL" || q.scope === "BOTH") individual.push(id);
156
- } else if (isTeamEvent) {
157
- if (q.scope === "TEAM" || q.scope === "BOTH") {
158
- if (q.individual === false) team.push(id);
159
- else teamMember.push(id);
160
- }
161
- } else {
162
- if (q.individual === false) team.push(id);
163
- else individual.push(id);
164
- }
165
- });
166
- return {
167
- teamQuestionsOrder: team,
168
- teamMemberQuestionsOrder: teamMember,
169
- individualQuestionsOrder: individual
170
- };
171
- }, [questionOrder, questions, scope, participationType, isTeamEvent]);
172
- const autoSaveTimerRef = useRef(null);
173
- const markDirty = (desc, delay = 3e4) => {
174
- setIsDirtyForUI(true);
175
- if (autoSaveTimerRef.current) clearTimeout(autoSaveTimerRef.current);
176
- autoSaveTimerRef.current = setTimeout(() => {
177
- saveRoutine();
178
- }, delay);
179
- };
180
- useEffect(() => {
181
- return () => {
182
- if (autoSaveTimerRef.current) clearTimeout(autoSaveTimerRef.current);
183
- };
184
- }, []);
185
- const saveRoutine = async (retryCount = 0) => {
186
- var _a, _b;
187
- if (isSavingRef.current) {
188
- return new Promise((resolve) => {
189
- const check = () => {
190
- if (!isSavingRef.current) resolve();
191
- else setTimeout(check, 100);
192
- };
193
- check();
194
- });
195
- }
196
- isSavingRef.current = true;
197
- autoSaveTimerRef.current = null;
198
- const dirtyIds = Array.from(dirtyQuestionsRef.current);
199
- const orderDirty = isOrderDirtyRef.current;
200
- if (dirtyIds.length === 0 && !orderDirty) {
201
- setIsDirtyForUI(false);
202
- isSavingRef.current = false;
203
- return;
204
- }
205
- const questionPromises = [];
206
- let hasSkippedQuestions = false;
207
- for (const id of dirtyIds) {
208
- const q = questionsRef.current[id];
209
- if (!q) {
210
- dirtyQuestionsRef.current.delete(id);
211
- continue;
212
- }
213
- const stateBeingSaved = JSON.stringify(q);
214
- const isNew = newQuestionsRef.current.has(id);
215
- const isChoice = ["MULTIPLE_CHOICE", "CHECKBOX", "DROPDOWN"].includes(q.kind);
216
- const isPayment = ["PAYMENT", "PAYMENT_CHECKBOX"].includes(q.kind);
217
- const effectiveScope = scope || q.scope || (q.individual === false ? "TEAM" : "INDIVIDUAL");
218
- const path = `/data/${userUid}/events/discounts/${eventId}.csv`;
219
- const individualPath = `/data/${userUid}/events/discounts/${eventId}_individual.csv`;
220
- const discountPath = userUid ? path : q.discount_file_path;
221
- const individualDiscountPath = userUid ? individualPath : discountPath;
222
- if (q.kind === "DISCOUNT" && q.file && userUid && storageService) {
223
- try {
224
- const targetUploadPath = getDiscountFilePath(eventId, userUid, participationType, scope, q);
225
- await storageService.uploadFile(targetUploadPath, q.file);
226
- } catch (err) {
227
- console.error("Failed to upload discount file", err);
228
- showAlert("Failed to upload discount file", "error");
229
- continue;
230
- }
231
- }
232
- const basePayload = {
233
- event_id: eventId,
234
- question_type: q.kind,
235
- placeholder: q.placeholder || "",
236
- validation: q.required,
237
- individual: q.individual !== false,
238
- scope: effectiveScope,
239
- conditions: {},
240
- options: isChoice ? ((_a = q.options) == null ? void 0 : _a.map((o) => ({ value: o.value || o.label }))) || [] : [],
241
- Categories: isPayment ? ((_b = q.Categories) == null ? void 0 : _b.map((c) => ({ name: c.name, price: c.price }))) || [] : [],
242
- additional_fee: isPayment,
243
- applies_on: q.kind === "DISCOUNT" ? q.applies_on || [] : [],
244
- discount_file_path: effectiveScope === "TEAM" || effectiveScope === "BOTH" || effectiveScope === "INDIVIDUAL" ? discountPath || "" : "",
245
- individual_discount_file_path: effectiveScope === "INDIVIDUAL" || effectiveScope === "BOTH" ? individualDiscountPath || "" : ""
246
- };
247
- if (isNew) {
248
- if (addQuestion) {
249
- const apiPayload = { ...basePayload, question: q.label };
250
- if (!apiPayload.question || isChoice && apiPayload.options.length === 0 || isPayment && apiPayload.Categories.length === 0 || q.kind === "DISCOUNT" && apiPayload.applies_on.length === 0 || q.kind === "DISCOUNT" && effectiveScope === "TEAM" && !apiPayload.discount_file_path || q.kind === "DISCOUNT" && effectiveScope === "INDIVIDUAL" && !apiPayload.individual_discount_file_path) {
251
- hasSkippedQuestions = true;
252
- continue;
253
- }
254
- questionPromises.push(
255
- addQuestion(apiPayload).then(() => {
256
- const currentState = JSON.stringify(questionsRef.current[id]);
257
- newQuestionsRef.current.delete(id);
258
- setQuestions((prev) => {
259
- if (!prev[id]) return prev;
260
- return { ...prev, [id]: { ...prev[id], originalLabel: q.label } };
261
- });
262
- if (currentState === stateBeingSaved) dirtyQuestionsRef.current.delete(id);
263
- if (onPolluted) onPolluted();
264
- })
265
- );
266
- }
267
- } else {
268
- if (editQuestion) {
269
- const apiPayload = {
270
- ...basePayload,
271
- question: q.originalLabel || q.label,
272
- new_question: q.label
273
- };
274
- if (!apiPayload.new_question || isChoice && apiPayload.options.length === 0 || isPayment && apiPayload.Categories.length === 0 || q.kind === "DISCOUNT" && apiPayload.applies_on.length === 0) {
275
- hasSkippedQuestions = true;
276
- continue;
277
- }
278
- questionPromises.push(
279
- editQuestion(apiPayload).then(() => {
280
- const currentState = JSON.stringify(questionsRef.current[id]);
281
- setQuestions((prev) => {
282
- if (!prev[id]) return prev;
283
- return { ...prev, [id]: { ...prev[id], originalLabel: q.label } };
284
- });
285
- if (currentState === stateBeingSaved) dirtyQuestionsRef.current.delete(id);
286
- if (onPolluted) onPolluted();
287
- })
288
- );
289
- }
290
- }
291
- }
292
- try {
293
- if (questionPromises.length > 0) await Promise.all(questionPromises);
294
- if (orderDirty && !hasSkippedQuestions && updateOrder) {
295
- const orderSnapshot = [...questionOrderRef.current];
296
- const orderPayload = {
297
- event_id: eventId,
298
- questions: orderSnapshot.map((id, index) => {
299
- const q = questionsRef.current[id];
300
- return q ? { question: q.label, order: 900 + index } : null;
301
- }).filter(Boolean)
302
- };
303
- await updateOrder(orderPayload).then(() => {
304
- const currentOrderJSON = JSON.stringify(questionOrderRef.current);
305
- const sentOrderJSON = JSON.stringify(orderSnapshot);
306
- if (currentOrderJSON === sentOrderJSON) isOrderDirtyRef.current = false;
307
- if (onPolluted) onPolluted();
308
- });
309
- }
310
- if (dirtyQuestionsRef.current.size === 0 && !isOrderDirtyRef.current) {
311
- setIsDirtyForUI(false);
312
- }
313
- } catch (e) {
314
- console.error("Auto-save failed", e);
315
- if (!autoSaveTimerRef.current && retryCount < 3) {
316
- autoSaveTimerRef.current = setTimeout(() => {
317
- saveRoutine(retryCount + 1);
318
- }, 3e4);
319
- setIsDirtyForUI(true);
320
- } else {
321
- showAlert("Failed to save changes. Please try again.", "error");
322
- }
323
- } finally {
324
- isSavingRef.current = false;
325
- }
326
- };
327
- useImperativeHandle(ref, () => ({
328
- save: async () => {
329
- if (editingQuestionId) {
330
- handleCancel(editingQuestionId);
331
- setShowValidationErrors(false);
332
- }
333
- if (!isSameQuestionTitleAllowed) {
334
- const titles = /* @__PURE__ */ new Set();
335
- const duplicates = /* @__PURE__ */ new Set();
336
- Object.values(questions).forEach((q) => {
337
- var _a;
338
- const normalized = (_a = q.label) == null ? void 0 : _a.trim().toLowerCase();
339
- if (!normalized) return;
340
- if (titles.has(normalized)) duplicates.add(q.label);
341
- titles.add(normalized);
342
- });
343
- if (duplicates.size > 0) {
344
- const dupList = Array.from(duplicates).join(", ");
345
- showAlert(`Duplicate titles: ${dupList}`, "error");
346
- throw new Error(`Duplicate titles: ${dupList}`);
347
- }
348
- }
349
- return await saveRoutine();
350
- },
351
- validateNavigation: () => {
352
- if (editingQuestionId) {
353
- handleCancel(editingQuestionId);
354
- setShowValidationErrors(false);
355
- }
356
- return true;
357
- },
358
- isSaving: () => isSavingRef.current || isBusy,
359
- isDirty: () => isDirtyForUI
360
- }));
361
- useEffect(() => {
362
- if (!isDirtyForUI) return;
363
- const handleBeforeUnload = (e) => {
364
- e.preventDefault();
365
- e.returnValue = "";
366
- saveRoutine();
367
- };
368
- window.addEventListener("beforeunload", handleBeforeUnload);
369
- return () => window.removeEventListener("beforeunload", handleBeforeUnload);
370
- }, [isDirtyForUI]);
371
- const updateQuestionLocal = (id, updates) => {
372
- setQuestions((prev) => {
373
- const current = prev[id];
374
- if (!current) return prev;
375
- const updated = { ...prev, [id]: { ...current, ...updates } };
376
- questionsRef.current = updated;
377
- if (updates.options || updates.Categories || updates.label !== void 0 || updates.file !== void 0 || updates.applies_on !== void 0) {
378
- setShowValidationErrors(false);
379
- }
380
- if (onQuestionsChange) {
381
- clearTimeout(window._notifyTimer);
382
- window._notifyTimer = setTimeout(() => {
383
- notifyParentOfChange(updated, questionOrderRef.current);
384
- }, 500);
385
- }
386
- return updated;
387
- });
388
- dirtyQuestionsRef.current.add(id);
389
- markDirty();
390
- };
391
- const addQuestionLocal = (question, indexToInsert) => {
392
- const updatedQuestions = { ...questionsRef.current, [question.id]: question };
393
- setQuestions(updatedQuestions);
394
- questionsRef.current = updatedQuestions;
395
- setQuestionOrder((prev) => {
396
- const newOrder = [...prev];
397
- newOrder.push(question.id);
398
- questionOrderRef.current = newOrder;
399
- notifyParentOfChange(questionsRef.current, newOrder);
400
- return newOrder;
401
- });
402
- newQuestionsRef.current.add(question.id);
403
- dirtyQuestionsRef.current.add(question.id);
404
- isOrderDirtyRef.current = true;
405
- markDirty();
406
- };
407
- const deleteQuestionLocal = async (id) => {
408
- const q = questions[id];
409
- if (!q) return;
410
- if (["TEAM_SIZE", "NAME_ON_TICKET"].includes(q.kind)) {
411
- showAlert("System questions cannot be deleted", "error");
412
- return;
413
- }
414
- const nextQuestions = { ...questionsRef.current };
415
- delete nextQuestions[id];
416
- setQuestions(nextQuestions);
417
- questionsRef.current = nextQuestions;
418
- const nextOrder = questionOrderRef.current.filter((qid) => qid !== id);
419
- setQuestionOrder(nextOrder);
420
- questionOrderRef.current = nextOrder;
421
- notifyParentOfChange(nextQuestions, nextOrder);
422
- if (editingQuestionId === id) setEditingQuestionId(null);
423
- if (newQuestionsRef.current.has(id)) {
424
- dirtyQuestionsRef.current.delete(id);
425
- newQuestionsRef.current.delete(id);
426
- return;
427
- }
428
- if (deleteQuestion) {
429
- try {
430
- await deleteQuestion({ event_id: eventId, question: q.originalLabel || q.label });
431
- dirtyQuestionsRef.current.delete(id);
432
- newQuestionsRef.current.delete(id);
433
- if (onPolluted) onPolluted();
434
- } catch (e) {
435
- console.error("Delete failed", e);
436
- }
437
- }
438
- };
439
- const startEditing = (id, questionOverride) => {
440
- const q = questions[id];
441
- if (q) {
442
- snapshotRef.current = JSON.parse(JSON.stringify(q));
443
- isCurrentSessionNewRef.current = false;
444
- }
445
- setEditingQuestionId(id);
446
- };
447
- const handleCancel = (id) => {
448
- if (isCurrentSessionNewRef.current) {
449
- const nextQuestions = { ...questionsRef.current };
450
- delete nextQuestions[id];
451
- setQuestions(nextQuestions);
452
- questionsRef.current = nextQuestions;
453
- const nextOrder = questionOrderRef.current.filter((qid) => qid !== id);
454
- setQuestionOrder(nextOrder);
455
- questionOrderRef.current = nextOrder;
456
- dirtyQuestionsRef.current.delete(id);
457
- newQuestionsRef.current.delete(id);
458
- setEditingQuestionId(null);
459
- setShowValidationErrors(false);
460
- return;
461
- }
462
- if (snapshotRef.current) {
463
- setQuestions((prev) => {
464
- const updated = { ...prev, [id]: { ...snapshotRef.current, file: void 0 } };
465
- questionsRef.current = updated;
466
- return updated;
467
- });
468
- }
469
- dirtyQuestionsRef.current.delete(id);
470
- if (dirtyQuestionsRef.current.size === 0 && !isOrderDirtyRef.current) setIsDirtyForUI(false);
471
- setEditingQuestionId(null);
472
- setShowValidationErrors(false);
473
- };
474
- const triggerSave = () => {
475
- snapshotRef.current = null;
476
- isCurrentSessionNewRef.current = false;
477
- if (autoSaveTimerRef.current) clearTimeout(autoSaveTimerRef.current);
478
- autoSaveTimerRef.current = setTimeout(() => saveRoutine(), 100);
479
- };
480
- const handleSetActiveQuestion = (newId) => {
481
- if (newId === null) {
482
- if (editingQuestionId) handleCancel(editingQuestionId);
483
- return;
484
- }
485
- if (editingQuestionId && editingQuestionId !== newId) {
486
- const current = questions[editingQuestionId];
487
- if (!current) {
488
- startEditing(newId);
489
- setShowValidationErrors(false);
490
- return;
491
- }
492
- if (validateQuestionError(current, questions, participationType, isSameQuestionTitleAllowed) !== null) {
493
- setShowValidationErrors(true);
494
- showAlert("Please complete the current question to proceed.", "error");
495
- return;
496
- } else {
497
- triggerSave();
498
- setShowValidationErrors(false);
499
- }
500
- }
501
- startEditing(newId);
502
- setShowValidationErrors(false);
503
- };
504
- const sensors = useSensors(
505
- useSensor(PointerSensor, { activationConstraint: { distance: 3 } }),
506
- useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates })
507
- );
508
- const handleDragStart = (event) => {
509
- setActiveId(event.active.id);
510
- if (editingQuestionId) setEditingQuestionId(null);
511
- };
512
- const handleDragEnd = (event) => {
513
- const { active, over } = event;
514
- setActiveId(null);
515
- if (!over || active.id === over.id) return;
516
- const oldIndex = questionOrder.indexOf(active.id);
517
- const newIndex = questionOrder.indexOf(over.id);
518
- const activeQ = questions[active.id];
519
- const overQ = questions[over.id];
520
- if (isTeamEvent && activeQ && overQ && activeQ.individual !== overQ.individual) return;
521
- if (["TEAM_SIZE", "NAME_ON_TICKET"].includes(activeQ == null ? void 0 : activeQ.kind)) return;
522
- if (oldIndex !== -1 && newIndex !== -1) {
523
- const newOrder = arrayMove(questionOrder, oldIndex, newIndex);
524
- setQuestionOrder(newOrder);
525
- questionOrderRef.current = newOrder;
526
- isOrderDirtyRef.current = true;
527
- markDirty();
528
- notifyParentOfChange(questions, newOrder);
529
- }
530
- };
531
- const handleAddClick = (isIndividual = true) => {
532
- if (editingQuestionId) {
533
- const q = questions[editingQuestionId];
534
- if (q && validateQuestionError(q, questions, participationType, isSameQuestionTitleAllowed) !== null) {
535
- setShowValidationErrors(true);
536
- showAlert("Please complete the current question to proceed.", "error");
537
- return;
538
- }
539
- triggerSave();
540
- setShowValidationErrors(false);
541
- }
542
- const newId = crypto.randomUUID();
543
- let defaultScope = scope || (isTeamEvent ? "TEAM" : "INDIVIDUAL");
544
- const newQuestion = {
545
- id: newId,
546
- kind: "INPUT_STR",
547
- label: "",
548
- required: false,
549
- options: [],
550
- individual: isIndividual,
551
- scope: defaultScope
552
- };
553
- addQuestionLocal(newQuestion);
554
- isCurrentSessionNewRef.current = true;
555
- snapshotRef.current = JSON.parse(JSON.stringify(newQuestion));
556
- setEditingQuestionId(newId);
557
- };
558
- const handleDuplicate = (id) => {
559
- var _a, _b;
560
- const original = questions[id];
561
- if (!original) return;
562
- if (["TEAM_SIZE", "NAME_ON_TICKET"].includes(original.kind)) {
563
- showAlert("System questions cannot be duplicated", "error");
564
- return;
565
- }
566
- const newId = crypto.randomUUID();
567
- const baseName = (original.label || "").replace(/\s+copy\s+\(\d+\)$/i, "").trim();
568
- let nextNumber = 1;
569
- const labels = Object.values(questions).map((q) => {
570
- var _a2;
571
- return ((_a2 = q.label) == null ? void 0 : _a2.toLowerCase()) || "";
572
- });
573
- while (labels.includes(`${baseName} copy (${nextNumber})`.toLowerCase())) nextNumber++;
574
- const newQuestion = {
575
- ...original,
576
- id: newId,
577
- label: `${baseName} copy (${nextNumber})`,
578
- options: ((_a = original.options) == null ? void 0 : _a.map((o) => ({ ...o, id: crypto.randomUUID() }))) || [],
579
- Categories: ((_b = original.Categories) == null ? void 0 : _b.map((c) => ({ ...c, id: crypto.randomUUID() }))) || []
580
- };
581
- const originalIndex = questionOrder.indexOf(id);
582
- const newOrder = [...questionOrder];
583
- newOrder.splice(originalIndex + 1, 0, newId);
584
- setQuestions((prev) => {
585
- const updated = { ...prev, [newId]: newQuestion };
586
- questionsRef.current = updated;
587
- return updated;
588
- });
589
- setQuestionOrder(newOrder);
590
- questionOrderRef.current = newOrder;
591
- newQuestionsRef.current.add(newId);
592
- dirtyQuestionsRef.current.add(newId);
593
- isOrderDirtyRef.current = true;
594
- markDirty();
595
- isCurrentSessionNewRef.current = true;
596
- setEditingQuestionId(newId);
597
- };
598
- const handleManualSave = (id) => {
599
- const q = questions[id];
600
- if (!q) return;
601
- if (validateQuestionError(q, questions, participationType, isSameQuestionTitleAllowed) !== null) {
602
- setShowValidationErrors(true);
603
- return;
604
- }
605
- triggerSave();
606
- setShowValidationErrors(false);
607
- setEditingQuestionId(null);
608
- };
609
- const activeQuestionProps = (id) => {
610
- const q = questions[id];
611
- const err = validateQuestionError(q, questions, participationType, isSameQuestionTitleAllowed);
612
- return {
613
- isDirty: dirtyQuestionsRef.current.has(id),
614
- isSaving: isSavingRef.current,
615
- isNew: newQuestionsRef.current.has(id),
616
- isValid: err === null,
617
- errorMessage: showValidationErrors ? err || void 0 : void 0
618
- };
619
- };
620
- const handleSectionToggle = (section) => {
621
- let currentIsOpen = false;
622
- let setOpen = () => {
623
- };
624
- let qOrder = [];
625
- if (section === "TEAM") {
626
- currentIsOpen = isTeamOpen;
627
- setOpen = setIsTeamOpen;
628
- qOrder = teamQuestionsOrder;
629
- } else if (section === "TEAM_MEMBER") {
630
- currentIsOpen = isTeamMemberOpen;
631
- setOpen = setIsTeamMemberOpen;
632
- qOrder = teamMemberQuestionsOrder;
633
- } else {
634
- currentIsOpen = isIndividualOpen;
635
- setOpen = setIsIndividualOpen;
636
- qOrder = individualQuestionsOrder;
637
- }
638
- if (currentIsOpen && editingQuestionId && qOrder.includes(editingQuestionId)) {
639
- handleSetActiveQuestion(null);
640
- }
641
- setOpen(!currentIsOpen);
642
- };
643
- if (!isLoaded && initialFields) return /* @__PURE__ */ jsx("div", { className: "ui-p-8 ui-text-center ui-text-gray-500", children: "Loading Form Builder..." });
644
- const isAddingNew = editingQuestionId ? newQuestionsRef.current.has(editingQuestionId) : false;
645
- return /* @__PURE__ */ jsxs("div", { className: "ui-flex ui-flex-col ui-gap-6 ui-relative", children: [
646
- /* @__PURE__ */ jsx(
647
- Alert,
648
- {
649
- isVisible: alertState.isVisible,
650
- message: alertState.message,
651
- type: alertState.type,
652
- onClose: () => setAlertState((prev) => ({ ...prev, isVisible: false }))
653
- }
654
- ),
655
- /* @__PURE__ */ jsxs(
656
- DndContext,
657
- {
658
- sensors,
659
- collisionDetection: closestCenter,
660
- onDragStart: handleDragStart,
661
- onDragEnd: handleDragEnd,
662
- children: [
663
- (scope === "TEAM" || isTeamEvent && !scope) && /* @__PURE__ */ jsxs("div", { className: "ui-space-y-8 ui-overflow-y-hidden", children: [
664
- /* @__PURE__ */ jsxs("div", { className: "ui-border ui-border-gray-200 ui-rounded-xl ui-bg-white", children: [
665
- /* @__PURE__ */ jsxs(
666
- "div",
667
- {
668
- className: "ui-p-4 ui-flex ui-items-center ui-space-x-2 ui-cursor-pointer ui-transition-colors",
669
- onClick: () => handleSectionToggle("TEAM"),
670
- children: [
671
- /* @__PURE__ */ jsx(ChevronDown, { className: cn(
672
- "ui-w-5 ui-h-5 ui-text-gray-900 ui-transition-transform ui-duration-300",
673
- isTeamOpen ? "ui-rotate-180" : "ui-rotate-0"
674
- ) }),
675
- /* @__PURE__ */ jsxs("div", { className: "ui-flex ui-items-center ui-gap-2", children: [
676
- /* @__PURE__ */ jsx("h3", { className: "ui-text-xl ui-font-semibold ui-text-gray-800 ui-flex ui-items-center ui-gap-2", children: "Team questions" }),
677
- /* @__PURE__ */ jsx(
678
- Tooltip,
679
- {
680
- placement: "bottom",
681
- content: "Questions that apply to the entire team and only need to be specified once",
682
- children: /* @__PURE__ */ jsx(ForwardRef, { className: "ui-h-5 ui-w-5 ui-text-gray-400" })
683
- }
684
- )
685
- ] })
686
- ]
687
- }
688
- ),
689
- /* @__PURE__ */ jsx(AnimatePresence, { initial: false, children: isTeamOpen && /* @__PURE__ */ jsx(
690
- motion.div,
691
- {
692
- initial: { height: 0, opacity: 0 },
693
- animate: { height: "auto", opacity: 1 },
694
- exit: { height: 0, opacity: 0 },
695
- transition: { duration: 0.2 },
696
- children: /* @__PURE__ */ jsx("div", { className: "ui-p-6 ui-pt-0", children: teamQuestionsOrder.length > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
697
- /* @__PURE__ */ jsx(SortableContext, { items: teamQuestionsOrder, strategy: verticalListSortingStrategy, children: /* @__PURE__ */ jsx(
698
- SortableQuestionList,
699
- {
700
- questions,
701
- questionOrder: teamQuestionsOrder,
702
- formId,
703
- eventId,
704
- userUid,
705
- storageService,
706
- isLocked,
707
- activeQuestionId: editingQuestionId,
708
- onSetActiveQuestion: handleSetActiveQuestion,
709
- onDelete: deleteQuestionLocal,
710
- onDuplicate: handleDuplicate,
711
- onSave: handleManualSave,
712
- onUpdate: updateQuestionLocal,
713
- onCancel: handleCancel,
714
- activeQuestionProps: editingQuestionId ? activeQuestionProps(editingQuestionId) : void 0,
715
- disabled: isAddingNew,
716
- scope,
717
- participationType,
718
- disableDiscountOption,
719
- showValidationErrors
720
- }
721
- ) }),
722
- !activeId && !isLocked && /* @__PURE__ */ jsx("div", { className: "ui-flex ui-justify-center ui-mt-6", children: /* @__PURE__ */ jsxs(
723
- Button,
724
- {
725
- type: "button",
726
- variant: "outline",
727
- onClick: (e) => {
728
- e.stopPropagation();
729
- if (!isAddingNew) handleAddClick(false);
730
- },
731
- size: "lg",
732
- className: cn("ui-gap-x-2 ui-px-4 ui-py-2.5 ui-text-sm", isAddingNew && "ui-opacity-50 ui-cursor-not-allowed"),
733
- disabled: isAddingNew,
734
- children: [
735
- /* @__PURE__ */ jsx(Plus, { className: "ui-font-bold ui-w-5 ui-h-5" }),
736
- "Add New Question"
737
- ]
738
- }
739
- ) })
740
- ] }) : /* @__PURE__ */ jsx(EmptyState, { onAdd: () => handleAddClick(false), isAddingNew }) })
741
- }
742
- ) })
743
- ] }),
744
- /* @__PURE__ */ jsxs("div", { className: "ui-border ui-border-gray-200 ui-rounded-xl ui-bg-white", children: [
745
- /* @__PURE__ */ jsxs(
746
- "div",
747
- {
748
- className: "ui-p-4 ui-flex ui-items-center ui-space-x-2 ui-cursor-pointer ui-transition-colors",
749
- onClick: () => handleSectionToggle("TEAM_MEMBER"),
750
- children: [
751
- /* @__PURE__ */ jsx(ChevronDown, { className: cn(
752
- "ui-w-5 ui-h-5 ui-text-gray-900 ui-transition-transform ui-duration-300",
753
- isTeamMemberOpen ? "ui-rotate-180" : "ui-rotate-0"
754
- ) }),
755
- /* @__PURE__ */ jsxs("div", { className: "ui-flex ui-items-center ui-gap-2", children: [
756
- /* @__PURE__ */ jsx("h3", { className: "ui-text-xl ui-font-semibold ui-text-gray-800 ui-flex ui-items-center ui-gap-2", children: "Team Member Questions" }),
757
- /* @__PURE__ */ jsx(
758
- Tooltip,
759
- {
760
- placement: "bottom",
761
- content: "Questions that are specific to each individual team member and need to be asked separately for each person.",
762
- children: /* @__PURE__ */ jsx(ForwardRef, { className: "ui-h-5 ui-w-5 ui-text-gray-400" })
763
- }
764
- )
765
- ] })
766
- ]
767
- }
768
- ),
769
- /* @__PURE__ */ jsx(AnimatePresence, { initial: false, children: isTeamMemberOpen && /* @__PURE__ */ jsx(
770
- motion.div,
771
- {
772
- initial: { height: 0, opacity: 0 },
773
- animate: { height: "auto", opacity: 1 },
774
- exit: { height: 0, opacity: 0 },
775
- transition: { duration: 0.2 },
776
- children: /* @__PURE__ */ jsx("div", { className: "ui-p-6 ui-pt-0", children: teamMemberQuestionsOrder.length > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
777
- /* @__PURE__ */ jsx(SortableContext, { items: teamMemberQuestionsOrder, strategy: verticalListSortingStrategy, children: /* @__PURE__ */ jsx(
778
- SortableQuestionList,
779
- {
780
- questions,
781
- questionOrder: teamMemberQuestionsOrder,
782
- formId,
783
- eventId,
784
- userUid,
785
- storageService,
786
- isLocked,
787
- activeQuestionId: editingQuestionId,
788
- onSetActiveQuestion: handleSetActiveQuestion,
789
- onDelete: deleteQuestionLocal,
790
- onDuplicate: handleDuplicate,
791
- onSave: handleManualSave,
792
- onUpdate: updateQuestionLocal,
793
- onCancel: handleCancel,
794
- activeQuestionProps: editingQuestionId ? activeQuestionProps(editingQuestionId) : void 0,
795
- disabled: isAddingNew,
796
- scope,
797
- participationType,
798
- disableDiscountOption,
799
- showValidationErrors
800
- }
801
- ) }),
802
- !activeId && !isLocked && /* @__PURE__ */ jsx("div", { className: "ui-flex ui-justify-center ui-mt-6", children: /* @__PURE__ */ jsxs(
803
- Button,
804
- {
805
- type: "button",
806
- variant: "outline",
807
- onClick: (e) => {
808
- e.stopPropagation();
809
- if (!isAddingNew) handleAddClick(true);
810
- },
811
- size: "lg",
812
- className: cn("ui-gap-x-2 ui-px-4 ui-py-2.5 ui-text-sm", isAddingNew && "ui-opacity-50 ui-cursor-not-allowed"),
813
- disabled: isAddingNew,
814
- children: [
815
- /* @__PURE__ */ jsx(Plus, { className: "ui-font-bold ui-w-5 ui-h-5" }),
816
- "Add New Question"
817
- ]
818
- }
819
- ) })
820
- ] }) : /* @__PURE__ */ jsx(EmptyState, { onAdd: () => handleAddClick(true), isAddingNew }) })
821
- }
822
- ) })
823
- ] })
824
- ] }),
825
- (scope === "INDIVIDUAL" || !isTeamEvent && !scope) && /* @__PURE__ */ jsxs("div", { className: "ui-border ui-border-gray-200 ui-rounded-xl ui-bg-white ui-overflow-y-hidden", children: [
826
- /* @__PURE__ */ jsxs(
827
- "div",
828
- {
829
- className: "ui-p-4 ui-flex ui-items-center ui-space-x-2 ui-cursor-pointer ui-transition-colors",
830
- onClick: () => handleSectionToggle("INDIVIDUAL"),
831
- children: [
832
- /* @__PURE__ */ jsx(ChevronDown, { className: cn(
833
- "ui-w-5 ui-h-5 ui-text-gray-900 ui-transition-transform ui-duration-300",
834
- isIndividualOpen ? "ui-rotate-180" : "ui-rotate-0"
835
- ) }),
836
- /* @__PURE__ */ jsx("h3", { className: "ui-text-xl ui-font-semibold ui-text-gray-800 ui-flex ui-items-center ui-gap-2", children: "Individual questions" })
837
- ]
838
- }
839
- ),
840
- /* @__PURE__ */ jsx(AnimatePresence, { initial: false, children: isIndividualOpen && /* @__PURE__ */ jsx(
841
- motion.div,
842
- {
843
- initial: { height: 0, opacity: 0 },
844
- animate: { height: "auto", opacity: 1 },
845
- exit: { height: 0, opacity: 0 },
846
- transition: { duration: 0.2 },
847
- children: /* @__PURE__ */ jsx("div", { className: "ui-p-6 ui-pt-0", children: individualQuestionsOrder.length > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
848
- /* @__PURE__ */ jsx(SortableContext, { items: individualQuestionsOrder, strategy: verticalListSortingStrategy, children: /* @__PURE__ */ jsx(
849
- SortableQuestionList,
850
- {
851
- questions,
852
- questionOrder: individualQuestionsOrder,
853
- formId,
854
- eventId,
855
- userUid,
856
- storageService,
857
- isLocked,
858
- activeQuestionId: editingQuestionId,
859
- onSetActiveQuestion: handleSetActiveQuestion,
860
- onDelete: deleteQuestionLocal,
861
- onDuplicate: handleDuplicate,
862
- onSave: handleManualSave,
863
- onUpdate: updateQuestionLocal,
864
- onCancel: handleCancel,
865
- activeQuestionProps: editingQuestionId ? activeQuestionProps(editingQuestionId) : void 0,
866
- disabled: isAddingNew,
867
- scope,
868
- participationType,
869
- disableDiscountOption,
870
- showValidationErrors
871
- }
872
- ) }),
873
- !activeId && !isLocked && /* @__PURE__ */ jsx("div", { className: "ui-flex ui-justify-center ui-mt-6", children: /* @__PURE__ */ jsxs(
874
- Button,
875
- {
876
- type: "button",
877
- onClick: () => !isAddingNew && handleAddClick(true),
878
- variant: "outline",
879
- size: "lg",
880
- className: cn("ui-gap-x-2 ui-px-4 ui-py-2.5 ui-text-sm", isAddingNew && "ui-opacity-50 ui-cursor-not-allowed"),
881
- disabled: isAddingNew,
882
- children: [
883
- /* @__PURE__ */ jsx(Plus, { className: "ui-font-bold ui-w-5 ui-h-5" }),
884
- "Add New Question"
885
- ]
886
- }
887
- ) })
888
- ] }) : /* @__PURE__ */ jsx(EmptyState, { onAdd: () => handleAddClick(true), isAddingNew }) })
889
- }
890
- ) })
891
- ] }),
892
- /* @__PURE__ */ jsx(DragOverlay, { children: activeId && questions[activeId] ? /* @__PURE__ */ jsx("div", { className: "ui-opacity-80 ui-rotate-2 ui-cursor-grabbing", children: /* @__PURE__ */ jsx(
893
- QuestionCard,
894
- {
895
- question: questions[activeId],
896
- formId,
897
- eventId,
898
- isLocked,
899
- isOpen: false,
900
- onToggle: () => {
901
- },
902
- onDelete: () => {
903
- },
904
- onUpdate: () => {
905
- }
906
- }
907
- ) }) : null })
908
- ]
909
- }
910
- )
911
- ] });
912
- });
913
- FormBuilder.displayName = "FormBuilder";
914
- const FormBuilder$1 = memo(FormBuilder);
915
- export {
916
- FormBuilder$1 as default
917
- };
918
- //# sourceMappingURL=FormBuilder.js.map