@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.
- package/dist/PdSpaHelper.d.ts.map +1 -1
- package/dist/{src/PdSpaHelper.js → PdSpaHelper.js} +16 -17
- package/dist/defaultpage/default-confirm-popup.d.ts.map +1 -1
- package/dist/{src/defaultpage → defaultpage}/default-confirm-popup.js +4 -5
- package/dist/defaultpage/default-dialog-popup.d.ts.map +1 -1
- package/dist/{src/defaultpage → defaultpage}/default-dialog-popup.js +4 -5
- package/dist/{src/defaultpage → defaultpage}/default-login.js +2 -3
- package/dist/defaultpage/default-popup.d.ts.map +1 -1
- package/dist/{src/defaultpage → defaultpage}/default-popup.js +1 -1
- package/dist/{src/defaultpage → defaultpage}/default-step-address.js +5 -6
- package/dist/{src/defaultpage → defaultpage}/default-step-summary.js +6 -7
- package/dist/{src/defaultpage → defaultpage}/default-view-page.js +2 -3
- package/dist/{src/defaultpage → defaultpage}/default-wizard-step.js +4 -5
- package/dist/defaultpage/default-wizard.d.ts.map +1 -1
- package/dist/{src/defaultpage → defaultpage}/default-wizard.js +7 -8
- package/dist/generated/locale-wrapper/be-wrapper.d.ts +15 -1
- package/dist/generated/locale-wrapper/be-wrapper.d.ts.map +1 -1
- package/dist/generated/locale-wrapper/be-wrapper.js +17 -0
- package/dist/generated/locale-wrapper/de-wrapper.d.ts.map +1 -1
- package/dist/generated/locale-wrapper/de-wrapper.js +17 -0
- package/dist/generated/locale-wrapper/en-wrapper.d.ts +15 -1
- package/dist/generated/locale-wrapper/en-wrapper.d.ts.map +1 -1
- package/dist/generated/locale-wrapper/en-wrapper.js +17 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -21
- package/dist/pd-panel-viewer.js +10 -12
- package/dist/pd-panel.js +2 -3
- package/dist/{src/popup → popup}/wizard-close-popup.js +3 -5
- package/dist/{src/popup → popup}/wizard-reload-popup.js +3 -5
- package/dist/{src/router → router}/AppMain.js +4 -5
- package/dist/{src/service-provider → service-provider}/firebase/auth.js +1 -4
- package/dist/{src/service-provider → service-provider}/firebase/firestorage-client.js +1 -1
- package/dist/{src/service-provider → service-provider}/firebase/firestore-client.js +1 -1
- package/dist/{src/service-provider → service-provider}/firebase/functions-client.js +1 -1
- package/dist/{src/service-provider → service-provider}/firebase/messagingFirebaseClient.js +2 -2
- package/dist/{src/service-provider → service-provider}/service-provider-impl.js +1 -2
- package/dist/{src/store → store}/mini-rx.store.js +1 -1
- package/dist/{src/store → store}/spa-app-effects.js +2 -2
- package/dist/{src/store → store}/spa-app-selector.js +1 -1
- package/dist/stories/pd-loading-state.stories.d.ts +3 -3
- package/dist/stories/pd-toast.stories.d.ts +3 -3
- package/dist/tmpown/pd-loading-state.d.ts.map +1 -1
- package/dist/{src/tmpown → tmpown}/pd-loading-state.js +6 -8
- package/dist/tmpown/pd-login.d.ts.map +1 -1
- package/dist/{src/tmpown → tmpown}/pd-login.js +6 -7
- package/dist/tmpown/pd-panel-viewer.d.ts.map +1 -1
- package/dist/{src/tmpown → tmpown}/pd-toast.js +5 -7
- package/package.json +29 -23
- package/dist/node_modules/@firebase/app/dist/esm/index.esm2017.js +0 -749
- package/dist/node_modules/@firebase/auth/dist/esm2017/index-68602d24.js +0 -6265
- package/dist/node_modules/@firebase/component/dist/esm/index.esm2017.js +0 -341
- package/dist/node_modules/@firebase/firestore/dist/index.esm2017.js +0 -10250
- package/dist/node_modules/@firebase/functions/dist/index.esm2017.js +0 -513
- package/dist/node_modules/@firebase/installations/dist/esm/index.esm2017.js +0 -863
- package/dist/node_modules/@firebase/logger/dist/esm/index.esm2017.js +0 -122
- package/dist/node_modules/@firebase/messaging/dist/esm/index.esm2017.js +0 -1019
- package/dist/node_modules/@firebase/storage/dist/index.esm2017.js +0 -2042
- package/dist/node_modules/@firebase/util/dist/index.esm2017.js +0 -931
- package/dist/node_modules/@firebase/webchannel-wrapper/dist/bloom-blob/esm/bloom_blob_es2018.js +0 -417
- package/dist/node_modules/@firebase/webchannel-wrapper/dist/webchannel-blob/esm/webchannel_blob_es2018.js +0 -2155
- package/dist/node_modules/@lit/reactive-element/decorators/custom-element.js +0 -14
- package/dist/node_modules/@lit/reactive-element/decorators/property.js +0 -20
- package/dist/node_modules/@lit/reactive-element/decorators/query-assigned-elements.js +0 -7
- package/dist/node_modules/@progressive-development/pd-dialog/pd-popup-dialog.js +0 -5
- package/dist/node_modules/@progressive-development/pd-dialog/pd-popup.js +0 -2
- package/dist/node_modules/@progressive-development/pd-dialog/src/PdPopup.js +0 -113
- package/dist/node_modules/@progressive-development/pd-dialog/src/PdPopupDialog.js +0 -189
- package/dist/node_modules/@progressive-development/pd-forms/pd-button.js +0 -2
- package/dist/node_modules/@progressive-development/pd-forms/pd-form-container.js +0 -2
- package/dist/node_modules/@progressive-development/pd-forms/pd-form-row.js +0 -2
- package/dist/node_modules/@progressive-development/pd-forms/pd-hover-box.js +0 -2
- package/dist/node_modules/@progressive-development/pd-forms/pd-input.js +0 -2
- package/dist/node_modules/@progressive-development/pd-forms/src/PdBaseInputElement.js +0 -86
- package/dist/node_modules/@progressive-development/pd-forms/src/PdBaseUi.js +0 -34
- package/dist/node_modules/@progressive-development/pd-forms/src/PdBaseUiInput.js +0 -227
- package/dist/node_modules/@progressive-development/pd-forms/src/PdButton.js +0 -194
- package/dist/node_modules/@progressive-development/pd-forms/src/PdFormContainer.js +0 -167
- package/dist/node_modules/@progressive-development/pd-forms/src/PdFormRow.js +0 -92
- package/dist/node_modules/@progressive-development/pd-forms/src/PdHoverBox.js +0 -108
- package/dist/node_modules/@progressive-development/pd-forms/src/PdInput.js +0 -79
- package/dist/node_modules/@progressive-development/pd-forms/src/generated/locale/be.js +0 -11
- package/dist/node_modules/@progressive-development/pd-forms/src/generated/locale/en.js +0 -11
- package/dist/node_modules/@progressive-development/pd-forms/src/shared-input-field-styles.js +0 -152
- package/dist/node_modules/@progressive-development/pd-forms/src/shared-input-styles.js +0 -64
- package/dist/node_modules/@progressive-development/pd-icon/pd-icon.js +0 -4
- package/dist/node_modules/@progressive-development/pd-icon/src/PdIcon.js +0 -596
- package/dist/node_modules/@progressive-development/pd-order/dist/locales/be.js +0 -15
- package/dist/node_modules/@progressive-development/pd-order/dist/locales/de.js +0 -15
- package/dist/node_modules/@progressive-development/pd-order/dist/locales/en.js +0 -15
- package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-contact/pd-contact.js +0 -2
- package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-contact/src/PdContact.js +0 -567
- package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-content/pd-collapse.js +0 -2
- package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-content/pd-edit-content.js +0 -2
- package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-content/src/PdCollapse.js +0 -136
- package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-content/src/PdEditContent.js +0 -224
- package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-dialog/pd-popup.js +0 -2
- package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-dialog/src/PdPopup.js +0 -113
- package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/pd-checkbox.js +0 -2
- package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/pd-form-container.js +0 -2
- package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/pd-form-row.js +0 -2
- package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/pd-hover-box.js +0 -2
- package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/pd-input.js +0 -2
- package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/pd-radio-group.js +0 -2
- package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdBaseInputElement.js +0 -86
- package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdBaseUi.js +0 -34
- package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdBaseUiInput.js +0 -229
- package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdCheckbox.js +0 -230
- package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdFormContainer.js +0 -167
- package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdFormRow.js +0 -92
- package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdHoverBox.js +0 -108
- package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdInput.js +0 -79
- package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/PdRadioGroup.js +0 -72
- package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/shared-input-field-styles.js +0 -152
- package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-forms/src/shared-input-styles.js +0 -64
- package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-icon/pd-icon.js +0 -4
- package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-icon/src/PdIcon.js +0 -596
- package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-price/pd-pricetable.js +0 -2
- package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/@progressive-development/pd-price/src/PdPricetable.js +0 -149
- package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/fecha/lib/fecha.js +0 -200
- package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/lit/node_modules/lit-html/directive.js +0 -27
- package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/lit/node_modules/lit-html/directives/class-map.js +0 -36
- package/dist/node_modules/@progressive-development/pd-order/dist/node_modules/lit/node_modules/lit-html/lit-html.js +0 -242
- package/dist/node_modules/@progressive-development/pd-order/dist/pd-order-contacts.js +0 -2
- package/dist/node_modules/@progressive-development/pd-order/dist/pd-order-summary.js +0 -2
- package/dist/node_modules/@progressive-development/pd-order/dist/src/PdOrderContacts.js +0 -192
- package/dist/node_modules/@progressive-development/pd-order/dist/src/PdOrderSummary.js +0 -243
- package/dist/node_modules/@progressive-development/pd-page/pd-footer.js +0 -2
- package/dist/node_modules/@progressive-development/pd-page/pd-menu.js +0 -2
- package/dist/node_modules/@progressive-development/pd-page/src/PdFooter.js +0 -141
- package/dist/node_modules/@progressive-development/pd-page/src/PdMenu.js +0 -450
- package/dist/node_modules/@progressive-development/pd-shared-styles/src/shared-color-styles.js +0 -30
- package/dist/node_modules/@progressive-development/pd-shared-styles/src/shared-font-styles.js +0 -32
- package/dist/node_modules/@progressive-development/pd-wizard/pd-wizard.js +0 -2
- package/dist/node_modules/@progressive-development/pd-wizard/src/PdSteps.js +0 -191
- package/dist/node_modules/@progressive-development/pd-wizard/src/PdWizard.js +0 -280
- package/dist/node_modules/firebase/app/dist/esm/index.esm.js +0 -35
- package/dist/node_modules/idb/build/index.js +0 -81
- package/dist/node_modules/idb/build/wrap-idb-value.js +0 -148
- package/dist/node_modules/lit/node_modules/lit-html/directive.js +0 -27
- package/dist/node_modules/lit/node_modules/lit-html/directives/class-map.js +0 -36
- package/dist/node_modules/lit/node_modules/lit-html/lit-html.js +0 -242
- package/dist/node_modules/lit-element-router/lit-element-router.js +0 -131
- package/dist/node_modules/lit-element-router/utility/router-utility.js +0 -36
- package/dist/node_modules/mini-rx-store/index.esm.js +0 -458
- package/dist/node_modules/pwa-helpers/media-query.js +0 -17
- package/dist/node_modules/rxjs/dist/esm5/internal/Observable.js +0 -100
- package/dist/node_modules/rxjs/dist/esm5/internal/Subscriber.js +0 -147
- package/dist/node_modules/rxjs/dist/esm5/internal/Subscription.js +0 -139
- package/dist/node_modules/rxjs/dist/esm5/internal/config.js +0 -10
- package/dist/node_modules/rxjs/dist/esm5/internal/observable/innerFrom.js +0 -159
- package/dist/node_modules/rxjs/dist/esm5/internal/operators/OperatorSubscriber.js +0 -52
- package/dist/node_modules/rxjs/dist/esm5/internal/operators/catchError.js +0 -28
- package/dist/node_modules/rxjs/dist/esm5/internal/operators/distinctUntilChanged.js +0 -27
- package/dist/node_modules/rxjs/dist/esm5/internal/operators/filter.js +0 -13
- package/dist/node_modules/rxjs/dist/esm5/internal/operators/map.js +0 -13
- package/dist/node_modules/rxjs/dist/esm5/internal/operators/observeOn.js +0 -26
- package/dist/node_modules/rxjs/dist/esm5/internal/operators/tap.js +0 -36
- package/dist/node_modules/rxjs/dist/esm5/internal/operators/withLatestFrom.js +0 -43
- package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js +0 -18
- package/dist/node_modules/rxjs/dist/esm5/internal/symbol/iterator.js +0 -11
- package/dist/node_modules/rxjs/dist/esm5/internal/symbol/observable.js +0 -6
- package/dist/node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js +0 -14
- package/dist/node_modules/rxjs/dist/esm5/internal/util/args.js +0 -10
- package/dist/node_modules/rxjs/dist/esm5/internal/util/arrRemove.js +0 -9
- package/dist/node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js +0 -13
- package/dist/node_modules/rxjs/dist/esm5/internal/util/errorContext.js +0 -8
- package/dist/node_modules/rxjs/dist/esm5/internal/util/executeSchedule.js +0 -23
- package/dist/node_modules/rxjs/dist/esm5/internal/util/identity.js +0 -6
- package/dist/node_modules/rxjs/dist/esm5/internal/util/isArrayLike.js +0 -6
- package/dist/node_modules/rxjs/dist/esm5/internal/util/isAsyncIterable.js +0 -7
- package/dist/node_modules/rxjs/dist/esm5/internal/util/isFunction.js +0 -6
- package/dist/node_modules/rxjs/dist/esm5/internal/util/isInteropObservable.js +0 -8
- package/dist/node_modules/rxjs/dist/esm5/internal/util/isIterable.js +0 -8
- package/dist/node_modules/rxjs/dist/esm5/internal/util/isPromise.js +0 -7
- package/dist/node_modules/rxjs/dist/esm5/internal/util/isReadableStreamLike.js +0 -46
- package/dist/node_modules/rxjs/dist/esm5/internal/util/lift.js +0 -22
- package/dist/node_modules/rxjs/dist/esm5/internal/util/noop.js +0 -5
- package/dist/node_modules/rxjs/dist/esm5/internal/util/pipe.js +0 -17
- package/dist/node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js +0 -11
- package/dist/node_modules/rxjs/dist/esm5/internal/util/throwUnobservableError.js +0 -6
- package/dist/pd-spa-helper.d.ts +0 -1
- package/dist/pd-spa-helper.d.ts.map +0 -1
- package/dist/src/generated/locale-wrapper/be-wrapper.js +0 -15
- package/dist/src/generated/locale-wrapper/de-wrapper.js +0 -13
- package/dist/src/generated/locale-wrapper/en-wrapper.js +0 -15
- /package/dist/{src/generated → generated}/locales/be.js +0 -0
- /package/dist/{src/generated → generated}/locales/de.js +0 -0
- /package/dist/{src/generated → generated}/locales/en.js +0 -0
- /package/dist/{src/helper → helper}/helper-utils.js +0 -0
- /package/dist/{src/model → model}/spa-model.js +0 -0
- /package/dist/{src/service-provider → service-provider}/mock/auth.js +0 -0
- /package/dist/{src/service-provider → service-provider}/mock/function-client.js +0 -0
- /package/dist/{src/service-provider → service-provider}/mock/storage-client.js +0 -0
- /package/dist/{src/service-provider → service-provider}/service-provider-model.js +0 -0
- /package/dist/{src/store → store}/indexDB.js +0 -0
- /package/dist/{src/store → store}/spa-app-actions.js +0 -0
- /package/dist/{src/store → store}/spa-app-reducer.js +0 -0
|
@@ -1,749 +0,0 @@
|
|
|
1
|
-
import { Component, ComponentContainer } from "../../../component/dist/esm/index.esm2017.js";
|
|
2
|
-
import { Logger } from "../../../logger/dist/esm/index.esm2017.js";
|
|
3
|
-
import { base64urlEncodeWithoutPadding, isIndexedDBAvailable, validateIndexedDBOpenable, getDefaultAppConfig, deepEqual, FirebaseError, ErrorFactory } from "../../../util/dist/index.esm2017.js";
|
|
4
|
-
import { openDB } from "../../../../idb/build/index.js";
|
|
5
|
-
/**
|
|
6
|
-
* @license
|
|
7
|
-
* Copyright 2019 Google LLC
|
|
8
|
-
*
|
|
9
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
-
* you may not use this file except in compliance with the License.
|
|
11
|
-
* You may obtain a copy of the License at
|
|
12
|
-
*
|
|
13
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
-
*
|
|
15
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
16
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
-
* See the License for the specific language governing permissions and
|
|
19
|
-
* limitations under the License.
|
|
20
|
-
*/
|
|
21
|
-
class PlatformLoggerServiceImpl {
|
|
22
|
-
constructor(container) {
|
|
23
|
-
this.container = container;
|
|
24
|
-
}
|
|
25
|
-
// In initial implementation, this will be called by installations on
|
|
26
|
-
// auth token refresh, and installations will send this string.
|
|
27
|
-
getPlatformInfoString() {
|
|
28
|
-
const providers = this.container.getProviders();
|
|
29
|
-
return providers.map((provider) => {
|
|
30
|
-
if (isVersionServiceProvider(provider)) {
|
|
31
|
-
const service = provider.getImmediate();
|
|
32
|
-
return `${service.library}/${service.version}`;
|
|
33
|
-
} else {
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
}).filter((logString) => logString).join(" ");
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
function isVersionServiceProvider(provider) {
|
|
40
|
-
const component = provider.getComponent();
|
|
41
|
-
return (component === null || component === void 0 ? void 0 : component.type) === "VERSION";
|
|
42
|
-
}
|
|
43
|
-
const name$q = "@firebase/app";
|
|
44
|
-
const version$1 = "0.10.13";
|
|
45
|
-
/**
|
|
46
|
-
* @license
|
|
47
|
-
* Copyright 2019 Google LLC
|
|
48
|
-
*
|
|
49
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
50
|
-
* you may not use this file except in compliance with the License.
|
|
51
|
-
* You may obtain a copy of the License at
|
|
52
|
-
*
|
|
53
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
54
|
-
*
|
|
55
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
56
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
57
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
58
|
-
* See the License for the specific language governing permissions and
|
|
59
|
-
* limitations under the License.
|
|
60
|
-
*/
|
|
61
|
-
const logger = new Logger("@firebase/app");
|
|
62
|
-
const name$p = "@firebase/app-compat";
|
|
63
|
-
const name$o = "@firebase/analytics-compat";
|
|
64
|
-
const name$n = "@firebase/analytics";
|
|
65
|
-
const name$m = "@firebase/app-check-compat";
|
|
66
|
-
const name$l = "@firebase/app-check";
|
|
67
|
-
const name$k = "@firebase/auth";
|
|
68
|
-
const name$j = "@firebase/auth-compat";
|
|
69
|
-
const name$i = "@firebase/database";
|
|
70
|
-
const name$h = "@firebase/data-connect";
|
|
71
|
-
const name$g = "@firebase/database-compat";
|
|
72
|
-
const name$f = "@firebase/functions";
|
|
73
|
-
const name$e = "@firebase/functions-compat";
|
|
74
|
-
const name$d = "@firebase/installations";
|
|
75
|
-
const name$c = "@firebase/installations-compat";
|
|
76
|
-
const name$b = "@firebase/messaging";
|
|
77
|
-
const name$a = "@firebase/messaging-compat";
|
|
78
|
-
const name$9 = "@firebase/performance";
|
|
79
|
-
const name$8 = "@firebase/performance-compat";
|
|
80
|
-
const name$7 = "@firebase/remote-config";
|
|
81
|
-
const name$6 = "@firebase/remote-config-compat";
|
|
82
|
-
const name$5 = "@firebase/storage";
|
|
83
|
-
const name$4 = "@firebase/storage-compat";
|
|
84
|
-
const name$3 = "@firebase/firestore";
|
|
85
|
-
const name$2 = "@firebase/vertexai-preview";
|
|
86
|
-
const name$1 = "@firebase/firestore-compat";
|
|
87
|
-
const name = "firebase";
|
|
88
|
-
const version = "10.14.1";
|
|
89
|
-
/**
|
|
90
|
-
* @license
|
|
91
|
-
* Copyright 2019 Google LLC
|
|
92
|
-
*
|
|
93
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
94
|
-
* you may not use this file except in compliance with the License.
|
|
95
|
-
* You may obtain a copy of the License at
|
|
96
|
-
*
|
|
97
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
98
|
-
*
|
|
99
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
100
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
101
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
102
|
-
* See the License for the specific language governing permissions and
|
|
103
|
-
* limitations under the License.
|
|
104
|
-
*/
|
|
105
|
-
const DEFAULT_ENTRY_NAME = "[DEFAULT]";
|
|
106
|
-
const PLATFORM_LOG_STRING = {
|
|
107
|
-
[name$q]: "fire-core",
|
|
108
|
-
[name$p]: "fire-core-compat",
|
|
109
|
-
[name$n]: "fire-analytics",
|
|
110
|
-
[name$o]: "fire-analytics-compat",
|
|
111
|
-
[name$l]: "fire-app-check",
|
|
112
|
-
[name$m]: "fire-app-check-compat",
|
|
113
|
-
[name$k]: "fire-auth",
|
|
114
|
-
[name$j]: "fire-auth-compat",
|
|
115
|
-
[name$i]: "fire-rtdb",
|
|
116
|
-
[name$h]: "fire-data-connect",
|
|
117
|
-
[name$g]: "fire-rtdb-compat",
|
|
118
|
-
[name$f]: "fire-fn",
|
|
119
|
-
[name$e]: "fire-fn-compat",
|
|
120
|
-
[name$d]: "fire-iid",
|
|
121
|
-
[name$c]: "fire-iid-compat",
|
|
122
|
-
[name$b]: "fire-fcm",
|
|
123
|
-
[name$a]: "fire-fcm-compat",
|
|
124
|
-
[name$9]: "fire-perf",
|
|
125
|
-
[name$8]: "fire-perf-compat",
|
|
126
|
-
[name$7]: "fire-rc",
|
|
127
|
-
[name$6]: "fire-rc-compat",
|
|
128
|
-
[name$5]: "fire-gcs",
|
|
129
|
-
[name$4]: "fire-gcs-compat",
|
|
130
|
-
[name$3]: "fire-fst",
|
|
131
|
-
[name$1]: "fire-fst-compat",
|
|
132
|
-
[name$2]: "fire-vertex",
|
|
133
|
-
"fire-js": "fire-js",
|
|
134
|
-
[name]: "fire-js-all"
|
|
135
|
-
};
|
|
136
|
-
/**
|
|
137
|
-
* @license
|
|
138
|
-
* Copyright 2019 Google LLC
|
|
139
|
-
*
|
|
140
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
141
|
-
* you may not use this file except in compliance with the License.
|
|
142
|
-
* You may obtain a copy of the License at
|
|
143
|
-
*
|
|
144
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
145
|
-
*
|
|
146
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
147
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
148
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
149
|
-
* See the License for the specific language governing permissions and
|
|
150
|
-
* limitations under the License.
|
|
151
|
-
*/
|
|
152
|
-
const _apps = /* @__PURE__ */ new Map();
|
|
153
|
-
const _serverApps = /* @__PURE__ */ new Map();
|
|
154
|
-
const _components = /* @__PURE__ */ new Map();
|
|
155
|
-
function _addComponent(app, component) {
|
|
156
|
-
try {
|
|
157
|
-
app.container.addComponent(component);
|
|
158
|
-
} catch (e) {
|
|
159
|
-
logger.debug(`Component ${component.name} failed to register with FirebaseApp ${app.name}`, e);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
function _registerComponent(component) {
|
|
163
|
-
const componentName = component.name;
|
|
164
|
-
if (_components.has(componentName)) {
|
|
165
|
-
logger.debug(`There were multiple attempts to register component ${componentName}.`);
|
|
166
|
-
return false;
|
|
167
|
-
}
|
|
168
|
-
_components.set(componentName, component);
|
|
169
|
-
for (const app of _apps.values()) {
|
|
170
|
-
_addComponent(app, component);
|
|
171
|
-
}
|
|
172
|
-
for (const serverApp of _serverApps.values()) {
|
|
173
|
-
_addComponent(serverApp, component);
|
|
174
|
-
}
|
|
175
|
-
return true;
|
|
176
|
-
}
|
|
177
|
-
function _getProvider(app, name2) {
|
|
178
|
-
const heartbeatController = app.container.getProvider("heartbeat").getImmediate({ optional: true });
|
|
179
|
-
if (heartbeatController) {
|
|
180
|
-
void heartbeatController.triggerHeartbeat();
|
|
181
|
-
}
|
|
182
|
-
return app.container.getProvider(name2);
|
|
183
|
-
}
|
|
184
|
-
function _isFirebaseServerApp(obj) {
|
|
185
|
-
return obj.settings !== void 0;
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* @license
|
|
189
|
-
* Copyright 2019 Google LLC
|
|
190
|
-
*
|
|
191
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
-
* you may not use this file except in compliance with the License.
|
|
193
|
-
* You may obtain a copy of the License at
|
|
194
|
-
*
|
|
195
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
-
*
|
|
197
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
198
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
-
* See the License for the specific language governing permissions and
|
|
201
|
-
* limitations under the License.
|
|
202
|
-
*/
|
|
203
|
-
const ERRORS = {
|
|
204
|
-
[
|
|
205
|
-
"no-app"
|
|
206
|
-
/* AppError.NO_APP */
|
|
207
|
-
]: "No Firebase App '{$appName}' has been created - call initializeApp() first",
|
|
208
|
-
[
|
|
209
|
-
"bad-app-name"
|
|
210
|
-
/* AppError.BAD_APP_NAME */
|
|
211
|
-
]: "Illegal App name: '{$appName}'",
|
|
212
|
-
[
|
|
213
|
-
"duplicate-app"
|
|
214
|
-
/* AppError.DUPLICATE_APP */
|
|
215
|
-
]: "Firebase App named '{$appName}' already exists with different options or config",
|
|
216
|
-
[
|
|
217
|
-
"app-deleted"
|
|
218
|
-
/* AppError.APP_DELETED */
|
|
219
|
-
]: "Firebase App named '{$appName}' already deleted",
|
|
220
|
-
[
|
|
221
|
-
"server-app-deleted"
|
|
222
|
-
/* AppError.SERVER_APP_DELETED */
|
|
223
|
-
]: "Firebase Server App has been deleted",
|
|
224
|
-
[
|
|
225
|
-
"no-options"
|
|
226
|
-
/* AppError.NO_OPTIONS */
|
|
227
|
-
]: "Need to provide options, when not being deployed to hosting via source.",
|
|
228
|
-
[
|
|
229
|
-
"invalid-app-argument"
|
|
230
|
-
/* AppError.INVALID_APP_ARGUMENT */
|
|
231
|
-
]: "firebase.{$appName}() takes either no argument or a Firebase App instance.",
|
|
232
|
-
[
|
|
233
|
-
"invalid-log-argument"
|
|
234
|
-
/* AppError.INVALID_LOG_ARGUMENT */
|
|
235
|
-
]: "First argument to `onLog` must be null or a function.",
|
|
236
|
-
[
|
|
237
|
-
"idb-open"
|
|
238
|
-
/* AppError.IDB_OPEN */
|
|
239
|
-
]: "Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.",
|
|
240
|
-
[
|
|
241
|
-
"idb-get"
|
|
242
|
-
/* AppError.IDB_GET */
|
|
243
|
-
]: "Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.",
|
|
244
|
-
[
|
|
245
|
-
"idb-set"
|
|
246
|
-
/* AppError.IDB_WRITE */
|
|
247
|
-
]: "Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.",
|
|
248
|
-
[
|
|
249
|
-
"idb-delete"
|
|
250
|
-
/* AppError.IDB_DELETE */
|
|
251
|
-
]: "Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.",
|
|
252
|
-
[
|
|
253
|
-
"finalization-registry-not-supported"
|
|
254
|
-
/* AppError.FINALIZATION_REGISTRY_NOT_SUPPORTED */
|
|
255
|
-
]: "FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.",
|
|
256
|
-
[
|
|
257
|
-
"invalid-server-app-environment"
|
|
258
|
-
/* AppError.INVALID_SERVER_APP_ENVIRONMENT */
|
|
259
|
-
]: "FirebaseServerApp is not for use in browser environments."
|
|
260
|
-
};
|
|
261
|
-
const ERROR_FACTORY = new ErrorFactory("app", "Firebase", ERRORS);
|
|
262
|
-
/**
|
|
263
|
-
* @license
|
|
264
|
-
* Copyright 2019 Google LLC
|
|
265
|
-
*
|
|
266
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
267
|
-
* you may not use this file except in compliance with the License.
|
|
268
|
-
* You may obtain a copy of the License at
|
|
269
|
-
*
|
|
270
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
271
|
-
*
|
|
272
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
273
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
274
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
275
|
-
* See the License for the specific language governing permissions and
|
|
276
|
-
* limitations under the License.
|
|
277
|
-
*/
|
|
278
|
-
class FirebaseAppImpl {
|
|
279
|
-
constructor(options, config, container) {
|
|
280
|
-
this._isDeleted = false;
|
|
281
|
-
this._options = Object.assign({}, options);
|
|
282
|
-
this._config = Object.assign({}, config);
|
|
283
|
-
this._name = config.name;
|
|
284
|
-
this._automaticDataCollectionEnabled = config.automaticDataCollectionEnabled;
|
|
285
|
-
this._container = container;
|
|
286
|
-
this.container.addComponent(new Component(
|
|
287
|
-
"app",
|
|
288
|
-
() => this,
|
|
289
|
-
"PUBLIC"
|
|
290
|
-
/* ComponentType.PUBLIC */
|
|
291
|
-
));
|
|
292
|
-
}
|
|
293
|
-
get automaticDataCollectionEnabled() {
|
|
294
|
-
this.checkDestroyed();
|
|
295
|
-
return this._automaticDataCollectionEnabled;
|
|
296
|
-
}
|
|
297
|
-
set automaticDataCollectionEnabled(val) {
|
|
298
|
-
this.checkDestroyed();
|
|
299
|
-
this._automaticDataCollectionEnabled = val;
|
|
300
|
-
}
|
|
301
|
-
get name() {
|
|
302
|
-
this.checkDestroyed();
|
|
303
|
-
return this._name;
|
|
304
|
-
}
|
|
305
|
-
get options() {
|
|
306
|
-
this.checkDestroyed();
|
|
307
|
-
return this._options;
|
|
308
|
-
}
|
|
309
|
-
get config() {
|
|
310
|
-
this.checkDestroyed();
|
|
311
|
-
return this._config;
|
|
312
|
-
}
|
|
313
|
-
get container() {
|
|
314
|
-
return this._container;
|
|
315
|
-
}
|
|
316
|
-
get isDeleted() {
|
|
317
|
-
return this._isDeleted;
|
|
318
|
-
}
|
|
319
|
-
set isDeleted(val) {
|
|
320
|
-
this._isDeleted = val;
|
|
321
|
-
}
|
|
322
|
-
/**
|
|
323
|
-
* This function will throw an Error if the App has already been deleted -
|
|
324
|
-
* use before performing API actions on the App.
|
|
325
|
-
*/
|
|
326
|
-
checkDestroyed() {
|
|
327
|
-
if (this.isDeleted) {
|
|
328
|
-
throw ERROR_FACTORY.create("app-deleted", { appName: this._name });
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
/**
|
|
333
|
-
* @license
|
|
334
|
-
* Copyright 2019 Google LLC
|
|
335
|
-
*
|
|
336
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
337
|
-
* you may not use this file except in compliance with the License.
|
|
338
|
-
* You may obtain a copy of the License at
|
|
339
|
-
*
|
|
340
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
341
|
-
*
|
|
342
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
343
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
344
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
345
|
-
* See the License for the specific language governing permissions and
|
|
346
|
-
* limitations under the License.
|
|
347
|
-
*/
|
|
348
|
-
const SDK_VERSION = version;
|
|
349
|
-
function initializeApp(_options, rawConfig = {}) {
|
|
350
|
-
let options = _options;
|
|
351
|
-
if (typeof rawConfig !== "object") {
|
|
352
|
-
const name3 = rawConfig;
|
|
353
|
-
rawConfig = { name: name3 };
|
|
354
|
-
}
|
|
355
|
-
const config = Object.assign({ name: DEFAULT_ENTRY_NAME, automaticDataCollectionEnabled: false }, rawConfig);
|
|
356
|
-
const name2 = config.name;
|
|
357
|
-
if (typeof name2 !== "string" || !name2) {
|
|
358
|
-
throw ERROR_FACTORY.create("bad-app-name", {
|
|
359
|
-
appName: String(name2)
|
|
360
|
-
});
|
|
361
|
-
}
|
|
362
|
-
options || (options = getDefaultAppConfig());
|
|
363
|
-
if (!options) {
|
|
364
|
-
throw ERROR_FACTORY.create(
|
|
365
|
-
"no-options"
|
|
366
|
-
/* AppError.NO_OPTIONS */
|
|
367
|
-
);
|
|
368
|
-
}
|
|
369
|
-
const existingApp = _apps.get(name2);
|
|
370
|
-
if (existingApp) {
|
|
371
|
-
if (deepEqual(options, existingApp.options) && deepEqual(config, existingApp.config)) {
|
|
372
|
-
return existingApp;
|
|
373
|
-
} else {
|
|
374
|
-
throw ERROR_FACTORY.create("duplicate-app", { appName: name2 });
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
const container = new ComponentContainer(name2);
|
|
378
|
-
for (const component of _components.values()) {
|
|
379
|
-
container.addComponent(component);
|
|
380
|
-
}
|
|
381
|
-
const newApp = new FirebaseAppImpl(options, config, container);
|
|
382
|
-
_apps.set(name2, newApp);
|
|
383
|
-
return newApp;
|
|
384
|
-
}
|
|
385
|
-
function getApp(name2 = DEFAULT_ENTRY_NAME) {
|
|
386
|
-
const app = _apps.get(name2);
|
|
387
|
-
if (!app && name2 === DEFAULT_ENTRY_NAME && getDefaultAppConfig()) {
|
|
388
|
-
return initializeApp();
|
|
389
|
-
}
|
|
390
|
-
if (!app) {
|
|
391
|
-
throw ERROR_FACTORY.create("no-app", { appName: name2 });
|
|
392
|
-
}
|
|
393
|
-
return app;
|
|
394
|
-
}
|
|
395
|
-
function registerVersion(libraryKeyOrName, version2, variant) {
|
|
396
|
-
var _a;
|
|
397
|
-
let library = (_a = PLATFORM_LOG_STRING[libraryKeyOrName]) !== null && _a !== void 0 ? _a : libraryKeyOrName;
|
|
398
|
-
if (variant) {
|
|
399
|
-
library += `-${variant}`;
|
|
400
|
-
}
|
|
401
|
-
const libraryMismatch = library.match(/\s|\//);
|
|
402
|
-
const versionMismatch = version2.match(/\s|\//);
|
|
403
|
-
if (libraryMismatch || versionMismatch) {
|
|
404
|
-
const warning = [
|
|
405
|
-
`Unable to register library "${library}" with version "${version2}":`
|
|
406
|
-
];
|
|
407
|
-
if (libraryMismatch) {
|
|
408
|
-
warning.push(`library name "${library}" contains illegal characters (whitespace or "/")`);
|
|
409
|
-
}
|
|
410
|
-
if (libraryMismatch && versionMismatch) {
|
|
411
|
-
warning.push("and");
|
|
412
|
-
}
|
|
413
|
-
if (versionMismatch) {
|
|
414
|
-
warning.push(`version name "${version2}" contains illegal characters (whitespace or "/")`);
|
|
415
|
-
}
|
|
416
|
-
logger.warn(warning.join(" "));
|
|
417
|
-
return;
|
|
418
|
-
}
|
|
419
|
-
_registerComponent(new Component(
|
|
420
|
-
`${library}-version`,
|
|
421
|
-
() => ({ library, version: version2 }),
|
|
422
|
-
"VERSION"
|
|
423
|
-
/* ComponentType.VERSION */
|
|
424
|
-
));
|
|
425
|
-
}
|
|
426
|
-
/**
|
|
427
|
-
* @license
|
|
428
|
-
* Copyright 2021 Google LLC
|
|
429
|
-
*
|
|
430
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
431
|
-
* you may not use this file except in compliance with the License.
|
|
432
|
-
* You may obtain a copy of the License at
|
|
433
|
-
*
|
|
434
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
435
|
-
*
|
|
436
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
437
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
438
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
439
|
-
* See the License for the specific language governing permissions and
|
|
440
|
-
* limitations under the License.
|
|
441
|
-
*/
|
|
442
|
-
const DB_NAME = "firebase-heartbeat-database";
|
|
443
|
-
const DB_VERSION = 1;
|
|
444
|
-
const STORE_NAME = "firebase-heartbeat-store";
|
|
445
|
-
let dbPromise = null;
|
|
446
|
-
function getDbPromise() {
|
|
447
|
-
if (!dbPromise) {
|
|
448
|
-
dbPromise = openDB(DB_NAME, DB_VERSION, {
|
|
449
|
-
upgrade: (db, oldVersion) => {
|
|
450
|
-
switch (oldVersion) {
|
|
451
|
-
case 0:
|
|
452
|
-
try {
|
|
453
|
-
db.createObjectStore(STORE_NAME);
|
|
454
|
-
} catch (e) {
|
|
455
|
-
console.warn(e);
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
}).catch((e) => {
|
|
460
|
-
throw ERROR_FACTORY.create("idb-open", {
|
|
461
|
-
originalErrorMessage: e.message
|
|
462
|
-
});
|
|
463
|
-
});
|
|
464
|
-
}
|
|
465
|
-
return dbPromise;
|
|
466
|
-
}
|
|
467
|
-
async function readHeartbeatsFromIndexedDB(app) {
|
|
468
|
-
try {
|
|
469
|
-
const db = await getDbPromise();
|
|
470
|
-
const tx = db.transaction(STORE_NAME);
|
|
471
|
-
const result = await tx.objectStore(STORE_NAME).get(computeKey(app));
|
|
472
|
-
await tx.done;
|
|
473
|
-
return result;
|
|
474
|
-
} catch (e) {
|
|
475
|
-
if (e instanceof FirebaseError) {
|
|
476
|
-
logger.warn(e.message);
|
|
477
|
-
} else {
|
|
478
|
-
const idbGetError = ERROR_FACTORY.create("idb-get", {
|
|
479
|
-
originalErrorMessage: e === null || e === void 0 ? void 0 : e.message
|
|
480
|
-
});
|
|
481
|
-
logger.warn(idbGetError.message);
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
async function writeHeartbeatsToIndexedDB(app, heartbeatObject) {
|
|
486
|
-
try {
|
|
487
|
-
const db = await getDbPromise();
|
|
488
|
-
const tx = db.transaction(STORE_NAME, "readwrite");
|
|
489
|
-
const objectStore = tx.objectStore(STORE_NAME);
|
|
490
|
-
await objectStore.put(heartbeatObject, computeKey(app));
|
|
491
|
-
await tx.done;
|
|
492
|
-
} catch (e) {
|
|
493
|
-
if (e instanceof FirebaseError) {
|
|
494
|
-
logger.warn(e.message);
|
|
495
|
-
} else {
|
|
496
|
-
const idbGetError = ERROR_FACTORY.create("idb-set", {
|
|
497
|
-
originalErrorMessage: e === null || e === void 0 ? void 0 : e.message
|
|
498
|
-
});
|
|
499
|
-
logger.warn(idbGetError.message);
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
function computeKey(app) {
|
|
504
|
-
return `${app.name}!${app.options.appId}`;
|
|
505
|
-
}
|
|
506
|
-
/**
|
|
507
|
-
* @license
|
|
508
|
-
* Copyright 2021 Google LLC
|
|
509
|
-
*
|
|
510
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
511
|
-
* you may not use this file except in compliance with the License.
|
|
512
|
-
* You may obtain a copy of the License at
|
|
513
|
-
*
|
|
514
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
515
|
-
*
|
|
516
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
517
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
518
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
519
|
-
* See the License for the specific language governing permissions and
|
|
520
|
-
* limitations under the License.
|
|
521
|
-
*/
|
|
522
|
-
const MAX_HEADER_BYTES = 1024;
|
|
523
|
-
const STORED_HEARTBEAT_RETENTION_MAX_MILLIS = 30 * 24 * 60 * 60 * 1e3;
|
|
524
|
-
class HeartbeatServiceImpl {
|
|
525
|
-
constructor(container) {
|
|
526
|
-
this.container = container;
|
|
527
|
-
this._heartbeatsCache = null;
|
|
528
|
-
const app = this.container.getProvider("app").getImmediate();
|
|
529
|
-
this._storage = new HeartbeatStorageImpl(app);
|
|
530
|
-
this._heartbeatsCachePromise = this._storage.read().then((result) => {
|
|
531
|
-
this._heartbeatsCache = result;
|
|
532
|
-
return result;
|
|
533
|
-
});
|
|
534
|
-
}
|
|
535
|
-
/**
|
|
536
|
-
* Called to report a heartbeat. The function will generate
|
|
537
|
-
* a HeartbeatsByUserAgent object, update heartbeatsCache, and persist it
|
|
538
|
-
* to IndexedDB.
|
|
539
|
-
* Note that we only store one heartbeat per day. So if a heartbeat for today is
|
|
540
|
-
* already logged, subsequent calls to this function in the same day will be ignored.
|
|
541
|
-
*/
|
|
542
|
-
async triggerHeartbeat() {
|
|
543
|
-
var _a, _b;
|
|
544
|
-
try {
|
|
545
|
-
const platformLogger = this.container.getProvider("platform-logger").getImmediate();
|
|
546
|
-
const agent = platformLogger.getPlatformInfoString();
|
|
547
|
-
const date = getUTCDateString();
|
|
548
|
-
if (((_a = this._heartbeatsCache) === null || _a === void 0 ? void 0 : _a.heartbeats) == null) {
|
|
549
|
-
this._heartbeatsCache = await this._heartbeatsCachePromise;
|
|
550
|
-
if (((_b = this._heartbeatsCache) === null || _b === void 0 ? void 0 : _b.heartbeats) == null) {
|
|
551
|
-
return;
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
if (this._heartbeatsCache.lastSentHeartbeatDate === date || this._heartbeatsCache.heartbeats.some((singleDateHeartbeat) => singleDateHeartbeat.date === date)) {
|
|
555
|
-
return;
|
|
556
|
-
} else {
|
|
557
|
-
this._heartbeatsCache.heartbeats.push({ date, agent });
|
|
558
|
-
}
|
|
559
|
-
this._heartbeatsCache.heartbeats = this._heartbeatsCache.heartbeats.filter((singleDateHeartbeat) => {
|
|
560
|
-
const hbTimestamp = new Date(singleDateHeartbeat.date).valueOf();
|
|
561
|
-
const now = Date.now();
|
|
562
|
-
return now - hbTimestamp <= STORED_HEARTBEAT_RETENTION_MAX_MILLIS;
|
|
563
|
-
});
|
|
564
|
-
return this._storage.overwrite(this._heartbeatsCache);
|
|
565
|
-
} catch (e) {
|
|
566
|
-
logger.warn(e);
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
/**
|
|
570
|
-
* Returns a base64 encoded string which can be attached to the heartbeat-specific header directly.
|
|
571
|
-
* It also clears all heartbeats from memory as well as in IndexedDB.
|
|
572
|
-
*
|
|
573
|
-
* NOTE: Consuming product SDKs should not send the header if this method
|
|
574
|
-
* returns an empty string.
|
|
575
|
-
*/
|
|
576
|
-
async getHeartbeatsHeader() {
|
|
577
|
-
var _a;
|
|
578
|
-
try {
|
|
579
|
-
if (this._heartbeatsCache === null) {
|
|
580
|
-
await this._heartbeatsCachePromise;
|
|
581
|
-
}
|
|
582
|
-
if (((_a = this._heartbeatsCache) === null || _a === void 0 ? void 0 : _a.heartbeats) == null || this._heartbeatsCache.heartbeats.length === 0) {
|
|
583
|
-
return "";
|
|
584
|
-
}
|
|
585
|
-
const date = getUTCDateString();
|
|
586
|
-
const { heartbeatsToSend, unsentEntries } = extractHeartbeatsForHeader(this._heartbeatsCache.heartbeats);
|
|
587
|
-
const headerString = base64urlEncodeWithoutPadding(JSON.stringify({ version: 2, heartbeats: heartbeatsToSend }));
|
|
588
|
-
this._heartbeatsCache.lastSentHeartbeatDate = date;
|
|
589
|
-
if (unsentEntries.length > 0) {
|
|
590
|
-
this._heartbeatsCache.heartbeats = unsentEntries;
|
|
591
|
-
await this._storage.overwrite(this._heartbeatsCache);
|
|
592
|
-
} else {
|
|
593
|
-
this._heartbeatsCache.heartbeats = [];
|
|
594
|
-
void this._storage.overwrite(this._heartbeatsCache);
|
|
595
|
-
}
|
|
596
|
-
return headerString;
|
|
597
|
-
} catch (e) {
|
|
598
|
-
logger.warn(e);
|
|
599
|
-
return "";
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
function getUTCDateString() {
|
|
604
|
-
const today = /* @__PURE__ */ new Date();
|
|
605
|
-
return today.toISOString().substring(0, 10);
|
|
606
|
-
}
|
|
607
|
-
function extractHeartbeatsForHeader(heartbeatsCache, maxSize = MAX_HEADER_BYTES) {
|
|
608
|
-
const heartbeatsToSend = [];
|
|
609
|
-
let unsentEntries = heartbeatsCache.slice();
|
|
610
|
-
for (const singleDateHeartbeat of heartbeatsCache) {
|
|
611
|
-
const heartbeatEntry = heartbeatsToSend.find((hb) => hb.agent === singleDateHeartbeat.agent);
|
|
612
|
-
if (!heartbeatEntry) {
|
|
613
|
-
heartbeatsToSend.push({
|
|
614
|
-
agent: singleDateHeartbeat.agent,
|
|
615
|
-
dates: [singleDateHeartbeat.date]
|
|
616
|
-
});
|
|
617
|
-
if (countBytes(heartbeatsToSend) > maxSize) {
|
|
618
|
-
heartbeatsToSend.pop();
|
|
619
|
-
break;
|
|
620
|
-
}
|
|
621
|
-
} else {
|
|
622
|
-
heartbeatEntry.dates.push(singleDateHeartbeat.date);
|
|
623
|
-
if (countBytes(heartbeatsToSend) > maxSize) {
|
|
624
|
-
heartbeatEntry.dates.pop();
|
|
625
|
-
break;
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
unsentEntries = unsentEntries.slice(1);
|
|
629
|
-
}
|
|
630
|
-
return {
|
|
631
|
-
heartbeatsToSend,
|
|
632
|
-
unsentEntries
|
|
633
|
-
};
|
|
634
|
-
}
|
|
635
|
-
class HeartbeatStorageImpl {
|
|
636
|
-
constructor(app) {
|
|
637
|
-
this.app = app;
|
|
638
|
-
this._canUseIndexedDBPromise = this.runIndexedDBEnvironmentCheck();
|
|
639
|
-
}
|
|
640
|
-
async runIndexedDBEnvironmentCheck() {
|
|
641
|
-
if (!isIndexedDBAvailable()) {
|
|
642
|
-
return false;
|
|
643
|
-
} else {
|
|
644
|
-
return validateIndexedDBOpenable().then(() => true).catch(() => false);
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
/**
|
|
648
|
-
* Read all heartbeats.
|
|
649
|
-
*/
|
|
650
|
-
async read() {
|
|
651
|
-
const canUseIndexedDB = await this._canUseIndexedDBPromise;
|
|
652
|
-
if (!canUseIndexedDB) {
|
|
653
|
-
return { heartbeats: [] };
|
|
654
|
-
} else {
|
|
655
|
-
const idbHeartbeatObject = await readHeartbeatsFromIndexedDB(this.app);
|
|
656
|
-
if (idbHeartbeatObject === null || idbHeartbeatObject === void 0 ? void 0 : idbHeartbeatObject.heartbeats) {
|
|
657
|
-
return idbHeartbeatObject;
|
|
658
|
-
} else {
|
|
659
|
-
return { heartbeats: [] };
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
// overwrite the storage with the provided heartbeats
|
|
664
|
-
async overwrite(heartbeatsObject) {
|
|
665
|
-
var _a;
|
|
666
|
-
const canUseIndexedDB = await this._canUseIndexedDBPromise;
|
|
667
|
-
if (!canUseIndexedDB) {
|
|
668
|
-
return;
|
|
669
|
-
} else {
|
|
670
|
-
const existingHeartbeatsObject = await this.read();
|
|
671
|
-
return writeHeartbeatsToIndexedDB(this.app, {
|
|
672
|
-
lastSentHeartbeatDate: (_a = heartbeatsObject.lastSentHeartbeatDate) !== null && _a !== void 0 ? _a : existingHeartbeatsObject.lastSentHeartbeatDate,
|
|
673
|
-
heartbeats: heartbeatsObject.heartbeats
|
|
674
|
-
});
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
// add heartbeats
|
|
678
|
-
async add(heartbeatsObject) {
|
|
679
|
-
var _a;
|
|
680
|
-
const canUseIndexedDB = await this._canUseIndexedDBPromise;
|
|
681
|
-
if (!canUseIndexedDB) {
|
|
682
|
-
return;
|
|
683
|
-
} else {
|
|
684
|
-
const existingHeartbeatsObject = await this.read();
|
|
685
|
-
return writeHeartbeatsToIndexedDB(this.app, {
|
|
686
|
-
lastSentHeartbeatDate: (_a = heartbeatsObject.lastSentHeartbeatDate) !== null && _a !== void 0 ? _a : existingHeartbeatsObject.lastSentHeartbeatDate,
|
|
687
|
-
heartbeats: [
|
|
688
|
-
...existingHeartbeatsObject.heartbeats,
|
|
689
|
-
...heartbeatsObject.heartbeats
|
|
690
|
-
]
|
|
691
|
-
});
|
|
692
|
-
}
|
|
693
|
-
}
|
|
694
|
-
}
|
|
695
|
-
function countBytes(heartbeatsCache) {
|
|
696
|
-
return base64urlEncodeWithoutPadding(
|
|
697
|
-
// heartbeatsCache wrapper properties
|
|
698
|
-
JSON.stringify({ version: 2, heartbeats: heartbeatsCache })
|
|
699
|
-
).length;
|
|
700
|
-
}
|
|
701
|
-
/**
|
|
702
|
-
* @license
|
|
703
|
-
* Copyright 2019 Google LLC
|
|
704
|
-
*
|
|
705
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
706
|
-
* you may not use this file except in compliance with the License.
|
|
707
|
-
* You may obtain a copy of the License at
|
|
708
|
-
*
|
|
709
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
710
|
-
*
|
|
711
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
712
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
713
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
714
|
-
* See the License for the specific language governing permissions and
|
|
715
|
-
* limitations under the License.
|
|
716
|
-
*/
|
|
717
|
-
function registerCoreComponents(variant) {
|
|
718
|
-
_registerComponent(new Component(
|
|
719
|
-
"platform-logger",
|
|
720
|
-
(container) => new PlatformLoggerServiceImpl(container),
|
|
721
|
-
"PRIVATE"
|
|
722
|
-
/* ComponentType.PRIVATE */
|
|
723
|
-
));
|
|
724
|
-
_registerComponent(new Component(
|
|
725
|
-
"heartbeat",
|
|
726
|
-
(container) => new HeartbeatServiceImpl(container),
|
|
727
|
-
"PRIVATE"
|
|
728
|
-
/* ComponentType.PRIVATE */
|
|
729
|
-
));
|
|
730
|
-
registerVersion(name$q, version$1, variant);
|
|
731
|
-
registerVersion(name$q, version$1, "esm2017");
|
|
732
|
-
registerVersion("fire-js", "");
|
|
733
|
-
}
|
|
734
|
-
registerCoreComponents("");
|
|
735
|
-
export {
|
|
736
|
-
FirebaseError,
|
|
737
|
-
SDK_VERSION,
|
|
738
|
-
DEFAULT_ENTRY_NAME as _DEFAULT_ENTRY_NAME,
|
|
739
|
-
_addComponent,
|
|
740
|
-
_apps,
|
|
741
|
-
_components,
|
|
742
|
-
_getProvider,
|
|
743
|
-
_isFirebaseServerApp,
|
|
744
|
-
_registerComponent,
|
|
745
|
-
_serverApps,
|
|
746
|
-
getApp,
|
|
747
|
-
initializeApp,
|
|
748
|
-
registerVersion
|
|
749
|
-
};
|