@retailcrm/embed-ui-v1-contexts 0.4.7 → 0.4.8
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/dist/host.cjs +4 -2
- package/dist/host.d.ts +3 -3
- package/dist/host.js +4 -2
- package/dist/meta.json +50 -0
- package/dist/remote/order/card.cjs +28 -0
- package/dist/remote/order/card.d.ts +1 -1
- package/dist/remote/order/card.js +28 -0
- package/package.json +3 -3
- package/types/order/card.d.ts +5 -0
package/dist/host.cjs
CHANGED
|
@@ -74,8 +74,10 @@ const createContextAccessor = (accessors, onError = null) => {
|
|
|
74
74
|
}, onReject, onError);
|
|
75
75
|
},
|
|
76
76
|
on(context, event, handler) {
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
run(() => {
|
|
78
|
+
guard(context);
|
|
79
|
+
accessors[context].on(event, handler);
|
|
80
|
+
}, null, onError);
|
|
79
81
|
}
|
|
80
82
|
};
|
|
81
83
|
};
|
package/dist/host.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ContextAccessor, ContextSchema, ContextSchemaMap, FieldAccessor, FieldGetters, FieldSetters, LogicalRejection, Rejection, RuntimeRejection } from '@retailcrm/embed-ui-v1-types/context';
|
|
2
2
|
import { Maybe } from '@retailcrm/embed-ui-v1-types/scaffolding';
|
|
3
3
|
export declare class HostError extends Error {
|
|
4
4
|
constructor(message: string, previous?: Error | undefined);
|
|
@@ -10,7 +10,7 @@ export declare class LogicalError extends HostError {
|
|
|
10
10
|
export declare class RuntimeError extends HostError {
|
|
11
11
|
get rejection(): RuntimeRejection;
|
|
12
12
|
}
|
|
13
|
-
export declare const createGetter: <S extends ContextSchema>(id: string, getters: FieldGetters<S>) => <
|
|
14
|
-
export declare const createSetter: <S extends ContextSchema>(id: string, setters: FieldSetters<S>) => <
|
|
13
|
+
export declare const createGetter: <S extends ContextSchema>(id: string, getters: FieldGetters<S>) => FieldAccessor<S>["get"];
|
|
14
|
+
export declare const createSetter: <S extends ContextSchema>(id: string, setters: FieldSetters<S>) => FieldAccessor<S>["set"];
|
|
15
15
|
export declare const createContextAccessor: <M extends ContextSchemaMap>(accessors: { [K in keyof M]: FieldAccessor<M[K]>; }, onError?: Maybe<ErrorHandler>) => ContextAccessor<M>;
|
|
16
16
|
export type ErrorHandler = (e: unknown) => void;
|
package/dist/host.js
CHANGED
|
@@ -72,8 +72,10 @@ const createContextAccessor = (accessors, onError = null) => {
|
|
|
72
72
|
}, onReject, onError);
|
|
73
73
|
},
|
|
74
74
|
on(context, event, handler) {
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
run(() => {
|
|
76
|
+
guard(context);
|
|
77
|
+
accessors[context].on(event, handler);
|
|
78
|
+
}, null, onError);
|
|
77
79
|
}
|
|
78
80
|
};
|
|
79
81
|
};
|
package/dist/meta.json
CHANGED
|
@@ -217,6 +217,56 @@
|
|
|
217
217
|
},
|
|
218
218
|
"readonly": true
|
|
219
219
|
},
|
|
220
|
+
{
|
|
221
|
+
"name": "contragent.type",
|
|
222
|
+
"type": "\"enterpreneur\" | \"legal-entity\"",
|
|
223
|
+
"description": {
|
|
224
|
+
"en-GB": "Legal entity type",
|
|
225
|
+
"es-ES": "Tipo de entidad legal",
|
|
226
|
+
"ru-RU": "Тип юридического лица"
|
|
227
|
+
},
|
|
228
|
+
"readonly": true
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"name": "contragent.certificateNumber",
|
|
232
|
+
"type": "string | null",
|
|
233
|
+
"description": {
|
|
234
|
+
"en-GB": "Certificate number",
|
|
235
|
+
"es-ES": "Número de certificado",
|
|
236
|
+
"ru-RU": "Номер свидетельства"
|
|
237
|
+
},
|
|
238
|
+
"readonly": false
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
"name": "contragent.certificateDate",
|
|
242
|
+
"type": "string | null",
|
|
243
|
+
"description": {
|
|
244
|
+
"en-GB": "Certificate date",
|
|
245
|
+
"es-ES": "Fecha del certificado",
|
|
246
|
+
"ru-RU": "Дата свидетельства"
|
|
247
|
+
},
|
|
248
|
+
"readonly": false
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
"name": "contragent.OGRN",
|
|
252
|
+
"type": "string | null",
|
|
253
|
+
"description": {
|
|
254
|
+
"en-GB": "PSRN of the counterparty",
|
|
255
|
+
"es-ES": "PSRN del contraparte",
|
|
256
|
+
"ru-RU": "ОГРН контрагента"
|
|
257
|
+
},
|
|
258
|
+
"readonly": false
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
"name": "contragent.OGRNIP",
|
|
262
|
+
"type": "string | null",
|
|
263
|
+
"description": {
|
|
264
|
+
"en-GB": "PSRN of Individual entrepreneur",
|
|
265
|
+
"es-ES": "PSRN del emprendedor individual",
|
|
266
|
+
"ru-RU": "ОГРНИП"
|
|
267
|
+
},
|
|
268
|
+
"readonly": false
|
|
269
|
+
},
|
|
220
270
|
{
|
|
221
271
|
"name": "company.name",
|
|
222
272
|
"type": "string | null",
|
|
@@ -77,6 +77,34 @@ const schema = {
|
|
|
77
77
|
defaults: () => "",
|
|
78
78
|
readonly: true
|
|
79
79
|
},
|
|
80
|
+
"contragent.type": {
|
|
81
|
+
accepts: predicates.oneOf(
|
|
82
|
+
predicates.isExactly("enterpreneur"),
|
|
83
|
+
predicates.isExactly("legal-entity")
|
|
84
|
+
),
|
|
85
|
+
defaults: () => "legal-entity",
|
|
86
|
+
readonly: true
|
|
87
|
+
},
|
|
88
|
+
"contragent.certificateNumber": {
|
|
89
|
+
accepts: predicates.oneOf(predicates.isString, predicates.isNull),
|
|
90
|
+
defaults: () => null,
|
|
91
|
+
readonly: false
|
|
92
|
+
},
|
|
93
|
+
"contragent.certificateDate": {
|
|
94
|
+
accepts: predicates.oneOf(predicates.isString, predicates.isNull),
|
|
95
|
+
defaults: () => null,
|
|
96
|
+
readonly: false
|
|
97
|
+
},
|
|
98
|
+
"contragent.OGRN": {
|
|
99
|
+
accepts: predicates.oneOf(predicates.isString, predicates.isNull),
|
|
100
|
+
defaults: () => null,
|
|
101
|
+
readonly: false
|
|
102
|
+
},
|
|
103
|
+
"contragent.OGRNIP": {
|
|
104
|
+
accepts: predicates.oneOf(predicates.isString, predicates.isNull),
|
|
105
|
+
defaults: () => null,
|
|
106
|
+
readonly: false
|
|
107
|
+
},
|
|
80
108
|
"company.name": {
|
|
81
109
|
accepts: predicates.oneOf(predicates.isString, predicates.isNull),
|
|
82
110
|
defaults: () => null,
|
|
@@ -8,5 +8,5 @@ export declare const useContext: StoreDefinition<"order/card", Context<Schema>,
|
|
|
8
8
|
schema: () => Schema;
|
|
9
9
|
}, {
|
|
10
10
|
initialize(): Promise<void>;
|
|
11
|
-
set<F extends "customer.lastName" | "customer.firstName" | "customer.patronymic" | "customer.email" | "customer.phone" | "company.name" | "company.legalName" | "company.legalAddress" | "company.INN" | "company.OKPO" | "company.BIK" | "company.bank" | "company.bankAddress" | "company.corrAccount" | "company.bankAccount" | "delivery.address">(field: F, value: TypeOf< Schema[F]>, onReject?: Maybe<RejectionHandler>): void;
|
|
11
|
+
set<F extends "customer.lastName" | "customer.firstName" | "customer.patronymic" | "customer.email" | "customer.phone" | "contragent.certificateNumber" | "contragent.certificateDate" | "contragent.OGRN" | "contragent.OGRNIP" | "company.name" | "company.legalName" | "company.legalAddress" | "company.INN" | "company.OKPO" | "company.BIK" | "company.bank" | "company.bankAddress" | "company.corrAccount" | "company.bankAccount" | "delivery.address">(field: F, value: TypeOf< Schema[F]>, onReject?: Maybe<RejectionHandler>): void;
|
|
12
12
|
}>;
|
|
@@ -75,6 +75,34 @@ const schema = {
|
|
|
75
75
|
defaults: () => "",
|
|
76
76
|
readonly: true
|
|
77
77
|
},
|
|
78
|
+
"contragent.type": {
|
|
79
|
+
accepts: oneOf(
|
|
80
|
+
isExactly("enterpreneur"),
|
|
81
|
+
isExactly("legal-entity")
|
|
82
|
+
),
|
|
83
|
+
defaults: () => "legal-entity",
|
|
84
|
+
readonly: true
|
|
85
|
+
},
|
|
86
|
+
"contragent.certificateNumber": {
|
|
87
|
+
accepts: oneOf(isString, isNull),
|
|
88
|
+
defaults: () => null,
|
|
89
|
+
readonly: false
|
|
90
|
+
},
|
|
91
|
+
"contragent.certificateDate": {
|
|
92
|
+
accepts: oneOf(isString, isNull),
|
|
93
|
+
defaults: () => null,
|
|
94
|
+
readonly: false
|
|
95
|
+
},
|
|
96
|
+
"contragent.OGRN": {
|
|
97
|
+
accepts: oneOf(isString, isNull),
|
|
98
|
+
defaults: () => null,
|
|
99
|
+
readonly: false
|
|
100
|
+
},
|
|
101
|
+
"contragent.OGRNIP": {
|
|
102
|
+
accepts: oneOf(isString, isNull),
|
|
103
|
+
defaults: () => null,
|
|
104
|
+
readonly: false
|
|
105
|
+
},
|
|
78
106
|
"company.name": {
|
|
79
107
|
accepts: oneOf(isString, isNull),
|
|
80
108
|
defaults: () => null,
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@retailcrm/embed-ui-v1-contexts",
|
|
3
3
|
"description": "Reactive contexts for RetailCRM JS API",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "0.4.
|
|
5
|
+
"version": "0.4.8",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "RetailDriverLLC <integration@retailcrm.ru>",
|
|
8
8
|
"repository": "git@github.com:retailcrm/embed-ui.git",
|
|
@@ -93,10 +93,10 @@
|
|
|
93
93
|
"pinia": "^2.2"
|
|
94
94
|
},
|
|
95
95
|
"dependencies": {
|
|
96
|
-
"@retailcrm/embed-ui-v1-types": "^0.4.
|
|
96
|
+
"@retailcrm/embed-ui-v1-types": "^0.4.8"
|
|
97
97
|
},
|
|
98
98
|
"devDependencies": {
|
|
99
|
-
"@retailcrm/embed-ui-v1-testing": "^0.4.
|
|
99
|
+
"@retailcrm/embed-ui-v1-testing": "^0.4.8",
|
|
100
100
|
"tsx": "^4.19.2",
|
|
101
101
|
"typescript": "^5.6.3",
|
|
102
102
|
"vite": "^5.4.11",
|
package/types/order/card.d.ts
CHANGED
|
@@ -15,6 +15,11 @@ export type Schema = {
|
|
|
15
15
|
'country': ReadonlyField<string | null>;
|
|
16
16
|
'currency': ReadonlyField<string>;
|
|
17
17
|
'status': ReadonlyField<string>;
|
|
18
|
+
'contragent.type': ReadonlyField<'enterpreneur' | 'legal-entity'>;
|
|
19
|
+
'contragent.certificateNumber': Field<string | null>;
|
|
20
|
+
'contragent.certificateDate': Field<string | null>;
|
|
21
|
+
'contragent.OGRN': Field<string | null>;
|
|
22
|
+
'contragent.OGRNIP': Field<string | null>;
|
|
18
23
|
'company.name': Field<string | null>;
|
|
19
24
|
'company.legalName': Field<string | null>;
|
|
20
25
|
'company.legalAddress': Field<string | null>;
|