Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,13 @@ Never pass raw internal IDs from the client.

### `<StromcomProvider>`

| Prop | Type | Required | Description |
| -------------- | ----------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| `clientKey` | `string` | ✅ | Project client key. |
| `clientSecret` | `string` | ✅ | Project bearer token. |
| `environment` | `"production"` \| `"staging"` \| `string` | | Default `"production"`. Pass any custom URL to point at a self-hosted loader. |
| `dataLayer` | `string` | | Default `"stromCom"`. The global JS variable name. Change it if `stromCom` collides with something else on the page. |
| `language` | `string` | | Initial UI language (e.g. `"cs"`, `"en"`, `"sk"`). Omit to auto-detect from the browser. To change it at runtime, use `<StromcomConf language>`. |
| Prop | Type | Required | Description |
| -------------- | ----------------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `clientKey` | `string` | ✅ | Project client key. |
| `clientSecret` | `string` | ✅ | Project bearer token. |
| `environment` | `"production"` \| `"staging"` \| `string` | | Default `"production"`. Pass any custom URL to point at a self-hosted loader. |
| `dataLayer` | `string` | | Default `"stromCom"`. The global JS variable name. Change it if `stromCom` collides with something else on the page. |
| `language` | `string` | | Initial UI language (e.g. `"cs"`, `"en"`, `"sk"`). Any code is accepted; one without a translation falls back to the browser language, then English. Omit to auto-detect from the browser. To change it at runtime, use `<StromcomConf language>`. |

### `<StromcomUser>`

Expand Down Expand Up @@ -185,15 +185,15 @@ Sends SDK configuration. Place once inside the provider, before threads.

Notable options:

| Prop | Type | Description |
| ----------------------------- | ----------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| `notificationRenderer` | `Function` | Custom notification rendering function. |
| `onNotification` | `Function` | Called when unread count changes. |
| `pageCSSPath` | `string` | CSS file URL injected into the widget iframe. |
| `notificationElementPosition` | `1\|2\|3\|4` | Icon position: 1=TL, 2=TR, 3=BR, 4=BL. |
| `language` | `"en"\|"cs"\|"sk"\|null` | UI language. `null` follows the browser, falling back to English. Overrides `<StromcomProvider language>`. |
| `theme` | `"stromcom-light"\|"stromcom-dark"\|null` | Theme. `null` follows browser preference. |
| `entityResolve` | `Function` | `async ({type, id}) => detail` — resolves business-entity detail (order, ticket…) for the message editor's chip hover-card. |
| Prop | Type | Description |
| ----------------------------- | ----------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `notificationRenderer` | `Function` | Custom notification rendering function. |
| `onNotification` | `Function` | Called when unread count changes. |
| `pageCSSPath` | `string` | CSS file URL injected into the widget iframe. |
| `notificationElementPosition` | `1\|2\|3\|4` | Icon position: 1=TL, 2=TR, 3=BR, 4=BL. |
| `language` | `string\|null` | UI language. Any code is accepted; one without a translation falls back to the browser language, then English. `null` follows the browser. Overrides `<StromcomProvider language>`. |
| `theme` | `"stromcom-light"\|"stromcom-dark"\|null` | Theme. `null` follows browser preference. |
| `entityResolve` | `Function` | `async ({type, id}) => detail` — resolves business-entity detail (order, ticket…) for the message editor's chip hover-card. |

See [`src/StromcomConf.jsx`](./src/StromcomConf.jsx) for the full list.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stromcom/react-snippet",
"version": "0.2.0",
"version": "0.3.0",
"description": "React integration for the STROMCOM chat widget. Loads the SDK, identifies users, and embeds threads as plain React components.",
"keywords": [
"stromcom",
Expand Down
7 changes: 4 additions & 3 deletions src/StromcomConf.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ import { useStromcom } from './StromcomProvider.jsx';
* @param {Function} [props.homeBeforeRender] - Callback before notification center opens
* @param {Function} [props.notificationElementBeforeRender]- Callback before notification icon renders
* @param {Function} [props.notificationElementAfterRender] - Callback after notification icon renders
* @param {('en'|'cs'|'sk'|null)} [props.language] - UI language. null follows the browser, falling back to English.
* Overrides the `language` prop on StromcomProvider, which is only
* the initial value; this one can be changed at runtime.
* @param {(string|null)} [props.language] - UI language. Any code is accepted; one without a translation falls
* back to the browser language, then English. null follows the browser. Overrides the `language`
* prop on StromcomProvider, which is only the initial value; this one
* can be changed at runtime.
* @param {('stromcom-light'|'stromcom-dark'|null)} [props.theme] - Theme. null follows browser preference.
* @param {Function} [props.entityResolve] - async ({type, id}) => detail; resolves business-entity detail for the message editor's chip hover-card
*
Expand Down
8 changes: 5 additions & 3 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ export interface StromcomProviderProps {
/** `"production"`, `"staging"`, or a full custom loader URL. Default `"production"`. */
environment?: StromcomEnvironment;
/**
* Initial UI language (e.g. `"cs"`, `"en"`, `"sk"`). Omit to auto-detect from the browser.
* Initial UI language (e.g. `"cs"`, `"en"`, `"sk"`). Any code is accepted; one without a
* translation falls back to the browser language, then English. Omit to auto-detect from the browser.
* Use `StromcomConf`'s `language` prop to change it at runtime.
*/
language?: string;
Expand Down Expand Up @@ -84,10 +85,11 @@ export interface StromcomConfOptions {
notificationElementBeforeRender?: () => void | Promise<void>;
notificationElementAfterRender?: () => void;
/**
* UI language, or `null` to follow the browser (falling back to English).
* UI language, or `null` to follow the browser. Any language code is accepted;
* one the widget has no translation for falls back to the browser language, then English.
* Overrides `StromcomProviderProps.language`, which is only the initial value.
*/
language?: 'en' | 'cs' | 'sk' | null;
language?: string | null;
/** Theme: `"stromcom-light"`, `"stromcom-dark"`, or `null` to follow browser preference. */
theme?: 'stromcom-light' | 'stromcom-dark' | null;
/** Resolves business-entity detail (order, ticket…) for the message editor's chip hover-card. */
Expand Down