heartraite 1.0.23 → 1.0.25

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.
@@ -11,12 +11,13 @@ export declare enum CloudFunction {
11
11
  GET_MATCH = "match/get-match",
12
12
  HANDLE_MATCH_SEEN = "match/handle-match-seen",
13
13
  GET_MATCHES = "match/get-matches",
14
- GET_MATCH_CHECK = "match/get-match-check",
15
14
  REMOVE_MATCH = "match/remove-match",
16
- GET_MATCHABLE_USER = "match/get-matchable-user",
17
- GET_MATCHABLE_USERS = "match/get-matchable-users",
15
+ GET_MATCH_CHECK = "matchmaking/get-match-check",
16
+ GET_MATCHABLE_USER = "matchmaking/get-matchable-user",
17
+ GET_MATCHABLE_USERS = "matchmaking/get-matchable-users",
18
18
  SEND_MESSAGE = "message/send-message",
19
19
  GET_MESSAGES = "message/get-messages",
20
+ CALCULATE_PLS_SCORE = "pls/calculate-score",
20
21
  CREATE_PLS_INPUT = "pls/create-input",
21
22
  CREATE_PLS_ASSESSMENT = "pls/create-assessment",
22
23
  GET_PLS_ASSESSMENT = "pls/get-assessment",
@@ -15,12 +15,13 @@ var CloudFunction;
15
15
  CloudFunction["GET_MATCH"] = "match/get-match";
16
16
  CloudFunction["HANDLE_MATCH_SEEN"] = "match/handle-match-seen";
17
17
  CloudFunction["GET_MATCHES"] = "match/get-matches";
18
- CloudFunction["GET_MATCH_CHECK"] = "match/get-match-check";
19
18
  CloudFunction["REMOVE_MATCH"] = "match/remove-match";
20
- CloudFunction["GET_MATCHABLE_USER"] = "match/get-matchable-user";
21
- CloudFunction["GET_MATCHABLE_USERS"] = "match/get-matchable-users";
19
+ CloudFunction["GET_MATCH_CHECK"] = "matchmaking/get-match-check";
20
+ CloudFunction["GET_MATCHABLE_USER"] = "matchmaking/get-matchable-user";
21
+ CloudFunction["GET_MATCHABLE_USERS"] = "matchmaking/get-matchable-users";
22
22
  CloudFunction["SEND_MESSAGE"] = "message/send-message";
23
23
  CloudFunction["GET_MESSAGES"] = "message/get-messages";
24
+ CloudFunction["CALCULATE_PLS_SCORE"] = "pls/calculate-score";
24
25
  CloudFunction["CREATE_PLS_INPUT"] = "pls/create-input";
25
26
  CloudFunction["CREATE_PLS_ASSESSMENT"] = "pls/create-assessment";
26
27
  CloudFunction["GET_PLS_ASSESSMENT"] = "pls/get-assessment";
@@ -1,4 +1,6 @@
1
+ import { PLSScore } from "./pls.types";
1
2
  import { Submission } from "./submission.types";
3
+ type SubmissionId = string;
2
4
  export type Assessment = {
3
5
  id: string;
4
6
  created: string;
@@ -8,4 +10,6 @@ export type Assessment = {
8
10
  };
9
11
  export type FullAssessment = Assessment & {
10
12
  submissions: Submission[];
13
+ scores?: Record<SubmissionId, PLSScore>;
11
14
  };
15
+ export {};
@@ -1,6 +1,6 @@
1
1
  import { CloudFunction } from "../enum";
2
- import { AddImagesRequest, AuthenticateBankIDRequest, CollectBankIDRequest, CreateBillingPortalRequest, CreateCheckoutSessionRequest, CreateLikeRequest, CreatePLSAssessmentRequest, CreatePLSInputRequest, CreatePLSSubmissionRequest, CreateReportRequest, GetCARequest, GetMatchableUserRequest, GetMatchCheckRequest, GetMatchesRequest, GetMatchRequest, GetMessagesRequest, GetPLSAssessmentRequest, GetPLSSubmissionRequest, GetProductsRequest, GetUserRequest, HandleLikeSeenRequest, HandleMatchSeenRequest, RegisterOnboardingRequest, RegisterUserRequest, RemoveMatchRequest, SendMessageRequest, SubmitAnswerRequest, SubmitCategoryFeedbackRequest, SubmitPLSCategoryFeedbackRequest, UpdatePLSAnswerRequest, UpdateQuestionsRequest, UpdateUserRequest } from "./request.types";
3
- import { AddImagesResponse, AuthenticateBankIDResponse, CollectBankIDResponse, CreateBillingPortalResponse, CreateCheckoutSessionResponse, CreateLikeResponse, CreatePLSAssessmentResponse, CreatePLSInputResponse, CreatePLSSubmissionResponse, CreateReportResponse, GetCAResponse, GetMatchableUserResponse, GetMatchableUsersResponse, GetMatchCheckResponse, GetMatchesResponse, GetMatchResponse, GetMessagesResponse, GetPLSAssessmentResponse, GetPLSAssessmentsResponse, GetPLSSubmissionResponse, GetProductsResponse, GetUserResponse, HandleLikeSeenResponse, HandleMatchSeenResponse, RegisterOnboardingResponse, RegisterUserResponse, RemoveMatchResponse, SendMessageResponse, SubmitAnswerResponse, SubmitCategoryFeedbackResponse, SubmitPLSCategoryFeedbackResponse, UpdatePLSAnswerResponse, UpdateQuestionsResponse, UpdateUserResponse } from "./response.types";
2
+ import { AddImagesRequest, AuthenticateBankIDRequest, CalculatePLSScoreRequest, CollectBankIDRequest, CreateBillingPortalRequest, CreateCheckoutSessionRequest, CreateLikeRequest, CreatePLSAssessmentRequest, CreatePLSInputRequest, CreatePLSSubmissionRequest, CreateReportRequest, GetCARequest, GetMatchableUserRequest, GetMatchCheckRequest, GetMatchesRequest, GetMatchRequest, GetMessagesRequest, GetPLSAssessmentRequest, GetPLSSubmissionRequest, GetProductsRequest, GetUserRequest, HandleLikeSeenRequest, HandleMatchSeenRequest, RegisterOnboardingRequest, RegisterUserRequest, RemoveMatchRequest, SendMessageRequest, SubmitAnswerRequest, SubmitCategoryFeedbackRequest, SubmitPLSCategoryFeedbackRequest, UpdatePLSAnswerRequest, UpdateQuestionsRequest, UpdateUserRequest } from "./request.types";
3
+ import { AddImagesResponse, AuthenticateBankIDResponse, CalculatePLSScoreResponse, CollectBankIDResponse, CreateBillingPortalResponse, CreateCheckoutSessionResponse, CreateLikeResponse, CreatePLSAssessmentResponse, CreatePLSInputResponse, CreatePLSSubmissionResponse, CreateReportResponse, GetCAResponse, GetMatchableUserResponse, GetMatchableUsersResponse, GetMatchCheckResponse, GetMatchesResponse, GetMatchResponse, GetMessagesResponse, GetPLSAssessmentResponse, GetPLSAssessmentsResponse, GetPLSSubmissionResponse, GetProductsResponse, GetUserResponse, HandleLikeSeenResponse, HandleMatchSeenResponse, RegisterOnboardingResponse, RegisterUserResponse, RemoveMatchResponse, SendMessageResponse, SubmitAnswerResponse, SubmitCategoryFeedbackResponse, SubmitPLSCategoryFeedbackResponse, UpdatePLSAnswerResponse, UpdateQuestionsResponse, UpdateUserResponse } from "./response.types";
4
4
  export type CloudFunctionTypes = {
5
5
  [CloudFunction.REGISTER_USER]: {
6
6
  payload: RegisterUserRequest;
@@ -74,6 +74,10 @@ export type CloudFunctionTypes = {
74
74
  payload: GetMessagesRequest;
75
75
  response: GetMessagesResponse;
76
76
  };
77
+ [CloudFunction.CALCULATE_PLS_SCORE]: {
78
+ payload: CalculatePLSScoreRequest;
79
+ response: CalculatePLSScoreResponse;
80
+ };
77
81
  [CloudFunction.CREATE_PLS_INPUT]: {
78
82
  payload: CreatePLSInputRequest;
79
83
  response: CreatePLSInputResponse;
@@ -5,6 +5,7 @@ export * from "./error.types";
5
5
  export * from "./helper.types";
6
6
  export * from "./like.types";
7
7
  export * from "./match.types";
8
+ export * from "./matchmaking.types";
8
9
  export * from "./message.types";
9
10
  export * from "./request.types";
10
11
  export * from "./report.types";
@@ -21,6 +21,7 @@ __exportStar(require("./error.types"), exports);
21
21
  __exportStar(require("./helper.types"), exports);
22
22
  __exportStar(require("./like.types"), exports);
23
23
  __exportStar(require("./match.types"), exports);
24
+ __exportStar(require("./matchmaking.types"), exports);
24
25
  __exportStar(require("./message.types"), exports);
25
26
  __exportStar(require("./request.types"), exports);
26
27
  __exportStar(require("./report.types"), exports);
@@ -1,7 +1,5 @@
1
- import { LikeType } from "../enum";
2
1
  import { AdvancedMatchStatus } from "../enum/match.enum";
3
2
  import { RatedQuestions } from "./rating.types";
4
- import { UserProfile } from "./user.types";
5
3
  export type Match = {
6
4
  id: string;
7
5
  users: Record<string, boolean>;
@@ -21,26 +19,6 @@ interface StrengthOrWeakness {
21
19
  title: string;
22
20
  summary: string;
23
21
  }
24
- export type MatchStatus = {
25
- likeType?: LikeType;
26
- advancedMatchStatus?: AdvancedMatchStatus;
27
- };
28
- export type MatchData = {
29
- percentages: Record<string, number>;
30
- totalPercentage: number;
31
- isMatch: boolean;
32
- };
33
- export type MatchableUser = {
34
- matchId?: string;
35
- conversationId?: string;
36
- profile: UserProfile;
37
- matchData: MatchData;
38
- matchStatus: MatchStatus;
39
- };
40
- export type MatchCheck = {
41
- profile: UserProfile;
42
- matchData: MatchData;
43
- };
44
22
  export type UserMatch = {
45
23
  matchId: string;
46
24
  userId: string;
@@ -0,0 +1,23 @@
1
+ import { AdvancedMatchStatus, LikeType } from "../enum";
2
+ import { UserProfile } from "./user.types";
3
+ export type MatchableUser = {
4
+ matchId?: string;
5
+ conversationId?: string;
6
+ distance: number;
7
+ profile: UserProfile;
8
+ compatibility: MatchCompatibility;
9
+ matchStatus: MatchStatus;
10
+ };
11
+ export type MatchStatus = {
12
+ isMatch: boolean;
13
+ likeType?: LikeType;
14
+ advancedMatchStatus?: AdvancedMatchStatus;
15
+ };
16
+ export type MatchCompatibility = {
17
+ categoryPercentages: Record<string, number>;
18
+ totalPercentage: number;
19
+ };
20
+ export type MatchCheck = {
21
+ profile: UserProfile;
22
+ compatibility: MatchCompatibility;
23
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +1,4 @@
1
+ import { Score } from "./ca.types";
1
2
  export type PLS = {
2
3
  id: string;
3
4
  questionnaire: Record<string, string>;
@@ -6,3 +7,10 @@ export type PLS = {
6
7
  variation: string;
7
8
  created: string;
8
9
  };
10
+ export type PLSScore = {
11
+ assessmentId: string;
12
+ submissionId: string;
13
+ created: string;
14
+ scores: Score;
15
+ summary: string;
16
+ };
@@ -62,6 +62,9 @@ export type GetMatchableUserRequest = {
62
62
  export type GetMatchCheckRequest = {
63
63
  userId: string;
64
64
  };
65
+ export type CalculatePLSScoreRequest = {
66
+ assessmentId: string;
67
+ };
65
68
  export type CreatePLSInputRequest = {
66
69
  questionnaire: Record<string, string>;
67
70
  channelId: string;
@@ -1,6 +1,7 @@
1
1
  import { Assessment, FullAssessment } from "./assessment.types";
2
2
  import { Submission, CategoryEvaluation } from "./submission.types";
3
- import { Match, MatchableUser, MatchCheck, UserMatch } from "./match.types";
3
+ import { Match, UserMatch } from "./match.types";
4
+ import { MatchableUser, MatchCheck } from "./matchmaking.types";
4
5
  import { Message } from "./message.types";
5
6
  import { StripeProduct } from "./stripe.types";
6
7
  import { User } from "./user.types";
@@ -41,6 +42,7 @@ export type CreateLikeResponse = {
41
42
  };
42
43
  export type GetLikesResponse = Like[];
43
44
  export type HandleLikeSeenResponse = void;
45
+ export type CalculatePLSScoreResponse = FullAssessment;
44
46
  export type CreatePLSInputResponse = void;
45
47
  export type CreatePLSAssessmentResponse = Assessment;
46
48
  export type GetPLSAssessmentResponse = FullAssessment;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "heartraite",
3
- "version": "1.0.23",
3
+ "version": "1.0.25",
4
4
  "description": "Heartraite npm package for common functionality",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -11,12 +11,13 @@ export enum CloudFunction {
11
11
  GET_MATCH = "match/get-match",
12
12
  HANDLE_MATCH_SEEN = "match/handle-match-seen",
13
13
  GET_MATCHES = "match/get-matches",
14
- GET_MATCH_CHECK = "match/get-match-check",
15
14
  REMOVE_MATCH = "match/remove-match",
16
- GET_MATCHABLE_USER = "match/get-matchable-user",
17
- GET_MATCHABLE_USERS = "match/get-matchable-users",
15
+ GET_MATCH_CHECK = "matchmaking/get-match-check",
16
+ GET_MATCHABLE_USER = "matchmaking/get-matchable-user",
17
+ GET_MATCHABLE_USERS = "matchmaking/get-matchable-users",
18
18
  SEND_MESSAGE = "message/send-message",
19
19
  GET_MESSAGES = "message/get-messages",
20
+ CALCULATE_PLS_SCORE = "pls/calculate-score",
20
21
  CREATE_PLS_INPUT = "pls/create-input",
21
22
  CREATE_PLS_ASSESSMENT = "pls/create-assessment",
22
23
  GET_PLS_ASSESSMENT = "pls/get-assessment",
@@ -1,5 +1,8 @@
1
+ import { PLSScore } from "./pls.types";
1
2
  import { Submission } from "./submission.types";
2
3
 
4
+ type SubmissionId = string;
5
+
3
6
  export type Assessment = {
4
7
  id: string;
5
8
  created: string;
@@ -10,4 +13,5 @@ export type Assessment = {
10
13
 
11
14
  export type FullAssessment = Assessment & {
12
15
  submissions: Submission[];
16
+ scores?: Record<SubmissionId, PLSScore>;
13
17
  };
@@ -2,6 +2,7 @@ import { CloudFunction } from "../enum";
2
2
  import {
3
3
  AddImagesRequest,
4
4
  AuthenticateBankIDRequest,
5
+ CalculatePLSScoreRequest,
5
6
  CollectBankIDRequest,
6
7
  CreateBillingPortalRequest,
7
8
  CreateCheckoutSessionRequest,
@@ -36,6 +37,7 @@ import {
36
37
  import {
37
38
  AddImagesResponse,
38
39
  AuthenticateBankIDResponse,
40
+ CalculatePLSScoreResponse,
39
41
  CollectBankIDResponse,
40
42
  CreateBillingPortalResponse,
41
43
  CreateCheckoutSessionResponse,
@@ -157,6 +159,10 @@ export type CloudFunctionTypes = {
157
159
  };
158
160
 
159
161
  // pls
162
+ [CloudFunction.CALCULATE_PLS_SCORE]: {
163
+ payload: CalculatePLSScoreRequest;
164
+ response: CalculatePLSScoreResponse;
165
+ };
160
166
  [CloudFunction.CREATE_PLS_INPUT]: {
161
167
  payload: CreatePLSInputRequest;
162
168
  response: CreatePLSInputResponse;
@@ -5,6 +5,7 @@ export * from "./error.types";
5
5
  export * from "./helper.types";
6
6
  export * from "./like.types";
7
7
  export * from "./match.types";
8
+ export * from "./matchmaking.types";
8
9
  export * from "./message.types";
9
10
  export * from "./request.types";
10
11
  export * from "./report.types";
@@ -1,7 +1,5 @@
1
- import { LikeType } from "../enum";
2
1
  import { AdvancedMatchStatus } from "../enum/match.enum";
3
2
  import { RatedQuestions } from "./rating.types";
4
- import { UserProfile } from "./user.types";
5
3
 
6
4
  export type Match = {
7
5
  id: string;
@@ -25,30 +23,6 @@ interface StrengthOrWeakness {
25
23
  summary: string;
26
24
  }
27
25
 
28
- export type MatchStatus = {
29
- likeType?: LikeType;
30
- advancedMatchStatus?: AdvancedMatchStatus;
31
- };
32
-
33
- export type MatchData = {
34
- percentages: Record<string, number>;
35
- totalPercentage: number;
36
- isMatch: boolean;
37
- };
38
-
39
- export type MatchableUser = {
40
- matchId?: string;
41
- conversationId?: string;
42
- profile: UserProfile;
43
- matchData: MatchData;
44
- matchStatus: MatchStatus;
45
- };
46
-
47
- export type MatchCheck = {
48
- profile: UserProfile;
49
- matchData: MatchData;
50
- };
51
-
52
26
  export type UserMatch = {
53
27
  matchId: string;
54
28
  userId: string;
@@ -0,0 +1,27 @@
1
+ import { AdvancedMatchStatus, LikeType } from "../enum";
2
+ import { UserProfile } from "./user.types";
3
+
4
+ export type MatchableUser = {
5
+ matchId?: string;
6
+ conversationId?: string;
7
+ distance: number;
8
+ profile: UserProfile;
9
+ compatibility: MatchCompatibility;
10
+ matchStatus: MatchStatus;
11
+ };
12
+
13
+ export type MatchStatus = {
14
+ isMatch: boolean;
15
+ likeType?: LikeType;
16
+ advancedMatchStatus?: AdvancedMatchStatus;
17
+ };
18
+
19
+ export type MatchCompatibility = {
20
+ categoryPercentages: Record<string, number>;
21
+ totalPercentage: number;
22
+ };
23
+
24
+ export type MatchCheck = {
25
+ profile: UserProfile;
26
+ compatibility: MatchCompatibility;
27
+ };
@@ -1,3 +1,5 @@
1
+ import { Score } from "./ca.types";
2
+
1
3
  export type PLS = {
2
4
  id: string;
3
5
  questionnaire: Record<string, string>;
@@ -6,3 +8,11 @@ export type PLS = {
6
8
  variation: string;
7
9
  created: string;
8
10
  };
11
+
12
+ export type PLSScore = {
13
+ assessmentId: string;
14
+ submissionId: string;
15
+ created: string;
16
+ scores: Score;
17
+ summary: string;
18
+ };
@@ -57,6 +57,9 @@ export type GetMatchableUserRequest = { userId: string };
57
57
  export type GetMatchCheckRequest = { userId: string };
58
58
 
59
59
  // pls
60
+ export type CalculatePLSScoreRequest = {
61
+ assessmentId: string;
62
+ };
60
63
  export type CreatePLSInputRequest = {
61
64
  questionnaire: Record<string, string>;
62
65
  channelId: string;
@@ -1,6 +1,7 @@
1
1
  import { Assessment, FullAssessment } from "./assessment.types";
2
2
  import { Submission, CategoryEvaluation } from "./submission.types";
3
- import { Match, MatchableUser, MatchCheck, UserMatch } from "./match.types";
3
+ import { Match, UserMatch } from "./match.types";
4
+ import { MatchableUser, MatchCheck } from "./matchmaking.types";
4
5
  import { Message } from "./message.types";
5
6
  import { StripeProduct } from "./stripe.types";
6
7
  import { User } from "./user.types";
@@ -54,6 +55,7 @@ export type GetLikesResponse = Like[];
54
55
  export type HandleLikeSeenResponse = void;
55
56
 
56
57
  // pls
58
+ export type CalculatePLSScoreResponse = FullAssessment;
57
59
  export type CreatePLSInputResponse = void;
58
60
  export type CreatePLSAssessmentResponse = Assessment;
59
61
  export type GetPLSAssessmentResponse = FullAssessment;