@propeller-commerce/propeller-v2-react-ui 0.21.0 → 0.22.0
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 +41 -0
- package/dist/index.cjs +86 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +54 -9
- package/dist/index.d.ts +54 -9
- package/dist/index.js +88 -39
- package/dist/index.js.map +1 -1
- package/dist/pure.cjs +6 -14
- package/dist/pure.cjs.map +1 -1
- package/dist/pure.d.cts +12 -0
- package/dist/pure.d.ts +12 -0
- package/dist/pure.js +7 -15
- package/dist/pure.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +2 -2
package/dist/pure.d.cts
CHANGED
|
@@ -454,6 +454,12 @@ interface ProductBulkPricesProps {
|
|
|
454
454
|
* Defaults to 'open'.
|
|
455
455
|
*/
|
|
456
456
|
portalMode?: string;
|
|
457
|
+
/**
|
|
458
|
+
* Whether a session exists, independent of whether `user` has loaded yet.
|
|
459
|
+
* Passed down by the parent alongside `portalMode`; closes the hydration
|
|
460
|
+
* window in which an authenticated visitor still has a null `user`.
|
|
461
|
+
*/
|
|
462
|
+
isAuthenticated?: boolean;
|
|
457
463
|
/** Authenticated user — used for semi-closed visibility. */
|
|
458
464
|
user?: Contact | Customer | null;
|
|
459
465
|
/** Tax zone code. Defaults to 'NL'. */
|
|
@@ -534,6 +540,12 @@ interface ProductPriceProps {
|
|
|
534
540
|
* Defaults to 'open'.
|
|
535
541
|
*/
|
|
536
542
|
portalMode?: string;
|
|
543
|
+
/**
|
|
544
|
+
* Whether a session exists, independent of whether `user` has loaded yet.
|
|
545
|
+
* Passed down by the parent alongside `portalMode`; closes the hydration
|
|
546
|
+
* window in which an authenticated visitor still has a null `user`.
|
|
547
|
+
*/
|
|
548
|
+
isAuthenticated?: boolean;
|
|
537
549
|
/** Authenticated user — used for semi-closed visibility. */
|
|
538
550
|
user?: Contact | Customer | null;
|
|
539
551
|
/**
|
package/dist/pure.d.ts
CHANGED
|
@@ -454,6 +454,12 @@ interface ProductBulkPricesProps {
|
|
|
454
454
|
* Defaults to 'open'.
|
|
455
455
|
*/
|
|
456
456
|
portalMode?: string;
|
|
457
|
+
/**
|
|
458
|
+
* Whether a session exists, independent of whether `user` has loaded yet.
|
|
459
|
+
* Passed down by the parent alongside `portalMode`; closes the hydration
|
|
460
|
+
* window in which an authenticated visitor still has a null `user`.
|
|
461
|
+
*/
|
|
462
|
+
isAuthenticated?: boolean;
|
|
457
463
|
/** Authenticated user — used for semi-closed visibility. */
|
|
458
464
|
user?: Contact | Customer | null;
|
|
459
465
|
/** Tax zone code. Defaults to 'NL'. */
|
|
@@ -534,6 +540,12 @@ interface ProductPriceProps {
|
|
|
534
540
|
* Defaults to 'open'.
|
|
535
541
|
*/
|
|
536
542
|
portalMode?: string;
|
|
543
|
+
/**
|
|
544
|
+
* Whether a session exists, independent of whether `user` has loaded yet.
|
|
545
|
+
* Passed down by the parent alongside `portalMode`; closes the hydration
|
|
546
|
+
* window in which an authenticated visitor still has a null `user`.
|
|
547
|
+
*/
|
|
548
|
+
isAuthenticated?: boolean;
|
|
537
549
|
/** Authenticated user — used for semi-closed visibility. */
|
|
538
550
|
user?: Contact | Customer | null;
|
|
539
551
|
/**
|
package/dist/pure.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { buildClusterJsonLd, safeJsonStringify, buildItemListJsonLd, buildProductJsonLd, getLabel, getLocalizedValue, isContentHidden, formatPrice, localeForLanguage, getCountryName } from '@propeller-commerce/propeller-v2-core-ui';
|
|
1
|
+
import { buildClusterJsonLd, safeJsonStringify, buildItemListJsonLd, buildProductJsonLd, getLabel, getLocalizedValue, isContentHidden, formatPrice, localeForLanguage, getCountryName, resolveLanguageEntry, getLanguageString, getLanguageUri } from '@propeller-commerce/propeller-v2-core-ui';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
3
|
import { twMerge } from 'tailwind-merge';
|
|
4
4
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
@@ -613,7 +613,7 @@ function OrderTotals(props) {
|
|
|
613
613
|
var OrderTotals_default = OrderTotals;
|
|
614
614
|
function ProductBulkPrices(props) {
|
|
615
615
|
const includeTax = !!props.includeTax;
|
|
616
|
-
const isHidden = isContentHidden(props.portalMode, props.user);
|
|
616
|
+
const isHidden = isContentHidden(props.portalMode, props.user, props.isAuthenticated);
|
|
617
617
|
function getTierQuantity(tier) {
|
|
618
618
|
const discount = tier.discount;
|
|
619
619
|
return discount?.quantityFrom ?? tier.quantity ?? null;
|
|
@@ -715,14 +715,10 @@ function ProductDownloads(props) {
|
|
|
715
715
|
const hasItems = items.length > 0;
|
|
716
716
|
const lang = props.language || "NL";
|
|
717
717
|
function getDocumentUrl(doc) {
|
|
718
|
-
|
|
719
|
-
const match = docs.find((d) => d.language === lang);
|
|
720
|
-
return match?.originalUrl || docs?.[0]?.originalUrl || "";
|
|
718
|
+
return resolveLanguageEntry(doc.documents, lang)?.originalUrl || "";
|
|
721
719
|
}
|
|
722
720
|
function getDocumentName(doc) {
|
|
723
|
-
|
|
724
|
-
const match = alts.find((a) => a.language === lang);
|
|
725
|
-
return match?.value || alts?.[0]?.value || "Download";
|
|
721
|
+
return getLanguageString(doc.alt, lang, "Download");
|
|
726
722
|
}
|
|
727
723
|
return /* @__PURE__ */ jsxs("div", { className: cn(`propeller-product-downloads ${props.className || ""}`), children: [
|
|
728
724
|
hasItems ? /* @__PURE__ */ jsx("h3", { className: "propeller-product-downloads__title text-base font-semibold text-foreground mb-3", children: getLabel(props.labels, "title", "Downloads") }) : null,
|
|
@@ -780,7 +776,7 @@ function ProductDownloads(props) {
|
|
|
780
776
|
var ProductDownloads_default = ProductDownloads;
|
|
781
777
|
function ProductPriceDisplay(props) {
|
|
782
778
|
function isHidden() {
|
|
783
|
-
return isContentHidden(props.portalMode, props.user);
|
|
779
|
+
return isContentHidden(props.portalMode, props.user, props.isAuthenticated);
|
|
784
780
|
}
|
|
785
781
|
function formatPrice5(value) {
|
|
786
782
|
if (value === null || value === void 0) return "";
|
|
@@ -871,14 +867,10 @@ function ProductVideos(props) {
|
|
|
871
867
|
const hasItems = items.length > 0;
|
|
872
868
|
const lang = props.language || "NL";
|
|
873
869
|
function getVideoUri(video) {
|
|
874
|
-
|
|
875
|
-
const match = vids.find((v) => v.language === lang);
|
|
876
|
-
return match?.uri || vids?.[0]?.uri || "";
|
|
870
|
+
return getLanguageUri(video.videos, lang, "");
|
|
877
871
|
}
|
|
878
872
|
function getVideoTitle(video) {
|
|
879
|
-
|
|
880
|
-
const match = alts.find((a) => a.language === lang);
|
|
881
|
-
return match?.value || alts?.[0]?.value || "Video";
|
|
873
|
+
return getLanguageString(video.alt, lang, "Video");
|
|
882
874
|
}
|
|
883
875
|
function isEmbeddable(uri) {
|
|
884
876
|
return uri.includes("youtube.com") || uri.includes("youtu.be") || uri.includes("vimeo.com");
|