@pageactions/page-actions-js 0.12.1 → 1.0.0
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/README.md +41 -1
- package/dist/service/PageActions.d.ts +39 -1
- package/dist/service/PageActions.d.ts.map +1 -1
- package/dist/service/PageActions.js +96 -2
- package/dist/service/PageActions.js.map +1 -1
- package/dist/type/Interaction.type.d.ts +2 -0
- package/dist/type/Interaction.type.d.ts.map +1 -1
- package/dist/type/Interaction.type.js.map +1 -1
- package/dist/type/visibility.type.d.ts +7 -0
- package/dist/type/visibility.type.d.ts.map +1 -0
- package/dist/type/visibility.type.js +3 -0
- package/dist/type/visibility.type.js.map +1 -0
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -96,9 +96,29 @@ pageActions.firstAction("firstname_changed");
|
|
|
96
96
|
|
|
97
97
|
This action will be reported at most one time. Every further call with the same action type will be ignored during page visit (same PageActions instance).
|
|
98
98
|
|
|
99
|
+
### Page visit duration
|
|
100
|
+
|
|
101
|
+
Page Action can calculate the total time the user spent on a page. However, to calculate this time correctly, we need to know when a user switches browser tabs or closes the page.
|
|
102
|
+
|
|
103
|
+
You can register a default visibility change handler that uses [visibilitychange](https://developer.mozilla.org/en-US/docs/Web/API/Document/visibilitychange_event) event listener:
|
|
104
|
+
|
|
105
|
+
```ts
|
|
106
|
+
pageActions.pageView();
|
|
107
|
+
pageActions.registerVisibilityListener();
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
The other method is to manually call functions when the page becomes hidden or visible. Remember that a `pageView()` function registers a `page visible` event by default.
|
|
111
|
+
|
|
112
|
+
```ts
|
|
113
|
+
pageActions.pageVisible();
|
|
114
|
+
pageActions.pageHidden();
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
The extra benefit of the default handler is that it automatically flushes all events when the page is closed.
|
|
118
|
+
|
|
99
119
|
### Flushing actions
|
|
100
120
|
|
|
101
|
-
By default, sending actions to the collector is delayed so analytics doesn't impact page performance. Sometimes you may need to send events immediately. For example, when
|
|
121
|
+
By default, sending actions to the collector is delayed so analytics doesn't impact page performance. Sometimes you may need to send events immediately. For example, when a user clicks on the button that performs navigation to a different page. In such a situation, a `flush()` method can be used to publish events before the current page is closed.
|
|
102
122
|
|
|
103
123
|
Example:
|
|
104
124
|
|
|
@@ -111,3 +131,23 @@ Another way to do this is by using a `flush` option when reporting an action.
|
|
|
111
131
|
```ts
|
|
112
132
|
pageActions.action("focus", { flush: true });
|
|
113
133
|
```
|
|
134
|
+
|
|
135
|
+
### End page view
|
|
136
|
+
|
|
137
|
+
In some cases, a page visit doesn't end with navigation to other documents or closing of the browser tab. For example, the single-page application (SPA) uses a router to navigate to the other view without reloading a page.
|
|
138
|
+
|
|
139
|
+
In such situations, you may need to signal that some view is no longer displayed and the page-duration timer should be stopped.
|
|
140
|
+
|
|
141
|
+
You can call the `endPageView()` function to do this. It also sends all existing actions to the collector if they haven't been published yet.
|
|
142
|
+
|
|
143
|
+
```ts
|
|
144
|
+
pageActions.endPageView();
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Ignore page actions from development computer
|
|
148
|
+
|
|
149
|
+
After you install Page Actions on your website, you may want to ignore page views and actions from your local machine. While testing you can generate a lot of page views that should not be counted as website traffic that you want to observe.
|
|
150
|
+
|
|
151
|
+
If you set a `page_actions_ignore` local storage key with a value of `true`, then all page views and page actions will be ignored and not sent to the collector.
|
|
152
|
+
|
|
153
|
+
You may also set `page_actions_verbose` with value of `true` to force verbose mode and see page actions in the browser's console.
|
|
@@ -22,6 +22,8 @@ export declare class PageActions {
|
|
|
22
22
|
private _groupName;
|
|
23
23
|
private _pageUrl;
|
|
24
24
|
private _referrer;
|
|
25
|
+
private _visibilityChanges;
|
|
26
|
+
private _listenerAbort;
|
|
25
27
|
private _debounceTimeMs;
|
|
26
28
|
private interactionStream;
|
|
27
29
|
/**
|
|
@@ -47,8 +49,23 @@ export declare class PageActions {
|
|
|
47
49
|
* @returns Current PageActions service for chaining method calls
|
|
48
50
|
*/
|
|
49
51
|
accountId(value: string): PageActions;
|
|
52
|
+
/**
|
|
53
|
+
* Configure your group ID for reported actions. Must be configured before reporting page view or any action.
|
|
54
|
+
* It should be used if you want to measure different things or single page or you have same form on different pages. You can filter page views by group ID in the dashboard.
|
|
55
|
+
* @param value A Group ID for reported actions, 'default' if not provided
|
|
56
|
+
* @returns Current PageActions service for chaining method calls
|
|
57
|
+
*/
|
|
50
58
|
group(value: string): PageActions;
|
|
59
|
+
/**
|
|
60
|
+
* Reports page view event. Must be called only once before any page action is reported.
|
|
61
|
+
* @returns Current PageActions service for chaining method calls
|
|
62
|
+
*/
|
|
51
63
|
pageView(): PageActions;
|
|
64
|
+
/**
|
|
65
|
+
* Signals that page view ended. Stops page view duration timer and flushes all interactions to the collector.
|
|
66
|
+
* @returns Current PageActions service for chaining method calls
|
|
67
|
+
*/
|
|
68
|
+
endPageView(): PageActions;
|
|
52
69
|
/**
|
|
53
70
|
* Reports an action with given type
|
|
54
71
|
* @param type An identifier for the action
|
|
@@ -68,7 +85,28 @@ export declare class PageActions {
|
|
|
68
85
|
* @returns Current PageActions service
|
|
69
86
|
*/
|
|
70
87
|
flush(): PageActions;
|
|
71
|
-
|
|
88
|
+
/**
|
|
89
|
+
* Register a listener that handles page visibility changes. It is used to calculate page visit duration and
|
|
90
|
+
* to automatically flush page actions when page is closed.
|
|
91
|
+
* @returns Current PageActions service
|
|
92
|
+
*/
|
|
93
|
+
registerVisibilityListener(): PageActions;
|
|
94
|
+
/**
|
|
95
|
+
* Unregister an existing visibility listener.
|
|
96
|
+
* @returns Current PageActions service
|
|
97
|
+
*/
|
|
98
|
+
unregisterVisibilityListener(): PageActions;
|
|
99
|
+
/**
|
|
100
|
+
* Report page enters visible state
|
|
101
|
+
* @returns Current PageActions service
|
|
102
|
+
*/
|
|
103
|
+
pageVisible(): PageActions;
|
|
104
|
+
/**
|
|
105
|
+
* Report page enters hidden state
|
|
106
|
+
* @returns Current PageActions service
|
|
107
|
+
*/
|
|
108
|
+
pageHidden(): PageActions;
|
|
109
|
+
private containsInteraction;
|
|
72
110
|
private createInteraction;
|
|
73
111
|
private appendInteraction;
|
|
74
112
|
private generateId;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageActions.d.ts","sourceRoot":"","sources":["../../src/service/PageActions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,WAAW,EAAyB,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"PageActions.d.ts","sourceRoot":"","sources":["../../src/service/PageActions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,WAAW,EAAyB,MAAM,6BAA6B,CAAC;AAIjG,2CAA2C;AAC3C,MAAM,WAAW,aAAa;IAC5B,4FAA4F;IAC5F,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,8FAA8F;IAC9F,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,8FAA8F;IAC9F,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gIAAgI;IAChI,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,wEAAwE;AACxE,qBAAa,WAAW;IACf,YAAY,EAAE,WAAW,EAAE,CAAM;IACjC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAa;IAClD,OAAO,CAAC,mBAAmB,CAAkB;IAE7C,OAAO,CAAC,aAAa,CAAiC;IACtD,OAAO,CAAC,OAAO,CAAiC;IAChD,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,UAAU,CAAiC;IACnD,OAAO,CAAC,UAAU,CAAqB;IACvC,OAAO,CAAC,QAAQ,CAAiC;IACjD,OAAO,CAAC,SAAS,CAAiC;IAClD,OAAO,CAAC,kBAAkB,CAA0B;IACpD,OAAO,CAAC,cAAc,CAA0C;IAEhE,OAAO,CAAC,eAAe,CAAQ;IAC/B,OAAO,CAAC,iBAAiB,CAAoD;IAE7E;;;OAGG;gBACS,MAAM,EAAE,MAAM;IAY1B;;;;OAIG;IACI,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW;IAK1C;;;;OAIG;IACI,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW;IAO3C;;;;OAIG;IACI,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW;IAO5C;;;;;OAKG;IACI,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW;IAOxC;;;OAGG;IACI,QAAQ,IAAI,WAAW;IAe9B;;;OAGG;IACI,WAAW,IAAI,WAAW;IAUjC;;;;;OAKG;IACI,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB,GAAG,WAAW;IAkBrE;;;;;OAKG;IACI,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB,GAAG,WAAW;IAiB1E;;;OAGG;IACI,KAAK,IAAI,WAAW;IAK3B;;;;OAIG;IACI,0BAA0B,IAAI,WAAW;IAqBhD;;;OAGG;IACI,4BAA4B,IAAI,WAAW;IAOlD;;;OAGG;IACI,WAAW,IAAI,WAAW;IAQjC;;;OAGG;IACI,UAAU,IAAI,WAAW;IAUhC,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,iBAAiB;IAKzB,OAAO,CAAC,UAAU;IAQlB,OAAO,CAAC,oBAAoB;IAI5B,OAAO,CAAC,4BAA4B;IAMpC,OAAO,CAAC,mBAAmB;IAM3B,OAAO,CAAC,sBAAsB;YAehB,eAAe;YAKf,sBAAsB;CAYrC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PAGE_VIEW } from "../type/Interaction.type.js";
|
|
2
2
|
import { debounceTime, Subject } from "rxjs";
|
|
3
|
+
import { VISIBLITY_IN, VISIBLITY_OUT } from "../type/visibility.type.js";
|
|
3
4
|
/** Entry point class to report actions to the Page Actions collector */
|
|
4
5
|
export class PageActions {
|
|
5
6
|
/**
|
|
@@ -17,6 +18,8 @@ export class PageActions {
|
|
|
17
18
|
this._groupName = "default";
|
|
18
19
|
this._pageUrl = undefined;
|
|
19
20
|
this._referrer = undefined;
|
|
21
|
+
this._visibilityChanges = [];
|
|
22
|
+
this._listenerAbort = undefined;
|
|
20
23
|
this._debounceTimeMs = 2000;
|
|
21
24
|
this.interactionStream = new Subject();
|
|
22
25
|
if (!siteId) {
|
|
@@ -24,6 +27,9 @@ export class PageActions {
|
|
|
24
27
|
}
|
|
25
28
|
this._siteId = siteId;
|
|
26
29
|
this.registerInteractionsListener();
|
|
30
|
+
if (window.localStorage.getItem("page_actions_verbose") == "true") {
|
|
31
|
+
this._verbose = true;
|
|
32
|
+
}
|
|
27
33
|
if (this._verbose)
|
|
28
34
|
console.log("PageActions service created with siteId = " + siteId);
|
|
29
35
|
}
|
|
@@ -42,7 +48,9 @@ export class PageActions {
|
|
|
42
48
|
* @returns Current PageActions service for chaining method calls
|
|
43
49
|
*/
|
|
44
50
|
verbose(value) {
|
|
45
|
-
|
|
51
|
+
if (window.localStorage.getItem("page_actions_verbose") != "true") {
|
|
52
|
+
this._verbose = value;
|
|
53
|
+
}
|
|
46
54
|
return this;
|
|
47
55
|
}
|
|
48
56
|
/**
|
|
@@ -58,6 +66,12 @@ export class PageActions {
|
|
|
58
66
|
this._accountId = value;
|
|
59
67
|
return this;
|
|
60
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Configure your group ID for reported actions. Must be configured before reporting page view or any action.
|
|
71
|
+
* It should be used if you want to measure different things or single page or you have same form on different pages. You can filter page views by group ID in the dashboard.
|
|
72
|
+
* @param value A Group ID for reported actions, 'default' if not provided
|
|
73
|
+
* @returns Current PageActions service for chaining method calls
|
|
74
|
+
*/
|
|
61
75
|
group(value) {
|
|
62
76
|
if (!value)
|
|
63
77
|
throw new Error(REQUIRE_GROUP_MESSAGE);
|
|
@@ -66,6 +80,10 @@ export class PageActions {
|
|
|
66
80
|
this._groupName = value;
|
|
67
81
|
return this;
|
|
68
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Reports page view event. Must be called only once before any page action is reported.
|
|
85
|
+
* @returns Current PageActions service for chaining method calls
|
|
86
|
+
*/
|
|
69
87
|
pageView() {
|
|
70
88
|
if (!this._collectorUrl)
|
|
71
89
|
throw new Error(COLLECTOR_MISSING_MESSAGE);
|
|
@@ -75,6 +93,9 @@ export class PageActions {
|
|
|
75
93
|
throw new Error(PAGEVIEW_REPEATED_MESSAGE);
|
|
76
94
|
this._pageUrl = document.location.href;
|
|
77
95
|
this._referrer = document.referrer;
|
|
96
|
+
this._visibilityChanges = [];
|
|
97
|
+
if (document.visibilityState === "visible")
|
|
98
|
+
this.pageVisible();
|
|
78
99
|
const interaction = this.createInteraction(PAGE_VIEW, {});
|
|
79
100
|
this.pageViewId = interaction.id;
|
|
80
101
|
this.appendInteraction(interaction);
|
|
@@ -82,6 +103,21 @@ export class PageActions {
|
|
|
82
103
|
console.log("Registered page view", interaction);
|
|
83
104
|
return this;
|
|
84
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* Signals that page view ended. Stops page view duration timer and flushes all interactions to the collector.
|
|
108
|
+
* @returns Current PageActions service for chaining method calls
|
|
109
|
+
*/
|
|
110
|
+
endPageView() {
|
|
111
|
+
if (!this.pageViewId)
|
|
112
|
+
throw new Error(PAGEVIEW_NOT_ACTIVE);
|
|
113
|
+
this.pageHidden();
|
|
114
|
+
this.flush();
|
|
115
|
+
this.pageViewId = undefined;
|
|
116
|
+
this.interactions = [];
|
|
117
|
+
if (this._verbose)
|
|
118
|
+
console.log("Page view ended");
|
|
119
|
+
return this;
|
|
120
|
+
}
|
|
85
121
|
/**
|
|
86
122
|
* Reports an action with given type
|
|
87
123
|
* @param type An identifier for the action
|
|
@@ -152,6 +188,60 @@ export class PageActions {
|
|
|
152
188
|
this.publishInteractions();
|
|
153
189
|
return this;
|
|
154
190
|
}
|
|
191
|
+
/**
|
|
192
|
+
* Register a listener that handles page visibility changes. It is used to calculate page visit duration and
|
|
193
|
+
* to automatically flush page actions when page is closed.
|
|
194
|
+
* @returns Current PageActions service
|
|
195
|
+
*/
|
|
196
|
+
registerVisibilityListener() {
|
|
197
|
+
const abortController = new AbortController();
|
|
198
|
+
this._listenerAbort = abortController;
|
|
199
|
+
addEventListener("visibilitychange", () => {
|
|
200
|
+
if (document.visibilityState === "visible") {
|
|
201
|
+
this.pageVisible();
|
|
202
|
+
}
|
|
203
|
+
if (document.visibilityState === "hidden") {
|
|
204
|
+
this.pageHidden();
|
|
205
|
+
this.flush();
|
|
206
|
+
}
|
|
207
|
+
}, {
|
|
208
|
+
signal: abortController.signal,
|
|
209
|
+
});
|
|
210
|
+
return this;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Unregister an existing visibility listener.
|
|
214
|
+
* @returns Current PageActions service
|
|
215
|
+
*/
|
|
216
|
+
unregisterVisibilityListener() {
|
|
217
|
+
if (this._listenerAbort) {
|
|
218
|
+
this._listenerAbort.abort();
|
|
219
|
+
}
|
|
220
|
+
return this;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Report page enters visible state
|
|
224
|
+
* @returns Current PageActions service
|
|
225
|
+
*/
|
|
226
|
+
pageVisible() {
|
|
227
|
+
this._visibilityChanges.push({
|
|
228
|
+
type: VISIBLITY_IN,
|
|
229
|
+
at: new Date().toISOString(),
|
|
230
|
+
});
|
|
231
|
+
return this;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Report page enters hidden state
|
|
235
|
+
* @returns Current PageActions service
|
|
236
|
+
*/
|
|
237
|
+
pageHidden() {
|
|
238
|
+
this._visibilityChanges.push({
|
|
239
|
+
type: VISIBLITY_OUT,
|
|
240
|
+
at: new Date().toISOString(),
|
|
241
|
+
});
|
|
242
|
+
return this;
|
|
243
|
+
}
|
|
244
|
+
// Private
|
|
155
245
|
containsInteraction(interactionType) {
|
|
156
246
|
return this.interactions.findIndex((it) => it.type === interactionType) >= 0;
|
|
157
247
|
}
|
|
@@ -184,7 +274,9 @@ export class PageActions {
|
|
|
184
274
|
});
|
|
185
275
|
}
|
|
186
276
|
publishInteractions() {
|
|
187
|
-
|
|
277
|
+
if (window.localStorage.getItem("page_actions_ignore") !== "true") {
|
|
278
|
+
this.sendInteraction(this.createViewInteractions());
|
|
279
|
+
}
|
|
188
280
|
}
|
|
189
281
|
createViewInteractions() {
|
|
190
282
|
return {
|
|
@@ -196,6 +288,7 @@ export class PageActions {
|
|
|
196
288
|
viewStartedAt: new Date(),
|
|
197
289
|
referrer: this._referrer,
|
|
198
290
|
pageUrl: this._pageUrl,
|
|
291
|
+
visibility: this._visibilityChanges,
|
|
199
292
|
};
|
|
200
293
|
}
|
|
201
294
|
// extract networking to separate file
|
|
@@ -227,4 +320,5 @@ const ACCOUNT_ID_AFTER_PAGEVIEW_MESSAGE = "Account id cannot be changed after pa
|
|
|
227
320
|
const REQUIRE_GROUP_MESSAGE = "Group name cannot be empty";
|
|
228
321
|
const REQUIRE_ACCOUNT_ID_MESSAGE = "Account id cannot be empty";
|
|
229
322
|
const PAGEVIEW_REPEATED_MESSAGE = "Function pageView() can be called at most once with given PageActions object";
|
|
323
|
+
const PAGEVIEW_NOT_ACTIVE = "There is no active PageView";
|
|
230
324
|
//# sourceMappingURL=PageActions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageActions.js","sourceRoot":"","sources":["../../src/service/PageActions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA2C,MAAM,6BAA6B,CAAC;AACjG,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"PageActions.js","sourceRoot":"","sources":["../../src/service/PageActions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA2C,MAAM,6BAA6B,CAAC;AACjG,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,aAAa,EAAyB,MAAM,4BAA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,CAAC,aAAa,eAAe,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC;CACF;AACD,MAAM,6BAA6B,GAAG,6DAA6D,CAAC;AACpG,MAAM,yBAAyB,GAC7B,0FAA0F,CAAC;AAC7F,MAAM,0BAA0B,GAC9B,yFAAyF,CAAC;AAC5F,MAAM,oBAAoB,GAAG,kCAAkC,CAAC;AAChE,MAAM,mBAAmB,GACvB,4EAA4E,CAAC;AAC/E,MAAM,4BAA4B,GAAG,qDAAqD,CAAC;AAC3F,MAAM,iCAAiC,GAAG,qDAAqD,CAAC;AAChG,MAAM,qBAAqB,GAAG,4BAA4B,CAAC;AAC3D,MAAM,0BAA0B,GAAG,4BAA4B,CAAC;AAChE,MAAM,yBAAyB,GAC7B,8EAA8E,CAAC;AACjF,MAAM,mBAAmB,GAAG,6BAA6B,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { VisibilityChange } from "./visibility.type.js";
|
|
1
2
|
export declare const PAGE_VIEW = "pv";
|
|
2
3
|
export interface Interaction {
|
|
3
4
|
id: string;
|
|
@@ -14,5 +15,6 @@ export interface ViewInteractions {
|
|
|
14
15
|
interactions: Interaction[];
|
|
15
16
|
referrer?: string;
|
|
16
17
|
pageUrl?: string;
|
|
18
|
+
visibility: VisibilityChange[];
|
|
17
19
|
}
|
|
18
20
|
//# sourceMappingURL=Interaction.type.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Interaction.type.d.ts","sourceRoot":"","sources":["../../src/type/Interaction.type.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,OAAO,CAAC;AAE9B,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,IAAI,CAAC;IACX,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,IAAI,CAAC;IACpB,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"Interaction.type.d.ts","sourceRoot":"","sources":["../../src/type/Interaction.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,eAAO,MAAM,SAAS,OAAO,CAAC;AAE9B,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,IAAI,CAAC;IACX,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,IAAI,CAAC;IACpB,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,gBAAgB,EAAE,CAAC;CAChC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Interaction.type.js","sourceRoot":"","sources":["../../src/type/Interaction.type.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Interaction.type.js","sourceRoot":"","sources":["../../src/type/Interaction.type.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visibility.type.d.ts","sourceRoot":"","sources":["../../src/type/visibility.type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,eAAO,MAAM,YAAY,OAAO,CAAC;AACjC,eAAO,MAAM,aAAa,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visibility.type.js","sourceRoot":"","sources":["../../src/type/visibility.type.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC;AACjC,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pageactions/page-actions-js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Page Actions JavaScript client library",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"homepage": "https://www.page-actions.com",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
|
+
"prebuild": "npm run fmt && npm run test",
|
|
30
31
|
"build": "tsc",
|
|
31
32
|
"build:watch": "tsc --watch",
|
|
32
33
|
"build:link": "npm run build && npm link",
|
|
@@ -40,10 +41,10 @@
|
|
|
40
41
|
"rxjs": "^7.8.2"
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
43
|
-
"jsdom": "^
|
|
44
|
+
"jsdom": "^29.1.1",
|
|
44
45
|
"oxfmt": "^0.44.0",
|
|
45
46
|
"pkg-size": "^2.4.0",
|
|
46
47
|
"typescript": "^5.9.3",
|
|
47
|
-
"vitest": "^4.
|
|
48
|
+
"vitest": "^4.1.7"
|
|
48
49
|
}
|
|
49
50
|
}
|