@blazeo.com/calendar-client 1.0.21 → 1.0.23
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 +272 -236
- package/dist/index.js +196 -69
- package/dist/index.mjs +194 -69
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -25,6 +25,7 @@ __export(index_exports, {
|
|
|
25
25
|
AvailabilityDetailModel: () => AvailabilityDetail_default,
|
|
26
26
|
AvailabilityModel: () => Availability_default,
|
|
27
27
|
CalendarDayModel: () => CalendarDay_default,
|
|
28
|
+
CalendarLocationModel: () => CalendarLocation_default,
|
|
28
29
|
CalendarModel: () => Calendar_default,
|
|
29
30
|
CalendarParticipantModel: () => CalendarParticipant_default,
|
|
30
31
|
CompanyModel: () => Company_default,
|
|
@@ -34,6 +35,7 @@ __export(index_exports, {
|
|
|
34
35
|
EventModel: () => Event_default,
|
|
35
36
|
FlowModel: () => Flow_default,
|
|
36
37
|
LeadModel: () => Lead_default,
|
|
38
|
+
LocationType: () => LocationType,
|
|
37
39
|
OpeningHourModel: () => OpeningHour_default,
|
|
38
40
|
ParticipantInfoModel: () => ParticipantInfo_default,
|
|
39
41
|
ParticipantModel: () => Participant_default,
|
|
@@ -152,8 +154,8 @@ function mergeConsumerHeader(env, opts) {
|
|
|
152
154
|
if (!headers["Consumer"] && (env == null ? void 0 : env.consumer)) headers["Consumer"] = env.consumer;
|
|
153
155
|
return { ...opts, headers };
|
|
154
156
|
}
|
|
155
|
-
function createRequestHelpers(self,
|
|
156
|
-
const env = () =>
|
|
157
|
+
function createRequestHelpers(self, getEnv12) {
|
|
158
|
+
const env = () => getEnv12(self);
|
|
157
159
|
const baseUrl = () => env().baseUrl;
|
|
158
160
|
const fetchFn = () => env().fetch ?? (typeof fetch !== "undefined" ? fetch : () => {
|
|
159
161
|
throw new Error("fetch not available");
|
|
@@ -226,6 +228,12 @@ var DayOfWeek = {
|
|
|
226
228
|
Friday: 5,
|
|
227
229
|
Saturday: 6
|
|
228
230
|
};
|
|
231
|
+
var LocationType = {
|
|
232
|
+
Physical: 0,
|
|
233
|
+
Video: 1,
|
|
234
|
+
Phone: 2,
|
|
235
|
+
Custom: 3
|
|
236
|
+
};
|
|
229
237
|
|
|
230
238
|
// src/models/appointment/Event.js
|
|
231
239
|
var import_mobx_state_tree4 = require("mobx-state-tree");
|
|
@@ -337,7 +345,8 @@ var EventModel = import_mobx_state_tree4.types.model("Event", {
|
|
|
337
345
|
createdOn: import_mobx_state_tree4.types.optional(import_mobx_state_tree4.types.maybeNull(import_mobx_state_tree4.types.string), null),
|
|
338
346
|
modifiedOn: import_mobx_state_tree4.types.optional(import_mobx_state_tree4.types.maybeNull(import_mobx_state_tree4.types.string), null),
|
|
339
347
|
externalEventId: import_mobx_state_tree4.types.optional(import_mobx_state_tree4.types.maybeNull(import_mobx_state_tree4.types.string), null),
|
|
340
|
-
|
|
348
|
+
calendarLocationId: import_mobx_state_tree4.types.optional(import_mobx_state_tree4.types.maybeNull(import_mobx_state_tree4.types.string), null),
|
|
349
|
+
customLocation: import_mobx_state_tree4.types.optional(import_mobx_state_tree4.types.maybeNull(import_mobx_state_tree4.types.string), null),
|
|
341
350
|
flowId: import_mobx_state_tree4.types.optional(import_mobx_state_tree4.types.maybeNull(import_mobx_state_tree4.types.string), null),
|
|
342
351
|
flowPath: import_mobx_state_tree4.types.optional(import_mobx_state_tree4.types.maybeNull(import_mobx_state_tree4.types.string), null),
|
|
343
352
|
attendeeStatus: import_mobx_state_tree4.types.optional(import_mobx_state_tree4.types.number, AttendeeStatus.Tentative),
|
|
@@ -384,7 +393,8 @@ var EventModel = import_mobx_state_tree4.types.model("Event", {
|
|
|
384
393
|
visitorName: self.visitorName ?? void 0,
|
|
385
394
|
visitorEmail: self.visitorEmail ?? void 0,
|
|
386
395
|
visitorPhone: self.visitorPhone ?? void 0,
|
|
387
|
-
|
|
396
|
+
calendarLocationId: self.calendarLocationId ?? void 0,
|
|
397
|
+
customLocation: self.customLocation ?? void 0,
|
|
388
398
|
flowId: self.flowId ?? void 0,
|
|
389
399
|
flowPath: self.flowPath ?? void 0
|
|
390
400
|
};
|
|
@@ -409,7 +419,8 @@ var EventModel = import_mobx_state_tree4.types.model("Event", {
|
|
|
409
419
|
visitorName: self.visitorName ?? void 0,
|
|
410
420
|
visitorEmail: self.visitorEmail ?? void 0,
|
|
411
421
|
visitorPhone: self.visitorPhone ?? void 0,
|
|
412
|
-
|
|
422
|
+
calendarLocationId: self.calendarLocationId ?? void 0,
|
|
423
|
+
customLocation: self.customLocation ?? void 0,
|
|
413
424
|
flowId: self.flowId ?? void 0,
|
|
414
425
|
flowPath: self.flowPath ?? void 0
|
|
415
426
|
};
|
|
@@ -433,7 +444,8 @@ var EventModel = import_mobx_state_tree4.types.model("Event", {
|
|
|
433
444
|
visitorName: self.visitorName ?? void 0,
|
|
434
445
|
visitorEmail: self.visitorEmail ?? void 0,
|
|
435
446
|
visitorPhone: self.visitorPhone ?? void 0,
|
|
436
|
-
|
|
447
|
+
calendarLocationId: self.calendarLocationId ?? void 0,
|
|
448
|
+
customLocation: self.customLocation ?? void 0,
|
|
437
449
|
flowId: self.flowId ?? void 0,
|
|
438
450
|
flowPath: self.flowPath ?? void 0
|
|
439
451
|
};
|
|
@@ -493,7 +505,8 @@ function mapEventFromApi(d) {
|
|
|
493
505
|
visitorEmail: pick("visitorEmail", "VisitorEmail", "visitor_email"),
|
|
494
506
|
visitorPhone: pick("visitorPhone", "VisitorPhone", "visitor_phone"),
|
|
495
507
|
externalEventId: pick("externalEventId", "ExternalEventId", "external_event_id"),
|
|
496
|
-
|
|
508
|
+
calendarLocationId: pick("calendarLocationId", "CalendarLocationId", "calendar_location_id"),
|
|
509
|
+
customLocation: pick("customLocation", "CustomLocation", "custom_location"),
|
|
497
510
|
flowId: pick("flowId", "FlowId", "flow_id"),
|
|
498
511
|
flowPath: pick("flowPath", "FlowPath", "flow_path"),
|
|
499
512
|
attendeeStatus: n(pick("attendeeStatus", "AttendeeStatus", "attendee_status")),
|
|
@@ -1745,8 +1758,116 @@ AssetModel.upload = async (file, opts = {}) => {
|
|
|
1745
1758
|
};
|
|
1746
1759
|
var Asset_default = AssetModel;
|
|
1747
1760
|
|
|
1748
|
-
// src/models/appointment/
|
|
1761
|
+
// src/models/appointment/CalendarLocation.js
|
|
1749
1762
|
var import_mobx_state_tree16 = require("mobx-state-tree");
|
|
1763
|
+
function mapCalendarLocationFromApi(d) {
|
|
1764
|
+
if (!d) return d;
|
|
1765
|
+
const pick = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
|
|
1766
|
+
const n = (v) => v != null && v !== "" ? Number(v) : void 0;
|
|
1767
|
+
const b = (v) => v === true || v === "true" || v === 1 || v === "1";
|
|
1768
|
+
return {
|
|
1769
|
+
id: n(pick("id", "Id")),
|
|
1770
|
+
calendarLocationId: pick("calendarLocationId", "CalendarLocationId", "calendar_location_id") ?? null,
|
|
1771
|
+
calendarId: pick("calendarId", "CalendarId", "calendar_id") ?? null,
|
|
1772
|
+
locationType: n(pick("locationType", "LocationType", "location_type")),
|
|
1773
|
+
name: pick("name", "Name") ?? "",
|
|
1774
|
+
value: pick("value", "Value") ?? "",
|
|
1775
|
+
isDefault: b(pick("isDefault", "IsDefault", "is_default")),
|
|
1776
|
+
sortOrder: n(pick("sortOrder", "SortOrder", "sort_order")) ?? 0,
|
|
1777
|
+
createdOn: pick("createdOn", "CreatedOn", "created_on") ?? null,
|
|
1778
|
+
modifiedOn: pick("modifiedOn", "ModifiedOn", "modified_on") ?? null
|
|
1779
|
+
};
|
|
1780
|
+
}
|
|
1781
|
+
function toPayload4(self) {
|
|
1782
|
+
return {
|
|
1783
|
+
calendarLocationId: self.calendarLocationId ?? void 0,
|
|
1784
|
+
calendarId: self.calendarId ?? void 0,
|
|
1785
|
+
locationType: self.locationType,
|
|
1786
|
+
name: self.name ?? "",
|
|
1787
|
+
value: self.value ?? "",
|
|
1788
|
+
isDefault: self.isDefault,
|
|
1789
|
+
sortOrder: self.sortOrder
|
|
1790
|
+
};
|
|
1791
|
+
}
|
|
1792
|
+
var CalendarLocationModel = import_mobx_state_tree16.types.model("CalendarLocation", {
|
|
1793
|
+
id: import_mobx_state_tree16.types.optional(import_mobx_state_tree16.types.maybeNull(import_mobx_state_tree16.types.number), null),
|
|
1794
|
+
calendarLocationId: import_mobx_state_tree16.types.optional(import_mobx_state_tree16.types.maybeNull(import_mobx_state_tree16.types.string), null),
|
|
1795
|
+
calendarId: import_mobx_state_tree16.types.optional(import_mobx_state_tree16.types.maybeNull(import_mobx_state_tree16.types.string), null),
|
|
1796
|
+
locationType: import_mobx_state_tree16.types.optional(import_mobx_state_tree16.types.number, LocationType.Physical),
|
|
1797
|
+
name: import_mobx_state_tree16.types.optional(import_mobx_state_tree16.types.string, ""),
|
|
1798
|
+
value: import_mobx_state_tree16.types.optional(import_mobx_state_tree16.types.string, ""),
|
|
1799
|
+
isDefault: import_mobx_state_tree16.types.optional(import_mobx_state_tree16.types.boolean, false),
|
|
1800
|
+
sortOrder: import_mobx_state_tree16.types.optional(import_mobx_state_tree16.types.number, 0),
|
|
1801
|
+
createdOn: import_mobx_state_tree16.types.optional(import_mobx_state_tree16.types.maybeNull(import_mobx_state_tree16.types.string), null),
|
|
1802
|
+
modifiedOn: import_mobx_state_tree16.types.optional(import_mobx_state_tree16.types.maybeNull(import_mobx_state_tree16.types.string), null)
|
|
1803
|
+
}).actions((self) => {
|
|
1804
|
+
const { reqGet, reqPost } = createRequestHelpers(self, import_mobx_state_tree16.getEnv);
|
|
1805
|
+
return {
|
|
1806
|
+
/** GET Calendar/Location/Get – list locations by calendar id */
|
|
1807
|
+
async getByCalendar(calendarId) {
|
|
1808
|
+
const resolvedCalendarId = calendarId ?? self.calendarId;
|
|
1809
|
+
if (!resolvedCalendarId) return { status: "failure", message: "calendarId required" };
|
|
1810
|
+
return reqGet("/Calendar/Location/Get", { calendar_id: resolvedCalendarId });
|
|
1811
|
+
},
|
|
1812
|
+
/** POST Calendar/Location/Save – create or update location */
|
|
1813
|
+
async save() {
|
|
1814
|
+
const res = await reqPost("/Calendar/Location/Save", toPayload4(self));
|
|
1815
|
+
if (res.status === "success" && res.data) {
|
|
1816
|
+
(0, import_mobx_state_tree16.applySnapshot)(self, mapCalendarLocationFromApi(res.data));
|
|
1817
|
+
}
|
|
1818
|
+
return res;
|
|
1819
|
+
},
|
|
1820
|
+
/** GET Calendar/Location/Remove – remove location by id */
|
|
1821
|
+
async remove(calendarLocationId) {
|
|
1822
|
+
const resolvedCalendarLocationId = calendarLocationId ?? self.calendarLocationId;
|
|
1823
|
+
if (!resolvedCalendarLocationId) return { status: "failure", message: "calendarLocationId required" };
|
|
1824
|
+
return reqGet("/Calendar/Location/Remove", { calendar_location_id: resolvedCalendarLocationId });
|
|
1825
|
+
},
|
|
1826
|
+
/** POST Calendar/Location/SetDefault – set this location as default for calendar */
|
|
1827
|
+
async setDefault(calendarId, calendarLocationId) {
|
|
1828
|
+
const resolvedCalendarId = calendarId ?? self.calendarId;
|
|
1829
|
+
const resolvedCalendarLocationId = calendarLocationId ?? self.calendarLocationId;
|
|
1830
|
+
if (!resolvedCalendarId || !resolvedCalendarLocationId) {
|
|
1831
|
+
return { status: "failure", message: "calendarId and calendarLocationId required" };
|
|
1832
|
+
}
|
|
1833
|
+
return reqPost("/Calendar/Location/SetDefault", {
|
|
1834
|
+
calendar_id: resolvedCalendarId,
|
|
1835
|
+
calendar_location_id: resolvedCalendarLocationId
|
|
1836
|
+
});
|
|
1837
|
+
}
|
|
1838
|
+
};
|
|
1839
|
+
});
|
|
1840
|
+
CalendarLocationModel.getByCalendar = async (calendarId) => {
|
|
1841
|
+
const { reqGet } = createRequestHelpersFromEnv(getConfig());
|
|
1842
|
+
const res = await reqGet("/Calendar/Location/Get", { calendar_id: calendarId });
|
|
1843
|
+
if (res.status === "success" && Array.isArray(res.data)) {
|
|
1844
|
+
return res.data.map((row) => CalendarLocationModel.create(mapCalendarLocationFromApi(row), { env: getConfig() }));
|
|
1845
|
+
}
|
|
1846
|
+
return null;
|
|
1847
|
+
};
|
|
1848
|
+
CalendarLocationModel.save = async (payload) => {
|
|
1849
|
+
const { reqPost } = createRequestHelpersFromEnv(getConfig());
|
|
1850
|
+
const res = await reqPost("/Calendar/Location/Save", payload);
|
|
1851
|
+
if (res.status === "success" && res.data) {
|
|
1852
|
+
return CalendarLocationModel.create(mapCalendarLocationFromApi(res.data), { env: getConfig() });
|
|
1853
|
+
}
|
|
1854
|
+
return null;
|
|
1855
|
+
};
|
|
1856
|
+
CalendarLocationModel.remove = async (calendarLocationId) => {
|
|
1857
|
+
const { reqGet } = createRequestHelpersFromEnv(getConfig());
|
|
1858
|
+
return reqGet("/Calendar/Location/Remove", { calendar_location_id: calendarLocationId });
|
|
1859
|
+
};
|
|
1860
|
+
CalendarLocationModel.setDefault = async (calendarId, calendarLocationId) => {
|
|
1861
|
+
const { reqPost } = createRequestHelpersFromEnv(getConfig());
|
|
1862
|
+
return reqPost("/Calendar/Location/SetDefault", {
|
|
1863
|
+
calendar_id: calendarId,
|
|
1864
|
+
calendar_location_id: calendarLocationId
|
|
1865
|
+
});
|
|
1866
|
+
};
|
|
1867
|
+
var CalendarLocation_default = CalendarLocationModel;
|
|
1868
|
+
|
|
1869
|
+
// src/models/appointment/Preference.js
|
|
1870
|
+
var import_mobx_state_tree17 = require("mobx-state-tree");
|
|
1750
1871
|
var PreferenceScope = {
|
|
1751
1872
|
Global: 0,
|
|
1752
1873
|
Consumer: 1,
|
|
@@ -1755,13 +1876,13 @@ var PreferenceScope = {
|
|
|
1755
1876
|
Event: 4
|
|
1756
1877
|
};
|
|
1757
1878
|
var SCOPE_NAMES = ["Global", "Consumer", "Company", "Calendar", "Event"];
|
|
1758
|
-
var PreferenceModel =
|
|
1759
|
-
id:
|
|
1760
|
-
preferenceId:
|
|
1761
|
-
level:
|
|
1762
|
-
primaryKey:
|
|
1763
|
-
preferenceOption:
|
|
1764
|
-
optionsJson:
|
|
1879
|
+
var PreferenceModel = import_mobx_state_tree17.types.model("Preference", {
|
|
1880
|
+
id: import_mobx_state_tree17.types.optional(import_mobx_state_tree17.types.maybeNull(import_mobx_state_tree17.types.number), null),
|
|
1881
|
+
preferenceId: import_mobx_state_tree17.types.optional(import_mobx_state_tree17.types.maybeNull(import_mobx_state_tree17.types.string), null),
|
|
1882
|
+
level: import_mobx_state_tree17.types.optional(import_mobx_state_tree17.types.number, 0),
|
|
1883
|
+
primaryKey: import_mobx_state_tree17.types.optional(import_mobx_state_tree17.types.string, ""),
|
|
1884
|
+
preferenceOption: import_mobx_state_tree17.types.optional(import_mobx_state_tree17.types.string, ""),
|
|
1885
|
+
optionsJson: import_mobx_state_tree17.types.optional(import_mobx_state_tree17.types.maybeNull(import_mobx_state_tree17.types.string), null)
|
|
1765
1886
|
}).actions((self) => ({
|
|
1766
1887
|
/** POST /preference/{scope}/{key}/{option} – save this preference to the API. */
|
|
1767
1888
|
async save() {
|
|
@@ -1809,7 +1930,7 @@ PreferenceModel.delete = async (preferenceId) => {
|
|
|
1809
1930
|
var Preference_default = PreferenceModel;
|
|
1810
1931
|
|
|
1811
1932
|
// src/models/appointment/Flow.js
|
|
1812
|
-
var
|
|
1933
|
+
var import_mobx_state_tree18 = require("mobx-state-tree");
|
|
1813
1934
|
function mapFlowFromApi(d) {
|
|
1814
1935
|
if (!d) return d;
|
|
1815
1936
|
const pick = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
|
|
@@ -1818,6 +1939,7 @@ function mapFlowFromApi(d) {
|
|
|
1818
1939
|
id: pick("id", "Id") ?? null,
|
|
1819
1940
|
flowId: pick("flowId", "FlowId", "flow_id") ?? "",
|
|
1820
1941
|
companyKey: pick("companyKey", "CompanyKey", "company_key") ?? "",
|
|
1942
|
+
calendarId: pick("calendarId", "CalendarId", "calendar_id") ?? null,
|
|
1821
1943
|
name: pick("name", "Name") ?? "",
|
|
1822
1944
|
description: pick("description", "Description") ?? null,
|
|
1823
1945
|
flowJson: pick("flowJson", "FlowJson", "flow_json") ?? "",
|
|
@@ -1827,26 +1949,27 @@ function mapFlowFromApi(d) {
|
|
|
1827
1949
|
modifiedOn: pick("modifiedOn", "ModifiedOn", "modified_on") ?? null
|
|
1828
1950
|
};
|
|
1829
1951
|
}
|
|
1830
|
-
var FlowModel =
|
|
1831
|
-
id:
|
|
1832
|
-
flowId:
|
|
1833
|
-
companyKey:
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1952
|
+
var FlowModel = import_mobx_state_tree18.types.model("Flow", {
|
|
1953
|
+
id: import_mobx_state_tree18.types.optional(import_mobx_state_tree18.types.maybeNull(import_mobx_state_tree18.types.number), null),
|
|
1954
|
+
flowId: import_mobx_state_tree18.types.optional(import_mobx_state_tree18.types.identifier, "new"),
|
|
1955
|
+
companyKey: import_mobx_state_tree18.types.optional(import_mobx_state_tree18.types.maybeNull(import_mobx_state_tree18.types.string), null),
|
|
1956
|
+
calendarId: import_mobx_state_tree18.types.optional(import_mobx_state_tree18.types.maybeNull(import_mobx_state_tree18.types.string), null),
|
|
1957
|
+
name: import_mobx_state_tree18.types.optional(import_mobx_state_tree18.types.maybeNull(import_mobx_state_tree18.types.string), null),
|
|
1958
|
+
description: import_mobx_state_tree18.types.optional(import_mobx_state_tree18.types.maybeNull(import_mobx_state_tree18.types.string), null),
|
|
1959
|
+
flowJson: import_mobx_state_tree18.types.optional(import_mobx_state_tree18.types.string, ""),
|
|
1960
|
+
isActive: import_mobx_state_tree18.types.optional(import_mobx_state_tree18.types.boolean, true),
|
|
1961
|
+
isDeleted: import_mobx_state_tree18.types.optional(import_mobx_state_tree18.types.boolean, false),
|
|
1962
|
+
createdOn: import_mobx_state_tree18.types.optional(import_mobx_state_tree18.types.maybeNull(import_mobx_state_tree18.types.string), null),
|
|
1963
|
+
modifiedOn: import_mobx_state_tree18.types.optional(import_mobx_state_tree18.types.maybeNull(import_mobx_state_tree18.types.string), null)
|
|
1841
1964
|
}).actions((self) => {
|
|
1842
|
-
const { reqGet, reqPost } = createRequestHelpers(self,
|
|
1965
|
+
const { reqGet, reqPost } = createRequestHelpers(self, import_mobx_state_tree18.getEnv);
|
|
1843
1966
|
return {
|
|
1844
1967
|
/** GET flow/get – fetch this flow by flowId */
|
|
1845
1968
|
async get() {
|
|
1846
1969
|
if (!self.flowId || self.flowId === "new") return { status: "failure", message: "flowId required" };
|
|
1847
1970
|
const res = await reqGet("/flow/get", { flow_id: self.flowId });
|
|
1848
1971
|
if (res.status === "success" && res.data) {
|
|
1849
|
-
(0,
|
|
1972
|
+
(0, import_mobx_state_tree18.applySnapshot)(self, mapFlowFromApi(res.data));
|
|
1850
1973
|
}
|
|
1851
1974
|
return res;
|
|
1852
1975
|
},
|
|
@@ -1854,6 +1977,7 @@ var FlowModel = import_mobx_state_tree17.types.model("Flow", {
|
|
|
1854
1977
|
async create() {
|
|
1855
1978
|
const payload = {
|
|
1856
1979
|
companyKey: self.companyKey ?? void 0,
|
|
1980
|
+
calendarId: self.calendarId ?? void 0,
|
|
1857
1981
|
name: self.name ?? void 0,
|
|
1858
1982
|
description: self.description ?? void 0,
|
|
1859
1983
|
flowJson: self.flowJson || void 0,
|
|
@@ -1861,7 +1985,7 @@ var FlowModel = import_mobx_state_tree17.types.model("Flow", {
|
|
|
1861
1985
|
};
|
|
1862
1986
|
const res = await reqPost("/flow/create", payload);
|
|
1863
1987
|
if (res.status === "success" && res.data) {
|
|
1864
|
-
(0,
|
|
1988
|
+
(0, import_mobx_state_tree18.applySnapshot)(self, mapFlowFromApi(res.data));
|
|
1865
1989
|
}
|
|
1866
1990
|
return res;
|
|
1867
1991
|
},
|
|
@@ -1870,6 +1994,7 @@ var FlowModel = import_mobx_state_tree17.types.model("Flow", {
|
|
|
1870
1994
|
if (!self.flowId || self.flowId === "new") return { status: "failure", message: "flowId required" };
|
|
1871
1995
|
const payload = {
|
|
1872
1996
|
flowId: self.flowId,
|
|
1997
|
+
calendarId: self.calendarId ?? void 0,
|
|
1873
1998
|
name: self.name ?? void 0,
|
|
1874
1999
|
description: self.description ?? void 0,
|
|
1875
2000
|
flowJson: self.flowJson || void 0,
|
|
@@ -1877,7 +2002,7 @@ var FlowModel = import_mobx_state_tree17.types.model("Flow", {
|
|
|
1877
2002
|
};
|
|
1878
2003
|
const res = await reqPost("/flow/update", payload);
|
|
1879
2004
|
if (res.status === "success" && res.data) {
|
|
1880
|
-
(0,
|
|
2005
|
+
(0, import_mobx_state_tree18.applySnapshot)(self, mapFlowFromApi(res.data));
|
|
1881
2006
|
}
|
|
1882
2007
|
return res;
|
|
1883
2008
|
},
|
|
@@ -1891,7 +2016,7 @@ var FlowModel = import_mobx_state_tree17.types.model("Flow", {
|
|
|
1891
2016
|
if (!self.flowId || self.flowId === "new") return { status: "failure", message: "flowId required" };
|
|
1892
2017
|
const res = await reqPost("/flow/duplicate", { flow_id: self.flowId, new_name: newName ?? void 0 });
|
|
1893
2018
|
if (res.status === "success" && res.data) {
|
|
1894
|
-
(0,
|
|
2019
|
+
(0, import_mobx_state_tree18.applySnapshot)(self, mapFlowFromApi(res.data));
|
|
1895
2020
|
}
|
|
1896
2021
|
return res;
|
|
1897
2022
|
},
|
|
@@ -2068,7 +2193,7 @@ FlowModel.getPreview = async (flowId) => {
|
|
|
2068
2193
|
var Flow_default = FlowModel;
|
|
2069
2194
|
|
|
2070
2195
|
// src/models/appointment/Lead.js
|
|
2071
|
-
var
|
|
2196
|
+
var import_mobx_state_tree19 = require("mobx-state-tree");
|
|
2072
2197
|
function mapLeadFromApi(d) {
|
|
2073
2198
|
if (!d) return d;
|
|
2074
2199
|
const pick = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
|
|
@@ -2097,27 +2222,27 @@ function mapLeadFromApi(d) {
|
|
|
2097
2222
|
modifiedOn: pick("modifiedOn", "ModifiedOn", "modified_on") ?? null
|
|
2098
2223
|
};
|
|
2099
2224
|
}
|
|
2100
|
-
var LeadModel =
|
|
2101
|
-
id:
|
|
2102
|
-
leadId:
|
|
2103
|
-
email:
|
|
2104
|
-
name:
|
|
2105
|
-
phone:
|
|
2106
|
-
companyKey:
|
|
2107
|
-
source:
|
|
2108
|
-
leadType:
|
|
2109
|
-
referrerLink:
|
|
2110
|
-
createdOn:
|
|
2111
|
-
modifiedOn:
|
|
2225
|
+
var LeadModel = import_mobx_state_tree19.types.model("Lead", {
|
|
2226
|
+
id: import_mobx_state_tree19.types.optional(import_mobx_state_tree19.types.maybeNull(import_mobx_state_tree19.types.number), null),
|
|
2227
|
+
leadId: import_mobx_state_tree19.types.optional(import_mobx_state_tree19.types.identifier, "new"),
|
|
2228
|
+
email: import_mobx_state_tree19.types.optional(import_mobx_state_tree19.types.string, ""),
|
|
2229
|
+
name: import_mobx_state_tree19.types.optional(import_mobx_state_tree19.types.string, ""),
|
|
2230
|
+
phone: import_mobx_state_tree19.types.optional(import_mobx_state_tree19.types.string, ""),
|
|
2231
|
+
companyKey: import_mobx_state_tree19.types.optional(import_mobx_state_tree19.types.string, ""),
|
|
2232
|
+
source: import_mobx_state_tree19.types.optional(import_mobx_state_tree19.types.string, ""),
|
|
2233
|
+
leadType: import_mobx_state_tree19.types.optional(import_mobx_state_tree19.types.number, 2),
|
|
2234
|
+
referrerLink: import_mobx_state_tree19.types.optional(import_mobx_state_tree19.types.string, ""),
|
|
2235
|
+
createdOn: import_mobx_state_tree19.types.optional(import_mobx_state_tree19.types.maybeNull(import_mobx_state_tree19.types.string), null),
|
|
2236
|
+
modifiedOn: import_mobx_state_tree19.types.optional(import_mobx_state_tree19.types.maybeNull(import_mobx_state_tree19.types.string), null)
|
|
2112
2237
|
}).actions((self) => {
|
|
2113
|
-
const { reqGet, reqPost } = createRequestHelpers(self,
|
|
2238
|
+
const { reqGet, reqPost } = createRequestHelpers(self, import_mobx_state_tree19.getEnv);
|
|
2114
2239
|
return {
|
|
2115
2240
|
/** GET /lead/get – fetch this lead by leadId */
|
|
2116
2241
|
async get() {
|
|
2117
2242
|
if (!self.leadId || self.leadId === "new") return { status: "failure", message: "leadId required" };
|
|
2118
2243
|
const res = await reqGet("/lead/get", { lead_id: self.leadId });
|
|
2119
2244
|
if (res.status === "success" && res.data) {
|
|
2120
|
-
(0,
|
|
2245
|
+
(0, import_mobx_state_tree19.applySnapshot)(self, mapLeadFromApi(res.data));
|
|
2121
2246
|
}
|
|
2122
2247
|
return res;
|
|
2123
2248
|
},
|
|
@@ -2128,7 +2253,7 @@ var LeadModel = import_mobx_state_tree18.types.model("Lead", {
|
|
|
2128
2253
|
}
|
|
2129
2254
|
const lead = await LeadModel.getByEmail(self.email, self.companyKey);
|
|
2130
2255
|
if (lead) {
|
|
2131
|
-
(0,
|
|
2256
|
+
(0, import_mobx_state_tree19.applySnapshot)(self, (0, import_mobx_state_tree19.getSnapshot)(lead));
|
|
2132
2257
|
}
|
|
2133
2258
|
return { status: lead ? "success" : "failure", data: lead ?? void 0 };
|
|
2134
2259
|
},
|
|
@@ -2150,7 +2275,7 @@ var LeadModel = import_mobx_state_tree18.types.model("Lead", {
|
|
|
2150
2275
|
};
|
|
2151
2276
|
const res = await reqPost("/lead/create", payload);
|
|
2152
2277
|
if (res.status === "success" && res.data) {
|
|
2153
|
-
(0,
|
|
2278
|
+
(0, import_mobx_state_tree19.applySnapshot)(self, mapLeadFromApi(res.data));
|
|
2154
2279
|
}
|
|
2155
2280
|
return res;
|
|
2156
2281
|
},
|
|
@@ -2171,7 +2296,7 @@ var LeadModel = import_mobx_state_tree18.types.model("Lead", {
|
|
|
2171
2296
|
};
|
|
2172
2297
|
const res = await reqPost("/lead/update", payload);
|
|
2173
2298
|
if (res.status === "success" && res.data) {
|
|
2174
|
-
(0,
|
|
2299
|
+
(0, import_mobx_state_tree19.applySnapshot)(self, mapLeadFromApi(res.data));
|
|
2175
2300
|
}
|
|
2176
2301
|
return res;
|
|
2177
2302
|
},
|
|
@@ -2297,19 +2422,19 @@ LeadModel.getSources = async (companyKey) => {
|
|
|
2297
2422
|
var Lead_default = LeadModel;
|
|
2298
2423
|
|
|
2299
2424
|
// src/models/appointment/CustomField.js
|
|
2300
|
-
var
|
|
2301
|
-
var CustomFieldModel =
|
|
2302
|
-
id:
|
|
2303
|
-
customFieldId:
|
|
2304
|
-
calendarId:
|
|
2305
|
-
label:
|
|
2306
|
-
type:
|
|
2307
|
-
isRequired:
|
|
2308
|
-
createdOn:
|
|
2309
|
-
modifiedOn:
|
|
2310
|
-
isDeleted:
|
|
2425
|
+
var import_mobx_state_tree20 = require("mobx-state-tree");
|
|
2426
|
+
var CustomFieldModel = import_mobx_state_tree20.types.model("CustomField", {
|
|
2427
|
+
id: import_mobx_state_tree20.types.optional(import_mobx_state_tree20.types.maybeNull(import_mobx_state_tree20.types.number), null),
|
|
2428
|
+
customFieldId: import_mobx_state_tree20.types.optional(import_mobx_state_tree20.types.maybeNull(import_mobx_state_tree20.types.string), null),
|
|
2429
|
+
calendarId: import_mobx_state_tree20.types.optional(import_mobx_state_tree20.types.maybeNull(import_mobx_state_tree20.types.string), null),
|
|
2430
|
+
label: import_mobx_state_tree20.types.optional(import_mobx_state_tree20.types.maybeNull(import_mobx_state_tree20.types.string), null),
|
|
2431
|
+
type: import_mobx_state_tree20.types.optional(import_mobx_state_tree20.types.string, ""),
|
|
2432
|
+
isRequired: import_mobx_state_tree20.types.optional(import_mobx_state_tree20.types.boolean, false),
|
|
2433
|
+
createdOn: import_mobx_state_tree20.types.optional(import_mobx_state_tree20.types.maybeNull(import_mobx_state_tree20.types.string), null),
|
|
2434
|
+
modifiedOn: import_mobx_state_tree20.types.optional(import_mobx_state_tree20.types.maybeNull(import_mobx_state_tree20.types.string), null),
|
|
2435
|
+
isDeleted: import_mobx_state_tree20.types.optional(import_mobx_state_tree20.types.boolean, false)
|
|
2311
2436
|
}).actions((self) => {
|
|
2312
|
-
const { reqGet, reqPost } = createRequestHelpers(self,
|
|
2437
|
+
const { reqGet, reqPost } = createRequestHelpers(self, import_mobx_state_tree20.getEnv);
|
|
2313
2438
|
return {
|
|
2314
2439
|
/** GET /CustomField/GetAll?calendar_id= */
|
|
2315
2440
|
async getAll(calendarId) {
|
|
@@ -2327,10 +2452,10 @@ var CustomFieldModel = import_mobx_state_tree19.types.model("CustomField", {
|
|
|
2327
2452
|
},
|
|
2328
2453
|
/** POST /CustomField/Add */
|
|
2329
2454
|
async add(payload) {
|
|
2330
|
-
const body = payload ??
|
|
2455
|
+
const body = payload ?? toPayload5(self);
|
|
2331
2456
|
const res = await reqPost("/CustomField/Add", body);
|
|
2332
2457
|
if (res.status === "success" && res.data) {
|
|
2333
|
-
(0,
|
|
2458
|
+
(0, import_mobx_state_tree20.applySnapshot)(self, mapCustomFieldFromApi(res.data));
|
|
2334
2459
|
}
|
|
2335
2460
|
return res;
|
|
2336
2461
|
},
|
|
@@ -2394,7 +2519,7 @@ function mapCustomFieldFromApi(d) {
|
|
|
2394
2519
|
isDeleted: Boolean(pick("isDeleted", "IsDeleted", "is_deleted"))
|
|
2395
2520
|
};
|
|
2396
2521
|
}
|
|
2397
|
-
function
|
|
2522
|
+
function toPayload5(self) {
|
|
2398
2523
|
return {
|
|
2399
2524
|
customFieldId: self.customFieldId || void 0,
|
|
2400
2525
|
calendarId: self.calendarId || void 0,
|
|
@@ -2466,10 +2591,10 @@ CustomFieldModel.saveFormFieldData = async (fieldPayload) => {
|
|
|
2466
2591
|
var CustomField_default = CustomFieldModel;
|
|
2467
2592
|
|
|
2468
2593
|
// src/models/appointment/index.js
|
|
2469
|
-
var
|
|
2470
|
-
var RootStore =
|
|
2471
|
-
calendars:
|
|
2472
|
-
events:
|
|
2594
|
+
var import_mobx_state_tree21 = require("mobx-state-tree");
|
|
2595
|
+
var RootStore = import_mobx_state_tree21.types.model("RootStore", {
|
|
2596
|
+
calendars: import_mobx_state_tree21.types.optional(import_mobx_state_tree21.types.map(Calendar_default), {}),
|
|
2597
|
+
events: import_mobx_state_tree21.types.optional(import_mobx_state_tree21.types.map(Event_default), {})
|
|
2473
2598
|
}).actions((self) => ({
|
|
2474
2599
|
addCalendar(snapshot) {
|
|
2475
2600
|
const cal = Calendar_default.create(snapshot);
|
|
@@ -2495,6 +2620,7 @@ function createRootStore(initialState = {}) {
|
|
|
2495
2620
|
AvailabilityDetailModel,
|
|
2496
2621
|
AvailabilityModel,
|
|
2497
2622
|
CalendarDayModel,
|
|
2623
|
+
CalendarLocationModel,
|
|
2498
2624
|
CalendarModel,
|
|
2499
2625
|
CalendarParticipantModel,
|
|
2500
2626
|
CompanyModel,
|
|
@@ -2504,6 +2630,7 @@ function createRootStore(initialState = {}) {
|
|
|
2504
2630
|
EventModel,
|
|
2505
2631
|
FlowModel,
|
|
2506
2632
|
LeadModel,
|
|
2633
|
+
LocationType,
|
|
2507
2634
|
OpeningHourModel,
|
|
2508
2635
|
ParticipantInfoModel,
|
|
2509
2636
|
ParticipantModel,
|