@flamingo-stack/openframe-frontend-core 0.0.719 → 0.0.720
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/{chunk-4JIGEK7C.cjs → chunk-2C72EWQR.cjs} +93 -29
- package/dist/{chunk-IWCPXJEE.js → chunk-3HZ6XSZC.js} +2 -4
- package/dist/{chunk-ZXCZYMN4.cjs → chunk-4SIZCHVZ.cjs} +13 -15
- package/dist/{chunk-E2V2EH2G.cjs → chunk-5XDCCQ4A.cjs} +15 -15
- package/dist/{chunk-HCFNEKO3.cjs → chunk-6BLN5WDS.cjs} +41 -41
- package/dist/{chunk-D6PMVWDI.js → chunk-6W46LVK4.js} +5 -5
- package/dist/{chunk-JHQ334WS.js → chunk-742BGXNX.js} +2 -0
- package/dist/{chunk-AECTRMGQ.cjs → chunk-7GRPR7XA.cjs} +13 -1
- package/dist/{chunk-AJHSQ5XK.js → chunk-7HYEQKN6.js} +6 -6
- package/dist/{chunk-2JLP2X2M.js → chunk-7IOU6BJE.js} +12 -11
- package/dist/{chunk-7BREFV7G.cjs → chunk-7LPR4RZ3.cjs} +34 -36
- package/dist/chunk-AFTRPEXO.js +13 -0
- package/dist/{chunk-JPD4NXH6.js → chunk-AZRI4XBP.js} +1 -1
- package/dist/{chunk-4QFWGLZO.js → chunk-B2N4YX66.js} +1 -1
- package/dist/{chunk-TELAANY6.js → chunk-B5LNX4GZ.js} +2 -2
- package/dist/{chunk-SWAVO7BB.cjs → chunk-DHNJSQGX.cjs} +91 -91
- package/dist/{chunk-LOZLHG2U.cjs → chunk-DOPOHO6H.cjs} +20 -20
- package/dist/{chunk-NQVS4G7G.cjs → chunk-DYDDAA6O.cjs} +519 -518
- package/dist/{chunk-DFEPUYTF.cjs → chunk-EVMM3JE6.cjs} +44 -46
- package/dist/chunk-EWPR7662.cjs +13 -0
- package/dist/{chunk-AGVXKD4K.js → chunk-FSQQZFVG.js} +12 -0
- package/dist/{chunk-TTVOLEUS.js → chunk-GANIUMRU.js} +89 -2
- package/dist/{chunk-TDZ76NCB.cjs → chunk-HFEYEPOG.cjs} +27 -27
- package/dist/{chunk-LE5WKGJV.cjs → chunk-HTS46FFY.cjs} +3 -3
- package/dist/{chunk-H5VIMBRN.cjs → chunk-IL3ZWNM2.cjs} +4 -4
- package/dist/{chunk-PSVSEN4J.cjs → chunk-IMTY3GRR.cjs} +2 -0
- package/dist/{chunk-WS7WRR5Z.cjs → chunk-ISCZ6UNF.cjs} +85 -89
- package/dist/{chunk-XGHGGBM3.js → chunk-K2BYVPGR.js} +3 -3
- package/dist/{chunk-HWVUR735.cjs → chunk-KSGMZHVV.cjs} +2 -2
- package/dist/{chunk-FVQJBII6.js → chunk-LO3KCLEF.js} +1 -1
- package/dist/{chunk-MA4Q5RBP.cjs → chunk-NYSMDM4J.cjs} +2 -2
- package/dist/{chunk-5YAGX5DY.js → chunk-O3MKJU6A.js} +6 -6
- package/dist/{chunk-H5V7GRN5.js → chunk-PSMJYZMV.js} +4 -6
- package/dist/{chunk-JH2SIWPQ.js → chunk-PXAKSPLZ.js} +1586 -1263
- package/dist/{chunk-CU6NWO2M.js → chunk-Q5327DXK.js} +13 -17
- package/dist/{chunk-NYWESHOQ.cjs → chunk-QF464PPL.cjs} +39 -39
- package/dist/{chunk-UWQWMGJ7.cjs → chunk-RDP5UZXQ.cjs} +888 -565
- package/dist/{chunk-ETYLOZOB.cjs → chunk-RFUOIQSG.cjs} +100 -13
- package/dist/{chunk-DC4RTYWK.cjs → chunk-RZQGIWK3.cjs} +3 -3
- package/dist/{chunk-EAHOB64X.js → chunk-TORERAXD.js} +105 -41
- package/dist/{chunk-6YPTUHM7.js → chunk-URW23QUM.js} +1 -1
- package/dist/{chunk-QBCDSTLE.cjs → chunk-UWJMDFDO.cjs} +18 -18
- package/dist/{chunk-4D6NMPOO.js → chunk-V6B2FBZK.js} +5 -5
- package/dist/{chunk-5U3KWQXP.js → chunk-VBHGJFA3.js} +10 -10
- package/dist/{chunk-LCLDFMDF.cjs → chunk-VF2CJXZ2.cjs} +15 -15
- package/dist/{chunk-7BCY77W6.js → chunk-VYVPII4W.js} +8 -10
- package/dist/{chunk-TTEFN6VO.js → chunk-VYZCKY5K.js} +9 -9
- package/dist/{chunk-E7YCPY7K.cjs → chunk-XSM46FHD.cjs} +3 -3
- package/dist/{chunk-NZ5BHDFZ.js → chunk-XW3Q623Q.js} +1 -1
- package/dist/{chunk-Y4MB25KW.js → chunk-YK3X74SF.js} +1 -1
- package/dist/{chunk-ZKNZ2CXW.cjs → chunk-ZHD3F2TH.cjs} +3 -3
- package/dist/{chunk-KBJJQFYU.js → chunk-ZPHOQDAE.js} +1 -1
- package/dist/{cloud-tenants-DNBPNQNP.js → cloud-tenants-RKQRSDNE.js} +9 -9
- package/dist/{cloud-tenants-FBUO66GW.cjs → cloud-tenants-UQZASXUB.cjs} +10 -10
- package/dist/components/case-studies/index.cjs +23 -23
- package/dist/components/case-studies/index.js +10 -10
- package/dist/components/chat/ask-prompts.d.ts +10 -2
- package/dist/components/chat/ask-prompts.d.ts.map +1 -1
- package/dist/components/chat/assistant-ask-prompts.d.ts +27 -0
- package/dist/components/chat/assistant-ask-prompts.d.ts.map +1 -0
- package/dist/components/chat/entity-cards/dispatch.d.ts.map +1 -1
- package/dist/components/chat/hooks/index.d.ts +1 -0
- package/dist/components/chat/hooks/index.d.ts.map +1 -1
- package/dist/components/chat/hooks/use-ask-prompts.d.ts +63 -0
- package/dist/components/chat/hooks/use-ask-prompts.d.ts.map +1 -0
- package/dist/components/chat/index.cjs +23 -6
- package/dist/components/chat/index.d.ts +1 -0
- package/dist/components/chat/index.d.ts.map +1 -1
- package/dist/components/chat/index.js +22 -5
- package/dist/components/chat/utils/icon-library.d.ts.map +1 -1
- package/dist/components/contact/index.cjs +11 -11
- package/dist/components/contact/index.js +10 -10
- package/dist/components/docs/index.cjs +14 -14
- package/dist/components/docs/index.js +13 -13
- package/dist/components/embeds/index.cjs +11 -11
- package/dist/components/embeds/index.js +10 -10
- package/dist/components/faq/faq-ask-card.d.ts +44 -0
- package/dist/components/faq/faq-ask-card.d.ts.map +1 -0
- package/dist/components/faq/faq-document-page.d.ts +5 -1
- package/dist/components/faq/faq-document-page.d.ts.map +1 -1
- package/dist/components/faq/faq-section.d.ts +18 -5
- package/dist/components/faq/faq-section.d.ts.map +1 -1
- package/dist/components/faq/index.cjs +13 -12
- package/dist/components/faq/index.d.ts +1 -0
- package/dist/components/faq/index.d.ts.map +1 -1
- package/dist/components/faq/index.js +12 -11
- package/dist/components/features/auth/auth-benefits-panel.d.ts.map +1 -1
- package/dist/components/features/index.cjs +10 -10
- package/dist/components/features/index.js +9 -9
- package/dist/components/help-center-pages/index.cjs +104 -105
- package/dist/components/help-center-pages/index.js +28 -29
- package/dist/components/help-center-pages/trust-center-page.d.ts +4 -1
- package/dist/components/help-center-pages/trust-center-page.d.ts.map +1 -1
- package/dist/components/index.cjs +109 -197
- package/dist/components/index.js +228 -316
- package/dist/components/meeting-scheduler/index.cjs +50 -51
- package/dist/components/meeting-scheduler/index.js +12 -13
- package/dist/components/navigation/index.cjs +13 -13
- package/dist/components/navigation/index.js +12 -12
- package/dist/components/navigation/mingo-ai-button.d.ts +1 -1
- package/dist/components/navigation/mingo-ai-button.d.ts.map +1 -1
- package/dist/components/onboarding-guides/index.cjs +13 -14
- package/dist/components/onboarding-guides/index.js +12 -13
- package/dist/components/product-demo/index.cjs +7 -7
- package/dist/components/product-demo/index.js +7 -7
- package/dist/components/related-content/index.cjs +5 -7
- package/dist/components/related-content/index.js +4 -6
- package/dist/components/tickets/index.cjs +15 -15
- package/dist/components/tickets/index.js +14 -14
- package/dist/components/ui/index.cjs +26 -10
- package/dist/components/ui/index.js +25 -9
- package/dist/contexts/assistant-runtime-context.d.ts +74 -0
- package/dist/contexts/assistant-runtime-context.d.ts.map +1 -0
- package/dist/contexts/index.cjs +7 -1
- package/dist/contexts/index.d.ts +1 -0
- package/dist/contexts/index.d.ts.map +1 -1
- package/dist/contexts/index.js +6 -0
- package/dist/{devices-5A5TY4JD.cjs → devices-7Q2EUM7B.cjs} +11 -11
- package/dist/{devices-PLDAEUSL.js → devices-U3Y4IIW4.js} +9 -9
- package/dist/hooks/index.cjs +3 -4
- package/dist/hooks/index.js +2 -3
- package/dist/index.cjs +34 -14
- package/dist/index.js +33 -13
- package/dist/{knowledge-G6Q5KRWV.js → knowledge-NST53EXE.js} +9 -9
- package/dist/{knowledge-FKTJ723Z.cjs → knowledge-UYIZ74MA.cjs} +11 -11
- package/dist/{logs-CJCXUBU6.cjs → logs-HTH7X7KV.cjs} +18 -18
- package/dist/{logs-QMV6XIC4.js → logs-JVTRG232.js} +9 -9
- package/dist/{policies-G6D7AX6F.js → policies-DTXTRK56.js} +9 -9
- package/dist/{policies-QMRTK3CY.cjs → policies-MXK2HB4W.cjs} +14 -14
- package/dist/{remote-session-DBD6OSTX.js → remote-session-LAJZKQBN.js} +3 -3
- package/dist/{remote-session-2JVI7RVA.cjs → remote-session-SKKF4PBV.cjs} +5 -5
- package/dist/{software-update-6BQM6BKH.js → software-update-6RHMPM3W.js} +9 -9
- package/dist/{software-update-PNZMRDBT.cjs → software-update-P6BSM6HX.cjs} +14 -14
- package/dist/utils/index.cjs +26 -2
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +25 -3
- package/dist/utils/list-url.d.ts.map +1 -1
- package/dist/utils/source-icons.d.ts.map +1 -1
- package/dist/utils/trial.d.ts +18 -0
- package/dist/utils/trial.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/components/chat/ask-prompts.tsx +25 -3
- package/src/components/chat/assistant-ask-prompts.tsx +78 -0
- package/src/components/chat/entity-cards/dispatch.tsx +38 -4
- package/src/components/chat/hooks/index.ts +12 -0
- package/src/components/chat/hooks/use-ask-prompts.ts +188 -0
- package/src/components/chat/index.ts +1 -0
- package/src/components/chat/utils/icon-library.tsx +6 -0
- package/src/components/faq/faq-ask-card.tsx +115 -0
- package/src/components/faq/faq-document-page.tsx +6 -1
- package/src/components/faq/faq-section.tsx +27 -5
- package/src/components/faq/index.ts +1 -0
- package/src/components/features/auth/auth-benefits-panel.tsx +5 -4
- package/src/components/help-center-pages/trust-center-page.tsx +5 -2
- package/src/components/navigation/mingo-ai-button.tsx +27 -6
- package/src/contexts/assistant-runtime-context.tsx +84 -0
- package/src/contexts/index.ts +9 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/list-url.ts +4 -0
- package/src/utils/source-icons.ts +10 -2
- package/src/utils/trial.ts +19 -0
- package/dist/chunk-6X3O67OL.cjs +0 -89
- package/dist/chunk-AUMKE74M.cjs +0 -16
- package/dist/chunk-G3GRYDMS.js +0 -16
- package/dist/chunk-RR6PY34K.js +0 -89
package/src/contexts/index.ts
CHANGED
|
@@ -30,4 +30,13 @@ export {
|
|
|
30
30
|
|
|
31
31
|
export { ChatRuntimeContext, useChatRuntime, useRequiredChatRuntime, type ChatRuntime } from './chat-runtime-context';
|
|
32
32
|
|
|
33
|
+
export {
|
|
34
|
+
AssistantRuntimeContext,
|
|
35
|
+
useAssistantRuntime,
|
|
36
|
+
type AssistantAskCardCopy,
|
|
37
|
+
type AssistantAskEvent,
|
|
38
|
+
type AssistantOpenRequest,
|
|
39
|
+
type AssistantRuntime,
|
|
40
|
+
} from './assistant-runtime-context';
|
|
41
|
+
|
|
33
42
|
export { useOuterOrDefault } from './use-outer-or-default';
|
package/src/utils/index.ts
CHANGED
|
@@ -17,6 +17,7 @@ export {
|
|
|
17
17
|
// source of truth). Re-exported here so existing callers that pull from
|
|
18
18
|
// the barrel keep working without changing imports.
|
|
19
19
|
export { formatDate, formatNumber, formatPrice, formatBytes } from './format';
|
|
20
|
+
export { TRIAL_DAYS, TRIAL_LABELS } from './trial';
|
|
20
21
|
export {
|
|
21
22
|
VENDOR_CLASSIFICATIONS,
|
|
22
23
|
OPENFRAME_CLASSIFICATIONS,
|
package/src/utils/list-url.ts
CHANGED
|
@@ -116,6 +116,10 @@ const BUILDERS: Record<string, (ids: string[], base: string) => string> = {
|
|
|
116
116
|
design_doc: (ids, b) => `${b}/api/design-docs?ids=${ids.join(',')}`,
|
|
117
117
|
openframe_tenant: (ids, b) => `${b}/api/openframe-tenants?ids=${ids.join(',')}`,
|
|
118
118
|
prospect_call: (ids, b) => `${b}/api/prospect-calls?ids=${ids.join(',')}`,
|
|
119
|
+
// The public website's own pages (live source; ChatRef-shaped items like the objects above).
|
|
120
|
+
site_page: (ids, b) => `${b}/api/site-pages?ids=${ids.join(',')}`,
|
|
121
|
+
// The OpenMSP vendor directory (indexed source).
|
|
122
|
+
vendor: (ids, b) => `${b}/api/vendors/cards?ids=${ids.join(',')}`,
|
|
119
123
|
// Code intelligence — per-object card hydration, same `handleEntityCardList`
|
|
120
124
|
// shape as the internal objects above.
|
|
121
125
|
code_rule: (ids, b) => `${b}/api/code-rules/cards?ids=${ids.join(',')}`,
|
|
@@ -54,8 +54,12 @@ export const SOURCE_ICON_NAMES: Record<string, string> = {
|
|
|
54
54
|
'audience-mssp': 'shield-lock',
|
|
55
55
|
'audience-it-team': 'buildings',
|
|
56
56
|
|
|
57
|
-
// Trust (single-record live source over the public Vanta projection)
|
|
58
|
-
'trust-center': 'shield',
|
|
57
|
+
// Trust (single-record live source over the public Vanta projection): the icon its menu entry draws
|
|
58
|
+
'trust-center': 'shield-check',
|
|
59
|
+
// The public website's own pages (live source): the site's own mark, as a glyph in the slot's colour
|
|
60
|
+
'website-pages': 'flamingo-logo-grey',
|
|
61
|
+
// The OpenMSP vendor directory: the icon the site menu's "Tool directory" entry draws (it reads this one)
|
|
62
|
+
vendors: 'package-search',
|
|
59
63
|
|
|
60
64
|
// Financials
|
|
61
65
|
'investor-updates': 'mail',
|
|
@@ -145,6 +149,8 @@ export const SOURCE_LABELS_BY_TABLE: Record<string, string> = {
|
|
|
145
149
|
|
|
146
150
|
// Trust
|
|
147
151
|
'trust-center': 'Trust Center',
|
|
152
|
+
'website-pages': 'Website',
|
|
153
|
+
vendors: 'Vendor Directory',
|
|
148
154
|
|
|
149
155
|
// Financials
|
|
150
156
|
'investor-updates': 'Investor Updates',
|
|
@@ -248,6 +254,8 @@ export const DEFAULT_DOCUMENT_TYPE_TO_TABLE_ID: Record<string, string> = {
|
|
|
248
254
|
|
|
249
255
|
// Trust
|
|
250
256
|
trust_center: 'trust-center',
|
|
257
|
+
site_page: 'website-pages',
|
|
258
|
+
vendor: 'vendors',
|
|
251
259
|
|
|
252
260
|
// Financials
|
|
253
261
|
investor_update: 'investor-updates',
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The free trial's facts and the words every surface says them with: the
|
|
3
|
+
* sign-up panel here, and the host site's trial buttons, trust rows and pricing
|
|
4
|
+
* copy. Stated once, so a trial that changes length changes everywhere.
|
|
5
|
+
*
|
|
6
|
+
* Server-safe (no React, no DOM).
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/** How long the free trial runs, in days. */
|
|
10
|
+
export const TRIAL_DAYS = 14;
|
|
11
|
+
|
|
12
|
+
/** The reassurance labels shown beside a trial button. */
|
|
13
|
+
export const TRIAL_LABELS = {
|
|
14
|
+
/** "14 day free trial" */
|
|
15
|
+
length: `${TRIAL_DAYS} day free trial`,
|
|
16
|
+
noCard: 'No card required',
|
|
17
|
+
cancel: 'Cancel Anytime',
|
|
18
|
+
noContract: 'No Contract',
|
|
19
|
+
} as const;
|
package/dist/chunk-6X3O67OL.cjs
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var _chunkAUMKE74Mcjs = require('./chunk-AUMKE74M.cjs');
|
|
5
|
-
|
|
6
|
-
// src/hooks/use-self-fetch.ts
|
|
7
|
-
var _react = require('react');
|
|
8
|
-
function useSelfFetch(url, options) {
|
|
9
|
-
const initialData = _optionalChain([options, 'optionalAccess', _ => _.initialData]);
|
|
10
|
-
const revalidateOnVisibleAfterMs = _optionalChain([options, 'optionalAccess', _2 => _2.revalidateOnVisibleAfterMs]);
|
|
11
|
-
const [data, setData] = _react.useState.call(void 0, _nullishCoalesce(initialData, () => ( null)));
|
|
12
|
-
const [dataUrl, setDataUrl] = _react.useState.call(void 0, initialData !== void 0 ? url : null);
|
|
13
|
-
const [isLoading, setIsLoading] = _react.useState.call(void 0, initialData === void 0 && url !== null);
|
|
14
|
-
const [error, setError] = _react.useState.call(void 0, false);
|
|
15
|
-
const [reloadKey, setReloadKey] = _react.useState.call(void 0, 0);
|
|
16
|
-
const [mountedAt] = _react.useState.call(void 0, () => Date.now());
|
|
17
|
-
const dataAtRef = _react.useRef.call(void 0, initialData !== void 0 ? mountedAt : 0);
|
|
18
|
-
const dataUrlRef = _react.useRef.call(void 0, initialData !== void 0 ? url : null);
|
|
19
|
-
const [syncedProps, setSyncedProps] = _react.useState.call(void 0, { url, initialData });
|
|
20
|
-
if (syncedProps.url !== url || syncedProps.initialData !== initialData) {
|
|
21
|
-
setSyncedProps({ url, initialData });
|
|
22
|
-
if (syncedProps.initialData !== initialData && initialData !== void 0) {
|
|
23
|
-
setData(initialData);
|
|
24
|
-
setDataUrl(url);
|
|
25
|
-
}
|
|
26
|
-
if (syncedProps.url !== url && url === null) {
|
|
27
|
-
setIsLoading(false);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
_react.useEffect.call(void 0, () => {
|
|
31
|
-
if (url === null) return void 0;
|
|
32
|
-
if (dataUrlRef.current === url) return void 0;
|
|
33
|
-
const ctrl = new AbortController();
|
|
34
|
-
let cancelled = false;
|
|
35
|
-
async function load() {
|
|
36
|
-
try {
|
|
37
|
-
setIsLoading(true);
|
|
38
|
-
setError(false);
|
|
39
|
-
const res = await _chunkAUMKE74Mcjs.contentFetch.call(void 0, url, { signal: ctrl.signal });
|
|
40
|
-
if (!res.ok) throw new Error(`Request failed (${res.status})`);
|
|
41
|
-
const json = await res.json();
|
|
42
|
-
if (!cancelled) {
|
|
43
|
-
setData(json);
|
|
44
|
-
setDataUrl(url);
|
|
45
|
-
dataUrlRef.current = url;
|
|
46
|
-
dataAtRef.current = Date.now();
|
|
47
|
-
}
|
|
48
|
-
} catch (err) {
|
|
49
|
-
if (cancelled || _optionalChain([err, 'optionalAccess', _3 => _3.name]) === "AbortError") return;
|
|
50
|
-
setError(true);
|
|
51
|
-
console.error("useSelfFetch:", url, err);
|
|
52
|
-
} finally {
|
|
53
|
-
if (!cancelled) setIsLoading(false);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
void load();
|
|
57
|
-
return () => {
|
|
58
|
-
cancelled = true;
|
|
59
|
-
ctrl.abort();
|
|
60
|
-
};
|
|
61
|
-
}, [url, reloadKey]);
|
|
62
|
-
const forceReload = () => {
|
|
63
|
-
dataUrlRef.current = null;
|
|
64
|
-
setReloadKey((k) => k + 1);
|
|
65
|
-
};
|
|
66
|
-
_react.useEffect.call(void 0, () => {
|
|
67
|
-
if (!revalidateOnVisibleAfterMs || url === null) return void 0;
|
|
68
|
-
const onVisible = () => {
|
|
69
|
-
if (document.visibilityState !== "visible") return;
|
|
70
|
-
if (Date.now() - dataAtRef.current < revalidateOnVisibleAfterMs) return;
|
|
71
|
-
forceReload();
|
|
72
|
-
};
|
|
73
|
-
document.addEventListener("visibilitychange", onVisible);
|
|
74
|
-
return () => document.removeEventListener("visibilitychange", onVisible);
|
|
75
|
-
}, [url, revalidateOnVisibleAfterMs]);
|
|
76
|
-
return {
|
|
77
|
-
data,
|
|
78
|
-
dataUrl,
|
|
79
|
-
setData,
|
|
80
|
-
isLoading,
|
|
81
|
-
error,
|
|
82
|
-
// Force a re-fetch of the current url (error-retry affordance).
|
|
83
|
-
reload: forceReload
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
exports.useSelfFetch = useSelfFetch;
|
package/dist/chunk-AUMKE74M.cjs
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _chunkULWVKHSIcjs = require('./chunk-ULWVKHSI.cjs');
|
|
6
|
-
|
|
7
|
-
// src/utils/embed-content-fetch.ts
|
|
8
|
-
var contentFetch = (input, init) => {
|
|
9
|
-
if (!_chunkULWVKHSIcjs.hasEmbedAuthAdapter.call(void 0, )) return fetch(input, init);
|
|
10
|
-
const url = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
11
|
-
return _chunkULWVKHSIcjs.embedAuthedFetch.call(void 0, url, init);
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
exports.contentFetch = contentFetch;
|
package/dist/chunk-G3GRYDMS.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
embedAuthedFetch,
|
|
4
|
-
hasEmbedAuthAdapter
|
|
5
|
-
} from "./chunk-ADBE7QF3.js";
|
|
6
|
-
|
|
7
|
-
// src/utils/embed-content-fetch.ts
|
|
8
|
-
var contentFetch = (input, init) => {
|
|
9
|
-
if (!hasEmbedAuthAdapter()) return fetch(input, init);
|
|
10
|
-
const url = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
11
|
-
return embedAuthedFetch(url, init);
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export {
|
|
15
|
-
contentFetch
|
|
16
|
-
};
|
package/dist/chunk-RR6PY34K.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
contentFetch
|
|
4
|
-
} from "./chunk-G3GRYDMS.js";
|
|
5
|
-
|
|
6
|
-
// src/hooks/use-self-fetch.ts
|
|
7
|
-
import { useEffect, useRef, useState } from "react";
|
|
8
|
-
function useSelfFetch(url, options) {
|
|
9
|
-
const initialData = options?.initialData;
|
|
10
|
-
const revalidateOnVisibleAfterMs = options?.revalidateOnVisibleAfterMs;
|
|
11
|
-
const [data, setData] = useState(initialData ?? null);
|
|
12
|
-
const [dataUrl, setDataUrl] = useState(initialData !== void 0 ? url : null);
|
|
13
|
-
const [isLoading, setIsLoading] = useState(initialData === void 0 && url !== null);
|
|
14
|
-
const [error, setError] = useState(false);
|
|
15
|
-
const [reloadKey, setReloadKey] = useState(0);
|
|
16
|
-
const [mountedAt] = useState(() => Date.now());
|
|
17
|
-
const dataAtRef = useRef(initialData !== void 0 ? mountedAt : 0);
|
|
18
|
-
const dataUrlRef = useRef(initialData !== void 0 ? url : null);
|
|
19
|
-
const [syncedProps, setSyncedProps] = useState({ url, initialData });
|
|
20
|
-
if (syncedProps.url !== url || syncedProps.initialData !== initialData) {
|
|
21
|
-
setSyncedProps({ url, initialData });
|
|
22
|
-
if (syncedProps.initialData !== initialData && initialData !== void 0) {
|
|
23
|
-
setData(initialData);
|
|
24
|
-
setDataUrl(url);
|
|
25
|
-
}
|
|
26
|
-
if (syncedProps.url !== url && url === null) {
|
|
27
|
-
setIsLoading(false);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
if (url === null) return void 0;
|
|
32
|
-
if (dataUrlRef.current === url) return void 0;
|
|
33
|
-
const ctrl = new AbortController();
|
|
34
|
-
let cancelled = false;
|
|
35
|
-
async function load() {
|
|
36
|
-
try {
|
|
37
|
-
setIsLoading(true);
|
|
38
|
-
setError(false);
|
|
39
|
-
const res = await contentFetch(url, { signal: ctrl.signal });
|
|
40
|
-
if (!res.ok) throw new Error(`Request failed (${res.status})`);
|
|
41
|
-
const json = await res.json();
|
|
42
|
-
if (!cancelled) {
|
|
43
|
-
setData(json);
|
|
44
|
-
setDataUrl(url);
|
|
45
|
-
dataUrlRef.current = url;
|
|
46
|
-
dataAtRef.current = Date.now();
|
|
47
|
-
}
|
|
48
|
-
} catch (err) {
|
|
49
|
-
if (cancelled || err?.name === "AbortError") return;
|
|
50
|
-
setError(true);
|
|
51
|
-
console.error("useSelfFetch:", url, err);
|
|
52
|
-
} finally {
|
|
53
|
-
if (!cancelled) setIsLoading(false);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
void load();
|
|
57
|
-
return () => {
|
|
58
|
-
cancelled = true;
|
|
59
|
-
ctrl.abort();
|
|
60
|
-
};
|
|
61
|
-
}, [url, reloadKey]);
|
|
62
|
-
const forceReload = () => {
|
|
63
|
-
dataUrlRef.current = null;
|
|
64
|
-
setReloadKey((k) => k + 1);
|
|
65
|
-
};
|
|
66
|
-
useEffect(() => {
|
|
67
|
-
if (!revalidateOnVisibleAfterMs || url === null) return void 0;
|
|
68
|
-
const onVisible = () => {
|
|
69
|
-
if (document.visibilityState !== "visible") return;
|
|
70
|
-
if (Date.now() - dataAtRef.current < revalidateOnVisibleAfterMs) return;
|
|
71
|
-
forceReload();
|
|
72
|
-
};
|
|
73
|
-
document.addEventListener("visibilitychange", onVisible);
|
|
74
|
-
return () => document.removeEventListener("visibilitychange", onVisible);
|
|
75
|
-
}, [url, revalidateOnVisibleAfterMs]);
|
|
76
|
-
return {
|
|
77
|
-
data,
|
|
78
|
-
dataUrl,
|
|
79
|
-
setData,
|
|
80
|
-
isLoading,
|
|
81
|
-
error,
|
|
82
|
-
// Force a re-fetch of the current url (error-retry affordance).
|
|
83
|
-
reload: forceReload
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export {
|
|
88
|
-
useSelfFetch
|
|
89
|
-
};
|