@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.
@@ -36,8 +36,46 @@ export type User = {
36
36
  id?: string | number;
37
37
  name?: string | null | undefined;
38
38
  avatar?: string | null | undefined;
39
- email?: string;
39
+ email?: string | null;
40
40
  signature?: string;
41
+ /**
42
+ * Signed feature policy generated on your server. Supersedes `signature`: it
43
+ * covers the same user id and additionally carries the features this
44
+ * particular end user may use.
45
+ *
46
+ * Build it with your project secret, never in the browser:
47
+ *
48
+ * ```js
49
+ * const claims = { id, exp, features: { ai: { fullTemplateGeneration: false } } };
50
+ * const payload = Buffer.from(JSON.stringify(claims)).toString('base64url');
51
+ * const salt = 'unlayer:end-user-policy-token:v1:salt';
52
+ * const info = 'unlayer:end-user-policy-token:v1:signing-key';
53
+ * const key = Buffer.from(hkdfSync('sha256', SECRET, salt, info, 32));
54
+ * const signed = `v1.${payload}`;
55
+ * const token = `${signed}.${createHmac('sha256', key).update(signed).digest('hex')}`;
56
+ * ```
57
+ *
58
+ * `features` accepts the boolean feature-flag portion of
59
+ * `unlayer.init({ features })`: objects are containers and every leaf must be
60
+ * `true` or `false`. It can only restrict; a policy cannot grant a feature
61
+ * the project's plan excludes.
62
+ */
63
+ featurePolicyToken?: string | null;
64
+ /**
65
+ * Your own fields. Anything beyond the properties above is stored with the
66
+ * end user and returned on the next session, merged into what is already
67
+ * stored — so a field you stop sending keeps its last value. Unlayer never
68
+ * interprets them.
69
+ *
70
+ * Reserved names are dropped here: the credentials above, plus `projectId`,
71
+ * `customId`, `consoleAttestation`, `entitlements`, `featurePolicy`,
72
+ * `policyExp`, `featurePolicyVerified`, `legacySignatureVerified`,
73
+ * `consoleSession`, `_consoleSession`, `_consoleSessionId`,
74
+ * `_consoleSessionProof`, `_consoleUserId`, `consoleContextVerified`,
75
+ * `consoleSessionExp`, `consoleSessionId`, `consoleUserId`, and
76
+ * `consoleSessionProof`. Prefer names specific to your application.
77
+ */
78
+ [field: string]: unknown;
41
79
  };
42
80
 
43
81
  export type JSONSchema = Record<string, unknown>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unlayer/types",
3
- "version": "1.508.0",
3
+ "version": "1.510.0",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "types": "./dist/index.d.ts",