@dxos/plugin-client 0.7.4 → 0.7.5-labs.071a3e2
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/lib/browser/app-graph-builder-6LOTDB4T.mjs +44 -0
- package/dist/lib/browser/app-graph-builder-6LOTDB4T.mjs.map +7 -0
- package/dist/lib/browser/chunk-E3OUNOEL.mjs +76 -0
- package/dist/lib/browser/chunk-E3OUNOEL.mjs.map +7 -0
- package/dist/lib/browser/chunk-MSK3TLIH.mjs +17 -0
- package/dist/lib/browser/chunk-MSK3TLIH.mjs.map +7 -0
- package/dist/lib/browser/chunk-NHIL4T3L.mjs +12 -0
- package/dist/lib/browser/chunk-NHIL4T3L.mjs.map +7 -0
- package/dist/lib/browser/chunk-PDSHZE3P.mjs +162 -0
- package/dist/lib/browser/chunk-PDSHZE3P.mjs.map +7 -0
- package/dist/lib/browser/chunk-RGMLBYIF.mjs +18 -0
- package/dist/lib/browser/chunk-RGMLBYIF.mjs.map +7 -0
- package/dist/lib/browser/client-BEJK55IM.mjs +41 -0
- package/dist/lib/browser/client-BEJK55IM.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +76 -428
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-resolver-E6TL7E24.mjs +159 -0
- package/dist/lib/browser/intent-resolver-E6TL7E24.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-context-PHX2CVI7.mjs +24 -0
- package/dist/lib/browser/react-context-PHX2CVI7.mjs.map +7 -0
- package/dist/lib/browser/react-surface-K5NKVCIB.mjs +41 -0
- package/dist/lib/browser/react-surface-K5NKVCIB.mjs.map +7 -0
- package/dist/lib/browser/schema-AL34NY2M.mjs +33 -0
- package/dist/lib/browser/schema-AL34NY2M.mjs.map +7 -0
- package/dist/lib/browser/types.mjs +8 -0
- package/dist/lib/node/app-graph-builder-JCND3P6G.cjs +58 -0
- package/dist/lib/node/app-graph-builder-JCND3P6G.cjs.map +7 -0
- package/dist/lib/node/chunk-NVYWMDF3.cjs +95 -0
- package/dist/lib/node/chunk-NVYWMDF3.cjs.map +7 -0
- package/dist/lib/node/{meta.cjs → chunk-OIFPM5ZW.cjs} +12 -11
- package/dist/lib/node/chunk-OIFPM5ZW.cjs.map +7 -0
- package/dist/lib/node/chunk-VUJ3ZPK3.cjs +190 -0
- package/dist/lib/node/chunk-VUJ3ZPK3.cjs.map +7 -0
- package/dist/lib/node/chunk-XPC4JOPP.cjs +37 -0
- package/dist/lib/node/chunk-XPC4JOPP.cjs.map +7 -0
- package/dist/lib/node/chunk-ZI7AV5RP.cjs +36 -0
- package/dist/lib/node/chunk-ZI7AV5RP.cjs.map +7 -0
- package/dist/lib/node/client-AHIW24VM.cjs +55 -0
- package/dist/lib/node/client-AHIW24VM.cjs.map +7 -0
- package/dist/lib/node/index.cjs +71 -416
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/intent-resolver-DUPICQ3F.cjs +167 -0
- package/dist/lib/node/intent-resolver-DUPICQ3F.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/react-context-WMOFXPT4.cjs +48 -0
- package/dist/lib/node/react-context-WMOFXPT4.cjs.map +7 -0
- package/dist/lib/node/react-surface-YQ2PKXNV.cjs +62 -0
- package/dist/lib/node/react-surface-YQ2PKXNV.cjs.map +7 -0
- package/dist/lib/node/schema-HW4W3QYU.cjs +49 -0
- package/dist/lib/node/schema-HW4W3QYU.cjs.map +7 -0
- package/dist/lib/node/types.cjs +30 -0
- package/dist/lib/node/types.cjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-ZLGKFBLY.mjs +45 -0
- package/dist/lib/node-esm/app-graph-builder-ZLGKFBLY.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-74T33KTB.mjs +77 -0
- package/dist/lib/node-esm/chunk-74T33KTB.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-B73LKPGU.mjs +18 -0
- package/dist/lib/node-esm/chunk-B73LKPGU.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HO7WDE7C.mjs +14 -0
- package/dist/lib/node-esm/chunk-HO7WDE7C.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-QR72BXJK.mjs +19 -0
- package/dist/lib/node-esm/chunk-QR72BXJK.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-WS4CKCUR.mjs +163 -0
- package/dist/lib/node-esm/chunk-WS4CKCUR.mjs.map +7 -0
- package/dist/lib/node-esm/client-FY7IDNRL.mjs +42 -0
- package/dist/lib/node-esm/client-FY7IDNRL.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +76 -428
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/intent-resolver-QUQH2LS2.mjs +160 -0
- package/dist/lib/node-esm/intent-resolver-QUQH2LS2.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react-context-EEGDXBWA.mjs +25 -0
- package/dist/lib/node-esm/react-context-EEGDXBWA.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-H34XQPWC.mjs +42 -0
- package/dist/lib/node-esm/react-surface-H34XQPWC.mjs.map +7 -0
- package/dist/lib/node-esm/schema-74LVJ3EU.mjs +34 -0
- package/dist/lib/node-esm/schema-74LVJ3EU.mjs.map +7 -0
- package/dist/lib/node-esm/types.mjs +9 -0
- package/dist/types/src/ClientPlugin.d.ts +2 -36
- package/dist/types/src/ClientPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +181 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/capabilities.d.ts +8 -0
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
- package/dist/types/src/capabilities/client.d.ts +9 -0
- package/dist/types/src/capabilities/client.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +194 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/intent-resolver.d.ts +8 -0
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-context.d.ts +8 -0
- package/dist/types/src/capabilities/react-context.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +7 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/schema.d.ts +4 -0
- package/dist/types/src/capabilities/schema.d.ts.map +1 -0
- package/dist/types/src/components/IdentityDialog.d.ts +1 -0
- package/dist/types/src/components/IdentityDialog.d.ts.map +1 -1
- package/dist/types/src/components/JoinDialog.d.ts +1 -0
- package/dist/types/src/components/JoinDialog.d.ts.map +1 -1
- package/dist/types/src/components/RecoveryCodeDialog.d.ts +1 -0
- package/dist/types/src/components/RecoveryCodeDialog.d.ts.map +1 -1
- package/dist/types/src/events.d.ts +7 -0
- package/dist/types/src/events.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +3 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -12
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +98 -0
- package/dist/types/src/types.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +23 -20
- package/src/ClientPlugin.ts +64 -0
- package/src/capabilities/app-graph-builder.ts +39 -0
- package/src/capabilities/capabilities.ts +16 -0
- package/src/capabilities/client.ts +42 -0
- package/src/capabilities/index.ts +14 -0
- package/src/capabilities/intent-resolver.ts +130 -0
- package/src/capabilities/react-context.tsx +20 -0
- package/src/capabilities/react-surface.tsx +44 -0
- package/src/capabilities/schema.ts +36 -0
- package/src/components/IdentityDialog.tsx +15 -13
- package/src/components/JoinDialog.tsx +13 -19
- package/src/components/RecoveryCodeDialog.stories.tsx +2 -2
- package/src/components/RecoveryCodeDialog.tsx +3 -1
- package/src/events.ts +14 -0
- package/src/index.ts +4 -4
- package/src/meta.ts +1 -15
- package/src/types.ts +89 -0
- package/dist/lib/browser/chunk-FGUXUNOK.mjs +0 -26
- package/dist/lib/browser/chunk-FGUXUNOK.mjs.map +0 -7
- package/dist/lib/browser/meta.mjs +0 -13
- package/dist/lib/node/chunk-XYLDQWFV.cjs +0 -51
- package/dist/lib/node/chunk-XYLDQWFV.cjs.map +0 -7
- package/dist/lib/node/meta.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-C6X363FK.mjs +0 -28
- package/dist/lib/node-esm/chunk-C6X363FK.mjs.map +0 -7
- package/dist/lib/node-esm/meta.mjs +0 -14
- package/src/ClientPlugin.tsx +0 -316
- /package/dist/lib/browser/{meta.mjs.map → types.mjs.map} +0 -0
- /package/dist/lib/node-esm/{meta.mjs.map → types.mjs.map} +0 -0
package/dist/lib/node/index.cjs
CHANGED
|
@@ -28,177 +28,28 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var node_exports = {};
|
|
30
30
|
__export(node_exports, {
|
|
31
|
+
CLIENT_PLUGIN: () => import_chunk_OIFPM5ZW.CLIENT_PLUGIN,
|
|
32
|
+
ClientCapabilities: () => import_chunk_ZI7AV5RP.ClientCapabilities,
|
|
33
|
+
ClientEvents: () => import_chunk_XPC4JOPP.ClientEvents,
|
|
31
34
|
ClientPlugin: () => ClientPlugin,
|
|
32
|
-
|
|
33
|
-
parseClientPlugin: () => parseClientPlugin
|
|
35
|
+
meta: () => import_chunk_OIFPM5ZW.meta
|
|
34
36
|
});
|
|
35
37
|
module.exports = __toCommonJS(node_exports);
|
|
36
|
-
var
|
|
37
|
-
var
|
|
38
|
+
var import_chunk_XPC4JOPP = require("./chunk-XPC4JOPP.cjs");
|
|
39
|
+
var import_chunk_ZI7AV5RP = require("./chunk-ZI7AV5RP.cjs");
|
|
40
|
+
var import_chunk_OIFPM5ZW = require("./chunk-OIFPM5ZW.cjs");
|
|
38
41
|
var import_app_framework = require("@dxos/app-framework");
|
|
39
|
-
var import_config = require("@dxos/config");
|
|
40
|
-
var import_react2 = require("@dxos/echo-signals/react");
|
|
41
|
-
var import_invariant = require("@dxos/invariant");
|
|
42
|
-
var import_plugin_graph = require("@dxos/plugin-graph");
|
|
43
|
-
var import_react_client = require("@dxos/react-client");
|
|
44
|
-
var import_react3 = __toESM(require("react"));
|
|
45
42
|
var import_app_framework2 = require("@dxos/app-framework");
|
|
46
|
-
var
|
|
47
|
-
var
|
|
48
|
-
var
|
|
49
|
-
var
|
|
50
|
-
var
|
|
51
|
-
var
|
|
52
|
-
var import_react6 = require("@dxos/shell/react");
|
|
53
|
-
var import_react7 = __toESM(require("react"));
|
|
54
|
-
var import_react_ui3 = require("@dxos/react-ui");
|
|
55
|
-
var IdentityDialog = (props) => {
|
|
56
|
-
const dispatch = (0, import_app_framework2.useIntentDispatcher)();
|
|
57
|
-
const client = (0, import_react_client2.useClient)();
|
|
58
|
-
const handleDone = (0, import_react3.useCallback)(() => dispatch({
|
|
59
|
-
action: import_app_framework2.LayoutAction.SET_LAYOUT,
|
|
60
|
-
data: {
|
|
61
|
-
element: "dialog",
|
|
62
|
-
state: false
|
|
63
|
-
}
|
|
64
|
-
}), [
|
|
65
|
-
dispatch
|
|
66
|
-
]);
|
|
67
|
-
const handleResetStorage = (0, import_react3.useCallback)(async () => {
|
|
68
|
-
await client.reset();
|
|
69
|
-
await dispatch({
|
|
70
|
-
action: import_chunk_XYLDQWFV.ClientAction.RESET_STORAGE
|
|
71
|
-
});
|
|
72
|
-
}, [
|
|
73
|
-
dispatch
|
|
74
|
-
]);
|
|
75
|
-
const handleRecover = (0, import_react3.useCallback)(async () => {
|
|
76
|
-
await client.reset();
|
|
77
|
-
await dispatch({
|
|
78
|
-
action: import_chunk_XYLDQWFV.ClientAction.RESET_STORAGE,
|
|
79
|
-
data: {
|
|
80
|
-
target: "recoverIdentity"
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
}, [
|
|
84
|
-
dispatch
|
|
85
|
-
]);
|
|
86
|
-
const handleJoinNewIdentity = (0, import_react3.useCallback)(async () => {
|
|
87
|
-
await client.reset();
|
|
88
|
-
await dispatch({
|
|
89
|
-
action: import_chunk_XYLDQWFV.ClientAction.RESET_STORAGE,
|
|
90
|
-
data: {
|
|
91
|
-
target: "deviceInvitation"
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
}, [
|
|
95
|
-
dispatch
|
|
96
|
-
]);
|
|
97
|
-
return /* @__PURE__ */ import_react3.default.createElement(import_react_ui.Dialog.Content, null, /* @__PURE__ */ import_react3.default.createElement(import_react_ui.Clipboard.Provider, null, /* @__PURE__ */ import_react3.default.createElement(import_react4.IdentityPanel, {
|
|
98
|
-
...props,
|
|
99
|
-
doneActionParent: /* @__PURE__ */ import_react3.default.createElement(import_react_ui.Dialog.Close, {
|
|
100
|
-
asChild: true
|
|
101
|
-
}),
|
|
102
|
-
onDone: handleDone,
|
|
103
|
-
onResetStorage: handleResetStorage,
|
|
104
|
-
onRecover: handleRecover,
|
|
105
|
-
onJoinNewIdentity: handleJoinNewIdentity
|
|
106
|
-
})));
|
|
107
|
-
};
|
|
108
|
-
var JoinDialog = (props) => {
|
|
109
|
-
const dispatch = (0, import_app_framework3.useIntentDispatcher)();
|
|
110
|
-
const handleCancelResetStorage = (0, import_react5.useCallback)(() => dispatch({
|
|
111
|
-
plugin: import_chunk_XYLDQWFV.CLIENT_PLUGIN,
|
|
112
|
-
action: import_chunk_XYLDQWFV.ClientAction.SHARE_IDENTITY
|
|
113
|
-
}), [
|
|
114
|
-
dispatch
|
|
115
|
-
]);
|
|
116
|
-
const handleDone = (0, import_react5.useCallback)(async (result) => {
|
|
117
|
-
if (result?.identityKey) {
|
|
118
|
-
await Promise.all([
|
|
119
|
-
dispatch({
|
|
120
|
-
action: import_app_framework3.LayoutAction.SET_LAYOUT,
|
|
121
|
-
data: {
|
|
122
|
-
element: "dialog",
|
|
123
|
-
state: false
|
|
124
|
-
}
|
|
125
|
-
}),
|
|
126
|
-
dispatch({
|
|
127
|
-
action: import_chunk_XYLDQWFV.OBSERVABILITY_ACTION,
|
|
128
|
-
data: {
|
|
129
|
-
name: props.initialDisposition === "recover-identity" ? "identity.recover" : "identity.join"
|
|
130
|
-
}
|
|
131
|
-
})
|
|
132
|
-
]);
|
|
133
|
-
}
|
|
134
|
-
}, [
|
|
135
|
-
dispatch
|
|
136
|
-
]);
|
|
137
|
-
return /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Dialog.Content, null, /* @__PURE__ */ import_react5.default.createElement(import_react6.JoinPanel, {
|
|
138
|
-
mode: "halo-only",
|
|
139
|
-
...props,
|
|
140
|
-
exitActionParent: /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Dialog.Close, {
|
|
141
|
-
asChild: true
|
|
142
|
-
}),
|
|
143
|
-
doneActionParent: /* @__PURE__ */ import_react5.default.createElement(import_react_ui2.Dialog.Close, {
|
|
144
|
-
asChild: true
|
|
145
|
-
}),
|
|
146
|
-
onCancelResetStorage: handleCancelResetStorage,
|
|
147
|
-
onDone: handleDone
|
|
148
|
-
}));
|
|
149
|
-
};
|
|
150
|
-
var RecoveryCodeDialog = ({ code }) => {
|
|
151
|
-
const { t } = (0, import_react_ui3.useTranslation)(import_chunk_XYLDQWFV.CLIENT_PLUGIN);
|
|
152
|
-
const [confirmation, setConfirmation] = (0, import_react7.useState)(false);
|
|
153
|
-
const handleConfirmation = (0, import_react7.useCallback)((checked) => setConfirmation(checked), []);
|
|
154
|
-
return /* @__PURE__ */ import_react7.default.createElement(import_react_ui3.AlertDialog.Content, {
|
|
155
|
-
classNames: "bs-content min-bs-[15rem] max-bs-full md:max-is-[40rem] overflow-hidden"
|
|
156
|
-
}, /* @__PURE__ */ import_react7.default.createElement(import_react_ui3.AlertDialog.Title, {
|
|
157
|
-
classNames: ""
|
|
158
|
-
}, t("recovery code dialog title")), /* @__PURE__ */ import_react7.default.createElement("p", {
|
|
159
|
-
className: "py-4"
|
|
160
|
-
}, t("recovery code dialog description")), /* @__PURE__ */ import_react7.default.createElement(import_react_ui3.Clipboard.Provider, null, /* @__PURE__ */ import_react7.default.createElement(Code, {
|
|
161
|
-
code
|
|
162
|
-
})), /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
163
|
-
className: "flex flex-col py-4 gap-2"
|
|
164
|
-
}, /* @__PURE__ */ import_react7.default.createElement("p", null, t("recovery code dialog warning 1")), /* @__PURE__ */ import_react7.default.createElement("p", null, t("recovery code dialog warning 2"))), /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
165
|
-
className: "flex items-center gap-2 pbe-4"
|
|
166
|
-
}, /* @__PURE__ */ import_react7.default.createElement(import_react_ui3.Input.Root, null, /* @__PURE__ */ import_react7.default.createElement(import_react_ui3.Input.Checkbox, {
|
|
167
|
-
"data-testid": "recoveryCode.confirm",
|
|
168
|
-
checked: confirmation,
|
|
169
|
-
onCheckedChange: handleConfirmation
|
|
170
|
-
}), /* @__PURE__ */ import_react7.default.createElement(import_react_ui3.Input.Label, null, t("recovery code confirmation label")))), /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
171
|
-
className: "flex justify-end"
|
|
172
|
-
}, /* @__PURE__ */ import_react7.default.createElement(import_react_ui3.AlertDialog.Action, {
|
|
173
|
-
asChild: true
|
|
174
|
-
}, /* @__PURE__ */ import_react7.default.createElement(import_react_ui3.Button, {
|
|
175
|
-
"data-testid": "recoveryCode.continue",
|
|
176
|
-
variant: "primary",
|
|
177
|
-
disabled: !confirmation
|
|
178
|
-
}, t("continue label")))));
|
|
179
|
-
};
|
|
180
|
-
var Code = ({ code }) => {
|
|
181
|
-
const words = code.split(" ");
|
|
182
|
-
return /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
183
|
-
className: "relative p-2 border border-separator rounded group"
|
|
184
|
-
}, /* @__PURE__ */ import_react7.default.createElement(import_react_ui3.Clipboard.IconButton, {
|
|
185
|
-
value: code,
|
|
186
|
-
classNames: "absolute top-2 right-2 invisible group-hover:visible"
|
|
187
|
-
}), /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
188
|
-
className: "grid grid-cols-4"
|
|
189
|
-
}, words.map((word, i) => /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
190
|
-
key: i,
|
|
191
|
-
className: "flex items-center p-2 gap-2 items-center"
|
|
192
|
-
}, /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
193
|
-
className: "w-4 text-xs text-center text-subdued"
|
|
194
|
-
}, i + 1), /* @__PURE__ */ import_react7.default.createElement("div", {
|
|
195
|
-
className: "text-sm"
|
|
196
|
-
}, word)))));
|
|
197
|
-
};
|
|
43
|
+
var AppGraphBuilder = (0, import_app_framework2.lazy)(async () => import("./app-graph-builder-JCND3P6G.cjs"));
|
|
44
|
+
var Client = (0, import_app_framework2.lazy)(async () => import("./client-AHIW24VM.cjs"));
|
|
45
|
+
var IntentResolver = (0, import_app_framework2.lazy)(async () => import("./intent-resolver-DUPICQ3F.cjs"));
|
|
46
|
+
var ReactContext = (0, import_app_framework2.lazy)(async () => import("./react-context-WMOFXPT4.cjs"));
|
|
47
|
+
var ReactSurface = (0, import_app_framework2.lazy)(async () => import("./react-surface-YQ2PKXNV.cjs"));
|
|
48
|
+
var Schema = (0, import_app_framework2.lazy)(async () => import("./schema-HW4W3QYU.cjs"));
|
|
198
49
|
var translations_default = [
|
|
199
50
|
{
|
|
200
51
|
"en-US": {
|
|
201
|
-
[
|
|
52
|
+
[import_chunk_OIFPM5ZW.CLIENT_PLUGIN]: {
|
|
202
53
|
"open shell label": "Open HALO",
|
|
203
54
|
"recovery code dialog title": "Account Recovery",
|
|
204
55
|
"recovery code dialog description": "This is your identity recovery code, store it in a safe place. You can use it to recover your identity if you ever lose access to your devices.",
|
|
@@ -210,266 +61,70 @@ var translations_default = [
|
|
|
210
61
|
}
|
|
211
62
|
}
|
|
212
63
|
];
|
|
213
|
-
var
|
|
214
|
-
|
|
215
|
-
var ClientPlugin = ({ appKey, invitationUrl = window.location.origin, invitationParam = "deviceInvitationCode", onClientInitialized, onReady, onReset, ...options }) => {
|
|
216
|
-
(0, import_react2.registerSignalsRuntime)();
|
|
217
|
-
let client;
|
|
218
|
-
let error = null;
|
|
219
|
-
const createDeviceInvitationUrl = (invitationCode) => {
|
|
64
|
+
var ClientPlugin = ({ invitationUrl = window.location.origin, invitationParam = "deviceInvitationCode", onReset, ...options }) => {
|
|
65
|
+
const createInvitationUrl = (invitationCode) => {
|
|
220
66
|
const baseUrl = new URL(invitationUrl);
|
|
221
67
|
baseUrl.searchParams.set(invitationParam, invitationCode);
|
|
222
68
|
return baseUrl.toString();
|
|
223
69
|
};
|
|
224
|
-
return
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
},
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
return /* @__PURE__ */ import_react.default.createElement(RecoveryCodeDialog, data.subject);
|
|
276
|
-
}
|
|
277
|
-
break;
|
|
278
|
-
}
|
|
279
|
-
return null;
|
|
280
|
-
}
|
|
281
|
-
},
|
|
282
|
-
graph: {
|
|
283
|
-
builder: (plugins) => {
|
|
284
|
-
const intentPlugin = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseIntentPlugin);
|
|
285
|
-
const id = `${import_chunk_XYLDQWFV.CLIENT_PLUGIN}/open-shell`;
|
|
286
|
-
return (0, import_plugin_graph.createExtension)({
|
|
287
|
-
id: import_chunk_XYLDQWFV.CLIENT_PLUGIN,
|
|
288
|
-
filter: (node) => node.id === "root",
|
|
289
|
-
actions: () => [
|
|
290
|
-
{
|
|
291
|
-
id,
|
|
292
|
-
data: async () => {
|
|
293
|
-
await intentPlugin?.provides.intent.dispatch([
|
|
294
|
-
{
|
|
295
|
-
plugin: import_chunk_XYLDQWFV.CLIENT_PLUGIN,
|
|
296
|
-
action: import_chunk_XYLDQWFV.ClientAction.SHARE_IDENTITY
|
|
297
|
-
}
|
|
298
|
-
]);
|
|
299
|
-
},
|
|
300
|
-
properties: {
|
|
301
|
-
label: [
|
|
302
|
-
"open shell label",
|
|
303
|
-
{
|
|
304
|
-
ns: import_chunk_XYLDQWFV.CLIENT_PLUGIN
|
|
305
|
-
}
|
|
306
|
-
],
|
|
307
|
-
icon: "ph--address-book--regular",
|
|
308
|
-
keyBinding: {
|
|
309
|
-
macos: "meta+shift+.",
|
|
310
|
-
// TODO(wittjosiah): Test on windows to see if it behaves the same as linux.
|
|
311
|
-
windows: "alt+shift+.",
|
|
312
|
-
linux: "alt+shift+>"
|
|
313
|
-
},
|
|
314
|
-
testId: "clientPlugin.openShell"
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
]
|
|
318
|
-
});
|
|
319
|
-
}
|
|
320
|
-
},
|
|
321
|
-
intent: {
|
|
322
|
-
resolver: async (intent) => {
|
|
323
|
-
switch (intent.action) {
|
|
324
|
-
case import_chunk_XYLDQWFV.ClientAction.CREATE_IDENTITY: {
|
|
325
|
-
const data = await client.halo.createIdentity();
|
|
326
|
-
return {
|
|
327
|
-
data,
|
|
328
|
-
intents: [
|
|
329
|
-
[
|
|
330
|
-
{
|
|
331
|
-
action: import_chunk_XYLDQWFV.OBSERVABILITY_ACTION,
|
|
332
|
-
data: {
|
|
333
|
-
name: "identity.create"
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
]
|
|
337
|
-
]
|
|
338
|
-
};
|
|
339
|
-
}
|
|
340
|
-
case import_chunk_XYLDQWFV.ClientAction.JOIN_IDENTITY: {
|
|
341
|
-
return {
|
|
342
|
-
data: true,
|
|
343
|
-
intents: [
|
|
344
|
-
[
|
|
345
|
-
{
|
|
346
|
-
action: import_app_framework.LayoutAction.SET_LAYOUT,
|
|
347
|
-
data: {
|
|
348
|
-
element: "dialog",
|
|
349
|
-
component: "dxos.org/plugin/client/JoinDialog",
|
|
350
|
-
dialogBlockAlign: "start",
|
|
351
|
-
subject: {
|
|
352
|
-
initialInvitationCode: intent.data?.invitationCode,
|
|
353
|
-
initialDisposition: "accept-halo-invitation"
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
]
|
|
358
|
-
]
|
|
359
|
-
};
|
|
360
|
-
}
|
|
361
|
-
case import_chunk_XYLDQWFV.ClientAction.SHARE_IDENTITY: {
|
|
362
|
-
return {
|
|
363
|
-
data: true,
|
|
364
|
-
intents: [
|
|
365
|
-
[
|
|
366
|
-
{
|
|
367
|
-
action: import_app_framework.LayoutAction.SET_LAYOUT,
|
|
368
|
-
data: {
|
|
369
|
-
element: "dialog",
|
|
370
|
-
component: "dxos.org/plugin/client/IdentityDialog",
|
|
371
|
-
dialogBlockAlign: "start"
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
],
|
|
375
|
-
[
|
|
376
|
-
{
|
|
377
|
-
action: import_chunk_XYLDQWFV.OBSERVABILITY_ACTION,
|
|
378
|
-
data: {
|
|
379
|
-
name: "identity.share"
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
]
|
|
383
|
-
]
|
|
384
|
-
};
|
|
385
|
-
}
|
|
386
|
-
case import_chunk_XYLDQWFV.ClientAction.RECOVER_IDENTITY: {
|
|
387
|
-
return {
|
|
388
|
-
data: true,
|
|
389
|
-
intents: [
|
|
390
|
-
[
|
|
391
|
-
{
|
|
392
|
-
action: import_app_framework.LayoutAction.SET_LAYOUT,
|
|
393
|
-
data: {
|
|
394
|
-
element: "dialog",
|
|
395
|
-
component: "dxos.org/plugin/client/JoinDialog",
|
|
396
|
-
dialogBlockAlign: "start",
|
|
397
|
-
subject: {
|
|
398
|
-
initialDisposition: "recover-identity"
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
]
|
|
403
|
-
]
|
|
404
|
-
};
|
|
405
|
-
}
|
|
406
|
-
case import_chunk_XYLDQWFV.ClientAction.RESET_STORAGE: {
|
|
407
|
-
await onReset?.({
|
|
408
|
-
target: intent.data?.target
|
|
409
|
-
});
|
|
410
|
-
return {
|
|
411
|
-
data: true
|
|
412
|
-
};
|
|
413
|
-
}
|
|
414
|
-
case import_chunk_XYLDQWFV.ClientAction.CREATE_AGENT: {
|
|
415
|
-
(0, import_invariant.invariant)(client.services.services.EdgeAgentService, "Missing EdgeAgentService", {
|
|
416
|
-
F: __dxlog_file,
|
|
417
|
-
L: 283,
|
|
418
|
-
S: void 0,
|
|
419
|
-
A: [
|
|
420
|
-
"client.services.services.EdgeAgentService",
|
|
421
|
-
"'Missing EdgeAgentService'"
|
|
422
|
-
]
|
|
423
|
-
});
|
|
424
|
-
await client.services.services.EdgeAgentService.createAgent(null, {
|
|
425
|
-
timeout: 1e4
|
|
426
|
-
});
|
|
427
|
-
return {
|
|
428
|
-
data: true
|
|
429
|
-
};
|
|
430
|
-
}
|
|
431
|
-
case import_chunk_XYLDQWFV.ClientAction.CREATE_RECOVERY_CODE: {
|
|
432
|
-
(0, import_invariant.invariant)(client.services.services.IdentityService, "IdentityService not available", {
|
|
433
|
-
F: __dxlog_file,
|
|
434
|
-
L: 289,
|
|
435
|
-
S: void 0,
|
|
436
|
-
A: [
|
|
437
|
-
"client.services.services.IdentityService",
|
|
438
|
-
"'IdentityService not available'"
|
|
439
|
-
]
|
|
440
|
-
});
|
|
441
|
-
const { seedphrase } = await client.services.services.IdentityService.createRecoveryPhrase();
|
|
442
|
-
return {
|
|
443
|
-
data: true,
|
|
444
|
-
intents: [
|
|
445
|
-
[
|
|
446
|
-
{
|
|
447
|
-
action: import_app_framework.LayoutAction.SET_LAYOUT,
|
|
448
|
-
data: {
|
|
449
|
-
element: "dialog",
|
|
450
|
-
dialogBlockAlign: "start",
|
|
451
|
-
dialogType: "alert",
|
|
452
|
-
state: true,
|
|
453
|
-
component: "dxos.org/plugin/client/RecoveryCodeDialog",
|
|
454
|
-
subject: {
|
|
455
|
-
code: seedphrase
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
]
|
|
460
|
-
]
|
|
461
|
-
};
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
};
|
|
70
|
+
return (0, import_app_framework.definePlugin)(import_chunk_OIFPM5ZW.meta, [
|
|
71
|
+
(0, import_app_framework.defineModule)({
|
|
72
|
+
id: `${import_chunk_OIFPM5ZW.meta.id}/module/client`,
|
|
73
|
+
activatesOn: (0, import_app_framework.oneOf)(import_app_framework.Events.Startup, import_app_framework.Events.SetupAppGraph),
|
|
74
|
+
activatesAfter: [
|
|
75
|
+
import_chunk_XPC4JOPP.ClientEvents.ClientReady
|
|
76
|
+
],
|
|
77
|
+
activate: (context) => Client({
|
|
78
|
+
...options,
|
|
79
|
+
context
|
|
80
|
+
})
|
|
81
|
+
}),
|
|
82
|
+
(0, import_app_framework.defineModule)({
|
|
83
|
+
id: `${import_chunk_OIFPM5ZW.meta.id}/module/schema`,
|
|
84
|
+
activatesOn: import_chunk_XPC4JOPP.ClientEvents.ClientReady,
|
|
85
|
+
activatesBefore: [
|
|
86
|
+
import_chunk_XPC4JOPP.ClientEvents.SetupSchema
|
|
87
|
+
],
|
|
88
|
+
activate: Schema
|
|
89
|
+
}),
|
|
90
|
+
(0, import_app_framework.defineModule)({
|
|
91
|
+
id: `${import_chunk_OIFPM5ZW.meta.id}/module/react-context`,
|
|
92
|
+
activatesOn: import_app_framework.Events.Startup,
|
|
93
|
+
activate: ReactContext
|
|
94
|
+
}),
|
|
95
|
+
(0, import_app_framework.defineModule)({
|
|
96
|
+
id: `${import_chunk_OIFPM5ZW.meta.id}/module/react-surface`,
|
|
97
|
+
activatesOn: import_app_framework.Events.SetupSurfaces,
|
|
98
|
+
activate: () => ReactSurface({
|
|
99
|
+
createInvitationUrl
|
|
100
|
+
})
|
|
101
|
+
}),
|
|
102
|
+
(0, import_app_framework.defineModule)({
|
|
103
|
+
id: `${import_chunk_OIFPM5ZW.meta.id}/module/app-graph-builder`,
|
|
104
|
+
activatesOn: import_app_framework.Events.SetupAppGraph,
|
|
105
|
+
activate: AppGraphBuilder
|
|
106
|
+
}),
|
|
107
|
+
(0, import_app_framework.defineModule)({
|
|
108
|
+
id: `${import_chunk_OIFPM5ZW.meta.id}/module/intent-resolver`,
|
|
109
|
+
activatesOn: import_app_framework.Events.SetupIntents,
|
|
110
|
+
activate: (context) => IntentResolver({
|
|
111
|
+
context,
|
|
112
|
+
onReset
|
|
113
|
+
})
|
|
114
|
+
}),
|
|
115
|
+
(0, import_app_framework.defineModule)({
|
|
116
|
+
id: `${import_chunk_OIFPM5ZW.meta.id}/module/translations`,
|
|
117
|
+
activatesOn: import_app_framework.Events.SetupTranslations,
|
|
118
|
+
activate: () => (0, import_app_framework.contributes)(import_app_framework.Capabilities.Translations, translations_default)
|
|
119
|
+
})
|
|
120
|
+
]);
|
|
468
121
|
};
|
|
469
|
-
var src_default = ClientPlugin;
|
|
470
122
|
// Annotate the CommonJS export names for ESM import in node:
|
|
471
123
|
0 && (module.exports = {
|
|
124
|
+
CLIENT_PLUGIN,
|
|
125
|
+
ClientCapabilities,
|
|
126
|
+
ClientEvents,
|
|
472
127
|
ClientPlugin,
|
|
473
|
-
|
|
128
|
+
meta
|
|
474
129
|
});
|
|
475
130
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/ClientPlugin.
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport {\n LayoutAction,\n parseIntentPlugin,\n resolvePlugin,\n type SurfaceProvides,\n type GraphBuilderProvides,\n type IntentResolverProvides,\n type Plugin,\n type PluginDefinition,\n type TranslationsProvides,\n} from '@dxos/app-framework';\nimport { Config, Defaults, Envs, Local, Storage } from '@dxos/config';\nimport { registerSignalsRuntime } from '@dxos/echo-signals/react';\nimport { invariant } from '@dxos/invariant';\nimport { createExtension, type Node } from '@dxos/plugin-graph';\nimport { Client, type ClientOptions, ClientProvider } from '@dxos/react-client';\nimport { type IdentityPanelProps, type JoinPanelProps } from '@dxos/shell/react';\n\nimport { IdentityDialog, JoinDialog, RecoveryCodeDialog, type RecoveryCodeDialogProps } from './components';\nimport meta, { CLIENT_PLUGIN, ClientAction, OBSERVABILITY_ACTION } from './meta';\nimport translations from './translations';\n\nexport type ClientPluginOptions = ClientOptions & {\n /**\n * Used to track app-specific state in spaces.\n */\n appKey: string;\n\n /**\n * Base URL for the invitation link.\n */\n invitationUrl?: string;\n\n /**\n * Query parameter for the invitation code.\n */\n invitationParam?: string;\n\n /**\n * Run after the client has been initialized.\n */\n onClientInitialized?: (client: Client) => Promise<void>;\n\n /**\n * Run after the identity has been successfully initialized.\n * Run with client during plugin ready phase.\n */\n onReady?: (client: Client, plugins: Plugin[]) => Promise<void>;\n\n /**\n * Called when the client is reset.\n */\n onReset?: (params: { target?: string }) => Promise<void>;\n};\n\nexport type ClientPluginProvides = IntentResolverProvides &\n GraphBuilderProvides &\n SurfaceProvides &\n TranslationsProvides & {\n client: Client;\n };\n\nexport const parseClientPlugin = (plugin?: Plugin) =>\n (plugin?.provides as any).client instanceof Client ? (plugin as Plugin<ClientPluginProvides>) : undefined;\n\nexport const ClientPlugin = ({\n appKey,\n invitationUrl = window.location.origin,\n invitationParam = 'deviceInvitationCode',\n onClientInitialized,\n onReady,\n onReset,\n ...options\n}: ClientPluginOptions): PluginDefinition<\n Omit<ClientPluginProvides, 'client'>,\n Pick<ClientPluginProvides, 'client'>\n> => {\n registerSignalsRuntime();\n\n let client: Client;\n let error: unknown = null;\n\n const createDeviceInvitationUrl = (invitationCode: string) => {\n const baseUrl = new URL(invitationUrl);\n baseUrl.searchParams.set(invitationParam, invitationCode);\n return baseUrl.toString();\n };\n\n return {\n meta,\n initialize: async () => {\n const config = new Config(await Storage(), Envs(), Local(), Defaults());\n client = new Client({ config, ...options });\n\n try {\n await client.initialize();\n await onClientInitialized?.(client);\n\n // TODO(wittjosiah): Remove. This is a hack to get the app to boot with the new identity after a reset.\n client.reloaded.on(() => {\n client.halo.identity.subscribe(async (identity) => {\n if (identity) {\n window.location.href = window.location.origin;\n }\n });\n });\n } catch (err) {\n error = err;\n }\n\n return {\n client,\n context: ({ children }) => <ClientProvider client={client}>{children}</ClientProvider>,\n };\n },\n ready: async (plugins) => {\n if (error) {\n throw error;\n }\n\n await onReady?.(client, plugins);\n },\n unload: async () => {\n await client.destroy();\n },\n provides: {\n translations,\n surface: {\n component: ({ data, role, ...rest }) => {\n switch (role) {\n case 'dialog':\n if (data.component === 'dxos.org/plugin/client/IdentityDialog') {\n return (\n <IdentityDialog\n {...(data.subject as IdentityPanelProps)}\n createInvitationUrl={createDeviceInvitationUrl}\n />\n );\n } else if (data.component === 'dxos.org/plugin/client/JoinDialog') {\n return <JoinDialog {...(data.subject as JoinPanelProps)} />;\n } else if (data.component === 'dxos.org/plugin/client/RecoveryCodeDialog') {\n return <RecoveryCodeDialog {...(data.subject as RecoveryCodeDialogProps)} />;\n }\n break;\n }\n\n return null;\n },\n },\n graph: {\n builder: (plugins) => {\n const intentPlugin = resolvePlugin(plugins, parseIntentPlugin);\n const id = `${CLIENT_PLUGIN}/open-shell`;\n\n return createExtension({\n id: CLIENT_PLUGIN,\n filter: (node): node is Node<null> => node.id === 'root',\n actions: () => [\n {\n id,\n data: async () => {\n await intentPlugin?.provides.intent.dispatch([\n { plugin: CLIENT_PLUGIN, action: ClientAction.SHARE_IDENTITY },\n ]);\n },\n properties: {\n label: ['open shell label', { ns: CLIENT_PLUGIN }],\n icon: 'ph--address-book--regular',\n keyBinding: {\n macos: 'meta+shift+.',\n // TODO(wittjosiah): Test on windows to see if it behaves the same as linux.\n windows: 'alt+shift+.',\n linux: 'alt+shift+>',\n },\n testId: 'clientPlugin.openShell',\n },\n },\n ],\n });\n },\n },\n intent: {\n resolver: async (intent) => {\n switch (intent.action) {\n case ClientAction.CREATE_IDENTITY: {\n const data = await client.halo.createIdentity();\n return {\n data,\n intents: [\n [\n {\n action: OBSERVABILITY_ACTION,\n data: {\n name: 'identity.create',\n },\n },\n ],\n ],\n };\n }\n\n case ClientAction.JOIN_IDENTITY: {\n return {\n data: true,\n intents: [\n [\n {\n action: LayoutAction.SET_LAYOUT,\n data: {\n element: 'dialog',\n component: 'dxos.org/plugin/client/JoinDialog',\n dialogBlockAlign: 'start',\n subject: {\n initialInvitationCode: intent.data?.invitationCode,\n initialDisposition: 'accept-halo-invitation',\n } satisfies Partial<JoinPanelProps>,\n },\n },\n ],\n ],\n };\n }\n\n case ClientAction.SHARE_IDENTITY: {\n return {\n data: true,\n intents: [\n [\n {\n action: LayoutAction.SET_LAYOUT,\n data: {\n element: 'dialog',\n component: 'dxos.org/plugin/client/IdentityDialog',\n dialogBlockAlign: 'start',\n },\n },\n ],\n [\n {\n action: OBSERVABILITY_ACTION,\n data: {\n name: 'identity.share',\n },\n },\n ],\n ],\n };\n }\n\n case ClientAction.RECOVER_IDENTITY: {\n return {\n data: true,\n intents: [\n [\n {\n action: LayoutAction.SET_LAYOUT,\n data: {\n element: 'dialog',\n component: 'dxos.org/plugin/client/JoinDialog',\n dialogBlockAlign: 'start',\n subject: {\n initialDisposition: 'recover-identity',\n } satisfies Partial<JoinPanelProps>,\n },\n },\n ],\n ],\n };\n }\n\n case ClientAction.RESET_STORAGE: {\n await onReset?.({ target: intent.data?.target });\n return { data: true };\n }\n\n case ClientAction.CREATE_AGENT: {\n invariant(client.services.services.EdgeAgentService, 'Missing EdgeAgentService');\n await client.services.services.EdgeAgentService.createAgent(null as any, { timeout: 10_000 });\n return { data: true };\n }\n\n case ClientAction.CREATE_RECOVERY_CODE: {\n invariant(client.services.services.IdentityService, 'IdentityService not available');\n // TODO(wittjosiah): This needs a proper api. Rename property.\n const { seedphrase } = await client.services.services.IdentityService.createRecoveryPhrase();\n return {\n data: true,\n intents: [\n [\n {\n action: LayoutAction.SET_LAYOUT,\n data: {\n element: 'dialog',\n dialogBlockAlign: 'start',\n dialogType: 'alert',\n state: true,\n component: 'dxos.org/plugin/client/RecoveryCodeDialog',\n subject: { code: seedphrase },\n },\n },\n ],\n ],\n };\n }\n }\n },\n },\n },\n };\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useCallback } from 'react';\n\nimport { LayoutAction, useIntentDispatcher } from '@dxos/app-framework';\nimport { useClient } from '@dxos/react-client';\nimport { Clipboard, Dialog } from '@dxos/react-ui';\nimport { IdentityPanel, type IdentityPanelProps } from '@dxos/shell/react';\n\nimport { ClientAction } from '../meta';\n\nexport const IdentityDialog = (props: IdentityPanelProps) => {\n const dispatch = useIntentDispatcher();\n const client = useClient();\n\n const handleDone = useCallback(\n () =>\n dispatch({\n action: LayoutAction.SET_LAYOUT,\n data: {\n element: 'dialog',\n state: false,\n },\n }),\n [dispatch],\n );\n\n const handleResetStorage = useCallback(async () => {\n await client.reset();\n await dispatch({ action: ClientAction.RESET_STORAGE });\n }, [dispatch]);\n\n const handleRecover = useCallback(async () => {\n await client.reset();\n await dispatch({ action: ClientAction.RESET_STORAGE, data: { target: 'recoverIdentity' } });\n }, [dispatch]);\n\n const handleJoinNewIdentity = useCallback(async () => {\n await client.reset();\n await dispatch({ action: ClientAction.RESET_STORAGE, data: { target: 'deviceInvitation' } });\n }, [dispatch]);\n\n return (\n <Dialog.Content>\n <Clipboard.Provider>\n <IdentityPanel\n {...props}\n doneActionParent={<Dialog.Close asChild />}\n onDone={handleDone}\n onResetStorage={handleResetStorage}\n onRecover={handleRecover}\n onJoinNewIdentity={handleJoinNewIdentity}\n />\n </Clipboard.Provider>\n </Dialog.Content>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useCallback } from 'react';\n\nimport { LayoutAction, useIntentDispatcher } from '@dxos/app-framework';\nimport { type InvitationResult } from '@dxos/react-client/invitations';\nimport { Dialog } from '@dxos/react-ui';\nimport { JoinPanel, type JoinPanelProps } from '@dxos/shell/react';\n\nimport { CLIENT_PLUGIN, ClientAction, OBSERVABILITY_ACTION } from '../meta';\n\nexport const JoinDialog = (props: JoinPanelProps) => {\n const dispatch = useIntentDispatcher();\n\n const handleCancelResetStorage = useCallback(\n () => dispatch({ plugin: CLIENT_PLUGIN, action: ClientAction.SHARE_IDENTITY }),\n [dispatch],\n );\n\n const handleDone = useCallback(\n async (result: InvitationResult | null) => {\n if (result?.identityKey) {\n await Promise.all([\n dispatch({\n action: LayoutAction.SET_LAYOUT,\n data: {\n element: 'dialog',\n state: false,\n },\n }),\n dispatch({\n action: OBSERVABILITY_ACTION,\n data: {\n name: props.initialDisposition === 'recover-identity' ? 'identity.recover' : 'identity.join',\n },\n }),\n ]);\n }\n },\n [dispatch],\n );\n\n return (\n <Dialog.Content>\n <JoinPanel\n mode='halo-only'\n {...props}\n exitActionParent={<Dialog.Close asChild />}\n doneActionParent={<Dialog.Close asChild />}\n onCancelResetStorage={handleCancelResetStorage}\n onDone={handleDone}\n />\n </Dialog.Content>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useCallback, useState } from 'react';\n\nimport { AlertDialog, Button, Clipboard, Input, useTranslation } from '@dxos/react-ui';\n\nimport { CLIENT_PLUGIN } from '../meta';\n\nexport type RecoveryCodeDialogProps = {\n code: string;\n};\n\nexport const RecoveryCodeDialog = ({ code }: RecoveryCodeDialogProps) => {\n const { t } = useTranslation(CLIENT_PLUGIN);\n const [confirmation, setConfirmation] = useState(false);\n\n const handleConfirmation = useCallback((checked: boolean) => setConfirmation(checked), []);\n\n return (\n <AlertDialog.Content classNames='bs-content min-bs-[15rem] max-bs-full md:max-is-[40rem] overflow-hidden'>\n <AlertDialog.Title classNames=''>{t('recovery code dialog title')}</AlertDialog.Title>\n <p className='py-4'>{t('recovery code dialog description')}</p>\n <Clipboard.Provider>\n <Code code={code} />\n </Clipboard.Provider>\n <div className='flex flex-col py-4 gap-2'>\n <p>{t('recovery code dialog warning 1')}</p>\n <p>{t('recovery code dialog warning 2')}</p>\n </div>\n <div className='flex items-center gap-2 pbe-4'>\n <Input.Root>\n <Input.Checkbox\n data-testid='recoveryCode.confirm'\n checked={confirmation}\n onCheckedChange={handleConfirmation}\n />\n <Input.Label>{t('recovery code confirmation label')}</Input.Label>\n </Input.Root>\n </div>\n <div className='flex justify-end'>\n <AlertDialog.Action asChild>\n <Button data-testid='recoveryCode.continue' variant='primary' disabled={!confirmation}>\n {t('continue label')}\n </Button>\n </AlertDialog.Action>\n </div>\n </AlertDialog.Content>\n );\n};\n\nconst Code = ({ code }: { code: string }) => {\n const words = code.split(' ');\n return (\n <div className='relative p-2 border border-separator rounded group'>\n <Clipboard.IconButton value={code} classNames='absolute top-2 right-2 invisible group-hover:visible' />\n <div className='grid grid-cols-4'>\n {words.map((word, i) => (\n <div key={i} className='flex items-center p-2 gap-2 items-center'>\n <div className='w-4 text-xs text-center text-subdued'>{i + 1}</div>\n <div className='text-sm'>{word}</div>\n </div>\n ))}\n </div>\n </div>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { CLIENT_PLUGIN } from './meta';\n\nexport default [\n {\n 'en-US': {\n [CLIENT_PLUGIN]: {\n 'open shell label': 'Open HALO',\n 'recovery code dialog title': 'Account Recovery',\n 'recovery code dialog description':\n 'This is your identity recovery code, store it in a safe place. You can use it to recover your identity if you ever lose access to your devices.',\n 'recovery code dialog warning 1': 'NOTE: This code will not be displayed again.',\n 'recovery code dialog warning 2':\n 'It is your private key for recovering DXOS data. Anyone with this key will be able to gain access to your account.',\n 'recovery code confirmation label': 'Please confirm you have saved the code.',\n 'continue label': 'Continue',\n },\n },\n },\n];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { ClientPlugin } from './ClientPlugin';\n\nexport default ClientPlugin;\n\nexport * from './ClientPlugin';\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["
|
|
3
|
+
"sources": ["../../../src/ClientPlugin.ts", "../../../src/capabilities/index.ts", "../../../src/translations.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capabilities, contributes, defineModule, definePlugin, Events, oneOf } from '@dxos/app-framework';\n\nimport { Client, AppGraphBuilder, IntentResolver, ReactContext, ReactSurface, Schema } from './capabilities';\nimport { ClientEvents } from './events';\nimport { meta } from './meta';\nimport translations from './translations';\nimport { type ClientPluginOptions } from './types';\n\nexport const ClientPlugin = ({\n invitationUrl = window.location.origin,\n invitationParam = 'deviceInvitationCode',\n onReset,\n ...options\n}: ClientPluginOptions) => {\n const createInvitationUrl = (invitationCode: string) => {\n const baseUrl = new URL(invitationUrl);\n baseUrl.searchParams.set(invitationParam, invitationCode);\n return baseUrl.toString();\n };\n\n return definePlugin(meta, [\n defineModule({\n id: `${meta.id}/module/client`,\n activatesOn: oneOf(Events.Startup, Events.SetupAppGraph),\n activatesAfter: [ClientEvents.ClientReady],\n activate: (context) => Client({ ...options, context }),\n }),\n defineModule({\n id: `${meta.id}/module/schema`,\n activatesOn: ClientEvents.ClientReady,\n activatesBefore: [ClientEvents.SetupSchema],\n activate: Schema,\n }),\n defineModule({\n id: `${meta.id}/module/react-context`,\n activatesOn: Events.Startup,\n activate: ReactContext,\n }),\n defineModule({\n id: `${meta.id}/module/react-surface`,\n activatesOn: Events.SetupSurfaces,\n activate: () => ReactSurface({ createInvitationUrl }),\n }),\n defineModule({\n id: `${meta.id}/module/app-graph-builder`,\n activatesOn: Events.SetupAppGraph,\n activate: AppGraphBuilder,\n }),\n defineModule({\n id: `${meta.id}/module/intent-resolver`,\n activatesOn: Events.SetupIntents,\n activate: (context) => IntentResolver({ context, onReset }),\n }),\n defineModule({\n id: `${meta.id}/module/translations`,\n activatesOn: Events.SetupTranslations,\n activate: () => contributes(Capabilities.Translations, translations),\n }),\n ]);\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { lazy } from '@dxos/app-framework';\n\nexport const AppGraphBuilder = lazy(async () => import('./app-graph-builder'));\nexport const Client = lazy(async () => import('./client'));\nexport const IntentResolver = lazy(async () => import('./intent-resolver'));\nexport const ReactContext = lazy(async () => import('./react-context'));\nexport const ReactSurface = lazy(async () => import('./react-surface'));\nexport const Schema = lazy(async () => import('./schema'));\n\nexport * from './capabilities';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { CLIENT_PLUGIN } from './meta';\n\nexport default [\n {\n 'en-US': {\n [CLIENT_PLUGIN]: {\n 'open shell label': 'Open HALO',\n 'recovery code dialog title': 'Account Recovery',\n 'recovery code dialog description':\n 'This is your identity recovery code, store it in a safe place. You can use it to recover your identity if you ever lose access to your devices.',\n 'recovery code dialog warning 1': 'NOTE: This code will not be displayed again.',\n 'recovery code dialog warning 2':\n 'It is your private key for recovering DXOS data. Anyone with this key will be able to gain access to your account.',\n 'recovery code confirmation label': 'Please confirm you have saved the code.',\n 'continue label': 'Continue',\n },\n },\n },\n];\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,2BAAqF;ACArF,IAAAA,wBAAqB;AAEd,IAAMC,sBAAkBC,4BAAK,YAAY,OAAO,kCAAA,CAAA;AAChD,IAAMC,aAASD,4BAAK,YAAY,OAAO,uBAAA,CAAA;AACvC,IAAME,qBAAiBF,4BAAK,YAAY,OAAO,gCAAA,CAAA;AAC/C,IAAMG,mBAAeH,4BAAK,YAAY,OAAO,8BAAA,CAAA;AAC7C,IAAMI,mBAAeJ,4BAAK,YAAY,OAAO,8BAAA,CAAA;AAC7C,IAAMK,aAASL,4BAAK,YAAY,OAAO,uBAAA,CAAA;ACL9C,IAAA,uBAAe;EACb;IACE,SAAS;MACP,CAACM,mCAAAA,GAAgB;QACf,oBAAoB;QACpB,8BAA8B;QAC9B,oCACE;QACF,kCAAkC;QAClC,kCACE;QACF,oCAAoC;QACpC,kBAAkB;MACpB;IACF;EACF;;AFTK,IAAMC,eAAe,CAAC,EAC3BC,gBAAgBC,OAAOC,SAASC,QAChCC,kBAAkB,wBAClBC,SACA,GAAGC,QAAAA,MACiB;AACpB,QAAMC,sBAAsB,CAACC,mBAAAA;AAC3B,UAAMC,UAAU,IAAIC,IAAIV,aAAAA;AACxBS,YAAQE,aAAaC,IAAIR,iBAAiBI,cAAAA;AAC1C,WAAOC,QAAQI,SAAQ;EACzB;AAEA,aAAOC,mCAAaC,4BAAM;QACxBC,mCAAa;MACXC,IAAI,GAAGF,2BAAKE,EAAE;MACdC,iBAAaC,4BAAMC,4BAAOC,SAASD,4BAAOE,aAAa;MACvDC,gBAAgB;QAACC,mCAAaC;;MAC9BC,UAAU,CAACC,YAAYlC,OAAO;QAAE,GAAGa;QAASqB;MAAQ,CAAA;IACtD,CAAA;QACAX,mCAAa;MACXC,IAAI,GAAGF,2BAAKE,EAAE;MACdC,aAAaM,mCAAaC;MAC1BG,iBAAiB;QAACJ,mCAAaK;;MAC/BH,UAAU7B;IACZ,CAAA;QACAmB,mCAAa;MACXC,IAAI,GAAGF,2BAAKE,EAAE;MACdC,aAAaE,4BAAOC;MACpBK,UAAU/B;IACZ,CAAA;QACAqB,mCAAa;MACXC,IAAI,GAAGF,2BAAKE,EAAE;MACdC,aAAaE,4BAAOU;MACpBJ,UAAU,MAAM9B,aAAa;QAAEW;MAAoB,CAAA;IACrD,CAAA;QACAS,mCAAa;MACXC,IAAI,GAAGF,2BAAKE,EAAE;MACdC,aAAaE,4BAAOE;MACpBI,UAAUnC;IACZ,CAAA;QACAyB,mCAAa;MACXC,IAAI,GAAGF,2BAAKE,EAAE;MACdC,aAAaE,4BAAOW;MACpBL,UAAU,CAACC,YAAYjC,eAAe;QAAEiC;QAAStB;MAAQ,CAAA;IAC3D,CAAA;QACAW,mCAAa;MACXC,IAAI,GAAGF,2BAAKE,EAAE;MACdC,aAAaE,4BAAOY;MACpBN,UAAU,UAAMO,kCAAYC,kCAAaC,cAAcC,oBAAAA;IACzD,CAAA;GACD;AACH;",
|
|
6
|
+
"names": ["import_app_framework", "AppGraphBuilder", "lazy", "Client", "IntentResolver", "ReactContext", "ReactSurface", "Schema", "CLIENT_PLUGIN", "ClientPlugin", "invitationUrl", "window", "location", "origin", "invitationParam", "onReset", "options", "createInvitationUrl", "invitationCode", "baseUrl", "URL", "searchParams", "set", "toString", "definePlugin", "meta", "defineModule", "id", "activatesOn", "oneOf", "Events", "Startup", "SetupAppGraph", "activatesAfter", "ClientEvents", "ClientReady", "activate", "context", "activatesBefore", "SetupSchema", "SetupSurfaces", "SetupIntents", "SetupTranslations", "contributes", "Capabilities", "Translations", "translations"]
|
|
7
7
|
}
|