@askdialog/dialog-vue 3.9.0 → 3.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/dist/components/DialogSearch/DialogSearchProductCard.vue.d.ts +2 -2
- package/dist/components/DialogSearch/DialogSearchProducts.vue.d.ts +2 -2
- package/dist/components/DialogSearch/searchDisplay.d.ts +8 -3
- package/dist/components/DialogSearch/useDialogSearch.d.ts +4 -4
- package/dist/dialog-vue.js +286 -287
- package/dist/dialog-vue.umd.cjs +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -117,7 +117,7 @@ import '@askdialog/dialog-vue/style.css';
|
|
|
117
117
|
|
|
118
118
|
const client = new Dialog({ apiKey: 'your-api-key', locale: 'en-US', currency: 'USD' });
|
|
119
119
|
|
|
120
|
-
const { controller, state, theme } = useDialogSearch({ client, language: 'en',
|
|
120
|
+
const { controller, state, theme } = useDialogSearch({ client, language: 'en', country: 'US' });
|
|
121
121
|
</script>
|
|
122
122
|
|
|
123
123
|
<template>
|
|
@@ -133,14 +133,14 @@ Creates one search controller per composable instance and disposes it on unmount
|
|
|
133
133
|
**Options:**
|
|
134
134
|
- `client` (Dialog) - Dialog SDK client instance (required)
|
|
135
135
|
- `language` (string, required) - Lowercase ISO 639-1 language code, e.g. `fr`
|
|
136
|
-
- `
|
|
136
|
+
- `country` (string, required) - Shopper's ISO 3166-1 alpha-2 country, e.g. `BE`; prices follow its market
|
|
137
137
|
- `surface` (SearchSurface, optional) - Where results are displayed, for analytics (default: `'search_page'`)
|
|
138
|
-
- `navigate` ((url, hit) => void, optional) - Router adapter called after selection attribution (e.g. `(url) => router.push(url)`). Omit it to let the cards' plain `<a href>` links navigate natively.
|
|
138
|
+
- `navigate` ((url, hit: SearchProductHit) => void, optional) - Router adapter called after selection attribution (e.g. `(url) => router.push(url)`). Omit it to let the cards' plain `<a href>` links navigate natively.
|
|
139
139
|
- `debounceMs` (number, optional) - Keystroke debounce (default: 250)
|
|
140
140
|
- `hitsPerPage` (number, optional) - Results per page (default: 12)
|
|
141
141
|
- `sections` (SearchSection[], optional) - Extra indices searched alongside the products; `collections` fills the collections column of `DialogSearchResults`. Only request an index the catalog exposes: a missing one fails the whole search.
|
|
142
142
|
|
|
143
|
-
Search language and
|
|
143
|
+
Search language and country are explicit and independent of `client.locale`, which can be a regional locale such as `fr-FR`.
|
|
144
144
|
|
|
145
145
|
Options are read once during setup — later changes don't rebind the live controller.
|
|
146
146
|
|
|
@@ -152,7 +152,7 @@ With the collections column, for a catalog that exposes a collections index:
|
|
|
152
152
|
const { controller, state, theme } = useDialogSearch({
|
|
153
153
|
client,
|
|
154
154
|
language: 'en',
|
|
155
|
-
|
|
155
|
+
country: 'US',
|
|
156
156
|
sections: [{ index: 'collections', hitsPerPage: 5 }],
|
|
157
157
|
});
|
|
158
158
|
```
|
|
@@ -169,7 +169,7 @@ Search input: typing runs a debounced search, submitting (Enter) searches immedi
|
|
|
169
169
|
|
|
170
170
|
#### DialogSearchResults
|
|
171
171
|
|
|
172
|
-
Floating results panel overlaying the page content: portaled to `document.body` in `position: fixed`, centered on the bar (up to 1440px wide, filling the viewport) and anchored under the spot where the component is rendered (place it right after the bar), so no ancestor stacking context or `overflow: hidden` can hide it. It shows the same layout as the Shopify search overlay: a collections column on the left when `sections` requests them, the products on the right as a list or a 3-column grid, the query match emphasized in every title, and either a "See all results" button or the pagination controls. Below 768px the panel stacks, collections in a horizontal rail above the products. Colors, radii and font follow the SDK theme (dark palette when `backgroundColor` is dark, straight or rounded corners from `ctaBorderType`). Each card links to the product page and records search attribution (viewport impressions, select on click and middle-click) automatically. Clicking outside the panel (and outside the bar) closes it; typing again or re-focusing the bar reopens it with the results kept.
|
|
172
|
+
Floating results panel overlaying the page content: portaled to `document.body` in `position: fixed`, centered on the bar (up to 1440px wide, filling the viewport) and anchored under the spot where the component is rendered (place it right after the bar), so no ancestor stacking context or `overflow: hidden` can hide it. It shows the same layout as the Shopify search overlay: a collections column on the left when `sections` requests them, the products on the right as a list or a 3-column grid, the query match emphasized in every title, and either a "See all results" button or the pagination controls. Below 768px the panel stacks, collections in a horizontal rail above the products. Colors, radii and font follow the SDK theme (dark palette when `backgroundColor` is dark, straight or rounded corners from `ctaBorderType`). Each product card reads the hit, Algolia's Shopify record: its `product_image` (the variant's `image` when absent), its `title`, its lowest variant price (`variants_min_price`, formatted with `currency`, the base currency of the shopper's market) and its `url`; a hit without a price shows none. Each card links to the product page and records search attribution (viewport impressions, select on click and middle-click) automatically. Clicking outside the panel (and outside the bar) closes it; typing again or re-focusing the bar reopens it with the results kept.
|
|
173
173
|
|
|
174
174
|
**Props:**
|
|
175
175
|
- `controller` (SearchController) - From `useDialogSearch` (required)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { SearchController,
|
|
1
|
+
import { SearchController, SearchProductHit } from '@askdialog/dialog-sdk';
|
|
2
2
|
interface Props {
|
|
3
3
|
controller: SearchController;
|
|
4
|
-
hit:
|
|
4
|
+
hit: SearchProductHit;
|
|
5
5
|
index: number;
|
|
6
6
|
locale?: string;
|
|
7
7
|
/** Committed query, emphasized inside the title. */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { SearchController, SearchResult } from '@askdialog/dialog-sdk';
|
|
1
|
+
import { SearchController, SearchProductHit, SearchResult } from '@askdialog/dialog-sdk';
|
|
2
2
|
import { SearchMessages } from './searchMessages';
|
|
3
3
|
type __VLS_Props = {
|
|
4
4
|
controller: SearchController;
|
|
5
|
-
response: SearchResult
|
|
5
|
+
response: SearchResult<SearchProductHit>;
|
|
6
6
|
locale: string | undefined;
|
|
7
7
|
messages: SearchMessages;
|
|
8
8
|
};
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import { SearchHit,
|
|
2
|
-
/**
|
|
3
|
-
|
|
1
|
+
import { SearchHit, SearchProductHit } from '@askdialog/dialog-sdk';
|
|
2
|
+
/**
|
|
3
|
+
* The lowest variant price only, as on the Shopify storefront search.
|
|
4
|
+
* Hide a missing or invalid price; show a bare amount when currency is absent.
|
|
5
|
+
*/
|
|
6
|
+
export declare const formatSearchPrice: ({ variants_min_price: amount, currency }: SearchProductHit, locale?: string) => string;
|
|
7
|
+
/** The product's image, as Algolia's cards in distinct mode; else the variant's. */
|
|
8
|
+
export declare const hitImage: (hit: SearchProductHit) => string | undefined;
|
|
4
9
|
export declare const safeHref: (url: string) => string | undefined;
|
|
5
10
|
export declare const hitHref: (hit: SearchHit) => string | undefined;
|
|
6
11
|
export declare const hitTitle: (hit: SearchHit) => string;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Dialog, SearchController, SearchControllerState,
|
|
1
|
+
import { Dialog, SearchController, SearchControllerState, SearchProductHit, SearchSection, SearchSurface, Theme } from '@askdialog/dialog-sdk';
|
|
2
2
|
import { ShallowRef } from 'vue';
|
|
3
3
|
export interface UseDialogSearchOptions {
|
|
4
4
|
client: Dialog;
|
|
5
5
|
/** Lowercase ISO 639-1 language code, e.g. `fr`. */
|
|
6
6
|
language: string;
|
|
7
|
-
/** ISO
|
|
8
|
-
|
|
7
|
+
/** Shopper's ISO 3166-1 alpha-2 country, e.g. `BE`; prices follow its market. */
|
|
8
|
+
country: string;
|
|
9
9
|
/** UI surface used in search analytics. */
|
|
10
10
|
surface?: SearchSurface;
|
|
11
11
|
/** Navigate after recording selection; omit to use native links. */
|
|
12
|
-
navigate?: (url: string, hit:
|
|
12
|
+
navigate?: (url: string, hit: SearchProductHit) => void;
|
|
13
13
|
debounceMs?: number;
|
|
14
14
|
hitsPerPage?: number;
|
|
15
15
|
/**
|