@opencx/widget 3.0.85 → 3.0.86
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/designs.cjs +24 -24
- package/dist/designs.cjs.map +1 -1
- package/dist/designs.js +3197 -2975
- package/dist/designs.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/is-exhaustive-9o43S91P.cjs +2 -0
- package/dist/is-exhaustive-9o43S91P.cjs.map +1 -0
- package/dist/is-exhaustive-DGJzQK69.js +7 -0
- package/dist/is-exhaustive-DGJzQK69.js.map +1 -0
- package/dist/react.cjs +1 -1
- package/dist/react.js +2 -2
- package/dist/src/designs/react/components/Header.d.ts +3 -0
- package/dist/src/designs/react/components/lib/DynamicIcon.d.ts +6 -0
- package/dist/src/designs/react/components/lib/dialog.d.ts +8 -2
- package/dist/src/designs/react/hooks/useSetWidgetSize.d.ts +8 -0
- package/dist/src/headless/core/context/session.ctx.d.ts +32 -1
- package/dist/src/headless/core/index.d.ts +3 -1
- package/dist/src/headless/core/types/icons.d.ts +3 -0
- package/dist/src/headless/core/types/widget-config.d.ts +36 -0
- package/dist/src/headless/core/utils/is-exhaustive.d.ts +1 -0
- package/dist/src/headless/react/hooks/useSessions.d.ts +32 -0
- package/dist/{useWidgetTrigger-D94qDfz7.js → useWidgetTrigger-Bi12WVrs.js} +59 -58
- package/dist/useWidgetTrigger-Bi12WVrs.js.map +1 -0
- package/dist/{useWidgetTrigger-Be2RN31V.cjs → useWidgetTrigger-Bplu_1C-.cjs} +2 -2
- package/dist/useWidgetTrigger-Bplu_1C-.cjs.map +1 -0
- package/dist/{widget.ctx-0z1bMkkT.js → widget.ctx-DFFwNHvy.js} +13 -10
- package/dist/widget.ctx-DFFwNHvy.js.map +1 -0
- package/dist/{widget.ctx-BOpwwK5L.cjs → widget.ctx-oIT8sGvJ.cjs} +2 -2
- package/dist/widget.ctx-oIT8sGvJ.cjs.map +1 -0
- package/dist-embed/script.js +147 -82
- package/dist-embed/script.js.map +1 -1
- package/package.json +2 -1
- package/dist/src/designs/react/components/WidgetHeader.d.ts +0 -2
- package/dist/src/designs/react/hooks/useWidgetSize.d.ts +0 -4
- package/dist/useWidgetTrigger-Be2RN31V.cjs.map +0 -1
- package/dist/useWidgetTrigger-D94qDfz7.js.map +0 -1
- package/dist/widget.ctx-0z1bMkkT.js.map +0 -1
- package/dist/widget.ctx-BOpwwK5L.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./widget.ctx-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./widget.ctx-oIT8sGvJ.cjs"),e=require("./is-exhaustive-9o43S91P.cjs");exports.PrimitiveState=t.PrimitiveState;exports.WidgetCtx=t.WidgetCtx;exports.isExhaustive=e.isExhaustive;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { P as
|
|
1
|
+
import { P as e, W as a } from "./widget.ctx-DFFwNHvy.js";
|
|
2
|
+
import { i as s } from "./is-exhaustive-DGJzQK69.js";
|
|
2
3
|
export {
|
|
3
|
-
|
|
4
|
-
a as WidgetCtx
|
|
4
|
+
e as PrimitiveState,
|
|
5
|
+
a as WidgetCtx,
|
|
6
|
+
s as isExhaustive
|
|
5
7
|
};
|
|
6
8
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-exhaustive-9o43S91P.cjs","sources":["../src/headless/core/utils/is-exhaustive.ts"],"sourcesContent":["export function isExhaustive(value: never, funcName: string) {\n console.error(`Missing case for ${value} in ${funcName}`);\n}\n"],"names":["isExhaustive","value","funcName"],"mappings":"aAAgB,SAAAA,EAAaC,EAAcC,EAAkB,CAC3D,QAAQ,MAAM,oBAAoBD,CAAK,OAAOC,CAAQ,EAAE,CAC1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-exhaustive-DGJzQK69.js","sources":["../src/headless/core/utils/is-exhaustive.ts"],"sourcesContent":["export function isExhaustive(value: never, funcName: string) {\n console.error(`Missing case for ${value} in ${funcName}`);\n}\n"],"names":["isExhaustive","value","funcName"],"mappings":"AAAgB,SAAAA,EAAaC,GAAcC,GAAkB;AAC3D,UAAQ,MAAM,oBAAoBD,CAAK,OAAOC,CAAQ,EAAE;AAC1D;"}
|
package/dist/react.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useWidgetTrigger-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useWidgetTrigger-Bplu_1C-.cjs");function g(t,i,s){const{widgetCtx:{api:u}}=e.useWidget();return e._default(async r=>u.vote({action:r==="up"?"upvote":"downvote",messagePublicId:t,sessionId:i}).then(s),[u,t,i,s])}exports.WidgetProvider=e.WidgetProvider;exports.WidgetTriggerProvider=e.WidgetTriggerProvider;exports.useConfig=e.useConfig;exports.useContact=e.useContact;exports.useIsAwaitingBotReply=e.useIsAwaitingBotReply;exports.useMessages=e.useMessages;exports.usePreludeData=e.usePreludeData;exports.usePrimitiveState=e.usePrimitiveState;exports.useSessions=e.useSessions;exports.useUploadFiles=e.useUploadFiles;exports.useWidget=e.useWidget;exports.useWidgetRouter=e.useWidgetRouter;exports.useWidgetTrigger=e.useWidgetTrigger;exports.useVote=g;
|
|
2
2
|
//# sourceMappingURL=react.cjs.map
|
package/dist/react.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { u, _ as r } from "./useWidgetTrigger-
|
|
2
|
-
import { W as p, k as f, a as l, b as v, c as W, d as c, e as m, f as P, g as w, i as x, h as C, j as b } from "./useWidgetTrigger-
|
|
1
|
+
import { u, _ as r } from "./useWidgetTrigger-Bi12WVrs.js";
|
|
2
|
+
import { W as p, k as f, a as l, b as v, c as W, d as c, e as m, f as P, g as w, i as x, h as C, j as b } from "./useWidgetTrigger-Bi12WVrs.js";
|
|
3
3
|
function g(e, s, t) {
|
|
4
4
|
const {
|
|
5
5
|
widgetCtx: { api: a }
|
|
@@ -4,15 +4,21 @@ declare const Dialog: React.FC<DialogPrimitive.DialogProps>;
|
|
|
4
4
|
declare const DialogTrigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
5
5
|
declare const DialogClose: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
6
6
|
declare const DialogOverlay: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
-
declare const DialogContent: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> &
|
|
7
|
+
declare const DialogContent: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
8
|
+
withClose?: boolean;
|
|
9
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
8
10
|
declare const DialogHeader: {
|
|
9
11
|
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
10
12
|
displayName: string;
|
|
11
13
|
};
|
|
14
|
+
declare const DialogBody: {
|
|
15
|
+
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
16
|
+
displayName: string;
|
|
17
|
+
};
|
|
12
18
|
declare const DialogFooter: {
|
|
13
19
|
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
14
20
|
displayName: string;
|
|
15
21
|
};
|
|
16
22
|
declare const DialogTitle: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
17
23
|
declare const DialogDescription: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
18
|
-
export { Dialog, DialogOverlay, DialogTrigger, DialogClose, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription, };
|
|
24
|
+
export { Dialog, DialogOverlay, DialogTrigger, DialogClose, DialogContent, DialogHeader, DialogBody, DialogFooter, DialogTitle, DialogDescription, };
|
|
@@ -9,6 +9,7 @@ type SessionState = {
|
|
|
9
9
|
*/
|
|
10
10
|
session: SessionDto | null;
|
|
11
11
|
isCreatingSession: boolean;
|
|
12
|
+
isResolvingSession: boolean;
|
|
12
13
|
};
|
|
13
14
|
type SessionsState = {
|
|
14
15
|
/** List of all user sessions */
|
|
@@ -56,6 +57,36 @@ export declare class SessionCtx {
|
|
|
56
57
|
private getSessions;
|
|
57
58
|
setSessions: (data: SessionDto[]) => void;
|
|
58
59
|
refreshSessions: () => Promise<void>;
|
|
59
|
-
resolveSession: () => Promise<
|
|
60
|
+
resolveSession: () => Promise<{
|
|
61
|
+
readonly success: false;
|
|
62
|
+
readonly error: "Session is not opened";
|
|
63
|
+
readonly data?: undefined;
|
|
64
|
+
} | {
|
|
65
|
+
readonly success: true;
|
|
66
|
+
readonly data: {
|
|
67
|
+
id: string;
|
|
68
|
+
createdAt: string;
|
|
69
|
+
updatedAt: string;
|
|
70
|
+
isHandedOff: boolean;
|
|
71
|
+
isOpened: boolean;
|
|
72
|
+
assignee: {
|
|
73
|
+
kind: "human" | "ai" | "none" | "unknown";
|
|
74
|
+
name: string | null;
|
|
75
|
+
avatarUrl: string | null;
|
|
76
|
+
};
|
|
77
|
+
channel: string;
|
|
78
|
+
isVerified: boolean;
|
|
79
|
+
lastMessage: string | null;
|
|
80
|
+
};
|
|
81
|
+
readonly error?: undefined;
|
|
82
|
+
} | {
|
|
83
|
+
readonly success: false;
|
|
84
|
+
readonly error: {
|
|
85
|
+
statusCode?: number;
|
|
86
|
+
message?: string;
|
|
87
|
+
error?: string;
|
|
88
|
+
};
|
|
89
|
+
readonly data?: undefined;
|
|
90
|
+
}>;
|
|
60
91
|
}
|
|
61
92
|
export {};
|
|
@@ -2,12 +2,14 @@ export type { AgentOrBotType } from './types/agent-or-bot';
|
|
|
2
2
|
export type { SafeExtract, StringOrLiteral } from './types/helpers';
|
|
3
3
|
export type { LiteralWidgetComponentKey, WidgetComponentKey, UserMessageType, AgentMessageType, BotMessageType, MessageType, } from './types/messages';
|
|
4
4
|
export type { MessageAttachmentType, MessageDto, PreludeDto, SendMessageDto, SendMessageOutputDto, ResolveSessionDto, SessionDto, VoteInputDto, VoteOutputDto, ActionCallDto, } from './types/dtos';
|
|
5
|
-
export type { WidgetConfig } from './types/widget-config';
|
|
5
|
+
export type { WidgetConfig, HeaderButtonU } from './types/widget-config';
|
|
6
6
|
export type { ExternalStorage } from './types/external-storage';
|
|
7
7
|
export type { OpenCxComponentNameU } from './types/component-name';
|
|
8
|
+
export type { IconNameU } from './types/icons';
|
|
8
9
|
export { WidgetCtx } from './context/widget.ctx';
|
|
9
10
|
export type { ContactCtx } from './context/contact.ctx';
|
|
10
11
|
export type { SessionCtx } from './context/session.ctx';
|
|
11
12
|
export type { MessageCtx } from './context/message.ctx';
|
|
12
13
|
export type { RouterCtx, ScreenU } from './context/router.ctx';
|
|
13
14
|
export { PrimitiveState } from './utils/PrimitiveState';
|
|
15
|
+
export { isExhaustive } from './utils/is-exhaustive';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { icons } from 'lucide';
|
|
2
|
+
import { SafeExtract } from './helpers';
|
|
3
|
+
export type IconNameU = SafeExtract<keyof typeof icons, 'Maximize' | 'Maximize2' | 'Minimize' | 'Minimize2' | 'Expand' | 'Shrink' | 'X' | 'SquareX' | 'CircleX' | 'Check' | 'CheckCheck' | 'CircleCheck' | 'CircleCheckBig' | 'SquareCheck' | 'SquareCheckBig'>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AgentOrBotType } from './agent-or-bot';
|
|
2
|
+
import { IconNameU } from './icons';
|
|
2
3
|
import { JsonValue } from './json-value';
|
|
3
4
|
type UserBaseConfig = {
|
|
4
5
|
token: string;
|
|
@@ -86,6 +87,30 @@ type TextContentOptions = {
|
|
|
86
87
|
headerTitle?: string;
|
|
87
88
|
};
|
|
88
89
|
};
|
|
90
|
+
type HeaderButtonBase = {
|
|
91
|
+
icon?: IconNameU;
|
|
92
|
+
hideOnSmallScreen?: boolean;
|
|
93
|
+
hideOnLargeScreen?: boolean;
|
|
94
|
+
};
|
|
95
|
+
export type HeaderButtonU = (HeaderButtonBase & {
|
|
96
|
+
functionality: 'expand-shrink';
|
|
97
|
+
/** if `HeaderButtonBase.icon` is passed, it will override this option */
|
|
98
|
+
expandIcon?: IconNameU;
|
|
99
|
+
/** if `HeaderButtonBase.icon` is passed, it will override this option */
|
|
100
|
+
shrinkIcon?: IconNameU;
|
|
101
|
+
}) | (HeaderButtonBase & {
|
|
102
|
+
functionality: 'close-widget';
|
|
103
|
+
}) | (HeaderButtonBase & {
|
|
104
|
+
functionality: 'resolve-session';
|
|
105
|
+
onResolved?: 'reset-chat' | 'close-widget' | 'reset-chat-and-close-widget';
|
|
106
|
+
confirmation?: {
|
|
107
|
+
type: 'modal';
|
|
108
|
+
title?: string;
|
|
109
|
+
description?: string;
|
|
110
|
+
confirmButtonText?: string;
|
|
111
|
+
cancelButtonText?: string;
|
|
112
|
+
};
|
|
113
|
+
});
|
|
89
114
|
export interface WidgetConfig {
|
|
90
115
|
/**
|
|
91
116
|
* Your organization's widget token.
|
|
@@ -205,6 +230,17 @@ export interface WidgetConfig {
|
|
|
205
230
|
* Custom text content to override the defaults in the default widget.
|
|
206
231
|
*/
|
|
207
232
|
textContent?: TextContentOptions;
|
|
233
|
+
/**
|
|
234
|
+
* Custom header buttons to expand-shrink the size of the widget, close the widget, resolve the session, etc.
|
|
235
|
+
*
|
|
236
|
+
* Note that using this options will remove the default `close-widget` button on small screens.
|
|
237
|
+
*
|
|
238
|
+
* @default close-widget button on small screens
|
|
239
|
+
*/
|
|
240
|
+
headerButtons?: {
|
|
241
|
+
sessionsScreen?: Array<HeaderButtonU>;
|
|
242
|
+
chatScreen?: Array<HeaderButtonU>;
|
|
243
|
+
};
|
|
208
244
|
/**
|
|
209
245
|
* Customize the router behavior.
|
|
210
246
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isExhaustive(value: never, funcName: string): void;
|
|
@@ -2,6 +2,7 @@ export declare function useSessions(): {
|
|
|
2
2
|
sessionState: {
|
|
3
3
|
session: import('../../core').SessionDto | null;
|
|
4
4
|
isCreatingSession: boolean;
|
|
5
|
+
isResolvingSession: boolean;
|
|
5
6
|
};
|
|
6
7
|
sessionsState: {
|
|
7
8
|
data: import('../../core').SessionDto[];
|
|
@@ -11,6 +12,37 @@ export declare function useSessions(): {
|
|
|
11
12
|
isInitialFetchLoading: boolean;
|
|
12
13
|
};
|
|
13
14
|
loadMoreSessions: () => Promise<void>;
|
|
15
|
+
resolveSession: () => Promise<{
|
|
16
|
+
readonly success: false;
|
|
17
|
+
readonly error: "Session is not opened";
|
|
18
|
+
readonly data?: undefined;
|
|
19
|
+
} | {
|
|
20
|
+
readonly success: true;
|
|
21
|
+
readonly data: {
|
|
22
|
+
id: string;
|
|
23
|
+
createdAt: string;
|
|
24
|
+
updatedAt: string;
|
|
25
|
+
isHandedOff: boolean;
|
|
26
|
+
isOpened: boolean;
|
|
27
|
+
assignee: {
|
|
28
|
+
kind: "human" | "ai" | "none" | "unknown";
|
|
29
|
+
name: string | null;
|
|
30
|
+
avatarUrl: string | null;
|
|
31
|
+
};
|
|
32
|
+
channel: string;
|
|
33
|
+
isVerified: boolean;
|
|
34
|
+
lastMessage: string | null;
|
|
35
|
+
};
|
|
36
|
+
readonly error?: undefined;
|
|
37
|
+
} | {
|
|
38
|
+
readonly success: false;
|
|
39
|
+
readonly error: {
|
|
40
|
+
statusCode?: number;
|
|
41
|
+
message?: string;
|
|
42
|
+
error?: string;
|
|
43
|
+
};
|
|
44
|
+
readonly data?: undefined;
|
|
45
|
+
}>;
|
|
14
46
|
openSessions: {
|
|
15
47
|
id: string;
|
|
16
48
|
createdAt: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import z, { createContext as Fe, useRef as W, useState as Me, useMemo as oe, useEffect as se, useContext as Ue, useSyncExternalStore as Jt, useLayoutEffect as Xt, useCallback as Se, useDebugValue as Qt } from "react";
|
|
2
2
|
import { v4 as Zt } from "uuid";
|
|
3
3
|
import { jsx as it } from "react/jsx-runtime";
|
|
4
|
-
import { W as en } from "./widget.ctx-
|
|
5
|
-
const tn = "3.0.
|
|
4
|
+
import { W as en } from "./widget.ctx-DFFwNHvy.js";
|
|
5
|
+
const tn = "3.0.86";
|
|
6
6
|
class nn {
|
|
7
7
|
constructor(t) {
|
|
8
8
|
this.components = [];
|
|
@@ -92,6 +92,7 @@ function on() {
|
|
|
92
92
|
sessionState: n,
|
|
93
93
|
sessionsState: r,
|
|
94
94
|
loadMoreSessions: e.sessionCtx.loadMoreSessions,
|
|
95
|
+
resolveSession: e.sessionCtx.resolveSession,
|
|
95
96
|
openSessions: o,
|
|
96
97
|
closedSessions: s,
|
|
97
98
|
canCreateNewSession: i
|
|
@@ -187,43 +188,43 @@ function un() {
|
|
|
187
188
|
var e = z, t = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
188
189
|
function n(O) {
|
|
189
190
|
{
|
|
190
|
-
for (var
|
|
191
|
-
S[
|
|
191
|
+
for (var v = arguments.length, S = new Array(v > 1 ? v - 1 : 0), E = 1; E < v; E++)
|
|
192
|
+
S[E - 1] = arguments[E];
|
|
192
193
|
r("error", O, S);
|
|
193
194
|
}
|
|
194
195
|
}
|
|
195
|
-
function r(O,
|
|
196
|
+
function r(O, v, S) {
|
|
196
197
|
{
|
|
197
|
-
var
|
|
198
|
-
L !== "" && (
|
|
198
|
+
var E = t.ReactDebugCurrentFrame, L = E.getStackAddendum();
|
|
199
|
+
L !== "" && (v += "%s", S = S.concat([L]));
|
|
199
200
|
var w = S.map(function(C) {
|
|
200
201
|
return String(C);
|
|
201
202
|
});
|
|
202
|
-
w.unshift("Warning: " +
|
|
203
|
+
w.unshift("Warning: " + v), Function.prototype.apply.call(console[O], console, w);
|
|
203
204
|
}
|
|
204
205
|
}
|
|
205
|
-
function o(O,
|
|
206
|
-
return O ===
|
|
206
|
+
function o(O, v) {
|
|
207
|
+
return O === v && (O !== 0 || 1 / O === 1 / v) || O !== O && v !== v;
|
|
207
208
|
}
|
|
208
209
|
var s = typeof Object.is == "function" ? Object.is : o, i = e.useState, f = e.useEffect, h = e.useLayoutEffect, c = e.useDebugValue, a = !1, u = !1;
|
|
209
|
-
function d(O,
|
|
210
|
+
function d(O, v, S) {
|
|
210
211
|
a || e.startTransition !== void 0 && (a = !0, n("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));
|
|
211
|
-
var
|
|
212
|
+
var E = v();
|
|
212
213
|
if (!u) {
|
|
213
|
-
var L =
|
|
214
|
-
s(
|
|
214
|
+
var L = v();
|
|
215
|
+
s(E, L) || (n("The result of getSnapshot should be cached to avoid an infinite loop"), u = !0);
|
|
215
216
|
}
|
|
216
217
|
var w = i({
|
|
217
218
|
inst: {
|
|
218
|
-
value:
|
|
219
|
-
getSnapshot:
|
|
219
|
+
value: E,
|
|
220
|
+
getSnapshot: v
|
|
220
221
|
}
|
|
221
222
|
}), C = w[0].inst, j = w[1];
|
|
222
223
|
return h(function() {
|
|
223
|
-
C.value =
|
|
224
|
+
C.value = E, C.getSnapshot = v, l(C) && j({
|
|
224
225
|
inst: C
|
|
225
226
|
});
|
|
226
|
-
}, [O,
|
|
227
|
+
}, [O, E, v]), f(function() {
|
|
227
228
|
l(C) && j({
|
|
228
229
|
inst: C
|
|
229
230
|
});
|
|
@@ -233,19 +234,19 @@ function un() {
|
|
|
233
234
|
});
|
|
234
235
|
};
|
|
235
236
|
return O(B);
|
|
236
|
-
}, [O]), c(
|
|
237
|
+
}, [O]), c(E), E;
|
|
237
238
|
}
|
|
238
239
|
function l(O) {
|
|
239
|
-
var
|
|
240
|
+
var v = O.getSnapshot, S = O.value;
|
|
240
241
|
try {
|
|
241
|
-
var
|
|
242
|
-
return !s(S,
|
|
242
|
+
var E = v();
|
|
243
|
+
return !s(S, E);
|
|
243
244
|
} catch {
|
|
244
245
|
return !0;
|
|
245
246
|
}
|
|
246
247
|
}
|
|
247
|
-
function y(O,
|
|
248
|
-
return
|
|
248
|
+
function y(O, v, S) {
|
|
249
|
+
return v();
|
|
249
250
|
}
|
|
250
251
|
var _ = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", T = !_, p = T ? y : d, k = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : p;
|
|
251
252
|
me.useSyncExternalStore = k, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
@@ -324,10 +325,10 @@ const pn = () => je, [Pe, Le] = ye && window.addEventListener ? [
|
|
|
324
325
|
}, gn = {
|
|
325
326
|
isOnline: pn,
|
|
326
327
|
isVisible: hn
|
|
327
|
-
},
|
|
328
|
+
}, vn = {
|
|
328
329
|
initFocus: _n,
|
|
329
330
|
initReconnect: yn
|
|
330
|
-
}, tt = !z.useId, ue = !ye || "Deno" in window,
|
|
331
|
+
}, tt = !z.useId, ue = !ye || "Deno" in window, En = (e) => dn() ? window.requestAnimationFrame(e) : setTimeout(e, 1), Re = ue ? se : Xt, Te = typeof navigator < "u" && navigator.connection, nt = !ue && Te && ([
|
|
331
332
|
"slow-2g",
|
|
332
333
|
"2g"
|
|
333
334
|
].includes(Te.effectiveType) || Te.saveData), qe = (e) => {
|
|
@@ -374,13 +375,13 @@ async function pt(...e) {
|
|
|
374
375
|
async function u(d) {
|
|
375
376
|
const [l] = qe(d);
|
|
376
377
|
if (!l) return;
|
|
377
|
-
const [y, _] = ct(t, l), [T, p, k, O] = q.get(t),
|
|
378
|
+
const [y, _] = ct(t, l), [T, p, k, O] = q.get(t), v = () => {
|
|
378
379
|
const V = T[l];
|
|
379
380
|
return (F(s.revalidate) ? s.revalidate(y().data, d) : s.revalidate !== !1) && (delete k[l], delete O[l], V && V[0]) ? V[0](dt).then(() => y().data) : y().data;
|
|
380
381
|
};
|
|
381
382
|
if (e.length < 3)
|
|
382
|
-
return
|
|
383
|
-
let S = r,
|
|
383
|
+
return v();
|
|
384
|
+
let S = r, E;
|
|
384
385
|
const L = Ie();
|
|
385
386
|
p[l] = [
|
|
386
387
|
L,
|
|
@@ -394,19 +395,19 @@ async function pt(...e) {
|
|
|
394
395
|
try {
|
|
395
396
|
S = S(K);
|
|
396
397
|
} catch (V) {
|
|
397
|
-
|
|
398
|
+
E = V;
|
|
398
399
|
}
|
|
399
400
|
if (S && fn(S))
|
|
400
401
|
if (S = await S.catch((V) => {
|
|
401
|
-
|
|
402
|
+
E = V;
|
|
402
403
|
}), L !== p[l][0]) {
|
|
403
|
-
if (
|
|
404
|
+
if (E) throw E;
|
|
404
405
|
return S;
|
|
405
|
-
} else
|
|
406
|
+
} else E && w && c(E) && (i = !0, _({
|
|
406
407
|
data: K,
|
|
407
408
|
_c: P
|
|
408
409
|
}));
|
|
409
|
-
if (i && !
|
|
410
|
+
if (i && !E)
|
|
410
411
|
if (F(i)) {
|
|
411
412
|
const V = i(S, K);
|
|
412
413
|
_({
|
|
@@ -420,12 +421,12 @@ async function pt(...e) {
|
|
|
420
421
|
error: P,
|
|
421
422
|
_c: P
|
|
422
423
|
});
|
|
423
|
-
if (p[l][1] = Ie(), Promise.resolve(
|
|
424
|
+
if (p[l][1] = Ie(), Promise.resolve(v()).then(() => {
|
|
424
425
|
_({
|
|
425
426
|
_c: P
|
|
426
427
|
});
|
|
427
|
-
}),
|
|
428
|
-
if (a) throw
|
|
428
|
+
}), E) {
|
|
429
|
+
if (a) throw E;
|
|
429
430
|
return;
|
|
430
431
|
}
|
|
431
432
|
return S;
|
|
@@ -436,7 +437,7 @@ const rt = (e, t) => {
|
|
|
436
437
|
e[n][0] && e[n][0](t);
|
|
437
438
|
}, mn = (e, t) => {
|
|
438
439
|
if (!q.has(e)) {
|
|
439
|
-
const n = G(
|
|
440
|
+
const n = G(vn, t), r = {}, o = pt.bind(P, e);
|
|
440
441
|
let s = $;
|
|
441
442
|
const i = {}, f = (a, u) => {
|
|
442
443
|
const d = i[a] || [];
|
|
@@ -555,7 +556,7 @@ const ot = z.use || ((e) => {
|
|
|
555
556
|
}), Ce = {
|
|
556
557
|
dedupe: !0
|
|
557
558
|
}, Mn = (e, t, n) => {
|
|
558
|
-
const { cache: r, compare: o, suspense: s, fallbackData: i, revalidateOnMount: f, revalidateIfStale: h, refreshInterval: c, refreshWhenHidden: a, refreshWhenOffline: u, keepPreviousData: d } = n, [l, y, _, T] = q.get(r), [p, k] = qe(e), O = W(!1),
|
|
559
|
+
const { cache: r, compare: o, suspense: s, fallbackData: i, revalidateOnMount: f, revalidateIfStale: h, refreshInterval: c, refreshWhenHidden: a, refreshWhenOffline: u, keepPreviousData: d } = n, [l, y, _, T] = q.get(r), [p, k] = qe(e), O = W(!1), v = W(!1), S = W(p), E = W(t), L = W(n), w = () => L.current, C = () => w().isVisible() && w().isOnline(), [j, B, K, V] = ct(r, p), J = W({}).current, Gt = g(i) ? n.fallback[p] : i, He = (m, b) => {
|
|
559
560
|
for (const D in J) {
|
|
560
561
|
const R = D;
|
|
561
562
|
if (R === "data") {
|
|
@@ -596,11 +597,11 @@ const ot = z.use || ((e) => {
|
|
|
596
597
|
]
|
|
597
598
|
), $e[0], $e[1]), Ge = !O.current, Kt = l[p] && l[p].length > 0, Q = X.data, Z = g(Q) ? Gt : Q, ce = X.error, Ke = W(Z), fe = d ? g(Q) ? Ke.current : Q : Z, ze = Kt && !g(ce) ? !1 : Ge && !g(f) ? f : w().isPaused() ? !1 : s ? g(Z) ? !1 : h : g(Z) || h, Ye = !!(p && t && Ge && ze), zt = g(X.isValidating) ? Ye : X.isValidating, Yt = g(X.isLoading) ? Ye : X.isLoading, ne = Se(
|
|
598
599
|
async (m) => {
|
|
599
|
-
const b =
|
|
600
|
-
if (!p || !b ||
|
|
600
|
+
const b = E.current;
|
|
601
|
+
if (!p || !b || v.current || w().isPaused())
|
|
601
602
|
return !1;
|
|
602
603
|
let D, R, N = !0;
|
|
603
|
-
const ee = m || {}, A = !_[p] || !ee.dedupe, x = () => tt ? !
|
|
604
|
+
const ee = m || {}, A = !_[p] || !ee.dedupe, x = () => tt ? !v.current && p === S.current && O.current : p === S.current, M = {
|
|
604
605
|
isValidating: !1,
|
|
605
606
|
isLoading: !1
|
|
606
607
|
}, Je = () => {
|
|
@@ -631,10 +632,10 @@ const ot = z.use || ((e) => {
|
|
|
631
632
|
M.data = o(U, D) ? U : D, A && x() && w().onSuccess(D, p, n);
|
|
632
633
|
} catch (I) {
|
|
633
634
|
Xe();
|
|
634
|
-
const U = w(), { shouldRetryOnError:
|
|
635
|
-
U.isPaused() || (M.error = I, A && x() && (U.onError(I, p, U), (
|
|
636
|
-
const
|
|
637
|
-
|
|
635
|
+
const U = w(), { shouldRetryOnError: ve } = U;
|
|
636
|
+
U.isPaused() || (M.error = I, A && x() && (U.onError(I, p, U), (ve === !0 || F(ve) && ve(I)) && (!w().revalidateOnFocus || !w().revalidateOnReconnect || C()) && U.onErrorRetry(I, p, U, (kt) => {
|
|
637
|
+
const Ee = l[p];
|
|
638
|
+
Ee && Ee[0] && Ee[0](re.ERROR_REVALIDATE_EVENT, kt);
|
|
638
639
|
}, {
|
|
639
640
|
retryCount: (ee.retryCount || 0) + 1,
|
|
640
641
|
dedupe: !0
|
|
@@ -664,7 +665,7 @@ const ot = z.use || ((e) => {
|
|
|
664
665
|
[]
|
|
665
666
|
);
|
|
666
667
|
if (Re(() => {
|
|
667
|
-
|
|
668
|
+
E.current = t, L.current = n, g(Q) || (Ke.current = Q);
|
|
668
669
|
}), Re(() => {
|
|
669
670
|
if (!p) return;
|
|
670
671
|
const m = ne.bind(P, Ce);
|
|
@@ -682,10 +683,10 @@ const ot = z.use || ((e) => {
|
|
|
682
683
|
return ne(ee);
|
|
683
684
|
}
|
|
684
685
|
});
|
|
685
|
-
return
|
|
686
|
+
return v.current = !1, S.current = p, O.current = !0, B({
|
|
686
687
|
_k: k
|
|
687
|
-
}), ze && (g(Z) || ue ? m() :
|
|
688
|
-
|
|
688
|
+
}), ze && (g(Z) || ue ? m() : En(m)), () => {
|
|
689
|
+
v.current = !0, R();
|
|
689
690
|
};
|
|
690
691
|
}, [
|
|
691
692
|
p
|
|
@@ -709,7 +710,7 @@ const ot = z.use || ((e) => {
|
|
|
709
710
|
]), Qt(fe), s && g(Z) && p) {
|
|
710
711
|
if (!tt && ue)
|
|
711
712
|
throw new Error("Fallback data is required when using suspense in SSR.");
|
|
712
|
-
|
|
713
|
+
E.current = t, L.current = n, v.current = !1;
|
|
713
714
|
const m = T[p];
|
|
714
715
|
if (!g(m)) {
|
|
715
716
|
const b = ke(m);
|
|
@@ -776,7 +777,7 @@ var he = function() {
|
|
|
776
777
|
return t;
|
|
777
778
|
}, he.apply(this, arguments);
|
|
778
779
|
};
|
|
779
|
-
function
|
|
780
|
+
function vt(e, t) {
|
|
780
781
|
var n = {};
|
|
781
782
|
for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r]);
|
|
782
783
|
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
@@ -784,7 +785,7 @@ function Et(e, t) {
|
|
|
784
785
|
t.indexOf(r[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[o]) && (n[r[o]] = e[r[o]]);
|
|
785
786
|
return n;
|
|
786
787
|
}
|
|
787
|
-
function
|
|
788
|
+
function Et(e, t, n, r) {
|
|
788
789
|
var o = arguments.length, s = o < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, i;
|
|
789
790
|
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") s = Reflect.decorate(e, t, n, r);
|
|
790
791
|
else for (var f = e.length - 1; f >= 0; f--) (i = e[f]) && (s = (o < 3 ? i(s) : o > 3 ? i(t, n, s) : i(t, n)) || s);
|
|
@@ -1137,8 +1138,8 @@ function Ht(e, t) {
|
|
|
1137
1138
|
const Bn = {
|
|
1138
1139
|
__extends: gt,
|
|
1139
1140
|
__assign: he,
|
|
1140
|
-
__rest:
|
|
1141
|
-
__decorate:
|
|
1141
|
+
__rest: vt,
|
|
1142
|
+
__decorate: Et,
|
|
1142
1143
|
__param: St,
|
|
1143
1144
|
__esDecorate: wt,
|
|
1144
1145
|
__runInitializers: mt,
|
|
@@ -1182,7 +1183,7 @@ const Bn = {
|
|
|
1182
1183
|
__classPrivateFieldIn: Wt,
|
|
1183
1184
|
__classPrivateFieldSet: Ut,
|
|
1184
1185
|
__createBinding: ge,
|
|
1185
|
-
__decorate:
|
|
1186
|
+
__decorate: Et,
|
|
1186
1187
|
__disposeResources: Bt,
|
|
1187
1188
|
__esDecorate: wt,
|
|
1188
1189
|
__exportStar: At,
|
|
@@ -1195,7 +1196,7 @@ const Bn = {
|
|
|
1195
1196
|
__param: St,
|
|
1196
1197
|
__propKey: bt,
|
|
1197
1198
|
__read: Be,
|
|
1198
|
-
__rest:
|
|
1199
|
+
__rest: vt,
|
|
1199
1200
|
__rewriteRelativeImportExtension: Ht,
|
|
1200
1201
|
__runInitializers: mt,
|
|
1201
1202
|
__setFunctionName: Ot,
|
|
@@ -1360,4 +1361,4 @@ export {
|
|
|
1360
1361
|
nr as m,
|
|
1361
1362
|
Y as u
|
|
1362
1363
|
};
|
|
1363
|
-
//# sourceMappingURL=useWidgetTrigger-
|
|
1364
|
+
//# sourceMappingURL=useWidgetTrigger-Bi12WVrs.js.map
|