@retailcrm/embed-ui 0.4.1-alpha.8 → 0.4.1-beta.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 CHANGED
@@ -1,6 +1,74 @@
1
1
  # Changelog
2
2
 
3
3
 
4
+ ## [0.4.1-beta.1](https://github.com/retailcrm/embed-ui/compare/v0.4.1-alpha.25...v0.4.1-beta.1) (2024-11-29)
5
+
6
+ ### Features
7
+
8
+ * Added typeCode / siteCode to order/card schema ([c3c4a27](https://github.com/retailcrm/embed-ui/commit/c3c4a278497aceb179791a5476df08a7666d36fa))
9
+
10
+ ### Bug Fixes
11
+
12
+ * **v1-components:** Styles of ellipsis modifier of UiLink ([c3b2189](https://github.com/retailcrm/embed-ui/commit/c3b2189712a036bec982360f1e7fcccd75038423))
13
+ ## [0.4.1-alpha.25](https://github.com/retailcrm/embed-ui/compare/v0.4.1-alpha.24...v0.4.1-alpha.25) (2024-11-28)
14
+ ## [0.4.1-alpha.24](https://github.com/retailcrm/embed-ui/compare/v0.4.1-alpha.23...v0.4.1-alpha.24) (2024-11-28)
15
+ ## [0.4.1-alpha.23](https://github.com/retailcrm/embed-ui/compare/v0.4.1-alpha.22...v0.4.1-alpha.23) (2024-11-28)
16
+ ## [0.4.1-alpha.22](https://github.com/retailcrm/embed-ui/compare/v0.4.1-alpha.21...v0.4.1-alpha.22) (2024-11-28)
17
+
18
+ ### Bug Fixes
19
+
20
+ * **v1-components:** Added slot 'icon' to remote UiLink definition ([c15bd98](https://github.com/retailcrm/embed-ui/commit/c15bd989d0c1ed08f185b35104e09e678e90dfb6))
21
+ ## [0.4.1-alpha.21](https://github.com/retailcrm/embed-ui/compare/v0.4.1-alpha.20...v0.4.1-alpha.21) (2024-11-27)
22
+
23
+ ### Bug Fixes
24
+
25
+ * **v1-components:** Missing VueI18n export ([ed6ef3a](https://github.com/retailcrm/embed-ui/commit/ed6ef3ab50a5879c18b205d24db0c3c9c9da537a))
26
+ ## [0.4.1-alpha.20](https://github.com/retailcrm/embed-ui/compare/v0.4.1-alpha.19...v0.4.1-alpha.20) (2024-11-27)
27
+
28
+ ### Bug Fixes
29
+
30
+ * **v1-components:** Missing i18n plugin ([635b839](https://github.com/retailcrm/embed-ui/commit/635b839b0d533e00c04fba00e8293b4793bd0b42))
31
+ ## [0.4.1-alpha.19](https://github.com/retailcrm/embed-ui/compare/v0.4.1-alpha.18...v0.4.1-alpha.19) (2024-11-27)
32
+
33
+ ### Features
34
+
35
+ * Added field 'photo' to 'user/current' context ([4d6aece](https://github.com/retailcrm/embed-ui/commit/4d6aece931d23ad74d2afa54fcfc1cc821846ca2))
36
+ ## [0.4.1-alpha.18](https://github.com/retailcrm/embed-ui/compare/v0.4.1-alpha.17...v0.4.1-alpha.18) (2024-11-27)
37
+
38
+ ### Bug Fixes
39
+
40
+ * Missing components info for remote root ([ee0cf4a](https://github.com/retailcrm/embed-ui/commit/ee0cf4a33d5f9fe41462f66eb65b1715081cd8c8))
41
+ ## [0.4.1-alpha.17](https://github.com/retailcrm/embed-ui/compare/v0.4.1-alpha.16...v0.4.1-alpha.17) (2024-11-27)
42
+ ## [0.4.1-alpha.16](https://github.com/retailcrm/embed-ui/compare/v0.4.1-alpha.15...v0.4.1-alpha.16) (2024-11-27)
43
+
44
+ ### Bug Fixes
45
+
46
+ * **v1-components:** exports configuration ([4756f47](https://github.com/retailcrm/embed-ui/commit/4756f4723afb79238c4f543bc8ddabebd55411d1))
47
+ ## [0.4.1-alpha.15](https://github.com/retailcrm/embed-ui/compare/v0.4.1-alpha.14...v0.4.1-alpha.15) (2024-11-26)
48
+
49
+ ### Bug Fixes
50
+
51
+ * Types across schemas, removed artifacts from unsuccessful rebase ([d34514d](https://github.com/retailcrm/embed-ui/commit/d34514df0e6fcdd9b0e9a1a2e9c909e299138284))
52
+ ## [0.4.1-alpha.14](https://github.com/retailcrm/embed-ui/compare/v0.4.1-alpha.13...v0.4.1-alpha.14) (2024-11-26)
53
+ ## [0.4.1-alpha.13](https://github.com/retailcrm/embed-ui/compare/v0.4.1-alpha.12...v0.4.1-alpha.13) (2024-11-26)
54
+ ## [0.4.1-alpha.12](https://github.com/retailcrm/embed-ui/compare/v0.4.1-alpha.11...v0.4.1-alpha.12) (2024-11-26)
55
+ ## [0.4.1-alpha.11](https://github.com/retailcrm/embed-ui/compare/v0.4.1-alpha.10...v0.4.1-alpha.11) (2024-11-26)
56
+
57
+ ### Features
58
+
59
+ * **v1-components:** Added links validator for UiButton and UiLink ([94788df](https://github.com/retailcrm/embed-ui/commit/94788df863f1c25d80ec5ad537fe40b2b10d27ef))
60
+ * **v1-components:** Added UiToolbar, UiToolbarButton and UiToolbarLink ([2bba2b5](https://github.com/retailcrm/embed-ui/commit/2bba2b5ba422ced4649f4d634672b3fdf52c8b01))
61
+ ## [0.4.1-alpha.10](https://github.com/retailcrm/embed-ui/compare/v0.4.1-alpha.9...v0.4.1-alpha.10) (2024-11-26)
62
+
63
+ ### Bug Fixes
64
+
65
+ * Missing import of ReadonlyField ([5a068ce](https://github.com/retailcrm/embed-ui/commit/5a068cead28bb40ee5c2b66116c4ae615b9661ad))
66
+ ## [0.4.1-alpha.9](https://github.com/retailcrm/embed-ui/compare/v0.4.1-alpha.8...v0.4.1-alpha.9) (2024-11-26)
67
+
68
+ ### Bug Fixes
69
+
70
+ * Types declaration in index.d.ts ([2751630](https://github.com/retailcrm/embed-ui/commit/2751630db649592bc4e8f2b8e16aaf86a7971e0f))
71
+ * **v1-components:** Missing slot of remote UiModalWindow definition ([2bf97a3](https://github.com/retailcrm/embed-ui/commit/2bf97a33e2eee41090195038733bc89baf72bc3d))
4
72
  ## [0.4.1-alpha.8](https://github.com/retailcrm/embed-ui/compare/v0.4.1-alpha.7...v0.4.1-alpha.8) (2024-11-25)
5
73
 
6
74
  ### Bug Fixes
package/README.md CHANGED
@@ -7,47 +7,3 @@ API и компоненты для создания расширений инт
7
7
  Цели встраивания определяют места, где будет размещена разметка виджета, генерируемая расширением.
8
8
 
9
9
  https://docs.retailcrm.ru/Developers/modules/PublishingModuleMarketplace/JsModulesTargets
10
-
11
- ## Контексты
12
-
13
- Предоставляют данные из системы, реактивны.
14
-
15
- ### `customer/card`
16
-
17
- Данные карточки клиента
18
-
19
- ```typescript
20
- import { useCustomerCardContext } from '@retailcrm/embed-ui'
21
-
22
- const customer = useCustomerCardContext()
23
- ```
24
-
25
- ### `customer/card:phone`
26
-
27
- Данные телефона клиента
28
-
29
- ```typescript
30
- import { useCustomerCardPhoneContext } from '@retailcrm/embed-ui'
31
-
32
- const phone = useCustomerCardPhoneContext()
33
- ```
34
-
35
- ### `order/card`
36
-
37
- Данные карточки заказа
38
-
39
- ```typescript
40
- import { useOrderCardContext } from '@retailcrm/embed-ui'
41
-
42
- const order = useOrderCardContext()
43
- ```
44
-
45
- ### `settings`
46
-
47
- Настройки CRM
48
-
49
- ```typescript
50
- import { useSettingsContext } from '@retailcrm/embed-ui'
51
-
52
- const settings = useSettingsContext()
53
- ```
package/dist/index.cjs CHANGED
@@ -56,6 +56,9 @@ const defineContext = (id, schema2) => {
56
56
  const withMeta = (predicate, type) => {
57
57
  return Object.assign(predicate, { type });
58
58
  };
59
+ const isExactly = (expected) => {
60
+ return withMeta((value) => value === expected, JSON.stringify(expected));
61
+ };
59
62
  const isNull = withMeta((value) => value === null, "null");
60
63
  const isNumber = withMeta((value) => typeof value === "number", "number");
61
64
  const isString = withMeta((value) => typeof value === "string", "string");
@@ -72,31 +75,41 @@ const oneOf = (...predicates) => withMeta(
72
75
  predicates.map((p) => p.type).join(" | ")
73
76
  );
74
77
  const schema$4 = {
75
- "lastName": {
76
- accepts: oneOf(isString, isNull),
78
+ "id": {
79
+ accepts: oneOf(isNumber, isNull),
77
80
  defaults: () => null,
78
- readonly: false
81
+ readonly: true
82
+ },
83
+ "email": {
84
+ accepts: isString,
85
+ defaults: () => "",
86
+ readonly: true
79
87
  },
80
88
  "firstName": {
81
89
  accepts: oneOf(isString, isNull),
82
90
  defaults: () => null,
83
- readonly: false
91
+ readonly: true
84
92
  },
85
- "patronymic": {
93
+ "lastName": {
86
94
  accepts: oneOf(isString, isNull),
87
95
  defaults: () => null,
88
- readonly: false
96
+ readonly: true
89
97
  },
90
- "email": {
91
- accepts: isString,
92
- defaults: () => "",
98
+ "patronymic": {
99
+ accepts: oneOf(isString, isNull),
100
+ defaults: () => null,
93
101
  readonly: true
94
102
  },
95
- "id": {
96
- accepts: oneOf(isNumber, isNull),
103
+ "photo": {
104
+ accepts: oneOf(isString, isNull),
97
105
  defaults: () => null,
98
106
  readonly: true
99
107
  },
108
+ "groups": {
109
+ accepts: arrayOf(isString),
110
+ defaults: () => [],
111
+ readonly: true
112
+ },
100
113
  "permissions": {
101
114
  accepts: arrayOf(isString),
102
115
  defaults: () => [],
@@ -151,15 +164,28 @@ const schema$1 = {
151
164
  defaults: () => null,
152
165
  readonly: true
153
166
  },
167
+ "typeCode": {
168
+ accepts: oneOf(isString, isNull),
169
+ defaults: () => null,
170
+ readonly: true
171
+ },
172
+ "siteCode": {
173
+ accepts: oneOf(isString, isNull),
174
+ defaults: () => null,
175
+ readonly: true
176
+ },
154
177
  "number": {
155
178
  accepts: oneOf(isString, isNull),
156
179
  defaults: () => null,
157
180
  readonly: true
158
181
  },
159
182
  "customer.type": {
160
- accepts: oneOf(isNumber, isNull),
161
- defaults: () => null,
162
- readonly: false
183
+ accepts: oneOf(
184
+ isExactly("customer"),
185
+ isExactly("customer_corporate")
186
+ ),
187
+ defaults: () => "customer",
188
+ readonly: true
163
189
  },
164
190
  "customer.lastName": {
165
191
  accepts: oneOf(isString, isNull),
@@ -259,13 +285,9 @@ const schema$1 = {
259
285
  };
260
286
  const useContext$1 = defineContext("order/card", schema$1);
261
287
  const locales = ["en-GB", "es-ES", "ru-RU"];
262
- const isLocale = withMeta(
263
- (value) => locales.includes(value),
264
- locales.map((l) => `'${l}'`).join(" | ")
265
- );
266
288
  const schema = {
267
289
  "system.locale": {
268
- accepts: isLocale,
290
+ accepts: oneOf(...locales.map(isExactly)),
269
291
  defaults: () => "en-GB",
270
292
  readonly: true
271
293
  }
@@ -275,11 +297,10 @@ const useField = (store, field) => {
275
297
  if (store.schema[field].readonly) {
276
298
  return vue.computed(() => store[field]);
277
299
  }
300
+ const set = store.set;
278
301
  return vue.computed({
279
302
  get: () => store[field],
280
- set: (value) => {
281
- store.set(field, value);
282
- }
303
+ set: (value) => set(field, value)
283
304
  });
284
305
  };
285
306
  const useInternal = pinia.defineStore("@retailcrm/embed-ui/_internal", {});
@@ -298,13 +319,13 @@ const createRoot = async (channel) => {
298
319
  "UiError",
299
320
  "UiLink",
300
321
  "UiLoader",
301
- "UiMenuItem",
302
- "UiMenuItemGroup",
303
322
  "UiModalSidebar",
304
323
  "UiModalWindow",
305
324
  "UiModalWindowSurface",
306
325
  "UiScrollBox",
307
326
  "UiTag",
327
+ "UiToolbarButton",
328
+ "UiToolbarLink",
308
329
  "UiTransition",
309
330
  "CrmYandexMap"
310
331
  ]
package/dist/index.mjs CHANGED
@@ -54,6 +54,9 @@ const defineContext = (id, schema2) => {
54
54
  const withMeta = (predicate, type) => {
55
55
  return Object.assign(predicate, { type });
56
56
  };
57
+ const isExactly = (expected) => {
58
+ return withMeta((value) => value === expected, JSON.stringify(expected));
59
+ };
57
60
  const isNull = withMeta((value) => value === null, "null");
58
61
  const isNumber = withMeta((value) => typeof value === "number", "number");
59
62
  const isString = withMeta((value) => typeof value === "string", "string");
@@ -70,31 +73,41 @@ const oneOf = (...predicates) => withMeta(
70
73
  predicates.map((p) => p.type).join(" | ")
71
74
  );
72
75
  const schema$4 = {
73
- "lastName": {
74
- accepts: oneOf(isString, isNull),
76
+ "id": {
77
+ accepts: oneOf(isNumber, isNull),
75
78
  defaults: () => null,
76
- readonly: false
79
+ readonly: true
80
+ },
81
+ "email": {
82
+ accepts: isString,
83
+ defaults: () => "",
84
+ readonly: true
77
85
  },
78
86
  "firstName": {
79
87
  accepts: oneOf(isString, isNull),
80
88
  defaults: () => null,
81
- readonly: false
89
+ readonly: true
82
90
  },
83
- "patronymic": {
91
+ "lastName": {
84
92
  accepts: oneOf(isString, isNull),
85
93
  defaults: () => null,
86
- readonly: false
94
+ readonly: true
87
95
  },
88
- "email": {
89
- accepts: isString,
90
- defaults: () => "",
96
+ "patronymic": {
97
+ accepts: oneOf(isString, isNull),
98
+ defaults: () => null,
91
99
  readonly: true
92
100
  },
93
- "id": {
94
- accepts: oneOf(isNumber, isNull),
101
+ "photo": {
102
+ accepts: oneOf(isString, isNull),
95
103
  defaults: () => null,
96
104
  readonly: true
97
105
  },
106
+ "groups": {
107
+ accepts: arrayOf(isString),
108
+ defaults: () => [],
109
+ readonly: true
110
+ },
98
111
  "permissions": {
99
112
  accepts: arrayOf(isString),
100
113
  defaults: () => [],
@@ -149,15 +162,28 @@ const schema$1 = {
149
162
  defaults: () => null,
150
163
  readonly: true
151
164
  },
165
+ "typeCode": {
166
+ accepts: oneOf(isString, isNull),
167
+ defaults: () => null,
168
+ readonly: true
169
+ },
170
+ "siteCode": {
171
+ accepts: oneOf(isString, isNull),
172
+ defaults: () => null,
173
+ readonly: true
174
+ },
152
175
  "number": {
153
176
  accepts: oneOf(isString, isNull),
154
177
  defaults: () => null,
155
178
  readonly: true
156
179
  },
157
180
  "customer.type": {
158
- accepts: oneOf(isNumber, isNull),
159
- defaults: () => null,
160
- readonly: false
181
+ accepts: oneOf(
182
+ isExactly("customer"),
183
+ isExactly("customer_corporate")
184
+ ),
185
+ defaults: () => "customer",
186
+ readonly: true
161
187
  },
162
188
  "customer.lastName": {
163
189
  accepts: oneOf(isString, isNull),
@@ -257,13 +283,9 @@ const schema$1 = {
257
283
  };
258
284
  const useContext$1 = defineContext("order/card", schema$1);
259
285
  const locales = ["en-GB", "es-ES", "ru-RU"];
260
- const isLocale = withMeta(
261
- (value) => locales.includes(value),
262
- locales.map((l) => `'${l}'`).join(" | ")
263
- );
264
286
  const schema = {
265
287
  "system.locale": {
266
- accepts: isLocale,
288
+ accepts: oneOf(...locales.map(isExactly)),
267
289
  defaults: () => "en-GB",
268
290
  readonly: true
269
291
  }
@@ -273,11 +295,10 @@ const useField = (store, field) => {
273
295
  if (store.schema[field].readonly) {
274
296
  return computed(() => store[field]);
275
297
  }
298
+ const set = store.set;
276
299
  return computed({
277
300
  get: () => store[field],
278
- set: (value) => {
279
- store.set(field, value);
280
- }
301
+ set: (value) => set(field, value)
281
302
  });
282
303
  };
283
304
  const useInternal = defineStore("@retailcrm/embed-ui/_internal", {});
@@ -296,13 +317,13 @@ const createRoot = async (channel) => {
296
317
  "UiError",
297
318
  "UiLink",
298
319
  "UiLoader",
299
- "UiMenuItem",
300
- "UiMenuItemGroup",
301
320
  "UiModalSidebar",
302
321
  "UiModalWindow",
303
322
  "UiModalWindowSurface",
304
323
  "UiScrollBox",
305
324
  "UiTag",
325
+ "UiToolbarButton",
326
+ "UiToolbarLink",
306
327
  "UiTransition",
307
328
  "CrmYandexMap"
308
329
  ]
package/dist/meta.json CHANGED
@@ -1,67 +1,5 @@
1
1
  {
2
2
  "contexts": {
3
- "user/current": [
4
- {
5
- "name": "lastName",
6
- "type": "string | null",
7
- "description": {
8
- "en-GB": "User last name",
9
- "es-ES": "Apellido del usuario",
10
- "ru-RU": "Фамилия пользователя"
11
- },
12
- "readonly": false
13
- },
14
- {
15
- "name": "firstName",
16
- "type": "string | null",
17
- "description": {
18
- "en-GB": "User name",
19
- "es-ES": "Nombre del usuario",
20
- "ru-RU": "Имя пользователя"
21
- },
22
- "readonly": false
23
- },
24
- {
25
- "name": "patronymic",
26
- "type": "string | null",
27
- "description": {
28
- "en-GB": "Patronymic of the user",
29
- "es-ES": "Patronímico del usuario",
30
- "ru-RU": "Отчество пользователя"
31
- },
32
- "readonly": false
33
- },
34
- {
35
- "name": "email",
36
- "type": "string",
37
- "description": {
38
- "en-GB": "User email",
39
- "es-ES": "Correo electrónico del usuario",
40
- "ru-RU": "Email пользователя"
41
- },
42
- "readonly": true
43
- },
44
- {
45
- "name": "id",
46
- "type": "number | null",
47
- "description": {
48
- "en-GB": "User ID",
49
- "es-ES": "ID del usuario",
50
- "ru-RU": "ID пользователя"
51
- },
52
- "readonly": true
53
- },
54
- {
55
- "name": "permissions",
56
- "type": "Array<string>",
57
- "description": {
58
- "en-GB": "Character codes of available user permissions",
59
- "es-ES": "Códigos de caracteres de los permisos disponibles para el usuario",
60
- "ru-RU": "Символьные коды доступных пользователю разрешений"
61
- },
62
- "readonly": true
63
- }
64
- ],
65
3
  "customer/card": [
66
4
  {
67
5
  "name": "id",
@@ -147,6 +85,26 @@
147
85
  },
148
86
  "readonly": true
149
87
  },
88
+ {
89
+ "name": "typeCode",
90
+ "type": "string | null",
91
+ "description": {
92
+ "en-GB": "Order type code",
93
+ "es-ES": "Código del tipo de pedido",
94
+ "ru-RU": "Код типа заказа"
95
+ },
96
+ "readonly": true
97
+ },
98
+ {
99
+ "name": "siteCode",
100
+ "type": "string | null",
101
+ "description": {
102
+ "en-GB": "Store code associated with the order",
103
+ "es-ES": "Código de la tienda asociado al pedido",
104
+ "ru-RU": "Код магазина, к которому относится заказ"
105
+ },
106
+ "readonly": true
107
+ },
150
108
  {
151
109
  "name": "number",
152
110
  "type": "string | null",
@@ -159,13 +117,13 @@
159
117
  },
160
118
  {
161
119
  "name": "customer.type",
162
- "type": "number | null",
120
+ "type": "\"customer\" | \"customer_corporate\"",
163
121
  "description": {
164
122
  "en-GB": "Client type",
165
123
  "es-ES": "Tipo de cliente",
166
124
  "ru-RU": "Тип клиента"
167
125
  },
168
- "readonly": false
126
+ "readonly": true
169
127
  },
170
128
  {
171
129
  "name": "customer.lastName",
@@ -358,10 +316,92 @@
358
316
  "readonly": false
359
317
  }
360
318
  ],
319
+ "user/current": [
320
+ {
321
+ "name": "id",
322
+ "type": "number | null",
323
+ "description": {
324
+ "en-GB": "User ID",
325
+ "es-ES": "ID del usuario",
326
+ "ru-RU": "ID пользователя"
327
+ },
328
+ "readonly": true
329
+ },
330
+ {
331
+ "name": "email",
332
+ "type": "string",
333
+ "description": {
334
+ "en-GB": "User email",
335
+ "es-ES": "Correo electrónico del usuario",
336
+ "ru-RU": "Email пользователя"
337
+ },
338
+ "readonly": true
339
+ },
340
+ {
341
+ "name": "firstName",
342
+ "type": "string | null",
343
+ "description": {
344
+ "en-GB": "User name",
345
+ "es-ES": "Nombre del usuario",
346
+ "ru-RU": "Имя пользователя"
347
+ },
348
+ "readonly": true
349
+ },
350
+ {
351
+ "name": "lastName",
352
+ "type": "string | null",
353
+ "description": {
354
+ "en-GB": "User last name",
355
+ "es-ES": "Apellido del usuario",
356
+ "ru-RU": "Фамилия пользователя"
357
+ },
358
+ "readonly": true
359
+ },
360
+ {
361
+ "name": "patronymic",
362
+ "type": "string | null",
363
+ "description": {
364
+ "en-GB": "Patronymic of the user",
365
+ "es-ES": "Patronímico del usuario",
366
+ "ru-RU": "Отчество пользователя"
367
+ },
368
+ "readonly": true
369
+ },
370
+ {
371
+ "name": "photo",
372
+ "type": "string | null",
373
+ "description": {
374
+ "en-GB": "User photo",
375
+ "es-ES": "Foto del usuario",
376
+ "ru-RU": "Фото пользователя"
377
+ },
378
+ "readonly": true
379
+ },
380
+ {
381
+ "name": "groups",
382
+ "type": "Array<string>",
383
+ "description": {
384
+ "en-GB": "Symbolic codes of the groups the user belongs to",
385
+ "es-ES": "Códigos simbólicos de los grupos a los que pertenece el usuario",
386
+ "ru-RU": "Символьные коды групп, в которых состоит пользователь"
387
+ },
388
+ "readonly": true
389
+ },
390
+ {
391
+ "name": "permissions",
392
+ "type": "Array<string>",
393
+ "description": {
394
+ "en-GB": "Character codes of available user permissions",
395
+ "es-ES": "Códigos de caracteres de los permisos disponibles para el usuario",
396
+ "ru-RU": "Символьные коды доступных пользователю разрешений"
397
+ },
398
+ "readonly": true
399
+ }
400
+ ],
361
401
  "settings": [
362
402
  {
363
403
  "name": "system.locale",
364
- "type": "'en-GB' | 'es-ES' | 'ru-RU'",
404
+ "type": "\"en-GB\" | \"es-ES\" | \"ru-RU\"",
365
405
  "description": {
366
406
  "en-GB": "Current system's locale",
367
407
  "es-ES": "Configuración regional actual del sistema",
@@ -507,9 +547,9 @@
507
547
  "ru-RU": "Виджет для списка позиций заказа"
508
548
  },
509
549
  "location": {
510
- "en-GB": "[Temporary unavailable]",
511
- "es-ES": "[Temporalmente no disponible]",
512
- "ru-RU": "[Временно недоступен]"
550
+ "en-GB": "Section start, right above the input fields",
551
+ "es-ES": "Inicio de la sección, justo encima de los campos de entrada",
552
+ "ru-RU": "Начало секции, над полями ввода"
513
553
  },
514
554
  "contexts": [
515
555
  "order/card",
package/index.d.ts CHANGED
@@ -6,10 +6,11 @@ import type { ContextSchema } from './types/context/schema'
6
6
  import type { Endpoint, RemoteCallable } from '@remote-ui/rpc'
7
7
  import type { IsReadonly } from './types/context/schema'
8
8
  import type { MessageEndpoint } from '@remote-ui/rpc'
9
- import type { Schema } from './types/context/customer/card'
10
- import type { Schema as Schema_2 } from './types/context/customer/card-phone'
11
- import type { Schema as Schema_3 } from './types/context/order/card'
12
- import type { Schema as Schema_4 } from './types/context/settings'
9
+ import type { Schema as CustomerCardSchema } from './types/context/customer/card'
10
+ import type { Schema as CustomerCardPhoneSchema } from './types/context/customer/card-phone'
11
+ import type { Schema as OrderCardSchema } from './types/context/order/card'
12
+ import type { Schema as CurrentUserSchema } from './types/context/user/current'
13
+ import type { Schema as SettingsSchema } from './types/context/settings'
13
14
  import type { SchemaList } from './types/context'
14
15
  import type { Store } from 'pinia'
15
16
  import type { StoreDefinition } from 'pinia'
@@ -17,54 +18,51 @@ import type { TypeOf } from './types/context/schema'
17
18
  import type { WidgetRunner } from './types/widget'
18
19
  import type { WritableComputedRef } from 'vue'
19
20
 
20
- declare type Computed<S extends ContextSchema, F extends keyof S> = IsReadonly<S[F]> extends true ? ComputedRef<TypeOf<S[F]>> : WritableComputedRef<TypeOf<S[F]>>;
21
+ declare type Computed<
22
+ S extends ContextSchema,
23
+ F extends keyof S
24
+ > = IsReadonly<S[F]> extends true ? ComputedRef<TypeOf<S[F]>> : WritableComputedRef<TypeOf<S[F]>>;
21
25
 
22
- export declare const createWidgetEndpoint: (widget: WidgetRunner, messenger: MessageEndpoint) => Endpoint<ContextAccessor<SchemaList>>
26
+ export declare const createWidgetEndpoint: (
27
+ widget: WidgetRunner,
28
+ messenger: MessageEndpoint
29
+ ) => Endpoint<ContextAccessor<SchemaList>>
23
30
 
24
- export declare const customerCardPhoneSchema: Schema_2
31
+ export declare const customerCardPhoneSchema: CustomerCardPhoneSchema
32
+ export declare const customerCardSchema: CustomerCardSchema
33
+ export declare const orderCardSchema: OrderCardSchema
34
+ export declare const currentUserSchema: CurrentUserSchema
35
+ export declare const settingsSchema: SettingsSchema
25
36
 
26
- export declare const customerCardSchema: Schema
27
-
28
- export declare const orderCardSchema: Schema_3
29
-
30
- export declare const settingsSchema: Schema_4
31
-
32
- export declare const useCustomerCardContext: StoreDefinition<'customer/card', Context<Schema>, {
33
- schema: () => Schema;
37
+ export type ContextStore<S extends ContextSchema> = Store<string, Context<S>, {
38
+ schema(): S;
34
39
  }, {
35
40
  initialize(): Promise<void>;
36
- set<F extends keyof Schema>(field: F, value: TypeOf<Schema[F]>): void;
41
+ set<F extends keyof S>(field: F, value: TypeOf<S[F]>): void;
37
42
  }>
38
43
 
39
- export declare const useCustomerCardPhoneContext: StoreDefinition<'customer/card:phone', Context<Schema_2>, {
40
- schema: () => Schema_2;
44
+ export type ContextStoreDefinition<
45
+ Id extends string,
46
+ S extends ContextSchema
47
+ > = StoreDefinition<Id, Context<S>, {
48
+ schema(): S;
41
49
  }, {
42
50
  initialize(): Promise<void>;
43
- set<F extends keyof Schema_2>(field: F, value: TypeOf<Schema_2[F]>): void;
51
+ set<F extends keyof S>(field: F, value: TypeOf<S[F]>): void;
44
52
  }>
45
53
 
46
- export declare const useField: <S extends ContextSchema, F extends keyof S>(store: Store<string, Context<S>, {
47
- schema(): S;
48
- }, {
49
- initialize(): Promise<void>;
50
- set<F_1 extends keyof S>(field: F_1, value: TypeOf<S[F_1]>): void;
51
- }>, field: F) => Computed<S, F>
54
+ export declare const useCustomerCardContext: ContextStoreDefinition<'customer/card', CustomerCardSchema>
55
+ export declare const useCustomerCardPhoneContext: ContextStoreDefinition<'customer/card:phone', CustomerCardPhoneSchema>
56
+ export declare const useOrderCardContext: ContextStoreDefinition<'order/card', OrderCardSchema>
57
+ export declare const useCurrentUserContext: ContextStoreDefinition<'user/current', CurrentUserSchema>
58
+ export declare const useSettingsContext: ContextStoreDefinition<'settings', SettingsSchema>
52
59
 
53
- export declare const useHost = () => RemoteCallable<Callable>
60
+ export declare const useField: <S extends ContextSchema, F extends keyof S>(
61
+ store: ContextStore<S>,
62
+ field: F
63
+ ) => Computed<S, F>
54
64
 
55
- export declare const useOrderCardContext: StoreDefinition<'order/card', Context<Schema_3>, {
56
- schema: () => Schema_3;
57
- }, {
58
- initialize(): Promise<void>;
59
- set<F extends keyof Schema_3>(field: F, value: TypeOf<Schema_3[F]>): void;
60
- }>
61
-
62
- export declare const useSettingsContext: StoreDefinition<'settings', Context<Schema_4>, {
63
- schema: () => Schema_4;
64
- }, {
65
- initialize(): Promise<void>;
66
- set<F extends keyof Schema_4>(field: F, value: TypeOf<Schema_4[F]>): void;
67
- }>
65
+ export declare const useHost = () => RemoteCallable<Callable>
68
66
 
69
67
  declare module 'pinia' {
70
68
  interface PiniaCustomProperties {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@retailcrm/embed-ui",
3
3
  "type": "module",
4
- "version": "0.4.1-alpha.8",
4
+ "version": "0.4.1-beta.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>",
@@ -1,13 +1,13 @@
1
- import type { Schema as CurrentUserSchema } from './user/current'
2
1
  import type { Schema as CustomerCardSchema } from './customer/card'
3
2
  import type { Schema as CustomerCardPhoneSchema } from './customer/card-phone'
4
3
  import type { Schema as OrderCardSchema } from './order/card'
4
+ import type { Schema as CurrentUserSchema } from './user/current'
5
5
  import type { Schema as SettingsSchema } from './settings'
6
6
 
7
7
  export type SchemaList = {
8
- 'user/current': CurrentUserSchema;
9
8
  'customer/card': CustomerCardSchema;
10
9
  'customer/card:phone': CustomerCardPhoneSchema;
11
10
  'order/card': OrderCardSchema;
11
+ 'user/current': CurrentUserSchema;
12
12
  'settings': SettingsSchema;
13
13
  }
@@ -1,10 +1,12 @@
1
- import type { Field } from '../schema'
1
+ import type { Field, ReadonlyField } from '../schema'
2
2
 
3
3
  export type Schema = {
4
4
  'id': ReadonlyField<number | null>;
5
5
  'externalId': ReadonlyField<string | null>;
6
+ 'typeCode': ReadonlyField<string | null>;
7
+ 'siteCode': ReadonlyField<string | null>;
6
8
  'number': ReadonlyField<string | null>;
7
- 'customer.type': ReadonlyField<number | null>;
9
+ 'customer.type': ReadonlyField<'customer' | 'customer_corporate'>;
8
10
  'customer.lastName': Field<string | null>;
9
11
  'customer.firstName': Field<string | null>;
10
12
  'customer.patronymic': Field<string | null>;
@@ -1,9 +1,6 @@
1
1
  import type { ReadonlyField } from './schema'
2
2
 
3
3
  export type Locale = 'en-GB' | 'es-ES' | 'ru-RU'
4
-
5
4
  export type Schema = {
6
- 'order.templates.number.api': ReadonlyField<string>;
7
- 'order.templates.number.crm': ReadonlyField<string>;
8
5
  'system.locale': ReadonlyField<Locale>;
9
6
  }
@@ -1,10 +1,12 @@
1
1
  import type { ReadonlyField } from '../schema'
2
2
 
3
3
  export type Schema = {
4
- 'lastName': ReadonlyField<string>;
5
- 'firstName': ReadonlyField<number | null>;
6
- 'patronymic': ReadonlyField<number | null>;
7
- 'email': ReadonlyField<string>;
8
4
  'id': ReadonlyField<number | null>;
5
+ 'email': ReadonlyField<string>;
6
+ 'firstName': ReadonlyField<string | null>;
7
+ 'lastName': ReadonlyField<string | null>;
8
+ 'patronymic': ReadonlyField<string | null>;
9
+ 'photo': ReadonlyField<string | null>;
10
+ 'groups': ReadonlyField<string[]>;
9
11
  'permissions': ReadonlyField<string[]>;
10
12
  }