@blazeo.com/calendar-client 1.0.17 → 1.0.19
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 +236 -199
- package/dist/index.js +313 -49
- package/dist/index.mjs +303 -41
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -97,8 +97,8 @@ function mergeConsumerHeader(env, opts) {
|
|
|
97
97
|
if (!headers["Consumer"] && (env == null ? void 0 : env.consumer)) headers["Consumer"] = env.consumer;
|
|
98
98
|
return { ...opts, headers };
|
|
99
99
|
}
|
|
100
|
-
function createRequestHelpers(self,
|
|
101
|
-
const env = () =>
|
|
100
|
+
function createRequestHelpers(self, getEnv11) {
|
|
101
|
+
const env = () => getEnv11(self);
|
|
102
102
|
const baseUrl = () => env().baseUrl;
|
|
103
103
|
const fetchFn = () => env().fetch ?? (typeof fetch !== "undefined" ? fetch : () => {
|
|
104
104
|
throw new Error("fetch not available");
|
|
@@ -854,6 +854,12 @@ var CalendarModel = types8.model("Calendar", {
|
|
|
854
854
|
else if (self.calendarId) q.calendar_id = self.calendarId;
|
|
855
855
|
return reqGet("/Calendar/Participant/OpeningHours/Get", q);
|
|
856
856
|
},
|
|
857
|
+
/** GET Calendar/Participant/OpeningHours/All/Get */
|
|
858
|
+
async getAllParticipantOpeningHours(calendarId) {
|
|
859
|
+
const resolvedCalendarId = calendarId || self.calendarId;
|
|
860
|
+
if (!resolvedCalendarId) return { status: "failure", message: "calendarId required" };
|
|
861
|
+
return reqGet("/Calendar/Participant/OpeningHours/All/Get", { calendar_id: resolvedCalendarId });
|
|
862
|
+
},
|
|
857
863
|
/** POST Calendar/Participant/Availability/OpeningHour/Save */
|
|
858
864
|
async saveOpeningHour(payload) {
|
|
859
865
|
return reqPost("/Calendar/Participant/Availability/OpeningHour/Save", payload);
|
|
@@ -1050,6 +1056,11 @@ CalendarModel.getParticipants = async (calendarId) => {
|
|
|
1050
1056
|
}
|
|
1051
1057
|
return null;
|
|
1052
1058
|
};
|
|
1059
|
+
CalendarModel.getAllParticipantOpeningHours = async (calendarId) => {
|
|
1060
|
+
const { reqGet } = createRequestHelpersFromEnv(getConfig());
|
|
1061
|
+
const res = await reqGet("/Calendar/Participant/OpeningHours/All/Get", { calendar_id: calendarId });
|
|
1062
|
+
return res.status === "success" && Array.isArray(res.data) ? res.data : null;
|
|
1063
|
+
};
|
|
1053
1064
|
CalendarModel.getCalendarParticipant = async (calendarId) => {
|
|
1054
1065
|
const { reqGet } = createRequestHelpersFromEnv(getConfig());
|
|
1055
1066
|
const res = await reqGet("/Calendar/Participant/Get", { calendar_id: calendarId });
|
|
@@ -1583,8 +1594,88 @@ CompanyModel.save = async (payload) => {
|
|
|
1583
1594
|
};
|
|
1584
1595
|
var Company_default = CompanyModel;
|
|
1585
1596
|
|
|
1597
|
+
// src/models/appointment/Asset.js
|
|
1598
|
+
import { types as types15, getEnv as getEnv6 } from "mobx-state-tree";
|
|
1599
|
+
var AssetModel = types15.model("Asset", {
|
|
1600
|
+
url: types15.optional(types15.maybeNull(types15.string), null),
|
|
1601
|
+
blobPath: types15.optional(types15.maybeNull(types15.string), null),
|
|
1602
|
+
category: types15.optional(types15.maybeNull(types15.string), null),
|
|
1603
|
+
contentType: types15.optional(types15.maybeNull(types15.string), null),
|
|
1604
|
+
size: types15.optional(types15.maybeNull(types15.number), null)
|
|
1605
|
+
}).actions((self) => ({
|
|
1606
|
+
/** POST /asset/upload – upload file using model category. */
|
|
1607
|
+
async upload(file, opts = {}) {
|
|
1608
|
+
const category = opts.category ?? self.category;
|
|
1609
|
+
return AssetModel.upload(file, { ...opts, category });
|
|
1610
|
+
}
|
|
1611
|
+
}));
|
|
1612
|
+
function pickValue(d, ...keys) {
|
|
1613
|
+
for (const k of keys) {
|
|
1614
|
+
if ((d == null ? void 0 : d[k]) !== void 0 && (d == null ? void 0 : d[k]) !== null) return d[k];
|
|
1615
|
+
}
|
|
1616
|
+
return null;
|
|
1617
|
+
}
|
|
1618
|
+
function mapFromApi5(d) {
|
|
1619
|
+
if (!d) return d;
|
|
1620
|
+
return {
|
|
1621
|
+
url: pickValue(d, "url", "Url"),
|
|
1622
|
+
blobPath: pickValue(d, "blobPath", "blob_path", "BlobPath"),
|
|
1623
|
+
category: pickValue(d, "category", "Category"),
|
|
1624
|
+
contentType: pickValue(d, "contentType", "content_type", "ContentType"),
|
|
1625
|
+
size: pickValue(d, "size", "Size")
|
|
1626
|
+
};
|
|
1627
|
+
}
|
|
1628
|
+
AssetModel.upload = async (file, opts = {}) => {
|
|
1629
|
+
const cfg = getConfig();
|
|
1630
|
+
if (!(cfg == null ? void 0 : cfg.baseUrl)) throw new Error("Configure baseUrl before AssetModel.upload");
|
|
1631
|
+
if (!file) return { status: "failure", message: "file is required" };
|
|
1632
|
+
const category = opts.category != null ? String(opts.category).trim() : "";
|
|
1633
|
+
if (!category) return { status: "failure", message: "category is required" };
|
|
1634
|
+
const fetchFn = cfg.fetch ?? (typeof fetch !== "undefined" ? fetch : () => {
|
|
1635
|
+
throw new Error("fetch not available");
|
|
1636
|
+
});
|
|
1637
|
+
const baseUrl = String(cfg.baseUrl).replace(/\/+$/, "");
|
|
1638
|
+
const url = `${baseUrl}/asset/upload`;
|
|
1639
|
+
const formData = new FormData();
|
|
1640
|
+
formData.append("file", file);
|
|
1641
|
+
formData.append("category", category);
|
|
1642
|
+
if (opts.companyKey != null && String(opts.companyKey).trim() !== "") {
|
|
1643
|
+
formData.append("company_key", String(opts.companyKey).trim());
|
|
1644
|
+
}
|
|
1645
|
+
if (opts.calendarId != null && String(opts.calendarId).trim() !== "") {
|
|
1646
|
+
formData.append("calendar_id", String(opts.calendarId).trim());
|
|
1647
|
+
}
|
|
1648
|
+
const headers = {};
|
|
1649
|
+
if (cfg.consumer) headers.Consumer = cfg.consumer;
|
|
1650
|
+
if (opts.consumer != null && String(opts.consumer).trim() !== "") {
|
|
1651
|
+
headers.Consumer = String(opts.consumer).trim();
|
|
1652
|
+
}
|
|
1653
|
+
const res = await fetchFn(url, {
|
|
1654
|
+
method: "POST",
|
|
1655
|
+
headers,
|
|
1656
|
+
body: formData
|
|
1657
|
+
});
|
|
1658
|
+
const text = await res.text();
|
|
1659
|
+
let data;
|
|
1660
|
+
try {
|
|
1661
|
+
data = JSON.parse(text);
|
|
1662
|
+
} catch {
|
|
1663
|
+
data = { status: "failure", message: text || res.statusText };
|
|
1664
|
+
}
|
|
1665
|
+
if (!res.ok && data.status !== "failure") {
|
|
1666
|
+
data.status = "failure";
|
|
1667
|
+
data.message = data.message ?? `HTTP ${res.status}`;
|
|
1668
|
+
}
|
|
1669
|
+
if ((data == null ? void 0 : data.status) === "success" && (data == null ? void 0 : data.data)) {
|
|
1670
|
+
const mapped = mapFromApi5(data.data);
|
|
1671
|
+
data.data = AssetModel.create(mapped, { env: cfg });
|
|
1672
|
+
}
|
|
1673
|
+
return data;
|
|
1674
|
+
};
|
|
1675
|
+
var Asset_default = AssetModel;
|
|
1676
|
+
|
|
1586
1677
|
// src/models/appointment/Preference.js
|
|
1587
|
-
import { types as
|
|
1678
|
+
import { types as types16 } from "mobx-state-tree";
|
|
1588
1679
|
var PreferenceScope = {
|
|
1589
1680
|
Global: 0,
|
|
1590
1681
|
Consumer: 1,
|
|
@@ -1593,13 +1684,13 @@ var PreferenceScope = {
|
|
|
1593
1684
|
Event: 4
|
|
1594
1685
|
};
|
|
1595
1686
|
var SCOPE_NAMES = ["Global", "Consumer", "Company", "Calendar", "Event"];
|
|
1596
|
-
var PreferenceModel =
|
|
1597
|
-
id:
|
|
1598
|
-
preferenceId:
|
|
1599
|
-
level:
|
|
1600
|
-
primaryKey:
|
|
1601
|
-
preferenceOption:
|
|
1602
|
-
optionsJson:
|
|
1687
|
+
var PreferenceModel = types16.model("Preference", {
|
|
1688
|
+
id: types16.optional(types16.maybeNull(types16.number), null),
|
|
1689
|
+
preferenceId: types16.optional(types16.maybeNull(types16.string), null),
|
|
1690
|
+
level: types16.optional(types16.number, 0),
|
|
1691
|
+
primaryKey: types16.optional(types16.string, ""),
|
|
1692
|
+
preferenceOption: types16.optional(types16.string, ""),
|
|
1693
|
+
optionsJson: types16.optional(types16.maybeNull(types16.string), null)
|
|
1603
1694
|
}).actions((self) => ({
|
|
1604
1695
|
/** POST /preference/{scope}/{key}/{option} – save this preference to the API. */
|
|
1605
1696
|
async save() {
|
|
@@ -1647,7 +1738,7 @@ PreferenceModel.delete = async (preferenceId) => {
|
|
|
1647
1738
|
var Preference_default = PreferenceModel;
|
|
1648
1739
|
|
|
1649
1740
|
// src/models/appointment/Flow.js
|
|
1650
|
-
import { types as
|
|
1741
|
+
import { types as types17, getEnv as getEnv7, applySnapshot as applySnapshot6 } from "mobx-state-tree";
|
|
1651
1742
|
function mapFlowFromApi(d) {
|
|
1652
1743
|
if (!d) return d;
|
|
1653
1744
|
const pick = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
|
|
@@ -1665,19 +1756,19 @@ function mapFlowFromApi(d) {
|
|
|
1665
1756
|
modifiedOn: pick("modifiedOn", "ModifiedOn", "modified_on") ?? null
|
|
1666
1757
|
};
|
|
1667
1758
|
}
|
|
1668
|
-
var FlowModel =
|
|
1669
|
-
id:
|
|
1670
|
-
flowId:
|
|
1671
|
-
companyKey:
|
|
1672
|
-
name:
|
|
1673
|
-
description:
|
|
1674
|
-
flowJson:
|
|
1675
|
-
isActive:
|
|
1676
|
-
isDeleted:
|
|
1677
|
-
createdOn:
|
|
1678
|
-
modifiedOn:
|
|
1759
|
+
var FlowModel = types17.model("Flow", {
|
|
1760
|
+
id: types17.optional(types17.maybeNull(types17.number), null),
|
|
1761
|
+
flowId: types17.optional(types17.identifier, "new"),
|
|
1762
|
+
companyKey: types17.optional(types17.maybeNull(types17.string), null),
|
|
1763
|
+
name: types17.optional(types17.maybeNull(types17.string), null),
|
|
1764
|
+
description: types17.optional(types17.maybeNull(types17.string), null),
|
|
1765
|
+
flowJson: types17.optional(types17.string, ""),
|
|
1766
|
+
isActive: types17.optional(types17.boolean, true),
|
|
1767
|
+
isDeleted: types17.optional(types17.boolean, false),
|
|
1768
|
+
createdOn: types17.optional(types17.maybeNull(types17.string), null),
|
|
1769
|
+
modifiedOn: types17.optional(types17.maybeNull(types17.string), null)
|
|
1679
1770
|
}).actions((self) => {
|
|
1680
|
-
const { reqGet, reqPost } = createRequestHelpers(self,
|
|
1771
|
+
const { reqGet, reqPost } = createRequestHelpers(self, getEnv7);
|
|
1681
1772
|
return {
|
|
1682
1773
|
/** GET flow/get – fetch this flow by flowId */
|
|
1683
1774
|
async get() {
|
|
@@ -1906,7 +1997,7 @@ FlowModel.getPreview = async (flowId) => {
|
|
|
1906
1997
|
var Flow_default = FlowModel;
|
|
1907
1998
|
|
|
1908
1999
|
// src/models/appointment/Lead.js
|
|
1909
|
-
import { types as
|
|
2000
|
+
import { types as types18, getEnv as getEnv8, applySnapshot as applySnapshot7, getSnapshot } from "mobx-state-tree";
|
|
1910
2001
|
function mapLeadFromApi(d) {
|
|
1911
2002
|
if (!d) return d;
|
|
1912
2003
|
const pick = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
|
|
@@ -1935,20 +2026,20 @@ function mapLeadFromApi(d) {
|
|
|
1935
2026
|
modifiedOn: pick("modifiedOn", "ModifiedOn", "modified_on") ?? null
|
|
1936
2027
|
};
|
|
1937
2028
|
}
|
|
1938
|
-
var LeadModel =
|
|
1939
|
-
id:
|
|
1940
|
-
leadId:
|
|
1941
|
-
email:
|
|
1942
|
-
name:
|
|
1943
|
-
phone:
|
|
1944
|
-
companyKey:
|
|
1945
|
-
source:
|
|
1946
|
-
leadType:
|
|
1947
|
-
referrerLink:
|
|
1948
|
-
createdOn:
|
|
1949
|
-
modifiedOn:
|
|
2029
|
+
var LeadModel = types18.model("Lead", {
|
|
2030
|
+
id: types18.optional(types18.maybeNull(types18.number), null),
|
|
2031
|
+
leadId: types18.optional(types18.identifier, "new"),
|
|
2032
|
+
email: types18.optional(types18.string, ""),
|
|
2033
|
+
name: types18.optional(types18.string, ""),
|
|
2034
|
+
phone: types18.optional(types18.string, ""),
|
|
2035
|
+
companyKey: types18.optional(types18.string, ""),
|
|
2036
|
+
source: types18.optional(types18.string, ""),
|
|
2037
|
+
leadType: types18.optional(types18.number, 2),
|
|
2038
|
+
referrerLink: types18.optional(types18.string, ""),
|
|
2039
|
+
createdOn: types18.optional(types18.maybeNull(types18.string), null),
|
|
2040
|
+
modifiedOn: types18.optional(types18.maybeNull(types18.string), null)
|
|
1950
2041
|
}).actions((self) => {
|
|
1951
|
-
const { reqGet, reqPost } = createRequestHelpers(self,
|
|
2042
|
+
const { reqGet, reqPost } = createRequestHelpers(self, getEnv8);
|
|
1952
2043
|
return {
|
|
1953
2044
|
/** GET /lead/get – fetch this lead by leadId */
|
|
1954
2045
|
async get() {
|
|
@@ -2134,11 +2225,180 @@ LeadModel.getSources = async (companyKey) => {
|
|
|
2134
2225
|
};
|
|
2135
2226
|
var Lead_default = LeadModel;
|
|
2136
2227
|
|
|
2228
|
+
// src/models/appointment/CustomField.js
|
|
2229
|
+
import { types as types19, getEnv as getEnv9, applySnapshot as applySnapshot8 } from "mobx-state-tree";
|
|
2230
|
+
var CustomFieldModel = types19.model("CustomField", {
|
|
2231
|
+
id: types19.optional(types19.maybeNull(types19.number), null),
|
|
2232
|
+
customFieldId: types19.optional(types19.maybeNull(types19.string), null),
|
|
2233
|
+
calendarId: types19.optional(types19.maybeNull(types19.string), null),
|
|
2234
|
+
label: types19.optional(types19.maybeNull(types19.string), null),
|
|
2235
|
+
type: types19.optional(types19.string, ""),
|
|
2236
|
+
isRequired: types19.optional(types19.boolean, false),
|
|
2237
|
+
createdOn: types19.optional(types19.maybeNull(types19.string), null),
|
|
2238
|
+
modifiedOn: types19.optional(types19.maybeNull(types19.string), null),
|
|
2239
|
+
isDeleted: types19.optional(types19.boolean, false)
|
|
2240
|
+
}).actions((self) => {
|
|
2241
|
+
const { reqGet, reqPost } = createRequestHelpers(self, getEnv9);
|
|
2242
|
+
return {
|
|
2243
|
+
/** GET /CustomField/GetAll?calendar_id= */
|
|
2244
|
+
async getAll(calendarId) {
|
|
2245
|
+
const resolvedCalendarId = calendarId || self.calendarId;
|
|
2246
|
+
if (!resolvedCalendarId) return { status: "failure", message: "calendarId required" };
|
|
2247
|
+
return reqGet("/CustomField/GetAll", { calendar_id: resolvedCalendarId });
|
|
2248
|
+
},
|
|
2249
|
+
/** GET /CustomField/FieldType/Get?FieldType= */
|
|
2250
|
+
async getFieldType(fieldType) {
|
|
2251
|
+
return reqGet("/CustomField/FieldType/Get", { FieldType: fieldType });
|
|
2252
|
+
},
|
|
2253
|
+
/** GET /CustomField/FieldTypes/Get */
|
|
2254
|
+
async getFieldTypes() {
|
|
2255
|
+
return reqGet("/CustomField/FieldTypes/Get");
|
|
2256
|
+
},
|
|
2257
|
+
/** POST /CustomField/Add */
|
|
2258
|
+
async add(payload) {
|
|
2259
|
+
const body = payload ?? toPayload4(self);
|
|
2260
|
+
const res = await reqPost("/CustomField/Add", body);
|
|
2261
|
+
if (res.status === "success" && res.data) {
|
|
2262
|
+
applySnapshot8(self, mapCustomFieldFromApi(res.data));
|
|
2263
|
+
}
|
|
2264
|
+
return res;
|
|
2265
|
+
},
|
|
2266
|
+
/** GET /CustomField/RemoveField?customfield_id= */
|
|
2267
|
+
async removeField(customFieldId) {
|
|
2268
|
+
const resolvedCustomFieldId = customFieldId || self.customFieldId;
|
|
2269
|
+
if (!resolvedCustomFieldId) return { status: "failure", message: "customFieldId required" };
|
|
2270
|
+
return reqGet("/CustomField/RemoveField", { customfield_id: resolvedCustomFieldId });
|
|
2271
|
+
},
|
|
2272
|
+
/** GET /CustomField/RemoveAllFields?calendar_id= */
|
|
2273
|
+
async removeAllFields(calendarId) {
|
|
2274
|
+
const resolvedCalendarId = calendarId || self.calendarId;
|
|
2275
|
+
if (!resolvedCalendarId) return { status: "failure", message: "calendarId required" };
|
|
2276
|
+
return reqGet("/CustomField/RemoveAllFields", { calendar_id: resolvedCalendarId });
|
|
2277
|
+
},
|
|
2278
|
+
/** GET /CustomField/Form/Get?calendar_id=&data_id= */
|
|
2279
|
+
async getForm(calendarId, dataId) {
|
|
2280
|
+
const resolvedCalendarId = calendarId || self.calendarId;
|
|
2281
|
+
if (!resolvedCalendarId) return { status: "failure", message: "calendarId required" };
|
|
2282
|
+
const query = { calendar_id: resolvedCalendarId };
|
|
2283
|
+
if (dataId != null && dataId !== "") query.data_id = dataId;
|
|
2284
|
+
return reqGet("/CustomField/Form/Get", query);
|
|
2285
|
+
},
|
|
2286
|
+
/** POST /CustomField/Form/Save?calendar_id= */
|
|
2287
|
+
async saveForm(fields, calendarId) {
|
|
2288
|
+
const resolvedCalendarId = calendarId || self.calendarId;
|
|
2289
|
+
if (!resolvedCalendarId) return { status: "failure", message: "calendarId required" };
|
|
2290
|
+
return reqPost("/CustomField/Form/Save", fields ?? [], { calendar_id: resolvedCalendarId });
|
|
2291
|
+
},
|
|
2292
|
+
/** GET /CustomField/Form/Data/Get?calendar_id=&data_id= */
|
|
2293
|
+
async getFormData(calendarId, dataId) {
|
|
2294
|
+
const resolvedCalendarId = calendarId || self.calendarId;
|
|
2295
|
+
if (!resolvedCalendarId) return { status: "failure", message: "calendarId required" };
|
|
2296
|
+
const query = { calendar_id: resolvedCalendarId };
|
|
2297
|
+
if (dataId != null && dataId !== "") query.data_id = dataId;
|
|
2298
|
+
return reqGet("/CustomField/Form/Data/Get", query);
|
|
2299
|
+
},
|
|
2300
|
+
/** POST /CustomField/Form/Data/Save?data_id= */
|
|
2301
|
+
async saveFormData(fields, dataId) {
|
|
2302
|
+
if (!dataId) return { status: "failure", message: "dataId required" };
|
|
2303
|
+
return reqPost("/CustomField/Form/Data/Save", fields ?? [], { data_id: dataId });
|
|
2304
|
+
},
|
|
2305
|
+
/** POST /CustomField/Form/Field/Data/Save */
|
|
2306
|
+
async saveFormFieldData(fieldPayload) {
|
|
2307
|
+
return reqPost("/CustomField/Form/Field/Data/Save", fieldPayload ?? {});
|
|
2308
|
+
}
|
|
2309
|
+
};
|
|
2310
|
+
});
|
|
2311
|
+
function mapCustomFieldFromApi(d) {
|
|
2312
|
+
if (!d) return d;
|
|
2313
|
+
const pick = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
|
|
2314
|
+
return {
|
|
2315
|
+
id: pick("id", "Id") ?? null,
|
|
2316
|
+
customFieldId: pick("customFieldId", "CustomFieldId", "custom_field_id") ?? null,
|
|
2317
|
+
calendarId: pick("calendarId", "CalendarId", "calendar_id") ?? null,
|
|
2318
|
+
label: pick("label", "Label") ?? null,
|
|
2319
|
+
type: pick("type", "Type") ?? "",
|
|
2320
|
+
isRequired: Boolean(pick("isRequired", "IsRequired", "is_required")),
|
|
2321
|
+
createdOn: pick("createdOn", "CreatedOn", "created_on") ?? null,
|
|
2322
|
+
modifiedOn: pick("modifiedOn", "ModifiedOn", "modified_on") ?? null,
|
|
2323
|
+
isDeleted: Boolean(pick("isDeleted", "IsDeleted", "is_deleted"))
|
|
2324
|
+
};
|
|
2325
|
+
}
|
|
2326
|
+
function toPayload4(self) {
|
|
2327
|
+
return {
|
|
2328
|
+
customFieldId: self.customFieldId || void 0,
|
|
2329
|
+
calendarId: self.calendarId || void 0,
|
|
2330
|
+
label: self.label ?? void 0,
|
|
2331
|
+
type: self.type || void 0,
|
|
2332
|
+
isRequired: Boolean(self.isRequired)
|
|
2333
|
+
};
|
|
2334
|
+
}
|
|
2335
|
+
CustomFieldModel.getAll = async (calendarId) => {
|
|
2336
|
+
const { reqGet } = createRequestHelpersFromEnv(getConfig());
|
|
2337
|
+
const res = await reqGet("/CustomField/GetAll", { calendar_id: calendarId });
|
|
2338
|
+
if (res.status === "success" && Array.isArray(res.data)) {
|
|
2339
|
+
return res.data.map((f) => CustomFieldModel.create(mapCustomFieldFromApi(f), { env: getConfig() }));
|
|
2340
|
+
}
|
|
2341
|
+
return null;
|
|
2342
|
+
};
|
|
2343
|
+
CustomFieldModel.getFieldType = async (fieldType) => {
|
|
2344
|
+
const { reqGet } = createRequestHelpersFromEnv(getConfig());
|
|
2345
|
+
const res = await reqGet("/CustomField/FieldType/Get", { FieldType: fieldType });
|
|
2346
|
+
return res.status === "success" ? res.data : null;
|
|
2347
|
+
};
|
|
2348
|
+
CustomFieldModel.getFieldTypes = async () => {
|
|
2349
|
+
const { reqGet } = createRequestHelpersFromEnv(getConfig());
|
|
2350
|
+
const res = await reqGet("/CustomField/FieldTypes/Get");
|
|
2351
|
+
return res.status === "success" ? res.data : null;
|
|
2352
|
+
};
|
|
2353
|
+
CustomFieldModel.add = async (payload) => {
|
|
2354
|
+
const { reqPost } = createRequestHelpersFromEnv(getConfig());
|
|
2355
|
+
const res = await reqPost("/CustomField/Add", payload);
|
|
2356
|
+
if (res.status === "success" && res.data) {
|
|
2357
|
+
return CustomFieldModel.create(mapCustomFieldFromApi(res.data), { env: getConfig() });
|
|
2358
|
+
}
|
|
2359
|
+
return null;
|
|
2360
|
+
};
|
|
2361
|
+
CustomFieldModel.removeField = async (customFieldId) => {
|
|
2362
|
+
const { reqGet } = createRequestHelpersFromEnv(getConfig());
|
|
2363
|
+
return reqGet("/CustomField/RemoveField", { customfield_id: customFieldId });
|
|
2364
|
+
};
|
|
2365
|
+
CustomFieldModel.removeAllFields = async (calendarId) => {
|
|
2366
|
+
const { reqGet } = createRequestHelpersFromEnv(getConfig());
|
|
2367
|
+
return reqGet("/CustomField/RemoveAllFields", { calendar_id: calendarId });
|
|
2368
|
+
};
|
|
2369
|
+
CustomFieldModel.getForm = async (calendarId, dataId) => {
|
|
2370
|
+
const { reqGet } = createRequestHelpersFromEnv(getConfig());
|
|
2371
|
+
const query = { calendar_id: calendarId };
|
|
2372
|
+
if (dataId != null && dataId !== "") query.data_id = dataId;
|
|
2373
|
+
const res = await reqGet("/CustomField/Form/Get", query);
|
|
2374
|
+
return res.status === "success" ? res.data : null;
|
|
2375
|
+
};
|
|
2376
|
+
CustomFieldModel.saveForm = async (calendarId, fields) => {
|
|
2377
|
+
const { reqPost } = createRequestHelpersFromEnv(getConfig());
|
|
2378
|
+
return reqPost("/CustomField/Form/Save", fields ?? [], { calendar_id: calendarId });
|
|
2379
|
+
};
|
|
2380
|
+
CustomFieldModel.getFormData = async (calendarId, dataId) => {
|
|
2381
|
+
const { reqGet } = createRequestHelpersFromEnv(getConfig());
|
|
2382
|
+
const query = { calendar_id: calendarId };
|
|
2383
|
+
if (dataId != null && dataId !== "") query.data_id = dataId;
|
|
2384
|
+
const res = await reqGet("/CustomField/Form/Data/Get", query);
|
|
2385
|
+
return res.status === "success" ? res.data : null;
|
|
2386
|
+
};
|
|
2387
|
+
CustomFieldModel.saveFormData = async (dataId, fields) => {
|
|
2388
|
+
const { reqPost } = createRequestHelpersFromEnv(getConfig());
|
|
2389
|
+
return reqPost("/CustomField/Form/Data/Save", fields ?? [], { data_id: dataId });
|
|
2390
|
+
};
|
|
2391
|
+
CustomFieldModel.saveFormFieldData = async (fieldPayload) => {
|
|
2392
|
+
const { reqPost } = createRequestHelpersFromEnv(getConfig());
|
|
2393
|
+
return reqPost("/CustomField/Form/Field/Data/Save", fieldPayload ?? {});
|
|
2394
|
+
};
|
|
2395
|
+
var CustomField_default = CustomFieldModel;
|
|
2396
|
+
|
|
2137
2397
|
// src/models/appointment/index.js
|
|
2138
|
-
import { types as
|
|
2139
|
-
var RootStore =
|
|
2140
|
-
calendars:
|
|
2141
|
-
events:
|
|
2398
|
+
import { types as types20, getEnv as getEnv10 } from "mobx-state-tree";
|
|
2399
|
+
var RootStore = types20.model("RootStore", {
|
|
2400
|
+
calendars: types20.optional(types20.map(Calendar_default), {}),
|
|
2401
|
+
events: types20.optional(types20.map(Event_default), {})
|
|
2142
2402
|
}).actions((self) => ({
|
|
2143
2403
|
addCalendar(snapshot) {
|
|
2144
2404
|
const cal = Calendar_default.create(snapshot);
|
|
@@ -2157,6 +2417,7 @@ function createRootStore(initialState = {}) {
|
|
|
2157
2417
|
return RootStore.create(initialState, { env });
|
|
2158
2418
|
}
|
|
2159
2419
|
export {
|
|
2420
|
+
Asset_default as AssetModel,
|
|
2160
2421
|
AssignmentMethod,
|
|
2161
2422
|
AttendeeStatus,
|
|
2162
2423
|
AvailabilityDetail_default as AvailabilityDetailModel,
|
|
@@ -2166,6 +2427,7 @@ export {
|
|
|
2166
2427
|
CalendarParticipant_default as CalendarParticipantModel,
|
|
2167
2428
|
Company_default as CompanyModel,
|
|
2168
2429
|
ConfigModel_default as ConfigModel,
|
|
2430
|
+
CustomField_default as CustomFieldModel,
|
|
2169
2431
|
DayOfWeek,
|
|
2170
2432
|
Event_default as EventModel,
|
|
2171
2433
|
Flow_default as FlowModel,
|