@appsemble/lang-sdk 0.34.10 → 0.34.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appsemble/lang-sdk",
3
- "version": "0.34.10",
3
+ "version": "0.34.12",
4
4
  "description": "Language SDK for Appsemble",
5
5
  "keywords": [
6
6
  "app",
@@ -323,6 +323,7 @@ parameters:
323
323
  'zoneinfo',
324
324
  'role',
325
325
  'properties',
326
+ 'phoneNumber',
326
327
  ],
327
328
  description: `
328
329
  > **Note:** For this remapper to work, the app member that activated the remapper has to be logged in to
@@ -340,6 +341,7 @@ Provides some fields of app member information taken from the OpenID user info.
340
341
  - \`zoneinfo\`: The app member’s timezone
341
342
  - \`role\`: The role of the app member in the app
342
343
  - \`properties\`: Custom properties defined on the app member
344
+ - \`phoneNumber\`: Phone number of the app member if enabled in app definition.
343
345
 
344
346
  Example:
345
347
 
@@ -351,7 +353,8 @@ Example:
351
353
  "name": "Test User",
352
354
  "picture": "https://www.gravatar.com/avatar/f46b82357ce29bcd1099915946cda468?s=128&d=mp",
353
355
  "sub": "5c6270e2-ad31-414f-bcab-6752a2c4dcfd",
354
- "properties": {}
356
+ "properties": {},
357
+ "phoneNumber":+31 612345678"
355
358
  }
356
359
  \`\`\`
357
360
  `,
@@ -25,6 +25,13 @@ If set to \`navigation\`, it will only be visible if \`login\` is also visible i
25
25
  If set to \`navigation\`, it will only be visible if \`login\` is also visible in \`navigation\`.
26
26
  `,
27
27
  },
28
+ enabledSettings: {
29
+ type: 'array',
30
+ items: {
31
+ enum: ['name', 'phoneNumber', 'picture', 'languages'],
32
+ },
33
+ description: 'A list of the settings to display on the settings page.',
34
+ },
28
35
  install: {
29
36
  enum: ['navbar', 'navigation', 'hidden'],
30
37
  default: 'navigation',
@@ -12,6 +12,21 @@ export const AppMembersDefinition = {
12
12
  $ref: '#/components/schemas/AppMemberPropertyDefinition',
13
13
  },
14
14
  },
15
+ phoneNumber: {
16
+ type: 'object',
17
+ description: 'Whether the phone number property should be enabled',
18
+ required: ['enable'],
19
+ properties: {
20
+ enable: {
21
+ type: 'boolean',
22
+ default: false,
23
+ },
24
+ required: {
25
+ type: 'boolean',
26
+ default: false,
27
+ },
28
+ },
29
+ },
15
30
  },
16
31
  };
17
32
  //# sourceMappingURL=AppMembersDefinition.js.map
@@ -35,7 +35,7 @@ have two pages with the same name. The name of the page is displayed at the *app
35
35
  default: false,
36
36
  },
37
37
  navigation: {
38
- $ref: '#/components/schemas/AppLayoutDefinition/properties/navigation',
38
+ enum: ['bottom', 'left-menu', 'hidden', 'dropdown', 'profileDropdown'],
39
39
  description: `The type of navigation displayed on the page.
40
40
 
41
41
  This overrides the navigation property of the app itself. Defaults to \`left-menu\` if navigation or
@@ -15,6 +15,10 @@ Does nothing if the app member isn’t logged in.`,
15
15
  $ref: '#/components/schemas/RemapperDefinition',
16
16
  description: 'The new full name of the app member.',
17
17
  },
18
+ phoneNumber: {
19
+ $ref: '#/components/schemas/RemapperDefinition',
20
+ description: 'Phone number of the app member',
21
+ },
18
22
  properties: {
19
23
  $ref: '#/components/schemas/RemapperDefinition',
20
24
  description: `The updated custom properties for the app member.
@@ -19,6 +19,10 @@ Does nothing if the app member is already logged in.`,
19
19
  $ref: '#/components/schemas/RemapperDefinition',
20
20
  description: 'The email to log in with.',
21
21
  },
22
+ phoneNumber: {
23
+ $ref: '#/components/schemas/RemapperDefinition',
24
+ description: 'Phone number of the app member',
25
+ },
22
26
  name: {
23
27
  $ref: '#/components/schemas/RemapperDefinition',
24
28
  description: 'The full name of the app member.',
@@ -361,6 +361,11 @@ export interface AppMemberRegisterAction extends BaseActionDefinition<'app.membe
361
361
  * The email address to register with.
362
362
  */
363
363
  email: Remapper;
364
+ /**
365
+ * The phone number of the app member,
366
+ * only works if the phone number is enabled in the members definition.
367
+ */
368
+ phoneNumber?: Remapper;
364
369
  /**
365
370
  * The password to login with.
366
371
  */
@@ -436,6 +441,10 @@ export interface AppMemberCurrentPatchAction extends BaseActionDefinition<'app.m
436
441
  * The display name to update.
437
442
  */
438
443
  name?: Remapper;
444
+ /**
445
+ * Phone number of the app member
446
+ */
447
+ phoneNumber?: Remapper;
439
448
  /**
440
449
  * Custom properties that can be assigned freely.
441
450
  *
package/types/core.d.ts CHANGED
@@ -9,6 +9,7 @@ import { type ResourceDefinition } from './resource.js';
9
9
  import { type ViewRole } from './roles.js';
10
10
  import { type Security } from './security.js';
11
11
  import { type Theme } from './theme.js';
12
+ export type SettingName = 'languages' | 'name' | 'phoneNumber' | 'picture';
12
13
  export interface AppDefinition {
13
14
  /**
14
15
  * The name of the app.
@@ -70,6 +71,10 @@ export interface AppDefinition {
70
71
  * @default 'navbar'
71
72
  */
72
73
  install?: LayoutPosition;
74
+ /**
75
+ * Settings to be shown on the default settings page.
76
+ */
77
+ enabledSettings?: SettingName[];
73
78
  /**
74
79
  * The navigation type to use.
75
80
  *
@@ -95,7 +100,8 @@ export interface AppDefinition {
95
100
  pages: PageDefinition[];
96
101
  controller?: ControllerDefinition;
97
102
  members?: {
98
- properties: Record<string, AppMemberPropertyDefinition>;
103
+ phoneNumber?: AppMemberPhoneNumberDefinition;
104
+ properties?: Record<string, AppMemberPropertyDefinition>;
99
105
  };
100
106
  /**
101
107
  * Resource definitions that may be used by the app.
@@ -159,8 +165,9 @@ export interface BasePageDefinition {
159
165
  /**
160
166
  * The navigation type to use for the page.
161
167
  * Setting this will override the default navigation for the app.
168
+ * if this is set to `navbar`, navigation link is rendered in the profile dropdown.
162
169
  */
163
- navigation?: Navigation;
170
+ navigation?: Navigation | 'profileDropdown';
164
171
  /**
165
172
  * A list of roles that may view the page.
166
173
  */
@@ -294,6 +301,10 @@ export interface WebhookDefinition {
294
301
  schema: OpenAPIV3.SchemaObject;
295
302
  action: ActionDefinition;
296
303
  }
304
+ export interface AppMemberPhoneNumberDefinition {
305
+ enable: boolean;
306
+ required?: boolean;
307
+ }
297
308
  export interface AppMemberPropertyDefinition {
298
309
  /**
299
310
  * The JSON schema to validate user properties against before sending it to the backend.
package/types/member.d.ts CHANGED
@@ -12,6 +12,10 @@ export interface AppMemberInfo {
12
12
  * The end-user's preferred email address.
13
13
  */
14
14
  email: string;
15
+ /**
16
+ * The phone number of the app member.
17
+ */
18
+ phoneNumber?: string;
15
19
  /**
16
20
  * True if the end-user's email address has been verified, else false.
17
21
  */
@@ -1,5 +1,5 @@
1
1
  import { type RequireExactlyOne } from 'type-fest';
2
- type AppMemberInfoKey = 'demo' | 'email_verified' | 'email' | 'locale' | 'name' | 'picture' | 'properties' | 'role' | 'sub' | 'zoneinfo';
2
+ type AppMemberInfoKey = 'demo' | 'email_verified' | 'email' | 'locale' | 'name' | 'phoneNumber' | 'picture' | 'properties' | 'role' | 'sub' | 'zoneinfo';
3
3
  interface BaseICSRemapper {
4
4
  /**
5
5
  * The start of the icalendar event.
package/validation.js CHANGED
@@ -75,10 +75,10 @@ function validateUniquePageNames(definition, report) {
75
75
  checkPages(definition.pages);
76
76
  }
77
77
  function validateMembersSchema(definition, report) {
78
- if (!definition.members) {
78
+ if (!definition.members?.properties) {
79
79
  return;
80
80
  }
81
- for (const [propertyName, propertyDefinition] of Object.entries(definition.members.properties)) {
81
+ for (const [propertyName, propertyDefinition] of Object.entries(definition.members.properties ?? {})) {
82
82
  // Handled by schema validation
83
83
  if (!propertyDefinition?.schema) {
84
84
  continue;
@@ -104,6 +104,18 @@ function validateMembersSchema(definition, report) {
104
104
  }
105
105
  }
106
106
  }
107
+ function validatePhoneNumberDefinition(definition, report) {
108
+ if (!definition.members?.phoneNumber) {
109
+ return;
110
+ }
111
+ if (!definition.members.phoneNumber.enable && definition.members.phoneNumber.required) {
112
+ report(definition.members.phoneNumber, 'phone number should be enabled', [
113
+ 'members',
114
+ 'phoneNumber',
115
+ 'required',
116
+ ]);
117
+ }
118
+ }
107
119
  // XXX: Very not good nesting
108
120
  function validateResourceSchemas(definition, report) {
109
121
  if (!definition.resources) {
@@ -1222,6 +1234,7 @@ export async function validateAppDefinition(definition, getBlockVersions, contro
1222
1234
  validateLanguage(definition, report);
1223
1235
  validateResourceReferences(definition, report);
1224
1236
  validateMembersSchema(definition, report);
1237
+ validatePhoneNumberDefinition(definition, report);
1225
1238
  validateResourceSchemas(definition, report);
1226
1239
  validateSecurity(definition, report);
1227
1240
  validateBlocks(definition, blockVersionMap, report);