@retailcrm/embed-ui 0.5.14 → 0.5.16
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 +14 -0
- package/dist/index.cjs +21 -0
- package/dist/index.mjs +25 -3
- package/index.d.ts +5 -1
- package/package.json +5 -4
- package/vitest.workspace.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
## [0.5.16](https://github.com/retailcrm/embed-ui/compare/v0.5.15...v0.5.16) (2025-01-27)
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **v1-components:** UiDate & utilities for date/time formatting with automatic vue-i18n locale detection ([41ad8b0](https://github.com/retailcrm/embed-ui/commit/41ad8b07bba29981a3c8132953d90cb5560a00a3))
|
|
9
|
+
## [0.5.15](https://github.com/retailcrm/embed-ui/compare/v0.5.14...v0.5.15) (2025-01-24)
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* Composable utility for using @omnicajs/symfony-fouter ([cc9df5a](https://github.com/retailcrm/embed-ui/commit/cc9df5a274fdfefd0ca2ec56bcf87eec8130fe8e))
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **v1-components:** Avatar display style ([b29c9a8](https://github.com/retailcrm/embed-ui/commit/b29c9a864c5a5e4bbd53836a1313d7090917d058))
|
|
4
18
|
## [0.5.14](https://github.com/retailcrm/embed-ui/compare/v0.5.13...v0.5.14) (2025-01-24)
|
|
5
19
|
|
|
6
20
|
### Bug Fixes
|
package/dist/index.cjs
CHANGED
|
@@ -10,6 +10,7 @@ const cardPhone = require("@retailcrm/embed-ui-v1-contexts/remote/customer/card-
|
|
|
10
10
|
const card$1 = require("@retailcrm/embed-ui-v1-contexts/remote/order/card");
|
|
11
11
|
const current = require("@retailcrm/embed-ui-v1-contexts/remote/user/current");
|
|
12
12
|
const settings = require("@retailcrm/embed-ui-v1-contexts/remote/settings");
|
|
13
|
+
const symfonyRouter = require("@omnicajs/symfony-router");
|
|
13
14
|
const vue = require("vue");
|
|
14
15
|
const useField = (store, field, onReject = null) => {
|
|
15
16
|
if (store.schema[field].readonly) {
|
|
@@ -48,6 +49,25 @@ const useHost = () => {
|
|
|
48
49
|
}
|
|
49
50
|
};
|
|
50
51
|
};
|
|
52
|
+
const useRouter = () => {
|
|
53
|
+
const stringify = JSON.stringify;
|
|
54
|
+
const clone = (pojo) => JSON.parse(stringify(pojo));
|
|
55
|
+
const settings$1 = settings.useContext();
|
|
56
|
+
const routing = vue.shallowRef(clone(settings$1["system.routing"]));
|
|
57
|
+
vue.watch(() => settings$1["system.routing"], (changed) => {
|
|
58
|
+
if (stringify(changed) !== stringify(routing.value)) {
|
|
59
|
+
routing.value = clone(changed);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
return vue.computed(() => {
|
|
63
|
+
symfonyRouter.Router.setData(clone(routing.value));
|
|
64
|
+
return {
|
|
65
|
+
generate: (name, params = {}, absolute = false) => {
|
|
66
|
+
return symfonyRouter.Router.getInstance().generate(name, params, absolute);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
});
|
|
70
|
+
};
|
|
51
71
|
const createRoot = async (channel) => {
|
|
52
72
|
const root = remote$1.createRemoteRoot(channel, {
|
|
53
73
|
components: [
|
|
@@ -145,3 +165,4 @@ exports.createWidgetEndpoint = createWidgetEndpoint;
|
|
|
145
165
|
exports.useCustomField = useCustomField;
|
|
146
166
|
exports.useField = useField;
|
|
147
167
|
exports.useHost = useHost;
|
|
168
|
+
exports.useRouter = useRouter;
|
package/dist/index.mjs
CHANGED
|
@@ -7,8 +7,10 @@ import { schema, useContext } from "@retailcrm/embed-ui-v1-contexts/remote/custo
|
|
|
7
7
|
import { schema as schema2, useContext as useContext2 } from "@retailcrm/embed-ui-v1-contexts/remote/customer/card-phone";
|
|
8
8
|
import { schema as schema3, useContext as useContext3 } from "@retailcrm/embed-ui-v1-contexts/remote/order/card";
|
|
9
9
|
import { schema as schema4, useContext as useContext4 } from "@retailcrm/embed-ui-v1-contexts/remote/user/current";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { useContext as useContext5 } from "@retailcrm/embed-ui-v1-contexts/remote/settings";
|
|
11
|
+
import { schema as schema5, useContext as useContext6 } from "@retailcrm/embed-ui-v1-contexts/remote/settings";
|
|
12
|
+
import { Router } from "@omnicajs/symfony-router";
|
|
13
|
+
import { computed, shallowRef, watch } from "vue";
|
|
12
14
|
const useField = (store, field, onReject = null) => {
|
|
13
15
|
if (store.schema[field].readonly) {
|
|
14
16
|
return computed(() => store[field]);
|
|
@@ -46,6 +48,25 @@ const useHost = () => {
|
|
|
46
48
|
}
|
|
47
49
|
};
|
|
48
50
|
};
|
|
51
|
+
const useRouter = () => {
|
|
52
|
+
const stringify = JSON.stringify;
|
|
53
|
+
const clone = (pojo) => JSON.parse(stringify(pojo));
|
|
54
|
+
const settings = useContext5();
|
|
55
|
+
const routing = shallowRef(clone(settings["system.routing"]));
|
|
56
|
+
watch(() => settings["system.routing"], (changed) => {
|
|
57
|
+
if (stringify(changed) !== stringify(routing.value)) {
|
|
58
|
+
routing.value = clone(changed);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
return computed(() => {
|
|
62
|
+
Router.setData(clone(routing.value));
|
|
63
|
+
return {
|
|
64
|
+
generate: (name, params = {}, absolute = false) => {
|
|
65
|
+
return Router.getInstance().generate(name, params, absolute);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
};
|
|
49
70
|
const createRoot = async (channel) => {
|
|
50
71
|
const root = createRemoteRoot(channel, {
|
|
51
72
|
components: [
|
|
@@ -113,5 +134,6 @@ export {
|
|
|
113
134
|
useField,
|
|
114
135
|
useHost,
|
|
115
136
|
useContext3 as useOrderCardContext,
|
|
116
|
-
|
|
137
|
+
useRouter,
|
|
138
|
+
useContext6 as useSettingsContext
|
|
117
139
|
};
|
package/index.d.ts
CHANGED
|
@@ -24,6 +24,8 @@ import type {
|
|
|
24
24
|
ContextStoreDefinition,
|
|
25
25
|
} from '@retailcrm/embed-ui-v1-contexts/remote'
|
|
26
26
|
|
|
27
|
+
import type { Router } from '@omnicajs/symfony-router'
|
|
28
|
+
|
|
27
29
|
import type { Schema as CustomerCardSchema } from '@retailcrm/embed-ui-v1-contexts/types/customer/card'
|
|
28
30
|
import type { Schema as CustomerCardPhoneSchema } from '@retailcrm/embed-ui-v1-contexts/types/customer/card-phone'
|
|
29
31
|
import type { Schema as OrderCardSchema } from '@retailcrm/embed-ui-v1-contexts/types/order/card'
|
|
@@ -85,4 +87,6 @@ export declare const useCustomerCardContext: ContextStoreDefinition<'customer/ca
|
|
|
85
87
|
export declare const useCustomerCardPhoneContext: ContextStoreDefinition<'customer/card:phone', CustomerCardPhoneSchema>
|
|
86
88
|
export declare const useOrderCardContext: ContextStoreDefinition<'order/card', OrderCardSchema>
|
|
87
89
|
export declare const useCurrentUserContext: ContextStoreDefinition<'user/current', CurrentUserSchema>
|
|
88
|
-
export declare const useSettingsContext: ContextStoreDefinition<'settings', SettingsSchema>
|
|
90
|
+
export declare const useSettingsContext: ContextStoreDefinition<'settings', SettingsSchema>
|
|
91
|
+
|
|
92
|
+
export declare const useRouter: () => ComputedRef<Pick<Router, 'generate'>>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@retailcrm/embed-ui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.16",
|
|
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>",
|
|
@@ -35,15 +35,16 @@
|
|
|
35
35
|
"vue": "^3.5"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
+
"@omnicajs/symfony-router": "^1.0.0",
|
|
38
39
|
"@omnicajs/vue-remote": "^0.2.5",
|
|
39
40
|
"@remote-ui/rpc": "^1.4.5",
|
|
40
|
-
"@retailcrm/embed-ui-v1-contexts": "^0.5.
|
|
41
|
-
"@retailcrm/embed-ui-v1-types": "^0.5.
|
|
41
|
+
"@retailcrm/embed-ui-v1-contexts": "^0.5.16",
|
|
42
|
+
"@retailcrm/embed-ui-v1-types": "^0.5.16"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
44
45
|
"@eslint/eslintrc": "^3.0.2",
|
|
45
46
|
"@eslint/js": "^9.13.0",
|
|
46
|
-
"@retailcrm/embed-ui-v1-testing": "^0.5.
|
|
47
|
+
"@retailcrm/embed-ui-v1-testing": "^0.5.16",
|
|
47
48
|
"@types/git-semver-tags": "^7.0.0",
|
|
48
49
|
"@types/node": "^22.7.9",
|
|
49
50
|
"@types/semver": "^7.5.8",
|