@flamingo-stack/openframe-frontend-core 0.0.733 → 0.0.735

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 (89) hide show
  1. package/dist/build/export-map.json +1 -1
  2. package/dist/{chunk-3KGICRH7.cjs → chunk-36CCUJOE.cjs} +406 -353
  3. package/dist/{chunk-TIMCHP4X.cjs → chunk-3FZZPR76.cjs} +42 -42
  4. package/dist/{chunk-CJVAA7KL.cjs → chunk-3JP2OVH3.cjs} +30 -30
  5. package/dist/{chunk-HSWHOCZ3.cjs → chunk-3X4N3IT7.cjs} +18 -18
  6. package/dist/{chunk-ATMBJBOI.cjs → chunk-4F7V2MAC.cjs} +12 -12
  7. package/dist/{chunk-U4T5NLZD.cjs → chunk-6TTAILSV.cjs} +3 -3
  8. package/dist/{chunk-XDWY6HAW.cjs → chunk-7HT3VHLJ.cjs} +17 -17
  9. package/dist/{chunk-AV5533DH.cjs → chunk-EQ7OOK4B.cjs} +11 -11
  10. package/dist/{chunk-XY632BCH.cjs → chunk-EQH7BUNS.cjs} +4 -4
  11. package/dist/{chunk-3UTPZW36.cjs → chunk-F7STMHT7.cjs} +65 -65
  12. package/dist/{chunk-EMG3T55N.cjs → chunk-HLBFTDUL.cjs} +2 -2
  13. package/dist/{chunk-YIXKH2JO.cjs → chunk-JDXQ6T5P.cjs} +128 -112
  14. package/dist/{chunk-GB3CHAW7.cjs → chunk-MRVZ56GT.cjs} +79 -79
  15. package/dist/{chunk-FNRMDDVN.cjs → chunk-NVCSVGNI.cjs} +33 -33
  16. package/dist/{chunk-P3R23TOE.cjs → chunk-RH3AKULV.cjs} +21 -11
  17. package/dist/{chunk-J7JKPTGO.cjs → chunk-SHQZN5LF.cjs} +6 -6
  18. package/dist/{chunk-ZBNA6TCW.cjs → chunk-SZRZBCWC.cjs} +67 -67
  19. package/dist/{chunk-E26I4XH6.cjs → chunk-T323E2Y6.cjs} +4 -4
  20. package/dist/{chunk-IC4FT3A6.cjs → chunk-TUMUT7CV.cjs} +15 -15
  21. package/dist/{chunk-BP6R5WDW.cjs → chunk-VA7OMDZO.cjs} +41 -23
  22. package/dist/{chunk-EQORT7NK.cjs → chunk-W6E7XCBI.cjs} +38 -38
  23. package/dist/{cloud-tenants-3GOGR3EN.cjs → cloud-tenants-H5D57P4U.cjs} +7 -7
  24. package/dist/components/case-studies/index.cjs +19 -19
  25. package/dist/components/chat/entity-cards/program-card.d.ts.map +1 -1
  26. package/dist/components/chat/entity-cards/program-card.js +6 -6
  27. package/dist/components/chat/index.cjs +5 -5
  28. package/dist/components/contact/index.cjs +8 -8
  29. package/dist/components/docs/index.cjs +11 -11
  30. package/dist/components/embeds/index.cjs +8 -8
  31. package/dist/components/faq/index.cjs +8 -8
  32. package/dist/components/features/cards-strip.d.ts.map +1 -1
  33. package/dist/components/features/cards-strip.js +6 -2
  34. package/dist/components/features/index.cjs +7 -7
  35. package/dist/components/features/video-bites-strip.d.ts +6 -1
  36. package/dist/components/features/video-bites-strip.d.ts.map +1 -1
  37. package/dist/components/features/video-bites-strip.js +15 -3
  38. package/dist/components/help-center-pages/index.cjs +106 -106
  39. package/dist/components/index.cjs +61 -55
  40. package/dist/components/layout/page-heading.d.ts +9 -1
  41. package/dist/components/layout/page-heading.d.ts.map +1 -1
  42. package/dist/components/layout/page-heading.js +15 -5
  43. package/dist/components/meeting-scheduler/index.cjs +29 -29
  44. package/dist/components/navigation/index.cjs +10 -10
  45. package/dist/components/onboarding-guides/index.cjs +10 -10
  46. package/dist/components/product-demo/index.cjs +6 -6
  47. package/dist/components/related-content/index.cjs +4 -4
  48. package/dist/components/tickets/index.cjs +11 -11
  49. package/dist/components/ui/fade-preview.d.ts +5 -1
  50. package/dist/components/ui/fade-preview.d.ts.map +1 -1
  51. package/dist/components/ui/fade-preview.js +18 -1
  52. package/dist/components/ui/index.cjs +13 -7
  53. package/dist/components/ui/index.d.ts +1 -0
  54. package/dist/components/ui/index.d.ts.map +1 -1
  55. package/dist/components/ui/index.js +1 -0
  56. package/dist/components/ui/layout-hold.d.ts +31 -0
  57. package/dist/components/ui/layout-hold.d.ts.map +1 -0
  58. package/dist/components/ui/layout-hold.js +25 -0
  59. package/dist/components/ui/snap-carousel.d.ts.map +1 -1
  60. package/dist/components/ui/snap-carousel.js +28 -15
  61. package/dist/{devices-POZXTP7X.cjs → devices-SQTEXY2H.cjs} +8 -8
  62. package/dist/{embeddable-chat-I3Y5GCCR.cjs → embeddable-chat-S5ODWE3L.cjs} +71 -71
  63. package/dist/hooks/index.cjs +4 -2
  64. package/dist/hooks/ui/index.d.ts +1 -0
  65. package/dist/hooks/ui/index.d.ts.map +1 -1
  66. package/dist/hooks/ui/index.js +1 -0
  67. package/dist/hooks/ui/use-resumable-timeout.d.ts +22 -0
  68. package/dist/hooks/ui/use-resumable-timeout.d.ts.map +1 -0
  69. package/dist/hooks/ui/use-resumable-timeout.js +26 -0
  70. package/dist/hooks/use-scenario-player.d.ts +4 -3
  71. package/dist/hooks/use-scenario-player.d.ts.map +1 -1
  72. package/dist/hooks/use-scenario-player.js +17 -23
  73. package/dist/index.cjs +19 -11
  74. package/dist/{knowledge-AP34IMXN.cjs → knowledge-FO3TPLFO.cjs} +8 -8
  75. package/dist/{logs-CEVMIOPW.cjs → logs-Y4WQB2YR.cjs} +15 -15
  76. package/dist/{policies-AMBMRCGB.cjs → policies-D6VY2ODF.cjs} +11 -11
  77. package/dist/{software-update-Z3MWMSHI.cjs → software-update-7XN6U7HC.cjs} +10 -10
  78. package/package.json +1 -1
  79. package/src/components/chat/entity-cards/program-card.tsx +9 -8
  80. package/src/components/features/cards-strip.tsx +11 -2
  81. package/src/components/features/video-bites-strip.tsx +22 -3
  82. package/src/components/layout/page-heading.tsx +37 -7
  83. package/src/components/ui/fade-preview.tsx +30 -1
  84. package/src/components/ui/index.ts +1 -0
  85. package/src/components/ui/layout-hold.tsx +55 -0
  86. package/src/components/ui/snap-carousel.tsx +36 -20
  87. package/src/hooks/ui/index.ts +1 -0
  88. package/src/hooks/ui/use-resumable-timeout.ts +55 -0
  89. package/src/hooks/use-scenario-player.ts +28 -32
@@ -0,0 +1,22 @@
1
+ export interface UseResumableTimeoutOptions {
2
+ /** The wait counts down only while this is true. */
3
+ running: boolean;
4
+ /** How long the whole wait is. */
5
+ durationMs: number;
6
+ /** A new value starts the wait over from nothing (the slide changed). */
7
+ resetKey: string | number;
8
+ /** Called once the whole wait has been run. */
9
+ onElapsed: () => void;
10
+ }
11
+ /**
12
+ * A wait that PAUSES instead of starting over: `durationMs` of time spent
13
+ * `running`, however many times it is interrupted. A carousel that scrolls off
14
+ * screen half-way through a slide comes back with half a slide left, not a
15
+ * whole one, and the bar that shows the wait picks up where it stopped.
16
+ *
17
+ * Returns how much of the wait had been run at the last stop (0 after a
18
+ * reset), which is what a progress bar draws while it is not running and
19
+ * where it resumes from.
20
+ */
21
+ export declare function useResumableTimeout({ running, durationMs, resetKey, onElapsed }: UseResumableTimeoutOptions): number;
22
+ //# sourceMappingURL=use-resumable-timeout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-resumable-timeout.d.ts","sourceRoot":"","sources":["../../../src/hooks/ui/use-resumable-timeout.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,0BAA0B;IACzC,oDAAoD;IACpD,OAAO,EAAE,OAAO,CAAC;IACjB,kCAAkC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,yEAAyE;IACzE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,+CAA+C;IAC/C,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,0BAA0B,GAAG,MAAM,CA6BpH"}
@@ -0,0 +1,26 @@
1
+ "use client";
2
+ import { useEffect, useRef, useState } from "react";
3
+ function useResumableTimeout({ running, durationMs, resetKey, onElapsed }) {
4
+ const banked = useRef({ key: resetKey, ms: 0 });
5
+ const [shown, setShown] = useState({ key: resetKey, ms: 0 });
6
+ const onElapsedRef = useRef(onElapsed);
7
+ useEffect(() => {
8
+ onElapsedRef.current = onElapsed;
9
+ }, [onElapsed]);
10
+ useEffect(() => {
11
+ if (banked.current.key !== resetKey) banked.current = { key: resetKey, ms: 0 };
12
+ if (!running) return void 0;
13
+ const startedAt = Date.now();
14
+ const timer = setTimeout(() => onElapsedRef.current(), Math.max(0, durationMs - banked.current.ms));
15
+ return () => {
16
+ clearTimeout(timer);
17
+ const ms = Math.min(durationMs, banked.current.ms + (Date.now() - startedAt));
18
+ banked.current = { key: resetKey, ms };
19
+ setShown({ key: resetKey, ms });
20
+ };
21
+ }, [running, durationMs, resetKey]);
22
+ return shown.key === resetKey ? shown.ms : 0;
23
+ }
24
+ export {
25
+ useResumableTimeout
26
+ };
@@ -64,9 +64,10 @@ export interface UseScenarioPlayerResult {
64
64
  * not held by the visitor, motion allowed. Under reduced motion it parks on the last step
65
65
  * of the current scenario, and every scenario can still be read by choosing it.
66
66
  *
67
- * The moment it becomes playable, and at the top of every scenario (the
68
- * rotation moved on, or a tab was chosen), its first step follows within
69
- * `START_MS`, not a whole step later; from there every step takes `stepMs`.
67
+ * A step is `stepMs` of time spent playing: an interruption pauses it and it
68
+ * resumes with what was left (`useResumableTimeout`, the one clock every timed
69
+ * thing here runs on). At the top of a scenario whose first step is the empty
70
+ * stage, that step is left within `START_MS`.
70
71
  *
71
72
  * A visitor's own choice (`go`, `setStep`) moves the clock there and lets go of
72
73
  * any hold; the rotation carries on from that point.
@@ -1 +1 @@
1
- {"version":3,"file":"use-scenario-player.d.ts","sourceRoot":"","sources":["../../src/hooks/use-scenario-player.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,iBAAiB,EAAe,MAAM,mBAAmB,CAAC;AAUxE,MAAM,WAAW,wBAAwB;IACvC,0DAA0D;IAC1D,aAAa,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,QAAQ,EAAE,MAAM,GAAG,CAAC,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;IAClD,oDAAoD;IACpD,MAAM,EAAE,MAAM,CAAC;IACf,oEAAoE;IACpE,MAAM,EAAE,MAAM,CAAC;IACf,4EAA4E;IAC5E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,4BAA4B;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,uBAAuB;IACtC,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB,sFAAsF;IACtF,IAAI,EAAE,OAAO,CAAC;IACd,mFAAmF;IACnF,SAAS,EAAE,iBAAiB,CAAC;IAC7B,kFAAkF;IAClF,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,kDAAkD;IAClD,EAAE,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,qEAAqE;IACrE,aAAa,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,aAAa,EACb,QAAQ,EAAE,cAAc,EACxB,MAAM,EACN,MAAM,EACN,OAAc,EACd,eAAmB,EACnB,UAAkB,EAClB,cAAqB,GACtB,EAAE,wBAAwB,GAAG,uBAAuB,CAgEpD"}
1
+ {"version":3,"file":"use-scenario-player.d.ts","sourceRoot":"","sources":["../../src/hooks/use-scenario-player.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,iBAAiB,EAAe,MAAM,mBAAmB,CAAC;AAWxE,MAAM,WAAW,wBAAwB;IACvC,0DAA0D;IAC1D,aAAa,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,QAAQ,EAAE,MAAM,GAAG,CAAC,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;IAClD,oDAAoD;IACpD,MAAM,EAAE,MAAM,CAAC;IACf,oEAAoE;IACpE,MAAM,EAAE,MAAM,CAAC;IACf,4EAA4E;IAC5E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,4BAA4B;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,uBAAuB;IACtC,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB,sFAAsF;IACtF,IAAI,EAAE,OAAO,CAAC;IACd,mFAAmF;IACnF,SAAS,EAAE,iBAAiB,CAAC;IAC7B,kFAAkF;IAClF,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,kDAAkD;IAClD,EAAE,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,qEAAqE;IACrE,aAAa,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,aAAa,EACb,QAAQ,EAAE,cAAc,EACxB,MAAM,EACN,MAAM,EACN,OAAc,EACd,eAAmB,EACnB,UAAkB,EAClB,cAAqB,GACtB,EAAE,wBAAwB,GAAG,uBAAuB,CA0DpD"}
@@ -1,6 +1,7 @@
1
1
  "use client";
2
- import { useCallback, useEffect, useRef, useState } from "react";
2
+ import { useCallback, useState } from "react";
3
3
  import { useAutoplay } from "./ui/use-autoplay.js";
4
+ import { useResumableTimeout } from "./ui/use-resumable-timeout.js";
4
5
  const START_MS = 300;
5
6
  function useScenarioPlayer({
6
7
  scenarioCount,
@@ -21,28 +22,21 @@ function useScenarioPlayer({
21
22
  const playing = auto.playing && scenarioCount > 0;
22
23
  const [started, setStarted] = useState(false);
23
24
  if (playing && !started) setStarted(true);
24
- const starting = useRef(false);
25
- const wasPlaying = useRef(false);
26
- useEffect(() => {
27
- if (playing && !wasPlaying.current) starting.current = true;
28
- wasPlaying.current = playing;
29
- if (!playing) return void 0;
30
- const atEnd = rawStep >= lastStep;
31
- const quickStart = emptyFirstStep && (starting.current || rawStep === 0) && !atEnd;
32
- starting.current = false;
33
- const timer = setTimeout(
34
- () => {
35
- if (atEnd) {
36
- setScenario((current) => (current + 1) % scenarioCount);
37
- setRawStep(0);
38
- } else {
39
- setRawStep((current) => Math.min(current, lastStep) + 1);
40
- }
41
- },
42
- atEnd ? holdMs : quickStart ? Math.min(START_MS, stepMs) : stepMs
43
- );
44
- return () => clearTimeout(timer);
45
- }, [playing, rawStep, lastStep, stepMs, holdMs, scenario, scenarioCount, emptyFirstStep]);
25
+ const atEnd = rawStep >= lastStep;
26
+ const leavesAtOnce = emptyFirstStep && rawStep === 0 && !atEnd;
27
+ useResumableTimeout({
28
+ running: playing,
29
+ durationMs: atEnd ? holdMs : leavesAtOnce ? Math.min(START_MS, stepMs) : stepMs,
30
+ resetKey: `${scenario}:${Math.min(rawStep, lastStep)}`,
31
+ onElapsed: () => {
32
+ if (atEnd) {
33
+ setScenario((current) => (current + 1) % scenarioCount);
34
+ setRawStep(0);
35
+ } else {
36
+ setRawStep((current) => Math.min(current, lastStep) + 1);
37
+ }
38
+ }
39
+ });
46
40
  const setStep = useCallback(
47
41
  (next) => {
48
42
  setRawStep(Math.max(0, Math.min(lastStep, next)));