rotacloud 2.3.4 → 2.3.9

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.
@@ -4,6 +4,7 @@ import { Message } from './interfaces/message.interface.js';
4
4
  import { AttendanceQueryParams, AvailabilityQueryParams, DailyBudgetsQueryParams, DailyRevenueQueryParams, DayNotesQueryParams, DaysOffQueryParams, DocumentsQueryParams, GroupsQueryParams, LeaveEmbargoesQueryParams, LeaveQueryParams, LeaveRequestsQueryParams, LocationsQueryParams, RolesQueryParams, SettingsQueryParams, ShiftsQueryParams, TerminalsQueryParams, ToilAccrualsQueryParams, ToilAllowanceQueryParams, UsersQueryParams } from './interfaces/query-params/index.js';
5
5
  import { RequirementsOf } from './utils.js';
6
6
  import { Invoice, InvoiceQueryParameters } from './interfaces/invoice.interface.js';
7
+ import { UpdateUserWithOnboardingInfo } from './interfaces/onboarding.interface.js';
7
8
  /** Endpoint versions supported by the API */
8
9
  export type EndpointVersion = 'v1' | 'v2';
9
10
  /** Associated types for a given API endpoint */
@@ -63,5 +64,7 @@ export interface EndpointEntityMap extends Record<EndpointVersion, Record<string
63
64
  users: RequirementsOf<PartialUserV2, 'firstName' | 'lastName' | 'roles'>[];
64
65
  sendInvite?: boolean;
65
66
  }>;
67
+ 'users/onboard': Endpoint<void, number, UpdateUserWithOnboardingInfo>;
68
+ 'users/onboard/resend': Endpoint<void, number>;
66
69
  };
67
70
  }
@@ -68,10 +68,6 @@ export interface SubscriptionUpdateReq {
68
68
  billingEmail?: string;
69
69
  country?: number;
70
70
  }
71
- export interface EstimatesRes {
72
- owed: number;
73
- totalPrice: number;
74
- }
75
71
  export interface ProductCatalogueItemPrice {
76
72
  id: string;
77
73
  currency: string;
@@ -111,3 +107,34 @@ export interface CancelSubscriptionReq {
111
107
  message?: string;
112
108
  detail?: string;
113
109
  }
110
+ export interface EstimateLineItem {
111
+ id: string;
112
+ description: string;
113
+ amount: number;
114
+ discountAmount: number;
115
+ }
116
+ export interface UpdatedPlan {
117
+ planId: string;
118
+ trial?: boolean;
119
+ }
120
+ export interface UpdatedAddon {
121
+ addonId: string;
122
+ trial?: boolean;
123
+ }
124
+ export interface EstimatesReq {
125
+ plans?: UpdatedPlan[];
126
+ addons?: UpdatedAddon[];
127
+ paymentFrequency: 'monthly' | 'yearly';
128
+ }
129
+ export interface Estimate {
130
+ subTotal: number;
131
+ creditsApplied: number;
132
+ lineItems: EstimateLineItem[];
133
+ }
134
+ export interface EstimatesRes {
135
+ paymentFrequency: 'monthly' | 'yearly';
136
+ quantity: number;
137
+ immediateEstimates: Estimate;
138
+ nextEstimates: Estimate;
139
+ nextBillingDate: string;
140
+ }
@@ -0,0 +1,22 @@
1
+ import { RequirementsOf } from '../utils.js';
2
+ import { User } from './user.interface.js';
3
+ export interface UpdateUserWithOnboardingInfo {
4
+ title: string;
5
+ gender: string;
6
+ dob: string;
7
+ nationalInsuranceNumber?: string;
8
+ address1: string;
9
+ address2: string;
10
+ county: string;
11
+ phone: string;
12
+ postcode: string;
13
+ city: string;
14
+ emergencyContactName: string;
15
+ emergencyContactPhone: string;
16
+ emergencyContactRelationship: string;
17
+ }
18
+ export type PendingV1User = RequirementsOf<User, 'first_name' | 'last_name' | 'locations' | 'email'>;
19
+ export interface AddOrOnboard {
20
+ users: PendingV1User[];
21
+ locations: number[];
22
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -25,6 +25,7 @@ export type SDKConfig = ({
25
25
  apiKey?: never;
26
26
  basicAuth: string;
27
27
  }) & {
28
+ stripeKey?: string;
28
29
  baseUri?: string;
29
30
  accountId?: number;
30
31
  userId?: number;
package/dist/main.d.ts CHANGED
@@ -250,4 +250,23 @@ export declare const createRotaCloudClient: (config: import("./interfaces/sdk-co
250
250
  }) => import("./ops.js").RequestConfig<typeof userSpec, import("./interfaces/user-v2.interface.js").CreateUserResponse>;
251
251
  };
252
252
  };
253
+ onboarding: {
254
+ endpoint: "users/onboard";
255
+ endpointVersion: "v2";
256
+ operations: ("create" | "update")[];
257
+ customOperations: {
258
+ update: ({ request, service }: import("./ops.js").OperationContext, onboardingInfoForm: import("./interfaces/onboarding.interface.js").UpdateUserWithOnboardingInfo) => import("./ops.js").RequestConfig<typeof onboardingInfoForm, void>;
259
+ create: ({ request, service }: import("./ops.js").OperationContext, addOrOnboard: import("./interfaces/onboarding.interface.js").AddOrOnboard) => import("./ops.js").RequestConfig<typeof addOrOnboard, void>;
260
+ };
261
+ };
262
+ resendOnboardingLink: {
263
+ endpoint: "users/onboard/resend";
264
+ endpointVersion: "v2";
265
+ operations: "create"[];
266
+ customOperations: {
267
+ create: ({ request, service }: import("./ops.js").OperationContext, entity: {
268
+ id: number;
269
+ }) => import("./ops.js").RequestConfig<void, void>;
270
+ };
271
+ };
253
272
  }>;
package/dist/ops.d.ts CHANGED
@@ -166,7 +166,7 @@ export declare function getOpMap<E extends Endpoint<any, any>, T extends E['type
166
166
  }) | undefined) => Promise<T[]>;
167
167
  listByPage: (ctx: OperationContext, query: E["queryParameters"], opts?: (RequestOptions<T[]> & {
168
168
  offset?: number;
169
- }) | undefined) => AsyncGenerator<AxiosResponse<T[], any>, any, any>;
169
+ }) | undefined) => AsyncGenerator<AxiosResponse<T[], any, {}>, any, any>;
170
170
  create: (ctx: OperationContext, newEntity: E["createType"]) => RequestConfig<E["createType"], T>;
171
171
  update: (ctx: OperationContext, entity: T extends {
172
172
  id: number;
@@ -189,7 +189,7 @@ export declare function getOpMap<E extends Endpoint<any, any>, T extends E['type
189
189
  deleteBatch: typeof deleteBatchOp;
190
190
  list: (ctx: OperationContext, query: E["queryParameters"], opts?: RequestOptions<T[]> | undefined) => AsyncGenerator<T, any, any>;
191
191
  listAll: (ctx: OperationContext, query: E["queryParameters"], opts?: RequestOptions<T[]> | undefined) => Promise<T[]>;
192
- listByPage: (ctx: OperationContext, query: E["queryParameters"], opts?: RequestOptions<T[]> | undefined) => AsyncGenerator<AxiosResponse<PagedResponse<T>, any>, any, any>;
192
+ listByPage: (ctx: OperationContext, query: E["queryParameters"], opts?: RequestOptions<T[]> | undefined) => AsyncGenerator<AxiosResponse<PagedResponse<T>, any, {}>, any, any>;
193
193
  create: (ctx: OperationContext, newEntity: E["createType"]) => RequestConfig<E["createType"], T>;
194
194
  update: (ctx: OperationContext, entity: T extends {
195
195
  id: number;
package/dist/service.d.ts CHANGED
@@ -11,6 +11,7 @@ import { LogbookEntry, LogbookQueryParameters } from './interfaces/logbook.inter
11
11
  import { Message } from './interfaces/message.interface.js';
12
12
  import { Invoice, InvoiceDownload } from './interfaces/invoice.interface.js';
13
13
  import { CreateUserRequest, CreateUserResponse } from './interfaces/user-v2.interface.js';
14
+ import { AddOrOnboard, UpdateUserWithOnboardingInfo } from './interfaces/onboarding.interface.js';
14
15
  export type ServiceSpecification<CustomOp extends OpDef<unknown> = OpDef<any>> = {
15
16
  /** Operations allowed and usable for the endpoint */
16
17
  operations: Operation[];
@@ -294,4 +295,23 @@ export declare const SERVICES: {
294
295
  }) => RequestConfig<typeof userSpec, CreateUserResponse>;
295
296
  };
296
297
  };
298
+ onboarding: {
299
+ endpoint: "users/onboard";
300
+ endpointVersion: "v2";
301
+ operations: ("create" | "update")[];
302
+ customOperations: {
303
+ update: ({ request, service }: OperationContext, onboardingInfoForm: UpdateUserWithOnboardingInfo) => RequestConfig<typeof onboardingInfoForm, void>;
304
+ create: ({ request, service }: OperationContext, addOrOnboard: AddOrOnboard) => RequestConfig<typeof addOrOnboard, void>;
305
+ };
306
+ };
307
+ resendOnboardingLink: {
308
+ endpoint: "users/onboard/resend";
309
+ endpointVersion: "v2";
310
+ operations: "create"[];
311
+ customOperations: {
312
+ create: ({ request, service }: OperationContext, entity: {
313
+ id: number;
314
+ }) => RequestConfig<void, void>;
315
+ };
316
+ };
297
317
  };
package/dist/service.js CHANGED
@@ -394,4 +394,35 @@ export const SERVICES = {
394
394
  }),
395
395
  },
396
396
  },
397
+ onboarding: {
398
+ endpoint: 'users/onboard',
399
+ endpointVersion: 'v2',
400
+ operations: ['update', 'create'],
401
+ customOperations: {
402
+ update: ({ request, service }, onboardingInfoForm) => ({
403
+ ...request,
404
+ url: `${service.endpointVersion}/${service.endpoint}`,
405
+ method: 'PATCH',
406
+ data: onboardingInfoForm,
407
+ }),
408
+ create: ({ request, service }, addOrOnboard) => ({
409
+ ...request,
410
+ url: `${service.endpointVersion}/${service.endpoint}`,
411
+ method: 'POST',
412
+ data: addOrOnboard,
413
+ }),
414
+ },
415
+ },
416
+ resendOnboardingLink: {
417
+ endpoint: 'users/onboard/resend',
418
+ endpointVersion: 'v2',
419
+ operations: ['create'],
420
+ customOperations: {
421
+ create: ({ request, service }, entity) => ({
422
+ ...request,
423
+ url: `${service.endpointVersion}/${service.endpoint}/${entity.id}/resend`,
424
+ method: 'POST',
425
+ }),
426
+ },
427
+ },
397
428
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rotacloud",
3
- "version": "2.3.4",
3
+ "version": "2.3.9",
4
4
  "description": "The RotaCloud SDK for the RotaCloud API",
5
5
  "type": "module",
6
6
  "engines": {
package/src/endpoint.ts CHANGED
@@ -54,6 +54,7 @@ import {
54
54
  } from './interfaces/query-params/index.js';
55
55
  import { RequirementsOf } from './utils.js';
56
56
  import { Invoice, InvoiceQueryParameters } from './interfaces/invoice.interface.js';
57
+ import { UpdateUserWithOnboardingInfo } from './interfaces/onboarding.interface.js';
57
58
 
58
59
  /** Endpoint versions supported by the API */
59
60
  export type EndpointVersion = 'v1' | 'v2';
@@ -137,5 +138,7 @@ export interface EndpointEntityMap extends Record<EndpointVersion, Record<string
137
138
  sendInvite?: boolean;
138
139
  }
139
140
  >;
141
+ 'users/onboard': Endpoint<void, number, UpdateUserWithOnboardingInfo>;
142
+ 'users/onboard/resend': Endpoint<void, number>;
140
143
  };
141
144
  }
@@ -66,11 +66,6 @@ export interface SubscriptionUpdateReq {
66
66
  country?: number;
67
67
  }
68
68
 
69
- export interface EstimatesRes {
70
- owed: number;
71
- totalPrice: number;
72
- }
73
-
74
69
  export interface ProductCatalogueItemPrice {
75
70
  id: string;
76
71
  currency: string;
@@ -108,3 +103,40 @@ export interface CancelSubscriptionReq {
108
103
  message?: string;
109
104
  detail?: string;
110
105
  }
106
+
107
+ export interface EstimateLineItem {
108
+ id: string;
109
+ description: string;
110
+ amount: number;
111
+ discountAmount: number;
112
+ }
113
+
114
+ export interface UpdatedPlan {
115
+ planId: string;
116
+ trial?: boolean;
117
+ }
118
+
119
+ export interface UpdatedAddon {
120
+ addonId: string;
121
+ trial?: boolean;
122
+ }
123
+
124
+ export interface EstimatesReq {
125
+ plans?: UpdatedPlan[];
126
+ addons?: UpdatedAddon[];
127
+ paymentFrequency: 'monthly' | 'yearly';
128
+ }
129
+
130
+ export interface Estimate {
131
+ subTotal: number;
132
+ creditsApplied: number;
133
+ lineItems: EstimateLineItem[];
134
+ }
135
+
136
+ export interface EstimatesRes {
137
+ paymentFrequency: 'monthly' | 'yearly';
138
+ quantity: number;
139
+ immediateEstimates: Estimate;
140
+ nextEstimates: Estimate;
141
+ nextBillingDate: string;
142
+ }
@@ -0,0 +1,25 @@
1
+ import { RequirementsOf } from '../utils.js';
2
+ import { User } from './user.interface.js';
3
+
4
+ export interface UpdateUserWithOnboardingInfo {
5
+ title: string;
6
+ gender: string;
7
+ dob: string;
8
+ nationalInsuranceNumber?: string;
9
+ address1: string;
10
+ address2: string;
11
+ county: string;
12
+ phone: string;
13
+ postcode: string;
14
+ city: string;
15
+ emergencyContactName: string;
16
+ emergencyContactPhone: string;
17
+ emergencyContactRelationship: string;
18
+ }
19
+
20
+ export type PendingV1User = RequirementsOf<User, 'first_name' | 'last_name' | 'locations' | 'email'>;
21
+
22
+ export interface AddOrOnboard {
23
+ users: PendingV1User[];
24
+ locations: number[];
25
+ }
@@ -34,6 +34,7 @@ export type SDKConfig = (
34
34
  basicAuth: string;
35
35
  }
36
36
  ) & {
37
+ stripeKey?: string;
37
38
  baseUri?: string;
38
39
  accountId?: number;
39
40
  userId?: number;
package/src/service.ts CHANGED
@@ -36,6 +36,7 @@ import { LogbookEntry, LogbookQueryParameters } from './interfaces/logbook.inter
36
36
  import { Message } from './interfaces/message.interface.js';
37
37
  import { Invoice, InvoiceDownload } from './interfaces/invoice.interface.js';
38
38
  import { CreateUserRequest, CreateUserResponse, PartialUserV2 } from './interfaces/user-v2.interface.js';
39
+ import { AddOrOnboard, UpdateUserWithOnboardingInfo } from './interfaces/onboarding.interface.js';
39
40
 
40
41
  export type ServiceSpecification<CustomOp extends OpDef<unknown> = OpDef<any>> = {
41
42
  /** Operations allowed and usable for the endpoint */
@@ -516,4 +517,38 @@ export const SERVICES = {
516
517
  }),
517
518
  },
518
519
  },
520
+ onboarding: {
521
+ endpoint: 'users/onboard',
522
+ endpointVersion: 'v2',
523
+ operations: ['update', 'create'],
524
+ customOperations: {
525
+ update: (
526
+ { request, service },
527
+ onboardingInfoForm: UpdateUserWithOnboardingInfo,
528
+ ): RequestConfig<typeof onboardingInfoForm, void> => ({
529
+ ...request,
530
+ url: `${service.endpointVersion}/${service.endpoint}`,
531
+ method: 'PATCH',
532
+ data: onboardingInfoForm,
533
+ }),
534
+ create: ({ request, service }, addOrOnboard: AddOrOnboard): RequestConfig<typeof addOrOnboard, void> => ({
535
+ ...request,
536
+ url: `${service.endpointVersion}/${service.endpoint}`,
537
+ method: 'POST',
538
+ data: addOrOnboard,
539
+ }),
540
+ },
541
+ },
542
+ resendOnboardingLink: {
543
+ endpoint: 'users/onboard/resend',
544
+ endpointVersion: 'v2',
545
+ operations: ['create'],
546
+ customOperations: {
547
+ create: ({ request, service }, entity: { id: number }): RequestConfig<void, void> => ({
548
+ ...request,
549
+ url: `${service.endpointVersion}/${service.endpoint}/${entity.id}/resend`,
550
+ method: 'POST',
551
+ }),
552
+ },
553
+ },
519
554
  } satisfies Record<string, ServiceSpecification>;