@sprucelabs/spruce-invite-utils 3.4.3 → 4.0.0

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.
@@ -1,8 +1,9 @@
1
- import { PromptForLoginAndConfirmOptions } from '../../loggingInAndConfirmingJoin/LoginAndConfirmJoinController';
1
+ import { LoginAndConfirmJoinOptions, PromptForLoginAndConfirmOptions } from '../../loggingInAndConfirmingJoin/LoginAndConfirmJoinController';
2
2
  export default class LoginAndConfirmTestFixture {
3
3
  private static hitCount;
4
4
  private static wasBeforeEachCalled;
5
5
  static lastPromptOptions?: PromptForLoginAndConfirmOptions;
6
+ static lastFactoryOptions?: LoginAndConfirmJoinOptions;
6
7
  static beforeEach(): void;
7
8
  static getHitCount(): number;
8
9
  private static assertBeforeEachWasCalled;
@@ -1,10 +1,7 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  const test_1 = require("@sprucelabs/test");
7
- const LoginAndConfirmJoinController_1 = __importDefault(require("../../loggingInAndConfirmingJoin/LoginAndConfirmJoinController"));
4
+ const LoginAndConfirmJoinController_1 = require("../../loggingInAndConfirmingJoin/LoginAndConfirmJoinController");
8
5
  class LoginAndConfirmTestFixture {
9
6
  static beforeEach() {
10
7
  this.setClass(CountingLoginAndConfirmController);
@@ -26,13 +23,16 @@ class LoginAndConfirmTestFixture {
26
23
  this.setClass(Class);
27
24
  }
28
25
  static setClass(Class) {
29
- LoginAndConfirmJoinController_1.default.setClass(Class);
26
+ LoginAndConfirmJoinController_1.LoginAndConfirmJoinControllerFactory.setClass(Class);
30
27
  }
31
28
  }
32
29
  exports.default = LoginAndConfirmTestFixture;
33
30
  LoginAndConfirmTestFixture.hitCount = 0;
34
31
  LoginAndConfirmTestFixture.wasBeforeEachCalled = false;
35
32
  class CountingLoginAndConfirmController {
33
+ constructor(options) {
34
+ LoginAndConfirmTestFixture.lastFactoryOptions = options;
35
+ }
36
36
  async promptForLoginAndConfirmJoin(options) {
37
37
  //@ts-ignore
38
38
  LoginAndConfirmTestFixture.hitCount++;
@@ -1,8 +1,9 @@
1
- import { PromptForLoginAndConfirmOptions } from '../../loggingInAndConfirmingJoin/LoginAndConfirmJoinController';
1
+ import { LoginAndConfirmJoinOptions, PromptForLoginAndConfirmOptions } from '../../loggingInAndConfirmingJoin/LoginAndConfirmJoinController';
2
2
  export default class LoginAndConfirmTestFixture {
3
3
  private static hitCount;
4
4
  private static wasBeforeEachCalled;
5
5
  static lastPromptOptions?: PromptForLoginAndConfirmOptions;
6
+ static lastFactoryOptions?: LoginAndConfirmJoinOptions;
6
7
  static beforeEach(): void;
7
8
  static getHitCount(): number;
8
9
  private static assertBeforeEachWasCalled;
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { assert } from '@sprucelabs/test';
11
- import LoginAndConfirmJoinControllerImpl from '../../loggingInAndConfirmingJoin/LoginAndConfirmJoinController.js';
11
+ import { LoginAndConfirmJoinControllerFactory, } from '../../loggingInAndConfirmingJoin/LoginAndConfirmJoinController.js';
12
12
  export default class LoginAndConfirmTestFixture {
13
13
  static beforeEach() {
14
14
  this.setClass(CountingLoginAndConfirmController);
@@ -30,12 +30,15 @@ export default class LoginAndConfirmTestFixture {
30
30
  this.setClass(Class);
31
31
  }
32
32
  static setClass(Class) {
33
- LoginAndConfirmJoinControllerImpl.setClass(Class);
33
+ LoginAndConfirmJoinControllerFactory.setClass(Class);
34
34
  }
35
35
  }
36
36
  LoginAndConfirmTestFixture.hitCount = 0;
37
37
  LoginAndConfirmTestFixture.wasBeforeEachCalled = false;
38
38
  class CountingLoginAndConfirmController {
39
+ constructor(options) {
40
+ LoginAndConfirmTestFixture.lastFactoryOptions = options;
41
+ }
39
42
  promptForLoginAndConfirmJoin(options) {
40
43
  return __awaiter(this, void 0, void 0, function* () {
41
44
  //@ts-ignore
@@ -1,5 +1,5 @@
1
1
  export { default as buildRouteToCreateInvite } from './sending/buildRouteToCreateInvite';
2
- export { default as LoginAndConfirmJoinController } from './loggingInAndConfirmingJoin/LoginAndConfirmJoinController';
2
+ export { default as LoginAndConfirmJoinControllerImpl } from './loggingInAndConfirmingJoin/LoginAndConfirmJoinController';
3
3
  export * from './loggingInAndConfirmingJoin/LoginAndConfirmJoinController';
4
4
  export { default as LoginAndConfirmTestFixture } from './__tests__/support/LoginAndConfirmTestFixture';
5
5
  export * from './__tests__/support/LoginAndConfirmTestFixture';
@@ -1,5 +1,5 @@
1
1
  export { default as buildRouteToCreateInvite } from './sending/buildRouteToCreateInvite.js';
2
- export { default as LoginAndConfirmJoinController } from './loggingInAndConfirmingJoin/LoginAndConfirmJoinController.js';
2
+ export { default as LoginAndConfirmJoinControllerImpl } from './loggingInAndConfirmingJoin/LoginAndConfirmJoinController.js';
3
3
  export * from './loggingInAndConfirmingJoin/LoginAndConfirmJoinController.js';
4
4
  export { default as LoginAndConfirmTestFixture } from './__tests__/support/LoginAndConfirmTestFixture.js';
5
5
  export * from './__tests__/support/LoginAndConfirmTestFixture.js';
@@ -1,19 +1,21 @@
1
- import { Authenticator, CardViewControllerImpl, SpruceSchemas, ViewControllerFactory } from '@sprucelabs/heartwood-view-controllers';
1
+ import { Authenticator, CardViewControllerImpl, ViewControllerFactory } from '@sprucelabs/heartwood-view-controllers';
2
2
  import { MercuryClient } from '@sprucelabs/mercury-client';
3
+ export declare class LoginAndConfirmJoinControllerFactory {
4
+ private static Class?;
5
+ static setClass(Class?: LoginAndConfirmJoinConstructor): void;
6
+ static Controller(options: LoginAndConfirmJoinOptions): LoginAndConfirmJoinController;
7
+ }
3
8
  export default class LoginAndConfirmJoinControllerImpl implements LoginAndConfirmJoinController {
4
9
  private views;
5
10
  protected vc: CardViewControllerImpl;
6
11
  private authenticator;
7
12
  private dialog?;
8
- private static Class?;
9
13
  private organizationId;
10
14
  private connectToApi;
11
15
  private client;
12
16
  private locationId?;
13
17
  private confirmJoinContext?;
14
- protected constructor(options: LoginAndConfirmJoinOptions);
15
- static setClass(Class?: new () => LoginAndConfirmJoinController): void;
16
- static Controller(options: LoginAndConfirmJoinOptions): LoginAndConfirmJoinController;
18
+ constructor(options: LoginAndConfirmJoinOptions);
17
19
  promptForLoginAndConfirmJoin(options?: PromptForLoginAndConfirmOptions): Promise<boolean>;
18
20
  private listRoles;
19
21
  private confirmTheJoin;
@@ -27,9 +29,11 @@ export interface LoginAndConfirmJoinOptions {
27
29
  locationId?: string;
28
30
  connectToApi: ConnectToApi;
29
31
  }
30
- export declare type LoginAndConfirmJoinConstructor = new () => LoginAndConfirmJoinController;
32
+ export declare type LoginAndConfirmJoinConstructor = new (options: LoginAndConfirmJoinOptions) => LoginAndConfirmJoinController;
31
33
  declare type ConnectToApi = () => Promise<MercuryClient>;
32
- export declare type InviteViewContext = SpruceSchemas.Invite.v2021_12_16.InviteViewContext;
34
+ export interface InviteViewContext {
35
+ roleName?: string | undefined | null;
36
+ }
33
37
  export interface PromptForLoginAndConfirmOptions {
34
38
  confirmJoinViewContext?: InviteViewContext;
35
39
  }
@@ -9,16 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { assertOptions } from '@sprucelabs/schema';
11
11
  import ConfirmJoinCardViewController from '../accepting/ConfirmJoinCard.vc.js';
12
- export default class LoginAndConfirmJoinControllerImpl {
13
- constructor(options) {
14
- const { views, authenticator, organizationId, connectToApi, locationId } = options;
15
- this.views = views;
16
- this.authenticator = authenticator;
17
- this.organizationId = organizationId;
18
- this.connectToApi = connectToApi;
19
- this.locationId = locationId;
20
- this.vc = this.views.Controller('card', {});
21
- }
12
+ export class LoginAndConfirmJoinControllerFactory {
22
13
  static setClass(Class) {
23
14
  this.Class = Class;
24
15
  }
@@ -33,7 +24,18 @@ export default class LoginAndConfirmJoinControllerImpl {
33
24
  if (!views.hasController('invite.confirm-join-card')) {
34
25
  views.setController('invite.confirm-join-card', ConfirmJoinCardViewController);
35
26
  }
36
- return new ((_a = this.Class) !== null && _a !== void 0 ? _a : this)(options);
27
+ return new ((_a = this.Class) !== null && _a !== void 0 ? _a : LoginAndConfirmJoinControllerImpl)(options);
28
+ }
29
+ }
30
+ export default class LoginAndConfirmJoinControllerImpl {
31
+ constructor(options) {
32
+ const { views, authenticator, organizationId, connectToApi, locationId } = options;
33
+ this.views = views;
34
+ this.authenticator = authenticator;
35
+ this.organizationId = organizationId;
36
+ this.connectToApi = connectToApi;
37
+ this.locationId = locationId;
38
+ this.vc = this.views.Controller('card', {});
37
39
  }
38
40
  promptForLoginAndConfirmJoin(options) {
39
41
  return __awaiter(this, void 0, void 0, function* () {
@@ -1,5 +1,5 @@
1
1
  export { default as buildRouteToCreateInvite } from './sending/buildRouteToCreateInvite';
2
- export { default as LoginAndConfirmJoinController } from './loggingInAndConfirmingJoin/LoginAndConfirmJoinController';
2
+ export { default as LoginAndConfirmJoinControllerImpl } from './loggingInAndConfirmingJoin/LoginAndConfirmJoinController';
3
3
  export * from './loggingInAndConfirmingJoin/LoginAndConfirmJoinController';
4
4
  export { default as LoginAndConfirmTestFixture } from './__tests__/support/LoginAndConfirmTestFixture';
5
5
  export * from './__tests__/support/LoginAndConfirmTestFixture';
@@ -17,11 +17,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.LoginAndConfirmTestFixture = exports.LoginAndConfirmJoinController = exports.buildRouteToCreateInvite = void 0;
20
+ exports.LoginAndConfirmTestFixture = exports.LoginAndConfirmJoinControllerImpl = exports.buildRouteToCreateInvite = void 0;
21
21
  var buildRouteToCreateInvite_1 = require("./sending/buildRouteToCreateInvite");
22
22
  Object.defineProperty(exports, "buildRouteToCreateInvite", { enumerable: true, get: function () { return __importDefault(buildRouteToCreateInvite_1).default; } });
23
23
  var LoginAndConfirmJoinController_1 = require("./loggingInAndConfirmingJoin/LoginAndConfirmJoinController");
24
- Object.defineProperty(exports, "LoginAndConfirmJoinController", { enumerable: true, get: function () { return __importDefault(LoginAndConfirmJoinController_1).default; } });
24
+ Object.defineProperty(exports, "LoginAndConfirmJoinControllerImpl", { enumerable: true, get: function () { return __importDefault(LoginAndConfirmJoinController_1).default; } });
25
25
  __exportStar(require("./loggingInAndConfirmingJoin/LoginAndConfirmJoinController"), exports);
26
26
  var LoginAndConfirmTestFixture_1 = require("./__tests__/support/LoginAndConfirmTestFixture");
27
27
  Object.defineProperty(exports, "LoginAndConfirmTestFixture", { enumerable: true, get: function () { return __importDefault(LoginAndConfirmTestFixture_1).default; } });
@@ -1,19 +1,21 @@
1
- import { Authenticator, CardViewControllerImpl, SpruceSchemas, ViewControllerFactory } from '@sprucelabs/heartwood-view-controllers';
1
+ import { Authenticator, CardViewControllerImpl, ViewControllerFactory } from '@sprucelabs/heartwood-view-controllers';
2
2
  import { MercuryClient } from '@sprucelabs/mercury-client';
3
+ export declare class LoginAndConfirmJoinControllerFactory {
4
+ private static Class?;
5
+ static setClass(Class?: LoginAndConfirmJoinConstructor): void;
6
+ static Controller(options: LoginAndConfirmJoinOptions): LoginAndConfirmJoinController;
7
+ }
3
8
  export default class LoginAndConfirmJoinControllerImpl implements LoginAndConfirmJoinController {
4
9
  private views;
5
10
  protected vc: CardViewControllerImpl;
6
11
  private authenticator;
7
12
  private dialog?;
8
- private static Class?;
9
13
  private organizationId;
10
14
  private connectToApi;
11
15
  private client;
12
16
  private locationId?;
13
17
  private confirmJoinContext?;
14
- protected constructor(options: LoginAndConfirmJoinOptions);
15
- static setClass(Class?: new () => LoginAndConfirmJoinController): void;
16
- static Controller(options: LoginAndConfirmJoinOptions): LoginAndConfirmJoinController;
18
+ constructor(options: LoginAndConfirmJoinOptions);
17
19
  promptForLoginAndConfirmJoin(options?: PromptForLoginAndConfirmOptions): Promise<boolean>;
18
20
  private listRoles;
19
21
  private confirmTheJoin;
@@ -27,9 +29,11 @@ export interface LoginAndConfirmJoinOptions {
27
29
  locationId?: string;
28
30
  connectToApi: ConnectToApi;
29
31
  }
30
- export declare type LoginAndConfirmJoinConstructor = new () => LoginAndConfirmJoinController;
32
+ export declare type LoginAndConfirmJoinConstructor = new (options: LoginAndConfirmJoinOptions) => LoginAndConfirmJoinController;
31
33
  declare type ConnectToApi = () => Promise<MercuryClient>;
32
- export declare type InviteViewContext = SpruceSchemas.Invite.v2021_12_16.InviteViewContext;
34
+ export interface InviteViewContext {
35
+ roleName?: string | undefined | null;
36
+ }
33
37
  export interface PromptForLoginAndConfirmOptions {
34
38
  confirmJoinViewContext?: InviteViewContext;
35
39
  }
@@ -3,18 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.LoginAndConfirmJoinControllerFactory = void 0;
6
7
  const schema_1 = require("@sprucelabs/schema");
7
8
  const ConfirmJoinCard_vc_1 = __importDefault(require("../accepting/ConfirmJoinCard.vc"));
8
- class LoginAndConfirmJoinControllerImpl {
9
- constructor(options) {
10
- const { views, authenticator, organizationId, connectToApi, locationId } = options;
11
- this.views = views;
12
- this.authenticator = authenticator;
13
- this.organizationId = organizationId;
14
- this.connectToApi = connectToApi;
15
- this.locationId = locationId;
16
- this.vc = this.views.Controller('card', {});
17
- }
9
+ class LoginAndConfirmJoinControllerFactory {
18
10
  static setClass(Class) {
19
11
  this.Class = Class;
20
12
  }
@@ -29,7 +21,19 @@ class LoginAndConfirmJoinControllerImpl {
29
21
  if (!views.hasController('invite.confirm-join-card')) {
30
22
  views.setController('invite.confirm-join-card', ConfirmJoinCard_vc_1.default);
31
23
  }
32
- return new ((_a = this.Class) !== null && _a !== void 0 ? _a : this)(options);
24
+ return new ((_a = this.Class) !== null && _a !== void 0 ? _a : LoginAndConfirmJoinControllerImpl)(options);
25
+ }
26
+ }
27
+ exports.LoginAndConfirmJoinControllerFactory = LoginAndConfirmJoinControllerFactory;
28
+ class LoginAndConfirmJoinControllerImpl {
29
+ constructor(options) {
30
+ const { views, authenticator, organizationId, connectToApi, locationId } = options;
31
+ this.views = views;
32
+ this.authenticator = authenticator;
33
+ this.organizationId = organizationId;
34
+ this.connectToApi = connectToApi;
35
+ this.locationId = locationId;
36
+ this.vc = this.views.Controller('card', {});
33
37
  }
34
38
  async promptForLoginAndConfirmJoin(options) {
35
39
  this.client = await this.connectToApi();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sprucelabs/spruce-invite-utils",
3
3
  "description": "Invite Utilities",
4
- "version": "3.4.3",
4
+ "version": "4.0.0",
5
5
  "skill": {
6
6
  "namespace": "invite"
7
7
  },