widget-web-component 1.3.0-dev → 1.4.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.
Files changed (4) hide show
  1. package/README.md +35 -0
  2. package/bundle.css +1 -1
  3. package/index.js +838 -589
  4. package/package.json +1 -1
package/README.md CHANGED
@@ -128,3 +128,38 @@ 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`, `organization`, `notificationsUrl` and `scraperMock` are **environment
137
+ configuration** — they describe *which* Belender backend the widget talks to. These
138
+ values are passed at initialization time via `initBelenderComponent(config)`, not as
139
+ HTML attributes.
140
+
141
+ ```js
142
+ initBelenderComponent({
143
+ runtimeEnv: 'qa',
144
+ organization: 'belender',
145
+ notificationsUrl: 'wss://ws.custom-funder.com',
146
+ scraperMock: true
147
+ }).then((BelenderWebComponent) => {
148
+ customElements.define('belender-web-component', BelenderWebComponent);
149
+ });
150
+ ```
151
+
152
+ **When omitted**, each field falls back to automatic derivation from the hostname of
153
+ `api-url` (e.g. `.qa.` → `qa`, `api.` prefix → notifications URL, `opendata` in
154
+ hostname → opendata org). This means you only need to pass config when `api-url`
155
+ points to a **custom domain** outside Belender's naming conventions.
156
+
157
+ **Fields are independent** — you can set any subset. Unset values still fall back to
158
+ the automatic derivation.
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
+ | `organization` | string | `belender`, `opendata` | `opendata` in hostname → `opendata`, otherwise → `belender` |
164
+ | `notificationsUrl` | string | Any `ws://` or `wss://` URL | `api.` prefix replaced with `notifications.` |
165
+ | `scraperMock` | boolean | `true`, `false` | `belender`+`qa` or `opendata`+`dev` → `true`, otherwise → `false` |