@dxos/plugin-client 0.7.5-main.ff8607b → 0.7.5-staging.2ff1350
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 → app-graph-builder-JRQVJHEH.mjs} +2 -2
- package/dist/lib/browser/chunk-BFNE5KCF.mjs +271 -0
- package/dist/lib/browser/chunk-BFNE5KCF.mjs.map +7 -0
- package/dist/lib/browser/{chunk-MSK3TLIH.mjs → chunk-GHEQL2E6.mjs} +1 -2
- package/dist/lib/browser/{chunk-MSK3TLIH.mjs.map → chunk-GHEQL2E6.mjs.map} +3 -3
- package/dist/lib/browser/{chunk-E3OUNOEL.mjs → chunk-GYCVFUTM.mjs} +13 -1
- package/dist/lib/browser/{chunk-E3OUNOEL.mjs.map → chunk-GYCVFUTM.mjs.map} +3 -3
- package/dist/lib/browser/{client-BEJK55IM.mjs → client-A7YSVURS.mjs} +3 -8
- package/dist/lib/browser/client-A7YSVURS.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +17 -10
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-XNZZLRBY.mjs → intent-resolver-Z7OSI733.mjs} +113 -9
- package/dist/lib/browser/intent-resolver-Z7OSI733.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-context-PHX2CVI7.mjs → react-context-R3SG55F5.mjs} +2 -2
- package/dist/lib/browser/{react-surface-K5NKVCIB.mjs → react-surface-6BINNBEX.mjs} +20 -4
- package/dist/lib/browser/react-surface-6BINNBEX.mjs.map +7 -0
- package/dist/lib/browser/{schema-AL34NY2M.mjs → schema-J4MJIXRP.mjs} +3 -13
- package/dist/lib/browser/schema-J4MJIXRP.mjs.map +7 -0
- package/dist/lib/browser/types.mjs +1 -1
- package/dist/lib/node/{app-graph-builder-JCND3P6G.cjs → app-graph-builder-R6QR2VLZ.cjs} +6 -6
- package/dist/lib/node/chunk-3P5BBMXO.cjs +299 -0
- package/dist/lib/node/chunk-3P5BBMXO.cjs.map +7 -0
- package/dist/lib/node/{chunk-NVYWMDF3.cjs → chunk-NZKGFE46.cjs} +16 -4
- package/dist/lib/node/{chunk-NVYWMDF3.cjs.map → chunk-NZKGFE46.cjs.map} +3 -3
- package/dist/lib/node/{chunk-ZI7AV5RP.cjs → chunk-UHIGZJQL.cjs} +4 -5
- package/dist/lib/node/{chunk-ZI7AV5RP.cjs.map → chunk-UHIGZJQL.cjs.map} +3 -3
- package/dist/lib/node/{client-AHIW24VM.cjs → client-2RQATBB6.cjs} +7 -12
- package/dist/lib/node/client-2RQATBB6.cjs.map +7 -0
- package/dist/lib/node/index.cjs +18 -11
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/intent-resolver-5UHRO64Q.cjs +271 -0
- package/dist/lib/node/intent-resolver-5UHRO64Q.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{react-context-WMOFXPT4.cjs → react-context-TD6VGBVA.cjs} +6 -6
- package/dist/lib/node/{react-surface-YQ2PKXNV.cjs → react-surface-KRKGFWS3.cjs} +27 -15
- package/dist/lib/node/react-surface-KRKGFWS3.cjs.map +7 -0
- package/dist/lib/node/{schema-HW4W3QYU.cjs → schema-JXJS75HQ.cjs} +8 -18
- package/dist/lib/node/schema-JXJS75HQ.cjs.map +7 -0
- package/dist/lib/node/types.cjs +2 -2
- package/dist/lib/node/types.cjs.map +1 -1
- package/dist/lib/node-esm/{app-graph-builder-ZLGKFBLY.mjs → app-graph-builder-WXXGCOJB.mjs} +2 -2
- package/dist/lib/node-esm/chunk-2FPF25KT.mjs +272 -0
- package/dist/lib/node-esm/chunk-2FPF25KT.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-74T33KTB.mjs → chunk-M2NR7HNG.mjs} +13 -1
- package/dist/lib/node-esm/{chunk-74T33KTB.mjs.map → chunk-M2NR7HNG.mjs.map} +3 -3
- package/dist/lib/node-esm/{chunk-B73LKPGU.mjs → chunk-T35SFKK3.mjs} +1 -2
- package/dist/lib/node-esm/{chunk-B73LKPGU.mjs.map → chunk-T35SFKK3.mjs.map} +3 -3
- package/dist/lib/node-esm/{client-FY7IDNRL.mjs → client-36DKBSB7.mjs} +3 -8
- package/dist/lib/node-esm/client-36DKBSB7.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +17 -10
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-DLCCRSFV.mjs → intent-resolver-7XHZZGVW.mjs} +113 -9
- package/dist/lib/node-esm/intent-resolver-7XHZZGVW.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-context-EEGDXBWA.mjs → react-context-ZOGDOWJ2.mjs} +2 -2
- package/dist/lib/node-esm/{react-surface-H34XQPWC.mjs → react-surface-OQFDVSAP.mjs} +20 -4
- package/dist/lib/node-esm/react-surface-OQFDVSAP.mjs.map +7 -0
- package/dist/lib/node-esm/{schema-74LVJ3EU.mjs → schema-XM4HBLIX.mjs} +3 -13
- package/dist/lib/node-esm/schema-XM4HBLIX.mjs.map +7 -0
- package/dist/lib/node-esm/types.mjs +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts +0 -1
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/client.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +1 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +2 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/schema.d.ts.map +1 -1
- package/dist/types/src/components/IdentityDialog.d.ts +1 -2
- package/dist/types/src/components/IdentityDialog.d.ts.map +1 -1
- package/dist/types/src/components/JoinDialog.d.ts +1 -2
- package/dist/types/src/components/JoinDialog.d.ts.map +1 -1
- package/dist/types/src/components/ManageCredentialsDialog.d.ts +3 -0
- package/dist/types/src/components/ManageCredentialsDialog.d.ts.map +1 -0
- package/dist/types/src/components/ManageCredentialsDialog.stories.d.ts +8 -0
- package/dist/types/src/components/ManageCredentialsDialog.stories.d.ts.map +1 -0
- package/dist/types/src/components/RecoveryCodeDialog.d.ts +1 -2
- package/dist/types/src/components/RecoveryCodeDialog.d.ts.map +1 -1
- package/dist/types/src/components/RecoverySetupDialog.d.ts +3 -0
- package/dist/types/src/components/RecoverySetupDialog.d.ts.map +1 -0
- package/dist/types/src/components/RecoverySetupDialog.stories.d.ts +8 -0
- package/dist/types/src/components/RecoverySetupDialog.stories.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +1 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +7 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +16 -0
- package/dist/types/src/types.d.ts.map +1 -1
- package/package.json +21 -16
- package/src/ClientPlugin.ts +2 -2
- package/src/capabilities/capabilities.ts +0 -2
- package/src/capabilities/client.ts +1 -3
- package/src/capabilities/intent-resolver.ts +72 -4
- package/src/capabilities/react-surface.tsx +15 -0
- package/src/capabilities/schema.ts +3 -13
- package/src/components/IdentityDialog.tsx +12 -0
- package/src/components/ManageCredentialsDialog.stories.tsx +57 -0
- package/src/components/ManageCredentialsDialog.tsx +64 -0
- package/src/components/RecoveryCodeDialog.stories.tsx +5 -5
- package/src/components/RecoveryCodeDialog.tsx +2 -1
- package/src/components/RecoverySetupDialog.stories.tsx +77 -0
- package/src/components/RecoverySetupDialog.tsx +52 -0
- package/src/components/index.ts +1 -0
- package/src/translations.ts +10 -1
- package/src/types.ts +10 -0
- package/dist/lib/browser/chunk-PDSHZE3P.mjs +0 -162
- package/dist/lib/browser/chunk-PDSHZE3P.mjs.map +0 -7
- package/dist/lib/browser/client-BEJK55IM.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-XNZZLRBY.mjs.map +0 -7
- package/dist/lib/browser/react-surface-K5NKVCIB.mjs.map +0 -7
- package/dist/lib/browser/schema-AL34NY2M.mjs.map +0 -7
- package/dist/lib/node/chunk-VUJ3ZPK3.cjs +0 -190
- package/dist/lib/node/chunk-VUJ3ZPK3.cjs.map +0 -7
- package/dist/lib/node/client-AHIW24VM.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-UZEK4ODS.cjs +0 -167
- package/dist/lib/node/intent-resolver-UZEK4ODS.cjs.map +0 -7
- package/dist/lib/node/react-surface-YQ2PKXNV.cjs.map +0 -7
- package/dist/lib/node/schema-HW4W3QYU.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-WS4CKCUR.mjs +0 -163
- package/dist/lib/node-esm/chunk-WS4CKCUR.mjs.map +0 -7
- package/dist/lib/node-esm/client-FY7IDNRL.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-DLCCRSFV.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-H34XQPWC.mjs.map +0 -7
- package/dist/lib/node-esm/schema-74LVJ3EU.mjs.map +0 -7
- /package/dist/lib/browser/{app-graph-builder-6LOTDB4T.mjs.map → app-graph-builder-JRQVJHEH.mjs.map} +0 -0
- /package/dist/lib/browser/{react-context-PHX2CVI7.mjs.map → react-context-R3SG55F5.mjs.map} +0 -0
- /package/dist/lib/node/{app-graph-builder-JCND3P6G.cjs.map → app-graph-builder-R6QR2VLZ.cjs.map} +0 -0
- /package/dist/lib/node/{react-context-WMOFXPT4.cjs.map → react-context-TD6VGBVA.cjs.map} +0 -0
- /package/dist/lib/node-esm/{app-graph-builder-ZLGKFBLY.mjs.map → app-graph-builder-WXXGCOJB.mjs.map} +0 -0
- /package/dist/lib/node-esm/{react-context-EEGDXBWA.mjs.map → react-context-ZOGDOWJ2.mjs.map} +0 -0
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { type JoinPanelProps } from '@dxos/shell/react';
|
|
3
2
|
export declare const JOIN_DIALOG = "dxos.org/plugin/client/JoinDialog";
|
|
4
|
-
export declare const JoinDialog: (props: JoinPanelProps) =>
|
|
3
|
+
export declare const JoinDialog: (props: JoinPanelProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
4
|
//# sourceMappingURL=JoinDialog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JoinDialog.d.ts","sourceRoot":"","sources":["../../../../src/components/JoinDialog.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"JoinDialog.d.ts","sourceRoot":"","sources":["../../../../src/components/JoinDialog.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAKnE,eAAO,MAAM,WAAW,sCAAgC,CAAC;AAEzD,eAAO,MAAM,UAAU,UAAW,cAAc,4CAiC/C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ManageCredentialsDialog.d.ts","sourceRoot":"","sources":["../../../../src/components/ManageCredentialsDialog.tsx"],"names":[],"mappings":"AAeA,eAAO,MAAM,yBAAyB,mDAA6C,CAAC;AAGpF,eAAO,MAAM,uBAAuB,+CA6CnC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import '@dxos-theme';
|
|
2
|
+
import { type StoryObj, type Meta } from '@storybook/react';
|
|
3
|
+
import { ManageCredentialsDialog } from './ManageCredentialsDialog';
|
|
4
|
+
declare const meta: Meta;
|
|
5
|
+
export default meta;
|
|
6
|
+
type Story = StoryObj<typeof ManageCredentialsDialog>;
|
|
7
|
+
export declare const Default: Story;
|
|
8
|
+
//# sourceMappingURL=ManageCredentialsDialog.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ManageCredentialsDialog.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/ManageCredentialsDialog.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAQ5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAcpE,QAAA,MAAM,IAAI,EAAE,IAsBX,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAEtD,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
export declare const RECOVER_CODE_DIALOG = "dxos.org/plugin/client/RecoveryCodeDialog";
|
|
3
2
|
export type RecoveryCodeDialogProps = {
|
|
4
3
|
code: string;
|
|
5
4
|
};
|
|
6
|
-
export declare const RecoveryCodeDialog: ({ code }: RecoveryCodeDialogProps) =>
|
|
5
|
+
export declare const RecoveryCodeDialog: ({ code }: RecoveryCodeDialogProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
6
|
//# sourceMappingURL=RecoveryCodeDialog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecoveryCodeDialog.d.ts","sourceRoot":"","sources":["../../../../src/components/RecoveryCodeDialog.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RecoveryCodeDialog.d.ts","sourceRoot":"","sources":["../../../../src/components/RecoveryCodeDialog.tsx"],"names":[],"mappings":"AAUA,eAAO,MAAM,mBAAmB,8CAAwC,CAAC;AAEzE,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAGF,eAAO,MAAM,kBAAkB,aAAc,uBAAuB,4CAoCnE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecoverySetupDialog.d.ts","sourceRoot":"","sources":["../../../../src/components/RecoverySetupDialog.tsx"],"names":[],"mappings":"AAcA,eAAO,MAAM,oBAAoB,+CAAyC,CAAC;AAG3E,eAAO,MAAM,mBAAmB,+CAkC/B,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import '@dxos-theme';
|
|
2
|
+
import { type StoryObj, type Meta } from '@storybook/react';
|
|
3
|
+
import { RecoverySetupDialog } from './RecoverySetupDialog';
|
|
4
|
+
declare const meta: Meta;
|
|
5
|
+
export default meta;
|
|
6
|
+
type Story = StoryObj<typeof RecoverySetupDialog>;
|
|
7
|
+
export declare const Default: Story;
|
|
8
|
+
//# sourceMappingURL=RecoverySetupDialog.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecoverySetupDialog.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/RecoverySetupDialog.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAW5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAgB5D,QAAA,MAAM,IAAI,EAAE,IAqCX,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAElD,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAIA,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAIA,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC"}
|
|
@@ -2,6 +2,13 @@ declare const _default: {
|
|
|
2
2
|
'en-US': {
|
|
3
3
|
"dxos.org/plugin/client": {
|
|
4
4
|
'open shell label': string;
|
|
5
|
+
'manage credentials dialog title': string;
|
|
6
|
+
'recovery setup dialog title': string;
|
|
7
|
+
'recovery setup dialog description': string;
|
|
8
|
+
'create passkey label': string;
|
|
9
|
+
'create passkey description': string;
|
|
10
|
+
'create recovery code label': string;
|
|
11
|
+
'create recovery code description': string;
|
|
5
12
|
'recovery code dialog title': string;
|
|
6
13
|
'recovery code dialog description': string;
|
|
7
14
|
'recovery code dialog warning 1': string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAMA,wBAyBE"}
|
|
@@ -73,6 +73,22 @@ export declare namespace ClientAction {
|
|
|
73
73
|
}>;
|
|
74
74
|
export class CreateRecoveryCode extends CreateRecoveryCode_base {
|
|
75
75
|
}
|
|
76
|
+
const CreatePasskey_base: S.TaggedClass<CreatePasskey, "dxos.org/plugin/client/action/create-passkey", {
|
|
77
|
+
readonly _tag: S.tag<"dxos.org/plugin/client/action/create-passkey">;
|
|
78
|
+
} & {
|
|
79
|
+
input: typeof S.Void;
|
|
80
|
+
output: typeof S.Void;
|
|
81
|
+
}>;
|
|
82
|
+
export class CreatePasskey extends CreatePasskey_base {
|
|
83
|
+
}
|
|
84
|
+
const RedeemPasskey_base: S.TaggedClass<RedeemPasskey, "dxos.org/plugin/client/action/redeem-passkey", {
|
|
85
|
+
readonly _tag: S.tag<"dxos.org/plugin/client/action/redeem-passkey">;
|
|
86
|
+
} & {
|
|
87
|
+
input: typeof S.Void;
|
|
88
|
+
output: typeof S.Void;
|
|
89
|
+
}>;
|
|
90
|
+
export class RedeemPasskey extends RedeemPasskey_base {
|
|
91
|
+
}
|
|
76
92
|
export {};
|
|
77
93
|
}
|
|
78
94
|
export type ClientPluginOptions = ClientOptions & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AACtC,OAAO,EAAE,KAAK,MAAM,EAAE,SAAS,EAAE,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAkB/C,yBAAiB,YAAY,CAAC;;;;;;;;;;;;;;;;;IAC5B,MAAM,OAAO,cAAe,SAAQ,mBAKlC;KAAG;;;;;;;;;IAEL,MAAM,OAAO,YAAa,SAAQ,iBAKhC;KAAG;;;;;;;IAEL,MAAM,OAAO,aAAc,SAAQ,kBAGjC;KAAG;;;;;;;IAEL,MAAM,OAAO,eAAgB,SAAQ,oBAGnC;KAAG;;;;;;;;;IAEL,MAAM,OAAO,YAAa,SAAQ,iBAKhC;KAAG;;;;;;;IAEL,MAAM,OAAO,WAAY,SAAQ,gBAG/B;KAAG;;;;;;;IAEL,MAAM,OAAO,kBAAmB,SAAQ,uBAGtC;KAAG;;CACN;AAED,MAAM,MAAM,mBAAmB,GAAG,aAAa,GAAG;IAChD;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,mBAAmB,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,KAAK,YAAY,CAAC,IAAI,CAAC,CAAC;IAEtF;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,YAAY,CAAC,IAAI,CAAC,CAAC;CAC/D,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AACtC,OAAO,EAAE,KAAK,MAAM,EAAE,SAAS,EAAE,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAkB/C,yBAAiB,YAAY,CAAC;;;;;;;;;;;;;;;;;IAC5B,MAAM,OAAO,cAAe,SAAQ,mBAKlC;KAAG;;;;;;;;;IAEL,MAAM,OAAO,YAAa,SAAQ,iBAKhC;KAAG;;;;;;;IAEL,MAAM,OAAO,aAAc,SAAQ,kBAGjC;KAAG;;;;;;;IAEL,MAAM,OAAO,eAAgB,SAAQ,oBAGnC;KAAG;;;;;;;;;IAEL,MAAM,OAAO,YAAa,SAAQ,iBAKhC;KAAG;;;;;;;IAEL,MAAM,OAAO,WAAY,SAAQ,gBAG/B;KAAG;;;;;;;IAEL,MAAM,OAAO,kBAAmB,SAAQ,uBAGtC;KAAG;;;;;;;IAEL,MAAM,OAAO,aAAc,SAAQ,kBAGjC;KAAG;;;;;;;IAEL,MAAM,OAAO,aAAc,SAAQ,kBAGjC;KAAG;;CACN;AAED,MAAM,MAAM,mBAAmB,GAAG,aAAa,GAAG;IAChD;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,mBAAmB,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,KAAK,YAAY,CAAC,IAAI,CAAC,CAAC;IAEtF;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,YAAY,CAAC,IAAI,CAAC,CAAC;CAC/D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-client",
|
|
3
|
-
"version": "0.7.5-
|
|
3
|
+
"version": "0.7.5-staging.2ff1350",
|
|
4
4
|
"description": "DXOS Surface plugin for DXOS Client",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"author": "DXOS.org",
|
|
9
9
|
"sideEffects": true,
|
|
10
|
+
"type": "module",
|
|
10
11
|
"exports": {
|
|
11
12
|
".": {
|
|
12
13
|
"types": "./dist/types/src/index.d.ts",
|
|
@@ -33,19 +34,18 @@
|
|
|
33
34
|
],
|
|
34
35
|
"dependencies": {
|
|
35
36
|
"@preact/signals-core": "^1.6.0",
|
|
36
|
-
"@dxos/app-framework": "0.7.5-
|
|
37
|
-
"@dxos/config": "0.7.5-
|
|
38
|
-
"@dxos/echo-
|
|
39
|
-
"@dxos/echo-
|
|
40
|
-
"@dxos/invariant": "0.7.5-
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/plugin-observability": "0.7.5-
|
|
45
|
-
"@dxos/react-client": "0.7.5-
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/util": "0.7.5-main.ff8607b"
|
|
37
|
+
"@dxos/app-framework": "0.7.5-staging.2ff1350",
|
|
38
|
+
"@dxos/config": "0.7.5-staging.2ff1350",
|
|
39
|
+
"@dxos/echo-signals": "0.7.5-staging.2ff1350",
|
|
40
|
+
"@dxos/echo-schema": "0.7.5-staging.2ff1350",
|
|
41
|
+
"@dxos/invariant": "0.7.5-staging.2ff1350",
|
|
42
|
+
"@dxos/local-storage": "0.7.5-staging.2ff1350",
|
|
43
|
+
"@dxos/plugin-graph": "0.7.5-staging.2ff1350",
|
|
44
|
+
"@dxos/log": "0.7.5-staging.2ff1350",
|
|
45
|
+
"@dxos/plugin-observability": "0.7.5-staging.2ff1350",
|
|
46
|
+
"@dxos/react-client": "0.7.5-staging.2ff1350",
|
|
47
|
+
"@dxos/util": "0.7.5-staging.2ff1350",
|
|
48
|
+
"@dxos/shell": "0.7.5-staging.2ff1350"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@phosphor-icons/react": "^2.1.5",
|
|
@@ -54,12 +54,17 @@
|
|
|
54
54
|
"react": "~18.2.0",
|
|
55
55
|
"react-dom": "~18.2.0",
|
|
56
56
|
"vite": "5.4.7",
|
|
57
|
-
"@dxos/
|
|
57
|
+
"@dxos/live-object": "0.7.5-staging.2ff1350",
|
|
58
|
+
"@dxos/react-ui-theme": "0.7.5-staging.2ff1350",
|
|
59
|
+
"@dxos/react-ui": "0.7.5-staging.2ff1350",
|
|
60
|
+
"@dxos/storybook-utils": "0.7.5-staging.2ff1350"
|
|
58
61
|
},
|
|
59
62
|
"peerDependencies": {
|
|
60
63
|
"@phosphor-icons/react": "^2.1.5",
|
|
61
64
|
"react": "~18.2.0",
|
|
62
|
-
"react-dom": "~18.2.0"
|
|
65
|
+
"react-dom": "~18.2.0",
|
|
66
|
+
"@dxos/react-ui": "0.7.5-staging.2ff1350",
|
|
67
|
+
"@dxos/react-ui-theme": "0.7.5-staging.2ff1350"
|
|
63
68
|
},
|
|
64
69
|
"publishConfig": {
|
|
65
70
|
"access": "public"
|
package/src/ClientPlugin.ts
CHANGED
|
@@ -42,7 +42,7 @@ export const ClientPlugin = ({
|
|
|
42
42
|
}),
|
|
43
43
|
defineModule({
|
|
44
44
|
id: `${meta.id}/module/react-surface`,
|
|
45
|
-
activatesOn: Events.
|
|
45
|
+
activatesOn: Events.SetupReactSurface,
|
|
46
46
|
activate: () => ReactSurface({ createInvitationUrl }),
|
|
47
47
|
}),
|
|
48
48
|
defineModule({
|
|
@@ -52,7 +52,7 @@ export const ClientPlugin = ({
|
|
|
52
52
|
}),
|
|
53
53
|
defineModule({
|
|
54
54
|
id: `${meta.id}/module/intent-resolver`,
|
|
55
|
-
activatesOn: Events.
|
|
55
|
+
activatesOn: Events.SetupIntentResolver,
|
|
56
56
|
activate: (context) => IntentResolver({ context, onReset }),
|
|
57
57
|
}),
|
|
58
58
|
defineModule({
|
|
@@ -11,6 +11,4 @@ import { CLIENT_PLUGIN } from '../meta';
|
|
|
11
11
|
export namespace ClientCapabilities {
|
|
12
12
|
export const Client = defineCapability<Client>(`${CLIENT_PLUGIN}/capability/client`);
|
|
13
13
|
export const Schema = defineCapability<TypedObject[]>(`${CLIENT_PLUGIN}/capability/schema`);
|
|
14
|
-
// TODO(wittjosiah): Rename this. Reserve "system" nomenclature for internal use.
|
|
15
|
-
export const SystemSchema = defineCapability<TypedObject[]>(`${CLIENT_PLUGIN}/capability/system-schema`);
|
|
16
14
|
}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { contributes, type PluginsContext } from '@dxos/app-framework';
|
|
6
|
-
import { Config, Defaults, Envs, Local, Storage } from '@dxos/config';
|
|
7
6
|
import { Client } from '@dxos/react-client';
|
|
8
7
|
|
|
9
8
|
import { ClientCapabilities } from './capabilities';
|
|
@@ -15,8 +14,7 @@ type ClientCapabilityOptions = Omit<ClientPluginOptions, 'appKey' | 'invitationU
|
|
|
15
14
|
};
|
|
16
15
|
|
|
17
16
|
export default async ({ context, onClientInitialized, ...options }: ClientCapabilityOptions) => {
|
|
18
|
-
const
|
|
19
|
-
const client = new Client({ config, ...options });
|
|
17
|
+
const client = new Client(options);
|
|
20
18
|
await client.initialize();
|
|
21
19
|
await onClientInitialized?.(context, client);
|
|
22
20
|
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
} from '@dxos/app-framework';
|
|
13
13
|
import { invariant } from '@dxos/invariant';
|
|
14
14
|
import { ObservabilityAction } from '@dxos/plugin-observability/types';
|
|
15
|
+
import { PublicKey } from '@dxos/react-client';
|
|
15
16
|
import { type JoinPanelProps } from '@dxos/shell/react';
|
|
16
17
|
|
|
17
18
|
import { ClientCapabilities } from './capabilities';
|
|
@@ -21,9 +22,10 @@ import { ClientAction, type ClientPluginOptions } from '../types';
|
|
|
21
22
|
|
|
22
23
|
type IntentResolverOptions = Pick<ClientPluginOptions, 'onReset'> & {
|
|
23
24
|
context: PluginsContext;
|
|
25
|
+
appName?: string;
|
|
24
26
|
};
|
|
25
27
|
|
|
26
|
-
export default ({ context, onReset }: IntentResolverOptions) =>
|
|
28
|
+
export default ({ context, appName = 'Composer', onReset }: IntentResolverOptions) =>
|
|
27
29
|
contributes(Capabilities.IntentResolver, [
|
|
28
30
|
createResolver({
|
|
29
31
|
intent: ClientAction.CreateIdentity,
|
|
@@ -110,8 +112,8 @@ export default ({ context, onReset }: IntentResolverOptions) =>
|
|
|
110
112
|
resolve: async () => {
|
|
111
113
|
const client = context.requestCapability(ClientCapabilities.Client);
|
|
112
114
|
invariant(client.services.services.IdentityService, 'IdentityService not available');
|
|
113
|
-
// TODO(wittjosiah): This needs a proper api.
|
|
114
|
-
const {
|
|
115
|
+
// TODO(wittjosiah): This needs a proper api.
|
|
116
|
+
const { recoveryCode } = await client.services.services.IdentityService.createRecoveryCredential({});
|
|
115
117
|
return {
|
|
116
118
|
intents: [
|
|
117
119
|
createIntent(LayoutAction.UpdateDialog, {
|
|
@@ -120,11 +122,77 @@ export default ({ context, onReset }: IntentResolverOptions) =>
|
|
|
120
122
|
options: {
|
|
121
123
|
blockAlign: 'start',
|
|
122
124
|
type: 'alert',
|
|
123
|
-
props: { code:
|
|
125
|
+
props: { code: recoveryCode },
|
|
124
126
|
},
|
|
125
127
|
}),
|
|
126
128
|
],
|
|
127
129
|
};
|
|
128
130
|
},
|
|
129
131
|
}),
|
|
132
|
+
createResolver({
|
|
133
|
+
intent: ClientAction.CreatePasskey,
|
|
134
|
+
resolve: async () => {
|
|
135
|
+
const client = context.requestCapability(ClientCapabilities.Client);
|
|
136
|
+
const identity = client.halo.identity.get();
|
|
137
|
+
invariant(identity, 'Identity not available');
|
|
138
|
+
|
|
139
|
+
// TODO(wittjosiah): Consider factoring out passkey creation to the halo api.
|
|
140
|
+
const credential = await navigator.credentials.create({
|
|
141
|
+
publicKey: {
|
|
142
|
+
challenge: new Uint8Array(),
|
|
143
|
+
rp: { id: location.hostname, name: appName },
|
|
144
|
+
user: {
|
|
145
|
+
id: new TextEncoder().encode(identity.did),
|
|
146
|
+
name: identity.did,
|
|
147
|
+
displayName: identity.profile?.displayName ?? '',
|
|
148
|
+
},
|
|
149
|
+
pubKeyCredParams: [
|
|
150
|
+
{ type: 'public-key', alg: -8 }, // Ed25519 (not yet supported across all browsers)
|
|
151
|
+
{ type: 'public-key', alg: -7 }, // ES256
|
|
152
|
+
],
|
|
153
|
+
// https://web.dev/articles/webauthn-discoverable-credentials#resident-key
|
|
154
|
+
authenticatorSelection: {
|
|
155
|
+
residentKey: 'required',
|
|
156
|
+
requireResidentKey: true,
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
invariant(credential, 'Credential not available');
|
|
162
|
+
const recoveryKey = PublicKey.from(new Uint8Array((credential as any).response.getPublicKey()));
|
|
163
|
+
const algorithm = (credential as any).response.getPublicKeyAlgorithm() === -7 ? 'ES256' : 'ED25519';
|
|
164
|
+
|
|
165
|
+
// TODO(wittjosiah): This needs a proper api.
|
|
166
|
+
invariant(client.services.services.IdentityService, 'IdentityService not available');
|
|
167
|
+
await client.services.services.IdentityService.createRecoveryCredential({ recoveryKey, algorithm });
|
|
168
|
+
},
|
|
169
|
+
}),
|
|
170
|
+
createResolver({
|
|
171
|
+
intent: ClientAction.RedeemPasskey,
|
|
172
|
+
resolve: async () => {
|
|
173
|
+
const client = context.requestCapability(ClientCapabilities.Client);
|
|
174
|
+
// TODO(wittjosiah): This needs a proper api.
|
|
175
|
+
invariant(client.services.services.IdentityService, 'IdentityService not available');
|
|
176
|
+
const { deviceKey, controlFeedKey, challenge } =
|
|
177
|
+
await client.services.services.IdentityService.requestRecoveryChallenge();
|
|
178
|
+
const credential = await navigator.credentials.get({
|
|
179
|
+
publicKey: {
|
|
180
|
+
challenge: Buffer.from(challenge, 'base64'),
|
|
181
|
+
rpId: location.hostname,
|
|
182
|
+
userVerification: 'required',
|
|
183
|
+
},
|
|
184
|
+
});
|
|
185
|
+
const identityDid = new TextDecoder().decode((credential as any).response.userHandle);
|
|
186
|
+
await client.services.services.IdentityService.recoverIdentity({
|
|
187
|
+
external: {
|
|
188
|
+
identityDid,
|
|
189
|
+
deviceKey,
|
|
190
|
+
controlFeedKey,
|
|
191
|
+
signature: Buffer.from((credential as any).response.signature),
|
|
192
|
+
clientDataJson: Buffer.from((credential as any).response.clientDataJSON),
|
|
193
|
+
authenticatorData: Buffer.from((credential as any).response.authenticatorData),
|
|
194
|
+
},
|
|
195
|
+
});
|
|
196
|
+
},
|
|
197
|
+
}),
|
|
130
198
|
]);
|
|
@@ -13,9 +13,12 @@ import {
|
|
|
13
13
|
JOIN_DIALOG,
|
|
14
14
|
JoinDialog,
|
|
15
15
|
RECOVER_CODE_DIALOG,
|
|
16
|
+
RECOVER_SETUP_DIALOG,
|
|
16
17
|
RecoveryCodeDialog,
|
|
18
|
+
RecoverySetupDialog,
|
|
17
19
|
type RecoveryCodeDialogProps,
|
|
18
20
|
} from '../components';
|
|
21
|
+
import { MANAGE_CREDENTIALS_DIALOG, ManageCredentialsDialog } from '../components/ManageCredentialsDialog';
|
|
19
22
|
|
|
20
23
|
type ReactSurfaceOptions = {
|
|
21
24
|
createInvitationUrl: (invitationCode: string) => string;
|
|
@@ -41,4 +44,16 @@ export default ({ createInvitationUrl }: ReactSurfaceOptions) =>
|
|
|
41
44
|
filter: (data): data is { props: RecoveryCodeDialogProps } => data.component === RECOVER_CODE_DIALOG,
|
|
42
45
|
component: ({ data }) => <RecoveryCodeDialog {...data.props} />,
|
|
43
46
|
}),
|
|
47
|
+
createSurface({
|
|
48
|
+
id: RECOVER_SETUP_DIALOG,
|
|
49
|
+
role: 'dialog',
|
|
50
|
+
filter: (data): data is any => data.component === RECOVER_SETUP_DIALOG,
|
|
51
|
+
component: () => <RecoverySetupDialog />,
|
|
52
|
+
}),
|
|
53
|
+
createSurface({
|
|
54
|
+
id: MANAGE_CREDENTIALS_DIALOG,
|
|
55
|
+
role: 'dialog',
|
|
56
|
+
filter: (data): data is any => data.component === MANAGE_CREDENTIALS_DIALOG,
|
|
57
|
+
component: () => <ManageCredentialsDialog />,
|
|
58
|
+
}),
|
|
44
59
|
]);
|
|
@@ -9,28 +9,18 @@ import { type TypedObject } from '@dxos/echo-schema';
|
|
|
9
9
|
|
|
10
10
|
import { ClientCapabilities } from './capabilities';
|
|
11
11
|
|
|
12
|
-
// TODO(wittjosiah): Remove types?
|
|
13
12
|
export default (context: PluginsContext) => {
|
|
14
13
|
const client = context.requestCapability(ClientCapabilities.Client);
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
const unsubscribeSystem = effect(() => {
|
|
18
|
-
const systemSchemas = Array.from(new Set(context.requestCapabilities(ClientCapabilities.SystemSchema).flat()));
|
|
19
|
-
const newSchemas = systemSchemas.filter((schema) => !previousSystem.includes(schema));
|
|
20
|
-
previousSystem = systemSchemas;
|
|
21
|
-
client.addTypes(newSchemas);
|
|
22
|
-
});
|
|
23
|
-
|
|
15
|
+
// TODO(wittjosiah): Unregister schemas when they are disabled.
|
|
24
16
|
let previous: TypedObject[] = [];
|
|
25
17
|
const unsubscribe = effect(() => {
|
|
26
18
|
const schemas = Array.from(new Set(context.requestCapabilities(ClientCapabilities.Schema).flat()));
|
|
19
|
+
// TODO(wittjosiah): Filter out schemas which the client has already registered.
|
|
27
20
|
const newSchemas = schemas.filter((schema) => !previous.includes(schema));
|
|
28
21
|
previous = schemas;
|
|
29
22
|
client.addTypes(newSchemas);
|
|
30
23
|
});
|
|
31
24
|
|
|
32
|
-
return contributes(Capabilities.Null, null, () =>
|
|
33
|
-
unsubscribeSystem();
|
|
34
|
-
unsubscribe();
|
|
35
|
-
});
|
|
25
|
+
return contributes(Capabilities.Null, null, () => unsubscribe());
|
|
36
26
|
};
|
|
@@ -9,6 +9,7 @@ import { useClient } from '@dxos/react-client';
|
|
|
9
9
|
import { Clipboard, Dialog } from '@dxos/react-ui';
|
|
10
10
|
import { IdentityPanel, type IdentityPanelProps } from '@dxos/shell/react';
|
|
11
11
|
|
|
12
|
+
import { MANAGE_CREDENTIALS_DIALOG } from './ManageCredentialsDialog';
|
|
12
13
|
import { CLIENT_PLUGIN } from '../meta';
|
|
13
14
|
import { ClientAction } from '../types';
|
|
14
15
|
|
|
@@ -44,6 +45,16 @@ export const IdentityDialog = (props: IdentityPanelProps) => {
|
|
|
44
45
|
await dispatch(createIntent(ClientAction.ResetStorage, { target: 'deviceInvitation' }));
|
|
45
46
|
}, [dispatch]);
|
|
46
47
|
|
|
48
|
+
const handleManageCredentials = useCallback(async () => {
|
|
49
|
+
await dispatch(
|
|
50
|
+
createIntent(LayoutAction.UpdateDialog, {
|
|
51
|
+
part: 'dialog',
|
|
52
|
+
subject: MANAGE_CREDENTIALS_DIALOG,
|
|
53
|
+
options: { state: true, blockAlign: 'start' },
|
|
54
|
+
}),
|
|
55
|
+
);
|
|
56
|
+
}, [dispatch]);
|
|
57
|
+
|
|
47
58
|
return (
|
|
48
59
|
<Dialog.Content>
|
|
49
60
|
<Clipboard.Provider>
|
|
@@ -54,6 +65,7 @@ export const IdentityDialog = (props: IdentityPanelProps) => {
|
|
|
54
65
|
onResetStorage={handleResetStorage}
|
|
55
66
|
onRecover={handleRecover}
|
|
56
67
|
onJoinNewIdentity={handleJoinNewIdentity}
|
|
68
|
+
onManageCredentials={handleManageCredentials}
|
|
57
69
|
/>
|
|
58
70
|
</Clipboard.Provider>
|
|
59
71
|
</Dialog.Content>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import '@dxos-theme';
|
|
6
|
+
|
|
7
|
+
import { type StoryObj, type Meta } from '@storybook/react';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
|
|
10
|
+
import { IntentPlugin } from '@dxos/app-framework';
|
|
11
|
+
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
12
|
+
import { AlertDialog } from '@dxos/react-ui';
|
|
13
|
+
import { withTheme, withLayout } from '@dxos/storybook-utils';
|
|
14
|
+
|
|
15
|
+
import { ManageCredentialsDialog } from './ManageCredentialsDialog';
|
|
16
|
+
import { ClientPlugin } from '../ClientPlugin';
|
|
17
|
+
import translations from '../translations';
|
|
18
|
+
|
|
19
|
+
const Render = () => {
|
|
20
|
+
return (
|
|
21
|
+
<AlertDialog.Root open>
|
|
22
|
+
<AlertDialog.Overlay>
|
|
23
|
+
<ManageCredentialsDialog />
|
|
24
|
+
</AlertDialog.Overlay>
|
|
25
|
+
</AlertDialog.Root>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const meta: Meta = {
|
|
30
|
+
title: 'plugins/plugin-client/ManageCredentialsDialog',
|
|
31
|
+
component: ManageCredentialsDialog,
|
|
32
|
+
render: Render,
|
|
33
|
+
decorators: [
|
|
34
|
+
withPluginManager({
|
|
35
|
+
plugins: [
|
|
36
|
+
IntentPlugin(),
|
|
37
|
+
ClientPlugin({
|
|
38
|
+
onClientInitialized: async (_, client) => {
|
|
39
|
+
await client.halo.createIdentity();
|
|
40
|
+
},
|
|
41
|
+
}),
|
|
42
|
+
],
|
|
43
|
+
}),
|
|
44
|
+
withTheme,
|
|
45
|
+
withLayout({ tooltips: true }),
|
|
46
|
+
],
|
|
47
|
+
parameters: {
|
|
48
|
+
layout: 'fullscreen',
|
|
49
|
+
translations,
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export default meta;
|
|
54
|
+
|
|
55
|
+
type Story = StoryObj<typeof ManageCredentialsDialog>;
|
|
56
|
+
|
|
57
|
+
export const Default: Story = {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Receipt, Key } from '@phosphor-icons/react';
|
|
6
|
+
import React, { useMemo } from 'react';
|
|
7
|
+
|
|
8
|
+
import { createIntent, useIntentDispatcher } from '@dxos/app-framework';
|
|
9
|
+
import { useCredentials } from '@dxos/react-client/halo';
|
|
10
|
+
import { Dialog, Icon, List, ListItem, useTranslation } from '@dxos/react-ui';
|
|
11
|
+
import { BifurcatedAction, type ActionMenuItem } from '@dxos/shell/react';
|
|
12
|
+
|
|
13
|
+
import { CLIENT_PLUGIN } from '../meta';
|
|
14
|
+
import { ClientAction } from '../types';
|
|
15
|
+
|
|
16
|
+
export const MANAGE_CREDENTIALS_DIALOG = `${CLIENT_PLUGIN}/ManageCredentialsDialog`;
|
|
17
|
+
|
|
18
|
+
// TODO(wittjosiah): Factor panel out to @dxos/shell.
|
|
19
|
+
export const ManageCredentialsDialog = () => {
|
|
20
|
+
const { t } = useTranslation(CLIENT_PLUGIN);
|
|
21
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
22
|
+
const credentials = useCredentials();
|
|
23
|
+
const recoveryCredentials = credentials.filter(
|
|
24
|
+
(credential) => credential.subject.assertion['@type'] === 'dxos.halo.credentials.IdentityRecovery',
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
// TODO(wittjosiah): Reconsile w/ RecoverySetupDialog actions.
|
|
28
|
+
const actions: Record<string, ActionMenuItem> = useMemo(
|
|
29
|
+
() => ({
|
|
30
|
+
createPasskey: {
|
|
31
|
+
label: t('create passkey label'),
|
|
32
|
+
description: t('create passkey description'),
|
|
33
|
+
// TODO(wittjosiah): Ideally this would be a `user-key` icon.
|
|
34
|
+
icon: Key,
|
|
35
|
+
onClick: () => dispatch(createIntent(ClientAction.CreatePasskey)),
|
|
36
|
+
},
|
|
37
|
+
createRecoveryCode: {
|
|
38
|
+
label: t('create recovery code label'),
|
|
39
|
+
description: t('create recovery code description'),
|
|
40
|
+
icon: Receipt,
|
|
41
|
+
onClick: () => dispatch(createIntent(ClientAction.CreateRecoveryCode)),
|
|
42
|
+
},
|
|
43
|
+
}),
|
|
44
|
+
[t],
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<Dialog.Content classNames='bs-content min-bs-[15rem] max-bs-full md:max-is-[25rem] overflow-hidden'>
|
|
49
|
+
<Dialog.Title>{t('manage credentials dialog title')}</Dialog.Title>
|
|
50
|
+
<List classNames='py-4'>
|
|
51
|
+
{recoveryCredentials.map((credential) => (
|
|
52
|
+
<ListItem.Root key={credential.id?.toHex()}>
|
|
53
|
+
<ListItem.Endcap>
|
|
54
|
+
<Icon icon='ph--key--regular' size={5} />
|
|
55
|
+
</ListItem.Endcap>
|
|
56
|
+
<ListItem.Heading>{credential.issuanceDate.toLocaleString()}</ListItem.Heading>
|
|
57
|
+
</ListItem.Root>
|
|
58
|
+
))}
|
|
59
|
+
</List>
|
|
60
|
+
<div className='grow' />
|
|
61
|
+
<BifurcatedAction actions={actions} />
|
|
62
|
+
</Dialog.Content>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
@@ -17,16 +17,16 @@ import translations from '../translations';
|
|
|
17
17
|
|
|
18
18
|
const Render = () => {
|
|
19
19
|
const client = useClient();
|
|
20
|
-
const [
|
|
20
|
+
const [recoveryCode, setRecoveryCode] = useState<string>();
|
|
21
21
|
useAsyncEffect(async () => {
|
|
22
|
-
const {
|
|
23
|
-
|
|
22
|
+
const { recoveryCode } = (await client.services.services.IdentityService?.createRecoveryCredential({})) ?? {};
|
|
23
|
+
setRecoveryCode(recoveryCode);
|
|
24
24
|
}, [client]);
|
|
25
25
|
|
|
26
26
|
return (
|
|
27
|
-
<AlertDialog.Root open={!!
|
|
27
|
+
<AlertDialog.Root open={!!recoveryCode}>
|
|
28
28
|
<AlertDialog.Overlay>
|
|
29
|
-
<RecoveryCodeDialog code={
|
|
29
|
+
<RecoveryCodeDialog code={recoveryCode ?? ''} />
|
|
30
30
|
</AlertDialog.Overlay>
|
|
31
31
|
</AlertDialog.Root>
|
|
32
32
|
);
|
|
@@ -14,6 +14,7 @@ export type RecoveryCodeDialogProps = {
|
|
|
14
14
|
code: string;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
+
// TODO(wittjosiah): Factor panel out to @dxos/shell.
|
|
17
18
|
export const RecoveryCodeDialog = ({ code }: RecoveryCodeDialogProps) => {
|
|
18
19
|
const { t } = useTranslation(CLIENT_PLUGIN);
|
|
19
20
|
const [confirmation, setConfirmation] = useState(false);
|
|
@@ -59,7 +60,7 @@ const Code = ({ code }: { code: string }) => {
|
|
|
59
60
|
<Clipboard.IconButton value={code} classNames='absolute top-2 right-2 invisible group-hover:visible' />
|
|
60
61
|
<div className='grid grid-cols-4'>
|
|
61
62
|
{words.map((word, i) => (
|
|
62
|
-
<div key={i} className='flex items-center p-2 gap-2
|
|
63
|
+
<div key={i} className='flex items-center p-2 gap-2'>
|
|
63
64
|
<div className='w-4 text-xs text-center text-subdued'>{i + 1}</div>
|
|
64
65
|
<div className='text-sm'>{word}</div>
|
|
65
66
|
</div>
|