@depict-ai/portal-components 2.7.15 → 2.7.17
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/index.d.ts +1 -1
- package/dist/main.js +31 -30
- package/dist/module.js +32 -31
- package/package.json +2 -2
- package/src/specialForShopify/DefaultSolidProductCard.tsx +26 -26
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { SearchFilter } from "@depict-ai/types/api/SearchResponse";
|
|
|
3
3
|
import { Locale } from "@depict-ai/react-ui/locales/latest";
|
|
4
4
|
import { ReactNode } from "react";
|
|
5
5
|
import { FeaturedInDisplay } from "@depict-ai/types/api/FeaturedInResponseV3";
|
|
6
|
-
export const version = "2.7.
|
|
6
|
+
export const version = "2.7.17";
|
|
7
7
|
type TextOptions = {
|
|
8
8
|
/** Enabled */
|
|
9
9
|
enabled: boolean;
|
package/dist/main.js
CHANGED
|
@@ -18,7 +18,7 @@ $parcel$export(module.exports, "ExpandingSection", () => $2214dc111b9e2866$expor
|
|
|
18
18
|
$parcel$export(module.exports, "ReactLookCard", () => $35bab9ff48bfe404$export$48787da2a5568bc);
|
|
19
19
|
$parcel$export(module.exports, "version", () => $0a017be3a74fcc94$export$83d89fbfd8236492);
|
|
20
20
|
/*! Depict.ai portal components */ // This is where the actual source of your React stuff should live
|
|
21
|
-
const $0a017be3a74fcc94$export$83d89fbfd8236492 = "2.7.
|
|
21
|
+
const $0a017be3a74fcc94$export$83d89fbfd8236492 = "2.7.17";
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
@@ -91,7 +91,7 @@ const $3375ddd88f77967d$var$sizeOrder = [
|
|
|
91
91
|
];
|
|
92
92
|
const $3375ddd88f77967d$var$ContainsColorSwatchesContext = /*@__PURE__*/ (0, $7jsgb$solidjs.createContext)();
|
|
93
93
|
let $3375ddd88f77967d$var$colorCanvasContext;
|
|
94
|
-
function $3375ddd88f77967d$export$f11681c54c860912(display, info, configuredOptions_) {
|
|
94
|
+
function $3375ddd88f77967d$export$f11681c54c860912(display, info, configuredOptions_, overrideAspectRatio) {
|
|
95
95
|
const variantDisplays = (0, $7jsgb$solidjs.createMemo)(()=>display()?.variant_displays);
|
|
96
96
|
const defaultVariantIndex = (0, $7jsgb$solidjs.createMemo)(()=>display()?.variant_index);
|
|
97
97
|
const [showVariantIndex, setShowVariantIndex] = (0, $7jsgb$solidjs.createSignal)((0, $7jsgb$solidjs.untrack)(defaultVariantIndex));
|
|
@@ -105,7 +105,8 @@ function $3375ddd88f77967d$export$f11681c54c860912(display, info, configuredOpti
|
|
|
105
105
|
return originalPrice() !== salePrice();
|
|
106
106
|
}
|
|
107
107
|
}));
|
|
108
|
-
const aspectRatio_ = (0, $7jsgb$solidjs.createMemo)(()=>configuredOptions_().image_aspect_ratio);
|
|
108
|
+
const aspectRatio_ = (0, $7jsgb$solidjs.createMemo)(()=>overrideAspectRatio?.() || configuredOptions_().image_aspect_ratio);
|
|
109
|
+
const hasSizes = ()=>configuredOptions_().sizes && sizesInStock_().size > 1;
|
|
109
110
|
const sizesInStock_ = (0, $7jsgb$solidjs.createMemo)(()=>new Map(variantDisplays()?.map((d)=>[
|
|
110
111
|
d.size_name,
|
|
111
112
|
d.in_stock
|
|
@@ -211,32 +212,32 @@ function $3375ddd88f77967d$export$f11681c54c860912(display, info, configuredOpti
|
|
|
211
212
|
});
|
|
212
213
|
}
|
|
213
214
|
}), null);
|
|
214
|
-
(0, $7jsgb$solidjsweb.insert)(_el$3, (
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
return (()
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
return (
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
get fallback () {
|
|
229
|
-
return resolved();
|
|
230
|
-
},
|
|
215
|
+
(0, $7jsgb$solidjsweb.insert)(_el$3, ()=>{
|
|
216
|
+
// We want the whole product card to be a link, except for the color swatches
|
|
217
|
+
const [containsColorSwatches] = $3375ddd88f77967d$var$useContainsColorSwatches();
|
|
218
|
+
const LinkWrappedIfHaveSwatches = (props)=>{
|
|
219
|
+
const resolved = (0, $7jsgb$solidjs.children)(()=>props.children);
|
|
220
|
+
return (0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$solidjs.Show), {
|
|
221
|
+
get when () {
|
|
222
|
+
return containsColorSwatches();
|
|
223
|
+
},
|
|
224
|
+
get fallback () {
|
|
225
|
+
return resolved();
|
|
226
|
+
},
|
|
227
|
+
get children () {
|
|
228
|
+
return (0, $7jsgb$solidjsweb.createComponent)(LinkWrapped, {
|
|
231
229
|
get children () {
|
|
232
|
-
return (
|
|
233
|
-
get children () {
|
|
234
|
-
return resolved();
|
|
235
|
-
}
|
|
236
|
-
});
|
|
230
|
+
return resolved();
|
|
237
231
|
}
|
|
238
232
|
});
|
|
239
|
-
}
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
};
|
|
236
|
+
return (0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$solidjs.Show), {
|
|
237
|
+
get when () {
|
|
238
|
+
return titleOptions().enabled || configuredOptions_().price.enabled || hasSizes() || containsColorSwatches();
|
|
239
|
+
},
|
|
240
|
+
get children () {
|
|
240
241
|
return (0, $7jsgb$solidjsweb.createComponent)($3375ddd88f77967d$var$InComponentOrDiv, {
|
|
241
242
|
get component_ () {
|
|
242
243
|
return !containsColorSwatches() && LinkWrapped;
|
|
@@ -268,7 +269,7 @@ function $3375ddd88f77967d$export$f11681c54c860912(display, info, configuredOpti
|
|
|
268
269
|
get children () {
|
|
269
270
|
return (0, $7jsgb$solidjsweb.createComponent)((0, $7jsgb$solidjs.Show), {
|
|
270
271
|
get when () {
|
|
271
|
-
return (
|
|
272
|
+
return hasSizes();
|
|
272
273
|
},
|
|
273
274
|
get fallback () {
|
|
274
275
|
return (0, $7jsgb$solidjsweb.createComponent)(LinkWrappedIfHaveSwatches, {
|
|
@@ -355,9 +356,9 @@ function $3375ddd88f77967d$export$f11681c54c860912(display, info, configuredOpti
|
|
|
355
356
|
];
|
|
356
357
|
}
|
|
357
358
|
});
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
}
|
|
359
|
+
}
|
|
360
|
+
});
|
|
361
|
+
}, null);
|
|
361
362
|
(0, $7jsgb$solidjsweb.effect)((_$p)=>(0, $7jsgb$solidjsweb.style)(_el$3, mainStyle(), _$p));
|
|
362
363
|
return _el$3;
|
|
363
364
|
}
|
package/dist/module.js
CHANGED
|
@@ -3,11 +3,11 @@ import {render as $2MCgq$render, template as $2MCgq$template, createComponent as
|
|
|
3
3
|
import {useRef as $2MCgq$useRef, useState as $2MCgq$useState, useEffect as $2MCgq$useEffect, createElement as $2MCgq$createElement, Fragment as $2MCgq$Fragment} from "react";
|
|
4
4
|
import {createStore as $2MCgq$createStore, reconcile as $2MCgq$reconcile} from "solid-js/store";
|
|
5
5
|
import {media_query_to_accessor as $2MCgq$media_query_to_accessor, TextPlaceholder as $2MCgq$TextPlaceholder, useSlidableInformation as $2MCgq$useSlidableInformation, SlidableItems as $2MCgq$SlidableItems, ImagePlaceholder as $2MCgq$ImagePlaceholder, ImageContainer as $2MCgq$ImageContainer, ShopifyContainedImage as $2MCgq$ShopifyContainedImage, useVisibilityState as $2MCgq$useVisibilityState, useProductCardIndex as $2MCgq$useProductCardIndex, useProductCardIsVisible as $2MCgq$useProductCardIsVisible, accessor_of_object_to_object_with_accessor_values as $2MCgq$accessor_of_object_to_object_with_accessor_values, create_modified_filters as $2MCgq$create_modified_filters, SelectedFilters as $2MCgq$SelectedFilters, FilterBody as $2MCgq$FilterBody, ExpandingDetails as $2MCgq$ExpandingDetails, ListingProvider as $2MCgq$ListingProvider, PseudoRouter as $2MCgq$PseudoRouter, LookCard as $2MCgq$LookCard} from "@depict-ai/ui/latest";
|
|
6
|
-
import {createContext as $2MCgq$createContext, createMemo as $2MCgq$createMemo, createSignal as $2MCgq$createSignal, untrack as $2MCgq$untrack, createResource as $2MCgq$createResource, Suspense as $2MCgq$Suspense, createEffect as $2MCgq$createEffect,
|
|
6
|
+
import {createContext as $2MCgq$createContext, createMemo as $2MCgq$createMemo, createSignal as $2MCgq$createSignal, untrack as $2MCgq$untrack, createResource as $2MCgq$createResource, Suspense as $2MCgq$Suspense, createEffect as $2MCgq$createEffect, children as $2MCgq$children, Show as $2MCgq$Show, onCleanup as $2MCgq$onCleanup, For as $2MCgq$For, createRenderEffect as $2MCgq$createRenderEffect, on as $2MCgq$on, useContext as $2MCgq$useContext} from "solid-js";
|
|
7
7
|
import {createPortal as $2MCgq$createPortal} from "react-dom";
|
|
8
8
|
|
|
9
9
|
/*! Depict.ai portal components */ // This is where the actual source of your React stuff should live
|
|
10
|
-
const $91c11b750e80ede3$export$83d89fbfd8236492 = "2.7.
|
|
10
|
+
const $91c11b750e80ede3$export$83d89fbfd8236492 = "2.7.17";
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
@@ -80,7 +80,7 @@ const $29535f590238371c$var$sizeOrder = [
|
|
|
80
80
|
];
|
|
81
81
|
const $29535f590238371c$var$ContainsColorSwatchesContext = /*@__PURE__*/ (0, $2MCgq$createContext)();
|
|
82
82
|
let $29535f590238371c$var$colorCanvasContext;
|
|
83
|
-
function $29535f590238371c$export$f11681c54c860912(display, info, configuredOptions_) {
|
|
83
|
+
function $29535f590238371c$export$f11681c54c860912(display, info, configuredOptions_, overrideAspectRatio) {
|
|
84
84
|
const variantDisplays = (0, $2MCgq$createMemo)(()=>display()?.variant_displays);
|
|
85
85
|
const defaultVariantIndex = (0, $2MCgq$createMemo)(()=>display()?.variant_index);
|
|
86
86
|
const [showVariantIndex, setShowVariantIndex] = (0, $2MCgq$createSignal)((0, $2MCgq$untrack)(defaultVariantIndex));
|
|
@@ -94,7 +94,8 @@ function $29535f590238371c$export$f11681c54c860912(display, info, configuredOpti
|
|
|
94
94
|
return originalPrice() !== salePrice();
|
|
95
95
|
}
|
|
96
96
|
}));
|
|
97
|
-
const aspectRatio_ = (0, $2MCgq$createMemo)(()=>configuredOptions_().image_aspect_ratio);
|
|
97
|
+
const aspectRatio_ = (0, $2MCgq$createMemo)(()=>overrideAspectRatio?.() || configuredOptions_().image_aspect_ratio);
|
|
98
|
+
const hasSizes = ()=>configuredOptions_().sizes && sizesInStock_().size > 1;
|
|
98
99
|
const sizesInStock_ = (0, $2MCgq$createMemo)(()=>new Map(variantDisplays()?.map((d)=>[
|
|
99
100
|
d.size_name,
|
|
100
101
|
d.in_stock
|
|
@@ -200,32 +201,32 @@ function $29535f590238371c$export$f11681c54c860912(display, info, configuredOpti
|
|
|
200
201
|
});
|
|
201
202
|
}
|
|
202
203
|
}), null);
|
|
203
|
-
(0, $2MCgq$insert)(_el$3, (
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
return (()
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
return (
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
get fallback () {
|
|
218
|
-
return resolved();
|
|
219
|
-
},
|
|
204
|
+
(0, $2MCgq$insert)(_el$3, ()=>{
|
|
205
|
+
// We want the whole product card to be a link, except for the color swatches
|
|
206
|
+
const [containsColorSwatches] = $29535f590238371c$var$useContainsColorSwatches();
|
|
207
|
+
const LinkWrappedIfHaveSwatches = (props)=>{
|
|
208
|
+
const resolved = (0, $2MCgq$children)(()=>props.children);
|
|
209
|
+
return (0, $2MCgq$createComponent)((0, $2MCgq$Show), {
|
|
210
|
+
get when () {
|
|
211
|
+
return containsColorSwatches();
|
|
212
|
+
},
|
|
213
|
+
get fallback () {
|
|
214
|
+
return resolved();
|
|
215
|
+
},
|
|
216
|
+
get children () {
|
|
217
|
+
return (0, $2MCgq$createComponent)(LinkWrapped, {
|
|
220
218
|
get children () {
|
|
221
|
-
return (
|
|
222
|
-
get children () {
|
|
223
|
-
return resolved();
|
|
224
|
-
}
|
|
225
|
-
});
|
|
219
|
+
return resolved();
|
|
226
220
|
}
|
|
227
221
|
});
|
|
228
|
-
}
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
};
|
|
225
|
+
return (0, $2MCgq$createComponent)((0, $2MCgq$Show), {
|
|
226
|
+
get when () {
|
|
227
|
+
return titleOptions().enabled || configuredOptions_().price.enabled || hasSizes() || containsColorSwatches();
|
|
228
|
+
},
|
|
229
|
+
get children () {
|
|
229
230
|
return (0, $2MCgq$createComponent)($29535f590238371c$var$InComponentOrDiv, {
|
|
230
231
|
get component_ () {
|
|
231
232
|
return !containsColorSwatches() && LinkWrapped;
|
|
@@ -257,7 +258,7 @@ function $29535f590238371c$export$f11681c54c860912(display, info, configuredOpti
|
|
|
257
258
|
get children () {
|
|
258
259
|
return (0, $2MCgq$createComponent)((0, $2MCgq$Show), {
|
|
259
260
|
get when () {
|
|
260
|
-
return (
|
|
261
|
+
return hasSizes();
|
|
261
262
|
},
|
|
262
263
|
get fallback () {
|
|
263
264
|
return (0, $2MCgq$createComponent)(LinkWrappedIfHaveSwatches, {
|
|
@@ -344,9 +345,9 @@ function $29535f590238371c$export$f11681c54c860912(display, info, configuredOpti
|
|
|
344
345
|
];
|
|
345
346
|
}
|
|
346
347
|
});
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
}
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
}, null);
|
|
350
351
|
(0, $2MCgq$effect)((_$p)=>(0, $2MCgq$style)(_el$3, mainStyle(), _$p));
|
|
351
352
|
return _el$3;
|
|
352
353
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depict-ai/portal-components",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.17",
|
|
4
4
|
"packageManager": "yarn@3.2.2",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"dependencies": {
|
|
102
102
|
"@babel/runtime": "latest",
|
|
103
103
|
"@babel/runtime-corejs3": "^7.22.6",
|
|
104
|
-
"@depict-ai/plp-styling": "^4.4.
|
|
104
|
+
"@depict-ai/plp-styling": "^4.4.17",
|
|
105
105
|
"@depict-ai/react-ui": "^4.8.6",
|
|
106
106
|
"@depict-ai/types": "^5.4.4",
|
|
107
107
|
"@depict-ai/ui": "^4.8.16",
|
|
@@ -130,7 +130,8 @@ export function DefaultSolidProductCard(
|
|
|
130
130
|
// In development (product card editor), a fallback formatting will be used.
|
|
131
131
|
formatPrice: <T extends number | undefined>(price: T) => T extends undefined ? undefined : string;
|
|
132
132
|
}),
|
|
133
|
-
configuredOptions_: Accessor<ProductCardSchema
|
|
133
|
+
configuredOptions_: Accessor<ProductCardSchema>,
|
|
134
|
+
overrideAspectRatio?: Accessor<number>
|
|
134
135
|
) {
|
|
135
136
|
const variantDisplays = createMemo(() => display()?.variant_displays);
|
|
136
137
|
const defaultVariantIndex = createMemo(() => display()?.variant_index);
|
|
@@ -141,7 +142,8 @@ export function DefaultSolidProductCard(
|
|
|
141
142
|
const [salePrice] = createResource(variantToShow, v => v?.sale_price);
|
|
142
143
|
const [originalPrice] = createResource(variantToShow, v => v?.original_price);
|
|
143
144
|
const onSale = createMemo(() => <Suspense>{originalPrice() !== salePrice()}</Suspense>);
|
|
144
|
-
const aspectRatio_ = createMemo(() => configuredOptions_().image_aspect_ratio);
|
|
145
|
+
const aspectRatio_ = createMemo(() => overrideAspectRatio?.() || configuredOptions_().image_aspect_ratio);
|
|
146
|
+
const hasSizes = () => configuredOptions_().sizes && sizesInStock_().size > 1;
|
|
145
147
|
const sizesInStock_ = createMemo(
|
|
146
148
|
() =>
|
|
147
149
|
new Map(
|
|
@@ -262,27 +264,25 @@ export function DefaultSolidProductCard(
|
|
|
262
264
|
aspectRatio_={aspectRatio_}
|
|
263
265
|
/>
|
|
264
266
|
</LinkWrapped>
|
|
265
|
-
<Show
|
|
266
|
-
when={
|
|
267
|
-
titleOptions().enabled ||
|
|
268
|
-
configuredOptions_().price.enabled ||
|
|
269
|
-
configuredOptions_().sizes ||
|
|
270
|
-
configuredOptions_().color_options
|
|
271
|
-
}
|
|
272
|
-
>
|
|
273
|
-
{(() => {
|
|
274
|
-
// We want the whole product card to be a link, except for the color swatches
|
|
275
|
-
const [containsColorSwatches] = useContainsColorSwatches();
|
|
276
|
-
const LinkWrappedIfHaveSwatches = (props: { children: JSX.Element }) => {
|
|
277
|
-
const resolved = children(() => props.children);
|
|
278
|
-
return (
|
|
279
|
-
<Show when={containsColorSwatches()} fallback={resolved()}>
|
|
280
|
-
<LinkWrapped>{resolved()}</LinkWrapped>
|
|
281
|
-
</Show>
|
|
282
|
-
);
|
|
283
|
-
};
|
|
284
267
|
|
|
268
|
+
{(() => {
|
|
269
|
+
// We want the whole product card to be a link, except for the color swatches
|
|
270
|
+
const [containsColorSwatches] = useContainsColorSwatches();
|
|
271
|
+
const LinkWrappedIfHaveSwatches = (props: { children: JSX.Element }) => {
|
|
272
|
+
const resolved = children(() => props.children);
|
|
285
273
|
return (
|
|
274
|
+
<Show when={containsColorSwatches()} fallback={resolved()}>
|
|
275
|
+
<LinkWrapped>{resolved()}</LinkWrapped>
|
|
276
|
+
</Show>
|
|
277
|
+
);
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
return (
|
|
281
|
+
<Show
|
|
282
|
+
when={
|
|
283
|
+
titleOptions().enabled || configuredOptions_().price.enabled || hasSizes() || containsColorSwatches()
|
|
284
|
+
}
|
|
285
|
+
>
|
|
286
286
|
<InComponentOrDiv component_={!containsColorSwatches() && LinkWrapped} class_="text-container">
|
|
287
287
|
<Show
|
|
288
288
|
when={titleOptions().enabled}
|
|
@@ -295,7 +295,7 @@ export function DefaultSolidProductCard(
|
|
|
295
295
|
}
|
|
296
296
|
>
|
|
297
297
|
<Show
|
|
298
|
-
when={
|
|
298
|
+
when={hasSizes()}
|
|
299
299
|
fallback={
|
|
300
300
|
<LinkWrappedIfHaveSwatches>
|
|
301
301
|
<Title />
|
|
@@ -373,9 +373,9 @@ export function DefaultSolidProductCard(
|
|
|
373
373
|
</Show>
|
|
374
374
|
</Show>
|
|
375
375
|
</InComponentOrDiv>
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
376
|
+
</Show>
|
|
377
|
+
);
|
|
378
|
+
})()}
|
|
379
379
|
</div>
|
|
380
380
|
</ContainsColorSwatchesProvider>
|
|
381
381
|
);
|
|
@@ -620,7 +620,7 @@ function Sizes({
|
|
|
620
620
|
);
|
|
621
621
|
}
|
|
622
622
|
|
|
623
|
-
function setPropertyIfExists(style: CSSStyleDeclaration, property: string, value?: string | false | 0) {
|
|
623
|
+
function setPropertyIfExists(style: CSSStyleDeclaration, property: string, value?: string | false | 0 | null) {
|
|
624
624
|
if (value) {
|
|
625
625
|
style.setProperty(property, value);
|
|
626
626
|
} else {
|