heartraite 1.0.1

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.
@@ -0,0 +1,34 @@
1
+ name: Publish to npm
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ publish:
10
+ runs-on: ubuntu-latest
11
+
12
+ steps:
13
+ - name: Checkout repository
14
+ uses: actions/checkout@v2
15
+
16
+ - name: Set up Node.js
17
+ uses: actions/setup-node@v3
18
+ with:
19
+ node-version: "20"
20
+
21
+ - name: Install dependencies
22
+ run: npm install
23
+
24
+ - name: Increment version
25
+ run: node version-bump.js
26
+
27
+ - name: Authenticate with npm
28
+ run: npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
29
+
30
+ - name: Build TypeScript
31
+ run: npm run build
32
+
33
+ - name: Publish to npm
34
+ run: npm publish --access public
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # heartraite-npm
2
+
3
+ NPM package containing common functionality for Heartraite
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "heartraite",
3
+ "version": "1.0.1",
4
+ "description": "Heartraite npm package for common functionality",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "rootDir": "src",
8
+ "scripts": {
9
+ "build": "rm -rf ./dist && tsc",
10
+ "test": "jest"
11
+ },
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/agottfredsson/heartraite-npm.git"
15
+ },
16
+ "author": "Anton Gottfredsson",
17
+ "license": "ISC",
18
+ "bugs": {
19
+ "url": "https://github.com/agottfredsson/heartraite-npm/issues"
20
+ },
21
+ "homepage": "https://github.com/agottfredsson/heartraite-npm#readme",
22
+ "peerDependencies": {
23
+ "firebase": "^11.0.1"
24
+ },
25
+ "devDependencies": {
26
+ "@types/node": "^22.9.0",
27
+ "typescript": "^5.6.3",
28
+ "firebase": "^11.0.1"
29
+ }
30
+ }
@@ -0,0 +1,6 @@
1
+ export enum AiVerificationStatus {
2
+ PENDING = "pending",
3
+ ERROR = "error",
4
+ SUCCESS = "success",
5
+ ACTION_REQUIRED = "action required",
6
+ }
@@ -0,0 +1,30 @@
1
+ export enum AppRoute {
2
+ START = "start",
3
+ LOGIN = "login",
4
+ REGISTER = "register",
5
+ DISCOVER = "discover",
6
+ PROFILE = "profile",
7
+ MATCH = "match",
8
+ MESSAGES = "messages",
9
+ MATCHES = "matches",
10
+ SETTINGS = "settings",
11
+ ACOUNT_SETTINGS = "account_settings",
12
+ MATCH_SETTINGS = "match_settings",
13
+ MEMBERSHIP = "membership",
14
+ USER_PROFILE = "user_profile",
15
+ BLOG = "blog",
16
+ QUESTIONS = "questions",
17
+ CHAT = "chat",
18
+ SUBSCRIPTIONS = "membership",
19
+ NOTIFICATIONS = "notifications",
20
+ QUESTION = "question",
21
+ IMAGES = "images",
22
+ IMAGES_MODAL = "image_modal",
23
+ ADVANCED_MATCH = "advanced_match",
24
+ SUPPORT = "common_questions",
25
+ IMAGE_MODAL_REGISTRATION = "image_modal_registration",
26
+ GENERAL = "general",
27
+ MATCH_SCANNER = "match_scanner",
28
+ MATCH_CHECK = "match_check",
29
+ PROFILE_INPUT = "profile_input",
30
+ }
@@ -0,0 +1,34 @@
1
+ export enum CloudFunction {
2
+ CREATE_ASSESSMENT = "assessment/create-assessment",
3
+ GET_ASSESSMENT = "assessment/get-assessment",
4
+ GET_ASSESSMENTS = "assessment/get-assessments",
5
+ CREATE_SUBMISSION = "assessment/create-submission",
6
+ GET_SUBMISSION = "assessment/get-submission",
7
+ UPDATE_ANSWER = "assessment/update-answer",
8
+ SUBMIT_CATEGORY_FEEDBACK = "assessment/submit-category-feedback",
9
+ AUTHENTICATE_BANKID = "bankid/authenticate",
10
+ COLLECT_BANKID = "bankid/collect",
11
+ CREATE_LIKE = "like/create-like",
12
+ GET_LIKES = "like/get-likes",
13
+ HANDLE_LIKE_SEEN = "like/handle-like-seen",
14
+ GET_MATCH = "match/get-match",
15
+ HANDLE_MATCH_SEEN = "match/handle-match-seen",
16
+ GET_MATCHES = "match/get-matches",
17
+ GET_MATCH_CHECK = "match/get-match-check",
18
+ REMOVE_MATCH = "match/remove-match",
19
+ GET_MATCHABLE_USER = "match/get-matchable-user",
20
+ GET_MATCHABLE_USERS = "match/get-matchable-users",
21
+ SEND_MESSAGE = "message/send-message",
22
+ GET_MESSAGES = "message/get-messages",
23
+ CREATE_PLS = "pls/create-pls",
24
+ UPDATE_QUESTIONS = "rating/update-quesitons",
25
+ CREATE_REPORT = "report/create-report",
26
+ ADD_IMAGES = "storage/add-images",
27
+ GET_PRODUCTS = "stripe/get-products",
28
+ STRIPE_WEBWOOK = "stripe/webhook",
29
+ CREATE_BILLING_PORTAL = "stripe/create-billing-portal",
30
+ CREATE_CHECKOUT_SESSION = "stripe/create-checkout-session",
31
+ REGISTER_USER = "user/register-user",
32
+ UPDATE_USER = "user/update-user",
33
+ GET_CURRENT_USER = "user/get-current-user",
34
+ }
@@ -0,0 +1,6 @@
1
+ export enum FeedbackAgreement {
2
+ YES = "yes",
3
+ NO = "no",
4
+ PARTIAL = "partial",
5
+ UNKNOWN = "unknown",
6
+ }
@@ -0,0 +1,4 @@
1
+ export enum Gender {
2
+ MALE = "male",
3
+ FEMALE = "female",
4
+ }
@@ -0,0 +1,8 @@
1
+ export * from "./cloudfunction.enum";
2
+ export * from "./like.enum";
3
+ export * from "./match.enum";
4
+ export * from "./app-route.enum";
5
+ export * from "./ai-verification-status.enum";
6
+ export * from "./evaluation.enum";
7
+ export * from "./report.enum";
8
+ export * from "./gender.enum";
@@ -0,0 +1,6 @@
1
+ export enum LikeType {
2
+ LIKE = "like",
3
+ DISLIKE = "dislike",
4
+ PULSE = "pulse",
5
+ REVERTED = "reverted",
6
+ }
@@ -0,0 +1,6 @@
1
+ export enum AdvancedMatchStatus {
2
+ INITIAL = "initial",
3
+ LOADING = "loading",
4
+ ERROR = "error",
5
+ SUCCESS = "success",
6
+ }
@@ -0,0 +1,12 @@
1
+ export enum ReportReason {
2
+ OFFENSIVE_CONTENT = "offensive_content",
3
+ FAKE_PROFILE = "fake_profile",
4
+ INAPPROPRIATE_MESSAGES = "inappropriate_messages",
5
+ UNDER_AGED = "underaged",
6
+ OTHER = "other",
7
+ }
8
+
9
+ export enum ReportStatus {
10
+ UNRESOLVED = "unresolved",
11
+ RESOLVED = "resolved",
12
+ }
@@ -0,0 +1,25 @@
1
+ import { Functions, httpsCallable } from "firebase/functions";
2
+ import { CloudFunctionTypes } from "../types";
3
+
4
+ // Define the type of parameters for the generic function
5
+ interface Params<T extends keyof CloudFunctionTypes> {
6
+ functionName: T;
7
+ functions: Functions;
8
+ payload?: CloudFunctionTypes[T]["payload"];
9
+ }
10
+
11
+ // Generic function to call any Firebase Cloud Function
12
+ export const callCloudFunction = async <T extends keyof CloudFunctionTypes>({
13
+ payload,
14
+ functions,
15
+ functionName,
16
+ }: Params<T>): Promise<CloudFunctionTypes[T]["response"]> => {
17
+ const fn = httpsCallable<
18
+ CloudFunctionTypes[T]["payload"],
19
+ CloudFunctionTypes[T]["response"]
20
+ >(functions, functionName);
21
+
22
+ const res = payload ? await fn(payload) : await fn();
23
+
24
+ return res.data;
25
+ };
@@ -0,0 +1 @@
1
+ export * from "./function.caller";
package/src/index.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from "./enum";
2
+ export * from "./firebase";
3
+ export * from "./types";
@@ -0,0 +1,13 @@
1
+ import { Submission } from "./submission.types";
2
+
3
+ export type Assessment = {
4
+ id: string;
5
+ created: string;
6
+ createdBy: string;
7
+ intimateTopics: boolean;
8
+ version: string;
9
+ };
10
+
11
+ export type FullAssessment = Assessment & {
12
+ submissions: Submission[];
13
+ };
@@ -0,0 +1,203 @@
1
+ import { CloudFunction } from "../enum";
2
+ import {
3
+ AddImagesRequest,
4
+ AuthenticateBankIDRequest,
5
+ CollectBankIDRequest,
6
+ CreateAssessmentRequest,
7
+ CreateBillingPortalRequest,
8
+ CreateCheckoutSessionRequest,
9
+ CreateLikeRequest,
10
+ CreatePLSRequest,
11
+ CreateReportRequest,
12
+ CreateSubmissionRequest,
13
+ GetAssessmentRequest,
14
+ GetMatchableUserRequest,
15
+ GetMatchCheckRequest,
16
+ GetMatchesRequest,
17
+ GetMatchRequest,
18
+ GetMessagesRequest,
19
+ GetProductsRequest,
20
+ GetSubmissionRequest,
21
+ GetUserRequest,
22
+ HandleLikeSeenRequest,
23
+ HandleMatchSeenRequest,
24
+ RegisterUserRequest,
25
+ RemoveMatchRequest,
26
+ SendMessageRequest,
27
+ SubmitCategoryFeedbackRequest,
28
+ UpdateAnswerRequest,
29
+ UpdateQuestionsRequest,
30
+ UpdateUserRequest,
31
+ } from "./request.types";
32
+ import {
33
+ AddImagesResponse,
34
+ AuthenticateBankIDResponse,
35
+ CollectBankIDResponse,
36
+ CreateAssessmentResponse,
37
+ CreateBillingPortalResponse,
38
+ CreateCheckoutSessionResponse,
39
+ CreateLikeResponse,
40
+ CreatePLSResponse,
41
+ CreateReportResponse,
42
+ CreateSubmissionResponse,
43
+ GetAssessmentResponse,
44
+ GetAssessmentsResponse,
45
+ GetMatchableUserResponse,
46
+ GetMatchableUsersResponse,
47
+ GetMatchCheckResponse,
48
+ GetMatchesResponse,
49
+ GetMatchResponse,
50
+ GetMessagesResponse,
51
+ GetProductsResponse,
52
+ GetSubmissionResponse,
53
+ GetUserResponse,
54
+ HandleLikeSeenResponse,
55
+ HandleMatchSeenResponse,
56
+ RegisterUserResponse,
57
+ RemoveMatchResponse,
58
+ SendMessageResponse,
59
+ SubmitCategoryFeedbackResponse,
60
+ UpdateAnswerResponse,
61
+ UpdateQuestionsResponse,
62
+ UpdateUserResponse,
63
+ } from "./response.types";
64
+
65
+ // Define a mapping of Cloud Functions to payload and response types
66
+ export type CloudFunctionTypes = {
67
+ // Assessment
68
+ [CloudFunction.CREATE_ASSESSMENT]: {
69
+ payload: CreateAssessmentRequest;
70
+ response: CreateAssessmentResponse;
71
+ };
72
+ [CloudFunction.GET_ASSESSMENT]: {
73
+ payload: GetAssessmentRequest;
74
+ response: GetAssessmentResponse;
75
+ };
76
+ [CloudFunction.GET_ASSESSMENTS]: {
77
+ payload?: undefined;
78
+ response: GetAssessmentsResponse;
79
+ };
80
+ // Submission
81
+ [CloudFunction.CREATE_SUBMISSION]: {
82
+ payload: CreateSubmissionRequest;
83
+ response: CreateSubmissionResponse;
84
+ };
85
+ [CloudFunction.GET_SUBMISSION]: {
86
+ payload: GetSubmissionRequest;
87
+ response: GetSubmissionResponse;
88
+ };
89
+ [CloudFunction.UPDATE_ANSWER]: {
90
+ payload: UpdateAnswerRequest;
91
+ response: UpdateAnswerResponse;
92
+ };
93
+ [CloudFunction.SUBMIT_CATEGORY_FEEDBACK]: {
94
+ payload: SubmitCategoryFeedbackRequest;
95
+ response: SubmitCategoryFeedbackResponse;
96
+ };
97
+ // BankID
98
+ [CloudFunction.AUTHENTICATE_BANKID]: {
99
+ payload: AuthenticateBankIDRequest;
100
+ response: AuthenticateBankIDResponse;
101
+ };
102
+ [CloudFunction.COLLECT_BANKID]: {
103
+ payload: CollectBankIDRequest;
104
+ response: CollectBankIDResponse;
105
+ };
106
+ // Like
107
+ [CloudFunction.CREATE_LIKE]: {
108
+ payload: CreateLikeRequest;
109
+ response: CreateLikeResponse;
110
+ };
111
+ [CloudFunction.GET_LIKES]: {
112
+ payload: CreateLikeRequest;
113
+ response: CreateLikeResponse;
114
+ };
115
+ [CloudFunction.HANDLE_LIKE_SEEN]: {
116
+ payload: HandleLikeSeenRequest;
117
+ response: HandleLikeSeenResponse;
118
+ };
119
+ // Match
120
+ [CloudFunction.GET_MATCH]: {
121
+ payload: GetMatchRequest;
122
+ response: GetMatchResponse;
123
+ };
124
+ [CloudFunction.HANDLE_MATCH_SEEN]: {
125
+ payload: HandleMatchSeenRequest;
126
+ response: HandleMatchSeenResponse;
127
+ };
128
+ [CloudFunction.GET_MATCHES]: {
129
+ payload: GetMatchesRequest;
130
+ response: GetMatchesResponse;
131
+ };
132
+ [CloudFunction.GET_MATCH_CHECK]: {
133
+ payload: GetMatchCheckRequest;
134
+ response: GetMatchCheckResponse;
135
+ };
136
+ [CloudFunction.REMOVE_MATCH]: {
137
+ payload: RemoveMatchRequest;
138
+ response: RemoveMatchResponse;
139
+ };
140
+ [CloudFunction.GET_MATCHABLE_USER]: {
141
+ payload: GetMatchableUserRequest;
142
+ response: GetMatchableUserResponse;
143
+ };
144
+ [CloudFunction.GET_MATCHABLE_USERS]: {
145
+ payload: GetMatchableUsersResponse;
146
+ response: GetMatchableUsersResponse;
147
+ };
148
+ // Messages
149
+ [CloudFunction.SEND_MESSAGE]: {
150
+ payload: SendMessageRequest;
151
+ response: SendMessageResponse;
152
+ };
153
+ [CloudFunction.GET_MESSAGES]: {
154
+ payload: GetMessagesRequest;
155
+ response: GetMessagesResponse;
156
+ };
157
+ // PLS
158
+ [CloudFunction.CREATE_PLS]: {
159
+ payload: CreatePLSRequest;
160
+ response: CreatePLSResponse;
161
+ };
162
+ // Rating
163
+ [CloudFunction.UPDATE_QUESTIONS]: {
164
+ payload: UpdateQuestionsRequest;
165
+ response: UpdateQuestionsResponse;
166
+ };
167
+ // Report
168
+ [CloudFunction.CREATE_REPORT]: {
169
+ payload: CreateReportRequest;
170
+ response: CreateReportResponse;
171
+ };
172
+ // Storage
173
+ [CloudFunction.ADD_IMAGES]: {
174
+ payload: AddImagesRequest;
175
+ response: AddImagesResponse;
176
+ };
177
+ // Stripe
178
+ [CloudFunction.GET_PRODUCTS]: {
179
+ payload: GetProductsRequest;
180
+ response: GetProductsResponse;
181
+ };
182
+ [CloudFunction.CREATE_BILLING_PORTAL]: {
183
+ payload: CreateBillingPortalRequest;
184
+ response: CreateBillingPortalResponse;
185
+ };
186
+ [CloudFunction.CREATE_CHECKOUT_SESSION]: {
187
+ payload: CreateCheckoutSessionRequest;
188
+ response: CreateCheckoutSessionResponse;
189
+ };
190
+ // User
191
+ [CloudFunction.REGISTER_USER]: {
192
+ payload: RegisterUserRequest;
193
+ response: RegisterUserResponse;
194
+ };
195
+ [CloudFunction.UPDATE_USER]: {
196
+ payload: UpdateUserRequest;
197
+ response: UpdateUserResponse;
198
+ };
199
+ [CloudFunction.GET_CURRENT_USER]: {
200
+ payload: GetUserRequest;
201
+ response: GetUserResponse;
202
+ };
203
+ };
@@ -0,0 +1,12 @@
1
+ export * from "./assessment.types";
2
+ export * from "./cloud-function-types";
3
+ export * from "./like.types";
4
+ export * from "./match.types";
5
+ export * from "./message.types";
6
+ export * from "./request.types";
7
+ export * from "./report.types";
8
+ export * from "./response.types";
9
+ export * from "./pls.types";
10
+ export * from "./stripe.types";
11
+ export * from "./submission.types";
12
+ export * from "./user.types";
@@ -0,0 +1,9 @@
1
+ import { LikeType } from "../enum";
2
+
3
+ export type Like = {
4
+ userId: string;
5
+ thumbnailBlurred?: string;
6
+ seen: boolean;
7
+ created: string;
8
+ type: LikeType;
9
+ };
@@ -0,0 +1,75 @@
1
+ import { LikeType } from "../enum";
2
+ import { AdvancedMatchStatus } from "../enum/match.enum";
3
+ import { RatedQuestions } from "./rating.types";
4
+
5
+ export type Match = {
6
+ id: string;
7
+ users: Record<string, boolean>;
8
+ created: string;
9
+ percentages: RatedQuestions;
10
+ totalPercentage: number;
11
+ conversationId: string;
12
+ advancedMatchStatus: AdvancedMatchStatus;
13
+ advancedMatch?: AdvancedMatch;
14
+ };
15
+
16
+ interface StrengthOrWeakness {
17
+ title: string;
18
+ summary: string;
19
+ }
20
+
21
+ export type AdvancedMatch = {
22
+ strengths: StrengthOrWeakness[];
23
+ weaknesses: StrengthOrWeakness[];
24
+ summary: string;
25
+ };
26
+
27
+ export type UserData = {
28
+ id: string;
29
+ intro: string;
30
+ firstName: string;
31
+ state: string;
32
+ birth: string;
33
+ gender: string;
34
+ distance: number;
35
+ interestedIn: string;
36
+ zodiacSign: string;
37
+ images: string[];
38
+ profileInput: Record<string, string>;
39
+ aiSummary?: string;
40
+ thumbnail: string;
41
+ image: string;
42
+ bankIDVerified: boolean;
43
+ };
44
+
45
+ export type MatchableUser = {
46
+ user: UserData;
47
+ percentages: RatedQuestions;
48
+ totalPercentage: number;
49
+ isMatch: boolean;
50
+ likeType?: LikeType;
51
+ isWildcard: boolean;
52
+ matchId?: string;
53
+ conversationId?: string;
54
+ advancedMatchStatus?: AdvancedMatchStatus;
55
+ };
56
+
57
+ export type MatchCheck = {
58
+ user: UserData;
59
+ percentages: RatedQuestions;
60
+ totalPercentage: number;
61
+ };
62
+
63
+ export type UserQuestions = {
64
+ questions: Record<string, string>;
65
+ invalidQuestions: string[];
66
+ favoriteQuestions: string[];
67
+ };
68
+
69
+ export type UserMatch = {
70
+ matchId: string;
71
+ userId: string;
72
+ seen: boolean;
73
+ created: string;
74
+ conversationId: string;
75
+ };
@@ -0,0 +1,9 @@
1
+ export type Message = {
2
+ id: string;
3
+ conversationId: string;
4
+ recipient: string;
5
+ sender: string;
6
+ message: string;
7
+ created: string;
8
+ delivered: boolean;
9
+ };
@@ -0,0 +1,8 @@
1
+ export type PLS = {
2
+ id: string;
3
+ questionnaire: Record<string, string>;
4
+ channelId: string;
5
+ channel: string;
6
+ variation: string;
7
+ created: string;
8
+ };
@@ -0,0 +1 @@
1
+ export type RatedQuestions = Record<string, number>;
@@ -0,0 +1,12 @@
1
+ import { ReportReason, ReportStatus } from "../enum";
2
+
3
+ export type Report = {
4
+ id: string;
5
+ reporterId: string;
6
+ reportedUserId: string;
7
+ reason: ReportReason;
8
+ description?: string;
9
+ status: ReportStatus;
10
+ resolvedBy?: string;
11
+ created: string;
12
+ };
@@ -0,0 +1,101 @@
1
+ import { FeedbackAgreement, LikeType, ReportReason } from "../enum";
2
+ import { Answer } from "./submission.types";
3
+ import { RegistrationData } from "./user.types";
4
+
5
+ // assessment
6
+ export type CreateAssessmentRequest = { intimateTopics: boolean };
7
+ export type GetAssessmentRequest = { id: string };
8
+
9
+ // submission
10
+ export type CreateSubmissionRequest = {
11
+ assessmentId: string;
12
+ };
13
+ export type GetSubmissionRequest = {
14
+ assessmentId: string;
15
+ submissionId: string;
16
+ };
17
+ export type UpdateAnswerRequest = {
18
+ assessmentId: string;
19
+ submissionId: string;
20
+ categoryId: string;
21
+ answer: Answer;
22
+ };
23
+ export type SubmitCategoryFeedbackRequest = {
24
+ assessmentId: string;
25
+ submissionId: string;
26
+ categoryId: string;
27
+ agreement: FeedbackAgreement;
28
+ evaluationReflection: string;
29
+ additionalThoughts: string;
30
+ };
31
+
32
+ // bankid
33
+ export type AuthenticateBankIDRequest = undefined;
34
+ export type CollectBankIDRequest = {
35
+ orderRef: string;
36
+ };
37
+
38
+ // message
39
+ export type SendMessageRequest = {
40
+ conversationId: string;
41
+ messageId: string;
42
+ message: string;
43
+ };
44
+
45
+ export type GetMessagesRequest = {
46
+ conversationId: string;
47
+ limit: number;
48
+ offset: string;
49
+ };
50
+
51
+ // like
52
+ export type CreateLikeRequest = { recipientId: string; type: LikeType };
53
+ export type GetLikesRequest = { limit: number; offset: string };
54
+ export type HandleLikeSeenRequest = { userId: string };
55
+
56
+ // match
57
+ export type RemoveMatchRequest = { recipientId: string };
58
+ export type GetMatchRequest = { matchId: string };
59
+ export type HandleMatchSeenRequest = { userId: string };
60
+ export type GetMatchesRequest = { limit: number; offset: string };
61
+ export type GetMatchableUserRequest = { userId: string };
62
+ export type GetMatchCheckRequest = { userId: string };
63
+
64
+ // pls
65
+ export type CreatePLSRequest = {
66
+ questionnaire: Record<string, string>;
67
+ channelId: string;
68
+ variation: string;
69
+ };
70
+
71
+ // rating
72
+ export type UpdateQuestionsRequest = { questions: Record<string, string> };
73
+
74
+ // report
75
+ export type CreateReportRequest = {
76
+ reportedUserId: string;
77
+ reason: ReportReason;
78
+ description?: string;
79
+ };
80
+
81
+ // stripe
82
+ export type CreateCheckoutSessionRequest = {
83
+ priceId: string;
84
+ };
85
+
86
+ // user
87
+ export type RegisterUserRequest = {
88
+ email: string;
89
+ password: string;
90
+ referrerId?: string;
91
+ data: RegistrationData;
92
+ };
93
+ export type GetUserRequest = undefined;
94
+ export type UpdateUserRequest = Partial<any>; // TODO; fix typing
95
+
96
+ // storage
97
+ export type AddImagesRequest = { images: string[] };
98
+
99
+ // stripe
100
+ export type GetProductsRequest = undefined;
101
+ export type CreateBillingPortalRequest = undefined;
@@ -0,0 +1,80 @@
1
+ import { Assessment, FullAssessment } from "./assessment.types";
2
+ import { Submission, CategoryEvaluation } from "./submission.types";
3
+ import { Match, MatchableUser, MatchCheck, UserMatch } from "./match.types";
4
+ import { Message } from "./message.types";
5
+ import { StripeProduct } from "./stripe.types";
6
+ import { User } from "./user.types";
7
+ import { Like } from "./like.types";
8
+
9
+ // assessment
10
+ export type CreateAssessmentResponse = Assessment;
11
+ export type GetAssessmentResponse = Assessment;
12
+ export type GetAssessmentsResponse = FullAssessment[];
13
+ export type CreateSubmissionResponse = Submission;
14
+ export type GetSubmissionResponse = Submission;
15
+ export type UpdateAnswerResponse = {
16
+ submission: Submission;
17
+ categoryEvaluation?: CategoryEvaluation;
18
+ };
19
+ export type SubmitCategoryFeedbackResponse = CategoryEvaluation;
20
+
21
+ //BankID
22
+ export type AuthenticateBankIDResponse = {
23
+ orderRef: string;
24
+ qrStartToken: string;
25
+ autoStartToken: string;
26
+ };
27
+
28
+ export interface CollectBankIDResponse {
29
+ orderRef: string;
30
+ status: "pending" | "complete" | "failed";
31
+ qrCode?: string;
32
+ hintCode?: string;
33
+ }
34
+
35
+ // message
36
+ export type SendMessageResponse = Message;
37
+ export type GetMessagesResponse = Message[];
38
+
39
+ // match
40
+ export type HandleLikeResponse = boolean;
41
+ export type RemoveMatchResponse = void;
42
+ export type GetMatchResponse = Match;
43
+ export type HandleMatchSeenResponse = void;
44
+ export type GetMatchesResponse = UserMatch[];
45
+ export type GetMatchableUserResponse = MatchableUser;
46
+ export type GetMatchableUsersResponse = MatchableUser[];
47
+
48
+ // like
49
+ export type CreateLikeResponse = { isMatch: boolean };
50
+ export type GetLikesResponse = Like[];
51
+ export type HandleLikeSeenResponse = void;
52
+
53
+ // pls
54
+ export type CreatePLSResponse = void;
55
+
56
+ // rating
57
+ export type UpdateQuestionsResponse = void;
58
+
59
+ // report
60
+ export type CreateReportResponse = void;
61
+
62
+ // stripe
63
+ export type CreateBillingPortalResponse = { url: string };
64
+ export type CreateCheckoutSessionResponse = { url: string };
65
+ export type GetProductsResponse = StripeProduct[];
66
+
67
+ // user
68
+ export type RegisterUserResponse = {
69
+ success: boolean;
70
+ message: string;
71
+ };
72
+ export type GetUserResponse = User;
73
+ export type UpdateUserResponse = User;
74
+
75
+ // storage
76
+ export type AddImagesResponse = { images: string[]; thumbnail: string };
77
+
78
+ export type CancelBankIDResponse = void;
79
+
80
+ export type GetMatchCheckResponse = MatchCheck;
@@ -0,0 +1,8 @@
1
+ export type StripeProduct = {
2
+ id: string;
3
+ title: string;
4
+ description: string | null;
5
+ price: number | null;
6
+ priceId: string;
7
+ interval: string | null;
8
+ };
@@ -0,0 +1,30 @@
1
+ import { FeedbackAgreement } from "../enum";
2
+
3
+ type QuestionId = string;
4
+ type CategoryId = string;
5
+
6
+ export type Submission = {
7
+ id: string;
8
+ assessmentId: string;
9
+ introductionSeen: boolean;
10
+ answers: Record<QuestionId, Answer>;
11
+ categoryEvaluations: Record<CategoryId, CategoryEvaluation>;
12
+ lastUpdated: string;
13
+ created: string;
14
+ };
15
+
16
+ export type Answer = {
17
+ questionId: string;
18
+ answer: string | null;
19
+ elaboration?: string;
20
+ skipped: boolean;
21
+ reason: string | null;
22
+ };
23
+
24
+ export type CategoryEvaluation = {
25
+ categoryId: string;
26
+ aiSummary: string;
27
+ agreement: FeedbackAgreement | null;
28
+ evaluationReflection: string | null;
29
+ additionalThoughts: string | null;
30
+ };
@@ -0,0 +1,125 @@
1
+ import { Gender } from "../enum";
2
+
3
+ export type User = {
4
+ id: string;
5
+ email: string;
6
+ bankIDVerified: boolean; // should this be used?
7
+ registrationReferralAllowed: boolean; // should this be used?
8
+ profile: Profile;
9
+ preferences: DatingPreferences;
10
+ notifications: UserNotifications;
11
+ };
12
+
13
+ export type Profile = {
14
+ intro: string;
15
+ firstName: string;
16
+ state: string;
17
+ birth: Date;
18
+ age: number;
19
+ gender: Gender;
20
+ zodiacSign: string;
21
+ images: string[];
22
+ thumbnail: string;
23
+ thumbnailBlurred: string;
24
+ image: string;
25
+ aiSummary?: string;
26
+ attachedSummary: boolean;
27
+ profileInput: Record<string, string>;
28
+ };
29
+
30
+ export type NotificationSettings = {
31
+ enabled: boolean;
32
+ settings: Record<string, boolean>; // e.g., push, email, etc.
33
+ };
34
+
35
+ export type UserNotifications = {
36
+ pushNotificationsEnabled: boolean;
37
+ emailNotificationsEnabled: boolean;
38
+ pushNotificationSettings: NotificationSettings;
39
+ emailNotificationSettings: NotificationSettings;
40
+ };
41
+
42
+ export type DatingPreferences = {
43
+ minAge: number;
44
+ maxAge: number;
45
+ interestedIn: Gender[];
46
+ distanceRadius: number;
47
+ };
48
+
49
+ export type RegistrationData = {
50
+ firstName: string;
51
+ lat: number;
52
+ lng: number;
53
+ birth: Date;
54
+ gender: Gender;
55
+ interestedIn: Gender[];
56
+ minAge: number;
57
+ maxAge: number;
58
+ distanceRadius: number;
59
+ };
60
+
61
+ // export type User = {
62
+ // id: string;
63
+ // intro: string;
64
+ // firstName: string;
65
+ // state: string;
66
+ // birth: string;
67
+ // gender: string;
68
+ // interestedIn: string;
69
+ // zodiacSign: string;
70
+ // images: string[];
71
+ // profileInput: ProfileInput;
72
+ // lat: number;
73
+ // lng: number;
74
+ // radius: number;
75
+ // geohash: string;
76
+ // minAge: number;
77
+ // maxAge: number;
78
+ // aiSummary?: string;
79
+ // attachedSummary: boolean;
80
+ // thumbnail: string;
81
+ // image: string;
82
+ // bankIDVerified: boolean;
83
+ // emailNotificationsEnabled: boolean;
84
+ // pushNotificationsEnabled: boolean;
85
+ // pushNotificationSettings: NotificationSettings;
86
+ // registrationReferralAllowed: boolean;
87
+ // };
88
+
89
+ // export type UserRegistrationData = {
90
+ // firstName: string;
91
+ // state: string;
92
+ // birth: string;
93
+ // gender: string;
94
+ // images: string[];
95
+ // intro: string;
96
+ // interestedIn: string;
97
+ // lat?: number;
98
+ // lng?: number;
99
+ // radius?: number;
100
+ // minAge?: number;
101
+ // maxAge?: number;
102
+ // };
103
+
104
+ // export type UpdateUserData = {
105
+ // intro: string;
106
+ // firstName: string;
107
+ // state: string;
108
+ // birth: string;
109
+ // profileInput: ProfileInput;
110
+ // lat: number;
111
+ // lng: number;
112
+ // radius: number;
113
+ // geohash: string;
114
+ // minAge: number;
115
+ // maxAge: number;
116
+ // interestedIn: string; // maybe to be removed before release
117
+ // attachedSummary: boolean;
118
+ // expoPushToken?: string;
119
+ // pushNotificationsEnabled: boolean;
120
+ // emailNotificationsEnabled: boolean;
121
+ // pushNotificationSettings?: NotificationSettings;
122
+ // emailNotificationSettings?: NotificationSettings;
123
+ // };
124
+
125
+ // export type ProfileInput = Record<string, string>;
package/tsconfig.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "compilerOptions": {
3
+ "baseUrl": ".",
4
+ "declaration": true,
5
+ "outDir": "./dist",
6
+ "esModuleInterop": true,
7
+ "moduleResolution": "node",
8
+ "module": "CommonJS",
9
+ "target": "ES2021",
10
+ "strict": true
11
+ },
12
+ "include": [
13
+ "src/**/*.ts"
14
+ ]
15
+ }
16
+
@@ -0,0 +1,21 @@
1
+ const fs = require("fs");
2
+ const execSync = require("child_process").execSync;
3
+
4
+ // Get the current version from package.json
5
+ const packageJson = require("./package.json");
6
+ const currentVersion = packageJson.version;
7
+
8
+ // Get the latest published version from npm registry
9
+ const latestVersion = execSync("npm show heartraite version").toString().trim();
10
+
11
+ // Increment the version based on the latest version
12
+ const versionParts = latestVersion.split(".");
13
+ versionParts[2] = (parseInt(versionParts[2]) + 1).toString(); // Increment patch version
14
+ const newVersion = versionParts.join(".");
15
+
16
+ packageJson.version = newVersion;
17
+
18
+ // Update the package.json with the new version
19
+ fs.writeFileSync("package.json", JSON.stringify(packageJson, null, 2));
20
+
21
+ console.log(`Version bumped from ${currentVersion} to ${newVersion}`);