admesh-ui-sdk 0.16.4 → 0.16.6
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 +45 -58
- package/dist/components/AdMeshLayout.d.ts.map +1 -1
- package/dist/components/AdMeshProductCard.d.ts.map +1 -1
- package/dist/index.js +42 -42
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +820 -788
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.d.ts +52 -53
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/disclosureUtils.d.ts +3 -1
- package/dist/utils/disclosureUtils.d.ts.map +1 -1
- package/dist/utils/themeUtils.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -188,14 +188,28 @@ import { AdMeshLayout } from 'admesh-ui-sdk';
|
|
|
188
188
|
Individual product recommendation card with rich information display.
|
|
189
189
|
|
|
190
190
|
```tsx
|
|
191
|
+
// Default clean minimal design (recommended)
|
|
191
192
|
<AdMeshProductCard
|
|
192
193
|
recommendation={recommendation}
|
|
193
194
|
showMatchScore={false} // Deprecated - Match Score removed from UI
|
|
194
195
|
showBadges={true}
|
|
196
|
+
showFeatures={false} // Default: clean minimal design
|
|
197
|
+
onClick={(adId, admeshLink) => window.open(admeshLink)}
|
|
198
|
+
/>
|
|
199
|
+
|
|
200
|
+
// With features for detailed showcases
|
|
201
|
+
<AdMeshProductCard
|
|
202
|
+
recommendation={recommendation}
|
|
203
|
+
showFeatures={true} // Show key features section
|
|
195
204
|
onClick={(adId, admeshLink) => window.open(admeshLink)}
|
|
196
205
|
/>
|
|
197
206
|
```
|
|
198
207
|
|
|
208
|
+
**Props:**
|
|
209
|
+
- `showFeatures` (boolean, default: false) - Whether to display the key features section. Default is clean minimal design.
|
|
210
|
+
- `showBadges` (boolean, default: true) - Whether to show product badges
|
|
211
|
+
- `showMatchScore` (boolean, default: false) - Deprecated, match score removed from UI
|
|
212
|
+
|
|
199
213
|
#### AdMeshEcommerceCards
|
|
200
214
|
Horizontal scrolling product cards for ecommerce recommendations, similar to Google product search results.
|
|
201
215
|
|
|
@@ -533,29 +547,24 @@ interface AdMeshRecommendation {
|
|
|
533
547
|
interface AgentRecommendationResponse {
|
|
534
548
|
session_id: string;
|
|
535
549
|
intent: {
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
keywords?: string[];
|
|
550
|
+
goal: string;
|
|
551
|
+
intent_group: string;
|
|
552
|
+
purchase_intent: string;
|
|
553
|
+
intent_type: string;
|
|
554
|
+
layout_type: string;
|
|
555
|
+
categories: string[];
|
|
543
556
|
};
|
|
544
557
|
response: {
|
|
545
|
-
summary
|
|
558
|
+
summary: string;
|
|
546
559
|
recommendations: AdMeshRecommendation[];
|
|
547
|
-
followup_suggestions
|
|
560
|
+
followup_suggestions: Array<{
|
|
548
561
|
label: string;
|
|
549
562
|
query: string;
|
|
550
|
-
product_mentions: string[];
|
|
551
|
-
admesh_links: Record<string, string>;
|
|
552
|
-
session_id: string;
|
|
553
563
|
}>;
|
|
564
|
+
layout_type: string;
|
|
554
565
|
};
|
|
555
566
|
tokens_used: number;
|
|
556
567
|
model_used: string;
|
|
557
|
-
recommendation_id?: string;
|
|
558
|
-
end_of_session?: boolean;
|
|
559
568
|
}
|
|
560
569
|
```
|
|
561
570
|
|
|
@@ -1554,54 +1563,32 @@ The AdMesh UI SDK uses a unified JSON schema that works across all recommendatio
|
|
|
1554
1563
|
|
|
1555
1564
|
```typescript
|
|
1556
1565
|
interface AdMeshRecommendation {
|
|
1557
|
-
// Required core fields
|
|
1558
|
-
|
|
1566
|
+
// Required core fields (new format)
|
|
1567
|
+
product_id: string;
|
|
1568
|
+
title: string;
|
|
1569
|
+
recommendation_description: string;
|
|
1559
1570
|
admesh_link: string;
|
|
1560
|
-
audience_segment: string;
|
|
1561
|
-
availability: string;
|
|
1562
|
-
brand: string;
|
|
1563
|
-
brand_trust_score: number;
|
|
1564
1571
|
categories: string[];
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
external_id: string;
|
|
1568
|
-
feature_sections: any[];
|
|
1569
|
-
features: string[];
|
|
1570
|
-
image_url: string;
|
|
1571
|
-
integrations: any[];
|
|
1572
|
-
intent_match_score: number; // 0-1 normalized score
|
|
1573
|
-
is_fallback: boolean;
|
|
1574
|
-
keywords: string[];
|
|
1575
|
-
offer_trust_score: number;
|
|
1576
|
-
original_price: number;
|
|
1577
|
-
price: number;
|
|
1578
|
-
pricing: string; // Formatted price string (e.g., "$99.48")
|
|
1579
|
-
product_id: string;
|
|
1580
|
-
rating: number;
|
|
1581
|
-
reason: string; // Match reason/explanation
|
|
1582
|
-
recommendation_description: string; // Marketing-optimized description
|
|
1583
|
-
recommendation_title: string; // Marketing-optimized title
|
|
1584
|
-
redirect_url: string;
|
|
1585
|
-
review_count: number;
|
|
1572
|
+
integrations: string[];
|
|
1573
|
+
trust_score: number;
|
|
1586
1574
|
reward_note: string;
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
shipping_info?: {
|
|
1598
|
-
free_shipping_over_35: boolean;
|
|
1599
|
-
standard_rate: number;
|
|
1600
|
-
two_day_rate: number;
|
|
1601
|
-
ship_to_store: boolean;
|
|
1602
|
-
free_ship_to_store: boolean;
|
|
1575
|
+
meta: {
|
|
1576
|
+
ad_id: string;
|
|
1577
|
+
offer_trust_score: number;
|
|
1578
|
+
brand_trust_score: number;
|
|
1579
|
+
intent_match_score: number;
|
|
1580
|
+
reason: string;
|
|
1581
|
+
description: string;
|
|
1582
|
+
keywords: string[];
|
|
1583
|
+
url: string;
|
|
1584
|
+
redirect_url: string;
|
|
1603
1585
|
};
|
|
1604
|
-
|
|
1586
|
+
|
|
1587
|
+
// Legacy fields for backward compatibility
|
|
1588
|
+
ad_id?: string; // Use meta.ad_id instead
|
|
1589
|
+
brand?: string;
|
|
1590
|
+
source?: string;
|
|
1591
|
+
// ... other legacy fields
|
|
1605
1592
|
}
|
|
1606
1593
|
```
|
|
1607
1594
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdMeshLayout.d.ts","sourceRoot":"","sources":["../../src/components/AdMeshLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,iBAAiB,EAAwB,MAAM,gBAAgB,CAAC;AAG9E,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,
|
|
1
|
+
{"version":3,"file":"AdMeshLayout.d.ts","sourceRoot":"","sources":["../../src/components/AdMeshLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,iBAAiB,EAAwB,MAAM,gBAAgB,CAAC;AAG9E,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA0DpD,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdMeshProductCard.d.ts","sourceRoot":"","sources":["../../src/components/AdMeshProductCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAEjD,OAAO,KAAK,EAAE,sBAAsB,EAAa,MAAM,gBAAgB,CAAC;AASxE,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,
|
|
1
|
+
{"version":3,"file":"AdMeshProductCard.d.ts","sourceRoot":"","sources":["../../src/components/AdMeshProductCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAEjD,OAAO,KAAK,EAAE,sBAAsB,EAAa,MAAM,gBAAgB,CAAC;AASxE,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAqV9D,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react");function we(
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react");function we(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Z={exports:{}},G={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var le;function ke(){if(le)return
|
|
9
|
+
*/var le;function ke(){if(le)return G;le=1;var r=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(i,d,o){var s=null;if(o!==void 0&&(s=""+o),d.key!==void 0&&(s=""+d.key),"key"in d){o={};for(var l in d)l!=="key"&&(o[l]=d[l])}else o=d;return d=o.ref,{$$typeof:r,type:i,key:s,ref:d!==void 0?d:null,props:o}}return G.Fragment=e,G.jsx=n,G.jsxs=n,G}var J={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,16 +14,16 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var ce;function ve(){return ce||(ce=1,process.env.NODE_ENV!=="production"&&function(){function
|
|
17
|
+
*/var ce;function ve(){return ce||(ce=1,process.env.NODE_ENV!=="production"&&function(){function r(a){if(a==null)return null;if(typeof a=="function")return a.$$typeof===T?null:a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case _:return"Fragment";case j:return"Profiler";case g:return"StrictMode";case D:return"Suspense";case I:return"SuspenseList";case m:return"Activity"}if(typeof a=="object")switch(typeof a.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),a.$$typeof){case w:return"Portal";case U:return(a.displayName||"Context")+".Provider";case A:return(a._context.displayName||"Context")+".Consumer";case $:var u=a.render;return a=a.displayName,a||(a=u.displayName||u.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case B:return u=a.displayName||null,u!==null?u:r(a.type)||"Memo";case F:u=a._payload,a=a._init;try{return r(a(u))}catch{}}return null}function e(a){return""+a}function n(a){try{e(a);var u=!1}catch{u=!0}if(u){u=console;var x=u.error,k=typeof Symbol=="function"&&Symbol.toStringTag&&a[Symbol.toStringTag]||a.constructor.name||"Object";return x.call(u,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",k),e(a)}}function i(a){if(a===_)return"<>";if(typeof a=="object"&&a!==null&&a.$$typeof===F)return"<...>";try{var u=r(a);return u?"<"+u+">":"<...>"}catch{return"<...>"}}function d(){var a=R.A;return a===null?null:a.getOwner()}function o(){return Error("react-stack-top-frame")}function s(a){if(L.call(a,"key")){var u=Object.getOwnPropertyDescriptor(a,"key").get;if(u&&u.isReactWarning)return!1}return a.key!==void 0}function l(a,u){function x(){Y||(Y=!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)",u))}x.isReactWarning=!0,Object.defineProperty(a,"key",{get:x,configurable:!0})}function f(){var a=r(this.type);return H[a]||(H[a]=!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.")),a=this.props.ref,a!==void 0?a:null}function h(a,u,x,k,P,M,ee,re){return x=M.ref,a={$$typeof:v,type:a,key:u,props:M,_owner:P},(x!==void 0?x:null)!==null?Object.defineProperty(a,"ref",{enumerable:!1,get:f}):Object.defineProperty(a,"ref",{enumerable:!1,value:null}),a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(a,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(a,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:ee}),Object.defineProperty(a,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:re}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a}function b(a,u,x,k,P,M,ee,re){var C=u.children;if(C!==void 0)if(k)if(V(C)){for(k=0;k<C.length;k++)c(C[k]);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 c(C);if(L.call(u,"key")){C=r(a);var q=Object.keys(u).filter(function(ye){return ye!=="key"});k=0<q.length?"{key: someKey, "+q.join(": ..., ")+": ...}":"{key: someKey}",Q[C+k]||(q=0<q.length?"{"+q.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
18
|
let props = %s;
|
|
19
19
|
<%s {...props} />
|
|
20
20
|
React keys must be passed directly to JSX without using spread:
|
|
21
21
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,
|
|
22
|
+
<%s key={someKey} {...props} />`,k,C,q,C),Q[C+k]=!0)}if(C=null,x!==void 0&&(n(x),C=""+x),s(u)&&(n(u.key),C=""+u.key),"key"in u){x={};for(var te in u)te!=="key"&&(x[te]=u[te])}else x=u;return C&&l(x,typeof a=="function"?a.displayName||a.name||"Unknown":a),h(a,C,M,P,d(),x,ee,re)}function c(a){typeof a=="object"&&a!==null&&a.$$typeof===v&&a._store&&(a._store.validated=1)}var p=y,v=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),_=Symbol.for("react.fragment"),g=Symbol.for("react.strict_mode"),j=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),U=Symbol.for("react.context"),$=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),B=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),T=Symbol.for("react.client.reference"),R=p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=Object.prototype.hasOwnProperty,V=Array.isArray,N=console.createTask?console.createTask:function(){return null};p={"react-stack-bottom-frame":function(a){return a()}};var Y,H={},S=p["react-stack-bottom-frame"].bind(p,o)(),E=N(i(o)),Q={};J.Fragment=_,J.jsx=function(a,u,x,k,P){var M=1e4>R.recentlyCreatedOwnerStacks++;return b(a,u,x,!1,k,P,M?Error("react-stack-top-frame"):S,M?N(i(a)):E)},J.jsxs=function(a,u,x,k,P){var M=1e4>R.recentlyCreatedOwnerStacks++;return b(a,u,x,!0,k,P,M?Error("react-stack-top-frame"):S,M?N(i(a)):E)}}()),J}var me;function _e(){return me||(me=1,process.env.NODE_ENV==="production"?Z.exports=ke():Z.exports=ve()),Z.exports}var t=_e();const je=r=>{try{return new URL(r),!0}catch{return!1}},pe=(r,e)=>{const n=new Map;e.forEach(f=>{f.admesh_link&&n.set(f.admesh_link,f)});const i=/\[([^\]]+)\]\(([^)]+)\)/g,d=[];let o=0,s,l=0;for(;(s=i.exec(r))!==null;){const[f,h,b]=s,c=n.get(b);s.index>o&&d.push(r.slice(o,s.index)),c?(l++,d.push(t.jsx("a",{href:c.admesh_link,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-300 underline decoration-blue-600 dark:decoration-blue-400 hover:decoration-blue-800 dark:hover:decoration-blue-300 transition-colors duration-200 font-medium",style:{color:"#2563eb",textDecoration:"underline",textDecorationColor:"#2563eb",textUnderlineOffset:"2px"},onClick:p=>{console.log("AdMesh summary link clicked:",{adId:c.ad_id,productId:c.product_id,title:c.title||c.recommendation_title,brand:c.brand,pricing:c.pricing,admeshLink:c.admesh_link,source:"summary"}),typeof window<"u"&&window.admeshTracker&&window.admeshTracker.trackClick({adId:c.ad_id,productId:c.product_id,admeshLink:c.admesh_link,source:"summary"})},children:h},`summary-link-${l}`))):(console.warn(`[AdMesh Summary] No recommendation found for link: [${h}](${b}), creating regular link`),je(b)?(l++,d.push(t.jsx("a",{href:b,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-300 underline decoration-blue-600 dark:decoration-blue-400 hover:decoration-blue-800 dark:hover:decoration-blue-300 transition-colors duration-200 font-medium",style:{color:"#2563eb",textDecoration:"underline",textDecorationColor:"#2563eb",textUnderlineOffset:"2px"},onClick:p=>{console.log("AdMesh summary unmatched link clicked:",{linkText:h,url:b,source:"summary"}),typeof window<"u"&&window.admeshTracker&&window.admeshTracker.trackClick({url:b,linkText:h,source:"summary_unmatched"})},children:h},`summary-link-${l}`))):(console.warn(`[AdMesh Summary] Invalid URL in markdown link: [${h}](${b})`),d.push(h))),o=s.index+f.length}return o<r.length&&d.push(r.slice(o)),d},ne=({summaryText:r,recommendations:e,theme:n,className:i="",style:d={},onLinkClick:o})=>{if(!r||!r.trim())return console.warn("[AdMesh Summary] No summary text provided"),null;if(!e||e.length===0){console.warn("[AdMesh Summary] No recommendations provided");const l=pe(r,[]);return t.jsx("div",{className:`admesh-summary-unit ${i}`,style:d,children:t.jsx("p",{className:"text-gray-700 dark:text-gray-300 leading-relaxed",children:l.map((f,h)=>t.jsx(y.Fragment,{children:f},h))})})}const s=pe(r,e);return t.jsxs("div",{className:`admesh-summary-unit ${i}`,style:{fontFamily:(n==null?void 0:n.fontFamily)||'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',...d},children:[t.jsx("div",{className:"summary-content",children:t.jsx("p",{className:"text-gray-700 dark:text-gray-300 leading-relaxed text-base",children:s.map((l,f)=>t.jsx(y.Fragment,{children:l},f))})}),t.jsx("div",{className:"mt-3 pt-2 border-t border-gray-200 dark:border-gray-700",children:t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Sponsored"})})]})};var ae={exports:{}};/*!
|
|
23
23
|
Copyright (c) 2018 Jed Watson.
|
|
24
24
|
Licensed under the MIT License (MIT), see
|
|
25
25
|
http://jedwatson.github.io/classnames
|
|
26
|
-
*/var
|
|
26
|
+
*/var ue;function Ce(){return ue||(ue=1,function(r){(function(){var e={}.hasOwnProperty;function n(){for(var o="",s=0;s<arguments.length;s++){var l=arguments[s];l&&(o=d(o,i(l)))}return o}function i(o){if(typeof o=="string"||typeof o=="number")return o;if(typeof o!="object")return"";if(Array.isArray(o))return n.apply(null,o);if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]"))return o.toString();var s="";for(var l in o)e.call(o,l)&&o[l]&&(s=d(s,l));return s}function d(o,s){return s?o?o+" "+s:o+s:o}r.exports?(n.default=n,r.exports=n):window.classNames=n})()}(ae)),ae.exports}var Se=Ce();const z=we(Se),Te="https://api.useadmesh.com/track";let se={apiBaseUrl:Te,enabled:!0,debug:!1,retryAttempts:3,retryDelay:1e3};const Ne=r=>{se={...se,...r}},he=r=>{const[e,n]=y.useState(!1),[i,d]=y.useState(null),o=y.useMemo(()=>({...se,...r}),[r]),s=y.useCallback((c,p)=>{o.debug&&console.log(`[AdMesh Tracker] ${c}`,p)},[o.debug]),l=y.useCallback(async(c,p)=>{if(!o.enabled){s("Tracking disabled, skipping event",{eventType:c,data:p});return}if(!p.adId||!p.admeshLink){const g="Missing required tracking data: adId and admeshLink are required";s(g,p),d(g);return}n(!0),d(null);const v={event_type:c,ad_id:p.adId,admesh_link:p.admeshLink,product_id:p.productId,user_id:p.userId,session_id:p.sessionId,revenue:p.revenue,conversion_type:p.conversionType,metadata:p.metadata,timestamp:new Date().toISOString(),user_agent:navigator.userAgent,referrer:document.referrer,page_url:window.location.href};s(`Sending ${c} event`,v);let w=null;for(let g=1;g<=(o.retryAttempts||3);g++)try{const j=await fetch(`${o.apiBaseUrl}/events`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(v)});if(!j.ok)throw new Error(`HTTP ${j.status}: ${j.statusText}`);const A=await j.json();s(`${c} event tracked successfully`,A),n(!1);return}catch(j){w=j,s(`Attempt ${g} failed for ${c} event`,j),g<(o.retryAttempts||3)&&await new Promise(A=>setTimeout(A,(o.retryDelay||1e3)*g))}const _=`Failed to track ${c} event after ${o.retryAttempts} attempts: ${w==null?void 0:w.message}`;s(_,w),d(_),n(!1)},[o,s]),f=y.useCallback(async c=>l("click",c),[l]),h=y.useCallback(async c=>l("view",c),[l]),b=y.useCallback(async c=>(!c.revenue&&!c.conversionType&&s("Warning: Conversion tracking without revenue or conversion type",c),l("conversion",c)),[l,s]);return{trackClick:f,trackView:h,trackConversion:b,isTracking:e,error:i}},Re=(r,e,n)=>{try{const i=new URL(r);return i.searchParams.set("ad_id",e),i.searchParams.set("utm_source","admesh"),i.searchParams.set("utm_medium","recommendation"),n&&Object.entries(n).forEach(([d,o])=>{i.searchParams.set(d,o)}),i.toString()}catch(i){return console.warn("[AdMesh] Invalid URL provided to buildAdMeshLink:",r,i),r}},Ae=(r,e)=>({adId:r.ad_id,admeshLink:r.admesh_link,productId:r.product_id,...e}),X=({adId:r,admeshLink:e,productId:n,children:i,trackingData:d,className:o,style:s})=>{const{trackClick:l,trackView:f}=he(),h=y.useRef(null),b=y.useRef(!1);y.useEffect(()=>{if(!h.current||b.current)return;const p=new IntersectionObserver(v=>{v.forEach(w=>{w.isIntersecting&&!b.current&&(b.current=!0,f({adId:r,admeshLink:e,productId:n,...d}).catch(console.error))})},{threshold:.5,rootMargin:"0px"});return p.observe(h.current),()=>{p.disconnect()}},[r,e,n,d,f]);const c=y.useCallback(async p=>{try{await l({adId:r,admeshLink:e,productId:n,...d})}catch(_){console.error("Failed to track click:",_)}p.target.closest("a")||window.open(e,"_blank","noopener,noreferrer")},[r,e,n,d,l]);return t.jsx("div",{ref:h,className:o,onClick:c,style:{cursor:"pointer",...s},children:i})};X.displayName="AdMeshLinkTracker";const Me=`
|
|
27
27
|
/* AdMesh UI SDK - Complete Self-Contained Styles */
|
|
28
28
|
|
|
29
29
|
/* CSS Reset for AdMesh components */
|
|
@@ -31,39 +31,43 @@ React keys must be passed directly to JSX without using spread:
|
|
|
31
31
|
box-sizing: border-box;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
/* CSS Variables */
|
|
34
|
+
/* CSS Variables - Black/White Color Scheme */
|
|
35
35
|
.admesh-component {
|
|
36
|
-
--admesh-primary: #
|
|
37
|
-
--admesh-primary-hover: #
|
|
38
|
-
--admesh-secondary: #
|
|
39
|
-
--admesh-accent: #
|
|
36
|
+
--admesh-primary: #000000;
|
|
37
|
+
--admesh-primary-hover: #333333;
|
|
38
|
+
--admesh-secondary: #666666;
|
|
39
|
+
--admesh-accent: #000000;
|
|
40
40
|
--admesh-background: #ffffff;
|
|
41
41
|
--admesh-surface: #ffffff;
|
|
42
|
-
--admesh-border: #
|
|
43
|
-
--admesh-text: #
|
|
44
|
-
--admesh-text-muted: #
|
|
45
|
-
--admesh-text-light: #
|
|
42
|
+
--admesh-border: #e5e7eb;
|
|
43
|
+
--admesh-text: #000000;
|
|
44
|
+
--admesh-text-muted: #666666;
|
|
45
|
+
--admesh-text-light: #999999;
|
|
46
46
|
--admesh-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
|
|
47
47
|
--admesh-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
|
|
48
48
|
--admesh-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
|
|
49
49
|
--admesh-shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
|
|
50
|
-
--admesh-radius: 0.
|
|
51
|
-
--admesh-radius-sm: 0.
|
|
52
|
-
--admesh-radius-lg:
|
|
53
|
-
--admesh-radius-xl:
|
|
50
|
+
--admesh-radius: 0.5rem;
|
|
51
|
+
--admesh-radius-sm: 0.25rem;
|
|
52
|
+
--admesh-radius-lg: 0.75rem;
|
|
53
|
+
--admesh-radius-xl: 1rem;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
.admesh-component[data-admesh-theme="dark"] {
|
|
57
|
-
--admesh-
|
|
58
|
-
--admesh-
|
|
59
|
-
--admesh-
|
|
60
|
-
--admesh-
|
|
57
|
+
--admesh-primary: #ffffff;
|
|
58
|
+
--admesh-primary-hover: #e5e7eb;
|
|
59
|
+
--admesh-secondary: #9ca3af;
|
|
60
|
+
--admesh-accent: #ffffff;
|
|
61
|
+
--admesh-background: #000000;
|
|
62
|
+
--admesh-surface: #111111;
|
|
63
|
+
--admesh-border: #333333;
|
|
64
|
+
--admesh-text: #ffffff;
|
|
61
65
|
--admesh-text-muted: #9ca3af;
|
|
62
|
-
--admesh-text-light: #
|
|
63
|
-
--admesh-shadow: 0 1px 3px 0 rgb(
|
|
64
|
-
--admesh-shadow-md: 0 4px 6px -1px rgb(
|
|
65
|
-
--admesh-shadow-lg: 0 10px 15px -3px rgb(
|
|
66
|
-
--admesh-shadow-xl: 0 20px 25px -5px rgb(
|
|
66
|
+
--admesh-text-light: #666666;
|
|
67
|
+
--admesh-shadow: 0 1px 3px 0 rgb(255 255 255 / 0.1), 0 1px 2px -1px rgb(255 255 255 / 0.1);
|
|
68
|
+
--admesh-shadow-md: 0 4px 6px -1px rgb(255 255 255 / 0.1), 0 2px 4px -2px rgb(255 255 255 / 0.1);
|
|
69
|
+
--admesh-shadow-lg: 0 10px 15px -3px rgb(255 255 255 / 0.1), 0 4px 6px -4px rgb(255 255 255 / 0.1);
|
|
70
|
+
--admesh-shadow-xl: 0 20px 25px -5px rgb(255 255 255 / 0.1), 0 8px 10px -6px rgb(255 255 255 / 0.1);
|
|
67
71
|
}
|
|
68
72
|
|
|
69
73
|
/* Layout Styles */
|
|
@@ -211,7 +215,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
211
215
|
|
|
212
216
|
.admesh-product-card__match-score-fill {
|
|
213
217
|
height: 100%;
|
|
214
|
-
background:
|
|
218
|
+
background: var(--admesh-primary);
|
|
215
219
|
border-radius: var(--admesh-radius-sm);
|
|
216
220
|
transition: width 0.3s ease-in-out;
|
|
217
221
|
}
|
|
@@ -266,7 +270,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
266
270
|
}
|
|
267
271
|
|
|
268
272
|
.admesh-component[data-admesh-theme="dark"] .admesh-product-card__button:hover {
|
|
269
|
-
background:
|
|
273
|
+
background: var(--admesh-primary-hover);
|
|
270
274
|
}
|
|
271
275
|
|
|
272
276
|
.admesh-product-card__footer {
|
|
@@ -386,8 +390,8 @@ React keys must be passed directly to JSX without using spread:
|
|
|
386
390
|
align-items: center;
|
|
387
391
|
gap: 0.5rem;
|
|
388
392
|
padding: 0.75rem 1.5rem;
|
|
389
|
-
background:
|
|
390
|
-
color:
|
|
393
|
+
background: var(--admesh-primary);
|
|
394
|
+
color: var(--admesh-background);
|
|
391
395
|
font-size: 0.875rem;
|
|
392
396
|
font-weight: 500;
|
|
393
397
|
border: none;
|
|
@@ -594,15 +598,11 @@ React keys must be passed directly to JSX without using spread:
|
|
|
594
598
|
.admesh-component .bg-green-500 { background-color: #22c55e; }
|
|
595
599
|
.admesh-component .bg-blue-500 { background-color: #3b82f6; }
|
|
596
600
|
|
|
597
|
-
/*
|
|
598
|
-
.admesh-component .bg-
|
|
599
|
-
.admesh-component .bg-
|
|
600
|
-
.admesh-component .
|
|
601
|
-
.admesh-component .
|
|
602
|
-
.admesh-component .from-purple-500 { --tw-gradient-from: #a855f7; --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgba(168, 85, 247, 0)); }
|
|
603
|
-
.admesh-component .to-pink-500 { --tw-gradient-to: #ec4899; }
|
|
604
|
-
.admesh-component .from-green-400 { --tw-gradient-from: #4ade80; --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgba(74, 222, 128, 0)); }
|
|
605
|
-
.admesh-component .to-blue-500 { --tw-gradient-to: #3b82f6; }
|
|
601
|
+
/* Solid backgrounds - no gradients for minimal design */
|
|
602
|
+
.admesh-component .bg-primary { background-color: var(--admesh-primary); }
|
|
603
|
+
.admesh-component .bg-secondary { background-color: var(--admesh-secondary); }
|
|
604
|
+
.admesh-component .bg-surface { background-color: var(--admesh-surface); }
|
|
605
|
+
.admesh-component .bg-background { background-color: var(--admesh-background); }
|
|
606
606
|
|
|
607
607
|
/* Text utilities */
|
|
608
608
|
.admesh-component .text-xs { font-size: 0.75rem; line-height: 1rem; }
|
|
@@ -691,7 +691,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
691
691
|
.admesh-component .lg\\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
|
692
692
|
.admesh-component .lg\\:col-span-1 { grid-column: span 1 / span 1; }
|
|
693
693
|
}
|
|
694
|
-
`;let ae=!1;const fe=()=>{y.useEffect(()=>{if(ae)return;const e=document.createElement("style");return e.id="admesh-ui-sdk-styles",e.textContent=Me,document.getElementById("admesh-ui-sdk-styles")||(document.head.appendChild(e),ae=!0),()=>{const t=document.getElementById("admesh-ui-sdk-styles");t&&document.head.contains(t)&&(document.head.removeChild(t),ae=!1)}},[])},q=(e,t={})=>{const o=e.intent_match_score||0,d=t.customLabels||{};return o>=.8?d.partnerRecommendation||"Sponsored":o>=.6?d.partnerMatch||"Partner Match":o>=.3?d.promotedOption||"Promoted":d.relatedOption||"Related"},se=(e,t)=>{const o=e.intent_match_score||0;return o>=.8?"This recommendation is from a partner who compensates us when you engage. We've matched it to your needs based on your query.":o>=.6?"Top-rated partner solution matched to your specific requirements. Partner compensates us for qualified referrals.":o>=.3?"This partner solution may be relevant to your needs. The partner compensates us when you take qualifying actions.":"This solution is somewhat related to your query. While not a perfect match, it might still be helpful. This partner compensates us for qualified referrals."},Ee=(e=!0,t=!1)=>e?t?"These curated recommendations are from partners who compensate us for referrals.":"Personalized Sponsoreds: All results are from vetted partners who compensate us for qualified matches. We've ranked them based on relevance to your specific needs.":"Expanded Results: While these don't perfectly match your query, they're related solutions from our partner network. All partners compensate us for referrals.",Pe=(e,t=!1)=>{const o=e.intent_match_score||0;return t?"Promoted":o>=.8?"Smart Recommendation":o>=.6?"Partner Match":"Promoted"},Ie=()=>"We've partnered with trusted providers to bring you relevant solutions. These partners compensate us for qualified referrals, which helps us keep our service free.",Fe=e=>({"Top Match":"Top Match",Sponsored:"Sponsored","Perfect Fit":"Perfect Fit","Great Match":"Great Match",Recommended:"Recommended","Good Fit":"Good Fit",Featured:"Featured","Popular Choice":"Popular Choice","Premium Pick":"Premium Pick","Free Tier":"Free Tier","AI Powered":"AI Powered",Popular:"Popular",New:"New","Trial Available":"Trial Available","Related Option":"Related Option","Alternative Solution":"Alternative Solution","Expanded Match":"Expanded Match"})[e]||e,Le=(e,t="button")=>{const o=e.recommendation_title||e.title;return t==="link"?o:e.trial_days&&e.trial_days>0?`Try ${o}`:"Learn More"},Oe=e=>e.some(t=>(t.intent_match_score||0)>=.8),ze=(e=!1)=>e?"":"Recommendations ",H=({recommendation:e,theme:t,showMatchScore:o=!1,showBadges:d=!0,variation:i="default",expandable:n=!1,className:s,style:l})=>{var f,T,j,k,A,z,U,$,I,D,F,m,S,R;fe();const[g,u]=y.useState(!1);y.useMemo(()=>{var W;const C=[];q(e)==="Sponsored"&&C.push("Top Match"),e.trial_days&&e.trial_days>0&&C.push("Trial Available");const N=["ai","artificial intelligence","machine learning","ml","automation"];return(((W=e.keywords)==null?void 0:W.some(E=>N.some(K=>E.toLowerCase().includes(K))))||e.title.toLowerCase().includes("ai"))&&C.push("AI Powered"),e.badges&&e.badges.length>0&&e.badges.forEach(E=>{["Top Match","Free Tier","AI Powered","Popular","New","Trial Available"].includes(E)&&!C.includes(E)&&C.push(E)}),C},[e]),Math.round(e.intent_match_score*100);const c=i==="simple"?{title:e.recommendation_title||e.title,description:e.recommendation_description||e.description||e.reason,ctaText:e.recommendation_title||e.title,isSimple:!0}:{title:e.recommendation_title||e.title,description:e.recommendation_description||e.description||e.reason,ctaText:e.recommendation_title||e.title},h=O("admesh-component","admesh-card","relative p-4 sm:p-5 rounded-xl bg-gradient-to-br from-white to-gray-50 dark:from-slate-800 dark:to-slate-900 border border-gray-200/50 dark:border-slate-700/50 shadow-lg hover:shadow-xl transition-all duration-300 hover:-translate-y-1",s),w=t?{"--admesh-primary":t.primaryColor||t.accentColor||"#3b82f6","--admesh-secondary":t.secondaryColor||"#10b981","--admesh-accent":t.accentColor||"#3b82f6","--admesh-background":t.backgroundColor,"--admesh-surface":t.surfaceColor,"--admesh-border":t.borderColor,"--admesh-text":t.textColor,"--admesh-text-secondary":t.textSecondaryColor,"--admesh-radius":t.borderRadius||"12px","--admesh-shadow-sm":(f=t.shadows)==null?void 0:f.small,"--admesh-shadow-md":(T=t.shadows)==null?void 0:T.medium,"--admesh-shadow-lg":(j=t.shadows)==null?void 0:j.large,"--admesh-spacing-sm":(k=t.spacing)==null?void 0:k.small,"--admesh-spacing-md":(A=t.spacing)==null?void 0:A.medium,"--admesh-spacing-lg":(z=t.spacing)==null?void 0:z.large,"--admesh-font-size-sm":(U=t.fontSize)==null?void 0:U.small,"--admesh-font-size-base":($=t.fontSize)==null?void 0:$.base,"--admesh-font-size-lg":(I=t.fontSize)==null?void 0:I.large,"--admesh-font-size-title":(D=t.fontSize)==null?void 0:D.title,fontFamily:t.fontFamily,width:((m=(F=t.components)==null?void 0:F.productCard)==null?void 0:m.width)||"100%"}:{width:"100%"};return i==="simple"?r.jsxs("div",{className:O("admesh-component admesh-simple-ad","inline-block text-sm leading-relaxed",s),style:{fontFamily:(t==null?void 0:t.fontFamily)||'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',...(S=t==null?void 0:t.components)==null?void 0:S.productCard,...l},"data-admesh-theme":t==null?void 0:t.mode,children:[r.jsx("span",{style:{fontSize:"11px",fontWeight:"600",color:(t==null?void 0:t.accentColor)||"#2563eb",backgroundColor:(t==null?void 0:t.mode)==="dark"?"#374151":"#f3f4f6",padding:"2px 6px",borderRadius:"4px",marginRight:"8px"},title:se(e,q(e)),children:q(e)}),r.jsxs("span",{style:{color:(t==null?void 0:t.mode)==="dark"?"#f3f4f6":"#374151",marginRight:"4px"},children:[c.description," "]}),r.jsx(J,{adId:e.ad_id,admeshLink:e.admesh_link,productId:e.product_id,trackingData:{title:e.title,matchScore:e.intent_match_score,component:"simple_ad_cta"},children:r.jsx("span",{style:{color:(t==null?void 0:t.accentColor)||"#2563eb",textDecoration:"underline",cursor:"pointer",fontSize:"inherit",fontFamily:"inherit"},children:c.ctaText})}),r.jsx("span",{style:{fontSize:"10px",color:(t==null?void 0:t.mode)==="dark"?"#9ca3af":"#6b7280",marginLeft:"8px"},children:"(Sponsored )"})]}):r.jsx("div",{className:h,style:{fontFamily:(t==null?void 0:t.fontFamily)||'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',...(R=t==null?void 0:t.components)==null?void 0:R.productCard,...l},"data-admesh-theme":t==null?void 0:t.mode,children:r.jsxs("div",{className:"h-full flex flex-col",style:w,children:[r.jsx("div",{className:"mb-3",children:r.jsx("span",{style:{fontSize:"11px",fontWeight:"600",color:(t==null?void 0:t.accentColor)||"#2563eb",backgroundColor:(t==null?void 0:t.mode)==="dark"?"#374151":"#f3f4f6",padding:"2px 6px",borderRadius:"4px"},title:se(e,q(e)),children:q(e)})}),r.jsxs("div",{className:"flex justify-between items-center gap-3 mb-4",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[e.product_logo&&r.jsx("img",{src:e.product_logo.url,alt:`${e.title} logo`,className:"w-6 h-6 rounded flex-shrink-0",onError:C=>{C.target.style.display="none"}}),r.jsx("h4",{className:"font-semibold text-gray-800 dark:text-gray-200 text-sm sm:text-base truncate",children:c.title})]}),r.jsx("div",{className:"flex-shrink-0",children:r.jsx(J,{adId:e.ad_id,admeshLink:e.admesh_link,productId:e.product_id,trackingData:{title:e.title,matchScore:e.intent_match_score,component:"product_card_cta"},children:r.jsxs("button",{className:"text-xs px-2 py-1 sm:px-3 sm:py-2 rounded-full bg-gradient-to-r from-purple-500 to-pink-500 text-white hover:from-purple-600 hover:to-pink-600 flex items-center transition-all duration-200 transform hover:scale-105 shadow-md hover:shadow-lg whitespace-nowrap",children:["Visit",r.jsx("svg",{className:"ml-1 h-3 w-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})})})]}),r.jsx("div",{className:"mb-6",children:r.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 leading-relaxed",children:c.description})}),e.features&&e.features.length>0&&r.jsxs("div",{className:"mb-3",children:[r.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300 mb-2 font-medium",children:"✨ Key Features"}),r.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.features.slice(0,4).map((C,B)=>r.jsxs("span",{className:"text-xs px-2 py-1 rounded-full bg-gradient-to-r from-indigo-100 to-purple-100 dark:from-indigo-900/30 dark:to-purple-900/30 text-indigo-700 dark:text-indigo-300 border border-indigo-200 dark:border-indigo-700",children:[r.jsx("svg",{className:"h-3 w-3 mr-0.5 inline text-indigo-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),C]},B)),e.features.length>4&&r.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400 px-2 py-1",children:["+",e.features.length-4," more"]})]})]}),r.jsx("div",{className:"mt-auto pt-3 border-t border-gray-100 dark:border-slate-700",children:r.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-500 dark:text-gray-400",children:[r.jsx("span",{children:"Sponsored"}),r.jsx("span",{className:"text-gray-400 dark:text-gray-500"})]})})]})})};H.displayName="AdMeshProductCard";const ge=({products:e=[],recommendations:t=[],title:o="Product Recommendations",showTitle:d=!0,className:i="",cardClassName:n="",onProductClick:s,showPricing:l=!0,showRatings:g=!0,showBrand:u=!0,showSource:x=!1,showShipping:c=!0,maxCards:h=10,cardWidth:w="md",theme:f="auto",borderRadius:T="md",shadow:j="sm"})=>{const k=t.length>0?t.slice(0,h):e.slice(0,h),A=()=>{switch(w){case"sm":return"w-48 min-w-48";case"md":return"w-64 min-w-64";case"lg":return"w-80 min-w-80";default:return"w-64 min-w-64"}},z=()=>{switch(T){case"none":return"rounded-none";case"sm":return"rounded-sm";case"md":return"rounded-lg";case"lg":return"rounded-xl";default:return"rounded-lg"}},U=()=>{switch(j){case"none":return"";case"sm":return"shadow-sm hover:shadow-md";case"md":return"shadow-md hover:shadow-lg";case"lg":return"shadow-lg hover:shadow-xl";default:return"shadow-sm hover:shadow-md"}},$=()=>f==="dark"?"bg-gray-900 text-white":f==="light"?"bg-white text-gray-900":"bg-white dark:bg-gray-900 text-gray-900 dark:text-white",I=m=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:2}).format(m),D=m=>{const S=[],R=Math.floor(m),C=m%1!==0;for(let N=0;N<R;N++)S.push(r.jsx("span",{className:"text-yellow-400",children:"★"},N));C&&S.push(r.jsx("span",{className:"text-yellow-400",children:"☆"},"half"));const B=5-Math.ceil(m);for(let N=0;N<B;N++)S.push(r.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"☆"},`empty-${N}`));return S},F=m=>{if(s)s(m);else{const S=m.admesh_link||m.url;S&&window.open(S,"_blank","noopener,noreferrer")}};return(!e||e.length===0)&&(!t||t.length===0)?null:r.jsxs("div",{className:O("w-full",i),children:[d&&r.jsxs("div",{className:"mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:o}),r.jsx("div",{className:"mt-1 h-0.5 w-12 bg-blue-500"})]}),r.jsxs("div",{className:"relative",children:[k.length===0?r.jsx("div",{className:"text-center py-8 text-gray-500",children:"No products to display"}):r.jsx("div",{className:"flex gap-4 overflow-x-auto pb-4 scrollbar-hide",children:k.map(m=>{var R;const S=m.product_id||m.id||m.ad_id;return r.jsxs("div",{className:O(A(),z(),U(),$(),"flex-shrink-0 border border-gray-200 dark:border-gray-700 transition-all duration-200 cursor-pointer hover:scale-[1.02]",n),onClick:()=>F(m),children:[r.jsxs("div",{className:"relative aspect-square w-full overflow-hidden",children:[m.image_url?r.jsx("img",{src:m.image_url,alt:m.title,className:"h-full w-full object-cover transition-transform duration-200 hover:scale-105",loading:"lazy"}):r.jsx("div",{className:"flex h-full w-full items-center justify-center bg-gray-100 dark:bg-gray-800",children:r.jsx("svg",{className:"h-12 w-12 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),l&&m.discount_percentage&&m.discount_percentage>0&&r.jsxs("div",{className:"absolute top-2 left-2 bg-red-500 text-white text-xs font-bold px-2 py-1 rounded",children:["-",Math.round(m.discount_percentage),"%"]}),x&&m.source&&r.jsx("div",{className:"absolute top-2 right-2 bg-blue-500 text-white text-xs font-medium px-2 py-1 rounded",children:m.source.toUpperCase()})]}),r.jsxs("div",{className:"p-3",children:[u&&m.brand&&r.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1 uppercase tracking-wide",children:m.brand}),r.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white line-clamp-2 mb-2 leading-tight",children:m.title}),g&&m.rating&&r.jsxs("div",{className:"flex items-center gap-1 mb-2",children:[r.jsx("div",{className:"flex text-sm",children:D(m.rating)}),r.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["(",m.review_count||0,")"]})]}),l&&m.price&&r.jsx("div",{className:"mb-2",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-lg font-bold text-gray-900 dark:text-white",children:I(m.price)}),m.original_price&&m.original_price>m.price&&r.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400 line-through",children:I(m.original_price)})]})}),c&&((R=m.shipping_info)==null?void 0:R.free_shipping_over_35)&&r.jsx("div",{className:"text-xs text-green-600 dark:text-green-400 font-medium",children:"Free shipping over $35"}),m.availability&&m.availability!=="unknown"&&r.jsx("div",{className:O("text-xs font-medium mt-1",m.availability==="in_stock"?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"),children:m.availability==="in_stock"?"In Stock":"Out of Stock"})]})]},S)})}),k.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"absolute top-1/2 -left-2 transform -translate-y-1/2 bg-white dark:bg-gray-800 rounded-full shadow-lg p-1 opacity-0 group-hover:opacity-100 transition-opacity",children:r.jsx("svg",{className:"w-4 h-4 text-gray-600 dark:text-gray-300",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),r.jsx("div",{className:"absolute top-1/2 -right-2 transform -translate-y-1/2 bg-white dark:bg-gray-800 rounded-full shadow-lg p-1 opacity-0 group-hover:opacity-100 transition-opacity",children:r.jsx("svg",{className:"w-4 h-4 text-gray-600 dark:text-gray-300",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),r.jsxs("div",{className:"flex justify-between items-center mt-3 pt-2 border-t border-gray-200 dark:border-gray-700",children:[r.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Sponsored"}),r.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500"})]}),r.jsx("style",{dangerouslySetInnerHTML:{__html:`
|
|
694
|
+
`;let oe=!1;const fe=()=>{y.useEffect(()=>{if(oe)return;const r=document.createElement("style");return r.id="admesh-ui-sdk-styles",r.textContent=Me,document.getElementById("admesh-ui-sdk-styles")||(document.head.appendChild(r),oe=!0),()=>{const e=document.getElementById("admesh-ui-sdk-styles");e&&document.head.contains(e)&&(document.head.removeChild(e),oe=!1)}},[])},W=(r,e={})=>{const n=r.intent_match_score||0,i=e.customLabels||{};return n>=.8?i.partnerRecommendation||"Smart Pick":n>=.6?i.partnerMatch||"Partner Recommendation":n>=.3?i.promotedOption||"Promoted Match":i.relatedOption||"Related"},ie=(r,e)=>{const n=r.intent_match_score||0;return n>=.8?"This recommendation is from a partner who compensates us when you engage. We've matched it to your needs based on your query.":n>=.6?"Top-rated partner solution matched to your specific requirements. Partner compensates us for qualified referrals.":n>=.3?"This partner solution may be relevant to your needs. The partner compensates us when you take qualifying actions.":"This solution is somewhat related to your query. While not a perfect match, it might still be helpful. This partner compensates us for qualified referrals."},Ee=(r=!0,e=!1)=>r?e?"These curated recommendations are from partners who compensate us for referrals.":"Personalized Sponsoreds: All results are from vetted partners who compensate us for qualified matches. We've ranked them based on relevance to your specific needs.":"Expanded Results: While these don't perfectly match your query, they're related solutions from our partner network. All partners compensate us for referrals.",Pe=(r,e=!1)=>{const n=r.intent_match_score||0;return e?"Promoted Match":n>=.8?"Smart Pick":n>=.6?"Partner Recommendation":"Promoted Match"},Ie=()=>"We've partnered with trusted providers to bring you relevant solutions. These partners compensate us for qualified referrals, which helps us keep our service free.",Fe=r=>({"Top Match":"Smart Pick",Sponsored:"Smart Pick","Perfect Fit":"Smart Pick","Great Match":"Partner Recommendation",Recommended:"Partner Recommendation","Good Fit":"Promoted Match",Featured:"Promoted Match","Popular Choice":"Popular Choice","Premium Pick":"Premium Pick","Free Tier":"Free Tier","AI Powered":"AI Powered",Popular:"Popular",New:"New","Trial Available":"Trial Available","Related Option":"Related Option","Alternative Solution":"Alternative Solution","Expanded Match":"Expanded Match"})[r]||r,Le=(r,e="button")=>{const n=r.recommendation_title||r.title;return e==="link"?n:r.trial_days&&r.trial_days>0?`Try ${n}`:"Learn More"},Oe=r=>r.some(e=>(e.intent_match_score||0)>=.8),ze=(r=!1)=>r?"":"Recommendations ",K=({recommendation:r,theme:e,showMatchScore:n=!1,showBadges:i=!0,showFeatures:d=!1,variation:o="default",expandable:s=!1,className:l,style:f})=>{var _,g,j,A,U,$,D,I,B,F,m,T,R,L,V,N,Y,H;fe();const[h,b]=y.useState(!1);y.useMemo(()=>{var u;const S=[],E=W(r);(E==="Smart Pick"||E==="Partner Recommendation"||E==="Promoted Match")&&S.push("Top Match"),r.trial_days&&r.trial_days>0&&S.push("Trial Available");const Q=["ai","artificial intelligence","machine learning","ml","automation"];return(((u=r.keywords)==null?void 0:u.some(x=>Q.some(k=>x.toLowerCase().includes(k))))||r.title.toLowerCase().includes("ai"))&&S.push("AI Powered"),r.badges&&r.badges.length>0&&r.badges.forEach(x=>{["Top Match","Free Tier","AI Powered","Popular","New","Trial Available"].includes(x)&&!S.includes(x)&&S.push(x)}),S},[r]),Math.round((((_=r.meta)==null?void 0:_.intent_match_score)||r.intent_match_score||0)*100);const p=o==="simple"?{title:r.recommendation_title||r.title,description:r.recommendation_description||r.description||r.reason,ctaText:r.recommendation_title||r.title,isSimple:!0}:{title:r.recommendation_title||r.title,description:r.recommendation_description||r.description||r.reason,ctaText:r.recommendation_title||r.title},v=z("admesh-component","admesh-card","relative p-3 sm:p-4 rounded-xl bg-gradient-to-br from-white to-gray-50 dark:from-slate-800 dark:to-slate-900 border border-gray-200/50 dark:border-slate-700/50 shadow-lg hover:shadow-xl transition-all duration-300 hover:-translate-y-1",l),w=e?{"--admesh-primary":e.primaryColor||e.accentColor||"#3b82f6","--admesh-secondary":e.secondaryColor||"#10b981","--admesh-accent":e.accentColor||"#3b82f6","--admesh-background":e.backgroundColor,"--admesh-surface":e.surfaceColor,"--admesh-border":e.borderColor,"--admesh-text":e.textColor,"--admesh-text-secondary":e.textSecondaryColor,"--admesh-radius":e.borderRadius||"12px","--admesh-shadow-sm":(g=e.shadows)==null?void 0:g.small,"--admesh-shadow-md":(j=e.shadows)==null?void 0:j.medium,"--admesh-shadow-lg":(A=e.shadows)==null?void 0:A.large,"--admesh-spacing-sm":(U=e.spacing)==null?void 0:U.small,"--admesh-spacing-md":($=e.spacing)==null?void 0:$.medium,"--admesh-spacing-lg":(D=e.spacing)==null?void 0:D.large,"--admesh-font-size-sm":(I=e.fontSize)==null?void 0:I.small,"--admesh-font-size-base":(B=e.fontSize)==null?void 0:B.base,"--admesh-font-size-lg":(F=e.fontSize)==null?void 0:F.large,"--admesh-font-size-title":(m=e.fontSize)==null?void 0:m.title,fontFamily:e.fontFamily,width:((R=(T=e.components)==null?void 0:T.productCard)==null?void 0:R.width)||"100%"}:{width:"100%"};return o==="simple"?t.jsxs("div",{className:z("admesh-component admesh-simple-ad","inline-block text-sm leading-relaxed",l),style:{fontFamily:(e==null?void 0:e.fontFamily)||'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',...(L=e==null?void 0:e.components)==null?void 0:L.productCard,...f},"data-admesh-theme":e==null?void 0:e.mode,children:[t.jsx("span",{style:{fontSize:"11px",fontWeight:"600",color:(e==null?void 0:e.mode)==="dark"?"#000000":"#ffffff",backgroundColor:(e==null?void 0:e.mode)==="dark"?"#ffffff":"#000000",padding:"2px 6px",borderRadius:"4px",marginRight:"8px"},title:ie(r,W(r)),children:W(r)}),t.jsxs("span",{style:{color:(e==null?void 0:e.mode)==="dark"?"#f3f4f6":"#374151",marginRight:"4px"},children:[p.description," "]}),t.jsx(X,{adId:((V=r.meta)==null?void 0:V.ad_id)||r.ad_id||"",admeshLink:r.admesh_link,productId:r.product_id,trackingData:{title:r.title,matchScore:r.intent_match_score,component:"simple_ad_cta"},children:t.jsx("span",{style:{color:(e==null?void 0:e.mode)==="dark"?"#ffffff":"#000000",textDecoration:"underline",cursor:"pointer",fontSize:"inherit",fontFamily:"inherit"},children:p.ctaText})})]}):t.jsx("div",{className:v,style:{fontFamily:(e==null?void 0:e.fontFamily)||'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',...(N=e==null?void 0:e.components)==null?void 0:N.productCard,...f},"data-admesh-theme":e==null?void 0:e.mode,children:t.jsxs("div",{className:"h-full flex flex-col",style:w,children:[t.jsx("div",{className:"mb-1.5",children:t.jsx("span",{style:{fontSize:"11px",fontWeight:"600",color:(e==null?void 0:e.mode)==="dark"?"#000000":"#ffffff",backgroundColor:(e==null?void 0:e.mode)==="dark"?"#ffffff":"#000000",padding:"2px 6px",borderRadius:"4px"},title:ie(r,W(r)),children:W(r)})}),t.jsxs("div",{className:"flex justify-between items-center gap-3 mb-2",children:[t.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[r.product_logo&&t.jsx("img",{src:r.product_logo.url,alt:`${r.title} logo`,className:"w-6 h-6 rounded flex-shrink-0",onError:S=>{S.target.style.display="none"}}),t.jsx("h4",{className:"font-semibold text-gray-800 dark:text-gray-200 text-sm sm:text-base truncate",children:p.title})]}),t.jsx("div",{className:"flex-shrink-0",children:t.jsx(X,{adId:((Y=r.meta)==null?void 0:Y.ad_id)||r.ad_id||"",admeshLink:r.admesh_link,productId:r.product_id,trackingData:{title:r.title,matchScore:((H=r.meta)==null?void 0:H.intent_match_score)||r.intent_match_score,component:"product_card_cta"},children:t.jsxs("button",{className:"text-xs px-2 py-1 sm:px-3 sm:py-2 rounded-full flex items-center transition-all duration-200 transform hover:scale-105 shadow-md hover:shadow-lg whitespace-nowrap",style:{backgroundColor:(e==null?void 0:e.accentColor)||"#000000",color:(e==null?void 0:e.mode)==="dark"?"#000000":"#ffffff"},children:["Visit",t.jsx("svg",{className:"ml-1 h-3 w-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})})})]}),t.jsx("div",{className:"mb-3",children:t.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 leading-snug",children:p.description})}),d&&r.features&&r.features.length>0&&t.jsxs("div",{className:"mb-2",children:[t.jsx("div",{className:"text-xs font-medium mb-1.5",style:{color:(e==null?void 0:e.mode)==="dark"?"#9ca3af":"#666666"},children:"Key Features"}),t.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[r.features.slice(0,4).map((S,E)=>t.jsxs("span",{className:"text-xs px-2 py-1 rounded-full border",style:{backgroundColor:(e==null?void 0:e.mode)==="dark"?"#111111":"#f5f5f5",color:(e==null?void 0:e.mode)==="dark"?"#ffffff":"#000000",borderColor:(e==null?void 0:e.mode)==="dark"?"#333333":"#e5e7eb"},children:[t.jsx("svg",{className:"h-3 w-3 mr-0.5 inline",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),S]},E)),r.features.length>4&&t.jsxs("span",{className:"text-xs px-2 py-1",style:{color:(e==null?void 0:e.mode)==="dark"?"#9ca3af":"#666666"},children:["+",r.features.length-4," more"]})]})]}),t.jsx("div",{className:"mt-auto pt-3 border-t border-gray-100 dark:border-slate-700",children:t.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-500 dark:text-gray-400",children:[t.jsx("span",{children:"Sponsored"}),t.jsx("span",{className:"text-gray-400 dark:text-gray-500"})]})})]})})};K.displayName="AdMeshProductCard";const ge=({products:r=[],recommendations:e=[],title:n="Product Recommendations",showTitle:i=!0,className:d="",cardClassName:o="",onProductClick:s,showPricing:l=!0,showRatings:f=!0,showBrand:h=!0,showSource:b=!1,showShipping:c=!0,maxCards:p=10,cardWidth:v="md",theme:w="auto",borderRadius:_="md",shadow:g="sm"})=>{const j=e.length>0?e.slice(0,p):r.slice(0,p),A=()=>{switch(v){case"sm":return"w-48 min-w-48";case"md":return"w-64 min-w-64";case"lg":return"w-80 min-w-80";default:return"w-64 min-w-64"}},U=()=>{switch(_){case"none":return"rounded-none";case"sm":return"rounded-sm";case"md":return"rounded-lg";case"lg":return"rounded-xl";default:return"rounded-lg"}},$=()=>{switch(g){case"none":return"";case"sm":return"shadow-sm hover:shadow-md";case"md":return"shadow-md hover:shadow-lg";case"lg":return"shadow-lg hover:shadow-xl";default:return"shadow-sm hover:shadow-md"}},D=()=>w==="dark"?"bg-gray-900 text-white":w==="light"?"bg-white text-gray-900":"bg-white dark:bg-gray-900 text-gray-900 dark:text-white",I=m=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:2}).format(m),B=m=>{const T=[],R=Math.floor(m),L=m%1!==0;for(let N=0;N<R;N++)T.push(t.jsx("span",{className:"text-yellow-400",children:"★"},N));L&&T.push(t.jsx("span",{className:"text-yellow-400",children:"☆"},"half"));const V=5-Math.ceil(m);for(let N=0;N<V;N++)T.push(t.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"☆"},`empty-${N}`));return T},F=m=>{if(s)s(m);else{const T=m.admesh_link||m.url;T&&window.open(T,"_blank","noopener,noreferrer")}};return(!r||r.length===0)&&(!e||e.length===0)?null:t.jsxs("div",{className:z("w-full",d),children:[i&&t.jsxs("div",{className:"mb-4",children:[t.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:n}),t.jsx("div",{className:"mt-1 h-0.5 w-12 bg-blue-500"})]}),t.jsxs("div",{className:"relative",children:[j.length===0?t.jsx("div",{className:"text-center py-8 text-gray-500",children:"No products to display"}):t.jsx("div",{className:"flex gap-4 overflow-x-auto pb-4 scrollbar-hide",children:j.map(m=>{var R;const T=m.product_id||m.id||m.ad_id;return t.jsxs("div",{className:z(A(),U(),$(),D(),"flex-shrink-0 border border-gray-200 dark:border-gray-700 transition-all duration-200 cursor-pointer hover:scale-[1.02]",o),onClick:()=>F(m),children:[t.jsxs("div",{className:"relative aspect-square w-full overflow-hidden",children:[m.image_url?t.jsx("img",{src:m.image_url,alt:m.title,className:"h-full w-full object-cover transition-transform duration-200 hover:scale-105",loading:"lazy"}):t.jsx("div",{className:"flex h-full w-full items-center justify-center bg-gray-100 dark:bg-gray-800",children:t.jsx("svg",{className:"h-12 w-12 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),l&&m.discount_percentage&&m.discount_percentage>0&&t.jsxs("div",{className:"absolute top-2 left-2 bg-red-500 text-white text-xs font-bold px-2 py-1 rounded",children:["-",Math.round(m.discount_percentage),"%"]}),b&&m.source&&t.jsx("div",{className:"absolute top-2 right-2 bg-blue-500 text-white text-xs font-medium px-2 py-1 rounded",children:m.source.toUpperCase()})]}),t.jsxs("div",{className:"p-3",children:[h&&m.brand&&t.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1 uppercase tracking-wide",children:m.brand}),t.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white line-clamp-2 mb-2 leading-tight",children:m.title}),f&&m.rating&&t.jsxs("div",{className:"flex items-center gap-1 mb-2",children:[t.jsx("div",{className:"flex text-sm",children:B(m.rating)}),t.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["(",m.review_count||0,")"]})]}),l&&m.price&&t.jsx("div",{className:"mb-2",children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-lg font-bold text-gray-900 dark:text-white",children:I(m.price)}),m.original_price&&m.original_price>m.price&&t.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400 line-through",children:I(m.original_price)})]})}),c&&((R=m.shipping_info)==null?void 0:R.free_shipping_over_35)&&t.jsx("div",{className:"text-xs text-green-600 dark:text-green-400 font-medium",children:"Free shipping over $35"}),m.availability&&m.availability!=="unknown"&&t.jsx("div",{className:z("text-xs font-medium mt-1",m.availability==="in_stock"?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"),children:m.availability==="in_stock"?"In Stock":"Out of Stock"})]})]},T)})}),j.length>0&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"absolute top-1/2 -left-2 transform -translate-y-1/2 bg-white dark:bg-gray-800 rounded-full shadow-lg p-1 opacity-0 group-hover:opacity-100 transition-opacity",children:t.jsx("svg",{className:"w-4 h-4 text-gray-600 dark:text-gray-300",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),t.jsx("div",{className:"absolute top-1/2 -right-2 transform -translate-y-1/2 bg-white dark:bg-gray-800 rounded-full shadow-lg p-1 opacity-0 group-hover:opacity-100 transition-opacity",children:t.jsx("svg",{className:"w-4 h-4 text-gray-600 dark:text-gray-300",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),t.jsxs("div",{className:"flex justify-between items-center mt-3 pt-2 border-t border-gray-200 dark:border-gray-700",children:[t.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Sponsored"}),t.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500"})]}),t.jsx("style",{dangerouslySetInnerHTML:{__html:`
|
|
695
695
|
.scrollbar-hide {
|
|
696
696
|
-ms-overflow-style: none;
|
|
697
697
|
scrollbar-width: none;
|
|
@@ -705,5 +705,5 @@ React keys must be passed directly to JSX without using spread:
|
|
|
705
705
|
-webkit-box-orient: vertical;
|
|
706
706
|
overflow: hidden;
|
|
707
707
|
}
|
|
708
|
-
`}})]})},Ue=e=>{var d,i;const t=[];if(!e)return{isValid:!1,warnings:["No response object provided"]};(!e.recommendations||!Array.isArray(e.recommendations))&&t.push("No recommendations array found in response"),e.layout_type==="citation"&&!e.citation_summary&&t.push("Citation layout specified but no citation_summary provided");const o=((d=e.recommendations)==null?void 0:d.filter(n=>n&&n.admesh_link&&(n.title||n.recommendation_title)))||[];return o.length===0&&t.push("No valid recommendations found (missing admesh_link or title)"),{isValid:o.length>0,validCount:o.length,totalCount:((i=e.recommendations)==null?void 0:i.length)||0,warnings:t}},ie=({response:e,theme:t,className:o="",style:d={},onRecommendationClick:i,onLinkClick:n})=>{const s=Ue(e);if(s.warnings.length>0&&console.warn("[AdMesh Summary Layout] Validation warnings:",s.warnings),!s.isValid)return console.error("[AdMesh Summary Layout] Invalid response object"),r.jsx("div",{className:`admesh-summary-layout-error ${o}`,style:d,children:r.jsxs("div",{className:"text-center py-6 px-4 bg-gray-50 dark:bg-gray-800 rounded-lg",children:[r.jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"Unable to display recommendations"}),r.jsx("p",{className:"text-gray-500 dark:text-gray-500 text-xs mt-1",children:"Check console for details"})]})});const{layout_type:l="citation",citation_summary:g,recommendations:u=[],requires_summary:x=!0}=e;console.log(`[AdMesh Summary Layout] Rendering ${l} layout with ${s.validCount}/${s.totalCount} valid recommendations`);const c=()=>{switch(l){case"citation":return g&&x?r.jsx(oe,{summaryText:g,recommendations:u,theme:t,onLinkClick:n}):r.jsxs("div",{className:"fallback-citation",children:[r.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-3",children:"Based on your query, I'd recommend checking out these options:"}),r.jsx(H,{recommendation:u[0],theme:t})]});case"product_cards":case"product":return r.jsx("div",{className:"product-cards-layout",children:u.slice(0,3).map((h,w)=>r.jsx(H,{recommendation:h,theme:t,className:"mb-4"},h.ad_id||`rec-${w}`))});case"ecommerce":return r.jsx(ge,{recommendations:u.slice(0,3),theme:(t==null?void 0:t.mode)||"light"});default:return console.warn(`[AdMesh Summary Layout] Unknown layout type: ${l}`),g?r.jsx(oe,{summaryText:g,recommendations:u,theme:t,onLinkClick:n}):r.jsx(H,{recommendation:u[0],theme:t})}};return r.jsx("div",{className:`admesh-summary-layout admesh-layout-${l} ${o}`,style:{fontFamily:(t==null?void 0:t.fontFamily)||'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',...d},children:c()})},$e=({recommendations:e=[],citationSummary:t,layout:o,response:d,theme:i,className:n,style:s,onRecommendationClick:l,onLinkClick:g})=>{const u=l?c=>l(c.ad_id||"",c.admesh_link||""):void 0;if(d)return r.jsx(ie,{response:d,theme:i,className:n,style:s,onRecommendationClick:u,onLinkClick:g});const x={layout_type:o||"citation",citation_summary:t,recommendations:e,requires_summary:!!t};return r.jsx(ie,{response:x,theme:i,className:n,style:s,onRecommendationClick:u,onLinkClick:g})},xe=({recommendation:e,theme:t,variation:o="default",expandable:d=!1,className:i,style:n})=>{var c,h,w;const[s,l]=y.useState(!1),u=(()=>{const f=e.content_variations;return o==="question"&&(f!=null&&f.question)?{title:f.question.cta||e.recommendation_title||e.title,description:f.question.text,ctaText:f.question.cta||e.recommendation_title||e.title}:o==="statement"&&(f!=null&&f.statement)?{title:e.recommendation_title||e.title,description:f.statement.text,ctaText:f.statement.cta||e.recommendation_title||e.title}:{title:e.recommendation_title||e.title,description:e.recommendation_description||e.reason||"",ctaText:e.recommendation_title||e.title}})(),x=O("rounded-xl shadow-sm border border-gray-200 dark:border-gray-800 p-4 bg-white dark:bg-slate-900","hover:shadow-md transition-shadow duration-200",{"cursor-pointer":d&&(o==="question"||o==="statement")},i);return r.jsx("div",{className:x,style:{fontFamily:(t==null?void 0:t.fontFamily)||'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',width:((h=(c=t==null?void 0:t.components)==null?void 0:c.inlineRecommendation)==null?void 0:h.width)||"100%",...(w=t==null?void 0:t.components)==null?void 0:w.productCard,...n},"data-admesh-theme":t==null?void 0:t.mode,children:r.jsxs("div",{className:"h-full flex flex-col",children:[r.jsxs("div",{className:"flex justify-between items-center gap-3 mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[e.product_logo&&r.jsx("img",{src:e.product_logo.url,alt:`${e.title} logo`,className:"w-5 h-5 rounded flex-shrink-0",onError:f=>{f.target.style.display="none"}}),r.jsx("h4",{className:"font-semibold text-gray-800 dark:text-gray-200 text-sm truncate",children:u.title})]}),r.jsx("div",{className:"flex-shrink-0",children:r.jsx(J,{adId:e.ad_id,admeshLink:e.admesh_link,productId:e.product_id,trackingData:{title:e.title,matchScore:e.intent_match_score,component:"inline_card_cta"},children:r.jsxs("button",{className:"text-xs px-2 py-1 rounded-full bg-gradient-to-r from-purple-500 to-pink-500 text-white hover:from-purple-600 hover:to-pink-600 flex items-center transition-all duration-200 transform hover:scale-105 shadow-sm whitespace-nowrap",children:[o==="question"?"Try":"Visit",r.jsx("svg",{className:"ml-1 h-3 w-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})})})]}),u.description&&r.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-300 mb-2 line-clamp-2",children:u.description}),r.jsx("div",{className:"mt-auto pt-2 border-t border-gray-100 dark:border-slate-700",children:r.jsxs("div",{className:"flex items-center justify-between text-[11px] text-gray-500 dark:text-gray-400",children:[r.jsx("span",{children:"Sponsored"}),r.jsx("span",{className:"text-gray-400 dark:text-gray-500"})]})})]})})};xe.displayName="AdMeshInlineCard";const De={"Top Match":"primary","Free Tier":"success","AI Powered":"secondary",Popular:"warning",New:"primary","Trial Available":"success"},Be={"Top Match":"★","Free Tier":"◆","AI Powered":"◉",Popular:"▲",New:"●","Trial Available":"◈"},be=({type:e,variant:t,size:o="md",className:d,style:i})=>{const n=t||De[e]||"secondary",s=Be[e],l=O("admesh-component","admesh-badge",`admesh-badge--${n}`,`admesh-badge--${o}`,d);return r.jsxs("span",{className:l,style:i,children:[s&&r.jsx("span",{className:"admesh-badge__icon",children:s}),r.jsx("span",{className:"admesh-badge__text",children:e})]})};be.displayName="AdMeshBadge";const L=(e={})=>{const t={mode:"light",primaryColor:"#3b82f6",secondaryColor:"#10b981",accentColor:"#3b82f6",backgroundColor:"#ffffff",surfaceColor:"#f9fafb",borderColor:"#e5e7eb",textColor:"#111827",textSecondaryColor:"#6b7280",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontSize:{small:"12px",base:"14px",large:"16px",title:"18px"},borderRadius:"8px",spacing:{small:"4px",medium:"8px",large:"16px"},shadows:{small:"0 1px 3px rgba(0, 0, 0, 0.1)",medium:"0 4px 6px rgba(0, 0, 0, 0.1)",large:"0 10px 15px rgba(0, 0, 0, 0.1)"},icons:{expandIcon:"▼",collapseIcon:"▲",starIcon:"★",checkIcon:"✓",arrowIcon:"→"},gradients:{primary:"linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%)",secondary:"linear-gradient(135deg, #10b981 0%, #059669 100%)",accent:"linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%)"},components:{productCard:{width:"100%"},citationUnit:{width:"100%"},inlineRecommendation:{width:"100%"},expandableUnit:{width:"100%"},compareTable:{width:"100%"},card:{width:"auto"},button:{width:"auto"}}},o={...t,...e,fontSize:{...t.fontSize,...e.fontSize},spacing:{...t.spacing,...e.spacing},shadows:{...t.shadows,...e.shadows},icons:{...t.icons,...e.icons},components:{...t.components,...e.components}};return We(o)},Ve=(e={})=>L({...{mode:"dark",backgroundColor:"#1f2937",surfaceColor:"#374151",borderColor:"#4b5563",textColor:"#f9fafb",textSecondaryColor:"#9ca3af",shadows:{small:"0 1px 3px rgba(0, 0, 0, 0.3)",medium:"0 4px 6px rgba(0, 0, 0, 0.3)",large:"0 10px 15px rgba(0, 0, 0, 0.3)"}},...e}),qe={get minimal(){return L({primaryColor:"#000000",secondaryColor:"#666666",borderRadius:"4px",shadows:{small:"none",medium:"0 1px 3px rgba(0, 0, 0, 0.1)",large:"0 2px 6px rgba(0, 0, 0, 0.1)"},components:{productCard:{width:"100%"},citationUnit:{width:"100%"},inlineRecommendation:{width:"100%"},expandableUnit:{width:"100%"},compareTable:{width:"100%"}}})},get vibrant(){return L({primaryColor:"#8b5cf6",secondaryColor:"#06b6d4",accentColor:"#f59e0b",borderRadius:"12px",gradients:{primary:"linear-gradient(135deg, #8b5cf6 0%, #06b6d4 100%)",secondary:"linear-gradient(135deg, #06b6d4 0%, #10b981 100%)",accent:"linear-gradient(135deg, #f59e0b 0%, #ef4444 100%)"},components:{productCard:{width:"100%"},citationUnit:{width:"100%"},inlineRecommendation:{width:"100%"},expandableUnit:{width:"100%"},compareTable:{width:"100%"}}})},get corporate(){return L({primaryColor:"#1e40af",secondaryColor:"#059669",backgroundColor:"#f8fafc",surfaceColor:"#ffffff",borderColor:"#cbd5e1",borderRadius:"6px",fontFamily:'"Inter", -apple-system, BlinkMacSystemFont, sans-serif',components:{productCard:{width:"100%"},citationUnit:{width:"100%"},inlineRecommendation:{width:"100%"},expandableUnit:{width:"100%"},compareTable:{width:"100%"}}})},get highContrast(){return L({primaryColor:"#000000",secondaryColor:"#ffffff",backgroundColor:"#ffffff",surfaceColor:"#f5f5f5",borderColor:"#000000",textColor:"#000000",textSecondaryColor:"#333333",borderRadius:"0px",shadows:{small:"none",medium:"0 0 0 2px #000000",large:"0 0 0 3px #000000"},components:{productCard:{width:"100%"},citationUnit:{width:"100%"},inlineRecommendation:{width:"100%"},expandableUnit:{width:"100%"},compareTable:{width:"100%"}}})}},We=(e={})=>{const t=e.components||{},o={productCard:{width:"100%",...t.productCard},citationUnit:{width:"100%",...t.citationUnit},inlineRecommendation:{width:"100%",...t.inlineRecommendation},expandableUnit:{width:"100%",...t.expandableUnit},compareTable:{width:"100%",...t.compareTable},card:{width:"auto",...t.card},button:{width:"auto",...t.button}};return{...e,components:{...t,...o}}},Ye=(...e)=>{const t=L();return e.reduce((o,d)=>d?{...o,...d,mode:d.mode||o.mode}:o,t)},Ge=e=>{var o,d,i,n,s,l;const t=getComputedStyle(e);return{primaryColor:((o=t.getPropertyValue("--admesh-primary-color"))==null?void 0:o.trim())||void 0,secondaryColor:((d=t.getPropertyValue("--admesh-secondary-color"))==null?void 0:d.trim())||void 0,backgroundColor:((i=t.getPropertyValue("--admesh-background-color"))==null?void 0:i.trim())||void 0,textColor:((n=t.getPropertyValue("--admesh-text-color"))==null?void 0:n.trim())||void 0,borderRadius:((s=t.getPropertyValue("--admesh-border-radius"))==null?void 0:s.trim())||void 0,fontFamily:((l=t.getPropertyValue("--admesh-font-family"))==null?void 0:l.trim())||void 0}},He="0.2.1",Je={trackingEnabled:!0,debug:!1,theme:{mode:"light",accentColor:"#2563eb"}};exports.AdMeshBadge=be;exports.AdMeshEcommerceCards=ge;exports.AdMeshInlineCard=xe;exports.AdMeshLayout=$e;exports.AdMeshLinkTracker=J;exports.AdMeshProductCard=H;exports.AdMeshSummaryLayout=ie;exports.AdMeshSummaryUnit=oe;exports.DEFAULT_CONFIG=Je;exports.VERSION=He;exports.buildAdMeshLink=Re;exports.createAdMeshTheme=L;exports.createDarkTheme=Ve;exports.extractTrackingData=Ae;exports.getBadgeText=Fe;exports.getCtaText=Le;exports.getInlineDisclosure=Pe;exports.getInlineTooltip=Ie;exports.getLabelTooltip=se;exports.getPoweredByText=ze;exports.getRecommendationLabel=q;exports.getSectionDisclosure=Ee;exports.hasHighQualityMatches=Oe;exports.mergeThemes=Ye;exports.setAdMeshTrackerConfig=Ne;exports.themeFromCSSProperties=Ge;exports.themePresets=qe;exports.useAdMeshStyles=fe;exports.useAdMeshTracker=ue;
|
|
708
|
+
`}})]})},Ue=r=>{var i,d;const e=[];if(!r)return{isValid:!1,warnings:["No response object provided"]};(!r.recommendations||!Array.isArray(r.recommendations))&&e.push("No recommendations array found in response"),r.layout_type==="citation"&&!r.citation_summary&&e.push("Citation layout specified but no citation_summary provided");const n=((i=r.recommendations)==null?void 0:i.filter(o=>o&&o.admesh_link&&(o.title||o.recommendation_title)))||[];return n.length===0&&e.push("No valid recommendations found (missing admesh_link or title)"),{isValid:n.length>0,validCount:n.length,totalCount:((d=r.recommendations)==null?void 0:d.length)||0,warnings:e}},de=({response:r,theme:e,className:n="",style:i={},onRecommendationClick:d,onLinkClick:o})=>{const s=Ue(r);if(s.warnings.length>0&&console.warn("[AdMesh Summary Layout] Validation warnings:",s.warnings),!s.isValid)return console.error("[AdMesh Summary Layout] Invalid response object"),t.jsx("div",{className:`admesh-summary-layout-error ${n}`,style:i,children:t.jsxs("div",{className:"text-center py-6 px-4 bg-gray-50 dark:bg-gray-800 rounded-lg",children:[t.jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"Unable to display recommendations"}),t.jsx("p",{className:"text-gray-500 dark:text-gray-500 text-xs mt-1",children:"Check console for details"})]})});const{layout_type:l="citation",citation_summary:f,recommendations:h=[],requires_summary:b=!0}=r;console.log(`[AdMesh Summary Layout] Rendering ${l} layout with ${s.validCount}/${s.totalCount} valid recommendations`);const c=()=>{switch(l){case"citation":return f&&b?t.jsx(ne,{summaryText:f,recommendations:h,theme:e,onLinkClick:o}):t.jsxs("div",{className:"fallback-citation",children:[t.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-3",children:"Based on your query, I'd recommend checking out these options:"}),t.jsx(K,{recommendation:h[0],theme:e})]});case"product_cards":case"product":return t.jsx("div",{className:"product-cards-layout",children:h.slice(0,3).map((p,v)=>t.jsx(K,{recommendation:p,theme:e,className:"mb-4"},p.ad_id||`rec-${v}`))});case"ecommerce":return t.jsx(ge,{recommendations:h.slice(0,3),theme:(e==null?void 0:e.mode)||"light"});default:return console.warn(`[AdMesh Summary Layout] Unknown layout type: ${l}`),f?t.jsx(ne,{summaryText:f,recommendations:h,theme:e,onLinkClick:o}):t.jsx(K,{recommendation:h[0],theme:e})}};return t.jsx("div",{className:`admesh-summary-layout admesh-layout-${l} ${n}`,style:{fontFamily:(e==null?void 0:e.fontFamily)||'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',...i},children:c()})},$e=({recommendations:r=[],citationSummary:e,layout:n,response:i,theme:d,className:o,style:s,onRecommendationClick:l,onLinkClick:f})=>{const h=l?c=>{var p;return l(((p=c.meta)==null?void 0:p.ad_id)||c.ad_id||"",c.admesh_link||"")}:void 0;if(i)return t.jsx(de,{response:i,theme:d,className:o,style:s,onRecommendationClick:h,onLinkClick:f});const b={layout_type:n||"citation",citation_summary:e,recommendations:r,requires_summary:!!e};return t.jsx(de,{response:b,theme:d,className:o,style:s,onRecommendationClick:h,onLinkClick:f})},xe=({recommendation:r,theme:e,variation:n="default",expandable:i=!1,className:d,style:o})=>{var c,p,v,w,_;const[s,l]=y.useState(!1),h=(()=>{const g=r.content_variations;return n==="question"&&(g!=null&&g.question)?{title:g.question.cta||r.recommendation_title||r.title,description:g.question.text,ctaText:g.question.cta||r.recommendation_title||r.title}:n==="statement"&&(g!=null&&g.statement)?{title:r.recommendation_title||r.title,description:g.statement.text,ctaText:g.statement.cta||r.recommendation_title||r.title}:{title:r.recommendation_title||r.title,description:r.recommendation_description||r.reason||"",ctaText:r.recommendation_title||r.title}})(),b=z("rounded-xl shadow-sm border border-gray-200 dark:border-gray-800 p-4 bg-white dark:bg-slate-900","hover:shadow-md transition-shadow duration-200",{"cursor-pointer":i&&(n==="question"||n==="statement")},d);return t.jsx("div",{className:b,style:{fontFamily:(e==null?void 0:e.fontFamily)||'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',width:((p=(c=e==null?void 0:e.components)==null?void 0:c.inlineRecommendation)==null?void 0:p.width)||"100%",...(v=e==null?void 0:e.components)==null?void 0:v.productCard,...o},"data-admesh-theme":e==null?void 0:e.mode,children:t.jsxs("div",{className:"h-full flex flex-col",children:[t.jsxs("div",{className:"flex justify-between items-center gap-3 mb-2",children:[t.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[r.product_logo&&t.jsx("img",{src:r.product_logo.url,alt:`${r.title} logo`,className:"w-5 h-5 rounded flex-shrink-0",onError:g=>{g.target.style.display="none"}}),t.jsx("h4",{className:"font-semibold text-gray-800 dark:text-gray-200 text-sm truncate",children:h.title})]}),t.jsx("div",{className:"flex-shrink-0",children:t.jsx(X,{adId:((w=r.meta)==null?void 0:w.ad_id)||r.ad_id||"",admeshLink:r.admesh_link,productId:r.product_id,trackingData:{title:r.title,matchScore:((_=r.meta)==null?void 0:_.intent_match_score)||r.intent_match_score,component:"inline_card_cta"},children:t.jsxs("button",{className:"text-xs px-2 py-1 rounded-full bg-gradient-to-r from-purple-500 to-pink-500 text-white hover:from-purple-600 hover:to-pink-600 flex items-center transition-all duration-200 transform hover:scale-105 shadow-sm whitespace-nowrap",children:[n==="question"?"Try":"Visit",t.jsx("svg",{className:"ml-1 h-3 w-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})})})]}),h.description&&t.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-300 mb-2 line-clamp-2",children:h.description}),t.jsx("div",{className:"mt-auto pt-2 border-t border-gray-100 dark:border-slate-700",children:t.jsxs("div",{className:"flex items-center justify-between text-[11px] text-gray-500 dark:text-gray-400",children:[t.jsx("span",{children:"Sponsored"}),t.jsx("span",{className:"text-gray-400 dark:text-gray-500"})]})})]})})};xe.displayName="AdMeshInlineCard";const De={"Top Match":"primary","Free Tier":"success","AI Powered":"secondary",Popular:"warning",New:"primary","Trial Available":"success"},Be={"Top Match":"★","Free Tier":"◆","AI Powered":"◉",Popular:"▲",New:"●","Trial Available":"◈"},be=({type:r,variant:e,size:n="md",className:i,style:d})=>{const o=e||De[r]||"secondary",s=Be[r],l=z("admesh-component","admesh-badge",`admesh-badge--${o}`,`admesh-badge--${n}`,i);return t.jsxs("span",{className:l,style:d,children:[s&&t.jsx("span",{className:"admesh-badge__icon",children:s}),t.jsx("span",{className:"admesh-badge__text",children:r})]})};be.displayName="AdMeshBadge";const O=(r={})=>{const e={mode:"light",primaryColor:"#000000",secondaryColor:"#666666",accentColor:"#000000",backgroundColor:"#ffffff",surfaceColor:"#ffffff",borderColor:"#e5e7eb",textColor:"#000000",textSecondaryColor:"#666666",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontSize:{small:"12px",base:"14px",large:"16px",title:"18px"},borderRadius:"8px",spacing:{small:"4px",medium:"8px",large:"16px"},shadows:{small:"0 1px 3px rgba(0, 0, 0, 0.1)",medium:"0 4px 6px rgba(0, 0, 0, 0.1)",large:"0 10px 15px rgba(0, 0, 0, 0.1)"},icons:{expandIcon:"▼",collapseIcon:"▲",starIcon:"★",checkIcon:"✓",arrowIcon:"→"},gradients:{primary:"#000000",secondary:"#666666",accent:"#000000"},components:{productCard:{width:"100%"},citationUnit:{width:"100%"},inlineRecommendation:{width:"100%"},expandableUnit:{width:"100%"},compareTable:{width:"100%"},card:{width:"auto"},button:{width:"auto"}}},n={...e,...r,fontSize:{...e.fontSize,...r.fontSize},spacing:{...e.spacing,...r.spacing},shadows:{...e.shadows,...r.shadows},icons:{...e.icons,...r.icons},components:{...e.components,...r.components}};return We(n)},Ve=(r={})=>O({...{mode:"dark",primaryColor:"#ffffff",secondaryColor:"#9ca3af",accentColor:"#ffffff",backgroundColor:"#000000",surfaceColor:"#111111",borderColor:"#333333",textColor:"#ffffff",textSecondaryColor:"#9ca3af",shadows:{small:"0 1px 3px rgba(255, 255, 255, 0.1)",medium:"0 4px 6px rgba(255, 255, 255, 0.1)",large:"0 10px 15px rgba(255, 255, 255, 0.1)"},gradients:{primary:"#ffffff",secondary:"#9ca3af",accent:"#ffffff"}},...r}),qe={get minimal(){return O({primaryColor:"#000000",secondaryColor:"#666666",borderRadius:"4px",shadows:{small:"none",medium:"0 1px 3px rgba(0, 0, 0, 0.1)",large:"0 2px 6px rgba(0, 0, 0, 0.1)"},gradients:{primary:"#000000",secondary:"#666666",accent:"#000000"},components:{productCard:{width:"100%"},citationUnit:{width:"100%"},inlineRecommendation:{width:"100%"},expandableUnit:{width:"100%"},compareTable:{width:"100%"}}})},get vibrant(){return O({primaryColor:"#8b5cf6",secondaryColor:"#06b6d4",accentColor:"#f59e0b",borderRadius:"12px",gradients:{primary:"#8b5cf6",secondary:"#06b6d4",accent:"#f59e0b"},components:{productCard:{width:"100%"},citationUnit:{width:"100%"},inlineRecommendation:{width:"100%"},expandableUnit:{width:"100%"},compareTable:{width:"100%"}}})},get corporate(){return O({primaryColor:"#1e40af",secondaryColor:"#059669",backgroundColor:"#f8fafc",surfaceColor:"#ffffff",borderColor:"#cbd5e1",borderRadius:"6px",fontFamily:'"Inter", -apple-system, BlinkMacSystemFont, sans-serif',components:{productCard:{width:"100%"},citationUnit:{width:"100%"},inlineRecommendation:{width:"100%"},expandableUnit:{width:"100%"},compareTable:{width:"100%"}}})},get highContrast(){return O({primaryColor:"#000000",secondaryColor:"#ffffff",backgroundColor:"#ffffff",surfaceColor:"#f5f5f5",borderColor:"#000000",textColor:"#000000",textSecondaryColor:"#333333",borderRadius:"0px",shadows:{small:"none",medium:"0 0 0 2px #000000",large:"0 0 0 3px #000000"},components:{productCard:{width:"100%"},citationUnit:{width:"100%"},inlineRecommendation:{width:"100%"},expandableUnit:{width:"100%"},compareTable:{width:"100%"}}})}},We=(r={})=>{const e=r.components||{},n={productCard:{width:"100%",...e.productCard},citationUnit:{width:"100%",...e.citationUnit},inlineRecommendation:{width:"100%",...e.inlineRecommendation},expandableUnit:{width:"100%",...e.expandableUnit},compareTable:{width:"100%",...e.compareTable},card:{width:"auto",...e.card},button:{width:"auto",...e.button}};return{...r,components:{...e,...n}}},Ye=(...r)=>{const e=O();return r.reduce((n,i)=>i?{...n,...i,mode:i.mode||n.mode}:n,e)},He=r=>{var n,i,d,o,s,l;const e=getComputedStyle(r);return{primaryColor:((n=e.getPropertyValue("--admesh-primary-color"))==null?void 0:n.trim())||void 0,secondaryColor:((i=e.getPropertyValue("--admesh-secondary-color"))==null?void 0:i.trim())||void 0,backgroundColor:((d=e.getPropertyValue("--admesh-background-color"))==null?void 0:d.trim())||void 0,textColor:((o=e.getPropertyValue("--admesh-text-color"))==null?void 0:o.trim())||void 0,borderRadius:((s=e.getPropertyValue("--admesh-border-radius"))==null?void 0:s.trim())||void 0,fontFamily:((l=e.getPropertyValue("--admesh-font-family"))==null?void 0:l.trim())||void 0}},Ge="0.2.1",Je={trackingEnabled:!0,debug:!1,theme:{mode:"light",accentColor:"#2563eb"}};exports.AdMeshBadge=be;exports.AdMeshEcommerceCards=ge;exports.AdMeshInlineCard=xe;exports.AdMeshLayout=$e;exports.AdMeshLinkTracker=X;exports.AdMeshProductCard=K;exports.AdMeshSummaryLayout=de;exports.AdMeshSummaryUnit=ne;exports.DEFAULT_CONFIG=Je;exports.VERSION=Ge;exports.buildAdMeshLink=Re;exports.createAdMeshTheme=O;exports.createDarkTheme=Ve;exports.extractTrackingData=Ae;exports.getBadgeText=Fe;exports.getCtaText=Le;exports.getInlineDisclosure=Pe;exports.getInlineTooltip=Ie;exports.getLabelTooltip=ie;exports.getPoweredByText=ze;exports.getRecommendationLabel=W;exports.getSectionDisclosure=Ee;exports.hasHighQualityMatches=Oe;exports.mergeThemes=Ye;exports.setAdMeshTrackerConfig=Ne;exports.themeFromCSSProperties=He;exports.themePresets=qe;exports.useAdMeshStyles=fe;exports.useAdMeshTracker=he;
|
|
709
709
|
//# sourceMappingURL=index.js.map
|