heartraite 1.0.22 → 1.0.24

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.
@@ -4,3 +4,9 @@ export declare enum CASkipReason {
4
4
  DONT_KNOW = "dont_know",
5
5
  OTHER_REASON = "other_reason"
6
6
  }
7
+ export declare enum CAStatus {
8
+ NOT_STARTED = "not started",
9
+ IN_PROGRESS = "in progress",
10
+ ERROR = "error",
11
+ SUCCESS = "success"
12
+ }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CASkipReason = void 0;
3
+ exports.CAStatus = exports.CASkipReason = void 0;
4
4
  var CASkipReason;
5
5
  (function (CASkipReason) {
6
6
  CASkipReason["NOT_RELEVANT"] = "not_relevant";
@@ -8,3 +8,10 @@ var CASkipReason;
8
8
  CASkipReason["DONT_KNOW"] = "dont_know";
9
9
  CASkipReason["OTHER_REASON"] = "other_reason";
10
10
  })(CASkipReason || (exports.CASkipReason = CASkipReason = {}));
11
+ var CAStatus;
12
+ (function (CAStatus) {
13
+ CAStatus["NOT_STARTED"] = "not started";
14
+ CAStatus["IN_PROGRESS"] = "in progress";
15
+ CAStatus["ERROR"] = "error";
16
+ CAStatus["SUCCESS"] = "success";
17
+ })(CAStatus || (exports.CAStatus = CAStatus = {}));
@@ -17,6 +17,7 @@ export declare enum CloudFunction {
17
17
  GET_MATCHABLE_USERS = "match/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",
@@ -21,6 +21,7 @@ var CloudFunction;
21
21
  CloudFunction["GET_MATCHABLE_USERS"] = "match/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";
@@ -4,9 +4,3 @@ export declare enum AdvancedMatchStatus {
4
4
  ERROR = "error",
5
5
  SUCCESS = "success"
6
6
  }
7
- export declare enum CACompletionStatus {
8
- NOT_STARTED = "not started",
9
- IN_PROGRESS = "in progress",
10
- ERROR = "error",
11
- SUCCESS = "success"
12
- }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CACompletionStatus = exports.AdvancedMatchStatus = void 0;
3
+ exports.AdvancedMatchStatus = void 0;
4
4
  var AdvancedMatchStatus;
5
5
  (function (AdvancedMatchStatus) {
6
6
  AdvancedMatchStatus["INITIAL"] = "initial";
@@ -8,10 +8,3 @@ var AdvancedMatchStatus;
8
8
  AdvancedMatchStatus["ERROR"] = "error";
9
9
  AdvancedMatchStatus["SUCCESS"] = "success";
10
10
  })(AdvancedMatchStatus || (exports.AdvancedMatchStatus = AdvancedMatchStatus = {}));
11
- var CACompletionStatus;
12
- (function (CACompletionStatus) {
13
- CACompletionStatus["NOT_STARTED"] = "not started";
14
- CACompletionStatus["IN_PROGRESS"] = "in progress";
15
- CACompletionStatus["ERROR"] = "error";
16
- CACompletionStatus["SUCCESS"] = "success";
17
- })(CACompletionStatus || (exports.CACompletionStatus = CACompletionStatus = {}));
@@ -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,8 @@
1
1
  import { Answer, CategoryEvaluation } from "./submission.types";
2
2
  type QuestionId = string;
3
3
  type CategoryId = string;
4
+ type ScoreAmount = number;
5
+ export type Score = Record<QuestionId, ScoreAmount>;
4
6
  export type CA = {
5
7
  created: string;
6
8
  userId: string;
@@ -8,4 +10,9 @@ export type CA = {
8
10
  answers: Record<QuestionId, Answer>;
9
11
  categoryEvaluations?: Record<CategoryId, CategoryEvaluation>;
10
12
  };
13
+ export type CAScore = {
14
+ created: string;
15
+ userId: string;
16
+ scores: Score;
17
+ };
11
18
  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;
@@ -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;
@@ -41,9 +41,10 @@ export type CreateLikeResponse = {
41
41
  };
42
42
  export type GetLikesResponse = Like[];
43
43
  export type HandleLikeSeenResponse = void;
44
+ export type CalculatePLSScoreResponse = FullAssessment;
44
45
  export type CreatePLSInputResponse = void;
45
46
  export type CreatePLSAssessmentResponse = Assessment;
46
- export type GetPLSAssessmentResponse = Assessment;
47
+ export type GetPLSAssessmentResponse = FullAssessment;
47
48
  export type GetPLSAssessmentsResponse = FullAssessment[];
48
49
  export type CreatePLSSubmissionResponse = Submission;
49
50
  export type GetPLSSubmissionResponse = Submission;
@@ -1,4 +1,4 @@
1
- import { CACompletionStatus, Gender, NotificationSetting, UserLanguage } from "../enum";
1
+ import { CAStatus, Gender, NotificationSetting, UserLanguage } from "../enum";
2
2
  export type User = {
3
3
  id: string;
4
4
  email: string;
@@ -11,7 +11,7 @@ export type User = {
11
11
  status: UserStatus;
12
12
  };
13
13
  export type UserStatus = {
14
- caCompletionStatus: CACompletionStatus;
14
+ caStatus: CAStatus;
15
15
  };
16
16
  export type UserSettings = {
17
17
  language: UserLanguage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "heartraite",
3
- "version": "1.0.22",
3
+ "version": "1.0.24",
4
4
  "description": "Heartraite npm package for common functionality",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -4,3 +4,10 @@ export enum CASkipReason {
4
4
  DONT_KNOW = "dont_know",
5
5
  OTHER_REASON = "other_reason",
6
6
  }
7
+
8
+ export enum CAStatus {
9
+ NOT_STARTED = "not started",
10
+ IN_PROGRESS = "in progress",
11
+ ERROR = "error",
12
+ SUCCESS = "success",
13
+ }
@@ -17,6 +17,7 @@ export enum CloudFunction {
17
17
  GET_MATCHABLE_USERS = "match/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",
@@ -4,10 +4,3 @@ export enum AdvancedMatchStatus {
4
4
  ERROR = "error",
5
5
  SUCCESS = "success",
6
6
  }
7
-
8
- export enum CACompletionStatus {
9
- NOT_STARTED = "not started",
10
- IN_PROGRESS = "in progress",
11
- ERROR = "error",
12
- SUCCESS = "success",
13
- }
@@ -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,9 @@ import { Answer, CategoryEvaluation } from "./submission.types";
2
2
 
3
3
  type QuestionId = string;
4
4
  type CategoryId = string;
5
+ type ScoreAmount = number;
6
+
7
+ export type Score = Record<QuestionId, ScoreAmount>;
5
8
 
6
9
  export type CA = {
7
10
  created: string;
@@ -10,3 +13,9 @@ export type CA = {
10
13
  answers: Record<QuestionId, Answer>;
11
14
  categoryEvaluations?: Record<CategoryId, CategoryEvaluation>;
12
15
  };
16
+
17
+ export type CAScore = {
18
+ created: string;
19
+ userId: string;
20
+ scores: Score;
21
+ };
@@ -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;
@@ -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;
@@ -54,9 +54,10 @@ export type GetLikesResponse = Like[];
54
54
  export type HandleLikeSeenResponse = void;
55
55
 
56
56
  // pls
57
+ export type CalculatePLSScoreResponse = FullAssessment;
57
58
  export type CreatePLSInputResponse = void;
58
59
  export type CreatePLSAssessmentResponse = Assessment;
59
- export type GetPLSAssessmentResponse = Assessment;
60
+ export type GetPLSAssessmentResponse = FullAssessment;
60
61
  export type GetPLSAssessmentsResponse = FullAssessment[];
61
62
  export type CreatePLSSubmissionResponse = Submission;
62
63
  export type GetPLSSubmissionResponse = Submission;
@@ -1,9 +1,4 @@
1
- import {
2
- CACompletionStatus,
3
- Gender,
4
- NotificationSetting,
5
- UserLanguage,
6
- } from "../enum";
1
+ import { CAStatus, Gender, NotificationSetting, UserLanguage } from "../enum";
7
2
 
8
3
  export type User = {
9
4
  id: string;
@@ -18,7 +13,7 @@ export type User = {
18
13
  };
19
14
 
20
15
  export type UserStatus = {
21
- caCompletionStatus: CACompletionStatus;
16
+ caStatus: CAStatus;
22
17
  };
23
18
 
24
19
  export type UserSettings = {