@stringpush/sdk 0.1.1 → 0.2.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 +11 -9
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @stringpush/sdk
|
|
2
2
|
|
|
3
|
-
Framework-agnostic plain JavaScript SDK for
|
|
3
|
+
Framework-agnostic plain JavaScript SDK for StringPush.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -18,8 +18,8 @@ await init({
|
|
|
18
18
|
environment: "staging",
|
|
19
19
|
locale: "en",
|
|
20
20
|
apiKey: "trt_…",
|
|
21
|
-
apiBaseUrl: "
|
|
22
|
-
origin: "
|
|
21
|
+
apiBaseUrl: "https://api.platform.stringpush.com",
|
|
22
|
+
origin: "https://your-app.example.com",
|
|
23
23
|
onLocaleChange: () => app.rerender(),
|
|
24
24
|
onTranslationsUpdated: () => app.rerender(),
|
|
25
25
|
});
|
|
@@ -46,13 +46,13 @@ Enable when your plan includes MAU metering. No PII is sent — only a stable ha
|
|
|
46
46
|
|
|
47
47
|
`t(key, values)` supports ICU MessageFormat (plural, select) and `{name}` interpolation via `intl-messageformat`. Configure missing-key behavior with `missingKeyFallback` (`key`, `default_message`, or `empty`) and optional `defaultMessages` at init.
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
Try the [hosted sample app](https://sample.platform.stringpush.com) or follow [Getting started](https://docs.platform.stringpush.com/getting-started).
|
|
50
50
|
|
|
51
51
|
### Staging vs production
|
|
52
52
|
|
|
53
53
|
Pass `environment: "staging"` or `environment: "production"` in `init()`. The manifest and bundle URLs are scoped per environment (`/bundles/{projectId}/staging/…` vs `…/production/…`). Use **staging** for pre-release copy and overlay edit mode; use **production** for live customer traffic after promote + publish in admin.
|
|
54
54
|
|
|
55
|
-
Overlay edit mode is intended for **staging** only unless your organization explicitly enables production overlay
|
|
55
|
+
Overlay edit mode is intended for **staging** only unless your organization explicitly enables production overlay in admin Settings (Business+).
|
|
56
56
|
|
|
57
57
|
## Edit mode (staging overlay)
|
|
58
58
|
|
|
@@ -111,9 +111,11 @@ While edit mode is active, the overlay WebSocket applies `translation.updated` (
|
|
|
111
111
|
|
|
112
112
|
- **Runtime key** (`trt_…`): read-only; safe in customer frontends; restrict via application **allowed domains**.
|
|
113
113
|
- **Edit token**: short-lived; overlay/write only; never commit or ship in production bundles.
|
|
114
|
-
- **Environment**: use `staging` for overlay QA; production edit requires
|
|
114
|
+
- **Environment**: use `staging` for overlay QA; production edit requires **production overlay** enabled in admin Settings (Business+).
|
|
115
115
|
- **Origin**: set `origin` in `init()` to match an allowlisted domain (defaults to `window.location.origin`).
|
|
116
116
|
|
|
117
|
+
Report vulnerabilities to [security@stringpush.com](mailto:security@stringpush.com).
|
|
118
|
+
|
|
117
119
|
## Troubleshooting
|
|
118
120
|
|
|
119
121
|
| Symptom | What to check |
|
|
@@ -125,10 +127,10 @@ While edit mode is active, the overlay WebSocket applies `translation.updated` (
|
|
|
125
127
|
| `environment does not match` | `init({ environment })` must match the edit session environment |
|
|
126
128
|
| `401` on overlay save | Edit JWT expired — re-issue via `POST /v1/auth/edit-session` |
|
|
127
129
|
| `409` on save | Another editor saved first — use Reload in the panel |
|
|
128
|
-
| Live updates missing |
|
|
130
|
+
| Live updates missing | Confirm staging overlay and realtime are enabled for your org; same project/environment as the edit session |
|
|
129
131
|
| CORS errors on manifest or overlay | API must allow your origin; add hostname to application **allowed domains** |
|
|
130
132
|
| CORS errors on bundle CDN | Hosted CDN allows `*`; SDK omits runtime key on cross-origin bundle URLs. BYO CDN: set `Access-Control-Allow-Origin: *` (or your origins) on bundle GET |
|
|
131
133
|
|
|
132
|
-
Full staging setup: [
|
|
134
|
+
Full staging setup: [Staging overlay](https://docs.platform.stringpush.com/integration/overlay-staging).
|
|
133
135
|
|
|
134
|
-
See [
|
|
136
|
+
See [Concepts overview](https://docs.platform.stringpush.com/concepts/overview) for the full integration model.
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stringpush/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Plain JS SDK for in-context translation",
|
|
5
|
+
"homepage": "https://docs.platform.stringpush.com/getting-started",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://stringpush.com/support",
|
|
8
|
+
"email": "support@stringpush.com"
|
|
9
|
+
},
|
|
5
10
|
"publishConfig": {
|
|
6
11
|
"access": "public",
|
|
7
12
|
"registry": "https://registry.npmjs.org"
|
|
8
13
|
},
|
|
9
|
-
"repository": {
|
|
10
|
-
"type": "git",
|
|
11
|
-
"url": "git+https://github.com/StringPush/translations.git",
|
|
12
|
-
"directory": "packages/sdk"
|
|
13
|
-
},
|
|
14
14
|
"type": "module",
|
|
15
15
|
"main": "./dist/index.umd.cjs",
|
|
16
16
|
"module": "./dist/index.mjs",
|