@souldi/try-on 0.5.0 → 0.5.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## Unreleased
4
+
5
+ **Breaking.** Refine and the size screen leave the widget (ADR-0095).
6
+
7
+ - **One screen.** The result dialog is one **Try-on** screen. Before a try-on it shows the garment, the customer's size, the cart button and **Try on**; while the try-on is made the garment fades under a progress line, "Creating your try-on…", and the dialog stays open until the result lands. The size on the button opens it, before and after a try-on.
8
+ - **Removed: the size screen.** "How size X sits on you" and its 3D mannequin are gone from the dialog, and the size in the dialog is no longer a button. The mannequin's standalone build is still published, for older bundles that load it.
9
+ - **Removed: Refine.** The dialog has no Refine control, and the button handle's `refine()` is gone. `onError` no longer reports `operation: 'refine'`, and `onGenerationSuccess` / `onResultShown` no longer carry `refinable`. Refine stays in the Souldi API; the widget never sends a `refinement_prompt`.
10
+ - `openSize()` on the button handle still opens the dialog on the customer's size. Before a try-on it now shows the garment and **Try on** there.
11
+
3
12
  ## 0.5.0
4
13
 
5
14
  **Breaking.** `init({ appearance })` replaces the `theme` option.
package/README.md CHANGED
@@ -61,19 +61,20 @@ The result surface is the widget's and only the widget's: an accessible
61
61
  `<dialog>` inside an isolated Shadow DOM, appended to `<body>`. It reads none of
62
62
  your CSS selectors and never touches your product images, so a theme change
63
63
  cannot break it — and there is nothing to point it at. It is also where the
64
- customer decides. It has two screens:
65
-
66
- - **Try-on** — the render, beside the customer's size (when the garment has a
67
- size chart), an **Add size X to cart** button (when you supply
68
- [`onAddToCart`](#onaddtocart)), Refine, and the garment's back view when
69
- there is one.
70
- - **Size** — "How size X sits on you": the same size and cart button beside a
71
- mannequin showing how that size fits the customer's body, and a **Try on**
72
- button (or **View try-on**, once a result exists).
73
-
74
- The dialog can open on **Size** before any try-on has been generated — the
75
- size comes from the customer's measurements, not from a render — so the size
76
- shown on the try-on button opens it, before and after a try-on. The ruler
64
+ customer decides. It is one screen, **Try-on**, in three states:
65
+
66
+ - **Before a try-on** — the garment (the button's `garmentUrl`) beside the
67
+ customer's size (when the garment has a size chart), an **Add size X to
68
+ cart** button (when you supply [`onAddToCart`](#onaddtocart)) and **Try on**.
69
+ - **While it is being made** — the garment fades under a progress line,
70
+ "Creating your try-on…". The dialog stays open and shows the result when it
71
+ lands; closed meanwhile, it reopens with the result.
72
+ - **With a result** — the render, the same size and cart button, and the
73
+ garment's back view when there is one.
74
+
75
+ The dialog can open before any try-on has been generated — the size comes
76
+ from the customer's measurements, not from a render — so the size shown on
77
+ the try-on button opens it, before and after a try-on. The ruler
77
78
  shown on the button before a size exists is a way into sizing: it signs the
78
79
  customer in and takes them to their size, or to their profile when no size is
79
80
  ready yet. Neither ever starts a try-on. **Your profile** (retake the photo,
@@ -117,7 +118,7 @@ Callbacks about a specific try-on receive a trailing `info` object:
117
118
  | Field | Type | Present on | Description |
118
119
  |-------|------|-----------|-------------|
119
120
  | `buttonId` | `string` | most | The `containerId` of the button this callback is about |
120
- | `operation` | `'generate' \| 'refine' \| 'view'` | `onError`, `onResultShown` | Which operation this is about |
121
+ | `operation` | `'generate' \| 'view'` | `onError`, `onResultShown` | Which operation this is about |
121
122
  | `shownInResult` | `boolean` | `onError` | `true` when the widget has already said this inside its open dialog, under the result it failed to change — so you need not say it again |
122
123
  | `view` | `string \| null` | `onGenerationSuccess`, `onResultShown` | The Render View this result is (e.g. `'front'`), when the garment offers more than one |
123
124
  | `how` | `'verified' \| 'shared' \| 'restored'` | `onSignedIn` | How this tab's session began. Only `'verified'` is a *new* sign-in — `'shared'` and `'restored'` are this tab catching up with a session that began elsewhere |
@@ -131,12 +132,9 @@ placed by guessing. Read it whenever you render results yourself.
131
132
  `info` is passed after the existing arguments, so `onGenerationSuccess(url)`
132
133
  and `onError(message)` keep working unchanged.
133
134
 
134
- Note that `onError` with `operation: 'refine'` also covers a refine the widget
135
- *declined* — only the most recently generated result can be refined, so a
136
- request against an older one is reported here rather than silently dropped.
137
- The previous result is untouched either way. A failed `refine` or `view` with
138
- the dialog open is already shown in it (`shownInResult: true`); with the dialog
139
- closed, it is yours to show if you want the customer to see it.
135
+ A failed `view` leaves the previous result untouched. With the dialog open it
136
+ is already shown in it (`shownInResult: true`); with the dialog closed, it is
137
+ yours to show if you want the customer to see it.
140
138
 
141
139
  `onResultShown` receives the same `info` `onGenerationSuccess` did for that
142
140
  result, minus the image URL — it is about the same render, just reported once
@@ -213,7 +211,7 @@ It returns a handle for that button. Among its methods:
213
211
  | Method | Description |
214
212
  |--------|-------------|
215
213
  | `setGarment(garmentUrl)` | Point the button at another garment — a colour switch. The button's previous result is forgotten; a try-on still running for the previous garment is shown when it lands. |
216
- | `openSize()` | Open the dialog on the customer's size, exactly as the size on the button does — for a "check your size" control of your own. Does nothing while the button has no size to show. |
214
+ | `openSize()` | Open the dialog on the customer's size, exactly as the size on the button does — for a "check your size" control of your own. Before a try-on it shows the garment, the size and **Try on**. Does nothing while the button has no size to show. |
217
215
 
218
216
  > **Removed in 0.2.0:** `targetImageId`. It named an `<img>` on your page for the
219
217
  > widget to overwrite with the result, and it is gone — the widget shows every
@@ -327,7 +325,7 @@ The widget then contacts no one but you for its fonts, and a `font-src 'self'` p
327
325
 
328
326
  Your API keys are available in your **Souldi Dashboard**. The publishable key is scoped to the domains you whitelist — it cannot be used from unauthorized origins.
329
327
 
330
- > **Security note:** Authentication and AI generation go through your Souldi API endpoint and are handled server-side. The browser also reaches Souldi's own storage, through short-lived signed URLs the API issues: a photo upload goes straight to it, and result images come from Souldi's image CDN. Beyond Souldi, the browser contacts unpkg (the package's CDN) for two static assets: the fonts, unless you set [`fontsUrl`](#fonts), and the 3D mannequin on the size screen. No other third-party service is contacted.
328
+ > **Security note:** Authentication and AI generation go through your Souldi API endpoint and are handled server-side. The browser also reaches Souldi's own storage, through short-lived signed URLs the API issues: a photo upload goes straight to it, and result images come from Souldi's image CDN. Beyond Souldi, the browser contacts unpkg (the package's CDN) for its fonts, unless you set [`fontsUrl`](#fonts). No other third-party service is contacted.
331
329
 
332
330
  ---
333
331