@retailcrm/embed-ui-v1-types 0.5.1-alpha.1 → 0.5.1-alpha.2

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 (2) hide show
  1. package/context.d.ts +39 -12
  2. package/package.json +1 -1
package/context.d.ts CHANGED
@@ -118,10 +118,18 @@ export interface RuntimeRejection extends Rejection {
118
118
  type: 'runtime';
119
119
  }
120
120
 
121
- export type Dictionary = DictionaryItem[]
122
- export type DictionaryItem = {
121
+ export type CustomDictionary = CustomDictionaryItem[]
122
+ export type CustomDictionaryItem = {
123
123
  code: string;
124
124
  text: string;
125
+ cursor: string;
126
+ }
127
+
128
+ export type CustomDictionaryFilter = {
129
+ after?: string;
130
+ before?: string;
131
+ first?: number;
132
+ last?: number;
125
133
  }
126
134
 
127
135
  export interface BasicCustomField<K extends string, T> {
@@ -164,15 +172,34 @@ export type CustomContext = {
164
172
  [code: string]: CustomFieldType
165
173
  }
166
174
 
167
- export interface CustomContextAccessor {
168
- getCustomSchema (entity: string, onReject?: Maybe<RejectionHandler>): CustomContextSchema | null | undefined;
169
- getCustomField (entity: string, code: string): unknown;
175
+ export type CustomContextAccessor = {
176
+ getCustomSchema (entity: string, onReject?: Maybe<RejectionHandler>): CustomContextSchema | null;
177
+
178
+ getCustomDictionary (
179
+ code: string,
180
+ filter?: CustomDictionaryFilter,
181
+ onReject?: Maybe<RejectionHandler>
182
+ ): Promise<CustomDictionary>;
183
+
184
+ getCustomField (entity: string, code: string, onReject?: Maybe<RejectionHandler>): unknown;
170
185
  setCustomField (entity: string, code: string, value: CustomFieldType, onReject?: Maybe<RejectionHandler>): unknown;
171
- onCustomFieldChange (entity: string, code: string, handler: (value: CustomFieldType) => void);
172
- getDictionary (code: string, parameters?: {
173
- after?: string;
174
- before?: string;
175
- first?: number;
176
- last?: number;
177
- }, onReject?: Maybe<RejectionHandler>): Promise<Dictionary>;
186
+
187
+ onCustomFieldChange (
188
+ entity: string,
189
+ code: string,
190
+ handler: (value: CustomFieldType) => void,
191
+ onReject?: Maybe<RejectionHandler>
192
+ ): void | (() => void);
193
+ }
194
+
195
+ export type CustomFieldAccessor = {
196
+ readonly schema: CustomContextSchema;
197
+
198
+ get (code: string): unknown;
199
+ set (code: string, value: CustomFieldType): void;
200
+
201
+ onChange (
202
+ code: string,
203
+ handler: (value: CustomFieldType) => void
204
+ ): void | (() => void);
178
205
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@retailcrm/embed-ui-v1-types",
3
3
  "description": "Basic types declarations for RetailCRM JS API",
4
4
  "type": "module",
5
- "version": "0.5.1-alpha.1",
5
+ "version": "0.5.1-alpha.2",
6
6
  "license": "MIT",
7
7
  "author": "RetailDriverLLC <integration@retailcrm.ru>",
8
8
  "repository": "git@github.com:retailcrm/embed-ui.git",