@weavix/cli 0.4.0 → 0.5.1
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/README.md +2 -1
- package/build/index.js +3113 -1006
- package/build/templates/_external/npmrc.template +1 -0
- package/build/templates/{_shared/src/styles-360.scss → _external/src/styles.scss} +14 -16
- package/build/templates/_internal/npmrc.template +3 -0
- package/build/templates/{_shared/src/styles-gravity.scss → _internal/src/styles.scss} +32 -11
- package/build/templates/_internal/src/themes/yandex-cloud/_dark-hc.scss +328 -0
- package/build/templates/_internal/src/themes/yandex-cloud/_dark.scss +329 -0
- package/build/templates/_internal/src/themes/yandex-cloud/_light-hc.scss +321 -0
- package/build/templates/_internal/src/themes/yandex-cloud/_light.scss +323 -0
- package/build/templates/_internal/src/themes/yandex-cloud.scss +168 -0
- package/build/templates/_shared/AGENTS.md +53 -0
- package/build/templates/_shared/manifest.schema.json +255 -5
- package/build/templates/_shared/package.json +63 -65
- package/build/templates/_shared/proxy.ts +111 -0
- package/build/templates/_shared/src/main.tsx +2 -6
- package/build/templates/_shared/src/themes/yandex-360/_dark-hc.scss +296 -0
- package/build/templates/_shared/src/themes/yandex-360/_dark.scss +297 -0
- package/build/templates/_shared/src/themes/yandex-360/_light-hc.scss +289 -0
- package/build/templates/_shared/src/themes/yandex-360/_light.scss +291 -0
- package/build/templates/_shared/src/themes/yandex-360.scss +197 -0
- package/build/templates/_shared/src/themes/ys-text.scss +79 -0
- package/build/templates/_shared/vite.config.ts +5 -1
- package/build/templates/attachment.viewer.action/index.html +1 -1
- package/build/templates/attachment.viewer.action/src/App.tsx +14 -24
- package/build/templates/board.tab/index.html +14 -0
- package/build/templates/board.tab/src/App.tsx +27 -0
- package/build/templates/default/src/App.tsx +1 -1
- package/build/templates/goal.action/index.html +1 -1
- package/build/templates/goal.action/src/App.tsx +4 -16
- package/build/templates/goal.block/index.html +14 -0
- package/build/templates/goal.block/src/App.tsx +27 -0
- package/build/templates/goal.editor.action/index.html +14 -0
- package/build/templates/goal.editor.action/src/App.tsx +56 -0
- package/build/templates/goal.tab/index.html +14 -0
- package/build/templates/goal.tab/src/App.tsx +27 -0
- package/build/templates/issue.action/index.html +1 -1
- package/build/templates/issue.action/src/App.tsx +6 -13
- package/build/templates/issue.block/index.html +1 -1
- package/build/templates/issue.block/src/App.tsx +9 -18
- package/build/templates/issue.comment.action/src/App.tsx +5 -11
- package/build/templates/issue.editor.action/index.html +14 -0
- package/build/templates/issue.editor.action/src/App.tsx +56 -0
- package/build/templates/issue.tab/src/App.tsx +5 -12
- package/build/templates/navigation/src/App.tsx +2 -7
- package/build/templates/portfolio.action/index.html +1 -1
- package/build/templates/portfolio.action/src/App.tsx +4 -21
- package/build/templates/portfolio.block/index.html +14 -0
- package/build/templates/portfolio.block/src/App.tsx +27 -0
- package/build/templates/portfolio.editor.action/index.html +14 -0
- package/build/templates/portfolio.editor.action/src/App.tsx +56 -0
- package/build/templates/portfolio.tab/index.html +14 -0
- package/build/templates/portfolio.tab/src/App.tsx +27 -0
- package/build/templates/project.action/index.html +1 -1
- package/build/templates/project.action/src/App.tsx +4 -21
- package/build/templates/project.block/index.html +14 -0
- package/build/templates/project.block/src/App.tsx +27 -0
- package/build/templates/project.editor.action/index.html +14 -0
- package/build/templates/project.editor.action/src/App.tsx +56 -0
- package/build/templates/project.tab/index.html +14 -0
- package/build/templates/project.tab/src/App.tsx +27 -0
- package/build/templates/queue.action/index.html +14 -0
- package/build/templates/queue.action/src/App.tsx +29 -0
- package/build/templates/queue.tab/index.html +14 -0
- package/build/templates/queue.tab/src/App.tsx +29 -0
- package/build/templates/trigger.action/index.html +1 -1
- package/build/templates/trigger.action/src/App.tsx +15 -21
- package/package.json +3 -1
- package/build/templates/_shared/npmrc.template +0 -2
|
@@ -33,7 +33,8 @@
|
|
|
33
33
|
"items": {
|
|
34
34
|
"type": "string",
|
|
35
35
|
"enum": [
|
|
36
|
-
"tracker"
|
|
36
|
+
"tracker",
|
|
37
|
+
"messenger"
|
|
37
38
|
]
|
|
38
39
|
},
|
|
39
40
|
"minItems": 1,
|
|
@@ -261,16 +262,21 @@
|
|
|
261
262
|
"items": {
|
|
262
263
|
"type": "string",
|
|
263
264
|
"enum": [
|
|
264
|
-
"clipboard-write"
|
|
265
|
+
"clipboard-write",
|
|
266
|
+
"microphone",
|
|
267
|
+
"camera",
|
|
268
|
+
"geolocation",
|
|
269
|
+
"web-share",
|
|
270
|
+
"allow-downloads"
|
|
265
271
|
]
|
|
266
272
|
},
|
|
267
273
|
"uniqueItems": true
|
|
268
274
|
},
|
|
269
275
|
"external": {
|
|
270
276
|
"type": "array",
|
|
271
|
-
"description": "External
|
|
277
|
+
"description": "External API domains the plugin may call through the platform proxy",
|
|
272
278
|
"items": {
|
|
273
|
-
"
|
|
279
|
+
"$ref": "#/definitions/ExternalDomain"
|
|
274
280
|
},
|
|
275
281
|
"uniqueItems": true
|
|
276
282
|
}
|
|
@@ -319,6 +325,30 @@
|
|
|
319
325
|
"$ref": "#/definitions/SlotConfig"
|
|
320
326
|
}
|
|
321
327
|
},
|
|
328
|
+
"issue.editor.action": {
|
|
329
|
+
"type": "array",
|
|
330
|
+
"description": "Issue Editor Action slot configurations",
|
|
331
|
+
"minItems": 1,
|
|
332
|
+
"items": {
|
|
333
|
+
"$ref": "#/definitions/SlotConfig"
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
"queue.action": {
|
|
337
|
+
"type": "array",
|
|
338
|
+
"description": "Queue Action slot configurations",
|
|
339
|
+
"minItems": 1,
|
|
340
|
+
"items": {
|
|
341
|
+
"$ref": "#/definitions/SlotConfig"
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
"queue.tab": {
|
|
345
|
+
"type": "array",
|
|
346
|
+
"description": "Queue Tab slot configurations",
|
|
347
|
+
"minItems": 1,
|
|
348
|
+
"items": {
|
|
349
|
+
"$ref": "#/definitions/SlotConfig"
|
|
350
|
+
}
|
|
351
|
+
},
|
|
322
352
|
"navigation": {
|
|
323
353
|
"type": "array",
|
|
324
354
|
"description": "Navigation slot configurations",
|
|
@@ -351,6 +381,30 @@
|
|
|
351
381
|
"$ref": "#/definitions/SlotConfig"
|
|
352
382
|
}
|
|
353
383
|
},
|
|
384
|
+
"project.block": {
|
|
385
|
+
"type": "array",
|
|
386
|
+
"description": "Project Block slot configurations",
|
|
387
|
+
"minItems": 1,
|
|
388
|
+
"items": {
|
|
389
|
+
"$ref": "#/definitions/SlotConfig"
|
|
390
|
+
}
|
|
391
|
+
},
|
|
392
|
+
"project.tab": {
|
|
393
|
+
"type": "array",
|
|
394
|
+
"description": "Project Tab slot configurations",
|
|
395
|
+
"minItems": 1,
|
|
396
|
+
"items": {
|
|
397
|
+
"$ref": "#/definitions/SlotConfig"
|
|
398
|
+
}
|
|
399
|
+
},
|
|
400
|
+
"project.editor.action": {
|
|
401
|
+
"type": "array",
|
|
402
|
+
"description": "Project Editor Action slot configurations",
|
|
403
|
+
"minItems": 1,
|
|
404
|
+
"items": {
|
|
405
|
+
"$ref": "#/definitions/SlotConfig"
|
|
406
|
+
}
|
|
407
|
+
},
|
|
354
408
|
"portfolio.action": {
|
|
355
409
|
"type": "array",
|
|
356
410
|
"description": "Portfolio Action slot configurations",
|
|
@@ -359,6 +413,30 @@
|
|
|
359
413
|
"$ref": "#/definitions/SlotConfig"
|
|
360
414
|
}
|
|
361
415
|
},
|
|
416
|
+
"portfolio.block": {
|
|
417
|
+
"type": "array",
|
|
418
|
+
"description": "Portfolio Block slot configurations",
|
|
419
|
+
"minItems": 1,
|
|
420
|
+
"items": {
|
|
421
|
+
"$ref": "#/definitions/SlotConfig"
|
|
422
|
+
}
|
|
423
|
+
},
|
|
424
|
+
"portfolio.tab": {
|
|
425
|
+
"type": "array",
|
|
426
|
+
"description": "Portfolio Tab slot configurations",
|
|
427
|
+
"minItems": 1,
|
|
428
|
+
"items": {
|
|
429
|
+
"$ref": "#/definitions/SlotConfig"
|
|
430
|
+
}
|
|
431
|
+
},
|
|
432
|
+
"portfolio.editor.action": {
|
|
433
|
+
"type": "array",
|
|
434
|
+
"description": "Portfolio Editor Action slot configurations",
|
|
435
|
+
"minItems": 1,
|
|
436
|
+
"items": {
|
|
437
|
+
"$ref": "#/definitions/SlotConfig"
|
|
438
|
+
}
|
|
439
|
+
},
|
|
362
440
|
"goal.action": {
|
|
363
441
|
"type": "array",
|
|
364
442
|
"description": "Goal Action slot configurations",
|
|
@@ -367,6 +445,30 @@
|
|
|
367
445
|
"$ref": "#/definitions/SlotConfig"
|
|
368
446
|
}
|
|
369
447
|
},
|
|
448
|
+
"goal.block": {
|
|
449
|
+
"type": "array",
|
|
450
|
+
"description": "Goal Block slot configurations",
|
|
451
|
+
"minItems": 1,
|
|
452
|
+
"items": {
|
|
453
|
+
"$ref": "#/definitions/SlotConfig"
|
|
454
|
+
}
|
|
455
|
+
},
|
|
456
|
+
"goal.tab": {
|
|
457
|
+
"type": "array",
|
|
458
|
+
"description": "Goal Tab slot configurations",
|
|
459
|
+
"minItems": 1,
|
|
460
|
+
"items": {
|
|
461
|
+
"$ref": "#/definitions/SlotConfig"
|
|
462
|
+
}
|
|
463
|
+
},
|
|
464
|
+
"goal.editor.action": {
|
|
465
|
+
"type": "array",
|
|
466
|
+
"description": "Goal Editor Action slot configurations",
|
|
467
|
+
"minItems": 1,
|
|
468
|
+
"items": {
|
|
469
|
+
"$ref": "#/definitions/SlotConfig"
|
|
470
|
+
}
|
|
471
|
+
},
|
|
370
472
|
"attachment.viewer.action": {
|
|
371
473
|
"type": "array",
|
|
372
474
|
"description": "Attachment Viewer Action slot configurations",
|
|
@@ -374,6 +476,38 @@
|
|
|
374
476
|
"items": {
|
|
375
477
|
"$ref": "#/definitions/SlotConfig"
|
|
376
478
|
}
|
|
479
|
+
},
|
|
480
|
+
"board.tab": {
|
|
481
|
+
"type": "array",
|
|
482
|
+
"description": "Board Tab slot configurations",
|
|
483
|
+
"minItems": 1,
|
|
484
|
+
"items": {
|
|
485
|
+
"$ref": "#/definitions/SlotConfig"
|
|
486
|
+
}
|
|
487
|
+
},
|
|
488
|
+
"dock": {
|
|
489
|
+
"type": "array",
|
|
490
|
+
"description": "Dock slot configurations",
|
|
491
|
+
"minItems": 1,
|
|
492
|
+
"items": {
|
|
493
|
+
"$ref": "#/definitions/SlotConfig"
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
},
|
|
497
|
+
"additionalProperties": false
|
|
498
|
+
},
|
|
499
|
+
"messenger": {
|
|
500
|
+
"type": "object",
|
|
501
|
+
"description": "Messenger service slots",
|
|
502
|
+
"minProperties": 1,
|
|
503
|
+
"properties": {
|
|
504
|
+
"user.card.info": {
|
|
505
|
+
"type": "array",
|
|
506
|
+
"description": "User Card Info slot configurations",
|
|
507
|
+
"minItems": 1,
|
|
508
|
+
"items": {
|
|
509
|
+
"$ref": "#/definitions/SlotConfig"
|
|
510
|
+
}
|
|
377
511
|
}
|
|
378
512
|
},
|
|
379
513
|
"additionalProperties": false
|
|
@@ -384,12 +518,105 @@
|
|
|
384
518
|
},
|
|
385
519
|
"additionalProperties": false,
|
|
386
520
|
"definitions": {
|
|
521
|
+
"ExternalDomain": {
|
|
522
|
+
"type": "object",
|
|
523
|
+
"description": "External API domain declaration with optional authorization config",
|
|
524
|
+
"required": [
|
|
525
|
+
"domain"
|
|
526
|
+
],
|
|
527
|
+
"properties": {
|
|
528
|
+
"domain": {
|
|
529
|
+
"type": "string",
|
|
530
|
+
"description": "Hostname of the external API (no scheme, no path, lowercase)",
|
|
531
|
+
"pattern": "^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$",
|
|
532
|
+
"minLength": 1,
|
|
533
|
+
"maxLength": 253
|
|
534
|
+
},
|
|
535
|
+
"authorization": {
|
|
536
|
+
"$ref": "#/definitions/ExternalAuthorization"
|
|
537
|
+
},
|
|
538
|
+
"instructions": {
|
|
539
|
+
"type": "object",
|
|
540
|
+
"description": "Localized note shown to the end user when they need to provide a token for this domain (e.g. where to generate the PAT)",
|
|
541
|
+
"required": [
|
|
542
|
+
"ru",
|
|
543
|
+
"en"
|
|
544
|
+
],
|
|
545
|
+
"properties": {
|
|
546
|
+
"ru": {
|
|
547
|
+
"type": "string",
|
|
548
|
+
"description": "Russian instructions",
|
|
549
|
+
"minLength": 1,
|
|
550
|
+
"maxLength": 500
|
|
551
|
+
},
|
|
552
|
+
"en": {
|
|
553
|
+
"type": "string",
|
|
554
|
+
"description": "English instructions",
|
|
555
|
+
"minLength": 1,
|
|
556
|
+
"maxLength": 500
|
|
557
|
+
}
|
|
558
|
+
},
|
|
559
|
+
"additionalProperties": false
|
|
560
|
+
}
|
|
561
|
+
},
|
|
562
|
+
"additionalProperties": false
|
|
563
|
+
},
|
|
564
|
+
"ExternalAuthorization": {
|
|
565
|
+
"type": "object",
|
|
566
|
+
"description": "Authorization config for an external API domain",
|
|
567
|
+
"required": [
|
|
568
|
+
"type"
|
|
569
|
+
],
|
|
570
|
+
"properties": {
|
|
571
|
+
"type": {
|
|
572
|
+
"type": "string",
|
|
573
|
+
"description": "Authorization scheme: oauth (full OAuth flow or manual PAT for an OAuth provider) or token (manual non-OAuth token, e.g. API key)",
|
|
574
|
+
"enum": [
|
|
575
|
+
"oauth",
|
|
576
|
+
"token"
|
|
577
|
+
]
|
|
578
|
+
},
|
|
579
|
+
"scopes": {
|
|
580
|
+
"type": "array",
|
|
581
|
+
"description": "Scopes required by this version of the plugin for the domain",
|
|
582
|
+
"items": {
|
|
583
|
+
"type": "string",
|
|
584
|
+
"minLength": 1
|
|
585
|
+
},
|
|
586
|
+
"uniqueItems": true
|
|
587
|
+
},
|
|
588
|
+
"contextTypes": {
|
|
589
|
+
"type": "array",
|
|
590
|
+
"description": "Supported token storage contexts",
|
|
591
|
+
"items": {
|
|
592
|
+
"type": "string",
|
|
593
|
+
"enum": [
|
|
594
|
+
"user",
|
|
595
|
+
"organization"
|
|
596
|
+
]
|
|
597
|
+
},
|
|
598
|
+
"minItems": 1,
|
|
599
|
+
"uniqueItems": true
|
|
600
|
+
},
|
|
601
|
+
"header": {
|
|
602
|
+
"type": "string",
|
|
603
|
+
"description": "Custom HTTP header name to put the token into (default: Authorization)",
|
|
604
|
+
"minLength": 1
|
|
605
|
+
},
|
|
606
|
+
"prefix": {
|
|
607
|
+
"type": "string",
|
|
608
|
+
"description": "Custom token prefix in the Authorization header (default: Bearer; empty string for no prefix)"
|
|
609
|
+
}
|
|
610
|
+
},
|
|
611
|
+
"additionalProperties": false
|
|
612
|
+
},
|
|
387
613
|
"SlotConfig": {
|
|
388
614
|
"type": "object",
|
|
389
615
|
"description": "Configuration for a specific slot",
|
|
390
616
|
"required": [
|
|
391
617
|
"entrypoint",
|
|
392
|
-
"title"
|
|
618
|
+
"title",
|
|
619
|
+
"contextLevel"
|
|
393
620
|
],
|
|
394
621
|
"properties": {
|
|
395
622
|
"entrypoint": {
|
|
@@ -420,6 +647,29 @@
|
|
|
420
647
|
},
|
|
421
648
|
"additionalProperties": false
|
|
422
649
|
},
|
|
650
|
+
"contextLevel": {
|
|
651
|
+
"type": "string",
|
|
652
|
+
"description": "Level of context data provided to the slot",
|
|
653
|
+
"enum": [
|
|
654
|
+
"basic",
|
|
655
|
+
"full"
|
|
656
|
+
]
|
|
657
|
+
},
|
|
658
|
+
"icon": {
|
|
659
|
+
"type": "object",
|
|
660
|
+
"description": "Optional slot icon (used by 'dock' slot for FAB)",
|
|
661
|
+
"required": [
|
|
662
|
+
"url"
|
|
663
|
+
],
|
|
664
|
+
"properties": {
|
|
665
|
+
"url": {
|
|
666
|
+
"type": "string",
|
|
667
|
+
"description": "Relative path to the icon file (e.g. ./icon.svg)",
|
|
668
|
+
"minLength": 1
|
|
669
|
+
}
|
|
670
|
+
},
|
|
671
|
+
"additionalProperties": false
|
|
672
|
+
},
|
|
423
673
|
"description": {
|
|
424
674
|
"type": "object",
|
|
425
675
|
"description": "Localized descriptions for the slot",
|
|
@@ -1,69 +1,67 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
"name": "tracker-plugin-default-template",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"react",
|
|
7
|
+
"vite",
|
|
8
|
+
"template",
|
|
9
|
+
"typescript",
|
|
10
|
+
"gravity",
|
|
11
|
+
"uikit",
|
|
12
|
+
"sass"
|
|
13
|
+
],
|
|
14
|
+
"description": "Plugin template",
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": ">=18"
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"dev": "node node_modules/vite/bin/vite.js --logLevel silent",
|
|
20
|
+
"build": "tsc && node node_modules/vite/bin/vite.js build",
|
|
21
|
+
"lint:js": "eslint --ext .js,.jsx,.ts,.tsx .",
|
|
22
|
+
"lint:styles": "stylelint '{styles,src}/**/*.{css,scss}' --allow-empty-input",
|
|
23
|
+
"typecheck": "tsc",
|
|
24
|
+
"lint": "npm run lint:js && npm run lint:styles && npm run typecheck"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@gravity-ui/icons": "2.18.0",
|
|
28
|
+
"@gravity-ui/uikit": "7.37.0",
|
|
29
|
+
"@weavix/tracker-plugin-sdk-react": "latest",
|
|
30
|
+
"@weavix/tracker-components": "latest",
|
|
31
|
+
"@weavix/tracker-api-types": "latest",
|
|
32
|
+
"react": "18.3.1",
|
|
33
|
+
"react-dom": "18.3.1"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@gravity-ui/browserslist-config": "4.1.0",
|
|
37
|
+
"@gravity-ui/eslint-config": "4.2.0",
|
|
38
|
+
"@gravity-ui/prettier-config": "1.1.0",
|
|
39
|
+
"@gravity-ui/stylelint-config": "4.0.0",
|
|
40
|
+
"@gravity-ui/tsconfig": "1.0.0",
|
|
41
|
+
"@types/node": "^25.0.10",
|
|
42
|
+
"@types/react": "18.2.37",
|
|
43
|
+
"@types/react-dom": "18.2.15",
|
|
44
|
+
"@vitejs/plugin-react": "6.0.1",
|
|
45
|
+
"eslint": "9.24.0",
|
|
46
|
+
"husky": "9.1.7",
|
|
47
|
+
"sass": "1.99.0",
|
|
48
|
+
"typescript": "5.8.3",
|
|
49
|
+
"vite": "8.0.7",
|
|
50
|
+
"vite-plugin-svgr": "5.2.0"
|
|
51
|
+
},
|
|
52
|
+
"browserslist": [
|
|
53
|
+
"extends @gravity-ui/browserslist-config"
|
|
54
|
+
],
|
|
55
|
+
"lint-staged": {
|
|
56
|
+
"*.{css,scss}": [
|
|
57
|
+
"stylelint --fix --quiet"
|
|
13
58
|
],
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
},
|
|
18
|
-
"scripts": {
|
|
19
|
-
"dev": "node node_modules/vite/bin/vite.js",
|
|
20
|
-
"build": "tsc && node node_modules/vite/bin/vite.js build",
|
|
21
|
-
"lint:js": "eslint --ext .js,.jsx,.ts,.tsx .",
|
|
22
|
-
"lint:styles": "stylelint '{styles,src}/**/*.{css,scss}' --allow-empty-input",
|
|
23
|
-
"typecheck": "tsc",
|
|
24
|
-
"lint": "npm run lint:js && npm run lint:styles && npm run typecheck"
|
|
25
|
-
},
|
|
26
|
-
"dependencies": {
|
|
27
|
-
"@gravity-ui/icons": "2.18.0",
|
|
28
|
-
"@gravity-ui/uikit": "7.37.0",
|
|
29
|
-
"@yandex-data-ui/gravity-themes": "2.1.0",
|
|
30
|
-
"@yandex-data-ui/tracker-plugin-sdk-react": "0.0.30",
|
|
31
|
-
"@yandex-data-ui/tracker-pub-api-types": "0.0.6",
|
|
32
|
-
"bem-cn-lite": "4.1.0",
|
|
33
|
-
"react": "18.3.1",
|
|
34
|
-
"react-dom": "18.3.1"
|
|
35
|
-
},
|
|
36
|
-
"devDependencies": {
|
|
37
|
-
"@gravity-ui/browserslist-config": "4.1.0",
|
|
38
|
-
"@gravity-ui/eslint-config": "4.2.0",
|
|
39
|
-
"@gravity-ui/prettier-config": "1.1.0",
|
|
40
|
-
"@gravity-ui/stylelint-config": "4.0.0",
|
|
41
|
-
"@gravity-ui/tsconfig": "1.0.0",
|
|
42
|
-
"@types/node": "^25.0.10",
|
|
43
|
-
"@types/react": "18.2.37",
|
|
44
|
-
"@types/react-dom": "18.2.15",
|
|
45
|
-
"@vitejs/plugin-react": "6.0.1",
|
|
46
|
-
"axios": "1.15.0",
|
|
47
|
-
"eslint": "9.24.0",
|
|
48
|
-
"husky": "9.1.7",
|
|
49
|
-
"sass": "1.99.0",
|
|
50
|
-
"typescript": "5.8.3",
|
|
51
|
-
"vite": "8.0.7",
|
|
52
|
-
"vite-plugin-svgr": "5.2.0"
|
|
53
|
-
},
|
|
54
|
-
"browserslist": [
|
|
55
|
-
"extends @gravity-ui/browserslist-config"
|
|
59
|
+
"*.{js,jsx,ts,tsx}": [
|
|
60
|
+
"eslint --fix --quiet",
|
|
61
|
+
"prettier --write"
|
|
56
62
|
],
|
|
57
|
-
"
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"*.{js,jsx,ts,tsx}": [
|
|
62
|
-
"eslint --fix --quiet",
|
|
63
|
-
"prettier --write"
|
|
64
|
-
],
|
|
65
|
-
"*.md": [
|
|
66
|
-
"prettier --write"
|
|
67
|
-
]
|
|
68
|
-
}
|
|
63
|
+
"*.md": [
|
|
64
|
+
"prettier --write"
|
|
65
|
+
]
|
|
66
|
+
}
|
|
69
67
|
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import type { IncomingMessage, ServerResponse } from 'http';
|
|
2
|
+
import http from 'http';
|
|
3
|
+
import https from 'https';
|
|
4
|
+
|
|
5
|
+
import type { Plugin } from 'vite';
|
|
6
|
+
|
|
7
|
+
const CORS_HEADERS = {
|
|
8
|
+
'Access-Control-Allow-Origin': '*',
|
|
9
|
+
'Access-Control-Allow-Methods': 'POST, OPTIONS',
|
|
10
|
+
'Access-Control-Allow-Headers': 'Content-Type',
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export function proxyPlugin(): Plugin {
|
|
14
|
+
return {
|
|
15
|
+
name: 'dev-proxy',
|
|
16
|
+
apply: 'serve',
|
|
17
|
+
configureServer(server) {
|
|
18
|
+
server.middlewares.use(
|
|
19
|
+
(req: IncomingMessage, res: ServerResponse, next: () => void) => {
|
|
20
|
+
if (req.url === '/proxy' && req.method === 'OPTIONS') {
|
|
21
|
+
res.writeHead(204, CORS_HEADERS);
|
|
22
|
+
res.end();
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (req.url === '/proxy' && req.method === 'POST') {
|
|
27
|
+
let rawBody = '';
|
|
28
|
+
req.on('data', (chunk: Buffer) => {
|
|
29
|
+
rawBody += chunk.toString();
|
|
30
|
+
});
|
|
31
|
+
req.on('end', () => {
|
|
32
|
+
let parsed: {
|
|
33
|
+
url: string;
|
|
34
|
+
method?: string;
|
|
35
|
+
headers?: Record<string, string>;
|
|
36
|
+
body?: string;
|
|
37
|
+
};
|
|
38
|
+
try {
|
|
39
|
+
parsed = JSON.parse(rawBody);
|
|
40
|
+
} catch {
|
|
41
|
+
res.writeHead(400, CORS_HEADERS);
|
|
42
|
+
res.end(JSON.stringify({ error: 'Invalid JSON body' }));
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const { url, method = 'GET', headers = {}, body } = parsed;
|
|
47
|
+
|
|
48
|
+
if (!url) {
|
|
49
|
+
res.writeHead(400, CORS_HEADERS);
|
|
50
|
+
res.end(JSON.stringify({ error: 'Missing "url" field' }));
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
let targetUrl: URL;
|
|
55
|
+
try {
|
|
56
|
+
targetUrl = new URL(url);
|
|
57
|
+
} catch {
|
|
58
|
+
res.writeHead(400, CORS_HEADERS);
|
|
59
|
+
res.end(JSON.stringify({ error: 'Invalid URL' }));
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const isHttps = targetUrl.protocol === 'https:';
|
|
64
|
+
const transport = isHttps ? https : http;
|
|
65
|
+
const bodyBuffer = body ? Buffer.from(body) : undefined;
|
|
66
|
+
|
|
67
|
+
const options: http.RequestOptions = {
|
|
68
|
+
hostname: targetUrl.hostname,
|
|
69
|
+
port: targetUrl.port || (isHttps ? 443 : 80),
|
|
70
|
+
path: targetUrl.pathname + targetUrl.search,
|
|
71
|
+
method: method.toUpperCase(),
|
|
72
|
+
headers: {
|
|
73
|
+
...headers,
|
|
74
|
+
...(bodyBuffer
|
|
75
|
+
? { 'Content-Length': String(bodyBuffer.length) }
|
|
76
|
+
: {}),
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const proxyReq = transport.request(options, (proxyRes) => {
|
|
81
|
+
const responseHeaders: Record<string, string | string[]> = {
|
|
82
|
+
...CORS_HEADERS,
|
|
83
|
+
};
|
|
84
|
+
for (const [key, value] of Object.entries(proxyRes.headers)) {
|
|
85
|
+
if (value !== undefined) {
|
|
86
|
+
responseHeaders[key] = value;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
res.writeHead(proxyRes.statusCode ?? 200, responseHeaders);
|
|
90
|
+
proxyRes.pipe(res);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
proxyReq.on('error', (err: Error) => {
|
|
94
|
+
res.writeHead(502, CORS_HEADERS);
|
|
95
|
+
res.end(JSON.stringify({ error: err.message }));
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
if (bodyBuffer) {
|
|
99
|
+
proxyReq.write(bodyBuffer);
|
|
100
|
+
}
|
|
101
|
+
proxyReq.end();
|
|
102
|
+
});
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
next();
|
|
107
|
+
},
|
|
108
|
+
);
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
}
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import { TrackerPluginProvider } from '@
|
|
3
|
+
import { TrackerPluginProvider } from '@weavix/tracker-plugin-sdk-react';
|
|
4
4
|
import ReactDOM from 'react-dom/client';
|
|
5
5
|
|
|
6
6
|
import App from './App';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
import './styles-gravity.scss';
|
|
10
|
-
|
|
11
|
-
// yandex-360 theme
|
|
12
|
-
// import './styles-360.scss';
|
|
8
|
+
import './styles.scss';
|
|
13
9
|
|
|
14
10
|
const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
|
|
15
11
|
root.render(
|