@flamingo-stack/openframe-frontend-core 0.0.766 → 0.0.767
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/build/export-map.json +1 -1
- package/dist/{chunk-NJMZ3N7Q.cjs → chunk-7TJVYRHR.cjs} +5 -5
- package/dist/{chunk-X7ECVSVN.cjs → chunk-7ZU3AVEX.cjs} +11 -11
- package/dist/{chunk-F7R3U5EN.cjs → chunk-BXMDLQUA.cjs} +2 -2
- package/dist/{chunk-VRDHAR3X.cjs → chunk-FVH53QZJ.cjs} +100 -88
- package/dist/{chunk-7XFVUUVZ.cjs → chunk-GJ5DHDFQ.cjs} +2 -2
- package/dist/{chunk-JKQVKWLB.cjs → chunk-GQ7RGD4Y.cjs} +43 -43
- package/dist/{chunk-K3IHNXR4.cjs → chunk-I7A5MPXA.cjs} +3 -3
- package/dist/{chunk-VYYLYZUC.cjs → chunk-IKXUJUXC.cjs} +2 -2
- package/dist/{chunk-7VI7TOGI.cjs → chunk-JBJVUQVH.cjs} +134 -96
- package/dist/{chunk-JGWN6GH5.cjs → chunk-KHISVNNH.cjs} +4 -4
- package/dist/{chunk-WO3XO27C.cjs → chunk-M2UU3CWX.cjs} +3 -3
- package/dist/{chunk-INI4ADPT.cjs → chunk-MNIMYGFR.cjs} +13 -13
- package/dist/{chunk-NF3PBWDJ.cjs → chunk-NO2DEFAP.cjs} +43 -43
- package/dist/{chunk-UW7UWUZU.cjs → chunk-TPOLNGOW.cjs} +35 -35
- package/dist/{chunk-HNQRY6RU.cjs → chunk-UHDBMKJB.cjs} +3 -3
- package/dist/{chunk-7U3ELNGC.cjs → chunk-WEPIWJGR.cjs} +10 -10
- package/dist/{chunk-RTBYQWAV.cjs → chunk-XIXR6BHI.cjs} +27 -27
- package/dist/{cloud-tenants-U2KMEIO7.cjs → cloud-tenants-WXK5RDSY.cjs} +3 -3
- package/dist/components/case-studies/index.cjs +13 -13
- package/dist/components/chat/index.cjs +2 -2
- package/dist/components/chat/index.d.ts.map +1 -1
- package/dist/components/chat/index.js +18 -4
- package/dist/components/contact/index.cjs +4 -4
- package/dist/components/docs/index.cjs +7 -7
- package/dist/components/embeds/index.cjs +4 -4
- package/dist/components/embeds/rich-markdown-runtime.d.ts +4 -1
- package/dist/components/embeds/rich-markdown-runtime.d.ts.map +1 -1
- package/dist/components/embeds/rich-markdown-runtime.js +6 -5
- package/dist/components/faq/index.cjs +5 -5
- package/dist/components/features/index.cjs +3 -3
- package/dist/components/features/walkthrough-video.d.ts.map +1 -1
- package/dist/components/features/walkthrough-video.js +3 -1
- package/dist/components/help-center-pages/index.cjs +58 -58
- package/dist/components/index.cjs +33 -33
- package/dist/components/meeting-scheduler/index.cjs +24 -24
- package/dist/components/navigation/index.cjs +6 -6
- package/dist/components/onboarding-guides/index.cjs +5 -5
- package/dist/components/product-demo/index.cjs +12 -12
- package/dist/components/tickets/index.cjs +8 -8
- package/dist/components/ui/index.cjs +3 -3
- package/dist/components/ui/markdown/rich/embed-overrides.d.ts.map +1 -1
- package/dist/components/ui/markdown/rich/embed-overrides.js +10 -1
- package/dist/{devices-2D3XSIIE.cjs → devices-UHHHTCJF.cjs} +4 -4
- package/dist/index.cjs +9 -7
- package/dist/{knowledge-AJ36PMK2.cjs → knowledge-TJKHM7W4.cjs} +3 -3
- package/dist/{logs-DNE44ACE.cjs → logs-B3KCCMPE.cjs} +11 -11
- package/dist/{policies-AJHSP6ZY.cjs → policies-ZTUIXSYZ.cjs} +7 -7
- package/dist/{scripts-4YO2QL36.cjs → scripts-FIFAHBS6.cjs} +8 -8
- package/dist/{software-update-KMI2EOO3.cjs → software-update-62PLASQU.cjs} +6 -6
- package/dist/utils/after-page-load.d.ts +8 -0
- package/dist/utils/after-page-load.d.ts.map +1 -0
- package/dist/utils/after-page-load.js +24 -0
- package/dist/utils/index.cjs +24 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/package.json +1 -1
- package/src/components/chat/index.ts +22 -5
- package/src/components/embeds/rich-markdown-runtime.tsx +10 -6
- package/src/components/features/walkthrough-video.tsx +8 -1
- package/src/components/ui/markdown/rich/embed-overrides.tsx +11 -1
- package/src/utils/after-page-load.ts +30 -0
- package/src/utils/index.ts +1 -0
|
@@ -8,7 +8,7 @@ var _chunkSTEJZPIOcjs = require('./chunk-STEJZPIO.cjs');
|
|
|
8
8
|
var _chunkDKOLQPE7cjs = require('./chunk-DKOLQPE7.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkFVH53QZJcjs = require('./chunk-FVH53QZJ.cjs');
|
|
12
12
|
require('./chunk-MPTMT773.cjs');
|
|
13
13
|
require('./chunk-RB7VLVMD.cjs');
|
|
14
14
|
require('./chunk-ZV45VS6K.cjs');
|
|
@@ -21,7 +21,7 @@ require('./chunk-A6P6DHEZ.cjs');
|
|
|
21
21
|
require('./chunk-MZ4KBSH7.cjs');
|
|
22
22
|
require('./chunk-ZRDMGMY7.cjs');
|
|
23
23
|
require('./chunk-C42WIUH6.cjs');
|
|
24
|
-
require('./chunk-
|
|
24
|
+
require('./chunk-JBJVUQVH.cjs');
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
var _chunkYL6ZB2SRcjs = require('./chunk-YL6ZB2SR.cjs');
|
|
@@ -1903,7 +1903,7 @@ function KnowledgeScreen(_props) {
|
|
|
1903
1903
|
const cast = _chunkSTEJZPIOcjs.useProductDemoCast.call(void 0, );
|
|
1904
1904
|
const fixture = _react.useMemo.call(void 0, () => buildKnowledgeFixture(cast), [cast]);
|
|
1905
1905
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-full bg-ods-bg", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1906
|
-
|
|
1906
|
+
_chunkFVH53QZJcjs.KnowledgeBaseArticleView,
|
|
1907
1907
|
{
|
|
1908
1908
|
...fixture.article,
|
|
1909
1909
|
content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYL6ZB2SRcjs.SimpleMarkdownRenderer, { content: fixture.content, textSize: "compact" })
|
|
@@ -16,7 +16,7 @@ var _chunkDKOLQPE7cjs = require('./chunk-DKOLQPE7.cjs');
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunkFVH53QZJcjs = require('./chunk-FVH53QZJ.cjs');
|
|
20
20
|
require('./chunk-MPTMT773.cjs');
|
|
21
21
|
require('./chunk-RB7VLVMD.cjs');
|
|
22
22
|
require('./chunk-ZV45VS6K.cjs');
|
|
@@ -31,7 +31,7 @@ require('./chunk-ZRDMGMY7.cjs');
|
|
|
31
31
|
require('./chunk-C42WIUH6.cjs');
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
var
|
|
34
|
+
var _chunkJBJVUQVHcjs = require('./chunk-JBJVUQVH.cjs');
|
|
35
35
|
require('./chunk-YL6ZB2SR.cjs');
|
|
36
36
|
require('./chunk-GTONIRJU.cjs');
|
|
37
37
|
require('./chunk-RNLRS4ID.cjs');
|
|
@@ -1884,7 +1884,7 @@ function entry(logId, minutesAgo, severity, toolType, device2, summary) {
|
|
|
1884
1884
|
id: logId,
|
|
1885
1885
|
logId,
|
|
1886
1886
|
timestamp: displayTime(_chunkDKOLQPE7cjs.demoMinutesAgo.call(void 0, minutesAgo)),
|
|
1887
|
-
status: { label: severity, variant:
|
|
1887
|
+
status: { label: severity, variant: _chunkFVH53QZJcjs.logSeverityVariant.call(void 0, severity) },
|
|
1888
1888
|
source: { name: toolType, toolType },
|
|
1889
1889
|
device: device2,
|
|
1890
1890
|
description: { title: summary }
|
|
@@ -1956,13 +1956,13 @@ var NO_FILTERS = {};
|
|
|
1956
1956
|
var ACTION_COLUMNS = ["copy", "quickView", "open"];
|
|
1957
1957
|
var BESIDE_DRAWER_HIDDEN = [...ACTION_COLUMNS, "tool", "source"];
|
|
1958
1958
|
var logHref = () => "#";
|
|
1959
|
-
var copyAction = () => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1959
|
+
var copyAction = () => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFVH53QZJcjs.LogCopyIconButton, {});
|
|
1960
1960
|
function LogsScreen({ compact = false }) {
|
|
1961
1961
|
const [dock, setDock] = _react.useState.call(void 0, null);
|
|
1962
1962
|
const selected = LOGS_FIXTURE_SELECTED;
|
|
1963
1963
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex h-full bg-ods-bg", children: [
|
|
1964
1964
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "min-w-0 flex-1 overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1965
|
-
|
|
1965
|
+
_chunkFVH53QZJcjs.LogsPageView,
|
|
1966
1966
|
{
|
|
1967
1967
|
showHeader: false,
|
|
1968
1968
|
className: "p-[var(--spacing-system-l)]",
|
|
@@ -1970,7 +1970,7 @@ function LogsScreen({ compact = false }) {
|
|
|
1970
1970
|
onSearchChange: noop,
|
|
1971
1971
|
onOpenFilters: noop,
|
|
1972
1972
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1973
|
-
|
|
1973
|
+
_chunkFVH53QZJcjs.LogsTableView,
|
|
1974
1974
|
{
|
|
1975
1975
|
logs: LOGS_FIXTURE_ENTRIES,
|
|
1976
1976
|
facets: LOGS_FIXTURE_FACETS,
|
|
@@ -1984,8 +1984,8 @@ function LogsScreen({ compact = false }) {
|
|
|
1984
1984
|
)
|
|
1985
1985
|
}
|
|
1986
1986
|
) }),
|
|
1987
|
-
!compact && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ref: setDock, className: "relative w-[calc(400px+var(--spacing-system-m))] shrink-0", children: dock && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1988
|
-
|
|
1987
|
+
!compact && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ref: setDock, className: "relative w-[calc(400px+var(--spacing-system-m))] shrink-0", children: dock && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFVH53QZJcjs.AppLayoutDrawerContainerContext.Provider, { value: dock, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1988
|
+
_chunkFVH53QZJcjs.LogDrawer,
|
|
1989
1989
|
{
|
|
1990
1990
|
docked: true,
|
|
1991
1991
|
isOpen: true,
|
|
@@ -1997,12 +1997,12 @@ function LogsScreen({ compact = false }) {
|
|
|
1997
1997
|
{ label: "Log ID", value: selected.logId },
|
|
1998
1998
|
{
|
|
1999
1999
|
label: "Source",
|
|
2000
|
-
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2000
|
+
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFVH53QZJcjs.ToolBadge, { toolType: _chunkJBJVUQVHcjs.normalizeToolTypeWithFallback.call(void 0, selected.source.toolType) })
|
|
2001
2001
|
},
|
|
2002
|
-
{ label: "Device", value:
|
|
2002
|
+
{ label: "Device", value: _chunkFVH53QZJcjs.logSourceLabels.call(void 0, selected.device).deviceName }
|
|
2003
2003
|
],
|
|
2004
2004
|
deviceCard: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2005
|
-
|
|
2005
|
+
_chunkFVH53QZJcjs.DeviceCard,
|
|
2006
2006
|
{
|
|
2007
2007
|
...LOGS_FIXTURE_DEVICE,
|
|
2008
2008
|
actions: {
|
|
@@ -10,7 +10,7 @@ var _chunkDKOLQPE7cjs = require('./chunk-DKOLQPE7.cjs');
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunkFVH53QZJcjs = require('./chunk-FVH53QZJ.cjs');
|
|
14
14
|
require('./chunk-MPTMT773.cjs');
|
|
15
15
|
require('./chunk-RB7VLVMD.cjs');
|
|
16
16
|
require('./chunk-ZV45VS6K.cjs');
|
|
@@ -23,7 +23,7 @@ require('./chunk-A6P6DHEZ.cjs');
|
|
|
23
23
|
require('./chunk-MZ4KBSH7.cjs');
|
|
24
24
|
require('./chunk-ZRDMGMY7.cjs');
|
|
25
25
|
require('./chunk-C42WIUH6.cjs');
|
|
26
|
-
require('./chunk-
|
|
26
|
+
require('./chunk-JBJVUQVH.cjs');
|
|
27
27
|
require('./chunk-YL6ZB2SR.cjs');
|
|
28
28
|
require('./chunk-GTONIRJU.cjs');
|
|
29
29
|
require('./chunk-RNLRS4ID.cjs');
|
|
@@ -1889,14 +1889,14 @@ var POLICIES = [
|
|
|
1889
1889
|
policy("policy-local-admins", "No local admins", "No everyday account is a local administrator.", false, 0)
|
|
1890
1890
|
];
|
|
1891
1891
|
var POLICIES_FIXTURE = {
|
|
1892
|
-
summary:
|
|
1892
|
+
summary: _chunkFVH53QZJcjs.computePolicySummary.call(void 0, POLICIES),
|
|
1893
1893
|
rows: POLICIES.map((item) => ({
|
|
1894
1894
|
id: item.id,
|
|
1895
1895
|
name: item.name,
|
|
1896
1896
|
description: item.description,
|
|
1897
1897
|
critical: item.critical,
|
|
1898
1898
|
severityLabel: item.critical ? "Critical" : "Low",
|
|
1899
|
-
status:
|
|
1899
|
+
status: _chunkFVH53QZJcjs.getPolicyTableStatus.call(void 0, item),
|
|
1900
1900
|
actions: [
|
|
1901
1901
|
{ label: "Policy Details", onClick: noop },
|
|
1902
1902
|
{ label: "Delete Policy", onClick: noop }
|
|
@@ -1910,16 +1910,16 @@ var POLICIES_FIXTURE = {
|
|
|
1910
1910
|
var _jsxruntime = require('react/jsx-runtime');
|
|
1911
1911
|
function PoliciesScreen({ compact = false }) {
|
|
1912
1912
|
const table = /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1913
|
-
|
|
1913
|
+
_chunkFVH53QZJcjs.PoliciesTable,
|
|
1914
1914
|
{
|
|
1915
1915
|
rows: POLICIES_FIXTURE.rows,
|
|
1916
1916
|
rowAsLink: true,
|
|
1917
|
-
rightSlot: compact ? void 0 : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1917
|
+
rightSlot: compact ? void 0 : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFVH53QZJcjs.DataTable.RowCount, {}),
|
|
1918
1918
|
emptyMessage: "No policies found."
|
|
1919
1919
|
}
|
|
1920
1920
|
);
|
|
1921
1921
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex h-full flex-col gap-[var(--spacing-system-l)] bg-ods-bg p-[var(--spacing-system-l)]", children: [
|
|
1922
|
-
!compact && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1922
|
+
!compact && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFVH53QZJcjs.PolicySummaryCards, { summary: POLICIES_FIXTURE.summary, now: POLICIES_FIXTURE.now }),
|
|
1923
1923
|
table
|
|
1924
1924
|
] });
|
|
1925
1925
|
}
|
|
@@ -13,7 +13,7 @@ var _chunkDKOLQPE7cjs = require('./chunk-DKOLQPE7.cjs');
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _chunkFVH53QZJcjs = require('./chunk-FVH53QZJ.cjs');
|
|
17
17
|
require('./chunk-MPTMT773.cjs');
|
|
18
18
|
require('./chunk-RB7VLVMD.cjs');
|
|
19
19
|
|
|
@@ -28,7 +28,7 @@ require('./chunk-A6P6DHEZ.cjs');
|
|
|
28
28
|
require('./chunk-MZ4KBSH7.cjs');
|
|
29
29
|
require('./chunk-ZRDMGMY7.cjs');
|
|
30
30
|
require('./chunk-C42WIUH6.cjs');
|
|
31
|
-
require('./chunk-
|
|
31
|
+
require('./chunk-JBJVUQVH.cjs');
|
|
32
32
|
require('./chunk-YL6ZB2SR.cjs');
|
|
33
33
|
require('./chunk-GTONIRJU.cjs');
|
|
34
34
|
require('./chunk-RNLRS4ID.cjs');
|
|
@@ -1993,8 +1993,8 @@ function buildScriptsFixture(cast) {
|
|
|
1993
1993
|
var _jsxruntime = require('react/jsx-runtime');
|
|
1994
1994
|
var WIDE_HIDDEN_COLUMNS = ["result", "open"];
|
|
1995
1995
|
var COMPACT_COLUMNS = [
|
|
1996
|
-
{ ...
|
|
1997
|
-
|
|
1996
|
+
{ ..._chunkFVH53QZJcjs.EXECUTION_COLUMNS.machineId, width: "flex-1 min-w-0", hideAt: void 0 },
|
|
1997
|
+
_chunkFVH53QZJcjs.EXECUTION_COLUMNS.status
|
|
1998
1998
|
];
|
|
1999
1999
|
var COMPACT_ROWS = 4;
|
|
2000
2000
|
var TOKEN_CLASS = {
|
|
@@ -2053,7 +2053,7 @@ function ScriptCodePicture({ script }) {
|
|
|
2053
2053
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex min-w-0 items-center justify-between gap-[var(--spacing-system-m)]", children: [
|
|
2054
2054
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkZV45VS6Kcjs.TruncateText, { variant: "h6", tone: "secondary", children: `Written by ${provenance.author} \xB7 approved by ${provenance.approver}` }),
|
|
2055
2055
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2056
|
-
|
|
2056
|
+
_chunkFVH53QZJcjs.ScriptShellBadge,
|
|
2057
2057
|
{
|
|
2058
2058
|
value: script.shellType,
|
|
2059
2059
|
className: "shrink-0 text-ods-text-secondary text-h6",
|
|
@@ -2077,7 +2077,7 @@ function ScriptsScreen({ compact = false }) {
|
|
|
2077
2077
|
return (
|
|
2078
2078
|
// Four runs of the card's row height fill the frame; the padding is what is left round them.
|
|
2079
2079
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-full overflow-hidden bg-ods-bg p-[var(--spacing-system-xsf)]", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2080
|
-
|
|
2080
|
+
_chunkFVH53QZJcjs.ScriptExecutionsTable,
|
|
2081
2081
|
{
|
|
2082
2082
|
rows: fixture.executions.slice(0, COMPACT_ROWS),
|
|
2083
2083
|
columns: COMPACT_COLUMNS,
|
|
@@ -2087,13 +2087,13 @@ function ScriptsScreen({ compact = false }) {
|
|
|
2087
2087
|
) })
|
|
2088
2088
|
);
|
|
2089
2089
|
}
|
|
2090
|
-
const renderOutput = (row) => row.id === fixture.openExecutionId ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2090
|
+
const renderOutput = (row) => row.id === fixture.openExecutionId ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFVH53QZJcjs.ScriptExecutionResult, { result: row.result, empty: "\u2014" }) : null;
|
|
2091
2091
|
return (
|
|
2092
2092
|
// The frame's tighter padding and no header row: the output opened under a run needs the height.
|
|
2093
2093
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex h-full gap-[var(--spacing-system-m)] overflow-hidden bg-ods-bg p-[var(--spacing-system-m)]", children: [
|
|
2094
2094
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-[39%] shrink-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ScriptCodePicture, { script: fixture.script }) }),
|
|
2095
2095
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "min-w-0 flex-1 overflow-hidden", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2096
|
-
|
|
2096
|
+
_chunkFVH53QZJcjs.ScriptExecutionsTable,
|
|
2097
2097
|
{
|
|
2098
2098
|
rows: fixture.executions,
|
|
2099
2099
|
hideColumns: WIDE_HIDDEN_COLUMNS,
|
|
@@ -15,7 +15,7 @@ var _chunkDKOLQPE7cjs = require('./chunk-DKOLQPE7.cjs');
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _chunkFVH53QZJcjs = require('./chunk-FVH53QZJ.cjs');
|
|
19
19
|
require('./chunk-MPTMT773.cjs');
|
|
20
20
|
require('./chunk-RB7VLVMD.cjs');
|
|
21
21
|
|
|
@@ -30,7 +30,7 @@ require('./chunk-A6P6DHEZ.cjs');
|
|
|
30
30
|
require('./chunk-MZ4KBSH7.cjs');
|
|
31
31
|
require('./chunk-ZRDMGMY7.cjs');
|
|
32
32
|
require('./chunk-C42WIUH6.cjs');
|
|
33
|
-
require('./chunk-
|
|
33
|
+
require('./chunk-JBJVUQVH.cjs');
|
|
34
34
|
require('./chunk-YL6ZB2SR.cjs');
|
|
35
35
|
require('./chunk-GTONIRJU.cjs');
|
|
36
36
|
require('./chunk-RNLRS4ID.cjs');
|
|
@@ -1920,12 +1920,12 @@ function StaticPackageField({ value }) {
|
|
|
1920
1920
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1921
1921
|
_chunkZV45VS6Kcjs.Autocomplete,
|
|
1922
1922
|
{
|
|
1923
|
-
label:
|
|
1923
|
+
label: _chunkFVH53QZJcjs.PACKAGE_SEARCH_LABEL,
|
|
1924
1924
|
labelVariant: "large",
|
|
1925
1925
|
options: value ? [{ value: value.id, label: value.name, description: _nullishCoalesce(value.description, () => ( void 0)) }] : [],
|
|
1926
1926
|
value: _nullishCoalesce(_optionalChain([value, 'optionalAccess', _ => _.id]), () => ( null)),
|
|
1927
1927
|
onChange: noop,
|
|
1928
|
-
placeholder:
|
|
1928
|
+
placeholder: _chunkFVH53QZJcjs.PACKAGE_SEARCH_PLACEHOLDER
|
|
1929
1929
|
}
|
|
1930
1930
|
);
|
|
1931
1931
|
}
|
|
@@ -1939,7 +1939,7 @@ function SoftwareUpdateScreen({ compact = false }) {
|
|
|
1939
1939
|
[fixture.devices, fixture.selectedIds]
|
|
1940
1940
|
);
|
|
1941
1941
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-full bg-ods-bg pt-[var(--spacing-system-l)]", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-full", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1942
|
-
|
|
1942
|
+
_chunkFVH53QZJcjs.SoftwareActionForm,
|
|
1943
1943
|
{
|
|
1944
1944
|
action: fixture.action,
|
|
1945
1945
|
showHeader: false,
|
|
@@ -1951,7 +1951,7 @@ function SoftwareUpdateScreen({ compact = false }) {
|
|
|
1951
1951
|
initialValues: fixture.initialValues,
|
|
1952
1952
|
renderPackageSearch,
|
|
1953
1953
|
renderDevicePicker: () => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1954
|
-
|
|
1954
|
+
_chunkFVH53QZJcjs.DeviceSelector,
|
|
1955
1955
|
{
|
|
1956
1956
|
devices: selected,
|
|
1957
1957
|
loading: false,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run `run` once the page has loaded and the browser is idle: the moment for work no visitor waits on (a widget
|
|
3
|
+
* that starts closed, a tracker). Whatever runs before then competes with the page's first paint and hydration, which
|
|
4
|
+
* is what slows a phone's Largest Contentful Paint. `maxWaitMs` bounds the idle wait, so a page that is never idle
|
|
5
|
+
* still gets it. Returns a cancel.
|
|
6
|
+
*/
|
|
7
|
+
export declare function afterPageLoad(run: () => void, maxWaitMs?: number): () => void;
|
|
8
|
+
//# sourceMappingURL=after-page-load.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"after-page-load.d.ts","sourceRoot":"","sources":["../../src/utils/after-page-load.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,IAAI,EAAE,SAAS,SAAO,GAAG,MAAM,IAAI,CAuB3E"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
function afterPageLoad(run, maxWaitMs = 2e3) {
|
|
2
|
+
if (typeof window === "undefined") return () => {
|
|
3
|
+
};
|
|
4
|
+
const w = window;
|
|
5
|
+
let idleHandle = null;
|
|
6
|
+
let timer = null;
|
|
7
|
+
let cancelled = false;
|
|
8
|
+
const whenIdle = () => {
|
|
9
|
+
if (cancelled) return;
|
|
10
|
+
if (typeof w.requestIdleCallback === "function") idleHandle = w.requestIdleCallback(run, { timeout: maxWaitMs });
|
|
11
|
+
else timer = setTimeout(run, 0);
|
|
12
|
+
};
|
|
13
|
+
if (document.readyState === "complete") whenIdle();
|
|
14
|
+
else window.addEventListener("load", whenIdle, { once: true });
|
|
15
|
+
return () => {
|
|
16
|
+
cancelled = true;
|
|
17
|
+
window.removeEventListener("load", whenIdle);
|
|
18
|
+
if (idleHandle !== null) w.cancelIdleCallback?.(idleHandle);
|
|
19
|
+
if (timer !== null) clearTimeout(timer);
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
afterPageLoad
|
|
24
|
+
};
|
package/dist/utils/index.cjs
CHANGED
|
@@ -82763,6 +82763,29 @@ function isAnnouncementOnSurface(announcement, surface) {
|
|
|
82763
82763
|
return !surfaces?.length || surfaces.includes(surface);
|
|
82764
82764
|
}
|
|
82765
82765
|
|
|
82766
|
+
// src/utils/after-page-load.ts
|
|
82767
|
+
function afterPageLoad(run, maxWaitMs = 2e3) {
|
|
82768
|
+
if (typeof window === "undefined") return () => {
|
|
82769
|
+
};
|
|
82770
|
+
const w = window;
|
|
82771
|
+
let idleHandle = null;
|
|
82772
|
+
let timer = null;
|
|
82773
|
+
let cancelled = false;
|
|
82774
|
+
const whenIdle = () => {
|
|
82775
|
+
if (cancelled) return;
|
|
82776
|
+
if (typeof w.requestIdleCallback === "function") idleHandle = w.requestIdleCallback(run, { timeout: maxWaitMs });
|
|
82777
|
+
else timer = setTimeout(run, 0);
|
|
82778
|
+
};
|
|
82779
|
+
if (document.readyState === "complete") whenIdle();
|
|
82780
|
+
else window.addEventListener("load", whenIdle, { once: true });
|
|
82781
|
+
return () => {
|
|
82782
|
+
cancelled = true;
|
|
82783
|
+
window.removeEventListener("load", whenIdle);
|
|
82784
|
+
if (idleHandle !== null) w.cancelIdleCallback?.(idleHandle);
|
|
82785
|
+
if (timer !== null) clearTimeout(timer);
|
|
82786
|
+
};
|
|
82787
|
+
}
|
|
82788
|
+
|
|
82766
82789
|
// src/utils/dismissal-storage.ts
|
|
82767
82790
|
var WALKTHROUGH_VIDEO_DISMISS_KEY = "walkthrough-video-dismissed";
|
|
82768
82791
|
function walkthroughDismissCookieName(platform) {
|
|
@@ -86203,6 +86226,7 @@ exports.VENDOR_CLASSIFICATION_COPY = VENDOR_CLASSIFICATION_COPY;
|
|
|
86203
86226
|
exports.VIEWER_TIMEZONE = VIEWER_TIMEZONE;
|
|
86204
86227
|
exports.WALKTHROUGH_OPEN_QUERY_PARAM = WALKTHROUGH_OPEN_QUERY_PARAM;
|
|
86205
86228
|
exports.WALKTHROUGH_VIDEO_DISMISS_KEY = WALKTHROUGH_VIDEO_DISMISS_KEY;
|
|
86229
|
+
exports.afterPageLoad = afterPageLoad;
|
|
86206
86230
|
exports.aiProvider = aiProvider;
|
|
86207
86231
|
exports.analyzeImageColor = analyzeImageColor;
|
|
86208
86232
|
exports.announcementDismissCookieName = announcementDismissCookieName;
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ export * from './color-analysis';
|
|
|
40
40
|
export * from './announcement-storage';
|
|
41
41
|
export * from './announcement-surface';
|
|
42
42
|
export * from './dismiss-cookie';
|
|
43
|
+
export * from './after-page-load';
|
|
43
44
|
export * from './dismissal-storage';
|
|
44
45
|
export * from './walkthrough-deep-link';
|
|
45
46
|
export { type GetProxiedImageUrlOptions, getProxiedImageUrl, urlPathLooksLikeSvg, shouldProxyImage, generateImageSizes, skipsImageOptimizer, } from './image-proxy';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAK1B,OAAO,EACL,cAAc,EACd,wBAAwB,EACxB,yBAAyB,EACzB,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAI7B,OAAO,EAAE,UAAU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EACrB,eAAe,EACf,aAAa,EACb,UAAU,EACV,aAAa,GACd,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAGjG,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACpE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/utils/index.js
CHANGED
|
@@ -87,6 +87,7 @@ export * from "./color-analysis.js";
|
|
|
87
87
|
export * from "./announcement-storage.js";
|
|
88
88
|
export * from "./announcement-surface.js";
|
|
89
89
|
export * from "./dismiss-cookie.js";
|
|
90
|
+
export * from "./after-page-load.js";
|
|
90
91
|
export * from "./dismissal-storage.js";
|
|
91
92
|
export * from "./walkthrough-deep-link.js";
|
|
92
93
|
import {
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
// Chat components exports
|
|
4
|
-
import { createElement, forwardRef, lazy, Suspense, useEffect } from 'react';
|
|
4
|
+
import { createElement, forwardRef, lazy, Suspense, useEffect, useState } from 'react';
|
|
5
|
+
import { afterPageLoad } from '../../utils/after-page-load';
|
|
5
6
|
import type { EmbeddableChatHandle, EmbeddableChatProps } from './embeddable-chat';
|
|
6
|
-
import { holdAskAiOpens } from './utils/ask-ai-events';
|
|
7
|
+
import { ASK_AI_OPEN_EVENTS, holdAskAiOpens } from './utils/ask-ai-events';
|
|
7
8
|
export * from './approval-request-message';
|
|
8
9
|
export * from './approval-batch-message';
|
|
9
10
|
export * from './escalation-offer-message';
|
|
@@ -104,15 +105,31 @@ export * from './stream';
|
|
|
104
105
|
export * from './utils';
|
|
105
106
|
|
|
106
107
|
// EmbeddableChat — THE chat. Hosts mount it once at the root after providing a
|
|
107
|
-
// <ChatRuntimeContext.Provider>. Its module is loaded on its own,
|
|
108
|
-
//
|
|
109
|
-
//
|
|
108
|
+
// <ChatRuntimeContext.Provider>. Its module is loaded on its own (`lazy`), and
|
|
109
|
+
// only once the page has loaded and the browser is idle (`afterPageLoad`), or at
|
|
110
|
+
// once when something asks for it (an open event, `open` or `defaultOpen`): a
|
|
111
|
+
// chat that starts closed must not download and run beside the page's first
|
|
112
|
+
// paint, which is what slowed every page's LCP on phones. An open sent before it
|
|
113
|
+
// has loaded is held and delivered (`ask-ai-events`).
|
|
110
114
|
export type { ChatPrefillDraft, EmbeddableChatHandle, EmbeddableChatProps } from './embeddable-chat';
|
|
111
115
|
const LoadedEmbeddableChat = lazy(() =>
|
|
112
116
|
import('./embeddable-chat').then(module => ({ default: module.EmbeddableChat })),
|
|
113
117
|
);
|
|
114
118
|
export const EmbeddableChat = forwardRef<EmbeddableChatHandle, EmbeddableChatProps>((props, ref) => {
|
|
119
|
+
const [loadRequested, setLoadRequested] = useState(false);
|
|
120
|
+
const load = loadRequested || Boolean(props.open) || Boolean(props.defaultOpen);
|
|
115
121
|
useEffect(() => holdAskAiOpens(), []);
|
|
122
|
+
useEffect(() => {
|
|
123
|
+
if (load) return undefined;
|
|
124
|
+
const start = () => setLoadRequested(true);
|
|
125
|
+
for (const name of ASK_AI_OPEN_EVENTS) window.addEventListener(name, start);
|
|
126
|
+
const cancel = afterPageLoad(start);
|
|
127
|
+
return () => {
|
|
128
|
+
cancel();
|
|
129
|
+
for (const name of ASK_AI_OPEN_EVENTS) window.removeEventListener(name, start);
|
|
130
|
+
};
|
|
131
|
+
}, [load]);
|
|
132
|
+
if (!load) return null;
|
|
116
133
|
return createElement(Suspense, { fallback: null }, createElement(LoadedEmbeddableChat, { ...props, ref }));
|
|
117
134
|
});
|
|
118
135
|
EmbeddableChat.displayName = 'EmbeddableChat';
|
|
@@ -41,7 +41,10 @@ const DEFAULT_RUNTIME: RichMarkdownRuntime = {
|
|
|
41
41
|
const RichMarkdownRuntimeContext = createContext<RichMarkdownRuntime>(DEFAULT_RUNTIME);
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
|
-
* Provider that fills in
|
|
44
|
+
* Provider that fills in any prop the caller didn't pass from the provider ABOVE it (the host's, mounted once at the
|
|
45
|
+
* root), and from the defaults only where there is none. `RichMarkdownRenderer` mounts one of these around every
|
|
46
|
+
* document; filling from the defaults there replaced the host's runtime with `transformImageSrc: () => null`, so each
|
|
47
|
+
* in-article image's size probe downloaded the full original file on every markdown page (CU-17tkuw5xp4q).
|
|
45
48
|
* Memoizes the resolved runtime so satellites don't re-render when an
|
|
46
49
|
* unrelated parent state ticks.
|
|
47
50
|
*/
|
|
@@ -52,14 +55,15 @@ export function RichMarkdownRuntimeProvider({
|
|
|
52
55
|
transformImageSrc,
|
|
53
56
|
children,
|
|
54
57
|
}: Partial<RichMarkdownRuntime> & { children: ReactNode }) {
|
|
58
|
+
const outer = useContext(RichMarkdownRuntimeContext);
|
|
55
59
|
const value = useMemo<RichMarkdownRuntime>(
|
|
56
60
|
() => ({
|
|
57
|
-
redditProxyUrl: redditProxyUrl ??
|
|
58
|
-
twitterProxyUrl: twitterProxyUrl ??
|
|
59
|
-
ogScraperUrl: ogScraperUrl ??
|
|
60
|
-
transformImageSrc: transformImageSrc ??
|
|
61
|
+
redditProxyUrl: redditProxyUrl ?? outer.redditProxyUrl,
|
|
62
|
+
twitterProxyUrl: twitterProxyUrl ?? outer.twitterProxyUrl,
|
|
63
|
+
ogScraperUrl: ogScraperUrl ?? outer.ogScraperUrl,
|
|
64
|
+
transformImageSrc: transformImageSrc ?? outer.transformImageSrc,
|
|
61
65
|
}),
|
|
62
|
-
[redditProxyUrl, twitterProxyUrl, ogScraperUrl, transformImageSrc],
|
|
66
|
+
[redditProxyUrl, twitterProxyUrl, ogScraperUrl, transformImageSrc, outer],
|
|
63
67
|
);
|
|
64
68
|
return <RichMarkdownRuntimeContext.Provider value={value}>{children}</RichMarkdownRuntimeContext.Provider>;
|
|
65
69
|
}
|
|
@@ -66,6 +66,7 @@
|
|
|
66
66
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
67
67
|
import type React from 'react';
|
|
68
68
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
69
|
+
import { resizedImageUrl } from '../../embed-shims/next-image';
|
|
69
70
|
import { useIsHydrated } from '../../hooks/ui/use-is-hydrated';
|
|
70
71
|
import { MEDIA_ASPECT } from '../../styles/component-sizes';
|
|
71
72
|
import { cn } from '../../utils/cn';
|
|
@@ -91,6 +92,9 @@ import { VideoPlayBadge, VideoUnmuteGlyph } from './video-center-badge';
|
|
|
91
92
|
import { VideoHoverPreviewSurface } from './video-hover-preview';
|
|
92
93
|
import type { VideoPlayerHandle, VideoMutedFallbackState } from './video-shared';
|
|
93
94
|
|
|
95
|
+
/** The poster width the collapsed card asks for: its widest box (320px) at 2x for retina screens. */
|
|
96
|
+
const CARD_POSTER_WIDTH_PX = 640;
|
|
97
|
+
|
|
94
98
|
/** The inline card's box: 16:9 across the host's width, rounded and bordered. ONE string, read by the card and
|
|
95
99
|
* its skeleton, so the page keeps the same height before and after the player mounts. */
|
|
96
100
|
const INLINE_CARD_BOX_CLASS = `${MEDIA_ASPECT.video} w-full rounded-md border border-ods-border`;
|
|
@@ -1063,7 +1067,10 @@ function WalkthroughVideo({
|
|
|
1063
1067
|
// File player only. The theater resolves YouTube-wins; the card must
|
|
1064
1068
|
// not mount MuxPlayer on a youtube.com URL (it renders the poster).
|
|
1065
1069
|
url={video.mainVideoUrl || ''}
|
|
1066
|
-
|
|
1070
|
+
// The card is at most 320px wide: ask the host for a poster twice that (retina), not the full-size
|
|
1071
|
+
// original the theater shows (a 1920x1080 file drawn at 333x187, CU-17tkuw5xp4q). The original is kept
|
|
1072
|
+
// where the host registered no resizer.
|
|
1073
|
+
posterUrl={video.posterUrl ? resizedImageUrl(video.posterUrl, CARD_POSTER_WIDTH_PX) : video.posterUrl}
|
|
1067
1074
|
active={cardActive}
|
|
1068
1075
|
isClone={false}
|
|
1069
1076
|
badge="play"
|
|
@@ -18,7 +18,7 @@ import { MarkdownImage } from '../../../embeds/markdown-image';
|
|
|
18
18
|
import { OGLinkPreview, OGLinkErrorBoundary } from '../../../embeds/og-link-preview';
|
|
19
19
|
import { RedditEmbedClient } from '../../../embeds/reddit-embed-client';
|
|
20
20
|
import { TwitterEmbedClient } from '../../../embeds/twitter-embed-client';
|
|
21
|
-
import { Video } from '../../../features/video';
|
|
21
|
+
import { extractYouTubeId, Video } from '../../../features/video';
|
|
22
22
|
import { buildStandardLeafRenderers, hasRenderableSrc, type MdRenderProps } from '../base-components';
|
|
23
23
|
import type { TextSizeElement } from '../text-size';
|
|
24
24
|
|
|
@@ -224,6 +224,16 @@ export function buildRichEmbedOverrides({
|
|
|
224
224
|
return <MarkdownImage src={src.trim()} alt={alt} />;
|
|
225
225
|
},
|
|
226
226
|
|
|
227
|
+
// Raw <iframe> tags in stored content (a pasted YouTube embed). A YouTube one becomes the same click-to-play
|
|
228
|
+
// facade as the `youtube-embed` fence: the raw iframe loaded YouTube's whole player (about 470 KB of script) with
|
|
229
|
+
// the page, on every post that carried one (CU-17tkuw5xp4q). Any other iframe loads when it nears the screen.
|
|
230
|
+
iframe: ({ node: _node, src, ...rest }: MdRenderProps<'iframe'>) => {
|
|
231
|
+
if (!hasRenderableSrc(src)) return null;
|
|
232
|
+
const url = src.trim();
|
|
233
|
+
if (extractYouTubeId(url)) return <Video kind="youtube" url={url} />;
|
|
234
|
+
return <iframe {...rest} src={url} loading="lazy" />;
|
|
235
|
+
},
|
|
236
|
+
|
|
227
237
|
// Raw <video> tags in stored content (blog publisher injection) route
|
|
228
238
|
// to the <Video> SSOT (MuxPlayer) so HLS manifests play everywhere.
|
|
229
239
|
video: ({ src, poster, className }: MdRenderProps<'video'>) => {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run `run` once the page has loaded and the browser is idle: the moment for work no visitor waits on (a widget
|
|
3
|
+
* that starts closed, a tracker). Whatever runs before then competes with the page's first paint and hydration, which
|
|
4
|
+
* is what slows a phone's Largest Contentful Paint. `maxWaitMs` bounds the idle wait, so a page that is never idle
|
|
5
|
+
* still gets it. Returns a cancel.
|
|
6
|
+
*/
|
|
7
|
+
export function afterPageLoad(run: () => void, maxWaitMs = 2000): () => void {
|
|
8
|
+
if (typeof window === 'undefined') return () => {};
|
|
9
|
+
type IdleWindow = Window & {
|
|
10
|
+
requestIdleCallback?: (cb: () => void, opts?: { timeout: number }) => number;
|
|
11
|
+
cancelIdleCallback?: (handle: number) => void;
|
|
12
|
+
};
|
|
13
|
+
const w = window as IdleWindow;
|
|
14
|
+
let idleHandle: number | null = null;
|
|
15
|
+
let timer: ReturnType<typeof setTimeout> | null = null;
|
|
16
|
+
let cancelled = false;
|
|
17
|
+
const whenIdle = () => {
|
|
18
|
+
if (cancelled) return;
|
|
19
|
+
if (typeof w.requestIdleCallback === 'function') idleHandle = w.requestIdleCallback(run, { timeout: maxWaitMs });
|
|
20
|
+
else timer = setTimeout(run, 0);
|
|
21
|
+
};
|
|
22
|
+
if (document.readyState === 'complete') whenIdle();
|
|
23
|
+
else window.addEventListener('load', whenIdle, { once: true });
|
|
24
|
+
return () => {
|
|
25
|
+
cancelled = true;
|
|
26
|
+
window.removeEventListener('load', whenIdle);
|
|
27
|
+
if (idleHandle !== null) w.cancelIdleCallback?.(idleHandle);
|
|
28
|
+
if (timer !== null) clearTimeout(timer);
|
|
29
|
+
};
|
|
30
|
+
}
|
package/src/utils/index.ts
CHANGED
|
@@ -138,6 +138,7 @@ export * from './announcement-storage';
|
|
|
138
138
|
export * from './announcement-surface';
|
|
139
139
|
// cookie id-match dismissal store (walkthrough video widget)
|
|
140
140
|
export * from './dismiss-cookie';
|
|
141
|
+
export * from './after-page-load';
|
|
141
142
|
export * from './dismissal-storage';
|
|
142
143
|
// walkthrough deep-link query param (widget default + host URL minters)
|
|
143
144
|
export * from './walkthrough-deep-link';
|