stagebook 0.1.0 → 0.3.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.
@@ -1712,6 +1712,7 @@ interface MediaPlayerProps {
1712
1712
  stopAt?: number;
1713
1713
  allowScrubOutsideBounds?: boolean;
1714
1714
  stepDuration?: number;
1715
+ playback?: "once" | "manual";
1715
1716
  controls?: {
1716
1717
  playPause?: boolean;
1717
1718
  seek?: boolean;
@@ -1719,7 +1720,7 @@ interface MediaPlayerProps {
1719
1720
  speed?: boolean;
1720
1721
  };
1721
1722
  }
1722
- declare function MediaPlayer({ name, url, save, getElapsedTime, onComplete, syncToStageTime, submitOnComplete, playVideo, playAudio, captionsURL, startAt, stopAt, allowScrubOutsideBounds, stepDuration, controls, }: MediaPlayerProps): react_jsx_runtime.JSX.Element;
1723
+ declare function MediaPlayer({ name, url, save, getElapsedTime, onComplete, syncToStageTime, submitOnComplete, playVideo, playAudio, captionsURL, startAt, stopAt, allowScrubOutsideBounds, stepDuration, playback, controls, }: MediaPlayerProps): react_jsx_runtime.JSX.Element;
1723
1724
 
1724
1725
  interface Condition {
1725
1726
  reference: string;
@@ -1712,6 +1712,7 @@ interface MediaPlayerProps {
1712
1712
  stopAt?: number;
1713
1713
  allowScrubOutsideBounds?: boolean;
1714
1714
  stepDuration?: number;
1715
+ playback?: "once" | "manual";
1715
1716
  controls?: {
1716
1717
  playPause?: boolean;
1717
1718
  seek?: boolean;
@@ -1719,7 +1720,7 @@ interface MediaPlayerProps {
1719
1720
  speed?: boolean;
1720
1721
  };
1721
1722
  }
1722
- declare function MediaPlayer({ name, url, save, getElapsedTime, onComplete, syncToStageTime, submitOnComplete, playVideo, playAudio, captionsURL, startAt, stopAt, allowScrubOutsideBounds, stepDuration, controls, }: MediaPlayerProps): react_jsx_runtime.JSX.Element;
1723
+ declare function MediaPlayer({ name, url, save, getElapsedTime, onComplete, syncToStageTime, submitOnComplete, playVideo, playAudio, captionsURL, startAt, stopAt, allowScrubOutsideBounds, stepDuration, playback, controls, }: MediaPlayerProps): react_jsx_runtime.JSX.Element;
1723
1724
 
1724
1725
  interface Condition {
1725
1726
  reference: string;
package/dist/index.cjs CHANGED
@@ -8,7 +8,9 @@
8
8
 
9
9
 
10
10
 
11
- var _chunkI2WMGA4Qcjs = require('./chunk-I2WMGA4Q.cjs');
11
+
12
+
13
+ var _chunkYUWSH74Mcjs = require('./chunk-YUWSH74M.cjs');
12
14
 
13
15
  // src/schemas/treatment.ts
14
16
  var _zod = require('zod');
@@ -510,6 +512,7 @@ var mediaPlayerSchema = elementBaseSchema.extend({
510
512
  stepDuration: _zod.z.number().positive().optional(),
511
513
  syncToStageTime: _zod.z.boolean().optional(),
512
514
  submitOnComplete: _zod.z.boolean().optional(),
515
+ playback: _zod.z.enum(["once", "manual"]).optional(),
513
516
  controls: mediaPlayerControlsSchema
514
517
  }).strict();
515
518
  var timelineSchema = elementBaseSchema.extend({
@@ -616,6 +619,21 @@ var elementSchema = altTemplateContext(
616
619
  path: ["controls"]
617
620
  });
618
621
  }
622
+ const mpPlayback = data;
623
+ if (mpPlayback.playback === "once" && mpPlayback.controls) {
624
+ ctx.addIssue({
625
+ code: _zod.z.ZodIssueCode.custom,
626
+ message: 'controls cannot be specified when playback is "once" (participant controls are disabled)',
627
+ path: ["controls"]
628
+ });
629
+ }
630
+ if (mpPlayback.playback === "once" && mpPlayback.syncToStageTime) {
631
+ ctx.addIssue({
632
+ code: _zod.z.ZodIssueCode.custom,
633
+ message: 'playback "once" cannot be combined with syncToStageTime (use syncToStageTime without playback instead)',
634
+ path: ["playback"]
635
+ });
636
+ }
619
637
  }
620
638
  })
621
639
  );
@@ -1224,52 +1242,6 @@ var resolvedTreatmentSchema = _zod.z.object({
1224
1242
  exitSequence: _zod.z.array(resolvedIntroExitStepSchema).optional()
1225
1243
  });
1226
1244
 
1227
- // src/utils/reference.ts
1228
- function getNestedValueByPath(obj, path = []) {
1229
- return path.reduce(
1230
- (acc, key) => acc !== null && acc !== void 0 ? acc[key] : void 0,
1231
- obj
1232
- );
1233
- }
1234
- function getReferenceKeyAndPath(reference) {
1235
- const segments = reference.split(".");
1236
- const [type, ...rest] = segments;
1237
- let name;
1238
- let path = [];
1239
- let referenceKey;
1240
- if (["survey", "submitButton", "qualtrics"].includes(type)) {
1241
- [name, ...path] = rest;
1242
- referenceKey = `${type}_${name}`;
1243
- } else if (type === "prompt") {
1244
- [name] = rest;
1245
- referenceKey = `${type}_${name}`;
1246
- path = ["value"];
1247
- } else if (type === "trackedLink") {
1248
- [name, ...path] = rest;
1249
- referenceKey = `trackedLink_${name}`;
1250
- } else if (["urlParams", "connectionInfo", "browserInfo"].includes(type)) {
1251
- path = rest;
1252
- referenceKey = type;
1253
- } else if (["participantInfo", "discussion"].includes(type)) {
1254
- [name, ...path] = rest;
1255
- referenceKey = name;
1256
- } else {
1257
- throw new Error(`Invalid reference type: ${type}`);
1258
- }
1259
- if (!referenceKey || !name && [
1260
- "survey",
1261
- "submitButton",
1262
- "qualtrics",
1263
- "prompt",
1264
- "trackedLink",
1265
- "participantInfo",
1266
- "discussion"
1267
- ].includes(type)) {
1268
- throw new Error(`Reference ${reference} is missing a name segment.`);
1269
- }
1270
- return { referenceKey, path };
1271
- }
1272
-
1273
1245
  // src/templates/fillTemplates.ts
1274
1246
  function escapeRegExp(str) {
1275
1247
  return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
@@ -1547,5 +1519,5 @@ function getUnresolvedFields({
1547
1519
 
1548
1520
 
1549
1521
 
1550
- exports.baseTreatmentSchema = baseTreatmentSchema; exports.compare = _chunkI2WMGA4Qcjs.compare; exports.computeWatchedRanges = _chunkI2WMGA4Qcjs.computeWatchedRanges; exports.conditionSchema = conditionSchema; exports.conditionsSchema = conditionsSchema; exports.descriptionSchema = descriptionSchema; exports.discussionSchema = discussionSchema; exports.displayRegionSchema = displayRegionSchema; exports.displayTimeSchema = displayTimeSchema; exports.durationSchema = durationSchema; exports.elementSchema = elementSchema; exports.elementsSchema = elementsSchema; exports.evaluateCondition = _chunkI2WMGA4Qcjs.evaluateCondition; exports.evaluateConditions = _chunkI2WMGA4Qcjs.evaluateConditions; exports.exitStepsSchema = exitStepsSchema; exports.expandTemplate = expandTemplate; exports.fileSchema = fileSchema; exports.fillTemplates = fillTemplates; exports.getNestedValueByPath = getNestedValueByPath; exports.getReferenceKeyAndPath = getReferenceKeyAndPath; exports.getUnresolvedFields = getUnresolvedFields; exports.hideFromPositionsSchema = hideFromPositionsSchema; exports.hideTimeSchema = hideTimeSchema; exports.introExitStepSchema = introExitStepSchema; exports.introExitStepsBaseSchema = introExitStepsBaseSchema; exports.introExitStepsSchema = introExitStepsSchema; exports.introSequenceSchema = introSequenceSchema; exports.introSequencesSchema = introSequencesSchema; exports.introStepsSchema = introStepsSchema; exports.matchContentType = matchContentType; exports.metadataLogicalSchema = _chunkI2WMGA4Qcjs.metadataLogicalSchema; exports.metadataRefineSchema = _chunkI2WMGA4Qcjs.metadataRefineSchema; exports.metadataTypeSchema = _chunkI2WMGA4Qcjs.metadataTypeSchema; exports.nameSchema = nameSchema; exports.playerSchema = playerSchema; exports.positionSchema = positionSchema; exports.positionSelectorSchema = positionSelectorSchema; exports.promptFileSchema = _chunkI2WMGA4Qcjs.promptFileSchema; exports.promptSchema = promptSchema; exports.recursivelyFillTemplates = recursivelyFillTemplates; exports.referenceSchema = referenceSchema; exports.resolvedConditionSchema = resolvedConditionSchema; exports.resolvedConditionsSchema = resolvedConditionsSchema; exports.resolvedElementSchema = resolvedElementSchema; exports.resolvedIntroExitStepSchema = resolvedIntroExitStepSchema; exports.resolvedStageSchema = resolvedStageSchema; exports.resolvedTreatmentSchema = resolvedTreatmentSchema; exports.showToPositionsSchema = showToPositionsSchema; exports.stageSchema = stageSchema; exports.substituteFields = substituteFields; exports.templateContentSchema = templateContentSchema; exports.templateContextSchema = templateContextSchema; exports.templateSchema = templateSchema; exports.timelineSchema = timelineSchema; exports.treatmentFileSchema = treatmentFileSchema; exports.treatmentSchema = treatmentSchema; exports.treatmentsSchema = treatmentsSchema; exports.urlSchema = urlSchema; exports.validateSliderLabels = _chunkI2WMGA4Qcjs.validateSliderLabels;
1522
+ exports.baseTreatmentSchema = baseTreatmentSchema; exports.compare = _chunkYUWSH74Mcjs.compare; exports.computeWatchedRanges = _chunkYUWSH74Mcjs.computeWatchedRanges; exports.conditionSchema = conditionSchema; exports.conditionsSchema = conditionsSchema; exports.descriptionSchema = descriptionSchema; exports.discussionSchema = discussionSchema; exports.displayRegionSchema = displayRegionSchema; exports.displayTimeSchema = displayTimeSchema; exports.durationSchema = durationSchema; exports.elementSchema = elementSchema; exports.elementsSchema = elementsSchema; exports.evaluateCondition = _chunkYUWSH74Mcjs.evaluateCondition; exports.evaluateConditions = _chunkYUWSH74Mcjs.evaluateConditions; exports.exitStepsSchema = exitStepsSchema; exports.expandTemplate = expandTemplate; exports.fileSchema = fileSchema; exports.fillTemplates = fillTemplates; exports.getNestedValueByPath = _chunkYUWSH74Mcjs.getNestedValueByPath; exports.getReferenceKeyAndPath = _chunkYUWSH74Mcjs.getReferenceKeyAndPath; exports.getUnresolvedFields = getUnresolvedFields; exports.hideFromPositionsSchema = hideFromPositionsSchema; exports.hideTimeSchema = hideTimeSchema; exports.introExitStepSchema = introExitStepSchema; exports.introExitStepsBaseSchema = introExitStepsBaseSchema; exports.introExitStepsSchema = introExitStepsSchema; exports.introSequenceSchema = introSequenceSchema; exports.introSequencesSchema = introSequencesSchema; exports.introStepsSchema = introStepsSchema; exports.matchContentType = matchContentType; exports.metadataLogicalSchema = _chunkYUWSH74Mcjs.metadataLogicalSchema; exports.metadataRefineSchema = _chunkYUWSH74Mcjs.metadataRefineSchema; exports.metadataTypeSchema = _chunkYUWSH74Mcjs.metadataTypeSchema; exports.nameSchema = nameSchema; exports.playerSchema = playerSchema; exports.positionSchema = positionSchema; exports.positionSelectorSchema = positionSelectorSchema; exports.promptFileSchema = _chunkYUWSH74Mcjs.promptFileSchema; exports.promptSchema = promptSchema; exports.recursivelyFillTemplates = recursivelyFillTemplates; exports.referenceSchema = referenceSchema; exports.resolvedConditionSchema = resolvedConditionSchema; exports.resolvedConditionsSchema = resolvedConditionsSchema; exports.resolvedElementSchema = resolvedElementSchema; exports.resolvedIntroExitStepSchema = resolvedIntroExitStepSchema; exports.resolvedStageSchema = resolvedStageSchema; exports.resolvedTreatmentSchema = resolvedTreatmentSchema; exports.showToPositionsSchema = showToPositionsSchema; exports.stageSchema = stageSchema; exports.substituteFields = substituteFields; exports.templateContentSchema = templateContentSchema; exports.templateContextSchema = templateContextSchema; exports.templateSchema = templateSchema; exports.timelineSchema = timelineSchema; exports.treatmentFileSchema = treatmentFileSchema; exports.treatmentSchema = treatmentSchema; exports.treatmentsSchema = treatmentsSchema; exports.urlSchema = urlSchema; exports.validateSliderLabels = _chunkYUWSH74Mcjs.validateSliderLabels;
1551
1523
  //# sourceMappingURL=index.cjs.map