@veroxm/sdk 1.5.0 → 1.6.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/CHANGELOG.md +6 -0
- package/dist/embed.d.ts +2 -0
- package/dist/embed.js +3 -0
- package/dist/generated/api.d.ts +4 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.6.0
|
|
4
|
+
|
|
5
|
+
- Forms in several languages (public API 2.8): `embedForm({ lang: "fr" })` (or `data-lang="fr"`) shows the form in that
|
|
6
|
+
language when it has a translation; otherwise the visitor's browser language decides, and the form has a language
|
|
7
|
+
switcher. Responses from `app.forms` carry `locale`, the language the person answered in.
|
|
8
|
+
|
|
3
9
|
## 1.5.0
|
|
4
10
|
|
|
5
11
|
- Forms (public API 2.7). `embedForm({ baseUrl, form, mode })` shows a VeroXM form in a page: `inline` (in an element,
|
package/dist/embed.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ export interface FormEmbedOptions {
|
|
|
16
16
|
container?: HTMLElement | string;
|
|
17
17
|
/** Hidden fields the form declares, e.g. `{ source: "pricing-page" }`. */
|
|
18
18
|
hidden?: Record<string, string>;
|
|
19
|
+
/** The language to show, when the form has it ("fr", "ar"); otherwise the visitor's browser language decides. */
|
|
20
|
+
lang?: string;
|
|
19
21
|
/** inline: the height in pixels (default 520). */
|
|
20
22
|
height?: number;
|
|
21
23
|
/** inline: grow and shrink with the form's content (good for the all-on-a-page layout). */
|
package/dist/embed.js
CHANGED
|
@@ -82,6 +82,8 @@ export function embedForm(options) {
|
|
|
82
82
|
const url = new URL(`/f/${options.form}`, formOrigin);
|
|
83
83
|
for (const [k, v] of Object.entries(options.hidden ?? {}))
|
|
84
84
|
url.searchParams.set(k, String(v));
|
|
85
|
+
if (options.lang)
|
|
86
|
+
url.searchParams.set('lang', options.lang);
|
|
85
87
|
url.searchParams.set('vx_embed', mode);
|
|
86
88
|
url.searchParams.set('vx_id', id);
|
|
87
89
|
url.searchParams.set('vx_origin', window.location.origin);
|
|
@@ -306,6 +308,7 @@ export function embedFormsFromPage(baseUrl, root = document) {
|
|
|
306
308
|
mode,
|
|
307
309
|
container: mode === 'inline' || (mode === 'fullpage' && node.tagName !== 'SCRIPT') ? node : undefined,
|
|
308
310
|
hidden,
|
|
311
|
+
lang: d.lang,
|
|
309
312
|
height: num(d.height),
|
|
310
313
|
autoHeight: d.autoHeight === 'true',
|
|
311
314
|
size: d.size === 'small' || d.size === 'large' ? d.size : undefined,
|
package/dist/generated/api.d.ts
CHANGED
|
@@ -1792,6 +1792,8 @@ export interface components {
|
|
|
1792
1792
|
url?: string;
|
|
1793
1793
|
referrer?: string | null;
|
|
1794
1794
|
};
|
|
1795
|
+
/** @description The language the person saw: the definition's `locale` or one of its `translations`. Error messages come back in it. */
|
|
1796
|
+
locale?: string;
|
|
1795
1797
|
};
|
|
1796
1798
|
FormResponseResult: {
|
|
1797
1799
|
/** @description The response id (r_...). */
|
|
@@ -1886,6 +1888,8 @@ export interface components {
|
|
|
1886
1888
|
title: string;
|
|
1887
1889
|
} | null;
|
|
1888
1890
|
device: string | null;
|
|
1891
|
+
/** @description The language the person saw. */
|
|
1892
|
+
locale: string | null;
|
|
1889
1893
|
/** @description Signed-in forms: the project account that answered. */
|
|
1890
1894
|
endUserId: number | null;
|
|
1891
1895
|
variables: {
|