@blazeo.com/calendar-client 1.0.5 → 1.0.6
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/README.md +54 -54
- package/dist/index.d.ts +140 -129
- package/dist/index.js +5 -0
- package/dist/index.mjs +5 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
# @blazeo.com/calendar-client
|
|
2
|
-
|
|
3
|
-
**Private package** – for Blazeo internal teams only. JavaScript client for the Blazeo Calendar / Appointment API. Use it in React (or any JS app) to call calendar and event endpoints via MobX State Tree models.
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
From your npm registry (internal teams; ensure you're logged in to the scope):
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm install @blazeo.com/calendar-client
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Or link locally:
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
cd calendar-client && npm run build && npm link
|
|
17
|
-
cd your-app && npm link @blazeo.com/calendar-client
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
## Usage
|
|
21
|
-
|
|
22
|
-
Configure once at app startup, then use models and their methods:
|
|
23
|
-
|
|
24
|
-
```js
|
|
25
|
-
import { configure, setBaseUrl, setConsumer, CalendarModel, createRootStore } from '@blazeo.com/calendar-client';
|
|
26
|
-
|
|
27
|
-
configure({ baseUrl: 'https://your-appointment-api.example.com' });
|
|
28
|
-
// or: setBaseUrl('https://localhost:7051');
|
|
29
|
-
setConsumer('my-app'); // optional: sent as Consumer header (e.g. for lead source)
|
|
30
|
-
|
|
31
|
-
// Calendar static methods (no store needed)
|
|
32
|
-
const timezones = await CalendarModel.getTimeZones();
|
|
33
|
-
const calendar = await CalendarModel.get('calendar-guid');
|
|
34
|
-
|
|
35
|
-
// Or use RootStore with models
|
|
36
|
-
const store = createRootStore();
|
|
37
|
-
const cal = store.addCalendar({ calendarId: 'my-cal', name: 'My Calendar' });
|
|
38
|
-
await cal.create(); // POST to backend
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
## API overview
|
|
42
|
-
|
|
43
|
-
- **CalendarModel (static):** `get`, `getByCompany`, `getTimeZones`, `getTimeZone`, `getParticipants`, `getMonth`, `getEvents`, etc.
|
|
44
|
-
- **EventModel (instance):** `get`, `create`, `cancel`, `getCancellable`, `getAvailability`, `setReminder`
|
|
45
|
-
- **FlowModel:** Same pattern as Calendar — `FlowModel.create({}, { env })` with no fields; static `get`, `getRaw`, `list`, `createFlow`, `updateFlow`, `delete`, `duplicate`, appearance/embed/public/preview helpers; instance methods mirror those using `flowId` on the snapshot
|
|
46
|
-
- **LeadModel:** `LeadModel.create({}, { env })`; static `get`, `getRaw`, `getByEmail`, `getByCompany`; instance `get`, `getByEmail`, `getByCompany` (uses `leadId` / `email` / `companyKey` on the snapshot)
|
|
47
|
-
- **RootStore:** `addCalendar`, `addEvent`
|
|
48
|
-
|
|
49
|
-
All methods return `Promise<{ status, data?, message? }>`. Check `response.status === 'success'` and use `response.data`.
|
|
50
|
-
|
|
51
|
-
## Samples
|
|
52
|
-
|
|
53
|
-
- **`sample/`** – Uses the package via `file:..` for local development (run `npm run build` in parent first).
|
|
54
|
-
- **`sample-npm/`** – Uses the package from npm: `npm i @blazeo.com/calendar-client`. For testing the published package.
|
|
1
|
+
# @blazeo.com/calendar-client
|
|
2
|
+
|
|
3
|
+
**Private package** – for Blazeo internal teams only. JavaScript client for the Blazeo Calendar / Appointment API. Use it in React (or any JS app) to call calendar and event endpoints via MobX State Tree models.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
From your npm registry (internal teams; ensure you're logged in to the scope):
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @blazeo.com/calendar-client
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Or link locally:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
cd calendar-client && npm run build && npm link
|
|
17
|
+
cd your-app && npm link @blazeo.com/calendar-client
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
Configure once at app startup, then use models and their methods:
|
|
23
|
+
|
|
24
|
+
```js
|
|
25
|
+
import { configure, setBaseUrl, setConsumer, CalendarModel, createRootStore } from '@blazeo.com/calendar-client';
|
|
26
|
+
|
|
27
|
+
configure({ baseUrl: 'https://your-appointment-api.example.com' });
|
|
28
|
+
// or: setBaseUrl('https://localhost:7051');
|
|
29
|
+
setConsumer('my-app'); // optional: sent as Consumer header (e.g. for lead source)
|
|
30
|
+
|
|
31
|
+
// Calendar static methods (no store needed)
|
|
32
|
+
const timezones = await CalendarModel.getTimeZones();
|
|
33
|
+
const calendar = await CalendarModel.get('calendar-guid');
|
|
34
|
+
|
|
35
|
+
// Or use RootStore with models
|
|
36
|
+
const store = createRootStore();
|
|
37
|
+
const cal = store.addCalendar({ calendarId: 'my-cal', name: 'My Calendar' });
|
|
38
|
+
await cal.create(); // POST to backend
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## API overview
|
|
42
|
+
|
|
43
|
+
- **CalendarModel (static):** `get`, `getByCompany`, `getTimeZones`, `getTimeZone`, `getParticipants`, `getMonth`, `getEvents`, etc.
|
|
44
|
+
- **EventModel (instance):** `get`, `create`, `cancel`, `getCancellable`, `getAvailability`, `setReminder`
|
|
45
|
+
- **FlowModel:** Same pattern as Calendar — `FlowModel.create({}, { env })` with no fields; static `get`, `getRaw`, `list`, `createFlow`, `updateFlow`, `delete`, `duplicate`, appearance/embed/public/preview helpers; instance methods mirror those using `flowId` on the snapshot
|
|
46
|
+
- **LeadModel:** `LeadModel.create({}, { env })`; static `get`, `getRaw`, `getByEmail`, `getByCompany`; instance `get`, `getByEmail`, `getByCompany` (uses `leadId` / `email` / `companyKey` on the snapshot)
|
|
47
|
+
- **RootStore:** `addCalendar`, `addEvent`
|
|
48
|
+
|
|
49
|
+
All methods return `Promise<{ status, data?, message? }>`. Check `response.status === 'success'` and use `response.data`.
|
|
50
|
+
|
|
51
|
+
## Samples
|
|
52
|
+
|
|
53
|
+
- **`sample/`** – Uses the package via `file:..` for local development (run `npm run build` in parent first).
|
|
54
|
+
- **`sample-npm/`** – Uses the package from npm: `npm i @blazeo.com/calendar-client`. For testing the published package.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,129 +1,140 @@
|
|
|
1
|
-
/** @blazeo.com/calendar-client - type declarations */
|
|
2
|
-
|
|
3
|
-
export function configure(env: { baseUrl?: string; consumer?: string; fetch?: typeof fetch; getDefaultOffset?: () => number }): void;
|
|
4
|
-
export function getConfig(): { baseUrl?: string; consumer?: string; fetch?: typeof fetch; getDefaultOffset?: () => number } | null;
|
|
5
|
-
export function setBaseUrl(baseUrl: string): void;
|
|
6
|
-
export function setConsumer(consumer: string): void;
|
|
7
|
-
export function getConfigStore(): unknown;
|
|
8
|
-
|
|
9
|
-
export const ConfigModel: unknown;
|
|
10
|
-
|
|
11
|
-
export const CalendarModel: {
|
|
12
|
-
get(calendarId: string): Promise<unknown>;
|
|
13
|
-
getRaw(calendarId: string): Promise<{ status: string; data?: unknown; message?: string }>;
|
|
14
|
-
getByCompany(companyKey: string): Promise<unknown[]>;
|
|
15
|
-
getTimeZones(): Promise<unknown>;
|
|
16
|
-
getTimeZone(timezoneId: string): Promise<unknown>;
|
|
17
|
-
getParticipants(calendarId: string): Promise<unknown>;
|
|
18
|
-
getCalendarParticipant(calendarId: string): Promise<unknown>;
|
|
19
|
-
getParticipantsInfo(calendarId: string): Promise<unknown>;
|
|
20
|
-
getMonth(calendarId: string, year: number, month: number): Promise<unknown>;
|
|
21
|
-
getEvents(calendarId: string): Promise<unknown>;
|
|
22
|
-
createWithParticipants(name: string, companyKey: string, participantIds: string[], description: string, calendarId?: string): Promise<unknown>;
|
|
23
|
-
editWithParticipants(calendarId: string, name: string, participantIds: string[], description: string): Promise<unknown>;
|
|
24
|
-
create(snapshot: object, options?: { env?: object }): unknown;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export const EventModel: {
|
|
28
|
-
get(eventId: string): Promise<unknown>;
|
|
29
|
-
getByExternalId(externalEventId: string): Promise<unknown>;
|
|
30
|
-
getRoundRobinParticipant(calendarId: string): Promise<unknown>;
|
|
31
|
-
getEarliestAvailableDays(calendarId: string, count: number, opts?: { year?: number; month?: number; day?: number; offset?: number }): Promise<string[] | null>;
|
|
32
|
-
getDaySelectable(calendarId: string, year: number, month: number, day: number, opts?: { participantId?: string; offset?: number }): Promise<boolean>;
|
|
33
|
-
getByVisitorEmail(email: string, opts: { companyKey?: string; calendarId?: string; offset?: number }): Promise<unknown[] | null>;
|
|
34
|
-
getByVisitorPhone(phone: string, opts: { companyKey?: string; calendarId?: string; offset?: number }): Promise<unknown[] | null>;
|
|
35
|
-
getAvailability(calendarId: string, year: number, month: number, day: number, opts?: { participantId?: string; offset?: number }): Promise<unknown[]>;
|
|
36
|
-
cancel(eventId: string): Promise<unknown>;
|
|
37
|
-
getCancellable(eventId: string): Promise<boolean>;
|
|
38
|
-
createEvent(payload: object, offsetMinutes?: number): Promise<unknown>;
|
|
39
|
-
reschedule(payload: object, offsetMinutes?: number): Promise<unknown>;
|
|
40
|
-
updateEvent(payload: object): Promise<unknown>;
|
|
41
|
-
createTest(payload: object, offsetMinutes?: number): Promise<unknown>;
|
|
42
|
-
getCustomData(calendarId: string, eventId?: string): Promise<unknown>;
|
|
43
|
-
setReminder(eventId: string): Promise<unknown>;
|
|
44
|
-
setAttendeeStatus(eventId: string, attendeeStatus: number | string): Promise<unknown>;
|
|
45
|
-
create(snapshot: object, options?: { env?: object }): unknown;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export const AvailabilityModel: { create(snapshot: object, options?: { env?: object }): unknown };
|
|
49
|
-
export const AvailabilityDetailModel: { create(snapshot: object, options?: { env?: object }): unknown };
|
|
50
|
-
export const CalendarParticipantModel: {
|
|
51
|
-
getByCalendar(calendarId: string): Promise<unknown[] | null>;
|
|
52
|
-
getInfoByCalendar(calendarId: string): Promise<unknown[] | null>;
|
|
53
|
-
getByParticipant(participantId: string): Promise<unknown[] | null>;
|
|
54
|
-
create(snapshot: object, options?: { env?: object }): unknown;
|
|
55
|
-
};
|
|
56
|
-
export const ParticipantModel: {
|
|
57
|
-
get(participantId: string): Promise<unknown>;
|
|
58
|
-
getByIds(participantIds: string[] | string): Promise<unknown[] | null>;
|
|
59
|
-
getAll(companyKey: string): Promise<unknown[] | null>;
|
|
60
|
-
add(payload: object, calendarId?: string): Promise<unknown>;
|
|
61
|
-
remove(participantId: string): Promise<unknown>;
|
|
62
|
-
update(payload: object): Promise<unknown>;
|
|
63
|
-
save(payload: object): Promise<unknown>;
|
|
64
|
-
sendEmail(participantId: string): Promise<unknown>;
|
|
65
|
-
create(snapshot: object, options?: { env?: object }): unknown;
|
|
66
|
-
};
|
|
67
|
-
export const OpeningHourModel: { create(snapshot: object, options?: { env?: object }): unknown };
|
|
68
|
-
export const TimeSlotModel: { create(snapshot: object, options?: { env?: object }): unknown };
|
|
69
|
-
export const TimeFrameModel: { create(snapshot: object, options?: { env?: object }): unknown };
|
|
70
|
-
export const SettingModel: {
|
|
71
|
-
get(calendarId: string): Promise<unknown>;
|
|
72
|
-
save(payload: object): Promise<unknown>;
|
|
73
|
-
uploadLogo(calendarId: string, file: File | Blob): Promise<unknown>;
|
|
74
|
-
create(snapshot: object, options?: { env?: object }): unknown;
|
|
75
|
-
};
|
|
76
|
-
export const CompanyModel: {
|
|
77
|
-
get(companyKey: string): Promise<unknown>;
|
|
78
|
-
getAll(): Promise<unknown[] | null>;
|
|
79
|
-
save(payload: object): Promise<unknown>;
|
|
80
|
-
create(snapshot: object, options?: { env?: object }): unknown;
|
|
81
|
-
};
|
|
82
|
-
export const CalendarDayModel: { create(snapshot: object, options?: { env?: object }): unknown };
|
|
83
|
-
export const ParticipantInfoModel: { create(snapshot: object, options?: { env?: object }): unknown };
|
|
84
|
-
export const PreferenceModel: {
|
|
85
|
-
getScopes(): Promise<string[] | null>;
|
|
86
|
-
getOptions(): Promise<string[] | null>;
|
|
87
|
-
getOptionTemplate(option: string): Promise<unknown>;
|
|
88
|
-
get(option: string, keys: string | string[]): Promise<unknown>;
|
|
89
|
-
set(scope: string, key: string, option: string, body: string | object): Promise<unknown>;
|
|
90
|
-
delete(preferenceId: string): Promise<unknown>;
|
|
91
|
-
create(snapshot: object, options?: { env?: object }): unknown;
|
|
92
|
-
};
|
|
93
|
-
export const PreferenceScope: Record<string, number>;
|
|
94
|
-
|
|
95
|
-
export const FlowModel: {
|
|
96
|
-
getRaw(flowId: string): Promise<{ status: string; data?: unknown; message?: string }>;
|
|
97
|
-
list(companyKey: string, includeDeleted?: boolean): Promise<unknown[] | null>;
|
|
98
|
-
get(flowId: string): Promise<unknown>;
|
|
99
|
-
createFlow(payload: object): Promise<unknown>;
|
|
100
|
-
updateFlow(payload: object): Promise<unknown>;
|
|
101
|
-
delete(flowId: string): Promise<unknown>;
|
|
102
|
-
duplicate(flowId: string, newName?: string): Promise<unknown>;
|
|
103
|
-
getAppearance(flowId: string): Promise<unknown>;
|
|
104
|
-
saveAppearance(payload: object): Promise<unknown>;
|
|
105
|
-
getEmbed(flowId: string): Promise<unknown>;
|
|
106
|
-
saveEmbed(payload: object): Promise<unknown>;
|
|
107
|
-
getPublic(flowId: string): Promise<{ flow: unknown; appearance: unknown; embed: unknown } | null>;
|
|
108
|
-
getPreview(flowId: string): Promise<{ flow: unknown; appearance: unknown; embed: unknown } | null>;
|
|
109
|
-
/** Empty snapshot is valid: `FlowModel.create({}, { env })` after configure() */
|
|
110
|
-
create(snapshot?: object, options?: { env?: object }): unknown;
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
export const LeadModel: {
|
|
114
|
-
getRaw(leadId: string): Promise<{ status: string; data?: unknown; message?: string }>;
|
|
115
|
-
get(leadId: string): Promise<unknown>;
|
|
116
|
-
getByEmail(email: string, companyKey: string): Promise<unknown>;
|
|
117
|
-
getByCompany(
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
1
|
+
/** @blazeo.com/calendar-client - type declarations */
|
|
2
|
+
|
|
3
|
+
export function configure(env: { baseUrl?: string; consumer?: string; fetch?: typeof fetch; getDefaultOffset?: () => number }): void;
|
|
4
|
+
export function getConfig(): { baseUrl?: string; consumer?: string; fetch?: typeof fetch; getDefaultOffset?: () => number } | null;
|
|
5
|
+
export function setBaseUrl(baseUrl: string): void;
|
|
6
|
+
export function setConsumer(consumer: string): void;
|
|
7
|
+
export function getConfigStore(): unknown;
|
|
8
|
+
|
|
9
|
+
export const ConfigModel: unknown;
|
|
10
|
+
|
|
11
|
+
export const CalendarModel: {
|
|
12
|
+
get(calendarId: string): Promise<unknown>;
|
|
13
|
+
getRaw(calendarId: string): Promise<{ status: string; data?: unknown; message?: string }>;
|
|
14
|
+
getByCompany(companyKey: string): Promise<unknown[]>;
|
|
15
|
+
getTimeZones(): Promise<unknown>;
|
|
16
|
+
getTimeZone(timezoneId: string): Promise<unknown>;
|
|
17
|
+
getParticipants(calendarId: string): Promise<unknown>;
|
|
18
|
+
getCalendarParticipant(calendarId: string): Promise<unknown>;
|
|
19
|
+
getParticipantsInfo(calendarId: string): Promise<unknown>;
|
|
20
|
+
getMonth(calendarId: string, year: number, month: number): Promise<unknown>;
|
|
21
|
+
getEvents(calendarId: string): Promise<unknown>;
|
|
22
|
+
createWithParticipants(name: string, companyKey: string, participantIds: string[], description: string, calendarId?: string): Promise<unknown>;
|
|
23
|
+
editWithParticipants(calendarId: string, name: string, participantIds: string[], description: string): Promise<unknown>;
|
|
24
|
+
create(snapshot: object, options?: { env?: object }): unknown;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const EventModel: {
|
|
28
|
+
get(eventId: string): Promise<unknown>;
|
|
29
|
+
getByExternalId(externalEventId: string): Promise<unknown>;
|
|
30
|
+
getRoundRobinParticipant(calendarId: string): Promise<unknown>;
|
|
31
|
+
getEarliestAvailableDays(calendarId: string, count: number, opts?: { year?: number; month?: number; day?: number; offset?: number }): Promise<string[] | null>;
|
|
32
|
+
getDaySelectable(calendarId: string, year: number, month: number, day: number, opts?: { participantId?: string; offset?: number }): Promise<boolean>;
|
|
33
|
+
getByVisitorEmail(email: string, opts: { companyKey?: string; calendarId?: string; offset?: number }): Promise<unknown[] | null>;
|
|
34
|
+
getByVisitorPhone(phone: string, opts: { companyKey?: string; calendarId?: string; offset?: number }): Promise<unknown[] | null>;
|
|
35
|
+
getAvailability(calendarId: string, year: number, month: number, day: number, opts?: { participantId?: string; offset?: number }): Promise<unknown[]>;
|
|
36
|
+
cancel(eventId: string): Promise<unknown>;
|
|
37
|
+
getCancellable(eventId: string): Promise<boolean>;
|
|
38
|
+
createEvent(payload: object, offsetMinutes?: number): Promise<unknown>;
|
|
39
|
+
reschedule(payload: object, offsetMinutes?: number): Promise<unknown>;
|
|
40
|
+
updateEvent(payload: object): Promise<unknown>;
|
|
41
|
+
createTest(payload: object, offsetMinutes?: number): Promise<unknown>;
|
|
42
|
+
getCustomData(calendarId: string, eventId?: string): Promise<unknown>;
|
|
43
|
+
setReminder(eventId: string): Promise<unknown>;
|
|
44
|
+
setAttendeeStatus(eventId: string, attendeeStatus: number | string): Promise<unknown>;
|
|
45
|
+
create(snapshot: object, options?: { env?: object }): unknown;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const AvailabilityModel: { create(snapshot: object, options?: { env?: object }): unknown };
|
|
49
|
+
export const AvailabilityDetailModel: { create(snapshot: object, options?: { env?: object }): unknown };
|
|
50
|
+
export const CalendarParticipantModel: {
|
|
51
|
+
getByCalendar(calendarId: string): Promise<unknown[] | null>;
|
|
52
|
+
getInfoByCalendar(calendarId: string): Promise<unknown[] | null>;
|
|
53
|
+
getByParticipant(participantId: string): Promise<unknown[] | null>;
|
|
54
|
+
create(snapshot: object, options?: { env?: object }): unknown;
|
|
55
|
+
};
|
|
56
|
+
export const ParticipantModel: {
|
|
57
|
+
get(participantId: string): Promise<unknown>;
|
|
58
|
+
getByIds(participantIds: string[] | string): Promise<unknown[] | null>;
|
|
59
|
+
getAll(companyKey: string): Promise<unknown[] | null>;
|
|
60
|
+
add(payload: object, calendarId?: string): Promise<unknown>;
|
|
61
|
+
remove(participantId: string): Promise<unknown>;
|
|
62
|
+
update(payload: object): Promise<unknown>;
|
|
63
|
+
save(payload: object): Promise<unknown>;
|
|
64
|
+
sendEmail(participantId: string): Promise<unknown>;
|
|
65
|
+
create(snapshot: object, options?: { env?: object }): unknown;
|
|
66
|
+
};
|
|
67
|
+
export const OpeningHourModel: { create(snapshot: object, options?: { env?: object }): unknown };
|
|
68
|
+
export const TimeSlotModel: { create(snapshot: object, options?: { env?: object }): unknown };
|
|
69
|
+
export const TimeFrameModel: { create(snapshot: object, options?: { env?: object }): unknown };
|
|
70
|
+
export const SettingModel: {
|
|
71
|
+
get(calendarId: string): Promise<unknown>;
|
|
72
|
+
save(payload: object): Promise<unknown>;
|
|
73
|
+
uploadLogo(calendarId: string, file: File | Blob): Promise<unknown>;
|
|
74
|
+
create(snapshot: object, options?: { env?: object }): unknown;
|
|
75
|
+
};
|
|
76
|
+
export const CompanyModel: {
|
|
77
|
+
get(companyKey: string): Promise<unknown>;
|
|
78
|
+
getAll(): Promise<unknown[] | null>;
|
|
79
|
+
save(payload: object): Promise<unknown>;
|
|
80
|
+
create(snapshot: object, options?: { env?: object }): unknown;
|
|
81
|
+
};
|
|
82
|
+
export const CalendarDayModel: { create(snapshot: object, options?: { env?: object }): unknown };
|
|
83
|
+
export const ParticipantInfoModel: { create(snapshot: object, options?: { env?: object }): unknown };
|
|
84
|
+
export const PreferenceModel: {
|
|
85
|
+
getScopes(): Promise<string[] | null>;
|
|
86
|
+
getOptions(): Promise<string[] | null>;
|
|
87
|
+
getOptionTemplate(option: string): Promise<unknown>;
|
|
88
|
+
get(option: string, keys: string | string[]): Promise<unknown>;
|
|
89
|
+
set(scope: string, key: string, option: string, body: string | object): Promise<unknown>;
|
|
90
|
+
delete(preferenceId: string): Promise<unknown>;
|
|
91
|
+
create(snapshot: object, options?: { env?: object }): unknown;
|
|
92
|
+
};
|
|
93
|
+
export const PreferenceScope: Record<string, number>;
|
|
94
|
+
|
|
95
|
+
export const FlowModel: {
|
|
96
|
+
getRaw(flowId: string): Promise<{ status: string; data?: unknown; message?: string }>;
|
|
97
|
+
list(companyKey: string, includeDeleted?: boolean): Promise<unknown[] | null>;
|
|
98
|
+
get(flowId: string): Promise<unknown>;
|
|
99
|
+
createFlow(payload: object): Promise<unknown>;
|
|
100
|
+
updateFlow(payload: object): Promise<unknown>;
|
|
101
|
+
delete(flowId: string): Promise<unknown>;
|
|
102
|
+
duplicate(flowId: string, newName?: string): Promise<unknown>;
|
|
103
|
+
getAppearance(flowId: string): Promise<unknown>;
|
|
104
|
+
saveAppearance(payload: object): Promise<unknown>;
|
|
105
|
+
getEmbed(flowId: string): Promise<unknown>;
|
|
106
|
+
saveEmbed(payload: object): Promise<unknown>;
|
|
107
|
+
getPublic(flowId: string): Promise<{ flow: unknown; appearance: unknown; embed: unknown } | null>;
|
|
108
|
+
getPreview(flowId: string): Promise<{ flow: unknown; appearance: unknown; embed: unknown } | null>;
|
|
109
|
+
/** Empty snapshot is valid: `FlowModel.create({}, { env })` after configure() */
|
|
110
|
+
create(snapshot?: object, options?: { env?: object }): unknown;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export const LeadModel: {
|
|
114
|
+
getRaw(leadId: string): Promise<{ status: string; data?: unknown; message?: string }>;
|
|
115
|
+
get(leadId: string): Promise<unknown>;
|
|
116
|
+
getByEmail(email: string, companyKey: string): Promise<unknown>;
|
|
117
|
+
getByCompany(
|
|
118
|
+
companyKey: string,
|
|
119
|
+
opts?: {
|
|
120
|
+
skip?: number;
|
|
121
|
+
take?: number;
|
|
122
|
+
sort?: string;
|
|
123
|
+
sort_column?: string;
|
|
124
|
+
sort_dir?: 'asc' | 'desc';
|
|
125
|
+
page?: number;
|
|
126
|
+
page_size?: number;
|
|
127
|
+
}
|
|
128
|
+
): Promise<unknown[] | null>;
|
|
129
|
+
/** Empty snapshot is valid: `LeadModel.create({}, { env })` after configure() */
|
|
130
|
+
create(snapshot?: object, options?: { env?: object }): unknown;
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export const RootStore: unknown;
|
|
134
|
+
export function createRootStore(initialState?: object): unknown;
|
|
135
|
+
|
|
136
|
+
export const Unit: Record<string, number>;
|
|
137
|
+
export const AssignmentMethod: Record<string, number>;
|
|
138
|
+
export const AttendeeStatus: Record<string, number>;
|
|
139
|
+
export const RecurringFrequency: Record<string, number>;
|
|
140
|
+
export const DayOfWeek: Record<string, number>;
|
package/dist/index.js
CHANGED
|
@@ -1826,6 +1826,11 @@ LeadModel.getByCompany = async (companyKey, opts = {}) => {
|
|
|
1826
1826
|
const query = { company_key: companyKey };
|
|
1827
1827
|
if (opts.skip != null) query.skip = opts.skip;
|
|
1828
1828
|
if (opts.take != null) query.take = opts.take;
|
|
1829
|
+
const sortCol = opts.sort ?? opts.sort_column;
|
|
1830
|
+
if (sortCol != null && sortCol !== "") query.sort = sortCol;
|
|
1831
|
+
if (opts.sort_dir != null) query.sort_dir = opts.sort_dir;
|
|
1832
|
+
if (opts.page != null) query.page = opts.page;
|
|
1833
|
+
if (opts.page_size != null) query.page_size = opts.page_size;
|
|
1829
1834
|
const res = await reqGet("/lead/company/get", query);
|
|
1830
1835
|
if (res.status === "success" && Array.isArray(res.data)) {
|
|
1831
1836
|
return res.data.map((l) => LeadModel.create(mapLeadFromApi(l), { env: getConfig() }));
|
package/dist/index.mjs
CHANGED
|
@@ -1773,6 +1773,11 @@ LeadModel.getByCompany = async (companyKey, opts = {}) => {
|
|
|
1773
1773
|
const query = { company_key: companyKey };
|
|
1774
1774
|
if (opts.skip != null) query.skip = opts.skip;
|
|
1775
1775
|
if (opts.take != null) query.take = opts.take;
|
|
1776
|
+
const sortCol = opts.sort ?? opts.sort_column;
|
|
1777
|
+
if (sortCol != null && sortCol !== "") query.sort = sortCol;
|
|
1778
|
+
if (opts.sort_dir != null) query.sort_dir = opts.sort_dir;
|
|
1779
|
+
if (opts.page != null) query.page = opts.page;
|
|
1780
|
+
if (opts.page_size != null) query.page_size = opts.page_size;
|
|
1776
1781
|
const res = await reqGet("/lead/company/get", query);
|
|
1777
1782
|
if (res.status === "success" && Array.isArray(res.data)) {
|
|
1778
1783
|
return res.data.map((l) => LeadModel.create(mapLeadFromApi(l), { env: getConfig() }));
|