@d19n/webchat 1.0.6 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (306) hide show
  1. package/README.md +19 -14
  2. package/dist/TwilioChat/Chat.d.ts +3 -12
  3. package/dist/TwilioChat/components/ChatHeader.d.ts +5 -0
  4. package/dist/TwilioChat/components/ChatInput.d.ts +5 -0
  5. package/dist/TwilioChat/components/Container.d.ts +6 -0
  6. package/dist/TwilioChat/components/Message.d.ts +29 -0
  7. package/dist/TwilioChat/components/MessageList.d.ts +5 -0
  8. package/dist/TwilioChat/components/NotificationBar.d.ts +3 -0
  9. package/dist/TwilioChat/components/TypingIndicator.d.ts +5 -0
  10. package/dist/TwilioChat/components/Widget.d.ts +5 -0
  11. package/dist/TwilioChat/components/styled/ChatContent.d.ts +3 -0
  12. package/dist/TwilioChat/components/styled/ChatContentList.d.ts +3 -0
  13. package/dist/TwilioChat/components/styled/ChatWrapper.d.ts +3 -0
  14. package/dist/TwilioChat/components/styled/EventPost.d.ts +3 -0
  15. package/dist/TwilioChat/components/styled/Header.d.ts +3 -0
  16. package/dist/TwilioChat/components/styled/InputForm.d.ts +3 -0
  17. package/dist/TwilioChat/components/styled/MyPost.d.ts +3 -0
  18. package/dist/TwilioChat/components/styled/Splitter.d.ts +3 -0
  19. package/dist/TwilioChat/components/styled/WidgetButton.d.ts +3 -0
  20. package/dist/TwilioChat/components/styled/YFPost.d.ts +3 -0
  21. package/dist/TwilioChat/index.d.ts +2 -12
  22. package/dist/_virtual/Component.js +2 -0
  23. package/dist/_virtual/Component.js.map +1 -0
  24. package/dist/_virtual/_commonjsHelpers.js +1 -1
  25. package/dist/_virtual/index11.js +1 -1
  26. package/dist/_virtual/index3.js +1 -1
  27. package/dist/_virtual/index4.js +1 -1
  28. package/dist/assets/assets.d.ts +44 -0
  29. package/dist/assets/images/{svg/youfibre-upload.svg → youfibre-upload.svg} +4 -4
  30. package/dist/assets/styles/app.scss +242 -210
  31. package/dist/context/ChatGlobalContext.d.ts +31 -0
  32. package/dist/index.d.ts +2 -8
  33. package/dist/index.js +6 -36
  34. package/dist/index.js.map +1 -1
  35. package/dist/index.mjs +6 -36
  36. package/dist/index.mjs.map +1 -1
  37. package/dist/node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js +1 -1
  38. package/dist/node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js.map +1 -1
  39. package/dist/node_modules/@emotion/unitless/dist/emotion-unitless.esm.js +2 -0
  40. package/dist/node_modules/@emotion/unitless/dist/emotion-unitless.esm.js.map +1 -0
  41. package/dist/node_modules/attr-accept/dist/es/index.js +1 -1
  42. package/dist/node_modules/classnames/index.js +1 -1
  43. package/dist/node_modules/engine.io-client/build/esm/transport.js +1 -1
  44. package/dist/node_modules/engine.io-client/build/esm/transport.js.map +1 -1
  45. package/dist/node_modules/engine.io-client/build/esm/transports/polling-xhr.js.map +1 -1
  46. package/dist/node_modules/engine.io-client/build/esm/transports/webtransport.js.map +1 -1
  47. package/dist/node_modules/lodash.debounce/index.js +2 -0
  48. package/dist/node_modules/lodash.debounce/index.js.map +1 -0
  49. package/dist/node_modules/mdast-util-gfm-autolink-literal/to-markdown.js +1 -1
  50. package/dist/node_modules/mdast-util-gfm-autolink-literal/to-markdown.js.map +1 -1
  51. package/dist/node_modules/mdast-util-gfm-strikethrough/from-markdown.js +1 -1
  52. package/dist/node_modules/mdast-util-gfm-strikethrough/to-markdown.js +1 -1
  53. package/dist/node_modules/mdast-util-gfm-strikethrough/to-markdown.js.map +1 -1
  54. package/dist/node_modules/mdast-util-gfm-task-list-item/from-markdown.js +1 -1
  55. package/dist/node_modules/micromark-extension-gfm-autolink-literal/syntax.js +1 -1
  56. package/dist/node_modules/micromark-extension-gfm-autolink-literal/syntax.js.map +1 -1
  57. package/dist/node_modules/micromark-extension-gfm-table/syntax.js +1 -1
  58. package/dist/node_modules/micromark-extension-gfm-table/syntax.js.map +1 -1
  59. package/dist/node_modules/prop-types/factoryWithTypeCheckers.js +1 -1
  60. package/dist/node_modules/prop-types/factoryWithTypeCheckers.js.map +1 -1
  61. package/dist/node_modules/prop-types/index.js +1 -1
  62. package/dist/node_modules/prop-types/index.js.map +1 -1
  63. package/dist/node_modules/react-debounce-input/lib/Component.js +2 -0
  64. package/dist/node_modules/react-debounce-input/lib/Component.js.map +1 -0
  65. package/dist/node_modules/react-debounce-input/lib/index.js +2 -0
  66. package/dist/node_modules/react-debounce-input/lib/index.js.map +1 -0
  67. package/dist/node_modules/react-dropzone/dist/es/index.js +1 -1
  68. package/dist/node_modules/react-dropzone/dist/es/index.js.map +1 -1
  69. package/dist/node_modules/react-dropzone/dist/es/utils/index.js.map +1 -1
  70. package/dist/node_modules/react-icons/bs/index.js +2 -0
  71. package/dist/node_modules/react-icons/bs/index.js.map +1 -0
  72. package/dist/node_modules/react-icons/io/index.js +2 -0
  73. package/dist/node_modules/react-icons/io/index.js.map +1 -0
  74. package/dist/node_modules/react-icons/lib/iconBase.js +2 -0
  75. package/dist/node_modules/react-icons/lib/iconBase.js.map +1 -0
  76. package/dist/node_modules/react-icons/lib/iconContext.js.map +1 -0
  77. package/dist/node_modules/react-is/cjs/react-is.development.js +3 -4
  78. package/dist/node_modules/react-is/cjs/react-is.development.js.map +1 -1
  79. package/dist/node_modules/{react-markdown/node_modules/react-is → react-is}/cjs/react-is.production.min.js +1 -1
  80. package/dist/node_modules/react-is/cjs/react-is.production.min.js.map +1 -0
  81. package/dist/node_modules/react-is/index.js +1 -1
  82. package/dist/node_modules/react-is/index.js.map +1 -1
  83. package/dist/node_modules/react-markdown/lib/ast-to-react.js +1 -1
  84. package/dist/node_modules/react-markdown/lib/ast-to-react.js.map +1 -1
  85. package/dist/node_modules/react-modal-image/es/Image.js.map +1 -1
  86. package/dist/node_modules/react-modal-image/es/Lightbox.js.map +1 -1
  87. package/dist/node_modules/react-modal-image/es/styles.js.map +1 -1
  88. package/dist/node_modules/react-toastify/dist/react-toastify.esm.js.map +1 -1
  89. package/dist/node_modules/socket.io-client/build/esm/manager.js.map +1 -1
  90. package/dist/node_modules/socket.io-client/build/esm/socket.js +1 -1
  91. package/dist/node_modules/socket.io-client/build/esm/socket.js.map +1 -1
  92. package/dist/node_modules/socket.io-parser/build/esm/index.js +1 -1
  93. package/dist/node_modules/socket.io-parser/build/esm/index.js.map +1 -1
  94. package/dist/node_modules/style-inject/dist/style-inject.es.js.map +1 -1
  95. package/dist/node_modules/styled-components/dist/styled-components.browser.esm.js +1 -1
  96. package/dist/node_modules/styled-components/dist/styled-components.browser.esm.js.map +1 -1
  97. package/dist/node_modules/stylis/src/Enum.js +2 -0
  98. package/dist/node_modules/stylis/src/Enum.js.map +1 -0
  99. package/dist/node_modules/stylis/src/Middleware.js +2 -0
  100. package/dist/node_modules/stylis/src/Middleware.js.map +1 -0
  101. package/dist/node_modules/stylis/src/Parser.js +2 -0
  102. package/dist/node_modules/stylis/src/Parser.js.map +1 -0
  103. package/dist/node_modules/stylis/src/Prefixer.js +2 -0
  104. package/dist/node_modules/stylis/src/Prefixer.js.map +1 -0
  105. package/dist/node_modules/stylis/src/Serializer.js +2 -0
  106. package/dist/node_modules/stylis/src/Serializer.js.map +1 -0
  107. package/dist/node_modules/stylis/src/Tokenizer.js +2 -0
  108. package/dist/node_modules/stylis/src/Tokenizer.js.map +1 -0
  109. package/dist/node_modules/stylis/src/Utility.js +2 -0
  110. package/dist/node_modules/stylis/src/Utility.js.map +1 -0
  111. package/dist/node_modules/tslib/tslib.es6.js.map +1 -1
  112. package/dist/package.json/package.json +25 -17
  113. package/dist/services/chatService.d.ts +48 -0
  114. package/dist/src/TwilioChat/Chat.js +1 -1
  115. package/dist/src/TwilioChat/Chat.js.map +1 -1
  116. package/dist/src/TwilioChat/components/ChatHeader.js +2 -0
  117. package/dist/src/TwilioChat/components/ChatHeader.js.map +1 -0
  118. package/dist/src/TwilioChat/components/ChatInput.js +2 -0
  119. package/dist/src/TwilioChat/components/ChatInput.js.map +1 -0
  120. package/dist/src/TwilioChat/components/Container.js +2 -0
  121. package/dist/src/TwilioChat/components/Container.js.map +1 -0
  122. package/dist/src/TwilioChat/components/Message.js +2 -0
  123. package/dist/src/TwilioChat/components/Message.js.map +1 -0
  124. package/dist/src/TwilioChat/components/MessageList.js +2 -0
  125. package/dist/src/TwilioChat/components/MessageList.js.map +1 -0
  126. package/dist/src/TwilioChat/components/NotificationBar.js +2 -0
  127. package/dist/src/TwilioChat/components/NotificationBar.js.map +1 -0
  128. package/dist/src/TwilioChat/components/TypingIndicator.js +2 -0
  129. package/dist/src/TwilioChat/components/TypingIndicator.js.map +1 -0
  130. package/dist/src/TwilioChat/components/Widget.js +2 -0
  131. package/dist/src/TwilioChat/components/Widget.js.map +1 -0
  132. package/dist/src/TwilioChat/components/styled/ChatContent.js +2 -0
  133. package/dist/src/TwilioChat/components/styled/ChatContent.js.map +1 -0
  134. package/dist/src/TwilioChat/components/styled/ChatContentList.js +2 -0
  135. package/dist/src/TwilioChat/components/styled/ChatContentList.js.map +1 -0
  136. package/dist/src/TwilioChat/components/styled/ChatWrapper.js +2 -0
  137. package/dist/src/TwilioChat/components/styled/ChatWrapper.js.map +1 -0
  138. package/dist/src/TwilioChat/components/styled/EventPost.js +2 -0
  139. package/dist/src/TwilioChat/components/styled/EventPost.js.map +1 -0
  140. package/dist/src/TwilioChat/components/styled/Header.js +2 -0
  141. package/dist/src/TwilioChat/components/styled/Header.js.map +1 -0
  142. package/dist/src/TwilioChat/components/styled/InputForm.js +2 -0
  143. package/dist/src/TwilioChat/components/styled/InputForm.js.map +1 -0
  144. package/dist/src/TwilioChat/components/styled/MyPost.js +2 -0
  145. package/dist/src/TwilioChat/components/styled/MyPost.js.map +1 -0
  146. package/dist/src/TwilioChat/components/styled/Splitter.js +2 -0
  147. package/dist/src/TwilioChat/components/styled/Splitter.js.map +1 -0
  148. package/dist/src/TwilioChat/components/styled/WidgetButton.js +2 -0
  149. package/dist/src/TwilioChat/components/styled/WidgetButton.js.map +1 -0
  150. package/dist/src/TwilioChat/components/styled/YFPost.js +2 -0
  151. package/dist/src/TwilioChat/components/styled/YFPost.js.map +1 -0
  152. package/dist/src/TwilioChat/index.js +1 -1
  153. package/dist/src/TwilioChat/index.js.map +1 -1
  154. package/dist/src/assets/audio/notification.wav.js +2 -0
  155. package/dist/src/assets/audio/notification.wav.js.map +1 -0
  156. package/dist/src/assets/images/chat.svg.js +2 -0
  157. package/dist/src/assets/images/chat.svg.js.map +1 -0
  158. package/dist/src/assets/images/close.svg.js +2 -0
  159. package/dist/src/assets/images/close.svg.js.map +1 -0
  160. package/dist/src/assets/images/favicon.svg.js +2 -0
  161. package/dist/src/assets/images/favicon.svg.js.map +1 -0
  162. package/dist/src/assets/images/ico-close.png.js +2 -0
  163. package/dist/src/assets/images/ico-close.png.js.map +1 -0
  164. package/dist/src/assets/images/loader-transparent.gif.js +2 -0
  165. package/dist/src/assets/images/loader-transparent.gif.js.map +1 -0
  166. package/dist/src/assets/images/youfibre-upload.svg.js +2 -0
  167. package/dist/src/assets/images/youfibre-upload.svg.js.map +1 -0
  168. package/dist/src/assets/styles/app.scss.js +1 -1
  169. package/dist/src/context/ChatGlobalContext.js +2 -0
  170. package/dist/src/context/ChatGlobalContext.js.map +1 -0
  171. package/dist/src/index.js +1 -1
  172. package/dist/src/index.js.map +1 -1
  173. package/dist/src/services/chatService.js +2 -0
  174. package/dist/src/services/chatService.js.map +1 -0
  175. package/dist/src/utils/alert.js.map +1 -1
  176. package/dist/src/utils/chats.js +2 -0
  177. package/dist/src/utils/chats.js.map +1 -0
  178. package/dist/src/utils/helperFn.js +1 -1
  179. package/dist/src/utils/helperFn.js.map +1 -1
  180. package/dist/src/utils/validate.js +2 -0
  181. package/dist/src/utils/validate.js.map +1 -0
  182. package/dist/utils/helperFn.d.ts +18 -2
  183. package/dist/utils/validate.d.ts +3 -0
  184. package/package.json +21 -17
  185. package/dist/NotificationBar/index.d.ts +0 -3
  186. package/dist/_virtual/ConfigApi.js +0 -2
  187. package/dist/_virtual/ConfigApi.js.map +0 -1
  188. package/dist/_virtual/ConfigApi2.js +0 -2
  189. package/dist/_virtual/ConfigApi2.js.map +0 -1
  190. package/dist/_virtual/api.provider.js +0 -2
  191. package/dist/_virtual/api.provider.js.map +0 -1
  192. package/dist/_virtual/errors.js +0 -2
  193. package/dist/_virtual/errors.js.map +0 -1
  194. package/dist/_virtual/helpers.js +0 -2
  195. package/dist/_virtual/helpers.js.map +0 -1
  196. package/dist/_virtual/hoist-non-react-statics.cjs.js +0 -2
  197. package/dist/_virtual/hoist-non-react-statics.cjs.js.map +0 -1
  198. package/dist/_virtual/index12.js +0 -2
  199. package/dist/_virtual/index12.js.map +0 -1
  200. package/dist/_virtual/index13.js +0 -2
  201. package/dist/_virtual/index13.js.map +0 -1
  202. package/dist/_virtual/index14.js +0 -2
  203. package/dist/_virtual/index14.js.map +0 -1
  204. package/dist/_virtual/index15.js +0 -2
  205. package/dist/_virtual/index15.js.map +0 -1
  206. package/dist/_virtual/react-is.development2.js +0 -2
  207. package/dist/_virtual/react-is.development2.js.map +0 -1
  208. package/dist/_virtual/react-is.development3.js +0 -2
  209. package/dist/_virtual/react-is.development3.js.map +0 -1
  210. package/dist/_virtual/react-is.development4.js +0 -2
  211. package/dist/_virtual/react-is.development4.js.map +0 -1
  212. package/dist/_virtual/react-is.production.js +0 -2
  213. package/dist/_virtual/react-is.production.js.map +0 -1
  214. package/dist/_virtual/react-is.production.min2.js +0 -2
  215. package/dist/_virtual/react-is.production.min2.js.map +0 -1
  216. package/dist/_virtual/react-is.production.min3.js +0 -2
  217. package/dist/_virtual/react-is.production.min3.js.map +0 -1
  218. package/dist/_virtual/schema.types.js +0 -2
  219. package/dist/_virtual/schema.types.js.map +0 -1
  220. package/dist/api/api.d.ts +0 -17
  221. package/dist/assets/images/png/ico-chat.png +0 -0
  222. package/dist/context/GlobalContext.d.ts +0 -18
  223. package/dist/node_modules/@d19n/odin-sdk-generator/dist/api.provider.js +0 -2
  224. package/dist/node_modules/@d19n/odin-sdk-generator/dist/api.provider.js.map +0 -1
  225. package/dist/node_modules/@d19n/odin-sdk-generator/dist/utilities/helpers.js +0 -2
  226. package/dist/node_modules/@d19n/odin-sdk-generator/dist/utilities/helpers.js.map +0 -1
  227. package/dist/node_modules/@d19n/odin-types/dist/types/errors.js +0 -2
  228. package/dist/node_modules/@d19n/odin-types/dist/types/errors.js.map +0 -1
  229. package/dist/node_modules/@d19n/odin-types/dist/types/schema.types.js +0 -2
  230. package/dist/node_modules/@d19n/odin-types/dist/types/schema.types.js.map +0 -1
  231. package/dist/node_modules/@d19n/youfibre-odin-sdk/dist/api-sdk-v2/ConfigApi.js +0 -2
  232. package/dist/node_modules/@d19n/youfibre-odin-sdk/dist/api-sdk-v2/ConfigApi.js.map +0 -1
  233. package/dist/node_modules/@emotion/stylis/dist/stylis.browser.esm.js +0 -2
  234. package/dist/node_modules/@emotion/stylis/dist/stylis.browser.esm.js.map +0 -1
  235. package/dist/node_modules/@emotion/unitless/dist/unitless.browser.esm.js +0 -2
  236. package/dist/node_modules/@emotion/unitless/dist/unitless.browser.esm.js.map +0 -1
  237. package/dist/node_modules/camel-case/dist.es2015/index.js +0 -2
  238. package/dist/node_modules/camel-case/dist.es2015/index.js.map +0 -1
  239. package/dist/node_modules/capital-case/dist.es2015/index.js +0 -2
  240. package/dist/node_modules/capital-case/dist.es2015/index.js.map +0 -1
  241. package/dist/node_modules/change-case/dist.es2015/index.js +0 -2
  242. package/dist/node_modules/change-case/dist.es2015/index.js.map +0 -1
  243. package/dist/node_modules/constant-case/dist.es2015/index.js +0 -2
  244. package/dist/node_modules/constant-case/dist.es2015/index.js.map +0 -1
  245. package/dist/node_modules/dot-case/dist.es2015/index.js +0 -2
  246. package/dist/node_modules/dot-case/dist.es2015/index.js.map +0 -1
  247. package/dist/node_modules/header-case/dist.es2015/index.js +0 -2
  248. package/dist/node_modules/header-case/dist.es2015/index.js.map +0 -1
  249. package/dist/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js +0 -2
  250. package/dist/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js.map +0 -1
  251. package/dist/node_modules/hoist-non-react-statics/node_modules/react-is/cjs/react-is.development.js +0 -10
  252. package/dist/node_modules/hoist-non-react-statics/node_modules/react-is/cjs/react-is.development.js.map +0 -1
  253. package/dist/node_modules/hoist-non-react-statics/node_modules/react-is/cjs/react-is.production.min.js +0 -10
  254. package/dist/node_modules/hoist-non-react-statics/node_modules/react-is/cjs/react-is.production.min.js.map +0 -1
  255. package/dist/node_modules/hoist-non-react-statics/node_modules/react-is/index.js +0 -2
  256. package/dist/node_modules/hoist-non-react-statics/node_modules/react-is/index.js.map +0 -1
  257. package/dist/node_modules/lower-case/dist.es2015/index.js +0 -2
  258. package/dist/node_modules/lower-case/dist.es2015/index.js.map +0 -1
  259. package/dist/node_modules/no-case/dist.es2015/index.js +0 -2
  260. package/dist/node_modules/no-case/dist.es2015/index.js.map +0 -1
  261. package/dist/node_modules/param-case/dist.es2015/index.js +0 -2
  262. package/dist/node_modules/param-case/dist.es2015/index.js.map +0 -1
  263. package/dist/node_modules/pascal-case/dist.es2015/index.js +0 -2
  264. package/dist/node_modules/pascal-case/dist.es2015/index.js.map +0 -1
  265. package/dist/node_modules/path-case/dist.es2015/index.js +0 -2
  266. package/dist/node_modules/path-case/dist.es2015/index.js.map +0 -1
  267. package/dist/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js +0 -10
  268. package/dist/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js.map +0 -1
  269. package/dist/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js +0 -10
  270. package/dist/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js.map +0 -1
  271. package/dist/node_modules/prop-types/node_modules/react-is/index.js +0 -2
  272. package/dist/node_modules/prop-types/node_modules/react-is/index.js.map +0 -1
  273. package/dist/node_modules/react-icons/bs/index.esm.js +0 -2
  274. package/dist/node_modules/react-icons/bs/index.esm.js.map +0 -1
  275. package/dist/node_modules/react-icons/lib/esm/iconBase.js +0 -2
  276. package/dist/node_modules/react-icons/lib/esm/iconBase.js.map +0 -1
  277. package/dist/node_modules/react-icons/lib/esm/iconContext.js.map +0 -1
  278. package/dist/node_modules/react-is/cjs/react-is.production.js +0 -11
  279. package/dist/node_modules/react-is/cjs/react-is.production.js.map +0 -1
  280. package/dist/node_modules/react-markdown/node_modules/react-is/cjs/react-is.development.js +0 -10
  281. package/dist/node_modules/react-markdown/node_modules/react-is/cjs/react-is.development.js.map +0 -1
  282. package/dist/node_modules/react-markdown/node_modules/react-is/cjs/react-is.production.min.js.map +0 -1
  283. package/dist/node_modules/react-markdown/node_modules/react-is/index.js +0 -2
  284. package/dist/node_modules/react-markdown/node_modules/react-is/index.js.map +0 -1
  285. package/dist/node_modules/sentence-case/dist.es2015/index.js +0 -2
  286. package/dist/node_modules/sentence-case/dist.es2015/index.js.map +0 -1
  287. package/dist/node_modules/snake-case/dist.es2015/index.js +0 -2
  288. package/dist/node_modules/snake-case/dist.es2015/index.js.map +0 -1
  289. package/dist/node_modules/upper-case/dist.es2015/index.js +0 -2
  290. package/dist/node_modules/upper-case/dist.es2015/index.js.map +0 -1
  291. package/dist/node_modules/upper-case-first/dist.es2015/index.js +0 -2
  292. package/dist/node_modules/upper-case-first/dist.es2015/index.js.map +0 -1
  293. package/dist/node_modules/use-debounce/dist/index.module.js +0 -2
  294. package/dist/node_modules/use-debounce/dist/index.module.js.map +0 -1
  295. package/dist/src/NotificationBar/index.js +0 -2
  296. package/dist/src/NotificationBar/index.js.map +0 -1
  297. package/dist/src/api/api.js +0 -2
  298. package/dist/src/api/api.js.map +0 -1
  299. package/dist/src/context/GlobalContext.js +0 -2
  300. package/dist/src/context/GlobalContext.js.map +0 -1
  301. /package/dist/assets/images/{svg/chat.svg → chat.svg} +0 -0
  302. /package/dist/assets/images/{svg/close.svg → close.svg} +0 -0
  303. /package/dist/assets/images/{svg/favicon.svg → favicon.svg} +0 -0
  304. /package/dist/assets/images/{png/ico-close.png → ico-close.png} +0 -0
  305. /package/dist/assets/images/{gif/loader-transparent.gif → loader-transparent.gif} +0 -0
  306. /package/dist/node_modules/react-icons/lib/{esm/iconContext.js → iconContext.js} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chatService.js","sources":["../../../src/services/chatService.ts"],"sourcesContent":["import { io, Socket } from 'socket.io-client';\nimport FormData from 'form-data';\nimport moment from 'moment';\nexport interface Message {\n createdAt: string;\n from?: string | null;\n files?: string | null;\n message: string | null;\n form: FormType | null;\n messageId: string;\n fromId: string;\n senderType: string;\n}\nexport interface FormType {\n type: string;\n value: Array<{ title: string; action: string; placeholder?: string | null; type?: string; required?: boolean; options?:object }>;\n}\n\nexport const fetchAsync = async (url = '', method = 'get', headers:object|null = {}, body:object|null = {}) => {\n try {\n console.log('Fetching:', `${localStorage.getItem('apiUrl') || ''}${url}`);\n const response = await fetch(`${localStorage.getItem('apiUrl') || ''}${url}`, {\n method: method.toLowerCase(),\n headers: {\n \"Authorization\": `Bearer ${sessionStorage.getItem('authToken') || ''}`,\n ...(body instanceof FormData ? {} : { \"Content-Type\": \"application/json\" }),\n ...headers\n }, \n // Convert the body to JSON only if it's not empty and FormData\n body: body ? ((body instanceof FormData) ? body as unknown as BodyInit : JSON.stringify(body)) : null\n });\n // Check if the response is okay\n if (!response) {\n console.error('Error fetching data: ', url);\n return null;\n }\n const data = await response.json();\n return data;\n } catch (error) { console.error('Error fetching:', error); }\n};\n\nexport const loadZipCodesAsync = async (input: string): Promise<{ value: string; label: string }[]> => {\n try {\n const data = await fetchAsync(`/CrmModule/v2.0/premises/post-code-checker?searchString=${input}`, 'get', null, null);\n return data.data.map((category: any) => ({\n value: category.properties.PostalCode,\n label: category.properties.FullAddress,\n }));\n } catch (error) {\n console.error('Error fetching ZIP codes:', error);\n return [];\n }\n};\n\nexport const getToken = async (email) => {\n try {\n const data = await fetchAsync(`/ChatModule/v1.0/gateway/token?identity=${email}&source=twilio`, 'get', null, null);\n return data;\n } catch (error) { console.error('Error fetching token:', error); }\n};\n\nexport const chatLocalStorage = (name:string|null = null) => {\n const response = JSON.parse(localStorage.getItem('twilioChat')|| '[]');\n return name ? response[name] : response\n};\n\nexport const didAgentPost = (messages) => {\n return messages && chatLocalStorage('chatConversationId') ? Object.keys(messages.filter(ext => ext.senderType === 'AGENT')).length > 1 : false;\n};\n\nexport const scrollToBottom = () => {\n try {\n const scrollableContainer = document.querySelector('#ChatContentList');\n if(scrollableContainer){\n scrollableContainer.scrollTo({\n top: scrollableContainer.scrollHeight + 100,\n behavior: 'smooth'\n });\n }\n } catch(e){ }\n};\n\nexport const isConversationActive = async () => {\n if(chatLocalStorage('chatConversationId')){ \n try {\n const response = await fetchAsync(`${localStorage.getItem('apiUrl') || ''}/ChatModule/v1.0/gateway/conversation/${chatLocalStorage('chatConversationId')}`, 'get', null, null);\n // Check if the response is okay\n if (!response) {\n console.error(\"Can't check conversation!\");\n return null;\n }\n return response?.data?.properties?.Status;\n } catch (error) { console.error('Error fetching conversation status: ', error); }\n }\n};\n\nexport const createConversation = async (\n tmpChatUsername:string|null,\n tmpChatEmail:string|null,\n tmpChatAddress:string|null,\n tmpChatLastBill:string|null,\n tmpChatUserType:string|null,\n tmpChatCategory:string|null,\n allowCreateChat:boolean = true\n) => { \n try {\n const response = await fetchAsync(`/ChatModule/v1.0/gateway/conversation/create`, 'post', null, \n {\n source: \"twilio\",\n channel: \"WEB_CHAT\",\n identifier: tmpChatEmail || null,\n DpaCustomerName: tmpChatUsername || null,\n DpaCustomerEmail: tmpChatEmail || null,\n DpaCustomerAddress: tmpChatAddress || null,\n DpaCustomerLastBill: tmpChatLastBill || null,\n DpaCustomerType: tmpChatUserType || null,\n DpaCustomerCategory: tmpChatCategory || null,\n options: {\n skipValidationCheck: allowCreateChat\n }\n }\n );\n // Check if the response is okay\n if (!response) {\n console.error(\"Can't create conversation!\");\n return null;\n }\n console.log('Conversation created:', response);\n return response;\n } catch (error) { console.error('Error creating conversation:', error); }\n};\n\nexport const closeConversation = async (closedBy:string = \"CUSTOMER\") => {\n try {\n const response = await fetchAsync(\n `/ChatModule/v1.0/gateway/conversation/${chatLocalStorage('chatConversationId')}/close`, \n 'post', \n null, \n { closedBy: closedBy }\n );\n // Check if the response is okay\n if (!response) {\n console.error(\"Can't close conversation!\");\n return null;\n }\n // Check if the statusCode matches\n return response?.statusCode === 201;\n } catch (error) { console.error('Error closing conversation:', error); }\n};\n\nexport const sendMessage = async (message:string|null = null, uploadFiles:string[] = [], senderType:string = 'CUSTOMER') => {\n if(message || (message && message.length > 0) || Object.keys(uploadFiles).length > 0) {\n typeof document !== \"undefined\" && document.getElementById('inputMessage')?.focus();\n let formData;\n if(Object.keys(uploadFiles).length > 0){\n let tmpFormData:FormData = new FormData();\n tmpFormData.append('conversationSid', chatLocalStorage('chatConversationId'));\n tmpFormData.append('message', message !== '' ? message : null);\n tmpFormData.append('from', chatLocalStorage('chatUsername'));\n tmpFormData.append('sender', senderType);\n try{\n Object.keys(uploadFiles).length > 0 && uploadFiles.map(async (item) => {\n tmpFormData.append('files', item);\n }); \n } catch (e){\n \n }\n formData = tmpFormData;\n } else {\n let tmpFormData:any = {\n conversationSid: chatLocalStorage('chatConversationId'),\n message: message,\n from: chatLocalStorage('chatUsername'),\n sender: 'CUSTOMER',\n files: null,\n };\n formData = tmpFormData;\n }\n // Send a Message to the Conversation\n try { \n const data = await fetchAsync(`/ChatModule/v1.0/gateway/conversation/${chatLocalStorage('chatConversationId')}/message/send`, 'post', null, formData);\n return data;\n } catch (error) {\n console.error('Send a Message:', error);\n return [];\n }\n }\n};\n \nexport const getAllMessages = async () => {\n try{\n if(chatLocalStorage('chatConversationId')){\n const response:any = await fetchAsync(`/NotificationModule/v2.0/records/Conversation/${chatLocalStorage('chatConversationId')}/links?targetEntities=[\"Message\"]`, 'get', null, null);\n if(response){\n let tmpMessages:Message[] = await Promise.all(\n response.data?.Message?.dbRecords.map(async item => ({\n createdAt: item?.createdAt,\n from: item?.properties?.From,\n files: await getFiles(item?.properties?.Files), \n message: item?.properties?.Body,\n form: null,\n messageId: item?.id,\n fromId: item?.createdBy?.id,\n senderType: item.type === \"EVENT\" ? \"EVENT\" : item.properties.SenderType\n }))\n ); \n return tmpMessages ? [\n ...tmpMessages, {\n senderType: 'EVENT',\n createdAt: moment(new Date()).format(),\n from: 'YouFibre',\n message: \"Waiting for the agent to join the chat.\",\n form: null,\n files: [],\n messageId: `${Date.now()}-0000-0000-0000-000000000000`,\n fromId: 'YouFibre',\n }] : []; \n }\n }\n } catch (error) {\n console.error('Error fetching messages:', error);\n return [];\n }\n};\n\nexport const findUnreadedMessages = async (oldMessages:Message[] = [], newMessages:Message[] = []) => {\n let tmpMessages:Message[] = await Promise.all(\n newMessages.filter(item => !oldMessages.some(obj => obj?.messageId === item?.messageId))); \n return tmpMessages;\n}; \n\nexport const connectToWebsocket = (sessionId:string|null = null) => {\n return io(`${localStorage.getItem('websocketUrl') || ''}/ChatWebsocketModule/TwilioChatWebsocket/v1.0`, \n { \n path: '/ws',\n query: {\n clientId: sessionId \n },\n reconnection: true,\n reconnectionAttempts: Infinity, // Retry indefinitely\n reconnectionDelay: 1000, // Start with a 1-second delay\n reconnectionDelayMax: 5000, // Cap the delay at 5 seconds\n timeout: 10000, // Timeout after 10 seconds\n }); \n};\n\nexport const getFiles = async (files: String[] | null = null) => {\n try{\n let tmpFiles:any = [];\n if(files){\n const response:any = await fetchAsync(`/SchemaModule/v1.0/db/File/many?ids=${files}`, 'get', null, null);\n // Check if the response is okay\n if (!response) {\n console.error(\"Can't close conversation!\");\n } else {\n if(Object.keys(response?.data).length){\n response?.data?.map((item) => {\n tmpFiles = [...tmpFiles, {\n id: item?.id || \"\",\n type: item?.properties?.Mimetype || \"\",\n url: item?.properties?.Url || \"\"\n }];\n });\n }\n return (Object.keys(tmpFiles).length !== 0) ? tmpFiles : [];\n }\n } else {\n return [];\n }\n } catch (error) {\n console.error('Error fetching files:', error);\n return [];\n }\n};\n"],"names":["fetchAsync","__awaiter","__spreadArray","args_1","url","method","headers","body","console","log","concat","localStorage","getItem","fetch","toLowerCase","__assign","Authorization","sessionStorage","FormData","JSON","stringify","response","_a","sent","json","error","error_1","loadZipCodesAsync","input","data","map","category","value","properties","PostalCode","label","FullAddress","error_2","getToken","email","error_3","chatLocalStorage","name","parse","didAgentPost","messages","Object","keys","filter","ext","senderType","length","scrollToBottom","scrollableContainer","document","querySelector","scrollTo","top","scrollHeight","behavior","e","isConversationActive","_c","_b","Status","error_4","createConversation","tmpChatUsername_1","tmpChatEmail_1","tmpChatAddress_1","tmpChatLastBill_1","tmpChatUserType_1","tmpChatCategory_1","tmpChatUsername","tmpChatEmail","tmpChatAddress","tmpChatLastBill","tmpChatUserType","tmpChatCategory","allowCreateChat","source","channel","identifier","DpaCustomerName","DpaCustomerEmail","DpaCustomerAddress","DpaCustomerLastBill","DpaCustomerType","DpaCustomerCategory","options","skipValidationCheck","error_5","closeConversation","closedBy","statusCode","error_6","sendMessage","message","uploadFiles","getElementById","focus","formData","tmpFormData_1","append","item","tmpFormData","conversationSid","from","sender","files","error_7","getAllMessages","Promise","all","Message","dbRecords","createdAt","From","getFiles","Files","_f","_d","Body","form","messageId","id","fromId","_e","createdBy","type","SenderType","tmpMessages","moment","Date","format","now","error_8","findUnreadedMessages","oldMessages","newMessages","some","obj","connectToWebsocket","sessionId","io","path","query","clientId","reconnection","reconnectionAttempts","Infinity","reconnectionDelay","reconnectionDelayMax","timeout","tmpFiles_1","Mimetype","Url","error_9"],"mappings":"iRAkBO,IAAMA,EAAa,qEAAO,OAAAC,OAAA,EAAAC,EAAA,GAAAC,GAAA,QAAA,EAAA,SAAAC,EAAUC,EAAgBC,EAA0BC,uBAApD,IAAAH,IAAAA,EAAA,SAAU,IAAAC,IAAAA,EAAA,YAAgB,IAAAC,IAAAA,EAAA,CAAA,QAA0B,IAAAC,IAAAA,EAAA,CAAA,6CAGhE,6BADjBC,QAAQC,IAAI,YAAa,GAAAC,OAA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nBkD,EAAQxJ,EAAAA,EAAA,GAAOwJ,GAAQ,GAAA,CAAE,CACvB7B,IAAIrB,eAAAA,EAAMqB,KAAM,GAChBI,MAAsB,QAAhB3G,EAAAkF,aAAI,EAAJA,EAAMvE,kBAAU,IAAAX,OAAA,EAAAA,EAAEqI,WAAY,GACpCvJ,KAAqB,QAAhB2D,EAAAyC,aAAI,EAAJA,EAAMvE,kBAAU,IAAA8B,OAAA,EAAAA,EAAE6F,MAAO,MAC/B,EACH,IAEF,CAAA,EAAyC,IAAjC9G,OAAOC,KAAK2G,GAAUvG,OAAgBuG,EAAW,MAXzDlJ,QAAQiB,MAAM,oCAchB,KAAA,EAAA,MAAA,CAAA,EAAO,8BAIT,kBADAjB,QAAQiB,MAAM,wBAAyBoI,GACvC,CAAA,EAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"alert.js","sources":["../../../src/utils/alert.ts"],"sourcesContent":["import { toast } from 'react-toastify';\n\nexport const toastrMsg = (toastrText:any, toastrType:any) => {\n toast(toastrText, {\n type: toastrType\n })\n};"],"names":["toastrMsg","toastrText","toastrType","toast","type"],"mappings":"qFAEO,IAAMA,EAAY,SAACC,EAAgBC,GACtCC,EAAMF,EAAY,CACdG,KAAMF,GAEd"}
1
+ {"version":3,"file":"alert.js","sources":["../../../src/utils/alert.ts"],"sourcesContent":["import { toast } from 'react-toastify';\n\nexport const toastrMsg = (toastrText, toastrType) => {\n toast(toastrText, {\n type: toastrType\n })\n};"],"names":["toastrMsg","toastrText","toastrType","toast","type"],"mappings":"qFAEO,IAAMA,EAAY,SAACC,EAAYC,GAClCC,EAAMF,EAAY,CACdG,KAAMF,GAEd"}
@@ -0,0 +1,2 @@
1
+ import e from"../../_virtual/moment.js";var t=[{createdAt:e(new Date).format(),message:null,fromId:"Client",senderType:"CUSTOMER",form:{type:"buttons",value:[{title:"I am the account holder",action:"old_customer"},{title:"I am not the account holder",action:"not_customer"},{title:"I am new here",action:"new_customer"}]},messageId:"".concat(Date.now(),"-0000-0000-0000-000000000000")},{senderType:"AGENT",createdAt:e(new Date).format(),from:"YouFibre",fromId:"YouFibre",message:"Welcome to YouFibre!<br />We're going to ask you some questions to ensure we get you through to the right team, so please bear with us!<br />Are you the account holder?",form:null,messageId:"".concat(Date.now(),"-0000-0000-0000-000000000000")}],o={logged:!1,messages:t,chatCaseId:null,uploadArea:!1,uploadedFiles:[],chatClosing:!1,chatClosingType:null,chatLoading:!1,chatUserId:null,chatUsername:null,confirmClosing:!1,chatConversationId:null,chatSessionId:null,chatUserType:null,openChat:!1,resetFormValues:!1,token:null,typingAgent:!1,typingCustomer:!1,lightboxUrl:null,agentId:null},a={receiveMsg:null,chatUnreaded:!1,lastTimeActive:null},l={fullscreen:!1,side:"right"},r=[{senderType:"CUSTOMER",createdAt:e(new Date).format(),from:"Client",fromId:"Client",message:"I am new here",form:null,messageId:"".concat(Date.now(),"-0000-0000-0000-000000000001")},{senderType:"AGENT",createdAt:e(new Date).format(),from:"YouFibre",fromId:"YouFibre",message:"We're so happy to hear from you! So that we can provide the best possible support, please provide us with the following information.",form:null,messageId:"".concat(Date.now(),"-0000-0000-0000-000000000002")},{senderType:"CUSTOMER",createdAt:e(new Date).format(),from:"YouFibre",fromId:"YouFibre",message:null,form:{type:"form",value:[{title:"Name",action:"full_name",placeholder:null,type:"text",required:!0},{title:"Email",action:"email",placeholder:null,type:"email",required:!0},{title:"Enter your Postcode",action:"address",placeholder:"Example: SW1 4EN",type:"zip",required:!0},{title:"What do you need help with today?",action:"category",placeholder:null,type:"select",required:!0,options:{SALES:"Sales",TECH_SUPPORT:"Tech Support",COMPLAINT:"Complaint"}},{title:"Submit",action:"submit_form",type:"button"}]},messageId:"".concat(Date.now(),"-0000-0000-0000-000000000003")}],n=[{senderType:"CUSTOMER",createdAt:e(new Date).format(),from:"Client",fromId:"Client",message:"I am not the account holder",form:null,messageId:"".concat(Date.now(),"-0000-0000-0000-000000000001")},{senderType:"AGENT",createdAt:e(new Date).format(),from:"YouFibre",fromId:"YouFibre",message:"We're so happy to hear from you! So that we can provide the best possible support, please provide us with the following information.",form:null,messageId:"".concat(Date.now(),"-0000-0000-0000-000000000002")},{senderType:"CUSTOMER",createdAt:e(new Date).format(),from:"YouFibre",fromId:"YouFibre",message:null,form:{type:"form",value:[{title:"Name",action:"full_name",placeholder:null,type:"text",required:!0},{title:"Email",action:"email",placeholder:null,type:"email",required:!0},{title:"Enter your Postcode",action:"address",placeholder:"Example: SW1 4EN",type:"zip",required:!0},{title:"What do you need help with today?",action:"category",placeholder:null,type:"select",required:!0,options:{SALES:"Sales",TECH_SUPPORT:"Tech Support",COMPLAINT:"Complaint"}},{title:"Submit",action:"submit_form",type:"button"}]},messageId:"".concat(Date.now(),"-0000-0000-0000-000000000003")}],i=[{senderType:"CUSTOMER",createdAt:e(new Date).format(),from:"Client",fromId:"Client",message:"I am the account holder",form:null,messageId:"".concat(Date.now(),"-0000-0000-0000-000000000001")},{senderType:"AGENT",createdAt:e(new Date).format(),from:"YouFibre",fromId:"YouFibre",message:"We're so happy to hear from you! So that we can provide the best possible support, please provide us with the following information.",form:null,messageId:"".concat(Date.now(),"-0000-0000-0000-000000000002")},{senderType:"CUSTOMER",createdAt:e(new Date).format(),from:"YouFibre",fromId:"YouFibre",message:null,form:{type:"form",value:[{title:"Name",action:"full_name",placeholder:null,type:"text",required:!0},{title:"Email",action:"email",placeholder:null,type:"email",required:!0},{title:"Enter your Postcode",action:"address",placeholder:"Example: SW1 4EN",type:"zip",required:!0},{title:"What was the total value of your last bill?",action:"last_bill",placeholder:"Total amount of your last bill",type:"number",required:!0},{title:"What do you need help with today?",action:"category",placeholder:null,type:"select",required:!0,options:{SALES:"Sales",TECH_SUPPORT:"Tech Support",INSTALLS_AND_SERVICE_VISITS:"Installs & Service Visits",MANAGE_MY_ACCOUNT:"Manage My Account",BILLING:"Billing",CANCELLATION:"Cancellation",COMPLAINT:"Complaint"}},{title:"Submit",action:"submit_form",type:"button"}]},messageId:"".concat(Date.now(),"-0000-0000-0000-000000000003")}],s={SALES:"Sales",TECH_SUPPORT:"Tech Support",INSTALLS_AND_SERVICE_VISITS:"Installs & Service Visits",MANAGE_MY_ACCOUNT:"Manage My Account",BILLING:"Billing",CANCELLATION:"Cancellation",COMPLAINT:"Complaint"},m={NEW_CUSTOMER:"New customer",ACCOUNT_HOLDER:"Account holder",NOT_ACCOUNT_HOLDER:"Not the account holder"};export{s as categories,t as defaultMessages,o as initialTwilioChatState,l as initialTwilioSettingsState,a as initialTwilioTimerState,r as newAccountHolder,n as notAccountHolder,m as userTypeLabels,i as yesAccountHolder};
2
+ //# sourceMappingURL=chats.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chats.js","sources":["../../../src/utils/chats.ts"],"sourcesContent":["import moment from 'moment';\n\nexport const defaultMessages = [\n{\n createdAt: moment(new Date()).format(),\n message: null,\n fromId: \"Client\",\n senderType: \"CUSTOMER\",\n form: {\n type: \"buttons\",\n value: [\n {\n title: \"I am the account holder\",\n action: \"old_customer\"\n },\n {\n title: \"I am not the account holder\",\n action: \"not_customer\"\n },\n {\n title: \"I am new here\",\n action: \"new_customer\"\n },\n ]\n },\n messageId: `${Date.now()}-0000-0000-0000-000000000000`\n},\n{\n senderType: \"AGENT\",\n createdAt: moment(new Date()).format(),\n from: \"YouFibre\",\n fromId: \"YouFibre\",\n message: \"Welcome to YouFibre!<br />We're going to ask you some questions to ensure we get you through to the right team, so please bear with us!<br />Are you the account holder?\",\n form: null,\n messageId: `${Date.now()}-0000-0000-0000-000000000000`\n}\n];\n\nexport const initialTwilioChatState = {\n logged: false,\n messages: defaultMessages,\n chatCaseId: null,\n uploadArea: false,\n uploadedFiles: [],\n chatClosing: false,\n chatClosingType: null,\n chatLoading: false,\n chatUserId: null,\n chatUsername: null,\n confirmClosing: false,\n chatConversationId: null,\n chatSessionId: null,\n chatUserType: null,\n openChat: false,\n resetFormValues: false,\n token: null,\n typingAgent: false,\n typingCustomer: false,\n lightboxUrl: null,\n agentId: null,\n}\n\nexport const initialTwilioTimerState = {\n receiveMsg: null,\n chatUnreaded: false,\n lastTimeActive: null,\n}\n\nexport const initialTwilioSettingsState = {\n fullscreen: false,\n side: 'right',\n}\n\nexport type UserType = 'NEW_CUSTOMER' | 'ACCOUNT_HOLDER' | 'NOT_ACCOUNT_HOLDER';\n\nexport const newAccountHolder = [\n {\n senderType: \"CUSTOMER\",\n createdAt: moment(new Date()).format(),\n from: \"Client\",\n fromId: \"Client\",\n message: 'I am new here',\n form: null,\n messageId: `${Date.now()}-0000-0000-0000-000000000001`\n },\n {\n senderType: \"AGENT\",\n createdAt: moment(new Date()).format(),\n from: \"YouFibre\",\n fromId: \"YouFibre\",\n message: \"We're so happy to hear from you! So that we can provide the best possible support, please provide us with the following information.\",\n form: null,\n messageId: `${Date.now()}-0000-0000-0000-000000000002`\n },\n {\n senderType: \"CUSTOMER\",\n createdAt: moment(new Date()).format(),\n from: \"YouFibre\",\n fromId: \"YouFibre\",\n message: null,\n form: {\n type: \"form\",\n value: [\n {\n title: \"Name\",\n action: \"full_name\",\n placeholder: null,\n type: 'text',\n required: true\n },\n {\n title: \"Email\",\n action: \"email\",\n placeholder: null,\n type: 'email',\n required: true\n },\n {\n title: \"Enter your Postcode\",\n action: \"address\",\n placeholder: \"Example: SW1 4EN\",\n type: 'zip',\n required: true\n },\n {\n title: \"What do you need help with today?\",\n action: \"category\",\n placeholder: null,\n type: 'select',\n required: true,\n options: {\n SALES: \"Sales\",\n TECH_SUPPORT: \"Tech Support\",\n COMPLAINT: \"Complaint\",\n },\n },\n {\n title: \"Submit\",\n action: \"submit_form\",\n type: 'button'\n }\n ]\n },\n messageId: `${Date.now()}-0000-0000-0000-000000000003`\n }\n];\n\nexport const notAccountHolder = [\n {\n senderType: \"CUSTOMER\",\n createdAt: moment(new Date()).format(),\n from: \"Client\",\n fromId: \"Client\",\n message: 'I am not the account holder',\n form: null,\n messageId: `${Date.now()}-0000-0000-0000-000000000001`\n },\n {\n senderType: \"AGENT\",\n createdAt: moment(new Date()).format(),\n from: \"YouFibre\",\n fromId: \"YouFibre\",\n message: \"We're so happy to hear from you! So that we can provide the best possible support, please provide us with the following information.\",\n form: null,\n messageId: `${Date.now()}-0000-0000-0000-000000000002`\n },\n {\n senderType: \"CUSTOMER\",\n createdAt: moment(new Date()).format(),\n from: \"YouFibre\",\n fromId: \"YouFibre\",\n message: null,\n form: {\n type: \"form\",\n value: [\n {\n title: \"Name\",\n action: \"full_name\",\n placeholder: null,\n type: 'text',\n required: true\n },\n {\n title: \"Email\",\n action: \"email\",\n placeholder: null,\n type: 'email',\n required: true\n },\n {\n title: \"Enter your Postcode\",\n action: \"address\",\n placeholder: \"Example: SW1 4EN\",\n type: 'zip',\n required: true\n },\n {\n title: \"What do you need help with today?\",\n action: \"category\",\n placeholder: null,\n type: 'select',\n required: true,\n options: {\n SALES: \"Sales\",\n TECH_SUPPORT: \"Tech Support\",\n COMPLAINT: \"Complaint\",\n },\n },\n {\n title: \"Submit\",\n action: \"submit_form\",\n type: 'button'\n }\n ]\n },\n messageId: `${Date.now()}-0000-0000-0000-000000000003`\n }\n];\n\nexport const yesAccountHolder = [\n {\n senderType: \"CUSTOMER\",\n createdAt: moment(new Date()).format(),\n from: \"Client\",\n fromId: \"Client\",\n message: 'I am the account holder',\n form: null,\n messageId: `${Date.now()}-0000-0000-0000-000000000001`\n },\n {\n senderType: \"AGENT\",\n createdAt: moment(new Date()).format(),\n from: \"YouFibre\",\n fromId: \"YouFibre\",\n message: \"We're so happy to hear from you! So that we can provide the best possible support, please provide us with the following information.\",\n form: null,\n messageId: `${Date.now()}-0000-0000-0000-000000000002`\n },\n {\n senderType: \"CUSTOMER\",\n createdAt: moment(new Date()).format(),\n from: \"YouFibre\",\n fromId: \"YouFibre\",\n message: null,\n form: {\n type: \"form\",\n value: [\n {\n title: \"Name\",\n action: \"full_name\",\n placeholder: null,\n type: 'text',\n required: true\n },\n {\n title: \"Email\",\n action: \"email\",\n placeholder: null,\n type: 'email',\n required: true\n },\n {\n title: \"Enter your Postcode\",\n action: \"address\",\n placeholder: \"Example: SW1 4EN\",\n type: 'zip',\n required: true\n },\n {\n title: \"What was the total value of your last bill?\",\n action: \"last_bill\",\n placeholder: 'Total amount of your last bill',\n type: 'number',\n required: true\n },\n {\n title: \"What do you need help with today?\",\n action: \"category\",\n placeholder: null,\n type: 'select',\n required: true,\n options: {\n SALES: \"Sales\",\n TECH_SUPPORT: \"Tech Support\",\n INSTALLS_AND_SERVICE_VISITS: \"Installs & Service Visits\",\n MANAGE_MY_ACCOUNT: \"Manage My Account\",\n BILLING: \"Billing\",\n CANCELLATION: \"Cancellation\",\n COMPLAINT: \"Complaint\",\n },\n },\n {\n title: \"Submit\",\n action: \"submit_form\",\n type: 'button'\n }\n ]\n },\n messageId: `${Date.now()}-0000-0000-0000-000000000003`\n }\n];\n\nexport const categories = {\n SALES: \"Sales\",\n TECH_SUPPORT: \"Tech Support\",\n INSTALLS_AND_SERVICE_VISITS: \"Installs & Service Visits\",\n MANAGE_MY_ACCOUNT: \"Manage My Account\",\n BILLING: \"Billing\",\n CANCELLATION: \"Cancellation\",\n COMPLAINT: \"Complaint\",\n};\n\nexport const userTypeLabels = {\n NEW_CUSTOMER: \"New customer\",\n ACCOUNT_HOLDER: \"Account holder\",\n NOT_ACCOUNT_HOLDER: \"Not the account holder\"\n};"],"names":["defaultMessages","createdAt","moment","Date","format","message","fromId","senderType","form","type","value","title","action","messageId","concat","now","from","initialTwilioChatState","logged","messages","chatCaseId","uploadArea","uploadedFiles","chatClosing","chatClosingType","chatLoading","chatUserId","chatUsername","confirmClosing","chatConversationId","chatSessionId","chatUserType","openChat","resetFormValues","token","typingAgent","typingCustomer","lightboxUrl","agentId","initialTwilioTimerState","receiveMsg","chatUnreaded","lastTimeActive","initialTwilioSettingsState","fullscreen","side","newAccountHolder","placeholder","required","options","SALES","TECH_SUPPORT","COMPLAINT","notAccountHolder","yesAccountHolder","INSTALLS_AND_SERVICE_VISITS","MANAGE_MY_ACCOUNT","BILLING","CANCELLAT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C,aAAc,eACdN,UAAW,aAGFQ,EAAiB,CAC1BC,aAAc,eACdC,eAAgB,iBAChBC,mBAAoB"}
@@ -1,2 +1,2 @@
1
- var t=function(){var t=window.location.host;return/staging|localhost/.test(t)};export{t as isStagingOrDevelopment};
1
+ import"react";var t=function(){var t=window.location.host;return/staging|localhost/.test(t)};export{t as isStagingOrDevelopment};
2
2
  //# sourceMappingURL=helperFn.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helperFn.js","sources":["../../../src/utils/helperFn.ts"],"sourcesContent":["export const isStagingOrDevelopment = () => {\n const hostName = window.location.host;\n return /staging|localhost/.test(hostName);\n};\n\nexport const isProduction = () => {\n const hostName = window.location.host;\n return !isStagingOrDevelopment();\n};"],"names":["isStagingOrDevelopment","hostName","window","location","host","test"],"mappings":"AAAO,IAAMA,EAAyB,WAClC,IAAMC,EAAWC,OAAOC,SAASC,KACjC,MAAO,oBAAoBC,KAAKJ,EACpC"}
1
+ {"version":3,"file":"helperFn.js","sources":["../../../src/utils/helperFn.js"],"sourcesContent":["import React from \"react\";\n\nexport const emailRegex = /^[a-zA-Z0-9._-]+@([a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,8}$/i;\n\nexport const updateQueryParam = (paramName, paramValue) => {\n if (typeof window !== undefined) {\n const queryParams = new URLSearchParams(window.location.search);\n queryParams.set(paramName, paramValue);\n window.history.pushState({ query: queryParams.toString() }, '', `?${queryParams.toString()}`);\n }\n};\n\nexport const findKey = (objectOfObjects) => {\n for (const key in objectOfObjects) {\n if (objectOfObjects.hasOwnProperty(key)) {\n const innerObject = objectOfObjects[key];\n if (innerObject.AM === true || innerObject.PM === true) {\n return {\n key,\n time: innerObject.AM === true ? 'AM' : 'PM'\n };\n }\n }\n }\n return null;\n}\n\nexport const getValueByKey = (arr, propName, propValue) => {\n return arr.find(i => i[propName] === propValue);\n}\n\nconst forbiddenNumbers = [\n \"3334439694\",\n \"3308181667\",\n \"3308222222\"\n]\n\nexport const isForbiddenNumber = (phoneNumber) => {\n const normalizedPhoneNumber = normalizePhoneNumber(phoneNumber);\n\n const withoutCountryCode = normalizedPhoneNumber.startsWith('44')\n ? normalizedPhoneNumber.slice(2)\n : normalizedPhoneNumber.startsWith('0')\n ? normalizedPhoneNumber.slice(1)\n : normalizedPhoneNumber;\n\n return forbiddenNumbers.includes(withoutCountryCode);\n}\n\nconst normalizePhoneNumber = (phoneNumber) => {\n return phoneNumber.trim().replace(/[^0-9]/g, '');\n};\n\nexport const getProperty = (object, propKey) => {\n if (object) {\n return object[propKey]\n }\n}\n\nexport const isStagingOrDevelopment = () => {\n const hostName = window.location.host;\n return /staging|localhost/.test(hostName);\n};\n\nexport const isProduction = () => {\n const hostName = window.location.host;\n return !isStagingOrDevelopment();\n};\n\nexport const findOfferParams = (location) => {\n const params = new URLSearchParams(location);\n\n const customerType = params.get('CustomerType');\n const code = params.get('code');\n\n if (\n customerType !== undefined &&\n customerType !== null &&\n code !== undefined &&\n code !== null\n ) {\n return {\n customerType,\n code\n };\n } else {\n return false;\n }\n}\n\nexport const findCodeParams = (location) => {\n const params = new URLSearchParams(location);\n\n const code = params.get('code');\n\n if (\n code !== undefined &&\n code !== null\n ) {\n return code;\n } else {\n return false;\n }\n}\n\nexport const getAssociativeArray = (array, keyName) => {\n const tempArr = [];\n array.forEach(element => {\n tempArr[element[keyName]] = element;\n });\n return tempArr;\n}\n\nexport const sanitizeTextForLineBreaks = (text) => {\n if (text)\n if (text.indexOf('\\n') !== -1)\n return text.split('\\n').map((item, key) => (\n <span key={key}>{item}<br /></span>\n ))\n\n else if (text.indexOf('<br>') !== -1) {\n return text.split('<br>').map((item, key) => (\n <span key={key}>{item}<br /></span>\n ))\n }\n else\n return <span>{text}</span>\n}"],"names":["isStagingOrDevelopment","hostName","window","location","host","test"],"mappings":"cA2DO,IAAMA,EAAyB,WAClC,IAAMC,EAAWC,OAAOC,SAASC,KACjC,MAAO,oBAAoBC,KAAKJ,EACpC"}
@@ -0,0 +1,2 @@
1
+ var t=function(t,n){if("string"==typeof n&&0===n.length||"number"==typeof n&&0===n)return!0;return{select:/^[a-zA-Z0-9\s\-_,.!?()/@"']+$/,text:/^[a-zA-Z0-9\s\-_,.!?()/@"']+$/,email:/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.+-]+\.[a-zA-Z0-9]{2,}$/,number:/^(?:1000000(?:\.0{1,2})?|[0-9]{1,6}(?:\.\d{1,2})?)$/}[t].test(n)},n=function(t,n){if(t){var e=t.reduce(function(t,e){return"submit_form"!==e.action&&(t[e.action]="/"!==n[e.action]&&n[e.action]||null),t},{});return!Object.values(e).some(function(t){return null===t})}};export{n as validateForm,t as validateFormInput};
2
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.js","sources":["../../../src/utils/validate.ts"],"sourcesContent":["// Chat message validation\nexport const validateInput = (data) => {\n // // Don't delete this code\n // if(data.length === 0) return true;\n // const regex = /^[a-zA-Z0-9\\s\\-,.!?()/@#&£€$=+*\"']+$/;\n // return regex.test(data);\n return true;\n};\n\n// Validate onChange Input fields in Form\nexport const validateFormInput = (type:string, data:any) => {\n if((typeof data === 'string' && data.length === 0) || (typeof data === 'number' && data === 0)) return true;\n const regex = {\n 'select': /^[a-zA-Z0-9\\s\\-_,.!?()/@\"']+$/,\n 'text': /^[a-zA-Z0-9\\s\\-_,.!?()/@\"']+$/,\n 'email': /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.+-]+\\.[a-zA-Z0-9]{2,}$/,\n 'number': /^(?:1000000(?:\\.0{1,2})?|[0-9]{1,6}(?:\\.\\d{1,2})?)$/,\n };\n return regex[type].test(data);\n};\n\n// Validate form\nexport const validateForm = (form, values) => {\n if(form){\n let tmpValues:object = form.reduce((acc: any, item: any) => {\n if (item.action !== \"submit_form\") {\n acc[item.action] = (values[item.action] !== \"/\" && values[item.action]) || null;\n }\n return acc;\n }, {});\n return !Object.values(tmpValues).some(value => value === null);\n }\n};"],"names":["validateFormInput","type","data","length","select","text","email","number","test","validateForm","form","values","tmpValues","reduce","acc","item","action","Object","some","value"],"mappings":"AAUO,IAAMA,EAAoB,SAACC,EAAaC,GAC7C,GAAoB,iBAATA,GAAqC,IAAhBA,EAAKC,QAAkC,iBAATD,GAA8B,IAATA,EAAa,OAAO,EAOvG,MANc,CACZE,OAAU,gCACVC,KAAQ,gCACRC,MAAS,uDACTC,OAAU,uDAECN,GAAMO,KAAKN,EAC1B,EAGaO,EAAe,SAACC,EAAMC,GACjC,GAAGD,EAAK,CACN,IAAIE,EAAmBF,EAAKG,OAAO,SAACC,EAAUC,GAI5C,MAHoB,gBAAhBA,EAAKC,SACPF,EAAIC,EAAKC,QAAmC,MAAxBL,EAAOI,EAAKC,SAAmBL,EAAOI,EAAKC,SAAY,MAEtEF,CACT,EAAG,CAAA,GACH,OAAQG,OAAON,OAAOC,GAAWM,KAAK,SAAAC,GAAS,OAAU,OAAVA,CAAA,EACjD,CACF"}
@@ -1,2 +1,18 @@
1
- export declare const isStagingOrDevelopment: () => boolean;
2
- export declare const isProduction: () => boolean;
1
+ export const emailRegex: RegExp;
2
+ export function updateQueryParam(paramName: any, paramValue: any): void;
3
+ export function findKey(objectOfObjects: any): {
4
+ key: string;
5
+ time: string;
6
+ };
7
+ export function getValueByKey(arr: any, propName: any, propValue: any): any;
8
+ export function isForbiddenNumber(phoneNumber: any): boolean;
9
+ export function getProperty(object: any, propKey: any): any;
10
+ export function isStagingOrDevelopment(): boolean;
11
+ export function isProduction(): boolean;
12
+ export function findOfferParams(location: any): false | {
13
+ customerType: string;
14
+ code: string;
15
+ };
16
+ export function findCodeParams(location: any): string | false;
17
+ export function getAssociativeArray(array: any, keyName: any): any[];
18
+ export function sanitizeTextForLineBreaks(text: any): any;
@@ -0,0 +1,3 @@
1
+ export declare const validateInput: (data: any) => boolean;
2
+ export declare const validateFormInput: (type: string, data: any) => any;
3
+ export declare const validateForm: (form: any, values: any) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d19n/webchat",
3
- "version": "1.0.6",
3
+ "version": "1.1.0",
4
4
  "description": "D19N WebChat package",
5
5
  "author": "@d19n",
6
6
  "license": "ISC",
@@ -12,16 +12,15 @@
12
12
  "dist"
13
13
  ],
14
14
  "scripts": {
15
- "develop": "npm install && rm -rf node_modules/react node_modules/react-dom && npm run build && npm link",
16
- "test": "echo \"Error: no test specified\" && exit 1",
17
- "build": "rollup -c --bundleConfigAsCjs"
15
+ "build": "npm install --legacy-peer-deps && npx rollup -c --bundleConfigAsCjs",
16
+ "dev": "npx rollup -c --bundleConfigAsCjs --watch"
18
17
  },
19
18
  "repository": {
20
19
  "type": "git",
21
20
  "url": "https://github.com/d19n-llc/d19n-webchat.git"
22
21
  },
23
22
  "dependencies": {
24
- "@d19n/odin-sdk-generator": "^3.0.39",
23
+ "@d19n/odin-sdk-generator": "^3.0.166",
25
24
  "@d19n/odin-types": "^1.0.62",
26
25
  "@d19n/youfibre-odin-sdk": "^1.0.125",
27
26
  "@rollup/plugin-commonjs": "^28.0.6",
@@ -30,11 +29,7 @@
30
29
  "@rollup/plugin-replace": "^6.0.2",
31
30
  "@rollup/plugin-terser": "^0.4.4",
32
31
  "@rollup/plugin-typescript": "^12.1.4",
33
- "@types/node": "^24.1.0",
34
- "@types/react": "^18.3.23",
35
- "@types/react-dom": "^18.3.7",
36
- "@types/react-modal-image": "^2.6.4",
37
- "@types/styled-components": "^5.1.34",
32
+ "@rollup/plugin-url": "^8.0.2",
38
33
  "buffer": "^6.0.3",
39
34
  "form-data": "^4.0.4",
40
35
  "linkify-html": "^4.3.2",
@@ -43,8 +38,9 @@
43
38
  "package": "^1.0.1",
44
39
  "process": "^0.11.10",
45
40
  "react-bootstrap": "^2.10.10",
46
- "react-dropzone": "^14.3.8",
47
- "react-icons": "^4.2.0",
41
+ "react-debounce-input": "^3.3.0",
42
+ "react-dropzone": "^14.2.10",
43
+ "react-icons": "^5.0.1",
48
44
  "react-markdown": "^5.0.3",
49
45
  "react-modal-image": "^2.6.0",
50
46
  "react-timer-hook": "^4.0.5",
@@ -56,18 +52,26 @@
56
52
  "rollup-plugin-peer-deps-external": "^2.2.4",
57
53
  "rollup-plugin-postcss": "^4.0.2",
58
54
  "sass": "^1.87.0",
55
+ "sass-loader": "^10.5.2",
59
56
  "socket.io-client": "^4.7.5",
60
- "styled-components": "^5.2.1",
57
+ "styled-components": "^6.1.8",
61
58
  "ts-node": "^10.9.2",
62
- "tslib": "^2.8.1",
63
- "typescript": "^5.8.3",
64
59
  "use-debounce": "^10.0.5",
65
60
  "uuid": "^11.1.0"
66
61
  },
67
62
  "peerDependencies": {
68
63
  "axios": "^1.11.0",
69
- "react": ">=18.1.1 <21",
70
- "react-dom": ">=18.1.1 <21"
64
+ "react": ">=18.2.0 <21",
65
+ "react-dom": ">=18.2.0 <21"
66
+ },
67
+ "devDependencies": {
68
+ "@types/node": "^24.1.0",
69
+ "@types/react": "^18.3.23",
70
+ "@types/react-dom": "^18.3.7",
71
+ "@types/react-modal-image": "^2.6.4",
72
+ "@types/styled-components": "^5.1.34",
73
+ "tslib": "^2.8.1",
74
+ "typescript": "^5.8.3"
71
75
  },
72
76
  "keywords": [
73
77
  "webchat",
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- declare const NoticationBar: ({ type }: any) => React.JSX.Element;
3
- export default NoticationBar;
@@ -1,2 +0,0 @@
1
- import{__require as i}from"../node_modules/@d19n/youfibre-odin-sdk/dist/api-sdk-v2/ConfigApi.js";var o=i();export{o as C};
2
- //# sourceMappingURL=ConfigApi.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ConfigApi.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- var r={};export{r as __exports};
2
- //# sourceMappingURL=ConfigApi2.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ConfigApi2.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- var r={};export{r as __exports};
2
- //# sourceMappingURL=api.provider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api.provider.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- var r={};export{r as __exports};
2
- //# sourceMappingURL=errors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- var r={};export{r as __exports};
2
- //# sourceMappingURL=helpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- import{getDefaultExportFromCjs as s}from"./_commonjsHelpers.js";import{__require as o}from"../node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js";var t=s(o());export{t as default};
2
- //# sourceMappingURL=hoist-non-react-statics.cjs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hoist-non-react-statics.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- var r={};export{r as __exports};
2
- //# sourceMappingURL=index12.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index12.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- var e={exports:{}};export{e as __module};
2
- //# sourceMappingURL=index13.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index13.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- import{getAugmentedNamespace as e}from"./_commonjsHelpers.js";import*as s from"../node_modules/change-case/dist.es2015/index.js";var o=e(s);export{o as default};
2
- //# sourceMappingURL=index14.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index14.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- var e={exports:{}};export{e as __module};
2
- //# sourceMappingURL=index15.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index15.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- var r={};export{r as __exports};
2
- //# sourceMappingURL=react-is.development2.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"react-is.development2.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- var r={};export{r as __exports};
2
- //# sourceMappingURL=react-is.development3.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"react-is.development3.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- var r={};export{r as __exports};
2
- //# sourceMappingURL=react-is.development4.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"react-is.development4.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- var r={};export{r as __exports};
2
- //# sourceMappingURL=react-is.production.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"react-is.production.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- var r={};export{r as __exports};
2
- //# sourceMappingURL=react-is.production.min2.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"react-is.production.min2.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- var r={};export{r as __exports};
2
- //# sourceMappingURL=react-is.production.min3.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"react-is.production.min3.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- var r={};export{r as __exports};
2
- //# sourceMappingURL=schema.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.types.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
package/dist/api/api.d.ts DELETED
@@ -1,17 +0,0 @@
1
- import { ConfigApi } from '@d19n/youfibre-odin-sdk/dist/api-sdk-v2/ConfigApi.js';
2
- /**
3
- * Configure the API instance.
4
- * @param host Full host URL including protocol (e.g., https://youfibre.api.sandbox.odinfusion.com)
5
- * @param clientId OAuth client ID
6
- * @param clientSecret OAuth client secret
7
- * @param customToken Optional custom token
8
- */
9
- export declare function setConfig(host: string, clientId: string, clientSecret: string, customToken?: string | undefined): ConfigApi;
10
- declare const API: {
11
- get: (url: string, options?: {}) => Promise<any>;
12
- post: (url: string, body: any, options?: {}) => Promise<any>;
13
- put: (url: string, body: any, options?: {}) => Promise<any>;
14
- patch: (url: string, body: any, options?: {}) => Promise<any>;
15
- delete: (url: string, options?: {}) => Promise<any>;
16
- };
17
- export default API;
Binary file
@@ -1,18 +0,0 @@
1
- import React, { ReactNode } from 'react';
2
- interface GlobalContextType {
3
- webchatData: any;
4
- appMessages: any;
5
- goSetWebchatData: (data: any) => void;
6
- goResetWebchatData: () => void;
7
- goSetRegistrationData: (registrationData: any) => void;
8
- goResetRegistrationData: () => void;
9
- goGetRegistrationData: () => any;
10
- setAppMessages: React.Dispatch<React.SetStateAction<any>>;
11
- }
12
- declare const GlobalContext: React.Context<GlobalContextType>;
13
- interface GlobalProviderProps {
14
- children: ReactNode;
15
- }
16
- export declare const GlobalProvider: React.FC<GlobalProviderProps>;
17
- export declare const useGlobalContext: () => GlobalContextType;
18
- export default GlobalContext;
@@ -1,2 +0,0 @@
1
- import{__exports as t}from"../../../../_virtual/api.provider.js";import{__require as e}from"../../odin-types/dist/types/errors.js";import r from"axios";import{__require as i}from"./utilities/helpers.js";var o;function s(){if(o)return t;o=1;var s=t&&t.__awaiter||function(t,e,r,i){return new(r||(r=Promise))(function(o,s){function n(t){try{a(i.next(t))}catch(t){s(t)}}function h(t){try{a(i.throw(t))}catch(t){s(t)}}function a(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(n,h)}a((i=i.apply(t,e||[])).next())})},n=t&&t.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(t,"__esModule",{value:!0}),t.ApiProvider=void 0;const h=e(),a=n(r),d=i();return t.ApiProvider=class{constructor(t,e){this.authParams=t,this.authToken=e,this.maxNumberOfRetries=3,this.host=process.env.ODIN_HOST_URL,this.clientId=process.env.ODIN_OAUTH_CLIENT_ID,this.clientSecret=process.env.ODIN_OAUTH_CLIENT_SECRET,e&&(this.token=e),t&&(this.host=t.host,this.clientId=t.clientId,this.clientSecret=t.clientSecret),this.authenticate()}authenticate(){return s(this,void 0,void 0,function*(){try{if(this.authToken)return;if(this.tokenExpiresAt){if(Date.now()+325e3<this.tokenExpiresAt)return{token:this.token,tokenType:this.tokenType};console.log("TOKEN EXPIRED REFRESHING")}if(!this.host)throw new Error("Host is required");if(!this.clientId)throw new Error("Client ID is required");if(!this.clientSecret)throw new Error("Client Secret is required");const t=Buffer.from(`${this.clientId}:${this.clientSecret}`).toString("base64"),e=yield this.callAPI({url:`https://${this.host}/IdentityModule/v1.0/oauth/token`,method:"post",headers:{Authorization:`Basic ${t}`}});this.token=e.access_token,this.tokenType=e.token_type;const r=1e3*e.expires_in;return this.tokenExpiresAt=Date.now()+r,{token:this.token,tokenType:this.tokenType}}catch(t){throw console.error("Error authenticating:",t),t}})}getPrincipal(){return s(this,void 0,void 0,function*(){try{yield this.authenticate();return(yield this.callAPI({url:`https://${this.host}/IdentityModule/v1.0/users/my`,method:"get"})).data}catch(t){throw t}})}customApi(t){return s(this,void 0,void 0,function*(){try{yield this.authenticate();return(yield this.callAPI({url:`https://${(null==t?void 0:t.host)||this.host}/${t.path}`,method:t.method,data:t.body,headers:t.headers})).data}catch(t){throw console.error("Error with custmoAPI call:",t),t}})}listSchemas(){return s(this,void 0,void 0,function*(){try{yield this.authenticate();return(yield this.callAPI({url:`https://${this.host}/SchemaModule/v1.0/schemas`,method:"get"})).data}catch(t){throw console.error("Error:",t),t}})}getPipelines(t,e){return s(this,void 0,void 0,function*(){try{yield this.authenticate();return(yield this.callAPI({url:`https://${this.host}/SchemaModule/v1.0/pipelines/list/${t}/${e}`,method:"get"})).data}catch(t){throw console.error("Error:",t),t}})}getSchema(t,e){return s(this,void 0,void 0,function*(){try{yield this.authenticate();return(yield this.callAPI({url:`https://${this.host}/SchemaModule/v1.0/schemas/bymodule/?moduleName=${t}&entityName=${e}`,method:"get"})).data}catch(t){throw console.error("Error:",t),t}})}_reIndexRecords(t){return s(this,void 0,void 0,function*(){try{yield this.authenticate();return(yield this.callAPI({url:`https://${this.host}/SearchModule/v1.0/search/reindex`,method:"post",data:t})).data}catch(t){throw t}})}_searchRecords(t,e,r){return s(this,void 0,void 0,function*(){try{yield this.authenticate(),r.query.entity=`${t}:${e}`;return(yield this.callAPI({url:`https://${this.host}/${t}/v2.0/records/search`,method:"post",data:{returnQueryPlan:r.returnQueryPlan,query:r.query}})).data}catch(t){throw t}})}_searchAllRecordsAndPaginate(t,e,r,i=0){var o,n;return s(this,void 0,void 0,function*(){try{if(null===(o=null==r?void 0:r.query)||void 0===o?void 0:o.aggs)throw new Error("Aggregations are not supported for deep pagination. Use the standard search records API");r.query.hasOwnProperty("pageSize")||(r.query.pageSize=500),r.query.hasOwnProperty("pageNumber")||(r.query.pageNumber=0),i&&(r.query.pageNumber=i);const s=yield this._searchRecords(t,e,r),h=s;if(s.hasMore){let i=s.records[s.records.length-1];if(i&&i.hasOwnProperty("sort")?(r.query.searchAfter=i.sort,r.query.pageNumber=0):r.query.pageNumber=r.query.pageNumber+1,(null===(n=s.records)||void 0===n?void 0:n.length)>=r.query.pageSize){const i=yield this._searchAllRecordsAndPaginate(t,e,r,r.query.pageNumber);h.records.push(...i.records)}}return h}catch(t){throw t}})}_getByPrimaryKey(t,e,r){return s(this,void 0,void 0,function*(){try{yield this.authenticate();return(yield this.callAPI({url:`https://${this.host}/${t}/v2.0/records/${e}/${r}`})).data}catch(t){throw t}})}_getManyByPrimaryKey(t,e,r){return s(this,void 0,void 0,function*(){try{yield this.authenticate();return(yield this.callAPI({url:`https://${this.host}/${t}/v2.0/records/${e}?primaryKeys=${r.join()}`})).data}catch(t){throw t}})}_upsert(t,e,r){return s(this,void 0,void 0,function*(){try{const e=[];yield this.authenticate();const i=(0,d.chunkArray)(r,200);for(const r of i){const i=yield this.callAPI({url:`https://${this.host}/${t}/v2.0/records/upsert`,method:"post",data:{recordsToUpsert:r}});e.push(...i.data)}return e}catch(t){throw t}})}_update(t,e,r){return s(this,void 0,void 0,function*(){try{const e=[];yield this.authenticate();const i=(0,d.chunkArray)(r,200);for(const r of i){const i=yield this.callAPI({url:`https://${this.host}/${t}/v2.0/records/update`,method:"patch",data:{recordsToUpdate:r}});e.push(...i.data)}return e}catch(t){throw t}})}_delete(t,e,r){return s(this,void 0,void 0,function*(){try{const i=[];yield this.authenticate();const o=[];for(const i of r)o.push({entity:`${t}:${e}`,recordId:i});const s=(0,d.chunkArray)(o,200);for(const e of s){const r=yield this.callAPI({url:`https://${this.host}/${t}/v2.0/records/delete`,method:"delete",data:{recordsToDelete:e}});i.push(...r.data)}return i}catch(t){throw t}})}_restore(t,e,r){return s(this,void 0,void 0,function*(){try{yield this.authenticate();const i=[],o=[];for(const i of r)o.push({entity:`${t}:${e}`,recordId:i});const s=(0,d.chunkArray)(o,100);for(const e of s){const r=yield this.callAPI({url:`https://${this.host}/${t}/v2.0/records/restore`,method:"post",data:{recordsToDelete:e}});i.push(...r.data)}return i}catch(t){throw t}})}_applyAction(t,e,r){return s(this,void 0,void 0,function*(){try{const e=[];yield this.authenticate();const i=yield this.callAPI({url:`https://${this.host}/${t}/v2.0/records/apply-action`,method:"post",data:r});return e.push(...i.data),e}catch(t){throw t}})}_getLinks(t,e,r,i){var o;return s(this,void 0,void 0,function*(){try{yield this.authenticate();const s=yield this.callAPI({url:`https://${this.host}/${t}/v2.0/records/${e}/${r}/links?targetEntities=["${i}"]`,method:"get"});return(null===(o=s.data[i])||void 0===o?void 0:o.dbRecords)||[]}catch(t){throw t}})}_createLinks(t,e,r,i){return s(this,void 0,void 0,function*(){try{yield this.authenticate();return(yield this.callAPI({url:`https://${this.host}/${t}/v2.0/records/${e}/${r}/links`,method:"post",data:i})).data}catch(t){throw t}})}_deleteLinks(t,e,r,i){return s(this,void 0,void 0,function*(){try{yield this.authenticate();return(yield this.callAPI({url:`https://${this.host}/${t}/v2.0/records/${e}/${r}/links/${i}`,method:"delete"})).data}catch(t){throw t}})}_updateLinkProperties(t,e,r,i,o){return s(this,void 0,void 0,function*(){try{yield this.authenticate();return(yield this.callAPI({url:`https://${this.host}/${t}/v2.0/records/${e}/${r}/links/${i}`,method:"put",data:o})).data}catch(t){throw t}})}_getVersions(t,e,r){return s(this,void 0,void 0,function*(){try{yield this.authenticate();return(yield this.callAPI({url:`https://${this.host}/${t}/v2.0/records/${e}/${r}/versions`})).data}catch(t){throw t}})}_getRevisionTimeline(t,e,r){return s(this,void 0,void 0,function*(){try{yield this.authenticate();return(yield this.callAPI({url:`https://${this.host}/${t}/v2.0/records/${e}/${r}/revision-timeline`})).data}catch(t){throw t}})}callAPI(t){var e,r,i,o,n;return s(this,void 0,void 0,function*(){try{return(yield this.retryingFetch(t)).data}catch(t){if(a.default.isAxiosError(t)&&t.response)throw new h.OdinApiError(t.response.status,null===(e=t.response.data)||void 0===e?void 0:e.message,null===(i=null===(r=t.response)||void 0===r?void 0:r.data)||void 0===i?void 0:i.validation,null===(n=null===(o=t.response)||void 0===o?void 0:o.data)||void 0===n?void 0:n.data);throw Error,new h.OdinApiError(500,"Unknown error occurred",[],{})}})}retryingFetch(t,e=this.maxNumberOfRetries,r=1e3,i=.5){var o;return s(this,void 0,void 0,function*(){try{"true"===process.env.SDK_DEBUG&&console.log("API request",JSON.stringify({url:t.url,method:t.method,headers:Object.assign({"Content-Type":"application/json",Accept:"application/json",Authorization:`${this.tokenType} ${this.token}`},t.headers),data:t.data},null,2));const e=yield a.default.request({url:t.url,method:t.method,headers:Object.assign({"Content-Type":"application/json",Accept:"application/json",Authorization:`${this.tokenType} ${this.token}`},t.headers),data:t.data});return"true"===process.env.SDK_DEBUG&&console.log("API response",JSON.stringify(null==e?void 0:e.data,null,2)),e}catch(s){if(a.default.isAxiosError(s)){const t=null===(o=s.response)||void 0===o?void 0:o.status;if([401,422,404].includes(t))throw s}if(0===e)throw s;const n=r*2**(3-e),h=n+n*i*(2*Math.random()-1);return yield new Promise(t=>setTimeout(t,h)),this.retryingFetch(t,e-1)}})}},t}export{s as __require};
2
- //# sourceMappingURL=api.provider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api.provider.js","sources":["../../../../../node_modules/@d19n/odin-sdk-generator/dist/api.provider.js"],"sourcesContent":["\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ApiProvider = void 0;\nconst errors_1 = require(\"@d19n/odin-types/dist/types/errors\");\nconst axios_1 = __importDefault(require(\"axios\"));\nconst helpers_1 = require(\"./utilities/helpers\");\nclass ApiProvider {\n constructor(authParams, authToken) {\n this.authParams = authParams;\n this.authToken = authToken;\n this.maxNumberOfRetries = 3;\n this.host = process.env.ODIN_HOST_URL; // api.company.com\n this.clientId = process.env.ODIN_OAUTH_CLIENT_ID;\n this.clientSecret = process.env.ODIN_OAUTH_CLIENT_SECRET;\n if (authToken) {\n this.token = authToken;\n }\n if (authParams) {\n this.host = authParams.host;\n this.clientId = authParams.clientId;\n this.clientSecret = authParams.clientSecret;\n }\n this.authenticate();\n }\n authenticate() {\n return __awaiter(this, void 0, void 0, function* () {\n try {\n // skip OAuth if token is provided\n if (this.authToken) {\n return;\n }\n if (this.tokenExpiresAt) {\n const checkDate = Date.now() + 325 * 1000; // Current time plus 10 minutes\n if (checkDate < this.tokenExpiresAt) {\n return {\n token: this.token,\n tokenType: this.tokenType,\n };\n }\n else {\n console.log('TOKEN EXPIRED REFRESHING');\n }\n }\n if (!this.host) {\n throw new Error('Host is required');\n }\n if (!this.clientId) {\n throw new Error('Client ID is required');\n }\n if (!this.clientSecret) {\n throw new Error('Client Secret is required');\n }\n const credentials = Buffer.from(`${this.clientId}:${this.clientSecret}`).toString('base64');\n const res = yield this.callAPI({\n url: `https://${this.host}/IdentityModule/v1.0/oauth/token`,\n method: 'post',\n headers: {\n Authorization: `Basic ${credentials}`,\n },\n });\n this.token = res.access_token;\n this.tokenType = res.token_type;\n const expirationSecondsInMilliseconds = res.expires_in * 1000;\n // Calculate the expiration time\n this.tokenExpiresAt = Date.now() + expirationSecondsInMilliseconds;\n return {\n token: this.token,\n tokenType: this.tokenType,\n };\n }\n catch (error) {\n // Handle errors\n console.error('Error authenticating:', error);\n throw error;\n }\n });\n }\n getPrincipal() {\n return __awaiter(this, void 0, void 0, function* () {\n try {\n yield this.authenticate();\n const res = yield this.callAPI({\n url: `https://${this.host}/IdentityModule/v1.0/users/my`,\n method: 'get',\n });\n return res.data;\n }\n catch (error) {\n throw error;\n }\n });\n }\n customApi(params) {\n return __awaiter(this, void 0, void 0, function* () {\n try {\n yield this.authenticate();\n const res = yield this.callAPI({\n url: `https://${(params === null || params === void 0 ? void 0 : params.host) || this.host}/${params.path}`,\n method: params.method,\n data: params.body,\n headers: params.headers\n });\n return res.data;\n }\n catch (error) {\n // Handle errors\n console.error('Error with custmoAPI call:', error);\n throw error;\n }\n });\n }\n listSchemas() {\n return __awaiter(this, void 0, void 0, function* () {\n try {\n yield this.authenticate();\n const res = yield this.callAPI({\n url: `https://${this.host}/SchemaModule/v1.0/schemas`,\n method: 'get',\n });\n return res.data;\n }\n catch (error) {\n // Handle errors\n console.error('Error:', error);\n throw error;\n }\n });\n }\n getPipelines(moduleName, entityName) {\n return __awaiter(this, void 0, void 0, function* () {\n try {\n yield this.authenticate();\n const res = yield this.callAPI({\n url: `https://${this.host}/SchemaModule/v1.0/pipelines/list/${moduleName}/${entityName}`,\n method: 'get',\n });\n return res.data;\n }\n catch (error) {\n // Handle errors\n console.error('Error:', error);\n throw error;\n }\n });\n }\n getSchema(moduleName, entityName) {\n return __awaiter(this, void 0, void 0, function* () {\n try {\n yield this.authenticate();\n const res = yield this.callAPI({\n url: `https://${this.host}/SchemaModule/v1.0/schemas/bymodule/?moduleName=${moduleName}&entityName=${entityName}`,\n method: 'get',\n });\n return res.data;\n }\n catch (error) {\n // Handle errors\n console.error('Error:', error);\n throw error;\n }\n });\n }\n _reIndexRecords(body) {\n return __awaiter(this, void 0, void 0, function* () {\n try {\n yield this.authenticate();\n const res = yield this.callAPI({\n url: `https://${this.host}/SearchModule/v1.0/search/reindex`,\n method: 'post',\n data: body,\n });\n return res.data;\n }\n catch (error) {\n throw error;\n }\n });\n }\n _searchRecords(moduleName, entityName, params) {\n return __awaiter(this, void 0, void 0, function* () {\n try {\n yield this.authenticate();\n params.query.entity = `${moduleName}:${entityName}`;\n const res = yield this.callAPI({\n url: `https://${this.host}/${moduleName}/v2.0/records/search`,\n method: 'post',\n data: {\n returnQueryPlan: params.returnQueryPlan,\n query: params.query,\n },\n });\n return res.data;\n }\n catch (error) {\n throw error;\n }\n });\n }\n _searchAllRecordsAndPaginate(moduleName, entityName, params, nextPage = 0) {\n var _a, _b;\n return __awaiter(this, void 0, void 0, function* () {\n try {\n if ((_a = params === null || params === void 0 ? void 0 : params.query) === null || _a === void 0 ? void 0 : _a.aggs) {\n throw new Error('Aggregations are not supported for deep pagination. Use the standard search records API');\n }\n if (!params.query.hasOwnProperty('pageSize')) {\n params.query.pageSize = 500;\n }\n if (!params.query.hasOwnProperty('pageNumber')) {\n params.query.pageNumber = 0;\n }\n // For auto scrolling up to 10,000 records\n if (nextPage) {\n params.query.pageNumber = nextPage;\n }\n const result = yield this._searchRecords(moduleName, entityName, params);\n const allResults = result;\n const morePages = result.hasMore;\n if (morePages) {\n // Call the function recursively with the next page number\n // For deep pagination if the last result has sort key\n // Use that to paginate further\n let lastResult = result.records[result.records.length - 1];\n if (lastResult && lastResult.hasOwnProperty('sort')) {\n params.query.searchAfter = lastResult['sort'];\n params.query.pageNumber = 0;\n }\n else {\n params.query.pageNumber = params.query.pageNumber + 1;\n }\n if (((_b = result.records) === null || _b === void 0 ? void 0 : _b.length) >= params.query.pageSize) {\n const nextPageResults = yield this._searchAllRecordsAndPaginate(moduleName, entityName, params, params.query.pageNumber);\n allResults.records.push(...nextPageResults.records);\n }\n }\n // Return the accumulated results\n return allResults;\n }\n catch (error) {\n throw error;\n }\n });\n }\n _getByPrimaryKey(moduleName, entityName, primaryKey) {\n return __awaiter(this, void 0, void 0, function* () {\n try {\n yield this.authenticate();\n const res = yield this.callAPI({\n url: `https://${this.host}/${moduleName}/v2.0/records/${entityName}/${primaryKey}`,\n });\n return res.data;\n }\n catch (error) {\n throw error;\n }\n });\n }\n _getManyByPrimaryKey(moduleName, entityName, primaryKeys) {\n return __awaiter(this, void 0, void 0, function* () {\n try {\n yield this.authenticate();\n const res = yield this.callAPI({\n url: `https://${this.host}/${moduleName}/v2.0/records/${entityName}?primaryKeys=${primaryKeys.join()}`,\n });\n return res.data;\n }\n catch (error) {\n throw error;\n }\n });\n }\n _upsert(moduleName, entityName, dtos) {\n return __awaiter(this, void 0, void 0, function* () {\n try {\n const results = [];\n yield this.authenticate();\n const batches = (0, helpers_1.chunkArray)(dtos, 200);\n for (const batch of batches) {\n const res = yield this.callAPI({\n url: `https://${this.host}/${moduleName}/v2.0/records/upsert`,\n method: 'post',\n data: {\n recordsToUpsert: batch,\n },\n });\n results.push(...res.data);\n }\n return results;\n }\n catch (error) {\n throw error;\n }\n });\n }\n _update(moduleName, entityName, dtos) {\n return __awaiter(this, void 0, void 0, function* () {\n try {\n const results = [];\n yield this.authenticate();\n const batches = (0, helpers_1.chunkArray)(dtos, 200);\n for (const batch of batches) {\n const res = yield this.callAPI({\n url: `https://${this.host}/${moduleName}/v2.0/records/update`,\n method: 'patch',\n data: {\n recordsToUpdate: batch,\n },\n });\n results.push(...res.data);\n }\n return results;\n }\n catch (error) {\n throw error;\n }\n });\n }\n _delete(moduleName, entityName, primaryKeys) {\n return __awaiter(this, void 0, void 0, function* () {\n try {\n const results = [];\n yield this.authenticate();\n const dtos = [];\n for (const pk of primaryKeys) {\n dtos.push({\n entity: `${moduleName}:${entityName}`,\n recordId: pk,\n });\n }\n const batches = (0, helpers_1.chunkArray)(dtos, 200);\n for (const batch of batches) {\n const res = yield this.callAPI({\n url: `https://${this.host}/${moduleName}/v2.0/records/delete`,\n method: 'delete',\n data: {\n recordsToDelete: batch,\n },\n });\n results.push(...res.data);\n }\n return results;\n }\n catch (error) {\n throw error;\n }\n });\n }\n _restore(moduleName, entityName, primaryKeys) {\n return __awaiter(this, void 0, void 0, function* () {\n try {\n yield this.authenticate();\n const results = [];\n const dtos = [];\n for (const pk of primaryKeys) {\n dtos.push({\n entity: `${moduleName}:${entityName}`,\n recordId: pk,\n });\n }\n const batches = (0, helpers_1.chunkArray)(dtos, 100);\n for (const batch of batches) {\n const res = yield this.callAPI({\n url: `https://${this.host}/${moduleName}/v2.0/records/restore`,\n method: 'post',\n data: {\n recordsToDelete: batch,\n },\n });\n results.push(...res.data);\n }\n return results;\n }\n catch (error) {\n throw error;\n }\n });\n }\n _applyAction(moduleName, entityName, dto) {\n return __awaiter(this, void 0, void 0, function* () {\n try {\n const results = [];\n yield this.authenticate();\n const res = yield this.callAPI({\n url: `https://${this.host}/${moduleName}/v2.0/records/apply-action`,\n method: 'post',\n data: dto,\n });\n results.push(...res.data);\n return results;\n }\n catch (error) {\n throw error;\n }\n });\n }\n _getLinks(moduleName, entityName, primaryKey, targetEntityName) {\n var _a;\n return __awaiter(this, void 0, void 0, function* () {\n try {\n yield this.authenticate();\n const res = yield this.callAPI({\n url: `https://${this.host}/${moduleName}/v2.0/records/${entityName}/${primaryKey}/links?targetEntities=[\"${targetEntityName}\"]`,\n method: 'get',\n });\n return ((_a = res.data[targetEntityName]) === null || _a === void 0 ? void 0 : _a.dbRecords) || [];\n }\n catch (error) {\n throw error;\n }\n });\n }\n _createLinks(moduleName, entityName, primaryKey, dtos) {\n return __awaiter(this, void 0, void 0, function* () {\n try {\n yield this.authenticate();\n const res = yield this.callAPI({\n url: `https://${this.host}/${moduleName}/v2.0/records/${entityName}/${primaryKey}/links`,\n method: 'post',\n data: dtos,\n });\n return res.data;\n }\n catch (error) {\n throw error;\n }\n });\n }\n _deleteLinks(moduleName, entityName, primaryKey, linkedPrimaryKey) {\n return __awaiter(this, void 0, void 0, function* () {\n try {\n yield this.authenticate();\n const res = yield this.callAPI({\n url: `https://${this.host}/${moduleName}/v2.0/records/${entityName}/${primaryKey}/links/${linkedPrimaryKey}`,\n method: 'delete',\n });\n return res.data;\n }\n catch (error) {\n throw error;\n }\n });\n }\n _updateLinkProperties(moduleName, linkedEntityName, linkedRecordPrimaryKey, dbRecordAssociationId, dto) {\n return __awaiter(this, void 0, void 0, function* () {\n try {\n yield this.authenticate();\n const res = yield this.callAPI({\n url: `https://${this.host}/${moduleName}/v2.0/records/${linkedEntityName}/${linkedRecordPrimaryKey}/links/${dbRecordAssociationId}`,\n method: 'put',\n data: dto,\n });\n return res.data;\n }\n catch (error) {\n throw error;\n }\n });\n }\n _getVersions(moduleName, entityName, primaryKey) {\n return __awaiter(this, void 0, void 0, function* () {\n try {\n yield this.authenticate();\n const res = yield this.callAPI({\n url: `https://${this.host}/${moduleName}/v2.0/records/${entityName}/${primaryKey}/versions`,\n });\n return res.data;\n }\n catch (error) {\n throw error;\n }\n });\n }\n _getRevisionTimeline(moduleName, entityName, primaryKey) {\n return __awaiter(this, void 0, void 0, function* () {\n try {\n yield this.authenticate();\n const res = yield this.callAPI({\n url: `https://${this.host}/${moduleName}/v2.0/records/${entityName}/${primaryKey}/revision-timeline`,\n });\n return res.data;\n }\n catch (error) {\n throw error;\n }\n });\n }\n callAPI(config) {\n var _a, _b, _c, _d, _e;\n return __awaiter(this, void 0, void 0, function* () {\n try {\n const response = yield this.retryingFetch(config);\n return response.data;\n }\n catch (e) {\n if (axios_1.default.isAxiosError(e)) {\n if (e.response) {\n throw new errors_1.OdinApiError(e.response.status, (_a = e.response.data) === null || _a === void 0 ? void 0 : _a.message, (_c = (_b = e.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.validation, (_e = (_d = e.response) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.data);\n }\n }\n if (e instanceof Error) {\n throw new errors_1.OdinApiError(500, 'Unknown error occurred', [], {});\n }\n else {\n throw new errors_1.OdinApiError(500, 'Unknown error occurred', [], {});\n }\n }\n });\n }\n retryingFetch(config, retries = this.maxNumberOfRetries, initialDelay = 1000, jitterFactor = 0.5) {\n var _a;\n return __awaiter(this, void 0, void 0, function* () {\n try {\n if (process.env.SDK_DEBUG === 'true') {\n console.log('API request', JSON.stringify({\n url: config.url,\n method: config.method,\n headers: Object.assign({ 'Content-Type': 'application/json', Accept: 'application/json', Authorization: `${this.tokenType} ${this.token}` }, config.headers),\n data: config.data,\n }, null, 2));\n }\n const response = yield axios_1.default.request({\n url: config.url,\n method: config.method,\n headers: Object.assign({ 'Content-Type': 'application/json', Accept: 'application/json', Authorization: `${this.tokenType} ${this.token}` }, config.headers),\n data: config.data,\n });\n if (process.env.SDK_DEBUG === 'true') {\n console.log('API response', JSON.stringify(response === null || response === void 0 ? void 0 : response.data, null, 2));\n }\n return response;\n }\n catch (e) {\n if (axios_1.default.isAxiosError(e)) {\n const errorCode = (_a = e.response) === null || _a === void 0 ? void 0 : _a.status;\n if ([401, 422, 404].includes(errorCode)) {\n throw e;\n }\n }\n if (retries === 0) {\n throw e;\n }\n // Calculate exponential backoff with jitter\n const delay = initialDelay * 2 ** (3 - retries);\n const jitter = delay * jitterFactor * (Math.random() * 2 - 1);\n const backoffDelay = delay + jitter;\n // Wait before retrying the request\n yield new Promise((resolve) => setTimeout(resolve, backoffDelay));\n return this.retryingFetch(config, retries - 1);\n }\n });\n }\n}\nexports.ApiProvider = ApiProvider;\n"],"names":["__awaiter","this","thisArg","_arguments","P","generator","Promise","resolve","reject","fulfilled","value","step","next","e","rejected","result","done","then","apply","__importDefault","mod","__esModule","default","Object","defineProperty","api_provider","ApiProvider","errors_1","require$$0","axios_1","require$$1","helpers_1","require$$2","constructor","authParams","authToken","maxNumberOfRetries","host","process","env","ODIN_HOST_URL","clientId","ODIN_OAUTH_CLIENT_ID","clientSecret","ODIN_OAUTH_CLIENT_SECRET","token","authenticate","tokenExpiresAt","Date","now","tokenType","console","log","Error","credentials","Buffer","from","toString","res","callAPI","url","method","headers","Authorization","access_token","token_type","expirationSecondsInMilliseconds","expires_in","error","getPrincipal","data","customApi","params","path","body","listSchemas","getPipelines","moduleName","entityName","getSchema","_reIndexRecords","_searchRecords","query","entity","returnQueryPlan","_searchAllRecordsAndPaginate","nextPage","_a","_b","aggs","hasOwnProperty","pageSize","pageNumber","allResults","hasMore","lastResult","records","length","searchAfter","nextPageResults","push","_getByPrimaryKey","primaryKey","_getManyByPrimaryKey","primaryKeys","join","_upsert","dtos","results","batches","chunkArray","batch","recordsToUpsert","_update","recordsToUpdate","_delete","pk","recordId","recordsToDelete","_restore","_applyAction","dto","_getLinks","targetEntityName","dbRecords","_createLinks","_deleteLinks","linkedPrimaryKey","_updateLinkProperties","linkedEntityName","linkedRecordPrimaryKey","dbRecordAssociationId","_getVersions","_getRevisionTimeline","config","_c","_d","_e","retryingFetch","isAxiosError","response","OdinApiError","status","message","validation","retries","initialDelay","jitterFactor","SDK_DEBUG","JSON","stringify","assign","Accept","request","errorCode","includes","delay","backoffDelay","Math","random","setTimeout"],"mappings":"gPACA,IAAIA,EAAaC,GAAQA,EAAKD,WAAc,SAAUE,EAASC,EAAYC,EAAGC,GAE1E,OAAO,IAAKD,IAAMA,EAAIE,UAAU,SAAUC,EAASC,GAC/C,SAASC,EAAUC,GAAS,I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D,EADNA,EAAQT,GAAgC,EAAhBW,KAAKC,SAAe,GAI3D,aADM,IAAIzJ,QAASC,GAAYyJ,WAAWzJ,EAASsJ,IAC5C5J,KAAKyI,cAAcJ,EAAQW,EAAU,EAC5D,CACA,EACA","x_google_ignoreList":[0]}
@@ -1,2 +0,0 @@
1
- import{__exports as e}from"../../../../../_virtual/helpers.js";import n from"../../../../../_virtual/index14.js";import{__require as r}from"../../../odin-types/dist/types/schema.types.js";var a;function s(){if(a)return e;a=1,Object.defineProperty(e,"__esModule",{value:!0}),e.applyCaseToString=e.chunkArray=void 0;const s=n,t=r();return e.chunkArray=(e,n)=>Array.from({length:Math.ceil(e.length/n)},(r,a)=>e.slice(a*n,a*n+n)),e.applyCaseToString=function(e,n){if(!e)return e;function r(e){return(0,s.camelCase)(e)}switch(n){case t.ChangeCaseEnums.LOWER_CASE:return e.toLowerCase();case t.ChangeCaseEnums.UPPER_CASE:return e.toUpperCase();case t.ChangeCaseEnums.CAMEL_CASE:return r(e);case t.ChangeCaseEnums.CAPITAL_CASE:return a=e,(0,s.capitalCase)(a);case t.ChangeCaseEnums.CONSTANT_CASE:return function(e){return(0,s.constantCase)(e)}(e);case t.ChangeCaseEnums.DOT_CASE:return function(e){return(0,s.dotCase)(e)}(e);case t.ChangeCaseEnums.PASCAL_CASE:return function(e){return(0,s.pascalCase)(e)}(e);case t.ChangeCaseEnums.PATH_CASE:return function(e){return(0,s.pathCase)(e)}(e);case t.ChangeCaseEnums.SENTENCE_CASE:return function(e){return(0,s.sentenceCase)(e)}(e);case t.ChangeCaseEnums.SNAKE_CASE:return function(e){return(0,s.snakeCase)(e)}(e);case t.ChangeCaseEnums.CAMEL_UPPER_CASE:case t.ChangeCaseEnums.CAMEL_LOWER_CASE:return r(e);case t.ChangeCaseEnums.UPPERCASE_NOCASE_NOSPACE:return function(e){return e.replace(/\s+/g,"").toUpperCase()}(e);default:return e}var a},e}export{s as __require};
2
- //# sourceMappingURL=helpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers.js","sources":["../../../../../../node_modules/@d19n/odin-sdk-generator/dist/utilities/helpers.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.applyCaseToString = exports.chunkArray = void 0;\nconst change_case_1 = require(\"change-case\");\nconst schema_types_1 = require(\"@d19n/odin-types/dist/types/schema.types\");\nconst chunkArray = (arr, size) => {\n return Array.from({ length: Math.ceil(arr.length / size) }, (v, i) => arr.slice(i * size, i * size + size));\n};\nexports.chunkArray = chunkArray;\nfunction applyCaseToString(value, stringCase) {\n if (!value) {\n return value;\n }\n function toCapitalCase(inputString) {\n return (0, change_case_1.capitalCase)(inputString);\n }\n function toConstantCase(inputString) {\n return (0, change_case_1.constantCase)(inputString);\n }\n function toPascalCase(inputString) {\n return (0, change_case_1.pascalCase)(inputString);\n }\n function toCamelCase(inputString) {\n return (0, change_case_1.camelCase)(inputString);\n }\n function toDotCase(inputString) {\n return (0, change_case_1.dotCase)(inputString);\n }\n function toSnakeCase(inputString) {\n return (0, change_case_1.snakeCase)(inputString);\n }\n function toSentenceCase(inputString) {\n return (0, change_case_1.sentenceCase)(inputString);\n }\n function toPathCase(inputString) {\n return (0, change_case_1.pathCase)(inputString);\n }\n function toUpperCaseNoSpaces(inputString) {\n return inputString.replace(/\\s+/g, '').toUpperCase();\n }\n switch (stringCase) {\n case schema_types_1.ChangeCaseEnums.LOWER_CASE:\n return value.toLowerCase();\n case schema_types_1.ChangeCaseEnums.UPPER_CASE:\n return value.toUpperCase();\n case schema_types_1.ChangeCaseEnums.CAMEL_CASE:\n return toCamelCase(value);\n case schema_types_1.ChangeCaseEnums.CAPITAL_CASE:\n return toCapitalCase(value);\n case schema_types_1.ChangeCaseEnums.CONSTANT_CASE:\n return toConstantCase(value);\n case schema_types_1.ChangeCaseEnums.DOT_CASE:\n return toDotCase(value);\n case schema_types_1.ChangeCaseEnums.PASCAL_CASE:\n return toPascalCase(value);\n case schema_types_1.ChangeCaseEnums.PATH_CASE:\n return toPathCase(value);\n case schema_types_1.ChangeCaseEnums.SENTENCE_CASE:\n return toSentenceCase(value);\n case schema_types_1.ChangeCaseEnums.SNAKE_CASE:\n return toSnakeCase(value);\n case schema_types_1.ChangeCaseEnums.CAMEL_UPPER_CASE:\n return toCamelCase(value);\n case schema_types_1.ChangeCaseEnums.CAMEL_LOWER_CASE:\n return toCamelCase(value);\n case schema_types_1.ChangeCaseEnums.UPPERCASE_NOCASE_NOSPACE:\n return toUpperCaseNoSpaces(value);\n default:\n return value;\n }\n}\nexports.applyCaseToString = applyCaseToString;\n"],"names":["Object","defineProperty","helpers","value","applyCaseToString","chunkArray","change_case_1","require$$0","schema_types_1","require$$1","arr","size","Array","from","length","Math","ceil","v","i","slice","stringCase","toCamelCase","inputString","camelCase","ChangeCaseEnums","LOWER_CASE","toLowerCase","UPPER_CASE","toUpperCase","CAMEL_CASE","CAPITAL_CASE","capitalCase","CONSTANT_CASE","constantCase","toConstantCase","DOT_CASE","dotCase","toDotCase","PASCAL_CASE","pascalCase","toPascalCase","PATH_CASE","pathCase","toPathCase","SENTENCE_CASE","sentenceCase","toSentenceCase","SNAKE_CASE","snakeCase","toSnakeCase","CAMEL_UPPER_CASE","CAMEL_LOWER_CASE","UPPERCASE_NOCASE_NOSPACE","replace","toUpperCaseNoSpaces"],"mappings":"iOACAA,OAAOC,eAAeC,EAAS,aAAc,CAAEC,OAAO,IACtDD,EAAAE,kBAA4BF,EAAAG,gBAAqB,EACjD,MAAMC,EAAgBC,EAChBC,EAAiBC,WAIvBP,EAAAG,WAHmB,CAACK,EAAKC,IACdC,MAAMC,KAAK,CAAEC,OAAQC,KAAKC,KAAKN,EAAII,OAASH,IAAS,CAACM,EAAGC,IAAMR,EAAIS,MAAMD,EAAIP,EAAMO,EAAIP,EAAOA,IAiEzGT,EAAAE,kBA9DA,SAA2BD,EAAOiB,GAC9B,IAAKjB,EACD,OAAOA,EAWX,SAASkB,EAAYC,GACjB,OAAO,EAAIhB,EAAci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D3B","x_google_ignoreList":[0]}
@@ -1,2 +0,0 @@
1
- import{__exports as r}from"../../../../../_virtual/errors.js";var e;function t(){if(e)return r;e=1,Object.defineProperty(r,"__esModule",{value:!0}),r.OdinApiError=void 0;class t extends Error{constructor(r,e,t,s){super(),this.statusCode=r,this.message=e,this.validation=t,this.data=s}}return r.OdinApiError=t,r}export{t as __require};
2
- //# sourceMappingURL=errors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.js","sources":["../../../../../../node_modules/@d19n/odin-types/dist/types/errors.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.OdinApiError = void 0;\nclass OdinApiError extends Error {\n constructor(statusCode, message, validation, data) {\n super();\n this.statusCode = statusCode;\n this.message = message;\n this.validation = validation;\n this.data = data;\n }\n ;\n}\nexports.OdinApiError = OdinApiError;\n"],"names":["Object","defineProperty","errors","value","OdinApiError","Error","constructor","statusCode","message","validation","data","super","this"],"mappings":"mGACAA,OAAOC,eAAeC,EAAS,aAAc,CAAEC,OAAO,IACtDD,EAAAE,kBAAuB,EACvB,MAAMA,UAAqBC,MACvB,WAAAC,CAAYC,EAAYC,EAASC,EAAYC,GACzCC,QACAC,KAAKL,WAAaA,EAClBK,KAAKJ,QAAUA,EACfI,KAAKH,WAAaA,EAClBG,KAAKF,KAAOA,CACpB,SAGAR,EAAAE,aAAuBA","x_google_ignoreList":[0]}