@yartsun/chat-widget-types 1.0.3 → 1.0.6

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.
Files changed (52) hide show
  1. package/README.md +214 -115
  2. package/dist/config.types.d.ts +111 -46
  3. package/dist/config.types.d.ts.map +1 -1
  4. package/dist/config.types.js +2 -66
  5. package/dist/config.types.js.map +1 -1
  6. package/dist/default-config.d.ts +3 -0
  7. package/dist/default-config.d.ts.map +1 -0
  8. package/dist/default-config.js +3 -0
  9. package/dist/default-config.js.map +1 -0
  10. package/dist/index.d.ts +6 -0
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +5 -0
  13. package/dist/index.js.map +1 -1
  14. package/dist/migration/commands.d.ts +59 -0
  15. package/dist/migration/commands.d.ts.map +1 -0
  16. package/dist/migration/commands.js +286 -0
  17. package/dist/migration/commands.js.map +1 -0
  18. package/dist/migration/examples.d.ts +198 -0
  19. package/dist/migration/examples.d.ts.map +1 -0
  20. package/dist/migration/examples.js +439 -0
  21. package/dist/migration/examples.js.map +1 -0
  22. package/dist/migration/facade.d.ts +85 -0
  23. package/dist/migration/facade.d.ts.map +1 -0
  24. package/dist/migration/facade.js +168 -0
  25. package/dist/migration/facade.js.map +1 -0
  26. package/dist/migration/migrator.d.ts +49 -0
  27. package/dist/migration/migrator.d.ts.map +1 -0
  28. package/dist/migration/migrator.js +245 -0
  29. package/dist/migration/migrator.js.map +1 -0
  30. package/dist/migration/strategies.d.ts +85 -0
  31. package/dist/migration/strategies.d.ts.map +1 -0
  32. package/dist/migration/strategies.js +217 -0
  33. package/dist/migration/strategies.js.map +1 -0
  34. package/dist/migration/types.d.ts +196 -0
  35. package/dist/migration/types.d.ts.map +1 -0
  36. package/dist/migration/types.js +5 -0
  37. package/dist/migration/types.js.map +1 -0
  38. package/dist/utils.d.ts +1 -11
  39. package/dist/utils.d.ts.map +1 -1
  40. package/dist/utils.js +3 -129
  41. package/dist/utils.js.map +1 -1
  42. package/package.json +13 -4
  43. package/src/config.types.ts +131 -121
  44. package/src/default-config.ts +6 -0
  45. package/src/index.ts +26 -0
  46. package/src/migration/commands.ts +314 -0
  47. package/src/migration/examples.ts +471 -0
  48. package/src/migration/facade.ts +196 -0
  49. package/src/migration/migrator.ts +361 -0
  50. package/src/migration/strategies.ts +249 -0
  51. package/src/migration/types.ts +182 -0
  52. package/src/utils.ts +3 -145
package/dist/utils.js CHANGED
@@ -1,130 +1,4 @@
1
- import { DEFAULT_CONFIG } from "./config.types";
2
- export const extractSettings = (config) => ({
3
- // Общие настройки
4
- general: {
5
- widgetTitle: config.settings.widgetTitle,
6
- welcomeMessage: config.settings.welcomeMessage,
7
- launchView: config.settings.launchView,
8
- logo: config.settings.logo,
9
- },
10
- // Настройки форм и размеров
11
- shapes: {
12
- gapMessageLine: config.settings.gapMessageLine,
13
- paddingChat: config.settings.paddingChat,
14
- fontFamily: config.settings.fontFamily,
15
- borderRadius: config.settings.borderRadius,
16
- bottomSize: config.sections.bottom.params.size,
17
- sendButtonType: config.sections.bottom.btnSend.type,
18
- headerSize: config.sections.top.params.size,
19
- messageSize: config.sections.inside.params.size,
20
- },
21
- // Настройки цветов
22
- colors: {
23
- bgChat: { bgColor: config.settings.bgChat },
24
- welcomeMessage: { color: config.sections.inside?.welcomeMessage?.color || '#fff' },
25
- chipWidgetTitle: {
26
- color: config.sections.top.chipWidgetTitle.color,
27
- bgColor: config.sections.top.chipWidgetTitle.bgColor,
28
- },
29
- btnClose: {
30
- color: config.sections.top.btnClose.color,
31
- bgColor: config.sections.top.btnClose.bgColor,
32
- },
33
- messageUser: {
34
- color: config.sections.inside.messageUser.color,
35
- bgColor: config.sections.inside.messageUser.bgColor,
36
- },
37
- messageBot: {
38
- color: config.sections.inside.messageBot.color,
39
- bgColor: config.sections.inside.messageBot.bgColor,
40
- },
41
- inputSend: {
42
- color: config.sections.bottom.inputSend.color,
43
- bgColor: config.sections.bottom.inputSend.bgColor,
44
- },
45
- btnSend: {
46
- color: config.sections.bottom.btnSend.color,
47
- bgColor: config.sections.bottom.btnSend.bgColor,
48
- },
49
- activeBtn: {
50
- color: config.sections.bottom.activeBtn.color,
51
- bgColor: config.sections.bottom.activeBtn.bgColor,
52
- },
53
- },
54
- // Шрифт отдельно
55
- font: {
56
- fontFamily: config.settings.fontFamily,
57
- letterSpacing: config.settings.letterSpacing,
58
- fontWeight: config.settings.fontWeight,
59
- },
60
- });
61
- /**
62
- * Функция для сборки полного конфига из отдельных частей
63
- */
64
- export function buildWidgetConfig(general, shapes, colors, fonts) {
65
- return {
66
- settings: {
67
- widgetTitle: general.widgetTitle,
68
- welcomeMessage: general.welcomeMessage,
69
- launchView: general.launchView,
70
- bgChat: colors.bgChat.bgColor || colors.bgChat.color || DEFAULT_CONFIG.settings.bgChat,
71
- gapMessageLine: shapes.gapMessageLine,
72
- paddingChat: shapes.paddingChat,
73
- borderRadius: shapes.borderRadius,
74
- fontFamily: fonts.fontFamily,
75
- letterSpacing: fonts.letterSpacing,
76
- logo: general.logo,
77
- fontWeight: fonts.fontWeight,
78
- },
79
- sections: {
80
- top: {
81
- params: {
82
- size: shapes.headerSize,
83
- },
84
- chipWidgetTitle: {
85
- color: colors.chipWidgetTitle.color || DEFAULT_CONFIG.sections.top.chipWidgetTitle.color,
86
- bgColor: colors.chipWidgetTitle.bgColor || DEFAULT_CONFIG.sections.top.chipWidgetTitle.bgColor,
87
- },
88
- btnClose: {
89
- color: colors.btnClose.color || DEFAULT_CONFIG.sections.top.btnClose.color,
90
- bgColor: colors.btnClose.bgColor || DEFAULT_CONFIG.sections.top.btnClose.bgColor,
91
- },
92
- },
93
- inside: {
94
- params: {
95
- size: shapes.messageSize,
96
- },
97
- messageUser: {
98
- color: colors.messageUser.color || DEFAULT_CONFIG.sections.inside.messageUser.color,
99
- bgColor: colors.messageUser.bgColor || DEFAULT_CONFIG.sections.inside.messageUser.bgColor,
100
- },
101
- messageBot: {
102
- color: colors.messageBot.color || DEFAULT_CONFIG.sections.inside.messageBot.color,
103
- bgColor: colors.messageBot.bgColor || DEFAULT_CONFIG.sections.inside.messageBot.bgColor,
104
- },
105
- welcomeMessage: {
106
- color: colors.welcomeMessage.color || DEFAULT_CONFIG.sections.inside.welcomeMessage.color,
107
- },
108
- },
109
- bottom: {
110
- params: {
111
- size: shapes.bottomSize,
112
- },
113
- inputSend: {
114
- color: colors.inputSend.color || DEFAULT_CONFIG.sections.bottom.inputSend.color,
115
- bgColor: colors.inputSend.bgColor || DEFAULT_CONFIG.sections.bottom.inputSend.bgColor,
116
- },
117
- btnSend: {
118
- color: colors.btnSend.color || DEFAULT_CONFIG.sections.bottom.btnSend.color,
119
- bgColor: colors.btnSend.bgColor || DEFAULT_CONFIG.sections.bottom.btnSend.bgColor,
120
- type: shapes.sendButtonType,
121
- },
122
- activeBtn: {
123
- color: colors.activeBtn.color || DEFAULT_CONFIG.sections.bottom.activeBtn.color,
124
- bgColor: colors.activeBtn.bgColor || DEFAULT_CONFIG.sections.bottom.activeBtn.bgColor,
125
- },
126
- },
127
- },
128
- };
129
- }
1
+ export const getIcon = (icon) => {
2
+ return icon;
3
+ };
130
4
  //# sourceMappingURL=utils.js.map
package/dist/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6F,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE1I,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,MAAoB,EAKlD,EAAE,CAAC,CAAC;IACJ,kBAAkB;IAClB,OAAO,EAAE;QACP,WAAW,EAAE,MAAM,CAAC,QAAQ,CAAC,WAAW;QACxC,cAAc,EAAE,MAAM,CAAC,QAAQ,CAAC,cAAc;QAC9C,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,UAAU;QACtC,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,IAAI;KACR;IAEpB,4BAA4B;IAC5B,MAAM,EAAE;QACN,cAAc,EAAE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+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAY,EAAE,EAAE;IACtC,OAAO,IAAI,CAAA;AACb,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@yartsun/chat-widget-types",
3
- "version": "1.0.3",
4
- "description": "TypeScript definitions for HyperShadow Chat Widget",
3
+ "version": "1.0.6",
4
+ "description": "TypeScript definitions and professional migration system for HyperShadow Chat Widget configurations",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "files": [
@@ -12,7 +12,11 @@
12
12
  "build": "tsc",
13
13
  "build:watch": "tsc --watch",
14
14
  "clean": "rm -rf dist",
15
- "prepublishOnly": "npm run clean && npm run build"
15
+ "prepublishOnly": "npm run clean && npm run build",
16
+ "migrate": "npx tsx migrator/cli.ts",
17
+ "migrate:demo": "npx tsx migrator/demo.ts",
18
+ "migrate:examples": "npx tsx -e \"import('./src/migration/examples.js').then(m => m.runAllExamples())\"",
19
+ "migrate:help": "npx tsx migrator/cli.ts --help"
16
20
  },
17
21
  "keywords": [
18
22
  "typescript",
@@ -20,12 +24,17 @@
20
24
  "chat",
21
25
  "widget",
22
26
  "microfrontend",
23
- "module-federation"
27
+ "module-federation",
28
+ "migration",
29
+ "config-migration",
30
+ "schema-migration",
31
+ "version-upgrade"
24
32
  ],
25
33
  "author": "HyperShadow Team",
26
34
  "license": "MIT",
27
35
  "devDependencies": {
28
36
  "@types/node": "^24.0.13",
37
+ "ts-node": "^10.9.2",
29
38
  "typescript": "^5.8.3"
30
39
  },
31
40
  "repository": {
@@ -1,64 +1,164 @@
1
1
  /**
2
- * Типы для конфигурации виджета чата
2
+ * Типы для конфигурации виджета чата (V2)
3
3
  */
4
4
 
5
5
  // Базовые типы
6
6
  export type Size = 'sm' | 'md' | 'lg'
7
7
  export type BorderRadius = '0' | 'sm' | 'md' | 'lg'
8
8
  export type BtnType = 'icon' | 'text' | 'both'
9
- export type LaunchView = 'closed' | 'compact' | 'open'
9
+ export type LaunchView = 'closed' | 'compact'
10
+ export type ChipStyle = 'filled' | 'outlined' | 'invisible'
11
+ export type Loader = 'dots' | 'dots-pulse' | 'circle-pulse' | 'circle-pulse-1'
12
+ export type BgType = 'plain' | 'bubble'
13
+ export type InputStyle = 'inside' | 'stacked'
14
+ export type ButtonStyle = 'filled' | 'outlined' | 'invisible'
15
+ export type WarningStyle = 'gradient' | 'filled' | 'faded'
16
+
17
+ // Схема конфигурации
18
+ export interface ConfigSchema {
19
+ version: string
20
+ required: string[]
21
+ }
22
+
23
+ // Настройки виджета
24
+ export interface WidgetSettings {
25
+ bgChat: string
26
+ gapMessageLine: number
27
+ fontFamily: string
28
+ borderRadius: BorderRadius
29
+ launchView: LaunchView
30
+ letterSpacing: number
31
+ logo: string
32
+ fontWeight: number
33
+ loader: Loader
34
+ }
35
+
36
+ // Тексты виджета
37
+ export interface WidgetTexts {
38
+ welcomeMessage: string
39
+ widgetTitle: string
40
+ launchIssueTitle: string
41
+ launchIssueText: string
42
+ issueText: string
43
+ reconnectText: string
44
+ inputPlaceholder: string
45
+ disableInputText: string
46
+ disclaimer: string
47
+ }
48
+
49
+ // Базовые типы для элементов
50
+ export interface BorderStyle {
51
+ borderColor: string
52
+ borderWidth?: number
53
+ }
54
+
10
55
  export interface ColorItems {
11
56
  color?: string
12
57
  bgColor?: string
13
58
  }
14
- // Типы для элементов интерфейса
59
+
15
60
  export interface UIElement {
16
61
  color: string
17
62
  bgColor?: string
18
63
  type?: BtnType
64
+ bgType?: BgType
19
65
  }
20
66
 
21
- export interface SectionParams {
22
- size: Size
67
+ export interface InputSendElement extends UIElement {
68
+ inputStyle: InputStyle
69
+ borderStyle: BorderStyle
23
70
  }
24
71
 
25
- // Типы для настроек
26
- export interface WidgetSettings {
27
- widgetTitle: string
28
- welcomeMessage: string
29
- bgChat: string
30
- gapMessageLine: number
31
- paddingChat: number
32
- fontFamily: string
33
- borderRadius: BorderRadius
34
- launchView: LaunchView
35
- letterSpacing: number
36
- logo: string
37
- fontWeight: number
72
+ // Типы для Active Snippet
73
+ export interface ActiveSnippetParams {
74
+ buttonType: BtnType
75
+ buttonStyle: ButtonStyle
76
+ }
77
+
78
+ export interface ActiveSnippetElement {
79
+ params: ActiveSnippetParams
80
+ color: string
81
+ bgColor: string
82
+ headerChip: ColorItems
83
+ propertyColor: string
84
+ valueColor: string
85
+ yesButton: ColorItems
86
+ noButton: ColorItems
87
+ }
88
+
89
+ // Типы для предупреждений
90
+ export interface WarningParams {
91
+ warningStyle: WarningStyle
92
+ showIcon: boolean
93
+ icon: string
94
+ }
95
+
96
+ export interface WarningElement {
97
+ params: WarningParams
98
+ iconColor: string
99
+ bgColor: string
100
+ headlineColor?: string
101
+ color: string
102
+ resetButton?: {
103
+ color: string
104
+ bgColor: string
105
+ }
106
+ }
107
+
108
+ export interface WarningsSection {
109
+ launchIssue: WarningElement
110
+ connectionIssue: WarningElement
111
+ reconnectIssue: WarningElement
112
+ disableInputIssue: {
113
+ iconColor: string
114
+ bgColor: string
115
+ color: string
116
+ }
117
+ }
118
+
119
+ // Типы для лоадера
120
+ export interface LoaderSection {
121
+ completeStep: string
122
+ activeStep: string
38
123
  }
39
124
 
40
125
  // Типы для секций
41
126
  export interface TopSection {
42
- params: SectionParams
43
- chipWidgetTitle: UIElement
44
- btnClose: UIElement
127
+ params: {
128
+ size: Size
129
+ chipStyle: ChipStyle
130
+ chipType: BtnType
131
+ buttonStyle: ButtonStyle
132
+ buttonType: BtnType
133
+ }
134
+ chipWidgetTitle: ColorItems
135
+ buttons: ColorItems
45
136
  }
46
137
 
47
138
  export interface InsideSection {
48
- params: SectionParams
139
+ params: {
140
+ size: Size
141
+ }
49
142
  messageUser: UIElement
50
143
  messageBot: UIElement
144
+ activeSnippet: ActiveSnippetElement
51
145
  welcomeMessage: UIElement
52
146
  }
53
147
 
54
148
  export interface BottomSection {
55
- params: SectionParams
56
- inputSend: UIElement
149
+ params: {
150
+ size: Size
151
+ disclaimerShow: boolean
152
+ }
153
+ inputSend: InputSendElement
154
+ warningAlert: UIElement
57
155
  btnSend: UIElement
58
156
  activeBtn: UIElement
59
157
  }
60
158
 
61
159
  export interface WidgetSections {
160
+ warnings: WarningsSection
161
+ loader: LoaderSection
62
162
  top: TopSection
63
163
  inside: InsideSection
64
164
  bottom: BottomSection
@@ -66,18 +166,22 @@ export interface WidgetSections {
66
166
 
67
167
  // Основной тип конфигурации
68
168
  export interface WidgetConfig {
169
+ schema: ConfigSchema
69
170
  settings: WidgetSettings
171
+ texts: WidgetTexts
70
172
  sections: WidgetSections
71
173
  }
72
174
 
73
175
  // Типы для частичного обновления конфигурации
74
176
  export type PartialWidgetConfig = Partial<WidgetConfig>
75
177
  export type PartialWidgetSettings = Partial<WidgetSettings>
178
+ export type PartialWidgetTexts = Partial<WidgetTexts>
76
179
  export type PartialWidgetSections = Partial<WidgetSections>
77
180
 
78
181
  // Утилитарные типы
79
182
  export type ConfigKey = keyof WidgetConfig
80
183
  export type SettingsKey = keyof WidgetSettings
184
+ export type TextsKey = keyof WidgetTexts
81
185
  export type SectionsKey = keyof WidgetSections
82
186
 
83
187
  // Типы для валидации
@@ -86,103 +190,9 @@ export interface ConfigValidationResult {
86
190
  errors: string[]
87
191
  }
88
192
 
89
-
90
- export type GeneralSettings = Pick<WidgetSettings, 'widgetTitle' | 'welcomeMessage' | 'launchView' | 'logo'>
91
-
92
- export type ShapesSettings = Pick<
93
- WidgetSettings,
94
- 'gapMessageLine' | 'paddingChat' | 'fontFamily' | 'borderRadius'
95
- > & {
96
- bottomSize: WidgetConfig['sections']['bottom']['params']['size']
97
- sendButtonType: BtnType
98
- headerSize: WidgetConfig['sections']['top']['params']['size']
99
- messageSize: WidgetConfig['sections']['inside']['params']['size']
100
- }
101
- export type EmittedColorElement = {
102
- bgChat: ColorItems
103
- chipWidgetTitle: ColorItems
104
- btnClose: ColorItems
105
- messageUser: ColorItems
106
- messageBot: ColorItems
107
- inputSend: ColorItems
108
- btnSend: ColorItems
109
- activeBtn: ColorItems
110
- welcomeMessage: ColorItems
111
- }
112
- export interface FontSettings {
113
- fontFamily: string
114
- letterSpacing: number
115
- fontWeight: number
116
- }
117
-
118
- // Экспорт дефолтной конфигурации (для типизации)
119
- export const DEFAULT_CONFIG: WidgetConfig = {
120
- settings: {
121
- widgetTitle: 'HyperShadow',
122
- welcomeMessage:
123
- '🖖 Hi there — I’m your assistant for finding documents, tracking access, and making sense of your files. \n\nHow can I help?',
124
- bgChat: 'rgba(47, 47, 49, 0.90)',
125
- gapMessageLine: 12,
126
- paddingChat: 8,
127
- fontFamily: 'MacPaw Fixel',
128
- borderRadius: 'lg',
129
- launchView: 'closed',
130
- letterSpacing: 0,
131
- logo: '',
132
- fontWeight: 400,
133
- },
134
- sections: {
135
- top: {
136
- params: {
137
- size: 'md',
138
- },
139
- chipWidgetTitle: {
140
- color: '#BEB6E9',
141
- bgColor: '#5E4AC6',
142
- },
143
- btnClose: {
144
- color: '#BBBBBD',
145
- bgColor: '#2F2F31',
146
- },
147
- },
148
- inside: {
149
- params: {
150
- size: 'md',
151
- },
152
- messageUser: {
153
- color: '#F9F8F8',
154
- bgColor: '#F8F8F933',
155
- },
156
- messageBot: {
157
- color: '#fff',
158
- bgColor: '#5E4AC6',
159
- },
160
- welcomeMessage: {
161
- color: '#fff',
162
- },
163
- },
164
- bottom: {
165
- params: {
166
- size: 'sm',
167
- },
168
- inputSend: {
169
- color: '#EEECEC',
170
- bgColor: '#1E1E1E',
171
- },
172
- btnSend: {
173
- color: '#1E1E1E',
174
- bgColor: 'rgba(255, 255, 255, 0.50)',
175
- type: 'both',
176
- },
177
- activeBtn: {
178
- color: '#fff',
179
- bgColor: '#F8F8F933',
180
- },
181
- },
182
- },
183
- }
184
-
185
193
  // Утилитарный тип для глубоких частичных объектов
186
194
  export type DeepPartial<T> = {
187
195
  [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P]
188
- }
196
+ }
197
+
198
+ export { DEFAULT_CONFIG } from './default-config'
@@ -0,0 +1,6 @@
1
+ import example from '../examples/configV2.json'
2
+ import type { WidgetConfig } from './config.types'
3
+
4
+ export const DEFAULT_CONFIG: WidgetConfig = example as unknown as WidgetConfig
5
+
6
+
package/src/index.ts CHANGED
@@ -1,2 +1,28 @@
1
1
  export * from './config.types'
2
2
  export * from './utils'
3
+
4
+ // Система миграции конфигураций
5
+ // Явный реэкспорт с алиасом для конфликтующего имени ConfigSchema
6
+ export {
7
+ ConfigVersion,
8
+ MigrationResult,
9
+ MigrationContext,
10
+ MigrationOptions,
11
+ MigrationStrategy,
12
+ MigrationStepResult,
13
+ MigrationCommand,
14
+ VersionDetector,
15
+ ConfigValidator,
16
+ ConfigSchema as MigrationConfigSchema,
17
+ MigrationReport,
18
+ MigrationLogger,
19
+ ConfigV1,
20
+ ConfigV2,
21
+ ConfigByVersion,
22
+ ConfigFactory,
23
+ } from './migration/types'
24
+ export * from './migration/strategies'
25
+ export * from './migration/commands'
26
+ export * from './migration/migrator'
27
+ export * from './migration/facade'
28
+ export * from './migration/examples'