@retailcrm/embed-ui 0.2.0 → 0.2.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/CHANGELOG.md +12 -0
- package/dist/index.cjs +2 -1
- package/dist/index.mjs +2 -1
- package/package.json +1 -1
- package/types/context/schema.d.ts +5 -5
- package/scripts/generate-meta.ts +0 -54
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.2.1](https://github.com/retailcrm/embed-ui/compare/v0.2.0...v0.2.1) (2024-11-04)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* Added CrmYandexMap to known components ([90621b0](https://github.com/retailcrm/embed-ui/commit/90621b079465970b558d783d5e65bb01aef54586))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Fixes
|
|
14
|
+
|
|
15
|
+
* ContextAccessor getter return type ([5a98241](https://github.com/retailcrm/embed-ui/commit/5a98241fd230ef0341f4bb8b935d8cf33ae8db11))
|
|
16
|
+
|
|
5
17
|
## [0.2.0](https://github.com/retailcrm/embed-ui/compare/v0.1.0...v0.2.0) (2024-11-02)
|
|
6
18
|
|
|
7
19
|
|
package/dist/index.cjs
CHANGED
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@retailcrm/embed-ui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.1",
|
|
5
5
|
"description": "API and components for creating RetailCRM UI extensions",
|
|
6
6
|
"repository": "git@github.com:retailcrm/embed-ui.git",
|
|
7
7
|
"author": "RetailDriverLLC <integration@retailcrm.ru>",
|
|
@@ -46,14 +46,14 @@ export type EventHandler<
|
|
|
46
46
|
> = (payload: TypeOf<S[EventMap<S>[E]]>) => void
|
|
47
47
|
|
|
48
48
|
export type ContextAccessor<M extends ContextSchemaMap = ContextSchemaMap> = {
|
|
49
|
-
get <
|
|
50
|
-
C extends keyof M
|
|
51
|
-
>(context: C, field: '~'): Context<M[C]>;
|
|
52
|
-
|
|
53
49
|
get <
|
|
54
50
|
C extends keyof M,
|
|
55
51
|
F extends keyof M[C]
|
|
56
|
-
>(context: C, field: F):
|
|
52
|
+
>(context: C, field: F | '~'): If<
|
|
53
|
+
IsTilda<typeof field>,
|
|
54
|
+
Context<M[C]>,
|
|
55
|
+
Context<M[C]>[F]
|
|
56
|
+
>;
|
|
57
57
|
|
|
58
58
|
set <
|
|
59
59
|
C extends keyof M,
|
package/scripts/generate-meta.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import type { ContextSchema } from '~types/context/schema'
|
|
2
|
-
import type { SchemaDocumentation } from '~meta'
|
|
3
|
-
|
|
4
|
-
import * as fs from 'node:fs'
|
|
5
|
-
|
|
6
|
-
import { fileURLToPath } from 'node:url'
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
dirname,
|
|
10
|
-
join,
|
|
11
|
-
resolve,
|
|
12
|
-
} from 'node:path'
|
|
13
|
-
|
|
14
|
-
import { keysOf } from '@/utilities'
|
|
15
|
-
|
|
16
|
-
import {
|
|
17
|
-
schemaList,
|
|
18
|
-
schemaListDocumentation,
|
|
19
|
-
targetListDocumentation,
|
|
20
|
-
pageListDocumentation,
|
|
21
|
-
} from '~meta'
|
|
22
|
-
|
|
23
|
-
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
24
|
-
|
|
25
|
-
const dist = resolve(__dirname, '../dist/')
|
|
26
|
-
|
|
27
|
-
if (!fs.existsSync(dist)) {
|
|
28
|
-
fs.mkdirSync(dist)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
fs.writeFileSync(join(dist, 'meta.json'), JSON.stringify({
|
|
32
|
-
contexts: keysOf(schemaList).reduce((meta, key) => {
|
|
33
|
-
const schema = schemaList[key] as ContextSchema
|
|
34
|
-
|
|
35
|
-
meta[key] = keysOf(schema).map(field => {
|
|
36
|
-
const accepts = schema[field].accepts
|
|
37
|
-
const documentation = schemaListDocumentation[key] as SchemaDocumentation<ContextSchema>
|
|
38
|
-
|
|
39
|
-
return {
|
|
40
|
-
name: field,
|
|
41
|
-
type: 'type' in accepts ? accepts.type : 'unknown',
|
|
42
|
-
description: documentation[field].description,
|
|
43
|
-
readonly: schema[field].readonly,
|
|
44
|
-
}
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
return meta
|
|
48
|
-
}, {} as Record<string, unknown>),
|
|
49
|
-
targets: keysOf(targetListDocumentation).map(target => ({
|
|
50
|
-
id: target,
|
|
51
|
-
...targetListDocumentation[target],
|
|
52
|
-
})),
|
|
53
|
-
pages: pageListDocumentation,
|
|
54
|
-
}, null, 2))
|