@depict-ai/portal-components 2.7.14 → 2.7.16
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 +2 -2
- package/dist/main.js +29 -28
- package/dist/module.js +30 -29
- package/package.json +1 -1
- package/src/specialForShopify/DefaultSolidProductCard.tsx +24 -25
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.16";
|
|
7
7
|
type TextOptions = {
|
|
8
8
|
/** Enabled */
|
|
9
9
|
enabled: boolean;
|
|
@@ -16,7 +16,7 @@ type TextOptions = {
|
|
|
16
16
|
/** Color */
|
|
17
17
|
color: string;
|
|
18
18
|
/** Bg Color */
|
|
19
|
-
bg_color?: string;
|
|
19
|
+
bg_color?: string | null;
|
|
20
20
|
};
|
|
21
21
|
type ProductCardSchema = {
|
|
22
22
|
/**
|
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.16";
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
@@ -106,6 +106,7 @@ function $3375ddd88f77967d$export$f11681c54c860912(display, info, configuredOpti
|
|
|
106
106
|
}
|
|
107
107
|
}));
|
|
108
108
|
const aspectRatio_ = (0, $7jsgb$solidjs.createMemo)(()=>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.16";
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
@@ -95,6 +95,7 @@ function $29535f590238371c$export$f11681c54c860912(display, info, configuredOpti
|
|
|
95
95
|
}
|
|
96
96
|
}));
|
|
97
97
|
const aspectRatio_ = (0, $2MCgq$createMemo)(()=>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
|
@@ -50,7 +50,7 @@ type TextOptions = {
|
|
|
50
50
|
/** Color */
|
|
51
51
|
color: string;
|
|
52
52
|
/** Bg Color */
|
|
53
|
-
bg_color?: string;
|
|
53
|
+
bg_color?: string | null;
|
|
54
54
|
};
|
|
55
55
|
|
|
56
56
|
export type ProductCardSchema = {
|
|
@@ -142,6 +142,7 @@ export function DefaultSolidProductCard(
|
|
|
142
142
|
const [originalPrice] = createResource(variantToShow, v => v?.original_price);
|
|
143
143
|
const onSale = createMemo(() => <Suspense>{originalPrice() !== salePrice()}</Suspense>);
|
|
144
144
|
const aspectRatio_ = createMemo(() => configuredOptions_().image_aspect_ratio);
|
|
145
|
+
const hasSizes = () => configuredOptions_().sizes && sizesInStock_().size > 1;
|
|
145
146
|
const sizesInStock_ = createMemo(
|
|
146
147
|
() =>
|
|
147
148
|
new Map(
|
|
@@ -262,27 +263,25 @@ export function DefaultSolidProductCard(
|
|
|
262
263
|
aspectRatio_={aspectRatio_}
|
|
263
264
|
/>
|
|
264
265
|
</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
266
|
|
|
267
|
+
{(() => {
|
|
268
|
+
// We want the whole product card to be a link, except for the color swatches
|
|
269
|
+
const [containsColorSwatches] = useContainsColorSwatches();
|
|
270
|
+
const LinkWrappedIfHaveSwatches = (props: { children: JSX.Element }) => {
|
|
271
|
+
const resolved = children(() => props.children);
|
|
285
272
|
return (
|
|
273
|
+
<Show when={containsColorSwatches()} fallback={resolved()}>
|
|
274
|
+
<LinkWrapped>{resolved()}</LinkWrapped>
|
|
275
|
+
</Show>
|
|
276
|
+
);
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
return (
|
|
280
|
+
<Show
|
|
281
|
+
when={
|
|
282
|
+
titleOptions().enabled || configuredOptions_().price.enabled || hasSizes() || containsColorSwatches()
|
|
283
|
+
}
|
|
284
|
+
>
|
|
286
285
|
<InComponentOrDiv component_={!containsColorSwatches() && LinkWrapped} class_="text-container">
|
|
287
286
|
<Show
|
|
288
287
|
when={titleOptions().enabled}
|
|
@@ -295,7 +294,7 @@ export function DefaultSolidProductCard(
|
|
|
295
294
|
}
|
|
296
295
|
>
|
|
297
296
|
<Show
|
|
298
|
-
when={
|
|
297
|
+
when={hasSizes()}
|
|
299
298
|
fallback={
|
|
300
299
|
<LinkWrappedIfHaveSwatches>
|
|
301
300
|
<Title />
|
|
@@ -373,9 +372,9 @@ export function DefaultSolidProductCard(
|
|
|
373
372
|
</Show>
|
|
374
373
|
</Show>
|
|
375
374
|
</InComponentOrDiv>
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
375
|
+
</Show>
|
|
376
|
+
);
|
|
377
|
+
})()}
|
|
379
378
|
</div>
|
|
380
379
|
</ContainsColorSwatchesProvider>
|
|
381
380
|
);
|
|
@@ -620,7 +619,7 @@ function Sizes({
|
|
|
620
619
|
);
|
|
621
620
|
}
|
|
622
621
|
|
|
623
|
-
function setPropertyIfExists(style: CSSStyleDeclaration, property: string, value?: string | false | 0) {
|
|
622
|
+
function setPropertyIfExists(style: CSSStyleDeclaration, property: string, value?: string | false | 0 | null) {
|
|
624
623
|
if (value) {
|
|
625
624
|
style.setProperty(property, value);
|
|
626
625
|
} else {
|