@player-tools/devtools-basic-web-plugin 0.5.3--canary.90.2515

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.
Files changed (40) hide show
  1. package/dist/cjs/index.cjs +919 -0
  2. package/dist/cjs/index.cjs.map +1 -0
  3. package/dist/index.legacy-esm.js +884 -0
  4. package/dist/index.mjs +884 -0
  5. package/dist/index.mjs.map +1 -0
  6. package/package.json +41 -0
  7. package/src/WrapperComponent.tsx +169 -0
  8. package/src/constants/index.ts +27 -0
  9. package/src/content/common/Screen.tsx +35 -0
  10. package/src/content/common/index.ts +1 -0
  11. package/src/content/index.ts +18 -0
  12. package/src/content/navigation/index.ts +27 -0
  13. package/src/content/schema/index.ts +39 -0
  14. package/src/content/views/ConfigView.tsx +16 -0
  15. package/src/content/views/ConsoleView.tsx +20 -0
  16. package/src/content/views/FlowView.tsx +23 -0
  17. package/src/content/views/LogsView.tsx +9 -0
  18. package/src/content/views/index.ts +6 -0
  19. package/src/helpers/genDataChangeTransaction.ts +29 -0
  20. package/src/helpers/getEvaluateExpression.ts +50 -0
  21. package/src/helpers/index.ts +2 -0
  22. package/src/index.tsx +96 -0
  23. package/src/types.ts +35 -0
  24. package/types/WrapperComponent.d.ts +4 -0
  25. package/types/constants/index.d.ts +16 -0
  26. package/types/content/common/Screen.d.ts +7 -0
  27. package/types/content/common/index.d.ts +2 -0
  28. package/types/content/index.d.ts +33 -0
  29. package/types/content/navigation/index.d.ts +7 -0
  30. package/types/content/schema/index.d.ts +29 -0
  31. package/types/content/views/ConfigView.d.ts +3 -0
  32. package/types/content/views/ConsoleView.d.ts +3 -0
  33. package/types/content/views/FlowView.d.ts +3 -0
  34. package/types/content/views/LogsView.d.ts +3 -0
  35. package/types/content/views/index.d.ts +3 -0
  36. package/types/helpers/genDataChangeTransaction.d.ts +8 -0
  37. package/types/helpers/getEvaluateExpression.d.ts +4 -0
  38. package/types/helpers/index.d.ts +3 -0
  39. package/types/index.d.ts +18 -0
  40. package/types/types.d.ts +35 -0
@@ -0,0 +1,919 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/desktop/basic/src/index.tsx
31
+ var src_exports = {};
32
+ __export(src_exports, {
33
+ BasicWevDevtoolsPlugin: () => BasicWevDevtoolsPlugin
34
+ });
35
+ module.exports = __toCommonJS(src_exports);
36
+ var import_merge2 = require("dset/merge");
37
+ var import_immer2 = require("immer");
38
+ var import_react2 = __toESM(require("react"));
39
+
40
+ // ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/desktop/basic/src/WrapperComponent.tsx
41
+ var import_devtools_desktop_plugins_common = require("@player-tools/devtools-desktop-plugins-common");
42
+ var import_dequal = require("dequal");
43
+ var import_merge = require("dset/merge");
44
+ var import_immer = require("immer");
45
+ var import_react = __toESM(require("react"));
46
+
47
+ // ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/desktop/basic/src/constants/index.ts
48
+ var PLUGIN_ID = "player-ui-basic-devtools-plugin";
49
+ var PLUGIN_NAME = "Standard Devtools";
50
+ var PLUGIN_DESCRIPTION = "Standard Player UI Devtools";
51
+ var PLUGIN_VERSION = "0.0.1";
52
+ var INTERACTIONS = {
53
+ EVALUATE_EXPRESSION: "evaluate-expression"
54
+ };
55
+ var BASE_PLUGIN_DATA = {
56
+ id: PLUGIN_ID,
57
+ name: PLUGIN_NAME,
58
+ description: PLUGIN_DESCRIPTION,
59
+ version: PLUGIN_VERSION
60
+ };
61
+
62
+ // ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/desktop/basic/src/helpers/getEvaluateExpression.ts
63
+ var import_uuid = require("uuid");
64
+ var getEvaluateExpression = (expressionEvaluator) => (expression) => {
65
+ if (!expressionEvaluator) {
66
+ return {
67
+ id: (0, import_uuid.v4)(),
68
+ severity: "error",
69
+ result: "Expression evaluator not available",
70
+ expression
71
+ };
72
+ }
73
+ let result = {
74
+ id: (0, import_uuid.v4)(),
75
+ severity: "error",
76
+ result: "Something went wrong",
77
+ expression
78
+ };
79
+ try {
80
+ expressionEvaluator.deref()?.hooks.onError.intercept({
81
+ call: (error) => {
82
+ throw error;
83
+ }
84
+ });
85
+ const evaluatorResult = expressionEvaluator.deref()?.evaluate(expression);
86
+ result = {
87
+ id: (0, import_uuid.v4)(),
88
+ result: evaluatorResult,
89
+ expression
90
+ };
91
+ } catch (error) {
92
+ if (error instanceof Error) {
93
+ result = {
94
+ id: (0, import_uuid.v4)(),
95
+ severity: "error",
96
+ result: error.message,
97
+ expression
98
+ };
99
+ }
100
+ }
101
+ return result;
102
+ };
103
+
104
+ // ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/desktop/basic/src/helpers/genDataChangeTransaction.ts
105
+ var genDataChangeTransaction = ({
106
+ playerID,
107
+ data,
108
+ pluginID
109
+ }) => {
110
+ return {
111
+ id: -1,
112
+ type: "PLAYER_DEVTOOLS_PLUGIN_DATA_CHANGE",
113
+ payload: {
114
+ pluginID,
115
+ data
116
+ },
117
+ sender: playerID,
118
+ context: "player",
119
+ target: "player",
120
+ timestamp: Date.now(),
121
+ _messenger_: true
122
+ };
123
+ };
124
+
125
+ // ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/desktop/basic/_generated/index.json
126
+ var generated_default = {
127
+ id: "player-ui-basic-devtools-plugin",
128
+ views: [
129
+ {
130
+ id: "Config",
131
+ type: "stacked-view",
132
+ header: {
133
+ asset: {
134
+ id: "Config-header",
135
+ type: "navigation",
136
+ values: [
137
+ {
138
+ asset: {
139
+ id: "Config-header-values-0",
140
+ type: "action",
141
+ value: "Config",
142
+ label: {
143
+ asset: {
144
+ id: "Config-header-values-0-label",
145
+ type: "text",
146
+ value: "Config"
147
+ }
148
+ }
149
+ }
150
+ },
151
+ {
152
+ asset: {
153
+ id: "Config-header-values-1",
154
+ type: "action",
155
+ value: "Flow",
156
+ label: {
157
+ asset: {
158
+ id: "Config-header-values-1-label",
159
+ type: "text",
160
+ value: "Flow"
161
+ }
162
+ }
163
+ }
164
+ },
165
+ {
166
+ asset: {
167
+ id: "Config-header-values-2",
168
+ type: "action",
169
+ value: "Logs",
170
+ label: {
171
+ asset: {
172
+ id: "Config-header-values-2-label",
173
+ type: "text",
174
+ value: "Logs"
175
+ }
176
+ }
177
+ }
178
+ },
179
+ {
180
+ asset: {
181
+ id: "Config-header-values-3",
182
+ type: "action",
183
+ value: "Console",
184
+ label: {
185
+ asset: {
186
+ id: "Config-header-values-3-label",
187
+ type: "text",
188
+ value: "Console"
189
+ }
190
+ }
191
+ }
192
+ }
193
+ ]
194
+ }
195
+ },
196
+ main: {
197
+ asset: {
198
+ id: "Config-main",
199
+ type: "object-inspector",
200
+ binding: "playerConfig",
201
+ label: {
202
+ asset: {
203
+ id: "Config-main-label",
204
+ type: "text",
205
+ value: "Config"
206
+ }
207
+ }
208
+ }
209
+ }
210
+ },
211
+ {
212
+ id: "Flow",
213
+ type: "stacked-view",
214
+ header: {
215
+ asset: {
216
+ id: "Flow-header",
217
+ type: "navigation",
218
+ values: [
219
+ {
220
+ asset: {
221
+ id: "Flow-header-values-0",
222
+ type: "action",
223
+ value: "Config",
224
+ label: {
225
+ asset: {
226
+ id: "Flow-header-values-0-label",
227
+ type: "text",
228
+ value: "Config"
229
+ }
230
+ }
231
+ }
232
+ },
233
+ {
234
+ asset: {
235
+ id: "Flow-header-values-1",
236
+ type: "action",
237
+ value: "Flow",
238
+ label: {
239
+ asset: {
240
+ id: "Flow-header-values-1-label",
241
+ type: "text",
242
+ value: "Flow"
243
+ }
244
+ }
245
+ }
246
+ },
247
+ {
248
+ asset: {
249
+ id: "Flow-header-values-2",
250
+ type: "action",
251
+ value: "Logs",
252
+ label: {
253
+ asset: {
254
+ id: "Flow-header-values-2-label",
255
+ type: "text",
256
+ value: "Logs"
257
+ }
258
+ }
259
+ }
260
+ },
261
+ {
262
+ asset: {
263
+ id: "Flow-header-values-3",
264
+ type: "action",
265
+ value: "Console",
266
+ label: {
267
+ asset: {
268
+ id: "Flow-header-values-3-label",
269
+ type: "text",
270
+ value: "Console"
271
+ }
272
+ }
273
+ }
274
+ }
275
+ ]
276
+ }
277
+ },
278
+ main: {
279
+ asset: {
280
+ id: "Flow-main",
281
+ type: "object-inspector",
282
+ binding: "flow",
283
+ label: {
284
+ asset: {
285
+ id: "Flow-main-label",
286
+ type: "text",
287
+ value: "Flow"
288
+ }
289
+ }
290
+ }
291
+ },
292
+ footer: {
293
+ asset: {
294
+ id: "Flow-footer",
295
+ type: "copy-to-clipboard",
296
+ binding: "flow",
297
+ label: {
298
+ asset: {
299
+ id: "Flow-footer-label",
300
+ type: "text",
301
+ value: "Copy flow to the clipboard"
302
+ }
303
+ }
304
+ }
305
+ }
306
+ },
307
+ {
308
+ id: "Logs",
309
+ type: "stacked-view",
310
+ header: {
311
+ asset: {
312
+ id: "Logs-header",
313
+ type: "navigation",
314
+ values: [
315
+ {
316
+ asset: {
317
+ id: "Logs-header-values-0",
318
+ type: "action",
319
+ value: "Config",
320
+ label: {
321
+ asset: {
322
+ id: "Logs-header-values-0-label",
323
+ type: "text",
324
+ value: "Config"
325
+ }
326
+ }
327
+ }
328
+ },
329
+ {
330
+ asset: {
331
+ id: "Logs-header-values-1",
332
+ type: "action",
333
+ value: "Flow",
334
+ label: {
335
+ asset: {
336
+ id: "Logs-header-values-1-label",
337
+ type: "text",
338
+ value: "Flow"
339
+ }
340
+ }
341
+ }
342
+ },
343
+ {
344
+ asset: {
345
+ id: "Logs-header-values-2",
346
+ type: "action",
347
+ value: "Logs",
348
+ label: {
349
+ asset: {
350
+ id: "Logs-header-values-2-label",
351
+ type: "text",
352
+ value: "Logs"
353
+ }
354
+ }
355
+ }
356
+ },
357
+ {
358
+ asset: {
359
+ id: "Logs-header-values-3",
360
+ type: "action",
361
+ value: "Console",
362
+ label: {
363
+ asset: {
364
+ id: "Logs-header-values-3-label",
365
+ type: "text",
366
+ value: "Console"
367
+ }
368
+ }
369
+ }
370
+ }
371
+ ]
372
+ }
373
+ },
374
+ main: {
375
+ asset: {
376
+ id: "Logs-main",
377
+ type: "table",
378
+ binding: "logs"
379
+ }
380
+ }
381
+ },
382
+ {
383
+ id: "Console",
384
+ type: "stacked-view",
385
+ header: {
386
+ asset: {
387
+ id: "Console-header",
388
+ type: "navigation",
389
+ values: [
390
+ {
391
+ asset: {
392
+ id: "Console-header-values-0",
393
+ type: "action",
394
+ value: "Config",
395
+ label: {
396
+ asset: {
397
+ id: "Console-header-values-0-label",
398
+ type: "text",
399
+ value: "Config"
400
+ }
401
+ }
402
+ }
403
+ },
404
+ {
405
+ asset: {
406
+ id: "Console-header-values-1",
407
+ type: "action",
408
+ value: "Flow",
409
+ label: {
410
+ asset: {
411
+ id: "Console-header-values-1-label",
412
+ type: "text",
413
+ value: "Flow"
414
+ }
415
+ }
416
+ }
417
+ },
418
+ {
419
+ asset: {
420
+ id: "Console-header-values-2",
421
+ type: "action",
422
+ value: "Logs",
423
+ label: {
424
+ asset: {
425
+ id: "Console-header-values-2-label",
426
+ type: "text",
427
+ value: "Logs"
428
+ }
429
+ }
430
+ }
431
+ },
432
+ {
433
+ asset: {
434
+ id: "Console-header-values-3",
435
+ type: "action",
436
+ value: "Console",
437
+ label: {
438
+ asset: {
439
+ id: "Console-header-values-3-label",
440
+ type: "text",
441
+ value: "Console"
442
+ }
443
+ }
444
+ }
445
+ }
446
+ ]
447
+ }
448
+ },
449
+ main: {
450
+ asset: {
451
+ id: "Console-main",
452
+ type: "console",
453
+ exp: " publish('evaluate-expression', {{expression}}) ",
454
+ binding: "history"
455
+ }
456
+ }
457
+ }
458
+ ],
459
+ navigation: {
460
+ BEGIN: "Plugin",
461
+ Plugin: {
462
+ startState: "CONFIG",
463
+ CONFIG: {
464
+ state_type: "VIEW",
465
+ ref: "Config",
466
+ transitions: {
467
+ Config: "CONFIG",
468
+ Flow: "FLOW",
469
+ Logs: "LOGS",
470
+ Console: "CONSOLE"
471
+ }
472
+ },
473
+ FLOW: {
474
+ state_type: "VIEW",
475
+ ref: "Flow",
476
+ transitions: {
477
+ Config: "CONFIG",
478
+ Flow: "FLOW",
479
+ Logs: "LOGS",
480
+ Console: "CONSOLE"
481
+ }
482
+ },
483
+ LOGS: {
484
+ state_type: "VIEW",
485
+ ref: "Logs",
486
+ transitions: {
487
+ Config: "CONFIG",
488
+ Flow: "FLOW",
489
+ Logs: "LOGS",
490
+ Console: "CONSOLE"
491
+ }
492
+ },
493
+ CONSOLE: {
494
+ state_type: "VIEW",
495
+ ref: "Console",
496
+ transitions: {
497
+ Config: "CONFIG",
498
+ Flow: "FLOW",
499
+ Logs: "LOGS",
500
+ Console: "CONSOLE"
501
+ }
502
+ }
503
+ }
504
+ },
505
+ schema: {
506
+ ROOT: {
507
+ playerConfig: {
508
+ type: "RecordType"
509
+ },
510
+ flow: {
511
+ type: "RecordType"
512
+ },
513
+ expression: {
514
+ type: "StringType",
515
+ default: "",
516
+ validation: [
517
+ {
518
+ type: "string"
519
+ }
520
+ ],
521
+ format: {
522
+ type: "string"
523
+ }
524
+ },
525
+ history: {
526
+ type: "historyType",
527
+ isArray: true
528
+ },
529
+ logs: {
530
+ type: "logsType",
531
+ isArray: true
532
+ }
533
+ },
534
+ logsType: {
535
+ id: {
536
+ type: "StringType",
537
+ default: "",
538
+ validation: [
539
+ {
540
+ type: "string"
541
+ }
542
+ ],
543
+ format: {
544
+ type: "string"
545
+ }
546
+ },
547
+ time: {
548
+ type: "StringType",
549
+ default: "",
550
+ validation: [
551
+ {
552
+ type: "string"
553
+ }
554
+ ],
555
+ format: {
556
+ type: "string"
557
+ }
558
+ },
559
+ type: {
560
+ type: "StringType",
561
+ default: "",
562
+ validation: [
563
+ {
564
+ type: "string"
565
+ }
566
+ ],
567
+ format: {
568
+ type: "string"
569
+ }
570
+ },
571
+ message: {
572
+ type: "StringType",
573
+ default: "",
574
+ validation: [
575
+ {
576
+ type: "string"
577
+ }
578
+ ],
579
+ format: {
580
+ type: "string"
581
+ }
582
+ },
583
+ severity: {
584
+ type: "StringType",
585
+ default: "",
586
+ validation: [
587
+ {
588
+ type: "string"
589
+ }
590
+ ],
591
+ format: {
592
+ type: "string"
593
+ }
594
+ },
595
+ binding: {
596
+ type: "StringType",
597
+ default: "",
598
+ validation: [
599
+ {
600
+ type: "string"
601
+ }
602
+ ],
603
+ format: {
604
+ type: "string"
605
+ }
606
+ },
607
+ from: {
608
+ type: "StringType",
609
+ default: "",
610
+ validation: [
611
+ {
612
+ type: "string"
613
+ }
614
+ ],
615
+ format: {
616
+ type: "string"
617
+ }
618
+ },
619
+ to: {
620
+ type: "StringType",
621
+ default: "",
622
+ validation: [
623
+ {
624
+ type: "string"
625
+ }
626
+ ],
627
+ format: {
628
+ type: "string"
629
+ }
630
+ },
631
+ state: {
632
+ type: "StringType",
633
+ default: "",
634
+ validation: [
635
+ {
636
+ type: "string"
637
+ }
638
+ ],
639
+ format: {
640
+ type: "string"
641
+ }
642
+ },
643
+ error: {
644
+ type: "StringType",
645
+ default: "",
646
+ validation: [
647
+ {
648
+ type: "string"
649
+ }
650
+ ],
651
+ format: {
652
+ type: "string"
653
+ }
654
+ },
655
+ outcome: {
656
+ type: "StringType",
657
+ default: "",
658
+ validation: [
659
+ {
660
+ type: "string"
661
+ }
662
+ ],
663
+ format: {
664
+ type: "string"
665
+ }
666
+ },
667
+ metricType: {
668
+ type: "StringType",
669
+ default: "",
670
+ validation: [
671
+ {
672
+ type: "string"
673
+ }
674
+ ],
675
+ format: {
676
+ type: "string"
677
+ }
678
+ }
679
+ },
680
+ historyType: {
681
+ id: {
682
+ type: "StringType",
683
+ default: "",
684
+ validation: [
685
+ {
686
+ type: "string"
687
+ }
688
+ ],
689
+ format: {
690
+ type: "string"
691
+ }
692
+ },
693
+ expression: {
694
+ type: "StringType",
695
+ default: "",
696
+ validation: [
697
+ {
698
+ type: "string"
699
+ }
700
+ ],
701
+ format: {
702
+ type: "string"
703
+ }
704
+ },
705
+ result: {
706
+ type: "StringType",
707
+ default: "",
708
+ validation: [
709
+ {
710
+ type: "string"
711
+ }
712
+ ],
713
+ format: {
714
+ type: "string"
715
+ }
716
+ },
717
+ severity: {
718
+ type: "StringType",
719
+ default: "",
720
+ validation: [
721
+ {
722
+ type: "string"
723
+ }
724
+ ],
725
+ format: {
726
+ type: "string"
727
+ }
728
+ }
729
+ }
730
+ },
731
+ data: {
732
+ expression: "",
733
+ flow: {},
734
+ history: [],
735
+ logs: [],
736
+ playerConfig: {}
737
+ }
738
+ };
739
+
740
+ // ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/desktop/basic/src/WrapperComponent.tsx
741
+ var pluginData = {
742
+ ...BASE_PLUGIN_DATA,
743
+ flow: generated_default
744
+ };
745
+ var WrapperComponent = ({
746
+ children,
747
+ data,
748
+ playerConfig,
749
+ logs,
750
+ flow,
751
+ expressionEvaluator
752
+ }) => {
753
+ const [state, playerID, dispatch] = (0, import_devtools_desktop_plugins_common.usePluginState)();
754
+ const lastProcessedInteraction = import_react.default.useRef(0);
755
+ const expEvaluator = (0, import_react.useCallback)(getEvaluateExpression(expressionEvaluator), [
756
+ expressionEvaluator
757
+ ]);
758
+ const id = pluginData.id;
759
+ const processInteraction = (0, import_react.useCallback)(
760
+ (interaction) => {
761
+ const {
762
+ payload: { type, payload }
763
+ } = interaction;
764
+ if (type === INTERACTIONS.EVALUATE_EXPRESSION && expressionEvaluator && payload) {
765
+ const result = expEvaluator(payload);
766
+ const newState = (0, import_immer.produce)(state, (draft) => {
767
+ const current = state?.plugins?.[id]?.flow?.data?.history || [];
768
+ (0, import_merge.dset)(
769
+ draft,
770
+ ["plugins", id, "flow", "data", "history"],
771
+ [...current, result]
772
+ );
773
+ });
774
+ dispatch({
775
+ id: -1,
776
+ type: "PLAYER_DEVTOOLS_PLUGIN_DATA_CHANGE",
777
+ payload: {
778
+ pluginID: id,
779
+ data: newState.plugins[id].flow.data
780
+ },
781
+ sender: playerID,
782
+ context: "player",
783
+ target: "player",
784
+ timestamp: Date.now(),
785
+ _messenger_: true
786
+ });
787
+ lastProcessedInteraction.current += 1;
788
+ }
789
+ },
790
+ [dispatch, expressionEvaluator, id, state]
791
+ );
792
+ const pluginDataWithPlayerConfig = (0, import_immer.produce)(pluginData, (draft) => {
793
+ (0, import_merge.dset)(draft, ["flow", "data", "playerConfig"], playerConfig);
794
+ });
795
+ (0, import_react.useEffect)(() => {
796
+ const transaction = {
797
+ id: -1,
798
+ type: "PLAYER_DEVTOOLS_PLAYER_INIT",
799
+ payload: {
800
+ plugins: {
801
+ [id]: pluginDataWithPlayerConfig
802
+ }
803
+ },
804
+ sender: playerID,
805
+ context: "player",
806
+ target: "player",
807
+ timestamp: Date.now(),
808
+ _messenger_: true
809
+ };
810
+ dispatch(transaction);
811
+ }, []);
812
+ (0, import_react.useEffect)(() => {
813
+ if (lastProcessedInteraction.current < (state.interactions.length ?? 0)) {
814
+ state.interactions.slice(lastProcessedInteraction.current).forEach(processInteraction);
815
+ }
816
+ }, [state.interactions.length]);
817
+ (0, import_react.useEffect)(() => {
818
+ if ((0, import_dequal.dequal)(state.plugins[id]?.flow?.data?.data, data))
819
+ return;
820
+ const newState = (0, import_immer.produce)(state, (draft) => {
821
+ (0, import_merge.dset)(draft, ["plugins", id, "flow", "data", "data"], data);
822
+ });
823
+ const transaction = genDataChangeTransaction({
824
+ playerID,
825
+ data: newState.plugins[id].flow.data,
826
+ pluginID: id
827
+ });
828
+ dispatch(transaction);
829
+ }, [data]);
830
+ (0, import_react.useEffect)(() => {
831
+ if ((0, import_dequal.dequal)(state.plugins[id]?.flow?.data?.logs, logs))
832
+ return;
833
+ const newState = (0, import_immer.produce)(state, (draft) => {
834
+ (0, import_merge.dset)(draft, ["plugins", id, "flow", "data", "logs"], logs);
835
+ });
836
+ const transaction = genDataChangeTransaction({
837
+ playerID,
838
+ data: newState.plugins[id].flow.data,
839
+ pluginID: id
840
+ });
841
+ dispatch(transaction);
842
+ }, [logs]);
843
+ (0, import_react.useEffect)(() => {
844
+ if ((0, import_dequal.dequal)(state.plugins[id]?.flow?.data?.flow, flow))
845
+ return;
846
+ const newState = (0, import_immer.produce)(state, (draft) => {
847
+ (0, import_merge.dset)(draft, ["plugins", id, "flow", "data", "flow"], flow);
848
+ });
849
+ const transaction = genDataChangeTransaction({
850
+ playerID,
851
+ data: newState.plugins[id].flow.data,
852
+ pluginID: id
853
+ });
854
+ dispatch(transaction);
855
+ }, [flow]);
856
+ return children;
857
+ };
858
+
859
+ // ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/desktop/basic/src/index.tsx
860
+ var BasicWevDevtoolsPlugin = class {
861
+ name = "player_ui_basic_devtools_plugin";
862
+ data = {};
863
+ playerConfig = {};
864
+ logs = [];
865
+ flow;
866
+ expressionEvaluator;
867
+ view;
868
+ dataController;
869
+ apply(player) {
870
+ this.playerConfig = {
871
+ version: player.getVersion(),
872
+ plugins: player.getPlugins().map((plugin) => plugin.name)
873
+ };
874
+ player.hooks.dataController.tap(this.name, (dataController) => {
875
+ dataController.hooks.onUpdate.tap(this.name, (updates) => {
876
+ const newPlayerState = (0, import_immer2.produce)(this.data, (draft) => {
877
+ updates.forEach(({ binding, newValue }) => {
878
+ (0, import_merge2.dset)(draft, ["data", ...binding.asArray()], newValue);
879
+ });
880
+ });
881
+ this.data = newPlayerState;
882
+ });
883
+ });
884
+ player.logger.hooks.log.tap(this.name, (severity, message) => {
885
+ this.logs = [...this.logs, { severity, message }];
886
+ });
887
+ player.hooks.onStart.tap(this.name, (f) => {
888
+ this.flow = f;
889
+ });
890
+ player.hooks.view.tap(this.name, (view) => {
891
+ this.view = new WeakRef(view);
892
+ });
893
+ player.hooks.expressionEvaluator.tap(this.name, (evaluator) => {
894
+ this.expressionEvaluator = new WeakRef(evaluator);
895
+ });
896
+ }
897
+ applyReact(reactPlayer) {
898
+ reactPlayer.hooks.webComponent.tap(this.name, (Comp) => () => {
899
+ const Component = Comp;
900
+ return /* @__PURE__ */ import_react2.default.createElement(
901
+ WrapperComponent,
902
+ {
903
+ playerConfig: this.playerConfig,
904
+ data: this.data,
905
+ logs: this.logs,
906
+ flow: this.flow,
907
+ view: this.view,
908
+ expressionEvaluator: this.expressionEvaluator
909
+ },
910
+ /* @__PURE__ */ import_react2.default.createElement(Component, null)
911
+ );
912
+ });
913
+ }
914
+ };
915
+ // Annotate the CommonJS export names for ESM import in node:
916
+ 0 && (module.exports = {
917
+ BasicWevDevtoolsPlugin
918
+ });
919
+ //# sourceMappingURL=index.cjs.map