@buffcore/app-shell 0.0.0-stage → 0.8.39
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/LICENSE +202 -0
- package/NOTICE +4 -0
- package/README.md +8 -2
- package/dist/Settings.d.ts +42 -0
- package/dist/Settings.js +93 -0
- package/dist/SignIn.d.ts +14 -0
- package/dist/SignIn.js +126 -0
- package/dist/SignInView.d.ts +38 -0
- package/dist/SignInView.js +21 -0
- package/dist/account/AsksList.d.ts +29 -0
- package/dist/account/AsksList.js +39 -0
- package/dist/account/ClientConsentScreen.d.ts +17 -0
- package/dist/account/ClientConsentScreen.js +49 -0
- package/dist/account/ClientConsentView.d.ts +30 -0
- package/dist/account/ClientConsentView.js +37 -0
- package/dist/account/ClientsScreen.d.ts +9 -0
- package/dist/account/ClientsScreen.js +43 -0
- package/dist/account/ClientsView.d.ts +31 -0
- package/dist/account/ClientsView.js +37 -0
- package/dist/account/ConsentScreen.d.ts +22 -0
- package/dist/account/ConsentScreen.js +69 -0
- package/dist/account/ConsentView.d.ts +32 -0
- package/dist/account/ConsentView.js +25 -0
- package/dist/account/ConsentsScreen.d.ts +5 -0
- package/dist/account/ConsentsScreen.js +62 -0
- package/dist/account/ConsentsView.d.ts +28 -0
- package/dist/account/ConsentsView.js +33 -0
- package/dist/account/DevicesScreen.d.ts +9 -0
- package/dist/account/DevicesScreen.js +45 -0
- package/dist/account/DevicesView.d.ts +31 -0
- package/dist/account/DevicesView.js +35 -0
- package/dist/account/KeysScreen.d.ts +8 -0
- package/dist/account/KeysScreen.js +88 -0
- package/dist/account/KeysView.d.ts +54 -0
- package/dist/account/KeysView.js +63 -0
- package/dist/account/NotificationSettingsScreen.d.ts +11 -0
- package/dist/account/NotificationSettingsScreen.js +61 -0
- package/dist/account/NotificationSettingsView.d.ts +44 -0
- package/dist/account/NotificationSettingsView.js +30 -0
- package/dist/account/NotificationsScreen.d.ts +21 -0
- package/dist/account/NotificationsScreen.js +75 -0
- package/dist/account/NotificationsView.d.ts +22 -0
- package/dist/account/NotificationsView.js +15 -0
- package/dist/account/PrivacyScreen.d.ts +11 -0
- package/dist/account/PrivacyScreen.js +110 -0
- package/dist/account/PrivacyView.d.ts +40 -0
- package/dist/account/PrivacyView.js +41 -0
- package/dist/account/download.d.ts +13 -0
- package/dist/account/download.js +37 -0
- package/dist/account/index.d.ts +26 -0
- package/dist/account/index.js +25 -0
- package/dist/account/part-rights.d.ts +10 -0
- package/dist/account/part-rights.js +39 -0
- package/dist/account/parts.d.ts +37 -0
- package/dist/account/parts.js +37 -0
- package/dist/account/scope.d.ts +21 -0
- package/dist/account/scope.js +76 -0
- package/dist/account/wiring.d.ts +5 -0
- package/dist/account/wiring.js +15 -0
- package/dist/catalog.d.ts +2 -0
- package/dist/catalog.js +37 -0
- package/dist/context.d.ts +123 -0
- package/dist/context.js +31 -0
- package/dist/devices/EnterCodeView.d.ts +20 -0
- package/dist/devices/EnterCodeView.js +15 -0
- package/dist/devices/GateChoicesView.d.ts +19 -0
- package/dist/devices/GateChoicesView.js +12 -0
- package/dist/devices/Modes.d.ts +20 -0
- package/dist/devices/Modes.js +36 -0
- package/dist/devices/PickerView.d.ts +30 -0
- package/dist/devices/PickerView.js +22 -0
- package/dist/devices/PinFlow.d.ts +18 -0
- package/dist/devices/PinFlow.js +90 -0
- package/dist/devices/ProfileMode.d.ts +15 -0
- package/dist/devices/ProfileMode.js +153 -0
- package/dist/devices/SetPinView.d.ts +25 -0
- package/dist/devices/SetPinView.js +20 -0
- package/dist/devices/SetUpDevice.d.ts +12 -0
- package/dist/devices/SetUpDevice.js +86 -0
- package/dist/devices/ShowCodeView.d.ts +15 -0
- package/dist/devices/ShowCodeView.js +14 -0
- package/dist/devices/ThisDeviceView.d.ts +23 -0
- package/dist/devices/ThisDeviceView.js +25 -0
- package/dist/devices/Unset.d.ts +12 -0
- package/dist/devices/Unset.js +79 -0
- package/dist/devices/WelcomeView.d.ts +8 -0
- package/dist/devices/WelcomeView.js +9 -0
- package/dist/devices/index.d.ts +12 -0
- package/dist/devices/index.js +12 -0
- package/dist/devices/mode.d.ts +121 -0
- package/dist/devices/mode.js +168 -0
- package/dist/devices/pin.d.ts +9 -0
- package/dist/devices/pin.js +13 -0
- package/dist/devices/testing.d.ts +78 -0
- package/dist/devices/testing.js +212 -0
- package/dist/errors.d.ts +9 -0
- package/dist/errors.js +23 -0
- package/dist/extensions.d.ts +15 -0
- package/dist/extensions.js +16 -0
- package/dist/fonts.d.ts +13 -0
- package/dist/fonts.js +32 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +25 -0
- package/dist/intl-ready.d.ts +2 -0
- package/dist/intl-ready.js +21 -0
- package/dist/live.d.ts +20 -0
- package/dist/live.js +54 -0
- package/dist/locales/account.en.d.ts +93 -0
- package/dist/locales/account.en.js +93 -0
- package/dist/locales/account.es.json +94 -0
- package/dist/locales/devices.en.d.ts +68 -0
- package/dist/locales/devices.en.js +67 -0
- package/dist/locales/devices.es.json +69 -0
- package/dist/locales/door.en.d.ts +78 -0
- package/dist/locales/door.en.js +77 -0
- package/dist/locales/door.es.json +74 -0
- package/dist/locales/es.json +36 -0
- package/dist/locales/notices.en.d.ts +23 -0
- package/dist/locales/notices.en.js +22 -0
- package/dist/locales/notices.es.json +17 -0
- package/dist/locales/password.en.d.ts +27 -0
- package/dist/locales/password.en.js +26 -0
- package/dist/locales/password.es.json +22 -0
- package/dist/locales/prototype.en.d.ts +23 -0
- package/dist/locales/prototype.en.js +22 -0
- package/dist/locales/prototype.es.json +18 -0
- package/dist/locales/reports.en.d.ts +23 -0
- package/dist/locales/reports.en.js +22 -0
- package/dist/locales/reports.es.json +17 -0
- package/dist/locales/showcase.en.d.ts +153 -0
- package/dist/locales/showcase.en.js +152 -0
- package/dist/locales/showcase.es.json +148 -0
- package/dist/locales/signup.en.d.ts +41 -0
- package/dist/locales/signup.en.js +40 -0
- package/dist/locales/signup.es.json +35 -0
- package/dist/look.d.ts +13 -0
- package/dist/look.js +77 -0
- package/dist/messages.d.ts +5 -0
- package/dist/messages.js +21 -0
- package/dist/notices/MaintenanceView.d.ts +9 -0
- package/dist/notices/MaintenanceView.js +15 -0
- package/dist/notices/PausedView.d.ts +8 -0
- package/dist/notices/PausedView.js +9 -0
- package/dist/notices/StaffView.d.ts +15 -0
- package/dist/notices/StaffView.js +13 -0
- package/dist/notices/maintenance.d.ts +27 -0
- package/dist/notices/maintenance.js +77 -0
- package/dist/password/ForgotPassword.d.ts +10 -0
- package/dist/password/ForgotPassword.js +71 -0
- package/dist/password/ForgotPasswordView.d.ts +34 -0
- package/dist/password/ForgotPasswordView.js +33 -0
- package/dist/password/use-leak.d.ts +12 -0
- package/dist/password/use-leak.js +35 -0
- package/dist/preview.d.ts +12 -0
- package/dist/preview.js +31 -0
- package/dist/prototype/home-app.d.ts +4 -0
- package/dist/prototype/home-app.js +104 -0
- package/dist/prototype/home-bridge.d.ts +33 -0
- package/dist/prototype/home-bridge.js +143 -0
- package/dist/prototype/home-challenge.d.ts +20 -0
- package/dist/prototype/home-challenge.js +77 -0
- package/dist/prototype/home-discovery.d.ts +11 -0
- package/dist/prototype/home-discovery.js +39 -0
- package/dist/prototype/home-heartbeat.d.ts +4 -0
- package/dist/prototype/home-heartbeat.js +37 -0
- package/dist/prototype/home-journey-card.d.ts +10 -0
- package/dist/prototype/home-journey-card.js +41 -0
- package/dist/prototype/home-journey.d.ts +11 -0
- package/dist/prototype/home-journey.js +22 -0
- package/dist/prototype/home-look.d.ts +8 -0
- package/dist/prototype/home-look.js +27 -0
- package/dist/prototype/home-panel.d.ts +26 -0
- package/dist/prototype/home-panel.js +77 -0
- package/dist/prototype/home-player.d.ts +8 -0
- package/dist/prototype/home-player.js +25 -0
- package/dist/prototype/home-route.d.ts +4 -0
- package/dist/prototype/home-route.js +61 -0
- package/dist/prototype/home-styles.d.ts +59 -0
- package/dist/prototype/home-styles.js +44 -0
- package/dist/prototype/home-types.d.ts +88 -0
- package/dist/prototype/home-types.js +0 -0
- package/dist/prototype/home.d.ts +2 -0
- package/dist/prototype/home.js +3 -0
- package/dist/prototype/index.d.ts +27 -0
- package/dist/prototype/index.js +26 -0
- package/dist/prototype/scene.d.ts +28 -0
- package/dist/prototype/scene.js +64 -0
- package/dist/push/index.d.ts +26 -0
- package/dist/push/index.js +52 -0
- package/dist/push/platform.d.ts +6 -0
- package/dist/push/platform.js +15 -0
- package/dist/push/platform.native.d.ts +2 -0
- package/dist/push/platform.native.js +67 -0
- package/dist/push/platform.web.d.ts +12 -0
- package/dist/push/platform.web.js +54 -0
- package/dist/push/store.d.ts +26 -0
- package/dist/push/store.js +67 -0
- package/dist/push/types.d.ts +23 -0
- package/dist/push/types.js +4 -0
- package/dist/reports/ReportProblemSheet.d.ts +21 -0
- package/dist/reports/ReportProblemSheet.js +18 -0
- package/dist/reports/report-problem.d.ts +14 -0
- package/dist/reports/report-problem.js +52 -0
- package/dist/safe-storage.d.ts +11 -0
- package/dist/safe-storage.js +44 -0
- package/dist/shell-gate.d.ts +14 -0
- package/dist/shell-gate.js +81 -0
- package/dist/shell.d.ts +85 -0
- package/dist/shell.js +127 -0
- package/dist/showcase/board.d.ts +18 -0
- package/dist/showcase/board.js +43 -0
- package/dist/showcase/controls.d.ts +6 -0
- package/dist/showcase/controls.js +73 -0
- package/dist/showcase/devices.d.ts +5 -0
- package/dist/showcase/devices.js +77 -0
- package/dist/showcase/fields.d.ts +6 -0
- package/dist/showcase/fields.js +56 -0
- package/dist/showcase/frame-options.d.ts +1 -0
- package/dist/showcase/frame-options.js +31 -0
- package/dist/showcase/frames.d.ts +2 -0
- package/dist/showcase/frames.js +14 -0
- package/dist/showcase/index.d.ts +13 -0
- package/dist/showcase/index.js +13 -0
- package/dist/showcase/text-options.d.ts +3 -0
- package/dist/showcase/text-options.js +17 -0
- package/dist/signup/ProviderButtons.d.ts +16 -0
- package/dist/signup/ProviderButtons.js +17 -0
- package/dist/signup/SignUp.d.ts +10 -0
- package/dist/signup/SignUp.js +100 -0
- package/dist/signup/SignUpView.d.ts +65 -0
- package/dist/signup/SignUpView.js +59 -0
- package/dist/signup/bot-check.d.ts +18 -0
- package/dist/signup/bot-check.js +7 -0
- package/dist/signup/bot-check.native.d.ts +3 -0
- package/dist/signup/bot-check.native.js +52 -0
- package/dist/signup/bot-check.web.d.ts +3 -0
- package/dist/signup/bot-check.web.js +86 -0
- package/dist/signup/browser.d.ts +14 -0
- package/dist/signup/browser.js +16 -0
- package/dist/signup/browser.native.d.ts +8 -0
- package/dist/signup/browser.native.js +12 -0
- package/dist/signup/browser.web.d.ts +7 -0
- package/dist/signup/browser.web.js +19 -0
- package/dist/signup/pkce.d.ts +9 -0
- package/dist/signup/pkce.js +15 -0
- package/dist/signup/use-providers.d.ts +18 -0
- package/dist/signup/use-providers.js +49 -0
- package/dist/states.d.ts +15 -0
- package/dist/states.js +34 -0
- package/dist/storage.d.ts +34 -0
- package/dist/storage.js +115 -0
- package/dist/strings.en.d.ts +38 -0
- package/dist/strings.en.js +37 -0
- package/dist/theme-mode.d.ts +4 -0
- package/dist/theme-mode.js +11 -0
- package/dist/themes.d.ts +39 -0
- package/dist/themes.js +74 -0
- package/dist/web-styles.d.ts +2 -0
- package/dist/web-styles.js +107 -0
- package/package.json +124 -3
- package/web/firebase-messaging-sw.js +17 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/NOTICE
ADDED
package/README.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @buffcore/app-shell
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Expo app shell for a BuffCore product: sign-in, settings, themes, live sessions and push.
|
|
4
|
+
|
|
5
|
+
Part of [BuffApe](https://github.com/buffape/buffape), the open-source way to build a product with AI agents. Start one with `npm create @buffcore@latest my-app`.
|
|
6
|
+
|
|
7
|
+
## License
|
|
8
|
+
|
|
9
|
+
Apache-2.0. Copyright © 2026 BuffApe. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type Option } from '@buffcore/ui';
|
|
2
|
+
import type { Mode } from './themes.ts';
|
|
3
|
+
export interface SettingsViewProps {
|
|
4
|
+
languages: readonly Option[];
|
|
5
|
+
locale: string;
|
|
6
|
+
onLocale: (locale: string) => void;
|
|
7
|
+
mode: Mode;
|
|
8
|
+
onMode: (mode: Mode) => void;
|
|
9
|
+
/** The modes to offer besides `system`; a product's extra modes are labeled `shell.settings.mode.<mode>` in its catalog. */
|
|
10
|
+
modes?: readonly string[];
|
|
11
|
+
/** Development only: switch between the product's theme and the starter themes. */
|
|
12
|
+
themes?: readonly Option[];
|
|
13
|
+
theme?: string;
|
|
14
|
+
onTheme?: (key: string) => void;
|
|
15
|
+
/** Who is signed in, on the "Signed in as" line: the member's email, or in profile mode the profile's name. */
|
|
16
|
+
email: string;
|
|
17
|
+
onSignOut: () => void;
|
|
18
|
+
signingOut?: boolean;
|
|
19
|
+
onBack?: () => void;
|
|
20
|
+
/** "Report a problem": opens the report sheet (ReportProblemSheet). */
|
|
21
|
+
onReport?: () => void;
|
|
22
|
+
/** With the user door: "AI clients and keys", the way to the member's own (ClientsView). */
|
|
23
|
+
onAiClients?: () => void;
|
|
24
|
+
error?: string;
|
|
25
|
+
notice?: string;
|
|
26
|
+
}
|
|
27
|
+
/** Settings, as a view: language, display mode, (development) theme, and sign-out. */
|
|
28
|
+
export declare function SettingsView({ languages, locale, onLocale, mode, modes, onMode, themes, theme, onTheme, email, onSignOut, signingOut, onBack, onReport, onAiClients, error, notice, }: SettingsViewProps): import("react").JSX.Element;
|
|
29
|
+
/**
|
|
30
|
+
* Settings, wired: the language is saved on the person (except pseudo-locales); the mode on the
|
|
31
|
+
* device; "Report a problem" opens its sheet. A product with `push` on passes
|
|
32
|
+
* `signOut={usePush().signOut}`, so signing out removes this phone's token first. In profile mode
|
|
33
|
+
* it is the profile's own: its name on the "Signed in as" line, the language for this device only
|
|
34
|
+
* (a profile can't save the member's), and signing out goes back to the picker. A product with
|
|
35
|
+
* `user-door` on passes `onAiClients`, the row to the member's AI clients and keys (never a
|
|
36
|
+
* profile's).
|
|
37
|
+
*/
|
|
38
|
+
export declare function SettingsScreen({ onBack, signOut, onAiClients, }: {
|
|
39
|
+
onBack?: () => void;
|
|
40
|
+
signOut?: () => Promise<void>;
|
|
41
|
+
onAiClients?: () => void;
|
|
42
|
+
}): import("react").JSX.Element;
|
package/dist/Settings.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { updateMe } from '@buffcore/contracts/identity';
|
|
3
|
+
import { isRtl, PSEUDO_LOCALES } from '@buffcore/i18n';
|
|
4
|
+
import { useLocale, useT } from '@buffcore/i18n/react';
|
|
5
|
+
import { AppFrame, Banner, Button, IconButton, OptionList, Page, SettingRow, Text, TopBar, useTextDir, } from '@buffcore/ui';
|
|
6
|
+
import { useContext, useState } from 'react';
|
|
7
|
+
import { View } from 'react-native';
|
|
8
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
9
|
+
import { MeContext, useDisplay, useProfile, useShell } from './context.js';
|
|
10
|
+
import { errorText } from './messages.js';
|
|
11
|
+
import { useReportProblem } from './reports/report-problem.js';
|
|
12
|
+
const BASE_MODES = ['light', 'dark', 'contrast'];
|
|
13
|
+
function Section({ title, children }) {
|
|
14
|
+
const textDir = useTextDir();
|
|
15
|
+
return (_jsxs(View, { style: styles.section, children: [_jsx(Text, { variant: "heading-3", ...textDir, children: title }), children] }));
|
|
16
|
+
}
|
|
17
|
+
/** Settings, as a view: language, display mode, (development) theme, and sign-out. */
|
|
18
|
+
export function SettingsView({ languages, locale, onLocale, mode, modes = BASE_MODES, onMode, themes, theme, onTheme, email, onSignOut, signingOut = false, onBack, onReport, onAiClients, error, notice, }) {
|
|
19
|
+
const t = useT();
|
|
20
|
+
return (_jsx(AppFrame, { topBar: _jsx(TopBar, { width: "narrow", title: t('shell.settings.title'), leading: onBack ? (_jsx(IconButton, { icon: "arrow-left", label: t('shell.back'), onPress: onBack })) : null }), children: _jsxs(Page, { width: "narrow", children: [error ? _jsx(Banner, { tone: "error", children: error }) : null, notice ? _jsx(Banner, { tone: "info", children: notice }) : null, _jsx(Section, { title: t('shell.settings.language'), children: _jsx(OptionList, { label: t('shell.settings.language'), options: languages, selected: locale, onSelect: onLocale }) }), _jsx(Section, { title: t('shell.settings.display'), children: _jsx(OptionList, { label: t('shell.settings.display'), options: ['system', ...modes].map((id) => ({
|
|
21
|
+
id,
|
|
22
|
+
label: t(`shell.settings.mode.${id}`),
|
|
23
|
+
})), selected: mode, onSelect: (id) => onMode(id) }) }), themes && onTheme ? (_jsx(Section, { title: t('shell.settings.theme'), children: _jsx(OptionList, { label: t('shell.settings.theme'), options: themes, selected: theme, onSelect: onTheme }) })) : null, _jsxs(Section, { title: t('shell.settings.account'), children: [_jsx(SettingRow, { first: true, label: t('shell.settings.signedInAs', { email }), children: _jsx(Button, { variant: "danger", size: "sm", icon: "log-out", loading: signingOut, onPress: onSignOut, children: t('shell.settings.signOut') }) }), onAiClients ? (_jsx(SettingRow, { icon: "sparkles", label: t('shell.settings.aiClients'), help: t('shell.settings.aiClientsHelp'), onPress: onAiClients })) : null, onReport ? (_jsx(SettingRow, { icon: "message-square-text", label: t('shell.reports.open'), help: t('shell.reports.openSub'), onPress: onReport })) : null] })] }) }));
|
|
24
|
+
}
|
|
25
|
+
/** A language's own name ("español"), or its name in another language ("Spanish"). */
|
|
26
|
+
function languageName(code, inLocale) {
|
|
27
|
+
try {
|
|
28
|
+
const name = new Intl.DisplayNames([inLocale], { type: 'language' }).of(code) ?? code;
|
|
29
|
+
return name.charAt(0).toLocaleUpperCase(inLocale) + name.slice(1);
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return code;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Settings, wired: the language is saved on the person (except pseudo-locales); the mode on the
|
|
37
|
+
* device; "Report a problem" opens its sheet. A product with `push` on passes
|
|
38
|
+
* `signOut={usePush().signOut}`, so signing out removes this phone's token first. In profile mode
|
|
39
|
+
* it is the profile's own: its name on the "Signed in as" line, the language for this device only
|
|
40
|
+
* (a profile can't save the member's), and signing out goes back to the picker. A product with
|
|
41
|
+
* `user-door` on passes `onAiClients`, the row to the member's AI clients and keys (never a
|
|
42
|
+
* profile's).
|
|
43
|
+
*/
|
|
44
|
+
export function SettingsScreen({ onBack, signOut, onAiClients, }) {
|
|
45
|
+
const t = useT();
|
|
46
|
+
const { locale, setLocale } = useLocale();
|
|
47
|
+
const shell = useShell();
|
|
48
|
+
const display = useDisplay();
|
|
49
|
+
// Not useMe(): in profile mode nobody is signed in, and the profile picked is who this is.
|
|
50
|
+
const me = useContext(MeContext);
|
|
51
|
+
const profile = useProfile();
|
|
52
|
+
const [error, setError] = useState();
|
|
53
|
+
const [notice, setNotice] = useState();
|
|
54
|
+
const [signingOut, setSigningOut] = useState(false);
|
|
55
|
+
const report = useReportProblem();
|
|
56
|
+
const languages = shell.locales.map((code) => {
|
|
57
|
+
const own = languageName(code, code);
|
|
58
|
+
const here = languageName(code, locale);
|
|
59
|
+
return { id: code, label: own, lang: code, ...(here !== own ? { sub: here } : {}) };
|
|
60
|
+
});
|
|
61
|
+
const changeLanguage = async (next) => {
|
|
62
|
+
setError(undefined);
|
|
63
|
+
setNotice(undefined);
|
|
64
|
+
const turned = isRtl(next) !== isRtl(locale);
|
|
65
|
+
await setLocale(next);
|
|
66
|
+
// Native apps lay out right to left only after a restart (React Native's I18nManager).
|
|
67
|
+
if (turned && shell.platform !== 'web')
|
|
68
|
+
setNotice(t('shell.settings.restart'));
|
|
69
|
+
// Pseudo-locales are for development; a preview only reads, so its language stays here.
|
|
70
|
+
// A profile can't change the member's own (`PATCH /v1/me`).
|
|
71
|
+
if (shell.preview || profile || PSEUDO_LOCALES.includes(next))
|
|
72
|
+
return;
|
|
73
|
+
try {
|
|
74
|
+
await shell.api.call(updateMe, { body: { locale: next } });
|
|
75
|
+
}
|
|
76
|
+
catch (e) {
|
|
77
|
+
setError(errorText(e, t));
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
return (_jsx(SettingsView, { languages: languages, locale: locale, onLocale: (next) => void changeLanguage(next), mode: display.mode, onMode: display.setMode, modes: display.modes, ...(shell.dev && display.themes.length > 1
|
|
81
|
+
? {
|
|
82
|
+
themes: display.themes.map((x) => ({ id: x.key, label: x.label })),
|
|
83
|
+
theme: display.theme,
|
|
84
|
+
onTheme: display.setTheme,
|
|
85
|
+
}
|
|
86
|
+
: {}), email: profile?.displayName ?? me?.user.email ?? '', signingOut: signingOut, onSignOut: () => {
|
|
87
|
+
setSigningOut(true);
|
|
88
|
+
void (signOut ?? shell.signOut)();
|
|
89
|
+
}, onBack: onBack, ...(shell.preview ? {} : { onReport: () => report() }), ...(onAiClients && !profile && !shell.preview ? { onAiClients } : {}), error: error, notice: notice }));
|
|
90
|
+
}
|
|
91
|
+
const styles = StyleSheet.create((theme) => ({
|
|
92
|
+
section: { gap: theme.space['space-3'] },
|
|
93
|
+
}));
|
package/dist/SignIn.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sign-in with email and password. An unconfirmed email gets a code first; after the code,
|
|
3
|
+
* sign-in runs again with the same password. Products that offer `email-code` also let the
|
|
4
|
+
* person sign in with an emailed code instead, and anyone reset a forgotten password. `onBack`
|
|
5
|
+
* leaves sign-in from its first step; `onSignedIn` runs once someone is signed in (e.g. a fresh
|
|
6
|
+
* sign-in before changing a PIN). `withSignUp`: the way in, which also offers sign-up, and Apple
|
|
7
|
+
* and Google while the Owner has them on. Too many wrong passwords pause password sign-in for a
|
|
8
|
+
* while; a reset works at once.
|
|
9
|
+
*/
|
|
10
|
+
export declare function SignIn({ onBack, onSignedIn, withSignUp, }: {
|
|
11
|
+
onBack?: () => void;
|
|
12
|
+
onSignedIn?: () => void;
|
|
13
|
+
withSignUp?: boolean;
|
|
14
|
+
}): import("react").JSX.Element;
|
package/dist/SignIn.js
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { PASSWORD_LOCK_MINUTES } from '@buffcore/contracts/identity';
|
|
3
|
+
import { useT } from '@buffcore/i18n/react';
|
|
4
|
+
import { ApiCallError } from '@buffcore/sdk';
|
|
5
|
+
import { useState } from 'react';
|
|
6
|
+
import { useShell } from './context.js';
|
|
7
|
+
import { errorText } from './messages.js';
|
|
8
|
+
import { ForgotPassword } from './password/ForgotPassword.js';
|
|
9
|
+
import { SignInView } from './SignInView.js';
|
|
10
|
+
import { SignUp } from './signup/SignUp.js';
|
|
11
|
+
import { useProviders } from './signup/use-providers.js';
|
|
12
|
+
const isCode = (error, code) => error instanceof ApiCallError && error.code === code;
|
|
13
|
+
/**
|
|
14
|
+
* Sign-in with email and password. An unconfirmed email gets a code first; after the code,
|
|
15
|
+
* sign-in runs again with the same password. Products that offer `email-code` also let the
|
|
16
|
+
* person sign in with an emailed code instead, and anyone reset a forgotten password. `onBack`
|
|
17
|
+
* leaves sign-in from its first step; `onSignedIn` runs once someone is signed in (e.g. a fresh
|
|
18
|
+
* sign-in before changing a PIN). `withSignUp`: the way in, which also offers sign-up, and Apple
|
|
19
|
+
* and Google while the Owner has them on. Too many wrong passwords pause password sign-in for a
|
|
20
|
+
* while; a reset works at once.
|
|
21
|
+
*/
|
|
22
|
+
export function SignIn({ onBack, onSignedIn, withSignUp = false, }) {
|
|
23
|
+
const t = useT();
|
|
24
|
+
const { api, tokens, queryClient, signInMethods } = useShell();
|
|
25
|
+
const providers = useProviders();
|
|
26
|
+
const [step, setStep] = useState('password');
|
|
27
|
+
const [email, setEmail] = useState('');
|
|
28
|
+
const [password, setPassword] = useState('');
|
|
29
|
+
const [code, setCode] = useState('');
|
|
30
|
+
const [busy, setBusy] = useState(false);
|
|
31
|
+
const [error, setError] = useState();
|
|
32
|
+
const [notice, setNotice] = useState();
|
|
33
|
+
const [locked, setLocked] = useState();
|
|
34
|
+
const [away, setAway] = useState();
|
|
35
|
+
const run = async (work) => {
|
|
36
|
+
setBusy(true);
|
|
37
|
+
setError(undefined);
|
|
38
|
+
setNotice(undefined);
|
|
39
|
+
try {
|
|
40
|
+
await work();
|
|
41
|
+
}
|
|
42
|
+
catch (e) {
|
|
43
|
+
setError(errorText(e, t));
|
|
44
|
+
}
|
|
45
|
+
finally {
|
|
46
|
+
setBusy(false);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const signedIn = async (token) => {
|
|
50
|
+
if (token)
|
|
51
|
+
await tokens.set(token);
|
|
52
|
+
await queryClient.resetQueries();
|
|
53
|
+
onSignedIn?.();
|
|
54
|
+
};
|
|
55
|
+
const signIn = async () => {
|
|
56
|
+
try {
|
|
57
|
+
const result = await api.auth.signIn(email.trim(), password);
|
|
58
|
+
if (result.twoFactorRedirect) {
|
|
59
|
+
setError(t('shell.signIn.twoFactor'));
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
await signedIn(result.token);
|
|
63
|
+
}
|
|
64
|
+
catch (e) {
|
|
65
|
+
if (isCode(e, 'PASSWORD_LOCKED')) {
|
|
66
|
+
const minutes = Number(e.details?.minutes);
|
|
67
|
+
setLocked({ minutes: minutes > 0 ? minutes : PASSWORD_LOCK_MINUTES });
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (!isCode(e, 'EMAIL_NOT_VERIFIED'))
|
|
71
|
+
throw e;
|
|
72
|
+
await api.auth.sendEmailCode(email.trim());
|
|
73
|
+
setCode('');
|
|
74
|
+
setStep('code');
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const sendCode = () => step === 'sign-in-code'
|
|
78
|
+
? api.auth.sendSignInCode(email.trim())
|
|
79
|
+
: api.auth.sendEmailCode(email.trim());
|
|
80
|
+
const back = () => {
|
|
81
|
+
setAway(undefined);
|
|
82
|
+
setLocked(undefined);
|
|
83
|
+
};
|
|
84
|
+
if (away === 'forgot')
|
|
85
|
+
return _jsx(ForgotPassword, { initialEmail: email.trim(), onSignIn: back });
|
|
86
|
+
if (away === 'sign-up')
|
|
87
|
+
return _jsx(SignUp, { onBack: back });
|
|
88
|
+
const failed = withSignUp && providers.failed ? t('shell.providers.failed') : undefined;
|
|
89
|
+
return (_jsx(SignInView, { step: step, email: email, password: password, code: code, onEmail: (value) => {
|
|
90
|
+
setEmail(value);
|
|
91
|
+
setLocked(undefined);
|
|
92
|
+
}, onPassword: setPassword, onCode: setCode, busy: busy, error: error ?? failed, ...(locked ? { locked } : {}), notice: notice, onSubmit: () => run(async () => {
|
|
93
|
+
if (step === 'sign-in-code') {
|
|
94
|
+
await signedIn((await api.auth.signInWithCode(email.trim(), code.trim())).token);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
if (step === 'code')
|
|
98
|
+
await api.auth.verifyEmail(email.trim(), code.trim());
|
|
99
|
+
await signIn();
|
|
100
|
+
}), onResend: () => run(async () => {
|
|
101
|
+
await sendCode();
|
|
102
|
+
setNotice(t('shell.signIn.codeSent'));
|
|
103
|
+
}), onBack: () => {
|
|
104
|
+
setStep('password');
|
|
105
|
+
setError(undefined);
|
|
106
|
+
setNotice(undefined);
|
|
107
|
+
}, onForgotPassword: () => {
|
|
108
|
+
setError(undefined);
|
|
109
|
+
setNotice(undefined);
|
|
110
|
+
setAway('forgot');
|
|
111
|
+
}, ...(onBack ? { onLeave: onBack } : {}), ...(withSignUp
|
|
112
|
+
? {
|
|
113
|
+
onSignUp: () => setAway('sign-up'),
|
|
114
|
+
providers: providers.providers,
|
|
115
|
+
onProvider: (provider) => void run(() => providers.start(provider)),
|
|
116
|
+
}
|
|
117
|
+
: {}), ...(signInMethods.includes('email-code')
|
|
118
|
+
? {
|
|
119
|
+
onEmailCode: () => run(async () => {
|
|
120
|
+
await api.auth.sendSignInCode(email.trim());
|
|
121
|
+
setCode('');
|
|
122
|
+
setStep('sign-in-code');
|
|
123
|
+
}),
|
|
124
|
+
}
|
|
125
|
+
: {}) }));
|
|
126
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type SignInProvider } from './signup/ProviderButtons.tsx';
|
|
2
|
+
export interface SignInViewProps {
|
|
3
|
+
/**
|
|
4
|
+
* `password`: email and password. `code`: the emailed code that confirms the email.
|
|
5
|
+
* `sign-in-code`: the emailed code that signs in (products that offer `email-code`).
|
|
6
|
+
*/
|
|
7
|
+
step: 'password' | 'code' | 'sign-in-code';
|
|
8
|
+
email: string;
|
|
9
|
+
password: string;
|
|
10
|
+
code: string;
|
|
11
|
+
onEmail: (value: string) => void;
|
|
12
|
+
onPassword: (value: string) => void;
|
|
13
|
+
onCode: (value: string) => void;
|
|
14
|
+
/** Sign in, or confirm the code. */
|
|
15
|
+
onSubmit: () => void;
|
|
16
|
+
onResend: () => void;
|
|
17
|
+
onBack: () => void;
|
|
18
|
+
/** Back from the first step, when sign-in was opened from another screen (a device's welcome). */
|
|
19
|
+
onLeave?: () => void;
|
|
20
|
+
/** Present when the product offers signing in with an emailed code. */
|
|
21
|
+
onEmailCode?: () => void;
|
|
22
|
+
/** "Forgot your password?": opens the reset (ForgotPasswordView). */
|
|
23
|
+
onForgotPassword?: () => void;
|
|
24
|
+
/** "New here? Create an account": opens sign-up (SignUpView), when the product offers it. */
|
|
25
|
+
onSignUp?: () => void;
|
|
26
|
+
/** Apple and Google, when the Owner turned them on (E2). */
|
|
27
|
+
providers?: readonly SignInProvider[];
|
|
28
|
+
onProvider?: (provider: SignInProvider) => void;
|
|
29
|
+
/** Too many wrong passwords: signing in with one waits this long; a reset works at once. */
|
|
30
|
+
locked?: {
|
|
31
|
+
minutes: number;
|
|
32
|
+
};
|
|
33
|
+
busy?: boolean;
|
|
34
|
+
error?: string;
|
|
35
|
+
notice?: string;
|
|
36
|
+
}
|
|
37
|
+
/** Sign-in, as a view: props in, UI out. */
|
|
38
|
+
export declare function SignInView({ step, email, password, code, onEmail, onPassword, onCode, onSubmit, onResend, onBack, onLeave, onEmailCode, onForgotPassword, onSignUp, providers, onProvider, locked, busy, error, notice, }: SignInViewProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useT } from '@buffcore/i18n/react';
|
|
3
|
+
import { ActionBar, AppFrame, Banner, Button, IconButton, Page, Text, TextField, TopBar, } from '@buffcore/ui';
|
|
4
|
+
import { ProviderButtons } from './signup/ProviderButtons.js';
|
|
5
|
+
/** Sign-in, as a view: props in, UI out. */
|
|
6
|
+
export function SignInView({ step, email, password, code, onEmail, onPassword, onCode, onSubmit, onResend, onBack, onLeave, onEmailCode, onForgotPassword, onSignUp, providers, onProvider, locked, busy = false, error, notice, }) {
|
|
7
|
+
const t = useT();
|
|
8
|
+
const codeStep = step !== 'password';
|
|
9
|
+
const back = codeStep ? onBack : onLeave;
|
|
10
|
+
const ready = codeStep
|
|
11
|
+
? code.trim().length > 0
|
|
12
|
+
: !locked && email.trim().length > 0 && password.length > 0;
|
|
13
|
+
const submit = () => {
|
|
14
|
+
if (ready && !busy)
|
|
15
|
+
onSubmit();
|
|
16
|
+
};
|
|
17
|
+
const secondary = codeStep ? (_jsx(Button, { variant: "ghost", onPress: onResend, disabled: busy, children: t('shell.signIn.resend') })) : onEmailCode ? (_jsx(Button, { variant: "ghost", onPress: onEmailCode, disabled: busy || !email.trim(), children: t('shell.signIn.emailCode') })) : null;
|
|
18
|
+
return (_jsx(AppFrame, { topBar: _jsx(TopBar, { width: "narrow", title: t(codeStep ? 'shell.signIn.codeTitle' : 'shell.signIn.title'), leading: back ? _jsx(IconButton, { icon: "arrow-left", label: t('shell.back'), onPress: back }) : null }), actionBar: _jsx(ActionBar, { secondary: secondary, primary: _jsx(Button, { onPress: submit, loading: busy, disabled: !ready, children: t(step === 'code' ? 'shell.signIn.confirm' : 'shell.signIn.submit') }) }), children: _jsxs(Page, { width: "narrow", align: "center", children: [error ? _jsx(Banner, { tone: "error", children: error }) : null, notice ? _jsx(Banner, { tone: "success", children: notice }) : null, locked && !codeStep ? (_jsx(Banner, { tone: "attention", children: t('shell.signIn.locked', { minutes: locked.minutes }) })) : null, !codeStep && providers && onProvider ? (_jsx(ProviderButtons, { providers: providers, onProvider: onProvider, busy: busy })) : null, codeStep ? (_jsxs(_Fragment, { children: [_jsx(Text, { children: t(step === 'code' ? 'shell.signIn.codeIntro' : 'shell.signIn.signInCodeIntro', {
|
|
19
|
+
email,
|
|
20
|
+
}) }), _jsx(TextField, { label: t('shell.signIn.code'), type: "code", value: code, onChange: onCode, onSubmit: submit, autoFocus: true })] })) : (_jsxs(_Fragment, { children: [_jsx(TextField, { label: t('shell.signIn.email'), type: "email", value: email, onChange: onEmail, autoFocus: true }), _jsx(TextField, { label: t('shell.signIn.password'), type: "password", value: password, onChange: onPassword, onSubmit: submit }), onForgotPassword ? (_jsx(Button, { variant: "ghost", size: "sm", onPress: onForgotPassword, disabled: busy, children: t('shell.password.forgot') })) : null, onSignUp ? (_jsx(Button, { variant: "ghost", size: "sm", onPress: onSignUp, disabled: busy, children: t('shell.signUp.open') })) : null] }))] }) }));
|
|
21
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** A call the member's AI client or key asked first, waiting for them (`GET /v1/me/asks`). */
|
|
2
|
+
export interface AskItem {
|
|
3
|
+
id: string;
|
|
4
|
+
/** Who asks: the AI client's name, or the key's. */
|
|
5
|
+
by: string;
|
|
6
|
+
/** What it wants to do: the action's title, "Delete a note". */
|
|
7
|
+
action: string;
|
|
8
|
+
/** The account it acts in, by name. */
|
|
9
|
+
account: string;
|
|
10
|
+
/** When it asked (ISO). */
|
|
11
|
+
at: string;
|
|
12
|
+
}
|
|
13
|
+
/** Answering one: which, the button in progress, and whether it failed. */
|
|
14
|
+
export interface Answering {
|
|
15
|
+
id: string;
|
|
16
|
+
busy?: 'approve' | 'decline';
|
|
17
|
+
/** The answer did not go through; nothing changed. */
|
|
18
|
+
failed?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface AsksListProps {
|
|
21
|
+
asks: readonly AskItem[];
|
|
22
|
+
onApprove: (id: string) => void;
|
|
23
|
+
onDecline: (id: string) => void;
|
|
24
|
+
answering?: Answering;
|
|
25
|
+
/** The time "2 minutes ago" counts from. */
|
|
26
|
+
now: number;
|
|
27
|
+
}
|
|
28
|
+
/** The asks waiting for the member, above their messages: who asks, what, where, and the answer. */
|
|
29
|
+
export declare function AsksList({ asks, onApprove, onDecline, answering, now }: AsksListProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useLocale, useT } from '@buffcore/i18n/react';
|
|
3
|
+
import { Banner, Button, Icon, Text, useTextDir } from '@buffcore/ui';
|
|
4
|
+
import { View } from 'react-native';
|
|
5
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
6
|
+
import { ago } from './DevicesView.js';
|
|
7
|
+
/** The asks waiting for the member, above their messages: who asks, what, where, and the answer. */
|
|
8
|
+
export function AsksList({ asks, onApprove, onDecline, answering, now }) {
|
|
9
|
+
const t = useT();
|
|
10
|
+
const { locale } = useLocale();
|
|
11
|
+
const textDir = useTextDir();
|
|
12
|
+
if (asks.length === 0)
|
|
13
|
+
return null;
|
|
14
|
+
return (_jsxs(View, { style: styles.list, children: [_jsx(Text, { variant: "label", ...textDir, children: t('shell.account.asks.title') }), asks.map((ask) => {
|
|
15
|
+
const mine = answering?.id === ask.id ? answering : undefined;
|
|
16
|
+
return (_jsxs(View, { style: styles.card, children: [_jsxs(View, { style: styles.head, children: [_jsx(Icon, { name: "shield-check", color: "text-muted" }), _jsx(View, { style: styles.words, children: _jsx(Text, { variant: "title", ...textDir, children: t('shell.account.asks.asks', { by: ask.by }) }) })] }), _jsx(Text, { ...textDir, children: t('shell.account.asks.what', { action: ask.action }) }), _jsx(Text, { variant: "body-sm", color: "text-muted", ...textDir, children: t('shell.account.asks.where', {
|
|
17
|
+
account: ask.account,
|
|
18
|
+
when: ago(locale, ask.at, now),
|
|
19
|
+
}) }), mine?.failed ? _jsx(Banner, { tone: "attention", children: t('shell.account.tryAgain') }) : null, _jsxs(View, { style: styles.row, children: [_jsx(Button, { size: "sm", onPress: () => onApprove(ask.id), loading: mine?.busy === 'approve', disabled: Boolean(mine?.busy), children: t('shell.account.asks.approve') }), _jsx(Button, { size: "sm", variant: "secondary", onPress: () => onDecline(ask.id), loading: mine?.busy === 'decline', disabled: Boolean(mine?.busy), children: t('shell.account.asks.decline') })] })] }, ask.id));
|
|
20
|
+
}), _jsx(Text, { variant: "body-sm", color: "text-muted", ...textDir, children: t('shell.account.asks.help') })] }));
|
|
21
|
+
}
|
|
22
|
+
const styles = StyleSheet.create((theme) => ({
|
|
23
|
+
list: { gap: theme.space['space-3'] },
|
|
24
|
+
card: {
|
|
25
|
+
gap: theme.space['space-2'],
|
|
26
|
+
padding: theme.space['space-4'],
|
|
27
|
+
borderRadius: theme.radius['radius-panel'],
|
|
28
|
+
backgroundColor: theme.color['surface-sunken'],
|
|
29
|
+
borderWidth: theme.border['border-width-hairline'],
|
|
30
|
+
borderColor: theme.color['border-hairline'],
|
|
31
|
+
},
|
|
32
|
+
head: {
|
|
33
|
+
flexDirection: 'row',
|
|
34
|
+
gap: theme.space['space-2'],
|
|
35
|
+
alignItems: 'center',
|
|
36
|
+
},
|
|
37
|
+
words: { flex: 1 },
|
|
38
|
+
row: { flexDirection: 'row', flexWrap: 'wrap', gap: theme.space['space-2'] },
|
|
39
|
+
}));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface ClientConsentScreenProps {
|
|
2
|
+
/**
|
|
3
|
+
* The page's query as the sign-in library sent it (`/oauth/consent?<query>`), signed: it names
|
|
4
|
+
* the client and where it goes back to, and is sent back unchanged with the answer.
|
|
5
|
+
*/
|
|
6
|
+
query: string;
|
|
7
|
+
/** Go where the answer says: back to the client, with a code or a refusal (a full URL). */
|
|
8
|
+
onDone: (url: string) => void;
|
|
9
|
+
/** Leave a page that names no client. */
|
|
10
|
+
onBack: () => void;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The page a members' AI client sends a member to (the user door), wired: the client's name from
|
|
14
|
+
* the sign-in library, the member's accounts (asked only when there are several), and the answer,
|
|
15
|
+
* after which the browser goes back to the client.
|
|
16
|
+
*/
|
|
17
|
+
export declare function ClientConsentScreen({ query, onDone, onBack }: ClientConsentScreenProps): import("react").JSX.Element;
|