@pinelab/vendure-plugin-qls-fulfillment 1.8.0 → 1.8.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,3 +1,7 @@
1
+ # 1.8.1 (2026-04-24)
2
+
3
+ - Replaced `saveRawWarehouseStockData` boolean with `saveAdditionalData` hook, allowing you to handle and persist any QLS product data yourself
4
+
1
5
  # 1.8.0 (2026-04-21)
2
6
 
3
7
  - Added configurable `saveRawWarehouseStockData` option
@@ -15,20 +15,6 @@ function getVariantCustomFields(uiTab) {
15
15
  readonly: true,
16
16
  ui: { tab: uiTab },
17
17
  },
18
- {
19
- name: 'qlsRawWarehouseStockData',
20
- type: 'text',
21
- label: [
22
- {
23
- value: 'QLS Raw Warehouse Stock Data',
24
- languageCode: core_1.LanguageCode.en,
25
- },
26
- ],
27
- nullable: true,
28
- public: false,
29
- readonly: true,
30
- ui: { tab: uiTab },
31
- },
32
18
  ];
33
19
  }
34
20
  exports.orderCustomFields = [
@@ -29,7 +29,6 @@ let QlsPlugin = QlsPlugin_1 = class QlsPlugin {
29
29
  synchronizeStockLevels: true,
30
30
  autoPushOrders: true,
31
31
  qlsProductIdUiTab: 'QLS',
32
- saveRawWarehouseStockData: false,
33
32
  ...options,
34
33
  };
35
34
  return QlsPlugin_1;
@@ -218,15 +218,15 @@ let QlsProductService = class QlsProductService {
218
218
  else if (result.status === 'updated') {
219
219
  updatedInQls.push(variant);
220
220
  }
221
- if (result.qlsProductId && this.options.saveRawWarehouseStockData) {
222
- const qlsProduct = await client.getFulfillmentProductById(result.qlsProductId);
223
- // Update QLS warehouse stock data in Vendure, only on sync variants to prevent rate limit issues, and only if the option is enabled
224
- if (qlsProduct && qlsProduct.warehouse_stocks) {
225
- await this.connection.getRepository(ctx, core_1.ProductVariant).update({ id: variant.id }, {
226
- customFields: {
227
- qlsRawWarehouseStockData: JSON.stringify(qlsProduct.warehouse_stocks),
228
- },
229
- });
221
+ if (result.qlsProductId && this.options.saveAdditionalData) {
222
+ try {
223
+ const qlsProduct = await client.getFulfillmentProductById(result.qlsProductId);
224
+ if (qlsProduct) {
225
+ await this.options.saveAdditionalData(ctx, new core_1.Injector(this.moduleRef), qlsProduct);
226
+ }
227
+ }
228
+ catch (e) {
229
+ core_1.Logger.error(`Error in saveAdditionalData for variant '${variant.sku}': ${(0, catch_unknown_1.asError)(e).message}`, constants_1.loggerCtx);
230
230
  }
231
231
  }
232
232
  }
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ID, Injector, Order, ProductVariant, RequestContext, SerializedRequestContext } from '@vendure/core';
2
- import { CustomValue, FulfillmentOrderInput, FulfillmentOrderLineInput, FulfillmentProductInput } from './lib/client-types';
2
+ import { CustomValue, FulfillmentOrderInput, FulfillmentOrderLineInput, FulfillmentProduct, FulfillmentProductInput } from './lib/client-types';
3
3
  export interface QlsPluginOptions {
4
4
  /**
5
5
  * Get the QLS client config for the current channel based on given context
@@ -54,11 +54,12 @@ export interface QlsPluginOptions {
54
54
  */
55
55
  qlsProductIdUiTab?: string | null;
56
56
  /**
57
- * After syncing a variant to QLS, fetch the full product from QLS and save
58
- * the raw warehouse stock data in the `qlsRawWarehouseStockData` custom field.
59
- * Defaults to false.
57
+ * Optional hook called after syncing a variant to QLS.
58
+ * Receives the full QLS product, a RequestContext, and an Injector, allowing
59
+ * you to save any additional data to your own database. The saving itself
60
+ * happens inside this hook — if not provided, nothing is persisted.
60
61
  */
61
- saveRawWarehouseStockData?: boolean;
62
+ saveAdditionalData?: (ctx: RequestContext, injector: Injector, qlsProduct: FulfillmentProduct) => Promise<void> | void;
62
63
  /**
63
64
  * Additional order items to add to the QLS order.
64
65
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pinelab/vendure-plugin-qls-fulfillment",
3
- "version": "1.8.0",
3
+ "version": "1.8.1",
4
4
  "description": "Vendure plugin to fulfill orders via QLS.",
5
5
  "keywords": [
6
6
  "fulfillment",