@gengage/assistant-fe 0.4.1 → 0.4.2
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/chat/types.d.ts +6 -0
- package/dist/{chat-C9l4oBJA.js → chat-Ci4ZA37X.js} +20 -18
- package/dist/chat.iife.js +2 -2
- package/dist/chat.js +1 -1
- package/dist/common/overlay.d.ts +4 -0
- package/dist/{common-CiTC1BDg.js → common-DUMmqYxM.js} +1 -1
- package/dist/common.js +3 -3
- package/dist/index.js +3 -3
- package/dist/{native-webview-FnIiDil0.js → native-webview-v2HYw_9X.js} +35 -35
- package/dist/native.iife.js +2 -2
- package/dist/native.js +1 -1
- package/package.json +1 -1
package/dist/chat/types.d.ts
CHANGED
|
@@ -117,6 +117,10 @@ export interface ChatWidgetConfig extends BaseWidgetConfig {
|
|
|
117
117
|
* inline percent badge in the product details price row. List/sale price and campaign badges are unchanged.
|
|
118
118
|
*/
|
|
119
119
|
hideProductDiscountBadge?: boolean;
|
|
120
|
+
/** When true, hides the ReviewHighlights component in chat responses. */
|
|
121
|
+
hideUserReviews?: boolean;
|
|
122
|
+
/** When true, hides in-stock / out-of-stock labels on product cards. */
|
|
123
|
+
hideStockStatus?: boolean;
|
|
120
124
|
/** Enable browser-native voice input. Default: false. */
|
|
121
125
|
voiceEnabled?: boolean;
|
|
122
126
|
onOpen?: () => void;
|
|
@@ -346,6 +350,8 @@ export interface ChatUISpecRenderContext {
|
|
|
346
350
|
pricing?: import('../common/price-formatter.js').PriceFormatConfig | undefined;
|
|
347
351
|
productPriceUi?: ProductPriceUiConfig | undefined;
|
|
348
352
|
hideProductDiscountBadge?: boolean | undefined;
|
|
353
|
+
hideUserReviews?: boolean | undefined;
|
|
354
|
+
hideStockStatus?: boolean | undefined;
|
|
349
355
|
i18n?: Pick<ChatI18n, 'productCtaLabel' | 'viewOnSiteLabel' | 'aiTopPicksTitle' | 'roleWinner' | 'roleBestValue' | 'roleBestAlternative' | 'viewDetails' | 'groundingReviewCta' | 'groundingReviewSubtitle' | 'variantsLabel' | 'sortRelated' | 'sortPriceAsc' | 'sortPriceDesc' | 'sortToolbarAriaLabel' | 'compareSelected' | 'compareMinHint' | 'comparisonSelectLabel' | 'comparisonSelectedLabel' | 'comparisonSelectCardHint' | 'panelTitleProductDetails' | 'panelTitleSimilarProducts' | 'panelTitleComparisonResults' | 'panelTitleCategories' | 'panelTitleSearchResults' | 'inStockLabel' | 'outOfStockLabel' | 'findSimilarLabel' | 'galleryPrevAriaLabel' | 'galleryNextAriaLabel' | 'beautyStylesPreparedTitle' | 'watchStylesPreparedTitle' | 'consultingOtherCompatibleProductsLabel' | 'consultingFallbackGroupLabel' | 'consultingFallbackStyleLabel' | 'consultingStyleLoadingDescription' | 'consultingStyleUnavailableDescription' | 'consultingStyleLoadingBadge' | 'consultingStyleUnavailableBadge' | 'viewMoreLabel' | 'similarProductsLabel' | 'addToCartButton' | 'shareButton' | 'productInfoTab' | 'specificationsTab' | 'recommendedChoiceLabel' | 'highlightsLabel' | 'keyDifferencesLabel' | 'specialCasesLabel' | 'emptyReviewsMessage' | 'closeAriaLabel' | 'dismissAriaLabel' | 'startChatLabel' | 'handoffHeading' | 'customerReviewsTitle' | 'addToFavoritesLabel' | 'reviewFilterPositive' | 'reviewFilterNegative' | 'decreaseLabel' | 'increaseLabel' | 'reviewCustomersMentionSingular' | 'reviewCustomersMentionPlural' | 'reviewSubjectsHeading' | 'aiBrowseCategoriesTitle' | 'photoAnalysisBadge' | 'photoAnalysisStrengthsLabel' | 'photoAnalysisFocusLabel' | 'photoAnalysisCelebStyleLabel' | 'beautyPhotoStepTitle' | 'beautyPhotoStepDescription' | 'beautyPhotoStepUpload' | 'beautyPhotoStepProcessing' | 'beautyPhotoStepSkip'>;
|
|
350
356
|
productSort?: ProductSortState | undefined;
|
|
351
357
|
onSortChange?: ((sort: ProductSortState) => void) | undefined;
|
|
@@ -2630,16 +2630,16 @@ function oi(t, e, a) {
|
|
|
2630
2630
|
p.className = "gengage-chat-ai-toppick-price-stack", p.appendChild(Ye(r)), p.appendChild(d), e.appendChild(p);
|
|
2631
2631
|
} else e.appendChild(d);
|
|
2632
2632
|
}
|
|
2633
|
-
function si(t, e) {
|
|
2634
|
-
const
|
|
2635
|
-
if (!(!
|
|
2636
|
-
if (a) {
|
|
2637
|
-
const i = document.createElement("p");
|
|
2638
|
-
i.className = "gengage-chat-ai-toppick-reason", i.dataset.gengagePart = "ai-top-pick-reason", i.textContent = a, e.appendChild(i);
|
|
2639
|
-
}
|
|
2633
|
+
function si(t, e, a) {
|
|
2634
|
+
const n = typeof t.reason == "string" ? t.reason.trim() : "", i = a.hideUserReviews !== !0 && typeof t.reviewHighlight == "string" ? t.reviewHighlight.trim() : "";
|
|
2635
|
+
if (!(!n && !i)) {
|
|
2640
2636
|
if (n) {
|
|
2641
|
-
const
|
|
2642
|
-
|
|
2637
|
+
const r = document.createElement("p");
|
|
2638
|
+
r.className = "gengage-chat-ai-toppick-reason", r.dataset.gengagePart = "ai-top-pick-reason", r.textContent = n, e.appendChild(r);
|
|
2639
|
+
}
|
|
2640
|
+
if (i) {
|
|
2641
|
+
const r = document.createElement("div");
|
|
2642
|
+
r.className = "gengage-chat-ai-toppick-review", r.dataset.gengagePart = "ai-top-pick-review", r.textContent = i, e.appendChild(r);
|
|
2643
2643
|
}
|
|
2644
2644
|
}
|
|
2645
2645
|
}
|
|
@@ -2678,7 +2678,7 @@ function Ct(t, e, a) {
|
|
|
2678
2678
|
const m = ii(i);
|
|
2679
2679
|
m && u.appendChild(m), oi(i, u, e), t.labels && t.labels.length > 0 && u.appendChild(li(t.labels)), x.appendChild(u), n.appendChild(x);
|
|
2680
2680
|
const L = document.createElement("div");
|
|
2681
|
-
if (L.className = "gengage-chat-ai-toppick-detail", L.dataset.gengagePart = "ai-top-pick-detail", a) si(t, L);
|
|
2681
|
+
if (L.className = "gengage-chat-ai-toppick-detail", L.dataset.gengagePart = "ai-top-pick-detail", a) si(t, L, e);
|
|
2682
2682
|
else {
|
|
2683
2683
|
const k = typeof t.reason == "string" ? t.reason.trim() : "";
|
|
2684
2684
|
if (k) {
|
|
@@ -3025,7 +3025,7 @@ function vi(t, e) {
|
|
|
3025
3025
|
m.textContent = L, m.title = L, r.appendChild(m);
|
|
3026
3026
|
}
|
|
3027
3027
|
const c = a.rating, l = a.reviewCount;
|
|
3028
|
-
if (typeof c == "number" && Number.isFinite(c) && c > 0) {
|
|
3028
|
+
if (e.hideUserReviews !== !0 && typeof c == "number" && Number.isFinite(c) && c > 0) {
|
|
3029
3029
|
const m = document.createElement("div");
|
|
3030
3030
|
if (m.className = "gengage-chat-product-summary__rating", m.dataset.gengagePart = "product-summary-rating", m.appendChild(Ut(c)), typeof l == "number" && Number.isFinite(l)) {
|
|
3031
3031
|
const L = document.createElement("span");
|
|
@@ -3113,7 +3113,7 @@ var Qt = {
|
|
|
3113
3113
|
ProductCard: ({ element: t, context: e }) => rt(t, e),
|
|
3114
3114
|
ProductDetailsPanel: ({ element: t, context: e }) => Vi(t, e),
|
|
3115
3115
|
ProductGrid: ({ element: t, spec: e, renderElement: a, context: n }) => Qi(t, e, a, n),
|
|
3116
|
-
ReviewHighlights: ({ element: t, context: e }) => ti(t, {
|
|
3116
|
+
ReviewHighlights: ({ element: t, context: e }) => e.hideUserReviews === !0 ? null : ti(t, {
|
|
3117
3117
|
emptyReviewsMessage: e.i18n?.emptyReviewsMessage,
|
|
3118
3118
|
reviewFilterPositive: e.i18n?.reviewFilterPositive,
|
|
3119
3119
|
reviewFilterNegative: e.i18n?.reviewFilterNegative,
|
|
@@ -3123,7 +3123,7 @@ var Qt = {
|
|
|
3123
3123
|
}),
|
|
3124
3124
|
ComparisonTable: ({ element: t, context: e }) => Ji(t, e),
|
|
3125
3125
|
AITopPicks: ({ element: t, context: e }) => ci(t, e),
|
|
3126
|
-
GroundingReviewCard: ({ element: t, context: e }) => gi(t, e),
|
|
3126
|
+
GroundingReviewCard: ({ element: t, context: e }) => e.hideUserReviews === !0 ? null : gi(t, e),
|
|
3127
3127
|
AIGroupingCards: ({ element: t, context: e }) => pi(t, e),
|
|
3128
3128
|
AISuggestedSearchCards: ({ element: t, context: e }) => hi(t, e),
|
|
3129
3129
|
ProsAndCons: ({ element: t }) => ui(t),
|
|
@@ -3361,7 +3361,7 @@ function rt(t, e) {
|
|
|
3361
3361
|
b.className = "gengage-chat-product-card-name", b.textContent = P, b.title = P, s.appendChild(b);
|
|
3362
3362
|
}
|
|
3363
3363
|
const I = n.inStock;
|
|
3364
|
-
if (typeof I == "boolean") {
|
|
3364
|
+
if (e.hideStockStatus !== !0 && typeof I == "boolean") {
|
|
3365
3365
|
const b = document.createElement("div");
|
|
3366
3366
|
b.className = `gengage-chat-product-card-stock ${I ? "is-in-stock" : "is-out-of-stock"}`, b.textContent = I ? e.i18n?.inStockLabel ?? "In Stock" : e.i18n?.outOfStockLabel ?? "Out of Stock", s.appendChild(b);
|
|
3367
3367
|
}
|
|
@@ -3691,7 +3691,7 @@ function Vi(t, e) {
|
|
|
3691
3691
|
const E = document.createElement("h3");
|
|
3692
3692
|
E.className = "gengage-chat-product-details-title", E.textContent = i, E.title = i, N.appendChild(E);
|
|
3693
3693
|
}
|
|
3694
|
-
if (typeof y == "number" && Number.isFinite(y) && y > 0) {
|
|
3694
|
+
if (e.hideUserReviews !== !0 && typeof y == "number" && Number.isFinite(y) && y > 0) {
|
|
3695
3695
|
const E = document.createElement(o ? "button" : "div");
|
|
3696
3696
|
E.className = "gengage-chat-product-details-rating", o && (E.type = "button", E.classList.add("gengage-chat-product-details-rating--clickable"), E.setAttribute("aria-label", e.i18n?.groundingReviewCta ?? "Read Reviews"), E.addEventListener("click", () => {
|
|
3697
3697
|
e.onAction({
|
|
@@ -3732,7 +3732,7 @@ function Vi(t, e) {
|
|
|
3732
3732
|
T.classList.contains("gengage-chat-product-details-price-stack") && T.remove();
|
|
3733
3733
|
}
|
|
3734
3734
|
}
|
|
3735
|
-
if (typeof x == "boolean") {
|
|
3735
|
+
if (e.hideStockStatus !== !0 && typeof x == "boolean") {
|
|
3736
3736
|
const E = document.createElement("div");
|
|
3737
3737
|
E.className = `gengage-chat-product-details-stock ${x ? "is-in-stock" : "is-out-of-stock"}`, E.textContent = x ? e.i18n?.inStockLabel ?? "In Stock" : e.i18n?.outOfStockLabel ?? "Out of Stock", N.appendChild(E);
|
|
3738
3738
|
}
|
|
@@ -6914,7 +6914,7 @@ var fo = class Te extends Ra {
|
|
|
6914
6914
|
})));
|
|
6915
6915
|
return;
|
|
6916
6916
|
}
|
|
6917
|
-
this._drawer.setInputAreaChips([{
|
|
6917
|
+
this._drawer.setInputAreaChips([...this.config.hideUserReviews !== !0 ? [{
|
|
6918
6918
|
label: this._i18n.groundingReviewCta,
|
|
6919
6919
|
icon: "review",
|
|
6920
6920
|
onAction: () => this._sendAction({
|
|
@@ -6922,7 +6922,7 @@ var fo = class Te extends Ra {
|
|
|
6922
6922
|
type: "reviewSummary",
|
|
6923
6923
|
payload: { sku: e }
|
|
6924
6924
|
})
|
|
6925
|
-
}, {
|
|
6925
|
+
}] : [], {
|
|
6926
6926
|
label: this._i18n.findSimilarLabel,
|
|
6927
6927
|
icon: "similar",
|
|
6928
6928
|
onAction: () => this._sendAction({
|
|
@@ -7311,6 +7311,8 @@ var fo = class Te extends Ra {
|
|
|
7311
7311
|
pricing: this.config.pricing,
|
|
7312
7312
|
productPriceUi: this.config.productPriceUi,
|
|
7313
7313
|
hideProductDiscountBadge: this.config.hideProductDiscountBadge,
|
|
7314
|
+
hideUserReviews: this.config.hideUserReviews,
|
|
7315
|
+
hideStockStatus: this.config.hideStockStatus,
|
|
7314
7316
|
productSort: this._productSort,
|
|
7315
7317
|
onSortChange: (a) => {
|
|
7316
7318
|
this._productSort = a;
|