widget-web-component 1.4.0 → 1.5.0-dev
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 +33 -0
- package/bundle.css +1 -1
- package/index.js +400 -785
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -128,3 +128,36 @@ Query string, hash and trailing slash are stripped from a valid URL.
|
|
|
128
128
|
|
|
129
129
|
> ⚠️ Only the URL **format** is validated, not the destination. The widget will only
|
|
130
130
|
> work if `apiUrl` points to a valid Belender environment.
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## 🔧 Environment config (`WidgetConfig`)
|
|
135
|
+
|
|
136
|
+
`runtimeEnv` and `notificationsUrl` are **environment configuration** — they describe
|
|
137
|
+
*which* Belender backend the widget talks to. These values are passed at initialization
|
|
138
|
+
time via `initBelenderComponent(config)`, not as HTML attributes.
|
|
139
|
+
|
|
140
|
+
```js
|
|
141
|
+
initBelenderComponent({
|
|
142
|
+
runtimeEnv: 'qa',
|
|
143
|
+
notificationsUrl: 'wss://ws.custom-funder.com',
|
|
144
|
+
}).then((BelenderWebComponent) => {
|
|
145
|
+
customElements.define('belender-web-component', BelenderWebComponent);
|
|
146
|
+
});
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**When omitted**, each field falls back to automatic derivation from the hostname of
|
|
150
|
+
`api-url` (e.g. `.qa.` → `qa`, `api.` prefix → notifications URL). This means you only
|
|
151
|
+
need to pass config when `api-url` points to a **custom domain** outside Belender's
|
|
152
|
+
naming conventions.
|
|
153
|
+
|
|
154
|
+
**Fields are independent** — you can set any subset. Unset values still fall back to
|
|
155
|
+
the automatic derivation.
|
|
156
|
+
|
|
157
|
+
> ℹ️ `organization` and `scraperMock` are always derived automatically from `api-url`
|
|
158
|
+
> and are not configurable by the host.
|
|
159
|
+
|
|
160
|
+
| Field | Type | Valid values | Derived from `api-url` when omitted |
|
|
161
|
+
|---|---|---|---|
|
|
162
|
+
| `runtimeEnv` | string | `qa`, `dev`, `pro` | `.qa.` in hostname → `qa`, `.dev.` → `dev`, otherwise → `pro` |
|
|
163
|
+
| `notificationsUrl` | string | Any `ws://` or `wss://` URL | `api.` prefix replaced with `notifications.` |
|