seeonwall 0.4.0 → 0.6.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 CHANGED
@@ -54,11 +54,47 @@ Everything in `PosterParams`, plus:
54
54
  |---|---|---|
55
55
  | `posterSizes` | `string[]` or `string` | An array is joined with commas for you. |
56
56
  | `className`, `style` | | Applied to the mount element. |
57
+ | `variant` | `solid` \| `outline` \| `glyph` \| `icon` | The shape of the button. Default `solid`. |
58
+ | `fullWidth` | boolean | Stretches the button to the width of its container. |
57
59
  | `backgroundColor`, `textColor`, `borderRadius`, `borderColor` | | Button appearance. |
58
60
  | `buttonClassName` | | Your theme's classes, added after the widget's own. |
59
61
  | `matchButton` | selector | Copies shape and typography from one of your own buttons. |
60
62
  | `matchColors` | boolean | Also copies its colours. |
61
63
 
64
+ ### Button shapes
65
+
66
+ `variant` says which parts of the button are painted; the colour props say what colour
67
+ they are. The two are independent, so any shape can carry your colours or your theme's.
68
+
69
+ | | |
70
+ |---|---|
71
+ | `solid` | A filled button with a label. The default, and what the button looked like before. |
72
+ | `outline` | The same box with no fill. |
73
+ | `glyph` | The mark and the label, with no box. Reads as a secondary action. |
74
+ | `icon` | The mark alone, 40px square. It fits beside Add to cart rather than under it. |
75
+
76
+ ```tsx
77
+ <SeeOnWallButton posterUrl={product.image} variant="glyph" />
78
+ ```
79
+
80
+ The three shapes with no fill take their colour from the text around them, so they suit a
81
+ light or a dark theme with nothing to set. That also decides which colour props have
82
+ somewhere to land: `backgroundColor` reaches `solid` alone, and `borderColor` and
83
+ `borderRadius` do not reach `glyph`. `textColor` reaches every shape — it paints the label,
84
+ the mark, and the `outline` border when `borderColor` is absent. Passing a colour a shape
85
+ cannot use is harmless; it applies again as soon as you change back to a shape that can.
86
+
87
+ `glyph` and `icon` ignore `matchButton`: they draw no box to match, and they take the host
88
+ page's own font. `outline` still matches shape and typography, but not colours — a colour
89
+ picked against a filled Add to cart disappears on your page background.
90
+
91
+ `fullWidth` stretches `solid`, `outline` and `glyph` to the width of the element that holds
92
+ them. `icon` stays 40px square whatever you pass — a wide button with one mark in it is a
93
+ target a shopper cannot read.
94
+
95
+ Under `icon` the label is still resolved and translated as usual. It becomes the button's
96
+ accessible name and its tooltip, so a screen reader still announces it.
97
+
62
98
  ## Vanilla JavaScript
63
99
 
64
100
  ```js
@@ -82,6 +118,9 @@ Then mark any element on the page as a button mount, and the widget puts a
82
118
  Mounts added later are picked up automatically, so client-side navigation works
83
119
  without another call to `load()`.
84
120
 
121
+ The shapes above are `data-button-variant="outline" | "glyph" | "icon"` on the mount, and
122
+ `data-button-width="full"` stretches the button to its container.
123
+
85
124
  The full list of `data-*` attributes — sizes, frames, passe-partout, per-button
86
125
  language — is in the [integration docs](https://seeonwall.com/docs).
87
126
 
@@ -120,9 +159,11 @@ the part of your app that uses SeeOnWall.
120
159
  | `open(params)` | Opens the preview for one poster. |
121
160
  | `close()` | Closes the preview. |
122
161
  | `setLanguage(lang)` | Changes language at runtime. Only needed if your language switcher does not update `<html lang>`. |
123
- | `isSessionReady()` | Returns the cached readiness hint for the current shop session. It is for optional catalogue UI, never authorization. |
162
+ | `isSessionReady()` | Returns the cached readiness hint for the current shop session. It is for optional fast wall preview controls, never authorization. |
124
163
  | `refreshSessionState()` | Refreshes the safe session hint and resolves to `none`, `creating`, `ready`, or `expired`. |
125
164
  | `on('session-change', listener)` | Reacts to session changes in this or another same-origin shop tab. Returns an unsubscribe function. |
165
+ | `openCataloguePreview(params)` | Previews one poster on the wall the shopper already prepared. Resolves to `{ opened: true }` or a reason. |
166
+ | `whenLoaded()` | Resolves once the widget is available, including when `load()` has not been called yet. |
126
167
  | `destroy()` | Stops the widget and removes everything it added. |
127
168
  | `snippetVersion()` | The loaded widget version, or `null`. Useful in bug reports. |
128
169
 
@@ -132,6 +173,7 @@ From `seeonwall/react`:
132
173
  |---|---|
133
174
  | `useSeeOnWall(options)` | Loads the widget for as long as a component needs it. Same options as `load()`. |
134
175
  | `SeeOnWallButton` | Renders a mount for the widget's button. |
176
+ | `useSessionReady()` | `true` while the shopper has a wall ready for this shop. Re-renders when that changes. |
135
177
 
136
178
  ### `load(options)`
137
179
 
@@ -156,8 +198,70 @@ if (isSessionReady()) showCatalogueComparison()
156
198
 
157
199
  const unsubscribe = on('session-change', updateCatalogueControls)
158
200
  // Call unsubscribe() when the page or component is disposed.
201
+ //
202
+ // The listener also runs when the shopper comes back to your page after setting
203
+ // up a wall on a phone, which is the moment the controls first make sense.
159
204
  ```
160
205
 
206
+ In React, prefer the hook — it subscribes, unsubscribes and re-renders for you:
207
+
208
+ ```tsx
209
+ import { useSessionReady } from 'seeonwall/react'
210
+
211
+ function CompareButton(props) {
212
+ if (!useSessionReady()) return null
213
+ return <button onClick={() => openCataloguePreview(props)}>See on your wall</button>
214
+ }
215
+ ```
216
+
217
+ It returns `false` on the server and on the first paint, so server and client markup agree, and it
218
+ turns `true` once the widget loads and finds a stored session.
219
+
220
+ ### Fast wall preview
221
+
222
+ `openCataloguePreview(params)` shows one poster on the wall the shopper set up earlier, without
223
+ repeating the photo step. Use it on listing and recommendation surfaces, where the shopper is
224
+ comparing products rather than configuring one.
225
+
226
+ It takes the same `PosterParams` as `open()`, and it never throws — a refusal comes back as a
227
+ reason, so a control that ignores the result looks like a button that does nothing.
228
+
229
+ ```ts
230
+ import { isSessionReady, openCataloguePreview } from 'seeonwall'
231
+
232
+ // Show the control only once a wall exists; the first-time visitor has none.
233
+ if (isSessionReady()) {
234
+ const result = await openCataloguePreview({
235
+ posterUrl: 'https://cdn.myshop.com/posters/dune.jpg',
236
+ posterTitle: 'Dune',
237
+ posterWidth: '50cm',
238
+ posterHeight: '70cm',
239
+ })
240
+ if (!result.opened) reportToShopper(result.reason)
241
+ }
242
+ ```
243
+
244
+ | reason | |
245
+ |---|---|
246
+ | `no-ready-session` | The shopper has not set up a wall yet. Use `isSessionReady()` to avoid this one. |
247
+ | `session-expired` | The stored session is gone. Sessions last seven days. |
248
+ | `not-entitled` | The shop plan does not include fast wall preview. |
249
+ | `inactive-product` | The product is not active for SeeOnWall. Shopify and WooCommerce only. |
250
+ | `disabled` | The merchant turned fast wall preview off. Shopify and WooCommerce only. |
251
+ | `invalid-poster-data` | A missing poster URL, or a width or height that could not be read. |
252
+ | `poster-unavailable` | The artwork could not be prepared for preview. |
253
+ | `rate-limited` | Too many requests from this shopper. |
254
+ | `network-error` | The request did not complete. |
255
+ | `unsupported` | The widget on the page is older than this function. See below. |
256
+
257
+ Fast wall preview needs a paid SeeOnWall plan. Calling this function is itself the decision to show
258
+ it, so there is no separate switch for a script-tag storefront; the Shopify and WooCommerce apps keep
259
+ that choice in their own settings. Without a paid plan the call resolves with `not-entitled`.
260
+
261
+ The package fetches the widget at runtime rather than bundling it, so a browser can still hold a
262
+ copy from before this function existed. That copy resolves `unsupported` instead of failing, and it
263
+ keeps working for everything else. Treat `unsupported` as "not available here", not as an error.
264
+
161
265
  ## Notes
162
266
 
163
267
  **Server rendering is safe.** Every function returns quietly when there is no
package/dist/index.d.ts CHANGED
@@ -2,6 +2,20 @@ import type { PosterParams, SizeUnit } from './types.js';
2
2
  export type { PosterParams, SizeUnit };
3
3
  /** The safe storefront state returned by the readiness refresh. */
4
4
  export type StorefrontSessionState = 'none' | 'creating' | 'ready' | 'expired';
5
+ /**
6
+ * Why a fast wall preview did not open.
7
+ *
8
+ * The snippet gives all of these values but the last one. The package adds
9
+ * `unsupported`. The package gets the snippet at runtime, thus the copy on the
10
+ * page can be older than the package and can have no fast wall preview. Refer
11
+ * to ADR 172.
12
+ */
13
+ export type CataloguePreviewLaunchResult = {
14
+ opened: true;
15
+ } | {
16
+ opened: false;
17
+ reason: 'no-ready-session' | 'session-expired' | 'inactive-product' | 'invalid-poster-data' | 'poster-unavailable' | 'not-entitled' | 'disabled' | 'rate-limited' | 'network-error' | 'unsupported';
18
+ };
5
19
  export interface LoadOptions {
6
20
  /** Your shop id. You get the shop id from the SeeOnWall dashboard. */
7
21
  shopId: string;
@@ -31,6 +45,12 @@ interface SnippetApi {
31
45
  isSessionReady: () => boolean;
32
46
  refreshSessionState: () => Promise<StorefrontSessionState>;
33
47
  on: (event: 'session-change', listener: () => void) => () => void;
48
+ /**
49
+ * Optional on purpose. A snippet that is older than this function does not
50
+ * have it, and {@link isRestartable} must not refuse such a copy. The refusal
51
+ * would stop the widget for a merchant who does not use fast wall preview.
52
+ */
53
+ openCataloguePreview?: (params: PosterParams) => Promise<CataloguePreviewLaunchResult>;
34
54
  version: string;
35
55
  }
36
56
  interface SnippetConfig {
@@ -71,15 +91,42 @@ export declare function close(): void;
71
91
  * function only if your language selector does not change that attribute.
72
92
  */
73
93
  export declare function setLanguage(lang: string): void;
94
+ /**
95
+ * Completes when the widget is available.
96
+ *
97
+ * The promise waits for a load that starts later. It does not complete early
98
+ * because no load is in progress yet. Thus the order of two React effects
99
+ * cannot make a caller miss the widget.
100
+ *
101
+ * The promise does not fail. A load that fails leaves the caller waiting for
102
+ * the next attempt. On the server the promise completes immediately.
103
+ */
104
+ export declare function whenLoaded(): Promise<void>;
74
105
  /**
75
106
  * Returns the snippet's cached readiness hint for the current storefront session.
76
- * It is useful for optional catalogue UI and is never authorization.
107
+ * It is useful for optional fast wall preview controls and is never authorization.
77
108
  */
78
109
  export declare function isSessionReady(): boolean;
79
110
  /** Refreshes the storefront-safe session state from the SeeOnWall API. */
80
111
  export declare function refreshSessionState(): Promise<StorefrontSessionState>;
81
112
  /** Subscribes to same-origin storefront session changes and returns an unsubscribe function. */
82
113
  export declare function on(event: 'session-change', listener: () => void): () => void;
114
+ /**
115
+ * Opens a read-only preview of one poster on the wall that the shopper prepared
116
+ * before. The function does not start the camera flow, thus it needs a session
117
+ * that is already ready.
118
+ *
119
+ * The function does not throw. It gives a reason instead. Show the reason, or
120
+ * hide your control when {@link isSessionReady} is false. A silent call looks
121
+ * like a button that does nothing.
122
+ *
123
+ * The shop must have a paid plan. Without one the call gives `not-entitled`.
124
+ * There is no separate switch for a storefront that loads this package: the
125
+ * call is itself the decision to offer the control. The Shopify and WooCommerce
126
+ * apps keep that choice in their own settings, and give `disabled` when a
127
+ * merchant turns it off there.
128
+ */
129
+ export declare function openCataloguePreview(params: PosterParams): Promise<CataloguePreviewLaunchResult>;
83
130
  /**
84
131
  * Stops the snippet. The function removes the buttons, the styles, the
85
132
  * observers and the listeners of the snippet.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAExD,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAA;AAEtC,mEAAmE;AACnE,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,UAAU,GAAG,OAAO,GAAG,SAAS,CAAA;AAY9E,MAAM,WAAW,WAAW;IAC1B,sEAAsE;IACtE,MAAM,EAAE,MAAM,CAAA;IACd,kFAAkF;IAClF,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,iEAAiE;AACjE,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IACzB,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1B,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,IAAI,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAA;IACpC,KAAK,EAAE,MAAM,IAAI,CAAA;IACjB,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACnC,cAAc,EAAE,MAAM,OAAO,CAAA;IAC7B,mBAAmB,EAAE,MAAM,OAAO,CAAC,sBAAsB,CAAC,CAAA;IAC1D,EAAE,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AAaD;;;;;;;;GAQG;AACH,wBAAgB,OAAO,IAAI,IAAI,CAY9B;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,MAAM,GAAG,IAAI,CAE9C"}
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ const UNSUPPORTED = { opened: false, reason: 'unsupported' };
1
2
  /**
2
3
  * The location of the snippet file.
3
4
  *
@@ -9,6 +10,24 @@
9
10
  const DEFAULT_SCRIPT_URL = 'https://seeonwall.com/seeonwall.js';
10
11
  let loading = null;
11
12
  let api = null;
13
+ /**
14
+ * One promise for every caller that waits for the widget.
15
+ *
16
+ * A wait can start before load() does. React runs the effect of a child before
17
+ * the effect of its parent, thus a component that watches the session usually
18
+ * starts before the component that loads the widget.
19
+ *
20
+ * All callers share one promise. A new promise for each caller would keep one
21
+ * more object for as long as no load occurs.
22
+ */
23
+ let loadedPromise = null;
24
+ let resolveLoaded = null;
25
+ function announceLoaded() {
26
+ const resolve = resolveLoaded;
27
+ loadedPromise = null;
28
+ resolveLoaded = null;
29
+ resolve?.();
30
+ }
12
31
  /**
13
32
  * True when the caller wants the widget to run.
14
33
  *
@@ -69,7 +88,10 @@ function isRestartable(candidate) {
69
88
  typeof candidate.setLanguage === 'function' &&
70
89
  typeof candidate.isSessionReady === 'function' &&
71
90
  typeof candidate.refreshSessionState === 'function' &&
72
- typeof candidate.on === 'function');
91
+ typeof candidate.on === 'function'
92
+ // openCataloguePreview is absent from this list on purpose. Refer to the
93
+ // note on that member of the interface.
94
+ );
73
95
  }
74
96
  /** Stops the widget and forgets it. The caller must set `active` first. */
75
97
  function stop() {
@@ -129,6 +151,7 @@ export function load(options) {
129
151
  if (!loading) {
130
152
  loading = start(options).then((loaded) => {
131
153
  api = loaded;
154
+ announceLoaded();
132
155
  // A call to destroy() can occur while the widget loads. The widget
133
156
  // starts itself when its script runs, thus the loader must stop it now.
134
157
  // Before this point there was no widget to stop.
@@ -186,9 +209,30 @@ export function close() {
186
209
  export function setLanguage(lang) {
187
210
  withApi((loaded) => { loaded.setLanguage(lang); }, 'setLanguage');
188
211
  }
212
+ /**
213
+ * Completes when the widget is available.
214
+ *
215
+ * The promise waits for a load that starts later. It does not complete early
216
+ * because no load is in progress yet. Thus the order of two React effects
217
+ * cannot make a caller miss the widget.
218
+ *
219
+ * The promise does not fail. A load that fails leaves the caller waiting for
220
+ * the next attempt. On the server the promise completes immediately.
221
+ */
222
+ export function whenLoaded() {
223
+ if (!isBrowser() || api) {
224
+ return Promise.resolve();
225
+ }
226
+ if (!loadedPromise) {
227
+ loadedPromise = new Promise((resolve) => {
228
+ resolveLoaded = resolve;
229
+ });
230
+ }
231
+ return loadedPromise;
232
+ }
189
233
  /**
190
234
  * Returns the snippet's cached readiness hint for the current storefront session.
191
- * It is useful for optional catalogue UI and is never authorization.
235
+ * It is useful for optional fast wall preview controls and is never authorization.
192
236
  */
193
237
  export function isSessionReady() {
194
238
  return isBrowser() && api?.isSessionReady() === true;
@@ -209,19 +253,56 @@ export function on(event, listener) {
209
253
  return () => undefined;
210
254
  let cancelled = false;
211
255
  let unsubscribe;
212
- const subscribe = (loaded) => {
213
- if (!cancelled)
214
- unsubscribe = loaded.on(event, listener);
256
+ const subscribe = () => {
257
+ if (!cancelled && api)
258
+ unsubscribe = api.on(event, listener);
215
259
  };
260
+ // Through whenLoaded(), and not through `loading`, because a subscription can
261
+ // start before load(). The earlier form did nothing at all in that case.
216
262
  if (api)
217
- subscribe(api);
218
- else if (loading)
219
- void loading.then(subscribe).catch(() => undefined);
263
+ subscribe();
264
+ else
265
+ void whenLoaded().then(subscribe);
220
266
  return () => {
221
267
  cancelled = true;
222
268
  unsubscribe?.();
223
269
  };
224
270
  }
271
+ /**
272
+ * Opens a read-only preview of one poster on the wall that the shopper prepared
273
+ * before. The function does not start the camera flow, thus it needs a session
274
+ * that is already ready.
275
+ *
276
+ * The function does not throw. It gives a reason instead. Show the reason, or
277
+ * hide your control when {@link isSessionReady} is false. A silent call looks
278
+ * like a button that does nothing.
279
+ *
280
+ * The shop must have a paid plan. Without one the call gives `not-entitled`.
281
+ * There is no separate switch for a storefront that loads this package: the
282
+ * call is itself the decision to offer the control. The Shopify and WooCommerce
283
+ * apps keep that choice in their own settings, and give `disabled` when a
284
+ * merchant turns it off there.
285
+ */
286
+ export function openCataloguePreview(params) {
287
+ if (!isBrowser()) {
288
+ return Promise.resolve(UNSUPPORTED);
289
+ }
290
+ if (api) {
291
+ return launchCataloguePreview(api, params);
292
+ }
293
+ if (loading) {
294
+ return loading.then((loaded) => launchCataloguePreview(loaded, params), () => UNSUPPORTED);
295
+ }
296
+ console.warn('[seeonwall] You called openCataloguePreview() before load(). Call load({ shopId }) first.');
297
+ return Promise.resolve(UNSUPPORTED);
298
+ }
299
+ /** Calls the snippet, or reports that this copy of the snippet is too old. */
300
+ function launchCataloguePreview(loaded, params) {
301
+ if (typeof loaded.openCataloguePreview !== 'function') {
302
+ return Promise.resolve(UNSUPPORTED);
303
+ }
304
+ return loaded.openCataloguePreview(params);
305
+ }
225
306
  /**
226
307
  * Stops the snippet. The function removes the buttons, the styles, the
227
308
  * observers and the listeners of the snippet.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA;;;;;;;GAOG;AACH,MAAM,kBAAkB,GAAG,oCAAoC,CAAA;AAiD/D,IAAI,OAAO,GAA+B,IAAI,CAAA;AAC9C,IAAI,GAAG,GAAsB,IAAI,CAAA;AAEjC;;;;;;;GAOG;AACH,IAAI,MAAM,GAAG,KAAK,CAAA;AAElB;;;;;;GAMG;AACH,SAAS,SAAS;IAChB,OAAO,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,QAAQ,KAAK,WAAW,CAAA;AACzE,CAAC;AAED;;;;;;GAMG;AACH,SAAS,QAAQ,CAAC,OAAoB;IACpC,OAAO;QACL,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,GAAG,CAAC,OAAO,CAAC,QAAQ,K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AK,CAAA;IACd,IAAI,GAAG,EAAE,CAAC;QACR,IAAI,EAAE,CAAA;IACR,CAAC;IACD,2EAA2E;IAC3E,2EAA2E;IAC3E,4EAA4E;IAC5E,iDAAiD;AACnD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc;IAC5B,OAAO,GAAG,EAAE,OAAO,IAAI,IAAI,CAAA;AAC7B,CAAC"}
package/dist/react.d.ts CHANGED
@@ -13,8 +13,59 @@ export type { LoadOptions, PosterParams };
13
13
  * runs this sequence two times in development. The result is the same.
14
14
  */
15
15
  export declare function useSeeOnWall(options: LoadOptions): void;
16
+ /**
17
+ * Returns true while the shopper has a wall that is ready for this shop.
18
+ *
19
+ * Use the value to show or hide an optional control, for example a button that
20
+ * calls `openCataloguePreview` from the main entry. The value is a hint of the
21
+ * browser. It is never authorization: the server examines the session again on
22
+ * each action.
23
+ *
24
+ * The value is false on the server and on the first paint. It becomes true
25
+ * after the widget loads, thus your markup is the same on both sides.
26
+ */
27
+ export declare function useSessionReady(): boolean;
28
+ /**
29
+ * The shape of the button.
30
+ *
31
+ * A shape says which parts of the button are painted. The colour settings say
32
+ * what colour they are. The two questions are independent: each shape can carry
33
+ * your own colours, or the colours of your theme.
34
+ *
35
+ * - `solid` a filled button with a label. The default.
36
+ * - `outline` the same box with no fill.
37
+ * - `glyph` the mark and the label, with no box.
38
+ * - `icon` the mark alone.
39
+ */
40
+ export type ButtonVariant = 'solid' | 'outline' | 'glyph' | 'icon';
16
41
  /** The appearance settings that a merchant can set for one button. */
17
42
  export interface SeeOnWallButtonStyleProps {
43
+ /**
44
+ * The shape of the button. The default is `"solid"`, which is the button that
45
+ * this package gave before the shapes came. Refer to {@link ButtonVariant}.
46
+ *
47
+ * The three shapes with no fill take the colour of the text around them. Thus
48
+ * they agree with a light theme and with a dark theme, and you set nothing.
49
+ *
50
+ * A colour that a shape does not paint does nothing. `backgroundColor`
51
+ * reaches `"solid"` only, and `borderColor` and `borderRadius` do not reach
52
+ * `"glyph"`. `textColor` reaches every shape: it paints the label, the mark,
53
+ * and the border of `"outline"` if you give no border colour.
54
+ *
55
+ * With `"icon"` the label stays. It becomes the accessible name of the button
56
+ * and the tooltip, thus the button keeps a name that a screen reader reads.
57
+ */
58
+ variant?: ButtonVariant;
59
+ /**
60
+ * Stretches the button to the full width of the element that holds it. The
61
+ * default is the natural width of the button.
62
+ *
63
+ * The shape decides how far this setting goes. `"solid"`, `"outline"` and
64
+ * `"glyph"` become as wide as the element, and `"glyph"` puts its mark and
65
+ * its label in the middle. `"icon"` stays 40px square: a wide button with one
66
+ * mark in it is a target that the shopper cannot read.
67
+ */
68
+ fullWidth?: boolean;
18
69
  /** The background colour of the button, for example `"#b5502a"`. */
19
70
  backgroundColor?: string;
20
71
  /** The text colour of the button. */
@@ -31,9 +82,18 @@ export interface SeeOnWallButtonStyleProps {
31
82
  /**
32
83
  * A CSS selector for a button of your theme to copy. The widget copies the
33
84
  * shape and the typography of that button. It does not copy the colours.
85
+ *
86
+ * The shapes with no box, `"glyph"` and `"icon"`, do not copy a button. There
87
+ * is no box to copy, and they take the font of the page.
34
88
  */
35
89
  matchButton?: string;
36
- /** Copies the colours of the button named in `matchButton` as well. */
90
+ /**
91
+ * Copies the colours of the button named in `matchButton` as well.
92
+ *
93
+ * The shapes with no fill do not copy the colours. A colour that was selected
94
+ * against a fill, for example white on a black button, disappears on the
95
+ * background of the page.
96
+ */
37
97
  matchColors?: boolean;
38
98
  }
39
99
  export interface SeeOnWallButtonProps extends Omit<PosterParams, 'posterSizes'>, SeeOnWallButtonStyleProps {
@@ -1 +1 @@
1
- {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAExD,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAE3D,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,CAAA;AAY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AAED;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAA;AAElE,sEAAsE;AACtE,MAAM,WAAW,yBAAyB;IACxC;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,oEAAoE;IACpE,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,qCAAqC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,4DAA4D;IAC5D,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,uCAAuC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED,MAAM,WAAW,oBACf,SAAQ,IAAI,CAAC,YAAY,EAAE,aAAa,CAAC,EACvC,yBAAyB;IAC3B;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAAA;IAC/B,qDAAqD;IACrD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,oDAAoD;IACpD,KAAK,CAAC,EAAE,aAAa,CAAA;CACtB;AAiBD;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,YAAY,CAyEzE"}
package/dist/react.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useEffect } from 'react';
3
- import { load, destroy } from './index.js';
2
+ import { useEffect, useSyncExternalStore } from 'react';
3
+ import { load, destroy, isSessionReady, on, whenLoaded } from './index.js';
4
4
  /**
5
5
  * The number of components that use the widget at this moment.
6
6
  *
@@ -44,6 +44,39 @@ export function useSeeOnWall(options) {
44
44
  // again with the new value.
45
45
  }, [shopId, embedUrl, lang, sizeUnit, scriptUrl]);
46
46
  }
47
+ /**
48
+ * Watches the widget for a session that is ready.
49
+ *
50
+ * The snippet does not report a change when it starts, thus a session that was
51
+ * already in storage becomes visible only when the widget arrives. The
52
+ * subscription below reads the value again at that moment.
53
+ */
54
+ function subscribeToSession(onStoreChange) {
55
+ let cancelled = false;
56
+ const unsubscribe = on('session-change', onStoreChange);
57
+ void whenLoaded().then(() => {
58
+ if (!cancelled)
59
+ onStoreChange();
60
+ });
61
+ return () => {
62
+ cancelled = true;
63
+ unsubscribe();
64
+ };
65
+ }
66
+ /**
67
+ * Returns true while the shopper has a wall that is ready for this shop.
68
+ *
69
+ * Use the value to show or hide an optional control, for example a button that
70
+ * calls `openCataloguePreview` from the main entry. The value is a hint of the
71
+ * browser. It is never authorization: the server examines the session again on
72
+ * each action.
73
+ *
74
+ * The value is false on the server and on the first paint. It becomes true
75
+ * after the widget loads, thus your markup is the same on both sides.
76
+ */
77
+ export function useSessionReady() {
78
+ return useSyncExternalStore(subscribeToSession, isSessionReady, () => false);
79
+ }
47
80
  /**
48
81
  * Adds a value to the map of attributes, but only when the value is present.
49
82
  * An absent attribute and an empty attribute do not mean the same thing to the
@@ -66,7 +99,7 @@ function attr(target, name, value) {
66
99
  * arrives.
67
100
  */
68
101
  export function SeeOnWallButton(props) {
69
- const { posterUrl, posterTitle, sizeUnit, posterWidth, posterHeight, posterSizes, posterInset, productPageUrl, lang, frameDefaultCm, frameDefaultColor, framePreset, backgroundColor, textColor, borderRadius, borderColor, buttonClassName, matchButton, matchColors, className, style, } = props;
102
+ const { posterUrl, posterTitle, sizeUnit, posterWidth, posterHeight, posterSizes, posterInset, productPageUrl, lang, frameDefaultCm, frameDefaultColor, framePreset, variant, fullWidth, backgroundColor, textColor, borderRadius, borderColor, buttonClassName, matchButton, matchColors, className, style, } = props;
70
103
  const attributes = {};
71
104
  attr(attributes, 'data-poster-url', posterUrl);
72
105
  attr(attributes, 'data-poster-title', posterTitle);
@@ -80,6 +113,16 @@ export function SeeOnWallButton(props) {
80
113
  attr(attributes, 'data-frame-default-cm', frameDefaultCm);
81
114
  attr(attributes, 'data-frame-default-color', frameDefaultColor);
82
115
  attr(attributes, 'data-frame-preset', framePreset);
116
+ // A mount with no attribute is a solid button to the widget. Thus the default
117
+ // shape writes nothing, and the markup stays as it was before the shapes came.
118
+ if (variant !== undefined && variant !== 'solid') {
119
+ attributes['data-button-variant'] = variant;
120
+ }
121
+ // The widget reads the value "full" and no other value. Thus the attribute is
122
+ // absent for a button of the natural width, as it is for the default shape.
123
+ if (fullWidth === true) {
124
+ attributes['data-button-width'] = 'full';
125
+ }
83
126
  attr(attributes, 'data-bg-color', backgroundColor);
84
127
  attr(attributes, 'data-text-color', textColor);
85
128
  attr(attributes, 'data-border-radius', borderRadius);
package/dist/react.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"react.js","sourceRoot":"","sources":["../src/react.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAK1C;;;;;;;GAOG;AACH,IAAI,SAAS,GAAG,CAAC,CAAA;AAEjB;;;;;;;;;;GAUG;AACH,MAAM,UAAU,YAAY,CAAC,OAAoB;IAC/C,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,OAAO,CAAA;IAE/D,SAAS,CAAC,GAAG,EAAE;QACb,SAAS,IAAI,CAAC,CAAA;QACd,KAAK,IAAI,CAAC;YACR,MAAM;YACN,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC/C,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CA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,WAAW,CAAC,CAAA;IAClD,8EAA8E;IAC9E,+EAA+E;IAC/E,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,OAAO,EAAE,CAAC;QACjD,UAAU,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAAA;IAC7C,CAAC;IACD,8EAA8E;IAC9E,4EAA4E;IAC5E,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;QACvB,UAAU,CAAC,mBAAmB,CAAC,GAAG,MAAM,CAAA;IAC1C,CAAC;IACD,IAAI,CAAC,UAAU,EAAE,eAAe,EAAE,eAAe,CAAC,CAAA;IAClD,IAAI,CAAC,UAAU,EAAE,iBAAiB,EAAE,SAAS,CAAC,CAAA;IAC9C,IAAI,CAAC,UAAU,EAAE,oBAAoB,EAAE,YAAY,CAAC,CAAA;IACpD,IAAI,CAAC,UAAU,EAAE,mBAAmB,EAAE,WAAW,CAAC,CAAA;IAClD,IAAI,CAAC,UAAU,EAAE,mBAAmB,EAAE,eAAe,CAAC,CAAA;IACtD,IAAI,CAAC,UAAU,EAAE,mBAAmB,EAAE,WAAW,CAAC,CAAA;IAClD,IAAI,WAAW,KAAK,IAAI,EAAE,CAAC;QACzB,UAAU,CAAC,mBAAmB,CAAC,GAAG,MAAM,CAAA;IAC1C,CAAC;IAED,8EAA8E;IAC9E,6CAA6C;IAC7C,OAAO,CACL,cACE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,oBAAoB,SAAS,EAAE,CAAC,CAAC,CAAC,kBAAkB,EAC3E,KAAK,EAAE,KAAK,KACR,UAAU,GACd,CACH,CAAA;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seeonwall",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "description": "Show shoppers a poster on their own wall, at true scale. The seeonwall.com widget for React and headless storefronts.",
5
5
  "keywords": [
6
6
  "seeonwall",