@dxos/shell 0.4.10-main.ec8b427 → 0.4.10-main.eedd150
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/bundle/shell.mjs +12821 -11822
- package/dist/bundle/shell.mjs.map +1 -1
- package/dist/bundle/shell.umd.js +73 -65
- package/dist/bundle/shell.umd.js.map +1 -1
- package/dist/bundle/style.css +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react.mjs +435 -333
- package/dist/lib/browser/react.mjs.map +4 -4
- package/dist/lib/browser/testing/index.mjs +5 -7
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/types/src/components/EmojiPicker.d.ts.map +1 -1
- package/dist/types/src/components/EmojiPicker.js +2 -1
- package/dist/types/src/components/EmojiPicker.js.map +1 -1
- package/dist/types/src/composites/IdentityDialog/IdentityDialog.js +1 -1
- package/dist/types/src/composites/IdentityDialog/IdentityDialog.js.map +1 -1
- package/dist/types/src/composites/Shell/Shell.d.ts.map +1 -1
- package/dist/types/src/composites/Shell/Shell.js +18 -6
- package/dist/types/src/composites/Shell/Shell.js.map +1 -1
- package/dist/types/src/composites/StatusDialog/StatusDialog.d.ts +2 -0
- package/dist/types/src/composites/StatusDialog/StatusDialog.d.ts.map +1 -0
- package/dist/types/src/composites/StatusDialog/StatusDialog.js +22 -0
- package/dist/types/src/composites/StatusDialog/StatusDialog.js.map +1 -0
- package/dist/types/src/composites/StatusDialog/index.d.ts +2 -0
- package/dist/types/src/composites/StatusDialog/index.d.ts.map +1 -0
- package/dist/types/src/composites/StatusDialog/index.js +21 -0
- package/dist/types/src/composites/StatusDialog/index.js.map +1 -0
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.d.ts +1 -1
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.js +15 -8
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.js.map +1 -1
- package/dist/types/src/panels/IdentityPanel/IdentityPanelProps.d.ts +5 -3
- package/dist/types/src/panels/IdentityPanel/IdentityPanelProps.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/identityMachine.d.ts +3 -1
- package/dist/types/src/panels/IdentityPanel/identityMachine.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/identityMachine.js +15 -2
- package/dist/types/src/panels/IdentityPanel/identityMachine.js.map +1 -1
- package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.js +9 -5
- package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.js.map +1 -1
- package/dist/types/src/panels/IdentityPanel/steps/ProfileForm.js +4 -1
- package/dist/types/src/panels/IdentityPanel/steps/ProfileForm.js.map +1 -1
- package/dist/types/src/panels/IdentityPanel/steps/index.d.ts +0 -1
- package/dist/types/src/panels/IdentityPanel/steps/index.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/steps/index.js +0 -1
- package/dist/types/src/panels/IdentityPanel/steps/index.js.map +1 -1
- package/dist/types/src/panels/JoinPanel/JoinPanel.d.ts +1 -1
- package/dist/types/src/panels/JoinPanel/JoinPanel.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/JoinPanel.js +12 -5
- package/dist/types/src/panels/JoinPanel/JoinPanel.js.map +1 -1
- package/dist/types/src/panels/JoinPanel/JoinPanel.stories.d.ts +1 -1
- package/dist/types/src/panels/JoinPanel/JoinPanel.stories.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/JoinPanel.stories.js +2 -1
- package/dist/types/src/panels/JoinPanel/JoinPanel.stories.js.map +1 -1
- package/dist/types/src/panels/JoinPanel/JoinPanelProps.d.ts +8 -3
- package/dist/types/src/panels/JoinPanel/JoinPanelProps.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/joinMachine.d.ts +3 -2
- package/dist/types/src/panels/JoinPanel/joinMachine.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/joinMachine.js +7 -0
- package/dist/types/src/panels/JoinPanel/joinMachine.js.map +1 -1
- package/dist/types/src/panels/JoinPanel/steps/index.d.ts +0 -1
- package/dist/types/src/panels/JoinPanel/steps/index.d.ts.map +1 -1
- package/dist/types/src/panels/JoinPanel/steps/index.js +0 -1
- package/dist/types/src/panels/JoinPanel/steps/index.js.map +1 -1
- package/dist/types/src/panels/StatusPanel/StatusPanel.d.ts +4 -0
- package/dist/types/src/panels/StatusPanel/StatusPanel.d.ts.map +1 -0
- package/dist/types/src/panels/StatusPanel/StatusPanel.js +19 -0
- package/dist/types/src/panels/StatusPanel/StatusPanel.js.map +1 -0
- package/dist/types/src/panels/StatusPanel/index.d.ts +2 -0
- package/dist/types/src/panels/StatusPanel/index.d.ts.map +1 -0
- package/dist/types/src/panels/StatusPanel/index.js +21 -0
- package/dist/types/src/panels/StatusPanel/index.js.map +1 -0
- package/dist/types/src/panels/index.d.ts +1 -0
- package/dist/types/src/panels/index.d.ts.map +1 -1
- package/dist/types/src/panels/index.js +1 -0
- package/dist/types/src/panels/index.js.map +1 -1
- package/dist/types/src/steps/ConfirmReset.d.ts +16 -0
- package/dist/types/src/steps/ConfirmReset.d.ts.map +1 -0
- package/dist/types/src/steps/ConfirmReset.js +71 -0
- package/dist/types/src/steps/ConfirmReset.js.map +1 -0
- package/dist/types/src/steps/StepProps.d.ts +4 -1
- package/dist/types/src/steps/StepProps.d.ts.map +1 -1
- package/dist/types/src/steps/index.d.ts +1 -0
- package/dist/types/src/steps/index.d.ts.map +1 -1
- package/dist/types/src/steps/index.js +1 -0
- package/dist/types/src/steps/index.js.map +1 -1
- package/dist/types/src/testing/shell-manager.d.ts.map +1 -1
- package/dist/types/src/testing/shell-manager.js +5 -7
- package/dist/types/src/testing/shell-manager.js.map +1 -1
- package/dist/types/src/translations/locales/en-US.d.ts +4 -1
- package/dist/types/src/translations/locales/en-US.d.ts.map +1 -1
- package/dist/types/src/translations/locales/en-US.js +8 -5
- package/dist/types/src/translations/locales/en-US.js.map +1 -1
- package/dist/types/src/types/index.js +1 -0
- package/dist/types/src/types/index.js.map +1 -1
- package/package.json +20 -20
- package/src/components/EmojiPicker.tsx +3 -1
- package/src/composites/IdentityDialog/IdentityDialog.tsx +1 -1
- package/src/composites/Shell/Shell.tsx +23 -4
- package/src/composites/StatusDialog/StatusDialog.tsx +24 -0
- package/src/composites/StatusDialog/index.ts +5 -0
- package/src/panels/IdentityPanel/IdentityPanel.tsx +31 -14
- package/src/panels/IdentityPanel/IdentityPanelProps.ts +7 -3
- package/src/panels/IdentityPanel/identityMachine.ts +25 -3
- package/src/panels/IdentityPanel/steps/IdentityActionChooser.tsx +16 -7
- package/src/panels/IdentityPanel/steps/ProfileForm.tsx +6 -1
- package/src/panels/IdentityPanel/steps/index.ts +0 -1
- package/src/panels/JoinPanel/JoinPanel.stories.tsx +3 -2
- package/src/panels/JoinPanel/JoinPanel.tsx +21 -5
- package/src/panels/JoinPanel/JoinPanelProps.ts +9 -3
- package/src/panels/JoinPanel/joinMachine.ts +12 -2
- package/src/panels/JoinPanel/steps/index.ts +0 -1
- package/src/panels/StatusPanel/StatusPanel.tsx +19 -0
- package/src/panels/StatusPanel/index.ts +5 -0
- package/src/panels/index.ts +1 -0
- package/src/steps/ConfirmReset.tsx +112 -0
- package/src/steps/StepProps.ts +2 -1
- package/src/steps/index.ts +1 -0
- package/src/testing/shell-manager.ts +5 -7
- package/src/translations/locales/en-US.ts +9 -5
- package/src/types/index.ts +2 -0
- package/dist/types/src/panels/IdentityPanel/steps/SignOutChooser.d.ts +0 -16
- package/dist/types/src/panels/IdentityPanel/steps/SignOutChooser.d.ts.map +0 -1
- package/dist/types/src/panels/IdentityPanel/steps/SignOutChooser.js +0 -40
- package/dist/types/src/panels/IdentityPanel/steps/SignOutChooser.js.map +0 -1
- package/dist/types/src/panels/JoinPanel/steps/ResetIdentity.d.ts +0 -13
- package/dist/types/src/panels/JoinPanel/steps/ResetIdentity.d.ts.map +0 -1
- package/dist/types/src/panels/JoinPanel/steps/ResetIdentity.js +0 -66
- package/dist/types/src/panels/JoinPanel/steps/ResetIdentity.js.map +0 -1
- package/src/panels/IdentityPanel/steps/SignOutChooser.tsx +0 -84
- package/src/panels/JoinPanel/steps/ResetIdentity.tsx +0 -80
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
//
|
|
3
|
-
// Copyright 2023 DXOS.org
|
|
4
|
-
//
|
|
5
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
|
-
};
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.SignOutChooser = void 0;
|
|
10
|
-
const react_1 = require("@phosphor-icons/react");
|
|
11
|
-
const react_2 = __importDefault(require("react"));
|
|
12
|
-
const react_ui_1 = require("@dxos/react-ui");
|
|
13
|
-
const react_ui_theme_1 = require("@dxos/react-ui-theme");
|
|
14
|
-
const components_1 = require("../../../components");
|
|
15
|
-
const SignOutChooser = (props) => {
|
|
16
|
-
const { t } = (0, react_ui_1.useTranslation)('os');
|
|
17
|
-
const onResetDevice = () => {
|
|
18
|
-
var _a;
|
|
19
|
-
if (window.confirm(t('reset device confirm message'))) {
|
|
20
|
-
void ((_a = props.onResetDevice) === null || _a === void 0 ? void 0 : _a.call(props));
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
return (react_2.default.createElement(SignOutChooserImpl, { disabled: !props.active, onBack: () => { var _a; return (_a = props.send) === null || _a === void 0 ? void 0 : _a.call(props, { type: 'unchooseAction' }); }, onResetDevice: onResetDevice, onJoinNewIdentity: props.onJoinNewIdentity }));
|
|
24
|
-
};
|
|
25
|
-
exports.SignOutChooser = SignOutChooser;
|
|
26
|
-
const SignOutChooserImpl = ({ disabled, onResetDevice, onJoinNewIdentity, onBack }) => {
|
|
27
|
-
const { t } = (0, react_ui_1.useTranslation)('os');
|
|
28
|
-
return (react_2.default.createElement(react_2.default.Fragment, null,
|
|
29
|
-
react_2.default.createElement("div", { role: 'none', className: 'grow flex flex-col justify-center' },
|
|
30
|
-
react_2.default.createElement(react_ui_1.Message.Root, { valence: 'error' },
|
|
31
|
-
react_2.default.createElement(react_ui_1.Message.Title, null,
|
|
32
|
-
react_2.default.createElement(react_1.Warning, { className: (0, react_ui_theme_1.mx)((0, react_ui_theme_1.getSize)(6), 'inline mie-2') }),
|
|
33
|
-
t('sign out chooser title')),
|
|
34
|
-
react_2.default.createElement(react_ui_1.Message.Body, null, t('sign out chooser message')))),
|
|
35
|
-
react_2.default.createElement(components_1.Actions, null,
|
|
36
|
-
react_2.default.createElement(components_1.Action, { disabled: disabled, onClick: onBack }, t('back label')),
|
|
37
|
-
react_2.default.createElement(components_1.Action, { variant: 'primary', "data-testid": 'sign-out.join-new-identity', classNames: '!bg-error-500 hover:!bg-error-550', disabled: disabled, onClick: onJoinNewIdentity }, t('join new identity label')),
|
|
38
|
-
react_2.default.createElement(components_1.Action, { variant: 'primary', "data-testid": 'sign-out.reset-device', classNames: '!bg-error-500 hover:!bg-error-550', disabled: disabled, onClick: onResetDevice }, t('reset device label')))));
|
|
39
|
-
};
|
|
40
|
-
//# sourceMappingURL=SignOutChooser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SignOutChooser.js","sourceRoot":"","sources":["../../../../../../src/panels/IdentityPanel/steps/SignOutChooser.tsx"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;AAEF,iDAAgD;AAChD,kDAA0B;AAG1B,6CAAyD;AACzD,yDAAmD;AAEnD,oDAAsD;AAU/C,MAAM,cAAc,GAAG,CAAC,KAA0B,EAAE,EAAE;IAC3D,MAAM,EAAE,CAAC,EAAE,GAAG,IAAA,yBAAc,EAAC,IAAI,CAAC,CAAC;IACnC,MAAM,aAAa,GAAG,GAAG,EAAE;;QACzB,IAAI,MAAM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xC,UAAU,EAAC,mCAAmC,EAC9C,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,iBAAiB,IAEzB,CAAC,CAAC,yBAAyB,CAAC,CACtB;YACT,8BAAC,mBAAM,IACL,OAAO,EAAC,SAAS,iBACL,uBAAuB,EACnC,UAAU,EAAC,mCAAmC,EAC9C,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,aAAa,IAErB,CAAC,CAAC,oBAAoB,CAAC,CACjB,CACD,CACT,CACJ,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { type JoinStepProps } from '../JoinPanelProps';
|
|
2
|
-
export type ResetIdentityProps = JoinStepProps & {
|
|
3
|
-
method: 'reset identity';
|
|
4
|
-
};
|
|
5
|
-
export type ResetIdentityImplProps = {
|
|
6
|
-
disabled?: boolean;
|
|
7
|
-
pending?: boolean;
|
|
8
|
-
validationMessage?: string;
|
|
9
|
-
onConfirm?: () => void;
|
|
10
|
-
};
|
|
11
|
-
export declare const ResetIdentity: ({ send, active }: ResetIdentityProps) => JSX.Element;
|
|
12
|
-
export declare const ResetIdentityImpl: ({ disabled, pending, validationMessage, onConfirm }: ResetIdentityImplProps) => JSX.Element;
|
|
13
|
-
//# sourceMappingURL=ResetIdentity.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ResetIdentity.d.ts","sourceRoot":"","sources":["../../../../../../src/panels/JoinPanel/steps/ResetIdentity.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,MAAM,MAAM,kBAAkB,GAAG,aAAa,GAAG;IAC/C,MAAM,EAAE,gBAAgB,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,aAAa,qBAAsB,kBAAkB,gBAwBjE,CAAC;AAEF,eAAO,MAAM,iBAAiB,wDAAyD,sBAAsB,gBA6B5G,CAAC"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
//
|
|
3
|
-
// Copyright 2023 DXOS.org
|
|
4
|
-
//
|
|
5
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
-
}
|
|
11
|
-
Object.defineProperty(o, k2, desc);
|
|
12
|
-
}) : (function(o, m, k, k2) {
|
|
13
|
-
if (k2 === undefined) k2 = k;
|
|
14
|
-
o[k2] = m[k];
|
|
15
|
-
}));
|
|
16
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
-
}) : function(o, v) {
|
|
19
|
-
o["default"] = v;
|
|
20
|
-
});
|
|
21
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
-
if (mod && mod.__esModule) return mod;
|
|
23
|
-
var result = {};
|
|
24
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
-
__setModuleDefault(result, mod);
|
|
26
|
-
return result;
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.ResetIdentityImpl = exports.ResetIdentity = void 0;
|
|
30
|
-
const react_1 = __importStar(require("react"));
|
|
31
|
-
const log_1 = require("@dxos/log");
|
|
32
|
-
const react_client_1 = require("@dxos/react-client");
|
|
33
|
-
const react_ui_1 = require("@dxos/react-ui");
|
|
34
|
-
const components_1 = require("../../../components");
|
|
35
|
-
const ResetIdentity = ({ send, active }) => {
|
|
36
|
-
const client = (0, react_client_1.useClient)();
|
|
37
|
-
const { t } = (0, react_ui_1.useTranslation)('os');
|
|
38
|
-
const [validationMessage, setValidationMessage] = (0, react_1.useState)('');
|
|
39
|
-
const [pending, setPending] = (0, react_1.useState)(false);
|
|
40
|
-
const resetIdentity = () => {
|
|
41
|
-
setPending(true);
|
|
42
|
-
void client.reset().then(() => send === null || send === void 0 ? void 0 : send({ type: 'resetIdentity' }), (error) => {
|
|
43
|
-
log_1.log.catch(error);
|
|
44
|
-
setValidationMessage(t('failed to reset identity message'));
|
|
45
|
-
setPending(false);
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
return (react_1.default.createElement(exports.ResetIdentityImpl, { disabled: !active, pending: pending, validationMessage: validationMessage, onConfirm: () => resetIdentity() }));
|
|
49
|
-
};
|
|
50
|
-
exports.ResetIdentity = ResetIdentity;
|
|
51
|
-
const ResetIdentityImpl = ({ disabled, pending, validationMessage, onConfirm }) => {
|
|
52
|
-
const { t } = (0, react_ui_1.useTranslation)('os');
|
|
53
|
-
const confirmationValue = t('confirmation value');
|
|
54
|
-
const [inputValue, setInputValue] = (0, react_1.useState)('');
|
|
55
|
-
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
56
|
-
react_1.default.createElement("div", { role: 'none', className: 'grow flex flex-col justify-center' },
|
|
57
|
-
react_1.default.createElement(components_1.Input, { validationMessage, label: react_1.default.createElement(components_1.StepHeading, null, t('reset identity input label', { confirmationValue })), disabled: disabled, "data-testid": 'reset-identity-input', placeholder: confirmationValue, onChange: ({ target: { value } }) => setInputValue(value) })),
|
|
58
|
-
react_1.default.createElement(components_1.Actions, null,
|
|
59
|
-
react_1.default.createElement(components_1.Action
|
|
60
|
-
// TODO(wittjosiah): Probably make this red?
|
|
61
|
-
, {
|
|
62
|
-
// TODO(wittjosiah): Probably make this red?
|
|
63
|
-
variant: 'primary', disabled: disabled || pending || inputValue !== confirmationValue, onClick: () => onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm(), "data-testid": 'reset-identity-input-confirm' }, pending ? t('reset in progress label') : t('confirm label')))));
|
|
64
|
-
};
|
|
65
|
-
exports.ResetIdentityImpl = ResetIdentityImpl;
|
|
66
|
-
//# sourceMappingURL=ResetIdentity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ResetIdentity.js","sourceRoot":"","sources":["../../../../../../src/panels/JoinPanel/steps/ResetIdentity.tsx"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;AAEF,+CAAwC;AAExC,mCAAgC;AAChC,qDAA+C;AAC/C,6CAAgD;AAEhD,oDAA0E;AAcnE,MAAM,aAAa,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,EAAsB,EAAE,EAAE;IACpE,MAAM,MAAM,GAAG,IAAA,wBAAS,GAAE,CAAC;IAC3B,MAAM,EAAE,CAAC,EAAE,GAAG,IAAA,yBAAc,EAAC,IAAI,CAAC,CAAC;IACnC,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAG,IAAA,gBAAQ,EAAC,EAAE,CAAC,CAAC;IAC/D,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,aAAa,GAAG,GAAG,EAAE;QACzB,UAAU,CAAC,IAAI,CAAC,CAAC;QACjB,KAAK,MAAM,CAAC,KAAK,EAAE,CAAC,IAAI,CACtB,GAAG,EAAE,CAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAG,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,EACvC,CAAC,KAAK,EAAE,EAAE;YACR,SAAG,CAAC,KAAK,CAA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,OAAO,IAAI,UAAU,KAAK,iBAAiB,EACjE,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,aAAT,SAAS,uBAAT,SAAS,EAAI,iBAChB,8BAA8B,IAEzC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CACrD,CACD,CACT,CACJ,CAAC;AACJ,CAAC,CAAC;AA7BW,QAAA,iBAAiB,qBA6B5B"}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Warning } from '@phosphor-icons/react';
|
|
6
|
-
import React from 'react';
|
|
7
|
-
import { type Event, type SingleOrArray } from 'xstate';
|
|
8
|
-
|
|
9
|
-
import { Message, useTranslation } from '@dxos/react-ui';
|
|
10
|
-
import { getSize, mx } from '@dxos/react-ui-theme';
|
|
11
|
-
|
|
12
|
-
import { Action, Actions } from '../../../components';
|
|
13
|
-
import { type IdentityPanelStepProps } from '../IdentityPanelProps';
|
|
14
|
-
import { type IdentityEvent } from '../identityMachine';
|
|
15
|
-
|
|
16
|
-
export interface SignOutChooserProps extends Omit<IdentityPanelStepProps, 'send'> {
|
|
17
|
-
send?: (event: SingleOrArray<Event<IdentityEvent>>) => void;
|
|
18
|
-
onResetDevice?: () => Promise<void>;
|
|
19
|
-
onJoinNewIdentity?: () => void;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export const SignOutChooser = (props: SignOutChooserProps) => {
|
|
23
|
-
const { t } = useTranslation('os');
|
|
24
|
-
const onResetDevice = () => {
|
|
25
|
-
if (window.confirm(t('reset device confirm message'))) {
|
|
26
|
-
void props.onResetDevice?.();
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
return (
|
|
30
|
-
<SignOutChooserImpl
|
|
31
|
-
disabled={!props.active}
|
|
32
|
-
onBack={() => props.send?.({ type: 'unchooseAction' })}
|
|
33
|
-
onResetDevice={onResetDevice}
|
|
34
|
-
onJoinNewIdentity={props.onJoinNewIdentity}
|
|
35
|
-
/>
|
|
36
|
-
);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export type SignOutChooserImplProps = {
|
|
40
|
-
disabled?: boolean;
|
|
41
|
-
onResetDevice?: () => void;
|
|
42
|
-
onJoinNewIdentity?: () => void;
|
|
43
|
-
onBack?: () => void;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const SignOutChooserImpl = ({ disabled, onResetDevice, onJoinNewIdentity, onBack }: SignOutChooserImplProps) => {
|
|
47
|
-
const { t } = useTranslation('os');
|
|
48
|
-
return (
|
|
49
|
-
<>
|
|
50
|
-
<div role='none' className='grow flex flex-col justify-center'>
|
|
51
|
-
<Message.Root valence='error'>
|
|
52
|
-
<Message.Title>
|
|
53
|
-
<Warning className={mx(getSize(6), 'inline mie-2')} />
|
|
54
|
-
{t('sign out chooser title')}
|
|
55
|
-
</Message.Title>
|
|
56
|
-
<Message.Body>{t('sign out chooser message')}</Message.Body>
|
|
57
|
-
</Message.Root>
|
|
58
|
-
</div>
|
|
59
|
-
<Actions>
|
|
60
|
-
<Action disabled={disabled} onClick={onBack}>
|
|
61
|
-
{t('back label')}
|
|
62
|
-
</Action>
|
|
63
|
-
<Action
|
|
64
|
-
variant='primary'
|
|
65
|
-
data-testid='sign-out.join-new-identity'
|
|
66
|
-
classNames='!bg-error-500 hover:!bg-error-550'
|
|
67
|
-
disabled={disabled}
|
|
68
|
-
onClick={onJoinNewIdentity}
|
|
69
|
-
>
|
|
70
|
-
{t('join new identity label')}
|
|
71
|
-
</Action>
|
|
72
|
-
<Action
|
|
73
|
-
variant='primary'
|
|
74
|
-
data-testid='sign-out.reset-device'
|
|
75
|
-
classNames='!bg-error-500 hover:!bg-error-550'
|
|
76
|
-
disabled={disabled}
|
|
77
|
-
onClick={onResetDevice}
|
|
78
|
-
>
|
|
79
|
-
{t('reset device label')}
|
|
80
|
-
</Action>
|
|
81
|
-
</Actions>
|
|
82
|
-
</>
|
|
83
|
-
);
|
|
84
|
-
};
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { useState } from 'react';
|
|
6
|
-
|
|
7
|
-
import { log } from '@dxos/log';
|
|
8
|
-
import { useClient } from '@dxos/react-client';
|
|
9
|
-
import { useTranslation } from '@dxos/react-ui';
|
|
10
|
-
|
|
11
|
-
import { Action, Actions, StepHeading, Input } from '../../../components';
|
|
12
|
-
import { type JoinStepProps } from '../JoinPanelProps';
|
|
13
|
-
|
|
14
|
-
export type ResetIdentityProps = JoinStepProps & {
|
|
15
|
-
method: 'reset identity';
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export type ResetIdentityImplProps = {
|
|
19
|
-
disabled?: boolean;
|
|
20
|
-
pending?: boolean;
|
|
21
|
-
validationMessage?: string;
|
|
22
|
-
onConfirm?: () => void;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const ResetIdentity = ({ send, active }: ResetIdentityProps) => {
|
|
26
|
-
const client = useClient();
|
|
27
|
-
const { t } = useTranslation('os');
|
|
28
|
-
const [validationMessage, setValidationMessage] = useState('');
|
|
29
|
-
const [pending, setPending] = useState(false);
|
|
30
|
-
const resetIdentity = () => {
|
|
31
|
-
setPending(true);
|
|
32
|
-
void client.reset().then(
|
|
33
|
-
() => send?.({ type: 'resetIdentity' }),
|
|
34
|
-
(error) => {
|
|
35
|
-
log.catch(error);
|
|
36
|
-
setValidationMessage(t('failed to reset identity message'));
|
|
37
|
-
setPending(false);
|
|
38
|
-
},
|
|
39
|
-
);
|
|
40
|
-
};
|
|
41
|
-
return (
|
|
42
|
-
<ResetIdentityImpl
|
|
43
|
-
disabled={!active}
|
|
44
|
-
pending={pending}
|
|
45
|
-
validationMessage={validationMessage}
|
|
46
|
-
onConfirm={() => resetIdentity()}
|
|
47
|
-
/>
|
|
48
|
-
);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export const ResetIdentityImpl = ({ disabled, pending, validationMessage, onConfirm }: ResetIdentityImplProps) => {
|
|
52
|
-
const { t } = useTranslation('os');
|
|
53
|
-
const confirmationValue = t('confirmation value');
|
|
54
|
-
const [inputValue, setInputValue] = useState('');
|
|
55
|
-
return (
|
|
56
|
-
<>
|
|
57
|
-
<div role='none' className='grow flex flex-col justify-center'>
|
|
58
|
-
<Input
|
|
59
|
-
{...{ validationMessage }}
|
|
60
|
-
label={<StepHeading>{t('reset identity input label', { confirmationValue })}</StepHeading>}
|
|
61
|
-
disabled={disabled}
|
|
62
|
-
data-testid='reset-identity-input'
|
|
63
|
-
placeholder={confirmationValue}
|
|
64
|
-
onChange={({ target: { value } }) => setInputValue(value)}
|
|
65
|
-
/>
|
|
66
|
-
</div>
|
|
67
|
-
<Actions>
|
|
68
|
-
<Action
|
|
69
|
-
// TODO(wittjosiah): Probably make this red?
|
|
70
|
-
variant='primary'
|
|
71
|
-
disabled={disabled || pending || inputValue !== confirmationValue}
|
|
72
|
-
onClick={() => onConfirm?.()}
|
|
73
|
-
data-testid='reset-identity-input-confirm'
|
|
74
|
-
>
|
|
75
|
-
{pending ? t('reset in progress label') : t('confirm label')}
|
|
76
|
-
</Action>
|
|
77
|
-
</Actions>
|
|
78
|
-
</>
|
|
79
|
-
);
|
|
80
|
-
};
|