@player-tools/devtools-basic-web-plugin 0.6.1--canary.110.2690 → 0.6.1-next.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.
@@ -16,7 +16,8 @@ var PLUGIN_NAME = "Standard Devtools";
16
16
  var PLUGIN_DESCRIPTION = "Standard Player UI Devtools";
17
17
  var PLUGIN_VERSION = "0.0.1";
18
18
  var INTERACTIONS = {
19
- EVALUATE_EXPRESSION: "evaluate-expression"
19
+ EVALUATE_EXPRESSION: "evaluate-expression",
20
+ OVERRIDE_FLOW: "override-flow"
20
21
  };
21
22
  var BASE_PLUGIN_DATA = {
22
23
  id: PLUGIN_ID,
@@ -157,6 +158,20 @@ var generated_default = {
157
158
  }
158
159
  }
159
160
  }
161
+ },
162
+ {
163
+ asset: {
164
+ id: "Config-header-values-4",
165
+ type: "action",
166
+ value: "Editor",
167
+ label: {
168
+ asset: {
169
+ id: "Config-header-values-4-label",
170
+ type: "text",
171
+ value: "Editor"
172
+ }
173
+ }
174
+ }
160
175
  }
161
176
  ]
162
177
  }
@@ -239,6 +254,20 @@ var generated_default = {
239
254
  }
240
255
  }
241
256
  }
257
+ },
258
+ {
259
+ asset: {
260
+ id: "Flow-header-values-4",
261
+ type: "action",
262
+ value: "Editor",
263
+ label: {
264
+ asset: {
265
+ id: "Flow-header-values-4-label",
266
+ type: "text",
267
+ value: "Editor"
268
+ }
269
+ }
270
+ }
242
271
  }
243
272
  ]
244
273
  }
@@ -335,6 +364,20 @@ var generated_default = {
335
364
  }
336
365
  }
337
366
  }
367
+ },
368
+ {
369
+ asset: {
370
+ id: "Logs-header-values-4",
371
+ type: "action",
372
+ value: "Editor",
373
+ label: {
374
+ asset: {
375
+ id: "Logs-header-values-4-label",
376
+ type: "text",
377
+ value: "Editor"
378
+ }
379
+ }
380
+ }
338
381
  }
339
382
  ]
340
383
  }
@@ -410,6 +453,20 @@ var generated_default = {
410
453
  }
411
454
  }
412
455
  }
456
+ },
457
+ {
458
+ asset: {
459
+ id: "Console-header-values-4",
460
+ type: "action",
461
+ value: "Editor",
462
+ label: {
463
+ asset: {
464
+ id: "Console-header-values-4-label",
465
+ type: "text",
466
+ value: "Editor"
467
+ }
468
+ }
469
+ }
413
470
  }
414
471
  ]
415
472
  }
@@ -422,6 +479,96 @@ var generated_default = {
422
479
  binding: "history"
423
480
  }
424
481
  }
482
+ },
483
+ {
484
+ id: "Editor",
485
+ type: "stacked-view",
486
+ header: {
487
+ asset: {
488
+ id: "Editor-header",
489
+ type: "navigation",
490
+ values: [
491
+ {
492
+ asset: {
493
+ id: "Editor-header-values-0",
494
+ type: "action",
495
+ value: "Config",
496
+ label: {
497
+ asset: {
498
+ id: "Editor-header-values-0-label",
499
+ type: "text",
500
+ value: "Config"
501
+ }
502
+ }
503
+ }
504
+ },
505
+ {
506
+ asset: {
507
+ id: "Editor-header-values-1",
508
+ type: "action",
509
+ value: "Flow",
510
+ label: {
511
+ asset: {
512
+ id: "Editor-header-values-1-label",
513
+ type: "text",
514
+ value: "Flow"
515
+ }
516
+ }
517
+ }
518
+ },
519
+ {
520
+ asset: {
521
+ id: "Editor-header-values-2",
522
+ type: "action",
523
+ value: "Logs",
524
+ label: {
525
+ asset: {
526
+ id: "Editor-header-values-2-label",
527
+ type: "text",
528
+ value: "Logs"
529
+ }
530
+ }
531
+ }
532
+ },
533
+ {
534
+ asset: {
535
+ id: "Editor-header-values-3",
536
+ type: "action",
537
+ value: "Console",
538
+ label: {
539
+ asset: {
540
+ id: "Editor-header-values-3-label",
541
+ type: "text",
542
+ value: "Console"
543
+ }
544
+ }
545
+ }
546
+ },
547
+ {
548
+ asset: {
549
+ id: "Editor-header-values-4",
550
+ type: "action",
551
+ value: "Editor",
552
+ label: {
553
+ asset: {
554
+ id: "Editor-header-values-4-label",
555
+ type: "text",
556
+ value: "Editor"
557
+ }
558
+ }
559
+ }
560
+ }
561
+ ]
562
+ }
563
+ },
564
+ main: {
565
+ asset: {
566
+ id: "Editor-main",
567
+ type: "code-editor",
568
+ binding: "flow",
569
+ exp: " publish('override-flow', {{code}}) "
570
+ }
571
+ }
425
572
  }
426
573
  ],
427
574
  navigation: {
@@ -435,7 +582,8 @@ var generated_default = {
435
582
  Config: "CONFIG",
436
583
  Flow: "FLOW",
437
584
  Logs: "LOGS",
438
- Console: "CONSOLE"
585
+ Console: "CONSOLE",
586
+ Editor: "EDITOR"
439
587
  }
440
588
  },
441
589
  FLOW: {
@@ -445,7 +593,8 @@ var generated_default = {
445
593
  Config: "CONFIG",
446
594
  Flow: "FLOW",
447
595
  Logs: "LOGS",
448
- Console: "CONSOLE"
596
+ Console: "CONSOLE",
597
+ Editor: "EDITOR"
449
598
  }
450
599
  },
451
600
  LOGS: {
@@ -455,7 +604,8 @@ var generated_default = {
455
604
  Config: "CONFIG",
456
605
  Flow: "FLOW",
457
606
  Logs: "LOGS",
458
- Console: "CONSOLE"
607
+ Console: "CONSOLE",
608
+ Editor: "EDITOR"
459
609
  }
460
610
  },
461
611
  CONSOLE: {
@@ -465,7 +615,19 @@ var generated_default = {
465
615
  Config: "CONFIG",
466
616
  Flow: "FLOW",
467
617
  Logs: "LOGS",
468
- Console: "CONSOLE"
618
+ Console: "CONSOLE",
619
+ Editor: "EDITOR"
620
+ }
621
+ },
622
+ EDITOR: {
623
+ state_type: "VIEW",
624
+ ref: "Editor",
625
+ transitions: {
626
+ Config: "CONFIG",
627
+ Flow: "FLOW",
628
+ Logs: "LOGS",
629
+ Console: "CONSOLE",
630
+ Editor: "EDITOR"
469
631
  }
470
632
  }
471
633
  }
@@ -490,6 +652,18 @@ var generated_default = {
490
652
  type: "string"
491
653
  }
492
654
  },
655
+ code: {
656
+ type: "StringType",
657
+ default: "",
658
+ validation: [
659
+ {
660
+ type: "string"
661
+ }
662
+ ],
663
+ format: {
664
+ type: "string"
665
+ }
666
+ },
493
667
  history: {
494
668
  type: "historyType",
495
669
  isArray: true
@@ -716,7 +890,8 @@ var WrapperComponent = ({
716
890
  playerConfig,
717
891
  logs,
718
892
  flow,
719
- expressionEvaluator
893
+ expressionEvaluator,
894
+ overrideFlow
720
895
  }) => {
721
896
  const [state, playerID, dispatch] = usePluginState();
722
897
  const lastProcessedInteraction = React.useRef(0);
@@ -754,6 +929,15 @@ var WrapperComponent = ({
754
929
  });
755
930
  lastProcessedInteraction.current += 1;
756
931
  }
932
+ if (type === INTERACTIONS.OVERRIDE_FLOW && payload && overrideFlow) {
933
+ let newFlow;
934
+ try {
935
+ newFlow = JSON.parse(payload);
936
+ } catch (e) {
937
+ console.error("Error parsing new flow", e);
938
+ }
939
+ newFlow && overrideFlow(newFlow);
940
+ }
757
941
  },
758
942
  [dispatch, expressionEvaluator, id, state]
759
943
  );
@@ -834,6 +1018,7 @@ var BasicWevDevtoolsPlugin = class {
834
1018
  expressionEvaluator;
835
1019
  view;
836
1020
  dataController;
1021
+ overrideFlow;
837
1022
  checkIfDevtoolsIsActive() {
838
1023
  return localStorage.getItem("player-ui-devtools-active") === "true";
839
1024
  }
@@ -868,6 +1053,7 @@ var BasicWevDevtoolsPlugin = class {
868
1053
  player.hooks.expressionEvaluator.tap(this.name, (evaluator) => {
869
1054
  this.expressionEvaluator = new WeakRef(evaluator);
870
1055
  });
1056
+ this.overrideFlow = player.start.bind(player);
871
1057
  }
872
1058
  applyReact(reactPlayer) {
873
1059
  if (!this.checkIfDevtoolsIsActive()) {
@@ -883,6 +1069,7 @@ var BasicWevDevtoolsPlugin = class {
883
1069
  logs: this.logs,
884
1070
  flow: this.flow,
885
1071
  view: this.view,
1072
+ overrideFlow: this.overrideFlow,
886
1073
  expressionEvaluator: this.expressionEvaluator
887
1074
  },
888
1075
  /* @__PURE__ */ React2.createElement(Component, null)
package/dist/index.mjs CHANGED
@@ -16,7 +16,8 @@ var PLUGIN_NAME = "Standard Devtools";
16
16
  var PLUGIN_DESCRIPTION = "Standard Player UI Devtools";
17
17
  var PLUGIN_VERSION = "0.0.1";
18
18
  var INTERACTIONS = {
19
- EVALUATE_EXPRESSION: "evaluate-expression"
19
+ EVALUATE_EXPRESSION: "evaluate-expression",
20
+ OVERRIDE_FLOW: "override-flow"
20
21
  };
21
22
  var BASE_PLUGIN_DATA = {
22
23
  id: PLUGIN_ID,
@@ -157,6 +158,20 @@ var generated_default = {
157
158
  }
158
159
  }
159
160
  }
161
+ },
162
+ {
163
+ asset: {
164
+ id: "Config-header-values-4",
165
+ type: "action",
166
+ value: "Editor",
167
+ label: {
168
+ asset: {
169
+ id: "Config-header-values-4-label",
170
+ type: "text",
171
+ value: "Editor"
172
+ }
173
+ }
174
+ }
160
175
  }
161
176
  ]
162
177
  }
@@ -239,6 +254,20 @@ var generated_default = {
239
254
  }
240
255
  }
241
256
  }
257
+ },
258
+ {
259
+ asset: {
260
+ id: "Flow-header-values-4",
261
+ type: "action",
262
+ value: "Editor",
263
+ label: {
264
+ asset: {
265
+ id: "Flow-header-values-4-label",
266
+ type: "text",
267
+ value: "Editor"
268
+ }
269
+ }
270
+ }
242
271
  }
243
272
  ]
244
273
  }
@@ -335,6 +364,20 @@ var generated_default = {
335
364
  }
336
365
  }
337
366
  }
367
+ },
368
+ {
369
+ asset: {
370
+ id: "Logs-header-values-4",
371
+ type: "action",
372
+ value: "Editor",
373
+ label: {
374
+ asset: {
375
+ id: "Logs-header-values-4-label",
376
+ type: "text",
377
+ value: "Editor"
378
+ }
379
+ }
380
+ }
338
381
  }
339
382
  ]
340
383
  }
@@ -410,6 +453,20 @@ var generated_default = {
410
453
  }
411
454
  }
412
455
  }
456
+ },
457
+ {
458
+ asset: {
459
+ id: "Console-header-values-4",
460
+ type: "action",
461
+ value: "Editor",
462
+ label: {
463
+ asset: {
464
+ id: "Console-header-values-4-label",
465
+ type: "text",
466
+ value: "Editor"
467
+ }
468
+ }
469
+ }
413
470
  }
414
471
  ]
415
472
  }
@@ -422,6 +479,96 @@ var generated_default = {
422
479
  binding: "history"
423
480
  }
424
481
  }
482
+ },
483
+ {
484
+ id: "Editor",
485
+ type: "stacked-view",
486
+ header: {
487
+ asset: {
488
+ id: "Editor-header",
489
+ type: "navigation",
490
+ values: [
491
+ {
492
+ asset: {
493
+ id: "Editor-header-values-0",
494
+ type: "action",
495
+ value: "Config",
496
+ label: {
497
+ asset: {
498
+ id: "Editor-header-values-0-label",
499
+ type: "text",
500
+ value: "Config"
501
+ }
502
+ }
503
+ }
504
+ },
505
+ {
506
+ asset: {
507
+ id: "Editor-header-values-1",
508
+ type: "action",
509
+ value: "Flow",
510
+ label: {
511
+ asset: {
512
+ id: "Editor-header-values-1-label",
513
+ type: "text",
514
+ value: "Flow"
515
+ }
516
+ }
517
+ }
518
+ },
519
+ {
520
+ asset: {
521
+ id: "Editor-header-values-2",
522
+ type: "action",
523
+ value: "Logs",
524
+ label: {
525
+ asset: {
526
+ id: "Editor-header-values-2-label",
527
+ type: "text",
528
+ value: "Logs"
529
+ }
530
+ }
531
+ }
532
+ },
533
+ {
534
+ asset: {
535
+ id: "Editor-header-values-3",
536
+ type: "action",
537
+ value: "Console",
538
+ label: {
539
+ asset: {
540
+ id: "Editor-header-values-3-label",
541
+ type: "text",
542
+ value: "Console"
543
+ }
544
+ }
545
+ }
546
+ },
547
+ {
548
+ asset: {
549
+ id: "Editor-header-values-4",
550
+ type: "action",
551
+ value: "Editor",
552
+ label: {
553
+ asset: {
554
+ id: "Editor-header-values-4-label",
555
+ type: "text",
556
+ value: "Editor"
557
+ }
558
+ }
559
+ }
560
+ }
561
+ ]
562
+ }
563
+ },
564
+ main: {
565
+ asset: {
566
+ id: "Editor-main",
567
+ type: "code-editor",
568
+ binding: "flow",
569
+ exp: " publish('override-flow', {{code}}) "
570
+ }
571
+ }
425
572
  }
426
573
  ],
427
574
  navigation: {
@@ -435,7 +582,8 @@ var generated_default = {
435
582
  Config: "CONFIG",
436
583
  Flow: "FLOW",
437
584
  Logs: "LOGS",
438
- Console: "CONSOLE"
585
+ Console: "CONSOLE",
586
+ Editor: "EDITOR"
439
587
  }
440
588
  },
441
589
  FLOW: {
@@ -445,7 +593,8 @@ var generated_default = {
445
593
  Config: "CONFIG",
446
594
  Flow: "FLOW",
447
595
  Logs: "LOGS",
448
- Console: "CONSOLE"
596
+ Console: "CONSOLE",
597
+ Editor: "EDITOR"
449
598
  }
450
599
  },
451
600
  LOGS: {
@@ -455,7 +604,8 @@ var generated_default = {
455
604
  Config: "CONFIG",
456
605
  Flow: "FLOW",
457
606
  Logs: "LOGS",
458
- Console: "CONSOLE"
607
+ Console: "CONSOLE",
608
+ Editor: "EDITOR"
459
609
  }
460
610
  },
461
611
  CONSOLE: {
@@ -465,7 +615,19 @@ var generated_default = {
465
615
  Config: "CONFIG",
466
616
  Flow: "FLOW",
467
617
  Logs: "LOGS",
468
- Console: "CONSOLE"
618
+ Console: "CONSOLE",
619
+ Editor: "EDITOR"
620
+ }
621
+ },
622
+ EDITOR: {
623
+ state_type: "VIEW",
624
+ ref: "Editor",
625
+ transitions: {
626
+ Config: "CONFIG",
627
+ Flow: "FLOW",
628
+ Logs: "LOGS",
629
+ Console: "CONSOLE",
630
+ Editor: "EDITOR"
469
631
  }
470
632
  }
471
633
  }
@@ -490,6 +652,18 @@ var generated_default = {
490
652
  type: "string"
491
653
  }
492
654
  },
655
+ code: {
656
+ type: "StringType",
657
+ default: "",
658
+ validation: [
659
+ {
660
+ type: "string"
661
+ }
662
+ ],
663
+ format: {
664
+ type: "string"
665
+ }
666
+ },
493
667
  history: {
494
668
  type: "historyType",
495
669
  isArray: true
@@ -716,7 +890,8 @@ var WrapperComponent = ({
716
890
  playerConfig,
717
891
  logs,
718
892
  flow,
719
- expressionEvaluator
893
+ expressionEvaluator,
894
+ overrideFlow
720
895
  }) => {
721
896
  const [state, playerID, dispatch] = usePluginState();
722
897
  const lastProcessedInteraction = React.useRef(0);
@@ -754,6 +929,15 @@ var WrapperComponent = ({
754
929
  });
755
930
  lastProcessedInteraction.current += 1;
756
931
  }
932
+ if (type === INTERACTIONS.OVERRIDE_FLOW && payload && overrideFlow) {
933
+ let newFlow;
934
+ try {
935
+ newFlow = JSON.parse(payload);
936
+ } catch (e) {
937
+ console.error("Error parsing new flow", e);
938
+ }
939
+ newFlow && overrideFlow(newFlow);
940
+ }
757
941
  },
758
942
  [dispatch, expressionEvaluator, id, state]
759
943
  );
@@ -834,6 +1018,7 @@ var BasicWevDevtoolsPlugin = class {
834
1018
  expressionEvaluator;
835
1019
  view;
836
1020
  dataController;
1021
+ overrideFlow;
837
1022
  checkIfDevtoolsIsActive() {
838
1023
  return localStorage.getItem("player-ui-devtools-active") === "true";
839
1024
  }
@@ -868,6 +1053,7 @@ var BasicWevDevtoolsPlugin = class {
868
1053
  player.hooks.expressionEvaluator.tap(this.name, (evaluator) => {
869
1054
  this.expressionEvaluator = new WeakRef(evaluator);
870
1055
  });
1056
+ this.overrideFlow = player.start.bind(player);
871
1057
  }
872
1058
  applyReact(reactPlayer) {
873
1059
  if (!this.checkIfDevtoolsIsActive()) {
@@ -883,6 +1069,7 @@ var BasicWevDevtoolsPlugin = class {
883
1069
  logs: this.logs,
884
1070
  flow: this.flow,
885
1071
  view: this.view,
1072
+ overrideFlow: this.overrideFlow,
886
1073
  expressionEvaluator: this.expressionEvaluator
887
1074
  },
888
1075
  /* @__PURE__ */ React2.createElement(Component, null)