Sin descripción
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.

index.cjs.js 6.0KB

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