@antv/dumi-theme-antv 0.7.10 → 0.8.0-alpha.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/dist/builtins/Playground/index.js +1 -1
- package/dist/builtins/Playground/index.module.less +0 -1
- package/dist/common/styles/Common.js +1 -1
- package/dist/common/styles/theme.js +1 -1
- package/dist/components/AI/HomeDialog/AntVBanner/index.js +4 -0
- package/dist/components/AI/HomeDialog/AntVBanner/index.module.less +35 -0
- package/dist/components/AI/HomeDialog/ModeSelector/ModeSelectorDropdown.js +42 -0
- package/dist/components/AI/HomeDialog/ModeSelector/index.js +32 -0
- package/dist/components/AI/HomeDialog/ModeSelector/index.module.less +289 -0
- package/dist/components/AI/HomeDialog/PromptTextarea/ChooseLib/index.js +62 -0
- package/dist/components/AI/HomeDialog/PromptTextarea/ChooseLib/index.module.less +4 -0
- package/dist/components/AI/HomeDialog/PromptTextarea/DatasourceCard/index.js +25 -0
- package/dist/components/AI/HomeDialog/PromptTextarea/DatasourceCard/index.module.less +42 -0
- package/dist/components/AI/HomeDialog/PromptTextarea/SendButton.js +23 -0
- package/dist/components/AI/HomeDialog/PromptTextarea/SendButton.module.less +9 -0
- package/dist/components/AI/HomeDialog/PromptTextarea/Uploader/DataUploader.js +225 -0
- package/dist/components/AI/HomeDialog/PromptTextarea/index.js +172 -0
- package/dist/components/AI/HomeDialog/PromptTextarea/index.module.less +128 -0
- package/dist/components/AI/HomeDialog/RecommendCase/Card.js +80 -0
- package/dist/components/AI/HomeDialog/RecommendCase/card.module.less +131 -0
- package/dist/components/AI/HomeDialog/RecommendCase/index.js +130 -0
- package/dist/components/AI/HomeDialog/RecommendCase/index.module.less +45 -0
- package/dist/components/AI/HomeDialog/RecommendCase/recommend.json +66 -0
- package/dist/components/AI/HomeDialog/index.js +62 -0
- package/dist/components/AI/HomeDialog/index.module.less +3 -0
- package/dist/components/AI/constant.js +37 -0
- package/dist/components/AI/index.js +1 -0
- package/dist/components/AI/types.js +1 -0
- package/dist/components/AI/utils.js +38 -0
- package/dist/components/Login/Captcha/index.js +185 -0
- package/dist/components/Login/Captcha/index.less +91 -0
- package/dist/components/Login/CheckCode/index.js +244 -0
- package/dist/components/Login/CheckCode/index.less +137 -0
- package/dist/components/Login/CountDownButton/index.js +109 -0
- package/dist/components/Login/CountDownButton/index.less +8 -0
- package/dist/components/Login/LoginForm.js +239 -0
- package/dist/components/Login/LoginForm.less +408 -0
- package/dist/components/Login/index.js +24 -0
- package/dist/components/Login/openAuthWindow.js +54 -0
- package/dist/components/Login/types.js +5 -0
- package/dist/components/Login/utils.js +47 -0
- package/dist/hooks/useProducts.js +39 -0
- package/dist/hooks/useStreamingText.js +139 -0
- package/dist/hooks/useTypewriter.js +69 -0
- package/dist/hooks/useVisionsnapSdk.js +159 -0
- package/dist/layouts/DocLayout.js +2 -2
- package/dist/layouts/GlobalLayout/index.js +22 -0
- package/dist/locales/en.json +132 -1
- package/dist/locales/zh.json +132 -1
- package/dist/model/AIChat.js +313 -0
- package/dist/model/auth.js +147 -0
- package/dist/pages/AIPlayground/components/ConversationsMenu/index.js +176 -0
- package/dist/pages/AIPlayground/components/ConversationsMenu/index.module.less +46 -0
- package/dist/pages/AIPlayground/components/MarkdownComponent/MarkdownCodeBlock.js +97 -0
- package/dist/pages/AIPlayground/components/MarkdownComponent/MarkdownCodeBlock.module.less +13 -0
- package/dist/pages/AIPlayground/components/MarkdownComponent/index.js +50 -0
- package/dist/pages/AIPlayground/components/MsgBox/index.js +407 -0
- package/dist/pages/AIPlayground/components/MsgBox/index.module.less +43 -0
- package/dist/pages/AIPlayground/components/MsgBox/useAutoScroll.js +46 -0
- package/dist/pages/AIPlayground/components/SessionLayout/index.js +62 -0
- package/dist/pages/AIPlayground/components/SessionLayout/index.module.less +37 -0
- package/dist/pages/AIPlayground/components/TaskBox/generateCode.js +230 -0
- package/dist/pages/AIPlayground/components/TaskBox/index.js +101 -0
- package/dist/pages/AIPlayground/components/TaskBox/index.module.less +9 -0
- package/dist/pages/AIPlayground/demo.js +34 -0
- package/dist/pages/AIPlayground/index.js +12 -0
- package/dist/pages/AIPlayground/index.module.less +5 -0
- package/dist/pages/Examples/components/Accouncement/index.module.less +1 -1
- package/dist/pages/Examples/index.module.less +11 -11
- package/dist/pages/Index/components/Cases/index.module.less +8 -8
- package/dist/pages/Index/components/Companies/index.module.less +4 -3
- package/dist/pages/Index/components/Features/FeatureCard.module.less +4 -5
- package/dist/pages/Index/components/Features/index.module.less +5 -5
- package/dist/pages/Index/components/_.less +9 -9
- package/dist/pages/Index/index.js +1 -1
- package/dist/plugin/index.js +14 -6
- package/dist/slots/Banner/Notification.module.less +8 -8
- package/dist/slots/Banner/index.module.less +10 -9
- package/dist/slots/CodeEditor/Toolbar.js +23 -27
- package/dist/slots/CodeEditor/Toolbar.module.less +7 -0
- package/dist/slots/CodeEditor/index.js +67 -5
- package/dist/slots/CodeEditor/index.module.less +24 -0
- package/dist/slots/CodeEditor/utils.js +2 -1
- package/dist/slots/CodePreview/index.module.less +0 -3
- package/dist/slots/CodeRunner/index.js +24 -11
- package/dist/slots/ContentTable/index.module.less +2 -1
- package/dist/{pages/Index/components → slots}/Detail/News.js +1 -1
- package/dist/{pages/Index/components → slots}/Detail/News.module.less +9 -9
- package/dist/{pages/Index/components → slots}/Detail/index.js +13 -29
- package/dist/{pages/Index/components → slots}/Detail/index.module.less +23 -20
- package/dist/slots/ExampleSider/index.module.less +3 -4
- package/dist/slots/Footer/index.module.less +2 -2
- package/dist/slots/Header/Products/Product.module.less +2 -2
- package/dist/slots/Header/Products/getProducts.js +20 -26
- package/dist/slots/Header/Products/index.js +20 -16
- package/dist/slots/Header/Search/SearchResult.js +53 -14
- package/dist/slots/Header/Search/SearchResult.module.less +1 -0
- package/dist/slots/Header/Search/index.js +2 -1
- package/dist/slots/Header/index.js +72 -30
- package/dist/slots/Header/index.module.less +14 -6
- package/dist/slots/LiveExample/index.js +1 -1
- package/dist/slots/LiveExample/index.module.less +1 -1
- package/dist/slots/Loading/index.module.less +30 -28
- package/dist/slots/ManualContent/index.module.less +14 -17
- package/dist/slots/_.less +9 -9
- package/dist/static/user.svg +3 -0
- package/dist/typings.d.ts +11 -0
- package/dist/utils/analytics.js +16 -0
- package/dist/utils/code.js +35 -0
- package/dist/utils/env.js +63 -0
- package/dist/utils/index.js +7 -0
- package/dist/utils/request.js +42 -0
- package/package.json +31 -15
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
@primary-color: #873bf4;
|
|
2
|
+
@yuque-color-text-caption: #8c8c8c;
|
|
3
|
+
@yuque-color-border-primary: #d9d9d9;
|
|
4
|
+
@yuque-color-text-body: #595959;
|
|
5
|
+
@yuque-grey-5: #bfbfbf;
|
|
6
|
+
@yuque-color-bg-primary-hover-light: #f5f5f5;
|
|
7
|
+
@yuque-color-text-primary: #262626;
|
|
8
|
+
@font-size-sm: 12px;
|
|
9
|
+
@yuque-color-bg-primary: #ffffff;
|
|
10
|
+
@yuque-color-function-warning: #faad14;
|
|
11
|
+
@yuque-color-function-error: #ff4d4f;
|
|
12
|
+
@white: #ffffff;
|
|
13
|
+
@yuque-color-text-disable: #bfbfbf;
|
|
14
|
+
@yuque-color-bg-tertiary: #fafafa;
|
|
15
|
+
@yuque-color-text-link: #873bf4;
|
|
16
|
+
@color-1: #bfbfbf;
|
|
17
|
+
@color: #873bf4;
|
|
18
|
+
|
|
19
|
+
.account-login {
|
|
20
|
+
margin-top: 32px;
|
|
21
|
+
|
|
22
|
+
&.form-pro .mobile-code-field {
|
|
23
|
+
input {
|
|
24
|
+
height: 40px;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.ant-row{
|
|
29
|
+
margin: unset;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&.form-pro {
|
|
33
|
+
.ant-input,
|
|
34
|
+
.ant-cascader-picker,
|
|
35
|
+
.ant-select {
|
|
36
|
+
font-size: 14px;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// 桌面端内网打开外网登录时,会有返回按钮,页面需要上移
|
|
41
|
+
.login-from-desktop-inside {
|
|
42
|
+
margin-top: -16px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.split {
|
|
46
|
+
color: @yuque-color-text-caption;
|
|
47
|
+
padding: 0 8px;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.forgot-link {
|
|
51
|
+
font-size: 14px;
|
|
52
|
+
border-left: 1px solid @yuque-color-border-primary;
|
|
53
|
+
padding-left: 12px;
|
|
54
|
+
padding-right: 5px;
|
|
55
|
+
|
|
56
|
+
a {
|
|
57
|
+
color: @yuque-color-text-caption;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.protocol-check {
|
|
62
|
+
margin-bottom: 16px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&-bottom {
|
|
66
|
+
margin-top: 24px;
|
|
67
|
+
|
|
68
|
+
a {
|
|
69
|
+
display: inline-block;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
span.icon-dingtalk {
|
|
73
|
+
width: 20px;
|
|
74
|
+
height: 20px;
|
|
75
|
+
background-image: url('https://gw.alipayobjects.com/zos/rmsportal/iSBYXPhvTkwhjYUQVMLG.png');
|
|
76
|
+
background-position: 0 -21px;
|
|
77
|
+
background-size: 100%;
|
|
78
|
+
margin-right: 8px;
|
|
79
|
+
float: left;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.noSwitch {
|
|
84
|
+
height: 16px;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.countrylist {
|
|
88
|
+
height: 250px;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.login-more-warp {
|
|
92
|
+
padding-top: 23px;
|
|
93
|
+
width: 329px;
|
|
94
|
+
position: absolute;
|
|
95
|
+
bottom: 10px;
|
|
96
|
+
display: flex;
|
|
97
|
+
justify-content: center;
|
|
98
|
+
align-items: center;
|
|
99
|
+
|
|
100
|
+
&-desktop {
|
|
101
|
+
bottom: 34px;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.login-more-warp-box {
|
|
105
|
+
display: flex;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.login-email-icon {
|
|
110
|
+
display: inline-block;
|
|
111
|
+
margin-right: 5px;
|
|
112
|
+
|
|
113
|
+
svg {
|
|
114
|
+
font-size: 28px;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.switch {
|
|
119
|
+
text-align: left;
|
|
120
|
+
color: @yuque-color-text-body;
|
|
121
|
+
cursor: pointer;
|
|
122
|
+
line-height: 1.5;
|
|
123
|
+
margin-bottom: 10px;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.login-more-tips-warp {
|
|
127
|
+
position: absolute;
|
|
128
|
+
bottom: 90px;
|
|
129
|
+
|
|
130
|
+
&-desktop {
|
|
131
|
+
bottom: 114px;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.login-more-tips-warp-left {
|
|
135
|
+
display: inline-block;
|
|
136
|
+
height: 1px;
|
|
137
|
+
width: 100px;
|
|
138
|
+
background-image: linear-gradient(243deg, @yuque-grey-5 0%, rgba(216, 218, 217, 0%) 95%);
|
|
139
|
+
border-radius: 0.5px;
|
|
140
|
+
margin-right: 10px;
|
|
141
|
+
margin-bottom: 4px;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.login-more-tips-warp-right {
|
|
145
|
+
display: inline-block;
|
|
146
|
+
height: 1px;
|
|
147
|
+
width: 100px;
|
|
148
|
+
transform: scaleX(-1);
|
|
149
|
+
background-image: linear-gradient(243deg, @yuque-grey-5 0%, rgba(216, 218, 217, 0%) 95%);
|
|
150
|
+
border-radius: 0.5px;
|
|
151
|
+
margin-left: 10px;
|
|
152
|
+
margin-bottom: 4px;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
input {
|
|
157
|
+
appearance: none;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.ant-select-single {
|
|
161
|
+
height: 40px;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.ant-select-selection-item-content {
|
|
165
|
+
margin-top: 4px;
|
|
166
|
+
height: 40px;
|
|
167
|
+
text-align: center;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.phone-number-input {
|
|
171
|
+
width: 70%;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.login-password-formitem {
|
|
175
|
+
:global(.ant-form-explain) {
|
|
176
|
+
font-size: 14px;
|
|
177
|
+
line-height: 1.5;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
:global(.ant-form-item:last-child) {
|
|
181
|
+
margin-bottom: 8px;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.login-foot {
|
|
186
|
+
margin-top: 28px;
|
|
187
|
+
text-align: center;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.login-foot-span {
|
|
191
|
+
display: inline-block;
|
|
192
|
+
width: 1px;
|
|
193
|
+
height: 14px;
|
|
194
|
+
vertical-align: middle;
|
|
195
|
+
margin: 0 8px 3px;
|
|
196
|
+
background-color: @yuque-color-bg-primary-hover-light;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.login-foot-register {
|
|
200
|
+
display: inline;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.proxy-setting {
|
|
204
|
+
color: @yuque-color-text-primary;
|
|
205
|
+
font-size: @font-size-sm;
|
|
206
|
+
cursor: pointer;
|
|
207
|
+
padding-left: 15px;
|
|
208
|
+
margin-left: 15px;
|
|
209
|
+
border-left: solid @yuque-color-border-primary 1px;
|
|
210
|
+
height: 23px;
|
|
211
|
+
line-height: 21px;
|
|
212
|
+
margin-top: 4px;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.lark-login-protocol {
|
|
216
|
+
margin-top: 16px;
|
|
217
|
+
text-align: left;
|
|
218
|
+
|
|
219
|
+
.ant-checkbox-inner,
|
|
220
|
+
.ant-checkbox:hover::after,
|
|
221
|
+
.ant-checkbox-wrapper:hover .ant-checkbox::after {
|
|
222
|
+
border-radius: 50%;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.lark-form-back {
|
|
227
|
+
max-width: 320px;
|
|
228
|
+
text-align: left;
|
|
229
|
+
margin-top: 6px;
|
|
230
|
+
height: 15px;
|
|
231
|
+
align-self: flex-start;
|
|
232
|
+
|
|
233
|
+
span {
|
|
234
|
+
color: @yuque-color-text-link;
|
|
235
|
+
cursor: pointer;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.icon {
|
|
239
|
+
font-size: @font-size-sm;
|
|
240
|
+
position: relative;
|
|
241
|
+
top: -1px;
|
|
242
|
+
margin-right: 4px;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.password-reset {
|
|
247
|
+
height: 22px;
|
|
248
|
+
font-weight: 400;
|
|
249
|
+
font-size: 14px;
|
|
250
|
+
color: @yuque-color-text-caption;
|
|
251
|
+
line-height: 22px;
|
|
252
|
+
display: flex;
|
|
253
|
+
margin: 7px 0;
|
|
254
|
+
margin-bottom: 22px;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.platform-dingtalk .lark-form-main .lark-form-content {
|
|
259
|
+
margin-top: 0;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.in-org .lark-form-warp {
|
|
263
|
+
span {
|
|
264
|
+
font-size: 30px;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
img {
|
|
268
|
+
width: 52px !important;
|
|
269
|
+
height: 52px !important;
|
|
270
|
+
min-width: 52px !important;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.in-org .lark-form-main .account-slogon-subhead {
|
|
275
|
+
margin: 8px 0;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.platform-dingtalk,
|
|
279
|
+
.platform-wechat {
|
|
280
|
+
.lark-form-warp {
|
|
281
|
+
margin-bottom: 10px;
|
|
282
|
+
|
|
283
|
+
.ant-dropdown-trigger {
|
|
284
|
+
// 无需切换功能
|
|
285
|
+
display: none;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
span {
|
|
289
|
+
font-size: 24px;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
img {
|
|
293
|
+
width: 40px !important;
|
|
294
|
+
height: 40px !important;
|
|
295
|
+
min-width: 40px !important;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.platform-dingtalk {
|
|
301
|
+
&.show-logo {
|
|
302
|
+
.switch-login-warp {
|
|
303
|
+
top: 45px;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.switch-login-warp {
|
|
308
|
+
position: relative;
|
|
309
|
+
bottom: 0;
|
|
310
|
+
text-align: center;
|
|
311
|
+
top: 60px;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
.lark-form-main .account-login {
|
|
317
|
+
.proxy-board-warp {
|
|
318
|
+
position: absolute;
|
|
319
|
+
top: 0;
|
|
320
|
+
z-index: 2;
|
|
321
|
+
background: @yuque-color-bg-primary;
|
|
322
|
+
width: 100%;
|
|
323
|
+
left: 0;
|
|
324
|
+
height: 100%;
|
|
325
|
+
|
|
326
|
+
.ant-select-selector {
|
|
327
|
+
height: 32px;
|
|
328
|
+
|
|
329
|
+
.ant-select-selection-item {
|
|
330
|
+
line-height: 32px;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.ant-select-single {
|
|
335
|
+
height: 32px;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
h2 {
|
|
339
|
+
height: 110px;
|
|
340
|
+
line-height: 150px;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
.ant-btn-primary {
|
|
344
|
+
width: 304px;
|
|
345
|
+
margin-right: 48px;
|
|
346
|
+
margin-top: 20px;
|
|
347
|
+
height: 40px;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
.ant-row {
|
|
351
|
+
width: 304px;
|
|
352
|
+
margin-left: 50px;
|
|
353
|
+
padding: 10px 0;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
.hr-line {
|
|
360
|
+
border-top: 1px solid #4c4c4c;
|
|
361
|
+
height: 20px;
|
|
362
|
+
width: 100%;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
[data-icon="github"] {
|
|
366
|
+
vertical-align: baseline;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
.ant-btn-primary.btn-login {
|
|
370
|
+
|
|
371
|
+
&:hover {
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
&::after {
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
.proxy-board-warp {
|
|
381
|
+
.ant-col {
|
|
382
|
+
text-align: left;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
@media only screen and (max-width: 420px) {
|
|
387
|
+
.account-login {
|
|
388
|
+
margin-top: 22px;
|
|
389
|
+
|
|
390
|
+
.login-foot {
|
|
391
|
+
margin-top: 8px;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
.login-from-desktop.account-login {
|
|
396
|
+
.third-login {
|
|
397
|
+
padding-top: 0;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
@media only screen and (max-height: 800px) {
|
|
403
|
+
.account-login {
|
|
404
|
+
.login-foot {
|
|
405
|
+
margin-top: 18px;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import LoginForm from "./LoginForm";
|
|
3
|
+
import { Modal } from 'antd';
|
|
4
|
+
import { useSnapshot } from 'valtio';
|
|
5
|
+
import { useIntl } from 'dumi';
|
|
6
|
+
import { authStore, hideLoginModal } from "../../model/auth";
|
|
7
|
+
export function LoginModal() {
|
|
8
|
+
var authSnap = useSnapshot(authStore);
|
|
9
|
+
var intl = useIntl();
|
|
10
|
+
return /*#__PURE__*/React.createElement(Modal, {
|
|
11
|
+
width: 400,
|
|
12
|
+
title: intl.formatMessage({
|
|
13
|
+
id: 'login.modal.title'
|
|
14
|
+
}),
|
|
15
|
+
open: authSnap.isModalOpen,
|
|
16
|
+
onCancel: function onCancel() {
|
|
17
|
+
return hideLoginModal();
|
|
18
|
+
} // 直接调用 store 的 action
|
|
19
|
+
,
|
|
20
|
+
footer: null,
|
|
21
|
+
maskClosable: false,
|
|
22
|
+
destroyOnHidden: true
|
|
23
|
+
}, /*#__PURE__*/React.createElement(LoginForm, null));
|
|
24
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
4
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
5
|
+
import { pickBy } from 'lodash';
|
|
6
|
+
export var AuthScene = /*#__PURE__*/function (AuthScene) {
|
|
7
|
+
AuthScene["LOGIN"] = "login";
|
|
8
|
+
AuthScene["GET_ACCESS_TOKEN"] = "get_access_token";
|
|
9
|
+
return AuthScene;
|
|
10
|
+
}({});
|
|
11
|
+
var AUTH_BROADCAST_CHANNEL_NAME = 'WeaveFox-Auth';
|
|
12
|
+
var AuthSceneUrlMap = _defineProperty(_defineProperty({}, AuthScene.LOGIN, '/login/github/oauth'), AuthScene.GET_ACCESS_TOKEN, '/login/github/access_token');
|
|
13
|
+
export function openAuthWindow(params) {
|
|
14
|
+
try {
|
|
15
|
+
var _ref = params || {},
|
|
16
|
+
onSuccess = _ref.onSuccess,
|
|
17
|
+
onFail = _ref.onFail,
|
|
18
|
+
scene = _ref.scene,
|
|
19
|
+
sceneParams = _ref.sceneParams;
|
|
20
|
+
var broadcast = new BroadcastChannel(AUTH_BROADCAST_CHANNEL_NAME);
|
|
21
|
+
var cleanedParams = pickBy(sceneParams, function (val) {
|
|
22
|
+
return val !== undefined && val !== null;
|
|
23
|
+
});
|
|
24
|
+
var sceneParamsString = new URLSearchParams(cleanedParams).toString();
|
|
25
|
+
sceneParamsString = sceneParamsString ? "?".concat(sceneParamsString) : '';
|
|
26
|
+
window.open(AuthSceneUrlMap[scene] + sceneParamsString, 'github_auth', 'left=0,top=0,width=600,height=600');
|
|
27
|
+
var handler = function handler(event) {
|
|
28
|
+
if (event.data.source !== 'WeaveFox-Auth') return;
|
|
29
|
+
// 验证来源是否可信
|
|
30
|
+
if (event.origin !== window.location.origin) {
|
|
31
|
+
console.warn('Untrusted origin: ', event.origin);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (event.data.success) {
|
|
35
|
+
if (onSuccess) {
|
|
36
|
+
onSuccess(event.data);
|
|
37
|
+
}
|
|
38
|
+
} else if (onFail) {
|
|
39
|
+
onFail(event.data);
|
|
40
|
+
}
|
|
41
|
+
window.removeEventListener('message', handler);
|
|
42
|
+
broadcast.removeEventListener('message', handler);
|
|
43
|
+
};
|
|
44
|
+
window.addEventListener('message', handler, false);
|
|
45
|
+
broadcast.addEventListener('message', handler, false);
|
|
46
|
+
|
|
47
|
+
// 未解之谜,窗口可能会丢失 opener 信息,暂时用 5s 后强制刷新解决
|
|
48
|
+
setTimeout(function () {
|
|
49
|
+
window.location.reload();
|
|
50
|
+
}, 5000);
|
|
51
|
+
} catch (e) {
|
|
52
|
+
console.error('auth unexpected error', e);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
|
+
import FingerprintJS from '@fingerprintjs/fingerprintjs';
|
|
6
|
+
export var chinaMobilePhoneRE = /^(13\d|14\d|15[012356789]|16[567]|17[01235678]|18\d|19\d)\d{8}(\+\d+)?$/;
|
|
7
|
+
export var SignupRegion = /*#__PURE__*/function (SignupRegion) {
|
|
8
|
+
SignupRegion["oversea"] = "oversea";
|
|
9
|
+
SignupRegion["possible_oversea"] = "possible_oversea";
|
|
10
|
+
return SignupRegion;
|
|
11
|
+
}({}); // 可能是海外(不确定/待确认)
|
|
12
|
+
export function getFingerprint() {
|
|
13
|
+
return _getFingerprint.apply(this, arguments);
|
|
14
|
+
}
|
|
15
|
+
function _getFingerprint() {
|
|
16
|
+
_getFingerprint = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
17
|
+
var fp, result;
|
|
18
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
19
|
+
while (1) switch (_context.prev = _context.next) {
|
|
20
|
+
case 0:
|
|
21
|
+
_context.next = 2;
|
|
22
|
+
return FingerprintJS.load();
|
|
23
|
+
case 2:
|
|
24
|
+
fp = _context.sent;
|
|
25
|
+
_context.next = 5;
|
|
26
|
+
return fp.get();
|
|
27
|
+
case 5:
|
|
28
|
+
result = _context.sent;
|
|
29
|
+
return _context.abrupt("return", result);
|
|
30
|
+
case 7:
|
|
31
|
+
case "end":
|
|
32
|
+
return _context.stop();
|
|
33
|
+
}
|
|
34
|
+
}, _callee);
|
|
35
|
+
}));
|
|
36
|
+
return _getFingerprint.apply(this, arguments);
|
|
37
|
+
}
|
|
38
|
+
export var NC_SCENE = /*#__PURE__*/function (NC_SCENE) {
|
|
39
|
+
NC_SCENE["login"] = "login";
|
|
40
|
+
NC_SCENE["register"] = "register";
|
|
41
|
+
NC_SCENE["verifyUser"] = "verify_user";
|
|
42
|
+
NC_SCENE["registerH5"] = "nc_register_h5";
|
|
43
|
+
NC_SCENE["loginH5"] = "nc_login_h5";
|
|
44
|
+
NC_SCENE["reset"] = "nc_reset";
|
|
45
|
+
return NC_SCENE;
|
|
46
|
+
}({});
|
|
47
|
+
export var UIA_UA_RE = /Macaca UI Robot/;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query';
|
|
2
|
+
import { getBaseSiteDataUrl } from "../utils/env";
|
|
3
|
+
export function getProducts() {
|
|
4
|
+
// 如需要修改产品信息,请到 https://yuyan.antfin-inc.com/antv/site-data/sprints 修改区块内容
|
|
5
|
+
return fetch("".concat(getBaseSiteDataUrl(), "/antv/products.json") // 生产环境
|
|
6
|
+
// 'https://site-data-pre.alipay.com/antv/products.json', // 预发测试
|
|
7
|
+
).then(function (res) {
|
|
8
|
+
return res.json();
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// 封装了 queryKey 和 fetcher 的自定义 Hook
|
|
13
|
+
export function useProducts() {
|
|
14
|
+
return useQuery({
|
|
15
|
+
queryKey: ['antv-products'],
|
|
16
|
+
queryFn: getProducts,
|
|
17
|
+
staleTime: 24 * 60 * 60 * 1000 // 一天内数据不会被认为是 "stale",不会触发后台刷新
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
export function getAntVConfig() {
|
|
21
|
+
// 如需要修改产品信息,请到 https://yuyan.antfin-inc.com/antv/site-data/sprints 修改区块内容
|
|
22
|
+
return fetch("".concat(getBaseSiteDataUrl(), "/antv/config.json") // 生产环境
|
|
23
|
+
// 'https://site-data-pre.alipay.com/antv/products.json', // 预发测试
|
|
24
|
+
).then(function (res) {
|
|
25
|
+
return res.json();
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// 封装了 queryKey 和 fetcher 的自定义 Hook
|
|
30
|
+
export function useAntVConfig() {
|
|
31
|
+
return useQuery({
|
|
32
|
+
queryKey: ['antv-config'],
|
|
33
|
+
queryFn: getAntVConfig,
|
|
34
|
+
initialData: {
|
|
35
|
+
"VisionSnapVersion": "3.5.12",
|
|
36
|
+
"library": ["G2", "F2", "G6"]
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|