@haus-storefront-react/vendure-plugin-configs 0.0.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/README.md +176 -0
- package/badge.js +1 -0
- package/badge.mjs +91 -0
- package/campaign.js +42 -0
- package/campaign.mjs +467 -0
- package/index-CzxpJe9c.js +27 -0
- package/index-RBMJ45wv.mjs +3751 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.mjs +4 -0
- package/lib/configs/vendure-badge-plugin.augmentation.d.ts +15 -0
- package/lib/configs/vendure-badge-plugin.d.ts +14 -0
- package/lib/configs/vendure-badge-plugin.types.d.ts +24 -0
- package/lib/configs/vendure-campaign-plugin.augmentation.d.ts +13 -0
- package/lib/configs/vendure-campaign-plugin.d.ts +5 -0
- package/lib/configs/vendure-campaign-plugin.types.d.ts +19 -0
- package/lib/configs/vendure-packagesize-plugin.augmentation.d.ts +14 -0
- package/lib/configs/vendure-packagesize-plugin.d.ts +23 -0
- package/lib/configs/vendure-packagesize-plugin.types.d.ts +27 -0
- package/lib/configs/vendure-product-popularity-plugin.augmentation.d.ts +12 -0
- package/lib/configs/vendure-product-popularity-plugin.d.ts +32 -0
- package/lib/configs/vendure-product-popularity-plugin.types.d.ts +3 -0
- package/lib/exports/augmentations.d.ts +4 -0
- package/lib/exports/badge.d.ts +1 -0
- package/lib/exports/campaign.d.ts +1 -0
- package/lib/exports/packagesize.d.ts +1 -0
- package/lib/exports/product-popularity.d.ts +1 -0
- package/lib/plugin-config.d.ts +63 -0
- package/lib/types.d.ts +2 -0
- package/package.json +42 -0
- package/packagesize.js +1 -0
- package/packagesize.mjs +61 -0
- package/product-popularity.js +1 -0
- package/product-popularity.mjs +24 -0
package/README.md
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# Vendure Plugin Configs
|
|
2
|
+
|
|
3
|
+
This package provides a framework for creating and sharing plugin configurations for Vendure-based storefronts. Plugin configs allow you to extend the Vendure SDK with new features, queries, and type-safe entity augmentations—**only when you import the plugin**.
|
|
4
|
+
|
|
5
|
+
## What is a Plugin Config?
|
|
6
|
+
|
|
7
|
+
A plugin config is a TypeScript class that encapsulates:
|
|
8
|
+
|
|
9
|
+
- Feature functions (e.g. `showBadges`)
|
|
10
|
+
- Query/request extensions
|
|
11
|
+
- Optional type augmentation for Vendure entities (e.g. adding `badges` to `Product`)
|
|
12
|
+
|
|
13
|
+
## How to Create a Plugin Config
|
|
14
|
+
|
|
15
|
+
1. **Create a new file** in `libs/plugin-configs/vendure/src/lib/`, e.g. `my-plugin.ts`.
|
|
16
|
+
2. **Export a class or constant** that extends the base `VendurePluginConfig`.
|
|
17
|
+
3. **(Optional) Add type augmentation** for Vendure entities by placing a `declare module` block in the same file.
|
|
18
|
+
|
|
19
|
+
### Example: Badge Plugin
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import {
|
|
23
|
+
Asset,
|
|
24
|
+
Collection,
|
|
25
|
+
ErrorResult,
|
|
26
|
+
Maybe,
|
|
27
|
+
PaginatedList,
|
|
28
|
+
Product,
|
|
29
|
+
ProductVariant,
|
|
30
|
+
SearchResult,
|
|
31
|
+
} from '@haus-storefront-react/shared-types'
|
|
32
|
+
import VendurePluginConfig from './plugin-config'
|
|
33
|
+
import { filter } from 'lodash'
|
|
34
|
+
|
|
35
|
+
// Type augmentation: Only active if this plugin is imported!
|
|
36
|
+
declare module '@haus-storefront-react/shared-types' {
|
|
37
|
+
interface Product {
|
|
38
|
+
badges?: Maybe<Array<Badge>>
|
|
39
|
+
}
|
|
40
|
+
interface SearchResult {
|
|
41
|
+
badges?: Maybe<Array<Badge>>
|
|
42
|
+
}
|
|
43
|
+
interface ProductVariant {
|
|
44
|
+
badges?: Maybe<Array<Badge>>
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface BadgePluginRequests {
|
|
49
|
+
getBadges: () => Promise<PaginatedList<Badge> | ErrorResult>
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export type BadgeFeatures = {
|
|
53
|
+
showBadges: (props: {
|
|
54
|
+
product?: Product | SearchResult
|
|
55
|
+
variant?: ProductVariant
|
|
56
|
+
parentComponent?: string
|
|
57
|
+
badges: Maybe<Badge[]>
|
|
58
|
+
}) => { badges: Badge[]; availablePositions?: string[] }
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export type Badge = {
|
|
62
|
+
id: string
|
|
63
|
+
createdAt: string
|
|
64
|
+
updatedAt: string
|
|
65
|
+
collection: Collection
|
|
66
|
+
collectionId: string
|
|
67
|
+
position: string
|
|
68
|
+
asset: Asset
|
|
69
|
+
assetId: string
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export const VendureBadgePlugin = new VendurePluginConfig<BadgeFeatures, BadgePluginRequests>({
|
|
73
|
+
name: 'badges',
|
|
74
|
+
enableFeatures: {
|
|
75
|
+
showBadges: ({ badges = [], parentComponent }) => {
|
|
76
|
+
// ...implementation
|
|
77
|
+
return { badges: [], availablePositions: [] }
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
queryUpdates: {},
|
|
81
|
+
settings: {},
|
|
82
|
+
})
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## How to Use a Plugin Config in Your App
|
|
86
|
+
|
|
87
|
+
1. **Import the plugin in your app:**
|
|
88
|
+
```ts
|
|
89
|
+
import { VendureBadgePlugin } from '@haus-storefront-react/vendure-plugin-configs'
|
|
90
|
+
```
|
|
91
|
+
2. **Add it to your DataProvider/pluginConfigs:**
|
|
92
|
+
```tsx
|
|
93
|
+
<DataProvider
|
|
94
|
+
provider="vendure"
|
|
95
|
+
options={{
|
|
96
|
+
// ...
|
|
97
|
+
pluginConfigs: [VendureBadgePlugin.init({ enableFeatures: ['showBadges'] })],
|
|
98
|
+
}}
|
|
99
|
+
>
|
|
100
|
+
{/* ... */}
|
|
101
|
+
</DataProvider>
|
|
102
|
+
```
|
|
103
|
+
3. **TypeScript will now know about `product.badges`!**
|
|
104
|
+
|
|
105
|
+
### Example: Type-Safe Usage in a Component
|
|
106
|
+
|
|
107
|
+
```tsx
|
|
108
|
+
import { Product } from '@haus-storefront-react/shared-types'
|
|
109
|
+
|
|
110
|
+
function ProductBadges({ product }: { product: Product }) {
|
|
111
|
+
if (!product.badges?.length) return null
|
|
112
|
+
return (
|
|
113
|
+
<div>
|
|
114
|
+
{product.badges.map((badge) => (
|
|
115
|
+
<span key={badge.id}>{badge.position}</span>
|
|
116
|
+
))}
|
|
117
|
+
</div>
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**Note:** The type augmentation is _opt-in_: Only projects that import the plugin will see the new fields on `Product`, `SearchResult`, etc.
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Creating a Plugin Config in an External App
|
|
127
|
+
|
|
128
|
+
You can also create your own plugin config in an external app (outside this package). This is useful for app-specific features or experiments. See the example below, inspired by `test-plugin.ts`:
|
|
129
|
+
|
|
130
|
+
### 1. Create your plugin config (e.g. `test-plugin.ts`):
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
import { VendurePluginConfig, PluginFeatures } from '@haus-storefront-react/vendure-plugin-configs'
|
|
134
|
+
|
|
135
|
+
// Type augmentation: Adds testFeature to PluginFeatureMappings if this plugin is imported
|
|
136
|
+
|
|
137
|
+
declare module '@haus-storefront-react/vendure-plugin-configs' {
|
|
138
|
+
interface PluginFeatureMappings {
|
|
139
|
+
testFeature: (props: { value: string }) => string
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export const TestPlugin = new VendurePluginConfig<PluginFeatures>({
|
|
144
|
+
name: 'test',
|
|
145
|
+
enableFeatures: {
|
|
146
|
+
testFeature: ({ value }: { value: string }) => `Test feature says: ${value}`,
|
|
147
|
+
},
|
|
148
|
+
queryUpdates: {},
|
|
149
|
+
settings: {},
|
|
150
|
+
})
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### 2. Use your plugin config in your app:
|
|
154
|
+
|
|
155
|
+
```tsx
|
|
156
|
+
import { TestPlugin } from './plugin-configs/test-plugin'
|
|
157
|
+
;<DataProvider
|
|
158
|
+
provider="vendure"
|
|
159
|
+
options={{
|
|
160
|
+
// ...
|
|
161
|
+
pluginConfigs: [TestPlugin.init({ enableFeatures: ['testFeature'] })],
|
|
162
|
+
}}
|
|
163
|
+
>
|
|
164
|
+
{/* ... */}
|
|
165
|
+
</DataProvider>
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
- The `declare module` block ensures TypeScript is aware of your new feature when the plugin is imported.
|
|
169
|
+
- You can add any features, queries, or type augmentations you need for your app.
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Nx Commands
|
|
174
|
+
|
|
175
|
+
- **Build:** `nx build plugin-configs/vendure`
|
|
176
|
+
- **Test:** `nx test plugin-configs/vendure`
|
package/badge.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-CzxpJe9c.js"),t=new o.VendurePluginConfig({name:"badges",enableFeatures:{showBadges:({badges:e=[],parentComponent:i})=>{const s=i?t.getSettings().availablePositions[i]:t.getSettings().defaultPositions;return{badges:o.lodashExports.filter(e,a=>s?s.includes(a.position):!0),availablePositions:s}}},queryUpdates:{},settings:{defaultPositions:["top-left","top-right","bottom-left","bottom-right"],availablePositions:{productListItem:["top-left","top-right","bottom-left","bottom-right"],productDetail:["top-left","top-right","bottom-left","bottom-right"],imageCarousel:["top-left","top-right","bottom-left","bottom-right"]}}});t.setQueryUpdates({product:{fields:[{badges:["id","position","assetId",{asset:["id","name","preview","source"]},{collection:["id","name"]}]}]},search:{fields:[{items:[{badges:["id","position","assetId",{asset:["id","name","preview","source"]},{collection:["id","name"]}]}]}]},products:{fields:[{items:[{badges:["id","position","assetId",{asset:["id","name","preview","source"]},{collection:["id","name"]}]}]}]},briefProducts:{fields:[{items:[{badges:["id","position","assetId",{asset:["id","name","preview","source"]},{collection:["id","name"]}]}]}]}});t.setRequests({getBadges:async()=>t.getSdk().createRequest({operation:"badges",fields:["totalItems",{items:["id","createdAt","updatedAt","collectionId","position","assetId",{asset:["id","name","preview","source"]},{collection:["id","name"]}]}]},{options:{take:100}},!1).then(e=>e.data).catch(e=>({message:e.message,errorCode:e.code||"unknown"}))});exports.VendureBadgePlugin=t;
|
package/badge.mjs
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { V as a, l as d } from "./index-RBMJ45wv.mjs";
|
|
2
|
+
const t = new a({
|
|
3
|
+
name: "badges",
|
|
4
|
+
enableFeatures: {
|
|
5
|
+
showBadges: ({
|
|
6
|
+
badges: e = [],
|
|
7
|
+
parentComponent: i
|
|
8
|
+
}) => {
|
|
9
|
+
const s = i ? t.getSettings().availablePositions[i] : t.getSettings().defaultPositions;
|
|
10
|
+
return {
|
|
11
|
+
badges: d.filter(e, (o) => s ? s.includes(o.position) : !0),
|
|
12
|
+
availablePositions: s
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
queryUpdates: {},
|
|
17
|
+
settings: {
|
|
18
|
+
defaultPositions: ["top-left", "top-right", "bottom-left", "bottom-right"],
|
|
19
|
+
availablePositions: {
|
|
20
|
+
productListItem: ["top-left", "top-right", "bottom-left", "bottom-right"],
|
|
21
|
+
productDetail: ["top-left", "top-right", "bottom-left", "bottom-right"],
|
|
22
|
+
imageCarousel: ["top-left", "top-right", "bottom-left", "bottom-right"]
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
t.setQueryUpdates({
|
|
27
|
+
product: {
|
|
28
|
+
fields: [{
|
|
29
|
+
badges: ["id", "position", "assetId", {
|
|
30
|
+
asset: ["id", "name", "preview", "source"]
|
|
31
|
+
}, {
|
|
32
|
+
collection: ["id", "name"]
|
|
33
|
+
}]
|
|
34
|
+
}]
|
|
35
|
+
},
|
|
36
|
+
search: {
|
|
37
|
+
fields: [{
|
|
38
|
+
items: [{
|
|
39
|
+
badges: ["id", "position", "assetId", {
|
|
40
|
+
asset: ["id", "name", "preview", "source"]
|
|
41
|
+
}, {
|
|
42
|
+
collection: ["id", "name"]
|
|
43
|
+
}]
|
|
44
|
+
}]
|
|
45
|
+
}]
|
|
46
|
+
},
|
|
47
|
+
products: {
|
|
48
|
+
fields: [{
|
|
49
|
+
items: [{
|
|
50
|
+
badges: ["id", "position", "assetId", {
|
|
51
|
+
asset: ["id", "name", "preview", "source"]
|
|
52
|
+
}, {
|
|
53
|
+
collection: ["id", "name"]
|
|
54
|
+
}]
|
|
55
|
+
}]
|
|
56
|
+
}]
|
|
57
|
+
},
|
|
58
|
+
briefProducts: {
|
|
59
|
+
fields: [{
|
|
60
|
+
items: [{
|
|
61
|
+
badges: ["id", "position", "assetId", {
|
|
62
|
+
asset: ["id", "name", "preview", "source"]
|
|
63
|
+
}, {
|
|
64
|
+
collection: ["id", "name"]
|
|
65
|
+
}]
|
|
66
|
+
}]
|
|
67
|
+
}]
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
t.setRequests({
|
|
71
|
+
getBadges: async () => t.getSdk().createRequest({
|
|
72
|
+
operation: "badges",
|
|
73
|
+
fields: ["totalItems", {
|
|
74
|
+
items: ["id", "createdAt", "updatedAt", "collectionId", "position", "assetId", {
|
|
75
|
+
asset: ["id", "name", "preview", "source"]
|
|
76
|
+
}, {
|
|
77
|
+
collection: ["id", "name"]
|
|
78
|
+
}]
|
|
79
|
+
}]
|
|
80
|
+
}, {
|
|
81
|
+
options: {
|
|
82
|
+
take: 100
|
|
83
|
+
}
|
|
84
|
+
}, !1).then((e) => e.data).catch((e) => ({
|
|
85
|
+
message: e.message,
|
|
86
|
+
errorCode: e.code || "unknown"
|
|
87
|
+
}))
|
|
88
|
+
});
|
|
89
|
+
export {
|
|
90
|
+
t as VendureBadgePlugin
|
|
91
|
+
};
|
package/campaign.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ce=require("./index-CzxpJe9c.js"),g=require("react"),le=require("react-native");var b={exports:{}},v={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var L;function fe(){if(L)return v;L=1;var t=Symbol.for("react.transitional.element"),a=Symbol.for("react.fragment");function n(i,u,l){var R=null;if(l!==void 0&&(R=""+l),u.key!==void 0&&(R=""+u.key),"key"in u){l={};for(var p in u)p!=="key"&&(l[p]=u[p])}else l=u;return u=l.ref,{$$typeof:t,type:i,key:R,ref:u!==void 0?u:null,props:l}}return v.Fragment=a,v.jsx=n,v.jsxs=n,v}var _={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.development.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var $;function de(){return $||($=1,process.env.NODE_ENV!=="production"&&function(){function t(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ie?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case h:return"Fragment";case Z:return"Profiler";case Q:return"StrictMode";case te:return"Suspense";case ne:return"SuspenseList";case oe:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case B:return"Portal";case ee:return(e.displayName||"Context")+".Provider";case K:return(e._context.displayName||"Context")+".Consumer";case re:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ae:return r=e.displayName||null,r!==null?r:t(e.type)||"Memo";case I:r=e._payload,e=e._init;try{return t(e(r))}catch{}}return null}function a(e){return""+e}function n(e){try{a(e);var r=!1}catch{r=!0}if(r){r=console;var o=r.error,s=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return o.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",s),a(e)}}function i(e){if(e===h)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===I)return"<...>";try{var r=t(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function u(){var e=O.A;return e===null?null:e.getOwner()}function l(){return Error("react-stack-top-frame")}function R(e){if(Y.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function p(e,r){function o(){D||(D=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}o.isReactWarning=!0,Object.defineProperty(e,"key",{get:o,configurable:!0})}function z(){var e=t(this.type);return q[e]||(q[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function X(e,r,o,s,d,f,S,k){return o=f.ref,e={$$typeof:j,type:e,key:r,props:f,_owner:d},(o!==void 0?o:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:z}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:S}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:k}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function C(e,r,o,s,d,f,S,k){var c=r.children;if(c!==void 0)if(s)if(ue(c)){for(s=0;s<c.length;s++)w(c[s]);Object.freeze&&Object.freeze(c)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else w(c);if(Y.call(r,"key")){c=t(e);var m=Object.keys(r).filter(function(se){return se!=="key"});s=0<m.length?"{key: someKey, "+m.join(": ..., ")+": ...}":"{key: someKey}",M[c+s]||(m=0<m.length?"{"+m.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
|
+
let props = %s;
|
|
19
|
+
<%s {...props} />
|
|
20
|
+
React keys must be passed directly to JSX without using spread:
|
|
21
|
+
let props = %s;
|
|
22
|
+
<%s key={someKey} {...props} />`,s,c,m,c),M[c+s]=!0)}if(c=null,o!==void 0&&(n(o),c=""+o),R(r)&&(n(r.key),c=""+r.key),"key"in r){o={};for(var N in r)N!=="key"&&(o[N]=r[N])}else o=r;return c&&p(o,typeof e=="function"?e.displayName||e.name||"Unknown":e),X(e,c,f,d,u(),o,S,k)}function w(e){typeof e=="object"&&e!==null&&e.$$typeof===j&&e._store&&(e._store.validated=1)}var E=g,j=Symbol.for("react.transitional.element"),B=Symbol.for("react.portal"),h=Symbol.for("react.fragment"),Q=Symbol.for("react.strict_mode"),Z=Symbol.for("react.profiler"),K=Symbol.for("react.consumer"),ee=Symbol.for("react.context"),re=Symbol.for("react.forward_ref"),te=Symbol.for("react.suspense"),ne=Symbol.for("react.suspense_list"),ae=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),oe=Symbol.for("react.activity"),ie=Symbol.for("react.client.reference"),O=E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=Object.prototype.hasOwnProperty,ue=Array.isArray,y=console.createTask?console.createTask:function(){return null};E={"react-stack-bottom-frame":function(e){return e()}};var D,q={},U=E["react-stack-bottom-frame"].bind(E,l)(),F=y(i(l)),M={};_.Fragment=h,_.jsx=function(e,r,o,s,d){var f=1e4>O.recentlyCreatedOwnerStacks++;return C(e,r,o,!1,s,d,f?Error("react-stack-top-frame"):U,f?y(i(e)):F)},_.jsxs=function(e,r,o,s,d){var f=1e4>O.recentlyCreatedOwnerStacks++;return C(e,r,o,!0,s,d,f?Error("react-stack-top-frame"):U,f?y(i(e)):F)}}()),_}var W;function me(){return W||(W=1,process.env.NODE_ENV==="production"?b.exports=fe():b.exports=de()),b.exports}var Re=me(),P={exports:{}},x={};/**
|
|
23
|
+
* @license React
|
|
24
|
+
* react-compiler-runtime.production.js
|
|
25
|
+
*
|
|
26
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
27
|
+
*
|
|
28
|
+
* This source code is licensed under the MIT license found in the
|
|
29
|
+
* LICENSE file in the root directory of this source tree.
|
|
30
|
+
*/var V;function pe(){if(V)return x;V=1;var t=g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;return x.c=function(a){return t.H.useMemoCache(a)},x}var A={};/**
|
|
31
|
+
* @license React
|
|
32
|
+
* react-compiler-runtime.development.js
|
|
33
|
+
*
|
|
34
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
35
|
+
*
|
|
36
|
+
* This source code is licensed under the MIT license found in the
|
|
37
|
+
* LICENSE file in the root directory of this source tree.
|
|
38
|
+
*/var G;function ve(){return G||(G=1,process.env.NODE_ENV!=="production"&&function(){var t=g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;A.c=function(a){var n=t.H;return n===null&&console.error(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
|
|
39
|
+
1. You might have mismatching versions of React and the renderer (such as React DOM)
|
|
40
|
+
2. You might be breaking the Rules of Hooks
|
|
41
|
+
3. You might have more than one copy of React in the same app
|
|
42
|
+
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),n.useMemoCache(a)}}()),A}var H;function _e(){return H||(H=1,process.env.NODE_ENV==="production"?P.exports=pe():P.exports=ve()),P.exports}var Ee=_e();function be(t){const{src:a,alt:n,...i}=t;return a?{...i,source:{uri:a}}:i}const Pe=g.forwardRef((t,a)=>{const n=Ee.c(5);if(!t.src)return null;let i;n[0]!==t?(i=be(t),n[0]=t,n[1]=i):i=n[1];let u;return n[2]!==a||n[3]!==i?(u=Re.jsx(le.Image,{ref:a,...i}),n[2]=a,n[3]=i,n[4]=u):u=n[4],u});Pe.displayName="PlatformPrimitiveImage";const T=t=>t==null?0:typeof t=="number"?t:"value"in t?t.value:"min"in t?t.min:0,Te=t=>{const a=t.map(u=>T(u.price)),n=Math.min(...a),i=Math.max(...a);return n===void 0||i===void 0?{value:0}:n===i?{value:n}:{min:n,max:i}},J=new ce.VendurePluginConfig({name:"campaign",enableFeatures:{ordinaryPrice:({variant:t,orderLine:a,searchResult:n,product:i})=>{if(a){const u=a.productVariant;return u?.ordinaryPrice?T(u?.ordinaryPrice)*a.quantity:a.discountedLinePriceWithTax}return t?T(t.ordinaryPrice||0):n?T(n.ordinaryPrice||0):i?Te(i.variants):0}},queryUpdates:{}});J.setQueryUpdates({search:{fields:[{items:[{ordinaryPrice:[{operation:"PriceRange",fields:["min, max"],fragment:!0},{operation:"SinglePrice",fields:["value"],fragment:!0}]}]}]},product:{fields:[{ordinaryPrice:[{operation:"PriceRange",fields:["min, max"],fragment:!0},{operation:"SinglePrice",fields:["value"],fragment:!0}]},{variants:["ordinaryPrice"]}]},briefProducts:{fields:[{items:[{ordinaryPrice:[{operation:"PriceRange",fields:["min, max"],fragment:!0},{operation:"SinglePrice",fields:["value"],fragment:!0}]},{variants:["ordinaryPrice"]}]}]},activeOrder:{fields:[{lines:[{productVariant:["ordinaryPrice"]}]}]},orderByCode:{fields:[{lines:[{productVariant:["ordinaryPrice"]}]}]},adjustOrderLine:{fields:[{fields:[{lines:[{productVariant:["ordinaryPrice"]}]}]}]},addItemToOrder:{fields:[{fields:[{lines:[{productVariant:["ordinaryPrice"]}]}]}]}});exports.VendureCampaignPlugin=J;
|