@hanwenbo/x-taro-ui 0.0.1 → 0.0.3
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/es/adapters/miniapp/overlayHost.js +14 -8
- package/es/auth/components.d.ts +17 -15
- package/es/auth/components.js +253 -133
- package/es/auth/entries/locales.d.ts +2 -0
- package/es/auth/entries/locales.js +1 -0
- package/es/auth/index.d.ts +1 -0
- package/es/auth/index.js +2 -1
- package/es/auth/internal.d.ts +17 -11
- package/es/auth/internal.js +107 -42
- package/es/auth/phoneNumberInput.d.ts +4 -2
- package/es/auth/phoneNumberInput.js +27 -8
- package/es/auth/provider.d.ts +2 -2
- package/es/auth/styles.css +161 -99
- package/es/auth/theme.js +20 -4
- package/es/components/_shared/render.d.ts +1 -1
- package/es/components/button/button.js +23 -3
- package/es/components/button/types.d.ts +6 -0
- package/es/components/capsuleTabs/capsuleTabs.js +4 -0
- package/es/components/icon/lucide.generated.d.ts +10 -0
- package/es/components/icon/lucide.generated.js +10 -0
- package/es/components/inputItem/inputItem.js +5 -2
- package/es/components/list/list.d.ts +1 -1
- package/es/components/pagination/pagination.js +18 -5
- package/es/components/searchBar/searchBar.js +4 -0
- package/es/components/sectionList/sectionList.d.ts +1 -2
- package/es/components/segmented/segmented.js +10 -2
- package/es/components/touchableOpacity/touchableOpacity.js +1 -0
- package/es/taro-components.d.ts +6 -0
- package/lib/adapters/miniapp/overlayHost.js +13 -6
- package/lib/auth/components.d.ts +17 -15
- package/lib/auth/components.js +257 -125
- package/lib/auth/entries/locales.d.ts +2 -0
- package/lib/auth/entries/locales.js +33 -0
- package/lib/auth/index.d.ts +1 -0
- package/lib/auth/index.js +13 -0
- package/lib/auth/internal.d.ts +17 -11
- package/lib/auth/internal.js +76 -31
- package/lib/auth/phoneNumberInput.d.ts +4 -2
- package/lib/auth/phoneNumberInput.js +65 -45
- package/lib/auth/provider.d.ts +2 -2
- package/lib/auth/styles.css +161 -99
- package/lib/auth/theme.js +7 -4
- package/lib/components/_shared/render.d.ts +1 -1
- package/lib/components/button/button.js +7 -0
- package/lib/components/button/types.d.ts +6 -0
- package/lib/components/capsuleTabs/capsuleTabs.js +1 -0
- package/lib/components/icon/lucide.generated.d.ts +10 -0
- package/lib/components/icon/lucide.generated.js +24 -0
- package/lib/components/inputItem/inputItem.js +3 -0
- package/lib/components/list/list.d.ts +1 -1
- package/lib/components/pagination/pagination.js +19 -5
- package/lib/components/searchBar/searchBar.js +4 -0
- package/lib/components/sectionList/sectionList.d.ts +1 -2
- package/lib/components/segmented/segmented.js +6 -1
- package/lib/components/touchableOpacity/touchableOpacity.js +1 -0
- package/lib/taro-components.d.ts +6 -0
- package/package.json +4 -4
package/es/auth/components.js
CHANGED
|
@@ -19,13 +19,13 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
19
19
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
20
20
|
import { Text, View } from '@tarojs/components';
|
|
21
21
|
import { identifierLabel } from '@hanwenbo/x-auth-core/identifier';
|
|
22
|
-
import { useAccountSecurityController, useChangePasswordController, useForgotPasswordController, useIdentifierBindingController, useQuickSignInController, useSignInController, useSignUpController, useThirdPartySignInController } from '@hanwenbo/x-auth-core/react';
|
|
22
|
+
import { useAuthTranslation, useAccountSecurityController, useChangePasswordController, useForgotPasswordController, useIdentifierBindingController, useQuickSignInController, useSignInController, useSignUpController, useThirdPartySignInController } from '@hanwenbo/x-auth-core/react';
|
|
23
23
|
import { Button } from "../components/button";
|
|
24
24
|
import { Checkbox } from "../components/checkbox";
|
|
25
25
|
import { Icon } from "../components/icon";
|
|
26
26
|
import { InputItem } from "../components/inputItem/index";
|
|
27
27
|
import { Modal } from "../components/modal";
|
|
28
|
-
import { AuthError, AuthField, AuthPanel, AuthSelector, IdentifierInput, VerificationCodeInput, contactOptions } from "./internal";
|
|
28
|
+
import { AuthError, AuthField, AuthPanel, AuthSelector, CredentialSelector, IdentifierInput, VerificationCodeInput, contactOptions } from "./internal";
|
|
29
29
|
import { useAuthTheme } from "./provider";
|
|
30
30
|
import { authThemeTokensToStyle } from "./theme";
|
|
31
31
|
import "./styles.css";
|
|
@@ -56,6 +56,7 @@ export function ThirdPartySignIn(_ref2) {
|
|
|
56
56
|
style = _ref2.style,
|
|
57
57
|
testID = _ref2.testID,
|
|
58
58
|
tokens = _ref2.tokens;
|
|
59
|
+
var t = useAuthTranslation(config);
|
|
59
60
|
var controller = useThirdPartySignInController({
|
|
60
61
|
config: config,
|
|
61
62
|
onAuthError: onAuthError,
|
|
@@ -75,25 +76,57 @@ export function ThirdPartySignIn(_ref2) {
|
|
|
75
76
|
children: controller.error
|
|
76
77
|
}), /*#__PURE__*/_jsxs(View, {
|
|
77
78
|
className: "x-taro-auth-divider",
|
|
78
|
-
children: [/*#__PURE__*/_jsx(View, {
|
|
79
|
-
|
|
80
|
-
}), /*#__PURE__*/_jsx(
|
|
79
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
80
|
+
className: "x-taro-auth-divider__line"
|
|
81
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
82
|
+
children: t('auth.otherSignIn')
|
|
83
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
84
|
+
className: "x-taro-auth-divider__line"
|
|
85
|
+
})]
|
|
81
86
|
}), /*#__PURE__*/_jsx(View, {
|
|
82
87
|
className: "x-taro-auth-third-party__items",
|
|
83
88
|
children: controller.providers.map(function (provider) {
|
|
84
|
-
var _provider$ariaLabel;
|
|
89
|
+
var _provider$ariaLabel, _provider$icon;
|
|
85
90
|
return /*#__PURE__*/_jsx(Button, {
|
|
86
|
-
ariaLabel: (_provider$ariaLabel = provider.ariaLabel) !== null && _provider$ariaLabel !== void 0 ? _provider$ariaLabel :
|
|
87
|
-
|
|
91
|
+
ariaLabel: (_provider$ariaLabel = provider.ariaLabel) !== null && _provider$ariaLabel !== void 0 ? _provider$ariaLabel : t('auth.providerSignIn', {
|
|
92
|
+
provider: String(provider.label)
|
|
93
|
+
}),
|
|
94
|
+
className: "x-taro-auth-third-party__item",
|
|
95
|
+
compact: true,
|
|
88
96
|
disabled: provider.disabled || Boolean(controller.loadingProviderId),
|
|
89
|
-
icon:
|
|
97
|
+
icon: /*#__PURE__*/_jsx(View, {
|
|
98
|
+
className: "x-taro-auth-third-party__icon",
|
|
99
|
+
children: (_provider$icon = provider.icon) !== null && _provider$icon !== void 0 ? _provider$icon : /*#__PURE__*/_jsx(Icon, {
|
|
100
|
+
name: "ShieldCheck",
|
|
101
|
+
size: 28
|
|
102
|
+
})
|
|
103
|
+
}),
|
|
104
|
+
loadingIcon: /*#__PURE__*/_jsx(View, {
|
|
105
|
+
className: "x-taro-auth-third-party__icon",
|
|
106
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
107
|
+
name: "Loader2",
|
|
108
|
+
size: 28,
|
|
109
|
+
spin: true
|
|
110
|
+
})
|
|
111
|
+
}),
|
|
90
112
|
loading: provider.loading || controller.loadingProviderId === provider.id,
|
|
91
113
|
onClick: function onClick() {
|
|
92
114
|
return void controller.signIn(provider);
|
|
93
115
|
},
|
|
94
|
-
size: "
|
|
95
|
-
|
|
96
|
-
|
|
116
|
+
size: "small",
|
|
117
|
+
variant: "ghost",
|
|
118
|
+
gap: "var(--x-space-2)",
|
|
119
|
+
style: {
|
|
120
|
+
flexDirection: 'column',
|
|
121
|
+
flex: '0 0 auto',
|
|
122
|
+
width: 'calc(var(--x-space-8) * 2)',
|
|
123
|
+
padding: 'var(--x-space-1) 0',
|
|
124
|
+
borderWidth: 0
|
|
125
|
+
},
|
|
126
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
127
|
+
className: "x-taro-auth-third-party__label",
|
|
128
|
+
children: provider.label
|
|
129
|
+
})
|
|
97
130
|
}, provider.id);
|
|
98
131
|
})
|
|
99
132
|
})]
|
|
@@ -108,8 +141,8 @@ export function SignIn(_ref3) {
|
|
|
108
141
|
_ref3$contextFields = _ref3.contextFields,
|
|
109
142
|
contextFields = _ref3$contextFields === void 0 ? [] : _ref3$contextFields,
|
|
110
143
|
defaultMethod = _ref3.defaultMethod,
|
|
111
|
-
|
|
112
|
-
|
|
144
|
+
description = _ref3.description,
|
|
145
|
+
headerAlign = _ref3.headerAlign,
|
|
113
146
|
logo = _ref3.logo,
|
|
114
147
|
methods = _ref3.methods,
|
|
115
148
|
onAuthError = _ref3.onAuthError,
|
|
@@ -129,9 +162,9 @@ export function SignIn(_ref3) {
|
|
|
129
162
|
style = _ref3.style,
|
|
130
163
|
surface = _ref3.surface,
|
|
131
164
|
testID = _ref3.testID,
|
|
132
|
-
|
|
133
|
-
title = _ref3$title === void 0 ? '登录' : _ref3$title,
|
|
165
|
+
title = _ref3.title,
|
|
134
166
|
tokens = _ref3.tokens;
|
|
167
|
+
var t = useAuthTranslation(config);
|
|
135
168
|
var controller = useSignInController({
|
|
136
169
|
config: config,
|
|
137
170
|
contextFields: contextFields,
|
|
@@ -143,9 +176,12 @@ export function SignIn(_ref3) {
|
|
|
143
176
|
onSuccess: onSuccess,
|
|
144
177
|
services: services
|
|
145
178
|
});
|
|
179
|
+
if (description === undefined) description = t('auth.signInDescription');
|
|
180
|
+
if (title === undefined) title = t('auth.signIn');
|
|
146
181
|
return /*#__PURE__*/_jsx(AuthPanel, {
|
|
147
182
|
className: className,
|
|
148
183
|
description: description,
|
|
184
|
+
headerAlign: headerAlign,
|
|
149
185
|
logo: logo,
|
|
150
186
|
style: useAuthStyle(tokens, style),
|
|
151
187
|
surface: surface,
|
|
@@ -155,12 +191,12 @@ export function SignIn(_ref3) {
|
|
|
155
191
|
className: "x-taro-auth-form",
|
|
156
192
|
children: [/*#__PURE__*/_jsx(AuthError, {
|
|
157
193
|
children: controller.error
|
|
158
|
-
}), /*#__PURE__*/_jsx(
|
|
194
|
+
}), /*#__PURE__*/_jsx(CredentialSelector, {
|
|
159
195
|
onChange: controller.selectCredentialType,
|
|
160
196
|
options: controller.credentialOptions.map(function (value) {
|
|
161
197
|
return {
|
|
162
198
|
value: value,
|
|
163
|
-
label: value === 'password' ? '
|
|
199
|
+
label: value === 'password' ? t('auth.passwordSignIn') : t('auth.codeSignIn')
|
|
164
200
|
};
|
|
165
201
|
}),
|
|
166
202
|
value: controller.credentialType
|
|
@@ -179,12 +215,14 @@ export function SignIn(_ref3) {
|
|
|
179
215
|
error: controller.contextFieldErrors[field.name],
|
|
180
216
|
label: showFieldLabels ? field.label : undefined,
|
|
181
217
|
children: /*#__PURE__*/_jsx(InputItem, {
|
|
182
|
-
error: controller.contextFieldErrors[field.name],
|
|
218
|
+
error: Boolean(controller.contextFieldErrors[field.name]),
|
|
183
219
|
maxLength: field.maxLength,
|
|
184
220
|
onChange: function onChange(value) {
|
|
185
221
|
return controller.setContextValue(field.name, value);
|
|
186
222
|
},
|
|
187
|
-
placeholder: (_field$placeholder = field.placeholder) !== null && _field$placeholder !== void 0 ? _field$placeholder :
|
|
223
|
+
placeholder: (_field$placeholder = field.placeholder) !== null && _field$placeholder !== void 0 ? _field$placeholder : t('auth.enter', {
|
|
224
|
+
label: field.label
|
|
225
|
+
}),
|
|
188
226
|
prefix: field.prefix,
|
|
189
227
|
size: "large",
|
|
190
228
|
testID: testID ? "".concat(testID, "-context-").concat(field.name) : undefined,
|
|
@@ -201,11 +239,13 @@ export function SignIn(_ref3) {
|
|
|
201
239
|
value: controller.identifierValue
|
|
202
240
|
}) : null, controller.credentialType === 'password' ? /*#__PURE__*/_jsx(AuthField, {
|
|
203
241
|
error: controller.fieldErrors.password,
|
|
204
|
-
label: showFieldLabels ? '
|
|
242
|
+
label: showFieldLabels ? t('auth.password') : undefined,
|
|
205
243
|
children: /*#__PURE__*/_jsx(InputItem, {
|
|
206
|
-
error: controller.fieldErrors.password,
|
|
244
|
+
error: Boolean(controller.fieldErrors.password),
|
|
207
245
|
onChange: controller.setPassword,
|
|
208
|
-
placeholder:
|
|
246
|
+
placeholder: t('auth.enter', {
|
|
247
|
+
label: t('auth.password')
|
|
248
|
+
}),
|
|
209
249
|
prefix: /*#__PURE__*/_jsx(Icon, {
|
|
210
250
|
name: "Lock",
|
|
211
251
|
size: 18
|
|
@@ -215,6 +255,7 @@ export function SignIn(_ref3) {
|
|
|
215
255
|
value: controller.password
|
|
216
256
|
})
|
|
217
257
|
}) : /*#__PURE__*/_jsx(VerificationCodeInput, {
|
|
258
|
+
config: controller.config,
|
|
218
259
|
codeLength: controller.config.code.length,
|
|
219
260
|
countdown: controller.countdown,
|
|
220
261
|
disabled: controller.submitting,
|
|
@@ -226,20 +267,21 @@ export function SignIn(_ref3) {
|
|
|
226
267
|
sending: controller.sendingCode,
|
|
227
268
|
showLabel: showFieldLabels,
|
|
228
269
|
value: controller.code
|
|
229
|
-
}), showRemember || onForgotPassword ? /*#__PURE__*/_jsxs(View, {
|
|
270
|
+
}), showRemember || onForgotPassword && controller.credentialType === 'password' ? /*#__PURE__*/_jsxs(View, {
|
|
230
271
|
className: "x-taro-auth-form__meta",
|
|
231
272
|
children: [showRemember ? /*#__PURE__*/_jsx(Checkbox, {
|
|
232
273
|
checked: controller.remember,
|
|
233
274
|
onChange: controller.setRemember,
|
|
234
|
-
children:
|
|
275
|
+
children: t('auth.remember')
|
|
235
276
|
}) : /*#__PURE__*/_jsx(View, {}), onForgotPassword && controller.credentialType === 'password' ? /*#__PURE__*/_jsx(Button, {
|
|
236
277
|
onClick: onForgotPassword,
|
|
237
278
|
size: "small",
|
|
238
279
|
type: "link",
|
|
239
|
-
|
|
280
|
+
compact: true,
|
|
281
|
+
children: t('auth.forgotLink')
|
|
240
282
|
}) : null]
|
|
241
283
|
}) : null, /*#__PURE__*/_jsx(Button, {
|
|
242
|
-
ariaLabel:
|
|
284
|
+
ariaLabel: t('auth.signIn'),
|
|
243
285
|
block: true,
|
|
244
286
|
disabled: !controller.method || controller.submitting,
|
|
245
287
|
loading: controller.submitting,
|
|
@@ -248,7 +290,7 @@ export function SignIn(_ref3) {
|
|
|
248
290
|
},
|
|
249
291
|
size: "large",
|
|
250
292
|
testID: testID ? "".concat(testID, "-submit") : undefined,
|
|
251
|
-
children:
|
|
293
|
+
children: t('auth.signIn')
|
|
252
294
|
}), /*#__PURE__*/_jsx(ThirdPartySignIn, {
|
|
253
295
|
config: config,
|
|
254
296
|
onAuthError: onAuthError,
|
|
@@ -260,12 +302,13 @@ export function SignIn(_ref3) {
|
|
|
260
302
|
services: services
|
|
261
303
|
}), onSignUp ? /*#__PURE__*/_jsxs(InlineFooter, {
|
|
262
304
|
children: [/*#__PURE__*/_jsx(Text, {
|
|
263
|
-
children:
|
|
305
|
+
children: t('auth.noAccount')
|
|
264
306
|
}), /*#__PURE__*/_jsx(Button, {
|
|
265
307
|
onClick: onSignUp,
|
|
266
308
|
size: "small",
|
|
267
309
|
type: "link",
|
|
268
|
-
|
|
310
|
+
compact: true,
|
|
311
|
+
children: t('auth.signUpNow')
|
|
269
312
|
})]
|
|
270
313
|
}) : null]
|
|
271
314
|
})
|
|
@@ -275,8 +318,7 @@ export function SignUp(_ref5) {
|
|
|
275
318
|
var className = _ref5.className,
|
|
276
319
|
config = _ref5.config,
|
|
277
320
|
defaultIdentifier = _ref5.defaultIdentifier,
|
|
278
|
-
|
|
279
|
-
description = _ref5$description === void 0 ? '验证手机号或邮箱后创建账号' : _ref5$description,
|
|
321
|
+
description = _ref5.description,
|
|
280
322
|
identifiers = _ref5.identifiers,
|
|
281
323
|
logo = _ref5.logo,
|
|
282
324
|
onAuthError = _ref5.onAuthError,
|
|
@@ -287,9 +329,9 @@ export function SignUp(_ref5) {
|
|
|
287
329
|
style = _ref5.style,
|
|
288
330
|
surface = _ref5.surface,
|
|
289
331
|
testID = _ref5.testID,
|
|
290
|
-
|
|
291
|
-
title = _ref5$title === void 0 ? '注册' : _ref5$title,
|
|
332
|
+
title = _ref5.title,
|
|
292
333
|
tokens = _ref5.tokens;
|
|
334
|
+
var t = useAuthTranslation(config);
|
|
293
335
|
var controller = useSignUpController({
|
|
294
336
|
config: config,
|
|
295
337
|
defaultIdentifier: defaultIdentifier,
|
|
@@ -299,6 +341,8 @@ export function SignUp(_ref5) {
|
|
|
299
341
|
onSuccess: onSuccess,
|
|
300
342
|
services: services
|
|
301
343
|
});
|
|
344
|
+
if (description === undefined) description = t('auth.signUpDescription');
|
|
345
|
+
if (title === undefined) title = t('auth.signUp');
|
|
302
346
|
return /*#__PURE__*/_jsx(AuthPanel, {
|
|
303
347
|
className: className,
|
|
304
348
|
description: description,
|
|
@@ -313,7 +357,7 @@ export function SignUp(_ref5) {
|
|
|
313
357
|
children: controller.error
|
|
314
358
|
}), /*#__PURE__*/_jsx(AuthSelector, {
|
|
315
359
|
onChange: controller.setIdentifierType,
|
|
316
|
-
options: contactOptions(controller.identifiers),
|
|
360
|
+
options: contactOptions(controller.identifiers, controller.config),
|
|
317
361
|
value: controller.identifierType
|
|
318
362
|
}), /*#__PURE__*/_jsx(IdentifierInput, {
|
|
319
363
|
config: controller.config,
|
|
@@ -322,6 +366,7 @@ export function SignUp(_ref5) {
|
|
|
322
366
|
type: controller.identifierType,
|
|
323
367
|
value: controller.identifierValue
|
|
324
368
|
}), /*#__PURE__*/_jsx(VerificationCodeInput, {
|
|
369
|
+
config: controller.config,
|
|
325
370
|
codeLength: controller.config.code.length,
|
|
326
371
|
countdown: controller.countdown,
|
|
327
372
|
disabled: controller.submitting,
|
|
@@ -334,22 +379,24 @@ export function SignUp(_ref5) {
|
|
|
334
379
|
value: controller.code
|
|
335
380
|
}), /*#__PURE__*/_jsx(AuthField, {
|
|
336
381
|
error: controller.fieldErrors.password,
|
|
337
|
-
label:
|
|
382
|
+
label: t('auth.password'),
|
|
338
383
|
children: /*#__PURE__*/_jsx(InputItem, {
|
|
339
|
-
error: controller.fieldErrors.password,
|
|
384
|
+
error: Boolean(controller.fieldErrors.password),
|
|
340
385
|
onChange: controller.setPassword,
|
|
341
|
-
placeholder:
|
|
386
|
+
placeholder: t('auth.passwordHint', {
|
|
387
|
+
length: controller.config.password.minLength
|
|
388
|
+
}),
|
|
342
389
|
size: "large",
|
|
343
390
|
type: "password",
|
|
344
391
|
value: controller.password
|
|
345
392
|
})
|
|
346
393
|
}), /*#__PURE__*/_jsx(AuthField, {
|
|
347
394
|
error: controller.fieldErrors.confirmPassword,
|
|
348
|
-
label:
|
|
395
|
+
label: t('auth.confirmPassword'),
|
|
349
396
|
children: /*#__PURE__*/_jsx(InputItem, {
|
|
350
|
-
error: controller.fieldErrors.confirmPassword,
|
|
397
|
+
error: Boolean(controller.fieldErrors.confirmPassword),
|
|
351
398
|
onChange: controller.setConfirmPassword,
|
|
352
|
-
placeholder:
|
|
399
|
+
placeholder: t('auth.repeatPassword'),
|
|
353
400
|
size: "large",
|
|
354
401
|
type: "password",
|
|
355
402
|
value: controller.confirmPassword
|
|
@@ -368,6 +415,7 @@ export function SignUp(_ref5) {
|
|
|
368
415
|
href: agreement.href,
|
|
369
416
|
size: "small",
|
|
370
417
|
type: "link",
|
|
418
|
+
compact: true,
|
|
371
419
|
children: agreement.label
|
|
372
420
|
}) : agreement.label
|
|
373
421
|
}, agreement.id);
|
|
@@ -380,15 +428,16 @@ export function SignUp(_ref5) {
|
|
|
380
428
|
return void controller.submit();
|
|
381
429
|
},
|
|
382
430
|
size: "large",
|
|
383
|
-
children:
|
|
431
|
+
children: t('auth.signUp')
|
|
384
432
|
}), onSignIn ? /*#__PURE__*/_jsxs(InlineFooter, {
|
|
385
433
|
children: [/*#__PURE__*/_jsx(Text, {
|
|
386
|
-
children:
|
|
434
|
+
children: t('auth.hasAccount')
|
|
387
435
|
}), /*#__PURE__*/_jsx(Button, {
|
|
388
436
|
onClick: onSignIn,
|
|
389
437
|
size: "small",
|
|
390
438
|
type: "link",
|
|
391
|
-
|
|
439
|
+
compact: true,
|
|
440
|
+
children: t('auth.goSignIn')
|
|
392
441
|
})]
|
|
393
442
|
}) : null]
|
|
394
443
|
})
|
|
@@ -397,6 +446,7 @@ export function SignUp(_ref5) {
|
|
|
397
446
|
export function ForgotPassword(_ref6) {
|
|
398
447
|
var className = _ref6.className,
|
|
399
448
|
config = _ref6.config,
|
|
449
|
+
description = _ref6.description,
|
|
400
450
|
defaultIdentifier = _ref6.defaultIdentifier,
|
|
401
451
|
identifiers = _ref6.identifiers,
|
|
402
452
|
onAuthError = _ref6.onAuthError,
|
|
@@ -407,9 +457,9 @@ export function ForgotPassword(_ref6) {
|
|
|
407
457
|
style = _ref6.style,
|
|
408
458
|
surface = _ref6.surface,
|
|
409
459
|
testID = _ref6.testID,
|
|
410
|
-
|
|
411
|
-
title = _ref6$title === void 0 ? '找回密码' : _ref6$title,
|
|
460
|
+
title = _ref6.title,
|
|
412
461
|
tokens = _ref6.tokens;
|
|
462
|
+
var t = useAuthTranslation(config);
|
|
413
463
|
var controller = useForgotPasswordController({
|
|
414
464
|
config: config,
|
|
415
465
|
defaultIdentifier: defaultIdentifier,
|
|
@@ -419,21 +469,24 @@ export function ForgotPassword(_ref6) {
|
|
|
419
469
|
onSuccess: onSuccess,
|
|
420
470
|
services: services
|
|
421
471
|
});
|
|
472
|
+
if (title === undefined) title = t('auth.forgotPassword');
|
|
422
473
|
var activeStep = controller.step === 'verify' ? 0 : controller.step === 'reset' ? 1 : 2;
|
|
423
474
|
return /*#__PURE__*/_jsxs(AuthPanel, {
|
|
424
475
|
className: className,
|
|
425
|
-
description:
|
|
476
|
+
description: description === undefined ? t('auth.forgotDescription') : description,
|
|
426
477
|
style: useAuthStyle(tokens, style),
|
|
427
478
|
surface: surface,
|
|
428
479
|
testID: testID,
|
|
429
480
|
title: title,
|
|
430
481
|
children: [/*#__PURE__*/_jsx(View, {
|
|
431
|
-
ariaLabel:
|
|
482
|
+
ariaLabel: t('auth.forgotSteps'),
|
|
432
483
|
className: "x-taro-auth-steps",
|
|
433
|
-
children: ['
|
|
484
|
+
children: [t(controller.verifiesBeforeReset ? 'auth.verifyIdentity' : 'auth.code'), t('auth.setPassword'), t('auth.done')].map(function (label, index) {
|
|
434
485
|
return /*#__PURE__*/_jsxs(View, {
|
|
486
|
+
className: "x-taro-auth-step",
|
|
435
487
|
"data-active": index === activeStep ? 'true' : 'false',
|
|
436
488
|
children: [/*#__PURE__*/_jsx(Text, {
|
|
489
|
+
className: "x-taro-auth-step__number",
|
|
437
490
|
children: index + 1
|
|
438
491
|
}), /*#__PURE__*/_jsx(Text, {
|
|
439
492
|
children: label
|
|
@@ -448,7 +501,7 @@ export function ForgotPassword(_ref6) {
|
|
|
448
501
|
}), controller.step === 'verify' ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
449
502
|
children: [/*#__PURE__*/_jsx(AuthSelector, {
|
|
450
503
|
onChange: controller.setIdentifierType,
|
|
451
|
-
options: contactOptions(controller.identifiers),
|
|
504
|
+
options: contactOptions(controller.identifiers, controller.config),
|
|
452
505
|
value: controller.identifierType
|
|
453
506
|
}), /*#__PURE__*/_jsx(IdentifierInput, {
|
|
454
507
|
config: controller.config,
|
|
@@ -457,6 +510,7 @@ export function ForgotPassword(_ref6) {
|
|
|
457
510
|
type: controller.identifierType,
|
|
458
511
|
value: controller.identifierValue
|
|
459
512
|
}), /*#__PURE__*/_jsx(VerificationCodeInput, {
|
|
513
|
+
config: controller.config,
|
|
460
514
|
codeLength: controller.config.code.length,
|
|
461
515
|
countdown: controller.countdown,
|
|
462
516
|
error: controller.fieldErrors.code,
|
|
@@ -473,27 +527,29 @@ export function ForgotPassword(_ref6) {
|
|
|
473
527
|
return void controller.submitVerify();
|
|
474
528
|
},
|
|
475
529
|
size: "large",
|
|
476
|
-
children:
|
|
530
|
+
children: t('auth.next')
|
|
477
531
|
})]
|
|
478
532
|
}) : controller.step === 'reset' ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
479
533
|
children: [/*#__PURE__*/_jsx(AuthField, {
|
|
480
534
|
error: controller.fieldErrors.newPassword,
|
|
481
|
-
label:
|
|
535
|
+
label: t('auth.newPassword'),
|
|
482
536
|
children: /*#__PURE__*/_jsx(InputItem, {
|
|
483
|
-
error: controller.fieldErrors.newPassword,
|
|
537
|
+
error: Boolean(controller.fieldErrors.newPassword),
|
|
484
538
|
onChange: controller.setNewPassword,
|
|
485
|
-
placeholder:
|
|
539
|
+
placeholder: t('auth.passwordHint', {
|
|
540
|
+
length: controller.config.password.minLength
|
|
541
|
+
}),
|
|
486
542
|
size: "large",
|
|
487
543
|
type: "password",
|
|
488
544
|
value: controller.newPassword
|
|
489
545
|
})
|
|
490
546
|
}), /*#__PURE__*/_jsx(AuthField, {
|
|
491
547
|
error: controller.fieldErrors.confirmPassword,
|
|
492
|
-
label:
|
|
548
|
+
label: t('auth.confirmNewPassword'),
|
|
493
549
|
children: /*#__PURE__*/_jsx(InputItem, {
|
|
494
|
-
error: controller.fieldErrors.confirmPassword,
|
|
550
|
+
error: Boolean(controller.fieldErrors.confirmPassword),
|
|
495
551
|
onChange: controller.setConfirmPassword,
|
|
496
|
-
placeholder:
|
|
552
|
+
placeholder: t('auth.repeatNewPassword'),
|
|
497
553
|
size: "large",
|
|
498
554
|
type: "password",
|
|
499
555
|
value: controller.confirmPassword
|
|
@@ -502,30 +558,39 @@ export function ForgotPassword(_ref6) {
|
|
|
502
558
|
className: "x-taro-auth-form__actions",
|
|
503
559
|
children: [/*#__PURE__*/_jsx(Button, {
|
|
504
560
|
onClick: controller.back,
|
|
561
|
+
style: {
|
|
562
|
+
alignSelf: 'center'
|
|
563
|
+
},
|
|
505
564
|
size: "small",
|
|
506
|
-
type: "
|
|
507
|
-
|
|
565
|
+
type: "link",
|
|
566
|
+
compact: true,
|
|
567
|
+
disabled: controller.submitting,
|
|
568
|
+
children: t('auth.previous')
|
|
508
569
|
}), /*#__PURE__*/_jsx(Button, {
|
|
509
570
|
loading: controller.submitting,
|
|
510
571
|
onClick: function onClick() {
|
|
511
572
|
return void controller.submitReset();
|
|
512
573
|
},
|
|
513
|
-
size: "
|
|
514
|
-
|
|
574
|
+
size: "large",
|
|
575
|
+
block: true,
|
|
576
|
+
children: t('auth.resetPassword')
|
|
515
577
|
})]
|
|
516
578
|
})]
|
|
517
579
|
}) : /*#__PURE__*/_jsxs(View, {
|
|
518
580
|
className: "x-taro-auth-success",
|
|
519
|
-
children: [/*#__PURE__*/_jsx(
|
|
581
|
+
children: [/*#__PURE__*/_jsx(Icon, {
|
|
582
|
+
name: "CircleCheck",
|
|
583
|
+
size: 40
|
|
584
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
520
585
|
className: "x-taro-auth-success__title",
|
|
521
|
-
children:
|
|
586
|
+
children: t('auth.passwordReset')
|
|
522
587
|
}), /*#__PURE__*/_jsx(Text, {
|
|
523
|
-
children:
|
|
588
|
+
children: t('auth.passwordResetDescription')
|
|
524
589
|
}), onBackToSignIn ? /*#__PURE__*/_jsx(Button, {
|
|
525
590
|
block: true,
|
|
526
591
|
onClick: onBackToSignIn,
|
|
527
592
|
size: "large",
|
|
528
|
-
children:
|
|
593
|
+
children: t('auth.backToSignIn')
|
|
529
594
|
}) : null]
|
|
530
595
|
})]
|
|
531
596
|
}, controller.revision)]
|
|
@@ -536,11 +601,9 @@ export function QuickSignIn(_ref7) {
|
|
|
536
601
|
autoSubmitCode = _ref7$autoSubmitCode === void 0 ? true : _ref7$autoSubmitCode,
|
|
537
602
|
className = _ref7.className,
|
|
538
603
|
config = _ref7.config,
|
|
539
|
-
|
|
540
|
-
description = _ref7$description === void 0 ? '输入手机号,验证后继续当前操作' : _ref7$description,
|
|
604
|
+
description = _ref7.description,
|
|
541
605
|
footer = _ref7.footer,
|
|
542
|
-
|
|
543
|
-
identifierSubmitText = _ref7$identifierSubmi === void 0 ? '继续' : _ref7$identifierSubmi,
|
|
606
|
+
identifierSubmitText = _ref7.identifierSubmitText,
|
|
544
607
|
_ref7$identifierType = _ref7.identifierType,
|
|
545
608
|
identifierType = _ref7$identifierType === void 0 ? 'phone' : _ref7$identifierType,
|
|
546
609
|
initialIdentifier = _ref7.initialIdentifier,
|
|
@@ -553,14 +616,13 @@ export function QuickSignIn(_ref7) {
|
|
|
553
616
|
_ref7$showHeader = _ref7.showHeader,
|
|
554
617
|
showHeader = _ref7$showHeader === void 0 ? true : _ref7$showHeader,
|
|
555
618
|
style = _ref7.style,
|
|
556
|
-
|
|
557
|
-
submitText = _ref7$submitText === void 0 ? '继续' : _ref7$submitText,
|
|
619
|
+
submitText = _ref7.submitText,
|
|
558
620
|
_ref7$surface = _ref7.surface,
|
|
559
621
|
surface = _ref7$surface === void 0 ? 'plain' : _ref7$surface,
|
|
560
622
|
testID = _ref7.testID,
|
|
561
|
-
|
|
562
|
-
title = _ref7$title === void 0 ? '输入手机号' : _ref7$title,
|
|
623
|
+
title = _ref7.title,
|
|
563
624
|
tokens = _ref7.tokens;
|
|
625
|
+
var t = useAuthTranslation(config);
|
|
564
626
|
var controller = useQuickSignInController({
|
|
565
627
|
config: config,
|
|
566
628
|
defaultIdentifier: identifierType,
|
|
@@ -572,6 +634,14 @@ export function QuickSignIn(_ref7) {
|
|
|
572
634
|
onSuccess: onSuccess,
|
|
573
635
|
services: services
|
|
574
636
|
});
|
|
637
|
+
if (description === undefined) description = t('auth.quickDescription', {
|
|
638
|
+
label: identifierLabel(identifierType, controller.config)
|
|
639
|
+
});
|
|
640
|
+
if (identifierSubmitText === undefined) identifierSubmitText = t('auth.continue');
|
|
641
|
+
if (submitText === undefined) submitText = t('auth.continue');
|
|
642
|
+
if (title === undefined) title = t('auth.quickTitle', {
|
|
643
|
+
label: identifierLabel(identifierType, controller.config)
|
|
644
|
+
});
|
|
575
645
|
var submittedCodeRef = useRef('');
|
|
576
646
|
useEffect(function () {
|
|
577
647
|
if (autoSubmitCode && controller.step === 'code' && controller.code.length === controller.config.code.length && submittedCodeRef.current !== controller.code) {
|
|
@@ -587,30 +657,43 @@ export function QuickSignIn(_ref7) {
|
|
|
587
657
|
children: /*#__PURE__*/_jsxs(View, {
|
|
588
658
|
className: "x-taro-auth-quick x-taro-auth-step-screen",
|
|
589
659
|
"data-direction": controller.direction,
|
|
590
|
-
children: [
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
660
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
661
|
+
className: "x-taro-auth-quick__nav x-taro-auth-quick__nav--".concat(controller.step === 'code' ? 'back' : 'close'),
|
|
662
|
+
children: controller.step === 'code' ? /*#__PURE__*/_jsx(Button, {
|
|
663
|
+
ariaLabel: t('auth.editIdentifier'),
|
|
664
|
+
className: "x-taro-auth-quick__back",
|
|
665
|
+
onClick: controller.back,
|
|
666
|
+
shape: "round",
|
|
667
|
+
size: "small",
|
|
668
|
+
type: "ghost",
|
|
669
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
670
|
+
name: "ChevronLeft",
|
|
671
|
+
size: 18
|
|
672
|
+
})
|
|
673
|
+
}) : onClose ? /*#__PURE__*/_jsx(Button, {
|
|
674
|
+
ariaLabel: t('auth.close'),
|
|
675
|
+
className: "x-taro-auth-quick__close",
|
|
676
|
+
onClick: onClose,
|
|
677
|
+
shape: "round",
|
|
678
|
+
size: "small",
|
|
679
|
+
type: "ghost",
|
|
680
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
681
|
+
name: "X",
|
|
682
|
+
size: 18
|
|
683
|
+
})
|
|
684
|
+
}) : null
|
|
685
|
+
}), showHeader ? /*#__PURE__*/_jsxs(View, {
|
|
607
686
|
className: "x-taro-auth-quick__header",
|
|
608
687
|
children: [/*#__PURE__*/_jsx(Text, {
|
|
609
688
|
className: "x-taro-auth-quick__title",
|
|
610
|
-
children: controller.step === 'identifier' ? title :
|
|
689
|
+
children: controller.step === 'identifier' ? title : t('auth.quickCodeTitle', {
|
|
690
|
+
length: controller.config.code.length
|
|
691
|
+
})
|
|
611
692
|
}), /*#__PURE__*/_jsx(Text, {
|
|
612
693
|
className: "x-taro-auth-quick__description",
|
|
613
|
-
children: controller.step === 'identifier' ? description :
|
|
694
|
+
children: controller.step === 'identifier' ? description : t('auth.codeSent', {
|
|
695
|
+
identifier: controller.identifierValue
|
|
696
|
+
})
|
|
614
697
|
})]
|
|
615
698
|
}) : null, /*#__PURE__*/_jsxs(View, {
|
|
616
699
|
className: "x-taro-auth-form",
|
|
@@ -634,6 +717,7 @@ export function QuickSignIn(_ref7) {
|
|
|
634
717
|
})]
|
|
635
718
|
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
|
636
719
|
children: [/*#__PURE__*/_jsx(VerificationCodeInput, {
|
|
720
|
+
config: controller.config,
|
|
637
721
|
codeLength: controller.config.code.length,
|
|
638
722
|
countdown: controller.countdown,
|
|
639
723
|
error: controller.fieldErrors.code,
|
|
@@ -730,6 +814,7 @@ export function IdentifierBinding(_ref9) {
|
|
|
730
814
|
testID = _ref9.testID,
|
|
731
815
|
title = _ref9.title,
|
|
732
816
|
tokens = _ref9.tokens;
|
|
817
|
+
var t = useAuthTranslation(config);
|
|
733
818
|
var controller = useIdentifierBindingController({
|
|
734
819
|
action: action,
|
|
735
820
|
config: config,
|
|
@@ -740,25 +825,34 @@ export function IdentifierBinding(_ref9) {
|
|
|
740
825
|
requireReauthentication: requireReauthentication,
|
|
741
826
|
services: services
|
|
742
827
|
});
|
|
743
|
-
var label = identifierLabel(identifierType);
|
|
828
|
+
var label = identifierLabel(identifierType, controller.config);
|
|
744
829
|
return /*#__PURE__*/_jsx(AuthPanel, {
|
|
745
830
|
className: className,
|
|
746
|
-
description: action === 'change' && currentDisplayValue ?
|
|
831
|
+
description: action === 'change' && currentDisplayValue ? t('auth.currentIdentifier', {
|
|
832
|
+
label: label,
|
|
833
|
+
value: currentDisplayValue
|
|
834
|
+
}) : t(action === 'bind' ? 'auth.bindDescription' : 'auth.replaceDescription', {
|
|
835
|
+
label: label
|
|
836
|
+
}),
|
|
747
837
|
style: useAuthStyle(tokens, style),
|
|
748
838
|
surface: surface,
|
|
749
839
|
testID: testID,
|
|
750
|
-
title: title
|
|
840
|
+
title: title === undefined ? t(action === 'bind' ? 'auth.bindTitle' : 'auth.replaceTitle', {
|
|
841
|
+
label: label
|
|
842
|
+
}) : title,
|
|
751
843
|
children: /*#__PURE__*/_jsxs(View, {
|
|
752
844
|
className: "x-taro-auth-form",
|
|
753
845
|
children: [/*#__PURE__*/_jsx(AuthError, {
|
|
754
846
|
children: controller.error
|
|
755
847
|
}), controller.shouldReauthenticate ? /*#__PURE__*/_jsx(AuthField, {
|
|
756
848
|
error: controller.fieldErrors.currentPassword,
|
|
757
|
-
label:
|
|
849
|
+
label: t('auth.currentPassword'),
|
|
758
850
|
children: /*#__PURE__*/_jsx(InputItem, {
|
|
759
|
-
error: controller.fieldErrors.currentPassword,
|
|
851
|
+
error: Boolean(controller.fieldErrors.currentPassword),
|
|
760
852
|
onChange: controller.setCurrentPassword,
|
|
761
|
-
placeholder:
|
|
853
|
+
placeholder: t('auth.enter', {
|
|
854
|
+
label: t('auth.currentPassword')
|
|
855
|
+
}),
|
|
762
856
|
size: "large",
|
|
763
857
|
type: "password",
|
|
764
858
|
value: controller.currentPassword
|
|
@@ -770,6 +864,7 @@ export function IdentifierBinding(_ref9) {
|
|
|
770
864
|
type: identifierType,
|
|
771
865
|
value: controller.identifierValue
|
|
772
866
|
}), /*#__PURE__*/_jsx(VerificationCodeInput, {
|
|
867
|
+
config: controller.config,
|
|
773
868
|
codeLength: controller.config.code.length,
|
|
774
869
|
countdown: controller.countdown,
|
|
775
870
|
error: controller.fieldErrors.code,
|
|
@@ -783,16 +878,22 @@ export function IdentifierBinding(_ref9) {
|
|
|
783
878
|
className: "x-taro-auth-form__actions",
|
|
784
879
|
children: [onCancel ? /*#__PURE__*/_jsx(Button, {
|
|
785
880
|
onClick: onCancel,
|
|
881
|
+
style: {
|
|
882
|
+
alignSelf: 'center'
|
|
883
|
+
},
|
|
786
884
|
size: "small",
|
|
787
|
-
type: "
|
|
788
|
-
|
|
789
|
-
|
|
885
|
+
type: "link",
|
|
886
|
+
compact: true,
|
|
887
|
+
disabled: controller.submitting,
|
|
888
|
+
children: t('auth.cancel')
|
|
889
|
+
}) : null, /*#__PURE__*/_jsx(Button, {
|
|
790
890
|
loading: controller.submitting,
|
|
791
891
|
onClick: function onClick() {
|
|
792
892
|
return void controller.submit();
|
|
793
893
|
},
|
|
794
|
-
size: "
|
|
795
|
-
|
|
894
|
+
size: "large",
|
|
895
|
+
block: true,
|
|
896
|
+
children: t(action === 'bind' ? 'auth.confirmBind' : 'auth.confirmReplace')
|
|
796
897
|
})]
|
|
797
898
|
})]
|
|
798
899
|
})
|
|
@@ -801,8 +902,7 @@ export function IdentifierBinding(_ref9) {
|
|
|
801
902
|
export function ChangePassword(_ref10) {
|
|
802
903
|
var className = _ref10.className,
|
|
803
904
|
config = _ref10.config,
|
|
804
|
-
|
|
805
|
-
description = _ref10$description === void 0 ? '更新当前账号的登录密码' : _ref10$description,
|
|
905
|
+
description = _ref10.description,
|
|
806
906
|
onAuthError = _ref10.onAuthError,
|
|
807
907
|
onCancel = _ref10.onCancel,
|
|
808
908
|
onReauthenticationRequired = _ref10.onReauthenticationRequired,
|
|
@@ -812,9 +912,9 @@ export function ChangePassword(_ref10) {
|
|
|
812
912
|
style = _ref10.style,
|
|
813
913
|
surface = _ref10.surface,
|
|
814
914
|
testID = _ref10.testID,
|
|
815
|
-
|
|
816
|
-
title = _ref10$title === void 0 ? '修改密码' : _ref10$title,
|
|
915
|
+
title = _ref10.title,
|
|
817
916
|
tokens = _ref10.tokens;
|
|
917
|
+
var t = useAuthTranslation(config);
|
|
818
918
|
var controller = useChangePasswordController({
|
|
819
919
|
config: config,
|
|
820
920
|
onAuthError: onAuthError,
|
|
@@ -823,6 +923,8 @@ export function ChangePassword(_ref10) {
|
|
|
823
923
|
requireCurrentPassword: requireCurrentPassword,
|
|
824
924
|
services: services
|
|
825
925
|
});
|
|
926
|
+
if (description === undefined) description = t('auth.changePasswordDescription');
|
|
927
|
+
if (title === undefined) title = t('auth.changePassword');
|
|
826
928
|
return /*#__PURE__*/_jsx(AuthPanel, {
|
|
827
929
|
className: className,
|
|
828
930
|
description: description,
|
|
@@ -836,33 +938,37 @@ export function ChangePassword(_ref10) {
|
|
|
836
938
|
children: controller.error
|
|
837
939
|
}), controller.requireCurrentPassword ? /*#__PURE__*/_jsx(AuthField, {
|
|
838
940
|
error: controller.fieldErrors.currentPassword,
|
|
839
|
-
label:
|
|
941
|
+
label: t('auth.currentPassword'),
|
|
840
942
|
children: /*#__PURE__*/_jsx(InputItem, {
|
|
841
|
-
error: controller.fieldErrors.currentPassword,
|
|
943
|
+
error: Boolean(controller.fieldErrors.currentPassword),
|
|
842
944
|
onChange: controller.setCurrentPassword,
|
|
843
|
-
placeholder:
|
|
945
|
+
placeholder: t('auth.enter', {
|
|
946
|
+
label: t('auth.currentPassword')
|
|
947
|
+
}),
|
|
844
948
|
size: "large",
|
|
845
949
|
type: "password",
|
|
846
950
|
value: controller.currentPassword
|
|
847
951
|
})
|
|
848
952
|
}) : null, /*#__PURE__*/_jsx(AuthField, {
|
|
849
953
|
error: controller.fieldErrors.newPassword,
|
|
850
|
-
label:
|
|
954
|
+
label: t('auth.newPassword'),
|
|
851
955
|
children: /*#__PURE__*/_jsx(InputItem, {
|
|
852
|
-
error: controller.fieldErrors.newPassword,
|
|
956
|
+
error: Boolean(controller.fieldErrors.newPassword),
|
|
853
957
|
onChange: controller.setNewPassword,
|
|
854
|
-
placeholder:
|
|
958
|
+
placeholder: t('auth.passwordHint', {
|
|
959
|
+
length: controller.config.password.minLength
|
|
960
|
+
}),
|
|
855
961
|
size: "large",
|
|
856
962
|
type: "password",
|
|
857
963
|
value: controller.newPassword
|
|
858
964
|
})
|
|
859
965
|
}), /*#__PURE__*/_jsx(AuthField, {
|
|
860
966
|
error: controller.fieldErrors.confirmPassword,
|
|
861
|
-
label:
|
|
967
|
+
label: t('auth.confirmNewPassword'),
|
|
862
968
|
children: /*#__PURE__*/_jsx(InputItem, {
|
|
863
|
-
error: controller.fieldErrors.confirmPassword,
|
|
969
|
+
error: Boolean(controller.fieldErrors.confirmPassword),
|
|
864
970
|
onChange: controller.setConfirmPassword,
|
|
865
|
-
placeholder:
|
|
971
|
+
placeholder: t('auth.repeatNewPassword'),
|
|
866
972
|
size: "large",
|
|
867
973
|
type: "password",
|
|
868
974
|
value: controller.confirmPassword
|
|
@@ -871,16 +977,22 @@ export function ChangePassword(_ref10) {
|
|
|
871
977
|
className: "x-taro-auth-form__actions",
|
|
872
978
|
children: [onCancel ? /*#__PURE__*/_jsx(Button, {
|
|
873
979
|
onClick: onCancel,
|
|
980
|
+
style: {
|
|
981
|
+
alignSelf: 'center'
|
|
982
|
+
},
|
|
874
983
|
size: "small",
|
|
875
|
-
type: "
|
|
876
|
-
|
|
984
|
+
type: "link",
|
|
985
|
+
compact: true,
|
|
986
|
+
disabled: controller.submitting,
|
|
987
|
+
children: t('auth.cancel')
|
|
877
988
|
}) : null, /*#__PURE__*/_jsx(Button, {
|
|
878
989
|
loading: controller.submitting,
|
|
879
990
|
onClick: function onClick() {
|
|
880
991
|
return void controller.submit();
|
|
881
992
|
},
|
|
882
|
-
size: "
|
|
883
|
-
|
|
993
|
+
size: "large",
|
|
994
|
+
block: true,
|
|
995
|
+
children: t('auth.confirmChange')
|
|
884
996
|
})]
|
|
885
997
|
})]
|
|
886
998
|
})
|
|
@@ -890,8 +1002,7 @@ export function AccountSecurity(_ref11) {
|
|
|
890
1002
|
var _controller$state2, _controller$state3;
|
|
891
1003
|
var className = _ref11.className,
|
|
892
1004
|
config = _ref11.config,
|
|
893
|
-
|
|
894
|
-
description = _ref11$description === void 0 ? '管理可用于登录和找回账号的安全信息' : _ref11$description,
|
|
1005
|
+
description = _ref11.description,
|
|
895
1006
|
onAuthError = _ref11.onAuthError,
|
|
896
1007
|
onReauthenticationRequired = _ref11.onReauthenticationRequired,
|
|
897
1008
|
onStateChange = _ref11.onStateChange,
|
|
@@ -899,9 +1010,9 @@ export function AccountSecurity(_ref11) {
|
|
|
899
1010
|
state = _ref11.state,
|
|
900
1011
|
style = _ref11.style,
|
|
901
1012
|
testID = _ref11.testID,
|
|
902
|
-
|
|
903
|
-
title = _ref11$title === void 0 ? '账号安全' : _ref11$title,
|
|
1013
|
+
title = _ref11.title,
|
|
904
1014
|
tokens = _ref11.tokens;
|
|
1015
|
+
var t = useAuthTranslation(config);
|
|
905
1016
|
var controller = useAccountSecurityController({
|
|
906
1017
|
config: config,
|
|
907
1018
|
onAuthError: onAuthError,
|
|
@@ -910,6 +1021,8 @@ export function AccountSecurity(_ref11) {
|
|
|
910
1021
|
services: services,
|
|
911
1022
|
state: state
|
|
912
1023
|
});
|
|
1024
|
+
if (description === undefined) description = t('auth.securityDescription');
|
|
1025
|
+
if (title === undefined) title = t('auth.security');
|
|
913
1026
|
var _useState5 = useState(),
|
|
914
1027
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
915
1028
|
dialog = _useState6[0],
|
|
@@ -952,7 +1065,7 @@ export function AccountSecurity(_ref11) {
|
|
|
952
1065
|
children: controller.error
|
|
953
1066
|
}), controller.loading ? /*#__PURE__*/_jsx(Text, {
|
|
954
1067
|
className: "x-taro-auth-security__loading",
|
|
955
|
-
children:
|
|
1068
|
+
children: t('auth.loading')
|
|
956
1069
|
}) : null, /*#__PURE__*/_jsxs(View, {
|
|
957
1070
|
className: "x-taro-auth-security__list",
|
|
958
1071
|
children: [controller.config.accountSecurity.identifiers.map(function (type) {
|
|
@@ -965,10 +1078,12 @@ export function AccountSecurity(_ref11) {
|
|
|
965
1078
|
className: "x-taro-auth-security__content",
|
|
966
1079
|
children: [/*#__PURE__*/_jsx(Text, {
|
|
967
1080
|
className: "x-taro-auth-security__label",
|
|
968
|
-
children: identifierLabel(type)
|
|
1081
|
+
children: identifierLabel(type, controller.config)
|
|
969
1082
|
}), /*#__PURE__*/_jsx(Text, {
|
|
970
1083
|
className: "x-taro-auth-security__value",
|
|
971
|
-
children: binding !== null && binding !== void 0 && binding.bound ?
|
|
1084
|
+
children: binding !== null && binding !== void 0 && binding.bound ? binding.displayValue ? t('auth.linkedValue', {
|
|
1085
|
+
value: binding.displayValue
|
|
1086
|
+
}) : t('auth.linked') : t('auth.notLinked')
|
|
972
1087
|
})]
|
|
973
1088
|
}), /*#__PURE__*/_jsx(Button, {
|
|
974
1089
|
onClick: function onClick() {
|
|
@@ -979,7 +1094,7 @@ export function AccountSecurity(_ref11) {
|
|
|
979
1094
|
},
|
|
980
1095
|
size: "small",
|
|
981
1096
|
type: "outline",
|
|
982
|
-
children: action === 'bind' ? '
|
|
1097
|
+
children: action === 'bind' ? t('auth.bind') : t('auth.replace')
|
|
983
1098
|
})]
|
|
984
1099
|
}, type);
|
|
985
1100
|
}), /*#__PURE__*/_jsxs(View, {
|
|
@@ -988,10 +1103,10 @@ export function AccountSecurity(_ref11) {
|
|
|
988
1103
|
className: "x-taro-auth-security__content",
|
|
989
1104
|
children: [/*#__PURE__*/_jsx(Text, {
|
|
990
1105
|
className: "x-taro-auth-security__label",
|
|
991
|
-
children:
|
|
1106
|
+
children: t('auth.password')
|
|
992
1107
|
}), /*#__PURE__*/_jsx(Text, {
|
|
993
1108
|
className: "x-taro-auth-security__value",
|
|
994
|
-
children: (_controller$state2 = controller.state) !== null && _controller$state2 !== void 0 && _controller$state2.password.set ? '
|
|
1109
|
+
children: (_controller$state2 = controller.state) !== null && _controller$state2 !== void 0 && _controller$state2.password.set ? t('auth.passwordSet') : t('auth.notSet')
|
|
995
1110
|
})]
|
|
996
1111
|
}), /*#__PURE__*/_jsx(Button, {
|
|
997
1112
|
onClick: function onClick() {
|
|
@@ -1001,10 +1116,13 @@ export function AccountSecurity(_ref11) {
|
|
|
1001
1116
|
},
|
|
1002
1117
|
size: "small",
|
|
1003
1118
|
type: "outline",
|
|
1004
|
-
children:
|
|
1119
|
+
children: t('auth.edit')
|
|
1005
1120
|
})]
|
|
1006
1121
|
})]
|
|
1007
1122
|
}), /*#__PURE__*/_jsx(Modal, {
|
|
1123
|
+
title: (dialog === null || dialog === void 0 ? void 0 : dialog.action) === 'password' ? t('auth.changePassword') : dialog !== null && dialog !== void 0 && dialog.type ? t(dialog.action === 'bind' ? 'auth.bindTitle' : 'auth.replaceTitle', {
|
|
1124
|
+
label: identifierLabel(dialog.type, controller.config)
|
|
1125
|
+
}) : undefined,
|
|
1008
1126
|
body: (dialog === null || dialog === void 0 ? void 0 : dialog.action) === 'password' ? /*#__PURE__*/_jsx(ChangePassword, {
|
|
1009
1127
|
config: config,
|
|
1010
1128
|
onCancel: close,
|
|
@@ -1012,7 +1130,8 @@ export function AccountSecurity(_ref11) {
|
|
|
1012
1130
|
return void complete();
|
|
1013
1131
|
},
|
|
1014
1132
|
services: services,
|
|
1015
|
-
surface: "plain"
|
|
1133
|
+
surface: "plain",
|
|
1134
|
+
title: null
|
|
1016
1135
|
}) : dialog !== null && dialog !== void 0 && dialog.type ? /*#__PURE__*/_jsx(IdentifierBinding, {
|
|
1017
1136
|
action: dialog.action,
|
|
1018
1137
|
config: config,
|
|
@@ -1023,7 +1142,8 @@ export function AccountSecurity(_ref11) {
|
|
|
1023
1142
|
return void complete();
|
|
1024
1143
|
},
|
|
1025
1144
|
services: services,
|
|
1026
|
-
surface: "plain"
|
|
1145
|
+
surface: "plain",
|
|
1146
|
+
title: null
|
|
1027
1147
|
}) : null,
|
|
1028
1148
|
closeIcon: true,
|
|
1029
1149
|
onClose: close,
|