@vendure/ui-devkit 2.2.0-next.2 → 2.2.0-next.4
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/client/devkit-client-api.d.ts +109 -109
- package/client/index.d.ts +1 -1
- package/compiler/compile.d.ts +9 -9
- package/compiler/compile.js +261 -261
- package/compiler/constants.d.ts +6 -6
- package/compiler/constants.js +9 -9
- package/compiler/helpers.d.ts +25 -25
- package/compiler/helpers.js +49 -49
- package/compiler/index.d.ts +3 -3
- package/compiler/index.js +19 -19
- package/compiler/scaffold.d.ts +4 -4
- package/compiler/scaffold.js +237 -237
- package/compiler/translations.d.ts +12 -12
- package/compiler/translations.js +136 -136
- package/compiler/types.d.ts +419 -419
- package/compiler/types.js +2 -2
- package/compiler/utils.d.ts +34 -34
- package/compiler/utils.js +137 -137
- package/package.json +6 -6
|
@@ -1,109 +1,109 @@
|
|
|
1
|
-
import { ActiveRouteData, NotificationMessage, WatchQueryFetchPolicy } from '@vendure/common/lib/extension-host-types';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
/**
|
|
4
|
-
* @description
|
|
5
|
-
* Set the [window.postMessage API](https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage)
|
|
6
|
-
* `targetOrigin`. The Vendure ui-devkit uses the postMessage API to
|
|
7
|
-
* enable cross-frame and cross-origin communication between the ui extension code and the Admin UI
|
|
8
|
-
* app. The `targetOrigin` is a security feature intended to provide control over where messages are sent.
|
|
9
|
-
*
|
|
10
|
-
* @docsCategory ui-devkit
|
|
11
|
-
* @docsPage UiDevkitClient
|
|
12
|
-
*/
|
|
13
|
-
export declare function setTargetOrigin(value: string): void;
|
|
14
|
-
/**
|
|
15
|
-
* @description
|
|
16
|
-
* Retrieves information about the current route of the host application, since it is not possible
|
|
17
|
-
* to otherwise get this information from within the child iframe.
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```ts
|
|
21
|
-
* import { getActivatedRoute } from '\@vendure/ui-devkit';
|
|
22
|
-
*
|
|
23
|
-
* const route = await getActivatedRoute();
|
|
24
|
-
* const slug = route.params.slug;
|
|
25
|
-
* ```
|
|
26
|
-
* @docsCategory ui-devkit
|
|
27
|
-
* @docsPage UiDevkitClient
|
|
28
|
-
*/
|
|
29
|
-
export declare function getActivatedRoute(): Promise<ActiveRouteData>;
|
|
30
|
-
/**
|
|
31
|
-
* @description
|
|
32
|
-
* Perform a GraphQL query and returns either an Observable or a Promise of the result.
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* ```ts
|
|
36
|
-
* import { graphQlQuery } from '\@vendure/ui-devkit';
|
|
37
|
-
*
|
|
38
|
-
* const productList = await graphQlQuery(`
|
|
39
|
-
* query GetProducts($skip: Int, $take: Int) {
|
|
40
|
-
* products(options: { skip: $skip, take: $take }) {
|
|
41
|
-
* items { id, name, enabled },
|
|
42
|
-
* totalItems
|
|
43
|
-
* }
|
|
44
|
-
* }`, {
|
|
45
|
-
* skip: 0,
|
|
46
|
-
* take: 10,
|
|
47
|
-
* }).then(data => data.products);
|
|
48
|
-
* ```
|
|
49
|
-
*
|
|
50
|
-
* @docsCategory ui-devkit
|
|
51
|
-
* @docsPage UiDevkitClient
|
|
52
|
-
*/
|
|
53
|
-
export declare function graphQlQuery<T, V extends {
|
|
54
|
-
[key: string]: any;
|
|
55
|
-
}>(document: string, variables?: {
|
|
56
|
-
[key: string]: any;
|
|
57
|
-
}, fetchPolicy?: WatchQueryFetchPolicy): {
|
|
58
|
-
then: Promise<T>['then'];
|
|
59
|
-
stream: Observable<T>;
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* @description
|
|
63
|
-
* Perform a GraphQL mutation and returns either an Observable or a Promise of the result.
|
|
64
|
-
*
|
|
65
|
-
* @example
|
|
66
|
-
* ```ts
|
|
67
|
-
* import { graphQlMutation } from '\@vendure/ui-devkit';
|
|
68
|
-
*
|
|
69
|
-
* const disableProduct = (id: string) => {
|
|
70
|
-
* return graphQlMutation(`
|
|
71
|
-
* mutation DisableProduct($id: ID!) {
|
|
72
|
-
* updateProduct(input: { id: $id, enabled: false }) {
|
|
73
|
-
* id
|
|
74
|
-
* enabled
|
|
75
|
-
* }
|
|
76
|
-
* }`, { id })
|
|
77
|
-
* .then(data => data.updateProduct)
|
|
78
|
-
* }
|
|
79
|
-
* ```
|
|
80
|
-
*
|
|
81
|
-
* @docsCategory ui-devkit
|
|
82
|
-
* @docsPage UiDevkitClient
|
|
83
|
-
*/
|
|
84
|
-
export declare function graphQlMutation<T, V extends {
|
|
85
|
-
[key: string]: any;
|
|
86
|
-
}>(document: string, variables?: {
|
|
87
|
-
[key: string]: any;
|
|
88
|
-
}): {
|
|
89
|
-
then: Promise<T>['then'];
|
|
90
|
-
stream: Observable<T>;
|
|
91
|
-
};
|
|
92
|
-
/**
|
|
93
|
-
* @description
|
|
94
|
-
* Display a toast notification.
|
|
95
|
-
*
|
|
96
|
-
* @example
|
|
97
|
-
* ```ts
|
|
98
|
-
* import { notify } from '\@vendure/ui-devkit';
|
|
99
|
-
*
|
|
100
|
-
* notify({
|
|
101
|
-
* message: 'Updated Product',
|
|
102
|
-
* type: 'success'
|
|
103
|
-
* });
|
|
104
|
-
* ```
|
|
105
|
-
*
|
|
106
|
-
* @docsCategory ui-devkit
|
|
107
|
-
* @docsPage UiDevkitClient
|
|
108
|
-
*/
|
|
109
|
-
export declare function notify(options: NotificationMessage['data']): void;
|
|
1
|
+
import { ActiveRouteData, NotificationMessage, WatchQueryFetchPolicy } from '@vendure/common/lib/extension-host-types';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
/**
|
|
4
|
+
* @description
|
|
5
|
+
* Set the [window.postMessage API](https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage)
|
|
6
|
+
* `targetOrigin`. The Vendure ui-devkit uses the postMessage API to
|
|
7
|
+
* enable cross-frame and cross-origin communication between the ui extension code and the Admin UI
|
|
8
|
+
* app. The `targetOrigin` is a security feature intended to provide control over where messages are sent.
|
|
9
|
+
*
|
|
10
|
+
* @docsCategory ui-devkit
|
|
11
|
+
* @docsPage UiDevkitClient
|
|
12
|
+
*/
|
|
13
|
+
export declare function setTargetOrigin(value: string): void;
|
|
14
|
+
/**
|
|
15
|
+
* @description
|
|
16
|
+
* Retrieves information about the current route of the host application, since it is not possible
|
|
17
|
+
* to otherwise get this information from within the child iframe.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { getActivatedRoute } from '\@vendure/ui-devkit';
|
|
22
|
+
*
|
|
23
|
+
* const route = await getActivatedRoute();
|
|
24
|
+
* const slug = route.params.slug;
|
|
25
|
+
* ```
|
|
26
|
+
* @docsCategory ui-devkit
|
|
27
|
+
* @docsPage UiDevkitClient
|
|
28
|
+
*/
|
|
29
|
+
export declare function getActivatedRoute(): Promise<ActiveRouteData>;
|
|
30
|
+
/**
|
|
31
|
+
* @description
|
|
32
|
+
* Perform a GraphQL query and returns either an Observable or a Promise of the result.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* import { graphQlQuery } from '\@vendure/ui-devkit';
|
|
37
|
+
*
|
|
38
|
+
* const productList = await graphQlQuery(`
|
|
39
|
+
* query GetProducts($skip: Int, $take: Int) {
|
|
40
|
+
* products(options: { skip: $skip, take: $take }) {
|
|
41
|
+
* items { id, name, enabled },
|
|
42
|
+
* totalItems
|
|
43
|
+
* }
|
|
44
|
+
* }`, {
|
|
45
|
+
* skip: 0,
|
|
46
|
+
* take: 10,
|
|
47
|
+
* }).then(data => data.products);
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @docsCategory ui-devkit
|
|
51
|
+
* @docsPage UiDevkitClient
|
|
52
|
+
*/
|
|
53
|
+
export declare function graphQlQuery<T, V extends {
|
|
54
|
+
[key: string]: any;
|
|
55
|
+
}>(document: string, variables?: {
|
|
56
|
+
[key: string]: any;
|
|
57
|
+
}, fetchPolicy?: WatchQueryFetchPolicy): {
|
|
58
|
+
then: Promise<T>['then'];
|
|
59
|
+
stream: Observable<T>;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* @description
|
|
63
|
+
* Perform a GraphQL mutation and returns either an Observable or a Promise of the result.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* import { graphQlMutation } from '\@vendure/ui-devkit';
|
|
68
|
+
*
|
|
69
|
+
* const disableProduct = (id: string) => {
|
|
70
|
+
* return graphQlMutation(`
|
|
71
|
+
* mutation DisableProduct($id: ID!) {
|
|
72
|
+
* updateProduct(input: { id: $id, enabled: false }) {
|
|
73
|
+
* id
|
|
74
|
+
* enabled
|
|
75
|
+
* }
|
|
76
|
+
* }`, { id })
|
|
77
|
+
* .then(data => data.updateProduct)
|
|
78
|
+
* }
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* @docsCategory ui-devkit
|
|
82
|
+
* @docsPage UiDevkitClient
|
|
83
|
+
*/
|
|
84
|
+
export declare function graphQlMutation<T, V extends {
|
|
85
|
+
[key: string]: any;
|
|
86
|
+
}>(document: string, variables?: {
|
|
87
|
+
[key: string]: any;
|
|
88
|
+
}): {
|
|
89
|
+
then: Promise<T>['then'];
|
|
90
|
+
stream: Observable<T>;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* @description
|
|
94
|
+
* Display a toast notification.
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```ts
|
|
98
|
+
* import { notify } from '\@vendure/ui-devkit';
|
|
99
|
+
*
|
|
100
|
+
* notify({
|
|
101
|
+
* message: 'Updated Product',
|
|
102
|
+
* type: 'success'
|
|
103
|
+
* });
|
|
104
|
+
* ```
|
|
105
|
+
*
|
|
106
|
+
* @docsCategory ui-devkit
|
|
107
|
+
* @docsPage UiDevkitClient
|
|
108
|
+
*/
|
|
109
|
+
export declare function notify(options: NotificationMessage['data']): void;
|
package/client/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './devkit-client-api';
|
|
1
|
+
export * from './devkit-client-api';
|
package/compiler/compile.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { AdminUiAppConfig, AdminUiAppDevModeConfig } from '@vendure/common/lib/shared-types';
|
|
2
|
-
import { UiExtensionCompilerOptions } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* @description
|
|
5
|
-
* Compiles the Admin UI app with the specified extensions.
|
|
6
|
-
*
|
|
7
|
-
* @docsCategory UiDevkit
|
|
8
|
-
*/
|
|
9
|
-
export declare function compileUiExtensions(options: UiExtensionCompilerOptions): AdminUiAppConfig | AdminUiAppDevModeConfig;
|
|
1
|
+
import { AdminUiAppConfig, AdminUiAppDevModeConfig } from '@vendure/common/lib/shared-types';
|
|
2
|
+
import { UiExtensionCompilerOptions } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* @description
|
|
5
|
+
* Compiles the Admin UI app with the specified extensions.
|
|
6
|
+
*
|
|
7
|
+
* @docsCategory UiDevkit
|
|
8
|
+
*/
|
|
9
|
+
export declare function compileUiExtensions(options: UiExtensionCompilerOptions): AdminUiAppConfig | AdminUiAppDevModeConfig;
|