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

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 (380) hide show
  1. package/dist/index.js +72 -0
  2. package/dist/node_modules/@firebase/app/dist/esm/index.esm2017.js +749 -0
  3. package/dist/node_modules/@firebase/auth/dist/esm2017/index-68602d24.js +6265 -0
  4. package/dist/node_modules/@firebase/component/dist/esm/index.esm2017.js +341 -0
  5. package/dist/node_modules/@firebase/firestore/dist/index.esm2017.js +10250 -0
  6. package/dist/node_modules/@firebase/functions/dist/index.esm2017.js +513 -0
  7. package/dist/node_modules/@firebase/installations/dist/esm/index.esm2017.js +863 -0
  8. package/dist/node_modules/@firebase/logger/dist/esm/index.esm2017.js +122 -0
  9. package/dist/node_modules/@firebase/messaging/dist/esm/index.esm2017.js +1019 -0
  10. package/dist/node_modules/@firebase/storage/dist/index.esm2017.js +2042 -0
  11. package/dist/node_modules/@firebase/util/dist/index.esm2017.js +931 -0
  12. package/dist/node_modules/@firebase/webchannel-wrapper/dist/bloom-blob/esm/bloom_blob_es2018.js +417 -0
  13. package/dist/node_modules/@firebase/webchannel-wrapper/dist/webchannel-blob/esm/webchannel_blob_es2018.js +2155 -0
  14. package/dist/node_modules/@lit/reactive-element/decorators/custom-element.js +14 -0
  15. package/dist/node_modules/@lit/reactive-element/decorators/property.js +20 -0
  16. package/dist/node_modules/@lit/reactive-element/decorators/query-assigned-elements.js +7 -0
  17. package/dist/node_modules/@progressive-development/pd-dialog/pd-popup-dialog.js +5 -0
  18. package/dist/node_modules/@progressive-development/pd-dialog/pd-popup.js +2 -0
  19. package/dist/node_modules/@progressive-development/pd-dialog/src/PdPopup.js +113 -0
  20. package/dist/node_modules/@progressive-development/pd-dialog/src/PdPopupDialog.js +189 -0
  21. package/dist/node_modules/@progressive-development/pd-forms/pd-button.js +2 -0
  22. package/dist/node_modules/@progressive-development/pd-forms/pd-form-container.js +2 -0
  23. package/dist/node_modules/@progressive-development/pd-forms/pd-form-row.js +2 -0
  24. package/dist/node_modules/@progressive-development/pd-forms/pd-hover-box.js +2 -0
  25. package/dist/node_modules/@progressive-development/pd-forms/pd-input.js +2 -0
  26. package/dist/node_modules/@progressive-development/pd-forms/src/PdBaseInputElement.js +86 -0
  27. package/dist/node_modules/@progressive-development/pd-forms/src/PdBaseUi.js +34 -0
  28. package/dist/node_modules/@progressive-development/pd-forms/src/PdBaseUiInput.js +227 -0
  29. package/dist/node_modules/@progressive-development/pd-forms/src/PdButton.js +194 -0
  30. package/dist/node_modules/@progressive-development/pd-forms/src/PdFormContainer.js +167 -0
  31. package/dist/node_modules/@progressive-development/pd-forms/src/PdFormRow.js +92 -0
  32. package/dist/node_modules/@progressive-development/pd-forms/src/PdHoverBox.js +108 -0
  33. package/dist/node_modules/@progressive-development/pd-forms/src/PdInput.js +79 -0
  34. package/dist/node_modules/@progressive-development/pd-forms/src/generated/locale/be.js +11 -0
  35. package/dist/node_modules/@progressive-development/pd-forms/src/generated/locale/en.js +11 -0
  36. package/dist/node_modules/@progressive-development/pd-forms/src/shared-input-field-styles.js +152 -0
  37. package/dist/node_modules/@progressive-development/pd-forms/src/shared-input-styles.js +64 -0
  38. package/dist/node_modules/@progressive-development/pd-icon/pd-icon.js +4 -0
  39. package/dist/node_modules/@progressive-development/pd-icon/src/PdIcon.js +596 -0
  40. package/dist/node_modules/@progressive-development/pd-order/dist/locales/be.js +15 -0
  41. package/dist/node_modules/@progressive-development/pd-order/dist/locales/de.js +15 -0
  42. package/dist/node_modules/@progressive-development/pd-order/dist/locales/en.js +15 -0
  43. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-contact/pd-contact.js +2 -0
  44. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-contact/src/PdContact.js +567 -0
  45. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-content/pd-collapse.js +2 -0
  46. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-content/pd-edit-content.js +2 -0
  47. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-content/src/PdCollapse.js +136 -0
  48. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-content/src/PdEditContent.js +224 -0
  49. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-dialog/pd-popup.js +2 -0
  50. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-dialog/src/PdPopup.js +113 -0
  51. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/pd-checkbox.js +2 -0
  52. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/pd-form-container.js +2 -0
  53. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/pd-form-row.js +2 -0
  54. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/pd-hover-box.js +2 -0
  55. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/pd-input.js +2 -0
  56. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/pd-radio-group.js +2 -0
  57. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdBaseInputElement.js +86 -0
  58. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdBaseUi.js +34 -0
  59. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdBaseUiInput.js +229 -0
  60. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdCheckbox.js +230 -0
  61. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdFormContainer.js +167 -0
  62. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdFormRow.js +92 -0
  63. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdHoverBox.js +108 -0
  64. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdInput.js +79 -0
  65. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdRadioGroup.js +72 -0
  66. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/shared-input-field-styles.js +152 -0
  67. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/shared-input-styles.js +64 -0
  68. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-icon/pd-icon.js +4 -0
  69. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-icon/src/PdIcon.js +596 -0
  70. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-price/pd-pricetable.js +2 -0
  71. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-price/src/PdPricetable.js +149 -0
  72. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/fecha/lib/fecha.js +200 -0
  73. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/lit/node_modules/lit-html/directive.js +27 -0
  74. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/lit/node_modules/lit-html/directives/class-map.js +36 -0
  75. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/lit/node_modules/lit-html/lit-html.js +242 -0
  76. package/dist/node_modules/@progressive-development/pd-order/dist/pd-order-contacts.js +2 -0
  77. package/dist/node_modules/@progressive-development/pd-order/dist/pd-order-summary.js +2 -0
  78. package/dist/node_modules/@progressive-development/pd-order/dist/src/PdOrderContacts.js +192 -0
  79. package/dist/node_modules/@progressive-development/pd-order/dist/src/PdOrderSummary.js +243 -0
  80. package/dist/node_modules/@progressive-development/pd-page/pd-footer.js +2 -0
  81. package/dist/node_modules/@progressive-development/pd-page/pd-menu.js +2 -0
  82. package/dist/node_modules/@progressive-development/pd-page/src/PdFooter.js +141 -0
  83. package/dist/node_modules/@progressive-development/pd-page/src/PdMenu.js +450 -0
  84. package/dist/node_modules/@progressive-development/pd-shared-styles/src/shared-color-styles.js +30 -0
  85. package/dist/node_modules/@progressive-development/pd-shared-styles/src/shared-font-styles.js +32 -0
  86. package/dist/node_modules/@progressive-development/pd-wizard/pd-wizard.js +2 -0
  87. package/dist/node_modules/@progressive-development/pd-wizard/src/PdSteps.js +191 -0
  88. package/dist/node_modules/@progressive-development/pd-wizard/src/PdWizard.js +280 -0
  89. package/dist/node_modules/firebase/app/dist/esm/index.esm.js +35 -0
  90. package/dist/node_modules/idb/build/index.js +81 -0
  91. package/dist/node_modules/idb/build/wrap-idb-value.js +148 -0
  92. package/dist/node_modules/lit/node_modules/lit-html/directive.js +27 -0
  93. package/dist/node_modules/lit/node_modules/lit-html/directives/class-map.js +36 -0
  94. package/dist/node_modules/lit/node_modules/lit-html/lit-html.js +242 -0
  95. package/dist/node_modules/lit-element-router/lit-element-router.js +131 -0
  96. package/dist/node_modules/lit-element-router/utility/router-utility.js +36 -0
  97. package/dist/node_modules/mini-rx-store/index.esm.js +458 -0
  98. package/dist/node_modules/pwa-helpers/media-query.js +17 -0
  99. package/dist/node_modules/rxjs/dist/esm5/internal/Observable.js +100 -0
  100. package/dist/node_modules/rxjs/dist/esm5/internal/Subscriber.js +147 -0
  101. package/dist/node_modules/rxjs/dist/esm5/internal/Subscription.js +139 -0
  102. package/dist/node_modules/rxjs/dist/esm5/internal/config.js +10 -0
  103. package/dist/node_modules/rxjs/dist/esm5/internal/observable/innerFrom.js +159 -0
  104. package/dist/node_modules/rxjs/dist/esm5/internal/operators/OperatorSubscriber.js +52 -0
  105. package/dist/node_modules/rxjs/dist/esm5/internal/operators/catchError.js +28 -0
  106. package/dist/node_modules/rxjs/dist/esm5/internal/operators/distinctUntilChanged.js +27 -0
  107. package/dist/node_modules/rxjs/dist/esm5/internal/operators/filter.js +13 -0
  108. package/dist/node_modules/rxjs/dist/esm5/internal/operators/map.js +13 -0
  109. package/dist/node_modules/rxjs/dist/esm5/internal/operators/observeOn.js +26 -0
  110. package/dist/node_modules/rxjs/dist/esm5/internal/operators/tap.js +36 -0
  111. package/dist/node_modules/rxjs/dist/esm5/internal/operators/withLatestFrom.js +43 -0
  112. package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js +18 -0
  113. package/dist/node_modules/rxjs/dist/esm5/internal/symbol/iterator.js +11 -0
  114. package/dist/node_modules/rxjs/dist/esm5/internal/symbol/observable.js +6 -0
  115. package/dist/node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js +14 -0
  116. package/dist/node_modules/rxjs/dist/esm5/internal/util/args.js +10 -0
  117. package/dist/node_modules/rxjs/dist/esm5/internal/util/arrRemove.js +9 -0
  118. package/dist/node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js +13 -0
  119. package/dist/node_modules/rxjs/dist/esm5/internal/util/errorContext.js +8 -0
  120. package/dist/node_modules/rxjs/dist/esm5/internal/util/executeSchedule.js +23 -0
  121. package/dist/node_modules/rxjs/dist/esm5/internal/util/identity.js +6 -0
  122. package/dist/node_modules/rxjs/dist/esm5/internal/util/isArrayLike.js +6 -0
  123. package/dist/node_modules/rxjs/dist/esm5/internal/util/isAsyncIterable.js +7 -0
  124. package/dist/node_modules/rxjs/dist/esm5/internal/util/isFunction.js +6 -0
  125. package/dist/node_modules/rxjs/dist/esm5/internal/util/isInteropObservable.js +8 -0
  126. package/dist/node_modules/rxjs/dist/esm5/internal/util/isIterable.js +8 -0
  127. package/dist/node_modules/rxjs/dist/esm5/internal/util/isPromise.js +7 -0
  128. package/dist/node_modules/rxjs/dist/esm5/internal/util/isReadableStreamLike.js +46 -0
  129. package/dist/node_modules/rxjs/dist/esm5/internal/util/lift.js +22 -0
  130. package/dist/node_modules/rxjs/dist/esm5/internal/util/noop.js +5 -0
  131. package/dist/node_modules/rxjs/dist/esm5/internal/util/pipe.js +17 -0
  132. package/dist/node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js +11 -0
  133. package/dist/node_modules/rxjs/dist/esm5/internal/util/throwUnobservableError.js +6 -0
  134. package/dist/node_modules/tslib/tslib.es6.js +240 -0
  135. package/dist/pd-panel-viewer.js +189 -0
  136. package/dist/pd-panel.js +51 -0
  137. package/dist/src/PdSpaHelper.js +319 -402
  138. package/dist/src/defaultpage/default-confirm-popup.js +61 -41
  139. package/dist/src/defaultpage/default-dialog-popup.js +74 -60
  140. package/dist/src/defaultpage/default-login.js +31 -20
  141. package/dist/src/defaultpage/default-popup.js +13 -10
  142. package/dist/src/defaultpage/default-step-address.js +52 -42
  143. package/dist/src/defaultpage/default-step-summary.js +58 -49
  144. package/dist/src/defaultpage/default-view-page.js +31 -23
  145. package/dist/src/defaultpage/default-wizard-step.js +119 -111
  146. package/dist/src/defaultpage/default-wizard.js +199 -195
  147. package/dist/src/generated/locale-wrapper/be-wrapper.js +14 -11
  148. package/dist/src/generated/locale-wrapper/de-wrapper.js +12 -9
  149. package/dist/src/generated/locale-wrapper/en-wrapper.js +14 -11
  150. package/dist/src/generated/locales/be.js +17 -19
  151. package/dist/src/generated/locales/de.js +17 -19
  152. package/dist/src/generated/locales/en.js +17 -19
  153. package/dist/src/helper/helper-utils.js +29 -24
  154. package/dist/src/model/spa-model.js +6 -3
  155. package/dist/src/popup/wizard-close-popup.js +37 -27
  156. package/dist/src/popup/wizard-reload-popup.js +35 -23
  157. package/dist/src/router/AppMain.js +23 -12
  158. package/dist/src/service-provider/firebase/auth.js +50 -73
  159. package/dist/src/service-provider/firebase/firestorage-client.js +194 -243
  160. package/dist/src/service-provider/firebase/firestore-client.js +19 -25
  161. package/dist/src/service-provider/firebase/functions-client.js +27 -59
  162. package/dist/src/service-provider/firebase/messagingFirebaseClient.js +60 -59
  163. package/dist/src/service-provider/mock/auth.js +54 -54
  164. package/dist/src/service-provider/mock/function-client.js +28 -27
  165. package/dist/src/service-provider/mock/storage-client.js +86 -92
  166. package/dist/src/service-provider/service-provider-impl.js +206 -211
  167. package/dist/src/service-provider/service-provider-model.js +1 -2
  168. package/dist/src/store/indexDB.js +133 -180
  169. package/dist/src/store/mini-rx.store.js +36 -38
  170. package/dist/src/store/spa-app-actions.js +27 -14
  171. package/dist/src/store/spa-app-effects.js +60 -40
  172. package/dist/src/store/spa-app-reducer.js +42 -33
  173. package/dist/src/store/spa-app-selector.js +31 -15
  174. package/dist/src/tmpown/pd-loading-state.js +49 -39
  175. package/dist/src/tmpown/pd-login.js +76 -67
  176. package/dist/src/tmpown/pd-toast.js +74 -65
  177. package/package.json +21 -18
  178. package/.editorconfig +0 -29
  179. package/.storybook/main.ts +0 -14
  180. package/.storybook/preview.ts +0 -15
  181. package/demo/index.html +0 -29
  182. package/dist/src/InitApplicationData.d.ts +0 -3
  183. package/dist/src/InitApplicationData.js +0 -8
  184. package/dist/src/InitApplicationData.js.map +0 -1
  185. package/dist/src/PdSpaHelper.d.ts +0 -93
  186. package/dist/src/PdSpaHelper.js.map +0 -1
  187. package/dist/src/defaultpage/default-confirm-popup.d.ts +0 -19
  188. package/dist/src/defaultpage/default-confirm-popup.js.map +0 -1
  189. package/dist/src/defaultpage/default-dialog-popup.d.ts +0 -16
  190. package/dist/src/defaultpage/default-dialog-popup.js.map +0 -1
  191. package/dist/src/defaultpage/default-login.d.ts +0 -8
  192. package/dist/src/defaultpage/default-login.js.map +0 -1
  193. package/dist/src/defaultpage/default-popup.d.ts +0 -7
  194. package/dist/src/defaultpage/default-popup.js.map +0 -1
  195. package/dist/src/defaultpage/default-step-address.d.ts +0 -19
  196. package/dist/src/defaultpage/default-step-address.js.map +0 -1
  197. package/dist/src/defaultpage/default-step-summary.d.ts +0 -30
  198. package/dist/src/defaultpage/default-step-summary.js.map +0 -1
  199. package/dist/src/defaultpage/default-view-page.d.ts +0 -9
  200. package/dist/src/defaultpage/default-view-page.js.map +0 -1
  201. package/dist/src/defaultpage/default-wizard-step.d.ts +0 -34
  202. package/dist/src/defaultpage/default-wizard-step.js.map +0 -1
  203. package/dist/src/defaultpage/default-wizard.d.ts +0 -33
  204. package/dist/src/defaultpage/default-wizard.js.map +0 -1
  205. package/dist/src/firebase/auth.d.ts +0 -4
  206. package/dist/src/firebase/auth.js +0 -28
  207. package/dist/src/firebase/auth.js.map +0 -1
  208. package/dist/src/firebase/firestore-client.d.ts +0 -9
  209. package/dist/src/firebase/firestore-client.js +0 -19
  210. package/dist/src/firebase/firestore-client.js.map +0 -1
  211. package/dist/src/firebase/functions-client.d.ts +0 -34
  212. package/dist/src/firebase/functions-client.js +0 -70
  213. package/dist/src/firebase/functions-client.js.map +0 -1
  214. package/dist/src/generated/locale-codes.d.ts +0 -13
  215. package/dist/src/generated/locale-codes.js +0 -25
  216. package/dist/src/generated/locale-codes.js.map +0 -1
  217. package/dist/src/generated/locale-wrapper/be-wrapper.d.ts +0 -1
  218. package/dist/src/generated/locale-wrapper/be-wrapper.js.map +0 -1
  219. package/dist/src/generated/locale-wrapper/de-wrapper.d.ts +0 -15
  220. package/dist/src/generated/locale-wrapper/de-wrapper.js.map +0 -1
  221. package/dist/src/generated/locale-wrapper/en-wrapper.d.ts +0 -1
  222. package/dist/src/generated/locale-wrapper/en-wrapper.js.map +0 -1
  223. package/dist/src/generated/locales/be.d.ts +0 -15
  224. package/dist/src/generated/locales/be.js.map +0 -1
  225. package/dist/src/generated/locales/de.d.ts +0 -15
  226. package/dist/src/generated/locales/de.js.map +0 -1
  227. package/dist/src/generated/locales/en.d.ts +0 -15
  228. package/dist/src/generated/locales/en.js.map +0 -1
  229. package/dist/src/helper/helper-utils.d.ts +0 -5
  230. package/dist/src/helper/helper-utils.js.map +0 -1
  231. package/dist/src/index.d.ts +0 -22
  232. package/dist/src/index.js +0 -33
  233. package/dist/src/index.js.map +0 -1
  234. package/dist/src/model/spa-model.d.ts +0 -16
  235. package/dist/src/model/spa-model.js.map +0 -1
  236. package/dist/src/pd-spa-helper.d.ts +0 -0
  237. package/dist/src/pd-spa-helper.js +0 -5
  238. package/dist/src/pd-spa-helper.js.map +0 -1
  239. package/dist/src/popup/wizard-close-popup.d.ts +0 -10
  240. package/dist/src/popup/wizard-close-popup.js.map +0 -1
  241. package/dist/src/popup/wizard-reload-popup.d.ts +0 -13
  242. package/dist/src/popup/wizard-reload-popup.js.map +0 -1
  243. package/dist/src/router/AppMain.d.ts +0 -6
  244. package/dist/src/router/AppMain.js.map +0 -1
  245. package/dist/src/service-call-controller2.d.ts +0 -16
  246. package/dist/src/service-call-controller2.js +0 -43
  247. package/dist/src/service-call-controller2.js.map +0 -1
  248. package/dist/src/service-provider/firebase/auth.d.ts +0 -14
  249. package/dist/src/service-provider/firebase/auth.js.map +0 -1
  250. package/dist/src/service-provider/firebase/firestorage-client.d.ts +0 -20
  251. package/dist/src/service-provider/firebase/firestorage-client.js.map +0 -1
  252. package/dist/src/service-provider/firebase/firestore-client.d.ts +0 -11
  253. package/dist/src/service-provider/firebase/firestore-client.js.map +0 -1
  254. package/dist/src/service-provider/firebase/functions-client.d.ts +0 -9
  255. package/dist/src/service-provider/firebase/functions-client.js.map +0 -1
  256. package/dist/src/service-provider/firebase/messagingFirebaseClient.d.ts +0 -8
  257. package/dist/src/service-provider/firebase/messagingFirebaseClient.js.map +0 -1
  258. package/dist/src/service-provider/mock/auth.d.ts +0 -5
  259. package/dist/src/service-provider/mock/auth.js.map +0 -1
  260. package/dist/src/service-provider/mock/function-client.d.ts +0 -8
  261. package/dist/src/service-provider/mock/function-client.js.map +0 -1
  262. package/dist/src/service-provider/mock/storage-client.d.ts +0 -10
  263. package/dist/src/service-provider/mock/storage-client.js.map +0 -1
  264. package/dist/src/service-provider/service-provider-impl.d.ts +0 -21
  265. package/dist/src/service-provider/service-provider-impl.js.map +0 -1
  266. package/dist/src/service-provider/service-provider-model.d.ts +0 -136
  267. package/dist/src/service-provider/service-provider-model.js.map +0 -1
  268. package/dist/src/store/indexDB.d.ts +0 -27
  269. package/dist/src/store/indexDB.js.map +0 -1
  270. package/dist/src/store/mini-rx.store.d.ts +0 -4
  271. package/dist/src/store/mini-rx.store.js.map +0 -1
  272. package/dist/src/store/spa-app-actions.d.ts +0 -104
  273. package/dist/src/store/spa-app-actions.js.map +0 -1
  274. package/dist/src/store/spa-app-effects.d.ts +0 -23
  275. package/dist/src/store/spa-app-effects.js.map +0 -1
  276. package/dist/src/store/spa-app-reducer.d.ts +0 -9
  277. package/dist/src/store/spa-app-reducer.js.map +0 -1
  278. package/dist/src/store/spa-app-selector.d.ts +0 -6
  279. package/dist/src/store/spa-app-selector.js.map +0 -1
  280. package/dist/src/stories/Button.d.ts +0 -27
  281. package/dist/src/stories/Button.js +0 -20
  282. package/dist/src/stories/Button.js.map +0 -1
  283. package/dist/src/stories/Button.stories.d.ts +0 -9
  284. package/dist/src/stories/Button.stories.js +0 -41
  285. package/dist/src/stories/Button.stories.js.map +0 -1
  286. package/dist/src/stories/Header.d.ts +0 -12
  287. package/dist/src/stories/Header.js +0 -44
  288. package/dist/src/stories/Header.js.map +0 -1
  289. package/dist/src/stories/Header.stories.d.ts +0 -7
  290. package/dist/src/stories/Header.stories.js +0 -17
  291. package/dist/src/stories/Header.stories.js.map +0 -1
  292. package/dist/src/stories/Page.d.ts +0 -12
  293. package/dist/src/stories/Page.js +0 -61
  294. package/dist/src/stories/Page.js.map +0 -1
  295. package/dist/src/stories/Page.stories.d.ts +0 -7
  296. package/dist/src/stories/Page.stories.js +0 -19
  297. package/dist/src/stories/Page.stories.js.map +0 -1
  298. package/dist/src/stories/pd-loading-state.stories.d.ts +0 -30
  299. package/dist/src/stories/pd-loading-state.stories.js +0 -153
  300. package/dist/src/stories/pd-loading-state.stories.js.map +0 -1
  301. package/dist/src/stories/pd-toast.stories.d.ts +0 -23
  302. package/dist/src/stories/pd-toast.stories.js +0 -34
  303. package/dist/src/stories/pd-toast.stories.js.map +0 -1
  304. package/dist/src/tmpown/pd-loading-state.d.ts +0 -9
  305. package/dist/src/tmpown/pd-loading-state.js.map +0 -1
  306. package/dist/src/tmpown/pd-login.d.ts +0 -14
  307. package/dist/src/tmpown/pd-login.js.map +0 -1
  308. package/dist/src/tmpown/pd-panel-viewer.d.ts +0 -18
  309. package/dist/src/tmpown/pd-panel-viewer.js +0 -188
  310. package/dist/src/tmpown/pd-panel-viewer.js.map +0 -1
  311. package/dist/src/tmpown/pd-panel.d.ts +0 -5
  312. package/dist/src/tmpown/pd-panel.js +0 -41
  313. package/dist/src/tmpown/pd-panel.js.map +0 -1
  314. package/dist/src/tmpown/pd-toast.d.ts +0 -12
  315. package/dist/src/tmpown/pd-toast.js.map +0 -1
  316. package/dist/stories/index.stories.d.ts +0 -33
  317. package/dist/stories/index.stories.js +0 -37
  318. package/dist/stories/index.stories.js.map +0 -1
  319. package/dist/test/pd-spa-helper.test.d.ts +0 -1
  320. package/dist/test/pd-spa-helper.test.js +0 -22
  321. package/dist/test/pd-spa-helper.test.js.map +0 -1
  322. package/dist/tsconfig.tsbuildinfo +0 -1
  323. package/index.d.ts +0 -15
  324. package/lit-localize.json +0 -15
  325. package/pd-spa-helper.iml +0 -9
  326. package/src/PdSpaHelper.ts +0 -619
  327. package/src/defaultpage/default-confirm-popup.ts +0 -78
  328. package/src/defaultpage/default-dialog-popup.ts +0 -105
  329. package/src/defaultpage/default-login.ts +0 -41
  330. package/src/defaultpage/default-popup.ts +0 -26
  331. package/src/defaultpage/default-step-address.ts +0 -57
  332. package/src/defaultpage/default-step-summary.ts +0 -88
  333. package/src/defaultpage/default-view-page.ts +0 -58
  334. package/src/defaultpage/default-wizard-step.ts +0 -142
  335. package/src/defaultpage/default-wizard.ts +0 -273
  336. package/src/generated/locale-codes.ts +0 -27
  337. package/src/generated/locale-wrapper/be-wrapper.ts +0 -13
  338. package/src/generated/locale-wrapper/de-wrapper.ts +0 -11
  339. package/src/generated/locale-wrapper/en-wrapper.ts +0 -13
  340. package/src/generated/locales/be.ts +0 -26
  341. package/src/generated/locales/de.ts +0 -26
  342. package/src/generated/locales/en.ts +0 -26
  343. package/src/helper/helper-utils.ts +0 -35
  344. package/src/index.ts +0 -66
  345. package/src/model/spa-model.ts +0 -20
  346. package/src/pd-spa-helper.ts +0 -3
  347. package/src/popup/wizard-close-popup.ts +0 -52
  348. package/src/popup/wizard-reload-popup.ts +0 -69
  349. package/src/router/AppMain.ts +0 -10
  350. package/src/service-call-controller2.ts +0 -68
  351. package/src/service-provider/firebase/auth.ts +0 -89
  352. package/src/service-provider/firebase/firestorage-client.ts +0 -327
  353. package/src/service-provider/firebase/firestore-client.ts +0 -40
  354. package/src/service-provider/firebase/functions-client.ts +0 -73
  355. package/src/service-provider/firebase/messagingFirebaseClient.ts +0 -102
  356. package/src/service-provider/mock/auth.ts +0 -86
  357. package/src/service-provider/mock/function-client.ts +0 -42
  358. package/src/service-provider/mock/storage-client.ts +0 -149
  359. package/src/service-provider/service-provider-impl.ts +0 -286
  360. package/src/service-provider/service-provider-model.ts +0 -163
  361. package/src/store/indexDB.ts +0 -244
  362. package/src/store/mini-rx.store.ts +0 -48
  363. package/src/store/spa-app-actions.ts +0 -36
  364. package/src/store/spa-app-effects.ts +0 -73
  365. package/src/store/spa-app-reducer.ts +0 -86
  366. package/src/store/spa-app-selector.ts +0 -41
  367. package/src/stories/pd-loading-state.stories.ts +0 -168
  368. package/src/stories/pd-toast.stories.ts +0 -43
  369. package/src/tmpown/pd-loading-state.ts +0 -177
  370. package/src/tmpown/pd-login.ts +0 -131
  371. package/src/tmpown/pd-panel-viewer.ts +0 -193
  372. package/src/tmpown/pd-panel.ts +0 -43
  373. package/src/tmpown/pd-toast.ts +0 -118
  374. package/test/pd-spa-helper.test.ts +0 -26
  375. package/tsconfig.json +0 -22
  376. package/web-dev-server.config.mjs +0 -27
  377. package/web-test-runner.config.mjs +0 -41
  378. package/xliff/be.xlf +0 -60
  379. package/xliff/de.xlf +0 -46
  380. package/xliff/en.xlf +0 -58
@@ -0,0 +1,863 @@
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
+ };