@retailcrm/embed-ui 0.4.1-alpha.7 → 0.4.1-alpha.9

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,17 @@
1
1
  # Changelog
2
2
 
3
3
 
4
+ ## [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)
5
+
6
+ ### Bug Fixes
7
+
8
+ * Types declaration in index.d.ts ([2751630](https://github.com/retailcrm/embed-ui/commit/2751630db649592bc4e8f2b8e16aaf86a7971e0f))
9
+ * **v1-components:** Missing slot of remote UiModalWindow definition ([2bf97a3](https://github.com/retailcrm/embed-ui/commit/2bf97a33e2eee41090195038733bc89baf72bc3d))
10
+ ## [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)
11
+
12
+ ### Bug Fixes
13
+
14
+ * Missing contexts in meta.json ([52d3529](https://github.com/retailcrm/embed-ui/commit/52d3529519c43580ef846a98881cec1dbd3265e8))
4
15
  ## [0.4.1-alpha.7](https://github.com/retailcrm/embed-ui/compare/v0.4.1-alpha.6...v0.4.1-alpha.7) (2024-11-25)
5
16
  ## [0.4.1-alpha.6](https://github.com/retailcrm/embed-ui/compare/v0.4.1-alpha.5...v0.4.1-alpha.6) (2024-11-25)
6
17
  ## [0.4.1-alpha.5](https://github.com/retailcrm/embed-ui/compare/v0.4.1-alpha.4...v0.4.1-alpha.5) (2024-11-25)
package/dist/index.cjs CHANGED
@@ -72,28 +72,28 @@ const oneOf = (...predicates) => withMeta(
72
72
  predicates.map((p) => p.type).join(" | ")
73
73
  );
74
74
  const schema$4 = {
75
- "lastName": {
76
- accepts: oneOf(isString, isNull),
75
+ "id": {
76
+ accepts: oneOf(isNumber, isNull),
77
77
  defaults: () => null,
78
- readonly: false
78
+ readonly: true
79
+ },
80
+ "email": {
81
+ accepts: isString,
82
+ defaults: () => "",
83
+ readonly: true
79
84
  },
80
85
  "firstName": {
81
86
  accepts: oneOf(isString, isNull),
82
87
  defaults: () => null,
83
- readonly: false
88
+ readonly: true
84
89
  },
85
- "patronymic": {
90
+ "lastName": {
86
91
  accepts: oneOf(isString, isNull),
87
92
  defaults: () => null,
88
- readonly: false
89
- },
90
- "email": {
91
- accepts: isString,
92
- defaults: () => "",
93
93
  readonly: true
94
94
  },
95
- "id": {
96
- accepts: oneOf(isNumber, isNull),
95
+ "patronymic": {
96
+ accepts: oneOf(isString, isNull),
97
97
  defaults: () => null,
98
98
  readonly: true
99
99
  },
package/dist/index.mjs CHANGED
@@ -70,28 +70,28 @@ const oneOf = (...predicates) => withMeta(
70
70
  predicates.map((p) => p.type).join(" | ")
71
71
  );
72
72
  const schema$4 = {
73
- "lastName": {
74
- accepts: oneOf(isString, isNull),
73
+ "id": {
74
+ accepts: oneOf(isNumber, isNull),
75
75
  defaults: () => null,
76
- readonly: false
76
+ readonly: true
77
+ },
78
+ "email": {
79
+ accepts: isString,
80
+ defaults: () => "",
81
+ readonly: true
77
82
  },
78
83
  "firstName": {
79
84
  accepts: oneOf(isString, isNull),
80
85
  defaults: () => null,
81
- readonly: false
86
+ readonly: true
82
87
  },
83
- "patronymic": {
88
+ "lastName": {
84
89
  accepts: oneOf(isString, isNull),
85
90
  defaults: () => null,
86
- readonly: false
87
- },
88
- "email": {
89
- accepts: isString,
90
- defaults: () => "",
91
91
  readonly: true
92
92
  },
93
- "id": {
94
- accepts: oneOf(isNumber, isNull),
93
+ "patronymic": {
94
+ accepts: oneOf(isString, isNull),
95
95
  defaults: () => null,
96
96
  readonly: true
97
97
  },
package/dist/meta.json CHANGED
@@ -2,14 +2,24 @@
2
2
  "contexts": {
3
3
  "user/current": [
4
4
  {
5
- "name": "lastName",
6
- "type": "string | null",
5
+ "name": "id",
6
+ "type": "number | null",
7
7
  "description": {
8
- "en-GB": "User last name",
9
- "es-ES": "Apellido del usuario",
10
- "ru-RU": "Фамилия пользователя"
8
+ "en-GB": "User ID",
9
+ "es-ES": "ID del usuario",
10
+ "ru-RU": "ID пользователя"
11
11
  },
12
- "readonly": false
12
+ "readonly": true
13
+ },
14
+ {
15
+ "name": "email",
16
+ "type": "string",
17
+ "description": {
18
+ "en-GB": "User email",
19
+ "es-ES": "Correo electrónico del usuario",
20
+ "ru-RU": "Email пользователя"
21
+ },
22
+ "readonly": true
13
23
  },
14
24
  {
15
25
  "name": "firstName",
@@ -19,35 +29,25 @@
19
29
  "es-ES": "Nombre del usuario",
20
30
  "ru-RU": "Имя пользователя"
21
31
  },
22
- "readonly": false
32
+ "readonly": true
23
33
  },
24
34
  {
25
- "name": "patronymic",
35
+ "name": "lastName",
26
36
  "type": "string | null",
27
37
  "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 пользователя"
38
+ "en-GB": "User last name",
39
+ "es-ES": "Apellido del usuario",
40
+ "ru-RU": "Фамилия пользователя"
41
41
  },
42
42
  "readonly": true
43
43
  },
44
44
  {
45
- "name": "id",
46
- "type": "number | null",
45
+ "name": "patronymic",
46
+ "type": "string | null",
47
47
  "description": {
48
- "en-GB": "User ID",
49
- "es-ES": "ID del usuario",
50
- "ru-RU": "ID пользователя"
48
+ "en-GB": "Patronymic of the user",
49
+ "es-ES": "Patronímico del usuario",
50
+ "ru-RU": "Отчество пользователя"
51
51
  },
52
52
  "readonly": true
53
53
  },
@@ -387,6 +387,7 @@
387
387
  "contexts": [
388
388
  "customer/card",
389
389
  "customer/card:phone",
390
+ "user/current",
390
391
  "settings"
391
392
  ]
392
393
  },
@@ -404,6 +405,7 @@
404
405
  },
405
406
  "contexts": [
406
407
  "order/card",
408
+ "user/current",
407
409
  "settings"
408
410
  ]
409
411
  },
@@ -421,6 +423,7 @@
421
423
  },
422
424
  "contexts": [
423
425
  "order/card",
426
+ "user/current",
424
427
  "settings"
425
428
  ]
426
429
  },
@@ -438,6 +441,7 @@
438
441
  },
439
442
  "contexts": [
440
443
  "order/card",
444
+ "user/current",
441
445
  "settings"
442
446
  ]
443
447
  },
@@ -455,6 +459,7 @@
455
459
  },
456
460
  "contexts": [
457
461
  "order/card",
462
+ "user/current",
458
463
  "settings"
459
464
  ]
460
465
  },
@@ -472,6 +477,7 @@
472
477
  },
473
478
  "contexts": [
474
479
  "order/card",
480
+ "user/current",
475
481
  "settings"
476
482
  ]
477
483
  },
@@ -489,6 +495,7 @@
489
495
  },
490
496
  "contexts": [
491
497
  "order/card",
498
+ "user/current",
492
499
  "settings"
493
500
  ]
494
501
  },
@@ -506,6 +513,7 @@
506
513
  },
507
514
  "contexts": [
508
515
  "order/card",
516
+ "user/current",
509
517
  "settings"
510
518
  ]
511
519
  },
@@ -523,6 +531,7 @@
523
531
  },
524
532
  "contexts": [
525
533
  "order/card",
534
+ "user/current",
526
535
  "settings"
527
536
  ]
528
537
  },
@@ -540,6 +549,7 @@
540
549
  },
541
550
  "contexts": [
542
551
  "order/card",
552
+ "user/current",
543
553
  "settings"
544
554
  ]
545
555
  },
@@ -557,6 +567,7 @@
557
567
  },
558
568
  "contexts": [
559
569
  "order/card",
570
+ "user/current",
560
571
  "settings"
561
572
  ]
562
573
  },
@@ -574,6 +585,7 @@
574
585
  },
575
586
  "contexts": [
576
587
  "order/card",
588
+ "user/current",
577
589
  "settings"
578
590
  ]
579
591
  },
@@ -591,6 +603,7 @@
591
603
  },
592
604
  "contexts": [
593
605
  "order/card",
606
+ "user/current",
594
607
  "settings"
595
608
  ]
596
609
  },
@@ -608,6 +621,7 @@
608
621
  },
609
622
  "contexts": [
610
623
  "order/card",
624
+ "user/current",
611
625
  "settings"
612
626
  ]
613
627
  },
@@ -625,6 +639,7 @@
625
639
  },
626
640
  "contexts": [
627
641
  "order/card",
642
+ "user/current",
628
643
  "settings"
629
644
  ]
630
645
  }
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'
@@ -19,52 +20,46 @@ import type { WritableComputedRef } from 'vue'
19
20
 
20
21
  declare type Computed<S extends ContextSchema, F extends keyof S> = IsReadonly<S[F]> extends true ? ComputedRef<TypeOf<S[F]>> : WritableComputedRef<TypeOf<S[F]>>;
21
22
 
22
- export declare const createWidgetEndpoint: (widget: WidgetRunner, messenger: MessageEndpoint) => Endpoint<ContextAccessor<SchemaList>>
23
+ export declare const createWidgetEndpoint: (
24
+ widget: WidgetRunner,
25
+ messenger: MessageEndpoint
26
+ ) => Endpoint<ContextAccessor<SchemaList>>
23
27
 
24
- export declare const customerCardPhoneSchema: Schema_2
28
+ export declare const customerCardPhoneSchema: CustomerCardPhoneSchema
29
+ export declare const customerCardSchema: CustomerCardSchema
30
+ export declare const orderCardSchema: OrderCardSchema
31
+ export declare const currentUserSchema: CurrentUserSchema
32
+ export declare const settingsSchema: SettingsSchema
25
33
 
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;
34
+ export type ContextStore<S extends ContextSchema> = Store<string, Context<S>, {
35
+ schema(): S;
34
36
  }, {
35
37
  initialize(): Promise<void>;
36
- set<F extends keyof Schema>(field: F, value: TypeOf<Schema[F]>): void;
38
+ set<F extends keyof S>(field: F, value: TypeOf<S[F]>): void;
37
39
  }>
38
40
 
39
- export declare const useCustomerCardPhoneContext: StoreDefinition<'customer/card:phone', Context<Schema_2>, {
40
- schema: () => Schema_2;
41
+ export type ContextStoreDefinition<
42
+ Id extends string,
43
+ S extends ContextSchema
44
+ > = StoreDefinition<Id, Context<S>, {
45
+ schema: () => S;
41
46
  }, {
42
47
  initialize(): Promise<void>;
43
- set<F extends keyof Schema_2>(field: F, value: TypeOf<Schema_2[F]>): void;
48
+ set<F extends keyof S>(field: F, value: TypeOf<S[F]>): void;
44
49
  }>
45
50
 
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>
52
-
53
- export declare const useHost = () => RemoteCallable<Callable>
51
+ export declare const useCustomerCardContext: ContextStoreDefinition<'customer/card', CustomerCardSchema>
52
+ export declare const useCustomerCardPhoneContext: ContextStoreDefinition<'customer/card:phone', CustomerCardPhoneSchema>
53
+ export declare const useOrderCardContext: ContextStoreDefinition<'order/card', OrderCardSchema>
54
+ export declare const useCurrentUserContext = DefineStore<'user/current', CurrentUserSchema>
55
+ export declare const useSettingsContext: ContextStoreDefinition<'settings', SettingsSchema>
54
56
 
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
- }>
57
+ export declare const useField: <S extends ContextSchema, F extends keyof S>(
58
+ store: ContextStore<S>,
59
+ field: F
60
+ ) => Computed<S, F>
61
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
- }>
62
+ export declare const useHost = () => RemoteCallable<Callable>
68
63
 
69
64
  declare module 'pinia' {
70
65
  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.7",
4
+ "version": "0.4.1-alpha.9",
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,10 +1,10 @@
1
1
  import type { ReadonlyField } from '../schema'
2
2
 
3
3
  export type Schema = {
4
- 'lastName': ReadonlyField<string>;
4
+ 'id': ReadonlyField<number | null>;
5
+ 'email': ReadonlyField<string>;
5
6
  'firstName': ReadonlyField<number | null>;
7
+ 'lastName': ReadonlyField<string | null>;
6
8
  'patronymic': ReadonlyField<number | null>;
7
- 'email': ReadonlyField<string>;
8
- 'id': ReadonlyField<number | null>;
9
9
  'permissions': ReadonlyField<string[]>;
10
10
  }