@dev-crew-berlin/enter-js-utils 0.41.2 → 0.42.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.
@@ -7,6 +7,7 @@ import { FieldGroups } from '../models/field-group';
7
7
  import { Instance } from '../models/instance';
8
8
  import { User } from '../models/user';
9
9
  import { Variable } from '../models/variable';
10
+ import { components } from '../generated/api-schema';
10
11
  export type { APICredentials } from './api-base';
11
12
  export default class API extends APIBase {
12
13
  getInstanceList(): Promise<APIResult<Instance[]>>;
@@ -33,6 +34,10 @@ export default class API extends APIBase {
33
34
  attendeeId: string;
34
35
  includeDeleted?: boolean;
35
36
  }): Promise<APIResult<Attendee[]>>;
37
+ generateRegistrationToken(args: {
38
+ instanceName: string;
39
+ auth: components['schemas']['SecurityQuestion'] | components['schemas']['AuthCode'];
40
+ }): Promise<APIResult<string>>;
36
41
  getVariableList(args: {
37
42
  instanceName: string;
38
43
  }): Promise<APIResult<Variable[]>>;
@@ -60,6 +60,10 @@ export default class API extends APIBase {
60
60
  if (!result.success) return result;
61
61
  return success(result.data.map(attendeeJSON => new Attendee(attendeeJSON)));
62
62
  }
63
+ async generateRegistrationToken(args) {
64
+ const instanceName = args.instanceName;
65
+ return this.post(`/instances/${instanceName}/registration/registration_token`, args.auth);
66
+ }
63
67
  async getVariableList(args) {
64
68
  const instanceName = args.instanceName;
65
69
  return this.get(`/instances/${instanceName}/variables`);
@@ -56,6 +56,9 @@ export declare type paths = {
56
56
  put: operations["update_variable_instances__instance_name__variables__variable_name__put"];
57
57
  delete: operations["delete_variable_instances__instance_name__variables__variable_name__delete"];
58
58
  };
59
+ "/instances/{instance_name}/registration/registration_token": {
60
+ post: operations["generate_signed_registration_token_instances__instance_name__registration_registration_token_post"];
61
+ };
59
62
  };
60
63
  export declare type components = {
61
64
  schemas: {
@@ -179,6 +182,34 @@ export declare type components = {
179
182
  attendeeId: string;
180
183
  updates: components["schemas"]["AttendeeUpdate"];
181
184
  };
185
+ /** AuthCode */
186
+ AuthCode: {
187
+ /** Authcode */
188
+ authCode: string;
189
+ };
190
+ /** AuthCodeGenerator */
191
+ AuthCodeGenerator: {
192
+ /**
193
+ * Chars
194
+ * @default abcdefghijklmnopqrstuvwxyz1234567890
195
+ */
196
+ chars: string;
197
+ /**
198
+ * Length
199
+ * @default 8
200
+ */
201
+ length: number;
202
+ /**
203
+ * Prefix
204
+ * @default
205
+ */
206
+ prefix: string;
207
+ /**
208
+ * Suffix
209
+ * @default
210
+ */
211
+ suffix: string;
212
+ };
182
213
  /** AuthField */
183
214
  AuthField: {
184
215
  /**
@@ -711,8 +742,8 @@ export declare type components = {
711
742
  /** Ext */
712
743
  ext?: string[];
713
744
  };
714
- /** FrontendJSON */
715
- FrontendJSON: {
745
+ /** FrontendConfigJSON */
746
+ FrontendConfigJSON: {
716
747
  /** Domain */
717
748
  domain: string;
718
749
  };
@@ -1012,7 +1043,7 @@ export declare type components = {
1012
1043
  description: string;
1013
1044
  /** Thumbnail */
1014
1045
  thumbnail: boolean;
1015
- frontend: components["schemas"]["FrontendJSON"];
1046
+ frontend: components["schemas"]["FrontendConfigJSON"];
1016
1047
  registration: components["schemas"]["RegistrationInfo"];
1017
1048
  /** Guestnamefields */
1018
1049
  guestNameFields: string[];
@@ -1038,9 +1069,21 @@ export declare type components = {
1038
1069
  };
1039
1070
  /** Permissions */
1040
1071
  permissions: {
1041
- [key: string]: ("attendees:read" | "attendees:create" | "attendees:write" | "attendees:write:bulk" | "attendees:import" | "attendees:export" | "attendees:delete:soft" | "attendees:delete:final" | "emails:send" | "emails:send:bulk" | "email-config:write" | "pdfs:write" | "pdfs:export" | "payment:write" | "checkins:write" | "files:write" | "fields:write" | "fields:read" | "templates:write" | "register-flow:write" | "export-scripts:write" | "registration-code:write" | "instance-info:read" | "instance-info:write" | "domains:manage" | "stats:read" | "stats:write" | "backup:write" | "variables:read" | "variables:write" | "webhooks:read" | "webhooks:write")[];
1072
+ [key: string]: ("attendees:read" | "attendees:create" | "attendees:write" | "attendees:write:bulk" | "attendees:import" | "attendees:export" | "attendees:delete:soft" | "attendees:delete:final" | "emails:send" | "emails:send:bulk" | "email-config:write" | "pdfs:write" | "pdfs:export" | "payment:write" | "checkins:write" | "files:write" | "fields:write" | "fields:read" | "templates:write" | "register-flow:write" | "export-scripts:write" | "instance-info:read" | "instance-info:write" | "domains:manage" | "stats:read" | "stats:write" | "backup:write" | "variables:read" | "variables:write" | "webhooks:read" | "webhooks:write")[];
1042
1073
  };
1043
1074
  };
1075
+ /** QuestionFields */
1076
+ QuestionFields: {
1077
+ /** Attendeeid */
1078
+ attendeeId: string;
1079
+ /**
1080
+ * Userdatafieldkey
1081
+ * @default email
1082
+ */
1083
+ userdataFieldKey: string;
1084
+ /** Answer */
1085
+ answer: string;
1086
+ };
1044
1087
  /** RadioButtonField */
1045
1088
  RadioButtonField: {
1046
1089
  /**
@@ -1173,6 +1216,16 @@ export declare type components = {
1173
1216
  * Format: date-time
1174
1217
  */
1175
1218
  editEnd?: string;
1219
+ /**
1220
+ * Allowregistrationwithauthcode
1221
+ * @default false
1222
+ */
1223
+ allowRegistrationWithAuthCode: boolean;
1224
+ auth_code_generator?: components["schemas"]["AuthCodeGenerator"];
1225
+ };
1226
+ /** SecurityQuestion */
1227
+ SecurityQuestion: {
1228
+ security_question: components["schemas"]["QuestionFields"];
1176
1229
  };
1177
1230
  /** StaticField */
1178
1231
  StaticField: {
@@ -1685,5 +1738,31 @@ export declare type operations = {
1685
1738
  };
1686
1739
  };
1687
1740
  };
1741
+ generate_signed_registration_token_instances__instance_name__registration_registration_token_post: {
1742
+ parameters: {
1743
+ path: {
1744
+ instance_name: string;
1745
+ };
1746
+ };
1747
+ responses: {
1748
+ /** Successful Response */
1749
+ 200: {
1750
+ content: {
1751
+ "application/json": string;
1752
+ };
1753
+ };
1754
+ /** Validation Error */
1755
+ 422: {
1756
+ content: {
1757
+ "application/json": components["schemas"]["HTTPValidationError"];
1758
+ };
1759
+ };
1760
+ };
1761
+ requestBody: {
1762
+ content: {
1763
+ "application/json": components["schemas"]["SecurityQuestion"] | components["schemas"]["AuthCode"];
1764
+ };
1765
+ };
1766
+ };
1688
1767
  };
1689
1768
  export declare type external = {};
@@ -1,14 +1,6 @@
1
1
  import { components } from '../generated/api-schema';
2
2
  import { Attendee } from './attendee';
3
- export declare type InstanceJSON = Omit<components['schemas']['PublicInstance'], 'registration'> & {
4
- registration: {
5
- start?: string;
6
- end?: string;
7
- closed: boolean;
8
- canEdit: boolean;
9
- editEnd?: string;
10
- };
11
- };
3
+ export declare type InstanceJSON = components['schemas']['PublicInstance'];
12
4
  export declare class Instance {
13
5
  name: string;
14
6
  title: string;
@@ -24,6 +16,7 @@ export declare class Instance {
24
16
  closed: boolean;
25
17
  canEdit: boolean;
26
18
  editEnd?: Date;
19
+ allowRegistrationWithAuthCode: boolean;
27
20
  };
28
21
  guestNameFields: string[];
29
22
  tagColors: Record<string, string>;
@@ -11,7 +11,8 @@ export class Instance {
11
11
  end: json.registration.end ? new Date(json.registration.end) : undefined,
12
12
  closed: json.registration.closed,
13
13
  canEdit: json.registration.canEdit,
14
- editEnd: json.registration.editEnd ? new Date(json.registration.editEnd) : undefined
14
+ editEnd: json.registration.editEnd ? new Date(json.registration.editEnd) : undefined,
15
+ allowRegistrationWithAuthCode: json.registration.allowRegistrationWithAuthCode
15
16
  };
16
17
  this.guestNameFields = json.guestNameFields;
17
18
  this.tagColors = json.tagColors;
@@ -29,7 +30,8 @@ export class Instance {
29
30
  end: this.registration.end?.toISOString(),
30
31
  closed: this.registration.closed,
31
32
  canEdit: this.registration.canEdit,
32
- editEnd: this.registration.editEnd?.toISOString()
33
+ editEnd: this.registration.editEnd?.toISOString(),
34
+ allowRegistrationWithAuthCode: this.registration.allowRegistrationWithAuthCode
33
35
  },
34
36
  guestNameFields: this.guestNameFields,
35
37
  tagColors: this.tagColors
@@ -2,6 +2,7 @@ import { ReactElement } from 'react';
2
2
  declare type Props<Segment extends string> = {
3
3
  segments: Segment[];
4
4
  activeSegment?: Segment;
5
+ colors?: string[];
5
6
  onChange: (segment: Segment) => void;
6
7
  onFocus?: () => void;
7
8
  };
@@ -5,7 +5,7 @@ export const SegmentedControl = props => {
5
5
  const name = props.segments.join('');
6
6
  return /*#__PURE__*/React.createElement("div", {
7
7
  className: _JSXStyle.dynamic([["235524868", [theme.fonts.secondary, theme.colors.enterLightGrey, theme.colors.enterMediumGrey, theme.colors.enterDarkGrey]]]) + " " + 'segmented-controll'
8
- }, props.segments.map(segment => /*#__PURE__*/React.createElement("div", {
8
+ }, props.segments.map((segment, index) => /*#__PURE__*/React.createElement("div", {
9
9
  key: segment,
10
10
  className: _JSXStyle.dynamic([["235524868", [theme.fonts.secondary, theme.colors.enterLightGrey, theme.colors.enterMediumGrey, theme.colors.enterDarkGrey]]]) + " " + 'segment'
11
11
  }, /*#__PURE__*/React.createElement("input", {
@@ -18,6 +18,9 @@ export const SegmentedControl = props => {
18
18
  className: _JSXStyle.dynamic([["235524868", [theme.fonts.secondary, theme.colors.enterLightGrey, theme.colors.enterMediumGrey, theme.colors.enterDarkGrey]]])
19
19
  }), /*#__PURE__*/React.createElement("label", {
20
20
  htmlFor: segment,
21
+ style: props.colors && {
22
+ backgroundColor: props.colors[index] && segment === props.activeSegment ? props.colors[index] : undefined
23
+ },
21
24
  className: _JSXStyle.dynamic([["235524868", [theme.fonts.secondary, theme.colors.enterLightGrey, theme.colors.enterMediumGrey, theme.colors.enterDarkGrey]]])
22
25
  }, segment))), /*#__PURE__*/React.createElement(_JSXStyle, {
23
26
  id: "235524868",
@@ -3,6 +3,7 @@ import { ComponentStory, ComponentMeta } from '@storybook/react';
3
3
  declare const _default: ComponentMeta<(<Segment extends string>(props: {
4
4
  segments: Segment[];
5
5
  activeSegment?: Segment | undefined;
6
+ colors?: string[] | undefined;
6
7
  onChange: (segment: Segment) => void;
7
8
  onFocus?: (() => void) | undefined;
8
9
  }) => React.ReactElement<any, string | React.JSXElementConstructor<any>>)>;
@@ -10,6 +11,7 @@ export default _default;
10
11
  export declare const Basic: ComponentStory<(<Segment extends string>(props: {
11
12
  segments: Segment[];
12
13
  activeSegment?: Segment | undefined;
14
+ colors?: string[] | undefined;
13
15
  onChange: (segment: Segment) => void;
14
16
  onFocus?: (() => void) | undefined;
15
17
  }) => React.ReactElement<any, string | React.JSXElementConstructor<any>>)>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dev-crew-berlin/enter-js-utils",
3
- "version": "0.41.2",
3
+ "version": "0.42.0",
4
4
  "description": "utils such as vaildation and other helpers to work with data from the enter app",
5
5
  "files": [
6
6
  "dist",