@@ -4,7 +4,7 @@ Open-source reference implementation of an embeddable size recommendation widget
44
55Use this widget as-is, or as a starting point for building your own custom integration against the API.
66
7- ** [ Live demo] ( https://parcellab.github.io /selection-guide-ui/ ) **
7+ ** [ Live demo] ( https://cdn. parcellab.com/playground /selection-guide-ui/ ) **
88
99** Sample with short info text**
1010
@@ -55,7 +55,7 @@ It ships as a zero-dependency bundle in two formats:
5555 data-not-found-mode =" true-to-size"
5656></div >
5757
58- <script src =" https://parcellab.github.io/ selection-guide-ui/dist /size-recommender.iife.js" defer ></script >
58+ <script src =" https://cdn. parcellab.com/js/ selection-guide-ui/v1 /size-recommender.iife.js" defer ></script >
5959```
6060
6161The IIFE build auto-initializes every ` [data-size-recommender] ` element on the page.
@@ -67,10 +67,15 @@ const widget = window.SizeRecommender.init({
6767 target: ' #size-recommender' ,
6868 accountId: 1617954 ,
6969 productId: " Men's Iver Pants (tailored fit)" ,
70+ locale: ' de' ,
7071 appearance: ' neutral' ,
7172 density: ' compact' ,
7273 surface: ' subtle' ,
7374 notFoundMode: ' true-to-size' ,
75+ showPill: true ,
76+ showScale: true ,
77+ showRecommendation: true ,
78+ showSummary: true ,
7479 className: ' merchant-fit-widget' ,
7580 theme: {
7681 backgroundColor: ' #f6f6f6' ,
@@ -121,13 +126,17 @@ Full API documentation: [Size Recommender API Reference](https://product-api.par
121126| ` accountId ` | ` number \| string ` | — | ** Required** . parcelLab account identifier. |
122127| ` productId ` | ` string ` | — | ** Required** . Product identifier passed to the API. |
123128| ` articleName ` | ` string ` | — | Legacy alias for ` productId ` . Still accepted for backwards compatibility. |
124- | ` locale ` | ` string ` | ` 'en' ` | Locale for default messages. |
129+ | ` locale ` | ` string ` | ` 'en' ` | Language for default messages. Supported: ` en ` , ` de ` , ` fr ` , ` it ` , ` es ` . |
125130| ` messages ` | ` Partial<WidgetMessages> ` | — | Override any default message string. |
126- | ` notFoundMode ` | ` 'empty' \| 'true-to-size' ` | ` 'empty' ` | Behavior when the API returns 404 (see below) . |
131+ | ` notFoundMode ` | ` 'empty' \| 'true-to-size' \| 'hidden' ` | ` 'empty' ` | Behavior when the API returns 404. ` hidden ` hides the widget entirely . |
127132| ` apiBaseUrl ` | ` string ` | ` 'https://product-api.parcellab.com' ` | Override the API base URL. |
128133| ` appearance ` | ` 'neutral' \| 'colored' ` | ` 'neutral' ` | ` neutral ` is grayscale; ` colored ` uses gradient track. |
129134| ` density ` | ` 'compact' \| 'comfortable' ` | ` 'compact' ` | ` compact ` suits PDP sidebars; ` comfortable ` adds more spacing. |
130135| ` surface ` | ` 'subtle' \| 'plain' ` | ` 'subtle' ` | ` subtle ` renders a light card; ` plain ` renders inline. |
136+ | ` showPill ` | ` boolean ` | ` true ` | Show or hide the fit category pill badge. |
137+ | ` showScale ` | ` boolean ` | ` true ` | Show or hide the fit position scale bar. |
138+ | ` showRecommendation ` | ` boolean ` | ` true ` | Show or hide the entire recommendation box. |
139+ | ` showSummary ` | ` boolean ` | ` true ` | Show or hide the LLM summary within the recommendation. |
131140| ` className ` | ` string ` | — | Extra CSS classes added to the root element. |
132141| ` theme ` | ` Partial<WidgetTheme> ` | — | CSS token overrides (colors, radius, etc.). |
133142
@@ -144,7 +153,11 @@ When using the IIFE auto-init, configure via `data-*` attributes:
144153 data-appearance =" colored"
145154 data-density =" comfortable"
146155 data-surface =" plain"
147- data-locale =" en"
156+ data-locale =" de"
157+ data-show-pill =" true"
158+ data-show-scale =" true"
159+ data-show-recommendation =" true"
160+ data-show-summary =" false"
148161 data-messages =' {"title":"How It Fits"}'
149162 data-theme =' {"backgroundColor":"#f6f6f6","radius":"12px"}'
150163 data-class-name =" my-custom-class"
@@ -153,10 +166,11 @@ When using the IIFE auto-init, configure via `data-*` attributes:
153166
154167## 404 Handling
155168
156- When a product has no recommendation data, the widget supports two modes:
169+ When a product has no recommendation data, the widget supports three modes:
157170
158171- ** ` empty ` ** (default) — shows a "no data available" message
159172- ** ` true-to-size ` ** — renders a "likely true to size" fallback without confidence or summary
173+ - ** ` hidden ` ** — hides the widget entirely (` display: none ` ); the widget reappears when valid data is provided via ` update() ` or ` refresh() `
160174
161175## Styling
162176
@@ -169,7 +183,7 @@ The widget renders in **light DOM** (not Shadow DOM), so host-page typography in
169183.pl-size-recommender--{neutral|colored}
170184.pl-size-recommender--density-{compact|comfortable}
171185.pl-size-recommender--surface-{subtle|plain}
172- .pl-size-recommender--state-{loading|ready|fallback-true|empty|error}
186+ .pl-size-recommender--state-{loading|ready|fallback-true|empty|error|hidden }
173187.pl-size-recommender--fit-{small|true|large|unknown}
174188```
175189
@@ -266,15 +280,19 @@ npm test
266280
267281Runs the Vitest test suite with jsdom.
268282
269- ### GitHub Pages
283+ ### Deployment
270284
271- ``` sh
272- npm run build:pages
273- ```
285+ The project deploys to S3/CloudFront via GitHub Actions:
286+
287+ - ** Staging:** automatically deployed on push to ` main ` to ` s3://parcellab-cdn/playground/selection-guide-ui/ `
288+ - ** Production:** deployed on GitHub release to ` s3://parcellab-cdn/js/selection-guide-ui/v1/ ` (latest) and ` s3://parcellab-cdn/apps/selection-guide-ui/v1/{tag}/ ` (versioned)
274289
275- Builds a static demo site to ` site/ ` . The repository is configured to deploy this automatically via GitHub Actions on push to ` main ` .
290+ Build the demo site locally:
276291
277- ** Demo URL:** [ https://parcellab.github.io/selection-guide-ui/ ] ( https://parcellab.github.io/selection-guide-ui/ )
292+ ``` sh
293+ npm run build
294+ npm run build:site
295+ ```
278296
279297## Building Your Own
280298
0 commit comments