@blazeo.com/calendar-client 1.0.6 → 1.0.8
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/dist/index.d.ts +146 -140
- package/dist/index.js +21 -10
- package/dist/index.mjs +21 -10
- package/package.json +42 -42
package/dist/index.d.ts
CHANGED
|
@@ -1,140 +1,146 @@
|
|
|
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
|
|
123
|
-
|
|
124
|
-
sort_dir
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
export const
|
|
140
|
-
export
|
|
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
|
+
/** Maps to API query `sort`. */
|
|
123
|
+
sortBy?: string;
|
|
124
|
+
/** Maps to API query `sort_dir` (`asc` / `desc`). */
|
|
125
|
+
sortOrder?: 'ASC' | 'DESC' | 'asc' | 'desc' | string;
|
|
126
|
+
/** Same as `sortBy` (sent as `sort` on the wire). */
|
|
127
|
+
sort?: string;
|
|
128
|
+
sort_column?: string;
|
|
129
|
+
/** Same as `sortOrder` (sent as `sort_dir` on the wire). */
|
|
130
|
+
sort_dir?: 'asc' | 'desc' | string;
|
|
131
|
+
page?: number;
|
|
132
|
+
page_size?: number;
|
|
133
|
+
}
|
|
134
|
+
): Promise<unknown[] | null>;
|
|
135
|
+
/** Empty snapshot is valid: `LeadModel.create({}, { env })` after configure() */
|
|
136
|
+
create(snapshot?: object, options?: { env?: object }): unknown;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export const RootStore: unknown;
|
|
140
|
+
export function createRootStore(initialState?: object): unknown;
|
|
141
|
+
|
|
142
|
+
export const Unit: Record<string, number>;
|
|
143
|
+
export const AssignmentMethod: Record<string, number>;
|
|
144
|
+
export const AttendeeStatus: Record<string, number>;
|
|
145
|
+
export const RecurringFrequency: Record<string, number>;
|
|
146
|
+
export const DayOfWeek: Record<string, number>;
|
package/dist/index.js
CHANGED
|
@@ -719,7 +719,7 @@ var CalendarModel = import_mobx_state_tree7.types.model("Calendar", {
|
|
|
719
719
|
};
|
|
720
720
|
const res = await reqPost("/Calendar/Create", payload);
|
|
721
721
|
if (res.status === "success" && res.data) {
|
|
722
|
-
|
|
722
|
+
self, { ...res.data, calendarId: res.data.calendarId || self.calendarId };
|
|
723
723
|
}
|
|
724
724
|
return res;
|
|
725
725
|
},
|
|
@@ -1822,18 +1822,29 @@ LeadModel.getByEmail = async (email, companyKey) => {
|
|
|
1822
1822
|
return null;
|
|
1823
1823
|
};
|
|
1824
1824
|
LeadModel.getByCompany = async (companyKey, opts = {}) => {
|
|
1825
|
+
var _a, _b;
|
|
1825
1826
|
const { reqGet } = createRequestHelpersFromEnv(getConfig());
|
|
1826
1827
|
const query = { company_key: companyKey };
|
|
1827
|
-
|
|
1828
|
-
if (
|
|
1829
|
-
const
|
|
1830
|
-
if (
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1828
|
+
const sortBy = opts.sortBy ?? opts.sort ?? opts.sort_column;
|
|
1829
|
+
if (sortBy != null && sortBy !== "") query.sort = sortBy;
|
|
1830
|
+
const sortOrderRaw = opts.sortOrder ?? opts.sort_dir;
|
|
1831
|
+
if (sortOrderRaw != null && String(sortOrderRaw).trim() !== "") {
|
|
1832
|
+
const u = String(sortOrderRaw).trim().toUpperCase();
|
|
1833
|
+
query.sort_dir = u.startsWith("DESC") ? "desc" : "asc";
|
|
1834
|
+
}
|
|
1835
|
+
if (opts.page != null) {
|
|
1836
|
+
query.page = opts.page;
|
|
1837
|
+
if (opts.page_size != null) query.page_size = opts.page_size;
|
|
1838
|
+
} else {
|
|
1839
|
+
if (opts.skip != null) query.skip = opts.skip;
|
|
1840
|
+
if (opts.take != null) query.take = opts.take;
|
|
1841
|
+
}
|
|
1834
1842
|
const res = await reqGet("/lead/company/get", query);
|
|
1835
|
-
if (res.status === "success"
|
|
1836
|
-
|
|
1843
|
+
if (res.status === "success") {
|
|
1844
|
+
const leads = Array.isArray(res.data) ? res.data : Array.isArray((_a = res.data) == null ? void 0 : _a.Leads) ? res.data.Leads : Array.isArray((_b = res.data) == null ? void 0 : _b.leads) ? res.data.leads : null;
|
|
1845
|
+
if (leads) {
|
|
1846
|
+
return leads.map((l) => LeadModel.create(mapLeadFromApi(l), { env: getConfig() }));
|
|
1847
|
+
}
|
|
1837
1848
|
}
|
|
1838
1849
|
return null;
|
|
1839
1850
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -666,7 +666,7 @@ var CalendarModel = types7.model("Calendar", {
|
|
|
666
666
|
};
|
|
667
667
|
const res = await reqPost("/Calendar/Create", payload);
|
|
668
668
|
if (res.status === "success" && res.data) {
|
|
669
|
-
|
|
669
|
+
self, { ...res.data, calendarId: res.data.calendarId || self.calendarId };
|
|
670
670
|
}
|
|
671
671
|
return res;
|
|
672
672
|
},
|
|
@@ -1769,18 +1769,29 @@ LeadModel.getByEmail = async (email, companyKey) => {
|
|
|
1769
1769
|
return null;
|
|
1770
1770
|
};
|
|
1771
1771
|
LeadModel.getByCompany = async (companyKey, opts = {}) => {
|
|
1772
|
+
var _a, _b;
|
|
1772
1773
|
const { reqGet } = createRequestHelpersFromEnv(getConfig());
|
|
1773
1774
|
const query = { company_key: companyKey };
|
|
1774
|
-
|
|
1775
|
-
if (
|
|
1776
|
-
const
|
|
1777
|
-
if (
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1775
|
+
const sortBy = opts.sortBy ?? opts.sort ?? opts.sort_column;
|
|
1776
|
+
if (sortBy != null && sortBy !== "") query.sort = sortBy;
|
|
1777
|
+
const sortOrderRaw = opts.sortOrder ?? opts.sort_dir;
|
|
1778
|
+
if (sortOrderRaw != null && String(sortOrderRaw).trim() !== "") {
|
|
1779
|
+
const u = String(sortOrderRaw).trim().toUpperCase();
|
|
1780
|
+
query.sort_dir = u.startsWith("DESC") ? "desc" : "asc";
|
|
1781
|
+
}
|
|
1782
|
+
if (opts.page != null) {
|
|
1783
|
+
query.page = opts.page;
|
|
1784
|
+
if (opts.page_size != null) query.page_size = opts.page_size;
|
|
1785
|
+
} else {
|
|
1786
|
+
if (opts.skip != null) query.skip = opts.skip;
|
|
1787
|
+
if (opts.take != null) query.take = opts.take;
|
|
1788
|
+
}
|
|
1781
1789
|
const res = await reqGet("/lead/company/get", query);
|
|
1782
|
-
if (res.status === "success"
|
|
1783
|
-
|
|
1790
|
+
if (res.status === "success") {
|
|
1791
|
+
const leads = Array.isArray(res.data) ? res.data : Array.isArray((_a = res.data) == null ? void 0 : _a.Leads) ? res.data.Leads : Array.isArray((_b = res.data) == null ? void 0 : _b.leads) ? res.data.leads : null;
|
|
1792
|
+
if (leads) {
|
|
1793
|
+
return leads.map((l) => LeadModel.create(mapLeadFromApi(l), { env: getConfig() }));
|
|
1794
|
+
}
|
|
1784
1795
|
}
|
|
1785
1796
|
return null;
|
|
1786
1797
|
};
|
package/package.json
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@blazeo.com/calendar-client",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Blazeo Calendar / Appointment API client with MobX State Tree models",
|
|
5
|
-
"exports": {
|
|
6
|
-
".": {
|
|
7
|
-
"types": "./dist/index.d.ts",
|
|
8
|
-
"import": "./dist/index.mjs",
|
|
9
|
-
"require": "./dist/index.js"
|
|
10
|
-
}
|
|
11
|
-
},
|
|
12
|
-
"files": ["dist", "README.md"],
|
|
13
|
-
"scripts": {
|
|
14
|
-
"build": "tsup src/models/appointment/index.js --format cjs,esm --clean && node -e \"require('fs').copyFileSync('src/index.d.ts','dist/index.d.ts')\"",
|
|
15
|
-
"prepublishOnly": "npm run build"
|
|
16
|
-
},
|
|
17
|
-
"keywords": ["blazeo", "calendar", "appointment", "booking", "mobx", "mobx-state-tree"],
|
|
18
|
-
"author": "Blazeo",
|
|
19
|
-
"license": "UNLICENSED",
|
|
20
|
-
"repository": {
|
|
21
|
-
"type": "git",
|
|
22
|
-
"url": "https://github.com/blazeo-com/calendar-client.git"
|
|
23
|
-
},
|
|
24
|
-
"bugs": {
|
|
25
|
-
"url": "https://github.com/blazeo-com/calendar-client/issues"
|
|
26
|
-
},
|
|
27
|
-
"homepage": "https://github.com/blazeo-com/calendar-client#readme",
|
|
28
|
-
"publishConfig": {
|
|
29
|
-
"access": "restricted"
|
|
30
|
-
},
|
|
31
|
-
"dependencies": {
|
|
32
|
-
"mobx": "^6.10.0",
|
|
33
|
-
"mobx-state-tree": "^5.4.0"
|
|
34
|
-
},
|
|
35
|
-
"devDependencies": {
|
|
36
|
-
"tsup": "^8.0.1"
|
|
37
|
-
},
|
|
38
|
-
"peerDependencies": {},
|
|
39
|
-
"engines": {
|
|
40
|
-
"node": ">=18"
|
|
41
|
-
}
|
|
42
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@blazeo.com/calendar-client",
|
|
3
|
+
"version": "1.0.8",
|
|
4
|
+
"description": "Blazeo Calendar / Appointment API client with MobX State Tree models",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": {
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"import": "./dist/index.mjs",
|
|
9
|
+
"require": "./dist/index.js"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"files": ["dist", "README.md"],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsup src/models/appointment/index.js --format cjs,esm --clean && node -e \"require('fs').copyFileSync('src/index.d.ts','dist/index.d.ts')\"",
|
|
15
|
+
"prepublishOnly": "npm run build"
|
|
16
|
+
},
|
|
17
|
+
"keywords": ["blazeo", "calendar", "appointment", "booking", "mobx", "mobx-state-tree"],
|
|
18
|
+
"author": "Blazeo",
|
|
19
|
+
"license": "UNLICENSED",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "https://github.com/blazeo-com/calendar-client.git"
|
|
23
|
+
},
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/blazeo-com/calendar-client/issues"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://github.com/blazeo-com/calendar-client#readme",
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "restricted"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"mobx": "^6.10.0",
|
|
33
|
+
"mobx-state-tree": "^5.4.0"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"tsup": "^8.0.1"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {},
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=18"
|
|
41
|
+
}
|
|
42
|
+
}
|