@blazeo.com/calendar-client 1.0.57 → 1.0.58

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
@@ -509,6 +509,21 @@ export const LeadModel: {
509
509
  create(snapshot?: object, options?: { env?: object }): unknown;
510
510
  };
511
511
 
512
+ export const AuthorizationSource: {
513
+ None: 0;
514
+ Direct: 1;
515
+ Email: 2;
516
+ };
517
+
518
+ export type ParticipantCredentialsData = {
519
+ participantCredentialId?: string;
520
+ participantId: string;
521
+ email?: string;
522
+ authorizedByParticipantId?: string | null;
523
+ authorizationSource?: number | null;
524
+ authorizedOn?: string | null;
525
+ };
526
+
512
527
  export type CalendarProviderOption = {
513
528
  emailProvider: number;
514
529
  key: string;
@@ -558,8 +573,14 @@ export type ParticipantData = {
558
573
  createdOn?: string | null;
559
574
  modifiedOn?: string | null;
560
575
  isDeleted?: boolean;
561
- /** Last stored authorization error; populated by Auth/IsAuthorized when not authorized. */
576
+ /** Last stored authorization error from ParticipantCredentials. */
562
577
  authorizationError?: string;
578
+ /** Participant who initiated calendar authorization (in-app flow). */
579
+ authorizedByParticipantId?: string | null;
580
+ /** 1 = Direct, 2 = Email — from ParticipantCredentials. */
581
+ authorizationSource?: number | null;
582
+ /** When calendar OAuth last completed successfully. */
583
+ authorizedOn?: string | null;
563
584
  };
564
585
 
565
586
  export const CALENDAR_AUTH_MESSAGE_TYPE: 'calendar-authorization';
@@ -581,7 +602,7 @@ export const AuthModel: {
581
602
  getAuthorizationUrl(
582
603
  participantId: string,
583
604
  emailProvider: string | number,
584
- opts?: { host?: string }
605
+ opts?: { host?: string; authorizedByParticipantId?: string }
585
606
  ): Promise<{
586
607
  status: string;
587
608
  data?: ParticipantAuthorizationUrl;
package/dist/index.js CHANGED
@@ -26,6 +26,7 @@ __export(index_exports, {
26
26
  AssignmentMethod: () => AssignmentMethod,
27
27
  AttendeeStatus: () => AttendeeStatus,
28
28
  AuthModel: () => Auth_default,
29
+ AuthorizationSource: () => AuthorizationSource,
29
30
  AvailabilityDetailModel: () => AvailabilityDetail_default,
30
31
  AvailabilityModel: () => Availability_default,
31
32
  CALENDAR_AUTH_MESSAGE_TYPE: () => CALENDAR_AUTH_MESSAGE_TYPE,
@@ -376,6 +377,11 @@ var EmailProvider = {
376
377
  Microsoft: 2,
377
378
  Default: 3
378
379
  };
380
+ var AuthorizationSource = {
381
+ None: 0,
382
+ Direct: 1,
383
+ Email: 2
384
+ };
379
385
  var LocationType = {
380
386
  Physical: 0,
381
387
  Video: 1,
@@ -1566,7 +1572,11 @@ var ParticipantModel = import_mobx_state_tree11.types.model("Participant", {
1566
1572
  provider: import_mobx_state_tree11.types.optional(import_mobx_state_tree11.types.number, 0),
1567
1573
  createdOn: import_mobx_state_tree11.types.optional(import_mobx_state_tree11.types.maybeNull(import_mobx_state_tree11.types.string), null),
1568
1574
  modifiedOn: import_mobx_state_tree11.types.optional(import_mobx_state_tree11.types.maybeNull(import_mobx_state_tree11.types.string), null),
1569
- isDeleted: import_mobx_state_tree11.types.optional(import_mobx_state_tree11.types.boolean, false)
1575
+ isDeleted: import_mobx_state_tree11.types.optional(import_mobx_state_tree11.types.boolean, false),
1576
+ authorizationError: import_mobx_state_tree11.types.optional(import_mobx_state_tree11.types.string, ""),
1577
+ authorizedByParticipantId: import_mobx_state_tree11.types.optional(import_mobx_state_tree11.types.maybeNull(import_mobx_state_tree11.types.string), null),
1578
+ authorizationSource: import_mobx_state_tree11.types.optional(import_mobx_state_tree11.types.maybeNull(import_mobx_state_tree11.types.number), null),
1579
+ authorizedOn: import_mobx_state_tree11.types.optional(import_mobx_state_tree11.types.maybeNull(import_mobx_state_tree11.types.string), null)
1570
1580
  }).actions((self) => {
1571
1581
  const { reqGet, reqPost } = createRequestHelpers(self, import_mobx_state_tree11.getEnv);
1572
1582
  return {
@@ -1660,7 +1670,20 @@ function mapParticipantFromApi(d) {
1660
1670
  createdOn: pick2("createdOn", "CreatedOn", "created_on") ?? null,
1661
1671
  modifiedOn: pick2("modifiedOn", "ModifiedOn", "modified_on") ?? null,
1662
1672
  isDeleted: Boolean(pick2("isDeleted", "IsDeleted", "is_deleted")),
1663
- authorizationError: pick2("authorizationError", "AuthorizationError", "authorization_error") ?? ""
1673
+ authorizationError: pick2("authorizationError", "AuthorizationError", "authorization_error") ?? "",
1674
+ authorizedByParticipantId: (() => {
1675
+ const v = pick2(
1676
+ "authorizedByParticipantId",
1677
+ "AuthorizedByParticipantId",
1678
+ "authorized_by_participant_id"
1679
+ );
1680
+ return v != null && v !== "" ? String(v) : null;
1681
+ })(),
1682
+ authorizationSource: (() => {
1683
+ const v = pick2("authorizationSource", "AuthorizationSource", "authorization_source");
1684
+ return v != null && v !== "" ? Number(v) : null;
1685
+ })(),
1686
+ authorizedOn: pick2("authorizedOn", "AuthorizedOn", "authorized_on") ?? null
1664
1687
  };
1665
1688
  }
1666
1689
  function mapFromApi2(d) {
@@ -3386,7 +3409,7 @@ var AuthModel = {
3386
3409
  * GET Auth/AuthorizationUrl — OAuth URL to open in a popup when user picks a provider.
3387
3410
  * @param {string} participantId
3388
3411
  * @param {string|number} emailProvider — google, gmail, 1, outlook, microsoft, 2
3389
- * @param {{ host?: string }} [opts]
3412
+ * @param {{ host?: string, authorizedByParticipantId?: string }} [opts]
3390
3413
  * @returns {Promise<{ status: string, data?: object, message?: string }>}
3391
3414
  */
3392
3415
  async getAuthorizationUrl(participantId, emailProvider, opts = {}) {
@@ -3396,6 +3419,9 @@ var AuthModel = {
3396
3419
  email_provider: String(emailProvider)
3397
3420
  };
3398
3421
  if (opts.host) q.host = opts.host;
3422
+ if (opts.authorizedByParticipantId) {
3423
+ q.authorized_by_participant_id = String(opts.authorizedByParticipantId);
3424
+ }
3399
3425
  const res = await reqGet("/Auth/AuthorizationUrl", q);
3400
3426
  if (res.status === "success" && res.data) {
3401
3427
  res.data = mapAuthorizationUrlFromApi(res.data);
@@ -3510,6 +3536,7 @@ function createRootStore(initialState = {}) {
3510
3536
  AssignmentMethod,
3511
3537
  AttendeeStatus,
3512
3538
  AuthModel,
3539
+ AuthorizationSource,
3513
3540
  AvailabilityDetailModel,
3514
3541
  AvailabilityModel,
3515
3542
  CALENDAR_AUTH_MESSAGE_TYPE,
package/dist/index.mjs CHANGED
@@ -298,6 +298,11 @@ var EmailProvider = {
298
298
  Microsoft: 2,
299
299
  Default: 3
300
300
  };
301
+ var AuthorizationSource = {
302
+ None: 0,
303
+ Direct: 1,
304
+ Email: 2
305
+ };
301
306
  var LocationType = {
302
307
  Physical: 0,
303
308
  Video: 1,
@@ -1488,7 +1493,11 @@ var ParticipantModel = types11.model("Participant", {
1488
1493
  provider: types11.optional(types11.number, 0),
1489
1494
  createdOn: types11.optional(types11.maybeNull(types11.string), null),
1490
1495
  modifiedOn: types11.optional(types11.maybeNull(types11.string), null),
1491
- isDeleted: types11.optional(types11.boolean, false)
1496
+ isDeleted: types11.optional(types11.boolean, false),
1497
+ authorizationError: types11.optional(types11.string, ""),
1498
+ authorizedByParticipantId: types11.optional(types11.maybeNull(types11.string), null),
1499
+ authorizationSource: types11.optional(types11.maybeNull(types11.number), null),
1500
+ authorizedOn: types11.optional(types11.maybeNull(types11.string), null)
1492
1501
  }).actions((self) => {
1493
1502
  const { reqGet, reqPost } = createRequestHelpers(self, getEnv3);
1494
1503
  return {
@@ -1582,7 +1591,20 @@ function mapParticipantFromApi(d) {
1582
1591
  createdOn: pick2("createdOn", "CreatedOn", "created_on") ?? null,
1583
1592
  modifiedOn: pick2("modifiedOn", "ModifiedOn", "modified_on") ?? null,
1584
1593
  isDeleted: Boolean(pick2("isDeleted", "IsDeleted", "is_deleted")),
1585
- authorizationError: pick2("authorizationError", "AuthorizationError", "authorization_error") ?? ""
1594
+ authorizationError: pick2("authorizationError", "AuthorizationError", "authorization_error") ?? "",
1595
+ authorizedByParticipantId: (() => {
1596
+ const v = pick2(
1597
+ "authorizedByParticipantId",
1598
+ "AuthorizedByParticipantId",
1599
+ "authorized_by_participant_id"
1600
+ );
1601
+ return v != null && v !== "" ? String(v) : null;
1602
+ })(),
1603
+ authorizationSource: (() => {
1604
+ const v = pick2("authorizationSource", "AuthorizationSource", "authorization_source");
1605
+ return v != null && v !== "" ? Number(v) : null;
1606
+ })(),
1607
+ authorizedOn: pick2("authorizedOn", "AuthorizedOn", "authorized_on") ?? null
1586
1608
  };
1587
1609
  }
1588
1610
  function mapFromApi2(d) {
@@ -3308,7 +3330,7 @@ var AuthModel = {
3308
3330
  * GET Auth/AuthorizationUrl — OAuth URL to open in a popup when user picks a provider.
3309
3331
  * @param {string} participantId
3310
3332
  * @param {string|number} emailProvider — google, gmail, 1, outlook, microsoft, 2
3311
- * @param {{ host?: string }} [opts]
3333
+ * @param {{ host?: string, authorizedByParticipantId?: string }} [opts]
3312
3334
  * @returns {Promise<{ status: string, data?: object, message?: string }>}
3313
3335
  */
3314
3336
  async getAuthorizationUrl(participantId, emailProvider, opts = {}) {
@@ -3318,6 +3340,9 @@ var AuthModel = {
3318
3340
  email_provider: String(emailProvider)
3319
3341
  };
3320
3342
  if (opts.host) q.host = opts.host;
3343
+ if (opts.authorizedByParticipantId) {
3344
+ q.authorized_by_participant_id = String(opts.authorizedByParticipantId);
3345
+ }
3321
3346
  const res = await reqGet("/Auth/AuthorizationUrl", q);
3322
3347
  if (res.status === "success" && res.data) {
3323
3348
  res.data = mapAuthorizationUrlFromApi(res.data);
@@ -3431,6 +3456,7 @@ export {
3431
3456
  AssignmentMethod,
3432
3457
  AttendeeStatus,
3433
3458
  Auth_default as AuthModel,
3459
+ AuthorizationSource,
3434
3460
  AvailabilityDetail_default as AvailabilityDetailModel,
3435
3461
  Availability_default as AvailabilityModel,
3436
3462
  CALENDAR_AUTH_MESSAGE_TYPE,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blazeo.com/calendar-client",
3
- "version": "1.0.57",
3
+ "version": "1.0.58",
4
4
  "description": "Blazeo Calendar / Appointment API client with MobX State Tree models",
5
5
  "exports": {
6
6
  ".": {