@flarehr/apollo-super-selection 3.17.52781 → 3.21.53721

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 (296) hide show
  1. package/dist/lib/apollo-super-selection/apollo-super-selection.esm.js +1 -0
  2. package/dist/lib/apollo-super-selection/apollo-super-selection.js +130 -0
  3. package/dist/lib/apollo-super-selection/index.esm.js +0 -0
  4. package/dist/lib/apollo-super-selection/p-01a9f4a4.entry.js +1 -0
  5. package/dist/lib/apollo-super-selection/p-082669d9.js +1 -0
  6. package/dist/lib/apollo-super-selection/p-13573238.system.js +15 -0
  7. package/dist/lib/apollo-super-selection/p-20136efe.entry.js +1 -0
  8. package/dist/lib/apollo-super-selection/p-285da037.system.entry.js +1 -0
  9. package/dist/lib/apollo-super-selection/p-342cee5a.js +1 -0
  10. package/dist/lib/apollo-super-selection/p-381262c1.system.js +1 -0
  11. package/dist/lib/apollo-super-selection/p-38ee2795.system.js +1 -0
  12. package/dist/lib/apollo-super-selection/p-38f24f69.js +1 -0
  13. package/dist/lib/apollo-super-selection/p-50ea2036.system.js +1 -0
  14. package/dist/lib/apollo-super-selection/p-61734b66.js +1 -0
  15. package/dist/lib/apollo-super-selection/p-642db1f7.system.entry.js +1 -0
  16. package/dist/lib/apollo-super-selection/p-64ebe17d.system.entry.js +1 -0
  17. package/dist/lib/apollo-super-selection/p-7dbe5a2f.system.js +1 -0
  18. package/dist/lib/apollo-super-selection/p-8cbfc343.system.entry.js +1 -0
  19. package/dist/lib/apollo-super-selection/p-9eff6951.system.entry.js +69 -0
  20. package/dist/lib/apollo-super-selection/p-a98c2760.entry.js +1 -0
  21. package/dist/lib/apollo-super-selection/p-abedb220.entry.js +1 -0
  22. package/dist/lib/apollo-super-selection/p-ae4f5e0b.system.js +1 -0
  23. package/dist/lib/apollo-super-selection/p-c284a0de.entry.js +14 -0
  24. package/dist/lib/apollo-super-selection/p-c5e41889.entry.js +1 -0
  25. package/dist/lib/apollo-super-selection/p-cd49a6b7.system.entry.js +1 -0
  26. package/dist/lib/apollo-super-selection/p-d82b00ed.system.js +1 -0
  27. package/dist/lib/apollo-super-selection/p-df9ce4b7.js +15 -0
  28. package/dist/lib/apollo-super-selection/p-f15bf700.system.entry.js +1 -0
  29. package/dist/lib/apollo-super-selection/p-f7a45412.entry.js +1 -0
  30. package/dist/lib/cjs/active-router-e92fd784.js +75 -0
  31. package/dist/lib/cjs/apollo-super-selection.cjs.js +23 -0
  32. package/dist/lib/cjs/app-globals-45007120.js +25 -0
  33. package/dist/lib/cjs/context-consumer.cjs.entry.js +29 -0
  34. package/dist/lib/cjs/datorama-akita-7f4b082a.js +2704 -0
  35. package/dist/lib/cjs/delay-81aff2f1.js +955 -0
  36. package/dist/lib/cjs/fl-button_46.cjs.entry.js +17199 -0
  37. package/dist/lib/cjs/fl-style-guide.cjs.entry.js +90 -0
  38. package/dist/lib/cjs/index-942e6faa.js +1767 -0
  39. package/dist/lib/cjs/index.cjs.js +2 -0
  40. package/dist/lib/cjs/loader.cjs.js +25 -0
  41. package/dist/lib/cjs/stencil-async-content.cjs.entry.js +32 -0
  42. package/dist/lib/cjs/stencil-route-title.cjs.entry.js +32 -0
  43. package/dist/lib/cjs/stencil-router-prompt.cjs.entry.js +59 -0
  44. package/dist/lib/cjs/stencil-router-redirect.cjs.entry.js +32 -0
  45. package/dist/lib/collection/collection-manifest.json +131 -0
  46. package/dist/lib/collection/components/app-host/loading-page.js +9 -0
  47. package/dist/lib/collection/components/app-host/services/app-configuration.query.js +18 -0
  48. package/dist/lib/collection/components/app-host/services/app-configuration.service.js +25 -0
  49. package/dist/lib/collection/components/app-host/services/appinsights.service.js +43 -0
  50. package/dist/lib/collection/components/app-host/services/authentication.query.js +21 -0
  51. package/dist/lib/collection/components/app-host/services/authentication.service.js +50 -0
  52. package/dist/lib/collection/components/app-host/services/interop/host-interop.service.js +31 -0
  53. package/dist/lib/collection/components/app-host/services/interop/iframe-interop.service.js +30 -0
  54. package/dist/lib/collection/components/app-host/services/interop/react-native-interop.service.js +20 -0
  55. package/dist/lib/collection/components/app-host/services/interop.query.js +26 -0
  56. package/dist/lib/collection/components/app-host/services/session.store.js +37 -0
  57. package/dist/lib/collection/components/app-host/super-selection-app-host.css +28 -0
  58. package/dist/lib/collection/components/app-host/super-selection-app-host.js +92 -0
  59. package/dist/lib/collection/components/super-selection-app/api/api-client.js +14 -0
  60. package/dist/lib/collection/components/super-selection-app/api/event-tracking.api.js +9 -0
  61. package/dist/lib/collection/components/super-selection-app/api/super-selection-events.model.js +1 -0
  62. package/dist/lib/collection/components/super-selection-app/api/super-selection.api.dto.js +1 -0
  63. package/dist/lib/collection/components/super-selection-app/api/super-selection.api.js +30 -0
  64. package/dist/lib/collection/components/super-selection-app/app-state-pages/success.js +31 -0
  65. package/dist/lib/collection/components/super-selection-app/footer-section/footer-section.css +11 -0
  66. package/dist/lib/collection/components/super-selection-app/footer-section/footer-section.js +28 -0
  67. package/dist/lib/collection/components/super-selection-app/funds/constants.js +17 -0
  68. package/dist/lib/collection/components/super-selection-app/funds/custom-fund/api/custom-fund-choice.api.dto.js +1 -0
  69. package/dist/lib/collection/components/super-selection-app/funds/custom-fund/api/custom-fund-choice.api.js +31 -0
  70. package/dist/lib/collection/components/super-selection-app/funds/custom-fund/custom-fund.js +68 -0
  71. package/dist/lib/collection/components/super-selection-app/funds/custom-fund/custom-fund.store.js +53 -0
  72. package/dist/lib/collection/components/super-selection-app/funds/custom-fund/default-fund/default-fund.js +108 -0
  73. package/dist/lib/collection/components/super-selection-app/funds/custom-fund/my-own-fund/my-own-fund-inputs.js +93 -0
  74. package/dist/lib/collection/components/super-selection-app/funds/custom-fund/my-own-fund/my-own-fund.js +103 -0
  75. package/dist/lib/collection/components/super-selection-app/funds/custom-fund/self-managed-fund/bankBsbNumbers.js +111 -0
  76. package/dist/lib/collection/components/super-selection-app/funds/custom-fund/self-managed-fund/self-managed-fund-inputs.js +153 -0
  77. package/dist/lib/collection/components/super-selection-app/funds/custom-fund/self-managed-fund/self-managed-fund.form.js +1 -0
  78. package/dist/lib/collection/components/super-selection-app/funds/custom-fund/self-managed-fund/self-managed-fund.js +111 -0
  79. package/dist/lib/collection/components/super-selection-app/funds/custom-fund/self-managed-fund/self-managed-not-supported.css +23 -0
  80. package/dist/lib/collection/components/super-selection-app/funds/custom-fund/self-managed-fund/self-managed-not-supported.js +52 -0
  81. package/dist/lib/collection/components/super-selection-app/funds/promoted-fund/api/promoted-fund-choice.api.dto.js +1 -0
  82. package/dist/lib/collection/components/super-selection-app/funds/promoted-fund/api/promoted-fund-choice.api.js +13 -0
  83. package/dist/lib/collection/components/super-selection-app/funds/promoted-fund/promoted-fund-join-page.js +34 -0
  84. package/dist/lib/collection/components/super-selection-app/funds/promoted-fund/promoted-fund-standard-choice-page.js +62 -0
  85. package/dist/lib/collection/components/super-selection-app/funds/promoted-fund/promoted-fund.store.js +9 -0
  86. package/dist/lib/collection/components/super-selection-app/funds/promoted-fund/services/promoted-fund-join-iframe-builder.js +101 -0
  87. package/dist/lib/collection/components/super-selection-app/funds/qsuper/api/qsuper-choice.api.dto.js +1 -0
  88. package/dist/lib/collection/components/super-selection-app/funds/qsuper/api/qsuper-choice.api.js +13 -0
  89. package/dist/lib/collection/components/super-selection-app/funds/qsuper/helpers/confirmCheck.js +37 -0
  90. package/dist/lib/collection/components/super-selection-app/funds/qsuper/helpers/continueCheck.js +13 -0
  91. package/dist/lib/collection/components/super-selection-app/funds/qsuper/helpers/getNextRoute.js +89 -0
  92. package/dist/lib/collection/components/super-selection-app/funds/qsuper/helpers/resetState.js +31 -0
  93. package/dist/lib/collection/components/super-selection-app/funds/qsuper/qsuper-confirm-header.js +38 -0
  94. package/dist/lib/collection/components/super-selection-app/funds/qsuper/qsuper-confirm-selection/qsuper-confirm-selection.js +63 -0
  95. package/dist/lib/collection/components/super-selection-app/funds/qsuper/qsuper-confirmation.css +0 -0
  96. package/dist/lib/collection/components/super-selection-app/funds/qsuper/qsuper-consent/qsuper-consent.js +95 -0
  97. package/dist/lib/collection/components/super-selection-app/funds/qsuper/qsuper-insurance-opt-in.js +99 -0
  98. package/dist/lib/collection/components/super-selection-app/funds/qsuper/qsuper-insurance-questions.js +18 -0
  99. package/dist/lib/collection/components/super-selection-app/funds/qsuper/qsuper-layout.js +95 -0
  100. package/dist/lib/collection/components/super-selection-app/funds/qsuper/qsuper.css +50 -0
  101. package/dist/lib/collection/components/super-selection-app/funds/qsuper/questions/question1/question1.js +10 -0
  102. package/dist/lib/collection/components/super-selection-app/funds/qsuper/questions/question2/question2.js +10 -0
  103. package/dist/lib/collection/components/super-selection-app/funds/qsuper/questions/question3/question3.js +10 -0
  104. package/dist/lib/collection/components/super-selection-app/funds/qsuper/questions/question4/question4.js +10 -0
  105. package/dist/lib/collection/components/super-selection-app/funds/qsuper/questions/question5/question5.js +10 -0
  106. package/dist/lib/collection/components/super-selection-app/funds/qsuper/questions/question6/question6.js +10 -0
  107. package/dist/lib/collection/components/super-selection-app/funds/qsuper/questions/question7/question7.js +10 -0
  108. package/dist/lib/collection/components/super-selection-app/funds/qsuper/questions/question8/question8.js +10 -0
  109. package/dist/lib/collection/components/super-selection-app/funds/qsuper/questions/yes-no-buttons/qsuper-question-yes-no-buttons.js +66 -0
  110. package/dist/lib/collection/components/super-selection-app/funds/qsuper/services/qsuper.store.js +64 -0
  111. package/dist/lib/collection/components/super-selection-app/funds/slate-super/api/slate-choice.api.dto.js +1 -0
  112. package/dist/lib/collection/components/super-selection-app/funds/slate-super/api/slate-choice.api.js +13 -0
  113. package/dist/lib/collection/components/super-selection-app/funds/slate-super/services/slate-iframe-builder.js +127 -0
  114. package/dist/lib/collection/components/super-selection-app/funds/slate-super/slate-fund.store.js +9 -0
  115. package/dist/lib/collection/components/super-selection-app/funds/slate-super/slate-join-page.js +35 -0
  116. package/dist/lib/collection/components/super-selection-app/funds/slate-super/slate-standard-choice-page.js +67 -0
  117. package/dist/lib/collection/components/super-selection-app/funds/slate-super/slatesuper-header.css +0 -0
  118. package/dist/lib/collection/components/super-selection-app/funds/slate-super/slatesuper-header.js +19 -0
  119. package/dist/lib/collection/components/super-selection-app/notifications-section/notifications-section.js +25 -0
  120. package/dist/lib/collection/components/super-selection-app/services/australian-fund-lookup.service.js +22 -0
  121. package/dist/lib/collection/components/super-selection-app/services/event-tracking.service.js +71 -0
  122. package/dist/lib/collection/components/super-selection-app/services/navigation.service.js +22 -0
  123. package/dist/lib/collection/components/super-selection-app/services/notifications.service.js +37 -0
  124. package/dist/lib/collection/components/super-selection-app/services/notifications.store.js +3 -0
  125. package/dist/lib/collection/components/super-selection-app/services/selected-super-choice-info.service.js +53 -0
  126. package/dist/lib/collection/components/super-selection-app/services/super-selection-app.routes.js +46 -0
  127. package/dist/lib/collection/components/super-selection-app/services/super-selection-app.service.js +83 -0
  128. package/dist/lib/collection/components/super-selection-app/services/super-selection.store.js +12 -0
  129. package/dist/lib/collection/components/super-selection-app/standard-choice/api/standard-choice.model.js +1 -0
  130. package/dist/lib/collection/components/super-selection-app/standard-choice/standard-choice-form.js +49 -0
  131. package/dist/lib/collection/components/super-selection-app/super-choice-page/selected-super-choice-section/selected-super-choice-section.css +18 -0
  132. package/dist/lib/collection/components/super-selection-app/super-choice-page/selected-super-choice-section/selected-super-choice-section.js +53 -0
  133. package/dist/lib/collection/components/super-selection-app/super-choice-page/super-choice-item.js +216 -0
  134. package/dist/lib/collection/components/super-selection-app/super-choice-page/super-choice-page.css +53 -0
  135. package/dist/lib/collection/components/super-selection-app/super-choice-page/super-choice-page.js +180 -0
  136. package/dist/lib/collection/components/super-selection-app/super-selection-app.css +15 -0
  137. package/dist/lib/collection/components/super-selection-app/super-selection-app.js +229 -0
  138. package/dist/lib/collection/global/init-host.js +22 -0
  139. package/dist/lib/collection/global/main.dev.js +26 -0
  140. package/dist/lib/collection/global/main.js +11 -0
  141. package/dist/lib/collection/global/stencil-router-workaround.js +12 -0
  142. package/dist/lib/collection/index.js +2 -0
  143. package/dist/lib/collection/utils/config.js +2 -0
  144. package/dist/lib/collection/utils/gtm.js +5 -0
  145. package/dist/lib/collection/utils/iframe.js +33 -0
  146. package/dist/lib/collection/utils/index.js +8 -0
  147. package/dist/lib/collection/utils/lazy.js +29 -0
  148. package/dist/lib/collection/utils/storage.js +5 -0
  149. package/dist/lib/esm/active-router-4c80d3d2.js +73 -0
  150. package/dist/lib/esm/apollo-super-selection.js +21 -0
  151. package/dist/lib/esm/app-globals-7ac1ffba.js +23 -0
  152. package/dist/lib/esm/context-consumer.entry.js +25 -0
  153. package/dist/lib/esm/datorama-akita-79ce4385.js +2692 -0
  154. package/dist/lib/esm/delay-c0555599.js +935 -0
  155. package/dist/lib/esm/fl-button_46.entry.js +17150 -0
  156. package/dist/lib/esm/fl-style-guide.entry.js +86 -0
  157. package/dist/lib/esm/index-0496d1af.js +1734 -0
  158. package/dist/lib/esm/index.js +1 -0
  159. package/dist/lib/esm/loader.js +21 -0
  160. package/dist/lib/esm/polyfills/core-js.js +11 -0
  161. package/dist/lib/esm/polyfills/css-shim.js +1 -0
  162. package/dist/lib/esm/polyfills/dom.js +79 -0
  163. package/dist/lib/esm/polyfills/es5-html-element.js +1 -0
  164. package/dist/lib/esm/polyfills/index.js +34 -0
  165. package/dist/lib/esm/polyfills/system.js +6 -0
  166. package/dist/lib/esm/stencil-async-content.entry.js +28 -0
  167. package/dist/lib/esm/stencil-route-title.entry.js +28 -0
  168. package/dist/lib/esm/stencil-router-prompt.entry.js +55 -0
  169. package/dist/lib/esm/stencil-router-redirect.entry.js +28 -0
  170. package/dist/lib/esm-es5/active-router-4c80d3d2.js +1 -0
  171. package/dist/lib/esm-es5/apollo-super-selection.js +1 -0
  172. package/dist/lib/esm-es5/app-globals-7ac1ffba.js +1 -0
  173. package/dist/lib/esm-es5/context-consumer.entry.js +1 -0
  174. package/dist/lib/esm-es5/datorama-akita-79ce4385.js +15 -0
  175. package/dist/lib/esm-es5/delay-c0555599.js +1 -0
  176. package/dist/lib/esm-es5/fl-button_46.entry.js +69 -0
  177. package/dist/lib/esm-es5/fl-style-guide.entry.js +1 -0
  178. package/dist/lib/esm-es5/index-0496d1af.js +1 -0
  179. package/dist/lib/esm-es5/index.js +0 -0
  180. package/dist/lib/esm-es5/loader.js +1 -0
  181. package/dist/lib/esm-es5/stencil-async-content.entry.js +1 -0
  182. package/dist/lib/esm-es5/stencil-route-title.entry.js +1 -0
  183. package/dist/lib/esm-es5/stencil-router-prompt.entry.js +1 -0
  184. package/dist/lib/esm-es5/stencil-router-redirect.entry.js +1 -0
  185. package/dist/lib/index.cjs.js +1 -0
  186. package/dist/lib/index.js +1 -0
  187. package/dist/lib/loader/cdn.js +3 -0
  188. package/dist/lib/loader/index.cjs.js +3 -0
  189. package/dist/lib/loader/index.d.ts +13 -0
  190. package/dist/lib/loader/index.es2017.js +3 -0
  191. package/dist/lib/loader/index.js +4 -0
  192. package/dist/lib/loader/package.json +10 -0
  193. package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/button/button.css +45 -0
  194. package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/dropdown/dropdown.css +9 -0
  195. package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/dropdown-async/dropdown-async.css +9 -0
  196. package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/loading-indicator/loading-indicator.css +141 -0
  197. package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/promise-button/promise-button.css +5 -0
  198. package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/style-guide/style-guide.css +0 -0
  199. package/dist/lib/node_modules/@stencil/router/dist/collection/components/route/route.css +3 -0
  200. package/dist/lib/types/components/app-host/loading-page.d.ts +3 -0
  201. package/dist/lib/types/components/app-host/services/app-configuration.query.d.ts +11 -0
  202. package/dist/lib/types/components/app-host/services/app-configuration.service.d.ts +9 -0
  203. package/dist/lib/types/components/app-host/services/appinsights.service.d.ts +14 -0
  204. package/dist/lib/types/components/app-host/services/authentication.query.d.ts +13 -0
  205. package/dist/lib/types/components/app-host/services/authentication.service.d.ts +9 -0
  206. package/dist/lib/types/components/app-host/services/interop/host-interop.service.d.ts +7 -0
  207. package/dist/lib/types/components/app-host/services/interop/iframe-interop.service.d.ts +5 -0
  208. package/dist/lib/types/components/app-host/services/interop/react-native-interop.service.d.ts +7 -0
  209. package/dist/lib/types/components/app-host/services/interop.query.d.ts +11 -0
  210. package/dist/lib/types/components/app-host/services/session.store.d.ts +30 -0
  211. package/dist/lib/types/components/app-host/super-selection-app-host.d.ts +17 -0
  212. package/dist/lib/types/components/super-selection-app/api/api-client.d.ts +2 -0
  213. package/dist/lib/types/components/super-selection-app/api/event-tracking.api.d.ts +6 -0
  214. package/dist/lib/types/components/super-selection-app/api/super-selection-events.model.d.ts +73 -0
  215. package/dist/lib/types/components/super-selection-app/api/super-selection.api.d.ts +16 -0
  216. package/dist/lib/types/components/super-selection-app/api/super-selection.api.dto.d.ts +82 -0
  217. package/dist/lib/types/components/super-selection-app/app-state-pages/success.d.ts +4 -0
  218. package/dist/lib/types/components/super-selection-app/footer-section/footer-section.d.ts +4 -0
  219. package/dist/lib/types/components/super-selection-app/funds/constants.d.ts +17 -0
  220. package/dist/lib/types/components/super-selection-app/funds/custom-fund/api/custom-fund-choice.api.d.ts +8 -0
  221. package/dist/lib/types/components/super-selection-app/funds/custom-fund/api/custom-fund-choice.api.dto.d.ts +28 -0
  222. package/dist/lib/types/components/super-selection-app/funds/custom-fund/custom-fund.d.ts +9 -0
  223. package/dist/lib/types/components/super-selection-app/funds/custom-fund/custom-fund.store.d.ts +30 -0
  224. package/dist/lib/types/components/super-selection-app/funds/custom-fund/default-fund/default-fund.d.ts +15 -0
  225. package/dist/lib/types/components/super-selection-app/funds/custom-fund/my-own-fund/my-own-fund-inputs.d.ts +12 -0
  226. package/dist/lib/types/components/super-selection-app/funds/custom-fund/my-own-fund/my-own-fund.d.ts +12 -0
  227. package/dist/lib/types/components/super-selection-app/funds/custom-fund/self-managed-fund/bankBsbNumbers.d.ts +112 -0
  228. package/dist/lib/types/components/super-selection-app/funds/custom-fund/self-managed-fund/self-managed-fund-inputs.d.ts +15 -0
  229. package/dist/lib/types/components/super-selection-app/funds/custom-fund/self-managed-fund/self-managed-fund.d.ts +14 -0
  230. package/dist/lib/types/components/super-selection-app/funds/custom-fund/self-managed-fund/self-managed-fund.form.d.ts +14 -0
  231. package/dist/lib/types/components/super-selection-app/funds/custom-fund/self-managed-fund/self-managed-not-supported.d.ts +7 -0
  232. package/dist/lib/types/components/super-selection-app/funds/promoted-fund/api/promoted-fund-choice.api.d.ts +6 -0
  233. package/dist/lib/types/components/super-selection-app/funds/promoted-fund/api/promoted-fund-choice.api.dto.d.ts +6 -0
  234. package/dist/lib/types/components/super-selection-app/funds/promoted-fund/promoted-fund-join-page.d.ts +7 -0
  235. package/dist/lib/types/components/super-selection-app/funds/promoted-fund/promoted-fund-standard-choice-page.d.ts +8 -0
  236. package/dist/lib/types/components/super-selection-app/funds/promoted-fund/promoted-fund.store.d.ts +9 -0
  237. package/dist/lib/types/components/super-selection-app/funds/promoted-fund/services/promoted-fund-join-iframe-builder.d.ts +11 -0
  238. package/dist/lib/types/components/super-selection-app/funds/qsuper/api/qsuper-choice.api.d.ts +6 -0
  239. package/dist/lib/types/components/super-selection-app/funds/qsuper/api/qsuper-choice.api.dto.d.ts +21 -0
  240. package/dist/lib/types/components/super-selection-app/funds/qsuper/helpers/confirmCheck.d.ts +1 -0
  241. package/dist/lib/types/components/super-selection-app/funds/qsuper/helpers/continueCheck.d.ts +1 -0
  242. package/dist/lib/types/components/super-selection-app/funds/qsuper/helpers/getNextRoute.d.ts +2 -0
  243. package/dist/lib/types/components/super-selection-app/funds/qsuper/helpers/resetState.d.ts +1 -0
  244. package/dist/lib/types/components/super-selection-app/funds/qsuper/qsuper-confirm-header.d.ts +5 -0
  245. package/dist/lib/types/components/super-selection-app/funds/qsuper/qsuper-confirm-selection/qsuper-confirm-selection.d.ts +6 -0
  246. package/dist/lib/types/components/super-selection-app/funds/qsuper/qsuper-consent/qsuper-consent.d.ts +7 -0
  247. package/dist/lib/types/components/super-selection-app/funds/qsuper/qsuper-insurance-opt-in.d.ts +12 -0
  248. package/dist/lib/types/components/super-selection-app/funds/qsuper/qsuper-insurance-questions.d.ts +3 -0
  249. package/dist/lib/types/components/super-selection-app/funds/qsuper/qsuper-layout.d.ts +11 -0
  250. package/dist/lib/types/components/super-selection-app/funds/qsuper/questions/question1/question1.d.ts +3 -0
  251. package/dist/lib/types/components/super-selection-app/funds/qsuper/questions/question2/question2.d.ts +3 -0
  252. package/dist/lib/types/components/super-selection-app/funds/qsuper/questions/question3/question3.d.ts +3 -0
  253. package/dist/lib/types/components/super-selection-app/funds/qsuper/questions/question4/question4.d.ts +3 -0
  254. package/dist/lib/types/components/super-selection-app/funds/qsuper/questions/question5/question5.d.ts +3 -0
  255. package/dist/lib/types/components/super-selection-app/funds/qsuper/questions/question6/question6.d.ts +3 -0
  256. package/dist/lib/types/components/super-selection-app/funds/qsuper/questions/question7/question7.d.ts +3 -0
  257. package/dist/lib/types/components/super-selection-app/funds/qsuper/questions/question8/question8.d.ts +3 -0
  258. package/dist/lib/types/components/super-selection-app/funds/qsuper/questions/yes-no-buttons/qsuper-question-yes-no-buttons.d.ts +6 -0
  259. package/dist/lib/types/components/super-selection-app/funds/qsuper/services/qsuper.store.d.ts +58 -0
  260. package/dist/lib/types/components/super-selection-app/funds/slate-super/api/slate-choice.api.d.ts +6 -0
  261. package/dist/lib/types/components/super-selection-app/funds/slate-super/api/slate-choice.api.dto.d.ts +4 -0
  262. package/dist/lib/types/components/super-selection-app/funds/slate-super/services/slate-iframe-builder.d.ts +13 -0
  263. package/dist/lib/types/components/super-selection-app/funds/slate-super/slate-fund.store.d.ts +7 -0
  264. package/dist/lib/types/components/super-selection-app/funds/slate-super/slate-join-page.d.ts +7 -0
  265. package/dist/lib/types/components/super-selection-app/funds/slate-super/slate-standard-choice-page.d.ts +8 -0
  266. package/dist/lib/types/components/super-selection-app/funds/slate-super/slatesuper-header.d.ts +3 -0
  267. package/dist/lib/types/components/super-selection-app/notifications-section/notifications-section.d.ts +5 -0
  268. package/dist/lib/types/components/super-selection-app/services/australian-fund-lookup.service.d.ts +8 -0
  269. package/dist/lib/types/components/super-selection-app/services/event-tracking.service.d.ts +17 -0
  270. package/dist/lib/types/components/super-selection-app/services/navigation.service.d.ts +9 -0
  271. package/dist/lib/types/components/super-selection-app/services/notifications.service.d.ts +15 -0
  272. package/dist/lib/types/components/super-selection-app/services/notifications.store.d.ts +14 -0
  273. package/dist/lib/types/components/super-selection-app/services/selected-super-choice-info.service.d.ts +18 -0
  274. package/dist/lib/types/components/super-selection-app/services/super-selection-app.routes.d.ts +23 -0
  275. package/dist/lib/types/components/super-selection-app/services/super-selection-app.service.d.ts +26 -0
  276. package/dist/lib/types/components/super-selection-app/services/super-selection.store.d.ts +14 -0
  277. package/dist/lib/types/components/super-selection-app/standard-choice/api/standard-choice.model.d.ts +3 -0
  278. package/dist/lib/types/components/super-selection-app/standard-choice/standard-choice-form.d.ts +7 -0
  279. package/dist/lib/types/components/super-selection-app/super-choice-page/selected-super-choice-section/selected-super-choice-section.d.ts +5 -0
  280. package/dist/lib/types/components/super-selection-app/super-choice-page/super-choice-item.d.ts +17 -0
  281. package/dist/lib/types/components/super-selection-app/super-choice-page/super-choice-page.d.ts +14 -0
  282. package/dist/lib/types/components/super-selection-app/super-selection-app.d.ts +26 -0
  283. package/dist/lib/types/components.d.ts +576 -0
  284. package/dist/lib/types/global/init-host.d.ts +1 -0
  285. package/dist/lib/types/global/main.d.ts +1 -0
  286. package/dist/lib/types/global/main.dev.d.ts +1 -0
  287. package/dist/lib/types/global/stencil-router-workaround.d.ts +1 -0
  288. package/dist/lib/types/index.d.ts +2 -0
  289. package/dist/lib/types/stencil-public-runtime.d.ts +1555 -0
  290. package/dist/lib/types/utils/config.d.ts +2 -0
  291. package/dist/lib/types/utils/gtm.d.ts +7 -0
  292. package/dist/lib/types/utils/iframe.d.ts +13 -0
  293. package/dist/lib/types/utils/index.d.ts +3 -0
  294. package/dist/lib/types/utils/lazy.d.ts +12 -0
  295. package/dist/lib/types/utils/storage.d.ts +4 -0
  296. package/package.json +1 -1
@@ -0,0 +1,2704 @@
1
+ 'use strict';
2
+
3
+ const delay = require('./delay-81aff2f1.js');
4
+
5
+ /*! *****************************************************************************
6
+ Copyright (c) Microsoft Corporation.
7
+
8
+ Permission to use, copy, modify, and/or distribute this software for any
9
+ purpose with or without fee is hereby granted.
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
12
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
14
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
16
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17
+ PERFORMANCE OF THIS SOFTWARE.
18
+ ***************************************************************************** */
19
+
20
+ function __rest(s, e) {
21
+ var t = {};
22
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
23
+ t[p] = s[p];
24
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
25
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
26
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
27
+ t[p[i]] = s[p[i]];
28
+ }
29
+ return t;
30
+ }
31
+
32
+ function __decorate(decorators, target, key, desc) {
33
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
34
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
35
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
36
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
37
+ }
38
+
39
+ function __metadata(metadataKey, metadataValue) {
40
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
41
+ }
42
+
43
+ const ObjectUnsubscribedErrorImpl = (() => {
44
+ function ObjectUnsubscribedErrorImpl() {
45
+ Error.call(this);
46
+ this.message = 'object unsubscribed';
47
+ this.name = 'ObjectUnsubscribedError';
48
+ return this;
49
+ }
50
+ ObjectUnsubscribedErrorImpl.prototype = Object.create(Error.prototype);
51
+ return ObjectUnsubscribedErrorImpl;
52
+ })();
53
+ const ObjectUnsubscribedError = ObjectUnsubscribedErrorImpl;
54
+
55
+ class SubjectSubscription extends delay.Subscription {
56
+ constructor(subject, subscriber) {
57
+ super();
58
+ this.subject = subject;
59
+ this.subscriber = subscriber;
60
+ this.closed = false;
61
+ }
62
+ unsubscribe() {
63
+ if (this.closed) {
64
+ return;
65
+ }
66
+ this.closed = true;
67
+ const subject = this.subject;
68
+ const observers = subject.observers;
69
+ this.subject = null;
70
+ if (!observers || observers.length === 0 || subject.isStopped || subject.closed) {
71
+ return;
72
+ }
73
+ const subscriberIndex = observers.indexOf(this.subscriber);
74
+ if (subscriberIndex !== -1) {
75
+ observers.splice(subscriberIndex, 1);
76
+ }
77
+ }
78
+ }
79
+
80
+ class SubjectSubscriber extends delay.Subscriber {
81
+ constructor(destination) {
82
+ super(destination);
83
+ this.destination = destination;
84
+ }
85
+ }
86
+ class Subject extends delay.Observable {
87
+ constructor() {
88
+ super();
89
+ this.observers = [];
90
+ this.closed = false;
91
+ this.isStopped = false;
92
+ this.hasError = false;
93
+ this.thrownError = null;
94
+ }
95
+ [delay.rxSubscriber]() {
96
+ return new SubjectSubscriber(this);
97
+ }
98
+ lift(operator) {
99
+ const subject = new AnonymousSubject(this, this);
100
+ subject.operator = operator;
101
+ return subject;
102
+ }
103
+ next(value) {
104
+ if (this.closed) {
105
+ throw new ObjectUnsubscribedError();
106
+ }
107
+ if (!this.isStopped) {
108
+ const { observers } = this;
109
+ const len = observers.length;
110
+ const copy = observers.slice();
111
+ for (let i = 0; i < len; i++) {
112
+ copy[i].next(value);
113
+ }
114
+ }
115
+ }
116
+ error(err) {
117
+ if (this.closed) {
118
+ throw new ObjectUnsubscribedError();
119
+ }
120
+ this.hasError = true;
121
+ this.thrownError = err;
122
+ this.isStopped = true;
123
+ const { observers } = this;
124
+ const len = observers.length;
125
+ const copy = observers.slice();
126
+ for (let i = 0; i < len; i++) {
127
+ copy[i].error(err);
128
+ }
129
+ this.observers.length = 0;
130
+ }
131
+ complete() {
132
+ if (this.closed) {
133
+ throw new ObjectUnsubscribedError();
134
+ }
135
+ this.isStopped = true;
136
+ const { observers } = this;
137
+ const len = observers.length;
138
+ const copy = observers.slice();
139
+ for (let i = 0; i < len; i++) {
140
+ copy[i].complete();
141
+ }
142
+ this.observers.length = 0;
143
+ }
144
+ unsubscribe() {
145
+ this.isStopped = true;
146
+ this.closed = true;
147
+ this.observers = null;
148
+ }
149
+ _trySubscribe(subscriber) {
150
+ if (this.closed) {
151
+ throw new ObjectUnsubscribedError();
152
+ }
153
+ else {
154
+ return super._trySubscribe(subscriber);
155
+ }
156
+ }
157
+ _subscribe(subscriber) {
158
+ if (this.closed) {
159
+ throw new ObjectUnsubscribedError();
160
+ }
161
+ else if (this.hasError) {
162
+ subscriber.error(this.thrownError);
163
+ return delay.Subscription.EMPTY;
164
+ }
165
+ else if (this.isStopped) {
166
+ subscriber.complete();
167
+ return delay.Subscription.EMPTY;
168
+ }
169
+ else {
170
+ this.observers.push(subscriber);
171
+ return new SubjectSubscription(this, subscriber);
172
+ }
173
+ }
174
+ asObservable() {
175
+ const observable = new delay.Observable();
176
+ observable.source = this;
177
+ return observable;
178
+ }
179
+ }
180
+ Subject.create = (destination, source) => {
181
+ return new AnonymousSubject(destination, source);
182
+ };
183
+ class AnonymousSubject extends Subject {
184
+ constructor(destination, source) {
185
+ super();
186
+ this.destination = destination;
187
+ this.source = source;
188
+ }
189
+ next(value) {
190
+ const { destination } = this;
191
+ if (destination && destination.next) {
192
+ destination.next(value);
193
+ }
194
+ }
195
+ error(err) {
196
+ const { destination } = this;
197
+ if (destination && destination.error) {
198
+ this.destination.error(err);
199
+ }
200
+ }
201
+ complete() {
202
+ const { destination } = this;
203
+ if (destination && destination.complete) {
204
+ this.destination.complete();
205
+ }
206
+ }
207
+ _subscribe(subscriber) {
208
+ const { source } = this;
209
+ if (source) {
210
+ return this.source.subscribe(subscriber);
211
+ }
212
+ else {
213
+ return delay.Subscription.EMPTY;
214
+ }
215
+ }
216
+ }
217
+
218
+ class BehaviorSubject extends Subject {
219
+ constructor(_value) {
220
+ super();
221
+ this._value = _value;
222
+ }
223
+ get value() {
224
+ return this.getValue();
225
+ }
226
+ _subscribe(subscriber) {
227
+ const subscription = super._subscribe(subscriber);
228
+ if (subscription && !subscription.closed) {
229
+ subscriber.next(this._value);
230
+ }
231
+ return subscription;
232
+ }
233
+ getValue() {
234
+ if (this.hasError) {
235
+ throw this.thrownError;
236
+ }
237
+ else if (this.closed) {
238
+ throw new ObjectUnsubscribedError();
239
+ }
240
+ else {
241
+ return this._value;
242
+ }
243
+ }
244
+ next(value) {
245
+ super.next(this._value = value);
246
+ }
247
+ }
248
+
249
+ class QueueAction extends delay.AsyncAction {
250
+ constructor(scheduler, work) {
251
+ super(scheduler, work);
252
+ this.scheduler = scheduler;
253
+ this.work = work;
254
+ }
255
+ schedule(state, delay = 0) {
256
+ if (delay > 0) {
257
+ return super.schedule(state, delay);
258
+ }
259
+ this.delay = delay;
260
+ this.state = state;
261
+ this.scheduler.flush(this);
262
+ return this;
263
+ }
264
+ execute(state, delay) {
265
+ return (delay > 0 || this.closed) ?
266
+ super.execute(state, delay) :
267
+ this._execute(state, delay);
268
+ }
269
+ requestAsyncId(scheduler, id, delay = 0) {
270
+ if ((delay !== null && delay > 0) || (delay === null && this.delay > 0)) {
271
+ return super.requestAsyncId(scheduler, id, delay);
272
+ }
273
+ return scheduler.flush(this);
274
+ }
275
+ }
276
+
277
+ class QueueScheduler extends delay.AsyncScheduler {
278
+ }
279
+
280
+ const queueScheduler = new QueueScheduler(QueueAction);
281
+ const queue = queueScheduler;
282
+
283
+ class ObserveOnSubscriber extends delay.Subscriber {
284
+ constructor(destination, scheduler, delay = 0) {
285
+ super(destination);
286
+ this.scheduler = scheduler;
287
+ this.delay = delay;
288
+ }
289
+ static dispatch(arg) {
290
+ const { notification, destination } = arg;
291
+ notification.observe(destination);
292
+ this.unsubscribe();
293
+ }
294
+ scheduleMessage(notification) {
295
+ const destination = this.destination;
296
+ destination.add(this.scheduler.schedule(ObserveOnSubscriber.dispatch, this.delay, new ObserveOnMessage(notification, this.destination)));
297
+ }
298
+ _next(value) {
299
+ this.scheduleMessage(delay.Notification.createNext(value));
300
+ }
301
+ _error(err) {
302
+ this.scheduleMessage(delay.Notification.createError(err));
303
+ this.unsubscribe();
304
+ }
305
+ _complete() {
306
+ this.scheduleMessage(delay.Notification.createComplete());
307
+ this.unsubscribe();
308
+ }
309
+ }
310
+ class ObserveOnMessage {
311
+ constructor(notification, destination) {
312
+ this.notification = notification;
313
+ this.destination = destination;
314
+ }
315
+ }
316
+
317
+ class ReplaySubject extends Subject {
318
+ constructor(bufferSize = Number.POSITIVE_INFINITY, windowTime = Number.POSITIVE_INFINITY, scheduler) {
319
+ super();
320
+ this.scheduler = scheduler;
321
+ this._events = [];
322
+ this._infiniteTimeWindow = false;
323
+ this._bufferSize = bufferSize < 1 ? 1 : bufferSize;
324
+ this._windowTime = windowTime < 1 ? 1 : windowTime;
325
+ if (windowTime === Number.POSITIVE_INFINITY) {
326
+ this._infiniteTimeWindow = true;
327
+ this.next = this.nextInfiniteTimeWindow;
328
+ }
329
+ else {
330
+ this.next = this.nextTimeWindow;
331
+ }
332
+ }
333
+ nextInfiniteTimeWindow(value) {
334
+ if (!this.isStopped) {
335
+ const _events = this._events;
336
+ _events.push(value);
337
+ if (_events.length > this._bufferSize) {
338
+ _events.shift();
339
+ }
340
+ }
341
+ super.next(value);
342
+ }
343
+ nextTimeWindow(value) {
344
+ if (!this.isStopped) {
345
+ this._events.push(new ReplayEvent(this._getNow(), value));
346
+ this._trimBufferThenGetEvents();
347
+ }
348
+ super.next(value);
349
+ }
350
+ _subscribe(subscriber) {
351
+ const _infiniteTimeWindow = this._infiniteTimeWindow;
352
+ const _events = _infiniteTimeWindow ? this._events : this._trimBufferThenGetEvents();
353
+ const scheduler = this.scheduler;
354
+ const len = _events.length;
355
+ let subscription;
356
+ if (this.closed) {
357
+ throw new ObjectUnsubscribedError();
358
+ }
359
+ else if (this.isStopped || this.hasError) {
360
+ subscription = delay.Subscription.EMPTY;
361
+ }
362
+ else {
363
+ this.observers.push(subscriber);
364
+ subscription = new SubjectSubscription(this, subscriber);
365
+ }
366
+ if (scheduler) {
367
+ subscriber.add(subscriber = new ObserveOnSubscriber(subscriber, scheduler));
368
+ }
369
+ if (_infiniteTimeWindow) {
370
+ for (let i = 0; i < len && !subscriber.closed; i++) {
371
+ subscriber.next(_events[i]);
372
+ }
373
+ }
374
+ else {
375
+ for (let i = 0; i < len && !subscriber.closed; i++) {
376
+ subscriber.next(_events[i].value);
377
+ }
378
+ }
379
+ if (this.hasError) {
380
+ subscriber.error(this.thrownError);
381
+ }
382
+ else if (this.isStopped) {
383
+ subscriber.complete();
384
+ }
385
+ return subscription;
386
+ }
387
+ _getNow() {
388
+ return (this.scheduler || queue).now();
389
+ }
390
+ _trimBufferThenGetEvents() {
391
+ const now = this._getNow();
392
+ const _bufferSize = this._bufferSize;
393
+ const _windowTime = this._windowTime;
394
+ const _events = this._events;
395
+ const eventsCount = _events.length;
396
+ let spliceCount = 0;
397
+ while (spliceCount < eventsCount) {
398
+ if ((now - _events[spliceCount].time) < _windowTime) {
399
+ break;
400
+ }
401
+ spliceCount++;
402
+ }
403
+ if (eventsCount > _bufferSize) {
404
+ spliceCount = Math.max(spliceCount, eventsCount - _bufferSize);
405
+ }
406
+ if (spliceCount > 0) {
407
+ _events.splice(0, spliceCount);
408
+ }
409
+ return _events;
410
+ }
411
+ }
412
+ class ReplayEvent {
413
+ constructor(time, value) {
414
+ this.time = time;
415
+ this.value = value;
416
+ }
417
+ }
418
+
419
+ function isObservable(obj) {
420
+ return !!obj && (obj instanceof delay.Observable || (typeof obj.lift === 'function' && typeof obj.subscribe === 'function'));
421
+ }
422
+
423
+ const ArgumentOutOfRangeErrorImpl = (() => {
424
+ function ArgumentOutOfRangeErrorImpl() {
425
+ Error.call(this);
426
+ this.message = 'argument out of range';
427
+ this.name = 'ArgumentOutOfRangeError';
428
+ return this;
429
+ }
430
+ ArgumentOutOfRangeErrorImpl.prototype = Object.create(Error.prototype);
431
+ return ArgumentOutOfRangeErrorImpl;
432
+ })();
433
+ const ArgumentOutOfRangeError = ArgumentOutOfRangeErrorImpl;
434
+
435
+ function map(project, thisArg) {
436
+ return function mapOperation(source) {
437
+ if (typeof project !== 'function') {
438
+ throw new TypeError('argument is not a function. Are you looking for `mapTo()`?');
439
+ }
440
+ return source.lift(new MapOperator(project, thisArg));
441
+ };
442
+ }
443
+ class MapOperator {
444
+ constructor(project, thisArg) {
445
+ this.project = project;
446
+ this.thisArg = thisArg;
447
+ }
448
+ call(subscriber, source) {
449
+ return source.subscribe(new MapSubscriber(subscriber, this.project, this.thisArg));
450
+ }
451
+ }
452
+ class MapSubscriber extends delay.Subscriber {
453
+ constructor(destination, project, thisArg) {
454
+ super(destination);
455
+ this.project = project;
456
+ this.count = 0;
457
+ this.thisArg = thisArg || this;
458
+ }
459
+ _next(value) {
460
+ let result;
461
+ try {
462
+ result = this.project.call(this.thisArg, value, this.count++);
463
+ }
464
+ catch (err) {
465
+ this.destination.error(err);
466
+ return;
467
+ }
468
+ this.destination.next(result);
469
+ }
470
+ }
471
+
472
+ const subscribeToPromise = (promise) => (subscriber) => {
473
+ promise.then((value) => {
474
+ if (!subscriber.closed) {
475
+ subscriber.next(value);
476
+ subscriber.complete();
477
+ }
478
+ }, (err) => subscriber.error(err))
479
+ .then(null, delay.hostReportError);
480
+ return subscriber;
481
+ };
482
+
483
+ function getSymbolIterator() {
484
+ if (typeof Symbol !== 'function' || !Symbol.iterator) {
485
+ return '@@iterator';
486
+ }
487
+ return Symbol.iterator;
488
+ }
489
+ const iterator = getSymbolIterator();
490
+
491
+ const subscribeToIterable = (iterable) => (subscriber) => {
492
+ const iterator$1 = iterable[iterator]();
493
+ do {
494
+ let item;
495
+ try {
496
+ item = iterator$1.next();
497
+ }
498
+ catch (err) {
499
+ subscriber.error(err);
500
+ return subscriber;
501
+ }
502
+ if (item.done) {
503
+ subscriber.complete();
504
+ break;
505
+ }
506
+ subscriber.next(item.value);
507
+ if (subscriber.closed) {
508
+ break;
509
+ }
510
+ } while (true);
511
+ if (typeof iterator$1.return === 'function') {
512
+ subscriber.add(() => {
513
+ if (iterator$1.return) {
514
+ iterator$1.return();
515
+ }
516
+ });
517
+ }
518
+ return subscriber;
519
+ };
520
+
521
+ const subscribeToObservable = (obj) => (subscriber) => {
522
+ const obs = obj[delay.observable]();
523
+ if (typeof obs.subscribe !== 'function') {
524
+ throw new TypeError('Provided object does not correctly implement Symbol.observable');
525
+ }
526
+ else {
527
+ return obs.subscribe(subscriber);
528
+ }
529
+ };
530
+
531
+ const isArrayLike = ((x) => x && typeof x.length === 'number' && typeof x !== 'function');
532
+
533
+ function isPromise(value) {
534
+ return !!value && typeof value.subscribe !== 'function' && typeof value.then === 'function';
535
+ }
536
+
537
+ const subscribeTo = (result) => {
538
+ if (!!result && typeof result[delay.observable] === 'function') {
539
+ return subscribeToObservable(result);
540
+ }
541
+ else if (isArrayLike(result)) {
542
+ return delay.subscribeToArray(result);
543
+ }
544
+ else if (isPromise(result)) {
545
+ return subscribeToPromise(result);
546
+ }
547
+ else if (!!result && typeof result[iterator] === 'function') {
548
+ return subscribeToIterable(result);
549
+ }
550
+ else {
551
+ const value = delay.isObject(result) ? 'an invalid object' : `'${result}'`;
552
+ const msg = `You provided ${value} where a stream was expected.`
553
+ + ' You can provide an Observable, Promise, Array, or Iterable.';
554
+ throw new TypeError(msg);
555
+ }
556
+ };
557
+
558
+ function scheduleObservable(input, scheduler) {
559
+ return new delay.Observable(subscriber => {
560
+ const sub = new delay.Subscription();
561
+ sub.add(scheduler.schedule(() => {
562
+ const observable = input[delay.observable]();
563
+ sub.add(observable.subscribe({
564
+ next(value) { sub.add(scheduler.schedule(() => subscriber.next(value))); },
565
+ error(err) { sub.add(scheduler.schedule(() => subscriber.error(err))); },
566
+ complete() { sub.add(scheduler.schedule(() => subscriber.complete())); },
567
+ }));
568
+ }));
569
+ return sub;
570
+ });
571
+ }
572
+
573
+ function schedulePromise(input, scheduler) {
574
+ return new delay.Observable(subscriber => {
575
+ const sub = new delay.Subscription();
576
+ sub.add(scheduler.schedule(() => input.then(value => {
577
+ sub.add(scheduler.schedule(() => {
578
+ subscriber.next(value);
579
+ sub.add(scheduler.schedule(() => subscriber.complete()));
580
+ }));
581
+ }, err => {
582
+ sub.add(scheduler.schedule(() => subscriber.error(err)));
583
+ })));
584
+ return sub;
585
+ });
586
+ }
587
+
588
+ function scheduleIterable(input, scheduler) {
589
+ if (!input) {
590
+ throw new Error('Iterable cannot be null');
591
+ }
592
+ return new delay.Observable(subscriber => {
593
+ const sub = new delay.Subscription();
594
+ let iterator$1;
595
+ sub.add(() => {
596
+ if (iterator$1 && typeof iterator$1.return === 'function') {
597
+ iterator$1.return();
598
+ }
599
+ });
600
+ sub.add(scheduler.schedule(() => {
601
+ iterator$1 = input[iterator]();
602
+ sub.add(scheduler.schedule(function () {
603
+ if (subscriber.closed) {
604
+ return;
605
+ }
606
+ let value;
607
+ let done;
608
+ try {
609
+ const result = iterator$1.next();
610
+ value = result.value;
611
+ done = result.done;
612
+ }
613
+ catch (err) {
614
+ subscriber.error(err);
615
+ return;
616
+ }
617
+ if (done) {
618
+ subscriber.complete();
619
+ }
620
+ else {
621
+ subscriber.next(value);
622
+ this.schedule();
623
+ }
624
+ }));
625
+ }));
626
+ return sub;
627
+ });
628
+ }
629
+
630
+ function isInteropObservable(input) {
631
+ return input && typeof input[delay.observable] === 'function';
632
+ }
633
+
634
+ function isIterable(input) {
635
+ return input && typeof input[iterator] === 'function';
636
+ }
637
+
638
+ function scheduled(input, scheduler) {
639
+ if (input != null) {
640
+ if (isInteropObservable(input)) {
641
+ return scheduleObservable(input, scheduler);
642
+ }
643
+ else if (isPromise(input)) {
644
+ return schedulePromise(input, scheduler);
645
+ }
646
+ else if (isArrayLike(input)) {
647
+ return delay.scheduleArray(input, scheduler);
648
+ }
649
+ else if (isIterable(input) || typeof input === 'string') {
650
+ return scheduleIterable(input, scheduler);
651
+ }
652
+ }
653
+ throw new TypeError((input !== null && typeof input || input) + ' is not observable');
654
+ }
655
+
656
+ function from(input, scheduler) {
657
+ if (!scheduler) {
658
+ if (input instanceof delay.Observable) {
659
+ return input;
660
+ }
661
+ return new delay.Observable(subscribeTo(input));
662
+ }
663
+ else {
664
+ return scheduled(input, scheduler);
665
+ }
666
+ }
667
+
668
+ class SimpleInnerSubscriber extends delay.Subscriber {
669
+ constructor(parent) {
670
+ super();
671
+ this.parent = parent;
672
+ }
673
+ _next(value) {
674
+ this.parent.notifyNext(value);
675
+ }
676
+ _error(error) {
677
+ this.parent.notifyError(error);
678
+ this.unsubscribe();
679
+ }
680
+ _complete() {
681
+ this.parent.notifyComplete();
682
+ this.unsubscribe();
683
+ }
684
+ }
685
+ class SimpleOuterSubscriber extends delay.Subscriber {
686
+ notifyNext(innerValue) {
687
+ this.destination.next(innerValue);
688
+ }
689
+ notifyError(err) {
690
+ this.destination.error(err);
691
+ }
692
+ notifyComplete() {
693
+ this.destination.complete();
694
+ }
695
+ }
696
+ function innerSubscribe(result, innerSubscriber) {
697
+ if (innerSubscriber.closed) {
698
+ return undefined;
699
+ }
700
+ if (result instanceof delay.Observable) {
701
+ return result.subscribe(innerSubscriber);
702
+ }
703
+ return subscribeTo(result)(innerSubscriber);
704
+ }
705
+
706
+ function filter(predicate, thisArg) {
707
+ return function filterOperatorFunction(source) {
708
+ return source.lift(new FilterOperator(predicate, thisArg));
709
+ };
710
+ }
711
+ class FilterOperator {
712
+ constructor(predicate, thisArg) {
713
+ this.predicate = predicate;
714
+ this.thisArg = thisArg;
715
+ }
716
+ call(subscriber, source) {
717
+ return source.subscribe(new FilterSubscriber(subscriber, this.predicate, this.thisArg));
718
+ }
719
+ }
720
+ class FilterSubscriber extends delay.Subscriber {
721
+ constructor(destination, predicate, thisArg) {
722
+ super(destination);
723
+ this.predicate = predicate;
724
+ this.thisArg = thisArg;
725
+ this.count = 0;
726
+ }
727
+ _next(value) {
728
+ let result;
729
+ try {
730
+ result = this.predicate.call(this.thisArg, value, this.count++);
731
+ }
732
+ catch (err) {
733
+ this.destination.error(err);
734
+ return;
735
+ }
736
+ if (result) {
737
+ this.destination.next(value);
738
+ }
739
+ }
740
+ }
741
+
742
+ function distinctUntilChanged(compare, keySelector) {
743
+ return (source) => source.lift(new DistinctUntilChangedOperator(compare, keySelector));
744
+ }
745
+ class DistinctUntilChangedOperator {
746
+ constructor(compare, keySelector) {
747
+ this.compare = compare;
748
+ this.keySelector = keySelector;
749
+ }
750
+ call(subscriber, source) {
751
+ return source.subscribe(new DistinctUntilChangedSubscriber(subscriber, this.compare, this.keySelector));
752
+ }
753
+ }
754
+ class DistinctUntilChangedSubscriber extends delay.Subscriber {
755
+ constructor(destination, compare, keySelector) {
756
+ super(destination);
757
+ this.keySelector = keySelector;
758
+ this.hasKey = false;
759
+ if (typeof compare === 'function') {
760
+ this.compare = compare;
761
+ }
762
+ }
763
+ compare(x, y) {
764
+ return x === y;
765
+ }
766
+ _next(value) {
767
+ let key;
768
+ try {
769
+ const { keySelector } = this;
770
+ key = keySelector ? keySelector(value) : value;
771
+ }
772
+ catch (err) {
773
+ return this.destination.error(err);
774
+ }
775
+ let result = false;
776
+ if (this.hasKey) {
777
+ try {
778
+ const { compare } = this;
779
+ result = compare(this.key, key);
780
+ }
781
+ catch (err) {
782
+ return this.destination.error(err);
783
+ }
784
+ }
785
+ else {
786
+ this.hasKey = true;
787
+ }
788
+ if (!result) {
789
+ this.key = key;
790
+ this.destination.next(value);
791
+ }
792
+ }
793
+ }
794
+
795
+ function take(count) {
796
+ return (source) => {
797
+ if (count === 0) {
798
+ return delay.empty();
799
+ }
800
+ else {
801
+ return source.lift(new TakeOperator(count));
802
+ }
803
+ };
804
+ }
805
+ class TakeOperator {
806
+ constructor(total) {
807
+ this.total = total;
808
+ if (this.total < 0) {
809
+ throw new ArgumentOutOfRangeError;
810
+ }
811
+ }
812
+ call(subscriber, source) {
813
+ return source.subscribe(new TakeSubscriber(subscriber, this.total));
814
+ }
815
+ }
816
+ class TakeSubscriber extends delay.Subscriber {
817
+ constructor(destination, total) {
818
+ super(destination);
819
+ this.total = total;
820
+ this.count = 0;
821
+ }
822
+ _next(value) {
823
+ const total = this.total;
824
+ const count = ++this.count;
825
+ if (count <= total) {
826
+ this.destination.next(value);
827
+ if (count === total) {
828
+ this.destination.complete();
829
+ this.unsubscribe();
830
+ }
831
+ }
832
+ }
833
+ }
834
+
835
+ function switchMap(project, resultSelector) {
836
+ if (typeof resultSelector === 'function') {
837
+ return (source) => source.pipe(switchMap((a, i) => from(project(a, i)).pipe(map((b, ii) => resultSelector(a, b, i, ii)))));
838
+ }
839
+ return (source) => source.lift(new SwitchMapOperator(project));
840
+ }
841
+ class SwitchMapOperator {
842
+ constructor(project) {
843
+ this.project = project;
844
+ }
845
+ call(subscriber, source) {
846
+ return source.subscribe(new SwitchMapSubscriber(subscriber, this.project));
847
+ }
848
+ }
849
+ class SwitchMapSubscriber extends SimpleOuterSubscriber {
850
+ constructor(destination, project) {
851
+ super(destination);
852
+ this.project = project;
853
+ this.index = 0;
854
+ }
855
+ _next(value) {
856
+ let result;
857
+ const index = this.index++;
858
+ try {
859
+ result = this.project(value, index);
860
+ }
861
+ catch (error) {
862
+ this.destination.error(error);
863
+ return;
864
+ }
865
+ this._innerSub(result);
866
+ }
867
+ _innerSub(result) {
868
+ const innerSubscription = this.innerSubscription;
869
+ if (innerSubscription) {
870
+ innerSubscription.unsubscribe();
871
+ }
872
+ const innerSubscriber = new SimpleInnerSubscriber(this);
873
+ const destination = this.destination;
874
+ destination.add(innerSubscriber);
875
+ this.innerSubscription = innerSubscribe(result, innerSubscriber);
876
+ if (this.innerSubscription !== innerSubscriber) {
877
+ destination.add(this.innerSubscription);
878
+ }
879
+ }
880
+ _complete() {
881
+ const { innerSubscription } = this;
882
+ if (!innerSubscription || innerSubscription.closed) {
883
+ super._complete();
884
+ }
885
+ this.unsubscribe();
886
+ }
887
+ _unsubscribe() {
888
+ this.innerSubscription = undefined;
889
+ }
890
+ notifyComplete() {
891
+ this.innerSubscription = undefined;
892
+ if (this.isStopped) {
893
+ super._complete();
894
+ }
895
+ }
896
+ notifyNext(innerValue) {
897
+ this.destination.next(innerValue);
898
+ }
899
+ }
900
+
901
+ const currentAction = {
902
+ type: null,
903
+ entityIds: null,
904
+ skip: false,
905
+ };
906
+ let customActionActive = false;
907
+ function resetCustomAction() {
908
+ customActionActive = false;
909
+ }
910
+ // public API for custom actions. Custom action always wins
911
+ function logAction(type, entityIds) {
912
+ setAction(type, entityIds);
913
+ customActionActive = true;
914
+ }
915
+ function setAction(type, entityIds) {
916
+ if (customActionActive === false) {
917
+ currentAction.type = type;
918
+ currentAction.entityIds = entityIds;
919
+ }
920
+ }
921
+ function action(action, entityIds) {
922
+ return function (target, propertyKey, descriptor) {
923
+ const originalMethod = descriptor.value;
924
+ descriptor.value = function (...args) {
925
+ logAction(action, entityIds);
926
+ return originalMethod.apply(this, args);
927
+ };
928
+ return descriptor;
929
+ };
930
+ }
931
+
932
+ // @internal
933
+ function hasEntity(entities, id) {
934
+ return entities.hasOwnProperty(id);
935
+ }
936
+
937
+ // @internal
938
+ function addEntities({ state, entities, idKey, options = {}, preAddEntity }) {
939
+ let newEntities = {};
940
+ let newIds = [];
941
+ let hasNewEntities = false;
942
+ for (const entity of entities) {
943
+ if (hasEntity(state.entities, entity[idKey]) === false) {
944
+ // evaluate the middleware first to support dynamic ids
945
+ const current = preAddEntity(entity);
946
+ const entityId = current[idKey];
947
+ newEntities[entityId] = current;
948
+ if (options.prepend)
949
+ newIds.unshift(entityId);
950
+ else
951
+ newIds.push(entityId);
952
+ hasNewEntities = true;
953
+ }
954
+ }
955
+ return hasNewEntities
956
+ ? {
957
+ newState: Object.assign({}, state, { entities: Object.assign({}, state.entities, newEntities), ids: options.prepend ? [...newIds, ...state.ids] : [...state.ids, ...newIds] }),
958
+ newIds
959
+ }
960
+ : null;
961
+ }
962
+
963
+ // @internal
964
+ function isNil(v) {
965
+ return v === null || v === undefined;
966
+ }
967
+
968
+ // @internal
969
+ function coerceArray(value) {
970
+ if (isNil(value)) {
971
+ return [];
972
+ }
973
+ return Array.isArray(value) ? value : [value];
974
+ }
975
+
976
+ const DEFAULT_ID_KEY = 'id';
977
+
978
+ var EntityActions;
979
+ (function (EntityActions) {
980
+ EntityActions["Set"] = "Set";
981
+ EntityActions["Add"] = "Add";
982
+ EntityActions["Update"] = "Update";
983
+ EntityActions["Remove"] = "Remove";
984
+ })(EntityActions || (EntityActions = {}));
985
+
986
+ const isBrowser = typeof window !== 'undefined';
987
+
988
+ let __DEV__ = true;
989
+ function enableAkitaProdMode() {
990
+ __DEV__ = false;
991
+ if (isBrowser) {
992
+ delete window.$$stores;
993
+ delete window.$$queries;
994
+ }
995
+ }
996
+ // @internal
997
+ function isDev() {
998
+ return __DEV__;
999
+ }
1000
+
1001
+ // @internal
1002
+ function isObject(value) {
1003
+ const type = typeof value;
1004
+ return value != null && (type == 'object' || type == 'function');
1005
+ }
1006
+
1007
+ // @internal
1008
+ function isArray(value) {
1009
+ return Array.isArray(value);
1010
+ }
1011
+
1012
+ // @internal
1013
+ function getActiveEntities(idOrOptions, ids, currentActive) {
1014
+ let result;
1015
+ if (isArray(idOrOptions)) {
1016
+ result = idOrOptions;
1017
+ }
1018
+ else {
1019
+ if (isObject(idOrOptions)) {
1020
+ if (isNil(currentActive))
1021
+ return;
1022
+ idOrOptions = Object.assign({ wrap: true }, idOrOptions);
1023
+ const currentIdIndex = ids.indexOf(currentActive);
1024
+ if (idOrOptions.prev) {
1025
+ const isFirst = currentIdIndex === 0;
1026
+ if (isFirst && !idOrOptions.wrap)
1027
+ return;
1028
+ result = isFirst ? ids[ids.length - 1] : ids[currentIdIndex - 1];
1029
+ }
1030
+ else if (idOrOptions.next) {
1031
+ const isLast = ids.length === currentIdIndex + 1;
1032
+ if (isLast && !idOrOptions.wrap)
1033
+ return;
1034
+ result = isLast ? ids[0] : ids[currentIdIndex + 1];
1035
+ }
1036
+ }
1037
+ else {
1038
+ if (idOrOptions === currentActive)
1039
+ return;
1040
+ result = idOrOptions;
1041
+ }
1042
+ }
1043
+ return result;
1044
+ }
1045
+
1046
+ // @internal
1047
+ const getInitialEntitiesState = () => ({
1048
+ entities: {},
1049
+ ids: [],
1050
+ loading: true,
1051
+ error: null
1052
+ });
1053
+
1054
+ // @internal
1055
+ function isDefined(val) {
1056
+ return isNil(val) === false;
1057
+ }
1058
+
1059
+ // @internal
1060
+ function isEmpty(arr) {
1061
+ if (isArray(arr)) {
1062
+ return arr.length === 0;
1063
+ }
1064
+ return false;
1065
+ }
1066
+
1067
+ // @internal
1068
+ function isFunction(value) {
1069
+ return typeof value === 'function';
1070
+ }
1071
+
1072
+ // @internal
1073
+ function isUndefined(value) {
1074
+ return value === undefined;
1075
+ }
1076
+
1077
+ // @internal
1078
+ function hasActiveState(state) {
1079
+ return state.hasOwnProperty('active');
1080
+ }
1081
+ // @internal
1082
+ function isMultiActiveState(active) {
1083
+ return isArray(active);
1084
+ }
1085
+ // @internal
1086
+ function resolveActiveEntity({ active, ids, entities }) {
1087
+ if (isMultiActiveState(active)) {
1088
+ return getExitingActives(active, ids);
1089
+ }
1090
+ if (hasEntity(entities, active) === false) {
1091
+ return null;
1092
+ }
1093
+ return active;
1094
+ }
1095
+ // @internal
1096
+ function getExitingActives(currentActivesIds, newIds) {
1097
+ const filtered = currentActivesIds.filter(id => newIds.indexOf(id) > -1);
1098
+ /** Return the same reference if nothing has changed */
1099
+ if (filtered.length === currentActivesIds.length) {
1100
+ return currentActivesIds;
1101
+ }
1102
+ return filtered;
1103
+ }
1104
+
1105
+ // @internal
1106
+ function removeEntities({ state, ids }) {
1107
+ if (isNil(ids))
1108
+ return removeAllEntities(state);
1109
+ const entities = state.entities;
1110
+ let newEntities = {};
1111
+ for (const id of state.ids) {
1112
+ if (ids.includes(id) === false) {
1113
+ newEntities[id] = entities[id];
1114
+ }
1115
+ }
1116
+ const newState = Object.assign({}, state, { entities: newEntities, ids: state.ids.filter(current => ids.includes(current) === false) });
1117
+ if (hasActiveState(state)) {
1118
+ newState.active = resolveActiveEntity(newState);
1119
+ }
1120
+ return newState;
1121
+ }
1122
+ // @internal
1123
+ function removeAllEntities(state) {
1124
+ return Object.assign({}, state, { entities: {}, ids: [], active: isMultiActiveState(state.active) ? [] : null });
1125
+ }
1126
+
1127
+ // @internal
1128
+ function toEntitiesObject(entities, idKey, preAddEntity) {
1129
+ const acc = {
1130
+ entities: {},
1131
+ ids: []
1132
+ };
1133
+ for (const entity of entities) {
1134
+ // evaluate the middleware first to support dynamic ids
1135
+ const current = preAddEntity(entity);
1136
+ acc.entities[current[idKey]] = current;
1137
+ acc.ids.push(current[idKey]);
1138
+ }
1139
+ return acc;
1140
+ }
1141
+
1142
+ // @internal
1143
+ function isEntityState(state) {
1144
+ return state.entities && state.ids;
1145
+ }
1146
+ // @internal
1147
+ function applyMiddleware(entities, preAddEntity) {
1148
+ let mapped = {};
1149
+ for (const id of Object.keys(entities)) {
1150
+ mapped[id] = preAddEntity(entities[id]);
1151
+ }
1152
+ return mapped;
1153
+ }
1154
+ // @internal
1155
+ function setEntities({ state, entities, idKey, preAddEntity, isNativePreAdd }) {
1156
+ let newEntities;
1157
+ let newIds;
1158
+ if (isArray(entities)) {
1159
+ const resolve = toEntitiesObject(entities, idKey, preAddEntity);
1160
+ newEntities = resolve.entities;
1161
+ newIds = resolve.ids;
1162
+ }
1163
+ else if (isEntityState(entities)) {
1164
+ newEntities = isNativePreAdd ? entities.entities : applyMiddleware(entities.entities, preAddEntity);
1165
+ newIds = entities.ids;
1166
+ }
1167
+ else {
1168
+ // it's an object
1169
+ newEntities = isNativePreAdd ? entities : applyMiddleware(entities, preAddEntity);
1170
+ newIds = Object.keys(newEntities).map(id => (isNaN(id) ? id : Number(id)));
1171
+ }
1172
+ const newState = Object.assign({}, state, { entities: newEntities, ids: newIds, loading: false });
1173
+ if (hasActiveState(state)) {
1174
+ newState.active = resolveActiveEntity(newState);
1175
+ }
1176
+ return newState;
1177
+ }
1178
+
1179
+ let CONFIG = {
1180
+ resettable: false,
1181
+ ttl: null,
1182
+ producerFn: undefined
1183
+ };
1184
+ // @internal
1185
+ function getAkitaConfig() {
1186
+ return CONFIG;
1187
+ }
1188
+ function getGlobalProducerFn() {
1189
+ return CONFIG.producerFn;
1190
+ }
1191
+
1192
+ // @internal
1193
+ function deepFreeze(o) {
1194
+ Object.freeze(o);
1195
+ const oIsFunction = typeof o === 'function';
1196
+ const hasOwnProp = Object.prototype.hasOwnProperty;
1197
+ Object.getOwnPropertyNames(o).forEach(function (prop) {
1198
+ if (hasOwnProp.call(o, prop) &&
1199
+ (oIsFunction ? prop !== 'caller' && prop !== 'callee' && prop !== 'arguments' : true) &&
1200
+ o[prop] !== null &&
1201
+ (typeof o[prop] === 'object' || typeof o[prop] === 'function') &&
1202
+ !Object.isFrozen(o[prop])) {
1203
+ deepFreeze(o[prop]);
1204
+ }
1205
+ });
1206
+ return o;
1207
+ }
1208
+
1209
+ // @internal
1210
+ const $$deleteStore = new Subject();
1211
+ // @internal
1212
+ const $$addStore = new ReplaySubject(50, 5000);
1213
+ // @internal
1214
+ const $$updateStore = new Subject();
1215
+ // @internal
1216
+ function dispatchDeleted(storeName) {
1217
+ $$deleteStore.next(storeName);
1218
+ }
1219
+ // @internal
1220
+ function dispatchAdded(storeName) {
1221
+ $$addStore.next(storeName);
1222
+ }
1223
+ // @internal
1224
+ function dispatchUpdate(storeName, action) {
1225
+ $$updateStore.next({ storeName, action });
1226
+ }
1227
+ // @internal
1228
+ function assertStoreHasName(name, className) {
1229
+ if (!name) {
1230
+ console.error(`@StoreConfig({ name }) is missing in ${className}`);
1231
+ }
1232
+ }
1233
+
1234
+ // @internal
1235
+ function toBoolean(value) {
1236
+ return value != null && `${value}` !== 'false';
1237
+ }
1238
+
1239
+ // @internal
1240
+ function isPlainObject(value) {
1241
+ return toBoolean(value) && value.constructor.name === 'Object';
1242
+ }
1243
+
1244
+ const configKey = 'akitaConfig';
1245
+ function StoreConfig(metadata) {
1246
+ return function (constructor) {
1247
+ constructor[configKey] = { idKey: 'id' };
1248
+ for (let i = 0, keys = Object.keys(metadata); i < keys.length; i++) {
1249
+ const key = keys[i];
1250
+ /* name is preserved read only key */
1251
+ if (key === 'name') {
1252
+ constructor[configKey]['storeName'] = metadata[key];
1253
+ }
1254
+ else {
1255
+ constructor[configKey][key] = metadata[key];
1256
+ }
1257
+ }
1258
+ };
1259
+ }
1260
+
1261
+ // @internal
1262
+ const __stores__ = {};
1263
+ // @internal
1264
+ const __queries__ = {};
1265
+ if (isBrowser) {
1266
+ window.$$stores = __stores__;
1267
+ window.$$queries = __queries__;
1268
+ }
1269
+
1270
+ // @internal
1271
+ const transactionFinished = new Subject();
1272
+ // @internal
1273
+ const transactionInProcess = new BehaviorSubject(false);
1274
+ // @internal
1275
+ const transactionManager = {
1276
+ activeTransactions: 0,
1277
+ batchTransaction: null
1278
+ };
1279
+ // @internal
1280
+ function startBatch() {
1281
+ if (!isTransactionInProcess()) {
1282
+ transactionManager.batchTransaction = new Subject();
1283
+ }
1284
+ transactionManager.activeTransactions++;
1285
+ transactionInProcess.next(true);
1286
+ }
1287
+ // @internal
1288
+ function endBatch() {
1289
+ if (--transactionManager.activeTransactions === 0) {
1290
+ transactionManager.batchTransaction.next(true);
1291
+ transactionManager.batchTransaction.complete();
1292
+ transactionInProcess.next(false);
1293
+ transactionFinished.next(true);
1294
+ }
1295
+ }
1296
+ // @internal
1297
+ function isTransactionInProcess() {
1298
+ return transactionManager.activeTransactions > 0;
1299
+ }
1300
+ // @internal
1301
+ function commit() {
1302
+ return transactionManager.batchTransaction ? transactionManager.batchTransaction.asObservable() : delay.of(true);
1303
+ }
1304
+ /**
1305
+ * A logical transaction.
1306
+ * Use this transaction to optimize the dispatch of all the stores.
1307
+ * The following code will update the store, BUT emits only once
1308
+ *
1309
+ * @example
1310
+ * applyTransaction(() => {
1311
+ * this.todosStore.add(new Todo(1, title));
1312
+ * this.todosStore.add(new Todo(2, title));
1313
+ * });
1314
+ *
1315
+ */
1316
+ function applyTransaction(action, thisArg = undefined) {
1317
+ startBatch();
1318
+ try {
1319
+ return action.apply(thisArg);
1320
+ }
1321
+ finally {
1322
+ logAction('@Transaction');
1323
+ endBatch();
1324
+ }
1325
+ }
1326
+ /**
1327
+ * A logical transaction.
1328
+ * Use this transaction to optimize the dispatch of all the stores.
1329
+ *
1330
+ * The following code will update the store, BUT emits only once.
1331
+ *
1332
+ * @example
1333
+ * @transaction
1334
+ * addTodos() {
1335
+ * this.todosStore.add(new Todo(1, title));
1336
+ * this.todosStore.add(new Todo(2, title));
1337
+ * }
1338
+ *
1339
+ *
1340
+ */
1341
+ function transaction() {
1342
+ return function (target, propertyKey, descriptor) {
1343
+ const originalMethod = descriptor.value;
1344
+ descriptor.value = function (...args) {
1345
+ return applyTransaction(() => {
1346
+ return originalMethod.apply(this, args);
1347
+ }, this);
1348
+ };
1349
+ return descriptor;
1350
+ };
1351
+ }
1352
+
1353
+ /**
1354
+ *
1355
+ * Store for managing any type of data
1356
+ *
1357
+ * @example
1358
+ *
1359
+ * export interface SessionState {
1360
+ * token: string;
1361
+ * userDetails: UserDetails
1362
+ * }
1363
+ *
1364
+ * export function createInitialState(): SessionState {
1365
+ * return {
1366
+ * token: '',
1367
+ * userDetails: null
1368
+ * };
1369
+ * }
1370
+ *
1371
+ * @StoreConfig({ name: 'session' })
1372
+ * export class SessionStore extends Store<SessionState> {
1373
+ * constructor() {
1374
+ * super(createInitialState());
1375
+ * }
1376
+ * }
1377
+ */
1378
+ class Store {
1379
+ constructor(initialState, options = {}) {
1380
+ this.options = options;
1381
+ this.inTransaction = false;
1382
+ this.cache = {
1383
+ active: new BehaviorSubject(false),
1384
+ ttl: null,
1385
+ };
1386
+ this.onInit(initialState);
1387
+ }
1388
+ /**
1389
+ * Set the loading state
1390
+ *
1391
+ * @example
1392
+ *
1393
+ * store.setLoading(true)
1394
+ *
1395
+ */
1396
+ setLoading(loading = false) {
1397
+ if (loading !== this._value().loading) {
1398
+ isDev() && setAction('Set Loading');
1399
+ this._setState((state) => (Object.assign({}, state, { loading })));
1400
+ }
1401
+ }
1402
+ /**
1403
+ *
1404
+ * Set whether the data is cached
1405
+ *
1406
+ * @example
1407
+ *
1408
+ * store.setHasCache(true)
1409
+ * store.setHasCache(false)
1410
+ * store.setHasCache(true, { restartTTL: true })
1411
+ *
1412
+ */
1413
+ setHasCache(hasCache, options = { restartTTL: false }) {
1414
+ if (hasCache !== this.cache.active.value) {
1415
+ this.cache.active.next(hasCache);
1416
+ }
1417
+ if (options.restartTTL) {
1418
+ const ttlConfig = this.getCacheTTL();
1419
+ if (ttlConfig) {
1420
+ if (this.cache.ttl !== null) {
1421
+ clearTimeout(this.cache.ttl);
1422
+ }
1423
+ this.cache.ttl = setTimeout(() => this.setHasCache(false), ttlConfig);
1424
+ }
1425
+ }
1426
+ }
1427
+ /**
1428
+ *
1429
+ * Sometimes we need to access the store value from a store
1430
+ *
1431
+ * @example middleware
1432
+ *
1433
+ */
1434
+ getValue() {
1435
+ return this.storeValue;
1436
+ }
1437
+ /**
1438
+ * Set the error state
1439
+ *
1440
+ * @example
1441
+ *
1442
+ * store.setError({text: 'unable to load data' })
1443
+ *
1444
+ */
1445
+ setError(error) {
1446
+ if (error !== this._value().error) {
1447
+ isDev() && setAction('Set Error');
1448
+ this._setState((state) => (Object.assign({}, state, { error })));
1449
+ }
1450
+ }
1451
+ // @internal
1452
+ _select(project) {
1453
+ return this.store.asObservable().pipe(map((snapshot) => project(snapshot.state)), distinctUntilChanged());
1454
+ }
1455
+ // @internal
1456
+ _value() {
1457
+ return this.storeValue;
1458
+ }
1459
+ // @internal
1460
+ _cache() {
1461
+ return this.cache.active;
1462
+ }
1463
+ // @internal
1464
+ get config() {
1465
+ return this.constructor[configKey] || {};
1466
+ }
1467
+ // @internal
1468
+ get storeName() {
1469
+ return this.config.storeName || this.options.storeName || this.options.name;
1470
+ }
1471
+ // @internal
1472
+ get deepFreeze() {
1473
+ return this.config.deepFreezeFn || this.options.deepFreezeFn || deepFreeze;
1474
+ }
1475
+ // @internal
1476
+ get cacheConfig() {
1477
+ return this.config.cache || this.options.cache;
1478
+ }
1479
+ get _producerFn() {
1480
+ return this.config.producerFn || this.options.producerFn || getGlobalProducerFn();
1481
+ }
1482
+ // @internal
1483
+ get resettable() {
1484
+ return isDefined(this.config.resettable) ? this.config.resettable : this.options.resettable;
1485
+ }
1486
+ // @internal
1487
+ _setState(newState, _dispatchAction = true) {
1488
+ if (isFunction(newState)) {
1489
+ const _newState = newState(this._value());
1490
+ this.storeValue = __DEV__ ? this.deepFreeze(_newState) : _newState;
1491
+ }
1492
+ else {
1493
+ this.storeValue = newState;
1494
+ }
1495
+ if (!this.store) {
1496
+ this.store = new BehaviorSubject({ state: this.storeValue });
1497
+ if (isDev()) {
1498
+ this.store.subscribe(({ action }) => {
1499
+ if (action) {
1500
+ dispatchUpdate(this.storeName, action);
1501
+ }
1502
+ });
1503
+ }
1504
+ return;
1505
+ }
1506
+ if (isTransactionInProcess()) {
1507
+ this.handleTransaction();
1508
+ return;
1509
+ }
1510
+ this.dispatch(this.storeValue, _dispatchAction);
1511
+ }
1512
+ /**
1513
+ *
1514
+ * Reset the current store back to the initial value
1515
+ *
1516
+ * @example
1517
+ *
1518
+ * store.reset()
1519
+ *
1520
+ */
1521
+ reset() {
1522
+ if (this.isResettable()) {
1523
+ isDev() && setAction('Reset');
1524
+ this._setState(() => Object.assign({}, this._initialState));
1525
+ this.setHasCache(false);
1526
+ }
1527
+ else {
1528
+ isDev() && console.warn(`You need to enable the reset functionality`);
1529
+ }
1530
+ }
1531
+ update(stateOrCallback) {
1532
+ isDev() && setAction('Update');
1533
+ let newState;
1534
+ const currentState = this._value();
1535
+ if (isFunction(stateOrCallback)) {
1536
+ newState = isFunction(this._producerFn) ? this._producerFn(currentState, stateOrCallback) : stateOrCallback(currentState);
1537
+ }
1538
+ else {
1539
+ newState = stateOrCallback;
1540
+ }
1541
+ const withHook = this.akitaPreUpdate(currentState, Object.assign({}, currentState, newState));
1542
+ const resolved = isPlainObject(currentState) ? withHook : new currentState.constructor(withHook);
1543
+ this._setState(resolved);
1544
+ }
1545
+ updateStoreConfig(newOptions) {
1546
+ this.options = Object.assign({}, this.options, newOptions);
1547
+ }
1548
+ // @internal
1549
+ akitaPreUpdate(_, nextState) {
1550
+ return nextState;
1551
+ }
1552
+ ngOnDestroy() {
1553
+ this.destroy();
1554
+ }
1555
+ /**
1556
+ *
1557
+ * Destroy the store
1558
+ *
1559
+ * @example
1560
+ *
1561
+ * store.destroy()
1562
+ *
1563
+ */
1564
+ destroy() {
1565
+ const hmrEnabled = isBrowser ? window.hmrEnabled : false;
1566
+ if (!hmrEnabled && this === __stores__[this.storeName]) {
1567
+ delete __stores__[this.storeName];
1568
+ dispatchDeleted(this.storeName);
1569
+ this.setHasCache(false);
1570
+ this.cache.active.complete();
1571
+ this.store.complete();
1572
+ }
1573
+ }
1574
+ onInit(initialState) {
1575
+ __stores__[this.storeName] = this;
1576
+ this._setState(() => initialState);
1577
+ dispatchAdded(this.storeName);
1578
+ if (this.isResettable()) {
1579
+ this._initialState = initialState;
1580
+ }
1581
+ isDev() && assertStoreHasName(this.storeName, this.constructor.name);
1582
+ }
1583
+ dispatch(state, _dispatchAction = true) {
1584
+ let action = undefined;
1585
+ if (_dispatchAction) {
1586
+ action = currentAction;
1587
+ resetCustomAction();
1588
+ }
1589
+ this.store.next({ state, action });
1590
+ }
1591
+ watchTransaction() {
1592
+ commit().subscribe(() => {
1593
+ this.inTransaction = false;
1594
+ this.dispatch(this._value());
1595
+ });
1596
+ }
1597
+ isResettable() {
1598
+ if (this.resettable === false) {
1599
+ return false;
1600
+ }
1601
+ return this.resettable || getAkitaConfig().resettable;
1602
+ }
1603
+ handleTransaction() {
1604
+ if (!this.inTransaction) {
1605
+ this.watchTransaction();
1606
+ this.inTransaction = true;
1607
+ }
1608
+ }
1609
+ getCacheTTL() {
1610
+ return (this.cacheConfig && this.cacheConfig.ttl) || getAkitaConfig().ttl;
1611
+ }
1612
+ }
1613
+
1614
+ // @internal
1615
+ function updateEntities({ state, ids, idKey, newStateOrFn, preUpdateEntity, producerFn, onEntityIdChanges }) {
1616
+ const updatedEntities = {};
1617
+ let isUpdatingIdKey = false;
1618
+ let idToUpdate;
1619
+ for (const id of ids) {
1620
+ // if the entity doesn't exist don't do anything
1621
+ if (hasEntity(state.entities, id) === false) {
1622
+ continue;
1623
+ }
1624
+ const oldEntity = state.entities[id];
1625
+ let newState;
1626
+ if (isFunction(newStateOrFn)) {
1627
+ newState = isFunction(producerFn) ? producerFn(oldEntity, newStateOrFn) : newStateOrFn(oldEntity);
1628
+ }
1629
+ else {
1630
+ newState = newStateOrFn;
1631
+ }
1632
+ const isIdChanged = newState.hasOwnProperty(idKey) && newState[idKey] !== oldEntity[idKey];
1633
+ let newEntity;
1634
+ idToUpdate = id;
1635
+ if (isIdChanged) {
1636
+ isUpdatingIdKey = true;
1637
+ idToUpdate = newState[idKey];
1638
+ }
1639
+ const merged = Object.assign({}, oldEntity, newState);
1640
+ if (isPlainObject(oldEntity)) {
1641
+ newEntity = merged;
1642
+ }
1643
+ else {
1644
+ /**
1645
+ * In case that new state is class of it's own, there's
1646
+ * a possibility that it will be different than the old
1647
+ * class.
1648
+ * For example, Old state is an instance of animal class
1649
+ * and new state is instance of person class.
1650
+ * To avoid run over new person class with the old animal
1651
+ * class we check if the new state is a class of it's own.
1652
+ * If so, use it. Otherwise, use the old state class
1653
+ */
1654
+ if (isPlainObject(newState)) {
1655
+ newEntity = new oldEntity.constructor(merged);
1656
+ }
1657
+ else {
1658
+ newEntity = new newState.constructor(merged);
1659
+ }
1660
+ }
1661
+ updatedEntities[idToUpdate] = preUpdateEntity(oldEntity, newEntity);
1662
+ }
1663
+ let updatedIds = state.ids;
1664
+ let stateEntities = state.entities;
1665
+ if (isUpdatingIdKey) {
1666
+ const [id] = ids;
1667
+ const _a = state.entities, _b = id, rest = __rest(_a, [typeof _b === "symbol" ? _b : _b + ""]);
1668
+ stateEntities = rest;
1669
+ updatedIds = state.ids.map((current) => (current === id ? idToUpdate : current));
1670
+ onEntityIdChanges(id, idToUpdate);
1671
+ }
1672
+ return Object.assign({}, state, { entities: Object.assign({}, stateEntities, updatedEntities), ids: updatedIds });
1673
+ }
1674
+
1675
+ var _b;
1676
+ /**
1677
+ *
1678
+ * Store for managing a collection of entities
1679
+ *
1680
+ * @example
1681
+ *
1682
+ * export interface WidgetsState extends EntityState<Widget> { }
1683
+ *
1684
+ * @StoreConfig({ name: 'widgets' })
1685
+ * export class WidgetsStore extends EntityStore<WidgetsState> {
1686
+ * constructor() {
1687
+ * super();
1688
+ * }
1689
+ * }
1690
+ *
1691
+ *
1692
+ */
1693
+ class EntityStore extends Store {
1694
+ constructor(initialState = {}, options = {}) {
1695
+ super(Object.assign({}, getInitialEntitiesState(), initialState), options);
1696
+ this.options = options;
1697
+ this.entityActions = new Subject();
1698
+ this.entityIdChanges = new Subject();
1699
+ }
1700
+ // @internal
1701
+ get selectEntityAction$() {
1702
+ return this.entityActions.asObservable();
1703
+ }
1704
+ // @internal
1705
+ get selectEntityIdChanges$() {
1706
+ return this.entityIdChanges.asObservable();
1707
+ }
1708
+ // @internal
1709
+ get idKey() {
1710
+ return this.config.idKey || this.options.idKey || DEFAULT_ID_KEY;
1711
+ }
1712
+ /**
1713
+ *
1714
+ * Replace current collection with provided collection
1715
+ *
1716
+ * @example
1717
+ *
1718
+ * this.store.set([Entity, Entity])
1719
+ * this.store.set({ids: [], entities: {}})
1720
+ * this.store.set({ 1: {}, 2: {}})
1721
+ *
1722
+ */
1723
+ set(entities, options = {}) {
1724
+ if (isNil(entities))
1725
+ return;
1726
+ isDev() && setAction('Set Entity');
1727
+ const isNativePreAdd = this.akitaPreAddEntity === EntityStore.prototype.akitaPreAddEntity;
1728
+ this.setHasCache(true, { restartTTL: true });
1729
+ this._setState((state) => {
1730
+ const newState = setEntities({
1731
+ state,
1732
+ entities,
1733
+ idKey: this.idKey,
1734
+ preAddEntity: this.akitaPreAddEntity,
1735
+ isNativePreAdd,
1736
+ });
1737
+ if (isUndefined(options.activeId) === false) {
1738
+ newState.active = options.activeId;
1739
+ }
1740
+ return newState;
1741
+ });
1742
+ if (this.hasInitialUIState()) {
1743
+ this.handleUICreation();
1744
+ }
1745
+ this.entityActions.next({ type: EntityActions.Set, ids: this.ids });
1746
+ }
1747
+ /**
1748
+ * Add entities
1749
+ *
1750
+ * @example
1751
+ *
1752
+ * this.store.add([Entity, Entity])
1753
+ * this.store.add(Entity)
1754
+ * this.store.add(Entity, { prepend: true })
1755
+ *
1756
+ * this.store.add(Entity, { loading: false })
1757
+ */
1758
+ add(entities, options = { loading: false }) {
1759
+ const collection = coerceArray(entities);
1760
+ if (isEmpty(collection))
1761
+ return;
1762
+ const data = addEntities({
1763
+ state: this._value(),
1764
+ preAddEntity: this.akitaPreAddEntity,
1765
+ entities: collection,
1766
+ idKey: this.idKey,
1767
+ options,
1768
+ });
1769
+ if (data) {
1770
+ isDev() && setAction('Add Entity');
1771
+ data.newState.loading = options.loading;
1772
+ this._setState(() => data.newState);
1773
+ if (this.hasInitialUIState()) {
1774
+ this.handleUICreation(true);
1775
+ }
1776
+ this.entityActions.next({ type: EntityActions.Add, ids: data.newIds });
1777
+ }
1778
+ }
1779
+ update(idsOrFnOrState, newStateOrFn) {
1780
+ if (isUndefined(newStateOrFn)) {
1781
+ super.update(idsOrFnOrState);
1782
+ return;
1783
+ }
1784
+ let ids = [];
1785
+ if (isFunction(idsOrFnOrState)) {
1786
+ // We need to filter according the predicate function
1787
+ ids = this.ids.filter((id) => idsOrFnOrState(this.entities[id]));
1788
+ }
1789
+ else {
1790
+ // If it's nil we want all of them
1791
+ ids = isNil(idsOrFnOrState) ? this.ids : coerceArray(idsOrFnOrState);
1792
+ }
1793
+ if (isEmpty(ids))
1794
+ return;
1795
+ isDev() && setAction('Update Entity', ids);
1796
+ let entityIdChanged;
1797
+ this._setState((state) => updateEntities({
1798
+ idKey: this.idKey,
1799
+ ids,
1800
+ preUpdateEntity: this.akitaPreUpdateEntity,
1801
+ state,
1802
+ newStateOrFn,
1803
+ producerFn: this._producerFn,
1804
+ onEntityIdChanges: (oldId, newId) => {
1805
+ entityIdChanged = { oldId, newId };
1806
+ this.entityIdChanges.next(Object.assign({}, entityIdChanged, { pending: true }));
1807
+ },
1808
+ }));
1809
+ if (entityIdChanged) {
1810
+ this.entityIdChanges.next(Object.assign({}, entityIdChanged, { pending: false }));
1811
+ }
1812
+ this.entityActions.next({ type: EntityActions.Update, ids });
1813
+ }
1814
+ upsert(ids, newState, onCreate, options = {}) {
1815
+ const toArray = coerceArray(ids);
1816
+ const predicate = (isUpdate) => (id) => hasEntity(this.entities, id) === isUpdate;
1817
+ const baseClass = isFunction(onCreate) ? options.baseClass : onCreate ? onCreate.baseClass : undefined;
1818
+ const isClassBased = isFunction(baseClass);
1819
+ const updateIds = toArray.filter(predicate(true));
1820
+ const newEntities = toArray.filter(predicate(false)).map((id) => {
1821
+ const newStateObj = typeof newState === 'function' ? newState({}) : newState;
1822
+ const entity = isFunction(onCreate) ? onCreate(id, newStateObj) : newStateObj;
1823
+ const withId = Object.assign({}, entity, { [this.idKey]: id });
1824
+ if (isClassBased) {
1825
+ return new baseClass(withId);
1826
+ }
1827
+ return withId;
1828
+ });
1829
+ // it can be any of the three types
1830
+ this.update(updateIds, newState);
1831
+ this.add(newEntities);
1832
+ isDev() && logAction('Upsert Entity');
1833
+ }
1834
+ /**
1835
+ *
1836
+ * Upsert entity collection (idKey must be present)
1837
+ *
1838
+ * @example
1839
+ *
1840
+ * store.upsertMany([ { id: 1 }, { id: 2 }]);
1841
+ *
1842
+ * store.upsertMany([ { id: 1 }, { id: 2 }], { loading: true });
1843
+ * store.upsertMany([ { id: 1 }, { id: 2 }], { baseClass: Todo });
1844
+ *
1845
+ */
1846
+ upsertMany(entities, options = {}) {
1847
+ const addedIds = [];
1848
+ const updatedIds = [];
1849
+ const updatedEntities = {};
1850
+ // Update the state directly to optimize performance
1851
+ for (const entity of entities) {
1852
+ const withPreCheckHook = this.akitaPreCheckEntity(entity);
1853
+ const id = withPreCheckHook[this.idKey];
1854
+ if (hasEntity(this.entities, id)) {
1855
+ const prev = this._value().entities[id];
1856
+ const merged = Object.assign({}, this._value().entities[id], withPreCheckHook);
1857
+ const next = options.baseClass ? new options.baseClass(merged) : merged;
1858
+ const withHook = this.akitaPreUpdateEntity(prev, next);
1859
+ const nextId = withHook[this.idKey];
1860
+ updatedEntities[nextId] = withHook;
1861
+ updatedIds.push(nextId);
1862
+ }
1863
+ else {
1864
+ const newEntity = options.baseClass ? new options.baseClass(withPreCheckHook) : withPreCheckHook;
1865
+ const withHook = this.akitaPreAddEntity(newEntity);
1866
+ const nextId = withHook[this.idKey];
1867
+ addedIds.push(nextId);
1868
+ updatedEntities[nextId] = withHook;
1869
+ }
1870
+ }
1871
+ isDev() && logAction('Upsert Many');
1872
+ this._setState((state) => (Object.assign({}, state, { ids: addedIds.length ? [...state.ids, ...addedIds] : state.ids, entities: Object.assign({}, state.entities, updatedEntities), loading: !!options.loading })));
1873
+ updatedIds.length && this.entityActions.next({ type: EntityActions.Update, ids: updatedIds });
1874
+ addedIds.length && this.entityActions.next({ type: EntityActions.Add, ids: addedIds });
1875
+ if (addedIds.length && this.hasUIStore()) {
1876
+ this.handleUICreation(true);
1877
+ }
1878
+ }
1879
+ /**
1880
+ *
1881
+ * Replace one or more entities (except the id property)
1882
+ *
1883
+ *
1884
+ * @example
1885
+ *
1886
+ * this.store.replace(5, newEntity)
1887
+ * this.store.replace([1,2,3], newEntity)
1888
+ */
1889
+ replace(ids, newState) {
1890
+ const toArray = coerceArray(ids);
1891
+ if (isEmpty(toArray))
1892
+ return;
1893
+ let replaced = {};
1894
+ for (const id of toArray) {
1895
+ newState[this.idKey] = id;
1896
+ replaced[id] = newState;
1897
+ }
1898
+ isDev() && setAction('Replace Entity', ids);
1899
+ this._setState((state) => (Object.assign({}, state, { entities: Object.assign({}, state.entities, replaced) })));
1900
+ }
1901
+ /**
1902
+ *
1903
+ * Move entity inside the collection
1904
+ *
1905
+ *
1906
+ * @example
1907
+ *
1908
+ * this.store.move(fromIndex, toIndex)
1909
+ */
1910
+ move(from, to) {
1911
+ const ids = this.ids.slice();
1912
+ ids.splice(to < 0 ? ids.length + to : to, 0, ids.splice(from, 1)[0]);
1913
+ isDev() && setAction('Move Entity');
1914
+ this._setState((state) => (Object.assign({}, state, {
1915
+ // Change the entities reference so that selectAll emit
1916
+ entities: Object.assign({}, state.entities), ids })));
1917
+ }
1918
+ remove(idsOrFn) {
1919
+ if (isEmpty(this.ids))
1920
+ return;
1921
+ const idPassed = isDefined(idsOrFn);
1922
+ // null means remove all
1923
+ let ids = [];
1924
+ if (isFunction(idsOrFn)) {
1925
+ ids = this.ids.filter((entityId) => idsOrFn(this.entities[entityId]));
1926
+ }
1927
+ else {
1928
+ ids = idPassed ? coerceArray(idsOrFn) : this.ids;
1929
+ }
1930
+ if (isEmpty(ids))
1931
+ return;
1932
+ isDev() && setAction('Remove Entity', ids);
1933
+ this._setState((state) => removeEntities({ state, ids }));
1934
+ if (!idPassed) {
1935
+ this.setHasCache(false);
1936
+ }
1937
+ this.handleUIRemove(ids);
1938
+ this.entityActions.next({ type: EntityActions.Remove, ids });
1939
+ }
1940
+ /**
1941
+ *
1942
+ * Update the active entity
1943
+ *
1944
+ * @example
1945
+ *
1946
+ * this.store.updateActive({ completed: true })
1947
+ * this.store.updateActive(active => {
1948
+ * return {
1949
+ * config: {
1950
+ * ..active.config,
1951
+ * date
1952
+ * }
1953
+ * }
1954
+ * })
1955
+ */
1956
+ updateActive(newStateOrCallback) {
1957
+ const ids = coerceArray(this.active);
1958
+ isDev() && setAction('Update Active', ids);
1959
+ this.update(ids, newStateOrCallback);
1960
+ }
1961
+ setActive(idOrOptions) {
1962
+ const active = getActiveEntities(idOrOptions, this.ids, this.active);
1963
+ if (active === undefined) {
1964
+ return;
1965
+ }
1966
+ isDev() && setAction('Set Active', active);
1967
+ this._setActive(active);
1968
+ }
1969
+ /**
1970
+ * Add active entities
1971
+ *
1972
+ * @example
1973
+ *
1974
+ * store.addActive(2);
1975
+ * store.addActive([3, 4, 5]);
1976
+ */
1977
+ addActive(ids) {
1978
+ const toArray = coerceArray(ids);
1979
+ if (isEmpty(toArray))
1980
+ return;
1981
+ const everyExist = toArray.every((id) => this.active.indexOf(id) > -1);
1982
+ if (everyExist)
1983
+ return;
1984
+ isDev() && setAction('Add Active', ids);
1985
+ this._setState((state) => {
1986
+ /** Protect against case that one of the items in the array exist */
1987
+ const uniques = Array.from(new Set([...state.active, ...toArray]));
1988
+ return Object.assign({}, state, { active: uniques });
1989
+ });
1990
+ }
1991
+ /**
1992
+ * Remove active entities
1993
+ *
1994
+ * @example
1995
+ *
1996
+ * store.removeActive(2)
1997
+ * store.removeActive([3, 4, 5])
1998
+ */
1999
+ removeActive(ids) {
2000
+ const toArray = coerceArray(ids);
2001
+ if (isEmpty(toArray))
2002
+ return;
2003
+ const someExist = toArray.some((id) => this.active.indexOf(id) > -1);
2004
+ if (!someExist)
2005
+ return;
2006
+ isDev() && setAction('Remove Active', ids);
2007
+ this._setState((state) => {
2008
+ return Object.assign({}, state, { active: Array.isArray(state.active) ? state.active.filter((currentId) => toArray.indexOf(currentId) === -1) : null });
2009
+ });
2010
+ }
2011
+ /**
2012
+ * Toggle active entities
2013
+ *
2014
+ * @example
2015
+ *
2016
+ * store.toggle(2)
2017
+ * store.toggle([3, 4, 5])
2018
+ */
2019
+ toggleActive(ids) {
2020
+ const toArray = coerceArray(ids);
2021
+ const filterExists = (remove) => (id) => this.active.includes(id) === remove;
2022
+ const remove = toArray.filter(filterExists(true));
2023
+ const add = toArray.filter(filterExists(false));
2024
+ this.removeActive(remove);
2025
+ this.addActive(add);
2026
+ isDev() && logAction('Toggle Active');
2027
+ }
2028
+ /**
2029
+ *
2030
+ * Create sub UI store for managing Entity's UI state
2031
+ *
2032
+ * @example
2033
+ *
2034
+ * export type ProductUI = {
2035
+ * isLoading: boolean;
2036
+ * isOpen: boolean
2037
+ * }
2038
+ *
2039
+ * interface ProductsUIState extends EntityState<ProductUI> {}
2040
+ *
2041
+ * export class ProductsStore EntityStore<ProductsState, Product> {
2042
+ * ui: EntityUIStore<ProductsUIState, ProductUI>;
2043
+ *
2044
+ * constructor() {
2045
+ * super();
2046
+ * this.createUIStore();
2047
+ * }
2048
+ *
2049
+ * }
2050
+ */
2051
+ createUIStore(initialState = {}, storeConfig = {}) {
2052
+ const defaults = { name: `UI/${this.storeName}`, idKey: this.idKey };
2053
+ this.ui = new EntityUIStore(initialState, Object.assign({}, defaults, storeConfig));
2054
+ return this.ui;
2055
+ }
2056
+ // @internal
2057
+ destroy() {
2058
+ super.destroy();
2059
+ if (this.ui instanceof EntityStore) {
2060
+ this.ui.destroy();
2061
+ }
2062
+ this.entityActions.complete();
2063
+ }
2064
+ // @internal
2065
+ akitaPreUpdateEntity(_, nextEntity) {
2066
+ return nextEntity;
2067
+ }
2068
+ // @internal
2069
+ akitaPreAddEntity(newEntity) {
2070
+ return newEntity;
2071
+ }
2072
+ // @internal
2073
+ akitaPreCheckEntity(newEntity) {
2074
+ return newEntity;
2075
+ }
2076
+ get ids() {
2077
+ return this._value().ids;
2078
+ }
2079
+ get entities() {
2080
+ return this._value().entities;
2081
+ }
2082
+ get active() {
2083
+ return this._value().active;
2084
+ }
2085
+ _setActive(ids) {
2086
+ this._setState((state) => {
2087
+ return Object.assign({}, state, { active: ids });
2088
+ });
2089
+ }
2090
+ handleUICreation(add = false) {
2091
+ const ids = this.ids;
2092
+ const isFunc = isFunction(this.ui._akitaCreateEntityFn);
2093
+ let uiEntities;
2094
+ const createFn = (id) => {
2095
+ const current = this.entities[id];
2096
+ const ui = isFunc ? this.ui._akitaCreateEntityFn(current) : this.ui._akitaCreateEntityFn;
2097
+ return Object.assign({ [this.idKey]: current[this.idKey] }, ui);
2098
+ };
2099
+ if (add) {
2100
+ uiEntities = this.ids.filter((id) => isUndefined(this.ui.entities[id])).map(createFn);
2101
+ }
2102
+ else {
2103
+ uiEntities = ids.map(createFn);
2104
+ }
2105
+ add ? this.ui.add(uiEntities) : this.ui.set(uiEntities);
2106
+ }
2107
+ hasInitialUIState() {
2108
+ return this.hasUIStore() && isUndefined(this.ui._akitaCreateEntityFn) === false;
2109
+ }
2110
+ handleUIRemove(ids) {
2111
+ if (this.hasUIStore()) {
2112
+ this.ui.remove(ids);
2113
+ }
2114
+ }
2115
+ hasUIStore() {
2116
+ return this.ui instanceof EntityUIStore;
2117
+ }
2118
+ }
2119
+ __decorate([
2120
+ transaction(),
2121
+ __metadata("design:type", Function),
2122
+ __metadata("design:paramtypes", [Object, Object, Object, Object]),
2123
+ __metadata("design:returntype", void 0)
2124
+ ], EntityStore.prototype, "upsert", null);
2125
+ __decorate([
2126
+ transaction(),
2127
+ __metadata("design:type", Function),
2128
+ __metadata("design:paramtypes", [typeof (_b = typeof T !== "undefined" && T) === "function" ? _b : Object]),
2129
+ __metadata("design:returntype", void 0)
2130
+ ], EntityStore.prototype, "toggleActive", null);
2131
+ // @internal
2132
+ class EntityUIStore extends EntityStore {
2133
+ constructor(initialState = {}, storeConfig = {}) {
2134
+ super(initialState, storeConfig);
2135
+ }
2136
+ /**
2137
+ *
2138
+ * Set the initial UI entity state. This function will determine the entity's
2139
+ * initial state when we call `set()` or `add()`.
2140
+ *
2141
+ * @example
2142
+ *
2143
+ * constructor() {
2144
+ * super();
2145
+ * this.createUIStore().setInitialEntityState(entity => ({ isLoading: false, isOpen: true }));
2146
+ * this.createUIStore().setInitialEntityState({ isLoading: false, isOpen: true });
2147
+ * }
2148
+ *
2149
+ */
2150
+ setInitialEntityState(createFn) {
2151
+ this._akitaCreateEntityFn = createFn;
2152
+ }
2153
+ }
2154
+
2155
+ var Order;
2156
+ (function (Order) {
2157
+ Order["ASC"] = "asc";
2158
+ Order["DESC"] = "desc";
2159
+ })(Order || (Order = {}));
2160
+
2161
+ // @internal
2162
+ function isString(value) {
2163
+ return typeof value === 'string';
2164
+ }
2165
+
2166
+ const queryConfigKey = 'akitaQueryConfig';
2167
+
2168
+ function compareKeys(keysOrFuncs) {
2169
+ return function (prevState, currState) {
2170
+ const isFns = isFunction(keysOrFuncs[0]);
2171
+ // Return when they are NOT changed
2172
+ return keysOrFuncs.some(keyOrFunc => {
2173
+ if (isFns) {
2174
+ return keyOrFunc(prevState) !== keyOrFunc(currState);
2175
+ }
2176
+ return prevState[keyOrFunc] !== currState[keyOrFunc];
2177
+ }) === false;
2178
+ };
2179
+ }
2180
+
2181
+ class Query {
2182
+ constructor(store) {
2183
+ this.store = store;
2184
+ this.__store__ = store;
2185
+ if (isDev()) {
2186
+ // @internal
2187
+ __queries__[store.storeName] = this;
2188
+ }
2189
+ }
2190
+ select(project) {
2191
+ let mapFn;
2192
+ if (isFunction(project)) {
2193
+ mapFn = project;
2194
+ }
2195
+ else if (isString(project)) {
2196
+ mapFn = state => state[project];
2197
+ }
2198
+ else if (Array.isArray(project)) {
2199
+ return this.store
2200
+ ._select(state => state)
2201
+ .pipe(distinctUntilChanged(compareKeys(project)), map(state => {
2202
+ if (isFunction(project[0])) {
2203
+ return project.map(func => func(state));
2204
+ }
2205
+ return project.reduce((acc, k) => {
2206
+ acc[k] = state[k];
2207
+ return acc;
2208
+ }, {});
2209
+ }));
2210
+ }
2211
+ else {
2212
+ mapFn = state => state;
2213
+ }
2214
+ return this.store._select(mapFn);
2215
+ }
2216
+ /**
2217
+ * Select the loading state
2218
+ *
2219
+ * @example
2220
+ *
2221
+ * this.query.selectLoading().subscribe(isLoading => {})
2222
+ */
2223
+ selectLoading() {
2224
+ return this.select(state => state.loading);
2225
+ }
2226
+ /**
2227
+ * Select the error state
2228
+ *
2229
+ * @example
2230
+ *
2231
+ * this.query.selectError().subscribe(error => {})
2232
+ */
2233
+ selectError() {
2234
+ return this.select(state => state.error);
2235
+ }
2236
+ /**
2237
+ * Get the store's value
2238
+ *
2239
+ * @example
2240
+ *
2241
+ * this.query.getValue()
2242
+ *
2243
+ */
2244
+ getValue() {
2245
+ return this.store._value();
2246
+ }
2247
+ /**
2248
+ * Select the cache state
2249
+ *
2250
+ * @example
2251
+ *
2252
+ * this.query.selectHasCache().pipe(
2253
+ * switchMap(hasCache => {
2254
+ * return hasCache ? of() : http().pipe(res => store.set(res))
2255
+ * })
2256
+ * )
2257
+ */
2258
+ selectHasCache() {
2259
+ return this.store._cache().asObservable();
2260
+ }
2261
+ /**
2262
+ * Whether we've cached data
2263
+ *
2264
+ * @example
2265
+ *
2266
+ * this.query.getHasCache()
2267
+ *
2268
+ */
2269
+ getHasCache() {
2270
+ return this.store._cache().value;
2271
+ }
2272
+ // @internal
2273
+ get config() {
2274
+ return this.constructor[queryConfigKey];
2275
+ }
2276
+ }
2277
+
2278
+ /**
2279
+ * @example
2280
+ *
2281
+ * query.selectEntity(2).pipe(filterNil)
2282
+ */
2283
+ const filterNil = (source) => source.pipe(filter((value) => value !== null && typeof value !== 'undefined'));
2284
+
2285
+ /**
2286
+ * @internal
2287
+ *
2288
+ * @example
2289
+ *
2290
+ * getValue(state, 'todos.ui')
2291
+ *
2292
+ */
2293
+ function getValue(obj, prop) {
2294
+ /** return the whole state */
2295
+ if (prop.split('.').length === 1) {
2296
+ return obj;
2297
+ }
2298
+ const removeStoreName = prop
2299
+ .split('.')
2300
+ .slice(1)
2301
+ .join('.');
2302
+ return removeStoreName.split('.').reduce((acc, part) => acc && acc[part], obj);
2303
+ }
2304
+
2305
+ /**
2306
+ * @internal
2307
+ *
2308
+ * @example
2309
+ * setValue(state, 'todos.ui', { filter: {} })
2310
+ */
2311
+ function setValue(obj, prop, val) {
2312
+ const split = prop.split('.');
2313
+ if (split.length === 1) {
2314
+ return Object.assign({}, obj, val);
2315
+ }
2316
+ obj = Object.assign({}, obj);
2317
+ const lastIndex = split.length - 2;
2318
+ const removeStoreName = prop.split('.').slice(1);
2319
+ removeStoreName.reduce((acc, part, index) => {
2320
+ if (index !== lastIndex) {
2321
+ acc[part] = Object.assign({}, acc[part]);
2322
+ return acc && acc[part];
2323
+ }
2324
+ acc[part] = Array.isArray(acc[part]) || !isObject(acc[part]) ? val : Object.assign({}, acc[part], val);
2325
+ return acc && acc[part];
2326
+ }, obj);
2327
+ return obj;
2328
+ }
2329
+ const _persistStateInit = new ReplaySubject(1);
2330
+
2331
+ class AkitaPlugin {
2332
+ constructor(query, config) {
2333
+ this.query = query;
2334
+ if (config && config.resetFn) {
2335
+ if (getAkitaConfig().resettable) {
2336
+ this.onReset(config.resetFn);
2337
+ }
2338
+ }
2339
+ }
2340
+ /** This method is responsible for getting access to the query. */
2341
+ getQuery() {
2342
+ return this.query;
2343
+ }
2344
+ /** This method is responsible for getting access to the store. */
2345
+ getStore() {
2346
+ return this.getQuery().__store__;
2347
+ }
2348
+ /** This method is responsible tells whether the plugin is entityBased or not. */
2349
+ isEntityBased(entityId) {
2350
+ return toBoolean(entityId);
2351
+ }
2352
+ /** This method is responsible for selecting the source; it can be the whole store or one entity. */
2353
+ selectSource(entityId, property) {
2354
+ if (this.isEntityBased(entityId)) {
2355
+ return this.getQuery().selectEntity(entityId).pipe(filterNil);
2356
+ }
2357
+ if (property) {
2358
+ return this.getQuery().select(state => getValue(state, this.withStoreName(property)));
2359
+ }
2360
+ return this.getQuery().select();
2361
+ }
2362
+ getSource(entityId, property) {
2363
+ if (this.isEntityBased(entityId)) {
2364
+ return this.getQuery().getEntity(entityId);
2365
+ }
2366
+ const state = this.getQuery().getValue();
2367
+ if (property) {
2368
+ return getValue(state, this.withStoreName(property));
2369
+ }
2370
+ return state;
2371
+ }
2372
+ withStoreName(prop) {
2373
+ return `${this.storeName}.${prop}`;
2374
+ }
2375
+ get storeName() {
2376
+ return this.getStore().storeName;
2377
+ }
2378
+ /** This method is responsible for updating the store or one entity; it can be the whole store or one entity. */
2379
+ updateStore(newState, entityId, property) {
2380
+ if (this.isEntityBased(entityId)) {
2381
+ this.getStore().update(entityId, newState);
2382
+ }
2383
+ else {
2384
+ if (property) {
2385
+ this.getStore()._setState(state => {
2386
+ return setValue(state, this.withStoreName(property), newState);
2387
+ });
2388
+ return;
2389
+ }
2390
+ this.getStore()._setState(state => (Object.assign({}, state, newState)));
2391
+ }
2392
+ }
2393
+ /**
2394
+ * Function to invoke upon reset
2395
+ */
2396
+ onReset(fn) {
2397
+ const original = this.getStore().reset;
2398
+ this.getStore().reset = (...params) => {
2399
+ /** It should run after the plugin destroy method */
2400
+ setTimeout(() => {
2401
+ original.apply(this.getStore(), params);
2402
+ fn();
2403
+ });
2404
+ };
2405
+ }
2406
+ }
2407
+
2408
+ const paginatorDefaults = {
2409
+ pagesControls: false,
2410
+ range: false,
2411
+ startWith: 1,
2412
+ cacheTimeout: undefined,
2413
+ clearStoreWithCache: true
2414
+ };
2415
+ class PaginatorPlugin extends AkitaPlugin {
2416
+ constructor(query, config = {}) {
2417
+ super(query, {
2418
+ resetFn: () => {
2419
+ this.initial = false;
2420
+ this.destroy({ clearCache: true, currentPage: 1 });
2421
+ }
2422
+ });
2423
+ this.query = query;
2424
+ this.config = config;
2425
+ /** Save current filters, sorting, etc. in cache */
2426
+ this.metadata = new Map();
2427
+ this.pages = new Map();
2428
+ this.pagination = {
2429
+ currentPage: 1,
2430
+ perPage: 0,
2431
+ total: 0,
2432
+ lastPage: 0,
2433
+ data: []
2434
+ };
2435
+ /**
2436
+ * When the user navigates to a different page and return
2437
+ * we don't want to call `clearCache` on first time.
2438
+ */
2439
+ this.initial = true;
2440
+ /**
2441
+ * Proxy to the query loading
2442
+ */
2443
+ this.isLoading$ = this.query.selectLoading().pipe(delay.delay(0));
2444
+ this.config = Object.assign(paginatorDefaults, config);
2445
+ const { startWith, cacheTimeout } = this.config;
2446
+ this.page = new BehaviorSubject(startWith);
2447
+ if (isObservable(cacheTimeout)) {
2448
+ this.clearCacheSubscription = cacheTimeout.subscribe(() => this.clearCache());
2449
+ }
2450
+ }
2451
+ /**
2452
+ * Listen to page changes
2453
+ */
2454
+ get pageChanges() {
2455
+ return this.page.asObservable();
2456
+ }
2457
+ /**
2458
+ * Get the current page number
2459
+ */
2460
+ get currentPage() {
2461
+ return this.pagination.currentPage;
2462
+ }
2463
+ /**
2464
+ * Check if current page is the first one
2465
+ */
2466
+ get isFirst() {
2467
+ return this.currentPage === 1;
2468
+ }
2469
+ /**
2470
+ * Check if current page is the last one
2471
+ */
2472
+ get isLast() {
2473
+ return this.currentPage === this.pagination.lastPage;
2474
+ }
2475
+ /**
2476
+ * Whether to generate an array of pages for *ngFor
2477
+ * [1, 2, 3, 4]
2478
+ */
2479
+ withControls() {
2480
+ this.config.pagesControls = true;
2481
+ return this;
2482
+ }
2483
+ /**
2484
+ * Whether to generate the `from` and `to` keys
2485
+ * [1, 2, 3, 4]
2486
+ */
2487
+ withRange() {
2488
+ this.config.range = true;
2489
+ return this;
2490
+ }
2491
+ /**
2492
+ * Set the loading state
2493
+ */
2494
+ setLoading(value = true) {
2495
+ this.getStore().setLoading(value);
2496
+ }
2497
+ /**
2498
+ * Update the pagination object and add the page
2499
+ */
2500
+ update(response) {
2501
+ this.pagination = response;
2502
+ this.addPage(response.data);
2503
+ }
2504
+ /**
2505
+ *
2506
+ * Set the ids and add the page to store
2507
+ */
2508
+ addPage(data) {
2509
+ this.pages.set(this.currentPage, { ids: data.map(entity => entity[this.getStore().idKey]) });
2510
+ this.getStore().upsertMany(data);
2511
+ }
2512
+ /**
2513
+ * Clear the cache.
2514
+ */
2515
+ clearCache(options = {}) {
2516
+ if (!this.initial) {
2517
+ logAction('@Pagination - Clear Cache');
2518
+ if (options.clearStore !== false && (this.config.clearStoreWithCache || options.clearStore)) {
2519
+ this.getStore().remove();
2520
+ }
2521
+ this.pages = new Map();
2522
+ this.metadata = new Map();
2523
+ }
2524
+ this.initial = false;
2525
+ }
2526
+ clearPage(page) {
2527
+ this.pages.delete(page);
2528
+ }
2529
+ /**
2530
+ * Clear the cache timeout and optionally the pages
2531
+ */
2532
+ destroy({ clearCache, currentPage } = {}) {
2533
+ if (this.clearCacheSubscription) {
2534
+ this.clearCacheSubscription.unsubscribe();
2535
+ }
2536
+ if (clearCache) {
2537
+ this.clearCache();
2538
+ }
2539
+ if (!isUndefined(currentPage)) {
2540
+ this.setPage(currentPage);
2541
+ }
2542
+ this.initial = true;
2543
+ }
2544
+ /**
2545
+ * Whether the provided page is active
2546
+ */
2547
+ isPageActive(page) {
2548
+ return this.currentPage === page;
2549
+ }
2550
+ /**
2551
+ * Set the current page
2552
+ */
2553
+ setPage(page) {
2554
+ if (page !== this.currentPage || !this.hasPage(page)) {
2555
+ this.page.next((this.pagination.currentPage = page));
2556
+ }
2557
+ }
2558
+ /**
2559
+ * Increment current page
2560
+ */
2561
+ nextPage() {
2562
+ if (this.currentPage !== this.pagination.lastPage) {
2563
+ this.setPage(this.pagination.currentPage + 1);
2564
+ }
2565
+ }
2566
+ /**
2567
+ * Decrement current page
2568
+ */
2569
+ prevPage() {
2570
+ if (this.pagination.currentPage > 1) {
2571
+ this.setPage(this.pagination.currentPage - 1);
2572
+ }
2573
+ }
2574
+ /**
2575
+ * Set current page to last
2576
+ */
2577
+ setLastPage() {
2578
+ this.setPage(this.pagination.lastPage);
2579
+ }
2580
+ /**
2581
+ * Set current page to first
2582
+ */
2583
+ setFirstPage() {
2584
+ this.setPage(1);
2585
+ }
2586
+ /**
2587
+ * Check if page exists in cache
2588
+ */
2589
+ hasPage(page) {
2590
+ return this.pages.has(page);
2591
+ }
2592
+ /**
2593
+ * Get the current page if it's in cache, otherwise invoke the request
2594
+ */
2595
+ getPage(req) {
2596
+ let page = this.pagination.currentPage;
2597
+ if (this.hasPage(page)) {
2598
+ return this.selectPage(page);
2599
+ }
2600
+ else {
2601
+ this.setLoading(true);
2602
+ return from(req()).pipe(switchMap((config) => {
2603
+ page = config.currentPage;
2604
+ applyTransaction(() => {
2605
+ this.setLoading(false);
2606
+ this.update(config);
2607
+ });
2608
+ return this.selectPage(page);
2609
+ }));
2610
+ }
2611
+ }
2612
+ getQuery() {
2613
+ return this.query;
2614
+ }
2615
+ refreshCurrentPage() {
2616
+ if (isNil(this.currentPage) === false) {
2617
+ this.clearPage(this.currentPage);
2618
+ this.setPage(this.currentPage);
2619
+ }
2620
+ }
2621
+ getFrom() {
2622
+ if (this.isFirst) {
2623
+ return 1;
2624
+ }
2625
+ return (this.currentPage - 1) * this.pagination.perPage + 1;
2626
+ }
2627
+ getTo() {
2628
+ if (this.isLast) {
2629
+ return this.pagination.total;
2630
+ }
2631
+ return this.currentPage * this.pagination.perPage;
2632
+ }
2633
+ /**
2634
+ * Select the page
2635
+ */
2636
+ selectPage(page) {
2637
+ return this.query.selectAll({ asObject: true }).pipe(take(1), map(entities => {
2638
+ let response = Object.assign({}, this.pagination, { data: this.pages.get(page).ids.map(id => entities[id]) });
2639
+ const { range, pagesControls } = this.config;
2640
+ /** If no total - calc it */
2641
+ if (isNaN(this.pagination.total)) {
2642
+ if (response.lastPage === 1) {
2643
+ response.total = response.data ? response.data.length : 0;
2644
+ }
2645
+ else {
2646
+ response.total = response.perPage * response.lastPage;
2647
+ }
2648
+ this.pagination.total = response.total;
2649
+ }
2650
+ if (range) {
2651
+ response.from = this.getFrom();
2652
+ response.to = this.getTo();
2653
+ }
2654
+ if (pagesControls) {
2655
+ response.pageControls = generatePages(this.pagination.total, this.pagination.perPage);
2656
+ }
2657
+ return response;
2658
+ }));
2659
+ }
2660
+ }
2661
+ __decorate([
2662
+ action('@Pagination - New Page'),
2663
+ __metadata("design:type", Function),
2664
+ __metadata("design:paramtypes", [Object]),
2665
+ __metadata("design:returntype", void 0)
2666
+ ], PaginatorPlugin.prototype, "update", null);
2667
+ /**
2668
+ * Generate an array so we can ngFor them to navigate between pages
2669
+ */
2670
+ function generatePages(total, perPage) {
2671
+ const len = Math.ceil(total / perPage);
2672
+ let arr = [];
2673
+ for (let i = 0; i < len; i++) {
2674
+ arr.push(i + 1);
2675
+ }
2676
+ return arr;
2677
+ }
2678
+
2679
+ var StoreAction;
2680
+ (function (StoreAction) {
2681
+ StoreAction["Update"] = "UPDATE";
2682
+ })(StoreAction || (StoreAction = {}));
2683
+ var EntityStoreAction;
2684
+ (function (EntityStoreAction) {
2685
+ EntityStoreAction["Update"] = "UPDATE";
2686
+ EntityStoreAction["AddEntities"] = "ADD_ENTITIES";
2687
+ EntityStoreAction["SetEntities"] = "SET_ENTITIES";
2688
+ EntityStoreAction["UpdateEntities"] = "UPDATE_ENTITIES";
2689
+ EntityStoreAction["RemoveEntities"] = "REMOVE_ENTITIES";
2690
+ EntityStoreAction["UpsertEntities"] = "UPSERT_ENTITIES";
2691
+ EntityStoreAction["UpsertManyEntities"] = "UPSERT_MANY_ENTITIES";
2692
+ })(EntityStoreAction || (EntityStoreAction = {}));
2693
+
2694
+ exports.Query = Query;
2695
+ exports.SimpleInnerSubscriber = SimpleInnerSubscriber;
2696
+ exports.SimpleOuterSubscriber = SimpleOuterSubscriber;
2697
+ exports.Store = Store;
2698
+ exports.StoreConfig = StoreConfig;
2699
+ exports.distinctUntilChanged = distinctUntilChanged;
2700
+ exports.enableAkitaProdMode = enableAkitaProdMode;
2701
+ exports.filter = filter;
2702
+ exports.from = from;
2703
+ exports.innerSubscribe = innerSubscribe;
2704
+ exports.map = map;