@retailcrm/embed-ui 0.4.9 → 0.5.1-alpha.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,22 @@
1
1
  # Changelog
2
2
 
3
3
 
4
+ ## [0.5.1-alpha.1](https://github.com/retailcrm/embed-ui/compare/v0.5.0...v0.5.1-alpha.1) (2024-12-13)
5
+
6
+ ### Features
7
+
8
+ * Added useCustomField composable ([8290af2](https://github.com/retailcrm/embed-ui/commit/8290af2468308de132c24f17bb1be983b5c96d2e))
9
+ * **v1-contexts:** Logic of custom contexts ([b4e3dff](https://github.com/retailcrm/embed-ui/commit/b4e3dff92a9c258237d14e5ad8e25be1f87b9f1b))
10
+ * **v1-types:** Added types for custom contexts ([a86c795](https://github.com/retailcrm/embed-ui/commit/a86c795e2bd77c4086705c760277ecc03cfd8072))
11
+ ## [0.5.0](https://github.com/retailcrm/embed-ui/compare/v0.4.9...v0.5.0) (2024-12-11)
12
+
13
+ ### ⚠ BREAKING CHANGES
14
+
15
+ * Renaming fields of order/card context
16
+
17
+ ### Features
18
+
19
+ * Renaming fields of order/card context ([cc8f72f](https://github.com/retailcrm/embed-ui/commit/cc8f72f95ee0481b14562a8ae1937d83459517a2))
4
20
  ## [0.4.9](https://github.com/retailcrm/embed-ui/compare/v0.4.8...v0.4.9) (2024-12-10)
5
21
 
6
22
  ### Features
package/dist/index.cjs CHANGED
@@ -4,6 +4,7 @@ const rpc = require("@remote-ui/rpc");
4
4
  const pinia = require("pinia");
5
5
  const remote$1 = require("@omnicajs/vue-remote/remote");
6
6
  const remote = require("@retailcrm/embed-ui-v1-contexts/remote");
7
+ const custom = require("@retailcrm/embed-ui-v1-contexts/remote/custom");
7
8
  const card = require("@retailcrm/embed-ui-v1-contexts/remote/customer/card");
8
9
  const cardPhone = require("@retailcrm/embed-ui-v1-contexts/remote/customer/card-phone");
9
10
  const card$1 = require("@retailcrm/embed-ui-v1-contexts/remote/order/card");
@@ -21,6 +22,12 @@ const useField = (store, field, onReject = null) => {
21
22
  set: (value) => set(field, value, onReject ?? _onReject)
22
23
  });
23
24
  };
25
+ const useCustomField = (store, code) => {
26
+ return vue.computed({
27
+ get: () => code in store.values ? store.values[code] : void 0,
28
+ set: (value) => store.set(code, value)
29
+ });
30
+ };
24
31
  const useInternal = pinia.defineStore("@retailcrm/embed-ui/_internal", {});
25
32
  const useHost = () => {
26
33
  const store = useInternal();
@@ -56,6 +63,7 @@ const createWidgetEndpoint = (widget, messenger) => {
56
63
  const endpoint = rpc.createEndpoint(messenger);
57
64
  const pinia$1 = pinia.createPinia();
58
65
  pinia$1.use(remote.injectEndpoint(endpoint));
66
+ pinia$1.use(custom.injectAccessor(endpoint));
59
67
  let onRelease = () => {
60
68
  };
61
69
  endpoint.expose({
@@ -119,5 +127,6 @@ Object.defineProperty(exports, "useSettingsContext", {
119
127
  get: () => settings.useContext
120
128
  });
121
129
  exports.createWidgetEndpoint = createWidgetEndpoint;
130
+ exports.useCustomField = useCustomField;
122
131
  exports.useField = useField;
123
132
  exports.useHost = useHost;
package/dist/index.mjs CHANGED
@@ -2,6 +2,7 @@ import { createEndpoint, retain, release } from "@remote-ui/rpc";
2
2
  import { defineStore, createPinia } from "pinia";
3
3
  import { createRemoteRenderer, createRemoteRoot } from "@omnicajs/vue-remote/remote";
4
4
  import { injectEndpoint } from "@retailcrm/embed-ui-v1-contexts/remote";
5
+ import { injectAccessor } from "@retailcrm/embed-ui-v1-contexts/remote/custom";
5
6
  import { schema, useContext } from "@retailcrm/embed-ui-v1-contexts/remote/customer/card";
6
7
  import { schema as schema2, useContext as useContext2 } from "@retailcrm/embed-ui-v1-contexts/remote/customer/card-phone";
7
8
  import { schema as schema3, useContext as useContext3 } from "@retailcrm/embed-ui-v1-contexts/remote/order/card";
@@ -19,6 +20,12 @@ const useField = (store, field, onReject = null) => {
19
20
  set: (value) => set(field, value, onReject ?? _onReject)
20
21
  });
21
22
  };
23
+ const useCustomField = (store, code) => {
24
+ return computed({
25
+ get: () => code in store.values ? store.values[code] : void 0,
26
+ set: (value) => store.set(code, value)
27
+ });
28
+ };
22
29
  const useInternal = defineStore("@retailcrm/embed-ui/_internal", {});
23
30
  const useHost = () => {
24
31
  const store = useInternal();
@@ -54,6 +61,7 @@ const createWidgetEndpoint = (widget, messenger) => {
54
61
  const endpoint = createEndpoint(messenger);
55
62
  const pinia = createPinia();
56
63
  pinia.use(injectEndpoint(endpoint));
64
+ pinia.use(injectAccessor(endpoint));
57
65
  let onRelease = () => {
58
66
  };
59
67
  endpoint.expose({
@@ -84,6 +92,7 @@ export {
84
92
  schema3 as orderCardSchema,
85
93
  schema5 as settingsSchema,
86
94
  useContext4 as useCurrentUserContext,
95
+ useCustomField,
87
96
  useContext as useCustomerCardContext,
88
97
  useContext2 as useCustomerCardPhoneContext,
89
98
  useField,
package/dist/meta.json CHANGED
@@ -206,7 +206,7 @@
206
206
  "readonly": true
207
207
  },
208
208
  {
209
- "name": "contragent.type",
209
+ "name": "company.contragentType",
210
210
  "type": "\"enterpreneur\" | \"legal-entity\" | \"individual\"",
211
211
  "description": {
212
212
  "en-GB": "Legal entity type",
@@ -216,7 +216,7 @@
216
216
  "readonly": true
217
217
  },
218
218
  {
219
- "name": "contragent.certificateNumber",
219
+ "name": "company.certificateNumber",
220
220
  "type": "string | null",
221
221
  "description": {
222
222
  "en-GB": "Certificate number",
@@ -226,7 +226,7 @@
226
226
  "readonly": false
227
227
  },
228
228
  {
229
- "name": "contragent.certificateDate",
229
+ "name": "company.certificateDate",
230
230
  "type": "string | null",
231
231
  "description": {
232
232
  "en-GB": "Certificate date",
@@ -236,7 +236,7 @@
236
236
  "readonly": false
237
237
  },
238
238
  {
239
- "name": "contragent.OGRN",
239
+ "name": "company.OGRN",
240
240
  "type": "string | null",
241
241
  "description": {
242
242
  "en-GB": "PSRN of the counterparty",
@@ -246,7 +246,7 @@
246
246
  "readonly": false
247
247
  },
248
248
  {
249
- "name": "contragent.OGRNIP",
249
+ "name": "company.OGRNIP",
250
250
  "type": "string | null",
251
251
  "description": {
252
252
  "en-GB": "PSRN of Individual entrepreneur",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@retailcrm/embed-ui",
3
3
  "type": "module",
4
- "version": "0.4.9",
4
+ "version": "0.5.1-alpha.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>",
@@ -33,8 +33,8 @@
33
33
  "dependencies": {
34
34
  "@omnicajs/vue-remote": "^0.2.3",
35
35
  "@remote-ui/rpc": "^1.4.5",
36
- "@retailcrm/embed-ui-v1-contexts": "^0.4.9",
37
- "@retailcrm/embed-ui-v1-types": "^0.4.9"
36
+ "@retailcrm/embed-ui-v1-contexts": "^0.5.1-alpha.1",
37
+ "@retailcrm/embed-ui-v1-types": "^0.5.1-alpha.1"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "pinia": "^2.2",
@@ -43,7 +43,7 @@
43
43
  "devDependencies": {
44
44
  "@eslint/eslintrc": "^3.0.2",
45
45
  "@eslint/js": "^9.13.0",
46
- "@retailcrm/embed-ui-v1-testing": "^0.4.9",
46
+ "@retailcrm/embed-ui-v1-testing": "^0.5.1-alpha.1",
47
47
  "@types/git-semver-tags": "^7.0.0",
48
48
  "@types/node": "^22.7.9",
49
49
  "@types/semver": "^7.5.8",