@quantabit/account-type-sdk 1.0.0

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.
@@ -0,0 +1,912 @@
1
+ var QbitDIDAuth = (function (exports, sdkConfig, React) {
2
+ 'use strict';
3
+
4
+ /**
5
+ * Account Type SDK - 类型定义
6
+ */
7
+
8
+ // 账号类型
9
+ const AccountType = {
10
+ PERSONAL: 'personal',
11
+ // 个人账号
12
+ CREATOR: 'creator',
13
+ // 创作者账号
14
+ BUSINESS: 'business',
15
+ // 企业账号
16
+ INSTITUTION: 'institution',
17
+ // 机构账号
18
+ DEVELOPER: 'developer' // 开发者账号
19
+ };
20
+
21
+ // 认证级别
22
+ const VerificationLevel = {
23
+ NONE: 'none',
24
+ BASIC: 'basic',
25
+ VERIFIED: 'verified',
26
+ OFFICIAL: 'official'
27
+ };
28
+
29
+ // 认证标识颜色
30
+ const VerificationBadge$1 = {
31
+ BLUE: 'blue',
32
+ // 蓝V - 个人认证
33
+ YELLOW: 'yellow',
34
+ // 黄V - 企业认证
35
+ RED: 'red',
36
+ // 红V - 官方认证
37
+ PURPLE: 'purple' // 紫V - 机构认证
38
+ };
39
+
40
+ // 申请状态
41
+ const ApplicationStatus = {
42
+ PENDING: 'pending',
43
+ REVIEWING: 'reviewing',
44
+ APPROVED: 'approved',
45
+ REJECTED: 'rejected',
46
+ NEED_INFO: 'need_info'
47
+ };
48
+
49
+ /**
50
+ * 账号类型配置
51
+ */
52
+ const ACCOUNT_TYPE_CONFIG = {
53
+ [AccountType.PERSONAL]: {
54
+ name: '个人账号',
55
+ icon: '👤',
56
+ badge: null,
57
+ features: ['基础功能', '社交互动', '内容发布'],
58
+ limits: {
59
+ dailyPosts: 10,
60
+ followers: 5000
61
+ }
62
+ },
63
+ [AccountType.CREATOR]: {
64
+ name: '创作者账号',
65
+ icon: '✨',
66
+ badge: VerificationBadge$1.BLUE,
67
+ features: ['数据分析', '粉丝运营', '收益提现', '专属标识'],
68
+ limits: {
69
+ dailyPosts: 50,
70
+ followers: null
71
+ },
72
+ requirements: {
73
+ followers: 1000,
74
+ posts: 10
75
+ }
76
+ },
77
+ [AccountType.BUSINESS]: {
78
+ name: '企业账号',
79
+ icon: '🏢',
80
+ badge: VerificationBadge$1.YELLOW,
81
+ features: ['企业主页', '客户管理', '数据面板', '优先客服'],
82
+ limits: {
83
+ dailyPosts: 100,
84
+ followers: null
85
+ },
86
+ requirements: {
87
+ businessLicense: true
88
+ }
89
+ },
90
+ [AccountType.INSTITUTION]: {
91
+ name: '机构账号',
92
+ icon: '🏛️',
93
+ badge: VerificationBadge$1.PURPLE,
94
+ features: ['多账号管理', '团队协作', 'API接入', '专属客服'],
95
+ limits: {
96
+ dailyPosts: 200,
97
+ subAccounts: 50
98
+ },
99
+ requirements: {
100
+ institutionLicense: true
101
+ }
102
+ },
103
+ [AccountType.DEVELOPER]: {
104
+ name: '开发者账号',
105
+ icon: '👨‍💻',
106
+ badge: null,
107
+ features: ['API访问', '开发文档', '沙箱环境', '技术支持'],
108
+ limits: {
109
+ apiCalls: 10000
110
+ },
111
+ requirements: {
112
+ email: true
113
+ }
114
+ }
115
+ };
116
+
117
+ /**
118
+ * 获取账号类型信息
119
+ */
120
+ function getAccountTypeInfo(type) {
121
+ return ACCOUNT_TYPE_CONFIG[type] || ACCOUNT_TYPE_CONFIG[AccountType.PERSONAL];
122
+ }
123
+
124
+ /**
125
+ * 获取认证图标
126
+ */
127
+ function getVerificationBadgeIcon(badge) {
128
+ const icons = {
129
+ [VerificationBadge$1.BLUE]: '✓',
130
+ [VerificationBadge$1.YELLOW]: '✓',
131
+ [VerificationBadge$1.RED]: '★',
132
+ [VerificationBadge$1.PURPLE]: '✓'
133
+ };
134
+ return icons[badge] || '';
135
+ }
136
+
137
+ /**
138
+ * 获取认证颜色
139
+ */
140
+ function getVerificationColor(badge) {
141
+ const colors = {
142
+ [VerificationBadge$1.BLUE]: '#3b82f6',
143
+ [VerificationBadge$1.YELLOW]: '#f59e0b',
144
+ [VerificationBadge$1.RED]: '#ef4444',
145
+ [VerificationBadge$1.PURPLE]: '#8b5cf6'
146
+ };
147
+ return colors[badge] || '#6b7280';
148
+ }
149
+
150
+ /**
151
+ * 检查升级条件
152
+ */
153
+ function checkUpgradeEligibility(currentType, targetType, userStats) {
154
+ const config = ACCOUNT_TYPE_CONFIG[targetType];
155
+ if (!config?.requirements) return {
156
+ eligible: true,
157
+ missing: []
158
+ };
159
+ const missing = [];
160
+ const {
161
+ requirements
162
+ } = config;
163
+ if (requirements.followers && userStats.followers < requirements.followers) {
164
+ missing.push(`粉丝数需达到 ${requirements.followers}`);
165
+ }
166
+ if (requirements.posts && userStats.posts < requirements.posts) {
167
+ missing.push(`发布内容需达到 ${requirements.posts} 条`);
168
+ }
169
+ if (requirements.businessLicense && !userStats.hasBusinessLicense) {
170
+ missing.push('需要营业执照');
171
+ }
172
+ return {
173
+ eligible: missing.length === 0,
174
+ missing
175
+ };
176
+ }
177
+
178
+ /**
179
+ * Account Type SDK - API 客户端
180
+ * 账号类型管理系统后端接口封装
181
+ *
182
+ * 使用 BaseApiClient 基类简化代码
183
+ */
184
+
185
+
186
+ /**
187
+ * 账号类型 API 客户端
188
+ */
189
+ class AccountTypeApiClient extends sdkConfig.BaseApiClient {
190
+ constructor(config = {}) {
191
+ super('/account-type', config);
192
+ }
193
+
194
+ // ============ 账号类型查询 ============
195
+
196
+ /**
197
+ * 获取当前账号类型
198
+ */
199
+ async getMyAccountType() {
200
+ return this.get('/me');
201
+ }
202
+
203
+ /**
204
+ * 获取可用账号类型列表
205
+ */
206
+ async getAvailableTypes() {
207
+ return this.get('/types');
208
+ }
209
+
210
+ /**
211
+ * 获取类型详情
212
+ * @param {string} type - 类型标识
213
+ */
214
+ async getTypeDetails(type) {
215
+ return this.get(`/types/${type}`);
216
+ }
217
+
218
+ /**
219
+ * 获取权益对比
220
+ * @param {string} type1 - 类型1
221
+ * @param {string} type2 - 类型2
222
+ */
223
+ async compareBenefits(type1, type2) {
224
+ return this.get('/compare', {
225
+ type1,
226
+ type2
227
+ });
228
+ }
229
+
230
+ // ============ 升级申请 ============
231
+
232
+ /**
233
+ * 检查升级资格
234
+ * @param {string} targetType - 目标类型
235
+ */
236
+ async checkEligibility(targetType) {
237
+ return this.get('/upgrade/check', {
238
+ type: targetType
239
+ });
240
+ }
241
+
242
+ /**
243
+ * 申请升级
244
+ * @param {string} targetType - 目标类型
245
+ * @param {Object} documents - 证明材料
246
+ */
247
+ async applyUpgrade(targetType, documents = {}) {
248
+ return this.post('/upgrade/apply', {
249
+ targetType,
250
+ documents
251
+ });
252
+ }
253
+
254
+ /**
255
+ * 获取申请状态
256
+ */
257
+ async getApplicationStatus() {
258
+ return this.get('/upgrade/status');
259
+ }
260
+
261
+ /**
262
+ * 取消申请
263
+ * @param {string} applicationId - 申请 ID
264
+ */
265
+ async cancelApplication(applicationId) {
266
+ return this.post(`/upgrade/${applicationId}/cancel`);
267
+ }
268
+
269
+ /**
270
+ * 补充材料
271
+ * @param {string} applicationId - 申请 ID
272
+ * @param {Object} documents - 补充材料
273
+ */
274
+ async submitAdditionalDocs(applicationId, documents) {
275
+ return this.post(`/upgrade/${applicationId}/documents`, {
276
+ documents
277
+ });
278
+ }
279
+
280
+ /**
281
+ * 获取升级历史
282
+ */
283
+ async getUpgradeHistory() {
284
+ return this.get('/upgrade/history');
285
+ }
286
+
287
+ // ============ 认证申请 ============
288
+
289
+ /**
290
+ * 申请企业认证
291
+ * @param {Object} data - 企业信息
292
+ */
293
+ async applyBusinessVerification(data) {
294
+ return this.post('/verification/business', data);
295
+ }
296
+
297
+ /**
298
+ * 申请创作者认证
299
+ * @param {Object} data - 创作者信息
300
+ */
301
+ async applyCreatorVerification(data) {
302
+ return this.post('/verification/creator', data);
303
+ }
304
+
305
+ /**
306
+ * 申请机构认证
307
+ * @param {Object} data - 机构信息
308
+ */
309
+ async applyOrganizationVerification(data) {
310
+ return this.post('/verification/organization', data);
311
+ }
312
+
313
+ /**
314
+ * 获取认证状态
315
+ * @param {string} type - 认证类型
316
+ */
317
+ async getVerificationStatus(type) {
318
+ return this.get(`/verification/${type}/status`);
319
+ }
320
+ }
321
+
322
+ // 创建默认实例
323
+ const accountTypeApi = new AccountTypeApiClient();
324
+
325
+ /**
326
+ * Account Type SDK - 国际化支持
327
+ */
328
+
329
+ const messages = {
330
+ en: {
331
+ accountType: 'Account Type',
332
+ personal: 'Personal',
333
+ creator: 'Creator',
334
+ business: 'Business',
335
+ institution: 'Institution',
336
+ developer: 'Developer',
337
+ currentType: 'Current Type',
338
+ upgrade: 'Upgrade',
339
+ downgrade: 'Downgrade',
340
+ apply: 'Apply',
341
+ cancel: 'Cancel',
342
+ verified: 'Verified',
343
+ unverified: 'Unverified',
344
+ features: 'Features',
345
+ benefits: 'Benefits',
346
+ requirements: 'Requirements',
347
+ applicationPending: 'Application Pending',
348
+ applicationApproved: 'Approved',
349
+ applicationRejected: 'Rejected',
350
+ needMoreInfo: 'Need More Info',
351
+ followers: 'Followers',
352
+ posts: 'Posts',
353
+ businessLicense: 'Business License',
354
+ upgradeSuccess: 'Upgrade Successful!',
355
+ applicationSubmitted: 'Application Submitted'
356
+ },
357
+ zh: {
358
+ accountType: '账号类型',
359
+ personal: '个人账号',
360
+ creator: '创作者',
361
+ business: '企业账号',
362
+ institution: '机构账号',
363
+ developer: '开发者',
364
+ currentType: '当前类型',
365
+ upgrade: '升级',
366
+ downgrade: '降级',
367
+ apply: '申请',
368
+ cancel: '取消',
369
+ verified: '已认证',
370
+ unverified: '未认证',
371
+ features: '功能特权',
372
+ benefits: '权益',
373
+ requirements: '申请条件',
374
+ applicationPending: '申请审核中',
375
+ applicationApproved: '已通过',
376
+ applicationRejected: '已拒绝',
377
+ needMoreInfo: '需要补充材料',
378
+ followers: '粉丝数',
379
+ posts: '发布内容',
380
+ businessLicense: '营业执照',
381
+ upgradeSuccess: '升级成功!',
382
+ applicationSubmitted: '申请已提交'
383
+ },
384
+ ja: {
385
+ accountType: 'アカウントタイプ',
386
+ personal: '個人',
387
+ creator: 'クリエイター',
388
+ business: 'ビジネス',
389
+ institution: '機関',
390
+ developer: '開発者',
391
+ currentType: '現在のタイプ',
392
+ upgrade: 'アップグレード',
393
+ downgrade: 'ダウングレード',
394
+ apply: '申請',
395
+ cancel: 'キャンセル',
396
+ verified: '認証済み',
397
+ unverified: '未認証',
398
+ features: '機能',
399
+ benefits: '特典',
400
+ requirements: '申請条件',
401
+ applicationPending: '審査中',
402
+ applicationApproved: '承認済み',
403
+ applicationRejected: '却下',
404
+ needMoreInfo: '追加情報が必要',
405
+ followers: 'フォロワー',
406
+ posts: '投稿',
407
+ businessLicense: '事業許可証',
408
+ upgradeSuccess: 'アップグレード成功!',
409
+ applicationSubmitted: '申請完了'
410
+ },
411
+ ko: {
412
+ accountType: '계정 유형',
413
+ personal: '개인',
414
+ creator: '크리에이터',
415
+ business: '비즈니스',
416
+ institution: '기관',
417
+ developer: '개발자',
418
+ currentType: '현재 유형',
419
+ upgrade: '업그레이드',
420
+ downgrade: '다운그레이드',
421
+ apply: '신청',
422
+ cancel: '취소',
423
+ verified: '인증됨',
424
+ unverified: '미인증',
425
+ features: '기능',
426
+ benefits: '혜택',
427
+ requirements: '신청 조건',
428
+ applicationPending: '심사 중',
429
+ applicationApproved: '승인됨',
430
+ applicationRejected: '거절됨',
431
+ needMoreInfo: '추가 정보 필요',
432
+ followers: '팔로워',
433
+ posts: '게시물',
434
+ businessLicense: '사업자등록증',
435
+ upgradeSuccess: '업그레이드 성공!',
436
+ applicationSubmitted: '신청 완료'
437
+ }
438
+ };
439
+ const SUPPORTED_LANGUAGES = ['en', 'zh', 'ja', 'ko'];
440
+ let currentLanguage = 'zh';
441
+ function setLanguage(lang) {
442
+ if (SUPPORTED_LANGUAGES.includes(lang)) {
443
+ currentLanguage = lang;
444
+ }
445
+ }
446
+ function getLanguage() {
447
+ return currentLanguage;
448
+ }
449
+ function t(key, params = {}) {
450
+ let text = messages[currentLanguage]?.[key] || messages.en[key] || key;
451
+ Object.keys(params).forEach(param => {
452
+ text = text.replace(`{${param}}`, params[param]);
453
+ });
454
+ return text;
455
+ }
456
+
457
+ /**
458
+ * Account Type SDK - React Hooks
459
+ */
460
+
461
+
462
+ // 获取当前账号类型
463
+ function useAccountType() {
464
+ const [accountType, setAccountType] = React.useState(null);
465
+ const [loading, setLoading] = React.useState(true);
466
+ const [error, setError] = React.useState(null);
467
+ const refresh = React.useCallback(async () => {
468
+ try {
469
+ setLoading(true);
470
+ const data = await accountTypeApi.getMyAccountType();
471
+ setAccountType(data);
472
+ setError(null);
473
+ } catch (err) {
474
+ setError(err.message);
475
+ } finally {
476
+ setLoading(false);
477
+ }
478
+ }, []);
479
+ React.useEffect(() => {
480
+ refresh();
481
+ }, [refresh]);
482
+ return {
483
+ accountType,
484
+ loading,
485
+ error,
486
+ refresh
487
+ };
488
+ }
489
+
490
+ // 获取可用类型
491
+ function useAvailableTypes() {
492
+ const [types, setTypes] = React.useState([]);
493
+ const [loading, setLoading] = React.useState(true);
494
+ const [error, setError] = React.useState(null);
495
+ React.useEffect(() => {
496
+ accountTypeApi.getAvailableTypes().then(setTypes).catch(err => setError(err.message)).finally(() => setLoading(false));
497
+ }, []);
498
+ return {
499
+ types,
500
+ loading,
501
+ error
502
+ };
503
+ }
504
+
505
+ // 升级申请
506
+ function useUpgradeApplication() {
507
+ const [status, setStatus] = React.useState(null);
508
+ const [loading, setLoading] = React.useState(false);
509
+ const [error, setError] = React.useState(null);
510
+ const fetchStatus = React.useCallback(async () => {
511
+ try {
512
+ const data = await accountTypeApi.getApplicationStatus();
513
+ setStatus(data);
514
+ } catch (err) {
515
+ // 可能没有申请记录
516
+ setStatus(null);
517
+ }
518
+ }, []);
519
+ const apply = React.useCallback(async (targetType, documents = {}) => {
520
+ try {
521
+ setLoading(true);
522
+ setError(null);
523
+ const result = await accountTypeApi.applyUpgrade(targetType, documents);
524
+ await fetchStatus();
525
+ return result;
526
+ } catch (err) {
527
+ setError(err.message);
528
+ throw err;
529
+ } finally {
530
+ setLoading(false);
531
+ }
532
+ }, [fetchStatus]);
533
+ const cancel = React.useCallback(async applicationId => {
534
+ try {
535
+ setLoading(true);
536
+ await accountTypeApi.cancelApplication(applicationId);
537
+ await fetchStatus();
538
+ } catch (err) {
539
+ setError(err.message);
540
+ throw err;
541
+ } finally {
542
+ setLoading(false);
543
+ }
544
+ }, [fetchStatus]);
545
+ const submitDocs = React.useCallback(async (applicationId, documents) => {
546
+ try {
547
+ setLoading(true);
548
+ await accountTypeApi.submitAdditionalDocs(applicationId, documents);
549
+ await fetchStatus();
550
+ } catch (err) {
551
+ setError(err.message);
552
+ throw err;
553
+ } finally {
554
+ setLoading(false);
555
+ }
556
+ }, [fetchStatus]);
557
+ React.useEffect(() => {
558
+ fetchStatus();
559
+ }, [fetchStatus]);
560
+ return {
561
+ status,
562
+ apply,
563
+ cancel,
564
+ submitDocs,
565
+ loading,
566
+ error,
567
+ refresh: fetchStatus
568
+ };
569
+ }
570
+
571
+ // 资格检查
572
+ function useEligibilityCheck(targetType) {
573
+ const [eligibility, setEligibility] = React.useState(null);
574
+ const [loading, setLoading] = React.useState(true);
575
+ const [error, setError] = React.useState(null);
576
+ React.useEffect(() => {
577
+ if (!targetType) return;
578
+ accountTypeApi.checkEligibility(targetType).then(setEligibility).catch(err => setError(err.message)).finally(() => setLoading(false));
579
+ }, [targetType]);
580
+ return {
581
+ eligibility,
582
+ loading,
583
+ error
584
+ };
585
+ }
586
+
587
+ // 权益对比
588
+ function useBenefitsComparison(type1, type2) {
589
+ const [comparison, setComparison] = React.useState(null);
590
+ const [loading, setLoading] = React.useState(true);
591
+ const [error, setError] = React.useState(null);
592
+ React.useEffect(() => {
593
+ if (!type1 || !type2) return;
594
+ accountTypeApi.compareBenefits(type1, type2).then(setComparison).catch(err => setError(err.message)).finally(() => setLoading(false));
595
+ }, [type1, type2]);
596
+ return {
597
+ comparison,
598
+ loading,
599
+ error
600
+ };
601
+ }
602
+
603
+ /**
604
+ * 认证徽章
605
+ */
606
+ function VerificationBadge({
607
+ badge,
608
+ size = 'medium'
609
+ }) {
610
+ if (!badge) return null;
611
+ const color = getVerificationColor(badge);
612
+ const icon = getVerificationBadgeIcon(badge);
613
+ const sizeClass = {
614
+ small: 'badge-sm',
615
+ medium: 'badge-md',
616
+ large: 'badge-lg'
617
+ };
618
+ return /*#__PURE__*/React.createElement("span", {
619
+ className: `account-badge ${sizeClass[size]}`,
620
+ style: {
621
+ backgroundColor: color
622
+ }
623
+ }, icon);
624
+ }
625
+
626
+ /**
627
+ * 账号类型卡片
628
+ */
629
+ function AccountTypeCard({
630
+ type,
631
+ isCurrent = false,
632
+ isSelected = false,
633
+ onSelect,
634
+ disabled = false
635
+ }) {
636
+ const info = getAccountTypeInfo(type);
637
+ return /*#__PURE__*/React.createElement("div", {
638
+ className: `account-type-card ${isCurrent ? 'current' : ''} ${isSelected ? 'selected' : ''} ${disabled ? 'disabled' : ''}`,
639
+ onClick: () => !disabled && onSelect?.(type)
640
+ }, isCurrent && /*#__PURE__*/React.createElement("span", {
641
+ className: "account-current-tag"
642
+ }, "\u5F53\u524D"), /*#__PURE__*/React.createElement("div", {
643
+ className: "account-type-icon"
644
+ }, info.icon), /*#__PURE__*/React.createElement("div", {
645
+ className: "account-type-name"
646
+ }, info.name, info.badge && /*#__PURE__*/React.createElement(VerificationBadge, {
647
+ badge: info.badge,
648
+ size: "small"
649
+ })), /*#__PURE__*/React.createElement("ul", {
650
+ className: "account-type-features"
651
+ }, info.features.map((feature, i) => /*#__PURE__*/React.createElement("li", {
652
+ key: i
653
+ }, "\u2713 ", feature))), info.requirements && /*#__PURE__*/React.createElement("div", {
654
+ className: "account-type-requirements"
655
+ }, "\u9700\u8981\u6EE1\u8DB3\u6761\u4EF6"));
656
+ }
657
+
658
+ /**
659
+ * 类型选择器
660
+ */
661
+ function AccountTypeSelector({
662
+ currentType,
663
+ selectedType,
664
+ onSelect,
665
+ types = Object.values(AccountType)
666
+ }) {
667
+ return /*#__PURE__*/React.createElement("div", {
668
+ className: "account-type-selector"
669
+ }, types.map(type => /*#__PURE__*/React.createElement(AccountTypeCard, {
670
+ key: type,
671
+ type: type,
672
+ isCurrent: type === currentType,
673
+ isSelected: type === selectedType,
674
+ onSelect: onSelect
675
+ })));
676
+ }
677
+
678
+ /**
679
+ * 申请状态卡片
680
+ */
681
+ function ApplicationStatusCard({
682
+ application,
683
+ onCancel,
684
+ onSubmitDocs
685
+ }) {
686
+ if (!application) return null;
687
+ const statusConfig = {
688
+ [ApplicationStatus.PENDING]: {
689
+ label: '待审核',
690
+ color: '#f59e0b',
691
+ icon: '⏳'
692
+ },
693
+ [ApplicationStatus.REVIEWING]: {
694
+ label: '审核中',
695
+ color: '#3b82f6',
696
+ icon: '🔍'
697
+ },
698
+ [ApplicationStatus.APPROVED]: {
699
+ label: '已通过',
700
+ color: '#22c55e',
701
+ icon: '✅'
702
+ },
703
+ [ApplicationStatus.REJECTED]: {
704
+ label: '已拒绝',
705
+ color: '#ef4444',
706
+ icon: '❌'
707
+ },
708
+ [ApplicationStatus.NEED_INFO]: {
709
+ label: '需补充材料',
710
+ color: '#f97316',
711
+ icon: '📝'
712
+ }
713
+ };
714
+ const config = statusConfig[application.status] || statusConfig[ApplicationStatus.PENDING];
715
+ const targetInfo = getAccountTypeInfo(application.targetType);
716
+ return /*#__PURE__*/React.createElement("div", {
717
+ className: "account-application-card"
718
+ }, /*#__PURE__*/React.createElement("div", {
719
+ className: "account-application-header"
720
+ }, /*#__PURE__*/React.createElement("span", {
721
+ className: "account-application-target"
722
+ }, targetInfo.icon, " \u5347\u7EA7\u81F3 ", targetInfo.name), /*#__PURE__*/React.createElement("span", {
723
+ className: "account-application-status",
724
+ style: {
725
+ backgroundColor: config.color
726
+ }
727
+ }, config.icon, " ", config.label)), /*#__PURE__*/React.createElement("div", {
728
+ className: "account-application-info"
729
+ }, /*#__PURE__*/React.createElement("div", null, "\u7533\u8BF7\u65F6\u95F4: ", new Date(application.createdAt).toLocaleDateString()), application.message && /*#__PURE__*/React.createElement("div", null, "\u5907\u6CE8: ", application.message)), application.status === ApplicationStatus.NEED_INFO && /*#__PURE__*/React.createElement("button", {
730
+ className: "account-btn primary",
731
+ onClick: () => onSubmitDocs?.(application.id)
732
+ }, "\u8865\u5145\u6750\u6599"), [ApplicationStatus.PENDING, ApplicationStatus.REVIEWING].includes(application.status) && /*#__PURE__*/React.createElement("button", {
733
+ className: "account-btn secondary",
734
+ onClick: () => onCancel?.(application.id)
735
+ }, "\u53D6\u6D88\u7533\u8BF7"));
736
+ }
737
+
738
+ /**
739
+ * 权益对比表
740
+ */
741
+ function BenefitsComparison({
742
+ currentType,
743
+ targetType
744
+ }) {
745
+ const currentInfo = getAccountTypeInfo(currentType);
746
+ const targetInfo = getAccountTypeInfo(targetType);
747
+ return /*#__PURE__*/React.createElement("div", {
748
+ className: "account-comparison"
749
+ }, /*#__PURE__*/React.createElement("div", {
750
+ className: "account-comparison-header"
751
+ }, /*#__PURE__*/React.createElement("div", {
752
+ className: "account-comparison-col"
753
+ }, /*#__PURE__*/React.createElement("span", {
754
+ className: "account-comparison-type current"
755
+ }, currentInfo.icon, " ", currentInfo.name)), /*#__PURE__*/React.createElement("div", {
756
+ className: "account-comparison-arrow"
757
+ }, "\u2192"), /*#__PURE__*/React.createElement("div", {
758
+ className: "account-comparison-col"
759
+ }, /*#__PURE__*/React.createElement("span", {
760
+ className: "account-comparison-type target"
761
+ }, targetInfo.icon, " ", targetInfo.name))), /*#__PURE__*/React.createElement("div", {
762
+ className: "account-comparison-body"
763
+ }, /*#__PURE__*/React.createElement("div", {
764
+ className: "account-comparison-section"
765
+ }, /*#__PURE__*/React.createElement("h4", null, "\u65B0\u589E\u6743\u76CA"), targetInfo.features.filter(f => !currentInfo.features.includes(f)).map((feature, i) => /*#__PURE__*/React.createElement("div", {
766
+ key: i,
767
+ className: "account-comparison-item new"
768
+ }, "\u2728 ", feature)))));
769
+ }
770
+
771
+ /**
772
+ * 升级表单
773
+ */
774
+ function UpgradeForm({
775
+ targetType,
776
+ onSubmit,
777
+ loading = false
778
+ }) {
779
+ const [documents, setDocuments] = React.useState({});
780
+ const info = getAccountTypeInfo(targetType);
781
+ const handleSubmit = e => {
782
+ e.preventDefault();
783
+ onSubmit?.(documents);
784
+ };
785
+ return /*#__PURE__*/React.createElement("form", {
786
+ className: "account-upgrade-form",
787
+ onSubmit: handleSubmit
788
+ }, /*#__PURE__*/React.createElement("h3", null, "\u7533\u8BF7\u5347\u7EA7\u81F3 ", info.name), targetType === AccountType.BUSINESS && /*#__PURE__*/React.createElement("div", {
789
+ className: "account-form-group"
790
+ }, /*#__PURE__*/React.createElement("label", null, "\u8425\u4E1A\u6267\u7167"), /*#__PURE__*/React.createElement("input", {
791
+ type: "file",
792
+ accept: "image/*,.pdf",
793
+ onChange: e => setDocuments({
794
+ ...documents,
795
+ businessLicense: e.target.files[0]
796
+ })
797
+ })), targetType === AccountType.CREATOR && /*#__PURE__*/React.createElement("div", {
798
+ className: "account-form-group"
799
+ }, /*#__PURE__*/React.createElement("label", null, "\u521B\u4F5C\u9886\u57DF"), /*#__PURE__*/React.createElement("select", {
800
+ value: documents.category || '',
801
+ onChange: e => setDocuments({
802
+ ...documents,
803
+ category: e.target.value
804
+ })
805
+ }, /*#__PURE__*/React.createElement("option", {
806
+ value: ""
807
+ }, "\u8BF7\u9009\u62E9"), /*#__PURE__*/React.createElement("option", {
808
+ value: "tech"
809
+ }, "\u79D1\u6280"), /*#__PURE__*/React.createElement("option", {
810
+ value: "lifestyle"
811
+ }, "\u751F\u6D3B"), /*#__PURE__*/React.createElement("option", {
812
+ value: "entertainment"
813
+ }, "\u5A31\u4E50"), /*#__PURE__*/React.createElement("option", {
814
+ value: "education"
815
+ }, "\u6559\u80B2"))), /*#__PURE__*/React.createElement("div", {
816
+ className: "account-form-group"
817
+ }, /*#__PURE__*/React.createElement("label", null, "\u7533\u8BF7\u8BF4\u660E\uFF08\u9009\u586B\uFF09"), /*#__PURE__*/React.createElement("textarea", {
818
+ placeholder: "\u8BF7\u7B80\u8981\u8BF4\u660E\u60A8\u7684\u7533\u8BF7\u7406\u7531",
819
+ value: documents.description || '',
820
+ onChange: e => setDocuments({
821
+ ...documents,
822
+ description: e.target.value
823
+ })
824
+ })), /*#__PURE__*/React.createElement("button", {
825
+ type: "submit",
826
+ className: "account-btn primary large",
827
+ disabled: loading
828
+ }, loading ? '提交中...' : '提交申请'));
829
+ }
830
+
831
+ /**
832
+ * 账号类型页面
833
+ */
834
+ function AccountTypePage({
835
+ currentType,
836
+ application,
837
+ onApply,
838
+ onCancelApplication,
839
+ loading = false
840
+ }) {
841
+ const [selectedType, setSelectedType] = React.useState(null);
842
+ const [showForm, setShowForm] = React.useState(false);
843
+ const handleSelect = type => {
844
+ if (type !== currentType) {
845
+ setSelectedType(type);
846
+ }
847
+ };
848
+ const handleApply = documents => {
849
+ onApply?.(selectedType, documents);
850
+ setShowForm(false);
851
+ };
852
+ return /*#__PURE__*/React.createElement("div", {
853
+ className: "account-type-page"
854
+ }, /*#__PURE__*/React.createElement("h1", null, "\u8D26\u53F7\u7C7B\u578B"), application && /*#__PURE__*/React.createElement(ApplicationStatusCard, {
855
+ application: application,
856
+ onCancel: onCancelApplication
857
+ }), /*#__PURE__*/React.createElement("section", null, /*#__PURE__*/React.createElement("h2", null, "\u9009\u62E9\u8D26\u53F7\u7C7B\u578B"), /*#__PURE__*/React.createElement(AccountTypeSelector, {
858
+ currentType: currentType,
859
+ selectedType: selectedType,
860
+ onSelect: handleSelect
861
+ })), selectedType && selectedType !== currentType && /*#__PURE__*/React.createElement("section", null, /*#__PURE__*/React.createElement(BenefitsComparison, {
862
+ currentType: currentType,
863
+ targetType: selectedType
864
+ }), /*#__PURE__*/React.createElement("button", {
865
+ className: "account-btn primary large",
866
+ onClick: () => setShowForm(true)
867
+ }, "\u7533\u8BF7\u5347\u7EA7")), showForm && /*#__PURE__*/React.createElement("div", {
868
+ className: "account-modal-overlay",
869
+ onClick: () => setShowForm(false)
870
+ }, /*#__PURE__*/React.createElement("div", {
871
+ className: "account-modal",
872
+ onClick: e => e.stopPropagation()
873
+ }, /*#__PURE__*/React.createElement(UpgradeForm, {
874
+ targetType: selectedType,
875
+ onSubmit: handleApply,
876
+ loading: loading
877
+ }))));
878
+ }
879
+
880
+ exports.ACCOUNT_TYPE_CONFIG = ACCOUNT_TYPE_CONFIG;
881
+ exports.AccountType = AccountType;
882
+ exports.AccountTypeApiClient = AccountTypeApiClient;
883
+ exports.AccountTypeCard = AccountTypeCard;
884
+ exports.AccountTypePage = AccountTypePage;
885
+ exports.AccountTypeSelector = AccountTypeSelector;
886
+ exports.ApplicationStatus = ApplicationStatus;
887
+ exports.ApplicationStatusCard = ApplicationStatusCard;
888
+ exports.BenefitsComparison = BenefitsComparison;
889
+ exports.SUPPORTED_LANGUAGES = SUPPORTED_LANGUAGES;
890
+ exports.UpgradeForm = UpgradeForm;
891
+ exports.VerificationBadge = VerificationBadge$1;
892
+ exports.VerificationBadgeComponent = VerificationBadge;
893
+ exports.VerificationLevel = VerificationLevel;
894
+ exports.accountTypeApi = accountTypeApi;
895
+ exports.checkUpgradeEligibility = checkUpgradeEligibility;
896
+ exports.getAccountTypeInfo = getAccountTypeInfo;
897
+ exports.getLanguage = getLanguage;
898
+ exports.getVerificationBadgeIcon = getVerificationBadgeIcon;
899
+ exports.getVerificationColor = getVerificationColor;
900
+ exports.messages = messages;
901
+ exports.setLanguage = setLanguage;
902
+ exports.t = t;
903
+ exports.useAccountType = useAccountType;
904
+ exports.useAvailableTypes = useAvailableTypes;
905
+ exports.useBenefitsComparison = useBenefitsComparison;
906
+ exports.useEligibilityCheck = useEligibilityCheck;
907
+ exports.useUpgradeApplication = useUpgradeApplication;
908
+
909
+ return exports;
910
+
911
+ })({}, sdkConfig, React);
912
+ //# sourceMappingURL=index.iife.js.map