@serwist/google-analytics 9.0.0-preview.1 → 9.0.0-preview.11

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.
@@ -22,6 +22,5 @@ export interface GoogleAnalyticsInitializeOptions {
22
22
  /**
23
23
  * @param options
24
24
  */
25
- declare const initialize: (options?: GoogleAnalyticsInitializeOptions) => void;
26
- export { initialize };
25
+ export declare const initialize: (options?: GoogleAnalyticsInitializeOptions) => void;
27
26
  //# sourceMappingURL=initialize.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"initialize.d.ts","sourceRoot":"","sources":["../src/initialize.ts"],"names":[],"mappings":"AA0BA,MAAM,WAAW,gCAAgC;IAC/C;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE;QAAE,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IACrD;;;;OAIG;IACH,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;CAC/C;AAyID;;GAEG;AACH,QAAA,MAAM,UAAU,aAAa,gCAAgC,KAAQ,IAgBpE,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,CAAC"}
1
+ {"version":3,"file":"initialize.d.ts","sourceRoot":"","sources":["../src/initialize.ts"],"names":[],"mappings":"AA0BA,MAAM,WAAW,gCAAgC;IAC/C;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE;QAAE,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IACrD;;;;OAIG;IACH,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;CAC/C;AAyID;;GAEG;AACH,eAAO,MAAM,UAAU,aAAa,gCAAgC,KAAQ,IAa3E,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { BackgroundSyncPlugin } from '@serwist/background-sync';
2
2
  import { privateCacheNames, logger, getFriendlyURL } from '@serwist/core/internal';
3
- import { Router, Route } from '@serwist/routing';
3
+ import { registerRoute, Route } from '@serwist/routing';
4
4
  import { NetworkOnly, NetworkFirst } from '@serwist/strategies';
5
5
 
6
6
  const QUEUE_NAME = "serwist-google-analytics";
@@ -102,11 +102,9 @@ const initialize = (options = {})=>{
102
102
  createGtagJsRoute(cacheName),
103
103
  ...createCollectRoutes(bgSyncPlugin)
104
104
  ];
105
- const router = new Router();
106
105
  for (const route of routes){
107
- router.registerRoute(route);
106
+ registerRoute(route);
108
107
  }
109
- router.addFetchListener();
110
108
  };
111
109
 
112
110
  export { initialize };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@serwist/google-analytics",
3
- "version": "9.0.0-preview.1",
3
+ "version": "9.0.0-preview.11",
4
4
  "type": "module",
5
5
  "description": "Queues failed requests and uses the Background Sync API to replay them when the network is available",
6
6
  "files": [
@@ -42,15 +42,15 @@
42
42
  "./package.json": "./package.json"
43
43
  },
44
44
  "dependencies": {
45
- "@serwist/background-sync": "9.0.0-preview.1",
46
- "@serwist/core": "9.0.0-preview.1",
47
- "@serwist/routing": "9.0.0-preview.1",
48
- "@serwist/strategies": "9.0.0-preview.1"
45
+ "@serwist/background-sync": "9.0.0-preview.11",
46
+ "@serwist/core": "9.0.0-preview.11",
47
+ "@serwist/routing": "9.0.0-preview.11",
48
+ "@serwist/strategies": "9.0.0-preview.11"
49
49
  },
50
50
  "devDependencies": {
51
51
  "rollup": "4.9.6",
52
- "typescript": "5.4.0-dev.20240203",
53
- "@serwist/constants": "9.0.0-preview.1"
52
+ "typescript": "5.4.0-dev.20240206",
53
+ "@serwist/constants": "9.0.0-preview.11"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "typescript": ">=5.0.0"
package/src/initialize.ts CHANGED
@@ -10,7 +10,7 @@ import type { Queue, QueueEntry } from "@serwist/background-sync";
10
10
  import { BackgroundSyncPlugin } from "@serwist/background-sync";
11
11
  import type { RouteMatchCallbackOptions } from "@serwist/core";
12
12
  import { getFriendlyURL, logger, privateCacheNames } from "@serwist/core/internal";
13
- import { Route, Router } from "@serwist/routing";
13
+ import { Route, registerRoute } from "@serwist/routing";
14
14
  import { NetworkFirst, NetworkOnly } from "@serwist/strategies";
15
15
 
16
16
  import {
@@ -182,7 +182,7 @@ const createGtmJsRoute = (cacheName: string) => {
182
182
  /**
183
183
  * @param options
184
184
  */
185
- const initialize = (options: GoogleAnalyticsInitializeOptions = {}): void => {
185
+ export const initialize = (options: GoogleAnalyticsInitializeOptions = {}): void => {
186
186
  const cacheName = privateCacheNames.getGoogleAnalyticsName(options.cacheName);
187
187
 
188
188
  const bgSyncPlugin = new BackgroundSyncPlugin(QUEUE_NAME, {
@@ -192,12 +192,7 @@ const initialize = (options: GoogleAnalyticsInitializeOptions = {}): void => {
192
192
 
193
193
  const routes = [createGtmJsRoute(cacheName), createAnalyticsJsRoute(cacheName), createGtagJsRoute(cacheName), ...createCollectRoutes(bgSyncPlugin)];
194
194
 
195
- const router = new Router();
196
195
  for (const route of routes) {
197
- router.registerRoute(route);
196
+ registerRoute(route);
198
197
  }
199
-
200
- router.addFetchListener();
201
198
  };
202
-
203
- export { initialize };