@progressive-development/pd-spa-helper 0.3.104 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (278) hide show
  1. package/dist/PdSpaHelper.d.ts +86 -0
  2. package/dist/PdSpaHelper.d.ts.map +1 -0
  3. package/dist/{src/PdSpaHelper.js → PdSpaHelper.js} +16 -17
  4. package/dist/defaultpage/default-confirm-popup.d.ts +19 -0
  5. package/dist/defaultpage/default-confirm-popup.d.ts.map +1 -0
  6. package/dist/{src/defaultpage → defaultpage}/default-confirm-popup.js +4 -5
  7. package/dist/defaultpage/default-dialog-popup.d.ts +15 -0
  8. package/dist/defaultpage/default-dialog-popup.d.ts.map +1 -0
  9. package/dist/{src/defaultpage → defaultpage}/default-dialog-popup.js +4 -5
  10. package/dist/defaultpage/default-login.d.ts +8 -0
  11. package/dist/defaultpage/default-login.d.ts.map +1 -0
  12. package/dist/{src/defaultpage → defaultpage}/default-login.js +2 -3
  13. package/dist/defaultpage/default-popup.d.ts +7 -0
  14. package/dist/defaultpage/default-popup.d.ts.map +1 -0
  15. package/dist/{src/defaultpage → defaultpage}/default-popup.js +1 -1
  16. package/dist/defaultpage/default-step-address.d.ts +19 -0
  17. package/dist/defaultpage/default-step-address.d.ts.map +1 -0
  18. package/dist/{src/defaultpage → defaultpage}/default-step-address.js +5 -6
  19. package/dist/defaultpage/default-step-summary.d.ts +30 -0
  20. package/dist/defaultpage/default-step-summary.d.ts.map +1 -0
  21. package/dist/{src/defaultpage → defaultpage}/default-step-summary.js +6 -7
  22. package/dist/defaultpage/default-view-page.d.ts +10 -0
  23. package/dist/defaultpage/default-view-page.d.ts.map +1 -0
  24. package/dist/{src/defaultpage → defaultpage}/default-view-page.js +2 -3
  25. package/dist/defaultpage/default-wizard-step.d.ts +35 -0
  26. package/dist/defaultpage/default-wizard-step.d.ts.map +1 -0
  27. package/dist/{src/defaultpage → defaultpage}/default-wizard-step.js +4 -5
  28. package/dist/defaultpage/default-wizard.d.ts +32 -0
  29. package/dist/defaultpage/default-wizard.d.ts.map +1 -0
  30. package/dist/{src/defaultpage → defaultpage}/default-wizard.js +7 -8
  31. package/dist/generated/locale-codes.d.ts +14 -0
  32. package/dist/generated/locale-codes.d.ts.map +1 -0
  33. package/dist/generated/locale-wrapper/be-wrapper.d.ts +16 -0
  34. package/dist/generated/locale-wrapper/be-wrapper.d.ts.map +1 -0
  35. package/dist/generated/locale-wrapper/be-wrapper.js +17 -0
  36. package/dist/generated/locale-wrapper/de-wrapper.d.ts +16 -0
  37. package/dist/generated/locale-wrapper/de-wrapper.d.ts.map +1 -0
  38. package/dist/generated/locale-wrapper/de-wrapper.js +17 -0
  39. package/dist/generated/locale-wrapper/en-wrapper.d.ts +16 -0
  40. package/dist/generated/locale-wrapper/en-wrapper.d.ts.map +1 -0
  41. package/dist/generated/locale-wrapper/en-wrapper.js +17 -0
  42. package/dist/generated/locales/be.d.ts +16 -0
  43. package/dist/generated/locales/be.d.ts.map +1 -0
  44. package/dist/generated/locales/de.d.ts +16 -0
  45. package/dist/generated/locales/de.d.ts.map +1 -0
  46. package/dist/generated/locales/en.d.ts +16 -0
  47. package/dist/generated/locales/en.d.ts.map +1 -0
  48. package/dist/helper/helper-utils.d.ts +6 -0
  49. package/dist/helper/helper-utils.d.ts.map +1 -0
  50. package/dist/index.d.ts +23 -0
  51. package/dist/index.d.ts.map +1 -0
  52. package/dist/index.js +21 -21
  53. package/dist/model/spa-model.d.ts +17 -0
  54. package/dist/model/spa-model.d.ts.map +1 -0
  55. package/dist/pd-panel-viewer.d.ts +2 -0
  56. package/dist/pd-panel-viewer.js +10 -12
  57. package/dist/pd-panel.d.ts +2 -0
  58. package/dist/pd-panel.js +2 -3
  59. package/dist/pd-spa-helper.d.ts +1 -0
  60. package/dist/pd-spa-helper.d.ts.map +1 -0
  61. package/dist/popup/wizard-close-popup.d.ts +11 -0
  62. package/dist/popup/wizard-close-popup.d.ts.map +1 -0
  63. package/dist/{src/popup → popup}/wizard-close-popup.js +3 -5
  64. package/dist/popup/wizard-reload-popup.d.ts +14 -0
  65. package/dist/popup/wizard-reload-popup.d.ts.map +1 -0
  66. package/dist/{src/popup → popup}/wizard-reload-popup.js +3 -5
  67. package/dist/router/AppMain.d.ts +7 -0
  68. package/dist/router/AppMain.d.ts.map +1 -0
  69. package/dist/{src/router → router}/AppMain.js +4 -5
  70. package/dist/service-call-controller2.d.ts +17 -0
  71. package/dist/service-call-controller2.d.ts.map +1 -0
  72. package/dist/service-provider/firebase/auth.d.ts +15 -0
  73. package/dist/service-provider/firebase/auth.d.ts.map +1 -0
  74. package/dist/{src/service-provider → service-provider}/firebase/auth.js +1 -3
  75. package/dist/service-provider/firebase/firestorage-client.d.ts +21 -0
  76. package/dist/service-provider/firebase/firestorage-client.d.ts.map +1 -0
  77. package/dist/{src/service-provider → service-provider}/firebase/firestorage-client.js +1 -1
  78. package/dist/service-provider/firebase/firestore-client.d.ts +12 -0
  79. package/dist/service-provider/firebase/firestore-client.d.ts.map +1 -0
  80. package/dist/{src/service-provider → service-provider}/firebase/firestore-client.js +1 -1
  81. package/dist/service-provider/firebase/functions-client.d.ts +10 -0
  82. package/dist/service-provider/firebase/functions-client.d.ts.map +1 -0
  83. package/dist/{src/service-provider → service-provider}/firebase/functions-client.js +1 -1
  84. package/dist/service-provider/firebase/messagingFirebaseClient.d.ts +9 -0
  85. package/dist/service-provider/firebase/messagingFirebaseClient.d.ts.map +1 -0
  86. package/dist/{src/service-provider → service-provider}/firebase/messagingFirebaseClient.js +2 -2
  87. package/dist/service-provider/mock/auth.d.ts +6 -0
  88. package/dist/service-provider/mock/auth.d.ts.map +1 -0
  89. package/dist/service-provider/mock/function-client.d.ts +9 -0
  90. package/dist/service-provider/mock/function-client.d.ts.map +1 -0
  91. package/dist/service-provider/mock/storage-client.d.ts +11 -0
  92. package/dist/service-provider/mock/storage-client.d.ts.map +1 -0
  93. package/dist/service-provider/service-provider-impl.d.ts +22 -0
  94. package/dist/service-provider/service-provider-impl.d.ts.map +1 -0
  95. package/dist/{src/service-provider → service-provider}/service-provider-impl.js +1 -2
  96. package/dist/service-provider/service-provider-model.d.ts +137 -0
  97. package/dist/service-provider/service-provider-model.d.ts.map +1 -0
  98. package/dist/store/indexDB.d.ts +28 -0
  99. package/dist/store/indexDB.d.ts.map +1 -0
  100. package/dist/store/mini-rx.store.d.ts +5 -0
  101. package/dist/store/mini-rx.store.d.ts.map +1 -0
  102. package/dist/{src/store → store}/mini-rx.store.js +1 -1
  103. package/dist/store/spa-app-actions.d.ts +105 -0
  104. package/dist/store/spa-app-actions.d.ts.map +1 -0
  105. package/dist/store/spa-app-effects.d.ts +24 -0
  106. package/dist/store/spa-app-effects.d.ts.map +1 -0
  107. package/dist/{src/store → store}/spa-app-effects.js +2 -2
  108. package/dist/store/spa-app-reducer.d.ts +10 -0
  109. package/dist/store/spa-app-reducer.d.ts.map +1 -0
  110. package/dist/store/spa-app-selector.d.ts +7 -0
  111. package/dist/store/spa-app-selector.d.ts.map +1 -0
  112. package/dist/{src/store → store}/spa-app-selector.js +1 -1
  113. package/dist/stories/pd-loading-state.stories.d.ts +30 -0
  114. package/dist/stories/pd-loading-state.stories.d.ts.map +1 -0
  115. package/dist/stories/pd-toast.stories.d.ts +23 -0
  116. package/dist/stories/pd-toast.stories.d.ts.map +1 -0
  117. package/dist/tmpown/pd-loading-state.d.ts +9 -0
  118. package/dist/tmpown/pd-loading-state.d.ts.map +1 -0
  119. package/dist/{src/tmpown → tmpown}/pd-loading-state.js +6 -8
  120. package/dist/tmpown/pd-login.d.ts +11 -0
  121. package/dist/tmpown/pd-login.d.ts.map +1 -0
  122. package/dist/{src/tmpown → tmpown}/pd-login.js +6 -7
  123. package/dist/tmpown/pd-panel-viewer.d.ts +17 -0
  124. package/dist/tmpown/pd-panel-viewer.d.ts.map +1 -0
  125. package/dist/tmpown/pd-panel.d.ts +6 -0
  126. package/dist/tmpown/pd-panel.d.ts.map +1 -0
  127. package/dist/tmpown/pd-toast.d.ts +13 -0
  128. package/dist/tmpown/pd-toast.d.ts.map +1 -0
  129. package/dist/{src/tmpown → tmpown}/pd-toast.js +5 -7
  130. package/package.json +25 -20
  131. package/dist/node_modules/@firebase/app/dist/esm/index.esm2017.js +0 -749
  132. package/dist/node_modules/@firebase/auth/dist/esm2017/index-68602d24.js +0 -6265
  133. package/dist/node_modules/@firebase/component/dist/esm/index.esm2017.js +0 -341
  134. package/dist/node_modules/@firebase/firestore/dist/index.esm2017.js +0 -10250
  135. package/dist/node_modules/@firebase/functions/dist/index.esm2017.js +0 -513
  136. package/dist/node_modules/@firebase/installations/dist/esm/index.esm2017.js +0 -863
  137. package/dist/node_modules/@firebase/logger/dist/esm/index.esm2017.js +0 -122
  138. package/dist/node_modules/@firebase/messaging/dist/esm/index.esm2017.js +0 -1019
  139. package/dist/node_modules/@firebase/storage/dist/index.esm2017.js +0 -2042
  140. package/dist/node_modules/@firebase/util/dist/index.esm2017.js +0 -931
  141. package/dist/node_modules/@firebase/webchannel-wrapper/dist/bloom-blob/esm/bloom_blob_es2018.js +0 -417
  142. package/dist/node_modules/@firebase/webchannel-wrapper/dist/webchannel-blob/esm/webchannel_blob_es2018.js +0 -2155
  143. package/dist/node_modules/@lit/reactive-element/decorators/custom-element.js +0 -14
  144. package/dist/node_modules/@lit/reactive-element/decorators/property.js +0 -20
  145. package/dist/node_modules/@lit/reactive-element/decorators/query-assigned-elements.js +0 -7
  146. package/dist/node_modules/@progressive-development/pd-dialog/pd-popup-dialog.js +0 -5
  147. package/dist/node_modules/@progressive-development/pd-dialog/pd-popup.js +0 -2
  148. package/dist/node_modules/@progressive-development/pd-dialog/src/PdPopup.js +0 -113
  149. package/dist/node_modules/@progressive-development/pd-dialog/src/PdPopupDialog.js +0 -189
  150. package/dist/node_modules/@progressive-development/pd-forms/pd-button.js +0 -2
  151. package/dist/node_modules/@progressive-development/pd-forms/pd-form-container.js +0 -2
  152. package/dist/node_modules/@progressive-development/pd-forms/pd-form-row.js +0 -2
  153. package/dist/node_modules/@progressive-development/pd-forms/pd-hover-box.js +0 -2
  154. package/dist/node_modules/@progressive-development/pd-forms/pd-input.js +0 -2
  155. package/dist/node_modules/@progressive-development/pd-forms/src/PdBaseInputElement.js +0 -86
  156. package/dist/node_modules/@progressive-development/pd-forms/src/PdBaseUi.js +0 -34
  157. package/dist/node_modules/@progressive-development/pd-forms/src/PdBaseUiInput.js +0 -227
  158. package/dist/node_modules/@progressive-development/pd-forms/src/PdButton.js +0 -194
  159. package/dist/node_modules/@progressive-development/pd-forms/src/PdFormContainer.js +0 -167
  160. package/dist/node_modules/@progressive-development/pd-forms/src/PdFormRow.js +0 -92
  161. package/dist/node_modules/@progressive-development/pd-forms/src/PdHoverBox.js +0 -108
  162. package/dist/node_modules/@progressive-development/pd-forms/src/PdInput.js +0 -79
  163. package/dist/node_modules/@progressive-development/pd-forms/src/generated/locale/be.js +0 -11
  164. package/dist/node_modules/@progressive-development/pd-forms/src/generated/locale/en.js +0 -11
  165. package/dist/node_modules/@progressive-development/pd-forms/src/shared-input-field-styles.js +0 -152
  166. package/dist/node_modules/@progressive-development/pd-forms/src/shared-input-styles.js +0 -64
  167. package/dist/node_modules/@progressive-development/pd-icon/pd-icon.js +0 -4
  168. package/dist/node_modules/@progressive-development/pd-icon/src/PdIcon.js +0 -596
  169. package/dist/node_modules/@progressive-development/pd-order/dist/locales/be.js +0 -15
  170. package/dist/node_modules/@progressive-development/pd-order/dist/locales/de.js +0 -15
  171. package/dist/node_modules/@progressive-development/pd-order/dist/locales/en.js +0 -15
  172. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-contact/pd-contact.js +0 -2
  173. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-contact/src/PdContact.js +0 -567
  174. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-content/pd-collapse.js +0 -2
  175. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-content/pd-edit-content.js +0 -2
  176. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-content/src/PdCollapse.js +0 -136
  177. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-content/src/PdEditContent.js +0 -224
  178. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-dialog/pd-popup.js +0 -2
  179. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-dialog/src/PdPopup.js +0 -113
  180. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/pd-checkbox.js +0 -2
  181. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/pd-form-container.js +0 -2
  182. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/pd-form-row.js +0 -2
  183. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/pd-hover-box.js +0 -2
  184. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/pd-input.js +0 -2
  185. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/pd-radio-group.js +0 -2
  186. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdBaseInputElement.js +0 -86
  187. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdBaseUi.js +0 -34
  188. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdBaseUiInput.js +0 -229
  189. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdCheckbox.js +0 -230
  190. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdFormContainer.js +0 -167
  191. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdFormRow.js +0 -92
  192. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdHoverBox.js +0 -108
  193. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdInput.js +0 -79
  194. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdRadioGroup.js +0 -72
  195. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/shared-input-field-styles.js +0 -152
  196. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/shared-input-styles.js +0 -64
  197. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-icon/pd-icon.js +0 -4
  198. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-icon/src/PdIcon.js +0 -596
  199. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-price/pd-pricetable.js +0 -2
  200. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-price/src/PdPricetable.js +0 -149
  201. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/fecha/lib/fecha.js +0 -200
  202. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/lit/node_modules/lit-html/directive.js +0 -27
  203. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/lit/node_modules/lit-html/directives/class-map.js +0 -36
  204. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/lit/node_modules/lit-html/lit-html.js +0 -242
  205. package/dist/node_modules/@progressive-development/pd-order/dist/pd-order-contacts.js +0 -2
  206. package/dist/node_modules/@progressive-development/pd-order/dist/pd-order-summary.js +0 -2
  207. package/dist/node_modules/@progressive-development/pd-order/dist/src/PdOrderContacts.js +0 -192
  208. package/dist/node_modules/@progressive-development/pd-order/dist/src/PdOrderSummary.js +0 -243
  209. package/dist/node_modules/@progressive-development/pd-page/pd-footer.js +0 -2
  210. package/dist/node_modules/@progressive-development/pd-page/pd-menu.js +0 -2
  211. package/dist/node_modules/@progressive-development/pd-page/src/PdFooter.js +0 -141
  212. package/dist/node_modules/@progressive-development/pd-page/src/PdMenu.js +0 -450
  213. package/dist/node_modules/@progressive-development/pd-shared-styles/src/shared-color-styles.js +0 -30
  214. package/dist/node_modules/@progressive-development/pd-shared-styles/src/shared-font-styles.js +0 -32
  215. package/dist/node_modules/@progressive-development/pd-wizard/pd-wizard.js +0 -2
  216. package/dist/node_modules/@progressive-development/pd-wizard/src/PdSteps.js +0 -191
  217. package/dist/node_modules/@progressive-development/pd-wizard/src/PdWizard.js +0 -280
  218. package/dist/node_modules/firebase/app/dist/esm/index.esm.js +0 -35
  219. package/dist/node_modules/idb/build/index.js +0 -81
  220. package/dist/node_modules/idb/build/wrap-idb-value.js +0 -148
  221. package/dist/node_modules/lit/node_modules/lit-html/directive.js +0 -27
  222. package/dist/node_modules/lit/node_modules/lit-html/directives/class-map.js +0 -36
  223. package/dist/node_modules/lit/node_modules/lit-html/lit-html.js +0 -242
  224. package/dist/node_modules/lit-element-router/lit-element-router.js +0 -131
  225. package/dist/node_modules/lit-element-router/utility/router-utility.js +0 -36
  226. package/dist/node_modules/mini-rx-store/index.esm.js +0 -458
  227. package/dist/node_modules/pwa-helpers/media-query.js +0 -17
  228. package/dist/node_modules/rxjs/dist/esm5/internal/Observable.js +0 -100
  229. package/dist/node_modules/rxjs/dist/esm5/internal/Subscriber.js +0 -147
  230. package/dist/node_modules/rxjs/dist/esm5/internal/Subscription.js +0 -139
  231. package/dist/node_modules/rxjs/dist/esm5/internal/config.js +0 -10
  232. package/dist/node_modules/rxjs/dist/esm5/internal/observable/innerFrom.js +0 -159
  233. package/dist/node_modules/rxjs/dist/esm5/internal/operators/OperatorSubscriber.js +0 -52
  234. package/dist/node_modules/rxjs/dist/esm5/internal/operators/catchError.js +0 -28
  235. package/dist/node_modules/rxjs/dist/esm5/internal/operators/distinctUntilChanged.js +0 -27
  236. package/dist/node_modules/rxjs/dist/esm5/internal/operators/filter.js +0 -13
  237. package/dist/node_modules/rxjs/dist/esm5/internal/operators/map.js +0 -13
  238. package/dist/node_modules/rxjs/dist/esm5/internal/operators/observeOn.js +0 -26
  239. package/dist/node_modules/rxjs/dist/esm5/internal/operators/tap.js +0 -36
  240. package/dist/node_modules/rxjs/dist/esm5/internal/operators/withLatestFrom.js +0 -43
  241. package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js +0 -18
  242. package/dist/node_modules/rxjs/dist/esm5/internal/symbol/iterator.js +0 -11
  243. package/dist/node_modules/rxjs/dist/esm5/internal/symbol/observable.js +0 -6
  244. package/dist/node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js +0 -14
  245. package/dist/node_modules/rxjs/dist/esm5/internal/util/args.js +0 -10
  246. package/dist/node_modules/rxjs/dist/esm5/internal/util/arrRemove.js +0 -9
  247. package/dist/node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js +0 -13
  248. package/dist/node_modules/rxjs/dist/esm5/internal/util/errorContext.js +0 -8
  249. package/dist/node_modules/rxjs/dist/esm5/internal/util/executeSchedule.js +0 -23
  250. package/dist/node_modules/rxjs/dist/esm5/internal/util/identity.js +0 -6
  251. package/dist/node_modules/rxjs/dist/esm5/internal/util/isArrayLike.js +0 -6
  252. package/dist/node_modules/rxjs/dist/esm5/internal/util/isAsyncIterable.js +0 -7
  253. package/dist/node_modules/rxjs/dist/esm5/internal/util/isFunction.js +0 -6
  254. package/dist/node_modules/rxjs/dist/esm5/internal/util/isInteropObservable.js +0 -8
  255. package/dist/node_modules/rxjs/dist/esm5/internal/util/isIterable.js +0 -8
  256. package/dist/node_modules/rxjs/dist/esm5/internal/util/isPromise.js +0 -7
  257. package/dist/node_modules/rxjs/dist/esm5/internal/util/isReadableStreamLike.js +0 -46
  258. package/dist/node_modules/rxjs/dist/esm5/internal/util/lift.js +0 -22
  259. package/dist/node_modules/rxjs/dist/esm5/internal/util/noop.js +0 -5
  260. package/dist/node_modules/rxjs/dist/esm5/internal/util/pipe.js +0 -17
  261. package/dist/node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js +0 -11
  262. package/dist/node_modules/rxjs/dist/esm5/internal/util/throwUnobservableError.js +0 -6
  263. package/dist/node_modules/tslib/tslib.es6.js +0 -240
  264. package/dist/src/generated/locale-wrapper/be-wrapper.js +0 -15
  265. package/dist/src/generated/locale-wrapper/de-wrapper.js +0 -13
  266. package/dist/src/generated/locale-wrapper/en-wrapper.js +0 -15
  267. /package/dist/{src/generated → generated}/locales/be.js +0 -0
  268. /package/dist/{src/generated → generated}/locales/de.js +0 -0
  269. /package/dist/{src/generated → generated}/locales/en.js +0 -0
  270. /package/dist/{src/helper → helper}/helper-utils.js +0 -0
  271. /package/dist/{src/model → model}/spa-model.js +0 -0
  272. /package/dist/{src/service-provider → service-provider}/mock/auth.js +0 -0
  273. /package/dist/{src/service-provider → service-provider}/mock/function-client.js +0 -0
  274. /package/dist/{src/service-provider → service-provider}/mock/storage-client.js +0 -0
  275. /package/dist/{src/service-provider → service-provider}/service-provider-model.js +0 -0
  276. /package/dist/{src/store → store}/indexDB.js +0 -0
  277. /package/dist/{src/store → store}/spa-app-actions.js +0 -0
  278. /package/dist/{src/store → store}/spa-app-reducer.js +0 -0
@@ -1,863 +0,0 @@
1
- import { registerVersion, _registerComponent, _getProvider } from "../../../app/dist/esm/index.esm2017.js";
2
- import { Component } from "../../../component/dist/esm/index.esm2017.js";
3
- import { ErrorFactory, FirebaseError } from "../../../util/dist/index.esm2017.js";
4
- import { openDB } from "../../../../idb/build/index.js";
5
- const name = "@firebase/installations";
6
- const version = "0.6.9";
7
- /**
8
- * @license
9
- * Copyright 2019 Google LLC
10
- *
11
- * Licensed under the Apache License, Version 2.0 (the "License");
12
- * you may not use this file except in compliance with the License.
13
- * You may obtain a copy of the License at
14
- *
15
- * http://www.apache.org/licenses/LICENSE-2.0
16
- *
17
- * Unless required by applicable law or agreed to in writing, software
18
- * distributed under the License is distributed on an "AS IS" BASIS,
19
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
- * See the License for the specific language governing permissions and
21
- * limitations under the License.
22
- */
23
- const PENDING_TIMEOUT_MS = 1e4;
24
- const PACKAGE_VERSION = `w:${version}`;
25
- const INTERNAL_AUTH_VERSION = "FIS_v2";
26
- const INSTALLATIONS_API_URL = "https://firebaseinstallations.googleapis.com/v1";
27
- const TOKEN_EXPIRATION_BUFFER = 60 * 60 * 1e3;
28
- const SERVICE = "installations";
29
- const SERVICE_NAME = "Installations";
30
- /**
31
- * @license
32
- * Copyright 2019 Google LLC
33
- *
34
- * Licensed under the Apache License, Version 2.0 (the "License");
35
- * you may not use this file except in compliance with the License.
36
- * You may obtain a copy of the License at
37
- *
38
- * http://www.apache.org/licenses/LICENSE-2.0
39
- *
40
- * Unless required by applicable law or agreed to in writing, software
41
- * distributed under the License is distributed on an "AS IS" BASIS,
42
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
43
- * See the License for the specific language governing permissions and
44
- * limitations under the License.
45
- */
46
- const ERROR_DESCRIPTION_MAP = {
47
- [
48
- "missing-app-config-values"
49
- /* ErrorCode.MISSING_APP_CONFIG_VALUES */
50
- ]: 'Missing App configuration value: "{$valueName}"',
51
- [
52
- "not-registered"
53
- /* ErrorCode.NOT_REGISTERED */
54
- ]: "Firebase Installation is not registered.",
55
- [
56
- "installation-not-found"
57
- /* ErrorCode.INSTALLATION_NOT_FOUND */
58
- ]: "Firebase Installation not found.",
59
- [
60
- "request-failed"
61
- /* ErrorCode.REQUEST_FAILED */
62
- ]: '{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',
63
- [
64
- "app-offline"
65
- /* ErrorCode.APP_OFFLINE */
66
- ]: "Could not process request. Application offline.",
67
- [
68
- "delete-pending-registration"
69
- /* ErrorCode.DELETE_PENDING_REGISTRATION */
70
- ]: "Can't delete installation while there is a pending registration request."
71
- };
72
- const ERROR_FACTORY = new ErrorFactory(SERVICE, SERVICE_NAME, ERROR_DESCRIPTION_MAP);
73
- function isServerError(error) {
74
- return error instanceof FirebaseError && error.code.includes(
75
- "request-failed"
76
- /* ErrorCode.REQUEST_FAILED */
77
- );
78
- }
79
- /**
80
- * @license
81
- * Copyright 2019 Google LLC
82
- *
83
- * Licensed under the Apache License, Version 2.0 (the "License");
84
- * you may not use this file except in compliance with the License.
85
- * You may obtain a copy of the License at
86
- *
87
- * http://www.apache.org/licenses/LICENSE-2.0
88
- *
89
- * Unless required by applicable law or agreed to in writing, software
90
- * distributed under the License is distributed on an "AS IS" BASIS,
91
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
92
- * See the License for the specific language governing permissions and
93
- * limitations under the License.
94
- */
95
- function getInstallationsEndpoint({ projectId }) {
96
- return `${INSTALLATIONS_API_URL}/projects/${projectId}/installations`;
97
- }
98
- function extractAuthTokenInfoFromResponse(response) {
99
- return {
100
- token: response.token,
101
- requestStatus: 2,
102
- expiresIn: getExpiresInFromResponseExpiresIn(response.expiresIn),
103
- creationTime: Date.now()
104
- };
105
- }
106
- async function getErrorFromResponse(requestName, response) {
107
- const responseJson = await response.json();
108
- const errorData = responseJson.error;
109
- return ERROR_FACTORY.create("request-failed", {
110
- requestName,
111
- serverCode: errorData.code,
112
- serverMessage: errorData.message,
113
- serverStatus: errorData.status
114
- });
115
- }
116
- function getHeaders({ apiKey }) {
117
- return new Headers({
118
- "Content-Type": "application/json",
119
- Accept: "application/json",
120
- "x-goog-api-key": apiKey
121
- });
122
- }
123
- function getHeadersWithAuth(appConfig, { refreshToken }) {
124
- const headers = getHeaders(appConfig);
125
- headers.append("Authorization", getAuthorizationHeader(refreshToken));
126
- return headers;
127
- }
128
- async function retryIfServerError(fn) {
129
- const result = await fn();
130
- if (result.status >= 500 && result.status < 600) {
131
- return fn();
132
- }
133
- return result;
134
- }
135
- function getExpiresInFromResponseExpiresIn(responseExpiresIn) {
136
- return Number(responseExpiresIn.replace("s", "000"));
137
- }
138
- function getAuthorizationHeader(refreshToken) {
139
- return `${INTERNAL_AUTH_VERSION} ${refreshToken}`;
140
- }
141
- /**
142
- * @license
143
- * Copyright 2019 Google LLC
144
- *
145
- * Licensed under the Apache License, Version 2.0 (the "License");
146
- * you may not use this file except in compliance with the License.
147
- * You may obtain a copy of the License at
148
- *
149
- * http://www.apache.org/licenses/LICENSE-2.0
150
- *
151
- * Unless required by applicable law or agreed to in writing, software
152
- * distributed under the License is distributed on an "AS IS" BASIS,
153
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
154
- * See the License for the specific language governing permissions and
155
- * limitations under the License.
156
- */
157
- async function createInstallationRequest({ appConfig, heartbeatServiceProvider }, { fid }) {
158
- const endpoint = getInstallationsEndpoint(appConfig);
159
- const headers = getHeaders(appConfig);
160
- const heartbeatService = heartbeatServiceProvider.getImmediate({
161
- optional: true
162
- });
163
- if (heartbeatService) {
164
- const heartbeatsHeader = await heartbeatService.getHeartbeatsHeader();
165
- if (heartbeatsHeader) {
166
- headers.append("x-firebase-client", heartbeatsHeader);
167
- }
168
- }
169
- const body = {
170
- fid,
171
- authVersion: INTERNAL_AUTH_VERSION,
172
- appId: appConfig.appId,
173
- sdkVersion: PACKAGE_VERSION
174
- };
175
- const request = {
176
- method: "POST",
177
- headers,
178
- body: JSON.stringify(body)
179
- };
180
- const response = await retryIfServerError(() => fetch(endpoint, request));
181
- if (response.ok) {
182
- const responseValue = await response.json();
183
- const registeredInstallationEntry = {
184
- fid: responseValue.fid || fid,
185
- registrationStatus: 2,
186
- refreshToken: responseValue.refreshToken,
187
- authToken: extractAuthTokenInfoFromResponse(responseValue.authToken)
188
- };
189
- return registeredInstallationEntry;
190
- } else {
191
- throw await getErrorFromResponse("Create Installation", response);
192
- }
193
- }
194
- /**
195
- * @license
196
- * Copyright 2019 Google LLC
197
- *
198
- * Licensed under the Apache License, Version 2.0 (the "License");
199
- * you may not use this file except in compliance with the License.
200
- * You may obtain a copy of the License at
201
- *
202
- * http://www.apache.org/licenses/LICENSE-2.0
203
- *
204
- * Unless required by applicable law or agreed to in writing, software
205
- * distributed under the License is distributed on an "AS IS" BASIS,
206
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
207
- * See the License for the specific language governing permissions and
208
- * limitations under the License.
209
- */
210
- function sleep(ms) {
211
- return new Promise((resolve) => {
212
- setTimeout(resolve, ms);
213
- });
214
- }
215
- /**
216
- * @license
217
- * Copyright 2019 Google LLC
218
- *
219
- * Licensed under the Apache License, Version 2.0 (the "License");
220
- * you may not use this file except in compliance with the License.
221
- * You may obtain a copy of the License at
222
- *
223
- * http://www.apache.org/licenses/LICENSE-2.0
224
- *
225
- * Unless required by applicable law or agreed to in writing, software
226
- * distributed under the License is distributed on an "AS IS" BASIS,
227
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
228
- * See the License for the specific language governing permissions and
229
- * limitations under the License.
230
- */
231
- function bufferToBase64UrlSafe(array) {
232
- const b64 = btoa(String.fromCharCode(...array));
233
- return b64.replace(/\+/g, "-").replace(/\//g, "_");
234
- }
235
- /**
236
- * @license
237
- * Copyright 2019 Google LLC
238
- *
239
- * Licensed under the Apache License, Version 2.0 (the "License");
240
- * you may not use this file except in compliance with the License.
241
- * You may obtain a copy of the License at
242
- *
243
- * http://www.apache.org/licenses/LICENSE-2.0
244
- *
245
- * Unless required by applicable law or agreed to in writing, software
246
- * distributed under the License is distributed on an "AS IS" BASIS,
247
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
248
- * See the License for the specific language governing permissions and
249
- * limitations under the License.
250
- */
251
- const VALID_FID_PATTERN = /^[cdef][\w-]{21}$/;
252
- const INVALID_FID = "";
253
- function generateFid() {
254
- try {
255
- const fidByteArray = new Uint8Array(17);
256
- const crypto = self.crypto || self.msCrypto;
257
- crypto.getRandomValues(fidByteArray);
258
- fidByteArray[0] = 112 + fidByteArray[0] % 16;
259
- const fid = encode(fidByteArray);
260
- return VALID_FID_PATTERN.test(fid) ? fid : INVALID_FID;
261
- } catch (_a) {
262
- return INVALID_FID;
263
- }
264
- }
265
- function encode(fidByteArray) {
266
- const b64String = bufferToBase64UrlSafe(fidByteArray);
267
- return b64String.substr(0, 22);
268
- }
269
- /**
270
- * @license
271
- * Copyright 2019 Google LLC
272
- *
273
- * Licensed under the Apache License, Version 2.0 (the "License");
274
- * you may not use this file except in compliance with the License.
275
- * You may obtain a copy of the License at
276
- *
277
- * http://www.apache.org/licenses/LICENSE-2.0
278
- *
279
- * Unless required by applicable law or agreed to in writing, software
280
- * distributed under the License is distributed on an "AS IS" BASIS,
281
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
282
- * See the License for the specific language governing permissions and
283
- * limitations under the License.
284
- */
285
- function getKey(appConfig) {
286
- return `${appConfig.appName}!${appConfig.appId}`;
287
- }
288
- /**
289
- * @license
290
- * Copyright 2019 Google LLC
291
- *
292
- * Licensed under the Apache License, Version 2.0 (the "License");
293
- * you may not use this file except in compliance with the License.
294
- * You may obtain a copy of the License at
295
- *
296
- * http://www.apache.org/licenses/LICENSE-2.0
297
- *
298
- * Unless required by applicable law or agreed to in writing, software
299
- * distributed under the License is distributed on an "AS IS" BASIS,
300
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
301
- * See the License for the specific language governing permissions and
302
- * limitations under the License.
303
- */
304
- const fidChangeCallbacks = /* @__PURE__ */ new Map();
305
- function fidChanged(appConfig, fid) {
306
- const key = getKey(appConfig);
307
- callFidChangeCallbacks(key, fid);
308
- broadcastFidChange(key, fid);
309
- }
310
- function callFidChangeCallbacks(key, fid) {
311
- const callbacks = fidChangeCallbacks.get(key);
312
- if (!callbacks) {
313
- return;
314
- }
315
- for (const callback of callbacks) {
316
- callback(fid);
317
- }
318
- }
319
- function broadcastFidChange(key, fid) {
320
- const channel = getBroadcastChannel();
321
- if (channel) {
322
- channel.postMessage({ key, fid });
323
- }
324
- closeBroadcastChannel();
325
- }
326
- let broadcastChannel = null;
327
- function getBroadcastChannel() {
328
- if (!broadcastChannel && "BroadcastChannel" in self) {
329
- broadcastChannel = new BroadcastChannel("[Firebase] FID Change");
330
- broadcastChannel.onmessage = (e) => {
331
- callFidChangeCallbacks(e.data.key, e.data.fid);
332
- };
333
- }
334
- return broadcastChannel;
335
- }
336
- function closeBroadcastChannel() {
337
- if (fidChangeCallbacks.size === 0 && broadcastChannel) {
338
- broadcastChannel.close();
339
- broadcastChannel = null;
340
- }
341
- }
342
- /**
343
- * @license
344
- * Copyright 2019 Google LLC
345
- *
346
- * Licensed under the Apache License, Version 2.0 (the "License");
347
- * you may not use this file except in compliance with the License.
348
- * You may obtain a copy of the License at
349
- *
350
- * http://www.apache.org/licenses/LICENSE-2.0
351
- *
352
- * Unless required by applicable law or agreed to in writing, software
353
- * distributed under the License is distributed on an "AS IS" BASIS,
354
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
355
- * See the License for the specific language governing permissions and
356
- * limitations under the License.
357
- */
358
- const DATABASE_NAME = "firebase-installations-database";
359
- const DATABASE_VERSION = 1;
360
- const OBJECT_STORE_NAME = "firebase-installations-store";
361
- let dbPromise = null;
362
- function getDbPromise() {
363
- if (!dbPromise) {
364
- dbPromise = openDB(DATABASE_NAME, DATABASE_VERSION, {
365
- upgrade: (db, oldVersion) => {
366
- switch (oldVersion) {
367
- case 0:
368
- db.createObjectStore(OBJECT_STORE_NAME);
369
- }
370
- }
371
- });
372
- }
373
- return dbPromise;
374
- }
375
- async function set(appConfig, value) {
376
- const key = getKey(appConfig);
377
- const db = await getDbPromise();
378
- const tx = db.transaction(OBJECT_STORE_NAME, "readwrite");
379
- const objectStore = tx.objectStore(OBJECT_STORE_NAME);
380
- const oldValue = await objectStore.get(key);
381
- await objectStore.put(value, key);
382
- await tx.done;
383
- if (!oldValue || oldValue.fid !== value.fid) {
384
- fidChanged(appConfig, value.fid);
385
- }
386
- return value;
387
- }
388
- async function remove(appConfig) {
389
- const key = getKey(appConfig);
390
- const db = await getDbPromise();
391
- const tx = db.transaction(OBJECT_STORE_NAME, "readwrite");
392
- await tx.objectStore(OBJECT_STORE_NAME).delete(key);
393
- await tx.done;
394
- }
395
- async function update(appConfig, updateFn) {
396
- const key = getKey(appConfig);
397
- const db = await getDbPromise();
398
- const tx = db.transaction(OBJECT_STORE_NAME, "readwrite");
399
- const store = tx.objectStore(OBJECT_STORE_NAME);
400
- const oldValue = await store.get(key);
401
- const newValue = updateFn(oldValue);
402
- if (newValue === void 0) {
403
- await store.delete(key);
404
- } else {
405
- await store.put(newValue, key);
406
- }
407
- await tx.done;
408
- if (newValue && (!oldValue || oldValue.fid !== newValue.fid)) {
409
- fidChanged(appConfig, newValue.fid);
410
- }
411
- return newValue;
412
- }
413
- /**
414
- * @license
415
- * Copyright 2019 Google LLC
416
- *
417
- * Licensed under the Apache License, Version 2.0 (the "License");
418
- * you may not use this file except in compliance with the License.
419
- * You may obtain a copy of the License at
420
- *
421
- * http://www.apache.org/licenses/LICENSE-2.0
422
- *
423
- * Unless required by applicable law or agreed to in writing, software
424
- * distributed under the License is distributed on an "AS IS" BASIS,
425
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
426
- * See the License for the specific language governing permissions and
427
- * limitations under the License.
428
- */
429
- async function getInstallationEntry(installations) {
430
- let registrationPromise;
431
- const installationEntry = await update(installations.appConfig, (oldEntry) => {
432
- const installationEntry2 = updateOrCreateInstallationEntry(oldEntry);
433
- const entryWithPromise = triggerRegistrationIfNecessary(installations, installationEntry2);
434
- registrationPromise = entryWithPromise.registrationPromise;
435
- return entryWithPromise.installationEntry;
436
- });
437
- if (installationEntry.fid === INVALID_FID) {
438
- return { installationEntry: await registrationPromise };
439
- }
440
- return {
441
- installationEntry,
442
- registrationPromise
443
- };
444
- }
445
- function updateOrCreateInstallationEntry(oldEntry) {
446
- const entry = oldEntry || {
447
- fid: generateFid(),
448
- registrationStatus: 0
449
- /* RequestStatus.NOT_STARTED */
450
- };
451
- return clearTimedOutRequest(entry);
452
- }
453
- function triggerRegistrationIfNecessary(installations, installationEntry) {
454
- if (installationEntry.registrationStatus === 0) {
455
- if (!navigator.onLine) {
456
- const registrationPromiseWithError = Promise.reject(ERROR_FACTORY.create(
457
- "app-offline"
458
- /* ErrorCode.APP_OFFLINE */
459
- ));
460
- return {
461
- installationEntry,
462
- registrationPromise: registrationPromiseWithError
463
- };
464
- }
465
- const inProgressEntry = {
466
- fid: installationEntry.fid,
467
- registrationStatus: 1,
468
- registrationTime: Date.now()
469
- };
470
- const registrationPromise = registerInstallation(installations, inProgressEntry);
471
- return { installationEntry: inProgressEntry, registrationPromise };
472
- } else if (installationEntry.registrationStatus === 1) {
473
- return {
474
- installationEntry,
475
- registrationPromise: waitUntilFidRegistration(installations)
476
- };
477
- } else {
478
- return { installationEntry };
479
- }
480
- }
481
- async function registerInstallation(installations, installationEntry) {
482
- try {
483
- const registeredInstallationEntry = await createInstallationRequest(installations, installationEntry);
484
- return set(installations.appConfig, registeredInstallationEntry);
485
- } catch (e) {
486
- if (isServerError(e) && e.customData.serverCode === 409) {
487
- await remove(installations.appConfig);
488
- } else {
489
- await set(installations.appConfig, {
490
- fid: installationEntry.fid,
491
- registrationStatus: 0
492
- /* RequestStatus.NOT_STARTED */
493
- });
494
- }
495
- throw e;
496
- }
497
- }
498
- async function waitUntilFidRegistration(installations) {
499
- let entry = await updateInstallationRequest(installations.appConfig);
500
- while (entry.registrationStatus === 1) {
501
- await sleep(100);
502
- entry = await updateInstallationRequest(installations.appConfig);
503
- }
504
- if (entry.registrationStatus === 0) {
505
- const { installationEntry, registrationPromise } = await getInstallationEntry(installations);
506
- if (registrationPromise) {
507
- return registrationPromise;
508
- } else {
509
- return installationEntry;
510
- }
511
- }
512
- return entry;
513
- }
514
- function updateInstallationRequest(appConfig) {
515
- return update(appConfig, (oldEntry) => {
516
- if (!oldEntry) {
517
- throw ERROR_FACTORY.create(
518
- "installation-not-found"
519
- /* ErrorCode.INSTALLATION_NOT_FOUND */
520
- );
521
- }
522
- return clearTimedOutRequest(oldEntry);
523
- });
524
- }
525
- function clearTimedOutRequest(entry) {
526
- if (hasInstallationRequestTimedOut(entry)) {
527
- return {
528
- fid: entry.fid,
529
- registrationStatus: 0
530
- /* RequestStatus.NOT_STARTED */
531
- };
532
- }
533
- return entry;
534
- }
535
- function hasInstallationRequestTimedOut(installationEntry) {
536
- return installationEntry.registrationStatus === 1 && installationEntry.registrationTime + PENDING_TIMEOUT_MS < Date.now();
537
- }
538
- /**
539
- * @license
540
- * Copyright 2019 Google LLC
541
- *
542
- * Licensed under the Apache License, Version 2.0 (the "License");
543
- * you may not use this file except in compliance with the License.
544
- * You may obtain a copy of the License at
545
- *
546
- * http://www.apache.org/licenses/LICENSE-2.0
547
- *
548
- * Unless required by applicable law or agreed to in writing, software
549
- * distributed under the License is distributed on an "AS IS" BASIS,
550
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
551
- * See the License for the specific language governing permissions and
552
- * limitations under the License.
553
- */
554
- async function generateAuthTokenRequest({ appConfig, heartbeatServiceProvider }, installationEntry) {
555
- const endpoint = getGenerateAuthTokenEndpoint(appConfig, installationEntry);
556
- const headers = getHeadersWithAuth(appConfig, installationEntry);
557
- const heartbeatService = heartbeatServiceProvider.getImmediate({
558
- optional: true
559
- });
560
- if (heartbeatService) {
561
- const heartbeatsHeader = await heartbeatService.getHeartbeatsHeader();
562
- if (heartbeatsHeader) {
563
- headers.append("x-firebase-client", heartbeatsHeader);
564
- }
565
- }
566
- const body = {
567
- installation: {
568
- sdkVersion: PACKAGE_VERSION,
569
- appId: appConfig.appId
570
- }
571
- };
572
- const request = {
573
- method: "POST",
574
- headers,
575
- body: JSON.stringify(body)
576
- };
577
- const response = await retryIfServerError(() => fetch(endpoint, request));
578
- if (response.ok) {
579
- const responseValue = await response.json();
580
- const completedAuthToken = extractAuthTokenInfoFromResponse(responseValue);
581
- return completedAuthToken;
582
- } else {
583
- throw await getErrorFromResponse("Generate Auth Token", response);
584
- }
585
- }
586
- function getGenerateAuthTokenEndpoint(appConfig, { fid }) {
587
- return `${getInstallationsEndpoint(appConfig)}/${fid}/authTokens:generate`;
588
- }
589
- /**
590
- * @license
591
- * Copyright 2019 Google LLC
592
- *
593
- * Licensed under the Apache License, Version 2.0 (the "License");
594
- * you may not use this file except in compliance with the License.
595
- * You may obtain a copy of the License at
596
- *
597
- * http://www.apache.org/licenses/LICENSE-2.0
598
- *
599
- * Unless required by applicable law or agreed to in writing, software
600
- * distributed under the License is distributed on an "AS IS" BASIS,
601
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
602
- * See the License for the specific language governing permissions and
603
- * limitations under the License.
604
- */
605
- async function refreshAuthToken(installations, forceRefresh = false) {
606
- let tokenPromise;
607
- const entry = await update(installations.appConfig, (oldEntry) => {
608
- if (!isEntryRegistered(oldEntry)) {
609
- throw ERROR_FACTORY.create(
610
- "not-registered"
611
- /* ErrorCode.NOT_REGISTERED */
612
- );
613
- }
614
- const oldAuthToken = oldEntry.authToken;
615
- if (!forceRefresh && isAuthTokenValid(oldAuthToken)) {
616
- return oldEntry;
617
- } else if (oldAuthToken.requestStatus === 1) {
618
- tokenPromise = waitUntilAuthTokenRequest(installations, forceRefresh);
619
- return oldEntry;
620
- } else {
621
- if (!navigator.onLine) {
622
- throw ERROR_FACTORY.create(
623
- "app-offline"
624
- /* ErrorCode.APP_OFFLINE */
625
- );
626
- }
627
- const inProgressEntry = makeAuthTokenRequestInProgressEntry(oldEntry);
628
- tokenPromise = fetchAuthTokenFromServer(installations, inProgressEntry);
629
- return inProgressEntry;
630
- }
631
- });
632
- const authToken = tokenPromise ? await tokenPromise : entry.authToken;
633
- return authToken;
634
- }
635
- async function waitUntilAuthTokenRequest(installations, forceRefresh) {
636
- let entry = await updateAuthTokenRequest(installations.appConfig);
637
- while (entry.authToken.requestStatus === 1) {
638
- await sleep(100);
639
- entry = await updateAuthTokenRequest(installations.appConfig);
640
- }
641
- const authToken = entry.authToken;
642
- if (authToken.requestStatus === 0) {
643
- return refreshAuthToken(installations, forceRefresh);
644
- } else {
645
- return authToken;
646
- }
647
- }
648
- function updateAuthTokenRequest(appConfig) {
649
- return update(appConfig, (oldEntry) => {
650
- if (!isEntryRegistered(oldEntry)) {
651
- throw ERROR_FACTORY.create(
652
- "not-registered"
653
- /* ErrorCode.NOT_REGISTERED */
654
- );
655
- }
656
- const oldAuthToken = oldEntry.authToken;
657
- if (hasAuthTokenRequestTimedOut(oldAuthToken)) {
658
- return Object.assign(Object.assign({}, oldEntry), { authToken: {
659
- requestStatus: 0
660
- /* RequestStatus.NOT_STARTED */
661
- } });
662
- }
663
- return oldEntry;
664
- });
665
- }
666
- async function fetchAuthTokenFromServer(installations, installationEntry) {
667
- try {
668
- const authToken = await generateAuthTokenRequest(installations, installationEntry);
669
- const updatedInstallationEntry = Object.assign(Object.assign({}, installationEntry), { authToken });
670
- await set(installations.appConfig, updatedInstallationEntry);
671
- return authToken;
672
- } catch (e) {
673
- if (isServerError(e) && (e.customData.serverCode === 401 || e.customData.serverCode === 404)) {
674
- await remove(installations.appConfig);
675
- } else {
676
- const updatedInstallationEntry = Object.assign(Object.assign({}, installationEntry), { authToken: {
677
- requestStatus: 0
678
- /* RequestStatus.NOT_STARTED */
679
- } });
680
- await set(installations.appConfig, updatedInstallationEntry);
681
- }
682
- throw e;
683
- }
684
- }
685
- function isEntryRegistered(installationEntry) {
686
- return installationEntry !== void 0 && installationEntry.registrationStatus === 2;
687
- }
688
- function isAuthTokenValid(authToken) {
689
- return authToken.requestStatus === 2 && !isAuthTokenExpired(authToken);
690
- }
691
- function isAuthTokenExpired(authToken) {
692
- const now = Date.now();
693
- return now < authToken.creationTime || authToken.creationTime + authToken.expiresIn < now + TOKEN_EXPIRATION_BUFFER;
694
- }
695
- function makeAuthTokenRequestInProgressEntry(oldEntry) {
696
- const inProgressAuthToken = {
697
- requestStatus: 1,
698
- requestTime: Date.now()
699
- };
700
- return Object.assign(Object.assign({}, oldEntry), { authToken: inProgressAuthToken });
701
- }
702
- function hasAuthTokenRequestTimedOut(authToken) {
703
- return authToken.requestStatus === 1 && authToken.requestTime + PENDING_TIMEOUT_MS < Date.now();
704
- }
705
- /**
706
- * @license
707
- * Copyright 2019 Google LLC
708
- *
709
- * Licensed under the Apache License, Version 2.0 (the "License");
710
- * you may not use this file except in compliance with the License.
711
- * You may obtain a copy of the License at
712
- *
713
- * http://www.apache.org/licenses/LICENSE-2.0
714
- *
715
- * Unless required by applicable law or agreed to in writing, software
716
- * distributed under the License is distributed on an "AS IS" BASIS,
717
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
718
- * See the License for the specific language governing permissions and
719
- * limitations under the License.
720
- */
721
- async function getId(installations) {
722
- const installationsImpl = installations;
723
- const { installationEntry, registrationPromise } = await getInstallationEntry(installationsImpl);
724
- if (registrationPromise) {
725
- registrationPromise.catch(console.error);
726
- } else {
727
- refreshAuthToken(installationsImpl).catch(console.error);
728
- }
729
- return installationEntry.fid;
730
- }
731
- /**
732
- * @license
733
- * Copyright 2019 Google LLC
734
- *
735
- * Licensed under the Apache License, Version 2.0 (the "License");
736
- * you may not use this file except in compliance with the License.
737
- * You may obtain a copy of the License at
738
- *
739
- * http://www.apache.org/licenses/LICENSE-2.0
740
- *
741
- * Unless required by applicable law or agreed to in writing, software
742
- * distributed under the License is distributed on an "AS IS" BASIS,
743
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
744
- * See the License for the specific language governing permissions and
745
- * limitations under the License.
746
- */
747
- async function getToken(installations, forceRefresh = false) {
748
- const installationsImpl = installations;
749
- await completeInstallationRegistration(installationsImpl);
750
- const authToken = await refreshAuthToken(installationsImpl, forceRefresh);
751
- return authToken.token;
752
- }
753
- async function completeInstallationRegistration(installations) {
754
- const { registrationPromise } = await getInstallationEntry(installations);
755
- if (registrationPromise) {
756
- await registrationPromise;
757
- }
758
- }
759
- /**
760
- * @license
761
- * Copyright 2019 Google LLC
762
- *
763
- * Licensed under the Apache License, Version 2.0 (the "License");
764
- * you may not use this file except in compliance with the License.
765
- * You may obtain a copy of the License at
766
- *
767
- * http://www.apache.org/licenses/LICENSE-2.0
768
- *
769
- * Unless required by applicable law or agreed to in writing, software
770
- * distributed under the License is distributed on an "AS IS" BASIS,
771
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
772
- * See the License for the specific language governing permissions and
773
- * limitations under the License.
774
- */
775
- function extractAppConfig(app) {
776
- if (!app || !app.options) {
777
- throw getMissingValueError("App Configuration");
778
- }
779
- if (!app.name) {
780
- throw getMissingValueError("App Name");
781
- }
782
- const configKeys = [
783
- "projectId",
784
- "apiKey",
785
- "appId"
786
- ];
787
- for (const keyName of configKeys) {
788
- if (!app.options[keyName]) {
789
- throw getMissingValueError(keyName);
790
- }
791
- }
792
- return {
793
- appName: app.name,
794
- projectId: app.options.projectId,
795
- apiKey: app.options.apiKey,
796
- appId: app.options.appId
797
- };
798
- }
799
- function getMissingValueError(valueName) {
800
- return ERROR_FACTORY.create("missing-app-config-values", {
801
- valueName
802
- });
803
- }
804
- /**
805
- * @license
806
- * Copyright 2020 Google LLC
807
- *
808
- * Licensed under the Apache License, Version 2.0 (the "License");
809
- * you may not use this file except in compliance with the License.
810
- * You may obtain a copy of the License at
811
- *
812
- * http://www.apache.org/licenses/LICENSE-2.0
813
- *
814
- * Unless required by applicable law or agreed to in writing, software
815
- * distributed under the License is distributed on an "AS IS" BASIS,
816
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
817
- * See the License for the specific language governing permissions and
818
- * limitations under the License.
819
- */
820
- const INSTALLATIONS_NAME = "installations";
821
- const INSTALLATIONS_NAME_INTERNAL = "installations-internal";
822
- const publicFactory = (container) => {
823
- const app = container.getProvider("app").getImmediate();
824
- const appConfig = extractAppConfig(app);
825
- const heartbeatServiceProvider = _getProvider(app, "heartbeat");
826
- const installationsImpl = {
827
- app,
828
- appConfig,
829
- heartbeatServiceProvider,
830
- _delete: () => Promise.resolve()
831
- };
832
- return installationsImpl;
833
- };
834
- const internalFactory = (container) => {
835
- const app = container.getProvider("app").getImmediate();
836
- const installations = _getProvider(app, INSTALLATIONS_NAME).getImmediate();
837
- const installationsInternal = {
838
- getId: () => getId(installations),
839
- getToken: (forceRefresh) => getToken(installations, forceRefresh)
840
- };
841
- return installationsInternal;
842
- };
843
- function registerInstallations() {
844
- _registerComponent(new Component(
845
- INSTALLATIONS_NAME,
846
- publicFactory,
847
- "PUBLIC"
848
- /* ComponentType.PUBLIC */
849
- ));
850
- _registerComponent(new Component(
851
- INSTALLATIONS_NAME_INTERNAL,
852
- internalFactory,
853
- "PRIVATE"
854
- /* ComponentType.PRIVATE */
855
- ));
856
- }
857
- registerInstallations();
858
- registerVersion(name, version);
859
- registerVersion(name, version, "esm2017");
860
- export {
861
- getId,
862
- getToken
863
- };