@pinelab/vendure-plugin-qls-fulfillment 3.1.0 → 3.2.0

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,3 +1,7 @@
1
+ # 3.2.0 (2026-08-12)
2
+
3
+ - Restore the legacy Angular Admin UI extension alongside the React Dashboard.
4
+
1
5
  # 3.1.0 (2026-08-12)
2
6
 
3
7
  - Trigger `saveAdditionalVariantData` from incoming stock webhooks using the webhook payload directly.
@@ -0,0 +1,246 @@
1
+ import {
2
+ addActionBarDropdownMenuItem,
3
+ addActionBarItem,
4
+ ModalService,
5
+ } from '@vendure/admin-ui/core';
6
+ import { firstValueFrom, of } from 'rxjs';
7
+ import { map, catchError, take } from 'rxjs/operators';
8
+ import gql from 'graphql-tag';
9
+
10
+ export default [
11
+ // Product sync button in product list
12
+ addActionBarDropdownMenuItem({
13
+ id: 'qls-fulfillment-sync',
14
+ label: 'Synchronize with QLS',
15
+ locationId: 'product-list',
16
+ icon: 'resistor',
17
+ requiresPermission: ['QLSFullSync'],
18
+ onClick: (_, { dataService, notificationService }) => {
19
+ dataService
20
+ .mutate(
21
+ gql`
22
+ mutation TriggerQlsProductSync {
23
+ triggerQlsProductSync
24
+ }
25
+ `
26
+ )
27
+ .subscribe({
28
+ next: () => {
29
+ notificationService.notify({
30
+ message: `Triggered QLS full product sync...`,
31
+ type: 'success',
32
+ });
33
+ },
34
+ error: (err) => {
35
+ notificationService.notify({
36
+ message: err.message,
37
+ type: 'error',
38
+ });
39
+ },
40
+ });
41
+ },
42
+ }),
43
+ // QLS order link button on order detail page
44
+ addActionBarItem({
45
+ id: 'qls-visit-order',
46
+ label: 'QLS',
47
+ locationId: 'order-detail',
48
+ buttonColor: 'primary',
49
+ buttonStyle: 'outline',
50
+ icon: 'link',
51
+ buttonState: (context) => {
52
+ return context.entity$.pipe(
53
+ map((entity) => ({
54
+ visible: !!entity?.orderPlacedAt,
55
+ disabled: false,
56
+ }))
57
+ );
58
+ },
59
+ onClick: async (event, { route, dataService, notificationService }) => {
60
+ const orderId = route.snapshot.params.id;
61
+ const res = await firstValueFrom(
62
+ dataService.query(
63
+ gql`
64
+ query Order($orderId: ID!) {
65
+ order(id: $orderId) {
66
+ id
67
+ qlsOrderUrl
68
+ }
69
+ }
70
+ `,
71
+ { orderId }
72
+ ).single$
73
+ );
74
+ const url = (res as any).order.qlsOrderUrl;
75
+ if (url) {
76
+ window.open(url, '_blank');
77
+ } else {
78
+ notificationService.notify({
79
+ message: 'No QLS order found for this order.',
80
+ type: 'error',
81
+ });
82
+ }
83
+ },
84
+ }),
85
+ // QLS product link button on product variant detail page
86
+ addActionBarItem({
87
+ id: 'qls-visit-product',
88
+ label: 'QLS',
89
+ locationId: 'product-variant-detail',
90
+ buttonColor: 'primary',
91
+ buttonStyle: 'outline',
92
+ icon: 'link',
93
+ onClick: async (event, { route, dataService, notificationService }) => {
94
+ const variantId = route.snapshot.params.id;
95
+ const res = await firstValueFrom(
96
+ dataService.query(
97
+ gql`
98
+ query ProductVariant($id: ID!) {
99
+ productVariant(id: $id) {
100
+ id
101
+ qlsProductUrl
102
+ }
103
+ }
104
+ `,
105
+ { id: variantId }
106
+ ).single$
107
+ );
108
+ const url = (res as any).productVariant.qlsProductUrl;
109
+ if (url) {
110
+ window.open(url, '_blank');
111
+ } else {
112
+ notificationService.notify({
113
+ message: 'No QLS product found for this variant.',
114
+ type: 'error',
115
+ });
116
+ }
117
+ },
118
+ }),
119
+ // Push order to QLS button on order detail page
120
+ addActionBarDropdownMenuItem({
121
+ id: 'qls-fulfillment-push-order',
122
+ label: 'Push order to QLS',
123
+ locationId: 'order-detail',
124
+ icon: 'resistor',
125
+ requiresPermission: ['QLSFullSync'],
126
+ hasDivider: true,
127
+ onClick: async (
128
+ _,
129
+ { route, dataService, notificationService, injector }
130
+ ) => {
131
+ const orderId = route.snapshot.params.id;
132
+ const res = await firstValueFrom(
133
+ dataService.query(
134
+ gql`
135
+ query Order($orderId: ID!) {
136
+ order(id: $orderId) {
137
+ id
138
+ qlsOrderIds
139
+ }
140
+ }
141
+ `,
142
+ { orderId }
143
+ ).single$
144
+ );
145
+ if ((res as any).order.qlsOrderIds.length > 0) {
146
+ const modalService = injector.get(ModalService);
147
+ const confirmed = await firstValueFrom(
148
+ modalService.dialog({
149
+ title: 'Push order to QLS',
150
+ body: 'This order already exists in QLS. Are you sure you want to push it again?',
151
+ buttons: [
152
+ { type: 'secondary', label: 'Cancel', returnValue: false },
153
+ { type: 'primary', label: 'Push to QLS', returnValue: true },
154
+ ],
155
+ })
156
+ );
157
+ if (!confirmed) return;
158
+ }
159
+
160
+ dataService
161
+ .mutate(
162
+ gql`
163
+ mutation PushOrderToQls($orderId: ID!) {
164
+ pushOrderToQls(orderId: $orderId)
165
+ }
166
+ `,
167
+ { orderId }
168
+ )
169
+ .subscribe({
170
+ next: (result) => {
171
+ notificationService.notify({
172
+ message: (result as any).pushOrderToQls,
173
+ type: 'success',
174
+ });
175
+ },
176
+ error: (err) => {
177
+ notificationService.notify({
178
+ message: err.message,
179
+ type: 'error',
180
+ });
181
+ },
182
+ });
183
+ },
184
+ }),
185
+ addActionBarDropdownMenuItem({
186
+ id: 'qls-fulfillment-add-ean',
187
+ label: 'Add additional EAN to QLS',
188
+ locationId: 'product-variant-detail',
189
+ icon: 'resistor',
190
+ requiresPermission: ['QLSFullSync'],
191
+ onClick: async (
192
+ _,
193
+ { route, dataService, notificationService, entity$ }
194
+ ) => {
195
+ const ean = window.prompt('Enter additional EAN to add to QLS:');
196
+ if (!ean) {
197
+ return;
198
+ }
199
+ const variantId = route.snapshot.params.id;
200
+ try {
201
+ const variant = await firstValueFrom(entity$.pipe(take(1)));
202
+ const confirmed = window.confirm(
203
+ `Wil je EAN "${ean}" toevoegen aan "${variant?.name}"?`
204
+ );
205
+ if (!confirmed) {
206
+ return;
207
+ }
208
+ } catch (err) {
209
+ notificationService.notify({
210
+ message: (err as any).message,
211
+ type: 'error',
212
+ });
213
+ return;
214
+ }
215
+ dataService
216
+ .mutate(
217
+ gql`
218
+ mutation AddAdditionalEANSToQLS(
219
+ $variantId: ID!
220
+ $additionalEANS: [String!]!
221
+ ) {
222
+ addAdditionalEANSToQLS(
223
+ variantId: $variantId
224
+ additionalEANS: $additionalEANS
225
+ )
226
+ }
227
+ `,
228
+ { variantId, additionalEANS: [ean] }
229
+ )
230
+ .subscribe({
231
+ next: () => {
232
+ notificationService.notify({
233
+ message: `Added EAN ${ean} to QLS`,
234
+ type: 'success',
235
+ });
236
+ },
237
+ error: (err) => {
238
+ notificationService.notify({
239
+ message: err.message,
240
+ type: 'error',
241
+ });
242
+ },
243
+ });
244
+ },
245
+ }),
246
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pinelab/vendure-plugin-qls-fulfillment",
3
- "version": "3.1.0",
3
+ "version": "3.2.0",
4
4
  "description": "Vendure plugin to fulfill orders via QLS.",
5
5
  "keywords": [
6
6
  "fulfillment",