@retailcrm/embed-ui 0.3.6 → 0.4.0

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
@@ -2,6 +2,26 @@
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.4.0](https://github.com/retailcrm/embed-ui/compare/v0.3.7...v0.4.0) (2024-11-25)
6
+
7
+
8
+ ### ⚠ BREAKING CHANGES
9
+
10
+ * Удалены поля order.templates.number.api и
11
+ order.templates.number.crm из контекста settings
12
+
13
+ ### Features
14
+
15
+ * ref [#98287](https://github.com/retailcrm/embed-ui/issues/98287) Completed order/card with data ([23129cc](https://github.com/retailcrm/embed-ui/commit/23129cc47e8f4b84b5f357954b5fa4c4a501ea1b))
16
+ * ref [#98287](https://github.com/retailcrm/embed-ui/issues/98287) Контекст с данными о текущем пользователе ([a6cdb78](https://github.com/retailcrm/embed-ui/commit/a6cdb7872b0650bbda6bdac694cac2c30a4e4c55))
17
+
18
+ ### [0.3.7](https://github.com/retailcrm/embed-ui/compare/v0.3.6...v0.3.7) (2024-11-25)
19
+
20
+
21
+ ### Fixes
22
+
23
+ * Added generation of meta.json to ci ([1b3b776](https://github.com/retailcrm/embed-ui/commit/1b3b77648a4a7cf71264566f71cd1ff81e792f44))
24
+
5
25
  ### [0.3.6](https://github.com/retailcrm/embed-ui/compare/v0.3.5...v0.3.6) (2024-11-22)
6
26
 
7
27
  ### 0.3.5 (2024-11-22)
package/dist/index.cjs CHANGED
@@ -71,6 +71,39 @@ const oneOf = (...predicates) => withMeta(
71
71
  },
72
72
  predicates.map((p) => p.type).join(" | ")
73
73
  );
74
+ const schema$4 = {
75
+ "lastName": {
76
+ accepts: oneOf(isString, isNull),
77
+ defaults: () => null,
78
+ readonly: false
79
+ },
80
+ "firstName": {
81
+ accepts: oneOf(isString, isNull),
82
+ defaults: () => null,
83
+ readonly: false
84
+ },
85
+ "patronymic": {
86
+ accepts: oneOf(isString, isNull),
87
+ defaults: () => null,
88
+ readonly: false
89
+ },
90
+ "email": {
91
+ accepts: isString,
92
+ defaults: () => "",
93
+ readonly: true
94
+ },
95
+ "id": {
96
+ accepts: oneOf(isNumber, isNull),
97
+ defaults: () => null,
98
+ readonly: true
99
+ },
100
+ "permissions": {
101
+ accepts: arrayOf(isString),
102
+ defaults: () => [],
103
+ readonly: true
104
+ }
105
+ };
106
+ const useContext$4 = defineContext("user/current", schema$4);
74
107
  const schema$3 = {
75
108
  "id": {
76
109
  accepts: oneOf(isNumber, isNull),
@@ -108,7 +141,37 @@ const schema$2 = {
108
141
  };
109
142
  const useContext$2 = defineContext("customer/card:phone", schema$2);
110
143
  const schema$1 = {
111
- "customer.email": {
144
+ "id": {
145
+ accepts: oneOf(isNumber, isNull),
146
+ defaults: () => null,
147
+ readonly: true
148
+ },
149
+ "externalId": {
150
+ accepts: oneOf(isString, isNull),
151
+ defaults: () => null,
152
+ readonly: true
153
+ },
154
+ "number": {
155
+ accepts: oneOf(isString, isNull),
156
+ defaults: () => null,
157
+ readonly: true
158
+ },
159
+ "customer.type": {
160
+ accepts: oneOf(isNumber, isNull),
161
+ defaults: () => null,
162
+ readonly: false
163
+ },
164
+ "customer.lastName": {
165
+ accepts: oneOf(isString, isNull),
166
+ defaults: () => null,
167
+ readonly: false
168
+ },
169
+ "customer.firstName": {
170
+ accepts: oneOf(isString, isNull),
171
+ defaults: () => null,
172
+ readonly: false
173
+ },
174
+ "customer.patronymic": {
112
175
  accepts: oneOf(isString, isNull),
113
176
  defaults: () => null,
114
177
  readonly: false
@@ -118,6 +181,76 @@ const schema$1 = {
118
181
  defaults: () => null,
119
182
  readonly: false
120
183
  },
184
+ "customer.email": {
185
+ accepts: oneOf(isString, isNull),
186
+ defaults: () => null,
187
+ readonly: false
188
+ },
189
+ "country": {
190
+ accepts: oneOf(isString, isNull),
191
+ defaults: () => null,
192
+ readonly: true
193
+ },
194
+ "currency": {
195
+ accepts: isString,
196
+ defaults: () => "",
197
+ readonly: true
198
+ },
199
+ "status": {
200
+ accepts: isString,
201
+ defaults: () => "",
202
+ readonly: true
203
+ },
204
+ "company.name": {
205
+ accepts: oneOf(isString, isNull),
206
+ defaults: () => null,
207
+ readonly: false
208
+ },
209
+ "company.legalName": {
210
+ accepts: oneOf(isString, isNull),
211
+ defaults: () => null,
212
+ readonly: false
213
+ },
214
+ "company.legalAddress": {
215
+ accepts: oneOf(isString, isNull),
216
+ defaults: () => null,
217
+ readonly: false
218
+ },
219
+ "company.INN": {
220
+ accepts: oneOf(isString, isNull),
221
+ defaults: () => null,
222
+ readonly: false
223
+ },
224
+ "company.OKPO": {
225
+ accepts: oneOf(isString, isNull),
226
+ defaults: () => null,
227
+ readonly: false
228
+ },
229
+ "company.BIK": {
230
+ accepts: oneOf(isString, isNull),
231
+ defaults: () => null,
232
+ readonly: false
233
+ },
234
+ "company.bank": {
235
+ accepts: oneOf(isString, isNull),
236
+ defaults: () => null,
237
+ readonly: false
238
+ },
239
+ "company.bankAddress": {
240
+ accepts: oneOf(isString, isNull),
241
+ defaults: () => null,
242
+ readonly: false
243
+ },
244
+ "company.corrAccount": {
245
+ accepts: oneOf(isString, isNull),
246
+ defaults: () => null,
247
+ readonly: false
248
+ },
249
+ "company.bankAccount": {
250
+ accepts: oneOf(isString, isNull),
251
+ defaults: () => null,
252
+ readonly: false
253
+ },
121
254
  "delivery.address": {
122
255
  accepts: oneOf(isString, isNull),
123
256
  defaults: () => null,
@@ -131,16 +264,6 @@ const isLocale = withMeta(
131
264
  locales.map((l) => `'${l}'`).join(" | ")
132
265
  );
133
266
  const schema = {
134
- "order.templates.number.api": {
135
- accepts: isString,
136
- defaults: () => "",
137
- readonly: true
138
- },
139
- "order.templates.number.crm": {
140
- accepts: isString,
141
- defaults: () => "",
142
- readonly: true
143
- },
144
267
  "system.locale": {
145
268
  accepts: isLocale,
146
269
  defaults: () => "en-GB",
@@ -216,10 +339,12 @@ const createWidgetEndpoint = (widget, messenger) => {
216
339
  return endpoint;
217
340
  };
218
341
  exports.createWidgetEndpoint = createWidgetEndpoint;
342
+ exports.currentUserSchema = schema$4;
219
343
  exports.customerCardPhoneSchema = schema$2;
220
344
  exports.customerCardSchema = schema$3;
221
345
  exports.orderCardSchema = schema$1;
222
346
  exports.settingsSchema = schema;
347
+ exports.useCurrentUserContext = useContext$4;
223
348
  exports.useCustomerCardContext = useContext$3;
224
349
  exports.useCustomerCardPhoneContext = useContext$2;
225
350
  exports.useField = useField;
package/dist/index.mjs CHANGED
@@ -69,6 +69,39 @@ const oneOf = (...predicates) => withMeta(
69
69
  },
70
70
  predicates.map((p) => p.type).join(" | ")
71
71
  );
72
+ const schema$4 = {
73
+ "lastName": {
74
+ accepts: oneOf(isString, isNull),
75
+ defaults: () => null,
76
+ readonly: false
77
+ },
78
+ "firstName": {
79
+ accepts: oneOf(isString, isNull),
80
+ defaults: () => null,
81
+ readonly: false
82
+ },
83
+ "patronymic": {
84
+ accepts: oneOf(isString, isNull),
85
+ defaults: () => null,
86
+ readonly: false
87
+ },
88
+ "email": {
89
+ accepts: isString,
90
+ defaults: () => "",
91
+ readonly: true
92
+ },
93
+ "id": {
94
+ accepts: oneOf(isNumber, isNull),
95
+ defaults: () => null,
96
+ readonly: true
97
+ },
98
+ "permissions": {
99
+ accepts: arrayOf(isString),
100
+ defaults: () => [],
101
+ readonly: true
102
+ }
103
+ };
104
+ const useContext$4 = defineContext("user/current", schema$4);
72
105
  const schema$3 = {
73
106
  "id": {
74
107
  accepts: oneOf(isNumber, isNull),
@@ -106,7 +139,37 @@ const schema$2 = {
106
139
  };
107
140
  const useContext$2 = defineContext("customer/card:phone", schema$2);
108
141
  const schema$1 = {
109
- "customer.email": {
142
+ "id": {
143
+ accepts: oneOf(isNumber, isNull),
144
+ defaults: () => null,
145
+ readonly: true
146
+ },
147
+ "externalId": {
148
+ accepts: oneOf(isString, isNull),
149
+ defaults: () => null,
150
+ readonly: true
151
+ },
152
+ "number": {
153
+ accepts: oneOf(isString, isNull),
154
+ defaults: () => null,
155
+ readonly: true
156
+ },
157
+ "customer.type": {
158
+ accepts: oneOf(isNumber, isNull),
159
+ defaults: () => null,
160
+ readonly: false
161
+ },
162
+ "customer.lastName": {
163
+ accepts: oneOf(isString, isNull),
164
+ defaults: () => null,
165
+ readonly: false
166
+ },
167
+ "customer.firstName": {
168
+ accepts: oneOf(isString, isNull),
169
+ defaults: () => null,
170
+ readonly: false
171
+ },
172
+ "customer.patronymic": {
110
173
  accepts: oneOf(isString, isNull),
111
174
  defaults: () => null,
112
175
  readonly: false
@@ -116,6 +179,76 @@ const schema$1 = {
116
179
  defaults: () => null,
117
180
  readonly: false
118
181
  },
182
+ "customer.email": {
183
+ accepts: oneOf(isString, isNull),
184
+ defaults: () => null,
185
+ readonly: false
186
+ },
187
+ "country": {
188
+ accepts: oneOf(isString, isNull),
189
+ defaults: () => null,
190
+ readonly: true
191
+ },
192
+ "currency": {
193
+ accepts: isString,
194
+ defaults: () => "",
195
+ readonly: true
196
+ },
197
+ "status": {
198
+ accepts: isString,
199
+ defaults: () => "",
200
+ readonly: true
201
+ },
202
+ "company.name": {
203
+ accepts: oneOf(isString, isNull),
204
+ defaults: () => null,
205
+ readonly: false
206
+ },
207
+ "company.legalName": {
208
+ accepts: oneOf(isString, isNull),
209
+ defaults: () => null,
210
+ readonly: false
211
+ },
212
+ "company.legalAddress": {
213
+ accepts: oneOf(isString, isNull),
214
+ defaults: () => null,
215
+ readonly: false
216
+ },
217
+ "company.INN": {
218
+ accepts: oneOf(isString, isNull),
219
+ defaults: () => null,
220
+ readonly: false
221
+ },
222
+ "company.OKPO": {
223
+ accepts: oneOf(isString, isNull),
224
+ defaults: () => null,
225
+ readonly: false
226
+ },
227
+ "company.BIK": {
228
+ accepts: oneOf(isString, isNull),
229
+ defaults: () => null,
230
+ readonly: false
231
+ },
232
+ "company.bank": {
233
+ accepts: oneOf(isString, isNull),
234
+ defaults: () => null,
235
+ readonly: false
236
+ },
237
+ "company.bankAddress": {
238
+ accepts: oneOf(isString, isNull),
239
+ defaults: () => null,
240
+ readonly: false
241
+ },
242
+ "company.corrAccount": {
243
+ accepts: oneOf(isString, isNull),
244
+ defaults: () => null,
245
+ readonly: false
246
+ },
247
+ "company.bankAccount": {
248
+ accepts: oneOf(isString, isNull),
249
+ defaults: () => null,
250
+ readonly: false
251
+ },
119
252
  "delivery.address": {
120
253
  accepts: oneOf(isString, isNull),
121
254
  defaults: () => null,
@@ -129,16 +262,6 @@ const isLocale = withMeta(
129
262
  locales.map((l) => `'${l}'`).join(" | ")
130
263
  );
131
264
  const schema = {
132
- "order.templates.number.api": {
133
- accepts: isString,
134
- defaults: () => "",
135
- readonly: true
136
- },
137
- "order.templates.number.crm": {
138
- accepts: isString,
139
- defaults: () => "",
140
- readonly: true
141
- },
142
265
  "system.locale": {
143
266
  accepts: isLocale,
144
267
  defaults: () => "en-GB",
@@ -215,10 +338,12 @@ const createWidgetEndpoint = (widget, messenger) => {
215
338
  };
216
339
  export {
217
340
  createWidgetEndpoint,
341
+ schema$4 as currentUserSchema,
218
342
  schema$2 as customerCardPhoneSchema,
219
343
  schema$3 as customerCardSchema,
220
344
  schema$1 as orderCardSchema,
221
345
  schema as settingsSchema,
346
+ useContext$4 as useCurrentUserContext,
222
347
  useContext$3 as useCustomerCardContext,
223
348
  useContext$2 as useCustomerCardPhoneContext,
224
349
  useField,
package/dist/meta.json ADDED
@@ -0,0 +1,691 @@
1
+ {
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
+ "customer/card": [
66
+ {
67
+ "name": "id",
68
+ "type": "number | null",
69
+ "description": {
70
+ "en-GB": "Customer ID",
71
+ "es-ES": "ID del cliente",
72
+ "ru-RU": "ID клиента"
73
+ },
74
+ "readonly": true
75
+ },
76
+ {
77
+ "name": "externalId",
78
+ "type": "string",
79
+ "description": {
80
+ "en-GB": "Customer external ID",
81
+ "es-ES": "ID externo del cliente",
82
+ "ru-RU": "Внешний ID клиента"
83
+ },
84
+ "readonly": true
85
+ },
86
+ {
87
+ "name": "email",
88
+ "type": "string",
89
+ "description": {
90
+ "en-GB": "Customer email",
91
+ "es-ES": "Correo electrónico del cliente",
92
+ "ru-RU": "Email клиента"
93
+ },
94
+ "readonly": true
95
+ },
96
+ {
97
+ "name": "phones",
98
+ "type": "Array<string>",
99
+ "description": {
100
+ "en-GB": "Customer phone list",
101
+ "es-ES": "Lista de teléfonos del cliente",
102
+ "ru-RU": "Список телефонов клиента"
103
+ },
104
+ "readonly": true
105
+ }
106
+ ],
107
+ "customer/card:phone": [
108
+ {
109
+ "name": "value",
110
+ "type": "string",
111
+ "description": {
112
+ "en-GB": "Customer phone",
113
+ "es-ES": "Teléfono del cliente",
114
+ "ru-RU": "Телефон клиента"
115
+ },
116
+ "readonly": true
117
+ },
118
+ {
119
+ "name": "index",
120
+ "type": "number",
121
+ "description": {
122
+ "en-GB": "Serial number of the phone in the list",
123
+ "es-ES": "Número de serie del teléfono en la lista",
124
+ "ru-RU": "Порядковый номер телефона в списке"
125
+ },
126
+ "readonly": true
127
+ }
128
+ ],
129
+ "order/card": [
130
+ {
131
+ "name": "id",
132
+ "type": "number | null",
133
+ "description": {
134
+ "en-GB": "Order ID in CRM",
135
+ "es-ES": "ID del pedido en CRM",
136
+ "ru-RU": "Идентификатор заказа в CRM"
137
+ },
138
+ "readonly": true
139
+ },
140
+ {
141
+ "name": "externalId",
142
+ "type": "string | null",
143
+ "description": {
144
+ "en-GB": "The order ID in the external source system",
145
+ "es-ES": "El ID del pedido en el sistema de origen externo",
146
+ "ru-RU": "Идентифкатор заказа во внешней системе источника"
147
+ },
148
+ "readonly": true
149
+ },
150
+ {
151
+ "name": "number",
152
+ "type": "string | null",
153
+ "description": {
154
+ "en-GB": "Displayed order number",
155
+ "es-ES": "Número de pedido mostrado",
156
+ "ru-RU": "Отображаемый номер заказа"
157
+ },
158
+ "readonly": true
159
+ },
160
+ {
161
+ "name": "customer.type",
162
+ "type": "number | null",
163
+ "description": {
164
+ "en-GB": "Client type",
165
+ "es-ES": "Tipo de cliente",
166
+ "ru-RU": "Тип клиента"
167
+ },
168
+ "readonly": false
169
+ },
170
+ {
171
+ "name": "customer.lastName",
172
+ "type": "string | null",
173
+ "description": {
174
+ "en-GB": "Client last name",
175
+ "es-ES": "Apellido del cliente",
176
+ "ru-RU": "Фамилия клиента"
177
+ },
178
+ "readonly": false
179
+ },
180
+ {
181
+ "name": "customer.firstName",
182
+ "type": "string | null",
183
+ "description": {
184
+ "en-GB": "Client name",
185
+ "es-ES": "Nombre del cliente",
186
+ "ru-RU": "Имя клиента"
187
+ },
188
+ "readonly": false
189
+ },
190
+ {
191
+ "name": "customer.patronymic",
192
+ "type": "string | null",
193
+ "description": {
194
+ "en-GB": "Patronymic of the client",
195
+ "es-ES": "Patronímico del cliente",
196
+ "ru-RU": "Отчество клиента"
197
+ },
198
+ "readonly": false
199
+ },
200
+ {
201
+ "name": "customer.phone",
202
+ "type": "string | null",
203
+ "description": {
204
+ "en-GB": "Customer phone",
205
+ "es-ES": "Teléfono del cliente",
206
+ "ru-RU": "Телефон клиента"
207
+ },
208
+ "readonly": false
209
+ },
210
+ {
211
+ "name": "customer.email",
212
+ "type": "string | null",
213
+ "description": {
214
+ "en-GB": "Customer email",
215
+ "es-ES": "Correo electrónico del cliente",
216
+ "ru-RU": "Email клиента"
217
+ },
218
+ "readonly": false
219
+ },
220
+ {
221
+ "name": "country",
222
+ "type": "string | null",
223
+ "description": {
224
+ "en-GB": "Character code of the country",
225
+ "es-ES": "Código de caracteres del país",
226
+ "ru-RU": "Символьный код страны"
227
+ },
228
+ "readonly": true
229
+ },
230
+ {
231
+ "name": "currency",
232
+ "type": "string",
233
+ "description": {
234
+ "en-GB": "Currency code",
235
+ "es-ES": "Código de moneda",
236
+ "ru-RU": "Символьный код валюты"
237
+ },
238
+ "readonly": true
239
+ },
240
+ {
241
+ "name": "status",
242
+ "type": "string",
243
+ "description": {
244
+ "en-GB": "Order status",
245
+ "es-ES": "Estado del pedido",
246
+ "ru-RU": "Статус заказа"
247
+ },
248
+ "readonly": true
249
+ },
250
+ {
251
+ "name": "company.name",
252
+ "type": "string | null",
253
+ "description": {
254
+ "en-GB": "Company's name",
255
+ "es-ES": "Nombre de la empresa",
256
+ "ru-RU": "Название компании"
257
+ },
258
+ "readonly": false
259
+ },
260
+ {
261
+ "name": "company.legalName",
262
+ "type": "string | null",
263
+ "description": {
264
+ "en-GB": "Full name of the company",
265
+ "es-ES": "Nombre completo de la empresa",
266
+ "ru-RU": "Полное наименование компании"
267
+ },
268
+ "readonly": false
269
+ },
270
+ {
271
+ "name": "company.legalAddress",
272
+ "type": "string | null",
273
+ "description": {
274
+ "en-GB": "Company's registration address",
275
+ "es-ES": "Dirección de registro de la empresa",
276
+ "ru-RU": "Адрес регистрации компании"
277
+ },
278
+ "readonly": false
279
+ },
280
+ {
281
+ "name": "company.INN",
282
+ "type": "string | null",
283
+ "description": {
284
+ "en-GB": "Counterparty's INN",
285
+ "es-ES": "INN del contraparte",
286
+ "ru-RU": "ИНН контрагента"
287
+ },
288
+ "readonly": false
289
+ },
290
+ {
291
+ "name": "company.OKPO",
292
+ "type": "string | null",
293
+ "description": {
294
+ "en-GB": "OKPO of the counterparty",
295
+ "es-ES": "OKPO del contraparte",
296
+ "ru-RU": "ОКПО контрагента"
297
+ },
298
+ "readonly": false
299
+ },
300
+ {
301
+ "name": "company.BIK",
302
+ "type": "string | null",
303
+ "description": {
304
+ "en-GB": "Counterparty's BIC",
305
+ "es-ES": "BIC del contraparte",
306
+ "ru-RU": "БИК контрагента"
307
+ },
308
+ "readonly": false
309
+ },
310
+ {
311
+ "name": "company.bank",
312
+ "type": "string | null",
313
+ "description": {
314
+ "en-GB": "Counterparty's bank",
315
+ "es-ES": "Banco del contraparte",
316
+ "ru-RU": "Банк контрагента"
317
+ },
318
+ "readonly": false
319
+ },
320
+ {
321
+ "name": "company.bankAddress",
322
+ "type": "string | null",
323
+ "description": {
324
+ "en-GB": "The address of the counterparty's bank",
325
+ "es-ES": "Dirección del banco del contraparte",
326
+ "ru-RU": "Адрес банка контрагента"
327
+ },
328
+ "readonly": false
329
+ },
330
+ {
331
+ "name": "company.corrAccount",
332
+ "type": "string | null",
333
+ "description": {
334
+ "en-GB": "Correspondent account of the counterparty",
335
+ "es-ES": "Cuenta corresponsal del contraparte",
336
+ "ru-RU": "Корреспондентский счет контрагента"
337
+ },
338
+ "readonly": false
339
+ },
340
+ {
341
+ "name": "company.bankAccount",
342
+ "type": "string | null",
343
+ "description": {
344
+ "en-GB": "Counterparty's current account",
345
+ "es-ES": "Cuenta corriente del contraparte",
346
+ "ru-RU": "Расчетный счет контрагента"
347
+ },
348
+ "readonly": false
349
+ },
350
+ {
351
+ "name": "delivery.address",
352
+ "type": "string | null",
353
+ "description": {
354
+ "en-GB": "Delivery address",
355
+ "es-ES": "Dirección de entrega",
356
+ "ru-RU": "Адрес доставки"
357
+ },
358
+ "readonly": false
359
+ }
360
+ ],
361
+ "settings": [
362
+ {
363
+ "name": "system.locale",
364
+ "type": "'en-GB' | 'es-ES' | 'ru-RU'",
365
+ "description": {
366
+ "en-GB": "Current system's locale",
367
+ "es-ES": "Configuración regional actual del sistema",
368
+ "ru-RU": "Текущая локаль системы"
369
+ },
370
+ "readonly": true
371
+ }
372
+ ]
373
+ },
374
+ "targets": [
375
+ {
376
+ "id": "customer/card:phone",
377
+ "description": {
378
+ "en-GB": "Widget for customer phone list item",
379
+ "es-ES": "Widget para el elemento de la lista de teléfonos del cliente",
380
+ "ru-RU": "Виджет для элемента списка телефонов клиента"
381
+ },
382
+ "location": {
383
+ "en-GB": "Right after the phone number in the list",
384
+ "es-ES": "Justo después del número de teléfono en la lista",
385
+ "ru-RU": "Сразу после номера телефона в списке"
386
+ },
387
+ "contexts": [
388
+ "customer/card",
389
+ "customer/card:phone",
390
+ "settings"
391
+ ]
392
+ },
393
+ {
394
+ "id": "order/card:common.before",
395
+ "description": {
396
+ "en-GB": "Widget for the section with common data",
397
+ "es-ES": "Widget para la sección con datos comunes",
398
+ "ru-RU": "Виджет для секции с основными данными"
399
+ },
400
+ "location": {
401
+ "en-GB": "Section start, right above the input fields",
402
+ "es-ES": "Inicio de la sección, justo encima de los campos de entrada",
403
+ "ru-RU": "Начало секции, над полями ввода"
404
+ },
405
+ "contexts": [
406
+ "order/card",
407
+ "settings"
408
+ ]
409
+ },
410
+ {
411
+ "id": "order/card:common.after",
412
+ "description": {
413
+ "en-GB": "Widget for the section with common data",
414
+ "es-ES": "Widget para la sección con datos comunes",
415
+ "ru-RU": "Виджет для секции с основными данными"
416
+ },
417
+ "location": {
418
+ "en-GB": "Section end, right under the input fields",
419
+ "es-ES": "Fin de la sección, justo debajo de los campos de entrada",
420
+ "ru-RU": "Конец секции, под полями ввода"
421
+ },
422
+ "contexts": [
423
+ "order/card",
424
+ "settings"
425
+ ]
426
+ },
427
+ {
428
+ "id": "order/card:customer.before",
429
+ "description": {
430
+ "en-GB": "Widget for the section with customer data",
431
+ "es-ES": "Widget para la sección con datos del cliente",
432
+ "ru-RU": "Виджет для секции с данными клиента"
433
+ },
434
+ "location": {
435
+ "en-GB": "Section start, right above the input fields",
436
+ "es-ES": "Inicio de la sección, justo encima de los campos de entrada",
437
+ "ru-RU": "Начало секции, над полями ввода"
438
+ },
439
+ "contexts": [
440
+ "order/card",
441
+ "settings"
442
+ ]
443
+ },
444
+ {
445
+ "id": "order/card:customer.after",
446
+ "description": {
447
+ "en-GB": "Widget for the section with customer data",
448
+ "es-ES": "Widget para la sección con datos del cliente",
449
+ "ru-RU": "Виджет для секции с данными клиента"
450
+ },
451
+ "location": {
452
+ "en-GB": "Section end, right under the input fields",
453
+ "es-ES": "Fin de la sección, justo debajo de los campos de entrada",
454
+ "ru-RU": "Конец секции, под полями ввода"
455
+ },
456
+ "contexts": [
457
+ "order/card",
458
+ "settings"
459
+ ]
460
+ },
461
+ {
462
+ "id": "order/card:customer.email",
463
+ "description": {
464
+ "en-GB": "Widget for customer email input field",
465
+ "es-ES": "Widget para el campo de entrada del correo electrónico del cliente",
466
+ "ru-RU": "Виджет для поля ввода email клиента"
467
+ },
468
+ "location": {
469
+ "en-GB": "Right after the input field",
470
+ "es-ES": "Justo después del campo de entrada",
471
+ "ru-RU": "Сразу после поля ввода"
472
+ },
473
+ "contexts": [
474
+ "order/card",
475
+ "settings"
476
+ ]
477
+ },
478
+ {
479
+ "id": "order/card:customer.phone",
480
+ "description": {
481
+ "en-GB": "Widget for customer phone input field",
482
+ "es-ES": "Widget para el campo de entrada del teléfono del cliente",
483
+ "ru-RU": "Виджет для поля ввода телефона клиента"
484
+ },
485
+ "location": {
486
+ "en-GB": "Right after the input field",
487
+ "es-ES": "Justo después del campo de entrada",
488
+ "ru-RU": "Сразу после поля ввода"
489
+ },
490
+ "contexts": [
491
+ "order/card",
492
+ "settings"
493
+ ]
494
+ },
495
+ {
496
+ "id": "order/card:list.before",
497
+ "description": {
498
+ "en-GB": "Widget for the list of ordered items",
499
+ "es-ES": "Widget para la lista de artículos pedidos",
500
+ "ru-RU": "Виджет для списка позиций заказа"
501
+ },
502
+ "location": {
503
+ "en-GB": "[Temporary unavailable]",
504
+ "es-ES": "[Temporalmente no disponible]",
505
+ "ru-RU": "[Временно недоступен]"
506
+ },
507
+ "contexts": [
508
+ "order/card",
509
+ "settings"
510
+ ]
511
+ },
512
+ {
513
+ "id": "order/card:list.after",
514
+ "description": {
515
+ "en-GB": "Widget for the list of ordered items",
516
+ "es-ES": "Widget para la lista de artículos pedidos",
517
+ "ru-RU": "Виджет для списка позиций заказа"
518
+ },
519
+ "location": {
520
+ "en-GB": "Section start, right under the list",
521
+ "es-ES": "Inicio de la sección, justo debajo de la lista",
522
+ "ru-RU": "Начало секции, под списком"
523
+ },
524
+ "contexts": [
525
+ "order/card",
526
+ "settings"
527
+ ]
528
+ },
529
+ {
530
+ "id": "order/card:store.before",
531
+ "description": {
532
+ "en-GB": "Widget for the section with warehouse data",
533
+ "es-ES": "Widget para la sección con datos del almacén",
534
+ "ru-RU": "Виджет для секции с данными склада"
535
+ },
536
+ "location": {
537
+ "en-GB": "Section start, right above the input fields",
538
+ "es-ES": "Inicio de la sección, justo encima de los campos de entrada",
539
+ "ru-RU": "Начало секции, над полями ввода"
540
+ },
541
+ "contexts": [
542
+ "order/card",
543
+ "settings"
544
+ ]
545
+ },
546
+ {
547
+ "id": "order/card:dimensions.before",
548
+ "description": {
549
+ "en-GB": "Widget for the section with dimensions and weight",
550
+ "es-ES": "Widget para la sección con dimensiones y peso",
551
+ "ru-RU": "Виджет для секции с данными габаритов и веса"
552
+ },
553
+ "location": {
554
+ "en-GB": "Section start, right above the input fields",
555
+ "es-ES": "Inicio de la sección, justo encima de los campos de entrada",
556
+ "ru-RU": "Начало секции, над полями ввода"
557
+ },
558
+ "contexts": [
559
+ "order/card",
560
+ "settings"
561
+ ]
562
+ },
563
+ {
564
+ "id": "order/card:delivery.before",
565
+ "description": {
566
+ "en-GB": "Widget for the section with delivery data",
567
+ "es-ES": "Widget para la sección con datos de entrega",
568
+ "ru-RU": "Виджет для секции с данными доставки"
569
+ },
570
+ "location": {
571
+ "en-GB": "Section start, right above the input fields",
572
+ "es-ES": "Inicio de la sección, justo encima de los campos de entrada",
573
+ "ru-RU": "Начало секции, над полями ввода"
574
+ },
575
+ "contexts": [
576
+ "order/card",
577
+ "settings"
578
+ ]
579
+ },
580
+ {
581
+ "id": "order/card:delivery.after",
582
+ "description": {
583
+ "en-GB": "Widget for the section with delivery data",
584
+ "es-ES": "Widget para la sección con datos de entrega",
585
+ "ru-RU": "Виджет для секции с данными доставки"
586
+ },
587
+ "location": {
588
+ "en-GB": "Section end, right under the input fields",
589
+ "es-ES": "Fin de la sección, justo debajo de los campos de entrada",
590
+ "ru-RU": "Конец секции, под полями ввода"
591
+ },
592
+ "contexts": [
593
+ "order/card",
594
+ "settings"
595
+ ]
596
+ },
597
+ {
598
+ "id": "order/card:delivery.address",
599
+ "description": {
600
+ "en-GB": "Widget for delivery address input field",
601
+ "es-ES": "Widget para el campo de entrada de la dirección de entrega",
602
+ "ru-RU": "Виджет для поля ввода адреса доставки"
603
+ },
604
+ "location": {
605
+ "en-GB": "Right under the input field",
606
+ "es-ES": "Justo debajo del campo de entrada",
607
+ "ru-RU": "Под полем ввода адреса"
608
+ },
609
+ "contexts": [
610
+ "order/card",
611
+ "settings"
612
+ ]
613
+ },
614
+ {
615
+ "id": "order/card:payment.before",
616
+ "description": {
617
+ "en-GB": "Widget for the section with payment data",
618
+ "es-ES": "Widget para la sección con datos de pago",
619
+ "ru-RU": "Виджет для секции с данными по оплате"
620
+ },
621
+ "location": {
622
+ "en-GB": "Section start, right above the input fields",
623
+ "es-ES": "Inicio de la sección, justo encima de los campos de entrada",
624
+ "ru-RU": "Начало секции, над полями ввода"
625
+ },
626
+ "contexts": [
627
+ "order/card",
628
+ "settings"
629
+ ]
630
+ }
631
+ ],
632
+ "pages": [
633
+ {
634
+ "id": "customer/card",
635
+ "description": {
636
+ "en-GB": "Customer page",
637
+ "es-ES": "Página del cliente",
638
+ "ru-RU": "Страница клиента"
639
+ },
640
+ "targets": [
641
+ "customer/card:phone"
642
+ ]
643
+ },
644
+ {
645
+ "id": "order/card",
646
+ "description": {
647
+ "en-GB": "Page with the order creation/editing form",
648
+ "es-ES": "Página con el formulario de creación/edición de pedidos",
649
+ "ru-RU": "Страница с формой создания/редактирования заказа"
650
+ },
651
+ "targets": [
652
+ "order/card:common.before",
653
+ "order/card:common.after",
654
+ "order/card:customer.before",
655
+ "order/card:customer.after",
656
+ "order/card:customer.email",
657
+ "order/card:customer.phone",
658
+ "order/card:list.before",
659
+ "order/card:list.after",
660
+ "order/card:store.before",
661
+ "order/card:dimensions.before",
662
+ "order/card:delivery.before",
663
+ "order/card:delivery.after",
664
+ "order/card:delivery.address",
665
+ "order/card:payment.before"
666
+ ]
667
+ }
668
+ ],
669
+ "contextsUsage": {
670
+ "customer/card": {
671
+ "import": "import { useCustomerCardContext } from '@retailcrm/embed-ui'",
672
+ "call": "const customer = useCustomerCardContext()"
673
+ },
674
+ "customer/card:phone": {
675
+ "import": "import { useCustomerCardPhoneContext } from '@retailcrm/embed-ui'",
676
+ "call": "const phone = useCustomerCardPhoneContext()"
677
+ },
678
+ "order/card": {
679
+ "import": "import { useOrderCardContext } from '@retailcrm/embed-ui'",
680
+ "call": "const order = useOrderCardContext()"
681
+ },
682
+ "user/current": {
683
+ "import": "import { useCurrentUserContext } from '@retailcrm/embed-ui'",
684
+ "call": "const user = useCurrentUserContext()"
685
+ },
686
+ "settings": {
687
+ "import": "import { useSettingsContext } from '@retailcrm/embed-ui'",
688
+ "call": "const settings = useSettingsContext()"
689
+ }
690
+ }
691
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@retailcrm/embed-ui",
3
3
  "type": "module",
4
- "version": "0.3.6",
4
+ "version": "0.4.0",
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,9 +1,11 @@
1
+ import type { Schema as CurrentUserSchema } from './user/current'
1
2
  import type { Schema as CustomerCardSchema } from './customer/card'
2
3
  import type { Schema as CustomerCardPhoneSchema } from './customer/card-phone'
3
4
  import type { Schema as OrderCardSchema } from './order/card'
4
5
  import type { Schema as SettingsSchema } from './settings'
5
6
 
6
7
  export type SchemaList = {
8
+ 'user/current': CurrentUserSchema;
7
9
  'customer/card': CustomerCardSchema;
8
10
  'customer/card:phone': CustomerCardPhoneSchema;
9
11
  'order/card': OrderCardSchema;
@@ -1,7 +1,27 @@
1
1
  import type { Field } from '../schema'
2
2
 
3
3
  export type Schema = {
4
+ 'id': ReadonlyField<number | null>;
5
+ 'externalId': ReadonlyField<string | null>;
6
+ 'number': ReadonlyField<string | null>;
7
+ 'customer.type': ReadonlyField<number | null>;
8
+ 'customer.lastName': Field<string | null>;
9
+ 'customer.firstName': Field<string | null>;
10
+ 'customer.patronymic': Field<string | null>;
4
11
  'customer.email': Field<string | null>;
5
12
  'customer.phone': Field<string | null>;
13
+ 'country': ReadonlyField<string | null>;
14
+ 'currency': ReadonlyField<string>;
15
+ 'status': ReadonlyField<string>;
16
+ 'company.name': Field<string | null>;
17
+ 'company.legalName': Field<string | null>;
18
+ 'company.legalAddress': Field<string | null>;
19
+ 'company.INN': Field<string | null>;
20
+ 'company.OKPO': Field<string | null>;
21
+ 'company.BIK': Field<string | null>;
22
+ 'company.bank': Field<string | null>;
23
+ 'company.bankAddress': Field<string | null>;
24
+ 'company.corrAccount': Field<string | null>;
25
+ 'company.bankAccount': Field<string | null>;
6
26
  'delivery.address': Field<string | null>;
7
27
  }
@@ -0,0 +1,10 @@
1
+ import type { ReadonlyField } from '../schema'
2
+
3
+ export type Schema = {
4
+ 'lastName': ReadonlyField<string>;
5
+ 'firstName': ReadonlyField<number | null>;
6
+ 'patronymic': ReadonlyField<number | null>;
7
+ 'email': ReadonlyField<string>;
8
+ 'id': ReadonlyField<number | null>;
9
+ 'permissions': ReadonlyField<string[]>;
10
+ }
package/types/widget.d.ts CHANGED
@@ -35,62 +35,77 @@ export type SchemaListByTarget = {
35
35
  'customer/card:phone': Pick<SchemaList,
36
36
  | 'customer/card'
37
37
  | 'customer/card:phone'
38
+ | 'user/current'
38
39
  | 'settings'
39
40
  >;
40
41
  'order/card:common.before': Pick<SchemaList,
41
42
  | 'order/card'
43
+ | 'user/current'
42
44
  | 'settings'
43
45
  >;
44
46
  'order/card:common.after': Pick<SchemaList,
45
47
  | 'order/card'
48
+ | 'user/current'
46
49
  | 'settings'
47
50
  >;
48
51
  'order/card:customer.before': Pick<SchemaList,
49
52
  | 'order/card'
53
+ | 'user/current'
50
54
  | 'settings'
51
55
  >;
52
56
  'order/card:customer.after': Pick<SchemaList,
53
57
  | 'order/card'
58
+ | 'user/current'
54
59
  | 'settings'
55
60
  >;
56
61
  'order/card:customer.email': Pick<SchemaList,
57
62
  | 'order/card'
63
+ | 'user/current'
58
64
  | 'settings'
59
65
  >;
60
66
  'order/card:customer.phone': Pick<SchemaList,
61
67
  | 'order/card'
68
+ | 'user/current'
62
69
  | 'settings'
63
70
  >;
64
71
  'order/card:list.before': Pick<SchemaList,
65
72
  | 'order/card'
73
+ | 'user/current'
66
74
  | 'settings'
67
75
  >;
68
76
  'order/card:list.after': Pick<SchemaList,
69
77
  | 'order/card'
78
+ | 'user/current'
70
79
  | 'settings'
71
80
  >;
72
81
  'order/card:store.before': Pick<SchemaList,
73
82
  | 'order/card'
83
+ | 'user/current'
74
84
  | 'settings'
75
85
  >;
76
86
  'order/card:dimensions.before': Pick<SchemaList,
77
87
  | 'order/card'
88
+ | 'user/current'
78
89
  | 'settings'
79
90
  >;
80
91
  'order/card:delivery.before': Pick<SchemaList,
81
92
  | 'order/card'
93
+ | 'user/current'
82
94
  | 'settings'
83
95
  >;
84
96
  'order/card:delivery.after': Pick<SchemaList,
85
97
  | 'order/card'
98
+ | 'user/current'
86
99
  | 'settings'
87
100
  >;
88
101
  'order/card:delivery.address': Pick<SchemaList,
89
102
  | 'order/card'
103
+ | 'user/current'
90
104
  | 'settings'
91
105
  >;
92
106
  'order/card:payment.before': Pick<SchemaList,
93
107
  | 'order/card'
108
+ | 'user/current'
94
109
  | 'settings'
95
110
  >;
96
111
  }