@blazeo.com/calendar-client 1.0.30 → 1.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.d.ts +12 -0
- package/dist/index.js +43 -2
- package/dist/index.mjs +43 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -72,7 +72,7 @@ await LeadModel.requestExport('company-key');
|
|
|
72
72
|
- **CalendarModel (static):** `get`, `getByCompany`, `getTimeZones`, `getTimeZone`, `getParticipants`, `getMonth`, `getEvents`, etc.
|
|
73
73
|
- **EventModel (instance):** `get`, `create`, `cancel`, `getCancellable`, `getAvailability`, `setReminder`
|
|
74
74
|
- **FlowModel:** Same pattern as Calendar — `FlowModel.create({}, { env })` with no fields; static `get`, `getRaw`, `list`, `createFlow`, `updateFlow`, `delete`, `duplicate`, appearance/embed/public/preview helpers; instance methods mirror those using `flowId` on the snapshot
|
|
75
|
-
- **LeadModel:** `LeadModel.create({}, { env })`; static `get`, `getRaw`, `getByEmail`, `getByCompany`; instance `get`, `getByEmail`, `getByCompany`
|
|
75
|
+
- **LeadModel:** `LeadModel.create({}, { env })`; static `get`, `getRaw`, `getByEmail`, `getByPhone`, `getByCompany`, `saveColumnSelection`, `getColumnSelection`, `allowedColumns`; instance `get`, `getByEmail`, `getByPhone`, `getByCompany`, `saveColumnSelection`, `getColumnSelection`. Pass `userId` in `getByCompany(companyKey, { userId })` to return only columns saved for that user.
|
|
76
76
|
- **ParticipantModel:** static `get`, `getByEmail`, `getByIds`, `getAll`, …; instance `getByEmail` uses `email` + `companyKey` on the snapshot (see `GET /participant/getbyemail`)
|
|
77
77
|
- **AuthModel (calendar OAuth / Connect Calendar):** `getCalendarProviders`, `getAuthorizationUrl`, `getAuthorizationStatus`, `openOAuthPopup`, `onCalendarAuthMessage` — see [Calendar authorization flow](#calendar-authorization-direct-ui)
|
|
78
78
|
- **RootStore:** `addCalendar`, `addEvent`
|
package/dist/index.d.ts
CHANGED
|
@@ -231,6 +231,16 @@ export const LeadModel: {
|
|
|
231
231
|
get(leadId: string): Promise<unknown>;
|
|
232
232
|
getByEmail(email: string, companyKey: string): Promise<unknown>;
|
|
233
233
|
getByPhone(phone: string, companyKey: string): Promise<unknown>;
|
|
234
|
+
allowedColumns: string[];
|
|
235
|
+
saveColumnSelection(
|
|
236
|
+
userId: string,
|
|
237
|
+
columns: string[]
|
|
238
|
+
): Promise<{ status: string; data?: unknown; message?: string }>;
|
|
239
|
+
getColumnSelection(userId: string): Promise<{
|
|
240
|
+
status: string;
|
|
241
|
+
data?: { userId?: string; columns?: string[]; isDefault?: boolean };
|
|
242
|
+
message?: string;
|
|
243
|
+
}>;
|
|
234
244
|
createLead(payload: {
|
|
235
245
|
email: string;
|
|
236
246
|
companyKey: string;
|
|
@@ -263,6 +273,8 @@ export const LeadModel: {
|
|
|
263
273
|
getByCompany(
|
|
264
274
|
companyKey: string,
|
|
265
275
|
opts?: {
|
|
276
|
+
userId?: string;
|
|
277
|
+
user_id?: string;
|
|
266
278
|
skip?: number;
|
|
267
279
|
take?: number;
|
|
268
280
|
/** Maps to API query `sort`. */
|
package/dist/index.js
CHANGED
|
@@ -2026,9 +2026,11 @@ var PreferenceScope = {
|
|
|
2026
2026
|
Consumer: 1,
|
|
2027
2027
|
Company: 2,
|
|
2028
2028
|
Calendar: 3,
|
|
2029
|
-
Event: 4
|
|
2029
|
+
Event: 4,
|
|
2030
|
+
Participant: 5,
|
|
2031
|
+
User: 6
|
|
2030
2032
|
};
|
|
2031
|
-
var SCOPE_NAMES = ["Global", "Consumer", "Company", "Calendar", "Event"];
|
|
2033
|
+
var SCOPE_NAMES = ["Global", "Consumer", "Company", "Calendar", "Event", "Participant", "User"];
|
|
2032
2034
|
var PreferenceModel = import_mobx_state_tree17.types.model("Preference", {
|
|
2033
2035
|
id: import_mobx_state_tree17.types.optional(import_mobx_state_tree17.types.maybeNull(import_mobx_state_tree17.types.number), null),
|
|
2034
2036
|
preferenceId: import_mobx_state_tree17.types.optional(import_mobx_state_tree17.types.maybeNull(import_mobx_state_tree17.types.string), null),
|
|
@@ -2426,6 +2428,14 @@ var LeadModel = import_mobx_state_tree19.types.model("Lead", {
|
|
|
2426
2428
|
if (!self.companyKey) return null;
|
|
2427
2429
|
return LeadModel.getByCompany(self.companyKey, opts);
|
|
2428
2430
|
},
|
|
2431
|
+
/** POST /lead/columns/save – saves user column selection to Preference (scope User). */
|
|
2432
|
+
async saveColumnSelection(userId, columns) {
|
|
2433
|
+
return LeadModel.saveColumnSelection(userId, columns);
|
|
2434
|
+
},
|
|
2435
|
+
/** GET /lead/columns/get – reads saved column selection for a user. */
|
|
2436
|
+
async getColumnSelection(userId) {
|
|
2437
|
+
return LeadModel.getColumnSelection(userId);
|
|
2438
|
+
},
|
|
2429
2439
|
/** POST /lead/create – create this lead */
|
|
2430
2440
|
async createLead() {
|
|
2431
2441
|
const payload = {
|
|
@@ -2514,10 +2524,41 @@ LeadModel.getByPhone = async (phone, companyKey) => {
|
|
|
2514
2524
|
}
|
|
2515
2525
|
return null;
|
|
2516
2526
|
};
|
|
2527
|
+
LeadModel.allowedColumns = [
|
|
2528
|
+
"id",
|
|
2529
|
+
"lead_id",
|
|
2530
|
+
"email",
|
|
2531
|
+
"name",
|
|
2532
|
+
"phone",
|
|
2533
|
+
"company_key",
|
|
2534
|
+
"source",
|
|
2535
|
+
"lead_type",
|
|
2536
|
+
"referrer_link",
|
|
2537
|
+
"created_on",
|
|
2538
|
+
"modified_on"
|
|
2539
|
+
];
|
|
2540
|
+
LeadModel.saveColumnSelection = async (userId, columns) => {
|
|
2541
|
+
const uid = userId != null ? String(userId).trim() : "";
|
|
2542
|
+
if (!uid) return { status: "failure", message: "userId required" };
|
|
2543
|
+
const cols = Array.isArray(columns) ? columns.map((c) => String(c).trim()).filter(Boolean) : [];
|
|
2544
|
+
if (!cols.length) return { status: "failure", message: "columns required" };
|
|
2545
|
+
const { reqPost } = createRequestHelpersFromEnv(getConfig());
|
|
2546
|
+
return reqPost("/lead/columns/save", { user_id: uid, columns: cols });
|
|
2547
|
+
};
|
|
2548
|
+
LeadModel.getColumnSelection = async (userId) => {
|
|
2549
|
+
const uid = userId != null ? String(userId).trim() : "";
|
|
2550
|
+
if (!uid) return { status: "failure", message: "userId required" };
|
|
2551
|
+
const { reqGet } = createRequestHelpersFromEnv(getConfig());
|
|
2552
|
+
return reqGet("/lead/columns/get", { user_id: uid });
|
|
2553
|
+
};
|
|
2517
2554
|
LeadModel.getByCompany = async (companyKey, opts = {}) => {
|
|
2518
2555
|
var _a, _b;
|
|
2519
2556
|
const { reqGet } = createRequestHelpersFromEnv(getConfig());
|
|
2520
2557
|
const query = { company_key: companyKey };
|
|
2558
|
+
const userId = opts.userId ?? opts.user_id;
|
|
2559
|
+
if (userId != null && String(userId).trim() !== "") {
|
|
2560
|
+
query.user_id = String(userId).trim();
|
|
2561
|
+
}
|
|
2521
2562
|
const sortBy = opts.sortBy ?? opts.sort ?? opts.sort_column;
|
|
2522
2563
|
if (sortBy != null && sortBy !== "") query.sort = sortBy;
|
|
2523
2564
|
const sortOrderRaw = opts.sortOrder ?? opts.sort_dir;
|
package/dist/index.mjs
CHANGED
|
@@ -1955,9 +1955,11 @@ var PreferenceScope = {
|
|
|
1955
1955
|
Consumer: 1,
|
|
1956
1956
|
Company: 2,
|
|
1957
1957
|
Calendar: 3,
|
|
1958
|
-
Event: 4
|
|
1958
|
+
Event: 4,
|
|
1959
|
+
Participant: 5,
|
|
1960
|
+
User: 6
|
|
1959
1961
|
};
|
|
1960
|
-
var SCOPE_NAMES = ["Global", "Consumer", "Company", "Calendar", "Event"];
|
|
1962
|
+
var SCOPE_NAMES = ["Global", "Consumer", "Company", "Calendar", "Event", "Participant", "User"];
|
|
1961
1963
|
var PreferenceModel = types17.model("Preference", {
|
|
1962
1964
|
id: types17.optional(types17.maybeNull(types17.number), null),
|
|
1963
1965
|
preferenceId: types17.optional(types17.maybeNull(types17.string), null),
|
|
@@ -2355,6 +2357,14 @@ var LeadModel = types19.model("Lead", {
|
|
|
2355
2357
|
if (!self.companyKey) return null;
|
|
2356
2358
|
return LeadModel.getByCompany(self.companyKey, opts);
|
|
2357
2359
|
},
|
|
2360
|
+
/** POST /lead/columns/save – saves user column selection to Preference (scope User). */
|
|
2361
|
+
async saveColumnSelection(userId, columns) {
|
|
2362
|
+
return LeadModel.saveColumnSelection(userId, columns);
|
|
2363
|
+
},
|
|
2364
|
+
/** GET /lead/columns/get – reads saved column selection for a user. */
|
|
2365
|
+
async getColumnSelection(userId) {
|
|
2366
|
+
return LeadModel.getColumnSelection(userId);
|
|
2367
|
+
},
|
|
2358
2368
|
/** POST /lead/create – create this lead */
|
|
2359
2369
|
async createLead() {
|
|
2360
2370
|
const payload = {
|
|
@@ -2443,10 +2453,41 @@ LeadModel.getByPhone = async (phone, companyKey) => {
|
|
|
2443
2453
|
}
|
|
2444
2454
|
return null;
|
|
2445
2455
|
};
|
|
2456
|
+
LeadModel.allowedColumns = [
|
|
2457
|
+
"id",
|
|
2458
|
+
"lead_id",
|
|
2459
|
+
"email",
|
|
2460
|
+
"name",
|
|
2461
|
+
"phone",
|
|
2462
|
+
"company_key",
|
|
2463
|
+
"source",
|
|
2464
|
+
"lead_type",
|
|
2465
|
+
"referrer_link",
|
|
2466
|
+
"created_on",
|
|
2467
|
+
"modified_on"
|
|
2468
|
+
];
|
|
2469
|
+
LeadModel.saveColumnSelection = async (userId, columns) => {
|
|
2470
|
+
const uid = userId != null ? String(userId).trim() : "";
|
|
2471
|
+
if (!uid) return { status: "failure", message: "userId required" };
|
|
2472
|
+
const cols = Array.isArray(columns) ? columns.map((c) => String(c).trim()).filter(Boolean) : [];
|
|
2473
|
+
if (!cols.length) return { status: "failure", message: "columns required" };
|
|
2474
|
+
const { reqPost } = createRequestHelpersFromEnv(getConfig());
|
|
2475
|
+
return reqPost("/lead/columns/save", { user_id: uid, columns: cols });
|
|
2476
|
+
};
|
|
2477
|
+
LeadModel.getColumnSelection = async (userId) => {
|
|
2478
|
+
const uid = userId != null ? String(userId).trim() : "";
|
|
2479
|
+
if (!uid) return { status: "failure", message: "userId required" };
|
|
2480
|
+
const { reqGet } = createRequestHelpersFromEnv(getConfig());
|
|
2481
|
+
return reqGet("/lead/columns/get", { user_id: uid });
|
|
2482
|
+
};
|
|
2446
2483
|
LeadModel.getByCompany = async (companyKey, opts = {}) => {
|
|
2447
2484
|
var _a, _b;
|
|
2448
2485
|
const { reqGet } = createRequestHelpersFromEnv(getConfig());
|
|
2449
2486
|
const query = { company_key: companyKey };
|
|
2487
|
+
const userId = opts.userId ?? opts.user_id;
|
|
2488
|
+
if (userId != null && String(userId).trim() !== "") {
|
|
2489
|
+
query.user_id = String(userId).trim();
|
|
2490
|
+
}
|
|
2450
2491
|
const sortBy = opts.sortBy ?? opts.sort ?? opts.sort_column;
|
|
2451
2492
|
if (sortBy != null && sortBy !== "") query.sort = sortBy;
|
|
2452
2493
|
const sortOrderRaw = opts.sortOrder ?? opts.sort_dir;
|