@wix/web5-core 1.63.17 → 1.63.19
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/cjs/components/ui/SearchSection.css +0 -36
- package/dist/cjs/components/ui/SearchSection.js +18 -36
- package/dist/cjs/components/ui/SearchSection.js.map +1 -1
- package/dist/cjs/components/ui/UserQuery.css +106 -0
- package/dist/cjs/components/ui/UserQuery.js +64 -19
- package/dist/cjs/components/ui/UserQuery.js.map +1 -1
- package/dist/cjs/privacy/consentGate.js +1 -1
- package/dist/cjs/privacy/consentGate.js.map +1 -1
- package/dist/cjs/privacy/detectProvider.js +1 -1
- package/dist/cjs/privacy/detectProvider.js.map +1 -1
- package/dist/cjs/privacy/providers/hostSuppliedProvider.js +6 -2
- package/dist/cjs/privacy/providers/hostSuppliedProvider.js.map +1 -1
- package/dist/cjs/privacy/providers/oneTrustProvider.js +1 -1
- package/dist/cjs/privacy/providers/oneTrustProvider.js.map +1 -1
- package/dist/cjs/privacy/providers/shopifyProvider.js +7 -3
- package/dist/cjs/privacy/providers/shopifyProvider.js.map +1 -1
- package/dist/esm/components/ui/SearchSection.css +0 -36
- package/dist/esm/components/ui/SearchSection.js +1 -7
- package/dist/esm/components/ui/SearchSection.js.map +1 -1
- package/dist/esm/components/ui/UserQuery.css +106 -0
- package/dist/esm/components/ui/UserQuery.js +19 -4
- package/dist/esm/components/ui/UserQuery.js.map +1 -1
- package/dist/esm/privacy/consentGate.js +1 -1
- package/dist/esm/privacy/consentGate.js.map +1 -1
- package/dist/esm/privacy/detectProvider.js +1 -1
- package/dist/esm/privacy/detectProvider.js.map +1 -1
- package/dist/esm/privacy/providers/hostSuppliedProvider.js +6 -2
- package/dist/esm/privacy/providers/hostSuppliedProvider.js.map +1 -1
- package/dist/esm/privacy/providers/oneTrustProvider.js +1 -1
- package/dist/esm/privacy/providers/oneTrustProvider.js.map +1 -1
- package/dist/esm/privacy/providers/shopifyProvider.js +7 -3
- package/dist/esm/privacy/providers/shopifyProvider.js.map +1 -1
- package/dist/types/components/ui/SearchSection.d.ts.map +1 -1
- package/dist/types/components/ui/UserQuery.d.ts.map +1 -1
- package/dist/types/privacy/consentGate.d.ts.map +1 -1
- package/dist/types/privacy/providers/hostSuppliedProvider.d.ts.map +1 -1
- package/dist/types/privacy/providers/oneTrustProvider.d.ts.map +1 -1
- package/dist/types/privacy/providers/shopifyProvider.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/ui/SearchSection.css +0 -36
- package/src/components/ui/UserQuery.css +106 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_types","require","CONSENT_FEATURE","name","version","log","args","console","getShopify","window","Shopify","isShopifyHost","exports","toState","value","readSnapshot","_getShopify","privacy","customerPrivacy","UNKNOWN_CONSENT","consent","currentVisitorConsent","explicitAnalytics","analytics","explicitMarketing","marketing","allowed","analyticsProcessingAllowed","enforced","regulation","region","isRegulationEnforced","getRegulation","getRegion","bannerRequired","shouldShowBanner","permissiveDefault","fallbackWhenUnenforceable","performance","requestConsentApi","onReady","shopify","loadFeatures","error","createShopifyConsentProvider","read","subscribe","onChange","publish","document","addEventListener","removeEventListener"],"sources":["../../../../src/privacy/providers/shopifyProvider.ts"],"sourcesContent":["/**\n * Shopify Customer Privacy API provider — DL #218.\n *\n * Two things about this API shape the provider:\n *\n * 1. **It is not on the page by default.** `window.Shopify.customerPrivacy` is\n * `undefined` until somebody asks for it with `Shopify.loadFeatures`. The\n * theme app extension warms it so it is ready before the bundle mounts;\n * this provider still requests it, because the extension may not be\n * installed and the request is idempotent.\n *\n * 2. **`visitorConsentCollected` may have already fired.** The bundle executes\n * into an already-rendered storefront page (DL #217), so `read()` answers\n * from current state and the event is only ever an update.\n *\n * The region rule is the one judgement encoded here, and it keys off\n * `isRegulationEnforced()` rather than `shouldShowBanner()`. The two are not\n * interchangeable: the banner reflects what the *merchant* configured, while\n * enforcement reflects what the *visitor's jurisdiction* requires. A store with\n * an empty consent configuration reports \"no banner needed\" everywhere,\n * including inside the EU.\n */\n\nimport {\n UNKNOWN_CONSENT,\n type ConsentProvider,\n type ConsentSnapshot,\n type ConsentState,\n} from '../types';\n\ntype ShopifyConsentValue = 'yes' | 'no' | '' | undefined;\n\ninterface ShopifyVisitorConsent {\n analytics?: ShopifyConsentValue;\n marketing?: ShopifyConsentValue;\n preferences?: ShopifyConsentValue;\n sale_of_data?: ShopifyConsentValue;\n}\n\ninterface ShopifyCustomerPrivacy {\n analyticsProcessingAllowed?: () => boolean;\n marketingAllowed?: () => boolean;\n currentVisitorConsent?: () => ShopifyVisitorConsent;\n shouldShowBanner?: () => boolean;\n /** Whether a privacy regulation applies to this visitor's region. */\n isRegulationEnforced?: () => boolean;\n /** e.g. 'GDPR', 'CCPA'. */\n getRegulation?: () => string;\n /** e.g. 'DEBE' — country + subdivision. */\n getRegion?: () => string;\n}\n\ninterface ShopifyGlobal {\n customerPrivacy?: ShopifyCustomerPrivacy;\n loadFeatures?: (\n features: { name: string; version: string }[],\n callback: (error?: unknown) => void,\n ) => void;\n}\n\nconst CONSENT_FEATURE = { name: 'consent-tracking-api', version: '0.1' };\n\nconst log = (...args: unknown[]): void => {\n try {\n console.log('[w5-consent] shopify:', ...args);\n } catch {\n /* never break on a console */\n }\n};\n\nconst getShopify = (): ShopifyGlobal | null => {\n if (typeof window === 'undefined') {\n return null;\n }\n return (window as unknown as { Shopify?: ShopifyGlobal }).Shopify ?? null;\n};\n\nexport const isShopifyHost = (): boolean => getShopify() !== null;\n\nconst toState = (value: ShopifyConsentValue): ConsentState | null => {\n if (value === 'yes') return 'granted';\n if (value === 'no') return 'denied';\n return null;\n};\n\nconst readSnapshot = (): ConsentSnapshot => {\n const privacy = getShopify()?.customerPrivacy;\n if (!privacy) {\n log(\n 'customerPrivacy API not on the page — no answer available (store has no privacy configuration, or loadFeatures has not resolved yet)',\n );\n // The API has not loaded (or the store has no privacy configuration at\n // all). Not an answer — the gate holds, and the visitor's own action is\n // what unlocks the session.\n return UNKNOWN_CONSENT;\n }\n\n let consent: ShopifyVisitorConsent = {};\n try {\n consent = privacy.currentVisitorConsent?.() ?? {};\n } catch {\n // Present but not ready — treat as no answer yet.\n }\n\n const explicitAnalytics = toState(consent.analytics);\n const explicitMarketing = toState(consent.marketing);\n\n let allowed = false;\n try {\n allowed = privacy.analyticsProcessingAllowed?.() === true;\n } catch {\n allowed = false;\n }\n\n // Is a privacy regulation in force for *this visitor's* region? This is the\n // question that matters, and it is not the same question as \"is a banner\n // being shown\" — see the comment on `enforced` below.\n let enforced: boolean | null = null;\n let regulation = '';\n let region = '';\n try {\n if (typeof privacy.isRegulationEnforced === 'function') {\n enforced = privacy.isRegulationEnforced() === true;\n }\n regulation = privacy.getRegulation?.() ?? '';\n region = privacy.getRegion?.() ?? '';\n } catch {\n enforced = null;\n }\n\n let bannerRequired = true;\n try {\n bannerRequired = privacy.shouldShowBanner?.() !== false;\n } catch {\n bannerRequired = true;\n }\n\n /*\n * Measured on a live store from a Frankfurt IP, with no consent recorded:\n *\n * region 'DEBE' · regulation 'GDPR' · isRegulationEnforced() true\n * shouldShowBanner() false · analyticsProcessingAllowed() TRUE\n * getShopPrefs() { limit: [] }\n *\n * Shopify said tracking was allowed for a GDPR-protected visitor who had\n * never been asked, because the *merchant* had configured no consent\n * preferences. `shouldShowBanner()` and `analyticsProcessingAllowed()` both\n * describe the merchant's setup; neither is a statement about a legal basis.\n * A merchant's misconfiguration must not become our tracking decision, so\n * under an enforced regulation an absent answer stays `unknown` and the gate\n * holds — the visitor's own prompt is then the only thing that unlocks them.\n */\n const permissiveDefault = allowed || !bannerRequired;\n const fallbackWhenUnenforceable = permissiveDefault ? 'granted' : 'unknown';\n\n const analytics: ConsentState =\n explicitAnalytics ??\n (enforced === true ? 'unknown' : fallbackWhenUnenforceable);\n\n const marketing: ConsentState =\n explicitMarketing ??\n (enforced === true ? 'unknown' : !bannerRequired ? 'granted' : 'unknown');\n\n log(\n `read — visitorConsent.analytics=${consent.analytics ?? '(unset)'} ` +\n `analyticsProcessingAllowed=${allowed} bannerRequired=${bannerRequired} ` +\n `region=${region || '?'} regulation=${regulation || '?'} enforced=${\n enforced === null ? 'unavailable' : enforced\n }` +\n (enforced === true && explicitAnalytics === null\n ? ' → regulated and unanswered, holding'\n : '') +\n ` ⇒ ${analytics}`,\n );\n\n return {\n analytics,\n marketing,\n // Shopify has no separate performance bucket. Load telemetry carries an\n // app name and a session id to a Wix endpoint, so it answers to the same\n // answer analytics does rather than riding for free.\n performance: analytics,\n };\n};\n\n/**\n * Ask Shopify to load the consent API if it is not already there. Safe to call\n * more than once; the callback re-reads whatever state arrives.\n */\nconst requestConsentApi = (onReady: () => void): void => {\n const shopify = getShopify();\n if (!shopify || shopify.customerPrivacy || !shopify.loadFeatures) {\n return;\n }\n try {\n log('requesting consent-tracking-api via Shopify.loadFeatures…');\n shopify.loadFeatures([CONSENT_FEATURE], (error) => {\n if (error) {\n log('loadFeatures failed — gate stays held', error);\n return;\n }\n log('loadFeatures resolved — re-reading consent');\n onReady();\n });\n } catch {\n // Storefronts without the feature simply never resolve; the gate stays\n // held and engagement remains the only unlock.\n }\n};\n\nexport const createShopifyConsentProvider = (): ConsentProvider => ({\n name: 'shopify-customer-privacy',\n\n read: readSnapshot,\n\n subscribe(onChange) {\n const publish = () => {\n log('visitorConsentCollected — the visitor answered the banner');\n onChange(readSnapshot());\n };\n\n // The visitor may have answered the banner before this bundle existed, so\n // the event is an update — never the first read.\n if (typeof document !== 'undefined') {\n document.addEventListener('visitorConsentCollected', publish);\n }\n requestConsentApi(() => onChange(readSnapshot()));\n\n return () => {\n if (typeof document !== 'undefined') {\n document.removeEventListener('visitorConsentCollected', publish);\n }\n };\n },\n});\n"],"mappings":";;;;AAuBA,IAAAA,MAAA,GAAAC,OAAA;AAvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAuCA,MAAMC,eAAe,G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GA,CAAA,KAAM;MACpB3C,GAAG,CAAC,2DAA2D,CAAC;MAChE0C,QAAQ,CAAChC,YAAY,CAAC,CAAC,CAAC;IAC1B,CAAC;;IAED;IACA;IACA,IAAI,OAAOkC,QAAQ,KAAK,WAAW,EAAE;MACnCA,QAAQ,CAACC,gBAAgB,CAAC,yBAAyB,EAAEF,OAAO,CAAC;IAC/D;IACAT,iBAAiB,CAAC,MAAMQ,QAAQ,CAAChC,YAAY,CAAC,CAAC,CAAC,CAAC;IAEjD,OAAO,MAAM;MACX,IAAI,OAAOkC,QAAQ,KAAK,WAAW,EAAE;QACnCA,QAAQ,CAACE,mBAAmB,CAAC,yBAAyB,EAAEH,OAAO,CAAC;MAClE;IACF,CAAC;EACH;AACF,CAAC,CAAC;AAACpC,OAAA,CAAAgC,4BAAA,GAAAA,4BAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_types","require","CONSENT_FEATURE","name","version","log","args","console","debug","getShopify","window","Shopify","isShopifyHost","exports","toState","value","readSnapshot","_getShopify","privacy","customerPrivacy","UNKNOWN_CONSENT","consent","currentVisitorConsent","explicitAnalytics","analytics","explicitMarketing","marketing","allowed","analyticsProcessingAllowed","enforced","regulation","region","isRegulationEnforced","getRegulation","getRegion","bannerRequired","shouldShowBanner","permissiveDefault","fallbackWhenUnenforceable","performance","requestConsentApi","onReady","shopify","loadFeatures","error","createShopifyConsentProvider","read","subscribe","onChange","publish","document","addEventListener","removeEventListener"],"sources":["../../../../src/privacy/providers/shopifyProvider.ts"],"sourcesContent":["/**\n * Shopify Customer Privacy API provider — DL #218.\n *\n * Two things about this API shape the provider:\n *\n * 1. **It is not on the page by default.** `window.Shopify.customerPrivacy` is\n * `undefined` until somebody asks for it with `Shopify.loadFeatures`. The\n * theme app extension warms it so it is ready before the bundle mounts;\n * this provider still requests it, because the extension may not be\n * installed and the request is idempotent.\n *\n * 2. **`visitorConsentCollected` may have already fired.** The bundle executes\n * into an already-rendered storefront page (DL #217), so `read()` answers\n * from current state and the event is only ever an update.\n *\n * The region rule is the one judgement encoded here, and it keys off\n * `isRegulationEnforced()` rather than `shouldShowBanner()`. The two are not\n * interchangeable: the banner reflects what the *merchant* configured, while\n * enforcement reflects what the *visitor's jurisdiction* requires. A store with\n * an empty consent configuration reports \"no banner needed\" everywhere,\n * including inside the EU.\n */\n\nimport {\n UNKNOWN_CONSENT,\n type ConsentProvider,\n type ConsentSnapshot,\n type ConsentState,\n} from '../types';\n\ntype ShopifyConsentValue = 'yes' | 'no' | '' | undefined;\n\ninterface ShopifyVisitorConsent {\n analytics?: ShopifyConsentValue;\n marketing?: ShopifyConsentValue;\n preferences?: ShopifyConsentValue;\n sale_of_data?: ShopifyConsentValue;\n}\n\ninterface ShopifyCustomerPrivacy {\n analyticsProcessingAllowed?: () => boolean;\n marketingAllowed?: () => boolean;\n currentVisitorConsent?: () => ShopifyVisitorConsent;\n shouldShowBanner?: () => boolean;\n /** Whether a privacy regulation applies to this visitor's region. */\n isRegulationEnforced?: () => boolean;\n /** e.g. 'GDPR', 'CCPA'. */\n getRegulation?: () => string;\n /** e.g. 'DEBE' — country + subdivision. */\n getRegion?: () => string;\n}\n\ninterface ShopifyGlobal {\n customerPrivacy?: ShopifyCustomerPrivacy;\n loadFeatures?: (\n features: { name: string; version: string }[],\n callback: (error?: unknown) => void,\n ) => void;\n}\n\nconst CONSENT_FEATURE = { name: 'consent-tracking-api', version: '0.1' };\n\nconst log = (...args: unknown[]): void => {\n try {\n console.debug('[w5-consent] shopify:', ...args);\n } catch {\n /* never break on a console */\n }\n};\n\nconst getShopify = (): ShopifyGlobal | null => {\n if (typeof window === 'undefined') {\n return null;\n }\n return (window as unknown as { Shopify?: ShopifyGlobal }).Shopify ?? null;\n};\n\nexport const isShopifyHost = (): boolean => getShopify() !== null;\n\nconst toState = (value: ShopifyConsentValue): ConsentState | null => {\n if (value === 'yes') {\n return 'granted';\n }\n if (value === 'no') {\n return 'denied';\n }\n return null;\n};\n\nconst readSnapshot = (): ConsentSnapshot => {\n const privacy = getShopify()?.customerPrivacy;\n if (!privacy) {\n log(\n 'customerPrivacy API not on the page — no answer available (store has no privacy configuration, or loadFeatures has not resolved yet)',\n );\n // The API has not loaded (or the store has no privacy configuration at\n // all). Not an answer — the gate holds, and the visitor's own action is\n // what unlocks the session.\n return UNKNOWN_CONSENT;\n }\n\n let consent: ShopifyVisitorConsent = {};\n try {\n consent = privacy.currentVisitorConsent?.() ?? {};\n } catch {\n // Present but not ready — treat as no answer yet.\n }\n\n const explicitAnalytics = toState(consent.analytics);\n const explicitMarketing = toState(consent.marketing);\n\n let allowed = false;\n try {\n allowed = privacy.analyticsProcessingAllowed?.() === true;\n } catch {\n allowed = false;\n }\n\n // Is a privacy regulation in force for *this visitor's* region? This is the\n // question that matters, and it is not the same question as \"is a banner\n // being shown\" — see the comment on `enforced` below.\n let enforced: boolean | null = null;\n let regulation = '';\n let region = '';\n try {\n if (typeof privacy.isRegulationEnforced === 'function') {\n enforced = privacy.isRegulationEnforced() === true;\n }\n regulation = privacy.getRegulation?.() ?? '';\n region = privacy.getRegion?.() ?? '';\n } catch {\n enforced = null;\n }\n\n let bannerRequired = true;\n try {\n bannerRequired = privacy.shouldShowBanner?.() !== false;\n } catch {\n bannerRequired = true;\n }\n\n /*\n * Measured on a live store from a Frankfurt IP, with no consent recorded:\n *\n * region 'DEBE' · regulation 'GDPR' · isRegulationEnforced() true\n * shouldShowBanner() false · analyticsProcessingAllowed() TRUE\n * getShopPrefs() { limit: [] }\n *\n * Shopify said tracking was allowed for a GDPR-protected visitor who had\n * never been asked, because the *merchant* had configured no consent\n * preferences. `shouldShowBanner()` and `analyticsProcessingAllowed()` both\n * describe the merchant's setup; neither is a statement about a legal basis.\n * A merchant's misconfiguration must not become our tracking decision, so\n * under an enforced regulation an absent answer stays `unknown` and the gate\n * holds — the visitor's own prompt is then the only thing that unlocks them.\n */\n const permissiveDefault = allowed || !bannerRequired;\n const fallbackWhenUnenforceable = permissiveDefault ? 'granted' : 'unknown';\n\n const analytics: ConsentState =\n explicitAnalytics ??\n (enforced === true ? 'unknown' : fallbackWhenUnenforceable);\n\n const marketing: ConsentState =\n explicitMarketing ??\n (enforced === true ? 'unknown' : !bannerRequired ? 'granted' : 'unknown');\n\n log(\n `read — visitorConsent.analytics=${consent.analytics ?? '(unset)'} ` +\n `analyticsProcessingAllowed=${allowed} bannerRequired=${bannerRequired} ` +\n `region=${region || '?'} regulation=${regulation || '?'} enforced=${\n enforced === null ? 'unavailable' : enforced\n }` +\n (enforced === true && explicitAnalytics === null\n ? ' → regulated and unanswered, holding'\n : '') +\n ` ⇒ ${analytics}`,\n );\n\n return {\n analytics,\n marketing,\n // Shopify has no separate performance bucket. Load telemetry carries an\n // app name and a session id to a Wix endpoint, so it answers to the same\n // answer analytics does rather than riding for free.\n performance: analytics,\n };\n};\n\n/**\n * Ask Shopify to load the consent API if it is not already there. Safe to call\n * more than once; the callback re-reads whatever state arrives.\n */\nconst requestConsentApi = (onReady: () => void): void => {\n const shopify = getShopify();\n if (!shopify || shopify.customerPrivacy || !shopify.loadFeatures) {\n return;\n }\n try {\n log('requesting consent-tracking-api via Shopify.loadFeatures…');\n shopify.loadFeatures([CONSENT_FEATURE], (error) => {\n if (error) {\n log('loadFeatures failed — gate stays held', error);\n return;\n }\n log('loadFeatures resolved — re-reading consent');\n onReady();\n });\n } catch {\n // Storefronts without the feature simply never resolve; the gate stays\n // held and engagement remains the only unlock.\n }\n};\n\nexport const createShopifyConsentProvider = (): ConsentProvider => ({\n name: 'shopify-customer-privacy',\n\n read: readSnapshot,\n\n subscribe(onChange) {\n const publish = () => {\n log('visitorConsentCollected — the visitor answered the banner');\n onChange(readSnapshot());\n };\n\n // The visitor may have answered the banner before this bundle existed, so\n // the event is an update — never the first read.\n if (typeof document !== 'undefined') {\n document.addEventListener('visitorConsentCollected', publish);\n }\n requestConsentApi(() => onChange(readSnapshot()));\n\n return () => {\n if (typeof document !== 'undefined') {\n document.removeEventListener('visitorConsentCollected', publish);\n }\n };\n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,CAAC,CAAC,MAAM;IACN;IACA;EAAA;AAEJ,CAAC;AAEM,MAAMI,4BAA4B,GAAGA,CAAA,MAAwB;EAClE1C,IAAI,EAAE,0BAA0B;EAEhC2C,IAAI,EAAE9B,YAAY;EAElB+B,SAASA,CAACC,QAAQ,EAAE;IAClB,MAAMC,OAAO,GAAGA,CAAA,KAAM;MACpB5C,GAAG,CAAC,2DAA2D,CAAC;MAChE2C,QAAQ,CAAChC,YAAY,CAAC,CAAC,CAAC;IAC1B,CAAC;;IAED;IACA;IACA,IAAI,OAAOkC,QAAQ,KAAK,WAAW,EAAE;MACnCA,QAAQ,CAACC,gBAAgB,CAAC,yBAAyB,EAAEF,OAAO,CAAC;IAC/D;IACAT,iBAAiB,CAAC,MAAMQ,QAAQ,CAAChC,YAAY,CAAC,CAAC,CAAC,CAAC;IAEjD,OAAO,MAAM;MACX,IAAI,OAAOkC,QAAQ,KAAK,WAAW,EAAE;QACnCA,QAAQ,CAACE,mBAAmB,CAAC,yBAAyB,EAAEH,OAAO,CAAC;MAClE;IACF,CAAC;EACH;AACF,CAAC,CAAC;AAACpC,OAAA,CAAAgC,4BAAA,GAAAA,4BAAA","ignoreList":[]}
|
|
@@ -373,39 +373,6 @@
|
|
|
373
373
|
transform: translateY(-50%);
|
|
374
374
|
}
|
|
375
375
|
|
|
376
|
-
.web5-prompt-hint {
|
|
377
|
-
display: inline-flex;
|
|
378
|
-
align-items: center;
|
|
379
|
-
gap: 4px;
|
|
380
|
-
margin-right: 4px;
|
|
381
|
-
color: var(--pi-field-placeholder);
|
|
382
|
-
font-family: var(--pi-field-font-family);
|
|
383
|
-
font-size: 12px;
|
|
384
|
-
line-height: 1;
|
|
385
|
-
white-space: nowrap;
|
|
386
|
-
pointer-events: none;
|
|
387
|
-
user-select: none;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
.web5-prompt-hint__key {
|
|
391
|
-
display: inline-flex;
|
|
392
|
-
align-items: center;
|
|
393
|
-
justify-content: center;
|
|
394
|
-
min-width: 16px;
|
|
395
|
-
padding: 1px 4px;
|
|
396
|
-
border: 1px solid var(--pi-field-placeholder);
|
|
397
|
-
border-radius: 3px;
|
|
398
|
-
background: transparent;
|
|
399
|
-
font-family: inherit;
|
|
400
|
-
font-size: 11px;
|
|
401
|
-
line-height: 1;
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
@media (pointer: coarse) {
|
|
405
|
-
.web5-prompt-hint {
|
|
406
|
-
display: none;
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
376
|
|
|
410
377
|
.web5-prompt-field--multiline .web5-prompt-actions {
|
|
411
378
|
top: auto;
|
|
@@ -589,7 +556,4 @@
|
|
|
589
556
|
height: 20px;
|
|
590
557
|
}
|
|
591
558
|
|
|
592
|
-
.web5-prompt-hint {
|
|
593
|
-
display: none;
|
|
594
|
-
}
|
|
595
559
|
}
|
|
@@ -243,7 +243,6 @@ export const SearchSection = /*#__PURE__*/forwardRef(function SearchSection(_ref
|
|
|
243
243
|
const handleExpandClick = () => {
|
|
244
244
|
focusInput();
|
|
245
245
|
};
|
|
246
|
-
const showHint = inputValue === '' && !isFocused && !isCollapsed;
|
|
247
246
|
return /*#__PURE__*/React.createElement("div", {
|
|
248
247
|
className: cn('web5-prompt-shell', isCollapsed && 'web5-prompt-shell--collapsed',
|
|
249
248
|
// Widens the pill while the field or a chip holds focus. Driven by
|
|
@@ -290,12 +289,7 @@ export const SearchSection = /*#__PURE__*/forwardRef(function SearchSection(_ref
|
|
|
290
289
|
tabIndex: isCollapsed ? -1 : undefined
|
|
291
290
|
}), /*#__PURE__*/React.createElement("div", {
|
|
292
291
|
className: "web5-prompt-actions"
|
|
293
|
-
},
|
|
294
|
-
className: "web5-prompt-hint",
|
|
295
|
-
"aria-hidden": "true"
|
|
296
|
-
}, "Press ", /*#__PURE__*/React.createElement("kbd", {
|
|
297
|
-
className: "web5-prompt-hint__key"
|
|
298
|
-
}, "/"), ' ', "to search"), onVoiceInput && /*#__PURE__*/React.createElement("button", {
|
|
292
|
+
}, onVoiceInput && /*#__PURE__*/React.createElement("button", {
|
|
299
293
|
type: "button",
|
|
300
294
|
onClick: onVoiceInput,
|
|
301
295
|
className: "web5-prompt-voice",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","forwardRef","useEffect","useImperativeHandle","useState","useRef","useCallback","useLayoutEffect","cn","isWeb5Url","ArrowDownIcon","createElement","xmlns","width","height","viewBox","fill","stroke","strokeWidth","strokeLinecap","strokeLinejoin","d","MicrophoneIcon","props","_extends","ArrowRightIcon","PromptSendIcon","SearchSection","_ref","ref","onSubmit","placeholder","submitLabel","collapsedLabel","onCollapsedChange","chips","chipDisplayMode","chipPosition","onVoiceInput","progressMessage","className","contextBanner","hasContext","canSubmitEmpty","hasContent","isBottomZoneVisible","onChipClick","onFocusChange","inputValue","setInputValue","isFocused","setIsFocused","hasFocusInside","setHasFocusInside","isMultiline","setIsMultiline","isCollapsed","setIsCollapsed","inputRef","hasExpandedWhileZoneVisibleRef","previouslyFocusedElementRef","showChips","length","effectiveCollapsedLabel","replace","handleSubmit","trimmedValue","trim","element","current","computedStyles","window","getComputedStyle","lineHeight","Number","parseFloat","hasValue","style","nextHeight","Math","min","max","scrollHeight","hasFocusInsideRef","onFocusChangeRef","focusInput","active","document","activeElement","HTMLElement","body","requestAnimationFrame","_inputRef$current","focus","_inputRef$current2","blurInput","_inputRef$current3","blur","handleKeyDown","e","key","_inputRef$current4","preventDefault","prev","shiftKey","handleInputChange","target","value","handleInputFocus","relatedTarget","handleContentFocus","handleContentBlur","next","currentTarget","contains","role","canSubmit","chipsMarkup","map","chip","label","href","onMouseDown","onClick","_inputRef$current5","tabIndex","handleExpandClick","showHint","type","onFocus","onBlur","rows","onChange","onKeyDown","undefined","disabled","Fragment"],"sources":["../../../../src/components/ui/SearchSection.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useEffect,\n useImperativeHandle,\n useState,\n useRef,\n useCallback,\n useLayoutEffect,\n} from 'react';\nimport { cn } from '../../lib/utils';\nimport { isWeb5Url } from '../../types/link-types';\n\nexport interface ScrollChip {\n label: string;\n href: string;\n iconHint?: string;\n}\n\nexport interface SearchSectionProps {\n onSubmit?: (value: string) => void;\n placeholder?: string;\n /**\n * When set, the submit control renders as a labeled CTA button (text +\n * right arrow) instead of the icon-only send button. Used by the empty\n * state (e.g. \"Find Your Pair\").\n */\n submitLabel?: string;\n collapsedLabel?: string;\n onCollapsedChange?: (isCollapsed: boolean) => void;\n chips?: ScrollChip[];\n chipDisplayMode?: 'focus' | 'always';\n chipPosition?: 'top' | 'bottom';\n onVoiceInput?: () => void;\n progressMessage?: string;\n className?: string;\n contextBanner?: React.ReactNode;\n hasContext?: boolean;\n canSubmitEmpty?: boolean;\n hasContent?: boolean;\n isBottomZoneVisible?: boolean;\n onChipClick?: (e: React.MouseEvent<HTMLAnchorElement>, href: string) => void;\n onFocusChange?: (focused: boolean) => void;\n}\n\nexport interface SearchSectionHandle {\n focusInput: () => void;\n blurInput: () => void;\n}\n\nconst ArrowDownIcon: React.FC = () => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M12 5v14\" />\n <path d=\"m19 12-7 7-7-7\" />\n </svg>\n);\n\nconst MicrophoneIcon: React.FC<React.SVGProps<SVGSVGElement>> = (props) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n stroke=\"none\"\n aria-hidden=\"true\"\n {...props}\n >\n <path d=\"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z\" />\n <path\n d=\"M19 10v2a7 7 0 0 1-14 0v-2M12 19v3\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n fill=\"none\"\n />\n </svg>\n);\n\nconst ArrowRightIcon: React.FC<React.SVGProps<SVGSVGElement>> = (props) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n {...props}\n >\n <path d=\"M5 12h14\" />\n <path d=\"m12 5 7 7-7 7\" />\n </svg>\n);\n\nconst PromptSendIcon: React.FC<React.SVGProps<SVGSVGElement>> = (props) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n aria-hidden=\"true\"\n {...props}\n >\n <path\n d=\"M13.0306 7.53114C12.9609 7.60106 12.8781 7.65654 12.787 7.69439C12.6958 7.73224 12.5981 7.75173 12.4993 7.75173C12.4006 7.75173 12.3029 7.73224 12.2117 7.69439C12.1206 7.65654 12.0378 7.60106 11.9681 7.53114L8.74997 4.31301V13.5005C8.74997 13.6994 8.67095 13.8902 8.5303 14.0308C8.38965 14.1715 8.19888 14.2505 7.99997 14.2505C7.80106 14.2505 7.61029 14.1715 7.46964 14.0308C7.32899 13.8902 7.24997 13.6994 7.24997 13.5005V4.31301L4.0306 7.53114C3.8897 7.67203 3.69861 7.75119 3.49935 7.75119C3.30009 7.75119 3.10899 7.67203 2.9681 7.53114C2.8272 7.39024 2.74805 7.19915 2.74805 6.99989C2.74805 6.80063 2.8272 6.60953 2.9681 6.46864L7.4681 1.96864C7.53778 1.89872 7.62057 1.84324 7.71173 1.80539C7.8029 1.76753 7.90064 1.74805 7.99935 1.74805C8.09806 1.74805 8.1958 1.76753 8.28696 1.80539C8.37813 1.84324 8.46092 1.89872 8.5306 1.96864L13.0306 6.46864C13.1005 6.53832 13.156 6.62111 13.1938 6.71227C13.2317 6.80344 13.2512 6.90118 13.2512 6.99989C13.2512 7.0986 13.2317 7.19634 13.1938 7.2875C13.156 7.37867 13.1005 7.46146 13.0306 7.53114Z\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport const SearchSection = forwardRef<\n SearchSectionHandle,\n SearchSectionProps\n>(function SearchSection(\n {\n onSubmit,\n placeholder = 'Talk to us',\n submitLabel,\n collapsedLabel,\n onCollapsedChange,\n chips = [],\n chipDisplayMode = 'focus',\n chipPosition = 'top',\n onVoiceInput,\n progressMessage,\n className = '',\n contextBanner,\n hasContext,\n canSubmitEmpty = false,\n hasContent = false,\n isBottomZoneVisible = false,\n onChipClick,\n onFocusChange,\n },\n ref,\n) {\n const [inputValue, setInputValue] = useState('');\n const [isFocused, setIsFocused] = useState(false);\n const [hasFocusInside, setHasFocusInside] = useState(false);\n const [isMultiline, setIsMultiline] = useState(false);\n const [isCollapsed, setIsCollapsed] = useState(false);\n const inputRef = useRef<HTMLTextAreaElement>(null);\n const hasExpandedWhileZoneVisibleRef = useRef(false);\n const previouslyFocusedElementRef = useRef<HTMLElement | null>(null);\n const showChips =\n chips.length > 0 &&\n !hasContext &&\n (chipDisplayMode === 'always' || hasFocusInside);\n const effectiveCollapsedLabel =\n collapsedLabel ?? placeholder.replace(/\\.\\.\\.$/, '');\n\n const handleSubmit = useCallback(() => {\n const trimmedValue = inputValue.trim();\n if (trimmedValue || canSubmitEmpty) {\n onSubmit?.(trimmedValue);\n setInputValue('');\n }\n }, [canSubmitEmpty, inputValue, onSubmit]);\n\n useLayoutEffect(() => {\n const element = inputRef.current;\n if (!element) {\n return;\n }\n\n const computedStyles = window.getComputedStyle(element);\n const lineHeight = Number.parseFloat(computedStyles.lineHeight) || 32;\n\n const hasValue = inputValue.trim().length > 0;\n element.style.height = 'auto';\n const nextHeight = hasValue\n ? Math.min(Math.max(element.scrollHeight, lineHeight), 175)\n : lineHeight;\n element.style.height = `${nextHeight}px`;\n setIsMultiline(hasValue && nextHeight > lineHeight);\n }, [inputValue]);\n\n useEffect(() => {\n if (progressMessage || !hasContent) {\n setIsCollapsed(false);\n hasExpandedWhileZoneVisibleRef.current = false;\n return;\n }\n\n if (!isBottomZoneVisible) {\n hasExpandedWhileZoneVisibleRef.current = false;\n setIsCollapsed(false);\n return;\n }\n\n if (!hasExpandedWhileZoneVisibleRef.current) {\n setIsCollapsed(true);\n }\n }, [hasContent, isBottomZoneVisible, progressMessage]);\n\n useEffect(() => {\n onCollapsedChange?.(isCollapsed);\n }, [isCollapsed, onCollapsedChange]);\n\n const hasFocusInsideRef = useRef(hasFocusInside);\n hasFocusInsideRef.current = hasFocusInside;\n const onFocusChangeRef = useRef(onFocusChange);\n onFocusChangeRef.current = onFocusChange;\n\n useEffect(() => {\n onFocusChange?.(hasFocusInside);\n }, [hasFocusInside, onFocusChange]);\n\n useEffect(() => {\n return () => {\n if (hasFocusInsideRef.current) {\n onFocusChangeRef.current?.(false);\n }\n };\n }, []);\n\n const focusInput = useCallback(() => {\n const active = document.activeElement;\n if (\n active instanceof HTMLElement &&\n active !== inputRef.current &&\n active !== document.body\n ) {\n previouslyFocusedElementRef.current = active;\n }\n if (isCollapsed) {\n hasExpandedWhileZoneVisibleRef.current = true;\n setIsCollapsed(false);\n window.requestAnimationFrame(() => {\n inputRef.current?.focus();\n });\n } else {\n inputRef.current?.focus();\n }\n }, [isCollapsed]);\n\n const blurInput = useCallback(() => {\n inputRef.current?.blur();\n }, []);\n\n useImperativeHandle(ref, () => ({ focusInput, blurInput }), [\n focusInput,\n blurInput,\n ]);\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === 'Escape') {\n e.preventDefault();\n const prev = previouslyFocusedElementRef.current;\n previouslyFocusedElementRef.current = null;\n inputRef.current?.blur();\n prev?.focus?.();\n return;\n }\n if (\n e.key === 'Enter' &&\n !e.shiftKey &&\n (inputValue.trim() || canSubmitEmpty)\n ) {\n e.preventDefault();\n handleSubmit();\n }\n };\n\n const handleInputChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n setInputValue(e.target.value);\n };\n\n const handleInputFocus = (e: React.FocusEvent<HTMLTextAreaElement>) => {\n setIsFocused(true);\n if (\n e.relatedTarget instanceof HTMLElement &&\n e.relatedTarget !== inputRef.current\n ) {\n previouslyFocusedElementRef.current = e.relatedTarget;\n }\n };\n\n const handleContentFocus = () => {\n setHasFocusInside(true);\n };\n\n const handleContentBlur = (e: React.FocusEvent<HTMLDivElement>) => {\n const next = e.relatedTarget as Node | null;\n if (!next || !e.currentTarget.contains(next)) {\n setHasFocusInside(false);\n }\n };\n\n if (progressMessage) {\n return (\n <div\n className={cn('web5-prompt-progress', className)}\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n >\n <div className=\"web5-prompt-progress__indicator\" aria-hidden=\"true\">\n <ArrowDownIcon />\n </div>\n <div className=\"web5-prompt-progress__message\">{progressMessage}</div>\n </div>\n );\n }\n\n const canSubmit = inputValue.trim().length > 0 || canSubmitEmpty;\n const chipsMarkup =\n chips.length > 0 ? (\n <div\n className={cn(\n 'web5-prompt-shell__chips',\n chipPosition === 'bottom'\n ? 'web5-prompt-shell__chips--bottom'\n : 'web5-prompt-shell__chips--top',\n showChips\n ? 'web5-prompt-shell__chips--visible'\n : 'web5-prompt-shell__chips--hidden',\n )}\n aria-hidden={isCollapsed || !showChips}\n >\n {chips.map((chip) => (\n <a\n key={chip.label}\n href={isWeb5Url(chip.href) ? '#' : chip.href}\n onMouseDown={(e) => e.preventDefault()}\n onClick={(e) => {\n e.preventDefault();\n onChipClick?.(e, chip.href);\n setInputValue('');\n inputRef.current?.blur();\n }}\n tabIndex={!isCollapsed && showChips ? 0 : -1}\n // `has-custom-focus` opts out of Wix Thunderbolt's global keyboard focus ring\n // so our inset :focus-visible ring isn't overwritten when embedded in a Wix site.\n className=\"web5-prompt-chip has-custom-focus\"\n >\n {chip.label}\n <PromptSendIcon\n aria-hidden=\"true\"\n className=\"web5-prompt-send-icon\"\n />\n </a>\n ))}\n </div>\n ) : null;\n\n const handleExpandClick = () => {\n focusInput();\n };\n\n const showHint = inputValue === '' && !isFocused && !isCollapsed;\n\n return (\n <div\n className={cn(\n 'web5-prompt-shell',\n isCollapsed && 'web5-prompt-shell--collapsed',\n // Widens the pill while the field or a chip holds focus. Driven by\n // `hasFocusInside` rather than `isFocused` so clicking a chip (which\n // preventDefaults its mousedown) doesn't collapse the width mid-click.\n hasFocusInside && !isCollapsed && 'web5-prompt-shell--focused',\n className,\n )}\n >\n <div className=\"web5-prompt-shell__stage\">\n <button\n type=\"button\"\n className=\"web5-prompt-shell__collapsed-button has-custom-focus\"\n onClick={handleExpandClick}\n aria-label={effectiveCollapsedLabel}\n aria-hidden={!isCollapsed}\n tabIndex={isCollapsed ? 0 : -1}\n >\n {effectiveCollapsedLabel}\n </button>\n\n <div\n className=\"web5-prompt-shell__content\"\n aria-hidden={isCollapsed}\n onFocus={handleContentFocus}\n onBlur={handleContentBlur}\n >\n {contextBanner}\n <div className=\"web5-prompt-shell__panel\">\n <div\n className={cn(\n 'web5-prompt-shell__stack',\n chipPosition === 'top' && 'web5-prompt-shell__stack--chips-top',\n )}\n >\n <div className=\"web5-prompt-search\" role=\"search\">\n <div className=\"web5-prompt-search__inner\">\n <div\n className={cn(\n 'web5-prompt-field',\n isFocused && 'web5-prompt-field--focused',\n isMultiline && 'web5-prompt-field--multiline',\n )}\n >\n <textarea\n ref={inputRef}\n rows={1}\n value={inputValue}\n onChange={handleInputChange}\n onKeyDown={handleKeyDown}\n onFocus={handleInputFocus}\n onBlur={() => setIsFocused(false)}\n placeholder={placeholder}\n aria-label=\"Search or ask a question\"\n aria-keyshortcuts=\"/ Control+K\"\n className=\"web5-prompt-input has-custom-focus placeholder:text-search-input-hint\"\n tabIndex={isCollapsed ? -1 : undefined}\n />\n\n <div className=\"web5-prompt-actions\">\n {showHint && (\n <span className=\"web5-prompt-hint\" aria-hidden=\"true\">\n Press <kbd className=\"web5-prompt-hint__key\">/</kbd>{' '}\n to search\n </span>\n )}\n {onVoiceInput && (\n <button\n type=\"button\"\n onClick={onVoiceInput}\n className=\"web5-prompt-voice\"\n aria-label=\"Voice input\"\n tabIndex={isCollapsed ? -1 : undefined}\n >\n <MicrophoneIcon />\n </button>\n )}\n <button\n type=\"button\"\n onClick={handleSubmit}\n className={cn(\n 'web5-prompt-submit',\n submitLabel && 'web5-prompt-submit--labeled',\n canSubmit && 'web5-prompt-submit--active',\n )}\n aria-label={submitLabel ?? 'Submit'}\n disabled={!canSubmit || isCollapsed}\n tabIndex={isCollapsed ? -1 : undefined}\n >\n {submitLabel ? (\n <>\n <span className=\"web5-prompt-submit__label\">\n {submitLabel}\n </span>\n <ArrowRightIcon\n aria-hidden=\"true\"\n className=\"web5-prompt-send-icon\"\n />\n </>\n ) : (\n <PromptSendIcon\n aria-hidden=\"true\"\n className=\"web5-prompt-send-icon\"\n />\n )}\n </button>\n </div>\n </div>\n </div>\n </div>\n\n {chipsMarkup}\n </div>\n </div>\n </div>\n </div>\n </div>\n );\n});\n"],"mappings":";AAAA,OAAOA,KAAK,IACVC,UAAU,EACVC,SAAS,EACTC,mBAAmB,EACnBC,QAAQ,EACRC,MAAM,EACNC,WAAW,EACXC,eAAe,QACV,OAAO;AACd,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,wBAAwB;AAuClD,MAAMC,aAAuB,GAAGA,CAAA,kBAC9BV,KAAA,CAAAW,aAAA;EACEC,KAAK,EAAC,4BAA4B;EAClCC,KAAK,EAAC,IAAI;EACVC,MAAM,EAAC,IAAI;EACXC,OAAO,EAAC,WAAW;EACnBC,IAAI,EAAC,MAAM;EACXC,MAAM,EAAC,cAAc;EACrBC,WAAW,EAAC,GAAG;EACfC,aAAa,EAAC,OAAO;EACrBC,cAAc,EAAC,OAAO;EACtB,eAAY;AAAM,gBAElBpB,KAAA,CAAAW,aAAA;EAAMU,CAAC,EAAC;AAAU,CAAE,CAAC,eACrBrB,KAAA,CAAA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CuG,QAAQ,EAAE,CAACnB,SAAS,IAAI5D,WAAY;IACpCqE,QAAQ,EAAErE,WAAW,GAAG,CAAC,CAAC,GAAG8E;EAAU,GAEtCtG,WAAW,gBACVhC,KAAA,CAAAW,aAAA,CAAAX,KAAA,CAAAwI,QAAA,qBACExI,KAAA,CAAAW,aAAA;IAAM6B,SAAS,EAAC;EAA2B,GACxCR,WACG,CAAC,eACPhC,KAAA,CAAAW,aAAA,CAACc,cAAc;IACb,eAAY,MAAM;IAClBe,SAAS,EAAC;EAAuB,CAClC,CACD,CAAC,gBAEHxC,KAAA,CAAAW,aAAA,CAACe,cAAc;IACb,eAAY,MAAM;IAClBc,SAAS,EAAC;EAAuB,CAClC,CAEG,CACL,CACF,CACF,CACF,CAAC,EAEL6E,WACE,CACF,CACF,CACF,CACF,CAAC;AAEV,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","forwardRef","useEffect","useImperativeHandle","useState","useRef","useCallback","useLayoutEffect","cn","isWeb5Url","ArrowDownIcon","createElement","xmlns","width","height","viewBox","fill","stroke","strokeWidth","strokeLinecap","strokeLinejoin","d","MicrophoneIcon","props","_extends","ArrowRightIcon","PromptSendIcon","SearchSection","_ref","ref","onSubmit","placeholder","submitLabel","collapsedLabel","onCollapsedChange","chips","chipDisplayMode","chipPosition","onVoiceInput","progressMessage","className","contextBanner","hasContext","canSubmitEmpty","hasContent","isBottomZoneVisible","onChipClick","onFocusChange","inputValue","setInputValue","isFocused","setIsFocused","hasFocusInside","setHasFocusInside","isMultiline","setIsMultiline","isCollapsed","setIsCollapsed","inputRef","hasExpandedWhileZoneVisibleRef","previouslyFocusedElementRef","showChips","length","effectiveCollapsedLabel","replace","handleSubmit","trimmedValue","trim","element","current","computedStyles","window","getComputedStyle","lineHeight","Number","parseFloat","hasValue","style","nextHeight","Math","min","max","scrollHeight","hasFocusInsideRef","onFocusChangeRef","focusInput","active","document","activeElement","HTMLElement","body","requestAnimationFrame","_inputRef$current","focus","_inputRef$current2","blurInput","_inputRef$current3","blur","handleKeyDown","e","key","_inputRef$current4","preventDefault","prev","shiftKey","handleInputChange","target","value","handleInputFocus","relatedTarget","handleContentFocus","handleContentBlur","next","currentTarget","contains","role","canSubmit","chipsMarkup","map","chip","label","href","onMouseDown","onClick","_inputRef$current5","tabIndex","handleExpandClick","type","onFocus","onBlur","rows","onChange","onKeyDown","undefined","disabled","Fragment"],"sources":["../../../../src/components/ui/SearchSection.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useEffect,\n useImperativeHandle,\n useState,\n useRef,\n useCallback,\n useLayoutEffect,\n} from 'react';\nimport { cn } from '../../lib/utils';\nimport { isWeb5Url } from '../../types/link-types';\n\nexport interface ScrollChip {\n label: string;\n href: string;\n iconHint?: string;\n}\n\nexport interface SearchSectionProps {\n onSubmit?: (value: string) => void;\n placeholder?: string;\n /**\n * When set, the submit control renders as a labeled CTA button (text +\n * right arrow) instead of the icon-only send button. Used by the empty\n * state (e.g. \"Find Your Pair\").\n */\n submitLabel?: string;\n collapsedLabel?: string;\n onCollapsedChange?: (isCollapsed: boolean) => void;\n chips?: ScrollChip[];\n chipDisplayMode?: 'focus' | 'always';\n chipPosition?: 'top' | 'bottom';\n onVoiceInput?: () => void;\n progressMessage?: string;\n className?: string;\n contextBanner?: React.ReactNode;\n hasContext?: boolean;\n canSubmitEmpty?: boolean;\n hasContent?: boolean;\n isBottomZoneVisible?: boolean;\n onChipClick?: (e: React.MouseEvent<HTMLAnchorElement>, href: string) => void;\n onFocusChange?: (focused: boolean) => void;\n}\n\nexport interface SearchSectionHandle {\n focusInput: () => void;\n blurInput: () => void;\n}\n\nconst ArrowDownIcon: React.FC = () => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M12 5v14\" />\n <path d=\"m19 12-7 7-7-7\" />\n </svg>\n);\n\nconst MicrophoneIcon: React.FC<React.SVGProps<SVGSVGElement>> = (props) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n stroke=\"none\"\n aria-hidden=\"true\"\n {...props}\n >\n <path d=\"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z\" />\n <path\n d=\"M19 10v2a7 7 0 0 1-14 0v-2M12 19v3\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n fill=\"none\"\n />\n </svg>\n);\n\nconst ArrowRightIcon: React.FC<React.SVGProps<SVGSVGElement>> = (props) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n {...props}\n >\n <path d=\"M5 12h14\" />\n <path d=\"m12 5 7 7-7 7\" />\n </svg>\n);\n\nconst PromptSendIcon: React.FC<React.SVGProps<SVGSVGElement>> = (props) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n aria-hidden=\"true\"\n {...props}\n >\n <path\n d=\"M13.0306 7.53114C12.9609 7.60106 12.8781 7.65654 12.787 7.69439C12.6958 7.73224 12.5981 7.75173 12.4993 7.75173C12.4006 7.75173 12.3029 7.73224 12.2117 7.69439C12.1206 7.65654 12.0378 7.60106 11.9681 7.53114L8.74997 4.31301V13.5005C8.74997 13.6994 8.67095 13.8902 8.5303 14.0308C8.38965 14.1715 8.19888 14.2505 7.99997 14.2505C7.80106 14.2505 7.61029 14.1715 7.46964 14.0308C7.32899 13.8902 7.24997 13.6994 7.24997 13.5005V4.31301L4.0306 7.53114C3.8897 7.67203 3.69861 7.75119 3.49935 7.75119C3.30009 7.75119 3.10899 7.67203 2.9681 7.53114C2.8272 7.39024 2.74805 7.19915 2.74805 6.99989C2.74805 6.80063 2.8272 6.60953 2.9681 6.46864L7.4681 1.96864C7.53778 1.89872 7.62057 1.84324 7.71173 1.80539C7.8029 1.76753 7.90064 1.74805 7.99935 1.74805C8.09806 1.74805 8.1958 1.76753 8.28696 1.80539C8.37813 1.84324 8.46092 1.89872 8.5306 1.96864L13.0306 6.46864C13.1005 6.53832 13.156 6.62111 13.1938 6.71227C13.2317 6.80344 13.2512 6.90118 13.2512 6.99989C13.2512 7.0986 13.2317 7.19634 13.1938 7.2875C13.156 7.37867 13.1005 7.46146 13.0306 7.53114Z\"\n fill=\"currentColor\"\n />\n </svg>\n);\n\nexport const SearchSection = forwardRef<\n SearchSectionHandle,\n SearchSectionProps\n>(function SearchSection(\n {\n onSubmit,\n placeholder = 'Talk to us',\n submitLabel,\n collapsedLabel,\n onCollapsedChange,\n chips = [],\n chipDisplayMode = 'focus',\n chipPosition = 'top',\n onVoiceInput,\n progressMessage,\n className = '',\n contextBanner,\n hasContext,\n canSubmitEmpty = false,\n hasContent = false,\n isBottomZoneVisible = false,\n onChipClick,\n onFocusChange,\n },\n ref,\n) {\n const [inputValue, setInputValue] = useState('');\n const [isFocused, setIsFocused] = useState(false);\n const [hasFocusInside, setHasFocusInside] = useState(false);\n const [isMultiline, setIsMultiline] = useState(false);\n const [isCollapsed, setIsCollapsed] = useState(false);\n const inputRef = useRef<HTMLTextAreaElement>(null);\n const hasExpandedWhileZoneVisibleRef = useRef(false);\n const previouslyFocusedElementRef = useRef<HTMLElement | null>(null);\n const showChips =\n chips.length > 0 &&\n !hasContext &&\n (chipDisplayMode === 'always' || hasFocusInside);\n const effectiveCollapsedLabel =\n collapsedLabel ?? placeholder.replace(/\\.\\.\\.$/, '');\n\n const handleSubmit = useCallback(() => {\n const trimmedValue = inputValue.trim();\n if (trimmedValue || canSubmitEmpty) {\n onSubmit?.(trimmedValue);\n setInputValue('');\n }\n }, [canSubmitEmpty, inputValue, onSubmit]);\n\n useLayoutEffect(() => {\n const element = inputRef.current;\n if (!element) {\n return;\n }\n\n const computedStyles = window.getComputedStyle(element);\n const lineHeight = Number.parseFloat(computedStyles.lineHeight) || 32;\n\n const hasValue = inputValue.trim().length > 0;\n element.style.height = 'auto';\n const nextHeight = hasValue\n ? Math.min(Math.max(element.scrollHeight, lineHeight), 175)\n : lineHeight;\n element.style.height = `${nextHeight}px`;\n setIsMultiline(hasValue && nextHeight > lineHeight);\n }, [inputValue]);\n\n useEffect(() => {\n if (progressMessage || !hasContent) {\n setIsCollapsed(false);\n hasExpandedWhileZoneVisibleRef.current = false;\n return;\n }\n\n if (!isBottomZoneVisible) {\n hasExpandedWhileZoneVisibleRef.current = false;\n setIsCollapsed(false);\n return;\n }\n\n if (!hasExpandedWhileZoneVisibleRef.current) {\n setIsCollapsed(true);\n }\n }, [hasContent, isBottomZoneVisible, progressMessage]);\n\n useEffect(() => {\n onCollapsedChange?.(isCollapsed);\n }, [isCollapsed, onCollapsedChange]);\n\n const hasFocusInsideRef = useRef(hasFocusInside);\n hasFocusInsideRef.current = hasFocusInside;\n const onFocusChangeRef = useRef(onFocusChange);\n onFocusChangeRef.current = onFocusChange;\n\n useEffect(() => {\n onFocusChange?.(hasFocusInside);\n }, [hasFocusInside, onFocusChange]);\n\n useEffect(() => {\n return () => {\n if (hasFocusInsideRef.current) {\n onFocusChangeRef.current?.(false);\n }\n };\n }, []);\n\n const focusInput = useCallback(() => {\n const active = document.activeElement;\n if (\n active instanceof HTMLElement &&\n active !== inputRef.current &&\n active !== document.body\n ) {\n previouslyFocusedElementRef.current = active;\n }\n if (isCollapsed) {\n hasExpandedWhileZoneVisibleRef.current = true;\n setIsCollapsed(false);\n window.requestAnimationFrame(() => {\n inputRef.current?.focus();\n });\n } else {\n inputRef.current?.focus();\n }\n }, [isCollapsed]);\n\n const blurInput = useCallback(() => {\n inputRef.current?.blur();\n }, []);\n\n useImperativeHandle(ref, () => ({ focusInput, blurInput }), [\n focusInput,\n blurInput,\n ]);\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === 'Escape') {\n e.preventDefault();\n const prev = previouslyFocusedElementRef.current;\n previouslyFocusedElementRef.current = null;\n inputRef.current?.blur();\n prev?.focus?.();\n return;\n }\n if (\n e.key === 'Enter' &&\n !e.shiftKey &&\n (inputValue.trim() || canSubmitEmpty)\n ) {\n e.preventDefault();\n handleSubmit();\n }\n };\n\n const handleInputChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n setInputValue(e.target.value);\n };\n\n const handleInputFocus = (e: React.FocusEvent<HTMLTextAreaElement>) => {\n setIsFocused(true);\n if (\n e.relatedTarget instanceof HTMLElement &&\n e.relatedTarget !== inputRef.current\n ) {\n previouslyFocusedElementRef.current = e.relatedTarget;\n }\n };\n\n const handleContentFocus = () => {\n setHasFocusInside(true);\n };\n\n const handleContentBlur = (e: React.FocusEvent<HTMLDivElement>) => {\n const next = e.relatedTarget as Node | null;\n if (!next || !e.currentTarget.contains(next)) {\n setHasFocusInside(false);\n }\n };\n\n if (progressMessage) {\n return (\n <div\n className={cn('web5-prompt-progress', className)}\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n >\n <div className=\"web5-prompt-progress__indicator\" aria-hidden=\"true\">\n <ArrowDownIcon />\n </div>\n <div className=\"web5-prompt-progress__message\">{progressMessage}</div>\n </div>\n );\n }\n\n const canSubmit = inputValue.trim().length > 0 || canSubmitEmpty;\n const chipsMarkup =\n chips.length > 0 ? (\n <div\n className={cn(\n 'web5-prompt-shell__chips',\n chipPosition === 'bottom'\n ? 'web5-prompt-shell__chips--bottom'\n : 'web5-prompt-shell__chips--top',\n showChips\n ? 'web5-prompt-shell__chips--visible'\n : 'web5-prompt-shell__chips--hidden',\n )}\n aria-hidden={isCollapsed || !showChips}\n >\n {chips.map((chip) => (\n <a\n key={chip.label}\n href={isWeb5Url(chip.href) ? '#' : chip.href}\n onMouseDown={(e) => e.preventDefault()}\n onClick={(e) => {\n e.preventDefault();\n onChipClick?.(e, chip.href);\n setInputValue('');\n inputRef.current?.blur();\n }}\n tabIndex={!isCollapsed && showChips ? 0 : -1}\n // `has-custom-focus` opts out of Wix Thunderbolt's global keyboard focus ring\n // so our inset :focus-visible ring isn't overwritten when embedded in a Wix site.\n className=\"web5-prompt-chip has-custom-focus\"\n >\n {chip.label}\n <PromptSendIcon\n aria-hidden=\"true\"\n className=\"web5-prompt-send-icon\"\n />\n </a>\n ))}\n </div>\n ) : null;\n\n const handleExpandClick = () => {\n focusInput();\n };\n\n\n return (\n <div\n className={cn(\n 'web5-prompt-shell',\n isCollapsed && 'web5-prompt-shell--collapsed',\n // Widens the pill while the field or a chip holds focus. Driven by\n // `hasFocusInside` rather than `isFocused` so clicking a chip (which\n // preventDefaults its mousedown) doesn't collapse the width mid-click.\n hasFocusInside && !isCollapsed && 'web5-prompt-shell--focused',\n className,\n )}\n >\n <div className=\"web5-prompt-shell__stage\">\n <button\n type=\"button\"\n className=\"web5-prompt-shell__collapsed-button has-custom-focus\"\n onClick={handleExpandClick}\n aria-label={effectiveCollapsedLabel}\n aria-hidden={!isCollapsed}\n tabIndex={isCollapsed ? 0 : -1}\n >\n {effectiveCollapsedLabel}\n </button>\n\n <div\n className=\"web5-prompt-shell__content\"\n aria-hidden={isCollapsed}\n onFocus={handleContentFocus}\n onBlur={handleContentBlur}\n >\n {contextBanner}\n <div className=\"web5-prompt-shell__panel\">\n <div\n className={cn(\n 'web5-prompt-shell__stack',\n chipPosition === 'top' && 'web5-prompt-shell__stack--chips-top',\n )}\n >\n <div className=\"web5-prompt-search\" role=\"search\">\n <div className=\"web5-prompt-search__inner\">\n <div\n className={cn(\n 'web5-prompt-field',\n isFocused && 'web5-prompt-field--focused',\n isMultiline && 'web5-prompt-field--multiline',\n )}\n >\n <textarea\n ref={inputRef}\n rows={1}\n value={inputValue}\n onChange={handleInputChange}\n onKeyDown={handleKeyDown}\n onFocus={handleInputFocus}\n onBlur={() => setIsFocused(false)}\n placeholder={placeholder}\n aria-label=\"Search or ask a question\"\n aria-keyshortcuts=\"/ Control+K\"\n className=\"web5-prompt-input has-custom-focus placeholder:text-search-input-hint\"\n tabIndex={isCollapsed ? -1 : undefined}\n />\n\n <div className=\"web5-prompt-actions\">\n {onVoiceInput && (\n <button\n type=\"button\"\n onClick={onVoiceInput}\n className=\"web5-prompt-voice\"\n aria-label=\"Voice input\"\n tabIndex={isCollapsed ? -1 : undefined}\n >\n <MicrophoneIcon />\n </button>\n )}\n <button\n type=\"button\"\n onClick={handleSubmit}\n className={cn(\n 'web5-prompt-submit',\n submitLabel && 'web5-prompt-submit--labeled',\n canSubmit && 'web5-prompt-submit--active',\n )}\n aria-label={submitLabel ?? 'Submit'}\n disabled={!canSubmit || isCollapsed}\n tabIndex={isCollapsed ? -1 : undefined}\n >\n {submitLabel ? (\n <>\n <span className=\"web5-prompt-submit__label\">\n {submitLabel}\n </span>\n <ArrowRightIcon\n aria-hidden=\"true\"\n className=\"web5-prompt-send-icon\"\n />\n </>\n ) : (\n <PromptSendIcon\n aria-hidden=\"true\"\n className=\"web5-prompt-send-icon\"\n />\n )}\n </button>\n </div>\n </div>\n </div>\n </div>\n\n {chipsMarkup}\n </div>\n </div>\n </div>\n </div>\n </div>\n );\n});\n"],"mappings":";AAAA,OAAOA,KAAK,IACVC,UAAU,EACVC,SAAS,EACTC,mBAAmB,EACnBC,QAAQ,EACRC,MAAM,EACNC,WAAW,EACXC,eAAe,QACV,OAAO;AACd,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,wBAAwB;AAuClD,MAAMC,aAAuB,GAAGA,CAAA,kBAC9BV,KAAA,CAAAW,aAAA;EACEC,KAAK,EAAC,4BAA4B;EAClCC,KAAK,EAAC,IAAI;EACVC,MAAM,EAAC,IAAI;EACXC,OAAO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ACpCqE,QAAQ,EAAErE,WAAW,GAAG,CAAC,CAAC,GAAG6E;EAAU,GAEtCrG,WAAW,gBACVhC,KAAA,CAAAW,aAAA,CAAAX,KAAA,CAAAuI,QAAA,qBACEvI,KAAA,CAAAW,aAAA;IAAM6B,SAAS,EAAC;EAA2B,GACxCR,WACG,CAAC,eACPhC,KAAA,CAAAW,aAAA,CAACc,cAAc;IACb,eAAY,MAAM;IAClBe,SAAS,EAAC;EAAuB,CAClC,CACD,CAAC,gBAEHxC,KAAA,CAAAW,aAAA,CAACe,cAAc;IACb,eAAY,MAAM;IAClBc,SAAS,EAAC;EAAuB,CAClC,CAEG,CACL,CACF,CACF,CACF,CAAC,EAEL6E,WACE,CACF,CACF,CACF,CACF,CAAC;AAEV,CAAC,CAAC","ignoreList":[]}
|
|
@@ -70,3 +70,109 @@
|
|
|
70
70
|
.web5-user-query__product-back:hover .web5-user-query__product-back-title {
|
|
71
71
|
text-decoration: underline;
|
|
72
72
|
}
|
|
73
|
+
|
|
74
|
+
/*
|
|
75
|
+
* Keyboard hint — "Press / to search", beside the Share action.
|
|
76
|
+
*
|
|
77
|
+
* It lived inside the prompt field until it was moved here: there it competed
|
|
78
|
+
* with the placeholder for the same space and vanished the moment the reader
|
|
79
|
+
* focused the input, so the shortcut was only ever shown to someone not using
|
|
80
|
+
* it. Its colour still comes from the prompt-input token family, which keeps
|
|
81
|
+
* it in step with the input it describes and themeable by the same knob.
|
|
82
|
+
*/
|
|
83
|
+
.web5-prompt-hint {
|
|
84
|
+
display: inline-flex;
|
|
85
|
+
align-items: center;
|
|
86
|
+
gap: 4px;
|
|
87
|
+
color: var(--pi-field-placeholder);
|
|
88
|
+
font-family: var(--pi-field-font-family);
|
|
89
|
+
font-size: 12px;
|
|
90
|
+
line-height: 1;
|
|
91
|
+
white-space: nowrap;
|
|
92
|
+
pointer-events: none;
|
|
93
|
+
user-select: none;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.web5-prompt-hint__key {
|
|
97
|
+
display: inline-flex;
|
|
98
|
+
align-items: center;
|
|
99
|
+
justify-content: center;
|
|
100
|
+
min-width: 16px;
|
|
101
|
+
padding: 1px 4px;
|
|
102
|
+
border: 1px solid var(--pi-field-placeholder);
|
|
103
|
+
border-radius: 3px;
|
|
104
|
+
background: transparent;
|
|
105
|
+
font-family: inherit;
|
|
106
|
+
font-size: 11px;
|
|
107
|
+
line-height: 1;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* No physical keyboard, no shortcut worth advertising. */
|
|
111
|
+
@media (pointer: coarse) {
|
|
112
|
+
.web5-prompt-hint {
|
|
113
|
+
display: none;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* Mobile: the header is tight and there is no keyboard anyway. */
|
|
118
|
+
@media (max-width: 768px) {
|
|
119
|
+
.web5-prompt-hint {
|
|
120
|
+
display: none;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/*
|
|
125
|
+
* Action tooltips — "Share this", "New conversation".
|
|
126
|
+
*
|
|
127
|
+
* Brand-coloured via the theme tokens rather than the header's own greys, so a
|
|
128
|
+
* client that rebrands gets tooltips that match. `--primary` is the brand
|
|
129
|
+
* accent every client already sets; the copied-state toast beside this
|
|
130
|
+
* deliberately keeps its own near-black, because that one is a status message
|
|
131
|
+
* rather than a label and should not read as an action.
|
|
132
|
+
*
|
|
133
|
+
* Hover and focus-visible both, so a keyboard user gets the same affordance —
|
|
134
|
+
* the buttons are icon-only below the `sm` breakpoint, where the label is the
|
|
135
|
+
* only thing naming them.
|
|
136
|
+
*/
|
|
137
|
+
.web5-user-query__tooltip {
|
|
138
|
+
position: absolute;
|
|
139
|
+
top: calc(100% + 6px);
|
|
140
|
+
right: 0;
|
|
141
|
+
z-index: 20;
|
|
142
|
+
padding: 5px 10px;
|
|
143
|
+
border-radius: 6px;
|
|
144
|
+
background: hsl(var(--primary, 262 83% 58%));
|
|
145
|
+
color: hsl(var(--primary-foreground, 0 0% 100%));
|
|
146
|
+
font-size: 12px;
|
|
147
|
+
line-height: 1.4;
|
|
148
|
+
white-space: nowrap;
|
|
149
|
+
pointer-events: none;
|
|
150
|
+
opacity: 0;
|
|
151
|
+
transform: translateY(-2px);
|
|
152
|
+
transition:
|
|
153
|
+
opacity 120ms ease-out,
|
|
154
|
+
transform 120ms ease-out;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.web5-user-query__action:hover .web5-user-query__tooltip,
|
|
158
|
+
.web5-user-query__action:focus-within .web5-user-query__tooltip {
|
|
159
|
+
opacity: 1;
|
|
160
|
+
transform: translateY(0);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/*
|
|
164
|
+
* Touch has no hover, so a tooltip there is either permanently invisible or
|
|
165
|
+
* permanently in the way. The buttons carry `aria-label`, which is what
|
|
166
|
+
* actually names them for anyone who needs it.
|
|
167
|
+
*/
|
|
168
|
+
@media (pointer: coarse) {
|
|
169
|
+
.web5-user-query__tooltip {
|
|
170
|
+
display: none;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
@media (prefers-reduced-motion: reduce) {
|
|
175
|
+
.web5-user-query__tooltip {
|
|
176
|
+
transition: none;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
@@ -181,24 +181,39 @@ export const UserQuery = _ref => {
|
|
|
181
181
|
className: "w-6 h-6 flex items-center justify-center text-text-body hover:text-black transition-colors bg-transparent border-0 cursor-pointer disabled:opacity-30 disabled:cursor-default"
|
|
182
182
|
}, /*#__PURE__*/React.createElement(RedoIcon, null)))), /*#__PURE__*/React.createElement("div", {
|
|
183
183
|
className: "flex items-center gap-[10px] ml-[10px] sm:ml-0 shrink-0"
|
|
184
|
-
}, /*#__PURE__*/React.createElement("
|
|
185
|
-
className: "
|
|
184
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
185
|
+
className: "web5-prompt-hint",
|
|
186
|
+
"aria-hidden": "true"
|
|
187
|
+
}, "Press ", /*#__PURE__*/React.createElement("kbd", {
|
|
188
|
+
className: "web5-prompt-hint__key"
|
|
189
|
+
}, "/"), " to search"), /*#__PURE__*/React.createElement("div", {
|
|
190
|
+
className: "web5-user-query__action group relative"
|
|
186
191
|
}, /*#__PURE__*/React.createElement("button", {
|
|
187
192
|
type: "button",
|
|
193
|
+
"aria-label": "Share this",
|
|
188
194
|
onClick: handleShare,
|
|
189
195
|
disabled: isLoading || isCopied,
|
|
190
196
|
className: `web5-user-query__share flex items-center gap-2 p-[6px] sm:px-[13px] sm:py-[5px] rounded-[30px] text-[13px] leading-5 border-0 cursor-pointer transition-colors disabled:cursor-default
|
|
191
197
|
${isCopied ? 'is-copied bg-[#2b2b2b] text-white' : 'text-text-body bg-white hover:bg-gray-50'}`
|
|
192
198
|
}, isCopied ? /*#__PURE__*/React.createElement(CheckIcon, null) : /*#__PURE__*/React.createElement(ShareIcon, null), /*#__PURE__*/React.createElement("span", {
|
|
193
199
|
className: "hidden sm:inline"
|
|
194
|
-
}, isLoading ? 'Sharing…' : isCopied ? copiedLabel : 'Share')), isCopied && /*#__PURE__*/React.createElement("
|
|
200
|
+
}, isLoading ? 'Sharing…' : isCopied ? copiedLabel : 'Share')), !isCopied && /*#__PURE__*/React.createElement("span", {
|
|
201
|
+
className: "web5-user-query__tooltip",
|
|
202
|
+
role: "tooltip"
|
|
203
|
+
}, "Share this"), isCopied && /*#__PURE__*/React.createElement("div", {
|
|
195
204
|
className: "web5-user-query__copied-toast sm:hidden absolute top-full right-0 mt-1 flex items-center gap-2 bg-[#2b2b2b] text-white text-[12px] leading-none px-3 py-2 rounded-[8px] whitespace-nowrap"
|
|
196
|
-
}, /*#__PURE__*/React.createElement(CheckIcon, null), copiedLabel)), onNewConversation && /*#__PURE__*/React.createElement("
|
|
205
|
+
}, /*#__PURE__*/React.createElement(CheckIcon, null), copiedLabel)), onNewConversation && /*#__PURE__*/React.createElement("div", {
|
|
206
|
+
className: "web5-user-query__action group relative"
|
|
207
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
197
208
|
type: "button",
|
|
209
|
+
"aria-label": newConversationLabel,
|
|
198
210
|
onClick: handleNewConversation,
|
|
199
211
|
className: "web5-user-query__new-conversation flex items-center gap-2 p-[6px] sm:px-[13px] sm:py-[5px] rounded-[30px] text-[13px] leading-5 text-text-body bg-white border-0 cursor-pointer hover:bg-gray-50 transition-colors"
|
|
200
212
|
}, /*#__PURE__*/React.createElement(PlusIcon, null), /*#__PURE__*/React.createElement("span", {
|
|
201
213
|
className: "hidden sm:inline"
|
|
214
|
+
}, newConversationLabel)), /*#__PURE__*/React.createElement("span", {
|
|
215
|
+
className: "web5-user-query__tooltip",
|
|
216
|
+
role: "tooltip"
|
|
202
217
|
}, newConversationLabel)), onToggleCommentMode && /*#__PURE__*/React.createElement("button", {
|
|
203
218
|
type: "button",
|
|
204
219
|
onClick: onToggleCommentMode,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useCallback","useEffect","useMemo","useState","ShareIcon","CheckIcon","PlusIcon","UndoIcon","RedoIcon","CommentIcon","getForwardStack","pushToForwardStack","popFromForwardStack","clearForwardStack","DEFAULT_LOADING_MESSAGES","headerClassName","UserQuery","_ref","query","onNewConversation","onNavigateToTriggerId","predecessorTriggerId","currentTriggerId","onShare","onToggleCommentMode","commentMode","commentCount","loading","newConversationLabel","copiedLabel","copiedDurationMs","productBackContext","onBackToProduct","forwardStack","canGoForward","length","canGoBack","hasNavigation","handleBack","handleForward","nextTid","handleNewConversation","shareState","setShareState","productImageError","setProductImageError","imageUrl","handleShare","urlToCopy","window","location","href","err","console","warn","navigator","clipboard","writeText","catch","setTimeout","cyclingMessages","messages","cycledMessage","setCycledMessage","progressMessage","index","interval","setInterval","clearInterval","isCopied","isLoading","productBadge","title","backUrl","label","canNavigateBack","content","createElement","Fragment","className","src","alt","onError","type","onClick","progressText","role","pendingQuery","disabled"],"sources":["../../../../src/components/ui/UserQuery.tsx"],"sourcesContent":["import React, { FC, useCallback, useEffect, useMemo, useState } from 'react';\nimport { ShareIcon } from './icons/ShareIcon';\nimport { CheckIcon } from './icons/CheckIcon';\nimport { PlusIcon } from './icons/PlusIcon';\nimport { UndoIcon } from './icons/UndoIcon';\nimport { RedoIcon } from './icons/RedoIcon';\nimport { CommentIcon } from './icons/CommentIcon';\nimport {\n getForwardStack,\n pushToForwardStack,\n popFromForwardStack,\n clearForwardStack,\n} from '../../utils/navigationStack';\n\ntype ShareState = 'idle' | 'loading' | 'copied';\n\nconst DEFAULT_LOADING_MESSAGES = [\n 'Thinking…',\n 'Recognizing intent…',\n 'Connecting the dots…',\n 'Synthesizing insights…',\n 'Formulating a response…',\n];\n\nconst headerClassName =\n 'web5-user-query sticky top-0 z-10 flex items-center justify-between bg-white/60 backdrop-blur-sm pl-5 pr-[10px] py-[7px] sm:px-[30px] sm:py-[17px]';\n\nexport interface UserQueryLoadingState {\n pendingQuery: string;\n /** Static progress message. If omitted, falls back to cycling through `messages`. */\n progressMessage?: string;\n /** Messages cycled while loading when `progressMessage` is not set. */\n messages?: string[];\n}\n\n/**\n * Product the visitor was redirected from (DL #114). Rendered as a back badge\n * above the query: back arrow + thumbnail + product name. All fields are\n * resolved and validated app-side (allowed-domain `backUrl`, `https:`\n * `imageUrl`) before reaching this presentational component.\n */\nexport interface ProductBackContext {\n /** Product display name. Required — without it the badge does not render. */\n title: string;\n /** Validated product thumbnail URL. Omitted/failed to load → arrow + title only. */\n imageUrl?: string;\n /** Validated product-page URL to return to. Omitted → badge is non-clickable. */\n backUrl?: string;\n /** Accessible label override. Defaults to `Back to ${title}`. */\n label?: string;\n}\n\nexport interface UserQueryProps {\n query: string;\n onNewConversation?: () => void;\n onNavigateToTriggerId?: (triggerId: string) => void;\n predecessorTriggerId?: string;\n currentTriggerId?: string;\n onShare?: (triggerId: string) => Promise<string>;\n /** Optional comment-mode toggle. When provided, render the chat-bubble\n * toggle button next to Share. The button reflects `commentMode` via\n * `is-on` styling and `aria-pressed`. */\n onToggleCommentMode?: () => void;\n commentMode?: boolean;\n /** Total number of comments on this response — shown as a badge next to the\n * toggle when > 0. */\n commentCount?: number;\n loading?: UserQueryLoadingState;\n /** Label for the \"new conversation\" action. Defaults to \"New conversation\". */\n newConversationLabel?: string;\n /** Label shown after the share link is copied. Defaults to \"Link Copied\". */\n copiedLabel?: string;\n /** How long the copied state stays visible, in ms. Defaults to 2000. */\n copiedDurationMs?: number;\n /** When set (visitor arrived from a product page), render a back-to-product\n * badge above the query (DL #114). */\n productBackContext?: ProductBackContext;\n /** Invoked with the validated `backUrl` when the badge is activated. */\n onBackToProduct?: (backUrl: string) => void;\n}\n\nexport const UserQuery: FC<UserQueryProps> = ({\n query,\n onNewConversation,\n onNavigateToTriggerId,\n predecessorTriggerId,\n currentTriggerId,\n onShare,\n onToggleCommentMode,\n commentMode = false,\n commentCount = 0,\n loading,\n newConversationLabel = 'New conversation',\n copiedLabel = 'Link Copied',\n copiedDurationMs = 2000,\n productBackContext,\n onBackToProduct,\n}) => {\n const forwardStack = useMemo(() => getForwardStack(), [currentTriggerId]);\n const canGoForward = forwardStack.length > 0;\n const canGoBack = !!predecessorTriggerId;\n const hasNavigation = canGoBack || canGoForward;\n\n const handleBack = useCallback(() => {\n if (!predecessorTriggerId || !currentTriggerId || !onNavigateToTriggerId) {\n return;\n }\n pushToForwardStack(currentTriggerId);\n onNavigateToTriggerId(predecessorTriggerId);\n }, [predecessorTriggerId, currentTriggerId, onNavigateToTriggerId]);\n\n const handleForward = useCallback(() => {\n if (!onNavigateToTriggerId) {\n return;\n }\n const nextTid = popFromForwardStack();\n if (!nextTid) {\n return;\n }\n onNavigateToTriggerId(nextTid);\n }, [onNavigateToTriggerId]);\n\n const handleNewConversation = useCallback(() => {\n clearForwardStack();\n onNewConversation?.();\n }, [onNewConversation]);\n\n const [shareState, setShareState] = useState<ShareState>('idle');\n\n const [productImageError, setProductImageError] = useState(false);\n useEffect(() => {\n setProductImageError(false);\n }, [productBackContext?.imageUrl]);\n\n const handleShare = useCallback(async () => {\n if (shareState !== 'idle') {\n return;\n }\n setShareState('loading');\n let urlToCopy = window.location.href;\n try {\n if (onShare && currentTriggerId) {\n urlToCopy = await onShare(currentTriggerId);\n }\n } catch (err) {\n console.warn('[share] failed, falling back to current URL:', err);\n }\n navigator.clipboard\n .writeText(urlToCopy)\n .catch((err) => console.warn('[share] clipboard write failed:', err));\n setShareState('copied');\n setTimeout(() => setShareState('idle'), copiedDurationMs);\n }, [shareState, onShare, currentTriggerId, copiedDurationMs]);\n\n const cyclingMessages = useMemo(\n () =>\n loading?.messages && loading.messages.length > 0\n ? loading.messages\n : DEFAULT_LOADING_MESSAGES,\n [loading?.messages],\n );\n const [cycledMessage, setCycledMessage] = useState(cyclingMessages[0]);\n\n useEffect(() => {\n if (!loading || loading.progressMessage) {\n return;\n }\n setCycledMessage(cyclingMessages[0]);\n if (cyclingMessages.length <= 1) {\n return;\n }\n let index = 0;\n const interval = setInterval(() => {\n index = (index + 1) % cyclingMessages.length;\n setCycledMessage(cyclingMessages[index]);\n }, 4000);\n return () => clearInterval(interval);\n }, [loading, cyclingMessages]);\n\n if (!query && !loading) {\n return null;\n }\n\n const isCopied = shareState === 'copied';\n const isLoading = shareState === 'loading';\n\n const productBadge = productBackContext\n ? (() => {\n const { title, imageUrl, backUrl, label } = productBackContext;\n const canNavigateBack = !!backUrl && !!onBackToProduct;\n const content = (\n <>\n <UndoIcon className=\"web5-user-query__product-back-icon\" />\n {imageUrl && !productImageError && (\n <span className=\"web5-user-query__product-back-thumb\">\n <img\n src={imageUrl}\n alt=\"\"\n onError={() => setProductImageError(true)}\n />\n </span>\n )}\n <span className=\"web5-user-query__product-back-title\">{title}</span>\n </>\n );\n return canNavigateBack ? (\n <button\n type=\"button\"\n onClick={() => onBackToProduct?.(backUrl!)}\n aria-label={label ?? `Back to ${title}`}\n className=\"web5-user-query__product-back\"\n >\n {content}\n </button>\n ) : (\n <div className=\"web5-user-query__product-back web5-user-query__product-back--static\">\n {content}\n </div>\n );\n })()\n : null;\n\n if (loading) {\n const progressText = loading.progressMessage ?? cycledMessage;\n return (\n <div\n className={headerClassName}\n role=\"status\"\n aria-busy=\"true\"\n aria-live=\"polite\"\n >\n <div className=\"web5-user-query__left flex-1\">\n {productBadge}\n <p\n className=\"text-[14px] leading-5 text-text-body truncate min-w-0 max-w-[700px]\"\n title={`Asking: ${loading.pendingQuery}`}\n >\n <span className=\"text-text-body/70\">Asking: </span>\n {loading.pendingQuery}\n </p>\n </div>\n {progressText && (\n <div className=\"hidden sm:flex items-center gap-2 ml-[10px] shrink-0 min-w-0\">\n <div\n className=\"w-4 h-4 shrink-0 animate-spin inline-block border-[2px] border-current border-t-transparent text-blue-600 dark:text-blue-500 rounded-full\"\n aria-hidden=\"true\"\n />\n <p className=\"text-[13px] leading-5 text-text-body/70 truncate max-w-[240px]\">\n {progressText}\n </p>\n </div>\n )}\n </div>\n );\n }\n\n return (\n <div className={headerClassName}>\n <div className=\"flex items-center gap-[30px] flex-1 min-w-0\">\n <div className=\"web5-user-query__left\">\n {productBadge}\n <p\n className=\"web5-user-query__title text-[14px] leading-5 text-text-body truncate min-w-0 max-w-[700px]\"\n title={query}\n >\n {query}\n </p>\n </div>\n {hasNavigation && (\n <div className=\"flex items-center gap-[9px]\">\n <button\n type=\"button\"\n onClick={handleBack}\n disabled={!canGoBack}\n title=\"Go to previous conversation\"\n aria-label=\"Go to previous conversation\"\n className=\"w-6 h-6 flex items-center justify-center text-text-body hover:text-black transition-colors bg-transparent border-0 cursor-pointer disabled:opacity-30 disabled:cursor-default\"\n >\n <UndoIcon />\n </button>\n <button\n type=\"button\"\n onClick={handleForward}\n disabled={!canGoForward}\n title=\"Go to next conversation\"\n aria-label=\"Go to next conversation\"\n className=\"w-6 h-6 flex items-center justify-center text-text-body hover:text-black transition-colors bg-transparent border-0 cursor-pointer disabled:opacity-30 disabled:cursor-default\"\n >\n <RedoIcon />\n </button>\n </div>\n )}\n </div>\n <div className=\"flex items-center gap-[10px] ml-[10px] sm:ml-0 shrink-0\">\n {/* Share button — wraps button + mobile tooltip in a relative container */}\n <div className=\"relative\">\n <button\n type=\"button\"\n onClick={handleShare}\n disabled={isLoading || isCopied}\n className={`web5-user-query__share flex items-center gap-2 p-[6px] sm:px-[13px] sm:py-[5px] rounded-[30px] text-[13px] leading-5 border-0 cursor-pointer transition-colors disabled:cursor-default\n ${\n isCopied\n ? 'is-copied bg-[#2b2b2b] text-white'\n : 'text-text-body bg-white hover:bg-gray-50'\n }`}\n >\n {isCopied ? <CheckIcon /> : <ShareIcon />}\n <span className=\"hidden sm:inline\">\n {isLoading ? 'Sharing…' : isCopied ? copiedLabel : 'Share'}\n </span>\n </button>\n {/* Mobile-only tooltip: drops below the button when link is copied */}\n {isCopied && (\n <div className=\"web5-user-query__copied-toast sm:hidden absolute top-full right-0 mt-1 flex items-center gap-2 bg-[#2b2b2b] text-white text-[12px] leading-none px-3 py-2 rounded-[8px] whitespace-nowrap\">\n <CheckIcon />\n {copiedLabel}\n </div>\n )}\n </div>\n {onNewConversation && (\n <button\n type=\"button\"\n onClick={handleNewConversation}\n className=\"web5-user-query__new-conversation flex items-center gap-2 p-[6px] sm:px-[13px] sm:py-[5px] rounded-[30px] text-[13px] leading-5 text-text-body bg-white border-0 cursor-pointer hover:bg-gray-50 transition-colors\"\n >\n <PlusIcon />\n <span className=\"hidden sm:inline\">{newConversationLabel}</span>\n </button>\n )}\n {onToggleCommentMode && (\n <button\n type=\"button\"\n onClick={onToggleCommentMode}\n aria-pressed={commentMode}\n title=\"Add a comment\"\n aria-label=\"Add a comment\"\n className={`relative flex items-center gap-2 p-[6px] sm:px-[13px] sm:py-[5px] rounded-[30px] text-[13px] leading-5 border-0 cursor-pointer transition-colors ${\n commentMode\n ? 'bg-[#2b2b2b] text-white'\n : 'text-text-body bg-white hover:bg-gray-50'\n }`}\n >\n <CommentIcon />\n {commentCount > 0 && (\n <span\n className={`absolute -top-1 -right-1 min-w-[18px] h-[18px] px-1 rounded-full text-[10px] leading-[18px] text-center font-semibold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A,CAAA8E,aAAA;IAAKE,SAAS,EAAC;EAA2L,gBACxMhF,KAAA,CAAA8E,aAAA,CAACxE,SAAS,MAAE,CAAC,EACZwB,WACE,CAEJ,CAAC,EACLV,iBAAiB,iBAChBpB,KAAA,CAAA8E,aAAA;IACEM,IAAI,EAAC,QAAQ;IACbC,OAAO,EAAE3C,qBAAsB;IAC/BsC,SAAS,EAAC;EAAoN,gBAE9NhF,KAAA,CAAA8E,aAAA,CAACvE,QAAQ,MAAE,CAAC,eACZP,KAAA,CAAA8E,aAAA;IAAME,SAAS,EAAC;EAAkB,GAAEnD,oBAA2B,CACzD,CACT,EACAJ,mBAAmB,iBAClBzB,KAAA,CAAA8E,aAAA;IACEM,IAAI,EAAC,QAAQ;IACbC,OAAO,EAAE5D,mBAAoB;IAC7B,gBAAcC,WAAY;IAC1B+C,KAAK,EAAC,eAAe;IACrB,cAAW,eAAe;IAC1BO,SAAS,EAAE,oJACTtD,WAAW,GACP,yBAAyB,GACzB,0CAA0C;EAC7C,gBAEH1B,KAAA,CAAA8E,aAAA,CAACpE,WAAW,MAAE,CAAC,EACdiB,YAAY,GAAG,CAAC,iBACf3B,KAAA,CAAA8E,aAAA;IACEE,SAAS,EAAE,yHACTtD,WAAW,GAAG,yBAAyB,GAAG,yBAAyB;EAClE,GAEFC,YACG,CAEF,CAEP,CACF,CAAC;AAEV,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","useCallback","useEffect","useMemo","useState","ShareIcon","CheckIcon","PlusIcon","UndoIcon","RedoIcon","CommentIcon","getForwardStack","pushToForwardStack","popFromForwardStack","clearForwardStack","DEFAULT_LOADING_MESSAGES","headerClassName","UserQuery","_ref","query","onNewConversation","onNavigateToTriggerId","predecessorTriggerId","currentTriggerId","onShare","onToggleCommentMode","commentMode","commentCount","loading","newConversationLabel","copiedLabel","copiedDurationMs","productBackContext","onBackToProduct","forwardStack","canGoForward","length","canGoBack","hasNavigation","handleBack","handleForward","nextTid","handleNewConversation","shareState","setShareState","productImageError","setProductImageError","imageUrl","handleShare","urlToCopy","window","location","href","err","console","warn","navigator","clipboard","writeText","catch","setTimeout","cyclingMessages","messages","cycledMessage","setCycledMessage","progressMessage","index","interval","setInterval","clearInterval","isCopied","isLoading","productBadge","title","backUrl","label","canNavigateBack","content","createElement","Fragment","className","src","alt","onError","type","onClick","progressText","role","pendingQuery","disabled"],"sources":["../../../../src/components/ui/UserQuery.tsx"],"sourcesContent":["import React, { FC, useCallback, useEffect, useMemo, useState } from 'react';\nimport { ShareIcon } from './icons/ShareIcon';\nimport { CheckIcon } from './icons/CheckIcon';\nimport { PlusIcon } from './icons/PlusIcon';\nimport { UndoIcon } from './icons/UndoIcon';\nimport { RedoIcon } from './icons/RedoIcon';\nimport { CommentIcon } from './icons/CommentIcon';\nimport {\n getForwardStack,\n pushToForwardStack,\n popFromForwardStack,\n clearForwardStack,\n} from '../../utils/navigationStack';\n\ntype ShareState = 'idle' | 'loading' | 'copied';\n\nconst DEFAULT_LOADING_MESSAGES = [\n 'Thinking…',\n 'Recognizing intent…',\n 'Connecting the dots…',\n 'Synthesizing insights…',\n 'Formulating a response…',\n];\n\nconst headerClassName =\n 'web5-user-query sticky top-0 z-10 flex items-center justify-between bg-white/60 backdrop-blur-sm pl-5 pr-[10px] py-[7px] sm:px-[30px] sm:py-[17px]';\n\nexport interface UserQueryLoadingState {\n pendingQuery: string;\n /** Static progress message. If omitted, falls back to cycling through `messages`. */\n progressMessage?: string;\n /** Messages cycled while loading when `progressMessage` is not set. */\n messages?: string[];\n}\n\n/**\n * Product the visitor was redirected from (DL #114). Rendered as a back badge\n * above the query: back arrow + thumbnail + product name. All fields are\n * resolved and validated app-side (allowed-domain `backUrl`, `https:`\n * `imageUrl`) before reaching this presentational component.\n */\nexport interface ProductBackContext {\n /** Product display name. Required — without it the badge does not render. */\n title: string;\n /** Validated product thumbnail URL. Omitted/failed to load → arrow + title only. */\n imageUrl?: string;\n /** Validated product-page URL to return to. Omitted → badge is non-clickable. */\n backUrl?: string;\n /** Accessible label override. Defaults to `Back to ${title}`. */\n label?: string;\n}\n\nexport interface UserQueryProps {\n query: string;\n onNewConversation?: () => void;\n onNavigateToTriggerId?: (triggerId: string) => void;\n predecessorTriggerId?: string;\n currentTriggerId?: string;\n onShare?: (triggerId: string) => Promise<string>;\n /** Optional comment-mode toggle. When provided, render the chat-bubble\n * toggle button next to Share. The button reflects `commentMode` via\n * `is-on` styling and `aria-pressed`. */\n onToggleCommentMode?: () => void;\n commentMode?: boolean;\n /** Total number of comments on this response — shown as a badge next to the\n * toggle when > 0. */\n commentCount?: number;\n loading?: UserQueryLoadingState;\n /** Label for the \"new conversation\" action. Defaults to \"New conversation\". */\n newConversationLabel?: string;\n /** Label shown after the share link is copied. Defaults to \"Link Copied\". */\n copiedLabel?: string;\n /** How long the copied state stays visible, in ms. Defaults to 2000. */\n copiedDurationMs?: number;\n /** When set (visitor arrived from a product page), render a back-to-product\n * badge above the query (DL #114). */\n productBackContext?: ProductBackContext;\n /** Invoked with the validated `backUrl` when the badge is activated. */\n onBackToProduct?: (backUrl: string) => void;\n}\n\nexport const UserQuery: FC<UserQueryProps> = ({\n query,\n onNewConversation,\n onNavigateToTriggerId,\n predecessorTriggerId,\n currentTriggerId,\n onShare,\n onToggleCommentMode,\n commentMode = false,\n commentCount = 0,\n loading,\n newConversationLabel = 'New conversation',\n copiedLabel = 'Link Copied',\n copiedDurationMs = 2000,\n productBackContext,\n onBackToProduct,\n}) => {\n const forwardStack = useMemo(() => getForwardStack(), [currentTriggerId]);\n const canGoForward = forwardStack.length > 0;\n const canGoBack = !!predecessorTriggerId;\n const hasNavigation = canGoBack || canGoForward;\n\n const handleBack = useCallback(() => {\n if (!predecessorTriggerId || !currentTriggerId || !onNavigateToTriggerId) {\n return;\n }\n pushToForwardStack(currentTriggerId);\n onNavigateToTriggerId(predecessorTriggerId);\n }, [predecessorTriggerId, currentTriggerId, onNavigateToTriggerId]);\n\n const handleForward = useCallback(() => {\n if (!onNavigateToTriggerId) {\n return;\n }\n const nextTid = popFromForwardStack();\n if (!nextTid) {\n return;\n }\n onNavigateToTriggerId(nextTid);\n }, [onNavigateToTriggerId]);\n\n const handleNewConversation = useCallback(() => {\n clearForwardStack();\n onNewConversation?.();\n }, [onNewConversation]);\n\n const [shareState, setShareState] = useState<ShareState>('idle');\n\n const [productImageError, setProductImageError] = useState(false);\n useEffect(() => {\n setProductImageError(false);\n }, [productBackContext?.imageUrl]);\n\n const handleShare = useCallback(async () => {\n if (shareState !== 'idle') {\n return;\n }\n setShareState('loading');\n let urlToCopy = window.location.href;\n try {\n if (onShare && currentTriggerId) {\n urlToCopy = await onShare(currentTriggerId);\n }\n } catch (err) {\n console.warn('[share] failed, falling back to current URL:', err);\n }\n navigator.clipboard\n .writeText(urlToCopy)\n .catch((err) => console.warn('[share] clipboard write failed:', err));\n setShareState('copied');\n setTimeout(() => setShareState('idle'), copiedDurationMs);\n }, [shareState, onShare, currentTriggerId, copiedDurationMs]);\n\n const cyclingMessages = useMemo(\n () =>\n loading?.messages && loading.messages.length > 0\n ? loading.messages\n : DEFAULT_LOADING_MESSAGES,\n [loading?.messages],\n );\n const [cycledMessage, setCycledMessage] = useState(cyclingMessages[0]);\n\n useEffect(() => {\n if (!loading || loading.progressMessage) {\n return;\n }\n setCycledMessage(cyclingMessages[0]);\n if (cyclingMessages.length <= 1) {\n return;\n }\n let index = 0;\n const interval = setInterval(() => {\n index = (index + 1) % cyclingMessages.length;\n setCycledMessage(cyclingMessages[index]);\n }, 4000);\n return () => clearInterval(interval);\n }, [loading, cyclingMessages]);\n\n if (!query && !loading) {\n return null;\n }\n\n const isCopied = shareState === 'copied';\n const isLoading = shareState === 'loading';\n\n const productBadge = productBackContext\n ? (() => {\n const { title, imageUrl, backUrl, label } = productBackContext;\n const canNavigateBack = !!backUrl && !!onBackToProduct;\n const content = (\n <>\n <UndoIcon className=\"web5-user-query__product-back-icon\" />\n {imageUrl && !productImageError && (\n <span className=\"web5-user-query__product-back-thumb\">\n <img\n src={imageUrl}\n alt=\"\"\n onError={() => setProductImageError(true)}\n />\n </span>\n )}\n <span className=\"web5-user-query__product-back-title\">{title}</span>\n </>\n );\n return canNavigateBack ? (\n <button\n type=\"button\"\n onClick={() => onBackToProduct?.(backUrl!)}\n aria-label={label ?? `Back to ${title}`}\n className=\"web5-user-query__product-back\"\n >\n {content}\n </button>\n ) : (\n <div className=\"web5-user-query__product-back web5-user-query__product-back--static\">\n {content}\n </div>\n );\n })()\n : null;\n\n if (loading) {\n const progressText = loading.progressMessage ?? cycledMessage;\n return (\n <div\n className={headerClassName}\n role=\"status\"\n aria-busy=\"true\"\n aria-live=\"polite\"\n >\n <div className=\"web5-user-query__left flex-1\">\n {productBadge}\n <p\n className=\"text-[14px] leading-5 text-text-body truncate min-w-0 max-w-[700px]\"\n title={`Asking: ${loading.pendingQuery}`}\n >\n <span className=\"text-text-body/70\">Asking: </span>\n {loading.pendingQuery}\n </p>\n </div>\n {progressText && (\n <div className=\"hidden sm:flex items-center gap-2 ml-[10px] shrink-0 min-w-0\">\n <div\n className=\"w-4 h-4 shrink-0 animate-spin inline-block border-[2px] border-current border-t-transparent text-blue-600 dark:text-blue-500 rounded-full\"\n aria-hidden=\"true\"\n />\n <p className=\"text-[13px] leading-5 text-text-body/70 truncate max-w-[240px]\">\n {progressText}\n </p>\n </div>\n )}\n </div>\n );\n }\n\n return (\n <div className={headerClassName}>\n <div className=\"flex items-center gap-[30px] flex-1 min-w-0\">\n <div className=\"web5-user-query__left\">\n {productBadge}\n <p\n className=\"web5-user-query__title text-[14px] leading-5 text-text-body truncate min-w-0 max-w-[700px]\"\n title={query}\n >\n {query}\n </p>\n </div>\n {hasNavigation && (\n <div className=\"flex items-center gap-[9px]\">\n <button\n type=\"button\"\n onClick={handleBack}\n disabled={!canGoBack}\n title=\"Go to previous conversation\"\n aria-label=\"Go to previous conversation\"\n className=\"w-6 h-6 flex items-center justify-center text-text-body hover:text-black transition-colors bg-transparent border-0 cursor-pointer disabled:opacity-30 disabled:cursor-default\"\n >\n <UndoIcon />\n </button>\n <button\n type=\"button\"\n onClick={handleForward}\n disabled={!canGoForward}\n title=\"Go to next conversation\"\n aria-label=\"Go to next conversation\"\n className=\"w-6 h-6 flex items-center justify-center text-text-body hover:text-black transition-colors bg-transparent border-0 cursor-pointer disabled:opacity-30 disabled:cursor-default\"\n >\n <RedoIcon />\n </button>\n </div>\n )}\n </div>\n <div className=\"flex items-center gap-[10px] ml-[10px] sm:ml-0 shrink-0\">\n {/*\n Keyboard hint. It used to sit inside the prompt field, which was the\n wrong home for it twice over: it competed with the placeholder for the\n same space, and it disappeared exactly when the reader engaged with\n the input — so the shortcut was only ever advertised to someone who\n was not using it. Here it sits with the other page-level affordances\n and stays legible while the reader types.\n\n `aria-hidden` because the shortcut is already announced on the input\n itself via `aria-keyshortcuts`; this is the visual reminder, and\n repeating it to assistive tech would just be noise.\n */}\n <span className=\"web5-prompt-hint\" aria-hidden=\"true\">\n Press <kbd className=\"web5-prompt-hint__key\">/</kbd> to search\n </span>\n {/* Share button — wraps button + tooltips in a relative container */}\n <div className=\"web5-user-query__action group relative\">\n <button\n type=\"button\"\n aria-label=\"Share this\"\n onClick={handleShare}\n disabled={isLoading || isCopied}\n className={`web5-user-query__share flex items-center gap-2 p-[6px] sm:px-[13px] sm:py-[5px] rounded-[30px] text-[13px] leading-5 border-0 cursor-pointer transition-colors disabled:cursor-default\n ${\n isCopied\n ? 'is-copied bg-[#2b2b2b] text-white'\n : 'text-text-body bg-white hover:bg-gray-50'\n }`}\n >\n {isCopied ? <CheckIcon /> : <ShareIcon />}\n <span className=\"hidden sm:inline\">\n {isLoading ? 'Sharing…' : isCopied ? copiedLabel : 'Share'}\n </span>\n </button>\n {/*\n Hover tooltip. Suppressed once the link is copied, because the\n copied state is its own message and two overlapping bubbles saying\n different things is worse than none.\n */}\n {!isCopied && (\n <span className=\"web5-user-query__tooltip\" role=\"tooltip\">\n Share this\n </span>\n )}\n {/* Mobile-only tooltip: drops below the button when link is copied */}\n {isCopied && (\n <div className=\"web5-user-query__copied-toast sm:hidden absolute top-full right-0 mt-1 flex items-center gap-2 bg-[#2b2b2b] text-white text-[12px] leading-none px-3 py-2 rounded-[8px] whitespace-nowrap\">\n <CheckIcon />\n {copiedLabel}\n </div>\n )}\n </div>\n {onNewConversation && (\n <div className=\"web5-user-query__action group relative\">\n <button\n type=\"button\"\n aria-label={newConversationLabel}\n onClick={handleNewConversation}\n className=\"web5-user-query__new-conversation flex items-center gap-2 p-[6px] sm:px-[13px] sm:py-[5px] rounded-[30px] text-[13px] leading-5 text-text-body bg-white border-0 cursor-pointer hover:bg-gray-50 transition-colors\"\n >\n <PlusIcon />\n <span className=\"hidden sm:inline\">{newConversationLabel}</span>\n </button>\n <span className=\"web5-user-query__tooltip\" role=\"tooltip\">\n {newConversationLabel}\n </span>\n </div>\n )}\n {onToggleCommentMode && (\n <button\n type=\"button\"\n onClick={onToggleCommentMode}\n aria-pressed={commentMode}\n title=\"Add a comment\"\n aria-label=\"Add a comment\"\n className={`relative flex items-center gap-2 p-[6px] sm:px-[13px] sm:py-[5px] rounded-[30px] text-[13px] leading-5 border-0 cursor-pointer transition-colors ${\n commentMode\n ? 'bg-[#2b2b2b] text-white'\n : 'text-text-body bg-white hover:bg-gray-50'\n }`}\n >\n <CommentIcon />\n {commentCount > 0 && (\n <span\n className={`absolute -top-1 -right-1 min-w-[18px] h-[18px] px-1 rounded-full text-[10px] leading-[18px] text-center font-semibold ${\n commentMode ? 'bg-white text-[#2b2b2b]' : 'bg-[#2b2b2b] text-white'\n }`}\n >\n {commentCount}\n </span>\n )}\n </button>\n )}\n </div>\n </div>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAQC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAC5E,SAASC,SAAS,QAAQ,mBAAmB;AAC7C,SAASC,SAAS,QAAQ,mBAAmB;AAC7C,SAASC,QAAQ,QAAQ,kBAAkB;AAC3C,S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KE,SAAS,EAAC;EAA2L,gBACxMhF,KAAA,CAAA8E,aAAA,CAACxE,SAAS,MAAE,CAAC,EACZwB,WACE,CAEJ,CAAC,EACLV,iBAAiB,iBAChBpB,KAAA,CAAA8E,aAAA;IAAKE,SAAS,EAAC;EAAwC,gBACrDhF,KAAA,CAAA8E,aAAA;IACEM,IAAI,EAAC,QAAQ;IACb,cAAYvD,oBAAqB;IACjCwD,OAAO,EAAE3C,qBAAsB;IAC/BsC,SAAS,EAAC;EAAoN,gBAE9NhF,KAAA,CAAA8E,aAAA,CAACvE,QAAQ,MAAE,CAAC,eACZP,KAAA,CAAA8E,aAAA;IAAME,SAAS,EAAC;EAAkB,GAAEnD,oBAA2B,CACzD,CAAC,eACT7B,KAAA,CAAA8E,aAAA;IAAME,SAAS,EAAC,0BAA0B;IAACO,IAAI,EAAC;EAAS,GACtD1D,oBACG,CACH,CACN,EACAJ,mBAAmB,iBAClBzB,KAAA,CAAA8E,aAAA;IACEM,IAAI,EAAC,QAAQ;IACbC,OAAO,EAAE5D,mBAAoB;IAC7B,gBAAcC,WAAY;IAC1B+C,KAAK,EAAC,eAAe;IACrB,cAAW,eAAe;IAC1BO,SAAS,EAAE,oJACTtD,WAAW,GACP,yBAAyB,GACzB,0CAA0C;EAC7C,gBAEH1B,KAAA,CAAA8E,aAAA,CAACpE,WAAW,MAAE,CAAC,EACdiB,YAAY,GAAG,CAAC,iBACf3B,KAAA,CAAA8E,aAAA;IACEE,SAAS,EAAE,yHACTtD,WAAW,GAAG,yBAAyB,GAAG,yBAAyB;EAClE,GAEFC,YACG,CAEF,CAEP,CACF,CAAC;AAEV,CAAC","ignoreList":[]}
|
|
@@ -37,7 +37,7 @@ const log = function () {
|
|
|
37
37
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
38
38
|
args[_key] = arguments[_key];
|
|
39
39
|
}
|
|
40
|
-
console.
|
|
40
|
+
console.debug(LOG_PREFIX, ...args);
|
|
41
41
|
} catch {
|
|
42
42
|
// A console that throws must never break a send.
|
|
43
43
|
}
|