unlayer-types 1.509.0 → 1.512.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/embed.d.ts +82 -1
- package/package.json +1 -1
package/embed.d.ts
CHANGED
|
@@ -1891,8 +1891,46 @@ declare module "packages/editor/src/state/types/types" {
|
|
|
1891
1891
|
id?: string | number;
|
|
1892
1892
|
name?: string | null | undefined;
|
|
1893
1893
|
avatar?: string | null | undefined;
|
|
1894
|
-
email?: string;
|
|
1894
|
+
email?: string | null;
|
|
1895
1895
|
signature?: string;
|
|
1896
|
+
/**
|
|
1897
|
+
* Signed feature policy generated on your server. Supersedes `signature`: it
|
|
1898
|
+
* covers the same user id and additionally carries the features this
|
|
1899
|
+
* particular end user may use.
|
|
1900
|
+
*
|
|
1901
|
+
* Build it with your project secret, never in the browser:
|
|
1902
|
+
*
|
|
1903
|
+
* ```js
|
|
1904
|
+
* const claims = { id, exp, features: { ai: { fullTemplateGeneration: false } } };
|
|
1905
|
+
* const payload = Buffer.from(JSON.stringify(claims)).toString('base64url');
|
|
1906
|
+
* const salt = 'unlayer:end-user-policy-token:v1:salt';
|
|
1907
|
+
* const info = 'unlayer:end-user-policy-token:v1:signing-key';
|
|
1908
|
+
* const key = Buffer.from(hkdfSync('sha256', SECRET, salt, info, 32));
|
|
1909
|
+
* const signed = `v1.${payload}`;
|
|
1910
|
+
* const token = `${signed}.${createHmac('sha256', key).update(signed).digest('hex')}`;
|
|
1911
|
+
* ```
|
|
1912
|
+
*
|
|
1913
|
+
* `features` accepts the boolean feature-flag portion of
|
|
1914
|
+
* `unlayer.init({ features })`: objects are containers and every leaf must be
|
|
1915
|
+
* `true` or `false`. It can only restrict; a policy cannot grant a feature
|
|
1916
|
+
* the project's plan excludes.
|
|
1917
|
+
*/
|
|
1918
|
+
featurePolicyToken?: string | null;
|
|
1919
|
+
/**
|
|
1920
|
+
* Your own fields. Anything beyond the properties above is stored with the
|
|
1921
|
+
* end user and returned on the next session, merged into what is already
|
|
1922
|
+
* stored — so a field you stop sending keeps its last value. Unlayer never
|
|
1923
|
+
* interprets them.
|
|
1924
|
+
*
|
|
1925
|
+
* Reserved names are dropped here: the credentials above, plus `projectId`,
|
|
1926
|
+
* `customId`, `consoleAttestation`, `entitlements`, `featurePolicy`,
|
|
1927
|
+
* `policyExp`, `featurePolicyVerified`, `legacySignatureVerified`,
|
|
1928
|
+
* `consoleSession`, `_consoleSession`, `_consoleSessionId`,
|
|
1929
|
+
* `_consoleSessionProof`, `_consoleUserId`, `consoleContextVerified`,
|
|
1930
|
+
* `consoleSessionExp`, `consoleSessionId`, `consoleUserId`, and
|
|
1931
|
+
* `consoleSessionProof`. Prefer names specific to your application.
|
|
1932
|
+
*/
|
|
1933
|
+
[field: string]: unknown;
|
|
1896
1934
|
};
|
|
1897
1935
|
export type Language = {
|
|
1898
1936
|
label: string;
|
|
@@ -2583,6 +2621,14 @@ declare module "packages/editor/src/engine/config/features" {
|
|
|
2583
2621
|
deepmerge?: boolean;
|
|
2584
2622
|
}): void;
|
|
2585
2623
|
export function getFeatures(): Features;
|
|
2624
|
+
/**
|
|
2625
|
+
* Applies the verified feature policy returned with the editor session.
|
|
2626
|
+
*
|
|
2627
|
+
* Callers pass an init-shaped object of denials (`toDeniedFeatures`), not the
|
|
2628
|
+
* flattened policy the JWT carries.
|
|
2629
|
+
*/
|
|
2630
|
+
export function setFeaturePolicy(deniedFeatures: Features): void;
|
|
2631
|
+
export function getFeaturePolicy(): Features;
|
|
2586
2632
|
export function getFeature<Path extends keyof Features | [keyof Features, ...string[]] | (string & {})>(path: Path): Path extends keyof Features ? Features[Path] : any;
|
|
2587
2633
|
export function normalizeFeatureAsObject<Object extends Record<string, any>, Feature extends boolean | Object>(feature: Feature | undefined): Partial<Feature & object>;
|
|
2588
2634
|
export function getFeatureAsObject<Path extends keyof Features | [keyof Features, ...string[]] | (string & {})>(path: Path): Partial<(Path extends keyof Features ? Features[Path] : any) & object>;
|
|
@@ -3303,6 +3349,12 @@ declare module "packages/editor/src/engine/config/tools" {
|
|
|
3303
3349
|
validator?: string;
|
|
3304
3350
|
hidden?: boolean;
|
|
3305
3351
|
};
|
|
3352
|
+
/**
|
|
3353
|
+
* The validator a tool override (`unlayer.init({ tools: { image: { validator } } })`)
|
|
3354
|
+
* supplies for `id`, or `undefined` when there is none or the plan does not
|
|
3355
|
+
* include custom audit validators — see `canRunEmbedderValidators`.
|
|
3356
|
+
*/
|
|
3357
|
+
export function getOverrideToolValidator(id: string): string;
|
|
3306
3358
|
export function isRowToolEnabled(): boolean;
|
|
3307
3359
|
export function getTool(toolItem: ToolItem): ToolConfig<ValueMap, Validator>;
|
|
3308
3360
|
/**
|
|
@@ -4120,12 +4172,41 @@ declare module "packages/editor/src/embed/Editor" {
|
|
|
4120
4172
|
setTextDirection(textDirection: TextDirection | null): void;
|
|
4121
4173
|
setTranslations(translations: Translations): void;
|
|
4122
4174
|
loadBlank(bodyValues?: object): void;
|
|
4175
|
+
/**
|
|
4176
|
+
* Loads a design JSON into the editor, replacing the current design.
|
|
4177
|
+
*
|
|
4178
|
+
* Get design JSON from `saveDesign()` or `exportHtml()`, or generate it from React code with
|
|
4179
|
+
* `renderToJson()` from `@unlayer/react-elements` (templates written in code by developers,
|
|
4180
|
+
* coding agents, or an LLM at runtime stay editable here).
|
|
4181
|
+
*
|
|
4182
|
+
* @see https://docs.unlayer.com/builder/load-and-save-designs
|
|
4183
|
+
* @see https://docs.unlayer.com/elements
|
|
4184
|
+
*/
|
|
4123
4185
|
loadDesign<TDisplayMode extends DisplayMode | undefined = TClassDisplayMode>(design: JSONTemplate<TDisplayMode>): void;
|
|
4186
|
+
/**
|
|
4187
|
+
* Returns the current design JSON in the callback. Store it and pass it to `loadDesign()` to
|
|
4188
|
+
* reopen the design for editing later.
|
|
4189
|
+
*
|
|
4190
|
+
* @see https://docs.unlayer.com/builder/load-and-save-designs
|
|
4191
|
+
*/
|
|
4124
4192
|
saveDesign<TDisplayMode extends DisplayMode | undefined = TClassDisplayMode>(callback: (data: JSONTemplate<TDisplayMode>) => void, options?: SaveDesignOptions): void;
|
|
4193
|
+
/**
|
|
4194
|
+
* Exports the current design as HTML. The callback receives `{ html, design }`: send or render
|
|
4195
|
+
* the `html`, and store the `design` JSON to reopen it with `loadDesign()`.
|
|
4196
|
+
*
|
|
4197
|
+
* @see https://docs.unlayer.com/builder/export-html
|
|
4198
|
+
*/
|
|
4125
4199
|
exportHtml<TDisplayMode extends DisplayMode | undefined = TClassDisplayMode>(callback: (data: ExportHtmlResult<TDisplayMode>) => void, options?: ExportHtmlOptions): void;
|
|
4126
4200
|
exportLiveHtml<TDisplayMode extends DisplayMode | undefined = TClassDisplayMode>(callback: (data: ExportLiveHtmlResult<TDisplayMode>) => void, options?: ExportLiveHtmlOptions): void;
|
|
4127
4201
|
exportPlainText<TDisplayMode extends DisplayMode | undefined = TClassDisplayMode>(callback: (data: ExportPlainTextResult<TDisplayMode>) => void, options?: ExportPlainTextOptions): void;
|
|
4128
4202
|
exportImage<TDisplayMode extends DisplayMode | undefined = TClassDisplayMode>(callback: (data: ExportFromApiResult<TDisplayMode>) => void, options?: ExportImageFromApiOptions): void;
|
|
4203
|
+
/**
|
|
4204
|
+
* Exports the current design as a PDF. Unlike `exportHtml()`, the PDF is generated by Unlayer's
|
|
4205
|
+
* Cloud API, uploaded to your connected file storage, and the callback receives
|
|
4206
|
+
* `{ url, design }`.
|
|
4207
|
+
*
|
|
4208
|
+
* @see https://docs.unlayer.com/builder/export-pdf
|
|
4209
|
+
*/
|
|
4129
4210
|
exportPdf<TDisplayMode extends DisplayMode | undefined = TClassDisplayMode>(callback: (data: ExportFromApiResult<TDisplayMode>) => void, options?: ExportPdfFromApiOptions): void;
|
|
4130
4211
|
exportZip<TDisplayMode extends DisplayMode | undefined = TClassDisplayMode>(callback: (data: ExportFromApiResult<TDisplayMode>) => void, options?: ExportZipFromApiOptions): void;
|
|
4131
4212
|
setAppearance(appearance: DeepPartial<AppearanceConfig>): void;
|
package/package.json
CHANGED