@blazeo.com/calendar-client 1.0.18 → 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 -200
- package/dist/index.js +302 -49
- package/dist/index.mjs +292 -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");
|
|
@@ -1594,8 +1594,88 @@ CompanyModel.save = async (payload) => {
|
|
|
1594
1594
|
};
|
|
1595
1595
|
var Company_default = CompanyModel;
|
|
1596
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
|
+
|
|
1597
1677
|
// src/models/appointment/Preference.js
|
|
1598
|
-
import { types as
|
|
1678
|
+
import { types as types16 } from "mobx-state-tree";
|
|
1599
1679
|
var PreferenceScope = {
|
|
1600
1680
|
Global: 0,
|
|
1601
1681
|
Consumer: 1,
|
|
@@ -1604,13 +1684,13 @@ var PreferenceScope = {
|
|
|
1604
1684
|
Event: 4
|
|
1605
1685
|
};
|
|
1606
1686
|
var SCOPE_NAMES = ["Global", "Consumer", "Company", "Calendar", "Event"];
|
|
1607
|
-
var PreferenceModel =
|
|
1608
|
-
id:
|
|
1609
|
-
preferenceId:
|
|
1610
|
-
level:
|
|
1611
|
-
primaryKey:
|
|
1612
|
-
preferenceOption:
|
|
1613
|
-
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)
|
|
1614
1694
|
}).actions((self) => ({
|
|
1615
1695
|
/** POST /preference/{scope}/{key}/{option} – save this preference to the API. */
|
|
1616
1696
|
async save() {
|
|
@@ -1658,7 +1738,7 @@ PreferenceModel.delete = async (preferenceId) => {
|
|
|
1658
1738
|
var Preference_default = PreferenceModel;
|
|
1659
1739
|
|
|
1660
1740
|
// src/models/appointment/Flow.js
|
|
1661
|
-
import { types as
|
|
1741
|
+
import { types as types17, getEnv as getEnv7, applySnapshot as applySnapshot6 } from "mobx-state-tree";
|
|
1662
1742
|
function mapFlowFromApi(d) {
|
|
1663
1743
|
if (!d) return d;
|
|
1664
1744
|
const pick = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
|
|
@@ -1676,19 +1756,19 @@ function mapFlowFromApi(d) {
|
|
|
1676
1756
|
modifiedOn: pick("modifiedOn", "ModifiedOn", "modified_on") ?? null
|
|
1677
1757
|
};
|
|
1678
1758
|
}
|
|
1679
|
-
var FlowModel =
|
|
1680
|
-
id:
|
|
1681
|
-
flowId:
|
|
1682
|
-
companyKey:
|
|
1683
|
-
name:
|
|
1684
|
-
description:
|
|
1685
|
-
flowJson:
|
|
1686
|
-
isActive:
|
|
1687
|
-
isDeleted:
|
|
1688
|
-
createdOn:
|
|
1689
|
-
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)
|
|
1690
1770
|
}).actions((self) => {
|
|
1691
|
-
const { reqGet, reqPost } = createRequestHelpers(self,
|
|
1771
|
+
const { reqGet, reqPost } = createRequestHelpers(self, getEnv7);
|
|
1692
1772
|
return {
|
|
1693
1773
|
/** GET flow/get – fetch this flow by flowId */
|
|
1694
1774
|
async get() {
|
|
@@ -1917,7 +1997,7 @@ FlowModel.getPreview = async (flowId) => {
|
|
|
1917
1997
|
var Flow_default = FlowModel;
|
|
1918
1998
|
|
|
1919
1999
|
// src/models/appointment/Lead.js
|
|
1920
|
-
import { types as
|
|
2000
|
+
import { types as types18, getEnv as getEnv8, applySnapshot as applySnapshot7, getSnapshot } from "mobx-state-tree";
|
|
1921
2001
|
function mapLeadFromApi(d) {
|
|
1922
2002
|
if (!d) return d;
|
|
1923
2003
|
const pick = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
|
|
@@ -1946,20 +2026,20 @@ function mapLeadFromApi(d) {
|
|
|
1946
2026
|
modifiedOn: pick("modifiedOn", "ModifiedOn", "modified_on") ?? null
|
|
1947
2027
|
};
|
|
1948
2028
|
}
|
|
1949
|
-
var LeadModel =
|
|
1950
|
-
id:
|
|
1951
|
-
leadId:
|
|
1952
|
-
email:
|
|
1953
|
-
name:
|
|
1954
|
-
phone:
|
|
1955
|
-
companyKey:
|
|
1956
|
-
source:
|
|
1957
|
-
leadType:
|
|
1958
|
-
referrerLink:
|
|
1959
|
-
createdOn:
|
|
1960
|
-
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)
|
|
1961
2041
|
}).actions((self) => {
|
|
1962
|
-
const { reqGet, reqPost } = createRequestHelpers(self,
|
|
2042
|
+
const { reqGet, reqPost } = createRequestHelpers(self, getEnv8);
|
|
1963
2043
|
return {
|
|
1964
2044
|
/** GET /lead/get – fetch this lead by leadId */
|
|
1965
2045
|
async get() {
|
|
@@ -2145,11 +2225,180 @@ LeadModel.getSources = async (companyKey) => {
|
|
|
2145
2225
|
};
|
|
2146
2226
|
var Lead_default = LeadModel;
|
|
2147
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
|
+
|
|
2148
2397
|
// src/models/appointment/index.js
|
|
2149
|
-
import { types as
|
|
2150
|
-
var RootStore =
|
|
2151
|
-
calendars:
|
|
2152
|
-
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), {})
|
|
2153
2402
|
}).actions((self) => ({
|
|
2154
2403
|
addCalendar(snapshot) {
|
|
2155
2404
|
const cal = Calendar_default.create(snapshot);
|
|
@@ -2168,6 +2417,7 @@ function createRootStore(initialState = {}) {
|
|
|
2168
2417
|
return RootStore.create(initialState, { env });
|
|
2169
2418
|
}
|
|
2170
2419
|
export {
|
|
2420
|
+
Asset_default as AssetModel,
|
|
2171
2421
|
AssignmentMethod,
|
|
2172
2422
|
AttendeeStatus,
|
|
2173
2423
|
AvailabilityDetail_default as AvailabilityDetailModel,
|
|
@@ -2177,6 +2427,7 @@ export {
|
|
|
2177
2427
|
CalendarParticipant_default as CalendarParticipantModel,
|
|
2178
2428
|
Company_default as CompanyModel,
|
|
2179
2429
|
ConfigModel_default as ConfigModel,
|
|
2430
|
+
CustomField_default as CustomFieldModel,
|
|
2180
2431
|
DayOfWeek,
|
|
2181
2432
|
Event_default as EventModel,
|
|
2182
2433
|
Flow_default as FlowModel,
|