@hanwenbo/x-taro-ui 0.0.1 → 0.0.2
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/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/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/lib/auth/components.js
CHANGED
|
@@ -77,6 +77,7 @@ function ThirdPartySignIn({
|
|
|
77
77
|
testID,
|
|
78
78
|
tokens
|
|
79
79
|
}) {
|
|
80
|
+
const t = (0, import_react2.useAuthTranslation)(config);
|
|
80
81
|
const controller = (0, import_react2.useThirdPartySignInController)({
|
|
81
82
|
config,
|
|
82
83
|
onAuthError,
|
|
@@ -96,21 +97,31 @@ function ThirdPartySignIn({
|
|
|
96
97
|
style: useAuthStyle(tokens, style)
|
|
97
98
|
},
|
|
98
99
|
/* @__PURE__ */ import_react.default.createElement(import_internal.AuthError, null, controller.error),
|
|
99
|
-
/* @__PURE__ */ import_react.default.createElement(import_components.View, { className: "x-taro-auth-divider" }, /* @__PURE__ */ import_react.default.createElement(import_components.View,
|
|
100
|
+
/* @__PURE__ */ import_react.default.createElement(import_components.View, { className: "x-taro-auth-divider" }, /* @__PURE__ */ import_react.default.createElement(import_components.View, { className: "x-taro-auth-divider__line" }), /* @__PURE__ */ import_react.default.createElement(import_components.Text, null, t("auth.otherSignIn")), /* @__PURE__ */ import_react.default.createElement(import_components.View, { className: "x-taro-auth-divider__line" })),
|
|
100
101
|
/* @__PURE__ */ import_react.default.createElement(import_components.View, { className: "x-taro-auth-third-party__items" }, controller.providers.map((provider) => /* @__PURE__ */ import_react.default.createElement(
|
|
101
102
|
import_button.Button,
|
|
102
103
|
{
|
|
103
|
-
ariaLabel: provider.ariaLabel ??
|
|
104
|
-
|
|
104
|
+
ariaLabel: provider.ariaLabel ?? t("auth.providerSignIn", { provider: String(provider.label) }),
|
|
105
|
+
className: "x-taro-auth-third-party__item",
|
|
106
|
+
compact: true,
|
|
105
107
|
disabled: provider.disabled || Boolean(controller.loadingProviderId),
|
|
106
|
-
icon: provider.icon,
|
|
108
|
+
icon: /* @__PURE__ */ import_react.default.createElement(import_components.View, { className: "x-taro-auth-third-party__icon" }, provider.icon ?? /* @__PURE__ */ import_react.default.createElement(import_icon.Icon, { name: "ShieldCheck", size: 28 })),
|
|
109
|
+
loadingIcon: /* @__PURE__ */ import_react.default.createElement(import_components.View, { className: "x-taro-auth-third-party__icon" }, /* @__PURE__ */ import_react.default.createElement(import_icon.Icon, { name: "Loader2", size: 28, spin: true })),
|
|
107
110
|
key: provider.id,
|
|
108
111
|
loading: provider.loading || controller.loadingProviderId === provider.id,
|
|
109
112
|
onClick: () => void controller.signIn(provider),
|
|
110
|
-
size: "
|
|
111
|
-
|
|
113
|
+
size: "small",
|
|
114
|
+
variant: "ghost",
|
|
115
|
+
gap: "var(--x-space-2)",
|
|
116
|
+
style: {
|
|
117
|
+
flexDirection: "column",
|
|
118
|
+
flex: "0 0 auto",
|
|
119
|
+
width: "calc(var(--x-space-8) * 2)",
|
|
120
|
+
padding: "var(--x-space-1) 0",
|
|
121
|
+
borderWidth: 0
|
|
122
|
+
}
|
|
112
123
|
},
|
|
113
|
-
provider.label
|
|
124
|
+
/* @__PURE__ */ import_react.default.createElement(import_components.Text, { className: "x-taro-auth-third-party__label" }, provider.label)
|
|
114
125
|
)))
|
|
115
126
|
);
|
|
116
127
|
}
|
|
@@ -119,7 +130,8 @@ function SignIn({
|
|
|
119
130
|
config,
|
|
120
131
|
contextFields = [],
|
|
121
132
|
defaultMethod,
|
|
122
|
-
description
|
|
133
|
+
description,
|
|
134
|
+
headerAlign,
|
|
123
135
|
logo,
|
|
124
136
|
methods,
|
|
125
137
|
onAuthError,
|
|
@@ -137,9 +149,10 @@ function SignIn({
|
|
|
137
149
|
style,
|
|
138
150
|
surface,
|
|
139
151
|
testID,
|
|
140
|
-
title
|
|
152
|
+
title,
|
|
141
153
|
tokens
|
|
142
154
|
}) {
|
|
155
|
+
const t = (0, import_react2.useAuthTranslation)(config);
|
|
143
156
|
const controller = (0, import_react2.useSignInController)({
|
|
144
157
|
config,
|
|
145
158
|
contextFields,
|
|
@@ -151,11 +164,14 @@ function SignIn({
|
|
|
151
164
|
onSuccess,
|
|
152
165
|
services
|
|
153
166
|
});
|
|
167
|
+
if (description === void 0) description = t("auth.signInDescription");
|
|
168
|
+
if (title === void 0) title = t("auth.signIn");
|
|
154
169
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
155
170
|
import_internal.AuthPanel,
|
|
156
171
|
{
|
|
157
172
|
className,
|
|
158
173
|
description,
|
|
174
|
+
headerAlign,
|
|
159
175
|
logo,
|
|
160
176
|
style: useAuthStyle(tokens, style),
|
|
161
177
|
surface,
|
|
@@ -163,12 +179,12 @@ function SignIn({
|
|
|
163
179
|
title
|
|
164
180
|
},
|
|
165
181
|
/* @__PURE__ */ import_react.default.createElement(import_components.View, { className: "x-taro-auth-form" }, /* @__PURE__ */ import_react.default.createElement(import_internal.AuthError, null, controller.error), /* @__PURE__ */ import_react.default.createElement(
|
|
166
|
-
import_internal.
|
|
182
|
+
import_internal.CredentialSelector,
|
|
167
183
|
{
|
|
168
184
|
onChange: controller.selectCredentialType,
|
|
169
185
|
options: controller.credentialOptions.map((value) => ({
|
|
170
186
|
value,
|
|
171
|
-
label: value === "password" ? "
|
|
187
|
+
label: value === "password" ? t("auth.passwordSignIn") : t("auth.codeSignIn")
|
|
172
188
|
})),
|
|
173
189
|
value: controller.credentialType
|
|
174
190
|
}
|
|
@@ -192,10 +208,10 @@ function SignIn({
|
|
|
192
208
|
/* @__PURE__ */ import_react.default.createElement(
|
|
193
209
|
import_inputItem.InputItem,
|
|
194
210
|
{
|
|
195
|
-
error: controller.contextFieldErrors[field.name],
|
|
211
|
+
error: Boolean(controller.contextFieldErrors[field.name]),
|
|
196
212
|
maxLength: field.maxLength,
|
|
197
213
|
onChange: (value) => controller.setContextValue(field.name, value),
|
|
198
|
-
placeholder: field.placeholder ??
|
|
214
|
+
placeholder: field.placeholder ?? t("auth.enter", { label: field.label }),
|
|
199
215
|
prefix: field.prefix,
|
|
200
216
|
size: "large",
|
|
201
217
|
testID: testID ? `${testID}-context-${field.name}` : void 0,
|
|
@@ -217,14 +233,14 @@ function SignIn({
|
|
|
217
233
|
import_internal.AuthField,
|
|
218
234
|
{
|
|
219
235
|
error: controller.fieldErrors.password,
|
|
220
|
-
label: showFieldLabels ? "
|
|
236
|
+
label: showFieldLabels ? t("auth.password") : void 0
|
|
221
237
|
},
|
|
222
238
|
/* @__PURE__ */ import_react.default.createElement(
|
|
223
239
|
import_inputItem.InputItem,
|
|
224
240
|
{
|
|
225
|
-
error: controller.fieldErrors.password,
|
|
241
|
+
error: Boolean(controller.fieldErrors.password),
|
|
226
242
|
onChange: controller.setPassword,
|
|
227
|
-
placeholder: "
|
|
243
|
+
placeholder: t("auth.enter", { label: t("auth.password") }),
|
|
228
244
|
prefix: /* @__PURE__ */ import_react.default.createElement(import_icon.Icon, { name: "Lock", size: 18 }),
|
|
229
245
|
size: "large",
|
|
230
246
|
type: "password",
|
|
@@ -234,6 +250,7 @@ function SignIn({
|
|
|
234
250
|
) : /* @__PURE__ */ import_react.default.createElement(
|
|
235
251
|
import_internal.VerificationCodeInput,
|
|
236
252
|
{
|
|
253
|
+
config: controller.config,
|
|
237
254
|
codeLength: controller.config.code.length,
|
|
238
255
|
countdown: controller.countdown,
|
|
239
256
|
disabled: controller.submitting,
|
|
@@ -244,10 +261,10 @@ function SignIn({
|
|
|
244
261
|
showLabel: showFieldLabels,
|
|
245
262
|
value: controller.code
|
|
246
263
|
}
|
|
247
|
-
), showRemember || onForgotPassword ? /* @__PURE__ */ import_react.default.createElement(import_components.View, { className: "x-taro-auth-form__meta" }, showRemember ? /* @__PURE__ */ import_react.default.createElement(import_checkbox.Checkbox, { checked: controller.remember, onChange: controller.setRemember }, "
|
|
264
|
+
), showRemember || onForgotPassword && controller.credentialType === "password" ? /* @__PURE__ */ import_react.default.createElement(import_components.View, { className: "x-taro-auth-form__meta" }, showRemember ? /* @__PURE__ */ import_react.default.createElement(import_checkbox.Checkbox, { checked: controller.remember, onChange: controller.setRemember }, t("auth.remember")) : /* @__PURE__ */ import_react.default.createElement(import_components.View, null), onForgotPassword && controller.credentialType === "password" ? /* @__PURE__ */ import_react.default.createElement(import_button.Button, { onClick: onForgotPassword, size: "small", type: "link", compact: true }, t("auth.forgotLink")) : null) : null, /* @__PURE__ */ import_react.default.createElement(
|
|
248
265
|
import_button.Button,
|
|
249
266
|
{
|
|
250
|
-
ariaLabel: "
|
|
267
|
+
ariaLabel: t("auth.signIn"),
|
|
251
268
|
block: true,
|
|
252
269
|
disabled: !controller.method || controller.submitting,
|
|
253
270
|
loading: controller.submitting,
|
|
@@ -255,7 +272,7 @@ function SignIn({
|
|
|
255
272
|
size: "large",
|
|
256
273
|
testID: testID ? `${testID}-submit` : void 0
|
|
257
274
|
},
|
|
258
|
-
"
|
|
275
|
+
t("auth.signIn")
|
|
259
276
|
), /* @__PURE__ */ import_react.default.createElement(
|
|
260
277
|
ThirdPartySignIn,
|
|
261
278
|
{
|
|
@@ -268,14 +285,14 @@ function SignIn({
|
|
|
268
285
|
providers,
|
|
269
286
|
services
|
|
270
287
|
}
|
|
271
|
-
), onSignUp ? /* @__PURE__ */ import_react.default.createElement(InlineFooter, null, /* @__PURE__ */ import_react.default.createElement(import_components.Text, null, "
|
|
288
|
+
), onSignUp ? /* @__PURE__ */ import_react.default.createElement(InlineFooter, null, /* @__PURE__ */ import_react.default.createElement(import_components.Text, null, t("auth.noAccount")), /* @__PURE__ */ import_react.default.createElement(import_button.Button, { onClick: onSignUp, size: "small", type: "link", compact: true }, t("auth.signUpNow"))) : null)
|
|
272
289
|
);
|
|
273
290
|
}
|
|
274
291
|
function SignUp({
|
|
275
292
|
className,
|
|
276
293
|
config,
|
|
277
294
|
defaultIdentifier,
|
|
278
|
-
description
|
|
295
|
+
description,
|
|
279
296
|
identifiers,
|
|
280
297
|
logo,
|
|
281
298
|
onAuthError,
|
|
@@ -286,9 +303,10 @@ function SignUp({
|
|
|
286
303
|
style,
|
|
287
304
|
surface,
|
|
288
305
|
testID,
|
|
289
|
-
title
|
|
306
|
+
title,
|
|
290
307
|
tokens
|
|
291
308
|
}) {
|
|
309
|
+
const t = (0, import_react2.useAuthTranslation)(config);
|
|
292
310
|
const controller = (0, import_react2.useSignUpController)({
|
|
293
311
|
config,
|
|
294
312
|
defaultIdentifier,
|
|
@@ -298,6 +316,8 @@ function SignUp({
|
|
|
298
316
|
onSuccess,
|
|
299
317
|
services
|
|
300
318
|
});
|
|
319
|
+
if (description === void 0) description = t("auth.signUpDescription");
|
|
320
|
+
if (title === void 0) title = t("auth.signUp");
|
|
301
321
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
302
322
|
import_internal.AuthPanel,
|
|
303
323
|
{
|
|
@@ -313,7 +333,7 @@ function SignUp({
|
|
|
313
333
|
import_internal.AuthSelector,
|
|
314
334
|
{
|
|
315
335
|
onChange: controller.setIdentifierType,
|
|
316
|
-
options: (0, import_internal.contactOptions)(controller.identifiers),
|
|
336
|
+
options: (0, import_internal.contactOptions)(controller.identifiers, controller.config),
|
|
317
337
|
value: controller.identifierType
|
|
318
338
|
}
|
|
319
339
|
), /* @__PURE__ */ import_react.default.createElement(
|
|
@@ -328,6 +348,7 @@ function SignUp({
|
|
|
328
348
|
), /* @__PURE__ */ import_react.default.createElement(
|
|
329
349
|
import_internal.VerificationCodeInput,
|
|
330
350
|
{
|
|
351
|
+
config: controller.config,
|
|
331
352
|
codeLength: controller.config.code.length,
|
|
332
353
|
countdown: controller.countdown,
|
|
333
354
|
disabled: controller.submitting,
|
|
@@ -337,22 +358,22 @@ function SignUp({
|
|
|
337
358
|
sending: controller.sendingCode,
|
|
338
359
|
value: controller.code
|
|
339
360
|
}
|
|
340
|
-
), /* @__PURE__ */ import_react.default.createElement(import_internal.AuthField, { error: controller.fieldErrors.password, label: "
|
|
361
|
+
), /* @__PURE__ */ import_react.default.createElement(import_internal.AuthField, { error: controller.fieldErrors.password, label: t("auth.password") }, /* @__PURE__ */ import_react.default.createElement(
|
|
341
362
|
import_inputItem.InputItem,
|
|
342
363
|
{
|
|
343
|
-
error: controller.fieldErrors.password,
|
|
364
|
+
error: Boolean(controller.fieldErrors.password),
|
|
344
365
|
onChange: controller.setPassword,
|
|
345
|
-
placeholder:
|
|
366
|
+
placeholder: t("auth.passwordHint", { length: controller.config.password.minLength }),
|
|
346
367
|
size: "large",
|
|
347
368
|
type: "password",
|
|
348
369
|
value: controller.password
|
|
349
370
|
}
|
|
350
|
-
)), /* @__PURE__ */ import_react.default.createElement(import_internal.AuthField, { error: controller.fieldErrors.confirmPassword, label: "
|
|
371
|
+
)), /* @__PURE__ */ import_react.default.createElement(import_internal.AuthField, { error: controller.fieldErrors.confirmPassword, label: t("auth.confirmPassword") }, /* @__PURE__ */ import_react.default.createElement(
|
|
351
372
|
import_inputItem.InputItem,
|
|
352
373
|
{
|
|
353
|
-
error: controller.fieldErrors.confirmPassword,
|
|
374
|
+
error: Boolean(controller.fieldErrors.confirmPassword),
|
|
354
375
|
onChange: controller.setConfirmPassword,
|
|
355
|
-
placeholder: "
|
|
376
|
+
placeholder: t("auth.repeatPassword"),
|
|
356
377
|
size: "large",
|
|
357
378
|
type: "password",
|
|
358
379
|
value: controller.confirmPassword
|
|
@@ -364,7 +385,7 @@ function SignUp({
|
|
|
364
385
|
key: agreement.id,
|
|
365
386
|
onChange: (checked) => controller.toggleAgreement(agreement.id, checked)
|
|
366
387
|
},
|
|
367
|
-
agreement.href ? /* @__PURE__ */ import_react.default.createElement(import_button.Button, { href: agreement.href, size: "small", type: "link" }, agreement.label) : agreement.label
|
|
388
|
+
agreement.href ? /* @__PURE__ */ import_react.default.createElement(import_button.Button, { href: agreement.href, size: "small", type: "link", compact: true }, agreement.label) : agreement.label
|
|
368
389
|
)))) : null, /* @__PURE__ */ import_react.default.createElement(
|
|
369
390
|
import_button.Button,
|
|
370
391
|
{
|
|
@@ -373,13 +394,14 @@ function SignUp({
|
|
|
373
394
|
onClick: () => void controller.submit(),
|
|
374
395
|
size: "large"
|
|
375
396
|
},
|
|
376
|
-
"
|
|
377
|
-
), onSignIn ? /* @__PURE__ */ import_react.default.createElement(InlineFooter, null, /* @__PURE__ */ import_react.default.createElement(import_components.Text, null, "
|
|
397
|
+
t("auth.signUp")
|
|
398
|
+
), onSignIn ? /* @__PURE__ */ import_react.default.createElement(InlineFooter, null, /* @__PURE__ */ import_react.default.createElement(import_components.Text, null, t("auth.hasAccount")), /* @__PURE__ */ import_react.default.createElement(import_button.Button, { onClick: onSignIn, size: "small", type: "link", compact: true }, t("auth.goSignIn"))) : null)
|
|
378
399
|
);
|
|
379
400
|
}
|
|
380
401
|
function ForgotPassword({
|
|
381
402
|
className,
|
|
382
403
|
config,
|
|
404
|
+
description,
|
|
383
405
|
defaultIdentifier,
|
|
384
406
|
identifiers,
|
|
385
407
|
onAuthError,
|
|
@@ -390,9 +412,10 @@ function ForgotPassword({
|
|
|
390
412
|
style,
|
|
391
413
|
surface,
|
|
392
414
|
testID,
|
|
393
|
-
title
|
|
415
|
+
title,
|
|
394
416
|
tokens
|
|
395
417
|
}) {
|
|
418
|
+
const t = (0, import_react2.useAuthTranslation)(config);
|
|
396
419
|
const controller = (0, import_react2.useForgotPasswordController)({
|
|
397
420
|
config,
|
|
398
421
|
defaultIdentifier,
|
|
@@ -402,18 +425,32 @@ function ForgotPassword({
|
|
|
402
425
|
onSuccess,
|
|
403
426
|
services
|
|
404
427
|
});
|
|
428
|
+
if (title === void 0) title = t("auth.forgotPassword");
|
|
405
429
|
const activeStep = controller.step === "verify" ? 0 : controller.step === "reset" ? 1 : 2;
|
|
406
430
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
407
431
|
import_internal.AuthPanel,
|
|
408
432
|
{
|
|
409
433
|
className,
|
|
410
|
-
description: "
|
|
434
|
+
description: description === void 0 ? t("auth.forgotDescription") : description,
|
|
411
435
|
style: useAuthStyle(tokens, style),
|
|
412
436
|
surface,
|
|
413
437
|
testID,
|
|
414
438
|
title
|
|
415
439
|
},
|
|
416
|
-
/* @__PURE__ */ import_react.default.createElement(import_components.View, { ariaLabel: "
|
|
440
|
+
/* @__PURE__ */ import_react.default.createElement(import_components.View, { ariaLabel: t("auth.forgotSteps"), className: "x-taro-auth-steps" }, [
|
|
441
|
+
t(controller.verifiesBeforeReset ? "auth.verifyIdentity" : "auth.code"),
|
|
442
|
+
t("auth.setPassword"),
|
|
443
|
+
t("auth.done")
|
|
444
|
+
].map((label, index) => /* @__PURE__ */ import_react.default.createElement(
|
|
445
|
+
import_components.View,
|
|
446
|
+
{
|
|
447
|
+
className: "x-taro-auth-step",
|
|
448
|
+
"data-active": index === activeStep ? "true" : "false",
|
|
449
|
+
key: label
|
|
450
|
+
},
|
|
451
|
+
/* @__PURE__ */ import_react.default.createElement(import_components.Text, { className: "x-taro-auth-step__number" }, index + 1),
|
|
452
|
+
/* @__PURE__ */ import_react.default.createElement(import_components.Text, null, label)
|
|
453
|
+
))),
|
|
417
454
|
/* @__PURE__ */ import_react.default.createElement(
|
|
418
455
|
import_components.View,
|
|
419
456
|
{
|
|
@@ -426,7 +463,7 @@ function ForgotPassword({
|
|
|
426
463
|
import_internal.AuthSelector,
|
|
427
464
|
{
|
|
428
465
|
onChange: controller.setIdentifierType,
|
|
429
|
-
options: (0, import_internal.contactOptions)(controller.identifiers),
|
|
466
|
+
options: (0, import_internal.contactOptions)(controller.identifiers, controller.config),
|
|
430
467
|
value: controller.identifierType
|
|
431
468
|
}
|
|
432
469
|
), /* @__PURE__ */ import_react.default.createElement(
|
|
@@ -441,6 +478,7 @@ function ForgotPassword({
|
|
|
441
478
|
), /* @__PURE__ */ import_react.default.createElement(
|
|
442
479
|
import_internal.VerificationCodeInput,
|
|
443
480
|
{
|
|
481
|
+
config: controller.config,
|
|
444
482
|
codeLength: controller.config.code.length,
|
|
445
483
|
countdown: controller.countdown,
|
|
446
484
|
error: controller.fieldErrors.code,
|
|
@@ -457,36 +495,57 @@ function ForgotPassword({
|
|
|
457
495
|
onClick: () => void controller.submitVerify(),
|
|
458
496
|
size: "large"
|
|
459
497
|
},
|
|
460
|
-
"
|
|
461
|
-
)) : controller.step === "reset" ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_internal.AuthField, { error: controller.fieldErrors.newPassword, label: "
|
|
498
|
+
t("auth.next")
|
|
499
|
+
)) : controller.step === "reset" ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_internal.AuthField, { error: controller.fieldErrors.newPassword, label: t("auth.newPassword") }, /* @__PURE__ */ import_react.default.createElement(
|
|
462
500
|
import_inputItem.InputItem,
|
|
463
501
|
{
|
|
464
|
-
error: controller.fieldErrors.newPassword,
|
|
502
|
+
error: Boolean(controller.fieldErrors.newPassword),
|
|
465
503
|
onChange: controller.setNewPassword,
|
|
466
|
-
placeholder:
|
|
504
|
+
placeholder: t("auth.passwordHint", {
|
|
505
|
+
length: controller.config.password.minLength
|
|
506
|
+
}),
|
|
467
507
|
size: "large",
|
|
468
508
|
type: "password",
|
|
469
509
|
value: controller.newPassword
|
|
470
510
|
}
|
|
471
|
-
)), /* @__PURE__ */ import_react.default.createElement(
|
|
472
|
-
|
|
511
|
+
)), /* @__PURE__ */ import_react.default.createElement(
|
|
512
|
+
import_internal.AuthField,
|
|
473
513
|
{
|
|
474
514
|
error: controller.fieldErrors.confirmPassword,
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
515
|
+
label: t("auth.confirmNewPassword")
|
|
516
|
+
},
|
|
517
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
518
|
+
import_inputItem.InputItem,
|
|
519
|
+
{
|
|
520
|
+
error: Boolean(controller.fieldErrors.confirmPassword),
|
|
521
|
+
onChange: controller.setConfirmPassword,
|
|
522
|
+
placeholder: t("auth.repeatNewPassword"),
|
|
523
|
+
size: "large",
|
|
524
|
+
type: "password",
|
|
525
|
+
value: controller.confirmPassword
|
|
526
|
+
}
|
|
527
|
+
)
|
|
528
|
+
), /* @__PURE__ */ import_react.default.createElement(import_components.View, { className: "x-taro-auth-form__actions" }, /* @__PURE__ */ import_react.default.createElement(
|
|
529
|
+
import_button.Button,
|
|
530
|
+
{
|
|
531
|
+
onClick: controller.back,
|
|
532
|
+
style: { alignSelf: "center" },
|
|
533
|
+
size: "small",
|
|
534
|
+
type: "link",
|
|
535
|
+
compact: true,
|
|
536
|
+
disabled: controller.submitting
|
|
537
|
+
},
|
|
538
|
+
t("auth.previous")
|
|
539
|
+
), /* @__PURE__ */ import_react.default.createElement(
|
|
482
540
|
import_button.Button,
|
|
483
541
|
{
|
|
484
542
|
loading: controller.submitting,
|
|
485
543
|
onClick: () => void controller.submitReset(),
|
|
486
|
-
size: "
|
|
544
|
+
size: "large",
|
|
545
|
+
block: true
|
|
487
546
|
},
|
|
488
|
-
"
|
|
489
|
-
))) : /* @__PURE__ */ import_react.default.createElement(import_components.View, { className: "x-taro-auth-success" }, /* @__PURE__ */ import_react.default.createElement(import_components.Text, { className: "x-taro-auth-success__title" }, "
|
|
547
|
+
t("auth.resetPassword")
|
|
548
|
+
))) : /* @__PURE__ */ import_react.default.createElement(import_components.View, { className: "x-taro-auth-success" }, /* @__PURE__ */ import_react.default.createElement(import_icon.Icon, { name: "CircleCheck", size: 40 }), /* @__PURE__ */ import_react.default.createElement(import_components.Text, { className: "x-taro-auth-success__title" }, t("auth.passwordReset")), /* @__PURE__ */ import_react.default.createElement(import_components.Text, null, t("auth.passwordResetDescription")), onBackToSignIn ? /* @__PURE__ */ import_react.default.createElement(import_button.Button, { block: true, onClick: onBackToSignIn, size: "large" }, t("auth.backToSignIn")) : null)
|
|
490
549
|
)
|
|
491
550
|
);
|
|
492
551
|
}
|
|
@@ -494,9 +553,9 @@ function QuickSignIn({
|
|
|
494
553
|
autoSubmitCode = true,
|
|
495
554
|
className,
|
|
496
555
|
config,
|
|
497
|
-
description
|
|
556
|
+
description,
|
|
498
557
|
footer,
|
|
499
|
-
identifierSubmitText
|
|
558
|
+
identifierSubmitText,
|
|
500
559
|
identifierType = "phone",
|
|
501
560
|
initialIdentifier,
|
|
502
561
|
onAuthError,
|
|
@@ -507,12 +566,13 @@ function QuickSignIn({
|
|
|
507
566
|
services,
|
|
508
567
|
showHeader = true,
|
|
509
568
|
style,
|
|
510
|
-
submitText
|
|
569
|
+
submitText,
|
|
511
570
|
surface = "plain",
|
|
512
571
|
testID,
|
|
513
|
-
title
|
|
572
|
+
title,
|
|
514
573
|
tokens
|
|
515
574
|
}) {
|
|
575
|
+
const t = (0, import_react2.useAuthTranslation)(config);
|
|
516
576
|
const controller = (0, import_react2.useQuickSignInController)({
|
|
517
577
|
config,
|
|
518
578
|
defaultIdentifier: identifierType,
|
|
@@ -524,6 +584,14 @@ function QuickSignIn({
|
|
|
524
584
|
onSuccess,
|
|
525
585
|
services
|
|
526
586
|
});
|
|
587
|
+
if (description === void 0)
|
|
588
|
+
description = t("auth.quickDescription", {
|
|
589
|
+
label: (0, import_identifier.identifierLabel)(identifierType, controller.config)
|
|
590
|
+
});
|
|
591
|
+
if (identifierSubmitText === void 0) identifierSubmitText = t("auth.continue");
|
|
592
|
+
if (submitText === void 0) submitText = t("auth.continue");
|
|
593
|
+
if (title === void 0)
|
|
594
|
+
title = t("auth.quickTitle", { label: (0, import_identifier.identifierLabel)(identifierType, controller.config) });
|
|
527
595
|
const submittedCodeRef = (0, import_react.useRef)("");
|
|
528
596
|
(0, import_react.useEffect)(() => {
|
|
529
597
|
if (autoSubmitCode && controller.step === "code" && controller.code.length === controller.config.code.length && submittedCodeRef.current !== controller.code) {
|
|
@@ -546,30 +614,36 @@ function QuickSignIn({
|
|
|
546
614
|
"data-direction": controller.direction,
|
|
547
615
|
key: controller.revision
|
|
548
616
|
},
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
{
|
|
552
|
-
ariaLabel: "返回修改账号",
|
|
553
|
-
className: "x-taro-auth-quick__back",
|
|
554
|
-
onClick: controller.back,
|
|
555
|
-
shape: "round",
|
|
556
|
-
size: "small",
|
|
557
|
-
type: "ghost"
|
|
558
|
-
},
|
|
559
|
-
"←"
|
|
560
|
-
) : onClose ? /* @__PURE__ */ import_react.default.createElement(
|
|
561
|
-
import_button.Button,
|
|
617
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
618
|
+
import_components.View,
|
|
562
619
|
{
|
|
563
|
-
|
|
564
|
-
className: "x-taro-auth-quick__close",
|
|
565
|
-
onClick: onClose,
|
|
566
|
-
shape: "round",
|
|
567
|
-
size: "small",
|
|
568
|
-
type: "ghost"
|
|
620
|
+
className: `x-taro-auth-quick__nav x-taro-auth-quick__nav--${controller.step === "code" ? "back" : "close"}`
|
|
569
621
|
},
|
|
570
|
-
"
|
|
571
|
-
|
|
572
|
-
|
|
622
|
+
controller.step === "code" ? /* @__PURE__ */ import_react.default.createElement(
|
|
623
|
+
import_button.Button,
|
|
624
|
+
{
|
|
625
|
+
ariaLabel: t("auth.editIdentifier"),
|
|
626
|
+
className: "x-taro-auth-quick__back",
|
|
627
|
+
onClick: controller.back,
|
|
628
|
+
shape: "round",
|
|
629
|
+
size: "small",
|
|
630
|
+
type: "ghost"
|
|
631
|
+
},
|
|
632
|
+
/* @__PURE__ */ import_react.default.createElement(import_icon.Icon, { name: "ChevronLeft", size: 18 })
|
|
633
|
+
) : onClose ? /* @__PURE__ */ import_react.default.createElement(
|
|
634
|
+
import_button.Button,
|
|
635
|
+
{
|
|
636
|
+
ariaLabel: t("auth.close"),
|
|
637
|
+
className: "x-taro-auth-quick__close",
|
|
638
|
+
onClick: onClose,
|
|
639
|
+
shape: "round",
|
|
640
|
+
size: "small",
|
|
641
|
+
type: "ghost"
|
|
642
|
+
},
|
|
643
|
+
/* @__PURE__ */ import_react.default.createElement(import_icon.Icon, { name: "X", size: 18 })
|
|
644
|
+
) : null
|
|
645
|
+
),
|
|
646
|
+
showHeader ? /* @__PURE__ */ import_react.default.createElement(import_components.View, { className: "x-taro-auth-quick__header" }, /* @__PURE__ */ import_react.default.createElement(import_components.Text, { className: "x-taro-auth-quick__title" }, controller.step === "identifier" ? title : t("auth.quickCodeTitle", { length: controller.config.code.length })), /* @__PURE__ */ import_react.default.createElement(import_components.Text, { className: "x-taro-auth-quick__description" }, controller.step === "identifier" ? description : t("auth.codeSent", { identifier: controller.identifierValue }))) : null,
|
|
573
647
|
/* @__PURE__ */ import_react.default.createElement(import_components.View, { className: "x-taro-auth-form" }, /* @__PURE__ */ import_react.default.createElement(import_internal.AuthError, null, controller.error), controller.step === "identifier" ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
|
|
574
648
|
import_internal.IdentifierInput,
|
|
575
649
|
{
|
|
@@ -591,6 +665,7 @@ function QuickSignIn({
|
|
|
591
665
|
)) : /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
|
|
592
666
|
import_internal.VerificationCodeInput,
|
|
593
667
|
{
|
|
668
|
+
config: controller.config,
|
|
594
669
|
codeLength: controller.config.code.length,
|
|
595
670
|
countdown: controller.countdown,
|
|
596
671
|
error: controller.fieldErrors.code,
|
|
@@ -686,6 +761,7 @@ function IdentifierBinding({
|
|
|
686
761
|
title,
|
|
687
762
|
tokens
|
|
688
763
|
}) {
|
|
764
|
+
const t = (0, import_react2.useAuthTranslation)(config);
|
|
689
765
|
const controller = (0, import_react2.useIdentifierBindingController)({
|
|
690
766
|
action,
|
|
691
767
|
config,
|
|
@@ -696,28 +772,35 @@ function IdentifierBinding({
|
|
|
696
772
|
requireReauthentication,
|
|
697
773
|
services
|
|
698
774
|
});
|
|
699
|
-
const label = (0, import_identifier.identifierLabel)(identifierType);
|
|
775
|
+
const label = (0, import_identifier.identifierLabel)(identifierType, controller.config);
|
|
700
776
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
701
777
|
import_internal.AuthPanel,
|
|
702
778
|
{
|
|
703
779
|
className,
|
|
704
|
-
description: action === "change" && currentDisplayValue ?
|
|
780
|
+
description: action === "change" && currentDisplayValue ? t("auth.currentIdentifier", { label, value: currentDisplayValue }) : t(action === "bind" ? "auth.bindDescription" : "auth.replaceDescription", { label }),
|
|
705
781
|
style: useAuthStyle(tokens, style),
|
|
706
782
|
surface,
|
|
707
783
|
testID,
|
|
708
|
-
title: title
|
|
784
|
+
title: title === void 0 ? t(action === "bind" ? "auth.bindTitle" : "auth.replaceTitle", { label }) : title
|
|
709
785
|
},
|
|
710
|
-
/* @__PURE__ */ import_react.default.createElement(import_components.View, { className: "x-taro-auth-form" }, /* @__PURE__ */ import_react.default.createElement(import_internal.AuthError, null, controller.error), controller.shouldReauthenticate ? /* @__PURE__ */ import_react.default.createElement(
|
|
711
|
-
|
|
786
|
+
/* @__PURE__ */ import_react.default.createElement(import_components.View, { className: "x-taro-auth-form" }, /* @__PURE__ */ import_react.default.createElement(import_internal.AuthError, null, controller.error), controller.shouldReauthenticate ? /* @__PURE__ */ import_react.default.createElement(
|
|
787
|
+
import_internal.AuthField,
|
|
712
788
|
{
|
|
713
789
|
error: controller.fieldErrors.currentPassword,
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
790
|
+
label: t("auth.currentPassword")
|
|
791
|
+
},
|
|
792
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
793
|
+
import_inputItem.InputItem,
|
|
794
|
+
{
|
|
795
|
+
error: Boolean(controller.fieldErrors.currentPassword),
|
|
796
|
+
onChange: controller.setCurrentPassword,
|
|
797
|
+
placeholder: t("auth.enter", { label: t("auth.currentPassword") }),
|
|
798
|
+
size: "large",
|
|
799
|
+
type: "password",
|
|
800
|
+
value: controller.currentPassword
|
|
801
|
+
}
|
|
802
|
+
)
|
|
803
|
+
) : null, /* @__PURE__ */ import_react.default.createElement(
|
|
721
804
|
import_internal.IdentifierInput,
|
|
722
805
|
{
|
|
723
806
|
config: controller.config,
|
|
@@ -729,6 +812,7 @@ function IdentifierBinding({
|
|
|
729
812
|
), /* @__PURE__ */ import_react.default.createElement(
|
|
730
813
|
import_internal.VerificationCodeInput,
|
|
731
814
|
{
|
|
815
|
+
config: controller.config,
|
|
732
816
|
codeLength: controller.config.code.length,
|
|
733
817
|
countdown: controller.countdown,
|
|
734
818
|
error: controller.fieldErrors.code,
|
|
@@ -737,22 +821,33 @@ function IdentifierBinding({
|
|
|
737
821
|
sending: controller.sendingCode,
|
|
738
822
|
value: controller.code
|
|
739
823
|
}
|
|
740
|
-
), /* @__PURE__ */ import_react.default.createElement(import_components.View, { className: "x-taro-auth-form__actions" }, onCancel ? /* @__PURE__ */ import_react.default.createElement(
|
|
824
|
+
), /* @__PURE__ */ import_react.default.createElement(import_components.View, { className: "x-taro-auth-form__actions" }, onCancel ? /* @__PURE__ */ import_react.default.createElement(
|
|
825
|
+
import_button.Button,
|
|
826
|
+
{
|
|
827
|
+
onClick: onCancel,
|
|
828
|
+
style: { alignSelf: "center" },
|
|
829
|
+
size: "small",
|
|
830
|
+
type: "link",
|
|
831
|
+
compact: true,
|
|
832
|
+
disabled: controller.submitting
|
|
833
|
+
},
|
|
834
|
+
t("auth.cancel")
|
|
835
|
+
) : null, /* @__PURE__ */ import_react.default.createElement(
|
|
741
836
|
import_button.Button,
|
|
742
837
|
{
|
|
743
838
|
loading: controller.submitting,
|
|
744
839
|
onClick: () => void controller.submit(),
|
|
745
|
-
size: "
|
|
840
|
+
size: "large",
|
|
841
|
+
block: true
|
|
746
842
|
},
|
|
747
|
-
"
|
|
748
|
-
action === "bind" ? "绑定" : "更换"
|
|
843
|
+
t(action === "bind" ? "auth.confirmBind" : "auth.confirmReplace")
|
|
749
844
|
)))
|
|
750
845
|
);
|
|
751
846
|
}
|
|
752
847
|
function ChangePassword({
|
|
753
848
|
className,
|
|
754
849
|
config,
|
|
755
|
-
description
|
|
850
|
+
description,
|
|
756
851
|
onAuthError,
|
|
757
852
|
onCancel,
|
|
758
853
|
onReauthenticationRequired,
|
|
@@ -762,9 +857,10 @@ function ChangePassword({
|
|
|
762
857
|
style,
|
|
763
858
|
surface,
|
|
764
859
|
testID,
|
|
765
|
-
title
|
|
860
|
+
title,
|
|
766
861
|
tokens
|
|
767
862
|
}) {
|
|
863
|
+
const t = (0, import_react2.useAuthTranslation)(config);
|
|
768
864
|
const controller = (0, import_react2.useChangePasswordController)({
|
|
769
865
|
config,
|
|
770
866
|
onAuthError,
|
|
@@ -773,6 +869,8 @@ function ChangePassword({
|
|
|
773
869
|
requireCurrentPassword,
|
|
774
870
|
services
|
|
775
871
|
});
|
|
872
|
+
if (description === void 0) description = t("auth.changePasswordDescription");
|
|
873
|
+
if (title === void 0) title = t("auth.changePassword");
|
|
776
874
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
777
875
|
import_internal.AuthPanel,
|
|
778
876
|
{
|
|
@@ -783,51 +881,77 @@ function ChangePassword({
|
|
|
783
881
|
testID,
|
|
784
882
|
title
|
|
785
883
|
},
|
|
786
|
-
/* @__PURE__ */ import_react.default.createElement(import_components.View, { className: "x-taro-auth-form" }, /* @__PURE__ */ import_react.default.createElement(import_internal.AuthError, null, controller.error), controller.requireCurrentPassword ? /* @__PURE__ */ import_react.default.createElement(
|
|
787
|
-
|
|
884
|
+
/* @__PURE__ */ import_react.default.createElement(import_components.View, { className: "x-taro-auth-form" }, /* @__PURE__ */ import_react.default.createElement(import_internal.AuthError, null, controller.error), controller.requireCurrentPassword ? /* @__PURE__ */ import_react.default.createElement(
|
|
885
|
+
import_internal.AuthField,
|
|
788
886
|
{
|
|
789
887
|
error: controller.fieldErrors.currentPassword,
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
888
|
+
label: t("auth.currentPassword")
|
|
889
|
+
},
|
|
890
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
891
|
+
import_inputItem.InputItem,
|
|
892
|
+
{
|
|
893
|
+
error: Boolean(controller.fieldErrors.currentPassword),
|
|
894
|
+
onChange: controller.setCurrentPassword,
|
|
895
|
+
placeholder: t("auth.enter", { label: t("auth.currentPassword") }),
|
|
896
|
+
size: "large",
|
|
897
|
+
type: "password",
|
|
898
|
+
value: controller.currentPassword
|
|
899
|
+
}
|
|
900
|
+
)
|
|
901
|
+
) : null, /* @__PURE__ */ import_react.default.createElement(import_internal.AuthField, { error: controller.fieldErrors.newPassword, label: t("auth.newPassword") }, /* @__PURE__ */ import_react.default.createElement(
|
|
797
902
|
import_inputItem.InputItem,
|
|
798
903
|
{
|
|
799
|
-
error: controller.fieldErrors.newPassword,
|
|
904
|
+
error: Boolean(controller.fieldErrors.newPassword),
|
|
800
905
|
onChange: controller.setNewPassword,
|
|
801
|
-
placeholder:
|
|
906
|
+
placeholder: t("auth.passwordHint", { length: controller.config.password.minLength }),
|
|
802
907
|
size: "large",
|
|
803
908
|
type: "password",
|
|
804
909
|
value: controller.newPassword
|
|
805
910
|
}
|
|
806
|
-
)), /* @__PURE__ */ import_react.default.createElement(
|
|
807
|
-
|
|
911
|
+
)), /* @__PURE__ */ import_react.default.createElement(
|
|
912
|
+
import_internal.AuthField,
|
|
808
913
|
{
|
|
809
914
|
error: controller.fieldErrors.confirmPassword,
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
915
|
+
label: t("auth.confirmNewPassword")
|
|
916
|
+
},
|
|
917
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
918
|
+
import_inputItem.InputItem,
|
|
919
|
+
{
|
|
920
|
+
error: Boolean(controller.fieldErrors.confirmPassword),
|
|
921
|
+
onChange: controller.setConfirmPassword,
|
|
922
|
+
placeholder: t("auth.repeatNewPassword"),
|
|
923
|
+
size: "large",
|
|
924
|
+
type: "password",
|
|
925
|
+
value: controller.confirmPassword
|
|
926
|
+
}
|
|
927
|
+
)
|
|
928
|
+
), /* @__PURE__ */ import_react.default.createElement(import_components.View, { className: "x-taro-auth-form__actions" }, onCancel ? /* @__PURE__ */ import_react.default.createElement(
|
|
929
|
+
import_button.Button,
|
|
930
|
+
{
|
|
931
|
+
onClick: onCancel,
|
|
932
|
+
style: { alignSelf: "center" },
|
|
933
|
+
size: "small",
|
|
934
|
+
type: "link",
|
|
935
|
+
compact: true,
|
|
936
|
+
disabled: controller.submitting
|
|
937
|
+
},
|
|
938
|
+
t("auth.cancel")
|
|
939
|
+
) : null, /* @__PURE__ */ import_react.default.createElement(
|
|
817
940
|
import_button.Button,
|
|
818
941
|
{
|
|
819
942
|
loading: controller.submitting,
|
|
820
943
|
onClick: () => void controller.submit(),
|
|
821
|
-
size: "
|
|
944
|
+
size: "large",
|
|
945
|
+
block: true
|
|
822
946
|
},
|
|
823
|
-
"
|
|
947
|
+
t("auth.confirmChange")
|
|
824
948
|
)))
|
|
825
949
|
);
|
|
826
950
|
}
|
|
827
951
|
function AccountSecurity({
|
|
828
952
|
className,
|
|
829
953
|
config,
|
|
830
|
-
description
|
|
954
|
+
description,
|
|
831
955
|
onAuthError,
|
|
832
956
|
onReauthenticationRequired,
|
|
833
957
|
onStateChange,
|
|
@@ -835,10 +959,11 @@ function AccountSecurity({
|
|
|
835
959
|
state,
|
|
836
960
|
style,
|
|
837
961
|
testID,
|
|
838
|
-
title
|
|
962
|
+
title,
|
|
839
963
|
tokens
|
|
840
964
|
}) {
|
|
841
965
|
var _a, _b;
|
|
966
|
+
const t = (0, import_react2.useAuthTranslation)(config);
|
|
842
967
|
const controller = (0, import_react2.useAccountSecurityController)({
|
|
843
968
|
config,
|
|
844
969
|
onAuthError,
|
|
@@ -847,6 +972,8 @@ function AccountSecurity({
|
|
|
847
972
|
services,
|
|
848
973
|
state
|
|
849
974
|
});
|
|
975
|
+
if (description === void 0) description = t("auth.securityDescription");
|
|
976
|
+
if (title === void 0) title = t("auth.security");
|
|
850
977
|
const [dialog, setDialog] = (0, import_react.useState)();
|
|
851
978
|
const close = () => setDialog(void 0);
|
|
852
979
|
const complete = async () => {
|
|
@@ -862,16 +989,19 @@ function AccountSecurity({
|
|
|
862
989
|
},
|
|
863
990
|
/* @__PURE__ */ import_react.default.createElement(import_components.View, { className: "x-taro-auth-security__header" }, /* @__PURE__ */ import_react.default.createElement(import_components.Text, { className: "x-taro-auth-security__title" }, title), /* @__PURE__ */ import_react.default.createElement(import_components.Text, { className: "x-taro-auth-security__description" }, description)),
|
|
864
991
|
/* @__PURE__ */ import_react.default.createElement(import_internal.AuthError, null, controller.error),
|
|
865
|
-
controller.loading ? /* @__PURE__ */ import_react.default.createElement(import_components.Text, { className: "x-taro-auth-security__loading" }, "
|
|
992
|
+
controller.loading ? /* @__PURE__ */ import_react.default.createElement(import_components.Text, { className: "x-taro-auth-security__loading" }, t("auth.loading")) : null,
|
|
866
993
|
/* @__PURE__ */ import_react.default.createElement(import_components.View, { className: "x-taro-auth-security__list" }, controller.config.accountSecurity.identifiers.map((type) => {
|
|
867
994
|
var _a2;
|
|
868
995
|
const binding = (_a2 = controller.state) == null ? void 0 : _a2[type];
|
|
869
996
|
const action = (binding == null ? void 0 : binding.bound) ? "change" : "bind";
|
|
870
|
-
return /* @__PURE__ */ import_react.default.createElement(import_components.View, { className: "x-taro-auth-security__row", key: type }, /* @__PURE__ */ import_react.default.createElement(import_components.View, { className: "x-taro-auth-security__content" }, /* @__PURE__ */ import_react.default.createElement(import_components.Text, { className: "x-taro-auth-security__label" }, (0, import_identifier.identifierLabel)(type)), /* @__PURE__ */ import_react.default.createElement(import_components.Text, { className: "x-taro-auth-security__value" }, (binding == null ? void 0 : binding.bound) ?
|
|
871
|
-
}), /* @__PURE__ */ import_react.default.createElement(import_components.View, { className: "x-taro-auth-security__row" }, /* @__PURE__ */ import_react.default.createElement(import_components.View, { className: "x-taro-auth-security__content" }, /* @__PURE__ */ import_react.default.createElement(import_components.Text, { className: "x-taro-auth-security__label" }, "
|
|
997
|
+
return /* @__PURE__ */ import_react.default.createElement(import_components.View, { className: "x-taro-auth-security__row", key: type }, /* @__PURE__ */ import_react.default.createElement(import_components.View, { className: "x-taro-auth-security__content" }, /* @__PURE__ */ import_react.default.createElement(import_components.Text, { className: "x-taro-auth-security__label" }, (0, import_identifier.identifierLabel)(type, controller.config)), /* @__PURE__ */ import_react.default.createElement(import_components.Text, { className: "x-taro-auth-security__value" }, (binding == null ? void 0 : binding.bound) ? binding.displayValue ? t("auth.linkedValue", { value: binding.displayValue }) : t("auth.linked") : t("auth.notLinked"))), /* @__PURE__ */ import_react.default.createElement(import_button.Button, { onClick: () => setDialog({ action, type }), size: "small", type: "outline" }, action === "bind" ? t("auth.bind") : t("auth.replace")));
|
|
998
|
+
}), /* @__PURE__ */ import_react.default.createElement(import_components.View, { className: "x-taro-auth-security__row" }, /* @__PURE__ */ import_react.default.createElement(import_components.View, { className: "x-taro-auth-security__content" }, /* @__PURE__ */ import_react.default.createElement(import_components.Text, { className: "x-taro-auth-security__label" }, t("auth.password")), /* @__PURE__ */ import_react.default.createElement(import_components.Text, { className: "x-taro-auth-security__value" }, ((_a = controller.state) == null ? void 0 : _a.password.set) ? t("auth.passwordSet") : t("auth.notSet"))), /* @__PURE__ */ import_react.default.createElement(import_button.Button, { onClick: () => setDialog({ action: "password" }), size: "small", type: "outline" }, t("auth.edit")))),
|
|
872
999
|
/* @__PURE__ */ import_react.default.createElement(
|
|
873
1000
|
import_modal.Modal,
|
|
874
1001
|
{
|
|
1002
|
+
title: (dialog == null ? void 0 : dialog.action) === "password" ? t("auth.changePassword") : (dialog == null ? void 0 : dialog.type) ? t(dialog.action === "bind" ? "auth.bindTitle" : "auth.replaceTitle", {
|
|
1003
|
+
label: (0, import_identifier.identifierLabel)(dialog.type, controller.config)
|
|
1004
|
+
}) : void 0,
|
|
875
1005
|
body: (dialog == null ? void 0 : dialog.action) === "password" ? /* @__PURE__ */ import_react.default.createElement(
|
|
876
1006
|
ChangePassword,
|
|
877
1007
|
{
|
|
@@ -879,7 +1009,8 @@ function AccountSecurity({
|
|
|
879
1009
|
onCancel: close,
|
|
880
1010
|
onSuccess: () => void complete(),
|
|
881
1011
|
services,
|
|
882
|
-
surface: "plain"
|
|
1012
|
+
surface: "plain",
|
|
1013
|
+
title: null
|
|
883
1014
|
}
|
|
884
1015
|
) : (dialog == null ? void 0 : dialog.type) ? /* @__PURE__ */ import_react.default.createElement(
|
|
885
1016
|
IdentifierBinding,
|
|
@@ -891,7 +1022,8 @@ function AccountSecurity({
|
|
|
891
1022
|
onCancel: close,
|
|
892
1023
|
onSuccess: () => void complete(),
|
|
893
1024
|
services,
|
|
894
|
-
surface: "plain"
|
|
1025
|
+
surface: "plain",
|
|
1026
|
+
title: null
|
|
895
1027
|
}
|
|
896
1028
|
) : null,
|
|
897
1029
|
closeIcon: true,
|