@erpsquad/common 1.8.80 → 1.8.81

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 (658) hide show
  1. package/CHANGELOG.md +253 -253
  2. package/README.md +979 -979
  3. package/dist/_virtual/index/index.esm10.js +3 -3
  4. package/dist/_virtual/index/index.esm11.js +3 -3
  5. package/dist/_virtual/index/index.esm2.js +2 -4
  6. package/dist/_virtual/index/index.esm2.js.map +1 -1
  7. package/dist/_virtual/index/index.esm3.js +4 -2
  8. package/dist/_virtual/index/index.esm3.js.map +1 -1
  9. package/dist/_virtual/index/index.esm4.js +1 -1
  10. package/dist/_virtual/index/index.esm5.js +3 -3
  11. package/dist/_virtual/index/index.esm6.js +3 -3
  12. package/dist/_virtual/index/index.esm7.js +3 -3
  13. package/dist/_virtual/index/index.esm8.js +3 -3
  14. package/dist/_virtual/index/index.esm9.js +3 -3
  15. package/dist/_virtual/index/index10.js +1 -1
  16. package/dist/_virtual/index/index11.js +1 -1
  17. package/dist/_virtual/index/index2.js +1 -1
  18. package/dist/_virtual/index/index3.js +1 -1
  19. package/dist/_virtual/index/index4.js +1 -1
  20. package/dist/_virtual/index/index5.js +1 -1
  21. package/dist/_virtual/index/index6.js +1 -1
  22. package/dist/_virtual/index/index7.js +1 -1
  23. package/dist/_virtual/index/index8.js +1 -1
  24. package/dist/_virtual/index/index9.js +1 -1
  25. package/dist/api-client/api.accounting/api/index.esm.js.map +1 -1
  26. package/dist/api-client/api.accounting/api/index.js.map +1 -1
  27. package/dist/api-client/api.accounting/api-types.d.ts +15883 -15883
  28. package/dist/api-client/api.drive/api/index.esm.js.map +1 -1
  29. package/dist/api-client/api.drive/api/index.js.map +1 -1
  30. package/dist/api-client/api.drive/api-types.d.ts +696 -696
  31. package/dist/api-client/api.hrms/api/index.esm.js.map +1 -1
  32. package/dist/api-client/api.hrms/api/index.js.map +1 -1
  33. package/dist/api-client/api.inventory/api/index.esm.js.map +1 -1
  34. package/dist/api-client/api.inventory/api/index.js.map +1 -1
  35. package/dist/api-client/api.inventory/api-types.d.ts +6110 -6110
  36. package/dist/api-client/api.manufacturing/api/index.esm.js.map +1 -1
  37. package/dist/api-client/api.manufacturing/api/index.js.map +1 -1
  38. package/dist/api-client/api.manufacturing/api-types.d.ts +10066 -10066
  39. package/dist/api-client/api.purchase/api/index.esm.js.map +1 -1
  40. package/dist/api-client/api.purchase/api/index.js.map +1 -1
  41. package/dist/api-client/api.purchase/api-types.d.ts +6715 -6715
  42. package/dist/api-client/api.rbac/api/index.esm.js.map +1 -1
  43. package/dist/api-client/api.rbac/api/index.esm2.js.map +1 -1
  44. package/dist/api-client/api.rbac/api/index.js.map +1 -1
  45. package/dist/api-client/api.rbac/api/index2.js.map +1 -1
  46. package/dist/api-client/api.rbac/api-types.d.ts +1753 -1753
  47. package/dist/api-client/api.rental/api/index.esm.js.map +1 -1
  48. package/dist/api-client/api.rental/api/index.js.map +1 -1
  49. package/dist/api-client/api.rental/api-types.d.ts +15666 -15666
  50. package/dist/api-client/api.sales/api/index.esm.js.map +1 -1
  51. package/dist/api-client/api.sales/api/index.js.map +1 -1
  52. package/dist/api-client/api.sales/api-types.d.ts +8258 -8258
  53. package/dist/api-client/api.system-feature/api/index.esm.js.map +1 -1
  54. package/dist/api-client/api.system-feature/api/index.js.map +1 -1
  55. package/dist/api-client/api.system-feature/api-types.d.ts +2875 -2875
  56. package/dist/api-client/api.user/api/index.esm.js.map +1 -1
  57. package/dist/api-client/api.user/api/index.js.map +1 -1
  58. package/dist/api-client/api.user/api-types.d.ts +95 -95
  59. package/dist/api-client/api.workflow-automation/api/index.esm.js.map +1 -1
  60. package/dist/api-client/api.workflow-automation/api/index.js.map +1 -1
  61. package/dist/api-client/index.d.ts +39 -39
  62. package/dist/components/accordion/accordion/index.esm.js.map +1 -1
  63. package/dist/components/accordion/accordion/index.js.map +1 -1
  64. package/dist/components/accordion/accordion.d.ts +1 -1
  65. package/dist/components/action-bar/action-bar/index.esm.js +1 -1
  66. package/dist/components/action-bar/action-bar/index.esm.js.map +1 -1
  67. package/dist/components/action-bar/action-bar/index.js +5 -5
  68. package/dist/components/action-bar/action-bar/index.js.map +1 -1
  69. package/dist/components/action-bar/action-bar.d.ts +1 -1
  70. package/dist/components/activity-tag/activity-tag/index.esm.js.map +1 -1
  71. package/dist/components/activity-tag/activity-tag/index.js.map +1 -1
  72. package/dist/components/alert/alert/index.esm.js.map +1 -1
  73. package/dist/components/alert/alert/index.js.map +1 -1
  74. package/dist/components/button/button/index.esm.js.map +1 -1
  75. package/dist/components/button/button/index.js.map +1 -1
  76. package/dist/components/change-user-password-modal/change-user-password-modal/index.esm.js.map +1 -1
  77. package/dist/components/change-user-password-modal/change-user-password-modal/index.js.map +1 -1
  78. package/dist/components/checkbox/checkbox/index.esm.js.map +1 -1
  79. package/dist/components/checkbox/checkbox/index.js.map +1 -1
  80. package/dist/components/checkbox/checkbox.d.ts +1 -1
  81. package/dist/components/chip/chip/index.esm.js.map +1 -1
  82. package/dist/components/chip/chip/index.js.map +1 -1
  83. package/dist/components/chip-generator/chip-generator/index.esm.js.map +1 -1
  84. package/dist/components/chip-generator/chip-generator/index.js.map +1 -1
  85. package/dist/components/date-picker/date-picker/index.esm.js.map +1 -1
  86. package/dist/components/date-picker/date-picker/index.js.map +1 -1
  87. package/dist/components/date-picker/date-picker.d.ts +1 -1
  88. package/dist/components/date-time-picker/date-time-picker/index.esm.js.map +1 -1
  89. package/dist/components/date-time-picker/date-time-picker/index.js.map +1 -1
  90. package/dist/components/editor/custom-editor/index.esm.js.map +1 -1
  91. package/dist/components/editor/custom-editor/index.js.map +1 -1
  92. package/dist/components/filter/components/delete-group/index.esm.js +1 -0
  93. package/dist/components/filter/components/delete-group/index.esm.js.map +1 -1
  94. package/dist/components/filter/components/delete-group/index.js +1 -1
  95. package/dist/components/filter/components/delete-group/index.js.map +1 -1
  96. package/dist/components/filter/filter/index.esm.js +1 -1
  97. package/dist/components/filter/filter/index.esm.js.map +1 -1
  98. package/dist/components/filter/filter/index.js +7 -7
  99. package/dist/components/filter/filter/index.js.map +1 -1
  100. package/dist/components/footer/footer.d.ts +1 -1
  101. package/dist/components/form-control/form-builder/form-builder-element/dynamic-select/index.esm.js.map +1 -1
  102. package/dist/components/form-control/form-builder/form-builder-element/dynamic-select/index.js.map +1 -1
  103. package/dist/components/form-control/form-builder/form-builder-element/media.d.ts +1 -1
  104. package/dist/components/form-control/form-builder/form-builder-element/phone.d.ts +1 -1
  105. package/dist/components/form-control/form-builder/form-builder-element/select.d.ts +1 -1
  106. package/dist/components/form-control/form-builder/form-builder-element/text.d.ts +1 -1
  107. package/dist/components/form-control/form-builder/form-builder-element/time.d.ts +1 -1
  108. package/dist/components/form-control/form-parser/form-switcher.d.ts +1 -1
  109. package/dist/components/header/header/index.esm.js.map +1 -1
  110. package/dist/components/header/header/index.js.map +1 -1
  111. package/dist/components/header/redux/actionCreator/index.esm.js +1 -1
  112. package/dist/components/header/redux/actionCreator/index.esm.js.map +1 -1
  113. package/dist/components/header/redux/actionCreator/index.js +1 -1
  114. package/dist/components/header/redux/actionCreator/index.js.map +1 -1
  115. package/dist/components/icons/action/index.esm.js.map +1 -1
  116. package/dist/components/icons/action/index.js.map +1 -1
  117. package/dist/components/icons/action-arrow.d.ts +3 -3
  118. package/dist/components/icons/add-circle.d.ts +3 -3
  119. package/dist/components/icons/arrow-bidirectional.d.ts +3 -3
  120. package/dist/components/icons/arrow-circle-down.d.ts +3 -3
  121. package/dist/components/icons/arrow-down-three.d.ts +3 -3
  122. package/dist/components/icons/arrow-down-two.d.ts +3 -3
  123. package/dist/components/icons/arrow-down.d.ts +3 -3
  124. package/dist/components/icons/arrow-up-down.d.ts +3 -3
  125. package/dist/components/icons/arrow-up-two.d.ts +3 -3
  126. package/dist/components/icons/assignments.d.ts +3 -3
  127. package/dist/components/icons/blank-circle.d.ts +3 -3
  128. package/dist/components/icons/block-filled.d.ts +3 -3
  129. package/dist/components/icons/calendar-add.d.ts +3 -3
  130. package/dist/components/icons/calendar.d.ts +3 -3
  131. package/dist/components/icons/checkbox-square.d.ts +3 -3
  132. package/dist/components/icons/circular-arrow-setting.d.ts +3 -3
  133. package/dist/components/icons/clock.d.ts +3 -3
  134. package/dist/components/icons/close.d.ts +3 -3
  135. package/dist/components/icons/coin-outline.d.ts +3 -3
  136. package/dist/components/icons/copy.d.ts +3 -3
  137. package/dist/components/icons/coupon.d.ts +3 -3
  138. package/dist/components/icons/criteria/index.esm.js.map +1 -1
  139. package/dist/components/icons/criteria/index.js.map +1 -1
  140. package/dist/components/icons/cross/index.esm.js.map +1 -1
  141. package/dist/components/icons/cross/index.js.map +1 -1
  142. package/dist/components/icons/cross-hire.d.ts +3 -3
  143. package/dist/components/icons/custom-styled-icon.d.ts +3 -3
  144. package/dist/components/icons/dashboard.d.ts +3 -3
  145. package/dist/components/icons/document-download.d.ts +3 -3
  146. package/dist/components/icons/document.d.ts +3 -3
  147. package/dist/components/icons/dollar-circle-filled.d.ts +3 -3
  148. package/dist/components/icons/dollar-circle.d.ts +3 -3
  149. package/dist/components/icons/edit.d.ts +3 -3
  150. package/dist/components/icons/email.d.ts +3 -3
  151. package/dist/components/icons/export.d.ts +3 -3
  152. package/dist/components/icons/eye-off.d.ts +3 -3
  153. package/dist/components/icons/eye-plus-circle.d.ts +3 -3
  154. package/dist/components/icons/eye.d.ts +3 -3
  155. package/dist/components/icons/filled-circle.d.ts +3 -3
  156. package/dist/components/icons/filter-remove.d.ts +3 -3
  157. package/dist/components/icons/filter.d.ts +3 -3
  158. package/dist/components/icons/folder-save.d.ts +3 -3
  159. package/dist/components/icons/grid.d.ts +3 -3
  160. package/dist/components/icons/hashtag.d.ts +3 -3
  161. package/dist/components/icons/image.d.ts +3 -3
  162. package/dist/components/icons/import.d.ts +3 -3
  163. package/dist/components/icons/info-circle.d.ts +3 -3
  164. package/dist/components/icons/info.d.ts +3 -3
  165. package/dist/components/icons/link-horizontal.d.ts +3 -3
  166. package/dist/components/icons/link.d.ts +3 -3
  167. package/dist/components/icons/location.d.ts +3 -3
  168. package/dist/components/icons/lowest-lead-time.d.ts +3 -3
  169. package/dist/components/icons/lowest-min-qty.d.ts +3 -3
  170. package/dist/components/icons/lowest-price.d.ts +3 -3
  171. package/dist/components/icons/more.d.ts +3 -3
  172. package/dist/components/icons/notification.d.ts +3 -3
  173. package/dist/components/icons/paper-clip.d.ts +3 -3
  174. package/dist/components/icons/paragraph.d.ts +3 -3
  175. package/dist/components/icons/payment-request.d.ts +3 -3
  176. package/dist/components/icons/phone.d.ts +3 -3
  177. package/dist/components/icons/printer.d.ts +3 -3
  178. package/dist/components/icons/process-calendar.d.ts +3 -3
  179. package/dist/components/icons/promotion.d.ts +3 -3
  180. package/dist/components/icons/radio-button.d.ts +3 -3
  181. package/dist/components/icons/receipt-filled.d.ts +3 -3
  182. package/dist/components/icons/receipt-outline.d.ts +3 -3
  183. package/dist/components/icons/receipt.d.ts +3 -3
  184. package/dist/components/icons/refresh-icon.d.ts +3 -3
  185. package/dist/components/icons/replace.d.ts +3 -3
  186. package/dist/components/icons/save.d.ts +3 -3
  187. package/dist/components/icons/search-status.d.ts +3 -3
  188. package/dist/components/icons/search.d.ts +3 -3
  189. package/dist/components/icons/settings-fallback.d.ts +3 -3
  190. package/dist/components/icons/share/index.esm.js.map +1 -1
  191. package/dist/components/icons/share/index.js.map +1 -1
  192. package/dist/components/icons/sort-arrow-icon.d.ts +3 -3
  193. package/dist/components/icons/stacked-layer.d.ts +3 -3
  194. package/dist/components/icons/start-filled.d.ts +3 -3
  195. package/dist/components/icons/three-dot-icon.d.ts +3 -3
  196. package/dist/components/icons/tick-circle-filled.d.ts +3 -3
  197. package/dist/components/icons/tick-circle.d.ts +3 -3
  198. package/dist/components/icons/tick-octagon.d.ts +3 -3
  199. package/dist/components/icons/tick.d.ts +3 -3
  200. package/dist/components/icons/toggle-switch.d.ts +3 -3
  201. package/dist/components/icons/trash.d.ts +3 -3
  202. package/dist/components/icons/wave.d.ts +3 -3
  203. package/dist/components/icons/with-out-tick-octagon.d.ts +3 -3
  204. package/dist/components/icons/work-centre.d.ts +3 -3
  205. package/dist/components/inventory-reports-title-bar/redux/actionCreator/index.esm.js +1 -1
  206. package/dist/components/inventory-reports-title-bar/redux/actionCreator/index.esm.js.map +1 -1
  207. package/dist/components/inventory-reports-title-bar/redux/actionCreator/index.js +1 -1
  208. package/dist/components/inventory-reports-title-bar/redux/actionCreator/index.js.map +1 -1
  209. package/dist/components/label-value/label-value/index.esm.js.map +1 -1
  210. package/dist/components/label-value/label-value/index.js.map +1 -1
  211. package/dist/components/listing/listing/index.esm.js.map +1 -1
  212. package/dist/components/listing/listing/index.js.map +1 -1
  213. package/dist/components/loaders/erp-loader/index.esm.js.map +1 -1
  214. package/dist/components/loaders/erp-loader/index.js.map +1 -1
  215. package/dist/components/loaders/form-loader/index.esm.js.map +1 -1
  216. package/dist/components/loaders/form-loader/index.js.map +1 -1
  217. package/dist/components/loaders/modal-loader/index.esm.js.map +1 -1
  218. package/dist/components/loaders/modal-loader/index.js.map +1 -1
  219. package/dist/components/loaders/page-loader/index.esm.js.map +1 -1
  220. package/dist/components/loaders/page-loader/index.js.map +1 -1
  221. package/dist/components/location-select.d.ts +1 -1
  222. package/dist/components/material-editable-table/components/inline-edit-fields/index.esm.js.map +1 -1
  223. package/dist/components/material-editable-table/components/inline-edit-fields/index.js.map +1 -1
  224. package/dist/components/material-editable-table/material-editable-table/index.esm.js.map +1 -1
  225. package/dist/components/material-editable-table/material-editable-table/index.js.map +1 -1
  226. package/dist/components/material-editable-table/material-editable-table.d.ts +1 -1
  227. package/dist/components/material-table/material-table.d.ts +1 -1
  228. package/dist/components/menu/menu/index.esm.js.map +1 -1
  229. package/dist/components/menu/menu/index.js.map +1 -1
  230. package/dist/components/modal/modal/index.esm.js.map +1 -1
  231. package/dist/components/modal/modal/index.js.map +1 -1
  232. package/dist/components/page-navigator/page-navigator/index.esm.js.map +1 -1
  233. package/dist/components/page-navigator/page-navigator/index.js.map +1 -1
  234. package/dist/components/phone-input/phone-input.d.ts +1 -1
  235. package/dist/components/providers/ERPUIProvider/index.esm.js.map +1 -1
  236. package/dist/components/providers/ERPUIProvider/index.js.map +1 -1
  237. package/dist/components/radio/radio.d.ts +1 -1
  238. package/dist/components/reports-title-bar/redux/actionCreator/index.esm.js +1 -1
  239. package/dist/components/reports-title-bar/redux/actionCreator/index.esm.js.map +1 -1
  240. package/dist/components/reports-title-bar/redux/actionCreator/index.js +1 -1
  241. package/dist/components/reports-title-bar/redux/actionCreator/index.js.map +1 -1
  242. package/dist/components/reset-password-modal/reset-password-modal/index.esm.js.map +1 -1
  243. package/dist/components/reset-password-modal/reset-password-modal/index.js.map +1 -1
  244. package/dist/components/search-bar/search-bar/index.esm.js.map +1 -1
  245. package/dist/components/search-bar/search-bar/index.js.map +1 -1
  246. package/dist/components/searchable-select/index.esm.js.map +1 -1
  247. package/dist/components/searchable-select/index.js.map +1 -1
  248. package/dist/components/select/controller/chip-or-placeholder/index.esm.js.map +1 -1
  249. package/dist/components/select/controller/chip-or-placeholder/index.js.map +1 -1
  250. package/dist/components/select/select/index.esm.js.map +1 -1
  251. package/dist/components/select/select/index.js.map +1 -1
  252. package/dist/components/select/select-search/index.esm.js.map +1 -1
  253. package/dist/components/select/select-search/index.js.map +1 -1
  254. package/dist/components/select/select.d.ts +1 -1
  255. package/dist/components/share-modal/redux/actionCreator/index.esm.js +1 -1
  256. package/dist/components/share-modal/redux/actionCreator/index.esm.js.map +1 -1
  257. package/dist/components/share-modal/redux/actionCreator/index.js +1 -1
  258. package/dist/components/share-modal/redux/actionCreator/index.js.map +1 -1
  259. package/dist/components/sub-header-doc/sub-header-doc/index.esm.js.map +1 -1
  260. package/dist/components/sub-header-doc/sub-header-doc/index.js.map +1 -1
  261. package/dist/components/switches/android-12-switch/index.esm.js.map +1 -1
  262. package/dist/components/switches/android-12-switch/index.js.map +1 -1
  263. package/dist/components/switches/android-12-switch.d.ts +1 -3
  264. package/dist/components/text-area/text-area/index.esm.js.map +1 -1
  265. package/dist/components/text-area/text-area/index.js.map +1 -1
  266. package/dist/components/text-field/text-field/index.esm.js.map +1 -1
  267. package/dist/components/text-field/text-field/index.js.map +1 -1
  268. package/dist/components/text-field/text-field.d.ts +1 -1
  269. package/dist/components/time-picker/time-picker/index.esm.js.map +1 -1
  270. package/dist/components/time-picker/time-picker/index.js.map +1 -1
  271. package/dist/components/time-picker/time-picker.d.ts +1 -1
  272. package/dist/components/toast/toast/index.esm.js.map +1 -1
  273. package/dist/components/toast/toast/index.js.map +1 -1
  274. package/dist/components/toggle/toggle/index.esm.js.map +1 -1
  275. package/dist/components/toggle/toggle/index.js.map +1 -1
  276. package/dist/components/typography/typography/index.esm.js.map +1 -1
  277. package/dist/components/typography/typography/index.js.map +1 -1
  278. package/dist/components/upload/upload/index.esm.js +2 -2
  279. package/dist/components/upload/upload/index.esm.js.map +1 -1
  280. package/dist/components/upload/upload/index.js +11 -11
  281. package/dist/components/upload/upload/index.js.map +1 -1
  282. package/dist/components/upload-media/upload-media.d.ts +1 -1
  283. package/dist/constants/defaultColumns/index.esm.js.map +1 -1
  284. package/dist/constants/defaultColumns/index.js.map +1 -1
  285. package/dist/constants/modules/index.esm.js.map +1 -1
  286. package/dist/constants/modules/index.js.map +1 -1
  287. package/dist/constants/pathnames/pathname/index.esm.js.map +1 -1
  288. package/dist/constants/pathnames/pathname/index.js.map +1 -1
  289. package/dist/constants/pathnames/pathname.accounting/index.esm.js.map +1 -1
  290. package/dist/constants/pathnames/pathname.accounting/index.js.map +1 -1
  291. package/dist/constants/pathnames/pathname.crm/index.esm.js.map +1 -1
  292. package/dist/constants/pathnames/pathname.crm/index.js.map +1 -1
  293. package/dist/constants/pathnames/pathname.document/index.esm.js.map +1 -1
  294. package/dist/constants/pathnames/pathname.document/index.js.map +1 -1
  295. package/dist/constants/pathnames/pathname.hrms/index.esm.js.map +1 -1
  296. package/dist/constants/pathnames/pathname.hrms/index.js.map +1 -1
  297. package/dist/constants/pathnames/pathname.inventory/index.esm.js.map +1 -1
  298. package/dist/constants/pathnames/pathname.inventory/index.js.map +1 -1
  299. package/dist/constants/pathnames/pathname.manufacturing/index.esm.js.map +1 -1
  300. package/dist/constants/pathnames/pathname.manufacturing/index.js.map +1 -1
  301. package/dist/constants/pathnames/pathname.office/index.esm.js.map +1 -1
  302. package/dist/constants/pathnames/pathname.office/index.js.map +1 -1
  303. package/dist/constants/pathnames/pathname.procurement/index.esm.js.map +1 -1
  304. package/dist/constants/pathnames/pathname.procurement/index.js.map +1 -1
  305. package/dist/constants/pathnames/pathname.project/index.esm.js.map +1 -1
  306. package/dist/constants/pathnames/pathname.project/index.js.map +1 -1
  307. package/dist/constants/pathnames/pathname.quotes/index.esm.js.map +1 -1
  308. package/dist/constants/pathnames/pathname.quotes/index.js.map +1 -1
  309. package/dist/constants/pathnames/pathname.rental/index.esm.js.map +1 -1
  310. package/dist/constants/pathnames/pathname.rental/index.js.map +1 -1
  311. package/dist/constants/pathnames/pathname.user/index.esm.js.map +1 -1
  312. package/dist/constants/pathnames/pathname.user/index.js.map +1 -1
  313. package/dist/constants/route-page-map/index.esm.js.map +1 -1
  314. package/dist/constants/route-page-map/index.js.map +1 -1
  315. package/dist/constants/status/index.esm.js.map +1 -1
  316. package/dist/constants/status/index.js.map +1 -1
  317. package/dist/contexts/AuthContext/index.esm.js +1 -1
  318. package/dist/contexts/AuthContext/index.esm.js.map +1 -1
  319. package/dist/contexts/AuthContext/index.js +1 -1
  320. package/dist/contexts/AuthContext/index.js.map +1 -1
  321. package/dist/contexts/languageContext/index.esm.js +1 -1
  322. package/dist/contexts/languageContext/index.esm.js.map +1 -1
  323. package/dist/contexts/languageContext/index.js +1 -1
  324. package/dist/contexts/languageContext/index.js.map +1 -1
  325. package/dist/contexts/page-context/index.esm.js.map +1 -1
  326. package/dist/contexts/page-context/index.js.map +1 -1
  327. package/dist/hooks/use-translations/index.esm.js.map +1 -1
  328. package/dist/hooks/use-translations/index.js.map +1 -1
  329. package/dist/hooks/useApi/index.esm.js.map +1 -1
  330. package/dist/hooks/useApi/index.js.map +1 -1
  331. package/dist/hooks/useDataFetcher/index.esm.js.map +1 -1
  332. package/dist/hooks/useDataFetcher/index.js.map +1 -1
  333. package/dist/layout/fullScreen/fullScreen/index.esm.js.map +1 -1
  334. package/dist/layout/fullScreen/fullScreen/index.js.map +1 -1
  335. package/dist/layout/sidebarScreen/sidebarScreen/index.esm.js.map +1 -1
  336. package/dist/layout/sidebarScreen/sidebarScreen/index.js.map +1 -1
  337. package/dist/node_modules/@asseinfo/react-kanban/dist/index/index.esm.js +1 -1
  338. package/dist/node_modules/@asseinfo/react-kanban/dist/index/index.js +1 -1
  339. package/dist/node_modules/@glideapps/glide-data-grid-cells/dist/js/article-cell-editor-JDI676YI/index.esm.js +1 -1
  340. package/dist/node_modules/@glideapps/glide-data-grid-cells/dist/js/article-cell-editor-JDI676YI/index.js +2 -2
  341. package/dist/node_modules/@glideapps/glide-data-grid-cells/dist/js/article-cell-editor-JDI676YI/index.js.map +1 -1
  342. package/dist/node_modules/{@toast-ui → @glideapps/glide-data-grid-cells/node_modules/@toast-ui}/react-editor/dist/esm/index/index.esm.js +2 -2
  343. package/dist/node_modules/@glideapps/glide-data-grid-cells/node_modules/@toast-ui/react-editor/dist/esm/index/index.esm.js.map +1 -0
  344. package/dist/node_modules/@glideapps/glide-data-grid-cells/node_modules/@toast-ui/react-editor/dist/esm/index/index.js +2 -0
  345. package/dist/node_modules/@glideapps/glide-data-grid-cells/node_modules/@toast-ui/react-editor/dist/esm/index/index.js.map +1 -0
  346. package/dist/node_modules/@mui/icons-material/utils/createSvgIcon/index.esm.js +1 -1
  347. package/dist/node_modules/@mui/icons-material/utils/createSvgIcon/index.js +1 -1
  348. package/dist/node_modules/@mui/system/colorManipulator/index.esm.js +2 -2
  349. package/dist/node_modules/@mui/system/colorManipulator/index.js +1 -1
  350. package/dist/node_modules/@mui/system/colorManipulator/index.js.map +1 -1
  351. package/dist/node_modules/@mui/system/createStyled/index.esm.js +6 -6
  352. package/dist/node_modules/@mui/system/createStyled/index.js +1 -1
  353. package/dist/node_modules/@mui/system/createStyled/index.js.map +1 -1
  354. package/dist/node_modules/@mui/system/useThemeWithoutDefault/index.esm.js +1 -1
  355. package/dist/node_modules/@mui/system/useThemeWithoutDefault/index.js +1 -1
  356. package/dist/node_modules/material-react-table/dist/index.esm/index.esm.js +1 -1
  357. package/dist/node_modules/material-react-table/dist/index.esm/index.js +1 -1
  358. package/dist/node_modules/material-react-table/dist/index.esm/index.js.map +1 -1
  359. package/dist/node_modules/{@tanstack → material-react-table/node_modules/@tanstack}/react-virtual/dist/esm/index/index.esm.js +2 -2
  360. package/dist/node_modules/material-react-table/node_modules/@tanstack/react-virtual/dist/esm/index/index.esm.js.map +1 -0
  361. package/dist/node_modules/material-react-table/node_modules/@tanstack/react-virtual/dist/esm/index/index.js +2 -0
  362. package/dist/node_modules/material-react-table/node_modules/@tanstack/react-virtual/dist/esm/index/index.js.map +1 -0
  363. package/dist/redux/actionCreator/index.esm.js.map +1 -1
  364. package/dist/redux/actionCreator/index.js.map +1 -1
  365. package/dist/redux/module-reducer/index.esm.js.map +1 -1
  366. package/dist/redux/module-reducer/index.js.map +1 -1
  367. package/dist/redux/store/index.esm.js.map +1 -1
  368. package/dist/redux/store/index.js.map +1 -1
  369. package/dist/server/index.esm.js.map +1 -1
  370. package/dist/server/index.js.map +1 -1
  371. package/dist/src/components/accordion/accordion.d.ts +1 -1
  372. package/dist/src/components/action-bar/action-bar.d.ts +1 -1
  373. package/dist/src/components/checkbox/checkbox.d.ts +1 -1
  374. package/dist/src/components/date-picker/date-picker.d.ts +1 -1
  375. package/dist/src/components/footer/footer.d.ts +1 -1
  376. package/dist/src/components/form-control/form-builder/form-builder-element/media.d.ts +1 -1
  377. package/dist/src/components/form-control/form-builder/form-builder-element/phone.d.ts +1 -1
  378. package/dist/src/components/form-control/form-builder/form-builder-element/select.d.ts +1 -1
  379. package/dist/src/components/form-control/form-builder/form-builder-element/text.d.ts +1 -1
  380. package/dist/src/components/form-control/form-builder/form-builder-element/time.d.ts +1 -1
  381. package/dist/src/components/form-control/form-parser/form-switcher.d.ts +1 -1
  382. package/dist/src/components/icons/action-arrow.d.ts +3 -3
  383. package/dist/src/components/icons/add-circle.d.ts +3 -3
  384. package/dist/src/components/icons/arrow-bidirectional.d.ts +3 -3
  385. package/dist/src/components/icons/arrow-circle-down.d.ts +3 -3
  386. package/dist/src/components/icons/arrow-down-three.d.ts +3 -3
  387. package/dist/src/components/icons/arrow-down-two.d.ts +3 -3
  388. package/dist/src/components/icons/arrow-down.d.ts +3 -3
  389. package/dist/src/components/icons/arrow-up-down.d.ts +3 -3
  390. package/dist/src/components/icons/arrow-up-two.d.ts +3 -3
  391. package/dist/src/components/icons/assignments.d.ts +3 -3
  392. package/dist/src/components/icons/blank-circle.d.ts +3 -3
  393. package/dist/src/components/icons/block-filled.d.ts +3 -3
  394. package/dist/src/components/icons/calendar-add.d.ts +3 -3
  395. package/dist/src/components/icons/calendar.d.ts +3 -3
  396. package/dist/src/components/icons/checkbox-square.d.ts +3 -3
  397. package/dist/src/components/icons/circular-arrow-setting.d.ts +3 -3
  398. package/dist/src/components/icons/clock.d.ts +3 -3
  399. package/dist/src/components/icons/close.d.ts +3 -3
  400. package/dist/src/components/icons/coin-outline.d.ts +3 -3
  401. package/dist/src/components/icons/copy.d.ts +3 -3
  402. package/dist/src/components/icons/coupon.d.ts +3 -3
  403. package/dist/src/components/icons/cross-hire.d.ts +3 -3
  404. package/dist/src/components/icons/custom-styled-icon.d.ts +3 -3
  405. package/dist/src/components/icons/dashboard.d.ts +3 -3
  406. package/dist/src/components/icons/document-download.d.ts +3 -3
  407. package/dist/src/components/icons/document.d.ts +3 -3
  408. package/dist/src/components/icons/dollar-circle-filled.d.ts +3 -3
  409. package/dist/src/components/icons/dollar-circle.d.ts +3 -3
  410. package/dist/src/components/icons/edit.d.ts +3 -3
  411. package/dist/src/components/icons/email.d.ts +3 -3
  412. package/dist/src/components/icons/export.d.ts +3 -3
  413. package/dist/src/components/icons/eye-off.d.ts +3 -3
  414. package/dist/src/components/icons/eye-plus-circle.d.ts +3 -3
  415. package/dist/src/components/icons/eye.d.ts +3 -3
  416. package/dist/src/components/icons/filled-circle.d.ts +3 -3
  417. package/dist/src/components/icons/filter-remove.d.ts +3 -3
  418. package/dist/src/components/icons/filter.d.ts +3 -3
  419. package/dist/src/components/icons/folder-save.d.ts +3 -3
  420. package/dist/src/components/icons/grid.d.ts +3 -3
  421. package/dist/src/components/icons/hashtag.d.ts +3 -3
  422. package/dist/src/components/icons/image.d.ts +3 -3
  423. package/dist/src/components/icons/import.d.ts +3 -3
  424. package/dist/src/components/icons/info-circle.d.ts +3 -3
  425. package/dist/src/components/icons/info.d.ts +3 -3
  426. package/dist/src/components/icons/link-horizontal.d.ts +3 -3
  427. package/dist/src/components/icons/link.d.ts +3 -3
  428. package/dist/src/components/icons/location.d.ts +3 -3
  429. package/dist/src/components/icons/lowest-lead-time.d.ts +3 -3
  430. package/dist/src/components/icons/lowest-min-qty.d.ts +3 -3
  431. package/dist/src/components/icons/lowest-price.d.ts +3 -3
  432. package/dist/src/components/icons/more.d.ts +3 -3
  433. package/dist/src/components/icons/notification.d.ts +3 -3
  434. package/dist/src/components/icons/paper-clip.d.ts +3 -3
  435. package/dist/src/components/icons/paragraph.d.ts +3 -3
  436. package/dist/src/components/icons/payment-request.d.ts +3 -3
  437. package/dist/src/components/icons/phone.d.ts +3 -3
  438. package/dist/src/components/icons/printer.d.ts +3 -3
  439. package/dist/src/components/icons/process-calendar.d.ts +3 -3
  440. package/dist/src/components/icons/promotion.d.ts +3 -3
  441. package/dist/src/components/icons/radio-button.d.ts +3 -3
  442. package/dist/src/components/icons/receipt-filled.d.ts +3 -3
  443. package/dist/src/components/icons/receipt-outline.d.ts +3 -3
  444. package/dist/src/components/icons/receipt.d.ts +3 -3
  445. package/dist/src/components/icons/refresh-icon.d.ts +3 -3
  446. package/dist/src/components/icons/replace.d.ts +3 -3
  447. package/dist/src/components/icons/save.d.ts +3 -3
  448. package/dist/src/components/icons/search-status.d.ts +3 -3
  449. package/dist/src/components/icons/search.d.ts +3 -3
  450. package/dist/src/components/icons/settings-fallback.d.ts +3 -3
  451. package/dist/src/components/icons/sort-arrow-icon.d.ts +3 -3
  452. package/dist/src/components/icons/stacked-layer.d.ts +3 -3
  453. package/dist/src/components/icons/start-filled.d.ts +3 -3
  454. package/dist/src/components/icons/three-dot-icon.d.ts +3 -3
  455. package/dist/src/components/icons/tick-circle-filled.d.ts +3 -3
  456. package/dist/src/components/icons/tick-circle.d.ts +3 -3
  457. package/dist/src/components/icons/tick-octagon.d.ts +3 -3
  458. package/dist/src/components/icons/tick.d.ts +3 -3
  459. package/dist/src/components/icons/toggle-switch.d.ts +3 -3
  460. package/dist/src/components/icons/trash.d.ts +3 -3
  461. package/dist/src/components/icons/wave.d.ts +3 -3
  462. package/dist/src/components/icons/with-out-tick-octagon.d.ts +3 -3
  463. package/dist/src/components/icons/work-centre.d.ts +3 -3
  464. package/dist/src/components/location-select.d.ts +1 -1
  465. package/dist/src/components/material-editable-table/material-editable-table.d.ts +1 -1
  466. package/dist/src/components/material-table/material-table.d.ts +1 -1
  467. package/dist/src/components/phone-input/phone-input.d.ts +1 -1
  468. package/dist/src/components/radio/radio.d.ts +1 -1
  469. package/dist/src/components/select/select.d.ts +1 -1
  470. package/dist/src/components/switches/android-12-switch.d.ts +1 -3
  471. package/dist/src/components/text-field/text-field.d.ts +1 -1
  472. package/dist/src/components/time-picker/time-picker.d.ts +1 -1
  473. package/dist/src/components/upload-media/upload-media.d.ts +1 -1
  474. package/dist/src/utils/common-utility.d.ts +1 -1
  475. package/dist/style.css +62 -62
  476. package/dist/styles/index.d.ts +1 -1
  477. package/dist/theme/theme-impl/index.esm.js.map +1 -1
  478. package/dist/theme/theme-impl/index.js.map +1 -1
  479. package/dist/utils/api/index.esm.js +6 -6
  480. package/dist/utils/api/index.esm.js.map +1 -1
  481. package/dist/utils/api/index.js +1 -1
  482. package/dist/utils/api/index.js.map +1 -1
  483. package/dist/utils/common/index.esm.js +6 -6
  484. package/dist/utils/common/index.esm.js.map +1 -1
  485. package/dist/utils/common/index.js +1 -1
  486. package/dist/utils/common/index.js.map +1 -1
  487. package/dist/utils/common-utility.d.ts +1 -1
  488. package/dist/utils/date-range/index.esm.js.map +1 -1
  489. package/dist/utils/date-range/index.js.map +1 -1
  490. package/dist/utils/i18n/index.esm.js.map +1 -1
  491. package/dist/utils/i18n/index.js.map +1 -1
  492. package/dist/utils/menu-filter/index.esm.js.map +1 -1
  493. package/dist/utils/menu-filter/index.js.map +1 -1
  494. package/dist/views/404/index.esm.js.map +1 -1
  495. package/dist/views/404/index.js.map +1 -1
  496. package/dist/views/afterAuth/dashboard/dashboard/index.esm.js.map +1 -1
  497. package/dist/views/afterAuth/dashboard/dashboard/index.js.map +1 -1
  498. package/dist/views/afterAuth/dashboard/redux/actionCreator/index.esm.js.map +1 -1
  499. package/dist/views/afterAuth/dashboard/redux/actionCreator/index.js.map +1 -1
  500. package/dist/views/afterAuth/dashboard/redux/reducer/index.esm.js.map +1 -1
  501. package/dist/views/afterAuth/dashboard/redux/reducer/index.js.map +1 -1
  502. package/dist/views/afterAuth/dashboard/redux/state/index.esm.js.map +1 -1
  503. package/dist/views/afterAuth/dashboard/redux/state/index.js.map +1 -1
  504. package/dist/views/afterAuth/page-view/page-view/index.esm.js.map +1 -1
  505. package/dist/views/afterAuth/page-view/page-view/index.js.map +1 -1
  506. package/dist/views/afterAuth/page-view/redux/actionCreator/index.esm.js.map +1 -1
  507. package/dist/views/afterAuth/page-view/redux/actionCreator/index.js.map +1 -1
  508. package/dist/views/afterAuth/page-view/redux/reducer/index.esm.js.map +1 -1
  509. package/dist/views/afterAuth/page-view/redux/reducer/index.js.map +1 -1
  510. package/dist/views/afterAuth/page-view/redux/state/index.esm.js.map +1 -1
  511. package/dist/views/afterAuth/page-view/redux/state/index.js.map +1 -1
  512. package/dist/views/afterAuth/page-view/utils/default-data/index.esm.js.map +1 -1
  513. package/dist/views/afterAuth/page-view/utils/default-data/index.js.map +1 -1
  514. package/dist/views/afterAuth/page-view/utils/local-data/index.esm.js.map +1 -1
  515. package/dist/views/afterAuth/page-view/utils/local-data/index.js.map +1 -1
  516. package/dist/views/beforeAuth/change-password/change-password/index.esm.js.map +1 -1
  517. package/dist/views/beforeAuth/change-password/change-password/index.js.map +1 -1
  518. package/dist/views/beforeAuth/components/activity-tag-data/activity-tag-data/index.esm.js.map +1 -1
  519. package/dist/views/beforeAuth/components/activity-tag-data/activity-tag-data/index.js.map +1 -1
  520. package/dist/views/beforeAuth/components/calendar-data/calendar-data/index.esm.js.map +1 -1
  521. package/dist/views/beforeAuth/components/calendar-data/calendar-data/index.js.map +1 -1
  522. package/dist/views/beforeAuth/components/gantt-data/gantt-data/index.esm.js.map +1 -1
  523. package/dist/views/beforeAuth/components/gantt-data/gantt-data/index.js.map +1 -1
  524. package/dist/views/beforeAuth/components/grid-data/grid-data/index.esm.js.map +1 -1
  525. package/dist/views/beforeAuth/components/grid-data/grid-data/index.js.map +1 -1
  526. package/dist/views/beforeAuth/components/kanbann-content/kanbann-raw/index.esm.js.map +1 -1
  527. package/dist/views/beforeAuth/components/kanbann-content/kanbann-raw/index.js.map +1 -1
  528. package/dist/views/beforeAuth/components/list-content/column-raw/index.esm.js.map +1 -1
  529. package/dist/views/beforeAuth/components/list-content/column-raw/index.js.map +1 -1
  530. package/dist/views/beforeAuth/components/list-content/list-data/index.esm.js.map +1 -1
  531. package/dist/views/beforeAuth/components/list-content/list-data/index.js.map +1 -1
  532. package/dist/views/beforeAuth/components/multiline-data/multiline-data/index.esm.js.map +1 -1
  533. package/dist/views/beforeAuth/components/multiline-data/multiline-data/index.js.map +1 -1
  534. package/dist/views/beforeAuth/components/share-modal-data/share-modal-data/index.esm.js.map +1 -1
  535. package/dist/views/beforeAuth/components/share-modal-data/share-modal-data/index.js.map +1 -1
  536. package/dist/views/beforeAuth/components/shared-pages-data/shared-pages-data/index.esm.js.map +1 -1
  537. package/dist/views/beforeAuth/components/shared-pages-data/shared-pages-data/index.js.map +1 -1
  538. package/dist/views/beforeAuth/components/tabs-data/tabs-data/index.esm.js.map +1 -1
  539. package/dist/views/beforeAuth/components/tabs-data/tabs-data/index.js.map +1 -1
  540. package/dist/views/beforeAuth/components/user-dashboard-data/user-dashboard-data/index.esm.js.map +1 -1
  541. package/dist/views/beforeAuth/components/user-dashboard-data/user-dashboard-data/index.js.map +1 -1
  542. package/dist/views/beforeAuth/components/user-dropdown-data/user-dropdown-data/index.esm.js.map +1 -1
  543. package/dist/views/beforeAuth/components/user-dropdown-data/user-dropdown-data/index.js.map +1 -1
  544. package/dist/views/beforeAuth/forgot-password/forgot-password/index.esm.js.map +1 -1
  545. package/dist/views/beforeAuth/forgot-password/forgot-password/index.js.map +1 -1
  546. package/dist/views/beforeAuth/landing/landing/index.esm.js.map +1 -1
  547. package/dist/views/beforeAuth/landing/landing/index.js.map +1 -1
  548. package/dist/views/beforeAuth/reset-password/reset-password/index.esm.js.map +1 -1
  549. package/dist/views/beforeAuth/reset-password/reset-password/index.js.map +1 -1
  550. package/dist/views/form-builder/custom-form/index.esm.js.map +1 -1
  551. package/dist/views/form-builder/custom-form/index.js.map +1 -1
  552. package/dist/views/form-builder/element-edit-forms/checkbox/index.esm.js.map +1 -1
  553. package/dist/views/form-builder/element-edit-forms/checkbox/index.js.map +1 -1
  554. package/dist/views/form-builder/element-edit-forms/column-width/index.esm.js.map +1 -1
  555. package/dist/views/form-builder/element-edit-forms/column-width/index.js.map +1 -1
  556. package/dist/views/form-builder/element-edit-forms/field-select/index.esm.js.map +1 -1
  557. package/dist/views/form-builder/element-edit-forms/field-select/index.js.map +1 -1
  558. package/dist/views/form-builder/element-edit-forms/section/index.esm.js.map +1 -1
  559. package/dist/views/form-builder/element-edit-forms/section/index.js.map +1 -1
  560. package/dist/views/form-builder/element-edit-forms/select/index.esm.js.map +1 -1
  561. package/dist/views/form-builder/element-edit-forms/select/index.js.map +1 -1
  562. package/dist/views/form-builder/element-edit-forms/table-form/index.esm.js.map +1 -1
  563. package/dist/views/form-builder/element-edit-forms/table-form/index.js.map +1 -1
  564. package/dist/views/form-builder/element-edit-forms/text/index.esm.js.map +1 -1
  565. package/dist/views/form-builder/element-edit-forms/text/index.js.map +1 -1
  566. package/dist/views/form-builder/field_properties/index.esm.js.map +1 -1
  567. package/dist/views/form-builder/field_properties/index.js.map +1 -1
  568. package/dist/views/form-builder/form-fields/index.esm.js.map +1 -1
  569. package/dist/views/form-builder/form-fields/index.js.map +1 -1
  570. package/dist/views/form-builder/redux/actionCreator/index.esm.js +1 -1
  571. package/dist/views/form-builder/redux/actionCreator/index.esm.js.map +1 -1
  572. package/dist/views/form-builder/redux/actionCreator/index.js +1 -1
  573. package/dist/views/form-builder/redux/actionCreator/index.js.map +1 -1
  574. package/dist/views/form-builder/redux/reducer/index.esm.js.map +1 -1
  575. package/dist/views/form-builder/redux/reducer/index.js.map +1 -1
  576. package/dist/views/form-builder/redux/state/index.esm.js.map +1 -1
  577. package/dist/views/form-builder/redux/state/index.js.map +1 -1
  578. package/dist/views/form-builder/utils/common/index.esm.js.map +1 -1
  579. package/dist/views/form-builder/utils/common/index.js.map +1 -1
  580. package/dist/views/index.d.ts +8 -8
  581. package/dist/views/privateRoute/index.esm.js.map +1 -1
  582. package/dist/views/privateRoute/index.js.map +1 -1
  583. package/dist/views/template-editor/add-template/add-template/index.esm.js.map +1 -1
  584. package/dist/views/template-editor/add-template/add-template/index.js.map +1 -1
  585. package/dist/views/template-editor/company-selection-modal/company-selection-modal/index.esm.js.map +1 -1
  586. package/dist/views/template-editor/company-selection-modal/company-selection-modal/index.js.map +1 -1
  587. package/dist/views/template-editor/components/EditorCanvas/index.esm.js.map +1 -1
  588. package/dist/views/template-editor/components/EditorCanvas/index.js.map +1 -1
  589. package/dist/views/template-editor/components/EditorHeader/index.esm.js.map +1 -1
  590. package/dist/views/template-editor/components/EditorHeader/index.js.map +1 -1
  591. package/dist/views/template-editor/components/EditorSection/index.esm.js.map +1 -1
  592. package/dist/views/template-editor/components/EditorSection/index.js.map +1 -1
  593. package/dist/views/template-editor/components/EditorSidebar/index.esm.js +1 -1
  594. package/dist/views/template-editor/components/EditorSidebar/index.esm.js.map +1 -1
  595. package/dist/views/template-editor/components/EditorSidebar/index.js +1 -1
  596. package/dist/views/template-editor/components/EditorSidebar/index.js.map +1 -1
  597. package/dist/views/template-editor/components/SectionFlowEditor/index.esm.js.map +1 -1
  598. package/dist/views/template-editor/components/SectionFlowEditor/index.js.map +1 -1
  599. package/dist/views/template-editor/components/SectionFormatPanel/index.esm.js.map +1 -1
  600. package/dist/views/template-editor/components/SectionFormatPanel/index.js.map +1 -1
  601. package/dist/views/template-editor/components/controllers/AlignmentControl/index.esm.js.map +1 -1
  602. package/dist/views/template-editor/components/controllers/AlignmentControl/index.js.map +1 -1
  603. package/dist/views/template-editor/components/controllers/ButtonControls/index.esm.js.map +1 -1
  604. package/dist/views/template-editor/components/controllers/ButtonControls/index.js.map +1 -1
  605. package/dist/views/template-editor/components/controllers/CodeControls/index.esm.js.map +1 -1
  606. package/dist/views/template-editor/components/controllers/CodeControls/index.js.map +1 -1
  607. package/dist/views/template-editor/components/controllers/DividerControls/index.esm.js.map +1 -1
  608. package/dist/views/template-editor/components/controllers/DividerControls/index.js.map +1 -1
  609. package/dist/views/template-editor/components/controllers/ImageControls/index.esm.js.map +1 -1
  610. package/dist/views/template-editor/components/controllers/ImageControls/index.js.map +1 -1
  611. package/dist/views/template-editor/components/controllers/SignatureControls/index.esm.js.map +1 -1
  612. package/dist/views/template-editor/components/controllers/SignatureControls/index.js.map +1 -1
  613. package/dist/views/template-editor/components/controllers/TableControls/index.esm.js.map +1 -1
  614. package/dist/views/template-editor/components/controllers/TableControls/index.js.map +1 -1
  615. package/dist/views/template-editor/components/controllers/TextControls/index.esm.js.map +1 -1
  616. package/dist/views/template-editor/components/controllers/TextControls/index.js.map +1 -1
  617. package/dist/views/template-editor/components/controllers/border-control/index.esm.js.map +1 -1
  618. package/dist/views/template-editor/components/controllers/border-control/index.js.map +1 -1
  619. package/dist/views/template-editor/edit-section-modal/edit-section-modal/index.esm.js.map +1 -1
  620. package/dist/views/template-editor/edit-section-modal/edit-section-modal/index.js.map +1 -1
  621. package/dist/views/template-editor/routes/index.esm.js.map +1 -1
  622. package/dist/views/template-editor/routes/index.js.map +1 -1
  623. package/dist/views/template-editor/template-modal/html-thumbnail-preview/index.esm.js.map +1 -1
  624. package/dist/views/template-editor/template-modal/html-thumbnail-preview/index.js.map +1 -1
  625. package/dist/views/template-editor/template-modal/template-modal/index.esm.js.map +1 -1
  626. package/dist/views/template-editor/template-modal/template-modal/index.js.map +1 -1
  627. package/dist/views/template-editor/template-name-modal/template-name-modal/index.esm.js.map +1 -1
  628. package/dist/views/template-editor/template-name-modal/template-name-modal/index.js.map +1 -1
  629. package/dist/views/template-editor/templates/index.esm.js +1 -1
  630. package/dist/views/template-editor/templates/index.esm.js.map +1 -1
  631. package/dist/views/template-editor/templates/index.js +1 -1
  632. package/dist/views/template-editor/templates/index.js.map +1 -1
  633. package/dist/views/template-editor/utils/common/index.esm.js.map +1 -1
  634. package/dist/views/template-editor/utils/common/index.js.map +1 -1
  635. package/dist/views/template-editor/utils/constant/index.esm.js.map +1 -1
  636. package/dist/views/template-editor/utils/constant/index.js.map +1 -1
  637. package/dist/views/template-editor/utils/default-data/index.esm.js.map +1 -1
  638. package/dist/views/template-editor/utils/default-data/index.js.map +1 -1
  639. package/dist/views/template-editor/utils/style-extractor/index.esm.js.map +1 -1
  640. package/dist/views/template-editor/utils/style-extractor/index.js.map +1 -1
  641. package/dist/vite-env.d.ts +23 -23
  642. package/package.json +299 -299
  643. package/src/styles/README.md +287 -287
  644. package/src/styles/all.scss +7 -7
  645. package/src/styles/animations.scss +5 -5
  646. package/src/styles/css/reset.css +1 -1
  647. package/src/styles/index.d.ts +1 -1
  648. package/src/styles/index.ts +1 -1
  649. package/src/styles/mixins.scss +5 -5
  650. package/src/styles/sass/main.scss +11 -11
  651. package/src/styles/utils.scss +5 -5
  652. package/src/styles/variables.scss +4 -4
  653. package/dist/node_modules/@tanstack/react-virtual/dist/esm/index/index.esm.js.map +0 -1
  654. package/dist/node_modules/@tanstack/react-virtual/dist/esm/index/index.js +0 -2
  655. package/dist/node_modules/@tanstack/react-virtual/dist/esm/index/index.js.map +0 -1
  656. package/dist/node_modules/@toast-ui/react-editor/dist/esm/index/index.esm.js.map +0 -1
  657. package/dist/node_modules/@toast-ui/react-editor/dist/esm/index/index.js +0 -2
  658. package/dist/node_modules/@toast-ui/react-editor/dist/esm/index/index.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../../../../../src/views/template-editor/components/SectionFlowEditor.tsx"],"sourcesContent":["/* eslint-disable no-case-declarations */\n/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable react-hooks/exhaustive-deps */\n/* eslint-disable unused-imports/no-unused-vars */\nimport React, { useState, useEffect } from 'react';\nimport EditorHeader from './EditorHeader';\nimport EditorCanvas from './EditorCanvas';\nimport {\n DndContext,\n DragEndEvent,\n DragOverEvent,\n DragStartEvent,\n pointerWithin,\n} from '@dnd-kit/core';\nimport { SectionData, ElementType } from '../types/editor';\nimport { v4 as uuidv4 } from 'uuid';\nimport { enqueueSnackbar } from 'notistack';\nimport { Box } from '@mui/material';\nimport { useLocation, useParams } from 'react-router-dom';\nimport { getErrorMessage, getToken } from '../../../utils/common';\nimport { getV1FormBuilderRelationalSchemaFieldsName, getV1SubjectsId, getV1TemplateHeaderFooterCompanyIdHeaderFooter, getV1TemplatesId, patchV1TemplateHeaderFooterId, postV1TemplateHeaderFooter } from '../../../api-client/api.system-feature/api';\nimport { templateRoutes, extractStyles, generateEmailPreview, generateHeaderFooterPreview, generateInlineStyles } from '../utils/common';\nimport { initialStyles } from '../utils/constant';\nimport _ from 'lodash';\nimport formatText from '../../../utils/format-text';\nimport TemplateNameModal from \"../template-name-modal/template-name-modal\";\n\ninterface EnhancedSectionData extends SectionData {\n isSplitPair?: boolean;\n splitGroupId?: string;\n splitWidth?: number;\n}\n\ninterface SectionFlowEditorProps {\n modulePath: string;\n module: string;\n type: string;\n}\n\nconst SectionFlowEditor: React.FC<SectionFlowEditorProps> = ({ modulePath, module, type}) => {\n const { id, template_id } = useParams();\n const { state: locationState } = useLocation();\n\n const [sections, setSections] = useState<EnhancedSectionData[]>([]);\n const [headerSections, setHeaderSections] = useState<EnhancedSectionData[]>([]);\n const [footerSections, setFooterSections] = useState<EnhancedSectionData[]>([]);\n const [activeId, setActiveId] = useState<string | null>(null);\n const [selectedSection, setSelectedSection] = useState<string | null>(null);\n const [overSection, setOverSection] = useState<string | null>(null);\n const [preview, setPreview] = useState<boolean>(false);\n const [placeholders, setPlaceholders] = useState<Record<string, any>[]>([]);\n const [activeCanvas, setActiveCanvas] = useState<'main' | 'header' | 'footer'>('main');\n const [isEditingHeaderFooter, setIsEditingHeaderFooter] = useState<boolean>(false);\n const [payload, setPayload] = useState<any>(null);\n const [headerFooterId, setHeaderFooterId] = useState<string>('');\n const ROUTES = templateRoutes(modulePath, type);\n const [relation_table, setRelationTable] = useState<any[]>([]);\n const [templateData, setTemplateData] = useState<Record<string, any> | null >(null);\n\n const handleDragStart = (event: DragStartEvent) => {\n const { active } = event;\n setActiveId(active.id as string);\n };\n\n const handleDragOver = (event: DragOverEvent) => {\n const { /* active, */ over } = event;\n\n if (!over) {\n setOverSection(null);\n return;\n }\n\n if (over.id === 'header-canvas' && isEditingHeaderFooter) {\n setActiveCanvas('header');\n } else if (over.id === 'footer-canvas' && isEditingHeaderFooter) {\n setActiveCanvas('footer');\n } else if (over.id === 'main-canvas') {\n setActiveCanvas('main');\n }\n\n if (over.id !== 'header-canvas' && over.id !== 'main-canvas' && over.id !== 'footer-canvas') {\n setOverSection(over.id as string);\n }\n };\n\n const handleDragEnd = (event: DragEndEvent) => {\n const { active, over } = event;\n \n setActiveId(null);\n setOverSection(null);\n \n if (!over) return;\n \n let targetSections = sections;\n let setTargetSections = setSections;\n \n if ((over.id === 'header-canvas' || overSection?.startsWith('header-')) && isEditingHeaderFooter) {\n targetSections = headerSections;\n setTargetSections = setHeaderSections;\n setActiveCanvas('header');\n } else if ((over.id === 'footer-canvas' || overSection?.startsWith('footer-')) && isEditingHeaderFooter) {\n targetSections = footerSections;\n setTargetSections = setFooterSections;\n setActiveCanvas('footer');\n } else {\n setActiveCanvas('main');\n }\n \n if (active.data.current?.type === 'image') {\n const imageUrl = active.data.current.imageUrl;\n const newSection: EnhancedSectionData = createNewSection('image', { src: imageUrl, alt: 'Image' });\n \n const overIndex = targetSections.findIndex((section) => section.id === over.id);\n const newSections = [...targetSections];\n \n if (over.id === 'header-canvas' || over.id === 'main-canvas' || over.id === 'footer-canvas' || overIndex === -1) {\n setTargetSections([...targetSections, newSection]);\n } else {\n newSections.splice(overIndex, 0, newSection);\n setTargetSections(newSections);\n }\n \n enqueueSnackbar('Added uploaded image section');\n return;\n }\n \n if (typeof active.id === 'string' && active.id.startsWith('sidebar-')) {\n const type = active.id.replace('sidebar-', '') as ElementType;\n const newSection = createNewSection(type);\n \n const overIndex = targetSections.findIndex((section) => section.id === over.id);\n const isOverSection = overIndex !== -1;\n \n if (!isOverSection || over.id === 'header-canvas' || over.id === 'main-canvas' || over.id === 'footer-canvas') {\n setTargetSections([...targetSections, newSection]);\n } else {\n const targetSection = targetSections[overIndex];\n const isEmpty =\n !targetSection.content ||\n targetSection.content.includes('Click to add') ||\n targetSection.content.includes('enter your text');\n \n if (isEmpty) {\n const updatedSections = [...targetSections];\n updatedSections[overIndex] = {\n ...targetSection,\n type,\n content: newSection.content,\n };\n setTargetSections(updatedSections);\n // enqueueSnackbar(`Changed section to ${type}`);\n } else {\n const updatedSections = [...targetSections];\n updatedSections.splice(overIndex, 0, newSection);\n setTargetSections(updatedSections);\n // enqueueSnackbar(`Added new ${type} section`);\n }\n }\n return;\n }\n \n if (\n active.id !== over.id &&\n typeof active.id === 'string' &&\n typeof over.id === 'string'\n ) {\n let sourceSections: EnhancedSectionData[] = [];\n let sourceSetSections: React.Dispatch<React.SetStateAction<EnhancedSectionData[]>> | null = null;\n let canvasId = '';\n \n if (active.id.startsWith('header-') && isEditingHeaderFooter) {\n sourceSections = headerSections;\n sourceSetSections = setHeaderSections;\n canvasId = 'header-canvas';\n } else if (active.id.startsWith('footer-') && isEditingHeaderFooter) {\n sourceSections = footerSections;\n sourceSetSections = setFooterSections;\n canvasId = 'footer-canvas';\n } else {\n sourceSections = sections;\n sourceSetSections = setSections;\n canvasId = 'main-canvas';\n }\n \n const cleanActiveId = active.id.replace(/^(header-|footer-)/, '');\n \n const oldIndex = sourceSections.findIndex((section) => \n section.id === cleanActiveId || section.id === active.id\n );\n \n let newIndex = targetSections.findIndex((section) => \n section.id === String(over.id).replace(/^(header-|footer-)/, '')\n );\n \n if (over.id === 'header-canvas' || over.id === 'main-canvas' || over.id === 'footer-canvas') {\n newIndex = targetSections.length;\n }\n \n if (oldIndex !== -1 && newIndex !== -1) {\n if (sourceSections === targetSections) {\n const newSections = [...sourceSections];\n const [movedSection] = newSections.splice(oldIndex, 1);\n \n if (movedSection.isSplitPair && movedSection.splitGroupId) {\n const groupId = movedSection.splitGroupId;\n const groupSections = [movedSection, ...sourceSections.filter(\n s => s.splitGroupId === groupId && s.id !== movedSection.id\n )];\n \n const cleaned = newSections.filter(s => s.splitGroupId !== groupId);\n cleaned.splice(newIndex, 0, ...groupSections);\n sourceSetSections(cleaned);\n } else {\n newSections.splice(newIndex, 0, movedSection);\n sourceSetSections(newSections);\n }\n } else {\n const originalSection = sourceSections[oldIndex];\n \n const newSourceSections = [...sourceSections];\n newSourceSections.splice(oldIndex, 1);\n sourceSetSections(newSourceSections);\n \n const newTargetSections = [...targetSections];\n \n const movedSection = {...originalSection};\n \n if ((over.id === 'header-canvas' || over.id.startsWith('header-')) && isEditingHeaderFooter) {\n if (!movedSection.id.startsWith('header-')) {\n movedSection.id = `header-${movedSection.id}`;\n }\n } else if ((over.id === 'footer-canvas' || over.id.startsWith('footer-')) && isEditingHeaderFooter) {\n if (!movedSection.id.startsWith('footer-')) {\n movedSection.id = `footer-${movedSection.id}`;\n }\n } else {\n movedSection.id = movedSection.id.replace(/^(header-|footer-)/, '');\n }\n \n newTargetSections.splice(newIndex, 0, movedSection);\n setTargetSections(newTargetSections);\n }\n }\n }\n };\n\n const getRelevantSections = (canvasType: string) => {\n if (canvasType === 'header' && isEditingHeaderFooter) return headerSections;\n if (canvasType === 'footer' && isEditingHeaderFooter) return footerSections;\n return sections;\n };\n\n const getRelevantSetSections = (canvasType: string) => {\n if (canvasType === 'header' && isEditingHeaderFooter) return setHeaderSections;\n if (canvasType === 'footer' && isEditingHeaderFooter) return setFooterSections;\n return setSections;\n };\n\n const handleUpdateSection = (id: string, data: Partial<EnhancedSectionData>, canvasType: string) => {\n const relevantSections = getRelevantSections(canvasType);\n const relevantSetSections = getRelevantSetSections(canvasType);\n \n const cleanId = id.replace(/^(header-|footer-)/, '');\n \n relevantSetSections(\n relevantSections.map((section) =>\n section.id === cleanId || section.id === id ? { ...section, ...data } : section\n )\n );\n };\n\n const handleSplitSection = (id: string, content1: string, content2: string, canvasType: string) => {\n const relevantSections = getRelevantSections(canvasType);\n const relevantSetSections = getRelevantSetSections(canvasType);\n \n const cleanId = id.replace(/^(header-|footer-)/, '');\n \n const index = relevantSections.findIndex((section) => section.id === cleanId || section.id === id);\n if (index === -1) return;\n\n const section = relevantSections[index];\n const newSections = [...relevantSections];\n \n const sectionPrefix = canvasType === 'header' ? 'header-' : canvasType === 'footer' ? 'footer-' : '';\n \n if (section.isSplitPair && section.splitGroupId) {\n const splitGroupId = section.splitGroupId;\n const splitSections = newSections.filter(s => s.splitGroupId === splitGroupId);\n const totalSections = splitSections.length + 1;\n const newWidth = 100 / totalSections;\n \n newSections[index] = { \n ...section, \n content: content1,\n splitWidth: newWidth\n };\n\n const newSection: EnhancedSectionData = {\n id: `${sectionPrefix}section-${uuidv4()}`,\n content: content2,\n type: section.type,\n isSplitPair: true,\n splitGroupId: splitGroupId,\n splitWidth: newWidth,\n attributes: section.attributes,\n is_edited_from_source: false\n };\n\n newSections.splice(index + 1, 0, newSection);\n \n for (let i = 0; i < newSections.length; i++) {\n if (newSections[i].splitGroupId === splitGroupId) {\n newSections[i].splitWidth = newWidth;\n }\n }\n } else {\n const splitGroupId = uuidv4();\n const initialWidth = 50;\n \n newSections[index] = { \n ...section, \n content: content1,\n isSplitPair: true,\n splitGroupId,\n splitWidth: initialWidth\n };\n\n const newSection: EnhancedSectionData = {\n id: `${sectionPrefix}section-${uuidv4()}`,\n content: content2,\n type: section.type,\n isSplitPair: true,\n splitGroupId,\n splitWidth: initialWidth,\n attributes: section.attributes,\n is_edited_from_source: false\n };\n\n newSections.splice(index + 1, 0, newSection);\n }\n \n relevantSetSections(newSections);\n // enqueueSnackbar('Section split successfully');\n };\n\n const handleDeleteSection = (id: string, canvasType: string) => {\n const relevantSections = getRelevantSections(canvasType);\n const relevantSetSections = getRelevantSetSections(canvasType);\n \n const cleanId = id.replace(/^(header-|footer-)/, '');\n \n const sectionToDelete = relevantSections.find(s => s.id === cleanId || s.id === id);\n \n if (!sectionToDelete) return;\n \n if (sectionToDelete.isSplitPair && sectionToDelete.splitGroupId) {\n const splitSections = relevantSections.filter(s => s.splitGroupId === sectionToDelete.splitGroupId);\n \n if (splitSections.length <= 2) {\n const remainingSection = splitSections.find(s => s.id !== cleanId && s.id !== id);\n if (remainingSection) {\n remainingSection.isSplitPair = false;\n remainingSection.splitGroupId = undefined;\n remainingSection.splitWidth = undefined;\n }\n relevantSetSections(relevantSections.filter(s => s.id !== cleanId && s.id !== id));\n } else {\n const remainingSplitSections = splitSections.filter(s => s.id !== cleanId && s.id !== id);\n const newWidth = 100 / remainingSplitSections.length;\n \n const updatedSections = relevantSections.filter(section => section.id !== cleanId && section.id !== id).map(section => {\n if (section.splitGroupId === sectionToDelete.splitGroupId) {\n return { ...section, splitWidth: newWidth };\n }\n return section;\n });\n \n relevantSetSections(updatedSections);\n // enqueueSnackbar('Section removed from split group');\n }\n } else {\n relevantSetSections(relevantSections.filter(section => section.id !== cleanId && section.id !== id));\n // enqueueSnackbar('Section deleted');\n }\n \n if (selectedSection === id) {\n setSelectedSection(null);\n }\n };\n\n useEffect(() => {\n document.body.style.overflow = 'hidden';\n const main = document.getElementsByTagName('main')?.[0];\n if (main) {\n main.style.marginTop = '4.125rem';\n }\n return () => {\n document.body.removeAttribute('style');\n }\n }, []);\n\nconst getData = async () => {\n if (id) {\n const token = getToken();\n const subjRes = await getV1SubjectsId({ \n ...token, \n 'x-timezone': token['x-timezone']?.toString() || '',\n id \n });\n\n if ('data' in subjRes && subjRes.data && typeof subjRes.data === 'object' && 'resource' in subjRes.data) {\n const resource = (subjRes.data as any).resource;\n const token2 = getToken();\n const fRes = await getV1FormBuilderRelationalSchemaFieldsName({\n ...token2,\n 'x-timezone': token2['x-timezone']?.toString() || '',\n name: resource,\n });\n const schemaFields = ('data' in fRes && fRes.data && typeof fRes.data === 'object' && 'fields' in fRes.data) \n ? ((fRes.data as any).fields || [])\n : [];\n const relation_table = ('data' in fRes && fRes.data && typeof fRes.data === 'object' && 'relational_fields' in fRes.data)\n ? ((fRes.data as any).relational_fields || [])\n : [];\n\n // Process main schema fields\n const updatedFields = schemaFields\n .map((field) => ({\n ...field,\n key: field.key.replace('__replaceKey', ''),\n }))\n .filter((field) => !field.is_inner_join && field.alias !== 'id' && !field?.alias?.includes('_id'));\n\n // Process relation tables - separate array and object types\n const arrayRelationTables = [];\n const objectRelationFields = [];\n\n relation_table.forEach((table) => {\n if (!table) return;\n\n const updatedTableFields = (table.fields || []).map((field) => {\n const updatedField = {\n ...field,\n key: field.key.replace('__replaceKey', ''),\n alias: field?.templateKey ? field?.templateKey : field.alias,\n };\n\n // Prepend dataKey to field keys for object types\n if (table.type === 'object' && table.dataKey) {\n updatedField.key = `${table.dataKey}.${updatedField.key}`;\n }\n\n return updatedField;\n }).filter(\n (field) =>\n !field.is_inner_join &&\n field.alias !== 'id' &&\n !field.alias.includes('_id')\n );\n\n const uniqueTableFields = _.differenceWith(\n updatedTableFields,\n updatedTableFields,\n (fieldA: any, fieldB: any) => fieldA.key === fieldB?.joinKey\n );\n\n const tableFields = uniqueTableFields.map((f: any) => {\n const field = formatText(f.alias.replace(/_data$/, '').replace(/_/g, ' '));\n const value = table.type === 'object' && table.dataKey \n ? `${table.dataKey}.${f.alias.replace(/ /g, '_').toLowerCase()}`\n : f.alias.replace(/ /g, '_').toLowerCase();\n \n return { \n label: field, \n value: value \n };\n });\n\n if (table.type === 'object') {\n // Merge object type fields into main fields\n objectRelationFields.push(...tableFields);\n } else {\n // Keep array types separate\n arrayRelationTables.push({\n ...table,\n fields: tableFields\n });\n }\n });\n\n // Combine main fields and object relation fields\n const allFields = [\n ...updatedFields.map((f) => {\n const n = f?.alias || f?.key\n const field = formatText(n.replace(/_data$/, '').replace(/_/g, ' '));\n return { \n label: field, \n value: field.replace(/ /g, '_').toLowerCase() \n };\n }),\n ...objectRelationFields\n ];\n\n const uniqueAllFields = _.uniqBy(allFields, 'value');\n\n setPlaceholders(uniqueAllFields);\n setRelationTable(arrayRelationTables);\n }\n }\n\n // Rest of the function remains the same...\n if (template_id) {\n const token3 = getToken();\n const res = await getV1TemplatesId({ \n ...token3, \n 'x-timezone': token3['x-timezone']?.toString() || '',\n id: template_id \n });\n const templateSections = ('data' in res && res.data && typeof res.data === 'object' && 'sections' in res.data)\n ? ((res.data as any).sections || [])\n : [];\n const mainSecs = templateSections.map((s: any) => ({\n ...s,\n id: s.id || `section-${uuidv4()}`,\n }));\n setTemplateData(('data' in res && res.data) ? res.data as any : null);\n\n setSections(mainSecs);\n }\n\n if (locationState?.company_id) {\n const token4 = getToken();\n const res = await getV1TemplateHeaderFooterCompanyIdHeaderFooter({\n ...token4,\n 'x-timezone': token4['x-timezone']?.toString() || '',\n company_id: locationState.company_id,\n });\n const resData = ('data' in res && res.data && typeof res.data === 'object') ? res.data as any : null;\n setHeaderFooterId(resData?._id || '');\n const headerSections = resData?.header_sections || [];\n const footerSections = resData?.footer_sections || [];\n const headerSecs = headerSections.map((s) => ({\n ...s,\n id: s.id || `header-section-${uuidv4()}`,\n }));\n const footerSecs = footerSections.map((s) => ({\n ...s,\n id: s.id || `footer-section-${uuidv4()}`,\n }));\n\n setHeaderSections(headerSecs);\n setFooterSections(footerSecs);\n }\n};\n \n useEffect(() => {\n getData();\n }, [template_id, id, locationState?.company_id]);\n\n const createNewSection = (type: ElementType, attrs: Record<string, any> = {}): EnhancedSectionData => {\n let content = '';\n const styles = initialStyles[type] || {};\n const inlineStyles: string = generateInlineStyles(styles);\n\n const idPrefix = activeCanvas === 'header' && isEditingHeaderFooter ? 'header-' : \n activeCanvas === 'footer' && isEditingHeaderFooter ? 'footer-' : '';\n\n switch (type) {\n case 'heading':\n content = `<h1 style=\"${inlineStyles}\">Heading 1</h1>`;\n break;\n case 'heading-2':\n content = `<h2 style=\"${inlineStyles}\">Heading 2</h2>`;\n break;\n case 'heading-3':\n content = `<h3 style=\"${inlineStyles}\">Heading 3</h3>`;\n break;\n case 'heading-4':\n content = `<h4 style=\"${inlineStyles}\">Heading 4</h4>`;\n break;\n case 'text':\n content = `<p style=\"${inlineStyles}\">Hello, enter your text here...</p>`;\n break;\n case 'image':\n content = `<img src=\"${attrs.src}\" alt=\"${attrs.alt}\" style=\"${inlineStyles};\" />`;\n break;\n case 'buttons':\n attrs.text = attrs?.text || 'Button text';\n content = `<button style=\"${inlineStyles}\">${attrs.text}</button>`;\n break;\n case 'divider':\n content = `<hr style=\"${inlineStyles}\" />`;\n break;\n case 'table':\n const tableStyles = styles as any;\n const { border, borderStyle, borderColor, ...rest } = tableStyles;\n const tInlineStyles = generateInlineStyles(tableStyles.is_bordered ? tableStyles : rest);\n const tHeadInlineStyles: string = generateInlineStyles(tableStyles.tHead);\n const tBodyInlineStyles: string = generateInlineStyles(tableStyles.tBody);\n const thCellInlineStyles: string = generateInlineStyles({...tableStyles.thCells, border, borderStyle, borderColor });\n const tbCellInlineStyles: string = generateInlineStyles({...tableStyles.tbCells, border, borderStyle, borderColor});\n content = `\n <table style=\"${tInlineStyles}\">\n <thead style=\"${tHeadInlineStyles}\">\n <tr style=\"background-color: #f5f5f5;\">\n <th style=\"${thCellInlineStyles}\"></th>\n <th style=\"${thCellInlineStyles}\"></th>\n <th style=\"${thCellInlineStyles}\"></th>\n </tr>\n </thead>\n <tbody style=\"${tBodyInlineStyles}\">\n <tr>\n <td style=\"${tbCellInlineStyles}\"></td>\n <td style=\"${tbCellInlineStyles}\"></td>\n <td style=\"${tbCellInlineStyles}\"></td>\n </tr>\n </tbody>\n </table>\n `;\n break;\n case 'signature':\n content = `<div style=\"${inlineStyles}\">Signature: <input type='text' style=\"border:0; border-bottom:1px solid black\" class='signature-input'/></div>`;\n break;\n case 'qr-code':\n attrs.placeholder = attrs?.placeholder || '{{qr_data}}';\n content = `<div style=\"background-color: #f5f5f5; padding: 16px; text-align: center; color: #666666;\">${attrs.placeholder}</div>`;\n break;\n case 'bar-code':\n attrs.placeholder = attrs?.placeholder || '{{barcode_data}}';\n content = `<div style=\"background-color: #f5f5f5; padding: 16px; text-align: center; color: #666666;\">${attrs.placeholder}</div>`;\n break;\n default:\n content = '<p style=\"font-size: 16px; color: #333333; line-height: 1.5;\">New section</p>';\n }\n\n let attributes: Record<string, any> = {};\n attributes = extractStyles(content, type);\n\n return { \n id: `${idPrefix}section-${uuidv4()}`, \n content, \n type, \n attributes: {...(attrs || {}), styles},\n is_edited_from_source: false\n };\n };\n\n const handleSave = async () => {\n if(sections.length === 0 && headerSections.length === 0 && footerSections.length === 0) {\n enqueueSnackbar('Please add at least one section');\n return;\n }\n \n const mainHtml = generateEmailPreview(sections, headerSections, footerSections, true);\n try {\n const p = { \n ...getToken(), \n ...(template_id ? { id: template_id } : { subject_id: id, is_default: false, company_id: locationState.company_id }), \n sections: sections, \n contents: mainHtml \n }\n setPayload(p);\n } catch (error) {\n const m = getErrorMessage(error?.message);\n enqueueSnackbar(m, { variant: 'error' });\n }\n };\n const handleSaveHeaderFooter = async () => {\n if(sections.length === 0 && headerSections.length === 0 && footerSections.length === 0) {\n enqueueSnackbar('Please add at least one section', { variant: 'error' });\n return;\n } else if(!locationState?.company_id) {\n enqueueSnackbar('Company has not been selected', { variant: 'error' });\n return;\n }\n \n const headerHtml = generateHeaderFooterPreview(headerSections, 'header');\n const footerHtml = generateHeaderFooterPreview(footerSections, 'footer');\n const combinedHtml = `${headerHtml}${footerHtml}`;\n \n // Convert splitWidth from number to string for API\n const convertSectionForApi = (section: EnhancedSectionData) => ({\n id: section.id,\n content: section.content,\n type: section.type,\n isSplitPair: section.isSplitPair,\n splitGroupId: section.splitGroupId,\n splitWidth: section.splitWidth !== undefined ? String(section.splitWidth) : undefined,\n });\n \n const convertedHeaderSections = headerSections.map(convertSectionForApi);\n const convertedFooterSections = footerSections.map(convertSectionForApi);\n \n try {\n if(headerFooterId) {\n const token5 = getToken();\n const res = await patchV1TemplateHeaderFooterId({ \n ...token5,\n 'x-timezone': token5['x-timezone']?.toString() || '',\n id: headerFooterId, \n header_sections: convertedHeaderSections, \n footer_sections: convertedFooterSections, \n contents: combinedHtml \n });\n if(res.status_code === 200) {\n enqueueSnackbar('Header/Footer saved successfully', { variant: 'success' });\n setIsEditingHeaderFooter(false);\n }\n } else {\n const token6 = getToken();\n const res = await postV1TemplateHeaderFooter({ \n ...token6,\n 'x-timezone': token6['x-timezone']?.toString() || '',\n header_sections: convertedHeaderSections, \n footer_sections: convertedFooterSections, \n contents: combinedHtml, \n company_id: locationState.company_id\n });\n if(res.status_code === 200) {\n enqueueSnackbar('Header/Footer saved successfully', { variant: 'success' });\n setIsEditingHeaderFooter(false);\n }\n }\n } catch (error) {\n const m = getErrorMessage(error?.message);\n enqueueSnackbar(m, { variant: 'error' });\n }\n };\n\n const toggleHeaderFooterEditing = () => {\n setIsEditingHeaderFooter(!isEditingHeaderFooter);\n if (isEditingHeaderFooter) {\n setActiveCanvas('main');\n }\n };\n\n return (\n <Box sx={{ display: 'flex', flexDirection: 'column', height: '100vh' }}>\n <EditorHeader \n onPreview={() => setPreview(!preview)} \n onSave={handleSave}\n preview={preview}\n sections={sections}\n isEditingHeaderFooter={isEditingHeaderFooter}\n setIsEditingHeaderFooter={toggleHeaderFooterEditing}\n onSaveHeaderFooter={handleSaveHeaderFooter}\n modulePath={modulePath} \n type={type}\n mode={template_id ? 'edit' : 'add'}\n templateData={templateData}\n />\n <Box sx={{ display: 'flex', flex: 1, overflow: 'hidden' }}>\n <DndContext\n onDragStart={handleDragStart}\n onDragOver={handleDragOver}\n onDragEnd={handleDragEnd}\n collisionDetection={pointerWithin}\n >\n <EditorCanvas\n sections={sections}\n headerSections={headerSections}\n footerSections={footerSections}\n activeId={activeId}\n overSection={overSection}\n selectedSection={selectedSection}\n onSelectSection={setSelectedSection}\n onUpdateSection={handleUpdateSection}\n onSplitSection={handleSplitSection}\n onDeleteSection={handleDeleteSection}\n preview={preview}\n handleSave={handleSave}\n placeholders={placeholders}\n isEditingHeaderFooter={isEditingHeaderFooter}\n relation_table={relation_table}\n />\n </DndContext>\n </Box>\n {payload !== null && \n <TemplateNameModal \n isOpen={payload !== null} \n setIsOpen={() => setPayload(null)} \n payload={payload}\n templateRoutes={ROUTES}\n mode={template_id ? 'edit' : 'add'}\n templateData={templateData}\n />\n }\n </Box>\n );\n};\n\nexport default SectionFlowEditor;"],"names":["type","id","section","uuidv4","relation_table","_a","headerSections","footerSections"],"mappings":";;;;;;;;;;;;;;;;AAuCA,MAAM,oBAAsD,CAAC,EAAE,YAAY,QAAQ,WAAU;AAC3F,QAAM,EAAE,IAAI,YAAA,IAAgB,UAAA;AAC5B,QAAM,EAAE,OAAO,cAAA,IAAkB,YAAA;AAEjC,QAAM,CAAC,UAAU,WAAW,IAAI,SAAgC,CAAA,CAAE;AAClE,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAAgC,CAAA,CAAE;AAC9E,QAAM,CAAC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AM,GAAG,UAAU,SAAA,GAC7C,UAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,aAAa;AAAA,QACb,YAAY;AAAA,QACZ,WAAW;AAAA,QACX,oBAAoB;AAAA,QAEpB,UAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA,iBAAiB;AAAA,YACjB,iBAAiB;AAAA,YACjB,gBAAgB;AAAA,YAChB,iBAAiB;AAAA,YACjB;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA,GAEJ;AAAA,IACC,YAAY,QACX;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,QAAQ,YAAY;AAAA,QACpB,WAAW,MAAM,WAAW,IAAI;AAAA,QAChC;AAAA,QACA,gBAAgB;AAAA,QAChB,MAAM,cAAc,SAAS;AAAA,QAC7B;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GAEJ;AAEJ;"}
1
+ {"version":3,"file":"index.esm.js","sources":["../../../../../src/views/template-editor/components/SectionFlowEditor.tsx"],"sourcesContent":["/* eslint-disable no-case-declarations */\r\n/* eslint-disable @typescript-eslint/no-unused-vars */\r\n/* eslint-disable react-hooks/exhaustive-deps */\r\n/* eslint-disable unused-imports/no-unused-vars */\r\nimport React, { useState, useEffect } from 'react';\r\nimport EditorHeader from './EditorHeader';\r\nimport EditorCanvas from './EditorCanvas';\r\nimport {\r\n DndContext,\r\n DragEndEvent,\r\n DragOverEvent,\r\n DragStartEvent,\r\n pointerWithin,\r\n} from '@dnd-kit/core';\r\nimport { SectionData, ElementType } from '../types/editor';\r\nimport { v4 as uuidv4 } from 'uuid';\r\nimport { enqueueSnackbar } from 'notistack';\r\nimport { Box } from '@mui/material';\r\nimport { useLocation, useParams } from 'react-router-dom';\r\nimport { getErrorMessage, getToken } from '../../../utils/common';\r\nimport { getV1FormBuilderRelationalSchemaFieldsName, getV1SubjectsId, getV1TemplateHeaderFooterCompanyIdHeaderFooter, getV1TemplatesId, patchV1TemplateHeaderFooterId, postV1TemplateHeaderFooter } from '../../../api-client/api.system-feature/api';\r\nimport { templateRoutes, extractStyles, generateEmailPreview, generateHeaderFooterPreview, generateInlineStyles } from '../utils/common';\r\nimport { initialStyles } from '../utils/constant';\r\nimport _ from 'lodash';\r\nimport formatText from '../../../utils/format-text';\r\nimport TemplateNameModal from \"../template-name-modal/template-name-modal\";\r\n\r\ninterface EnhancedSectionData extends SectionData {\r\n isSplitPair?: boolean;\r\n splitGroupId?: string;\r\n splitWidth?: number;\r\n}\r\n\r\ninterface SectionFlowEditorProps {\r\n modulePath: string;\r\n module: string;\r\n type: string;\r\n}\r\n\r\nconst SectionFlowEditor: React.FC<SectionFlowEditorProps> = ({ modulePath, module, type}) => {\r\n const { id, template_id } = useParams();\r\n const { state: locationState } = useLocation();\r\n\r\n const [sections, setSections] = useState<EnhancedSectionData[]>([]);\r\n const [headerSections, setHeaderSections] = useState<EnhancedSectionData[]>([]);\r\n const [footerSections, setFooterSections] = useState<EnhancedSectionData[]>([]);\r\n const [activeId, setActiveId] = useState<string | null>(null);\r\n const [selectedSection, setSelectedSection] = useState<string | null>(null);\r\n const [overSection, setOverSection] = useState<string | null>(null);\r\n const [preview, setPreview] = useState<boolean>(false);\r\n const [placeholders, setPlaceholders] = useState<Record<string, any>[]>([]);\r\n const [activeCanvas, setActiveCanvas] = useState<'main' | 'header' | 'footer'>('main');\r\n const [isEditingHeaderFooter, setIsEditingHeaderFooter] = useState<boolean>(false);\r\n const [payload, setPayload] = useState<any>(null);\r\n const [headerFooterId, setHeaderFooterId] = useState<string>('');\r\n const ROUTES = templateRoutes(modulePath, type);\r\n const [relation_table, setRelationTable] = useState<any[]>([]);\r\n const [templateData, setTemplateData] = useState<Record<string, any> | null >(null);\r\n\r\n const handleDragStart = (event: DragStartEvent) => {\r\n const { active } = event;\r\n setActiveId(active.id as string);\r\n };\r\n\r\n const handleDragOver = (event: DragOverEvent) => {\r\n const { /* active, */ over } = event;\r\n\r\n if (!over) {\r\n setOverSection(null);\r\n return;\r\n }\r\n\r\n if (over.id === 'header-canvas' && isEditingHeaderFooter) {\r\n setActiveCanvas('header');\r\n } else if (over.id === 'footer-canvas' && isEditingHeaderFooter) {\r\n setActiveCanvas('footer');\r\n } else if (over.id === 'main-canvas') {\r\n setActiveCanvas('main');\r\n }\r\n\r\n if (over.id !== 'header-canvas' && over.id !== 'main-canvas' && over.id !== 'footer-canvas') {\r\n setOverSection(over.id as string);\r\n }\r\n };\r\n\r\n const handleDragEnd = (event: DragEndEvent) => {\r\n const { active, over } = event;\r\n \r\n setActiveId(null);\r\n setOverSection(null);\r\n \r\n if (!over) return;\r\n \r\n let targetSections = sections;\r\n let setTargetSections = setSections;\r\n \r\n if ((over.id === 'header-canvas' || overSection?.startsWith('header-')) && isEditingHeaderFooter) {\r\n targetSections = headerSections;\r\n setTargetSections = setHeaderSections;\r\n setActiveCanvas('header');\r\n } else if ((over.id === 'footer-canvas' || overSection?.startsWith('footer-')) && isEditingHeaderFooter) {\r\n targetSections = footerSections;\r\n setTargetSections = setFooterSections;\r\n setActiveCanvas('footer');\r\n } else {\r\n setActiveCanvas('main');\r\n }\r\n \r\n if (active.data.current?.type === 'image') {\r\n const imageUrl = active.data.current.imageUrl;\r\n const newSection: EnhancedSectionData = createNewSection('image', { src: imageUrl, alt: 'Image' });\r\n \r\n const overIndex = targetSections.findIndex((section) => section.id === over.id);\r\n const newSections = [...targetSections];\r\n \r\n if (over.id === 'header-canvas' || over.id === 'main-canvas' || over.id === 'footer-canvas' || overIndex === -1) {\r\n setTargetSections([...targetSections, newSection]);\r\n } else {\r\n newSections.splice(overIndex, 0, newSection);\r\n setTargetSections(newSections);\r\n }\r\n \r\n enqueueSnackbar('Added uploaded image section');\r\n return;\r\n }\r\n \r\n if (typeof active.id === 'string' && active.id.startsWith('sidebar-')) {\r\n const type = active.id.replace('sidebar-', '') as ElementType;\r\n const newSection = createNewSection(type);\r\n \r\n const overIndex = targetSections.findIndex((section) => section.id === over.id);\r\n const isOverSection = overIndex !== -1;\r\n \r\n if (!isOverSection || over.id === 'header-canvas' || over.id === 'main-canvas' || over.id === 'footer-canvas') {\r\n setTargetSections([...targetSections, newSection]);\r\n } else {\r\n const targetSection = targetSections[overIndex];\r\n const isEmpty =\r\n !targetSection.content ||\r\n targetSection.content.includes('Click to add') ||\r\n targetSection.content.includes('enter your text');\r\n \r\n if (isEmpty) {\r\n const updatedSections = [...targetSections];\r\n updatedSections[overIndex] = {\r\n ...targetSection,\r\n type,\r\n content: newSection.content,\r\n };\r\n setTargetSections(updatedSections);\r\n // enqueueSnackbar(`Changed section to ${type}`);\r\n } else {\r\n const updatedSections = [...targetSections];\r\n updatedSections.splice(overIndex, 0, newSection);\r\n setTargetSections(updatedSections);\r\n // enqueueSnackbar(`Added new ${type} section`);\r\n }\r\n }\r\n return;\r\n }\r\n \r\n if (\r\n active.id !== over.id &&\r\n typeof active.id === 'string' &&\r\n typeof over.id === 'string'\r\n ) {\r\n let sourceSections: EnhancedSectionData[] = [];\r\n let sourceSetSections: React.Dispatch<React.SetStateAction<EnhancedSectionData[]>> | null = null;\r\n let canvasId = '';\r\n \r\n if (active.id.startsWith('header-') && isEditingHeaderFooter) {\r\n sourceSections = headerSections;\r\n sourceSetSections = setHeaderSections;\r\n canvasId = 'header-canvas';\r\n } else if (active.id.startsWith('footer-') && isEditingHeaderFooter) {\r\n sourceSections = footerSections;\r\n sourceSetSections = setFooterSections;\r\n canvasId = 'footer-canvas';\r\n } else {\r\n sourceSections = sections;\r\n sourceSetSections = setSections;\r\n canvasId = 'main-canvas';\r\n }\r\n \r\n const cleanActiveId = active.id.replace(/^(header-|footer-)/, '');\r\n \r\n const oldIndex = sourceSections.findIndex((section) => \r\n section.id === cleanActiveId || section.id === active.id\r\n );\r\n \r\n let newIndex = targetSections.findIndex((section) => \r\n section.id === String(over.id).replace(/^(header-|footer-)/, '')\r\n );\r\n \r\n if (over.id === 'header-canvas' || over.id === 'main-canvas' || over.id === 'footer-canvas') {\r\n newIndex = targetSections.length;\r\n }\r\n \r\n if (oldIndex !== -1 && newIndex !== -1) {\r\n if (sourceSections === targetSections) {\r\n const newSections = [...sourceSections];\r\n const [movedSection] = newSections.splice(oldIndex, 1);\r\n \r\n if (movedSection.isSplitPair && movedSection.splitGroupId) {\r\n const groupId = movedSection.splitGroupId;\r\n const groupSections = [movedSection, ...sourceSections.filter(\r\n s => s.splitGroupId === groupId && s.id !== movedSection.id\r\n )];\r\n \r\n const cleaned = newSections.filter(s => s.splitGroupId !== groupId);\r\n cleaned.splice(newIndex, 0, ...groupSections);\r\n sourceSetSections(cleaned);\r\n } else {\r\n newSections.splice(newIndex, 0, movedSection);\r\n sourceSetSections(newSections);\r\n }\r\n } else {\r\n const originalSection = sourceSections[oldIndex];\r\n \r\n const newSourceSections = [...sourceSections];\r\n newSourceSections.splice(oldIndex, 1);\r\n sourceSetSections(newSourceSections);\r\n \r\n const newTargetSections = [...targetSections];\r\n \r\n const movedSection = {...originalSection};\r\n \r\n if ((over.id === 'header-canvas' || over.id.startsWith('header-')) && isEditingHeaderFooter) {\r\n if (!movedSection.id.startsWith('header-')) {\r\n movedSection.id = `header-${movedSection.id}`;\r\n }\r\n } else if ((over.id === 'footer-canvas' || over.id.startsWith('footer-')) && isEditingHeaderFooter) {\r\n if (!movedSection.id.startsWith('footer-')) {\r\n movedSection.id = `footer-${movedSection.id}`;\r\n }\r\n } else {\r\n movedSection.id = movedSection.id.replace(/^(header-|footer-)/, '');\r\n }\r\n \r\n newTargetSections.splice(newIndex, 0, movedSection);\r\n setTargetSections(newTargetSections);\r\n }\r\n }\r\n }\r\n };\r\n\r\n const getRelevantSections = (canvasType: string) => {\r\n if (canvasType === 'header' && isEditingHeaderFooter) return headerSections;\r\n if (canvasType === 'footer' && isEditingHeaderFooter) return footerSections;\r\n return sections;\r\n };\r\n\r\n const getRelevantSetSections = (canvasType: string) => {\r\n if (canvasType === 'header' && isEditingHeaderFooter) return setHeaderSections;\r\n if (canvasType === 'footer' && isEditingHeaderFooter) return setFooterSections;\r\n return setSections;\r\n };\r\n\r\n const handleUpdateSection = (id: string, data: Partial<EnhancedSectionData>, canvasType: string) => {\r\n const relevantSections = getRelevantSections(canvasType);\r\n const relevantSetSections = getRelevantSetSections(canvasType);\r\n \r\n const cleanId = id.replace(/^(header-|footer-)/, '');\r\n \r\n relevantSetSections(\r\n relevantSections.map((section) =>\r\n section.id === cleanId || section.id === id ? { ...section, ...data } : section\r\n )\r\n );\r\n };\r\n\r\n const handleSplitSection = (id: string, content1: string, content2: string, canvasType: string) => {\r\n const relevantSections = getRelevantSections(canvasType);\r\n const relevantSetSections = getRelevantSetSections(canvasType);\r\n \r\n const cleanId = id.replace(/^(header-|footer-)/, '');\r\n \r\n const index = relevantSections.findIndex((section) => section.id === cleanId || section.id === id);\r\n if (index === -1) return;\r\n\r\n const section = relevantSections[index];\r\n const newSections = [...relevantSections];\r\n \r\n const sectionPrefix = canvasType === 'header' ? 'header-' : canvasType === 'footer' ? 'footer-' : '';\r\n \r\n if (section.isSplitPair && section.splitGroupId) {\r\n const splitGroupId = section.splitGroupId;\r\n const splitSections = newSections.filter(s => s.splitGroupId === splitGroupId);\r\n const totalSections = splitSections.length + 1;\r\n const newWidth = 100 / totalSections;\r\n \r\n newSections[index] = { \r\n ...section, \r\n content: content1,\r\n splitWidth: newWidth\r\n };\r\n\r\n const newSection: EnhancedSectionData = {\r\n id: `${sectionPrefix}section-${uuidv4()}`,\r\n content: content2,\r\n type: section.type,\r\n isSplitPair: true,\r\n splitGroupId: splitGroupId,\r\n splitWidth: newWidth,\r\n attributes: section.attributes,\r\n is_edited_from_source: false\r\n };\r\n\r\n newSections.splice(index + 1, 0, newSection);\r\n \r\n for (let i = 0; i < newSections.length; i++) {\r\n if (newSections[i].splitGroupId === splitGroupId) {\r\n newSections[i].splitWidth = newWidth;\r\n }\r\n }\r\n } else {\r\n const splitGroupId = uuidv4();\r\n const initialWidth = 50;\r\n \r\n newSections[index] = { \r\n ...section, \r\n content: content1,\r\n isSplitPair: true,\r\n splitGroupId,\r\n splitWidth: initialWidth\r\n };\r\n\r\n const newSection: EnhancedSectionData = {\r\n id: `${sectionPrefix}section-${uuidv4()}`,\r\n content: content2,\r\n type: section.type,\r\n isSplitPair: true,\r\n splitGroupId,\r\n splitWidth: initialWidth,\r\n attributes: section.attributes,\r\n is_edited_from_source: false\r\n };\r\n\r\n newSections.splice(index + 1, 0, newSection);\r\n }\r\n \r\n relevantSetSections(newSections);\r\n // enqueueSnackbar('Section split successfully');\r\n };\r\n\r\n const handleDeleteSection = (id: string, canvasType: string) => {\r\n const relevantSections = getRelevantSections(canvasType);\r\n const relevantSetSections = getRelevantSetSections(canvasType);\r\n \r\n const cleanId = id.replace(/^(header-|footer-)/, '');\r\n \r\n const sectionToDelete = relevantSections.find(s => s.id === cleanId || s.id === id);\r\n \r\n if (!sectionToDelete) return;\r\n \r\n if (sectionToDelete.isSplitPair && sectionToDelete.splitGroupId) {\r\n const splitSections = relevantSections.filter(s => s.splitGroupId === sectionToDelete.splitGroupId);\r\n \r\n if (splitSections.length <= 2) {\r\n const remainingSection = splitSections.find(s => s.id !== cleanId && s.id !== id);\r\n if (remainingSection) {\r\n remainingSection.isSplitPair = false;\r\n remainingSection.splitGroupId = undefined;\r\n remainingSection.splitWidth = undefined;\r\n }\r\n relevantSetSections(relevantSections.filter(s => s.id !== cleanId && s.id !== id));\r\n } else {\r\n const remainingSplitSections = splitSections.filter(s => s.id !== cleanId && s.id !== id);\r\n const newWidth = 100 / remainingSplitSections.length;\r\n \r\n const updatedSections = relevantSections.filter(section => section.id !== cleanId && section.id !== id).map(section => {\r\n if (section.splitGroupId === sectionToDelete.splitGroupId) {\r\n return { ...section, splitWidth: newWidth };\r\n }\r\n return section;\r\n });\r\n \r\n relevantSetSections(updatedSections);\r\n // enqueueSnackbar('Section removed from split group');\r\n }\r\n } else {\r\n relevantSetSections(relevantSections.filter(section => section.id !== cleanId && section.id !== id));\r\n // enqueueSnackbar('Section deleted');\r\n }\r\n \r\n if (selectedSection === id) {\r\n setSelectedSection(null);\r\n }\r\n };\r\n\r\n useEffect(() => {\r\n document.body.style.overflow = 'hidden';\r\n const main = document.getElementsByTagName('main')?.[0];\r\n if (main) {\r\n main.style.marginTop = '4.125rem';\r\n }\r\n return () => {\r\n document.body.removeAttribute('style');\r\n }\r\n }, []);\r\n\r\nconst getData = async () => {\r\n if (id) {\r\n const token = getToken();\r\n const subjRes = await getV1SubjectsId({ \r\n ...token, \r\n 'x-timezone': token['x-timezone']?.toString() || '',\r\n id \r\n });\r\n\r\n if ('data' in subjRes && subjRes.data && typeof subjRes.data === 'object' && 'resource' in subjRes.data) {\r\n const resource = (subjRes.data as any).resource;\r\n const token2 = getToken();\r\n const fRes = await getV1FormBuilderRelationalSchemaFieldsName({\r\n ...token2,\r\n 'x-timezone': token2['x-timezone']?.toString() || '',\r\n name: resource,\r\n });\r\n const schemaFields = ('data' in fRes && fRes.data && typeof fRes.data === 'object' && 'fields' in fRes.data) \r\n ? ((fRes.data as any).fields || [])\r\n : [];\r\n const relation_table = ('data' in fRes && fRes.data && typeof fRes.data === 'object' && 'relational_fields' in fRes.data)\r\n ? ((fRes.data as any).relational_fields || [])\r\n : [];\r\n\r\n // Process main schema fields\r\n const updatedFields = schemaFields\r\n .map((field) => ({\r\n ...field,\r\n key: field.key.replace('__replaceKey', ''),\r\n }))\r\n .filter((field) => !field.is_inner_join && field.alias !== 'id' && !field?.alias?.includes('_id'));\r\n\r\n // Process relation tables - separate array and object types\r\n const arrayRelationTables = [];\r\n const objectRelationFields = [];\r\n\r\n relation_table.forEach((table) => {\r\n if (!table) return;\r\n\r\n const updatedTableFields = (table.fields || []).map((field) => {\r\n const updatedField = {\r\n ...field,\r\n key: field.key.replace('__replaceKey', ''),\r\n alias: field?.templateKey ? field?.templateKey : field.alias,\r\n };\r\n\r\n // Prepend dataKey to field keys for object types\r\n if (table.type === 'object' && table.dataKey) {\r\n updatedField.key = `${table.dataKey}.${updatedField.key}`;\r\n }\r\n\r\n return updatedField;\r\n }).filter(\r\n (field) =>\r\n !field.is_inner_join &&\r\n field.alias !== 'id' &&\r\n !field.alias.includes('_id')\r\n );\r\n\r\n const uniqueTableFields = _.differenceWith(\r\n updatedTableFields,\r\n updatedTableFields,\r\n (fieldA: any, fieldB: any) => fieldA.key === fieldB?.joinKey\r\n );\r\n\r\n const tableFields = uniqueTableFields.map((f: any) => {\r\n const field = formatText(f.alias.replace(/_data$/, '').replace(/_/g, ' '));\r\n const value = table.type === 'object' && table.dataKey \r\n ? `${table.dataKey}.${f.alias.replace(/ /g, '_').toLowerCase()}`\r\n : f.alias.replace(/ /g, '_').toLowerCase();\r\n \r\n return { \r\n label: field, \r\n value: value \r\n };\r\n });\r\n\r\n if (table.type === 'object') {\r\n // Merge object type fields into main fields\r\n objectRelationFields.push(...tableFields);\r\n } else {\r\n // Keep array types separate\r\n arrayRelationTables.push({\r\n ...table,\r\n fields: tableFields\r\n });\r\n }\r\n });\r\n\r\n // Combine main fields and object relation fields\r\n const allFields = [\r\n ...updatedFields.map((f) => {\r\n const n = f?.alias || f?.key\r\n const field = formatText(n.replace(/_data$/, '').replace(/_/g, ' '));\r\n return { \r\n label: field, \r\n value: field.replace(/ /g, '_').toLowerCase() \r\n };\r\n }),\r\n ...objectRelationFields\r\n ];\r\n\r\n const uniqueAllFields = _.uniqBy(allFields, 'value');\r\n\r\n setPlaceholders(uniqueAllFields);\r\n setRelationTable(arrayRelationTables);\r\n }\r\n }\r\n\r\n // Rest of the function remains the same...\r\n if (template_id) {\r\n const token3 = getToken();\r\n const res = await getV1TemplatesId({ \r\n ...token3, \r\n 'x-timezone': token3['x-timezone']?.toString() || '',\r\n id: template_id \r\n });\r\n const templateSections = ('data' in res && res.data && typeof res.data === 'object' && 'sections' in res.data)\r\n ? ((res.data as any).sections || [])\r\n : [];\r\n const mainSecs = templateSections.map((s: any) => ({\r\n ...s,\r\n id: s.id || `section-${uuidv4()}`,\r\n }));\r\n setTemplateData(('data' in res && res.data) ? res.data as any : null);\r\n\r\n setSections(mainSecs);\r\n }\r\n\r\n if (locationState?.company_id) {\r\n const token4 = getToken();\r\n const res = await getV1TemplateHeaderFooterCompanyIdHeaderFooter({\r\n ...token4,\r\n 'x-timezone': token4['x-timezone']?.toString() || '',\r\n company_id: locationState.company_id,\r\n });\r\n const resData = ('data' in res && res.data && typeof res.data === 'object') ? res.data as any : null;\r\n setHeaderFooterId(resData?._id || '');\r\n const headerSections = resData?.header_sections || [];\r\n const footerSections = resData?.footer_sections || [];\r\n const headerSecs = headerSections.map((s) => ({\r\n ...s,\r\n id: s.id || `header-section-${uuidv4()}`,\r\n }));\r\n const footerSecs = footerSections.map((s) => ({\r\n ...s,\r\n id: s.id || `footer-section-${uuidv4()}`,\r\n }));\r\n\r\n setHeaderSections(headerSecs);\r\n setFooterSections(footerSecs);\r\n }\r\n};\r\n \r\n useEffect(() => {\r\n getData();\r\n }, [template_id, id, locationState?.company_id]);\r\n\r\n const createNewSection = (type: ElementType, attrs: Record<string, any> = {}): EnhancedSectionData => {\r\n let content = '';\r\n const styles = initialStyles[type] || {};\r\n const inlineStyles: string = generateInlineStyles(styles);\r\n\r\n const idPrefix = activeCanvas === 'header' && isEditingHeaderFooter ? 'header-' : \r\n activeCanvas === 'footer' && isEditingHeaderFooter ? 'footer-' : '';\r\n\r\n switch (type) {\r\n case 'heading':\r\n content = `<h1 style=\"${inlineStyles}\">Heading 1</h1>`;\r\n break;\r\n case 'heading-2':\r\n content = `<h2 style=\"${inlineStyles}\">Heading 2</h2>`;\r\n break;\r\n case 'heading-3':\r\n content = `<h3 style=\"${inlineStyles}\">Heading 3</h3>`;\r\n break;\r\n case 'heading-4':\r\n content = `<h4 style=\"${inlineStyles}\">Heading 4</h4>`;\r\n break;\r\n case 'text':\r\n content = `<p style=\"${inlineStyles}\">Hello, enter your text here...</p>`;\r\n break;\r\n case 'image':\r\n content = `<img src=\"${attrs.src}\" alt=\"${attrs.alt}\" style=\"${inlineStyles};\" />`;\r\n break;\r\n case 'buttons':\r\n attrs.text = attrs?.text || 'Button text';\r\n content = `<button style=\"${inlineStyles}\">${attrs.text}</button>`;\r\n break;\r\n case 'divider':\r\n content = `<hr style=\"${inlineStyles}\" />`;\r\n break;\r\n case 'table':\r\n const tableStyles = styles as any;\r\n const { border, borderStyle, borderColor, ...rest } = tableStyles;\r\n const tInlineStyles = generateInlineStyles(tableStyles.is_bordered ? tableStyles : rest);\r\n const tHeadInlineStyles: string = generateInlineStyles(tableStyles.tHead);\r\n const tBodyInlineStyles: string = generateInlineStyles(tableStyles.tBody);\r\n const thCellInlineStyles: string = generateInlineStyles({...tableStyles.thCells, border, borderStyle, borderColor });\r\n const tbCellInlineStyles: string = generateInlineStyles({...tableStyles.tbCells, border, borderStyle, borderColor});\r\n content = `\r\n <table style=\"${tInlineStyles}\">\r\n <thead style=\"${tHeadInlineStyles}\">\r\n <tr style=\"background-color: #f5f5f5;\">\r\n <th style=\"${thCellInlineStyles}\"></th>\r\n <th style=\"${thCellInlineStyles}\"></th>\r\n <th style=\"${thCellInlineStyles}\"></th>\r\n </tr>\r\n </thead>\r\n <tbody style=\"${tBodyInlineStyles}\">\r\n <tr>\r\n <td style=\"${tbCellInlineStyles}\"></td>\r\n <td style=\"${tbCellInlineStyles}\"></td>\r\n <td style=\"${tbCellInlineStyles}\"></td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n `;\r\n break;\r\n case 'signature':\r\n content = `<div style=\"${inlineStyles}\">Signature: <input type='text' style=\"border:0; border-bottom:1px solid black\" class='signature-input'/></div>`;\r\n break;\r\n case 'qr-code':\r\n attrs.placeholder = attrs?.placeholder || '{{qr_data}}';\r\n content = `<div style=\"background-color: #f5f5f5; padding: 16px; text-align: center; color: #666666;\">${attrs.placeholder}</div>`;\r\n break;\r\n case 'bar-code':\r\n attrs.placeholder = attrs?.placeholder || '{{barcode_data}}';\r\n content = `<div style=\"background-color: #f5f5f5; padding: 16px; text-align: center; color: #666666;\">${attrs.placeholder}</div>`;\r\n break;\r\n default:\r\n content = '<p style=\"font-size: 16px; color: #333333; line-height: 1.5;\">New section</p>';\r\n }\r\n\r\n let attributes: Record<string, any> = {};\r\n attributes = extractStyles(content, type);\r\n\r\n return { \r\n id: `${idPrefix}section-${uuidv4()}`, \r\n content, \r\n type, \r\n attributes: {...(attrs || {}), styles},\r\n is_edited_from_source: false\r\n };\r\n };\r\n\r\n const handleSave = async () => {\r\n if(sections.length === 0 && headerSections.length === 0 && footerSections.length === 0) {\r\n enqueueSnackbar('Please add at least one section');\r\n return;\r\n }\r\n \r\n const mainHtml = generateEmailPreview(sections, headerSections, footerSections, true);\r\n try {\r\n const p = { \r\n ...getToken(), \r\n ...(template_id ? { id: template_id } : { subject_id: id, is_default: false, company_id: locationState.company_id }), \r\n sections: sections, \r\n contents: mainHtml \r\n }\r\n setPayload(p);\r\n } catch (error) {\r\n const m = getErrorMessage(error?.message);\r\n enqueueSnackbar(m, { variant: 'error' });\r\n }\r\n };\r\n const handleSaveHeaderFooter = async () => {\r\n if(sections.length === 0 && headerSections.length === 0 && footerSections.length === 0) {\r\n enqueueSnackbar('Please add at least one section', { variant: 'error' });\r\n return;\r\n } else if(!locationState?.company_id) {\r\n enqueueSnackbar('Company has not been selected', { variant: 'error' });\r\n return;\r\n }\r\n \r\n const headerHtml = generateHeaderFooterPreview(headerSections, 'header');\r\n const footerHtml = generateHeaderFooterPreview(footerSections, 'footer');\r\n const combinedHtml = `${headerHtml}${footerHtml}`;\r\n \r\n // Convert splitWidth from number to string for API\r\n const convertSectionForApi = (section: EnhancedSectionData) => ({\r\n id: section.id,\r\n content: section.content,\r\n type: section.type,\r\n isSplitPair: section.isSplitPair,\r\n splitGroupId: section.splitGroupId,\r\n splitWidth: section.splitWidth !== undefined ? String(section.splitWidth) : undefined,\r\n });\r\n \r\n const convertedHeaderSections = headerSections.map(convertSectionForApi);\r\n const convertedFooterSections = footerSections.map(convertSectionForApi);\r\n \r\n try {\r\n if(headerFooterId) {\r\n const token5 = getToken();\r\n const res = await patchV1TemplateHeaderFooterId({ \r\n ...token5,\r\n 'x-timezone': token5['x-timezone']?.toString() || '',\r\n id: headerFooterId, \r\n header_sections: convertedHeaderSections, \r\n footer_sections: convertedFooterSections, \r\n contents: combinedHtml \r\n });\r\n if(res.status_code === 200) {\r\n enqueueSnackbar('Header/Footer saved successfully', { variant: 'success' });\r\n setIsEditingHeaderFooter(false);\r\n }\r\n } else {\r\n const token6 = getToken();\r\n const res = await postV1TemplateHeaderFooter({ \r\n ...token6,\r\n 'x-timezone': token6['x-timezone']?.toString() || '',\r\n header_sections: convertedHeaderSections, \r\n footer_sections: convertedFooterSections, \r\n contents: combinedHtml, \r\n company_id: locationState.company_id\r\n });\r\n if(res.status_code === 200) {\r\n enqueueSnackbar('Header/Footer saved successfully', { variant: 'success' });\r\n setIsEditingHeaderFooter(false);\r\n }\r\n }\r\n } catch (error) {\r\n const m = getErrorMessage(error?.message);\r\n enqueueSnackbar(m, { variant: 'error' });\r\n }\r\n };\r\n\r\n const toggleHeaderFooterEditing = () => {\r\n setIsEditingHeaderFooter(!isEditingHeaderFooter);\r\n if (isEditingHeaderFooter) {\r\n setActiveCanvas('main');\r\n }\r\n };\r\n\r\n return (\r\n <Box sx={{ display: 'flex', flexDirection: 'column', height: '100vh' }}>\r\n <EditorHeader \r\n onPreview={() => setPreview(!preview)} \r\n onSave={handleSave}\r\n preview={preview}\r\n sections={sections}\r\n isEditingHeaderFooter={isEditingHeaderFooter}\r\n setIsEditingHeaderFooter={toggleHeaderFooterEditing}\r\n onSaveHeaderFooter={handleSaveHeaderFooter}\r\n modulePath={modulePath} \r\n type={type}\r\n mode={template_id ? 'edit' : 'add'}\r\n templateData={templateData}\r\n />\r\n <Box sx={{ display: 'flex', flex: 1, overflow: 'hidden' }}>\r\n <DndContext\r\n onDragStart={handleDragStart}\r\n onDragOver={handleDragOver}\r\n onDragEnd={handleDragEnd}\r\n collisionDetection={pointerWithin}\r\n >\r\n <EditorCanvas\r\n sections={sections}\r\n headerSections={headerSections}\r\n footerSections={footerSections}\r\n activeId={activeId}\r\n overSection={overSection}\r\n selectedSection={selectedSection}\r\n onSelectSection={setSelectedSection}\r\n onUpdateSection={handleUpdateSection}\r\n onSplitSection={handleSplitSection}\r\n onDeleteSection={handleDeleteSection}\r\n preview={preview}\r\n handleSave={handleSave}\r\n placeholders={placeholders}\r\n isEditingHeaderFooter={isEditingHeaderFooter}\r\n relation_table={relation_table}\r\n />\r\n </DndContext>\r\n </Box>\r\n {payload !== null && \r\n <TemplateNameModal \r\n isOpen={payload !== null} \r\n setIsOpen={() => setPayload(null)} \r\n payload={payload}\r\n templateRoutes={ROUTES}\r\n mode={template_id ? 'edit' : 'add'}\r\n templateData={templateData}\r\n />\r\n }\r\n </Box>\r\n );\r\n};\r\n\r\nexport default SectionFlowEditor;"],"names":["type","id","section","uuidv4","relation_table","_a","headerSections","footerSections"],"mappings":";;;;;;;;;;;;;;;;AAuCA,MAAM,oBAAsD,CAAC,EAAE,YAAY,QAAQ,WAAU;AAC3F,QAAM,EAAE,IAAI,YAAA,IAAgB,UAAA;AAC5B,QAAM,EAAE,OAAO,cAAA,IAAkB,YAAA;AAEjC,QAAM,CAAC,UAAU,WAAW,IAAI,SAAgC,CAAA,CAAE;AAClE,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAAgC,CAAA,CAAE;AAC9E,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAAgC,CAAA,CAAE;AAC9E,QAAM,CAAC,UAAU,WAAW,IAAI,SAAwB,IAAI;AAC5D,QAAM,CAAC,iBAAiB,kBAAkB,IAAI,SAAwB,IAAI;AAC1E,QAAM,CAAC,aAAa,cAAc,IAAI,SAAwB,IAAI;AAClE,QAAM,CAAC,SAAS,UAAU,IAAI,SAAkB,KAAK;AACrD,QAAM,CAAC,cAAc,eAAe,IAAI,SAAgC,CAAA,CAAE;AAC1E,QAAM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B;AAAA,YACjB;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA,GAEJ;AAAA,IACC,YAAY,QACX;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,QAAQ,YAAY;AAAA,QACpB,WAAW,MAAM,WAAW,IAAI;AAAA,QAChC;AAAA,QACA,gBAAgB;AAAA,QAChB,MAAM,cAAc,SAAS;AAAA,QAC7B;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GAEJ;AAEJ;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../src/views/template-editor/components/SectionFlowEditor.tsx"],"sourcesContent":["/* eslint-disable no-case-declarations */\n/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable react-hooks/exhaustive-deps */\n/* eslint-disable unused-imports/no-unused-vars */\nimport React, { useState, useEffect } from 'react';\nimport EditorHeader from './EditorHeader';\nimport EditorCanvas from './EditorCanvas';\nimport {\n DndContext,\n DragEndEvent,\n DragOverEvent,\n DragStartEvent,\n pointerWithin,\n} from '@dnd-kit/core';\nimport { SectionData, ElementType } from '../types/editor';\nimport { v4 as uuidv4 } from 'uuid';\nimport { enqueueSnackbar } from 'notistack';\nimport { Box } from '@mui/material';\nimport { useLocation, useParams } from 'react-router-dom';\nimport { getErrorMessage, getToken } from '../../../utils/common';\nimport { getV1FormBuilderRelationalSchemaFieldsName, getV1SubjectsId, getV1TemplateHeaderFooterCompanyIdHeaderFooter, getV1TemplatesId, patchV1TemplateHeaderFooterId, postV1TemplateHeaderFooter } from '../../../api-client/api.system-feature/api';\nimport { templateRoutes, extractStyles, generateEmailPreview, generateHeaderFooterPreview, generateInlineStyles } from '../utils/common';\nimport { initialStyles } from '../utils/constant';\nimport _ from 'lodash';\nimport formatText from '../../../utils/format-text';\nimport TemplateNameModal from \"../template-name-modal/template-name-modal\";\n\ninterface EnhancedSectionData extends SectionData {\n isSplitPair?: boolean;\n splitGroupId?: string;\n splitWidth?: number;\n}\n\ninterface SectionFlowEditorProps {\n modulePath: string;\n module: string;\n type: string;\n}\n\nconst SectionFlowEditor: React.FC<SectionFlowEditorProps> = ({ modulePath, module, type}) => {\n const { id, template_id } = useParams();\n const { state: locationState } = useLocation();\n\n const [sections, setSections] = useState<EnhancedSectionData[]>([]);\n const [headerSections, setHeaderSections] = useState<EnhancedSectionData[]>([]);\n const [footerSections, setFooterSections] = useState<EnhancedSectionData[]>([]);\n const [activeId, setActiveId] = useState<string | null>(null);\n const [selectedSection, setSelectedSection] = useState<string | null>(null);\n const [overSection, setOverSection] = useState<string | null>(null);\n const [preview, setPreview] = useState<boolean>(false);\n const [placeholders, setPlaceholders] = useState<Record<string, any>[]>([]);\n const [activeCanvas, setActiveCanvas] = useState<'main' | 'header' | 'footer'>('main');\n const [isEditingHeaderFooter, setIsEditingHeaderFooter] = useState<boolean>(false);\n const [payload, setPayload] = useState<any>(null);\n const [headerFooterId, setHeaderFooterId] = useState<string>('');\n const ROUTES = templateRoutes(modulePath, type);\n const [relation_table, setRelationTable] = useState<any[]>([]);\n const [templateData, setTemplateData] = useState<Record<string, any> | null >(null);\n\n const handleDragStart = (event: DragStartEvent) => {\n const { active } = event;\n setActiveId(active.id as string);\n };\n\n const handleDragOver = (event: DragOverEvent) => {\n const { /* active, */ over } = event;\n\n if (!over) {\n setOverSection(null);\n return;\n }\n\n if (over.id === 'header-canvas' && isEditingHeaderFooter) {\n setActiveCanvas('header');\n } else if (over.id === 'footer-canvas' && isEditingHeaderFooter) {\n setActiveCanvas('footer');\n } else if (over.id === 'main-canvas') {\n setActiveCanvas('main');\n }\n\n if (over.id !== 'header-canvas' && over.id !== 'main-canvas' && over.id !== 'footer-canvas') {\n setOverSection(over.id as string);\n }\n };\n\n const handleDragEnd = (event: DragEndEvent) => {\n const { active, over } = event;\n \n setActiveId(null);\n setOverSection(null);\n \n if (!over) return;\n \n let targetSections = sections;\n let setTargetSections = setSections;\n \n if ((over.id === 'header-canvas' || overSection?.startsWith('header-')) && isEditingHeaderFooter) {\n targetSections = headerSections;\n setTargetSections = setHeaderSections;\n setActiveCanvas('header');\n } else if ((over.id === 'footer-canvas' || overSection?.startsWith('footer-')) && isEditingHeaderFooter) {\n targetSections = footerSections;\n setTargetSections = setFooterSections;\n setActiveCanvas('footer');\n } else {\n setActiveCanvas('main');\n }\n \n if (active.data.current?.type === 'image') {\n const imageUrl = active.data.current.imageUrl;\n const newSection: EnhancedSectionData = createNewSection('image', { src: imageUrl, alt: 'Image' });\n \n const overIndex = targetSections.findIndex((section) => section.id === over.id);\n const newSections = [...targetSections];\n \n if (over.id === 'header-canvas' || over.id === 'main-canvas' || over.id === 'footer-canvas' || overIndex === -1) {\n setTargetSections([...targetSections, newSection]);\n } else {\n newSections.splice(overIndex, 0, newSection);\n setTargetSections(newSections);\n }\n \n enqueueSnackbar('Added uploaded image section');\n return;\n }\n \n if (typeof active.id === 'string' && active.id.startsWith('sidebar-')) {\n const type = active.id.replace('sidebar-', '') as ElementType;\n const newSection = createNewSection(type);\n \n const overIndex = targetSections.findIndex((section) => section.id === over.id);\n const isOverSection = overIndex !== -1;\n \n if (!isOverSection || over.id === 'header-canvas' || over.id === 'main-canvas' || over.id === 'footer-canvas') {\n setTargetSections([...targetSections, newSection]);\n } else {\n const targetSection = targetSections[overIndex];\n const isEmpty =\n !targetSection.content ||\n targetSection.content.includes('Click to add') ||\n targetSection.content.includes('enter your text');\n \n if (isEmpty) {\n const updatedSections = [...targetSections];\n updatedSections[overIndex] = {\n ...targetSection,\n type,\n content: newSection.content,\n };\n setTargetSections(updatedSections);\n // enqueueSnackbar(`Changed section to ${type}`);\n } else {\n const updatedSections = [...targetSections];\n updatedSections.splice(overIndex, 0, newSection);\n setTargetSections(updatedSections);\n // enqueueSnackbar(`Added new ${type} section`);\n }\n }\n return;\n }\n \n if (\n active.id !== over.id &&\n typeof active.id === 'string' &&\n typeof over.id === 'string'\n ) {\n let sourceSections: EnhancedSectionData[] = [];\n let sourceSetSections: React.Dispatch<React.SetStateAction<EnhancedSectionData[]>> | null = null;\n let canvasId = '';\n \n if (active.id.startsWith('header-') && isEditingHeaderFooter) {\n sourceSections = headerSections;\n sourceSetSections = setHeaderSections;\n canvasId = 'header-canvas';\n } else if (active.id.startsWith('footer-') && isEditingHeaderFooter) {\n sourceSections = footerSections;\n sourceSetSections = setFooterSections;\n canvasId = 'footer-canvas';\n } else {\n sourceSections = sections;\n sourceSetSections = setSections;\n canvasId = 'main-canvas';\n }\n \n const cleanActiveId = active.id.replace(/^(header-|footer-)/, '');\n \n const oldIndex = sourceSections.findIndex((section) => \n section.id === cleanActiveId || section.id === active.id\n );\n \n let newIndex = targetSections.findIndex((section) => \n section.id === String(over.id).replace(/^(header-|footer-)/, '')\n );\n \n if (over.id === 'header-canvas' || over.id === 'main-canvas' || over.id === 'footer-canvas') {\n newIndex = targetSections.length;\n }\n \n if (oldIndex !== -1 && newIndex !== -1) {\n if (sourceSections === targetSections) {\n const newSections = [...sourceSections];\n const [movedSection] = newSections.splice(oldIndex, 1);\n \n if (movedSection.isSplitPair && movedSection.splitGroupId) {\n const groupId = movedSection.splitGroupId;\n const groupSections = [movedSection, ...sourceSections.filter(\n s => s.splitGroupId === groupId && s.id !== movedSection.id\n )];\n \n const cleaned = newSections.filter(s => s.splitGroupId !== groupId);\n cleaned.splice(newIndex, 0, ...groupSections);\n sourceSetSections(cleaned);\n } else {\n newSections.splice(newIndex, 0, movedSection);\n sourceSetSections(newSections);\n }\n } else {\n const originalSection = sourceSections[oldIndex];\n \n const newSourceSections = [...sourceSections];\n newSourceSections.splice(oldIndex, 1);\n sourceSetSections(newSourceSections);\n \n const newTargetSections = [...targetSections];\n \n const movedSection = {...originalSection};\n \n if ((over.id === 'header-canvas' || over.id.startsWith('header-')) && isEditingHeaderFooter) {\n if (!movedSection.id.startsWith('header-')) {\n movedSection.id = `header-${movedSection.id}`;\n }\n } else if ((over.id === 'footer-canvas' || over.id.startsWith('footer-')) && isEditingHeaderFooter) {\n if (!movedSection.id.startsWith('footer-')) {\n movedSection.id = `footer-${movedSection.id}`;\n }\n } else {\n movedSection.id = movedSection.id.replace(/^(header-|footer-)/, '');\n }\n \n newTargetSections.splice(newIndex, 0, movedSection);\n setTargetSections(newTargetSections);\n }\n }\n }\n };\n\n const getRelevantSections = (canvasType: string) => {\n if (canvasType === 'header' && isEditingHeaderFooter) return headerSections;\n if (canvasType === 'footer' && isEditingHeaderFooter) return footerSections;\n return sections;\n };\n\n const getRelevantSetSections = (canvasType: string) => {\n if (canvasType === 'header' && isEditingHeaderFooter) return setHeaderSections;\n if (canvasType === 'footer' && isEditingHeaderFooter) return setFooterSections;\n return setSections;\n };\n\n const handleUpdateSection = (id: string, data: Partial<EnhancedSectionData>, canvasType: string) => {\n const relevantSections = getRelevantSections(canvasType);\n const relevantSetSections = getRelevantSetSections(canvasType);\n \n const cleanId = id.replace(/^(header-|footer-)/, '');\n \n relevantSetSections(\n relevantSections.map((section) =>\n section.id === cleanId || section.id === id ? { ...section, ...data } : section\n )\n );\n };\n\n const handleSplitSection = (id: string, content1: string, content2: string, canvasType: string) => {\n const relevantSections = getRelevantSections(canvasType);\n const relevantSetSections = getRelevantSetSections(canvasType);\n \n const cleanId = id.replace(/^(header-|footer-)/, '');\n \n const index = relevantSections.findIndex((section) => section.id === cleanId || section.id === id);\n if (index === -1) return;\n\n const section = relevantSections[index];\n const newSections = [...relevantSections];\n \n const sectionPrefix = canvasType === 'header' ? 'header-' : canvasType === 'footer' ? 'footer-' : '';\n \n if (section.isSplitPair && section.splitGroupId) {\n const splitGroupId = section.splitGroupId;\n const splitSections = newSections.filter(s => s.splitGroupId === splitGroupId);\n const totalSections = splitSections.length + 1;\n const newWidth = 100 / totalSections;\n \n newSections[index] = { \n ...section, \n content: content1,\n splitWidth: newWidth\n };\n\n const newSection: EnhancedSectionData = {\n id: `${sectionPrefix}section-${uuidv4()}`,\n content: content2,\n type: section.type,\n isSplitPair: true,\n splitGroupId: splitGroupId,\n splitWidth: newWidth,\n attributes: section.attributes,\n is_edited_from_source: false\n };\n\n newSections.splice(index + 1, 0, newSection);\n \n for (let i = 0; i < newSections.length; i++) {\n if (newSections[i].splitGroupId === splitGroupId) {\n newSections[i].splitWidth = newWidth;\n }\n }\n } else {\n const splitGroupId = uuidv4();\n const initialWidth = 50;\n \n newSections[index] = { \n ...section, \n content: content1,\n isSplitPair: true,\n splitGroupId,\n splitWidth: initialWidth\n };\n\n const newSection: EnhancedSectionData = {\n id: `${sectionPrefix}section-${uuidv4()}`,\n content: content2,\n type: section.type,\n isSplitPair: true,\n splitGroupId,\n splitWidth: initialWidth,\n attributes: section.attributes,\n is_edited_from_source: false\n };\n\n newSections.splice(index + 1, 0, newSection);\n }\n \n relevantSetSections(newSections);\n // enqueueSnackbar('Section split successfully');\n };\n\n const handleDeleteSection = (id: string, canvasType: string) => {\n const relevantSections = getRelevantSections(canvasType);\n const relevantSetSections = getRelevantSetSections(canvasType);\n \n const cleanId = id.replace(/^(header-|footer-)/, '');\n \n const sectionToDelete = relevantSections.find(s => s.id === cleanId || s.id === id);\n \n if (!sectionToDelete) return;\n \n if (sectionToDelete.isSplitPair && sectionToDelete.splitGroupId) {\n const splitSections = relevantSections.filter(s => s.splitGroupId === sectionToDelete.splitGroupId);\n \n if (splitSections.length <= 2) {\n const remainingSection = splitSections.find(s => s.id !== cleanId && s.id !== id);\n if (remainingSection) {\n remainingSection.isSplitPair = false;\n remainingSection.splitGroupId = undefined;\n remainingSection.splitWidth = undefined;\n }\n relevantSetSections(relevantSections.filter(s => s.id !== cleanId && s.id !== id));\n } else {\n const remainingSplitSections = splitSections.filter(s => s.id !== cleanId && s.id !== id);\n const newWidth = 100 / remainingSplitSections.length;\n \n const updatedSections = relevantSections.filter(section => section.id !== cleanId && section.id !== id).map(section => {\n if (section.splitGroupId === sectionToDelete.splitGroupId) {\n return { ...section, splitWidth: newWidth };\n }\n return section;\n });\n \n relevantSetSections(updatedSections);\n // enqueueSnackbar('Section removed from split group');\n }\n } else {\n relevantSetSections(relevantSections.filter(section => section.id !== cleanId && section.id !== id));\n // enqueueSnackbar('Section deleted');\n }\n \n if (selectedSection === id) {\n setSelectedSection(null);\n }\n };\n\n useEffect(() => {\n document.body.style.overflow = 'hidden';\n const main = document.getElementsByTagName('main')?.[0];\n if (main) {\n main.style.marginTop = '4.125rem';\n }\n return () => {\n document.body.removeAttribute('style');\n }\n }, []);\n\nconst getData = async () => {\n if (id) {\n const token = getToken();\n const subjRes = await getV1SubjectsId({ \n ...token, \n 'x-timezone': token['x-timezone']?.toString() || '',\n id \n });\n\n if ('data' in subjRes && subjRes.data && typeof subjRes.data === 'object' && 'resource' in subjRes.data) {\n const resource = (subjRes.data as any).resource;\n const token2 = getToken();\n const fRes = await getV1FormBuilderRelationalSchemaFieldsName({\n ...token2,\n 'x-timezone': token2['x-timezone']?.toString() || '',\n name: resource,\n });\n const schemaFields = ('data' in fRes && fRes.data && typeof fRes.data === 'object' && 'fields' in fRes.data) \n ? ((fRes.data as any).fields || [])\n : [];\n const relation_table = ('data' in fRes && fRes.data && typeof fRes.data === 'object' && 'relational_fields' in fRes.data)\n ? ((fRes.data as any).relational_fields || [])\n : [];\n\n // Process main schema fields\n const updatedFields = schemaFields\n .map((field) => ({\n ...field,\n key: field.key.replace('__replaceKey', ''),\n }))\n .filter((field) => !field.is_inner_join && field.alias !== 'id' && !field?.alias?.includes('_id'));\n\n // Process relation tables - separate array and object types\n const arrayRelationTables = [];\n const objectRelationFields = [];\n\n relation_table.forEach((table) => {\n if (!table) return;\n\n const updatedTableFields = (table.fields || []).map((field) => {\n const updatedField = {\n ...field,\n key: field.key.replace('__replaceKey', ''),\n alias: field?.templateKey ? field?.templateKey : field.alias,\n };\n\n // Prepend dataKey to field keys for object types\n if (table.type === 'object' && table.dataKey) {\n updatedField.key = `${table.dataKey}.${updatedField.key}`;\n }\n\n return updatedField;\n }).filter(\n (field) =>\n !field.is_inner_join &&\n field.alias !== 'id' &&\n !field.alias.includes('_id')\n );\n\n const uniqueTableFields = _.differenceWith(\n updatedTableFields,\n updatedTableFields,\n (fieldA: any, fieldB: any) => fieldA.key === fieldB?.joinKey\n );\n\n const tableFields = uniqueTableFields.map((f: any) => {\n const field = formatText(f.alias.replace(/_data$/, '').replace(/_/g, ' '));\n const value = table.type === 'object' && table.dataKey \n ? `${table.dataKey}.${f.alias.replace(/ /g, '_').toLowerCase()}`\n : f.alias.replace(/ /g, '_').toLowerCase();\n \n return { \n label: field, \n value: value \n };\n });\n\n if (table.type === 'object') {\n // Merge object type fields into main fields\n objectRelationFields.push(...tableFields);\n } else {\n // Keep array types separate\n arrayRelationTables.push({\n ...table,\n fields: tableFields\n });\n }\n });\n\n // Combine main fields and object relation fields\n const allFields = [\n ...updatedFields.map((f) => {\n const n = f?.alias || f?.key\n const field = formatText(n.replace(/_data$/, '').replace(/_/g, ' '));\n return { \n label: field, \n value: field.replace(/ /g, '_').toLowerCase() \n };\n }),\n ...objectRelationFields\n ];\n\n const uniqueAllFields = _.uniqBy(allFields, 'value');\n\n setPlaceholders(uniqueAllFields);\n setRelationTable(arrayRelationTables);\n }\n }\n\n // Rest of the function remains the same...\n if (template_id) {\n const token3 = getToken();\n const res = await getV1TemplatesId({ \n ...token3, \n 'x-timezone': token3['x-timezone']?.toString() || '',\n id: template_id \n });\n const templateSections = ('data' in res && res.data && typeof res.data === 'object' && 'sections' in res.data)\n ? ((res.data as any).sections || [])\n : [];\n const mainSecs = templateSections.map((s: any) => ({\n ...s,\n id: s.id || `section-${uuidv4()}`,\n }));\n setTemplateData(('data' in res && res.data) ? res.data as any : null);\n\n setSections(mainSecs);\n }\n\n if (locationState?.company_id) {\n const token4 = getToken();\n const res = await getV1TemplateHeaderFooterCompanyIdHeaderFooter({\n ...token4,\n 'x-timezone': token4['x-timezone']?.toString() || '',\n company_id: locationState.company_id,\n });\n const resData = ('data' in res && res.data && typeof res.data === 'object') ? res.data as any : null;\n setHeaderFooterId(resData?._id || '');\n const headerSections = resData?.header_sections || [];\n const footerSections = resData?.footer_sections || [];\n const headerSecs = headerSections.map((s) => ({\n ...s,\n id: s.id || `header-section-${uuidv4()}`,\n }));\n const footerSecs = footerSections.map((s) => ({\n ...s,\n id: s.id || `footer-section-${uuidv4()}`,\n }));\n\n setHeaderSections(headerSecs);\n setFooterSections(footerSecs);\n }\n};\n \n useEffect(() => {\n getData();\n }, [template_id, id, locationState?.company_id]);\n\n const createNewSection = (type: ElementType, attrs: Record<string, any> = {}): EnhancedSectionData => {\n let content = '';\n const styles = initialStyles[type] || {};\n const inlineStyles: string = generateInlineStyles(styles);\n\n const idPrefix = activeCanvas === 'header' && isEditingHeaderFooter ? 'header-' : \n activeCanvas === 'footer' && isEditingHeaderFooter ? 'footer-' : '';\n\n switch (type) {\n case 'heading':\n content = `<h1 style=\"${inlineStyles}\">Heading 1</h1>`;\n break;\n case 'heading-2':\n content = `<h2 style=\"${inlineStyles}\">Heading 2</h2>`;\n break;\n case 'heading-3':\n content = `<h3 style=\"${inlineStyles}\">Heading 3</h3>`;\n break;\n case 'heading-4':\n content = `<h4 style=\"${inlineStyles}\">Heading 4</h4>`;\n break;\n case 'text':\n content = `<p style=\"${inlineStyles}\">Hello, enter your text here...</p>`;\n break;\n case 'image':\n content = `<img src=\"${attrs.src}\" alt=\"${attrs.alt}\" style=\"${inlineStyles};\" />`;\n break;\n case 'buttons':\n attrs.text = attrs?.text || 'Button text';\n content = `<button style=\"${inlineStyles}\">${attrs.text}</button>`;\n break;\n case 'divider':\n content = `<hr style=\"${inlineStyles}\" />`;\n break;\n case 'table':\n const tableStyles = styles as any;\n const { border, borderStyle, borderColor, ...rest } = tableStyles;\n const tInlineStyles = generateInlineStyles(tableStyles.is_bordered ? tableStyles : rest);\n const tHeadInlineStyles: string = generateInlineStyles(tableStyles.tHead);\n const tBodyInlineStyles: string = generateInlineStyles(tableStyles.tBody);\n const thCellInlineStyles: string = generateInlineStyles({...tableStyles.thCells, border, borderStyle, borderColor });\n const tbCellInlineStyles: string = generateInlineStyles({...tableStyles.tbCells, border, borderStyle, borderColor});\n content = `\n <table style=\"${tInlineStyles}\">\n <thead style=\"${tHeadInlineStyles}\">\n <tr style=\"background-color: #f5f5f5;\">\n <th style=\"${thCellInlineStyles}\"></th>\n <th style=\"${thCellInlineStyles}\"></th>\n <th style=\"${thCellInlineStyles}\"></th>\n </tr>\n </thead>\n <tbody style=\"${tBodyInlineStyles}\">\n <tr>\n <td style=\"${tbCellInlineStyles}\"></td>\n <td style=\"${tbCellInlineStyles}\"></td>\n <td style=\"${tbCellInlineStyles}\"></td>\n </tr>\n </tbody>\n </table>\n `;\n break;\n case 'signature':\n content = `<div style=\"${inlineStyles}\">Signature: <input type='text' style=\"border:0; border-bottom:1px solid black\" class='signature-input'/></div>`;\n break;\n case 'qr-code':\n attrs.placeholder = attrs?.placeholder || '{{qr_data}}';\n content = `<div style=\"background-color: #f5f5f5; padding: 16px; text-align: center; color: #666666;\">${attrs.placeholder}</div>`;\n break;\n case 'bar-code':\n attrs.placeholder = attrs?.placeholder || '{{barcode_data}}';\n content = `<div style=\"background-color: #f5f5f5; padding: 16px; text-align: center; color: #666666;\">${attrs.placeholder}</div>`;\n break;\n default:\n content = '<p style=\"font-size: 16px; color: #333333; line-height: 1.5;\">New section</p>';\n }\n\n let attributes: Record<string, any> = {};\n attributes = extractStyles(content, type);\n\n return { \n id: `${idPrefix}section-${uuidv4()}`, \n content, \n type, \n attributes: {...(attrs || {}), styles},\n is_edited_from_source: false\n };\n };\n\n const handleSave = async () => {\n if(sections.length === 0 && headerSections.length === 0 && footerSections.length === 0) {\n enqueueSnackbar('Please add at least one section');\n return;\n }\n \n const mainHtml = generateEmailPreview(sections, headerSections, footerSections, true);\n try {\n const p = { \n ...getToken(), \n ...(template_id ? { id: template_id } : { subject_id: id, is_default: false, company_id: locationState.company_id }), \n sections: sections, \n contents: mainHtml \n }\n setPayload(p);\n } catch (error) {\n const m = getErrorMessage(error?.message);\n enqueueSnackbar(m, { variant: 'error' });\n }\n };\n const handleSaveHeaderFooter = async () => {\n if(sections.length === 0 && headerSections.length === 0 && footerSections.length === 0) {\n enqueueSnackbar('Please add at least one section', { variant: 'error' });\n return;\n } else if(!locationState?.company_id) {\n enqueueSnackbar('Company has not been selected', { variant: 'error' });\n return;\n }\n \n const headerHtml = generateHeaderFooterPreview(headerSections, 'header');\n const footerHtml = generateHeaderFooterPreview(footerSections, 'footer');\n const combinedHtml = `${headerHtml}${footerHtml}`;\n \n // Convert splitWidth from number to string for API\n const convertSectionForApi = (section: EnhancedSectionData) => ({\n id: section.id,\n content: section.content,\n type: section.type,\n isSplitPair: section.isSplitPair,\n splitGroupId: section.splitGroupId,\n splitWidth: section.splitWidth !== undefined ? String(section.splitWidth) : undefined,\n });\n \n const convertedHeaderSections = headerSections.map(convertSectionForApi);\n const convertedFooterSections = footerSections.map(convertSectionForApi);\n \n try {\n if(headerFooterId) {\n const token5 = getToken();\n const res = await patchV1TemplateHeaderFooterId({ \n ...token5,\n 'x-timezone': token5['x-timezone']?.toString() || '',\n id: headerFooterId, \n header_sections: convertedHeaderSections, \n footer_sections: convertedFooterSections, \n contents: combinedHtml \n });\n if(res.status_code === 200) {\n enqueueSnackbar('Header/Footer saved successfully', { variant: 'success' });\n setIsEditingHeaderFooter(false);\n }\n } else {\n const token6 = getToken();\n const res = await postV1TemplateHeaderFooter({ \n ...token6,\n 'x-timezone': token6['x-timezone']?.toString() || '',\n header_sections: convertedHeaderSections, \n footer_sections: convertedFooterSections, \n contents: combinedHtml, \n company_id: locationState.company_id\n });\n if(res.status_code === 200) {\n enqueueSnackbar('Header/Footer saved successfully', { variant: 'success' });\n setIsEditingHeaderFooter(false);\n }\n }\n } catch (error) {\n const m = getErrorMessage(error?.message);\n enqueueSnackbar(m, { variant: 'error' });\n }\n };\n\n const toggleHeaderFooterEditing = () => {\n setIsEditingHeaderFooter(!isEditingHeaderFooter);\n if (isEditingHeaderFooter) {\n setActiveCanvas('main');\n }\n };\n\n return (\n <Box sx={{ display: 'flex', flexDirection: 'column', height: '100vh' }}>\n <EditorHeader \n onPreview={() => setPreview(!preview)} \n onSave={handleSave}\n preview={preview}\n sections={sections}\n isEditingHeaderFooter={isEditingHeaderFooter}\n setIsEditingHeaderFooter={toggleHeaderFooterEditing}\n onSaveHeaderFooter={handleSaveHeaderFooter}\n modulePath={modulePath} \n type={type}\n mode={template_id ? 'edit' : 'add'}\n templateData={templateData}\n />\n <Box sx={{ display: 'flex', flex: 1, overflow: 'hidden' }}>\n <DndContext\n onDragStart={handleDragStart}\n onDragOver={handleDragOver}\n onDragEnd={handleDragEnd}\n collisionDetection={pointerWithin}\n >\n <EditorCanvas\n sections={sections}\n headerSections={headerSections}\n footerSections={footerSections}\n activeId={activeId}\n overSection={overSection}\n selectedSection={selectedSection}\n onSelectSection={setSelectedSection}\n onUpdateSection={handleUpdateSection}\n onSplitSection={handleSplitSection}\n onDeleteSection={handleDeleteSection}\n preview={preview}\n handleSave={handleSave}\n placeholders={placeholders}\n isEditingHeaderFooter={isEditingHeaderFooter}\n relation_table={relation_table}\n />\n </DndContext>\n </Box>\n {payload !== null && \n <TemplateNameModal \n isOpen={payload !== null} \n setIsOpen={() => setPayload(null)} \n payload={payload}\n templateRoutes={ROUTES}\n mode={template_id ? 'edit' : 'add'}\n templateData={templateData}\n />\n }\n </Box>\n );\n};\n\nexport default SectionFlowEditor;"],"names":["modulePath","module","type","id","template_id","useParams","state","locationState","useLocation","sections","setSections","useState","headerSections","setHeaderSections","footerSections","setFooterSections","activeId","setActiveId","selectedSection","setSelectedSection","overSection","setOverSection","preview","setPreview","placeholders","setPlaceholders","activeCanvas","setActiveCanvas","isEditingHeaderFooter","setIsEditingHeaderFooter","payload","setPayload","headerFooterId","setHeaderFooterId","ROUTES","templateRoutes","relation_table","setRelationTable","templateData","setTemplateData","getRelevantSections","canvasType","getRelevantSetSections","useEffect","document","body","style","overflow","main","_a","getElementsByTagName","marginTop","removeAttribute","async","token","getToken","subjRes","getV1SubjectsId","toString","data","resource","token2","fRes","getV1FormBuilderRelationalSchemaFieldsName","_b","name","schemaFields","fields","relational_fields","updatedFields","map","field","key","replace","filter","is_inner_join","alias","includes","arrayRelationTables","objectRelationFields","forEach","table","updatedTableFields","updatedField","templateKey","dataKey","tableFields","_","differenceWith","fieldA","fieldB","joinKey","f","label","formatText","value","toLowerCase","push","allFields","n","uniqueAllFields","uniqBy","token3","res","getV1TemplatesId","_c","mainSecs","s","uuidv4","company_id","token4","getV1TemplateHeaderFooterCompanyIdHeaderFooter","_d","resData","_id","header_sections","footer_sections","headerSecs","footerSecs","getData","createNewSection","attrs","content","styles","initialStyles","inlineStyles","generateInlineStyles","idPrefix","src","alt","text","tableStyles","border","borderStyle","borderColor","rest","tInlineStyles","is_bordered","tHeadInlineStyles","tHead","tBodyInlineStyles","tBody","thCellInlineStyles","thCells","tbCellInlineStyles","tbCells","placeholder","extractStyles","attributes","is_edited_from_source","handleSave","length","enqueueSnackbar","mainHtml","generateEmailPreview","p","subject_id","is_default","contents","error","m","getErrorMessage","message","variant","jsxs","Box","sx","display","flexDirection","height","children","jsx","EditorHeader","onPreview","onSave","onSaveHeaderFooter","combinedHtml","generateHeaderFooterPreview","convertSectionForApi","section","isSplitPair","splitGroupId","splitWidth","String","convertedHeaderSections","convertedFooterSections","token5","patchV1TemplateHeaderFooterId","status_code","token6","postV1TemplateHeaderFooter","mode","flex","DndContext","onDragStart","event","active","onDragOver","over","onDragEnd","targetSections","setTargetSections","startsWith","current","imageUrl","newSection","overIndex","findIndex","newSections","splice","targetSection","updatedSections","sourceSections","sourceSetSections","cleanActiveId","oldIndex","newIndex","movedSection","groupId","groupSections","cleaned","originalSection","newSourceSections","newTargetSections","collisionDetection","pointerWithin","EditorCanvas","onSelectSection","onUpdateSection","relevantSections","relevantSetSections","cleanId","onSplitSection","content1","content2","index","sectionPrefix","newWidth","i","initialWidth","onDeleteSection","sectionToDelete","find","splitSections","remainingSection","TemplateNameModal","isOpen","setIsOpen"],"mappings":"w8BAuC4D,EAAGA,aAAYC,OAAAA,E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I,GAAKA,EAAExG,KAAOoO,GAAW5H,EAAExG,KAAOA,GAEhF,GAAK8O,EAAL,CAEA,GAAIA,EAAgB7D,aAAe6D,EAAgB5D,aAAc,CAC/D,MAAM8D,EAAgBd,EAAiB3J,UAAYiC,EAAE0E,eAAiB4D,EAAgB5D,cAEtF,GAAI8D,EAAc5F,QAAU,EAAG,CAC7B,MAAM6F,EAAmBD,EAAcD,KAAKvI,GAAKA,EAAExG,KAAOoO,GAAW5H,EAAExG,KAAOA,GAC1EiP,IACFA,EAAiBhE,aAAc,EAC/BgE,EAAiB/D,kBAAe,EAChC+D,EAAiB9D,gBAAa,GAEhCgD,EAAoBD,EAAiB3J,OAAOiC,GAAKA,EAAExG,KAAOoO,GAAW5H,EAAExG,KAAOA,GAChF,KAAO,CACL,MACM0O,EAAW,IADcM,EAAczK,OAAOiC,GAAKA,EAAExG,KAAOoO,GAAW5H,EAAExG,KAAOA,GACxCoJ,OAS9C+E,EAPwBD,EAAiB3J,OAAOyG,GAAWA,EAAQhL,KAAOoO,GAAWpD,EAAQhL,KAAOA,GAAImE,IAAI6G,GACtGA,EAAQE,eAAiB4D,EAAgB5D,aACpC,IAAKF,EAASG,WAAYuD,GAE5B1D,GAKX,CACF,MACEmD,EAAoBD,EAAiB3J,OAAOyG,GAAWA,EAAQhL,KAAOoO,GAAWpD,EAAQhL,KAAOA,IAI9Fe,IAAoBf,GACtBgB,EAAmB,KAjCC,GAgadG,UACAgI,cACA9H,eACAI,wBACAQ,uBAIO,OAAZN,kBACC6I,EAAAA,IAAC0E,EAAAA,QAAA,CACCC,OAAoB,OAAZxN,EACRyN,UAAW,IAAMxN,EAAW,MAC5BD,UACAK,eAAgBD,EAChB6J,KAAM3L,EAAc,OAAS,MAC7BkC"}
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/views/template-editor/components/SectionFlowEditor.tsx"],"sourcesContent":["/* eslint-disable no-case-declarations */\r\n/* eslint-disable @typescript-eslint/no-unused-vars */\r\n/* eslint-disable react-hooks/exhaustive-deps */\r\n/* eslint-disable unused-imports/no-unused-vars */\r\nimport React, { useState, useEffect } from 'react';\r\nimport EditorHeader from './EditorHeader';\r\nimport EditorCanvas from './EditorCanvas';\r\nimport {\r\n DndContext,\r\n DragEndEvent,\r\n DragOverEvent,\r\n DragStartEvent,\r\n pointerWithin,\r\n} from '@dnd-kit/core';\r\nimport { SectionData, ElementType } from '../types/editor';\r\nimport { v4 as uuidv4 } from 'uuid';\r\nimport { enqueueSnackbar } from 'notistack';\r\nimport { Box } from '@mui/material';\r\nimport { useLocation, useParams } from 'react-router-dom';\r\nimport { getErrorMessage, getToken } from '../../../utils/common';\r\nimport { getV1FormBuilderRelationalSchemaFieldsName, getV1SubjectsId, getV1TemplateHeaderFooterCompanyIdHeaderFooter, getV1TemplatesId, patchV1TemplateHeaderFooterId, postV1TemplateHeaderFooter } from '../../../api-client/api.system-feature/api';\r\nimport { templateRoutes, extractStyles, generateEmailPreview, generateHeaderFooterPreview, generateInlineStyles } from '../utils/common';\r\nimport { initialStyles } from '../utils/constant';\r\nimport _ from 'lodash';\r\nimport formatText from '../../../utils/format-text';\r\nimport TemplateNameModal from \"../template-name-modal/template-name-modal\";\r\n\r\ninterface EnhancedSectionData extends SectionData {\r\n isSplitPair?: boolean;\r\n splitGroupId?: string;\r\n splitWidth?: number;\r\n}\r\n\r\ninterface SectionFlowEditorProps {\r\n modulePath: string;\r\n module: string;\r\n type: string;\r\n}\r\n\r\nconst SectionFlowEditor: React.FC<SectionFlowEditorProps> = ({ modulePath, module, type}) => {\r\n const { id, template_id } = useParams();\r\n const { state: locationState } = useLocation();\r\n\r\n const [sections, setSections] = useState<EnhancedSectionData[]>([]);\r\n const [headerSections, setHeaderSections] = useState<EnhancedSectionData[]>([]);\r\n const [footerSections, setFooterSections] = useState<EnhancedSectionData[]>([]);\r\n const [activeId, setActiveId] = useState<string | null>(null);\r\n const [selectedSection, setSelectedSection] = useState<string | null>(null);\r\n const [overSection, setOverSection] = useState<string | null>(null);\r\n const [preview, setPreview] = useState<boolean>(false);\r\n const [placeholders, setPlaceholders] = useState<Record<string, any>[]>([]);\r\n const [activeCanvas, setActiveCanvas] = useState<'main' | 'header' | 'footer'>('main');\r\n const [isEditingHeaderFooter, setIsEditingHeaderFooter] = useState<boolean>(false);\r\n const [payload, setPayload] = useState<any>(null);\r\n const [headerFooterId, setHeaderFooterId] = useState<string>('');\r\n const ROUTES = templateRoutes(modulePath, type);\r\n const [relation_table, setRelationTable] = useState<any[]>([]);\r\n const [templateData, setTemplateData] = useState<Record<string, any> | null >(null);\r\n\r\n const handleDragStart = (event: DragStartEvent) => {\r\n const { active } = event;\r\n setActiveId(active.id as string);\r\n };\r\n\r\n const handleDragOver = (event: DragOverEvent) => {\r\n const { /* active, */ over } = event;\r\n\r\n if (!over) {\r\n setOverSection(null);\r\n return;\r\n }\r\n\r\n if (over.id === 'header-canvas' && isEditingHeaderFooter) {\r\n setActiveCanvas('header');\r\n } else if (over.id === 'footer-canvas' && isEditingHeaderFooter) {\r\n setActiveCanvas('footer');\r\n } else if (over.id === 'main-canvas') {\r\n setActiveCanvas('main');\r\n }\r\n\r\n if (over.id !== 'header-canvas' && over.id !== 'main-canvas' && over.id !== 'footer-canvas') {\r\n setOverSection(over.id as string);\r\n }\r\n };\r\n\r\n const handleDragEnd = (event: DragEndEvent) => {\r\n const { active, over } = event;\r\n \r\n setActiveId(null);\r\n setOverSection(null);\r\n \r\n if (!over) return;\r\n \r\n let targetSections = sections;\r\n let setTargetSections = setSections;\r\n \r\n if ((over.id === 'header-canvas' || overSection?.startsWith('header-')) && isEditingHeaderFooter) {\r\n targetSections = headerSections;\r\n setTargetSections = setHeaderSections;\r\n setActiveCanvas('header');\r\n } else if ((over.id === 'footer-canvas' || overSection?.startsWith('footer-')) && isEditingHeaderFooter) {\r\n targetSections = footerSections;\r\n setTargetSections = setFooterSections;\r\n setActiveCanvas('footer');\r\n } else {\r\n setActiveCanvas('main');\r\n }\r\n \r\n if (active.data.current?.type === 'image') {\r\n const imageUrl = active.data.current.imageUrl;\r\n const newSection: EnhancedSectionData = createNewSection('image', { src: imageUrl, alt: 'Image' });\r\n \r\n const overIndex = targetSections.findIndex((section) => section.id === over.id);\r\n const newSections = [...targetSections];\r\n \r\n if (over.id === 'header-canvas' || over.id === 'main-canvas' || over.id === 'footer-canvas' || overIndex === -1) {\r\n setTargetSections([...targetSections, newSection]);\r\n } else {\r\n newSections.splice(overIndex, 0, newSection);\r\n setTargetSections(newSections);\r\n }\r\n \r\n enqueueSnackbar('Added uploaded image section');\r\n return;\r\n }\r\n \r\n if (typeof active.id === 'string' && active.id.startsWith('sidebar-')) {\r\n const type = active.id.replace('sidebar-', '') as ElementType;\r\n const newSection = createNewSection(type);\r\n \r\n const overIndex = targetSections.findIndex((section) => section.id === over.id);\r\n const isOverSection = overIndex !== -1;\r\n \r\n if (!isOverSection || over.id === 'header-canvas' || over.id === 'main-canvas' || over.id === 'footer-canvas') {\r\n setTargetSections([...targetSections, newSection]);\r\n } else {\r\n const targetSection = targetSections[overIndex];\r\n const isEmpty =\r\n !targetSection.content ||\r\n targetSection.content.includes('Click to add') ||\r\n targetSection.content.includes('enter your text');\r\n \r\n if (isEmpty) {\r\n const updatedSections = [...targetSections];\r\n updatedSections[overIndex] = {\r\n ...targetSection,\r\n type,\r\n content: newSection.content,\r\n };\r\n setTargetSections(updatedSections);\r\n // enqueueSnackbar(`Changed section to ${type}`);\r\n } else {\r\n const updatedSections = [...targetSections];\r\n updatedSections.splice(overIndex, 0, newSection);\r\n setTargetSections(updatedSections);\r\n // enqueueSnackbar(`Added new ${type} section`);\r\n }\r\n }\r\n return;\r\n }\r\n \r\n if (\r\n active.id !== over.id &&\r\n typeof active.id === 'string' &&\r\n typeof over.id === 'string'\r\n ) {\r\n let sourceSections: EnhancedSectionData[] = [];\r\n let sourceSetSections: React.Dispatch<React.SetStateAction<EnhancedSectionData[]>> | null = null;\r\n let canvasId = '';\r\n \r\n if (active.id.startsWith('header-') && isEditingHeaderFooter) {\r\n sourceSections = headerSections;\r\n sourceSetSections = setHeaderSections;\r\n canvasId = 'header-canvas';\r\n } else if (active.id.startsWith('footer-') && isEditingHeaderFooter) {\r\n sourceSections = footerSections;\r\n sourceSetSections = setFooterSections;\r\n canvasId = 'footer-canvas';\r\n } else {\r\n sourceSections = sections;\r\n sourceSetSections = setSections;\r\n canvasId = 'main-canvas';\r\n }\r\n \r\n const cleanActiveId = active.id.replace(/^(header-|footer-)/, '');\r\n \r\n const oldIndex = sourceSections.findIndex((section) => \r\n section.id === cleanActiveId || section.id === active.id\r\n );\r\n \r\n let newIndex = targetSections.findIndex((section) => \r\n section.id === String(over.id).replace(/^(header-|footer-)/, '')\r\n );\r\n \r\n if (over.id === 'header-canvas' || over.id === 'main-canvas' || over.id === 'footer-canvas') {\r\n newIndex = targetSections.length;\r\n }\r\n \r\n if (oldIndex !== -1 && newIndex !== -1) {\r\n if (sourceSections === targetSections) {\r\n const newSections = [...sourceSections];\r\n const [movedSection] = newSections.splice(oldIndex, 1);\r\n \r\n if (movedSection.isSplitPair && movedSection.splitGroupId) {\r\n const groupId = movedSection.splitGroupId;\r\n const groupSections = [movedSection, ...sourceSections.filter(\r\n s => s.splitGroupId === groupId && s.id !== movedSection.id\r\n )];\r\n \r\n const cleaned = newSections.filter(s => s.splitGroupId !== groupId);\r\n cleaned.splice(newIndex, 0, ...groupSections);\r\n sourceSetSections(cleaned);\r\n } else {\r\n newSections.splice(newIndex, 0, movedSection);\r\n sourceSetSections(newSections);\r\n }\r\n } else {\r\n const originalSection = sourceSections[oldIndex];\r\n \r\n const newSourceSections = [...sourceSections];\r\n newSourceSections.splice(oldIndex, 1);\r\n sourceSetSections(newSourceSections);\r\n \r\n const newTargetSections = [...targetSections];\r\n \r\n const movedSection = {...originalSection};\r\n \r\n if ((over.id === 'header-canvas' || over.id.startsWith('header-')) && isEditingHeaderFooter) {\r\n if (!movedSection.id.startsWith('header-')) {\r\n movedSection.id = `header-${movedSection.id}`;\r\n }\r\n } else if ((over.id === 'footer-canvas' || over.id.startsWith('footer-')) && isEditingHeaderFooter) {\r\n if (!movedSection.id.startsWith('footer-')) {\r\n movedSection.id = `footer-${movedSection.id}`;\r\n }\r\n } else {\r\n movedSection.id = movedSection.id.replace(/^(header-|footer-)/, '');\r\n }\r\n \r\n newTargetSections.splice(newIndex, 0, movedSection);\r\n setTargetSections(newTargetSections);\r\n }\r\n }\r\n }\r\n };\r\n\r\n const getRelevantSections = (canvasType: string) => {\r\n if (canvasType === 'header' && isEditingHeaderFooter) return headerSections;\r\n if (canvasType === 'footer' && isEditingHeaderFooter) return footerSections;\r\n return sections;\r\n };\r\n\r\n const getRelevantSetSections = (canvasType: string) => {\r\n if (canvasType === 'header' && isEditingHeaderFooter) return setHeaderSections;\r\n if (canvasType === 'footer' && isEditingHeaderFooter) return setFooterSections;\r\n return setSections;\r\n };\r\n\r\n const handleUpdateSection = (id: string, data: Partial<EnhancedSectionData>, canvasType: string) => {\r\n const relevantSections = getRelevantSections(canvasType);\r\n const relevantSetSections = getRelevantSetSections(canvasType);\r\n \r\n const cleanId = id.replace(/^(header-|footer-)/, '');\r\n \r\n relevantSetSections(\r\n relevantSections.map((section) =>\r\n section.id === cleanId || section.id === id ? { ...section, ...data } : section\r\n )\r\n );\r\n };\r\n\r\n const handleSplitSection = (id: string, content1: string, content2: string, canvasType: string) => {\r\n const relevantSections = getRelevantSections(canvasType);\r\n const relevantSetSections = getRelevantSetSections(canvasType);\r\n \r\n const cleanId = id.replace(/^(header-|footer-)/, '');\r\n \r\n const index = relevantSections.findIndex((section) => section.id === cleanId || section.id === id);\r\n if (index === -1) return;\r\n\r\n const section = relevantSections[index];\r\n const newSections = [...relevantSections];\r\n \r\n const sectionPrefix = canvasType === 'header' ? 'header-' : canvasType === 'footer' ? 'footer-' : '';\r\n \r\n if (section.isSplitPair && section.splitGroupId) {\r\n const splitGroupId = section.splitGroupId;\r\n const splitSections = newSections.filter(s => s.splitGroupId === splitGroupId);\r\n const totalSections = splitSections.length + 1;\r\n const newWidth = 100 / totalSections;\r\n \r\n newSections[index] = { \r\n ...section, \r\n content: content1,\r\n splitWidth: newWidth\r\n };\r\n\r\n const newSection: EnhancedSectionData = {\r\n id: `${sectionPrefix}section-${uuidv4()}`,\r\n content: content2,\r\n type: section.type,\r\n isSplitPair: true,\r\n splitGroupId: splitGroupId,\r\n splitWidth: newWidth,\r\n attributes: section.attributes,\r\n is_edited_from_source: false\r\n };\r\n\r\n newSections.splice(index + 1, 0, newSection);\r\n \r\n for (let i = 0; i < newSections.length; i++) {\r\n if (newSections[i].splitGroupId === splitGroupId) {\r\n newSections[i].splitWidth = newWidth;\r\n }\r\n }\r\n } else {\r\n const splitGroupId = uuidv4();\r\n const initialWidth = 50;\r\n \r\n newSections[index] = { \r\n ...section, \r\n content: content1,\r\n isSplitPair: true,\r\n splitGroupId,\r\n splitWidth: initialWidth\r\n };\r\n\r\n const newSection: EnhancedSectionData = {\r\n id: `${sectionPrefix}section-${uuidv4()}`,\r\n content: content2,\r\n type: section.type,\r\n isSplitPair: true,\r\n splitGroupId,\r\n splitWidth: initialWidth,\r\n attributes: section.attributes,\r\n is_edited_from_source: false\r\n };\r\n\r\n newSections.splice(index + 1, 0, newSection);\r\n }\r\n \r\n relevantSetSections(newSections);\r\n // enqueueSnackbar('Section split successfully');\r\n };\r\n\r\n const handleDeleteSection = (id: string, canvasType: string) => {\r\n const relevantSections = getRelevantSections(canvasType);\r\n const relevantSetSections = getRelevantSetSections(canvasType);\r\n \r\n const cleanId = id.replace(/^(header-|footer-)/, '');\r\n \r\n const sectionToDelete = relevantSections.find(s => s.id === cleanId || s.id === id);\r\n \r\n if (!sectionToDelete) return;\r\n \r\n if (sectionToDelete.isSplitPair && sectionToDelete.splitGroupId) {\r\n const splitSections = relevantSections.filter(s => s.splitGroupId === sectionToDelete.splitGroupId);\r\n \r\n if (splitSections.length <= 2) {\r\n const remainingSection = splitSections.find(s => s.id !== cleanId && s.id !== id);\r\n if (remainingSection) {\r\n remainingSection.isSplitPair = false;\r\n remainingSection.splitGroupId = undefined;\r\n remainingSection.splitWidth = undefined;\r\n }\r\n relevantSetSections(relevantSections.filter(s => s.id !== cleanId && s.id !== id));\r\n } else {\r\n const remainingSplitSections = splitSections.filter(s => s.id !== cleanId && s.id !== id);\r\n const newWidth = 100 / remainingSplitSections.length;\r\n \r\n const updatedSections = relevantSections.filter(section => section.id !== cleanId && section.id !== id).map(section => {\r\n if (section.splitGroupId === sectionToDelete.splitGroupId) {\r\n return { ...section, splitWidth: newWidth };\r\n }\r\n return section;\r\n });\r\n \r\n relevantSetSections(updatedSections);\r\n // enqueueSnackbar('Section removed from split group');\r\n }\r\n } else {\r\n relevantSetSections(relevantSections.filter(section => section.id !== cleanId && section.id !== id));\r\n // enqueueSnackbar('Section deleted');\r\n }\r\n \r\n if (selectedSection === id) {\r\n setSelectedSection(null);\r\n }\r\n };\r\n\r\n useEffect(() => {\r\n document.body.style.overflow = 'hidden';\r\n const main = document.getElementsByTagName('main')?.[0];\r\n if (main) {\r\n main.style.marginTop = '4.125rem';\r\n }\r\n return () => {\r\n document.body.removeAttribute('style');\r\n }\r\n }, []);\r\n\r\nconst getData = async () => {\r\n if (id) {\r\n const token = getToken();\r\n const subjRes = await getV1SubjectsId({ \r\n ...token, \r\n 'x-timezone': token['x-timezone']?.toString() || '',\r\n id \r\n });\r\n\r\n if ('data' in subjRes && subjRes.data && typeof subjRes.data === 'object' && 'resource' in subjRes.data) {\r\n const resource = (subjRes.data as any).resource;\r\n const token2 = getToken();\r\n const fRes = await getV1FormBuilderRelationalSchemaFieldsName({\r\n ...token2,\r\n 'x-timezone': token2['x-timezone']?.toString() || '',\r\n name: resource,\r\n });\r\n const schemaFields = ('data' in fRes && fRes.data && typeof fRes.data === 'object' && 'fields' in fRes.data) \r\n ? ((fRes.data as any).fields || [])\r\n : [];\r\n const relation_table = ('data' in fRes && fRes.data && typeof fRes.data === 'object' && 'relational_fields' in fRes.data)\r\n ? ((fRes.data as any).relational_fields || [])\r\n : [];\r\n\r\n // Process main schema fields\r\n const updatedFields = schemaFields\r\n .map((field) => ({\r\n ...field,\r\n key: field.key.replace('__replaceKey', ''),\r\n }))\r\n .filter((field) => !field.is_inner_join && field.alias !== 'id' && !field?.alias?.includes('_id'));\r\n\r\n // Process relation tables - separate array and object types\r\n const arrayRelationTables = [];\r\n const objectRelationFields = [];\r\n\r\n relation_table.forEach((table) => {\r\n if (!table) return;\r\n\r\n const updatedTableFields = (table.fields || []).map((field) => {\r\n const updatedField = {\r\n ...field,\r\n key: field.key.replace('__replaceKey', ''),\r\n alias: field?.templateKey ? field?.templateKey : field.alias,\r\n };\r\n\r\n // Prepend dataKey to field keys for object types\r\n if (table.type === 'object' && table.dataKey) {\r\n updatedField.key = `${table.dataKey}.${updatedField.key}`;\r\n }\r\n\r\n return updatedField;\r\n }).filter(\r\n (field) =>\r\n !field.is_inner_join &&\r\n field.alias !== 'id' &&\r\n !field.alias.includes('_id')\r\n );\r\n\r\n const uniqueTableFields = _.differenceWith(\r\n updatedTableFields,\r\n updatedTableFields,\r\n (fieldA: any, fieldB: any) => fieldA.key === fieldB?.joinKey\r\n );\r\n\r\n const tableFields = uniqueTableFields.map((f: any) => {\r\n const field = formatText(f.alias.replace(/_data$/, '').replace(/_/g, ' '));\r\n const value = table.type === 'object' && table.dataKey \r\n ? `${table.dataKey}.${f.alias.replace(/ /g, '_').toLowerCase()}`\r\n : f.alias.replace(/ /g, '_').toLowerCase();\r\n \r\n return { \r\n label: field, \r\n value: value \r\n };\r\n });\r\n\r\n if (table.type === 'object') {\r\n // Merge object type fields into main fields\r\n objectRelationFields.push(...tableFields);\r\n } else {\r\n // Keep array types separate\r\n arrayRelationTables.push({\r\n ...table,\r\n fields: tableFields\r\n });\r\n }\r\n });\r\n\r\n // Combine main fields and object relation fields\r\n const allFields = [\r\n ...updatedFields.map((f) => {\r\n const n = f?.alias || f?.key\r\n const field = formatText(n.replace(/_data$/, '').replace(/_/g, ' '));\r\n return { \r\n label: field, \r\n value: field.replace(/ /g, '_').toLowerCase() \r\n };\r\n }),\r\n ...objectRelationFields\r\n ];\r\n\r\n const uniqueAllFields = _.uniqBy(allFields, 'value');\r\n\r\n setPlaceholders(uniqueAllFields);\r\n setRelationTable(arrayRelationTables);\r\n }\r\n }\r\n\r\n // Rest of the function remains the same...\r\n if (template_id) {\r\n const token3 = getToken();\r\n const res = await getV1TemplatesId({ \r\n ...token3, \r\n 'x-timezone': token3['x-timezone']?.toString() || '',\r\n id: template_id \r\n });\r\n const templateSections = ('data' in res && res.data && typeof res.data === 'object' && 'sections' in res.data)\r\n ? ((res.data as any).sections || [])\r\n : [];\r\n const mainSecs = templateSections.map((s: any) => ({\r\n ...s,\r\n id: s.id || `section-${uuidv4()}`,\r\n }));\r\n setTemplateData(('data' in res && res.data) ? res.data as any : null);\r\n\r\n setSections(mainSecs);\r\n }\r\n\r\n if (locationState?.company_id) {\r\n const token4 = getToken();\r\n const res = await getV1TemplateHeaderFooterCompanyIdHeaderFooter({\r\n ...token4,\r\n 'x-timezone': token4['x-timezone']?.toString() || '',\r\n company_id: locationState.company_id,\r\n });\r\n const resData = ('data' in res && res.data && typeof res.data === 'object') ? res.data as any : null;\r\n setHeaderFooterId(resData?._id || '');\r\n const headerSections = resData?.header_sections || [];\r\n const footerSections = resData?.footer_sections || [];\r\n const headerSecs = headerSections.map((s) => ({\r\n ...s,\r\n id: s.id || `header-section-${uuidv4()}`,\r\n }));\r\n const footerSecs = footerSections.map((s) => ({\r\n ...s,\r\n id: s.id || `footer-section-${uuidv4()}`,\r\n }));\r\n\r\n setHeaderSections(headerSecs);\r\n setFooterSections(footerSecs);\r\n }\r\n};\r\n \r\n useEffect(() => {\r\n getData();\r\n }, [template_id, id, locationState?.company_id]);\r\n\r\n const createNewSection = (type: ElementType, attrs: Record<string, any> = {}): EnhancedSectionData => {\r\n let content = '';\r\n const styles = initialStyles[type] || {};\r\n const inlineStyles: string = generateInlineStyles(styles);\r\n\r\n const idPrefix = activeCanvas === 'header' && isEditingHeaderFooter ? 'header-' : \r\n activeCanvas === 'footer' && isEditingHeaderFooter ? 'footer-' : '';\r\n\r\n switch (type) {\r\n case 'heading':\r\n content = `<h1 style=\"${inlineStyles}\">Heading 1</h1>`;\r\n break;\r\n case 'heading-2':\r\n content = `<h2 style=\"${inlineStyles}\">Heading 2</h2>`;\r\n break;\r\n case 'heading-3':\r\n content = `<h3 style=\"${inlineStyles}\">Heading 3</h3>`;\r\n break;\r\n case 'heading-4':\r\n content = `<h4 style=\"${inlineStyles}\">Heading 4</h4>`;\r\n break;\r\n case 'text':\r\n content = `<p style=\"${inlineStyles}\">Hello, enter your text here...</p>`;\r\n break;\r\n case 'image':\r\n content = `<img src=\"${attrs.src}\" alt=\"${attrs.alt}\" style=\"${inlineStyles};\" />`;\r\n break;\r\n case 'buttons':\r\n attrs.text = attrs?.text || 'Button text';\r\n content = `<button style=\"${inlineStyles}\">${attrs.text}</button>`;\r\n break;\r\n case 'divider':\r\n content = `<hr style=\"${inlineStyles}\" />`;\r\n break;\r\n case 'table':\r\n const tableStyles = styles as any;\r\n const { border, borderStyle, borderColor, ...rest } = tableStyles;\r\n const tInlineStyles = generateInlineStyles(tableStyles.is_bordered ? tableStyles : rest);\r\n const tHeadInlineStyles: string = generateInlineStyles(tableStyles.tHead);\r\n const tBodyInlineStyles: string = generateInlineStyles(tableStyles.tBody);\r\n const thCellInlineStyles: string = generateInlineStyles({...tableStyles.thCells, border, borderStyle, borderColor });\r\n const tbCellInlineStyles: string = generateInlineStyles({...tableStyles.tbCells, border, borderStyle, borderColor});\r\n content = `\r\n <table style=\"${tInlineStyles}\">\r\n <thead style=\"${tHeadInlineStyles}\">\r\n <tr style=\"background-color: #f5f5f5;\">\r\n <th style=\"${thCellInlineStyles}\"></th>\r\n <th style=\"${thCellInlineStyles}\"></th>\r\n <th style=\"${thCellInlineStyles}\"></th>\r\n </tr>\r\n </thead>\r\n <tbody style=\"${tBodyInlineStyles}\">\r\n <tr>\r\n <td style=\"${tbCellInlineStyles}\"></td>\r\n <td style=\"${tbCellInlineStyles}\"></td>\r\n <td style=\"${tbCellInlineStyles}\"></td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n `;\r\n break;\r\n case 'signature':\r\n content = `<div style=\"${inlineStyles}\">Signature: <input type='text' style=\"border:0; border-bottom:1px solid black\" class='signature-input'/></div>`;\r\n break;\r\n case 'qr-code':\r\n attrs.placeholder = attrs?.placeholder || '{{qr_data}}';\r\n content = `<div style=\"background-color: #f5f5f5; padding: 16px; text-align: center; color: #666666;\">${attrs.placeholder}</div>`;\r\n break;\r\n case 'bar-code':\r\n attrs.placeholder = attrs?.placeholder || '{{barcode_data}}';\r\n content = `<div style=\"background-color: #f5f5f5; padding: 16px; text-align: center; color: #666666;\">${attrs.placeholder}</div>`;\r\n break;\r\n default:\r\n content = '<p style=\"font-size: 16px; color: #333333; line-height: 1.5;\">New section</p>';\r\n }\r\n\r\n let attributes: Record<string, any> = {};\r\n attributes = extractStyles(content, type);\r\n\r\n return { \r\n id: `${idPrefix}section-${uuidv4()}`, \r\n content, \r\n type, \r\n attributes: {...(attrs || {}), styles},\r\n is_edited_from_source: false\r\n };\r\n };\r\n\r\n const handleSave = async () => {\r\n if(sections.length === 0 && headerSections.length === 0 && footerSections.length === 0) {\r\n enqueueSnackbar('Please add at least one section');\r\n return;\r\n }\r\n \r\n const mainHtml = generateEmailPreview(sections, headerSections, footerSections, true);\r\n try {\r\n const p = { \r\n ...getToken(), \r\n ...(template_id ? { id: template_id } : { subject_id: id, is_default: false, company_id: locationState.company_id }), \r\n sections: sections, \r\n contents: mainHtml \r\n }\r\n setPayload(p);\r\n } catch (error) {\r\n const m = getErrorMessage(error?.message);\r\n enqueueSnackbar(m, { variant: 'error' });\r\n }\r\n };\r\n const handleSaveHeaderFooter = async () => {\r\n if(sections.length === 0 && headerSections.length === 0 && footerSections.length === 0) {\r\n enqueueSnackbar('Please add at least one section', { variant: 'error' });\r\n return;\r\n } else if(!locationState?.company_id) {\r\n enqueueSnackbar('Company has not been selected', { variant: 'error' });\r\n return;\r\n }\r\n \r\n const headerHtml = generateHeaderFooterPreview(headerSections, 'header');\r\n const footerHtml = generateHeaderFooterPreview(footerSections, 'footer');\r\n const combinedHtml = `${headerHtml}${footerHtml}`;\r\n \r\n // Convert splitWidth from number to string for API\r\n const convertSectionForApi = (section: EnhancedSectionData) => ({\r\n id: section.id,\r\n content: section.content,\r\n type: section.type,\r\n isSplitPair: section.isSplitPair,\r\n splitGroupId: section.splitGroupId,\r\n splitWidth: section.splitWidth !== undefined ? String(section.splitWidth) : undefined,\r\n });\r\n \r\n const convertedHeaderSections = headerSections.map(convertSectionForApi);\r\n const convertedFooterSections = footerSections.map(convertSectionForApi);\r\n \r\n try {\r\n if(headerFooterId) {\r\n const token5 = getToken();\r\n const res = await patchV1TemplateHeaderFooterId({ \r\n ...token5,\r\n 'x-timezone': token5['x-timezone']?.toString() || '',\r\n id: headerFooterId, \r\n header_sections: convertedHeaderSections, \r\n footer_sections: convertedFooterSections, \r\n contents: combinedHtml \r\n });\r\n if(res.status_code === 200) {\r\n enqueueSnackbar('Header/Footer saved successfully', { variant: 'success' });\r\n setIsEditingHeaderFooter(false);\r\n }\r\n } else {\r\n const token6 = getToken();\r\n const res = await postV1TemplateHeaderFooter({ \r\n ...token6,\r\n 'x-timezone': token6['x-timezone']?.toString() || '',\r\n header_sections: convertedHeaderSections, \r\n footer_sections: convertedFooterSections, \r\n contents: combinedHtml, \r\n company_id: locationState.company_id\r\n });\r\n if(res.status_code === 200) {\r\n enqueueSnackbar('Header/Footer saved successfully', { variant: 'success' });\r\n setIsEditingHeaderFooter(false);\r\n }\r\n }\r\n } catch (error) {\r\n const m = getErrorMessage(error?.message);\r\n enqueueSnackbar(m, { variant: 'error' });\r\n }\r\n };\r\n\r\n const toggleHeaderFooterEditing = () => {\r\n setIsEditingHeaderFooter(!isEditingHeaderFooter);\r\n if (isEditingHeaderFooter) {\r\n setActiveCanvas('main');\r\n }\r\n };\r\n\r\n return (\r\n <Box sx={{ display: 'flex', flexDirection: 'column', height: '100vh' }}>\r\n <EditorHeader \r\n onPreview={() => setPreview(!preview)} \r\n onSave={handleSave}\r\n preview={preview}\r\n sections={sections}\r\n isEditingHeaderFooter={isEditingHeaderFooter}\r\n setIsEditingHeaderFooter={toggleHeaderFooterEditing}\r\n onSaveHeaderFooter={handleSaveHeaderFooter}\r\n modulePath={modulePath} \r\n type={type}\r\n mode={template_id ? 'edit' : 'add'}\r\n templateData={templateData}\r\n />\r\n <Box sx={{ display: 'flex', flex: 1, overflow: 'hidden' }}>\r\n <DndContext\r\n onDragStart={handleDragStart}\r\n onDragOver={handleDragOver}\r\n onDragEnd={handleDragEnd}\r\n collisionDetection={pointerWithin}\r\n >\r\n <EditorCanvas\r\n sections={sections}\r\n headerSections={headerSections}\r\n footerSections={footerSections}\r\n activeId={activeId}\r\n overSection={overSection}\r\n selectedSection={selectedSection}\r\n onSelectSection={setSelectedSection}\r\n onUpdateSection={handleUpdateSection}\r\n onSplitSection={handleSplitSection}\r\n onDeleteSection={handleDeleteSection}\r\n preview={preview}\r\n handleSave={handleSave}\r\n placeholders={placeholders}\r\n isEditingHeaderFooter={isEditingHeaderFooter}\r\n relation_table={relation_table}\r\n />\r\n </DndContext>\r\n </Box>\r\n {payload !== null && \r\n <TemplateNameModal \r\n isOpen={payload !== null} \r\n setIsOpen={() => setPayload(null)} \r\n payload={payload}\r\n templateRoutes={ROUTES}\r\n mode={template_id ? 'edit' : 'add'}\r\n templateData={templateData}\r\n />\r\n }\r\n </Box>\r\n );\r\n};\r\n\r\nexport default SectionFlowEditor;"],"names":["modulePath","module","type","id","template_id","useParams","state","locationState","useLocation","sections","setSections","useState","headerSections","setHeaderSections","footerSections","setFooterSections","activeId","setActiveId","selectedSection","setSelectedSection","overSection","setOverSection","preview","setPreview","placeholders","setPlaceholders","activeCanvas","setActiveCanvas","isEditingHeaderFooter","setIsEditingHeaderFooter","payload","setPayload","headerFooterId","setHeaderFooterId","ROUTES","templateRoutes","relation_table","setRelationTable","templateData","setTemplateData","getRelevantSections","canvasType","getRelevantSetSections","useEffect","document","body","style","overflow","main","_a","getElementsByTagName","marginTop","removeAttribute","async","token","getToken","subjRes","getV1SubjectsId","toString","data","resource","token2","fRes","getV1FormBuilderRelationalSchemaFieldsName","_b","name","schemaFields","fields","relational_fields","updatedFields","map","field","key","replace","filter","is_inner_join","alias","includes","arrayRelationTables","objectRelationFields","forEach","table","updatedTableFields","updatedField","templateKey","dataKey","tableFields","_","differenceWith","fieldA","fieldB","joinKey","f","label","formatText","value","toLowerCase","push","allFields","n","uniqueAllFields","uniqBy","token3","res","getV1TemplatesId","_c","mainSecs","s","uuidv4","company_id","token4","getV1TemplateHeaderFooterCompanyIdHeaderFooter","_d","resData","_id","header_sections","footer_sections","headerSecs","footerSecs","getData","createNewSection","attrs","content","styles","initialStyles","inlineStyles","generateInlineStyles","idPrefix","src","alt","text","tableStyles","border","borderStyle","borderColor","rest","tInlineStyles","is_bordered","tHeadInlineStyles","tHead","tBodyInlineStyles","tBody","thCellInlineStyles","thCells","tbCellInlineStyles","tbCells","placeholder","extractStyles","attributes","is_edited_from_source","handleSave","length","enqueueSnackbar","mainHtml","generateEmailPreview","p","subject_id","is_default","contents","error","m","getErrorMessage","message","variant","jsxs","Box","sx","display","flexDirection","height","children","jsx","EditorHeader","onPreview","onSave","onSaveHeaderFooter","combinedHtml","generateHeaderFooterPreview","convertSectionForApi","section","isSplitPair","splitGroupId","splitWidth","String","convertedHeaderSections","convertedFooterSections","token5","patchV1TemplateHeaderFooterId","status_code","token6","postV1TemplateHeaderFooter","mode","flex","DndContext","onDragStart","event","active","onDragOver","over","onDragEnd","targetSections","setTargetSections","startsWith","current","imageUrl","newSection","overIndex","findIndex","newSections","splice","targetSection","updatedSections","sourceSections","sourceSetSections","cleanActiveId","oldIndex","newIndex","movedSection","groupId","groupSections","cleaned","originalSection","newSourceSections","newTargetSections","collisionDetection","pointerWithin","EditorCanvas","onSelectSection","onUpdateSection","relevantSections","relevantSetSections","cleanId","onSplitSection","content1","content2","index","sectionPrefix","newWidth","i","initialWidth","onDeleteSection","sectionToDelete","find","splitSections","remainingSection","TemplateNameModal","isOpen","setIsOpen"],"mappings":"w8BAuC4D,EAAGA,aAAYC,OAAAA,EAAQC,WACjF,MAAMC,GAAEA,EAAAC,YAAIA,GAAgBC,eACpBC,MAAOC,GAAkBC,iBAE1BC,EAAUC,GAAeC,EAAAA,SAAgC,KACzDC,EAAgBC,GAAqBF,EAAAA,SAAgC,KACrEG,EAAgBC,GAAqBJ,EAAAA,SAAgC,KACrEK,EAAUC,GAAeN,EAAAA,SAAwB,OACjDO,EAAiBC,GAAsBR,EAAAA,SAAwB,OAC/DS,EAAaC,GAAkBV,EAAAA,SAAwB,OACvDW,EAASC,GAAcZ,EAAAA,UAAkB,IACzCa,EAAcC,GAAmBd,EAAAA,SAAgC,KACjEe,EAAcC,GAAmBhB,EAAAA,SAAuC,SACxEiB,EAAuBC,GAA4BlB,EAAAA,UAAkB,IACrEmB,EAASC,GAAcpB,EAAAA,SAAc,OACrCqB,EAAgBC,GAAqBtB,EAAAA,SAAiB,IACvDuB,EAASC,EAAAA,eAAenC,EAAYE,IACnCkC,EAAgBC,GAAoB1B,EAAAA,SAAgB,KACpD2B,EAAcC,GAAmB5B,EAAAA,SAAsC,MA6LxE6B,EAAuBC,GACR,WAAfA,GAA2Bb,EAA8BhB,EAC1C,WAAf6B,GAA2Bb,EAA8Bd,EACtDL,EAGHiC,EAA0BD,GACX,WAAfA,GAA2Bb,EAA8Bf,EAC1C,WAAf4B,GAA2Bb,EAA8Bb,EACtDL,EAuITiC,EAAAA,UAAU,WACRC,SAASC,KAAKC,MAAMC,SAAW,SAC/B,MAAMC,EAAO,OAAAC,EAAAL,SAASM,qBAAqB,cAA9B,EAAAD,EAAwC,GAIrD,OAHID,IACFA,EAAKF,MAAMK,UAAY,YAElB,KACLP,SAASC,KAAKO,gBAAgB,WAE/B,IA4JHT,EAAAA,UAAU,KA1JIU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