@bikdotai/bik-component-library 0.0.685-beta.2 → 0.0.685-beta.3

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 (313) hide show
  1. package/dist/cjs/assets/icons/CheckSquareOffset.svg.js +1 -0
  2. package/dist/cjs/assets/icons/email-channel.svg.js +1 -1
  3. package/dist/cjs/assets/icons/facebook_channel.svg.js +1 -1
  4. package/dist/cjs/assets/icons/instagram-channel.svg.js +1 -1
  5. package/dist/cjs/assets/icons/whatsapp_color.svg.js +1 -1
  6. package/dist/cjs/components/QueryBuilder/Filters/CustomField/components/CustomField.js +1 -1
  7. package/dist/cjs/components/QueryBuilder/components/QueryBuilderNodes.js +1 -1
  8. package/dist/cjs/components/QueryBuilder/redux/queryBuilder.reducer.js +1 -1
  9. package/dist/cjs/components/SearchFilter/components/DatePickerButton.js +1 -1
  10. package/dist/cjs/components/SearchFilter/components/DateRangeOnlyButton.js +1 -1
  11. package/dist/cjs/components/TablePagination/TablePagination.js +1 -1
  12. package/dist/cjs/components/alerts/Alert.d.ts +0 -3
  13. package/dist/cjs/components/alerts/Alert.js +1 -1
  14. package/dist/cjs/components/alerts/Alert.styled.d.ts +0 -2
  15. package/dist/cjs/components/alerts/Alert.styled.js +2 -10
  16. package/dist/cjs/components/alerts/AlertHelper.d.ts +1 -2
  17. package/dist/cjs/components/alerts/AlertHelper.js +1 -1
  18. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsDropdown.js +1 -1
  19. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.d.ts +0 -13
  20. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.js +1 -1
  21. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
  22. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js +1 -1
  23. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.model.d.ts +0 -2
  24. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.styles.d.ts +0 -1
  25. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.styles.js +2 -6
  26. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.js +1 -1
  27. package/dist/cjs/components/avatar/Avatar.d.ts +1 -4
  28. package/dist/cjs/components/avatar/Avatar.js +1 -1
  29. package/dist/cjs/components/avatar/Avatar.styled.js +4 -4
  30. package/dist/cjs/components/avatar/AvatarHelper.d.ts +1 -2
  31. package/dist/cjs/components/avatar/AvatarHelper.js +1 -1
  32. package/dist/cjs/components/bik-layout/MockMenus.d.ts +1 -0
  33. package/dist/cjs/components/carousel-secondary/CarouselSecondary.d.ts +4 -2
  34. package/dist/cjs/components/carousel-secondary/CarouselSecondary.js +1 -1
  35. package/dist/cjs/components/carousel-secondary/CarouselSecondary.style.d.ts +1 -1
  36. package/dist/cjs/components/carousel-secondary/CarouselSecondary.style.js +1 -1
  37. package/dist/cjs/components/checkBox/CheckBox.d.ts +0 -1
  38. package/dist/cjs/components/checkBox/CheckBox.js +1 -1
  39. package/dist/cjs/components/country-code-picker/CountryCodePicker.d.ts +0 -6
  40. package/dist/cjs/components/country-code-picker/CountryCodePicker.js +1 -1
  41. package/dist/cjs/components/custom-date-time/DateSelector/DateSelector.js +1 -1
  42. package/dist/cjs/components/data-source-panel/DataSourceInfoFooter.d.ts +0 -5
  43. package/dist/cjs/components/data-source-panel/DataSourceInfoFooter.js +1 -1
  44. package/dist/cjs/components/data-source-panel/DataSourcePanel.d.ts +5 -18
  45. package/dist/cjs/components/data-source-panel/DataSourcePanel.js +1 -1
  46. package/dist/cjs/components/data-source-panel/DataSourcePanel.style.d.ts +0 -1
  47. package/dist/cjs/components/data-source-panel/DataSourcePanel.style.js +4 -50
  48. package/dist/cjs/components/data-source-panel/model.d.ts +7 -14
  49. package/dist/cjs/components/datePicker/DatePickerWrapper.d.ts +4 -1
  50. package/dist/cjs/components/datePicker/DatePickerWrapper.js +1 -1
  51. package/dist/cjs/components/datePicker/DatePickerWrapper.styled.d.ts +1 -1
  52. package/dist/cjs/components/datePicker/DatePickerWrapper.styled.js +2 -2
  53. package/dist/cjs/components/discount-modal/DiscountModal.d.ts +0 -2
  54. package/dist/cjs/components/discount-modal/DiscountModal.js +1 -1
  55. package/dist/cjs/components/discount-modal/DynamicCoupon/DynamicCoupon.d.ts +2 -1
  56. package/dist/cjs/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
  57. package/dist/cjs/components/dropdown/ChipDropdown.d.ts +1 -1
  58. package/dist/cjs/components/dropdown/ChipDropdown.js +3 -3
  59. package/dist/cjs/components/dropdown/ChipInput.d.ts +0 -2
  60. package/dist/cjs/components/dropdown/ChipInput.js +1 -1
  61. package/dist/cjs/components/dropdown/Common.styled.d.ts +1 -3
  62. package/dist/cjs/components/dropdown/Common.styled.js +4 -4
  63. package/dist/cjs/components/dropdown/Dropdown.d.ts +0 -1
  64. package/dist/cjs/components/dropdown/Dropdown.js +1 -1
  65. package/dist/cjs/components/dropdown/MenuItem/MenuItem.d.ts +1 -1
  66. package/dist/cjs/components/dropdown/MenuItem/MenuItem.js +5 -5
  67. package/dist/cjs/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
  68. package/dist/cjs/components/dropdown/OpenedDropdown/components/searchbox/SearchZeroState.d.ts +0 -1
  69. package/dist/cjs/components/dropdown/OpenedDropdown/components/searchbox/SearchZeroState.js +1 -1
  70. package/dist/cjs/components/dropdown/hooks/useDropdown.d.ts +1 -4
  71. package/dist/cjs/components/dropdown/hooks/useDropdown.js +1 -1
  72. package/dist/cjs/components/dropdown/type.d.ts +0 -1
  73. package/dist/cjs/components/input/Input.d.ts +0 -3
  74. package/dist/cjs/components/input/Input.js +1 -1
  75. package/dist/cjs/components/input/Input.styled.d.ts +0 -1
  76. package/dist/cjs/components/input/Input.styled.js +1 -1
  77. package/dist/cjs/components/modals/Modal.d.ts +0 -2
  78. package/dist/cjs/components/modals/Modal.js +1 -1
  79. package/dist/cjs/components/modals/modal.styled.d.ts +0 -6
  80. package/dist/cjs/components/modals/modal.styled.js +1 -1
  81. package/dist/cjs/components/modals/styledModal.d.ts +0 -2
  82. package/dist/cjs/components/modals/styledModal.js +1 -1
  83. package/dist/cjs/components/multi-level-dropdown/MenuItem.js +1 -1
  84. package/dist/cjs/components/plans/NewSubscriptionPlan.js +1 -1
  85. package/dist/cjs/components/plans/SubscriptionPlan.d.ts +0 -1
  86. package/dist/cjs/components/plans/SubscriptionPlan.js +1 -1
  87. package/dist/cjs/components/product-picker-v2/collectionScreen.d.ts +1 -3
  88. package/dist/cjs/components/product-picker-v2/collectionScreen.js +1 -1
  89. package/dist/cjs/components/product-picker-v2/modal.d.ts +13 -9
  90. package/dist/cjs/components/product-picker-v2/modal.js +1 -1
  91. package/dist/cjs/components/product-picker-v2/product.js +1 -1
  92. package/dist/cjs/components/product-picker-v2/productInfoOverlay.js +7 -7
  93. package/dist/cjs/components/product-picker-v2/productScreen.d.ts +3 -5
  94. package/dist/cjs/components/product-picker-v2/productScreen.js +1 -1
  95. package/dist/cjs/components/product-picker-v2/rearrangeScreen.d.ts +1 -3
  96. package/dist/cjs/components/product-picker-v2/rearrangeScreen.js +1 -1
  97. package/dist/cjs/components/product-picker-v2/searchScreen.d.ts +1 -3
  98. package/dist/cjs/components/product-picker-v2/searchScreen.js +1 -1
  99. package/dist/cjs/components/product-picker-v2/selectedScreen.d.ts +1 -3
  100. package/dist/cjs/components/product-picker-v2/selectedScreen.js +1 -1
  101. package/dist/cjs/components/product-picker-v2/style.d.ts +0 -11
  102. package/dist/cjs/components/product-picker-v2/style.js +18 -53
  103. package/dist/cjs/components/product-picker-v2/type.d.ts +0 -7
  104. package/dist/cjs/components/product-picker-v2/type.js +1 -1
  105. package/dist/cjs/components/product-picker-v2/utility.d.ts +1 -3
  106. package/dist/cjs/components/product-picker-v2/utility.js +1 -1
  107. package/dist/cjs/components/product-picker-v2/variant.js +1 -1
  108. package/dist/cjs/components/progress-bar-v2/ProgressBarV2.d.ts +0 -1
  109. package/dist/cjs/components/progress-bar-v2/ProgressBarV2.js +1 -1
  110. package/dist/cjs/components/states-modal/StateModalComponent.d.ts +0 -1
  111. package/dist/cjs/components/states-modal/StateModalComponent.js +1 -1
  112. package/dist/cjs/components/tag/Tag.d.ts +1 -1
  113. package/dist/cjs/components/tag/Tag.js +1 -1
  114. package/dist/cjs/components/tag/model.d.ts +1 -12
  115. package/dist/cjs/components/template-context-mapper/TemplateContextMapper.d.ts +0 -2
  116. package/dist/cjs/components/template-context-mapper/context/templateModalContext.d.ts +0 -3
  117. package/dist/cjs/components/template-context-mapper/custom-hooks/useAdditionalVariables.js +1 -1
  118. package/dist/cjs/components/template-context-mapper/modalElements/BackTrackComponent.js +1 -1
  119. package/dist/cjs/components/template-context-mapper/modalElements/DiscountCodeComponent.js +1 -1
  120. package/dist/cjs/components/template-context-mapper/modalElements/EditWebpushTemplate.js +1 -1
  121. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
  122. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnector.js +5 -5
  123. package/dist/cjs/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
  124. package/dist/cjs/components/template-preview/RCS/RCSMediaCard.d.ts +1 -1
  125. package/dist/cjs/components/template-preview/RCS/RCSMediaCard.js +1 -1
  126. package/dist/cjs/components/template-preview/WhatsApp/MediaCard.js +1 -1
  127. package/dist/cjs/components/template-preview/WhatsAppTemplatePreview.js +1 -1
  128. package/dist/cjs/components/template-preview/helpers/TemplateCreatorHelper.d.ts +0 -1
  129. package/dist/cjs/components/template-preview/helpers/TemplateCreatorHelper.js +1 -1
  130. package/dist/cjs/components/unsatisfactory-response-list/UnsatisfactoryCountIntentWiseModal.d.ts +4 -4
  131. package/dist/cjs/components/unsatisfactory-response-list/UnsatisfactoryCountIntentWiseModal.js +1 -1
  132. package/dist/cjs/components/unsatisfactory-response-list/UnsatisfactoryResponseList.d.ts +5 -7
  133. package/dist/cjs/components/unsatisfactory-response-list/UnsatisfactoryResponseList.js +1 -1
  134. package/dist/cjs/components/unsatisfactory-response-list/UnsatisfactoryResponseList.style.js +1 -1
  135. package/dist/cjs/components/variable-picker-v3/Content.d.ts +1 -0
  136. package/dist/cjs/components/variable-picker-v3/Content.js +1 -1
  137. package/dist/cjs/components/variable-picker-v3/SubHeaderItems.js +1 -1
  138. package/dist/cjs/components/zeroState/ZeroState.d.ts +0 -1
  139. package/dist/cjs/components/zeroState/ZeroState.js +1 -1
  140. package/dist/cjs/index.d.ts +0 -1
  141. package/dist/cjs/index.js +1 -1
  142. package/dist/esm/assets/icons/CheckSquareOffset.svg.js +1 -0
  143. package/dist/esm/assets/icons/email-channel.svg.js +1 -1
  144. package/dist/esm/assets/icons/facebook_channel.svg.js +1 -1
  145. package/dist/esm/assets/icons/instagram-channel.svg.js +1 -1
  146. package/dist/esm/assets/icons/whatsapp_color.svg.js +1 -1
  147. package/dist/esm/components/QueryBuilder/Filters/CustomField/components/CustomField.js +1 -1
  148. package/dist/esm/components/QueryBuilder/components/QueryBuilderNodes.js +1 -1
  149. package/dist/esm/components/QueryBuilder/redux/queryBuilder.reducer.js +1 -1
  150. package/dist/esm/components/SearchFilter/components/DatePickerButton.js +1 -1
  151. package/dist/esm/components/SearchFilter/components/DateRangeOnlyButton.js +1 -1
  152. package/dist/esm/components/TablePagination/TablePagination.js +1 -1
  153. package/dist/esm/components/alerts/Alert.d.ts +0 -3
  154. package/dist/esm/components/alerts/Alert.js +1 -1
  155. package/dist/esm/components/alerts/Alert.styled.d.ts +0 -2
  156. package/dist/esm/components/alerts/Alert.styled.js +5 -13
  157. package/dist/esm/components/alerts/AlertHelper.d.ts +1 -2
  158. package/dist/esm/components/alerts/AlertHelper.js +1 -1
  159. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsDropdown.js +1 -1
  160. package/dist/esm/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.d.ts +0 -13
  161. package/dist/esm/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.js +1 -1
  162. package/dist/esm/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
  163. package/dist/esm/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js +1 -1
  164. package/dist/esm/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.model.d.ts +0 -2
  165. package/dist/esm/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.styles.d.ts +0 -1
  166. package/dist/esm/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.styles.js +1 -5
  167. package/dist/esm/components/analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.js +1 -1
  168. package/dist/esm/components/avatar/Avatar.d.ts +1 -4
  169. package/dist/esm/components/avatar/Avatar.js +1 -1
  170. package/dist/esm/components/avatar/Avatar.styled.js +2 -2
  171. package/dist/esm/components/avatar/AvatarHelper.d.ts +1 -2
  172. package/dist/esm/components/avatar/AvatarHelper.js +1 -1
  173. package/dist/esm/components/bik-layout/MockMenus.d.ts +1 -0
  174. package/dist/esm/components/carousel-secondary/CarouselSecondary.d.ts +4 -2
  175. package/dist/esm/components/carousel-secondary/CarouselSecondary.js +1 -1
  176. package/dist/esm/components/carousel-secondary/CarouselSecondary.style.d.ts +1 -1
  177. package/dist/esm/components/carousel-secondary/CarouselSecondary.style.js +1 -1
  178. package/dist/esm/components/checkBox/CheckBox.d.ts +0 -1
  179. package/dist/esm/components/checkBox/CheckBox.js +1 -1
  180. package/dist/esm/components/country-code-picker/CountryCodePicker.d.ts +0 -6
  181. package/dist/esm/components/country-code-picker/CountryCodePicker.js +1 -1
  182. package/dist/esm/components/custom-date-time/DateSelector/DateSelector.js +1 -1
  183. package/dist/esm/components/data-source-panel/DataSourceInfoFooter.d.ts +0 -5
  184. package/dist/esm/components/data-source-panel/DataSourceInfoFooter.js +1 -1
  185. package/dist/esm/components/data-source-panel/DataSourcePanel.d.ts +5 -18
  186. package/dist/esm/components/data-source-panel/DataSourcePanel.js +1 -1
  187. package/dist/esm/components/data-source-panel/DataSourcePanel.style.d.ts +0 -1
  188. package/dist/esm/components/data-source-panel/DataSourcePanel.style.js +3 -49
  189. package/dist/esm/components/data-source-panel/model.d.ts +7 -14
  190. package/dist/esm/components/datePicker/DatePickerWrapper.d.ts +4 -1
  191. package/dist/esm/components/datePicker/DatePickerWrapper.js +1 -1
  192. package/dist/esm/components/datePicker/DatePickerWrapper.styled.d.ts +1 -1
  193. package/dist/esm/components/datePicker/DatePickerWrapper.styled.js +11 -11
  194. package/dist/esm/components/discount-modal/DiscountModal.d.ts +0 -2
  195. package/dist/esm/components/discount-modal/DiscountModal.js +1 -1
  196. package/dist/esm/components/discount-modal/DynamicCoupon/DynamicCoupon.d.ts +2 -1
  197. package/dist/esm/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
  198. package/dist/esm/components/dropdown/ChipDropdown.d.ts +1 -1
  199. package/dist/esm/components/dropdown/ChipDropdown.js +3 -3
  200. package/dist/esm/components/dropdown/ChipInput.d.ts +0 -2
  201. package/dist/esm/components/dropdown/ChipInput.js +1 -1
  202. package/dist/esm/components/dropdown/Common.styled.d.ts +1 -3
  203. package/dist/esm/components/dropdown/Common.styled.js +1 -1
  204. package/dist/esm/components/dropdown/Dropdown.d.ts +0 -1
  205. package/dist/esm/components/dropdown/Dropdown.js +1 -1
  206. package/dist/esm/components/dropdown/MenuItem/MenuItem.d.ts +1 -1
  207. package/dist/esm/components/dropdown/MenuItem/MenuItem.js +5 -5
  208. package/dist/esm/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
  209. package/dist/esm/components/dropdown/OpenedDropdown/components/searchbox/SearchZeroState.d.ts +0 -1
  210. package/dist/esm/components/dropdown/OpenedDropdown/components/searchbox/SearchZeroState.js +1 -1
  211. package/dist/esm/components/dropdown/hooks/useDropdown.d.ts +1 -4
  212. package/dist/esm/components/dropdown/hooks/useDropdown.js +1 -1
  213. package/dist/esm/components/dropdown/type.d.ts +0 -1
  214. package/dist/esm/components/input/Input.d.ts +0 -3
  215. package/dist/esm/components/input/Input.js +1 -1
  216. package/dist/esm/components/input/Input.styled.d.ts +0 -1
  217. package/dist/esm/components/input/Input.styled.js +1 -1
  218. package/dist/esm/components/modals/Modal.d.ts +0 -2
  219. package/dist/esm/components/modals/Modal.js +1 -1
  220. package/dist/esm/components/modals/modal.styled.d.ts +0 -6
  221. package/dist/esm/components/modals/modal.styled.js +1 -1
  222. package/dist/esm/components/modals/styledModal.d.ts +0 -2
  223. package/dist/esm/components/modals/styledModal.js +1 -1
  224. package/dist/esm/components/multi-level-dropdown/MenuItem.js +1 -1
  225. package/dist/esm/components/plans/NewSubscriptionPlan.js +1 -1
  226. package/dist/esm/components/plans/SubscriptionPlan.d.ts +0 -1
  227. package/dist/esm/components/plans/SubscriptionPlan.js +1 -1
  228. package/dist/esm/components/product-picker-v2/collectionScreen.d.ts +1 -3
  229. package/dist/esm/components/product-picker-v2/collectionScreen.js +1 -1
  230. package/dist/esm/components/product-picker-v2/modal.d.ts +13 -9
  231. package/dist/esm/components/product-picker-v2/modal.js +1 -1
  232. package/dist/esm/components/product-picker-v2/product.js +1 -1
  233. package/dist/esm/components/product-picker-v2/productInfoOverlay.js +7 -7
  234. package/dist/esm/components/product-picker-v2/productScreen.d.ts +3 -5
  235. package/dist/esm/components/product-picker-v2/productScreen.js +1 -1
  236. package/dist/esm/components/product-picker-v2/rearrangeScreen.d.ts +1 -3
  237. package/dist/esm/components/product-picker-v2/rearrangeScreen.js +1 -1
  238. package/dist/esm/components/product-picker-v2/searchScreen.d.ts +1 -3
  239. package/dist/esm/components/product-picker-v2/searchScreen.js +1 -1
  240. package/dist/esm/components/product-picker-v2/selectedScreen.d.ts +1 -3
  241. package/dist/esm/components/product-picker-v2/selectedScreen.js +1 -1
  242. package/dist/esm/components/product-picker-v2/style.d.ts +0 -11
  243. package/dist/esm/components/product-picker-v2/style.js +16 -51
  244. package/dist/esm/components/product-picker-v2/type.d.ts +0 -7
  245. package/dist/esm/components/product-picker-v2/type.js +1 -1
  246. package/dist/esm/components/product-picker-v2/utility.d.ts +1 -3
  247. package/dist/esm/components/product-picker-v2/utility.js +1 -1
  248. package/dist/esm/components/product-picker-v2/variant.js +1 -1
  249. package/dist/esm/components/progress-bar-v2/ProgressBarV2.d.ts +0 -1
  250. package/dist/esm/components/progress-bar-v2/ProgressBarV2.js +1 -1
  251. package/dist/esm/components/states-modal/StateModalComponent.d.ts +0 -1
  252. package/dist/esm/components/states-modal/StateModalComponent.js +1 -1
  253. package/dist/esm/components/tag/Tag.d.ts +1 -1
  254. package/dist/esm/components/tag/Tag.js +1 -1
  255. package/dist/esm/components/tag/model.d.ts +1 -12
  256. package/dist/esm/components/template-context-mapper/TemplateContextMapper.d.ts +0 -2
  257. package/dist/esm/components/template-context-mapper/context/templateModalContext.d.ts +0 -3
  258. package/dist/esm/components/template-context-mapper/custom-hooks/useAdditionalVariables.js +1 -1
  259. package/dist/esm/components/template-context-mapper/modalElements/BackTrackComponent.js +1 -1
  260. package/dist/esm/components/template-context-mapper/modalElements/DiscountCodeComponent.js +1 -1
  261. package/dist/esm/components/template-context-mapper/modalElements/EditWebpushTemplate.js +1 -1
  262. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
  263. package/dist/esm/components/template-context-mapper/modalElements/VariableConnector.js +4 -4
  264. package/dist/esm/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
  265. package/dist/esm/components/template-preview/RCS/RCSMediaCard.d.ts +1 -1
  266. package/dist/esm/components/template-preview/RCS/RCSMediaCard.js +1 -1
  267. package/dist/esm/components/template-preview/WhatsApp/MediaCard.js +1 -1
  268. package/dist/esm/components/template-preview/WhatsAppTemplatePreview.js +1 -1
  269. package/dist/esm/components/template-preview/helpers/TemplateCreatorHelper.d.ts +0 -1
  270. package/dist/esm/components/template-preview/helpers/TemplateCreatorHelper.js +1 -1
  271. package/dist/esm/components/unsatisfactory-response-list/UnsatisfactoryCountIntentWiseModal.d.ts +4 -4
  272. package/dist/esm/components/unsatisfactory-response-list/UnsatisfactoryCountIntentWiseModal.js +1 -1
  273. package/dist/esm/components/unsatisfactory-response-list/UnsatisfactoryResponseList.d.ts +5 -7
  274. package/dist/esm/components/unsatisfactory-response-list/UnsatisfactoryResponseList.js +1 -1
  275. package/dist/esm/components/unsatisfactory-response-list/UnsatisfactoryResponseList.style.js +1 -1
  276. package/dist/esm/components/variable-picker-v3/Content.d.ts +1 -0
  277. package/dist/esm/components/variable-picker-v3/Content.js +1 -1
  278. package/dist/esm/components/variable-picker-v3/SubHeaderItems.js +1 -1
  279. package/dist/esm/components/zeroState/ZeroState.d.ts +0 -1
  280. package/dist/esm/components/zeroState/ZeroState.js +5 -5
  281. package/dist/esm/index.d.ts +0 -1
  282. package/dist/esm/index.js +1 -1
  283. package/package.json +1 -1
  284. package/dist/cjs/_virtual/bik-store.js +0 -1
  285. package/dist/cjs/assets/icons/bik_livechat.svg.js +0 -1
  286. package/dist/cjs/assets/icons/task.svg.js +0 -1
  287. package/dist/cjs/components/carousel-secondary/model.d.ts +0 -4
  288. package/dist/cjs/components/carousel-secondary/model.js +0 -1
  289. package/dist/cjs/components/data-source-panel/IntentConfig.d.ts +0 -5
  290. package/dist/cjs/components/data-source-panel/IntentConfig.js +0 -1
  291. package/dist/cjs/components/data-source-panel/Modals/DescriptionModal.d.ts +0 -8
  292. package/dist/cjs/components/data-source-panel/Modals/DescriptionModal.js +0 -48
  293. package/dist/cjs/components/datePicker/model.d.ts +0 -4
  294. package/dist/cjs/components/datePicker/model.js +0 -1
  295. package/dist/cjs/components/tag/Tag.stories.d.ts +0 -22
  296. package/dist/cjs/components/variable-picker-v3/highlightSearchText.d.ts +0 -1
  297. package/dist/cjs/components/variable-picker-v3/highlightSearchText.js +0 -1
  298. package/dist/cjs/node_modules/@bikdotai/bik-models/growth/models/bik-store.js +0 -1
  299. package/dist/esm/_virtual/bik-store.js +0 -1
  300. package/dist/esm/assets/icons/bik_livechat.svg.js +0 -1
  301. package/dist/esm/assets/icons/task.svg.js +0 -1
  302. package/dist/esm/components/carousel-secondary/model.d.ts +0 -4
  303. package/dist/esm/components/carousel-secondary/model.js +0 -1
  304. package/dist/esm/components/data-source-panel/IntentConfig.d.ts +0 -5
  305. package/dist/esm/components/data-source-panel/IntentConfig.js +0 -1
  306. package/dist/esm/components/data-source-panel/Modals/DescriptionModal.d.ts +0 -8
  307. package/dist/esm/components/data-source-panel/Modals/DescriptionModal.js +0 -48
  308. package/dist/esm/components/datePicker/model.d.ts +0 -4
  309. package/dist/esm/components/datePicker/model.js +0 -1
  310. package/dist/esm/components/tag/Tag.stories.d.ts +0 -22
  311. package/dist/esm/components/variable-picker-v3/highlightSearchText.d.ts +0 -1
  312. package/dist/esm/components/variable-picker-v3/highlightSearchText.js +0 -1
  313. package/dist/esm/node_modules/@bikdotai/bik-models/growth/models/bik-store.js +0 -1
@@ -1 +1 @@
1
- import{jsx as e,Fragment as o,jsxs as t}from"react/jsx-runtime";import"../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js";import i from"../../assets/icons/alert_triangle.svg.js";import n from"../../assets/icons/plus.svg.js";import{memo as r,useState as a,useMemo as s,useEffect as d}from"react";import{COLORS as l}from"../../constants/Theme.js";import{Button as c}from"../button/Button.js";import{BikShimmer as u}from"../shimmer/ShimmerComponent/BikShimmer.js";import{BodyCaption as p}from"../TypographyStyle.js";import{SourceInfoFooterStyle as h}from"./DataSourcePanel.style.js";import{__exports as m}from"../../_virtual/bik-store.js";const v=r((r=>{const{appType:v,sourceIntent:b,hideHeading:A,messageSource:y,trainingSourceCount:f={},ShowTrainingDataSource:_={},faqCount:I,ChecklistType:R,footerButtonOption:O,isFooterLoading:w,reasonForAiGeneratedResponse:N,showAiResponseReason:k}=r,C=_,[F,j]=a(!0),[D,E]=a(!0),S="/bik-ai/training",[x,P]=a({buttonTitle:"",redirectUrl:"",addFaqProps:{}}),[U,M]=a({title:"",subTitle:""}),q=s((()=>{const e=(null==f?void 0:f[b])||0;return e<=1?"There is "+e+"data source added to the identified intent":`There are ${e} data sources added to the identified intent`}),[f,b]),L=()=>{var e;(null==x?void 0:x.redirectUrl)?window.open(`${window.location.origin}${null==x?void 0:x.redirectUrl}`,"_self"):Object.keys(null!==(e=null==x?void 0:x.addFaqProps)&&void 0!==e?e:{}).length>0?null==O||O.onClick(x):(null==O?void 0:O.navigate)&&(null==O||O.navigate("Training",v==m.ApplicationType.MANIFEST?{tab:"/custom_data"}:{},{},!0))};return d((()=>{var e,o,t,i;if(b){if(null===(e=null==y?void 0:y.sources)||void 0===e?void 0:e.length){const e=y.sources[0];if(C[b])b===R.ORDER_ENQUIRY&&E(!1);else{let n=null==e?void 0:e.insights,r="";switch(b){case R.PRODUCT_DETAILS:"Product reviews"!==(null==e?void 0:e.title)&&(n=`${I||"No"} FAQs added for this product`,r="Add product-specific information via FAQs to improve responses",P({buttonTitle:"Add FAQ",addFaqProps:{faqProducts:[{id:null==e?void 0:e.productId,variantId:null==e?void 0:e.variantId,name:null==e?void 0:e.title,imageUrl:null==e?void 0:e.imageUrl}]},redirectUrl:""}));break;case R.ORDER_MODIFICATION:n=(null==f?void 0:f[b])?void 0:"Customers who are looking to modify their orders would be redirected to your live agents via the agent handover flow.",n&&P({buttonTitle:v==m.ApplicationType.MANIFEST?"Manage agent handover":"Add relevant data",redirectUrl:v==m.ApplicationType.MANIFEST?"/customise?tab=AgentHandover":S,addFaqProps:{}});break;case R.ORDER_CANCELLATION:n=(null==f?void 0:f[b])?void 0:"Customers who are looking to cancel their orders would be redirected to your live agents via the agent handover flow.",P({buttonTitle:v==m.ApplicationType.MANIFEST?"Manage agent handover":"Add relevant data",redirectUrl:v==m.ApplicationType.MANIFEST?"/customise?tab=AgentHandover":S,addFaqProps:{}});break;case R.ORDER_TRACKING:if("ORDER_NOT_FOUND"===(null==e?void 0:e.subIntent))break;P({buttonTitle:v==m.ApplicationType.MANIFEST?"Add order tracking link":"Add relevant data",redirectUrl:v==m.ApplicationType.MANIFEST?"/training/order-management":S,addFaqProps:{}});break;case R.PRODUCT_SEARCH:if("QUIZ"===(null==e?void 0:e.type))break;if(-1!==(null===(i=null===(t=null===(o=null==y?void 0:y.sources)||void 0===o?void 0:o[0])||void 0===t?void 0:t.title)||void 0===i?void 0:i.toLowerCase().indexOf("collection"))){n="Collections are recommended by matching queries with collection names and descriptions. Add relevant keywords to your collection description to improve results.";break}n="Products are recommended by matching queries with product names, descriptions, tags, and collections. Add relevant keywords and tags to your products to improve results."}M({title:null!=n?n:"",subTitle:r})}}(C[b]||[R.PRODUCT_DETAILS,R.ORDER_MODIFICATION,R.ORDER_CANCELLATION,R.ORDER_TRACKING].includes(b))&&j(!1)}}),[null==y?void 0:y.messageId,f,b,null==y?void 0:y.sources,C,R,I,v,y]),e(h,{children:e(o,w?{children:e(u,{gap:"8px",direction:"column",boxes:[{height:"20px",width:"300px"},{height:"80px",width:"300px"}]})}:{children:!(null==U?void 0:U.title)&&f&&b in f?t(o,{children:[e(g,{hideHeading:null!=A&&A}),e(T,{reason:N||"",showAiResponseReason:null!=k&&k}),t("div",Object.assign({className:"source_info_details "+(f[b]>0?"":"no_data_source")},{children:[f[b]>0&&D?t(o,{children:[e(p,{children:q}),e(p,Object.assign({color:l.content.secondary},{children:"Improve responses by adding more data sources for the identified intent"}))]}):D&&t("div",Object.assign({className:"no_data_source_title"},{children:[e(i,{width:15,height:15,color:l.content.negative,style:{marginTop:2}}),e(p,{children:"No data sources added to the identified link"})]})),!O||O.hideAddDataButton||F?e(o,{}):e(c,{size:"small",buttonType:"tertiary",LeadingIcon:n,buttonText:(null==x?void 0:x.buttonTitle.length)>0?null==x?void 0:x.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:()=>L(),style:{backgroundColor:"unset"}})]}))]}):t(o,{children:[e(g,{hideHeading:null!=A&&A}),e(T,{reason:N||"",showAiResponseReason:null!=k&&k}),t("div",Object.assign({className:"source_info_details"},{children:[D&&t(o,{children:[e(p,{children:null==U?void 0:U.title}),e(p,Object.assign({color:l.content.secondary},{children:null==U?void 0:U.subTitle}))]}),!O||O.hideAddDataButton||F?e(o,{}):e(c,{size:"small",buttonType:"tertiary",LeadingIcon:n,buttonText:(null==x?void 0:x.buttonTitle.length)>0?null==x?void 0:x.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:()=>L(),style:{backgroundColor:"unset"}})]}))]})})})})),g=r((o=>o.hideHeading?null:e(p,Object.assign({color:l.content.secondary},{children:"Training insights"})))),T=r((i=>{const[n,r]=a(!1),s=i.reason&&i.reason.length>50,d=s&&!n?i.reason.substring(0,50)+"...":i.reason;return i.showAiResponseReason?t("div",Object.assign({className:"source_info_details"},{children:[e(p,Object.assign({color:l.content.primary,className:"why_ai_gave_this_response"},{children:"Here’s why your AI gave this response"})),t(p,Object.assign({color:l.content.secondary,className:"clamp-text"},{children:[d||"No reason provided for this response.",s&&e(p,Object.assign({color:l.content.brand,style:{cursor:"pointer",textDecoration:"underline",marginTop:"4px"},onClick:()=>r(!n)},{children:n?"Show less":"Show more"}))]}))]})):e(o,{})}));T.displayName="WhyAiGaveThisResponse",g.displayName="TrainingInsightsHeading",v.displayName="SourceInfoFooter";export{v as default};
1
+ import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import i from"../../assets/icons/alert_triangle.svg.js";import o from"../../assets/icons/plus.svg.js";import{memo as s,useState as l,useMemo as d,useEffect as r}from"react";import{COLORS as a}from"../../constants/Theme.js";import{Button as c}from"../button/Button.js";import{BodyCaption as u}from"../TypographyStyle.js";import{SourceInfoFooterStyle as h}from"./DataSourcePanel.style.js";const g=s((s=>{const{sourceIntent:g,hideHeading:T,messageSource:v,trainingSourceCount:b={},ShowTrainingDataSource:f={},ChecklistType:p,footerButtonOption:y}=s,[O,_]=l({}),I=f,[j,C]=l(!0),[D,N]=l(!0),R=d((()=>{const e=(null==b?void 0:b[g])||0;return e<=1?"There is "+e+"data source added to the identified intent":`There are ${e} data sources added to the identified intent`}),[b,g]);return r((()=>{var e,t;if(g){if(null===(e=null==v?void 0:v.sources)||void 0===e?void 0:e.length)if(I[g])g===p.ORDER_ENQUIRY&&N(!1);else{const e=null!==(t=null==y?void 0:y.title)&&void 0!==t?t:v.sources[0].insights,n=null==y?void 0:y.subtitle;_({title:e,subTitle:n})}(I[g]||[p.PRODUCT_DETAILS,p.ORDER_MODIFICATION,p.ORDER_CANCELLATION,p.ORDER_TRACKING].includes(g))&&C(!1)}}),[null==v?void 0:v.messageId,b,g]),e(h,{children:!O.title&&b&&g in b?t(n,{children:[e(m,{hideHeading:null!=T&&T}),t("div",Object.assign({className:"source_info_details "+(b[g]>0?"":"no_data_source")},{children:[b[g]>0&&D?t(n,{children:[e(u,{children:R}),e(u,Object.assign({color:a.content.secondary},{children:"Improve responses by adding more data sources for the identified intent"}))]}):D&&t("div",Object.assign({className:"no_data_source_title"},{children:[e(i,{width:15,height:15,color:a.content.negative,style:{marginTop:2}}),e(u,{children:"No data sources added to the identified link"})]})),!y||y.hideAddDataButton||j?e(n,{}):e(c,{size:"small",buttonType:"tertiary",LeadingIcon:o,buttonText:(null==y?void 0:y.buttonTitle.length)>0?null==y?void 0:y.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:y.onClick,style:{backgroundColor:"unset"}})]}))]}):t(n,{children:[e(m,{hideHeading:null!=T&&T}),t("div",Object.assign({className:"source_info_details"},{children:[D&&t(n,{children:[e(u,{children:O.title}),e(u,Object.assign({color:a.content.secondary},{children:O.subTitle}))]}),!y||y.hideAddDataButton||j?e(n,{}):e(c,{size:"small",buttonType:"tertiary",LeadingIcon:o,buttonText:(null==y?void 0:y.buttonTitle.length)>0?null==y?void 0:y.buttonTitle:"Add relevant data",matchParentWidth:!0,onClick:y.onClick,style:{backgroundColor:"unset"}})]}))]})})})),m=s((t=>t.hideHeading?null:e(u,Object.assign({color:a.content.secondary},{children:"Training insights"}))));m.displayName="TrainingInsightsHeading",g.displayName="SourceInfoFooter";export{g as default};
@@ -1,36 +1,23 @@
1
1
  /// <reference types="react" />
2
- import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
3
- import { AllSourceInfoDetailsCustomDataModel, CustomDataType, DataSourcePanelZeroState, footerButtonOptionModel, InfoContent, MessageSource, ProductSourceData } from './model';
4
- export interface CollapsibleSectionProps {
5
- title: string;
6
- count: number;
7
- isExpanded: boolean;
8
- onToggle: () => void;
9
- children: React.ReactNode;
10
- }
2
+ import { AllSourceInfoDetailsCustomDataModel, CustomDataType, DataSourcePanelZeroState, footerButtonOptionModel, InfoContent, MessageSource } from './model';
11
3
  export interface DataSourcePanelProps {
12
4
  storeId: string;
13
- appType: ApplicationType;
14
5
  messageSource: MessageSource;
15
6
  setMessageSourcePanel: (source?: MessageSource) => void;
16
7
  hideCloseButton?: boolean;
17
8
  title?: string;
18
9
  allSourceInfoDetail: AllSourceInfoDetailsCustomDataModel;
19
10
  isSourceInfoFetched?: boolean;
11
+ faqCount: number;
20
12
  editableSources: CustomDataType[];
21
13
  redirect: (sourceInfo: InfoContent) => void;
22
- preFillTrainingSourceCount?: {
14
+ trainingSourceCount: {
23
15
  [k in string]: number;
24
16
  };
25
17
  zeroStateButton: DataSourcePanelZeroState;
26
18
  ChecklistType: Record<string, string>;
19
+ IntentComponentMap: Record<string, JSX.Element>;
20
+ ShowTrainingDataSource: Record<string, string>;
27
21
  footerButtonOption?: footerButtonOptionModel;
28
- fetchTrainingSourceCount: (storeId: string) => Promise<{
29
- [k in string]: number;
30
- }>;
31
- fetchProductFAQCount: (storeId: string, productIds?: string[]) => Promise<number>;
32
- productSourceData?: ProductSourceData;
33
- reasonForAiGeneratedResponse?: string;
34
- showAiResponseReason?: boolean;
35
22
  }
36
23
  export declare const DataSourcePanel: React.FC<DataSourcePanelProps>;
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t,Fragment as i}from"react/jsx-runtime";import"../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js";import o from"../../assets/icons/boxV2.svg.js";import n from"../../assets/icons/chevronDownOutline.svg.js";import s from"../../assets/icons/chevronUpOutline.svg.js";import l from"../../assets/icons/cross.svg.js";import r from"../../assets/icons/edit.svg.js";import a from"../../assets/icons/filePdf.svg.js";import c from"../../assets/icons/help.svg.js";import d from"../../assets/icons/info.svg.js";import p from"../../assets/icons/openai.svg.js";import u from"../../assets/icons/plus.svg.js";import g from"../../assets/icons/redirect.svg.js";import h from"../../assets/icons/text_t9.svg.js";import m from"../../assets/icons/website.svg.js";import{useState as f,useMemo as v,useEffect as y}from"react";import{COLORS as x}from"../../constants/Theme.js";import{Button as C}from"../button/Button.js";import{IconButton as I}from"../icon-button/IconButton.js";import{BikShimmer as b}from"../shimmer/ShimmerComponent/BikShimmer.js";import{SideModal as T}from"../side-modal/SideModal.js";import{Tag as j}from"../tag/Tag.js";import{Tooltip as O}from"../tooltips/Tooltip.js";import{TitleSmall as E,BodyCaption as S,BodySecondary as L}from"../TypographyStyle.js";import w from"./DataSourceInfoFooter.js";import{SourceInfoDetailsStyle as N}from"./DataSourcePanel.style.js";import{intentConfig as A}from"./IntentConfig.js";import{DescriptionModal as _}from"./Modals/DescriptionModal.js";import{CustomDataType as D}from"./model.js";import{__exports as k}from"../../_virtual/bik-store.js";const F=F=>{var R,B;const{appType:P,storeId:U,messageSource:K,setMessageSourcePanel:M,hideCloseButton:W,isSourceInfoFetched:H,allSourceInfoDetail:$,ChecklistType:q,title:Q,zeroStateButton:G,editableSources:Y,preFillTrainingSourceCount:z,redirect:X,footerButtonOption:V,fetchTrainingSourceCount:J,fetchProductFAQCount:Z,productSourceData:ee,reasonForAiGeneratedResponse:te,showAiResponseReason:ie}=F,{sources:oe}=K,ne=["blog","article","page","policy"],[se,le]=f(!1),[re,ae]=f(!1),[ce,de]=f(!1),[pe,ue]=f(0),[ge,he]=f(),[me,fe]=f(null!=z?z:{}),[ve,ye]=f(!1),[xe,Ce]=f(!1),Ie={};A.forEach((t=>{let{key:i,type:o,tagText:n}=t;q[i]&&(Ie[q[i]]=e(j,{theme:"light",type:o,tagText:n,cursor:"pointer"}))}));const be=oe.filter((e=>"PRODUCTS"==e.type||"Products"==e.subTitle||e.productId)),Te=oe.filter((e=>"PRODUCTS"!=e.type&&"Products"!=e.subTitle&&!e.productId)),je=v((()=>{const e={};return["STORE_INFORMATION","CONTACT_INFO","STORE_LOCATION","SHIPPING_POLICY","RETURN_AND_REFUND","SALES_AND_OFFERS","SALES_AND_OFFERS_ISSUES","PRODUCT_CUSTOMISATION","PAYMENT_METHODS","CHECKOUT_ENQUIRY","ORDER_ENQUIRY"].forEach((t=>{q[t]&&(e[q[t]]=q[t])})),["COLLABORATION","SUBSCRIPTION_ENQUIRY"].forEach((t=>{e[t]=t})),e}),[q]);y((()=>{var e,t,i,o;if(!(null==K?void 0:K.messageId))return;le(!0),ae(!0),de(!1!==(null===(t=null===(e=K.sources)||void 0===e?void 0:e[0])||void 0===t?void 0:t.isTrainable)||!!(null===(o=null===(i=K.sources)||void 0===i?void 0:i[0])||void 0===o?void 0:o.insights));const n=K.sources.filter((e=>!!e.productId)).map((e=>e.productId)),s=Array.from(new Set(n)).filter((e=>!!e));Z(U,s).then((e=>ue(e))).then((()=>{z?(fe(z),setTimeout((()=>{le(!1),ae(!1)}),100)):(setTimeout((()=>le(!1)),100),J(U).then((e=>fe(e))).then((()=>setTimeout((()=>{ae(!1)}),100))))}))}),[Z,J,null==K?void 0:K.messageId,K.sources,z,U]);const Oe=e=>!!(e&&0===e.length||(null==K?void 0:K.isUnsatisfactoryAnswer)),Ee=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;return"custom"==e?e=D.FILES:ne.includes(e)?e=D.FETCHED_LINKS:"url"==e?e=D.WEBSITE_LINKS:"text"===e?e=D.TEXTS:"faq"===e&&(e=D.FAQ),t?e:null===(i=null==e?void 0:e.toLowerCase())||void 0===i?void 0:i.replace(/_/g," ")},Se=e=>e?"faq"==e.toLocaleLowerCase()?"FAQ":"openai"==e.toLocaleLowerCase()?"OPENAI":"files"==e.toLocaleLowerCase()?"PDF":"texts"==e.toLocaleLowerCase()?"Custom text":((e=(e=e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).replace("_"," ")).endsWith("s")&&(e=e.slice(0,-1)),e.replace("Website","Manual")):"",Le=t=>e("products"==t||"product"==t?o:"files"==t?a:"website links"==t||"fetched links"==t?m:"faq"==t?c:"texts"==t?h:p,{height:16,width:16,color:x.content.secondary}),we=e=>{const t=e.replace(/(<([^>]+)>)/gi,""),i=document.createElement("textarea");return i.innerHTML=t,i.value};if(se||!H)return e(N,{children:e(b,{boxes:[{width:"100px",height:"16px"},{width:"0",height:"4px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"0",height:"4px"},{width:"100%",height:"16px"}]})});const Ne=o=>{const{title:l,count:r,isExpanded:a,onToggle:c,children:d}=o;return t("div",{children:[t("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",cursor:"pointer"},onClick:c},{children:[t("div",Object.assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[e(S,Object.assign({style:{fontWeight:"600"}},{children:l})),P===k.ApplicationType.MANIFEST?e("div",Object.assign({style:{backgroundColor:x.surface.subdued,color:x.content.secondary,padding:"2px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:"500"}},{children:r})):e(i,{})]})),e(i,{children:P===k.ApplicationType.BIK?e(i,{}):e(a?n:s,{width:20,height:20,color:x.content.primary})})]})),a&&d]})};return t(i,{children:[e(N,{children:t(i,{children:[t("div",Object.assign({className:"pop-up-header",style:{display:"flex",flexDirection:"column",paddingBottom:"12px"}},{children:[!!Q&&e(E,{children:Q}),t("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",alignItems:"center"}},{children:[e(S,Object.assign({color:x.content.secondary},{children:"Intent"})),null!==(R=Ie[K.intent])&&void 0!==R?R:Ie.GENERIC,!W&&e("div",Object.assign({style:{display:"flex",marginLeft:"auto",cursor:"pointer"},onClick:()=>M(void 0)},{children:e(l,{height:20,width:20,color:x.content.secondary})}))]})),Oe(oe)?e("div",Object.assign({style:{display:"flex",margin:"auto",justifyContent:"center",alignItems:"center",height:"calc(100vh - 300px)"}},{children:(()=>{var i,o;return t("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",margin:"0px 30px",gap:"8px"}},{children:[e("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"12px",backgroundColor:`${x.background.negative.light}`,borderRadius:"100px"}},{children:e(d,{width:24,height:24,color:x.stroke.negative.vibrant})})),e("div",Object.assign({style:{justifyContent:"center",alignItems:"center",marginBottom:"-4px"}},{children:e(E,{children:"Insufficient data"})})),e(L,Object.assign({color:x.content.secondary,style:{display:"flex",justifyContent:"center",textAlign:"center"}},{children:"No data available to answer this query. Add an FAQ to address it in the future"})),G&&e("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e(C,{LeadingIcon:null!==(i=G.leadingIcon)&&void 0!==i?i:u,buttonText:null!==(o=G.title)&&void 0!==o?o:"Add FAQ",buttonType:"secondary",size:"small",matchParentWidth:!0,onClick:()=>{G.onClick()}})}))]}))})()})):e(j,{LeadingIcon:d,version:"2.0",type:"grey",theme:"light",alignIcon:"start",contentPadding:12,tagText:K.isEditable?`If any of the information is incorrect, update the original data source and sync it again. Alternatively, you can make local corrections directly in ${P===k.ApplicationType.BIK?"BIK":"Manifest"}.`:"Edit the original source and save again to update the response"})]})),!Oe(oe)&&t("div",Object.assign({className:"info-container"},{children:[e(i,{children:be.length>0&&e("div",Object.assign({className:"info-product-source"},{children:e(Ne,Object.assign({title:"Product Sources",count:be.length,isExpanded:P!==k.ApplicationType.MANIFEST||ve,onToggle:()=>ye(!ve)},{children:e("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:be.map(((o,n)=>{var s,l,a,c;const d=Ee(o.type||o.subTitle||"OpenAI"),p=Ee(o.type||o.subTitle||"OpenAI",!0),u=Se(d),h=null==Y?void 0:Y.includes(p),m=$[null!==(s=o.productId)&&void 0!==s?s:"Products"],f=o.title,v=o.productId&&(null==ee?void 0:ee[o.productId]),y=v&&v.metafield.join(", ");return t("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:n+1<(null==be?void 0:be.length)?`1px solid ${x.stroke.primary}`:"none"}},{children:[t("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[t("div",Object.assign({style:{display:"flex",flex:1,gap:"8px",flexDirection:"row",alignItems:"center",justifyContent:"flex-start"}},{children:[Le(d),e(O,Object.assign({body:f,placement:"top"},{children:e(L,Object.assign({style:p==D.FETCHED_LINKS||p==D.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:x.content.primary,className:"clamp-title",onClick:()=>p==D.FETCHED_LINKS||p==D.WEBSITE_LINKS?X(o):{}},{children:f}))}))]})),t("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[o.intent!==q.EMAIL_COLLECTION&&e(i,{children:e(S,Object.assign({color:x.content.secondary},{children:u}))}),(o.link||o.docId)&&e("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:e(I,h?{Icon:r,height:16,width:16,iconColor:x.content.secondary,onClick:()=>null==m?void 0:m.onEditClick(m.data,m.type),disabled:!m,disabledTooltip:"This source is deleted"}:{Icon:g,height:16,width:16,iconColor:x.content.secondary,disabled:"custom"===o.type&&!m,disabledTooltip:"This source is deleted",onClick:()=>X(o)})}))]}))]})),v&&t(S,{children:[e("span",Object.assign({className:"product-data-text1",onClick:()=>{var e;he({title:f,description:we(v.description),imageUrl:null!==(e=o.imageUrl)&&void 0!==e?e:"",onClose:()=>he(void 0)})}},{children:`${null===(l=v.description)||void 0===l?void 0:l.length} characters description,`})),e("span",Object.assign({className:"product-data-text1",onClick:()=>v.onEditFaqClick(v.faqs)},{children:`${null===(a=v.faqs)||void 0===a?void 0:a.length} FAQs, `})),e("span",Object.assign({className:"product-data-text2"},{children:"and"})),e(O,Object.assign({body:y,placement:"top"},{children:e("span",Object.assign({className:"product-data-text1"},{children:`${null===(c=v.metafield)||void 0===c?void 0:c.length} metafields`}))}))]})]}),`info-${n}`)}))}))}))}))}),e(i,{children:Te.length>0&&e("div",Object.assign({className:"info-content-source"},{children:e(Ne,Object.assign({title:"Content Sources",count:Te.length,isExpanded:P!==k.ApplicationType.MANIFEST||xe,onToggle:()=>Ce(!xe)},{children:e("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:Te.map(((o,n)=>{var s,l,a,c,d,p,u,h,m,f,v,y,C,b,T,j,E;const w=Ee(o.type||o.subTitle||"OpenAI"),N=Ee(o.type||o.subTitle||"OpenAI",!0),A=Se(w),_=null==Y?void 0:Y.includes(N),k="Products"===o.subTitle?$[null!==(s=o.productId)&&void 0!==s?s:"Products"]:$[null!==(l=o.docId)&&void 0!==l?l:""],F=N.toLowerCase()===(null===(a=D.FAQ)||void 0===a?void 0:a.toLowerCase())?"faq"===(null===(c=o.title)||void 0===c?void 0:c.toLowerCase())?o.subTitle:o.title:N.toLowerCase()===(null===(d=D.FILES)||void 0===d?void 0:d.toLowerCase())||N.toLowerCase()===(null===(p=D.FETCHED_LINKS)||void 0===p?void 0:p.toLowerCase())||N.toLowerCase()===(null===(u=D.TEXTS)||void 0===u?void 0:u.toLowerCase())?o.title:N.toLowerCase()===(null===(h=D.WEBSITE_LINKS)||void 0===h?void 0:h.toLowerCase())?o.title.split("/")[o.title.split("/").length-1].replace(/[^\w\s]/gi," ").replace(/^(.)(.*)$/,((e,t,i)=>t.toUpperCase()+i)):o.intent===q.EMAIL_COLLECTION?A:o.title,R="faq"===N.toLowerCase()?null!==(v=null!==(m=null==k?void 0:k.content)&&void 0!==m?m:null===(f=null==k?void 0:k.data)||void 0===f?void 0:f.answer)&&void 0!==v?v:"":N.toLowerCase()===(null===(y=D.FETCHED_LINKS)||void 0===y?void 0:y.toLowerCase())||N.toLowerCase()===(null===(C=D.WEBSITE_LINKS)||void 0===C?void 0:C.toLowerCase())||N.toLowerCase()===(null===(b=D.TEXTS)||void 0===b?void 0:b.toLowerCase())?null!==(E=null!==(T=null==k?void 0:k.content)&&void 0!==T?T:null===(j=null==k?void 0:k.data)||void 0===j?void 0:j.fileContentText)&&void 0!==E?E:"":o.intent===q.EMAIL_COLLECTION?"Collect leads before replying to messages":"";return t("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:n+1<(null==Te?void 0:Te.length)?`1px solid ${x.stroke.primary}`:"none"}},{children:[t("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[t("div",Object.assign({style:{display:"flex",flex:1,gap:"8px",flexDirection:"row",alignItems:"center",justifyContent:"flex-start"}},{children:[Le(w),e(O,Object.assign({body:F,placement:"top"},{children:e(L,Object.assign({style:N==D.FETCHED_LINKS||N==D.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:x.content.primary,className:"clamp-title",onClick:()=>N==D.FETCHED_LINKS||N==D.WEBSITE_LINKS?X(o):{}},{children:F}))}))]})),t("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[o.intent!==q.EMAIL_COLLECTION&&e(i,{children:e(S,Object.assign({color:x.content.secondary},{children:A}))}),(o.link||o.docId)&&e("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:e(I,_?{Icon:r,height:16,width:16,iconColor:x.content.secondary,onClick:()=>null==k?void 0:k.onEditClick(k.data,k.type),disabled:!k,disabledTooltip:"This source is deleted"}:{Icon:g,height:16,width:16,iconColor:x.content.secondary,disabled:"custom"===o.type&&!k,disabledTooltip:"This source is deleted",onClick:()=>X(o)})}))]}))]})),(null!=R?R:"").trim()&&e("div",Object.assign({style:{padding:"4px 8px",border:`1px dashed ${x.stroke.primary}`,borderRadius:"4px",backgroundColor:x.surface.subdued}},{children:e(S,Object.assign({color:x.content.primary,className:"clamp-description"},{children:we(null!=R?R:"").trim()}))}))]}),`info-${n}`)}))}))}))}))})]})),ce&&!Oe(oe)&&e("div",Object.assign({className:"footer"},{children:e(w,{appType:P,storeId:U,messageSource:K,sourceIntent:null!==(B=K.intent)&&void 0!==B?B:q.GENERIC,faqCount:pe,trainingSourceCount:me,ShowTrainingDataSource:je,ChecklistType:q,footerButtonOption:V,isFooterLoading:re,reasonForAiGeneratedResponse:te,showAiResponseReason:ie})}))]})}),ge&&e(T,Object.assign({header:"Product description",onClose:()=>he(void 0),width:"30%"},{children:e(_,{title:ge.title,description:ge.description,imageUrl:ge.imageUrl,onClose:ge.onClose})}))]})};export{F as DataSourcePanel};
1
+ import{jsx as e,Fragment as t,jsxs as i}from"react/jsx-runtime";import o from"../../assets/icons/boxV2.svg.js";import s from"../../assets/icons/cross.svg.js";import n from"../../assets/icons/edit.svg.js";import r from"../../assets/icons/filePdf.svg.js";import l from"../../assets/icons/help.svg.js";import a from"../../assets/icons/info.svg.js";import d from"../../assets/icons/openai.svg.js";import c from"../../assets/icons/plus.svg.js";import p from"../../assets/icons/redirect.svg.js";import u from"../../assets/icons/text_t9.svg.js";import g from"../../assets/icons/website.svg.js";import{useState as h,useEffect as m}from"react";import{COLORS as v}from"../../constants/Theme.js";import{Button as f}from"../button/Button.js";import{IconButton as y}from"../icon-button/IconButton.js";import{BikShimmer as C}from"../shimmer/ShimmerComponent/BikShimmer.js";import{Tag as x}from"../tag/Tag.js";import{Tooltip as b}from"../tooltips/Tooltip.js";import{TitleSmall as I,BodyCaption as L,BodySecondary as j}from"../TypographyStyle.js";import w from"./DataSourceInfoFooter.js";import{SourceInfoDetailsStyle as T}from"./DataSourcePanel.style.js";import{CustomDataType as E}from"./model.js";const S=S=>{var O,N;const{storeId:k,messageSource:D,setMessageSourcePanel:A,hideCloseButton:_,faqCount:B=0,isSourceInfoFetched:F,allSourceInfoDetail:K,ChecklistType:P,IntentComponentMap:W,title:q,zeroStateButton:M,editableSources:H,redirect:Q,trainingSourceCount:$,ShowTrainingDataSource:R,footerButtonOption:U}=S,{sources:X}=D,z=["blog","article","page","policy"],[G,V]=h(!1),[J,Y]=h(!1);m((()=>{var e,t,i,o;(null==D?void 0:D.messageId)&&(V(!0),setTimeout((()=>V(!1)),200),Y(!1!==(null===(t=null===(e=D.sources)||void 0===e?void 0:e[0])||void 0===t?void 0:t.isTrainable)||!!(null===(o=null===(i=D.sources)||void 0===i?void 0:i[0])||void 0===o?void 0:o.insights)))}),[null==D?void 0:D.messageId]);const Z=e=>!(0!==e.length&&!(null==D?void 0:D.isUnsatisfactoryAnswer)),ee=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;return"custom"==e?e=E.FILES:z.includes(e)?e=E.FETCHED_LINKS:"url"==e?e=E.WEBSITE_LINKS:"text"===e?e=E.TEXTS:"faq"===e&&(e=E.FAQ),t?e:null===(i=null==e?void 0:e.toLowerCase())||void 0===i?void 0:i.replace(/_/g," ")};return G||!F?e(T,{children:e(C,{boxes:[{width:"100px",height:"16px"},{width:"0",height:"4px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"0",height:"4px"},{width:"100%",height:"16px"}]})}):e(t,{children:e(T,{children:!!(null==X?void 0:X.length)&&i(t,{children:[i("div",Object.assign({className:"pop-up-header",style:{display:"flex",flexDirection:"column",paddingBottom:"12px"}},{children:[!!q&&e(I,{children:q}),i("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",alignItems:"center"}},{children:[e(L,Object.assign({color:v.content.secondary},{children:"Intent"})),null!==(O=W[D.intent])&&void 0!==O?O:W.GENERIC,!_&&e("div",Object.assign({style:{display:"flex",marginLeft:"auto",cursor:"pointer"},onClick:()=>A(void 0)},{children:e(s,{height:20,width:20,color:v.content.secondary})}))]})),Z(X)?e("div",Object.assign({style:{display:"flex",margin:"auto",justifyContent:"center",alignItems:"center",height:"calc(100vh - 300px)"}},{children:(()=>{var t,o;return i("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",margin:"0px 30px",gap:"8px"}},{children:[e("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"12px",backgroundColor:`${v.background.negative.light}`,borderRadius:"100px"}},{children:e(a,{width:24,height:24,color:v.stroke.negative.vibrant})})),e("div",Object.assign({style:{justifyContent:"center",alignItems:"center",marginBottom:"-4px"}},{children:e(I,{children:"Insufficient data"})})),e(j,Object.assign({color:v.content.secondary,style:{display:"flex",justifyContent:"center",textAlign:"center"}},{children:"No data available to answer this query. Add an FAQ to address it in the future"})),M&&e("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e(f,{LeadingIcon:null!==(t=M.leadingIcon)&&void 0!==t?t:c,buttonText:null!==(o=M.title)&&void 0!==o?o:"Add FAQ",buttonType:"secondary",size:"small",matchParentWidth:!0,onClick:()=>{M.onClick()}})}))]}))})()})):e(x,{LeadingIcon:a,version:"2.0",type:"grey",theme:"light",alignIcon:"start",contentPadding:12,tagText:D.isEditable?"If any of the information is incorrect, update the original data source and sync it again. Alternatively, you can make local corrections directly in Manifest.":"Edit the original source and save again to update the response"})]})),!Z(X)&&e("div",Object.assign({className:"info-container"},{children:e("div",Object.assign({style:{padding:"0 8px",maxWidth:"100%"}},{children:X.map(((s,a)=>{var c,h,m,f,C,x,I,w,T,S,O,N,k,D;const A=ee(s.type||s.subTitle||"OpenAI"),_=ee(s.type||s.subTitle||"OpenAI",!0),B=(F=A)?"faq"==F.toLocaleLowerCase()?"FAQ":"openai"==F.toLocaleLowerCase()?"OPENAI":"files"==F.toLocaleLowerCase()?"PDF":"texts"==F.toLocaleLowerCase()?"Custom text":((F=(F=F.charAt(0).toUpperCase()+F.slice(1).toLowerCase()).replace("_"," ")).endsWith("s")&&(F=F.slice(0,-1)),F.replace("Website","Manual")):"";var F;const W=null==H?void 0:H.includes(_),q="Products"===s.subTitle?K[null!==(c=s.productId)&&void 0!==c?c:"Products"]:K[null!==(h=s.docId)&&void 0!==h?h:""],M=_.toLowerCase()===(null===(m=E.FAQ)||void 0===m?void 0:m.toLowerCase())?"faq"===(null===(f=s.title)||void 0===f?void 0:f.toLowerCase())?s.subTitle:s.title:_.toLowerCase()===(null===(C=E.FILES)||void 0===C?void 0:C.toLowerCase())||_.toLowerCase()===(null===(x=E.FETCHED_LINKS)||void 0===x?void 0:x.toLowerCase())||_.toLowerCase()===(null===(I=E.TEXTS)||void 0===I?void 0:I.toLowerCase())?s.title:_.toLowerCase()===(null===(w=E.WEBSITE_LINKS)||void 0===w?void 0:w.toLowerCase())?s.title.split("/")[s.title.split("/").length-1].replace(/[^\w\s]/gi," ").replace(/^(.)(.*)$/,((e,t,i)=>t.toUpperCase()+i)):s.intent===P.EMAIL_COLLECTION?B:s.title,$="faq"===_.toLowerCase()?null===(T=null==q?void 0:q.data)||void 0===T?void 0:T.answer:_.toLowerCase()===(null===(S=E.FETCHED_LINKS)||void 0===S?void 0:S.toLowerCase())||_.toLowerCase()===(null===(O=E.WEBSITE_LINKS)||void 0===O?void 0:O.toLowerCase())||_.toLowerCase()===(null===(N=E.TEXTS)||void 0===N?void 0:N.toLowerCase())?null!==(D=null===(k=null==q?void 0:q.data)||void 0===k?void 0:k.fileContentText)&&void 0!==D?D:"":s.intent===P.EMAIL_COLLECTION?"Collect leads before replying to messages":"";return i("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"24px 0px",borderBottom:`1px solid ${v.stroke.primary}`}},{children:[i("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[e("div",Object.assign({style:{flex:1}},{children:e(b,Object.assign({body:M,placement:"top"},{children:e(j,Object.assign({style:_==E.FETCHED_LINKS||_==E.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:v.content.primary,className:"clamp-title",onClick:()=>_==E.FETCHED_LINKS||_==E.WEBSITE_LINKS?Q(s):{}},{children:M}))}))})),i("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[s.intent!==P.EMAIL_COLLECTION&&i(t,{children:[(U=A,e("products"==U?o:"files"==U?r:"website links"==U||"fetched links"==U?g:"faq"==U?l:"texts"==U?u:d,{height:16,width:16,color:v.content.secondary})),e(L,Object.assign({color:v.content.secondary},{children:B}))]}),(s.link||s.docId)&&e("div",Object.assign({style:{cursor:"pointer",marginLeft:"4px"}},{children:e(y,W?{Icon:n,height:16,width:16,bordered:!0,onClick:()=>null==q?void 0:q.onEditClick(q.data,q.type),disabled:!q,disabledTooltip:"This source is deleted"}:{Icon:p,height:16,width:16,bordered:!0,disabled:"custom"===s.type&&!q,disabledTooltip:"This source is deleted",onClick:()=>Q(s)})}))]}))]})),(null!=$?$:"").trim()&&e("div",Object.assign({style:{padding:"4px 8px",border:`1px dashed ${v.stroke.primary}`,borderRadius:"4px",backgroundColor:v.surface.subdued}},{children:e(L,Object.assign({color:v.content.primary,className:"clamp-description"},{children:(R=null!=$?$:"",R.replace(/(<([^>]+)>)/gi,"")).trim()}))}))]}),`info-${a}`);var R,U}))}))})),J&&!Z(X)&&e("div",Object.assign({className:"footer"},{children:e(w,{storeId:k,messageSource:D,sourceIntent:null!==(N=D.intent)&&void 0!==N?N:P.GENERIC,faqCount:B,trainingSourceCount:$,ShowTrainingDataSource:R,ChecklistType:P,footerButtonOption:U})}))]})})})};export{S as DataSourcePanel};
@@ -1,4 +1,3 @@
1
1
  export declare const SourceInfoDetailsStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
2
2
  export declare const WithoutContentSourceInfoDetailsStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
3
3
  export declare const SourceInfoFooterStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
4
- export declare const DataSourceCountStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -1,48 +1,11 @@
1
- import e from"styled-components";import{COLORS as o}from"../../constants/Theme.js";const r=e.div`
1
+ import e from"styled-components";import{COLORS as o}from"../../constants/Theme.js";const i=e.div`
2
2
  display: flex;
3
3
  margin: 0px 8px 0px 8px;
4
4
  padding: 20px 0px 20px 0px;
5
5
  flex-direction: column;
6
6
  max-height: calc(100vh - 130px);
7
7
  .info-container {
8
- display: flex;
9
- flex-direction: column;
10
8
  border-radius: 8px;
11
- gap: 12px;
12
- }
13
- .info-content-source {
14
- border-radius: 8px;
15
- display: flex;
16
- flex-direction: column;
17
- gap: 8px;
18
- background-color: ${o.surface.hovered};
19
- .source {
20
- border-radius: 12px;
21
- }
22
- }
23
- .info-product-source {
24
- border-radius: 8px;
25
- display: flex;
26
- flex-direction: column;
27
- gap: 8px;
28
- background-color: ${o.surface.hovered};
29
-
30
- .product-data-text1 {
31
- padding: 2px;
32
- text-decoration: underline;
33
- color: ${o.content.secondary};
34
- cursor: pointer;
35
- &:active {
36
- background-color: ${o.surface.hovered};
37
- }
38
- }
39
- .product-data-text2 {
40
- padding: 2px;
41
- color: ${o.content.secondary};
42
- }
43
- .source {
44
- border-radius: 12px;
45
- }
46
9
  }
47
10
  .pop-up-header {
48
11
  padding: 6px 8px;
@@ -137,7 +100,7 @@ import e from"styled-components";import{COLORS as o}from"../../constants/Theme.j
137
100
  -webkit-box-orient: vertical;
138
101
  white-space: pre-line;
139
102
  }
140
- `;const i=e.div`
103
+ `;const r=e.div`
141
104
  display: flex;
142
105
  flex-direction: column;
143
106
  gap: 8px;
@@ -157,13 +120,4 @@ import e from"styled-components";import{COLORS as o}from"../../constants/Theme.j
157
120
  display: flex;
158
121
  gap: 8px;
159
122
  }
160
- `;e.div`
161
- display: flex;
162
- align-items: center;
163
- justify-content: center;
164
- width: 24px;
165
- height: 24px;
166
- background-color: ${o.surface.subdued};
167
- border-radius: 22px;
168
- border: 1px solid ${o.stroke.primary};
169
- `;export{r as SourceInfoDetailsStyle,i as SourceInfoFooterStyle};
123
+ `;export{i as SourceInfoDetailsStyle,r as SourceInfoFooterStyle};
@@ -124,19 +124,12 @@ export interface LiveChatCTA {
124
124
  buttonType: string;
125
125
  }
126
126
  export interface footerButtonOptionModel {
127
+ title?: string;
128
+ subtitle?: string;
129
+ buttonTitle: string;
130
+ addFaqProps?: any;
131
+ redirectUrl?: string;
127
132
  hideAddDataButton?: boolean;
128
- navigate?: (pagePathKey: string, params?: object, queryParam?: object, openInNewTab?: boolean) => void;
129
- onClick: ({ buttonTitle, redirectUrl, addFaqProps, }: {
130
- buttonTitle: string;
131
- redirectUrl?: string;
132
- addFaqProps?: any;
133
- }) => void;
134
- }
135
- export interface ProductSourceData {
136
- [keys: string]: {
137
- description: string;
138
- metafield: string[];
139
- faqs: CustomDataFaqModel[];
140
- onEditFaqClick: (faqs: CustomDataFaqModel[]) => void;
141
- };
133
+ navigate?: (pagePathKey: Record<string, string>, params?: object, queryParam?: object, openInNewTab?: boolean) => void;
134
+ onClick: () => void;
142
135
  }
@@ -1,7 +1,10 @@
1
1
  import React from 'react';
2
2
  import { CalendarProps } from 'react-calendar';
3
3
  import { CSSProperties } from 'styled-components';
4
- import { DateButtonType } from './model';
4
+ export declare enum DateButtonType {
5
+ DEFAULT = "default",
6
+ LARGE = "large"
7
+ }
5
8
  export declare const DatePickerWrapper: React.FC<{
6
9
  val?: Date | Date[];
7
10
  onChange: (val: Date | Date[]) => void;
@@ -1 +1 @@
1
- import{jsxs as t,Fragment as e,jsx as r}from"react/jsx-runtime";import{useState as o,useRef as n}from"react";import a from"react-calendar";import{useOutside as i}from"../../hooks/useOutside.js";import l from"../../utils/DateUtils.js";import{COLORS as s}from"../../constants/Theme.js";import c from"../../assets/icons/calendar.svg.js";import{BodyPrimary as d,BodySecondary as m}from"../TypographyStyle.js";import{DateBtn as u,PickerContainer as g}from"./DatePickerWrapper.styled.js";import{DateButtonType as p}from"./model.js";const D=D=>{let{val:y,onChange:v,calendarProps:b,disabled:f,pickerStyles:h,nativeID:j,maxDate:S,minDate:w,dateButtonType:L,dateButtonStyles:C}=D;const[k,A]=o(!1),O=n(null),x=n(null);i(x,(()=>{A(!1)}));const T=()=>{var t,e,r,o;return y?Array.isArray(y)?(null===(t=null==y?void 0:y[0])||void 0===t?void 0:t.toString())&&(null===(e=null==y?void 0:y[1])||void 0===e?void 0:e.toString())?`${new Date(null===(r=null==y?void 0:y[0])||void 0===r?void 0:r.toString()).toLocaleDateString()}-${new Date(null===(o=null==y?void 0:y[1])||void 0===o?void 0:o.toString()).toLocaleDateString()}`:`${l.getPastDate(new Date,30).toLocaleDateString()}-${(new Date).toLocaleDateString()}`:new Date(y.toString()).toLocaleDateString():(new Date).toLocaleDateString()};return t(e,{children:[t(u,Object.assign({id:j,ref:O,bgColor:f?s.background.base:s.surface.standard,borderColor:s.stroke.primary,onClick:()=>A(!k),dateButtonType:L||p.DEFAULT,style:C},{children:[L===p.LARGE?r(d,Object.assign({style:{color:f?s.content.inactive:s.content.primary,flex:1}},{children:T()})):r(m,Object.assign({style:{color:f?s.content.inactive:s.content.primary,flex:1}},{children:T()})),r(c,{width:L===p.LARGE?24:20,height:L===p.LARGE?24:20,color:f?s.content.inactive:s.content.primary})]})),k&&!f&&r(g,Object.assign({ref:x,style:Object.assign({},h),contentPrimary:s.content.primary,subDued:s.surface.subdued,brandColor:s.background.brand,bgColor:s.surface.standard,borderColor:s.stroke.primary},{children:r(a,Object.assign({tileClassName:["custom__tile"],className:["custom__calendar"],onChange:t=>{v(t),A(!1)},maxDate:S,minDate:w,value:y?Array.isArray(y)?2===y.length?[new Date(y[0]),new Date(y[1])]:null:new Date(y):null},b))}))]})};export{D as DatePickerWrapper};
1
+ import{jsxs as t,Fragment as e,jsx as r}from"react/jsx-runtime";import{useState as o,useRef as a}from"react";import n from"react-calendar";import{useOutside as i}from"../../hooks/useOutside.js";import l from"../../utils/DateUtils.js";import{COLORS as s}from"../../constants/Theme.js";import c from"../../assets/icons/calendar.svg.js";import{BodyPrimary as d,BodySecondary as m}from"../TypographyStyle.js";import{DateBtn as u,PickerContainer as g}from"./DatePickerWrapper.styled.js";var D;!function(t){t.DEFAULT="default",t.LARGE="large"}(D||(D={}));const p=p=>{let{val:y,onChange:v,calendarProps:b,disabled:f,pickerStyles:h,nativeID:S,maxDate:j,minDate:L,dateButtonType:w,dateButtonStyles:A}=p;const[C,k]=o(!1),O=a(null),x=a(null);i(x,(()=>{k(!1)}));const E=()=>{var t,e,r,o;return y?Array.isArray(y)?(null===(t=null==y?void 0:y[0])||void 0===t?void 0:t.toString())&&(null===(e=null==y?void 0:y[1])||void 0===e?void 0:e.toString())?`${new Date(null===(r=null==y?void 0:y[0])||void 0===r?void 0:r.toString()).toLocaleDateString()}-${new Date(null===(o=null==y?void 0:y[1])||void 0===o?void 0:o.toString()).toLocaleDateString()}`:`${l.getPastDate(new Date,30).toLocaleDateString()}-${(new Date).toLocaleDateString()}`:new Date(y.toString()).toLocaleDateString():(new Date).toLocaleDateString()};return t(e,{children:[t(u,Object.assign({id:S,ref:O,bgColor:f?s.background.base:s.surface.standard,borderColor:s.stroke.primary,onClick:()=>k(!C),dateButtonType:w||D.DEFAULT,style:A},{children:[w===D.LARGE?r(d,Object.assign({style:{color:f?s.content.inactive:s.content.primary,flex:1}},{children:E()})):r(m,Object.assign({style:{color:f?s.content.inactive:s.content.primary,flex:1}},{children:E()})),r(c,{width:w===D.LARGE?24:20,height:w===D.LARGE?24:20,color:f?s.content.inactive:s.content.primary})]})),C&&!f&&r(g,Object.assign({ref:x,style:Object.assign({},h),contentPrimary:s.content.primary,subDued:s.surface.subdued,brandColor:s.background.brand,bgColor:s.surface.standard,borderColor:s.stroke.primary},{children:r(n,Object.assign({tileClassName:["custom__tile"],className:["custom__calendar"],onChange:t=>{v(t),k(!1)},maxDate:j,minDate:L,value:y?Array.isArray(y)?2===y.length?[new Date(y[0]),new Date(y[1])]:null:new Date(y):null},b))}))]})};export{D as DateButtonType,p as DatePickerWrapper};
@@ -1,4 +1,4 @@
1
- import { DateButtonType } from './model';
1
+ import { DateButtonType } from './DatePickerWrapper';
2
2
  export declare const DateBtn: import("styled-components").StyledComponent<"div", any, {
3
3
  bgColor: string;
4
4
  borderColor: string;
@@ -1,25 +1,25 @@
1
- import o from"styled-components";import{DateButtonType as r}from"./model.js";const e=o.div`
1
+ import r from"styled-components";import{DateButtonType as o}from"./DatePickerWrapper.js";const e=r.div`
2
2
  display: flex;
3
3
  padding: 5px 8px;
4
- background: ${o=>o.bgColor};
4
+ background: ${r=>r.bgColor};
5
5
  border-width: 1px;
6
6
  border-style: solid;
7
- border-color: ${o=>o.borderColor};
7
+ border-color: ${r=>r.borderColor};
8
8
  border-radius: 4px;
9
9
  flex-direction: row;
10
10
  align-items: center;
11
11
  gap: 8px;
12
12
  position: relative;
13
- height: ${o=>o.dateButtonType===r.LARGE?"48px":"32px"};
14
- `,t=o.div`
13
+ height: ${r=>r.dateButtonType===o.LARGE?"48px":"32px"};
14
+ `,a=r.div`
15
15
  position: absolute;
16
16
  top: calc(100% + 8px);
17
17
  zindex: 9;
18
18
  .custom__calendar {
19
- background: ${o=>o.bgColor};
19
+ background: ${r=>r.bgColor};
20
20
  border-width: 1px;
21
21
  border-style: solid;
22
- border-color: ${o=>o.borderColor};
22
+ border-color: ${r=>r.borderColor};
23
23
  box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.12);
24
24
  border-radius: 4px;
25
25
  }
@@ -27,7 +27,7 @@ import o from"styled-components";import{DateButtonType as r}from"./model.js";con
27
27
  .custom__tile:hover,
28
28
  .custom__tile:focus,
29
29
  .react-calendar__tile--active {
30
- background: ${o=>o.brandColor};
30
+ background: ${r=>r.brandColor};
31
31
  }
32
32
 
33
33
  .react-calendar__month-view__weekdays__weekday {
@@ -37,7 +37,7 @@ import o from"styled-components";import{DateButtonType as r}from"./model.js";con
37
37
  font-weight: 600;
38
38
  font-size: 14px;
39
39
  line-height: 20px;
40
- color: ${o=>o.contentPrimary};
40
+ color: ${r=>r.contentPrimary};
41
41
 
42
42
  abbr[title] {
43
43
  text-decoration: none !important;
@@ -45,7 +45,7 @@ import o from"styled-components";import{DateButtonType as r}from"./model.js";con
45
45
  }
46
46
 
47
47
  .react-calendar__month-view__weekdays {
48
- background: ${o=>o.subDued};
48
+ background: ${r=>r.subDued};
49
49
  }
50
50
 
51
51
  .react-calendar__navigation {
@@ -66,4 +66,4 @@ import o from"styled-components";import{DateButtonType as r}from"./model.js";con
66
66
  font-size: 20px;
67
67
  }
68
68
  }
69
- `;export{e as DateBtn,t as PickerContainer};
69
+ `;export{e as DateBtn,a as PickerContainer};
@@ -1,4 +1,3 @@
1
- import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
2
1
  import React from 'react';
3
2
  import { ICouponData } from "./type";
4
3
  import { Collection, Product } from "../product-picker/type";
@@ -28,7 +27,6 @@ export interface DiscountDialogueI {
28
27
  fetchCollections: any;
29
28
  fetchProducts: any;
30
29
  storeId: string;
31
- appType?: ApplicationType;
32
30
  };
33
31
  errorMsg?: string;
34
32
  loading?: boolean;
@@ -1 +1 @@
1
- import{jsx as e,jsxs as i,Fragment as t}from"react/jsx-runtime";import"../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js";import{useState as o,useEffect as n}from"react";import{DISCOUNT_TYPES as l,MIN_PURCHASE_REQUIREMENT as r,DISCOUNT_APPLIES_TO as d,OFFER_APPLIES_TO as a,initialStaticCouponErrorState as c,initialDynamicCouponErrorState as s,COUPON_EXPIRATION as u,DISCOUNT_TARGET_TYPES as p,DISCOUNT_TARGET_SELECTION as v,DISCOUNT_VALUE_TYPES as C}from"./type.js";import"../dropdown/DropdownPopover/index.js";import{Dropdown as b}from"../dropdown/Dropdown.js";import"../dropdown/ChipDropdown.js";import"../zeroState/ZeroState.js";import{TitleSmall as m,BodyCaption as y,TitleRegular as P}from"../TypographyStyle.js";import{DEFAULT_THEME as h}from"../../constants/Theme.js";import"../dropdown/OpenedDropdown/components/description/Description.styled.js";import"../checkBox/CheckBox.styled.js";import"../list-item/ListItem.js";import"../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js";import"../dropdown/OpenedDropdown/components/menu/MenuItem.js";import"../dropdown/OpenedDropdown/components/menu/MenuList.styled.js";import"../button/Button.js";import"../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js";import"../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js";import"../icon-button/IconButton.js";import"../input/Input.js";import"../dropdown/MenuItem/MenuItem.js";import{StyledModal as I}from"../modals/styledModal.js";import{ProductPickerContent as f}from"../product-picker/ProductPickerModal.js";import{Tag as T}from"../tag/Tag.js";import{Tooltip as E}from"../tooltips/Tooltip.js";import O from"../../assets/icons/gift_icon.svg.js";import S from"../../assets/icons/percentage_icon.svg.js";import g from"../../assets/icons/shipping_icon.svg.js";import _ from"../../assets/icons/triangle_error.svg.js";import V from"../../assets/icons/warning.svg.js";import{ProductPickerModal as A}from"../product-picker-v2/modal.js";import{PickerType as D}from"../variable-picker-v3/model.js";import{VariablePicker as j}from"../variable-picker-v3/VariablePicker.js";import{StyledDiscountDialogueContainer as k,CouponTypeContainerStyled as N,VariablePickerContainer as x}from"./DiscountModal.styled.js";import{validateDiscountData as F,descriptionBuilder as w}from"./DiscountUtils.js";import R,{DISCOUNT_PRODUCTS as M}from"./DynamicCoupon/DynamicCoupon.js";import q from"./StaticCoupon/StaticCoupon.js";import{__exports as L}from"../../_virtual/bik-store.js";const U=U=>{var B,G,Y,X,Q,H,z,K,$,Z,J;const W=[{id:"0",label:"Amount",value:"amount",icon:i=>e("span",Object.assign({style:{fontSize:20,color:i,lineHeight:.9}},{children:U.currency||""}))},{id:"1",label:"Percentage",value:"percentage",icon:i=>e(S,{width:24,height:24,color:i})},{id:"2",label:"Buy X get Y",value:l.BUY_X_GET_Y,icon:i=>e(O,{width:24,height:24,color:i})},{id:"3",label:"Free Shipping",value:l.FREE_SHIPPING,icon:i=>e(g,{width:24,height:24,color:i})}],[ee,ie]=o(),[te,oe]=o(),[ne,le]=o(),[re,de]=o(null!==(B=U.data)&&void 0!==B?B:"string"==typeof U.hideOption?{isStaticCoupon:"dynamic"===U.hideOption}:{isStaticCoupon:!0}),[ae,ce]=o(!0),[se,ue]=o(),[pe,ve]=o((null===(G=U.data)||void 0===G?void 0:G.minAmount)?r.AMOUNT:(null===(Y=U.data)||void 0===Y?void 0:Y.minQuantity)?r.QUANTITY:r.NA),[Ce,be]=o(d.ENTIRE_ORDER),[me,ye]=o(a.SPECIFIC_PRODUCTS),[Pe,he]=o(a.SPECIFIC_PRODUCTS),[Ie,fe]=o(void 0),[Te,Ee]=o(void 0),[Oe,Se]=o(void 0),[ge,_e]=o(void 0),[Ve,Ae]=o(void 0),[De,je]=o(void 0),[ke,Ne]=o(0),[xe,Fe]=o(""),[we,Re]=o(W[0]),[Me,qe]=o(!1),[Le,Ue]=o(c),[Be,Ge]=o(s),[Ye,Xe]=o(u.DYNAMIC_EXPIRATION),Qe=[{value:l.AMOUNT_OFF_ORDER,label:"Amount off on order",selected:se===l.AMOUNT_OFF_ORDER},{value:l.AMOUNT_OFF_PRODUCTS,label:"Amount off on products",selected:se===l.AMOUNT_OFF_PRODUCTS},{value:l.BUY_X_GET_Y,label:"Buy X Get Y FREE",selected:se===l.BUY_X_GET_Y},{value:l.FREE_SHIPPING,label:"Free shipping",selected:se===l.FREE_SHIPPING}];n((()=>{U.makeExpiryMandatory&&qe(!0)}),[U.makeExpiryMandatory]),n((()=>{var e,i,t,o,n,r,c,s;let p;const{tempCouponData:v,discountType:b}=He();ue(b);const m=(e,i)=>{Re(v.valueType===C.FIXED_AMOUNT?W[e]:W[i])},y=(e,i)=>{Object.keys(e||{}).length&&i(e)};switch(((null==v?void 0:v.expireAfter)||(null==v?void 0:v.expireAt))&&(qe(!0),(null==v?void 0:v.expireAt)&&Xe(u.FIXED_EXPIRATION),(null==v?void 0:v.expireAfter)&&Xe(u.DYNAMIC_EXPIRATION)),b){case l.AMOUNT_OFF_ORDER:m(0,1),be(d.ENTIRE_ORDER);break;case l.AMOUNT_OFF_PRODUCTS:m(0,1),(null===(e=v.entitledCollectionIds)||void 0===e?void 0:e.length)?be(d.SPECIFIC_COLLECTIONS):(null===(i=v.entitledProductIds)||void 0===i?void 0:i.length)||(null===(t=v.productVariableConf)||void 0===t?void 0:t.entitledProductVariable)?(be(d.SPECIFIC_PRODUCTS),y(null===(o=v.productVariableConf)||void 0===o?void 0:o.entitledProductVariable,_e)):be(d.ENTIRE_ORDER);break;case l.BUY_X_GET_Y:Re(W[2]),(null===(n=v.entitledCollectionIds)||void 0===n?void 0:n.length)?he(a.SPECIFIC_COLLECTIONS):(he(a.SPECIFIC_PRODUCTS),y(null===(r=v.productVariableConf)||void 0===r?void 0:r.entitledProductVariable,_e)),(null===(c=v.prerequisiteCollectionIds)||void 0===c?void 0:c.length)?ye(a.SPECIFIC_COLLECTIONS):(ye(a.SPECIFIC_PRODUCTS),y(null===(s=v.productVariableConf)||void 0===s?void 0:s.prerequisiteProductVariable,Ae));break;case l.FREE_SHIPPING:Re(W[3])}de(Object.assign({},v)),U.hideProbability||(p=$e()),ce(F(v,pe,b,U.hideProbability||!1,p,!!v.isStaticCoupon)),U.hideProbability||$e()}),[]),n((()=>{let e;U.hideProbability||(e=$e()),ce(F(re,pe,se,U.hideProbability||!1,e,!!re.isStaticCoupon))}),[re,ke,se,pe]),n((()=>{var e,i,t,o,n,l,r;if(!U.newPickerConf&&((null===(e=U.products)||void 0===e?void 0:e.length)||(null===(i=U.collection)||void 0===i?void 0:i.length))){if(U.products&&(null===(t=U.products)||void 0===t?void 0:t.length)){if(null===(o=U.data)||void 0===o?void 0:o.entitledProductIds){const e=U.products.filter((e=>{var i,t;return null===(t=null===(i=U.data)||void 0===i?void 0:i.entitledProductIds)||void 0===t?void 0:t.includes(parseInt(e.id))}));Ee(e)}if(null===(n=U.data)||void 0===n?void 0:n.prerequisiteProductIds){const e=U.products.filter((e=>{var i,t;return null===(t=null===(i=U.data)||void 0===i?void 0:i.prerequisiteProductIds)||void 0===t?void 0:t.includes(parseInt(e.id))}));fe(e)}}if(U.collection&&U.collection.length){if(null===(l=U.data)||void 0===l?void 0:l.entitledCollectionIds){const e=U.collection.filter((e=>{var i,t;return null===(t=null===(i=U.data)||void 0===i?void 0:i.entitledCollectionIds)||void 0===t?void 0:t.includes(parseInt(e.id))}));je(e)}if(null===(r=U.data)||void 0===r?void 0:r.prerequisiteCollectionIds){const e=U.collection.filter((e=>{var i,t;return null===(t=null===(i=U.data)||void 0===i?void 0:i.prerequisiteCollectionIds)||void 0===t?void 0:t.includes(parseInt(e.id))}));Se(e)}}}}),[U.products,U.collection]),n((()=>{var e,i,t,o,n,l,r,d;(null===(i=null===(e=U.data)||void 0===e?void 0:e.productsConf)||void 0===i?void 0:i.entitledProducts)&&Ee(U.data.productsConf.entitledProducts),(null===(o=null===(t=U.data)||void 0===t?void 0:t.productsConf)||void 0===o?void 0:o.prerequisiteProducts)&&fe(U.data.productsConf.prerequisiteProducts),(null===(l=null===(n=U.data)||void 0===n?void 0:n.collectionsConf)||void 0===l?void 0:l.entitledCollections)&&je(U.data.collectionsConf.entitledCollections),(null===(d=null===(r=U.data)||void 0===r?void 0:r.collectionsConf)||void 0===d?void 0:d.prerequisiteCollections)&&Se(U.data.collectionsConf.prerequisiteCollections)}),[null===(X=U.data)||void 0===X?void 0:X.productsConf,null===(Q=U.data)||void 0===Q?void 0:Q.collectionsConf]),n((()=>{if(!Te)return;if(U.newPickerConf){const e=[];return Object.values(Te).forEach((i=>{i.products&&Object.keys(i.products).forEach((i=>{e.push(parseInt(i))}))})),void de(Object.assign(Object.assign({},re),{entitledProductIds:e}))}const e=Te.map((e=>parseInt(e.id)));de(Object.assign(Object.assign({},re),{entitledProductIds:e}))}),[Te]),n((()=>{if(!Ie)return;if(U.newPickerConf){const e=[];return Object.values(Ie).forEach((i=>{i.products&&Object.keys(i.products).forEach((i=>{e.push(parseInt(i))}))})),void de(Object.assign(Object.assign({},re),{prerequisiteProductIds:e}))}const e=Ie.map((e=>parseInt(e.id)));de(Object.assign(Object.assign({},re),{prerequisiteProductIds:e}))}),[Ie]),n((()=>{if(!De)return;if(U.newPickerConf){(null==De?void 0:De.isCustom)&&delete De.isCustom;const e=Object.keys(De).map((e=>parseInt(e)));return void de(Object.assign(Object.assign({},re),{entitledCollectionIds:e}))}const e=De.map((e=>parseInt(e.id)));de(Object.assign(Object.assign({},re),{entitledCollectionIds:e}))}),[De]),n((()=>{if(!Oe)return;if(U.newPickerConf){(null==Oe?void 0:Oe.isCustom)&&delete Oe.isCustom;const e=Object.keys(Oe).map((e=>parseInt(e)));return void de(Object.assign(Object.assign({},re),{prerequisiteCollectionIds:e}))}const e=Oe.map((e=>parseInt(e.id)));de(Object.assign(Object.assign({},re),{prerequisiteCollectionIds:e}))}),[Oe]);const He=()=>{var e,i;let t,o=re;return re.isStaticCoupon||(re.targetType===p.SHIPPING_LINE?t=l.FREE_SHIPPING:re.targetType===p.LINE_ITEM?t=re.targetSelection===v.ENTITLED?(null===(e=re.prerequisiteProductIds)||void 0===e?void 0:e.length)||(null===(i=re.prerequisiteCollectionIds)||void 0===i?void 0:i.length)||re.prerequisiteQuantity||re.entitledQuantity?l.BUY_X_GET_Y:l.AMOUNT_OFF_PRODUCTS:l.AMOUNT_OFF_ORDER:(o=Object.assign(Object.assign({},o),{targetType:p.LINE_ITEM,targetSelection:v.ALL,valueType:C.FIXED_AMOUNT}),t=l.AMOUNT_OFF_ORDER)),{discountType:t,tempCouponData:o}},ze=()=>{Ue(c),Ge(s)},Ke=e=>{var i;const t={invalidDiscountCode:"Please add Discount Code",invalidCouponTitle:"Please add Discount Coupon Title",invalidCouponDescription:"Please add Coupon Description",inValidProbability:e.inValidProbability&&(null!==(i=re.probability)&&void 0!==i?i:-1)>1?"Probability should not exceed 1":re.isStaticCoupon?"Please add Probability":"Probability should be greater than 0",inValidDiscountAmount:"Please add Discount Amount",inValidMinimumAmount:"Specify minimum amount required",inValidMinimumQuantity:"Specify minimum items required",inValidCouponExpiry:"Please add Coupon Expiry",inValidProductSelection:"Please specify the products",inValidProductVariableSelection:"Please specify the product variables",inValidCollectionSelection:"Please specify the collections",inValidBuyXValue:"Please specify buy product quantity",inValidGetYValue:"Please specify get product quantity",inValidBuyXProductSelection:"Please specify the products",inValidBuyXCollectionSelection:"Please specify the collections",inValidGetYProductSelection:"Please specify the products",inValidGetYCollectionSelection:"Please specify the collections",inValidBuyXProductVariableSelection:"Please specify the product variables",inValidGetYProductVariableSelection:"Please specify the product variables"};let o="";Object.keys(e).forEach((i=>{e[i]&&(o=t[i])}));const n=Object.values(e).filter(Boolean).length;return n>0&&(Fe(n>1?"Please add discount details":o),!0)},$e=()=>{if(!U.quadrant||!U.probability)return;const e=[...U.probability];let i=[];e.length>=U.quadrant&&e.splice(U.quadrant-1,1),i=e;const t=i.reduce(((e,i)=>e+i),0)+(re.probability||0);return Ne(parseFloat(t.toFixed(4))),parseFloat(t.toFixed(4))},Ze=e=>{var i,t,o,n,r,d,a,c,s,u,b,m,y,P,h,I;const f=e.value;ue(f),fe([]),Ee([]),Se([]),je([]),f===l.FREE_SHIPPING?de({value:100,targetSelection:v.ALL,targetType:p.SHIPPING_LINE,valueType:C.PERCENTAGE,quadrant:re.quadrant,isStaticCoupon:!1,title:re.title,expireAt:null!==(i=re.expireAt)&&void 0!==i?i:void 0,expireAfter:null!==(t=re.expireAfter)&&void 0!==t?t:void 0,probability:re.probability,minQuantity:null!==(o=re.minQuantity)&&void 0!==o?o:void 0,minAmount:null!==(n=re.minAmount)&&void 0!==n?n:void 0}):f===l.BUY_X_GET_Y?de({value:100,targetSelection:v.ENTITLED,targetType:p.LINE_ITEM,valueType:C.PERCENTAGE,quadrant:re.quadrant,isStaticCoupon:!1,title:re.title,expireAt:null!==(r=re.expireAt)&&void 0!==r?r:void 0,expireAfter:null!==(d=re.expireAfter)&&void 0!==d?d:void 0,probability:re.probability,minQuantity:void 0,minAmount:void 0}):f===l.AMOUNT_OFF_ORDER?de({targetSelection:v.ALL,targetType:p.LINE_ITEM,valueType:null!==(a=re.valueType)&&void 0!==a?a:C.FIXED_AMOUNT,quadrant:re.quadrant,isStaticCoupon:!1,title:re.title,expireAt:null!==(c=re.expireAt)&&void 0!==c?c:void 0,expireAfter:null!==(s=re.expireAfter)&&void 0!==s?s:void 0,probability:re.probability,value:re.value,minQuantity:null!==(u=re.minQuantity)&&void 0!==u?u:void 0,minAmount:null!==(b=re.minAmount)&&void 0!==b?b:void 0}):f===l.AMOUNT_OFF_PRODUCTS&&de({targetSelection:v.ENTITLED,targetType:p.LINE_ITEM,valueType:null!==(m=re.valueType)&&void 0!==m?m:C.FIXED_AMOUNT,quadrant:re.quadrant,isStaticCoupon:!1,title:re.title,expireAt:null!==(y=re.expireAt)&&void 0!==y?y:void 0,expireAfter:null!==(P=re.expireAfter)&&void 0!==P?P:void 0,probability:re.probability,value:re.value,minQuantity:null!==(h=re.minQuantity)&&void 0!==h?h:void 0,minAmount:null!==(I=re.minAmount)&&void 0!==I?I:void 0})},Je=i=>i&&e(T,{theme:"light",tagText:i,type:"negative",LeadingIcon:V});return i(I,Object.assign({width:(ne||ee)&&U.newPickerConf?"25px":"640px",open:U.isOpen,hideCrossButton:!!te,headingTitle:ee?"Select Products":U.title,headingSubtitle:ee?void 0:U.subTitle,footerLeftCustomElement:xe?Je(xe):U.errorMsg?Je(U.errorMsg):!U.quadrant||U.hideProbability?e(t,{}):ke<=1?e(T,{theme:"light",tagText:`Current probability sum: ${ke}`,type:"white"}):e(E,Object.assign({body:"Probability sum should not exceed 1",placement:"top"},{children:e("div",{children:e(T,{style:{cursor:"pointer"},theme:"light",tagText:`Current probability sum: ${ke}`,type:"negative",LeadingIcon:_})})})),headerRightCustomElement:U.allowStaticCoupon||ee?void 0:e(b,{options:Qe,width:"200px",placement:"bottom-start",size:"small",onSelect:e=>{Ze(e)}}),onClose:U.onClose,footerContainerStyle:{borderTop:`1px solid ${h.colorsV2.stroke.primary}`},primaryButton:ee?{buttonType:"primary",onClick:()=>{ie(void 0)},buttonText:"Add"}:ne?{buttonType:"primary",onClick:()=>{le(void 0)},buttonText:"Add"}:{buttonType:"primary",buttonText:"Create discount code",isLoading:null!==(H=U.loading)&&void 0!==H&&H,onClick:()=>{var e,i,t,o,n;if(ze(),re.isStaticCoupon){const{isStaticCoupon:e,couponCode:i,title:t,description:o,quadrant:n,probability:l}=re,r={invalidDiscountCode:!i,invalidCouponTitle:!t,invalidCouponDescription:!o,inValidProbability:!U.hideProbability&&(null!=l?l:-1)<0||(null!=l?l:0)>1||Number.isNaN(null!=l?l:0)};if(Ke(r))return void Ue(r);if(ae||ke>1)return void Fe(!U.hideProbability&&ke>1?"Probability sum should not exceed 1":"Invalid coupon details");U.onSaveClicked({quadrant:n,couponCode:i,description:o,isStaticCoupon:e,probability:l,title:re.title})}else{const c={invalidCouponTitle:!re.title,inValidProbability:!U.hideProbability&&(null!==(e=re.probability)&&void 0!==e?e:-1)<=0||(null!==(i=re.probability)&&void 0!==i?i:-1)>1||Number.isNaN(null!==(t=re.probability)&&void 0!==t?t:-1),inValidDiscountAmount:!re.value,inValidMinimumQuantity:!1,inValidMinimumAmount:!1,inValidCouponExpiry:!1,inValidProductSelection:!1,inValidProductVariableSelection:!1,inValidCollectionSelection:!1,inValidBuyXValue:!1,inValidGetYValue:!1,inValidBuyXProductSelection:!1,inValidGetYProductSelection:!1,inValidBuyXCollectionSelection:!1,inValidGetYCollectionSelection:!1,inValidBuyXProductVariableSelection:!1,inValidGetYProductVariableSelection:!1};if(se!==l.BUY_X_GET_Y&&pe!==r.NA){const{minAmount:e,minQuantity:i}=re;c.inValidMinimumAmount=pe===r.AMOUNT&&!e,c.inValidMinimumQuantity=pe===r.QUANTITY&&!i}if(Me&&(c.inValidCouponExpiry=!re.expireAt&&!re.expireAfter),se!==l.AMOUNT_OFF_ORDER&&se!==l.AMOUNT_OFF_PRODUCTS||(Ce!==d.SPECIFIC_PRODUCTS||!Te||Object.keys(Te).length||ge||(c.inValidProductSelection=!0,c.inValidProductVariableSelection=!0),Ce===d.SPECIFIC_COLLECTIONS&&De&&!Object.keys(De).length&&(c.inValidCollectionSelection=!0)),se===l.BUY_X_GET_Y&&(re.prerequisiteQuantity||(c.inValidBuyXValue=!0),re.entitledQuantity||(c.inValidGetYValue=!0),me!==a.SPECIFIC_PRODUCTS||!Ie||Object.keys(Ie).length||Ve||(c.inValidBuyXProductSelection=!0,c.inValidBuyXProductVariableSelection=!0),me===a.SPECIFIC_COLLECTIONS&&Oe&&!Object.keys(Oe).length&&(c.inValidBuyXCollectionSelection=!0),Pe!==a.SPECIFIC_PRODUCTS||!Te||Object.keys(Te).length||ge||(c.inValidGetYProductSelection=!0,c.inValidGetYProductVariableSelection=!0),Pe===a.SPECIFIC_COLLECTIONS&&De&&!Object.keys(De).length&&(c.inValidGetYCollectionSelection=!0)),Ke(c))return void Ge(c);if(ae||ke>1)return void Fe(!U.hideProbability&&ke>1?"Probability sum should not exceed 1":"Invalid coupon details");U.onSaveClicked(Object.assign(Object.assign({},re),{description:w(re,U.currency,null!==(o=U.products)&&void 0!==o?o:[],null!==(n=U.collection)&&void 0!==n?n:[]),productsConf:{entitledProducts:null!=Te?Te:[],prerequisiteProducts:null!=Ie?Ie:[]},collectionsConf:{entitledCollections:null!=De?De:[],prerequisiteCollections:null!=Oe?Oe:[]},productVariableConf:{entitledProductVariable:null!=ge?ge:{},prerequisiteProductVariable:null!=Ve?Ve:{}}}))}}},secondaryButton:ee?{buttonType:"tertiaryGray",onClick:()=>{ie(void 0)},buttonText:"Back"}:ne?{buttonType:"tertiaryGray",onClick:()=>{le(void 0)},buttonText:"Back"}:{buttonType:"tertiaryGray",onClick:U.onClose,buttonText:"Cancel"}},{children:[!ee&&!ne&&i(k,{children:[U.allowStaticCoupon&&!ee&&i(N,Object.assign({selectedDiv:re.isStaticCoupon?1:2},{children:["static"===U.hideOption?e(t,{}):i("div",Object.assign({className:"coupon-type__container",onClick:()=>{re.isStaticCoupon||(de({isStaticCoupon:!0,quadrant:re.quadrant}),Fe(""),ze())}},{children:[e(m,Object.assign({style:{marginBottom:"4px",color:re.isStaticCoupon?h.colorsV2.content.brand:void 0}},{children:"Static Code"})),e(y,Object.assign({style:re.isStaticCoupon?{color:h.colorsV2.content.brand}:{}},{children:"A uniform code provided manually, used for providing the same discount to all customers."}))]})),"dynamic"===U.hideOption?e(t,{}):i("div",Object.assign({className:"coupon-type__container",onClick:()=>{var i;re.isStaticCoupon&&(ue(l.AMOUNT_OFF_ORDER),de({isStaticCoupon:!1,quadrant:re.quadrant,targetType:p.LINE_ITEM,targetSelection:v.ALL,valueType:C.FIXED_AMOUNT}),Fe(""),ze(),Re({id:"0",label:"Amount",value:"amount",icon:i=>e("span",Object.assign({style:{fontSize:20,color:i}},{children:U.currency||""}))}),qe(null!==(i=U.makeExpiryMandatory)&&void 0!==i&&i),ve(r.NA))}},{children:[e(m,Object.assign({style:{marginBottom:"4px",color:re.isStaticCoupon?void 0:h.colorsV2.content.brand}},{children:"Dynamic Code"})),e(y,Object.assign({style:re.isStaticCoupon?{}:{color:h.colorsV2.content.brand}},{children:"Code will be unique for all customers, with the first 5 letters of the customer's name, followed by 10 random characters."}))]}))]})),e(P,Object.assign({style:{marginTop:"24px"}},{children:"Coupon Details"})),re.isStaticCoupon&&!ee&&e(q,{discountData:re,setDiscountData:de,hideProbability:U.hideProbability||!1,discountAdminUrl:U.discountAdminUrl,staticDiscountValidationError:Le,currency:U.currency}),!re.isStaticCoupon&&!ee&&!ne&&e(R,{currency:U.currency,entitledProducts:null!=Te?Te:[],prerequisiteProducts:null!=Ie?Ie:[],setEntitledProducts:Ee,setPrerequisiteProducts:fe,discountData:re,productPickerOpen:ee,productVariablePickerOpen:te,setIsProductPickerOpen:ie,setIsProductVariablePickerOpen:oe,setDiscountData:de,selectedCouponType:se,setSelectedCouponType:ue,selectedMinimumRequirement:pe,setSelectedMinimumRequirement:ve,discountCouponAppliesTo:Ce,offerAppliesToBuy:me,offerAppliesToGet:Pe,setDiscountCouponAppliesTo:be,setOfferAppliesToBuy:ye,setOfferAppliesToGet:he,hideProbability:U.hideProbability||!1,hideExpiration:U.hideExpiration||!1,allowStaticCoupon:U.allowStaticCoupon,onChangeCouponType:Ze,collectionPickerOpen:ne,entitledCollections:null!=De?De:[],prerequisiteCollections:null!=Oe?Oe:[],setIsCollectionPickerOpen:le,setEntitledCollections:je,setPrerequisiteCollections:Se,useNewPicker:!!U.newPickerConf,setSelectedDiscountDetails:Re,selectedDiscountDetails:we,isProductVariableSupported:U.isProductVariableSupported,entitledProductVariable:ge,setEntitledProductVariable:_e,preRequisiteProductVariable:Ve,setPreRequisiteProductVariable:Ae,productVariableList:U.productVariableList,isAddExpirationChecked:Me,setIsAddExpirationChecked:qe,dynamicDiscountValidationError:Be,setDynamicDiscountValidationError:Ge,setValidationErrorMessage:Fe,resetValidationErrors:ze,discountDetailsOptions:W,selectedExpiration:Ye,setSelectedExpiration:Xe,makeExpiryMandatory:!!U.makeExpiryMandatory})]}),!!ee&&i(t,{children:[!U.newPickerConf&&e("div",Object.assign({style:{padding:"12px 0"}},{children:e(f,{show:!0,onSave:()=>{},products:null!==(z=U.products)&&void 0!==z?z:[],title:"Select Products",onClose:()=>{ie(void 0)},selectedProducts:null!==(K=ee===M.ENTITLED?Te:Ie)&&void 0!==K?K:[],setSelectedProducts:ee===M.ENTITLED?Ee:fe,onSearchKeyChange:U.onProductSearch})})),U.newPickerConf&&e(A,{visible:!0,onClose:()=>ie(void 0),collectionFetcher:(e,i,t)=>{var o;return(null===(o=U.newPickerConf)||void 0===o?void 0:o.fetchCollections)?U.newPickerConf.fetchCollections(e,i,!1,t):null},productFetcher:(e,i,t,o,n)=>{var l;return(null===(l=U.newPickerConf)||void 0===l?void 0:l.fetchProducts)?U.newPickerConf.fetchProducts(e,i,o,n,!1,t):null},selectedItems:ee===M.ENTITLED?Te:Ie,onAdd:e=>{ee===M.ENTITLED?Ee(e):fe(e),ie(void 0)},zIndex:200,storeId:U.newPickerConf.storeId,appType:U.newPickerConf.appType||L.ApplicationType.BIK,searchInCollectionFetcher:(e,i,t,o)=>{var n;return(null===(n=U.newPickerConf)||void 0===n?void 0:n.searchInCollection)?U.newPickerConf.searchInCollection(e,i,t,!1,o):null},customCollectionRestriction:!1,searchFetcher:(e,i,t)=>{var o;return(null===(o=U.newPickerConf)||void 0===o?void 0:o.searchProducts)?U.newPickerConf.searchProducts(e,i,!1,t):null},hideCollectionCheckbox:!0,hideVariantCheckbox:!0,selectProductsFromCustomCollection:!0,hideSelectionCount:!0})]}),!!ne&&e("div",Object.assign({style:{padding:"12px 0"}},{children:i(t,{children:[U.newPickerConf&&e(A,{visible:!0,onClose:()=>le(void 0),collectionFetcher:U.newPickerConf.fetchCollections,productFetcher:U.newPickerConf.fetchProducts,selectedItems:ne===M.ENTITLED?De:Oe,onAdd:e=>{Object.values(e).forEach((e=>{e.products&&delete e.products})),ne===M.ENTITLED?je(e):Se(e),le(void 0)},customCollectionRestriction:!1,zIndex:200,storeId:U.newPickerConf.storeId,appType:U.newPickerConf.appType||L.ApplicationType.BIK,searchInCollectionFetcher:U.newPickerConf.searchInCollection,searchFetcher:U.newPickerConf.searchProducts,hideProductCheckbox:!0,hideVariantCheckbox:!0,title:"Select Collections",hideGlobalSearch:!0,hideSelectionCount:!0}),!U.newPickerConf&&e(f,{show:!0,onSave:()=>{},products:null!==($=U.collection)&&void 0!==$?$:[],title:"Select Products",onClose:()=>{le(void 0)},selectedProducts:null!==(Z=ne===M.ENTITLED?De:Oe)&&void 0!==Z?Z:[],setSelectedProducts:ne===M.ENTITLED?je:Se,onSearchKeyChange:U.onCollectionSearch,searchPlaceholder:"Search collections..."})]})})),te&&e(x,{children:e("div",Object.assign({style:{width:"50%",height:"100%",marginLeft:"50%"}},{children:e(j,{type:D.EMBEDDED,data:null!==(J=U.productVariableList)&&void 0!==J?J:[],showHeader:!0,onSelect:e=>{if(te===M.ENTITLED){const{displayName:i,actualValue:t,isAvailable:o}=e;_e({displayName:i,actualValue:t,isAvailable:o}),oe(void 0)}if(te===M.PREREQUISITE){const{displayName:i,actualValue:t,isAvailable:o}=e;Ae({displayName:i,actualValue:t,isAvailable:o}),oe(void 0)}},onClose:()=>{oe(void 0)}})}))})]}))};export{U as DiscountModal};
1
+ import{jsx as e,jsxs as i,Fragment as t}from"react/jsx-runtime";import{useState as o,useEffect as n}from"react";import{DISCOUNT_TYPES as l,MIN_PURCHASE_REQUIREMENT as r,DISCOUNT_APPLIES_TO as d,OFFER_APPLIES_TO as a,initialStaticCouponErrorState as c,initialDynamicCouponErrorState as s,COUPON_EXPIRATION as u,DISCOUNT_TARGET_TYPES as p,DISCOUNT_TARGET_SELECTION as v,DISCOUNT_VALUE_TYPES as C}from"./type.js";import"../dropdown/DropdownPopover/index.js";import{Dropdown as b}from"../dropdown/Dropdown.js";import"../dropdown/ChipDropdown.js";import"../zeroState/ZeroState.js";import{TitleSmall as m,BodyCaption as y,TitleRegular as P}from"../TypographyStyle.js";import{DEFAULT_THEME as h}from"../../constants/Theme.js";import"../dropdown/OpenedDropdown/components/description/Description.styled.js";import"../checkBox/CheckBox.styled.js";import"../list-item/ListItem.js";import"../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js";import"../dropdown/OpenedDropdown/components/menu/MenuItem.js";import"../dropdown/OpenedDropdown/components/menu/MenuList.styled.js";import"../button/Button.js";import"../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js";import"../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js";import"../icon-button/IconButton.js";import"../input/Input.js";import"../dropdown/MenuItem/MenuItem.js";import{StyledModal as I}from"../modals/styledModal.js";import{ProductPickerContent as f}from"../product-picker/ProductPickerModal.js";import{Tag as E}from"../tag/Tag.js";import{Tooltip as O}from"../tooltips/Tooltip.js";import T from"../../assets/icons/gift_icon.svg.js";import S from"../../assets/icons/percentage_icon.svg.js";import g from"../../assets/icons/shipping_icon.svg.js";import V from"../../assets/icons/triangle_error.svg.js";import _ from"../../assets/icons/warning.svg.js";import{ProductPickerModal as A}from"../product-picker-v2/modal.js";import{PickerType as D}from"../variable-picker-v3/model.js";import{VariablePicker as j}from"../variable-picker-v3/VariablePicker.js";import{StyledDiscountDialogueContainer as N,CouponTypeContainerStyled as k,VariablePickerContainer as x}from"./DiscountModal.styled.js";import{validateDiscountData as F,descriptionBuilder as w}from"./DiscountUtils.js";import R,{DISCOUNT_PRODUCTS as M}from"./DynamicCoupon/DynamicCoupon.js";import q from"./StaticCoupon/StaticCoupon.js";const L=L=>{var U,B,G,Y,X,Q,H,z,$,K,Z;const J=[{id:"0",label:"Amount",value:"amount",icon:i=>e("span",Object.assign({style:{fontSize:20,color:i,lineHeight:.9}},{children:L.currency||""}))},{id:"1",label:"Percentage",value:"percentage",icon:i=>e(S,{width:24,height:24,color:i})},{id:"2",label:"Buy X get Y",value:l.BUY_X_GET_Y,icon:i=>e(T,{width:24,height:24,color:i})},{id:"3",label:"Free Shipping",value:l.FREE_SHIPPING,icon:i=>e(g,{width:24,height:24,color:i})}],[W,ee]=o(),[ie,te]=o(),[oe,ne]=o(),[le,re]=o(null!==(U=L.data)&&void 0!==U?U:"string"==typeof L.hideOption?{isStaticCoupon:"dynamic"===L.hideOption}:{isStaticCoupon:!0}),[de,ae]=o(!0),[ce,se]=o(),[ue,pe]=o((null===(B=L.data)||void 0===B?void 0:B.minAmount)?r.AMOUNT:(null===(G=L.data)||void 0===G?void 0:G.minQuantity)?r.QUANTITY:r.NA),[ve,Ce]=o(d.ENTIRE_ORDER),[be,me]=o(a.SPECIFIC_PRODUCTS),[ye,Pe]=o(a.SPECIFIC_PRODUCTS),[he,Ie]=o(void 0),[fe,Ee]=o(void 0),[Oe,Te]=o(void 0),[Se,ge]=o(void 0),[Ve,_e]=o(void 0),[Ae,De]=o(void 0),[je,Ne]=o(0),[ke,xe]=o(""),[Fe,we]=o(J[0]),[Re,Me]=o(!1),[qe,Le]=o(c),[Ue,Be]=o(s),[Ge,Ye]=o(u.DYNAMIC_EXPIRATION),Xe=[{value:l.AMOUNT_OFF_ORDER,label:"Amount off on order",selected:ce===l.AMOUNT_OFF_ORDER},{value:l.AMOUNT_OFF_PRODUCTS,label:"Amount off on products",selected:ce===l.AMOUNT_OFF_PRODUCTS},{value:l.BUY_X_GET_Y,label:"Buy X Get Y FREE",selected:ce===l.BUY_X_GET_Y},{value:l.FREE_SHIPPING,label:"Free shipping",selected:ce===l.FREE_SHIPPING}];n((()=>{L.makeExpiryMandatory&&Me(!0)}),[L.makeExpiryMandatory]),n((()=>{var e,i,t,o,n,r,c,s;let p;const{tempCouponData:v,discountType:b}=Qe();se(b);const m=(e,i)=>{we(v.valueType===C.FIXED_AMOUNT?J[e]:J[i])},y=(e,i)=>{Object.keys(e||{}).length&&i(e)};switch(((null==v?void 0:v.expireAfter)||(null==v?void 0:v.expireAt))&&(Me(!0),(null==v?void 0:v.expireAt)&&Ye(u.FIXED_EXPIRATION),(null==v?void 0:v.expireAfter)&&Ye(u.DYNAMIC_EXPIRATION)),b){case l.AMOUNT_OFF_ORDER:m(0,1),Ce(d.ENTIRE_ORDER);break;case l.AMOUNT_OFF_PRODUCTS:m(0,1),(null===(e=v.entitledCollectionIds)||void 0===e?void 0:e.length)?Ce(d.SPECIFIC_COLLECTIONS):(null===(i=v.entitledProductIds)||void 0===i?void 0:i.length)||(null===(t=v.productVariableConf)||void 0===t?void 0:t.entitledProductVariable)?(Ce(d.SPECIFIC_PRODUCTS),y(null===(o=v.productVariableConf)||void 0===o?void 0:o.entitledProductVariable,ge)):Ce(d.ENTIRE_ORDER);break;case l.BUY_X_GET_Y:we(J[2]),(null===(n=v.entitledCollectionIds)||void 0===n?void 0:n.length)?Pe(a.SPECIFIC_COLLECTIONS):(Pe(a.SPECIFIC_PRODUCTS),y(null===(r=v.productVariableConf)||void 0===r?void 0:r.entitledProductVariable,ge)),(null===(c=v.prerequisiteCollectionIds)||void 0===c?void 0:c.length)?me(a.SPECIFIC_COLLECTIONS):(me(a.SPECIFIC_PRODUCTS),y(null===(s=v.productVariableConf)||void 0===s?void 0:s.prerequisiteProductVariable,_e));break;case l.FREE_SHIPPING:we(J[3])}re(Object.assign({},v)),L.hideProbability||(p=$e()),ae(F(v,ue,b,L.hideProbability||!1,p,!!v.isStaticCoupon)),L.hideProbability||$e()}),[]),n((()=>{let e;L.hideProbability||(e=$e()),ae(F(le,ue,ce,L.hideProbability||!1,e,!!le.isStaticCoupon))}),[le,je,ce,ue]),n((()=>{var e,i,t,o,n,l,r;if(!L.newPickerConf&&((null===(e=L.products)||void 0===e?void 0:e.length)||(null===(i=L.collection)||void 0===i?void 0:i.length))){if(L.products&&(null===(t=L.products)||void 0===t?void 0:t.length)){if(null===(o=L.data)||void 0===o?void 0:o.entitledProductIds){const e=L.products.filter((e=>{var i,t;return null===(t=null===(i=L.data)||void 0===i?void 0:i.entitledProductIds)||void 0===t?void 0:t.includes(parseInt(e.id))}));Ee(e)}if(null===(n=L.data)||void 0===n?void 0:n.prerequisiteProductIds){const e=L.products.filter((e=>{var i,t;return null===(t=null===(i=L.data)||void 0===i?void 0:i.prerequisiteProductIds)||void 0===t?void 0:t.includes(parseInt(e.id))}));Ie(e)}}if(L.collection&&L.collection.length){if(null===(l=L.data)||void 0===l?void 0:l.entitledCollectionIds){const e=L.collection.filter((e=>{var i,t;return null===(t=null===(i=L.data)||void 0===i?void 0:i.entitledCollectionIds)||void 0===t?void 0:t.includes(parseInt(e.id))}));De(e)}if(null===(r=L.data)||void 0===r?void 0:r.prerequisiteCollectionIds){const e=L.collection.filter((e=>{var i,t;return null===(t=null===(i=L.data)||void 0===i?void 0:i.prerequisiteCollectionIds)||void 0===t?void 0:t.includes(parseInt(e.id))}));Te(e)}}}}),[L.products,L.collection]),n((()=>{var e,i,t,o,n,l,r,d;(null===(i=null===(e=L.data)||void 0===e?void 0:e.productsConf)||void 0===i?void 0:i.entitledProducts)&&Ee(L.data.productsConf.entitledProducts),(null===(o=null===(t=L.data)||void 0===t?void 0:t.productsConf)||void 0===o?void 0:o.prerequisiteProducts)&&Ie(L.data.productsConf.prerequisiteProducts),(null===(l=null===(n=L.data)||void 0===n?void 0:n.collectionsConf)||void 0===l?void 0:l.entitledCollections)&&De(L.data.collectionsConf.entitledCollections),(null===(d=null===(r=L.data)||void 0===r?void 0:r.collectionsConf)||void 0===d?void 0:d.prerequisiteCollections)&&Te(L.data.collectionsConf.prerequisiteCollections)}),[null===(Y=L.data)||void 0===Y?void 0:Y.productsConf,null===(X=L.data)||void 0===X?void 0:X.collectionsConf]),n((()=>{if(!fe)return;if(L.newPickerConf){const e=[];return Object.values(fe).forEach((i=>{i.products&&Object.keys(i.products).forEach((i=>{e.push(parseInt(i))}))})),void re(Object.assign(Object.assign({},le),{entitledProductIds:e}))}const e=fe.map((e=>parseInt(e.id)));re(Object.assign(Object.assign({},le),{entitledProductIds:e}))}),[fe]),n((()=>{if(!he)return;if(L.newPickerConf){const e=[];return Object.values(he).forEach((i=>{i.products&&Object.keys(i.products).forEach((i=>{e.push(parseInt(i))}))})),void re(Object.assign(Object.assign({},le),{prerequisiteProductIds:e}))}const e=he.map((e=>parseInt(e.id)));re(Object.assign(Object.assign({},le),{prerequisiteProductIds:e}))}),[he]),n((()=>{if(!Ae)return;if(L.newPickerConf){(null==Ae?void 0:Ae.isCustom)&&delete Ae.isCustom;const e=Object.keys(Ae).map((e=>parseInt(e)));return void re(Object.assign(Object.assign({},le),{entitledCollectionIds:e}))}const e=Ae.map((e=>parseInt(e.id)));re(Object.assign(Object.assign({},le),{entitledCollectionIds:e}))}),[Ae]),n((()=>{if(!Oe)return;if(L.newPickerConf){(null==Oe?void 0:Oe.isCustom)&&delete Oe.isCustom;const e=Object.keys(Oe).map((e=>parseInt(e)));return void re(Object.assign(Object.assign({},le),{prerequisiteCollectionIds:e}))}const e=Oe.map((e=>parseInt(e.id)));re(Object.assign(Object.assign({},le),{prerequisiteCollectionIds:e}))}),[Oe]);const Qe=()=>{var e,i;let t,o=le;return le.isStaticCoupon||(le.targetType===p.SHIPPING_LINE?t=l.FREE_SHIPPING:le.targetType===p.LINE_ITEM?t=le.targetSelection===v.ENTITLED?(null===(e=le.prerequisiteProductIds)||void 0===e?void 0:e.length)||(null===(i=le.prerequisiteCollectionIds)||void 0===i?void 0:i.length)||le.prerequisiteQuantity||le.entitledQuantity?l.BUY_X_GET_Y:l.AMOUNT_OFF_PRODUCTS:l.AMOUNT_OFF_ORDER:(o=Object.assign(Object.assign({},o),{targetType:p.LINE_ITEM,targetSelection:v.ALL,valueType:C.FIXED_AMOUNT}),t=l.AMOUNT_OFF_ORDER)),{discountType:t,tempCouponData:o}},He=()=>{Le(c),Be(s)},ze=e=>{var i;const t={invalidDiscountCode:"Please add Discount Code",invalidCouponTitle:"Please add Discount Coupon Title",invalidCouponDescription:"Please add Coupon Description",inValidProbability:e.inValidProbability&&(null!==(i=le.probability)&&void 0!==i?i:-1)>1?"Probability should not exceed 1":le.isStaticCoupon?"Please add Probability":"Probability should be greater than 0",inValidDiscountAmount:"Please add Discount Amount",inValidMinimumAmount:"Specify minimum amount required",inValidMinimumQuantity:"Specify minimum items required",inValidCouponExpiry:"Please add Coupon Expiry",inValidProductSelection:"Please specify the products",inValidProductVariableSelection:"Please specify the product variables",inValidCollectionSelection:"Please specify the collections",inValidBuyXValue:"Please specify buy product quantity",inValidGetYValue:"Please specify get product quantity",inValidBuyXProductSelection:"Please specify the products",inValidBuyXCollectionSelection:"Please specify the collections",inValidGetYProductSelection:"Please specify the products",inValidGetYCollectionSelection:"Please specify the collections",inValidBuyXProductVariableSelection:"Please specify the product variables",inValidGetYProductVariableSelection:"Please specify the product variables"};let o="";Object.keys(e).forEach((i=>{e[i]&&(o=t[i])}));const n=Object.values(e).filter(Boolean).length;return n>0&&(xe(n>1?"Please add discount details":o),!0)},$e=()=>{if(!L.quadrant||!L.probability)return;const e=[...L.probability];let i=[];e.length>=L.quadrant&&e.splice(L.quadrant-1,1),i=e;const t=i.reduce(((e,i)=>e+i),0)+(le.probability||0);return Ne(parseFloat(t.toFixed(4))),parseFloat(t.toFixed(4))},Ke=e=>{var i,t,o,n,r,d,a,c,s,u,b,m,y,P,h,I;const f=e.value;se(f),Ie([]),Ee([]),Te([]),De([]),f===l.FREE_SHIPPING?re({value:100,targetSelection:v.ALL,targetType:p.SHIPPING_LINE,valueType:C.PERCENTAGE,quadrant:le.quadrant,isStaticCoupon:!1,title:le.title,expireAt:null!==(i=le.expireAt)&&void 0!==i?i:void 0,expireAfter:null!==(t=le.expireAfter)&&void 0!==t?t:void 0,probability:le.probability,minQuantity:null!==(o=le.minQuantity)&&void 0!==o?o:void 0,minAmount:null!==(n=le.minAmount)&&void 0!==n?n:void 0}):f===l.BUY_X_GET_Y?re({value:100,targetSelection:v.ENTITLED,targetType:p.LINE_ITEM,valueType:C.PERCENTAGE,quadrant:le.quadrant,isStaticCoupon:!1,title:le.title,expireAt:null!==(r=le.expireAt)&&void 0!==r?r:void 0,expireAfter:null!==(d=le.expireAfter)&&void 0!==d?d:void 0,probability:le.probability,minQuantity:void 0,minAmount:void 0}):f===l.AMOUNT_OFF_ORDER?re({targetSelection:v.ALL,targetType:p.LINE_ITEM,valueType:null!==(a=le.valueType)&&void 0!==a?a:C.FIXED_AMOUNT,quadrant:le.quadrant,isStaticCoupon:!1,title:le.title,expireAt:null!==(c=le.expireAt)&&void 0!==c?c:void 0,expireAfter:null!==(s=le.expireAfter)&&void 0!==s?s:void 0,probability:le.probability,value:le.value,minQuantity:null!==(u=le.minQuantity)&&void 0!==u?u:void 0,minAmount:null!==(b=le.minAmount)&&void 0!==b?b:void 0}):f===l.AMOUNT_OFF_PRODUCTS&&re({targetSelection:v.ENTITLED,targetType:p.LINE_ITEM,valueType:null!==(m=le.valueType)&&void 0!==m?m:C.FIXED_AMOUNT,quadrant:le.quadrant,isStaticCoupon:!1,title:le.title,expireAt:null!==(y=le.expireAt)&&void 0!==y?y:void 0,expireAfter:null!==(P=le.expireAfter)&&void 0!==P?P:void 0,probability:le.probability,value:le.value,minQuantity:null!==(h=le.minQuantity)&&void 0!==h?h:void 0,minAmount:null!==(I=le.minAmount)&&void 0!==I?I:void 0})},Ze=i=>i&&e(E,{theme:"light",tagText:i,type:"negative",LeadingIcon:_});return i(I,Object.assign({width:(oe||W)&&L.newPickerConf?"25px":"640px",open:L.isOpen,hideCrossButton:!!ie,headingTitle:W?"Select Products":L.title,headingSubtitle:W?void 0:L.subTitle,footerLeftCustomElement:ke?Ze(ke):L.errorMsg?Ze(L.errorMsg):!L.quadrant||L.hideProbability?e(t,{}):je<=1?e(E,{theme:"light",tagText:`Current probability sum: ${je}`,type:"white"}):e(O,Object.assign({body:"Probability sum should not exceed 1",placement:"top"},{children:e("div",{children:e(E,{style:{cursor:"pointer"},theme:"light",tagText:`Current probability sum: ${je}`,type:"negative",LeadingIcon:V})})})),headerRightCustomElement:L.allowStaticCoupon||W?void 0:e(b,{options:Xe,width:"200px",placement:"bottom-start",size:"small",onSelect:e=>{Ke(e)}}),onClose:L.onClose,footerContainerStyle:{borderTop:`1px solid ${h.colorsV2.stroke.primary}`},primaryButton:W?{buttonType:"primary",onClick:()=>{ee(void 0)},buttonText:"Add"}:oe?{buttonType:"primary",onClick:()=>{ne(void 0)},buttonText:"Add"}:{buttonType:"primary",buttonText:"Create discount code",isLoading:null!==(Q=L.loading)&&void 0!==Q&&Q,onClick:()=>{var e,i,t,o,n;if(He(),le.isStaticCoupon){const{isStaticCoupon:e,couponCode:i,title:t,description:o,quadrant:n,probability:l}=le,r={invalidDiscountCode:!i,invalidCouponTitle:!t,invalidCouponDescription:!o,inValidProbability:!L.hideProbability&&(null!=l?l:-1)<0||(null!=l?l:0)>1||Number.isNaN(null!=l?l:0)};if(ze(r))return void Le(r);if(de||je>1)return void xe(!L.hideProbability&&je>1?"Probability sum should not exceed 1":"Invalid coupon details");L.onSaveClicked({quadrant:n,couponCode:i,description:o,isStaticCoupon:e,probability:l,title:le.title})}else{const c={invalidCouponTitle:!le.title,inValidProbability:!L.hideProbability&&(null!==(e=le.probability)&&void 0!==e?e:-1)<=0||(null!==(i=le.probability)&&void 0!==i?i:-1)>1||Number.isNaN(null!==(t=le.probability)&&void 0!==t?t:-1),inValidDiscountAmount:!le.value,inValidMinimumQuantity:!1,inValidMinimumAmount:!1,inValidCouponExpiry:!1,inValidProductSelection:!1,inValidProductVariableSelection:!1,inValidCollectionSelection:!1,inValidBuyXValue:!1,inValidGetYValue:!1,inValidBuyXProductSelection:!1,inValidGetYProductSelection:!1,inValidBuyXCollectionSelection:!1,inValidGetYCollectionSelection:!1,inValidBuyXProductVariableSelection:!1,inValidGetYProductVariableSelection:!1};if(ce!==l.BUY_X_GET_Y&&ue!==r.NA){const{minAmount:e,minQuantity:i}=le;c.inValidMinimumAmount=ue===r.AMOUNT&&!e,c.inValidMinimumQuantity=ue===r.QUANTITY&&!i}if(Re&&(c.inValidCouponExpiry=!le.expireAt&&!le.expireAfter),ce!==l.AMOUNT_OFF_ORDER&&ce!==l.AMOUNT_OFF_PRODUCTS||(ve!==d.SPECIFIC_PRODUCTS||!fe||Object.keys(fe).length||Se||(c.inValidProductSelection=!0,c.inValidProductVariableSelection=!0),ve===d.SPECIFIC_COLLECTIONS&&Ae&&!Object.keys(Ae).length&&(c.inValidCollectionSelection=!0)),ce===l.BUY_X_GET_Y&&(le.prerequisiteQuantity||(c.inValidBuyXValue=!0),le.entitledQuantity||(c.inValidGetYValue=!0),be!==a.SPECIFIC_PRODUCTS||!he||Object.keys(he).length||Ve||(c.inValidBuyXProductSelection=!0,c.inValidBuyXProductVariableSelection=!0),be===a.SPECIFIC_COLLECTIONS&&Oe&&!Object.keys(Oe).length&&(c.inValidBuyXCollectionSelection=!0),ye!==a.SPECIFIC_PRODUCTS||!fe||Object.keys(fe).length||Se||(c.inValidGetYProductSelection=!0,c.inValidGetYProductVariableSelection=!0),ye===a.SPECIFIC_COLLECTIONS&&Ae&&!Object.keys(Ae).length&&(c.inValidGetYCollectionSelection=!0)),ze(c))return void Be(c);if(de||je>1)return void xe(!L.hideProbability&&je>1?"Probability sum should not exceed 1":"Invalid coupon details");L.onSaveClicked(Object.assign(Object.assign({},le),{description:w(le,L.currency,null!==(o=L.products)&&void 0!==o?o:[],null!==(n=L.collection)&&void 0!==n?n:[]),productsConf:{entitledProducts:null!=fe?fe:[],prerequisiteProducts:null!=he?he:[]},collectionsConf:{entitledCollections:null!=Ae?Ae:[],prerequisiteCollections:null!=Oe?Oe:[]},productVariableConf:{entitledProductVariable:null!=Se?Se:{},prerequisiteProductVariable:null!=Ve?Ve:{}}}))}}},secondaryButton:W?{buttonType:"tertiaryGray",onClick:()=>{ee(void 0)},buttonText:"Back"}:oe?{buttonType:"tertiaryGray",onClick:()=>{ne(void 0)},buttonText:"Back"}:{buttonType:"tertiaryGray",onClick:L.onClose,buttonText:"Cancel"}},{children:[!W&&!oe&&i(N,{children:[L.allowStaticCoupon&&!W&&i(k,Object.assign({selectedDiv:le.isStaticCoupon?1:2},{children:["static"===L.hideOption?e(t,{}):i("div",Object.assign({className:"coupon-type__container",onClick:()=>{le.isStaticCoupon||(re({isStaticCoupon:!0,quadrant:le.quadrant}),xe(""),He())}},{children:[e(m,Object.assign({style:{marginBottom:"4px",color:le.isStaticCoupon?h.colorsV2.content.brand:void 0}},{children:"Static Code"})),e(y,Object.assign({style:le.isStaticCoupon?{color:h.colorsV2.content.brand}:{}},{children:"A uniform code provided manually, used for providing the same discount to all customers."}))]})),"dynamic"===L.hideOption?e(t,{}):i("div",Object.assign({className:"coupon-type__container",onClick:()=>{var i;le.isStaticCoupon&&(se(l.AMOUNT_OFF_ORDER),re({isStaticCoupon:!1,quadrant:le.quadrant,targetType:p.LINE_ITEM,targetSelection:v.ALL,valueType:C.FIXED_AMOUNT}),xe(""),He(),we({id:"0",label:"Amount",value:"amount",icon:i=>e("span",Object.assign({style:{fontSize:20,color:i}},{children:L.currency||""}))}),Me(null!==(i=L.makeExpiryMandatory)&&void 0!==i&&i),pe(r.NA))}},{children:[e(m,Object.assign({style:{marginBottom:"4px",color:le.isStaticCoupon?void 0:h.colorsV2.content.brand}},{children:"Dynamic Code"})),e(y,Object.assign({style:le.isStaticCoupon?{}:{color:h.colorsV2.content.brand}},{children:"Code will be unique for all customers, with the first 5 letters of the customer's name, followed by 10 random characters."}))]}))]})),e(P,Object.assign({style:{marginTop:"24px"}},{children:"Coupon Details"})),le.isStaticCoupon&&!W&&e(q,{discountData:le,setDiscountData:re,hideProbability:L.hideProbability||!1,discountAdminUrl:L.discountAdminUrl,staticDiscountValidationError:qe,currency:L.currency}),!le.isStaticCoupon&&!W&&!oe&&e(R,{currency:L.currency,entitledProducts:null!=fe?fe:[],prerequisiteProducts:null!=he?he:[],setEntitledProducts:Ee,setPrerequisiteProducts:Ie,discountData:le,productPickerOpen:W,productVariablePickerOpen:ie,setIsProductPickerOpen:ee,setIsProductVariablePickerOpen:te,setDiscountData:re,selectedCouponType:ce,setSelectedCouponType:se,selectedMinimumRequirement:ue,setSelectedMinimumRequirement:pe,discountCouponAppliesTo:ve,offerAppliesToBuy:be,offerAppliesToGet:ye,setDiscountCouponAppliesTo:Ce,setOfferAppliesToBuy:me,setOfferAppliesToGet:Pe,hideProbability:L.hideProbability||!1,hideExpiration:L.hideExpiration||!1,allowStaticCoupon:L.allowStaticCoupon,onChangeCouponType:Ke,collectionPickerOpen:oe,entitledCollections:null!=Ae?Ae:[],prerequisiteCollections:null!=Oe?Oe:[],setIsCollectionPickerOpen:ne,setEntitledCollections:De,setPrerequisiteCollections:Te,useNewPicker:!!L.newPickerConf,setSelectedDiscountDetails:we,selectedDiscountDetails:Fe,isProductVariableSupported:L.isProductVariableSupported,entitledProductVariable:Se,setEntitledProductVariable:ge,preRequisiteProductVariable:Ve,setPreRequisiteProductVariable:_e,productVariableList:L.productVariableList,isAddExpirationChecked:Re,setIsAddExpirationChecked:Me,dynamicDiscountValidationError:Ue,setDynamicDiscountValidationError:Be,setValidationErrorMessage:xe,resetValidationErrors:He,discountDetailsOptions:J,selectedExpiration:Ge,setSelectedExpiration:Ye,makeExpiryMandatory:!!L.makeExpiryMandatory})]}),!!W&&i(t,{children:[!L.newPickerConf&&e("div",Object.assign({style:{padding:"12px 0"}},{children:e(f,{show:!0,onSave:()=>{},products:null!==(H=L.products)&&void 0!==H?H:[],title:"Select Products",onClose:()=>{ee(void 0)},selectedProducts:null!==(z=W===M.ENTITLED?fe:he)&&void 0!==z?z:[],setSelectedProducts:W===M.ENTITLED?Ee:Ie,onSearchKeyChange:L.onProductSearch})})),L.newPickerConf&&e(A,{visible:!0,onClose:()=>ee(void 0),collectionFetcher:L.newPickerConf.fetchCollections,productFetcher:L.newPickerConf.fetchProducts,selectedItems:W===M.ENTITLED?fe:he,onAdd:e=>{W===M.ENTITLED?Ee(e):Ie(e),ee(void 0)},zIndex:200,storeId:L.newPickerConf.storeId,searchInCollectionFetcher:L.newPickerConf.searchInCollection,customCollectionRestriction:!1,searchFetcher:L.newPickerConf.searchProducts,hideCollectionCheckbox:!0,hideVariantCheckbox:!0,selectProductsFromCustomCollection:!0,hideSelectionCount:!0})]}),!!oe&&e("div",Object.assign({style:{padding:"12px 0"}},{children:i(t,{children:[L.newPickerConf&&e(A,{visible:!0,onClose:()=>ne(void 0),collectionFetcher:L.newPickerConf.fetchCollections,productFetcher:L.newPickerConf.fetchProducts,selectedItems:oe===M.ENTITLED?Ae:Oe,onAdd:e=>{Object.values(e).forEach((e=>{e.products&&delete e.products})),oe===M.ENTITLED?De(e):Te(e),ne(void 0)},customCollectionRestriction:!1,zIndex:200,storeId:L.newPickerConf.storeId,searchInCollectionFetcher:L.newPickerConf.searchInCollection,searchFetcher:L.newPickerConf.searchProducts,hideProductCheckbox:!0,hideVariantCheckbox:!0,title:"Select Collections",hideGlobalSearch:!0,hideSelectionCount:!0}),!L.newPickerConf&&e(f,{show:!0,onSave:()=>{},products:null!==($=L.collection)&&void 0!==$?$:[],title:"Select Products",onClose:()=>{ne(void 0)},selectedProducts:null!==(K=oe===M.ENTITLED?Ae:Oe)&&void 0!==K?K:[],setSelectedProducts:oe===M.ENTITLED?De:Te,onSearchKeyChange:L.onCollectionSearch,searchPlaceholder:"Search collections..."})]})})),ie&&e(x,{children:e("div",Object.assign({style:{width:"50%",height:"100%",marginLeft:"50%"}},{children:e(j,{type:D.EMBEDDED,data:null!==(Z=L.productVariableList)&&void 0!==Z?Z:[],showHeader:!0,onSelect:e=>{if(ie===M.ENTITLED){const{displayName:i,actualValue:t,isAvailable:o}=e;ge({displayName:i,actualValue:t,isAvailable:o}),te(void 0)}if(ie===M.PREREQUISITE){const{displayName:i,actualValue:t,isAvailable:o}=e;_e({displayName:i,actualValue:t,isAvailable:o}),te(void 0)}},onClose:()=>{te(void 0)}})}))})]}))};export{L as DiscountModal};
@@ -1,9 +1,10 @@
1
1
  import React from 'react';
2
+ import { DISCOUNT_TYPES } from "..";
2
3
  import { COUPON_EXPIRATION, DISCOUNT_APPLIES_TO, ICouponData, IDynamicDiscountValidationError, MIN_PURCHASE_REQUIREMENT, OFFER_APPLIES_TO } from "../type";
3
4
  import { SingleOption } from "../../dropdown/type";
4
5
  import { Collection, Product } from "../../product-picker/type";
5
6
  import { VariableListInterfaceV3 } from '../../variable-picker-v3/model';
6
- import { DISCOUNT_TYPES, ProductVariable } from '../type';
7
+ import { ProductVariable } from '../type';
7
8
  export declare enum DISCOUNT_PRODUCTS {
8
9
  ENTITLED = "entitled",
9
10
  PREREQUISITE = "prerequisite"