@blazeo.com/calendar-client 1.0.10 → 1.0.12

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 CHANGED
@@ -85,6 +85,7 @@ export const ParticipantModel: {
85
85
  update(payload: object): Promise<unknown>;
86
86
  save(payload: object): Promise<unknown>;
87
87
  sendEmail(participantId: string): Promise<unknown>;
88
+ migrate(participantId: string, userId: string): Promise<unknown>;
88
89
  create(snapshot: object, options?: { env?: object }): unknown;
89
90
  };
90
91
  export const OpeningHourModel: { create(snapshot: object, options?: { env?: object }): unknown };
package/dist/index.js CHANGED
@@ -551,16 +551,20 @@ EventModel.getByVisitorPhone = async (phone, opts = {}) => {
551
551
  }
552
552
  return null;
553
553
  };
554
- EventModel.getByDateRangeWithFilters = async (startDateFrom, startDateTo, opts = {}) => {
554
+ EventModel.getByDateRangeWithFilters = async (companyKey, startDateFrom, startDateTo, opts = {}) => {
555
+ if (companyKey == null || String(companyKey).trim() === "") {
556
+ throw new Error("companyKey required");
557
+ }
555
558
  const { reqGet } = createRequestHelpersFromEnv(getConfig());
556
559
  const query = {
560
+ company_key: String(companyKey).trim(),
557
561
  start_date_from: startDateFrom,
558
562
  start_date_to: startDateTo
559
563
  };
560
564
  const offset = opts.offset ?? getDefaultOffset();
561
- if (opts.companyKey != null && opts.companyKey !== "") query.company_key = opts.companyKey;
562
565
  if (opts.calendarId != null && opts.calendarId !== "") query.calendar_id = opts.calendarId;
563
566
  if (opts.participantId != null && opts.participantId !== "") query.participant_id = opts.participantId;
567
+ if (opts.leadId != null && opts.leadId !== "") query.lead_id = opts.leadId;
564
568
  if (opts.visitorName != null && opts.visitorName !== "") query.visitor_name = opts.visitorName;
565
569
  if (opts.visitorEmail != null && opts.visitorEmail !== "") query.visitor_email = opts.visitorEmail;
566
570
  if (opts.visitorPhone != null && opts.visitorPhone !== "") query.visitor_phone = opts.visitorPhone;
@@ -1260,6 +1264,10 @@ var ParticipantModel = import_mobx_state_tree11.types.model("Participant", {
1260
1264
  async sendEmail() {
1261
1265
  return reqGet("/participant/sendemail", { participant_id: self.participantId });
1262
1266
  },
1267
+ /** POST participant/migrate – migrate this participant id to user id */
1268
+ async migrate(userId) {
1269
+ return reqPost("/participant/migrate", {}, { participant_id: self.participantId, user_id: userId });
1270
+ },
1263
1271
  /** GET participant/calendars/get – calendars for this participant (paged) */
1264
1272
  async getCalendars(opts = {}) {
1265
1273
  var _a, _b, _c, _d;
@@ -1403,6 +1411,10 @@ ParticipantModel.sendEmail = async (participantId) => {
1403
1411
  const { reqGet } = createRequestHelpersFromEnv(getConfig());
1404
1412
  return reqGet("/participant/sendemail", { participant_id: participantId });
1405
1413
  };
1414
+ ParticipantModel.migrate = async (participantId, userId) => {
1415
+ const { reqPost } = createRequestHelpersFromEnv(getConfig());
1416
+ return reqPost("/participant/migrate", {}, { participant_id: participantId, user_id: userId });
1417
+ };
1406
1418
  ParticipantModel.getCalendars = async (participantId, opts = {}) => {
1407
1419
  var _a, _b, _c, _d;
1408
1420
  const { reqGet } = createRequestHelpersFromEnv(getConfig());
package/dist/index.mjs CHANGED
@@ -498,16 +498,20 @@ EventModel.getByVisitorPhone = async (phone, opts = {}) => {
498
498
  }
499
499
  return null;
500
500
  };
501
- EventModel.getByDateRangeWithFilters = async (startDateFrom, startDateTo, opts = {}) => {
501
+ EventModel.getByDateRangeWithFilters = async (companyKey, startDateFrom, startDateTo, opts = {}) => {
502
+ if (companyKey == null || String(companyKey).trim() === "") {
503
+ throw new Error("companyKey required");
504
+ }
502
505
  const { reqGet } = createRequestHelpersFromEnv(getConfig());
503
506
  const query = {
507
+ company_key: String(companyKey).trim(),
504
508
  start_date_from: startDateFrom,
505
509
  start_date_to: startDateTo
506
510
  };
507
511
  const offset = opts.offset ?? getDefaultOffset();
508
- if (opts.companyKey != null && opts.companyKey !== "") query.company_key = opts.companyKey;
509
512
  if (opts.calendarId != null && opts.calendarId !== "") query.calendar_id = opts.calendarId;
510
513
  if (opts.participantId != null && opts.participantId !== "") query.participant_id = opts.participantId;
514
+ if (opts.leadId != null && opts.leadId !== "") query.lead_id = opts.leadId;
511
515
  if (opts.visitorName != null && opts.visitorName !== "") query.visitor_name = opts.visitorName;
512
516
  if (opts.visitorEmail != null && opts.visitorEmail !== "") query.visitor_email = opts.visitorEmail;
513
517
  if (opts.visitorPhone != null && opts.visitorPhone !== "") query.visitor_phone = opts.visitorPhone;
@@ -1207,6 +1211,10 @@ var ParticipantModel = types11.model("Participant", {
1207
1211
  async sendEmail() {
1208
1212
  return reqGet("/participant/sendemail", { participant_id: self.participantId });
1209
1213
  },
1214
+ /** POST participant/migrate – migrate this participant id to user id */
1215
+ async migrate(userId) {
1216
+ return reqPost("/participant/migrate", {}, { participant_id: self.participantId, user_id: userId });
1217
+ },
1210
1218
  /** GET participant/calendars/get – calendars for this participant (paged) */
1211
1219
  async getCalendars(opts = {}) {
1212
1220
  var _a, _b, _c, _d;
@@ -1350,6 +1358,10 @@ ParticipantModel.sendEmail = async (participantId) => {
1350
1358
  const { reqGet } = createRequestHelpersFromEnv(getConfig());
1351
1359
  return reqGet("/participant/sendemail", { participant_id: participantId });
1352
1360
  };
1361
+ ParticipantModel.migrate = async (participantId, userId) => {
1362
+ const { reqPost } = createRequestHelpersFromEnv(getConfig());
1363
+ return reqPost("/participant/migrate", {}, { participant_id: participantId, user_id: userId });
1364
+ };
1353
1365
  ParticipantModel.getCalendars = async (participantId, opts = {}) => {
1354
1366
  var _a, _b, _c, _d;
1355
1367
  const { reqGet } = createRequestHelpersFromEnv(getConfig());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blazeo.com/calendar-client",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "description": "Blazeo Calendar / Appointment API client with MobX State Tree models",
5
5
  "exports": {
6
6
  ".": {
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "homepage": "https://github.com/blazeo-com/calendar-client#readme",
28
28
  "publishConfig": {
29
- "access": "restricted"
29
+ "access": "public"
30
30
  },
31
31
  "dependencies": {
32
32
  "mobx": "^6.10.0",