@progressive-development/pd-spa-helper 0.4.0 → 0.5.1

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 (198) hide show
  1. package/dist/PdSpaHelper.d.ts.map +1 -1
  2. package/dist/{src/PdSpaHelper.js → PdSpaHelper.js} +16 -17
  3. package/dist/defaultpage/default-confirm-popup.d.ts.map +1 -1
  4. package/dist/{src/defaultpage → defaultpage}/default-confirm-popup.js +4 -5
  5. package/dist/defaultpage/default-dialog-popup.d.ts.map +1 -1
  6. package/dist/{src/defaultpage → defaultpage}/default-dialog-popup.js +4 -5
  7. package/dist/{src/defaultpage → defaultpage}/default-login.js +2 -3
  8. package/dist/defaultpage/default-popup.d.ts.map +1 -1
  9. package/dist/{src/defaultpage → defaultpage}/default-popup.js +1 -1
  10. package/dist/{src/defaultpage → defaultpage}/default-step-address.js +5 -6
  11. package/dist/{src/defaultpage → defaultpage}/default-step-summary.js +6 -7
  12. package/dist/{src/defaultpage → defaultpage}/default-view-page.js +2 -3
  13. package/dist/{src/defaultpage → defaultpage}/default-wizard-step.js +4 -5
  14. package/dist/defaultpage/default-wizard.d.ts.map +1 -1
  15. package/dist/{src/defaultpage → defaultpage}/default-wizard.js +7 -8
  16. package/dist/generated/locale-wrapper/be-wrapper.d.ts +15 -1
  17. package/dist/generated/locale-wrapper/be-wrapper.d.ts.map +1 -1
  18. package/dist/generated/locale-wrapper/be-wrapper.js +17 -0
  19. package/dist/generated/locale-wrapper/de-wrapper.d.ts.map +1 -1
  20. package/dist/generated/locale-wrapper/de-wrapper.js +17 -0
  21. package/dist/generated/locale-wrapper/en-wrapper.d.ts +15 -1
  22. package/dist/generated/locale-wrapper/en-wrapper.d.ts.map +1 -1
  23. package/dist/generated/locale-wrapper/en-wrapper.js +17 -0
  24. package/dist/index.d.ts +2 -0
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +21 -21
  27. package/dist/pd-panel-viewer.js +10 -12
  28. package/dist/pd-panel.js +2 -3
  29. package/dist/{src/popup → popup}/wizard-close-popup.js +3 -5
  30. package/dist/{src/popup → popup}/wizard-reload-popup.js +3 -5
  31. package/dist/{src/router → router}/AppMain.js +4 -5
  32. package/dist/{src/service-provider → service-provider}/firebase/auth.js +1 -4
  33. package/dist/{src/service-provider → service-provider}/firebase/firestorage-client.js +1 -1
  34. package/dist/{src/service-provider → service-provider}/firebase/firestore-client.js +1 -1
  35. package/dist/{src/service-provider → service-provider}/firebase/functions-client.js +1 -1
  36. package/dist/{src/service-provider → service-provider}/firebase/messagingFirebaseClient.js +2 -2
  37. package/dist/{src/service-provider → service-provider}/service-provider-impl.js +1 -2
  38. package/dist/{src/store → store}/mini-rx.store.js +1 -1
  39. package/dist/{src/store → store}/spa-app-effects.js +2 -2
  40. package/dist/{src/store → store}/spa-app-selector.js +1 -1
  41. package/dist/stories/pd-loading-state.stories.d.ts +3 -3
  42. package/dist/stories/pd-toast.stories.d.ts +3 -3
  43. package/dist/tmpown/pd-loading-state.d.ts.map +1 -1
  44. package/dist/{src/tmpown → tmpown}/pd-loading-state.js +6 -8
  45. package/dist/tmpown/pd-login.d.ts.map +1 -1
  46. package/dist/{src/tmpown → tmpown}/pd-login.js +6 -7
  47. package/dist/tmpown/pd-panel-viewer.d.ts.map +1 -1
  48. package/dist/{src/tmpown → tmpown}/pd-toast.js +5 -7
  49. package/package.json +29 -23
  50. package/dist/node_modules/@firebase/app/dist/esm/index.esm2017.js +0 -749
  51. package/dist/node_modules/@firebase/auth/dist/esm2017/index-68602d24.js +0 -6265
  52. package/dist/node_modules/@firebase/component/dist/esm/index.esm2017.js +0 -341
  53. package/dist/node_modules/@firebase/firestore/dist/index.esm2017.js +0 -10250
  54. package/dist/node_modules/@firebase/functions/dist/index.esm2017.js +0 -513
  55. package/dist/node_modules/@firebase/installations/dist/esm/index.esm2017.js +0 -863
  56. package/dist/node_modules/@firebase/logger/dist/esm/index.esm2017.js +0 -122
  57. package/dist/node_modules/@firebase/messaging/dist/esm/index.esm2017.js +0 -1019
  58. package/dist/node_modules/@firebase/storage/dist/index.esm2017.js +0 -2042
  59. package/dist/node_modules/@firebase/util/dist/index.esm2017.js +0 -931
  60. package/dist/node_modules/@firebase/webchannel-wrapper/dist/bloom-blob/esm/bloom_blob_es2018.js +0 -417
  61. package/dist/node_modules/@firebase/webchannel-wrapper/dist/webchannel-blob/esm/webchannel_blob_es2018.js +0 -2155
  62. package/dist/node_modules/@lit/reactive-element/decorators/custom-element.js +0 -14
  63. package/dist/node_modules/@lit/reactive-element/decorators/property.js +0 -20
  64. package/dist/node_modules/@lit/reactive-element/decorators/query-assigned-elements.js +0 -7
  65. package/dist/node_modules/@progressive-development/pd-dialog/pd-popup-dialog.js +0 -5
  66. package/dist/node_modules/@progressive-development/pd-dialog/pd-popup.js +0 -2
  67. package/dist/node_modules/@progressive-development/pd-dialog/src/PdPopup.js +0 -113
  68. package/dist/node_modules/@progressive-development/pd-dialog/src/PdPopupDialog.js +0 -189
  69. package/dist/node_modules/@progressive-development/pd-forms/pd-button.js +0 -2
  70. package/dist/node_modules/@progressive-development/pd-forms/pd-form-container.js +0 -2
  71. package/dist/node_modules/@progressive-development/pd-forms/pd-form-row.js +0 -2
  72. package/dist/node_modules/@progressive-development/pd-forms/pd-hover-box.js +0 -2
  73. package/dist/node_modules/@progressive-development/pd-forms/pd-input.js +0 -2
  74. package/dist/node_modules/@progressive-development/pd-forms/src/PdBaseInputElement.js +0 -86
  75. package/dist/node_modules/@progressive-development/pd-forms/src/PdBaseUi.js +0 -34
  76. package/dist/node_modules/@progressive-development/pd-forms/src/PdBaseUiInput.js +0 -227
  77. package/dist/node_modules/@progressive-development/pd-forms/src/PdButton.js +0 -194
  78. package/dist/node_modules/@progressive-development/pd-forms/src/PdFormContainer.js +0 -167
  79. package/dist/node_modules/@progressive-development/pd-forms/src/PdFormRow.js +0 -92
  80. package/dist/node_modules/@progressive-development/pd-forms/src/PdHoverBox.js +0 -108
  81. package/dist/node_modules/@progressive-development/pd-forms/src/PdInput.js +0 -79
  82. package/dist/node_modules/@progressive-development/pd-forms/src/generated/locale/be.js +0 -11
  83. package/dist/node_modules/@progressive-development/pd-forms/src/generated/locale/en.js +0 -11
  84. package/dist/node_modules/@progressive-development/pd-forms/src/shared-input-field-styles.js +0 -152
  85. package/dist/node_modules/@progressive-development/pd-forms/src/shared-input-styles.js +0 -64
  86. package/dist/node_modules/@progressive-development/pd-icon/pd-icon.js +0 -4
  87. package/dist/node_modules/@progressive-development/pd-icon/src/PdIcon.js +0 -596
  88. package/dist/node_modules/@progressive-development/pd-order/dist/locales/be.js +0 -15
  89. package/dist/node_modules/@progressive-development/pd-order/dist/locales/de.js +0 -15
  90. package/dist/node_modules/@progressive-development/pd-order/dist/locales/en.js +0 -15
  91. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-contact/pd-contact.js +0 -2
  92. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-contact/src/PdContact.js +0 -567
  93. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-content/pd-collapse.js +0 -2
  94. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-content/pd-edit-content.js +0 -2
  95. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-content/src/PdCollapse.js +0 -136
  96. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-content/src/PdEditContent.js +0 -224
  97. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-dialog/pd-popup.js +0 -2
  98. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-dialog/src/PdPopup.js +0 -113
  99. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/pd-checkbox.js +0 -2
  100. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/pd-form-container.js +0 -2
  101. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/pd-form-row.js +0 -2
  102. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/pd-hover-box.js +0 -2
  103. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/pd-input.js +0 -2
  104. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/pd-radio-group.js +0 -2
  105. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdBaseInputElement.js +0 -86
  106. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdBaseUi.js +0 -34
  107. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdBaseUiInput.js +0 -229
  108. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdCheckbox.js +0 -230
  109. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdFormContainer.js +0 -167
  110. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdFormRow.js +0 -92
  111. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdHoverBox.js +0 -108
  112. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdInput.js +0 -79
  113. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdRadioGroup.js +0 -72
  114. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/shared-input-field-styles.js +0 -152
  115. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/shared-input-styles.js +0 -64
  116. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-icon/pd-icon.js +0 -4
  117. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-icon/src/PdIcon.js +0 -596
  118. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-price/pd-pricetable.js +0 -2
  119. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-price/src/PdPricetable.js +0 -149
  120. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/fecha/lib/fecha.js +0 -200
  121. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/lit/node_modules/lit-html/directive.js +0 -27
  122. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/lit/node_modules/lit-html/directives/class-map.js +0 -36
  123. package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/lit/node_modules/lit-html/lit-html.js +0 -242
  124. package/dist/node_modules/@progressive-development/pd-order/dist/pd-order-contacts.js +0 -2
  125. package/dist/node_modules/@progressive-development/pd-order/dist/pd-order-summary.js +0 -2
  126. package/dist/node_modules/@progressive-development/pd-order/dist/src/PdOrderContacts.js +0 -192
  127. package/dist/node_modules/@progressive-development/pd-order/dist/src/PdOrderSummary.js +0 -243
  128. package/dist/node_modules/@progressive-development/pd-page/pd-footer.js +0 -2
  129. package/dist/node_modules/@progressive-development/pd-page/pd-menu.js +0 -2
  130. package/dist/node_modules/@progressive-development/pd-page/src/PdFooter.js +0 -141
  131. package/dist/node_modules/@progressive-development/pd-page/src/PdMenu.js +0 -450
  132. package/dist/node_modules/@progressive-development/pd-shared-styles/src/shared-color-styles.js +0 -30
  133. package/dist/node_modules/@progressive-development/pd-shared-styles/src/shared-font-styles.js +0 -32
  134. package/dist/node_modules/@progressive-development/pd-wizard/pd-wizard.js +0 -2
  135. package/dist/node_modules/@progressive-development/pd-wizard/src/PdSteps.js +0 -191
  136. package/dist/node_modules/@progressive-development/pd-wizard/src/PdWizard.js +0 -280
  137. package/dist/node_modules/firebase/app/dist/esm/index.esm.js +0 -35
  138. package/dist/node_modules/idb/build/index.js +0 -81
  139. package/dist/node_modules/idb/build/wrap-idb-value.js +0 -148
  140. package/dist/node_modules/lit/node_modules/lit-html/directive.js +0 -27
  141. package/dist/node_modules/lit/node_modules/lit-html/directives/class-map.js +0 -36
  142. package/dist/node_modules/lit/node_modules/lit-html/lit-html.js +0 -242
  143. package/dist/node_modules/lit-element-router/lit-element-router.js +0 -131
  144. package/dist/node_modules/lit-element-router/utility/router-utility.js +0 -36
  145. package/dist/node_modules/mini-rx-store/index.esm.js +0 -458
  146. package/dist/node_modules/pwa-helpers/media-query.js +0 -17
  147. package/dist/node_modules/rxjs/dist/esm5/internal/Observable.js +0 -100
  148. package/dist/node_modules/rxjs/dist/esm5/internal/Subscriber.js +0 -147
  149. package/dist/node_modules/rxjs/dist/esm5/internal/Subscription.js +0 -139
  150. package/dist/node_modules/rxjs/dist/esm5/internal/config.js +0 -10
  151. package/dist/node_modules/rxjs/dist/esm5/internal/observable/innerFrom.js +0 -159
  152. package/dist/node_modules/rxjs/dist/esm5/internal/operators/OperatorSubscriber.js +0 -52
  153. package/dist/node_modules/rxjs/dist/esm5/internal/operators/catchError.js +0 -28
  154. package/dist/node_modules/rxjs/dist/esm5/internal/operators/distinctUntilChanged.js +0 -27
  155. package/dist/node_modules/rxjs/dist/esm5/internal/operators/filter.js +0 -13
  156. package/dist/node_modules/rxjs/dist/esm5/internal/operators/map.js +0 -13
  157. package/dist/node_modules/rxjs/dist/esm5/internal/operators/observeOn.js +0 -26
  158. package/dist/node_modules/rxjs/dist/esm5/internal/operators/tap.js +0 -36
  159. package/dist/node_modules/rxjs/dist/esm5/internal/operators/withLatestFrom.js +0 -43
  160. package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js +0 -18
  161. package/dist/node_modules/rxjs/dist/esm5/internal/symbol/iterator.js +0 -11
  162. package/dist/node_modules/rxjs/dist/esm5/internal/symbol/observable.js +0 -6
  163. package/dist/node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js +0 -14
  164. package/dist/node_modules/rxjs/dist/esm5/internal/util/args.js +0 -10
  165. package/dist/node_modules/rxjs/dist/esm5/internal/util/arrRemove.js +0 -9
  166. package/dist/node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js +0 -13
  167. package/dist/node_modules/rxjs/dist/esm5/internal/util/errorContext.js +0 -8
  168. package/dist/node_modules/rxjs/dist/esm5/internal/util/executeSchedule.js +0 -23
  169. package/dist/node_modules/rxjs/dist/esm5/internal/util/identity.js +0 -6
  170. package/dist/node_modules/rxjs/dist/esm5/internal/util/isArrayLike.js +0 -6
  171. package/dist/node_modules/rxjs/dist/esm5/internal/util/isAsyncIterable.js +0 -7
  172. package/dist/node_modules/rxjs/dist/esm5/internal/util/isFunction.js +0 -6
  173. package/dist/node_modules/rxjs/dist/esm5/internal/util/isInteropObservable.js +0 -8
  174. package/dist/node_modules/rxjs/dist/esm5/internal/util/isIterable.js +0 -8
  175. package/dist/node_modules/rxjs/dist/esm5/internal/util/isPromise.js +0 -7
  176. package/dist/node_modules/rxjs/dist/esm5/internal/util/isReadableStreamLike.js +0 -46
  177. package/dist/node_modules/rxjs/dist/esm5/internal/util/lift.js +0 -22
  178. package/dist/node_modules/rxjs/dist/esm5/internal/util/noop.js +0 -5
  179. package/dist/node_modules/rxjs/dist/esm5/internal/util/pipe.js +0 -17
  180. package/dist/node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js +0 -11
  181. package/dist/node_modules/rxjs/dist/esm5/internal/util/throwUnobservableError.js +0 -6
  182. package/dist/pd-spa-helper.d.ts +0 -1
  183. package/dist/pd-spa-helper.d.ts.map +0 -1
  184. package/dist/src/generated/locale-wrapper/be-wrapper.js +0 -15
  185. package/dist/src/generated/locale-wrapper/de-wrapper.js +0 -13
  186. package/dist/src/generated/locale-wrapper/en-wrapper.js +0 -15
  187. /package/dist/{src/generated → generated}/locales/be.js +0 -0
  188. /package/dist/{src/generated → generated}/locales/de.js +0 -0
  189. /package/dist/{src/generated → generated}/locales/en.js +0 -0
  190. /package/dist/{src/helper → helper}/helper-utils.js +0 -0
  191. /package/dist/{src/model → model}/spa-model.js +0 -0
  192. /package/dist/{src/service-provider → service-provider}/mock/auth.js +0 -0
  193. /package/dist/{src/service-provider → service-provider}/mock/function-client.js +0 -0
  194. /package/dist/{src/service-provider → service-provider}/mock/storage-client.js +0 -0
  195. /package/dist/{src/service-provider → service-provider}/service-provider-model.js +0 -0
  196. /package/dist/{src/store → store}/indexDB.js +0 -0
  197. /package/dist/{src/store → store}/spa-app-actions.js +0 -0
  198. /package/dist/{src/store → store}/spa-app-reducer.js +0 -0
@@ -1,513 +0,0 @@
1
- import { _registerComponent, registerVersion, _getProvider, getApp } from "../../app/dist/esm/index.esm2017.js";
2
- import { getModularInstance, getDefaultEmulatorHostnameAndPort, FirebaseError } from "../../util/dist/index.esm2017.js";
3
- import { Component } from "../../component/dist/esm/index.esm2017.js";
4
- /**
5
- * @license
6
- * Copyright 2017 Google LLC
7
- *
8
- * Licensed under the Apache License, Version 2.0 (the "License");
9
- * you may not use this file except in compliance with the License.
10
- * You may obtain a copy of the License at
11
- *
12
- * http://www.apache.org/licenses/LICENSE-2.0
13
- *
14
- * Unless required by applicable law or agreed to in writing, software
15
- * distributed under the License is distributed on an "AS IS" BASIS,
16
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
- * See the License for the specific language governing permissions and
18
- * limitations under the License.
19
- */
20
- const LONG_TYPE = "type.googleapis.com/google.protobuf.Int64Value";
21
- const UNSIGNED_LONG_TYPE = "type.googleapis.com/google.protobuf.UInt64Value";
22
- function mapValues(o, f) {
23
- const result = {};
24
- for (const key in o) {
25
- if (o.hasOwnProperty(key)) {
26
- result[key] = f(o[key]);
27
- }
28
- }
29
- return result;
30
- }
31
- function encode(data) {
32
- if (data == null) {
33
- return null;
34
- }
35
- if (data instanceof Number) {
36
- data = data.valueOf();
37
- }
38
- if (typeof data === "number" && isFinite(data)) {
39
- return data;
40
- }
41
- if (data === true || data === false) {
42
- return data;
43
- }
44
- if (Object.prototype.toString.call(data) === "[object String]") {
45
- return data;
46
- }
47
- if (data instanceof Date) {
48
- return data.toISOString();
49
- }
50
- if (Array.isArray(data)) {
51
- return data.map((x) => encode(x));
52
- }
53
- if (typeof data === "function" || typeof data === "object") {
54
- return mapValues(data, (x) => encode(x));
55
- }
56
- throw new Error("Data cannot be encoded in JSON: " + data);
57
- }
58
- function decode(json) {
59
- if (json == null) {
60
- return json;
61
- }
62
- if (json["@type"]) {
63
- switch (json["@type"]) {
64
- case LONG_TYPE:
65
- case UNSIGNED_LONG_TYPE: {
66
- const value = Number(json["value"]);
67
- if (isNaN(value)) {
68
- throw new Error("Data cannot be decoded from JSON: " + json);
69
- }
70
- return value;
71
- }
72
- default: {
73
- throw new Error("Data cannot be decoded from JSON: " + json);
74
- }
75
- }
76
- }
77
- if (Array.isArray(json)) {
78
- return json.map((x) => decode(x));
79
- }
80
- if (typeof json === "function" || typeof json === "object") {
81
- return mapValues(json, (x) => decode(x));
82
- }
83
- return json;
84
- }
85
- /**
86
- * @license
87
- * Copyright 2020 Google LLC
88
- *
89
- * Licensed under the Apache License, Version 2.0 (the "License");
90
- * you may not use this file except in compliance with the License.
91
- * You may obtain a copy of the License at
92
- *
93
- * http://www.apache.org/licenses/LICENSE-2.0
94
- *
95
- * Unless required by applicable law or agreed to in writing, software
96
- * distributed under the License is distributed on an "AS IS" BASIS,
97
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
98
- * See the License for the specific language governing permissions and
99
- * limitations under the License.
100
- */
101
- const FUNCTIONS_TYPE = "functions";
102
- /**
103
- * @license
104
- * Copyright 2017 Google LLC
105
- *
106
- * Licensed under the Apache License, Version 2.0 (the "License");
107
- * you may not use this file except in compliance with the License.
108
- * You may obtain a copy of the License at
109
- *
110
- * http://www.apache.org/licenses/LICENSE-2.0
111
- *
112
- * Unless required by applicable law or agreed to in writing, software
113
- * distributed under the License is distributed on an "AS IS" BASIS,
114
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
115
- * See the License for the specific language governing permissions and
116
- * limitations under the License.
117
- */
118
- const errorCodeMap = {
119
- OK: "ok",
120
- CANCELLED: "cancelled",
121
- UNKNOWN: "unknown",
122
- INVALID_ARGUMENT: "invalid-argument",
123
- DEADLINE_EXCEEDED: "deadline-exceeded",
124
- NOT_FOUND: "not-found",
125
- ALREADY_EXISTS: "already-exists",
126
- PERMISSION_DENIED: "permission-denied",
127
- UNAUTHENTICATED: "unauthenticated",
128
- RESOURCE_EXHAUSTED: "resource-exhausted",
129
- FAILED_PRECONDITION: "failed-precondition",
130
- ABORTED: "aborted",
131
- OUT_OF_RANGE: "out-of-range",
132
- UNIMPLEMENTED: "unimplemented",
133
- INTERNAL: "internal",
134
- UNAVAILABLE: "unavailable",
135
- DATA_LOSS: "data-loss"
136
- };
137
- class FunctionsError extends FirebaseError {
138
- constructor(code, message, details) {
139
- super(`${FUNCTIONS_TYPE}/${code}`, message || "");
140
- this.details = details;
141
- }
142
- }
143
- function codeForHTTPStatus(status) {
144
- if (status >= 200 && status < 300) {
145
- return "ok";
146
- }
147
- switch (status) {
148
- case 0:
149
- return "internal";
150
- case 400:
151
- return "invalid-argument";
152
- case 401:
153
- return "unauthenticated";
154
- case 403:
155
- return "permission-denied";
156
- case 404:
157
- return "not-found";
158
- case 409:
159
- return "aborted";
160
- case 429:
161
- return "resource-exhausted";
162
- case 499:
163
- return "cancelled";
164
- case 500:
165
- return "internal";
166
- case 501:
167
- return "unimplemented";
168
- case 503:
169
- return "unavailable";
170
- case 504:
171
- return "deadline-exceeded";
172
- }
173
- return "unknown";
174
- }
175
- function _errorForResponse(status, bodyJSON) {
176
- let code = codeForHTTPStatus(status);
177
- let description = code;
178
- let details = void 0;
179
- try {
180
- const errorJSON = bodyJSON && bodyJSON.error;
181
- if (errorJSON) {
182
- const status2 = errorJSON.status;
183
- if (typeof status2 === "string") {
184
- if (!errorCodeMap[status2]) {
185
- return new FunctionsError("internal", "internal");
186
- }
187
- code = errorCodeMap[status2];
188
- description = status2;
189
- }
190
- const message = errorJSON.message;
191
- if (typeof message === "string") {
192
- description = message;
193
- }
194
- details = errorJSON.details;
195
- if (details !== void 0) {
196
- details = decode(details);
197
- }
198
- }
199
- } catch (e) {
200
- }
201
- if (code === "ok") {
202
- return null;
203
- }
204
- return new FunctionsError(code, description, details);
205
- }
206
- /**
207
- * @license
208
- * Copyright 2017 Google LLC
209
- *
210
- * Licensed under the Apache License, Version 2.0 (the "License");
211
- * you may not use this file except in compliance with the License.
212
- * You may obtain a copy of the License at
213
- *
214
- * http://www.apache.org/licenses/LICENSE-2.0
215
- *
216
- * Unless required by applicable law or agreed to in writing, software
217
- * distributed under the License is distributed on an "AS IS" BASIS,
218
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
219
- * See the License for the specific language governing permissions and
220
- * limitations under the License.
221
- */
222
- class ContextProvider {
223
- constructor(authProvider, messagingProvider, appCheckProvider) {
224
- this.auth = null;
225
- this.messaging = null;
226
- this.appCheck = null;
227
- this.auth = authProvider.getImmediate({ optional: true });
228
- this.messaging = messagingProvider.getImmediate({
229
- optional: true
230
- });
231
- if (!this.auth) {
232
- authProvider.get().then((auth) => this.auth = auth, () => {
233
- });
234
- }
235
- if (!this.messaging) {
236
- messagingProvider.get().then((messaging) => this.messaging = messaging, () => {
237
- });
238
- }
239
- if (!this.appCheck) {
240
- appCheckProvider.get().then((appCheck) => this.appCheck = appCheck, () => {
241
- });
242
- }
243
- }
244
- async getAuthToken() {
245
- if (!this.auth) {
246
- return void 0;
247
- }
248
- try {
249
- const token = await this.auth.getToken();
250
- return token === null || token === void 0 ? void 0 : token.accessToken;
251
- } catch (e) {
252
- return void 0;
253
- }
254
- }
255
- async getMessagingToken() {
256
- if (!this.messaging || !("Notification" in self) || Notification.permission !== "granted") {
257
- return void 0;
258
- }
259
- try {
260
- return await this.messaging.getToken();
261
- } catch (e) {
262
- return void 0;
263
- }
264
- }
265
- async getAppCheckToken(limitedUseAppCheckTokens) {
266
- if (this.appCheck) {
267
- const result = limitedUseAppCheckTokens ? await this.appCheck.getLimitedUseToken() : await this.appCheck.getToken();
268
- if (result.error) {
269
- return null;
270
- }
271
- return result.token;
272
- }
273
- return null;
274
- }
275
- async getContext(limitedUseAppCheckTokens) {
276
- const authToken = await this.getAuthToken();
277
- const messagingToken = await this.getMessagingToken();
278
- const appCheckToken = await this.getAppCheckToken(limitedUseAppCheckTokens);
279
- return { authToken, messagingToken, appCheckToken };
280
- }
281
- }
282
- /**
283
- * @license
284
- * Copyright 2017 Google LLC
285
- *
286
- * Licensed under the Apache License, Version 2.0 (the "License");
287
- * you may not use this file except in compliance with the License.
288
- * You may obtain a copy of the License at
289
- *
290
- * http://www.apache.org/licenses/LICENSE-2.0
291
- *
292
- * Unless required by applicable law or agreed to in writing, software
293
- * distributed under the License is distributed on an "AS IS" BASIS,
294
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
295
- * See the License for the specific language governing permissions and
296
- * limitations under the License.
297
- */
298
- const DEFAULT_REGION = "us-central1";
299
- function failAfter(millis) {
300
- let timer = null;
301
- return {
302
- promise: new Promise((_, reject) => {
303
- timer = setTimeout(() => {
304
- reject(new FunctionsError("deadline-exceeded", "deadline-exceeded"));
305
- }, millis);
306
- }),
307
- cancel: () => {
308
- if (timer) {
309
- clearTimeout(timer);
310
- }
311
- }
312
- };
313
- }
314
- class FunctionsService {
315
- /**
316
- * Creates a new Functions service for the given app.
317
- * @param app - The FirebaseApp to use.
318
- */
319
- constructor(app, authProvider, messagingProvider, appCheckProvider, regionOrCustomDomain = DEFAULT_REGION, fetchImpl) {
320
- this.app = app;
321
- this.fetchImpl = fetchImpl;
322
- this.emulatorOrigin = null;
323
- this.contextProvider = new ContextProvider(authProvider, messagingProvider, appCheckProvider);
324
- this.cancelAllRequests = new Promise((resolve) => {
325
- this.deleteService = () => {
326
- return Promise.resolve(resolve());
327
- };
328
- });
329
- try {
330
- const url = new URL(regionOrCustomDomain);
331
- this.customDomain = url.origin + (url.pathname === "/" ? "" : url.pathname);
332
- this.region = DEFAULT_REGION;
333
- } catch (e) {
334
- this.customDomain = null;
335
- this.region = regionOrCustomDomain;
336
- }
337
- }
338
- _delete() {
339
- return this.deleteService();
340
- }
341
- /**
342
- * Returns the URL for a callable with the given name.
343
- * @param name - The name of the callable.
344
- * @internal
345
- */
346
- _url(name2) {
347
- const projectId = this.app.options.projectId;
348
- if (this.emulatorOrigin !== null) {
349
- const origin = this.emulatorOrigin;
350
- return `${origin}/${projectId}/${this.region}/${name2}`;
351
- }
352
- if (this.customDomain !== null) {
353
- return `${this.customDomain}/${name2}`;
354
- }
355
- return `https://${this.region}-${projectId}.cloudfunctions.net/${name2}`;
356
- }
357
- }
358
- function connectFunctionsEmulator$1(functionsInstance, host, port) {
359
- functionsInstance.emulatorOrigin = `http://${host}:${port}`;
360
- }
361
- function httpsCallable$1(functionsInstance, name2, options) {
362
- return (data) => {
363
- return call(functionsInstance, name2, data, {});
364
- };
365
- }
366
- async function postJSON(url, body, headers, fetchImpl) {
367
- headers["Content-Type"] = "application/json";
368
- let response;
369
- try {
370
- response = await fetchImpl(url, {
371
- method: "POST",
372
- body: JSON.stringify(body),
373
- headers
374
- });
375
- } catch (e) {
376
- return {
377
- status: 0,
378
- json: null
379
- };
380
- }
381
- let json = null;
382
- try {
383
- json = await response.json();
384
- } catch (e) {
385
- }
386
- return {
387
- status: response.status,
388
- json
389
- };
390
- }
391
- function call(functionsInstance, name2, data, options) {
392
- const url = functionsInstance._url(name2);
393
- return callAtURL(functionsInstance, url, data, options);
394
- }
395
- async function callAtURL(functionsInstance, url, data, options) {
396
- data = encode(data);
397
- const body = { data };
398
- const headers = {};
399
- const context = await functionsInstance.contextProvider.getContext(options.limitedUseAppCheckTokens);
400
- if (context.authToken) {
401
- headers["Authorization"] = "Bearer " + context.authToken;
402
- }
403
- if (context.messagingToken) {
404
- headers["Firebase-Instance-ID-Token"] = context.messagingToken;
405
- }
406
- if (context.appCheckToken !== null) {
407
- headers["X-Firebase-AppCheck"] = context.appCheckToken;
408
- }
409
- const timeout = options.timeout || 7e4;
410
- const failAfterHandle = failAfter(timeout);
411
- const response = await Promise.race([
412
- postJSON(url, body, headers, functionsInstance.fetchImpl),
413
- failAfterHandle.promise,
414
- functionsInstance.cancelAllRequests
415
- ]);
416
- failAfterHandle.cancel();
417
- if (!response) {
418
- throw new FunctionsError("cancelled", "Firebase Functions instance was deleted.");
419
- }
420
- const error = _errorForResponse(response.status, response.json);
421
- if (error) {
422
- throw error;
423
- }
424
- if (!response.json) {
425
- throw new FunctionsError("internal", "Response is not valid JSON object.");
426
- }
427
- let responseData = response.json.data;
428
- if (typeof responseData === "undefined") {
429
- responseData = response.json.result;
430
- }
431
- if (typeof responseData === "undefined") {
432
- throw new FunctionsError("internal", "Response is missing data field.");
433
- }
434
- const decodedData = decode(responseData);
435
- return { data: decodedData };
436
- }
437
- const name = "@firebase/functions";
438
- const version = "0.11.8";
439
- /**
440
- * @license
441
- * Copyright 2019 Google LLC
442
- *
443
- * Licensed under the Apache License, Version 2.0 (the "License");
444
- * you may not use this file except in compliance with the License.
445
- * You may obtain a copy of the License at
446
- *
447
- * http://www.apache.org/licenses/LICENSE-2.0
448
- *
449
- * Unless required by applicable law or agreed to in writing, software
450
- * distributed under the License is distributed on an "AS IS" BASIS,
451
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
452
- * See the License for the specific language governing permissions and
453
- * limitations under the License.
454
- */
455
- const AUTH_INTERNAL_NAME = "auth-internal";
456
- const APP_CHECK_INTERNAL_NAME = "app-check-internal";
457
- const MESSAGING_INTERNAL_NAME = "messaging-internal";
458
- function registerFunctions(fetchImpl, variant) {
459
- const factory = (container, { instanceIdentifier: regionOrCustomDomain }) => {
460
- const app = container.getProvider("app").getImmediate();
461
- const authProvider = container.getProvider(AUTH_INTERNAL_NAME);
462
- const messagingProvider = container.getProvider(MESSAGING_INTERNAL_NAME);
463
- const appCheckProvider = container.getProvider(APP_CHECK_INTERNAL_NAME);
464
- return new FunctionsService(app, authProvider, messagingProvider, appCheckProvider, regionOrCustomDomain, fetchImpl);
465
- };
466
- _registerComponent(new Component(
467
- FUNCTIONS_TYPE,
468
- factory,
469
- "PUBLIC"
470
- /* ComponentType.PUBLIC */
471
- ).setMultipleInstances(true));
472
- registerVersion(name, version, variant);
473
- registerVersion(name, version, "esm2017");
474
- }
475
- /**
476
- * @license
477
- * Copyright 2020 Google LLC
478
- *
479
- * Licensed under the Apache License, Version 2.0 (the "License");
480
- * you may not use this file except in compliance with the License.
481
- * You may obtain a copy of the License at
482
- *
483
- * http://www.apache.org/licenses/LICENSE-2.0
484
- *
485
- * Unless required by applicable law or agreed to in writing, software
486
- * distributed under the License is distributed on an "AS IS" BASIS,
487
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
488
- * See the License for the specific language governing permissions and
489
- * limitations under the License.
490
- */
491
- function getFunctions(app = getApp(), regionOrCustomDomain = DEFAULT_REGION) {
492
- const functionsProvider = _getProvider(getModularInstance(app), FUNCTIONS_TYPE);
493
- const functionsInstance = functionsProvider.getImmediate({
494
- identifier: regionOrCustomDomain
495
- });
496
- const emulator = getDefaultEmulatorHostnameAndPort("functions");
497
- if (emulator) {
498
- connectFunctionsEmulator(functionsInstance, ...emulator);
499
- }
500
- return functionsInstance;
501
- }
502
- function connectFunctionsEmulator(functionsInstance, host, port) {
503
- connectFunctionsEmulator$1(getModularInstance(functionsInstance), host, port);
504
- }
505
- function httpsCallable(functionsInstance, name2, options) {
506
- return httpsCallable$1(getModularInstance(functionsInstance), name2);
507
- }
508
- registerFunctions(fetch.bind(self));
509
- export {
510
- connectFunctionsEmulator,
511
- getFunctions,
512
- httpsCallable
513
- };