@player-ui/beacon-plugin 0.0.1-next.3 → 0.0.1-next.6
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/index.cjs.js +7 -9
- package/dist/index.d.ts +4 -4
- package/dist/index.esm.js +7 -9
- package/package.json +6 -7
- package/src/beacon.ts +8 -9
package/dist/index.cjs.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var tapableTs = require('tapable-ts');
|
|
6
6
|
var player = require('@player-ui/player');
|
|
7
7
|
var timm = require('timm');
|
|
8
8
|
|
|
@@ -55,12 +55,9 @@ const _BeaconPlugin = class {
|
|
|
55
55
|
view: void 0
|
|
56
56
|
};
|
|
57
57
|
this.hooks = {
|
|
58
|
-
buildBeacon: new
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
]),
|
|
62
|
-
cancelBeacon: new tapable.SyncBailHook(["args"]),
|
|
63
|
-
publishBeacon: new tapable.SyncHook(["beacon"])
|
|
58
|
+
buildBeacon: new tapableTs.AsyncSeriesWaterfallHook(),
|
|
59
|
+
cancelBeacon: new tapableTs.SyncBailHook(),
|
|
60
|
+
publishBeacon: new tapableTs.SyncHook()
|
|
64
61
|
};
|
|
65
62
|
if (options == null ? void 0 : options.plugins) {
|
|
66
63
|
options.plugins.forEach((plugin) => {
|
|
@@ -69,8 +66,9 @@ const _BeaconPlugin = class {
|
|
|
69
66
|
}
|
|
70
67
|
if (options == null ? void 0 : options.callback) {
|
|
71
68
|
this.hooks.publishBeacon.tap("BeaconCallback", (beacon) => {
|
|
72
|
-
if (options.callback)
|
|
69
|
+
if (options.callback) {
|
|
73
70
|
options.callback(beacon);
|
|
71
|
+
}
|
|
74
72
|
});
|
|
75
73
|
}
|
|
76
74
|
}
|
|
@@ -150,7 +148,7 @@ const _BeaconPlugin = class {
|
|
|
150
148
|
view: view || currentView,
|
|
151
149
|
logger: this.logger
|
|
152
150
|
});
|
|
153
|
-
const beacon = (yield this.hooks.buildBeacon.
|
|
151
|
+
const beacon = (yield this.hooks.buildBeacon.call(defaultBeacon, hookArgs)) || defaultBeacon;
|
|
154
152
|
const shouldCancel = this.hooks.cancelBeacon.call(hookArgs) || false;
|
|
155
153
|
if (!shouldCancel) {
|
|
156
154
|
const resolvedBeacon = this.dataController && this.expressionEvaluator ? player.resolveDataRefs(beacon, {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AsyncSeriesWaterfallHook, SyncBailHook, SyncHook } from 'tapable';
|
|
1
|
+
import { AsyncSeriesWaterfallHook, SyncBailHook, SyncHook } from 'tapable-ts';
|
|
2
2
|
import { PlayerFlowState, PlayerPlugin, Player } from '@player-ui/player';
|
|
3
3
|
import { Asset, View } from '@player-ui/types';
|
|
4
4
|
import { Logger } from '@player-ui/logger';
|
|
@@ -56,9 +56,9 @@ declare class BeaconPlugin implements PlayerPlugin {
|
|
|
56
56
|
private dataController?;
|
|
57
57
|
private expressionEvaluator?;
|
|
58
58
|
hooks: {
|
|
59
|
-
buildBeacon: AsyncSeriesWaterfallHook<unknown, HookArgs, any
|
|
60
|
-
cancelBeacon: SyncBailHook<HookArgs, boolean,
|
|
61
|
-
publishBeacon: SyncHook<any,
|
|
59
|
+
buildBeacon: AsyncSeriesWaterfallHook<[unknown, HookArgs], Record<string, any>>;
|
|
60
|
+
cancelBeacon: SyncBailHook<[HookArgs], boolean, Record<string, any>>;
|
|
61
|
+
publishBeacon: SyncHook<[any], Record<string, any>>;
|
|
62
62
|
};
|
|
63
63
|
constructor(options?: BeaconPluginOptions);
|
|
64
64
|
apply(player: Player): void;
|
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AsyncSeriesWaterfallHook, SyncBailHook, SyncHook } from 'tapable';
|
|
1
|
+
import { AsyncSeriesWaterfallHook, SyncBailHook, SyncHook } from 'tapable-ts';
|
|
2
2
|
import { resolveDataRefs } from '@player-ui/player';
|
|
3
3
|
import { setIn } from 'timm';
|
|
4
4
|
|
|
@@ -51,12 +51,9 @@ const _BeaconPlugin = class {
|
|
|
51
51
|
view: void 0
|
|
52
52
|
};
|
|
53
53
|
this.hooks = {
|
|
54
|
-
buildBeacon: new AsyncSeriesWaterfallHook(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
]),
|
|
58
|
-
cancelBeacon: new SyncBailHook(["args"]),
|
|
59
|
-
publishBeacon: new SyncHook(["beacon"])
|
|
54
|
+
buildBeacon: new AsyncSeriesWaterfallHook(),
|
|
55
|
+
cancelBeacon: new SyncBailHook(),
|
|
56
|
+
publishBeacon: new SyncHook()
|
|
60
57
|
};
|
|
61
58
|
if (options == null ? void 0 : options.plugins) {
|
|
62
59
|
options.plugins.forEach((plugin) => {
|
|
@@ -65,8 +62,9 @@ const _BeaconPlugin = class {
|
|
|
65
62
|
}
|
|
66
63
|
if (options == null ? void 0 : options.callback) {
|
|
67
64
|
this.hooks.publishBeacon.tap("BeaconCallback", (beacon) => {
|
|
68
|
-
if (options.callback)
|
|
65
|
+
if (options.callback) {
|
|
69
66
|
options.callback(beacon);
|
|
67
|
+
}
|
|
70
68
|
});
|
|
71
69
|
}
|
|
72
70
|
}
|
|
@@ -146,7 +144,7 @@ const _BeaconPlugin = class {
|
|
|
146
144
|
view: view || currentView,
|
|
147
145
|
logger: this.logger
|
|
148
146
|
});
|
|
149
|
-
const beacon = (yield this.hooks.buildBeacon.
|
|
147
|
+
const beacon = (yield this.hooks.buildBeacon.call(defaultBeacon, hookArgs)) || defaultBeacon;
|
|
150
148
|
const shouldCancel = this.hooks.cancelBeacon.call(hookArgs) || false;
|
|
151
149
|
if (!shouldCancel) {
|
|
152
150
|
const resolvedBeacon = this.dataController && this.expressionEvaluator ? resolveDataRefs(beacon, {
|
package/package.json
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@player-ui/beacon-plugin",
|
|
3
|
-
"version": "0.0.1-next.
|
|
3
|
+
"version": "0.0.1-next.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
7
7
|
},
|
|
8
8
|
"peerDependencies": {
|
|
9
|
-
"@player-ui/player": "0.0.1-next.
|
|
10
|
-
"@player-ui/expressions": "0.0.1-next.
|
|
11
|
-
"@player-ui/logger": "0.0.1-next.
|
|
12
|
-
"@player-ui/types": "0.0.1-next.
|
|
9
|
+
"@player-ui/player": "0.0.1-next.6",
|
|
10
|
+
"@player-ui/expressions": "0.0.1-next.6",
|
|
11
|
+
"@player-ui/logger": "0.0.1-next.6",
|
|
12
|
+
"@player-ui/types": "0.0.1-next.6"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"tapable": "
|
|
15
|
+
"tapable-ts": "^0.1.0",
|
|
16
16
|
"timm": "^1.6.2",
|
|
17
|
-
"@types/tapable": "^1.0.5",
|
|
18
17
|
"@babel/runtime": "7.15.4"
|
|
19
18
|
},
|
|
20
19
|
"main": "dist/index.cjs.js",
|
package/src/beacon.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SyncBailHook, AsyncSeriesWaterfallHook, SyncHook } from 'tapable';
|
|
1
|
+
import { SyncBailHook, AsyncSeriesWaterfallHook, SyncHook } from 'tapable-ts';
|
|
2
2
|
import type {
|
|
3
3
|
Player,
|
|
4
4
|
PlayerPlugin,
|
|
@@ -85,12 +85,9 @@ export class BeaconPlugin implements PlayerPlugin {
|
|
|
85
85
|
private expressionEvaluator?: ExpressionEvaluator;
|
|
86
86
|
|
|
87
87
|
public hooks = {
|
|
88
|
-
buildBeacon: new AsyncSeriesWaterfallHook<unknown, HookArgs>(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
]),
|
|
92
|
-
cancelBeacon: new SyncBailHook<HookArgs, boolean>(['args']),
|
|
93
|
-
publishBeacon: new SyncHook(['beacon']),
|
|
88
|
+
buildBeacon: new AsyncSeriesWaterfallHook<[unknown, HookArgs]>(),
|
|
89
|
+
cancelBeacon: new SyncBailHook<[HookArgs], boolean>(),
|
|
90
|
+
publishBeacon: new SyncHook<[any]>(),
|
|
94
91
|
};
|
|
95
92
|
|
|
96
93
|
constructor(options?: BeaconPluginOptions) {
|
|
@@ -102,7 +99,9 @@ export class BeaconPlugin implements PlayerPlugin {
|
|
|
102
99
|
|
|
103
100
|
if (options?.callback) {
|
|
104
101
|
this.hooks.publishBeacon.tap('BeaconCallback', (beacon: any) => {
|
|
105
|
-
if (options.callback)
|
|
102
|
+
if (options.callback) {
|
|
103
|
+
options.callback(beacon);
|
|
104
|
+
}
|
|
106
105
|
});
|
|
107
106
|
}
|
|
108
107
|
}
|
|
@@ -204,7 +203,7 @@ export class BeaconPlugin implements PlayerPlugin {
|
|
|
204
203
|
logger: this.logger as Logger,
|
|
205
204
|
};
|
|
206
205
|
const beacon =
|
|
207
|
-
(await this.hooks.buildBeacon.
|
|
206
|
+
(await this.hooks.buildBeacon.call(defaultBeacon, hookArgs)) ||
|
|
208
207
|
defaultBeacon;
|
|
209
208
|
const shouldCancel = this.hooks.cancelBeacon.call(hookArgs) || false;
|
|
210
209
|
|