@outmarket-ai/react-sdk 0.3.0 → 0.4.0-alpha.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/README.md CHANGED
@@ -90,7 +90,7 @@ Mount it once and put the components inside it.
90
90
  | Prop | Type | Description |
91
91
  | --- | --- | --- |
92
92
  | `session` | `OutmarketSession` | Required. The `201` body from step 4, unchanged. |
93
- | `onReady` | `({ workflowsByModule }) => void` | Called once the user's workflows have loaded, grouped by module. |
93
+ | `onReady` | `({ workflowsByModule }) => void` | Called once the user's workflows have loaded, and again if they change: the workflows the components can show, grouped by module, minus any your plan doesn't include. |
94
94
  | `colorMode` | `'light' \| 'dark' \| 'system'` | Color mode of the components. |
95
95
  | `theme` | `{ primary?: string }` | Your brand color, as hex. |
96
96
 
@@ -129,15 +129,35 @@ CDN, `https://embed.outmarket.ai`, when the first `<OutmarketProvider>` mounts (
129
129
  - The `environment` you pass to `<OutmarketProvider>` picks the version: `production` (the default)
130
130
  loads the stable version, `qa` the beta and `staging` the alpha.
131
131
  - The components render with your app's React.
132
- - The stylesheet sets Inter, served from the CDN with the components, as the font of your page's
133
- `html` and `body`. The components inherit it, so a font you set on one of their ancestors applies
134
- instead.
132
+ - The components render in shadow roots (see [Styling](#styling)). Your page gets one stylesheet
133
+ from the CDN, the `@font-face` rules for Inter, the components' font; the components' own
134
+ styles stay inside their shadow roots.
135
135
  - You don't import a stylesheet. `@outmarket-ai/react-sdk/styles.css` still exists, empty, so an
136
136
  existing import keeps working; you can remove it. The package's `pdf.worker.min.mjs` is empty too:
137
137
  if you served a copy of it as the PDF worker (`NEXT_PUBLIC_PDF_WORKER_URL`), remove that setting.
138
138
  - If the CDN can't be reached, the components show "Outmarket could not load".
139
139
  - `window.__OM_EMBED__` shows which version loaded.
140
140
 
141
+ ### Styling
142
+
143
+ Each component renders in a shadow root of its own, where you place it, and its dialogs, menus,
144
+ popovers and tooltips render in one more at the end of your page's `body`. So:
145
+
146
+ - Your page's CSS does not reach the components: a global `button`, `*:focus` or `div` rule does
147
+ not change them. Use `colorMode` and `theme` on `<OutmarketProvider>` to fit them to your app.
148
+ - The components' CSS does not reach your page: none of its rules matches your page's elements, and
149
+ the dark mode is not a `dark` class on your `html`.
150
+ - Inherited text styles (your page's font, colour, line height, letter spacing) stop at the
151
+ components too. Two things still come from your page: `rem` sizes follow your page's root font
152
+ size, so keep it at the browser's default (16px), and the text direction (`dir`) is your page's.
153
+ - The components paint the background of their colour mode, so they stay readable on any page.
154
+ - The components take the space of their parent: they add no box of their own around them.
155
+ `<OutmarketProvider>` puts its children in an `<outmarket-provider>` element, a flex column with
156
+ `flex: 1`: in a flex container it grows into the space left; in any other parent it is as wide
157
+ as the parent and as tall as its content.
158
+ - The shadow roots are open. In your own tests, Playwright and Cypress (with
159
+ `includeShadowDom`) find elements inside them; Testing Library's `screen` does not.
160
+
141
161
  ### Content Security Policy
142
162
 
143
163
  If your page has a Content Security Policy, loading the components from the CDN needs these sources:
@@ -148,7 +168,7 @@ If your page has a Content Security Policy, loading the components from the CDN
148
168
  | `style-src` | `https://embed.outmarket.ai` |
149
169
  | `font-src` | `https://embed.outmarket.ai` |
150
170
  | `worker-src` | `https://embed.outmarket.ai` and `blob:` (the PDF worker starts from a `blob:` URL) |
151
- | `connect-src` | `https://embed.outmarket.ai` and the Outmarket APIs of your `environment` |
171
+ | `connect-src` | `https://embed.outmarket.ai` (the components' stylesheets are fetched) and the Outmarket APIs of your `environment` |
152
172
 
153
173
  The Outmarket APIs of each environment:
154
174
 
package/dist/index.d.ts CHANGED
@@ -14,7 +14,8 @@ export interface OutmarketWorkflowInfo {
14
14
  label: string;
15
15
  }
16
16
 
17
- /** Fired once the real bootstrap resolves: the tenant's workflows grouped by module. */
17
+ /** Fired once the real bootstrap and the user resolve: the workflows the
18
+ * components can render, minus the plan-locked ones, grouped by module. */
18
19
  export interface OutmarketReadyPayload {
19
20
  workflowsByModule: Record<OutmarketModule, OutmarketWorkflowInfo[]>;
20
21
  }
@@ -132,7 +133,8 @@ export interface OutmarketProviderProps {
132
133
  colorMode?: 'light' | 'dark' | 'system';
133
134
  /** Brand accent (hex), mapped onto the surface's primary color. */
134
135
  theme?: { primary?: string };
135
- /** Fires once bootstrap resolves, with the tenant's workflows grouped by module. */
136
+ /** Fires once bootstrap and the user resolve, with the workflows the components
137
+ * can render, minus the plan-locked ones, grouped by module; again if they change. */
136
138
  onReady?: (payload: OutmarketReadyPayload) => void;
137
139
  children?: ReactNode;
138
140
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@outmarket-ai/react-sdk",
3
- "version": "0.3.0",
3
+ "version": "0.4.0-alpha.1",
4
4
  "description": "Embed the real Outmarket workflow surface (catalog + single workflow) in any React app.",
5
5
  "private": false,
6
6
  "type": "module",
@@ -61,5 +61,5 @@
61
61
  "url": "git+https://github.com/Outmarket-AI/outmarket-monorepo.git",
62
62
  "directory": "apps/product-frontend/packages/outmarket-react-sdk"
63
63
  },
64
- "gitHead": "2b7113000d10d57bf76edd0b863362985ac6d85c"
64
+ "gitHead": "c259b7d010a357ba7f950bdedd74987a93d6da2d"
65
65
  }