@haus-storefront-react/vendure-plugin-configs 1.0.4-next.1 → 1.0.4-next.10

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.
Files changed (59) hide show
  1. package/CHANGELOG.md +102 -0
  2. package/badge.js +1 -21
  3. package/badge.mjs +449 -3058
  4. package/campaign.js +1 -1
  5. package/campaign.mjs +50 -106
  6. package/elastic.js +1 -1
  7. package/elastic.mjs +10 -26
  8. package/index.js +1 -1
  9. package/index.mjs +2 -4
  10. package/lib/configs/vendure-badge-plugin.d.ts +10 -2
  11. package/lib/configs/vendure-badge-plugin.types.d.ts +0 -1
  12. package/lib/configs/vendure-campaign-plugin.d.ts +1 -1
  13. package/lib/configs/vendure-elastic-search-plugin.d.ts +1 -1
  14. package/lib/configs/vendure-packagesize-plugin.d.ts +1 -1
  15. package/lib/configs/vendure-product-popularity-plugin.d.ts +1 -1
  16. package/lib/configs/vendure-product-variant-specifications-plugin.d.ts +55 -0
  17. package/lib/configs/vendure-product-variant-specifications-plugin.types.d.ts +8 -0
  18. package/lib/configs/vendure-products-by-sku-plugin.d.ts +11 -0
  19. package/lib/configs/vendure-products-by-sku-plugin.types.d.ts +13 -0
  20. package/lib/configs/vendure-purchase-order-payment-plugin.d.ts +14 -0
  21. package/lib/configs/vendure-purchase-order-payment-plugin.types.d.ts +7 -0
  22. package/lib/configs/vendure-related-products-plugin.d.ts +39 -0
  23. package/lib/configs/vendure-related-products-plugin.types.d.ts +16 -0
  24. package/lib/exports/product-variant-specifications.d.ts +2 -0
  25. package/lib/exports/products-by-sku.d.ts +3 -0
  26. package/lib/exports/purchase-order-payment.d.ts +3 -0
  27. package/lib/exports/related-products.d.ts +3 -0
  28. package/lib/hooks/use-add-purchase-order-payment.d.ts +13 -0
  29. package/lib/hooks/use-related-products.d.ts +2 -0
  30. package/lib/plugin-config.d.ts +2 -1
  31. package/lib/strategies/quick-order-variant-sku-validation-strategy.d.ts +6 -0
  32. package/lib/types.d.ts +2 -0
  33. package/package.json +31 -4
  34. package/packagesize.js +1 -1
  35. package/packagesize.mjs +15 -59
  36. package/plugin-config-DrQQb9Ry.js +1 -0
  37. package/plugin-config-DywohMgp.mjs +903 -0
  38. package/product-popularity.js +1 -1
  39. package/product-popularity.mjs +12 -22
  40. package/product-variant-specifications.d.ts +2 -0
  41. package/product-variant-specifications.js +1 -0
  42. package/product-variant-specifications.mjs +9 -0
  43. package/products-by-sku.d.ts +2 -0
  44. package/products-by-sku.js +1 -0
  45. package/products-by-sku.mjs +54 -0
  46. package/purchase-order-payment.d.ts +2 -0
  47. package/purchase-order-payment.js +27 -0
  48. package/purchase-order-payment.mjs +209 -0
  49. package/related-products.d.ts +2 -0
  50. package/related-products.js +1 -0
  51. package/related-products.mjs +36 -0
  52. package/src-BCHcjT-q.mjs +455 -0
  53. package/src-BqcrcEUL.mjs +2718 -0
  54. package/src-Cj3iGasO.js +6 -0
  55. package/src-CvZOxNaX.js +21 -0
  56. package/index-BCrKAB0K.mjs +0 -311
  57. package/index-BRlTlK6a.mjs +0 -3768
  58. package/index-CgxqXyHf.js +0 -20
  59. package/index-DgRzu7XX.js +0 -10
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-CgxqXyHf.js"),e=new r.VendurePluginConfig({name:"productPopularity",enableFeatures:{},queryUpdates:{}});e.setQueryUpdates({product:{fields:["popularity"]},search:{fields:[{items:["popularity"]}]},searchField:{fields:[{items:["popularity"]}]}});exports.VendureProductPopularityPlugin=e;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=new(require(`./plugin-config-DrQQb9Ry.js`)).t({name:`productPopularity`,enableFeatures:{},queryUpdates:{}});e.setQueryUpdates({product:{fields:[`popularity`]},search:{fields:[{items:[`popularity`]}]},searchField:{fields:[{items:[`popularity`]}]}}),exports.VendureProductPopularityPlugin=e;
@@ -1,24 +1,14 @@
1
- import { V as e } from "./index-BRlTlK6a.mjs";
2
- const r = new e({
3
- name: "productPopularity",
4
- enableFeatures: {},
5
- queryUpdates: {}
1
+ import { t as e } from "./plugin-config-DywohMgp.mjs";
2
+ //#region src/lib/configs/vendure-product-popularity-plugin.ts
3
+ var t = new e({
4
+ name: "productPopularity",
5
+ enableFeatures: {},
6
+ queryUpdates: {}
6
7
  });
7
- r.setQueryUpdates({
8
- product: {
9
- fields: ["popularity"]
10
- },
11
- search: {
12
- fields: [{
13
- items: ["popularity"]
14
- }]
15
- },
16
- searchField: {
17
- fields: [{
18
- items: ["popularity"]
19
- }]
20
- }
8
+ t.setQueryUpdates({
9
+ product: { fields: ["popularity"] },
10
+ search: { fields: [{ items: ["popularity"] }] },
11
+ searchField: { fields: [{ items: ["popularity"] }] }
21
12
  });
22
- export {
23
- r as VendureProductPopularityPlugin
24
- };
13
+ //#endregion
14
+ export { t as VendureProductPopularityPlugin };
@@ -0,0 +1,2 @@
1
+ export * from './lib/exports/product-variant-specifications'
2
+ export {}
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=new(require(`./plugin-config-DrQQb9Ry.js`)).t({name:`productVariantSpecifications`,queryUpdates:{}});e.setQueryUpdates({product:{fields:[{variants:[{customFields:[{specifications:[`key`,`value`]}]}]}]}}),exports.VendureProductVariantSpecificationsPlugin=e;
@@ -0,0 +1,9 @@
1
+ import { t as e } from "./plugin-config-DywohMgp.mjs";
2
+ //#region src/lib/configs/vendure-product-variant-specifications-plugin.ts
3
+ var t = new e({
4
+ name: "productVariantSpecifications",
5
+ queryUpdates: {}
6
+ });
7
+ t.setQueryUpdates({ product: { fields: [{ variants: [{ customFields: [{ specifications: ["key", "value"] }] }] }] } });
8
+ //#endregion
9
+ export { t as VendureProductVariantSpecificationsPlugin };
@@ -0,0 +1,2 @@
1
+ export * from './lib/exports/products-by-sku'
2
+ export {}
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=new(require(`./plugin-config-DrQQb9Ry.js`)).t({name:`products-by-sku`,queryUpdates:{}});e.setRequests({productVariantsBySkus:async t=>e.getSdk().createRequest({operation:`productVariantsBySkus`,variables:{skus:{type:`[String!]!`}},fields:[{variantIdsBySku:[`sku`,`variantId`],errorResults:[`message`,`errorCode`]}]},{skus:t},!1).then(e=>e.data).catch(e=>({message:e.message,errorCode:e.code||`unknown`}))});var t=e=>typeof e==`object`&&!!e&&`productVariantsBySkus`in e&&typeof e.productVariantsBySkus==`function`,n=e=>e&&`errorCode`in e;function r(){return{validate:async r=>{let i=e.getSdk();if(!t(i))throw Error(`quickOrderVariantSkuValidationStrategy requires VendureProductsBySkuPlugin to be enabled.`);let a=[...new Set(r.map(e=>e.identifier))],o=await i.productVariantsBySkus(a);if(n(o))return{items:[],invalidIdentifiers:a,errorResults:[{message:o.message,errorCode:o.errorCode}]};let s=o.variantIdsBySku.filter(e=>e.variantId==null).map(e=>e.sku);if(s.length>0)return{items:[],invalidIdentifiers:s,errorResults:o.errorResults.map(e=>({message:e.message,errorCode:e.errorCode}))};let c=new Map(o.variantIdsBySku.map(e=>[e.sku,e.variantId]));return{items:r.map(e=>({productVariantId:c.get(e.identifier)??e.identifier,quantity:e.quantity})),errorResults:[]}}}}exports.VendureProductsBySkuPlugin=e,exports.quickOrderVariantSkuValidationStrategy=r;
@@ -0,0 +1,54 @@
1
+ import { t as e } from "./plugin-config-DywohMgp.mjs";
2
+ //#region src/lib/configs/vendure-products-by-sku-plugin.ts
3
+ var t = new e({
4
+ name: "products-by-sku",
5
+ queryUpdates: {}
6
+ });
7
+ t.setRequests({ productVariantsBySkus: async (e) => t.getSdk().createRequest({
8
+ operation: "productVariantsBySkus",
9
+ variables: { skus: { type: "[String!]!" } },
10
+ fields: [{
11
+ variantIdsBySku: ["sku", "variantId"],
12
+ errorResults: ["message", "errorCode"]
13
+ }]
14
+ }, { skus: e }, !1).then((e) => e.data).catch((e) => ({
15
+ message: e.message,
16
+ errorCode: e.code || "unknown"
17
+ })) });
18
+ //#endregion
19
+ //#region src/lib/strategies/quick-order-variant-sku-validation-strategy.ts
20
+ var n = (e) => typeof e == "object" && !!e && "productVariantsBySkus" in e && typeof e.productVariantsBySkus == "function", r = (e) => e && "errorCode" in e;
21
+ function i() {
22
+ return { validate: async (e) => {
23
+ let i = t.getSdk();
24
+ if (!n(i)) throw Error("quickOrderVariantSkuValidationStrategy requires VendureProductsBySkuPlugin to be enabled.");
25
+ let a = [...new Set(e.map((e) => e.identifier))], o = await i.productVariantsBySkus(a);
26
+ if (r(o)) return {
27
+ items: [],
28
+ invalidIdentifiers: a,
29
+ errorResults: [{
30
+ message: o.message,
31
+ errorCode: o.errorCode
32
+ }]
33
+ };
34
+ let s = o.variantIdsBySku.filter((e) => e.variantId == null).map((e) => e.sku);
35
+ if (s.length > 0) return {
36
+ items: [],
37
+ invalidIdentifiers: s,
38
+ errorResults: o.errorResults.map((e) => ({
39
+ message: e.message,
40
+ errorCode: e.errorCode
41
+ }))
42
+ };
43
+ let c = new Map(o.variantIdsBySku.map((e) => [e.sku, e.variantId]));
44
+ return {
45
+ items: e.map((e) => ({
46
+ productVariantId: c.get(e.identifier) ?? e.identifier,
47
+ quantity: e.quantity
48
+ })),
49
+ errorResults: []
50
+ };
51
+ } };
52
+ }
53
+ //#endregion
54
+ export { t as VendureProductsBySkuPlugin, i as quickOrderVariantSkuValidationStrategy };
@@ -0,0 +1,2 @@
1
+ export * from './lib/exports/purchase-order-payment'
2
+ export {}
@@ -0,0 +1,27 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./src-Cj3iGasO.js`),t=require(`./plugin-config-DrQQb9Ry.js`),n=require(`./src-CvZOxNaX.js`);let r=require(`@tanstack/react-query`);var i=[`id`,`code`,`active`,`createdAt`,`updatedAt`,`orderPlacedAt`,`state`,`totalQuantity`,`currencyCode`,`total`,`totalWithTax`,`subTotal`,`subTotalWithTax`,`shipping`,{discounts:[`type`,`description`,`amount`,`amountWithTax`]},{promotions:[`couponCode`,`description`,`name`,`enabled`,`perCustomerUsageLimit`,`perCustomerUsageLimit`]},`couponCodes`,`shippingWithTax`,`currencyCode`,{taxSummary:[`description`,`taxRate`,`taxBase`,`taxTotal`]},{customer:[`id`,`firstName`,`lastName`,`emailAddress`,`phoneNumber`]},{billingAddress:[`fullName`,`streetLine1`,`streetLine2`,`company`,`city`,`province`,`postalCode`,`countryCode`,`phoneNumber`]},{shippingAddress:[`fullName`,`streetLine1`,`streetLine2`,`company`,`city`,`province`,`postalCode`,`countryCode`,`phoneNumber`]},{shippingLines:[{shippingMethod:[`id`,`name`]},`priceWithTax`,`price`]},{lines:[`id`,`unitPrice`,`unitPriceWithTax`,`linePrice`,`linePriceWithTax`,`discountedUnitPrice`,`discountedUnitPriceWithTax`,`discountedLinePrice`,`discountedLinePriceWithTax`,`proratedUnitPrice`,`proratedUnitPriceWithTax`,`proratedLinePrice`,`proratedLinePriceWithTax`,`quantity`,{featuredAsset:[`id`,`preview`]},{productVariant:[`id`,`name`,`sku`,`price`,`priceWithTax`,`currencyCode`,{facetValues:[{facet:[`id`,`code`,`name`]},`id`,`code`,`name`]},{featuredAsset:[`id`,`preview`]},{product:[`id`,`slug`,`description`,{facetValues:[{facet:[`id`,`code`,`name`]},`id`,`code`,`name`],collections:[`id`,`name`,`slug`,`parentId`,{breadcrumbs:[`id`,`name`,`slug`]}]}]}]}]},{payments:[`id`,`state`,`method`,`amount`,`metadata`]},{history:[{items:[`id`,`type`,`data`,`createdAt`,`updatedAt`]},`totalItems`]}];n.t(`
2
+ mutation transitionOrderToState($input: String!) {
3
+ transitionOrderToState(state: $input) {
4
+ ... on ErrorResult {
5
+ errorCode
6
+ message
7
+ }
8
+ }
9
+ }
10
+ `),n.t(`
11
+ query nextOrderStates {
12
+ nextOrderStates
13
+ }
14
+ `),n.t(`
15
+ fragment EligiblePaymentMethods on PaymentMethodQuote {
16
+ id
17
+ name
18
+ description
19
+ code
20
+ }
21
+ `),n.t(`
22
+ query EligiblePaymentMethods {
23
+ eligiblePaymentMethods {
24
+ ...EligiblePaymentMethods
25
+ }
26
+ }
27
+ `);var a=new t.t({name:`purchase-order-payment`,queryUpdates:{}});a.setRequests({addPurchaseOrderPaymentToOrder:async t=>{try{return(await a.getSdk().createRequest({operation:`addPurchaseOrderPaymentToOrder`,fields:[{operation:`Order`,fields:i,fragment:!0},{operation:`ErrorResult`,fields:[`errorCode`,`message`],fragment:!0}],variables:{input:{type:`AddPurchaseOrderPaymentToOrderInput!`}}},{input:t},!0)).data}catch(t){return{errorCode:e.l.UnknownError,message:t instanceof Error?t.message:`Unknown payment error`}}}});var o=()=>{let t=n.i(),i=(0,r.useQueryClient)(),a=n.n({mutationFn:async e=>{let n=t.addPurchaseOrderPaymentToOrder;if(typeof n!=`function`)throw Error(`addPurchaseOrderPaymentToOrder is not available. Ensure VendurePurchaseOrderPaymentPlugin is registered.`);return n(e)},onSuccess:t=>{t&&!(`errorCode`in t)&&i.invalidateQueries({queryKey:[e.u.ACTIVE_ORDER]})}});return{addPurchaseOrderPayment:async e=>a.mutateAsync(e),error:a.error,isLoading:a.isPending,isError:a.isError,isSuccess:a.isSuccess,data:a.data,reset:a.reset}};exports.VendurePurchaseOrderPaymentPlugin=a,exports.useAddPurchaseOrderPayment=o;
@@ -0,0 +1,209 @@
1
+ import { l as e, u as t } from "./src-BCHcjT-q.mjs";
2
+ import { t as n } from "./plugin-config-DywohMgp.mjs";
3
+ import { a as r, n as i, r as a, t as o } from "./src-BqcrcEUL.mjs";
4
+ //#region ../../providers/src/vendure/queries/order/fragments/orderDetailFragment.ts
5
+ var s = [
6
+ "id",
7
+ "code",
8
+ "active",
9
+ "createdAt",
10
+ "updatedAt",
11
+ "orderPlacedAt",
12
+ "state",
13
+ "totalQuantity",
14
+ "currencyCode",
15
+ "total",
16
+ "totalWithTax",
17
+ "subTotal",
18
+ "subTotalWithTax",
19
+ "shipping",
20
+ { discounts: [
21
+ "type",
22
+ "description",
23
+ "amount",
24
+ "amountWithTax"
25
+ ] },
26
+ { promotions: [
27
+ "couponCode",
28
+ "description",
29
+ "name",
30
+ "enabled",
31
+ "perCustomerUsageLimit",
32
+ "perCustomerUsageLimit"
33
+ ] },
34
+ "couponCodes",
35
+ "shippingWithTax",
36
+ "currencyCode",
37
+ { taxSummary: [
38
+ "description",
39
+ "taxRate",
40
+ "taxBase",
41
+ "taxTotal"
42
+ ] },
43
+ { customer: [
44
+ "id",
45
+ "firstName",
46
+ "lastName",
47
+ "emailAddress",
48
+ "phoneNumber"
49
+ ] },
50
+ { billingAddress: [
51
+ "fullName",
52
+ "streetLine1",
53
+ "streetLine2",
54
+ "company",
55
+ "city",
56
+ "province",
57
+ "postalCode",
58
+ "countryCode",
59
+ "phoneNumber"
60
+ ] },
61
+ { shippingAddress: [
62
+ "fullName",
63
+ "streetLine1",
64
+ "streetLine2",
65
+ "company",
66
+ "city",
67
+ "province",
68
+ "postalCode",
69
+ "countryCode",
70
+ "phoneNumber"
71
+ ] },
72
+ { shippingLines: [
73
+ { shippingMethod: ["id", "name"] },
74
+ "priceWithTax",
75
+ "price"
76
+ ] },
77
+ { lines: [
78
+ "id",
79
+ "unitPrice",
80
+ "unitPriceWithTax",
81
+ "linePrice",
82
+ "linePriceWithTax",
83
+ "discountedUnitPrice",
84
+ "discountedUnitPriceWithTax",
85
+ "discountedLinePrice",
86
+ "discountedLinePriceWithTax",
87
+ "proratedUnitPrice",
88
+ "proratedUnitPriceWithTax",
89
+ "proratedLinePrice",
90
+ "proratedLinePriceWithTax",
91
+ "quantity",
92
+ { featuredAsset: ["id", "preview"] },
93
+ { productVariant: [
94
+ "id",
95
+ "name",
96
+ "sku",
97
+ "price",
98
+ "priceWithTax",
99
+ "currencyCode",
100
+ { facetValues: [
101
+ { facet: [
102
+ "id",
103
+ "code",
104
+ "name"
105
+ ] },
106
+ "id",
107
+ "code",
108
+ "name"
109
+ ] },
110
+ { featuredAsset: ["id", "preview"] },
111
+ { product: [
112
+ "id",
113
+ "slug",
114
+ "description",
115
+ {
116
+ facetValues: [
117
+ { facet: [
118
+ "id",
119
+ "code",
120
+ "name"
121
+ ] },
122
+ "id",
123
+ "code",
124
+ "name"
125
+ ],
126
+ collections: [
127
+ "id",
128
+ "name",
129
+ "slug",
130
+ "parentId",
131
+ { breadcrumbs: [
132
+ "id",
133
+ "name",
134
+ "slug"
135
+ ] }
136
+ ]
137
+ }
138
+ ] }
139
+ ] }
140
+ ] },
141
+ { payments: [
142
+ "id",
143
+ "state",
144
+ "method",
145
+ "amount",
146
+ "metadata"
147
+ ] },
148
+ { history: [{ items: [
149
+ "id",
150
+ "type",
151
+ "data",
152
+ "createdAt",
153
+ "updatedAt"
154
+ ] }, "totalItems"] }
155
+ ];
156
+ i("\n mutation transitionOrderToState($input: String!) {\n transitionOrderToState(state: $input) {\n ... on ErrorResult {\n errorCode\n message\n }\n }\n }\n"), i("\n query nextOrderStates {\n nextOrderStates\n }\n"), i("\n fragment EligiblePaymentMethods on PaymentMethodQuote {\n id\n name\n description\n code\n }\n"), i("\n query EligiblePaymentMethods {\n eligiblePaymentMethods {\n ...EligiblePaymentMethods\n }\n }\n");
157
+ //#endregion
158
+ //#region src/lib/configs/vendure-purchase-order-payment-plugin.ts
159
+ var c = new n({
160
+ name: "purchase-order-payment",
161
+ queryUpdates: {}
162
+ });
163
+ c.setRequests({ addPurchaseOrderPaymentToOrder: async (t) => {
164
+ try {
165
+ return (await c.getSdk().createRequest({
166
+ operation: "addPurchaseOrderPaymentToOrder",
167
+ fields: [{
168
+ operation: "Order",
169
+ fields: s,
170
+ fragment: !0
171
+ }, {
172
+ operation: "ErrorResult",
173
+ fields: ["errorCode", "message"],
174
+ fragment: !0
175
+ }],
176
+ variables: { input: { type: "AddPurchaseOrderPaymentToOrderInput!" } }
177
+ }, { input: t }, !0)).data;
178
+ } catch (t) {
179
+ return {
180
+ errorCode: e.UnknownError,
181
+ message: t instanceof Error ? t.message : "Unknown payment error"
182
+ };
183
+ }
184
+ } });
185
+ //#endregion
186
+ //#region src/lib/hooks/use-add-purchase-order-payment.ts
187
+ var l = () => {
188
+ let e = r(), n = o(), i = a({
189
+ mutationFn: async (t) => {
190
+ let n = e.addPurchaseOrderPaymentToOrder;
191
+ if (typeof n != "function") throw Error("addPurchaseOrderPaymentToOrder is not available. Ensure VendurePurchaseOrderPaymentPlugin is registered.");
192
+ return n(t);
193
+ },
194
+ onSuccess: (e) => {
195
+ e && !("errorCode" in e) && n.invalidateQueries({ queryKey: [t.ACTIVE_ORDER] });
196
+ }
197
+ });
198
+ return {
199
+ addPurchaseOrderPayment: async (e) => i.mutateAsync(e),
200
+ error: i.error,
201
+ isLoading: i.isPending,
202
+ isError: i.isError,
203
+ isSuccess: i.isSuccess,
204
+ data: i.data,
205
+ reset: i.reset
206
+ };
207
+ };
208
+ //#endregion
209
+ export { c as VendurePurchaseOrderPaymentPlugin, l as useAddPurchaseOrderPayment };
@@ -0,0 +1,2 @@
1
+ export * from './lib/exports/related-products'
2
+ export {}
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./src-Cj3iGasO.js`);const e=require(`./plugin-config-DrQQb9Ry.js`),t=require(`./src-CvZOxNaX.js`);let n=require(`@tanstack/react-query`);var r=new e.t({name:`relatedProducts`,enableFeatures:{},queryUpdates:{product:{fields:[`relatedProductIds`]},briefProducts:{fields:[`relatedProductIds`]}}});r.setRequests({relatedProducts:async e=>(await r.getSdk().createRequest({operation:`relatedProducts`,inheritFieldsFrom:`product`,variables:{input:{type:`RelatedProductsInput!`}}},{input:e},!1)).data});var i=e=>{let r=t.i();if(!r.relatedProducts)throw Error(`relatedProducts method not found in SDK. Need to register VendureRelatedProductsPlugin.`);return(0,n.useQuery)({queryKey:[`relatedProducts`,e.id,e.take,e.facetIds],queryFn:()=>r.relatedProducts(e),enabled:!!e.id})};exports.VendureRelatedProductsPlugin=r,exports.useRelatedProducts=i;
@@ -0,0 +1,36 @@
1
+ import "./src-BCHcjT-q.mjs";
2
+ import { t as e } from "./plugin-config-DywohMgp.mjs";
3
+ import { a as t } from "./src-BqcrcEUL.mjs";
4
+ import { useQuery as n } from "@tanstack/react-query";
5
+ //#region src/lib/configs/vendure-related-products-plugin.ts
6
+ var r = new e({
7
+ name: "relatedProducts",
8
+ enableFeatures: {},
9
+ queryUpdates: {
10
+ product: { fields: ["relatedProductIds"] },
11
+ briefProducts: { fields: ["relatedProductIds"] }
12
+ }
13
+ });
14
+ r.setRequests({ relatedProducts: async (e) => (await r.getSdk().createRequest({
15
+ operation: "relatedProducts",
16
+ inheritFieldsFrom: "product",
17
+ variables: { input: { type: "RelatedProductsInput!" } }
18
+ }, { input: e }, !1)).data });
19
+ //#endregion
20
+ //#region src/lib/hooks/use-related-products.ts
21
+ var i = (e) => {
22
+ let r = t();
23
+ if (!r.relatedProducts) throw Error("relatedProducts method not found in SDK. Need to register VendureRelatedProductsPlugin.");
24
+ return n({
25
+ queryKey: [
26
+ "relatedProducts",
27
+ e.id,
28
+ e.take,
29
+ e.facetIds
30
+ ],
31
+ queryFn: () => r.relatedProducts(e),
32
+ enabled: !!e.id
33
+ });
34
+ };
35
+ //#endregion
36
+ export { r as VendureRelatedProductsPlugin, i as useRelatedProducts };