GSI - Employe Self Service Mobile
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

145 lines
5.4 KiB

2 months ago
  1. import firebase from '@firebase/app-compat';
  2. import { logEvent, setCurrentScreen, setUserId, setUserProperties, setAnalyticsCollectionEnabled, settings, isSupported } from '@firebase/analytics';
  3. import { Component } from '@firebase/component';
  4. const name = "@firebase/analytics-compat";
  5. const version = "0.2.1";
  6. /**
  7. * @license
  8. * Copyright 2020 Google LLC
  9. *
  10. * Licensed under the Apache License, Version 2.0 (the "License");
  11. * you may not use this file except in compliance with the License.
  12. * You may obtain a copy of the License at
  13. *
  14. * http://www.apache.org/licenses/LICENSE-2.0
  15. *
  16. * Unless required by applicable law or agreed to in writing, software
  17. * distributed under the License is distributed on an "AS IS" BASIS,
  18. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  19. * See the License for the specific language governing permissions and
  20. * limitations under the License.
  21. */
  22. class AnalyticsService {
  23. constructor(app, _delegate) {
  24. this.app = app;
  25. this._delegate = _delegate;
  26. }
  27. logEvent(eventName, eventParams, options) {
  28. logEvent(this._delegate, eventName, eventParams, options);
  29. }
  30. /**
  31. * @deprecated Use {@link logEvent} with `eventName` as 'screen_view' and add relevant `eventParams`.
  32. * See {@link https://firebase.google.com/docs/analytics/screenviews | Track Screenviews}.
  33. */
  34. setCurrentScreen(screenName, options) {
  35. setCurrentScreen(this._delegate, screenName, options);
  36. }
  37. setUserId(id, options) {
  38. setUserId(this._delegate, id, options);
  39. }
  40. setUserProperties(properties, options) {
  41. setUserProperties(this._delegate, properties, options);
  42. }
  43. setAnalyticsCollectionEnabled(enabled) {
  44. setAnalyticsCollectionEnabled(this._delegate, enabled);
  45. }
  46. }
  47. /**
  48. * @license
  49. * Copyright 2021 Google LLC
  50. *
  51. * Licensed under the Apache License, Version 2.0 (the "License");
  52. * you may not use this file except in compliance with the License.
  53. * You may obtain a copy of the License at
  54. *
  55. * http://www.apache.org/licenses/LICENSE-2.0
  56. *
  57. * Unless required by applicable law or agreed to in writing, software
  58. * distributed under the License is distributed on an "AS IS" BASIS,
  59. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  60. * See the License for the specific language governing permissions and
  61. * limitations under the License.
  62. */
  63. /**
  64. * Officially recommended event names for gtag.js
  65. * Any other string is also allowed.
  66. */
  67. var EventName;
  68. (function (EventName) {
  69. EventName["ADD_SHIPPING_INFO"] = "add_shipping_info";
  70. EventName["ADD_PAYMENT_INFO"] = "add_payment_info";
  71. EventName["ADD_TO_CART"] = "add_to_cart";
  72. EventName["ADD_TO_WISHLIST"] = "add_to_wishlist";
  73. EventName["BEGIN_CHECKOUT"] = "begin_checkout";
  74. /**
  75. * @deprecated
  76. * This event name is deprecated and is unsupported in updated
  77. * Enhanced Ecommerce reports.
  78. */
  79. EventName["CHECKOUT_PROGRESS"] = "checkout_progress";
  80. EventName["EXCEPTION"] = "exception";
  81. EventName["GENERATE_LEAD"] = "generate_lead";
  82. EventName["LOGIN"] = "login";
  83. EventName["PAGE_VIEW"] = "page_view";
  84. EventName["PURCHASE"] = "purchase";
  85. EventName["REFUND"] = "refund";
  86. EventName["REMOVE_FROM_CART"] = "remove_from_cart";
  87. EventName["SCREEN_VIEW"] = "screen_view";
  88. EventName["SEARCH"] = "search";
  89. EventName["SELECT_CONTENT"] = "select_content";
  90. EventName["SELECT_ITEM"] = "select_item";
  91. EventName["SELECT_PROMOTION"] = "select_promotion";
  92. /** @deprecated */
  93. EventName["SET_CHECKOUT_OPTION"] = "set_checkout_option";
  94. EventName["SHARE"] = "share";
  95. EventName["SIGN_UP"] = "sign_up";
  96. EventName["TIMING_COMPLETE"] = "timing_complete";
  97. EventName["VIEW_CART"] = "view_cart";
  98. EventName["VIEW_ITEM"] = "view_item";
  99. EventName["VIEW_ITEM_LIST"] = "view_item_list";
  100. EventName["VIEW_PROMOTION"] = "view_promotion";
  101. EventName["VIEW_SEARCH_RESULTS"] = "view_search_results";
  102. })(EventName || (EventName = {}));
  103. /**
  104. * @license
  105. * Copyright 2021 Google LLC
  106. *
  107. * Licensed under the Apache License, Version 2.0 (the "License");
  108. * you may not use this file except in compliance with the License.
  109. * You may obtain a copy of the License at
  110. *
  111. * http://www.apache.org/licenses/LICENSE-2.0
  112. *
  113. * Unless required by applicable law or agreed to in writing, software
  114. * distributed under the License is distributed on an "AS IS" BASIS,
  115. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  116. * See the License for the specific language governing permissions and
  117. * limitations under the License.
  118. */
  119. const factory = (container) => {
  120. // Dependencies
  121. const app = container.getProvider('app-compat').getImmediate();
  122. const analyticsServiceExp = container.getProvider('analytics').getImmediate();
  123. return new AnalyticsService(app, analyticsServiceExp);
  124. };
  125. function registerAnalytics() {
  126. const namespaceExports = {
  127. Analytics: AnalyticsService,
  128. settings: settings,
  129. isSupported: isSupported,
  130. // We removed this enum in exp so need to re-create it here for compat.
  131. EventName
  132. };
  133. firebase.INTERNAL.registerComponent(new Component('analytics-compat', factory, "PUBLIC" /* ComponentType.PUBLIC */)
  134. .setServiceProps(namespaceExports)
  135. .setMultipleInstances(true));
  136. }
  137. registerAnalytics();
  138. firebase.registerVersion(name, version);
  139. export { registerAnalytics };
  140. //# sourceMappingURL=index.esm2017.js.map