unlayer-types 1.508.0 → 1.510.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.
Files changed (2) hide show
  1. package/embed.d.ts +53 -1
  2. 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
  /**
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "unlayer-types",
3
- "version": "1.508.0",
3
+ "version": "1.510.0",
4
4
  "license": "MIT"
5
5
  }