@pinelab/vendure-plugin-qls-fulfillment 1.0.0-beta.1 → 1.0.0-beta.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.
- package/dist/ui/providers.ts +74 -0
- package/package.json +2 -2
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { addActionBarDropdownMenuItem } from '@vendure/admin-ui/core';
|
|
2
|
+
import gql from 'graphql-tag';
|
|
3
|
+
|
|
4
|
+
export default [
|
|
5
|
+
// Product sync button in product list
|
|
6
|
+
addActionBarDropdownMenuItem({
|
|
7
|
+
id: 'qls-fulfillment-sync',
|
|
8
|
+
label: 'Synchronize with QLS',
|
|
9
|
+
locationId: 'product-list',
|
|
10
|
+
icon: 'resistor',
|
|
11
|
+
requiresPermission: ['QLSFullSync'],
|
|
12
|
+
onClick: (_, { dataService, notificationService }) => {
|
|
13
|
+
dataService
|
|
14
|
+
.mutate(
|
|
15
|
+
gql`
|
|
16
|
+
mutation TriggerQlsProductSync {
|
|
17
|
+
triggerQlsProductSync
|
|
18
|
+
}
|
|
19
|
+
`
|
|
20
|
+
)
|
|
21
|
+
.subscribe({
|
|
22
|
+
next: () => {
|
|
23
|
+
notificationService.notify({
|
|
24
|
+
message: `Triggered QLS full product sync...`,
|
|
25
|
+
type: 'success',
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
error: (err) => {
|
|
29
|
+
notificationService.notify({
|
|
30
|
+
message: err.message,
|
|
31
|
+
type: 'error',
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
},
|
|
36
|
+
}),
|
|
37
|
+
// Push order to QLS button on order detail page
|
|
38
|
+
addActionBarDropdownMenuItem({
|
|
39
|
+
id: 'qls-fulfillment-push-order',
|
|
40
|
+
label: 'Push order to QLS',
|
|
41
|
+
locationId: 'order-detail',
|
|
42
|
+
icon: 'resistor',
|
|
43
|
+
requiresPermission: ['QLSFullSync'],
|
|
44
|
+
hasDivider: true,
|
|
45
|
+
onClick: (_, { route, dataService, notificationService }) => {
|
|
46
|
+
dataService
|
|
47
|
+
.mutate(
|
|
48
|
+
gql`
|
|
49
|
+
mutation PushOrderToQls($orderId: ID!) {
|
|
50
|
+
pushOrderToQls(orderId: $orderId)
|
|
51
|
+
}
|
|
52
|
+
`,
|
|
53
|
+
{
|
|
54
|
+
orderId: route.snapshot.params.id,
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
.subscribe({
|
|
58
|
+
next: (result) => {
|
|
59
|
+
console.log(result);
|
|
60
|
+
notificationService.notify({
|
|
61
|
+
message: (result as any).pushOrderToQls,
|
|
62
|
+
type: 'success',
|
|
63
|
+
});
|
|
64
|
+
},
|
|
65
|
+
error: (err) => {
|
|
66
|
+
notificationService.notify({
|
|
67
|
+
message: err.message,
|
|
68
|
+
type: 'error',
|
|
69
|
+
});
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
}),
|
|
74
|
+
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pinelab/vendure-plugin-qls-fulfillment",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.2",
|
|
4
4
|
"description": "Vendure plugin to fulfill orders via QLS.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fulfillment",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"CHANGELOG.md"
|
|
24
24
|
],
|
|
25
25
|
"scripts": {
|
|
26
|
-
"build": "rimraf dist && yarn generate && tsc",
|
|
26
|
+
"build": "rimraf dist && yarn generate && tsc && copyfiles -u 1 'src/ui/**/*' dist/",
|
|
27
27
|
"start": "nodemon --watch src --exec ts-node test/dev-server.ts",
|
|
28
28
|
"generate": "graphql-codegen",
|
|
29
29
|
"test": "vitest run --bail 1",
|