heartraite 1.0.4 → 1.0.6

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.
@@ -29,6 +29,7 @@ export declare enum CloudFunction {
29
29
  STRIPE_WEBWOOK = "stripe/webhook",
30
30
  CREATE_BILLING_PORTAL = "stripe/create-billing-portal",
31
31
  CREATE_CHECKOUT_SESSION = "stripe/create-checkout-session",
32
+ REGISTER_ONBOARDING = "user/register-onboarding",
32
33
  UPDATE_USER = "user/update-user",
33
34
  GET_CURRENT_USER = "user/get-current-user"
34
35
  }
@@ -33,6 +33,7 @@ var CloudFunction;
33
33
  CloudFunction["STRIPE_WEBWOOK"] = "stripe/webhook";
34
34
  CloudFunction["CREATE_BILLING_PORTAL"] = "stripe/create-billing-portal";
35
35
  CloudFunction["CREATE_CHECKOUT_SESSION"] = "stripe/create-checkout-session";
36
+ CloudFunction["REGISTER_ONBOARDING"] = "user/register-onboarding";
36
37
  CloudFunction["UPDATE_USER"] = "user/update-user";
37
38
  CloudFunction["GET_CURRENT_USER"] = "user/get-current-user";
38
39
  })(CloudFunction || (exports.CloudFunction = CloudFunction = {}));
@@ -8,3 +8,4 @@ export * from "./report.enum";
8
8
  export * from "./gender.enum";
9
9
  export * from "./provider.enum";
10
10
  export * from "./state.enum";
11
+ export * from "./notification.enum";
@@ -24,3 +24,4 @@ __exportStar(require("./report.enum"), exports);
24
24
  __exportStar(require("./gender.enum"), exports);
25
25
  __exportStar(require("./provider.enum"), exports);
26
26
  __exportStar(require("./state.enum"), exports);
27
+ __exportStar(require("./notification.enum"), exports);
@@ -0,0 +1,5 @@
1
+ export declare enum NotificationSetting {
2
+ NEW_MATCH = "new-match",
3
+ NEW_LIKE = "new-like",
4
+ NEW_MESSAGE = "new-message"
5
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NotificationSetting = void 0;
4
+ var NotificationSetting;
5
+ (function (NotificationSetting) {
6
+ NotificationSetting["NEW_MATCH"] = "new-match";
7
+ NotificationSetting["NEW_LIKE"] = "new-like";
8
+ NotificationSetting["NEW_MESSAGE"] = "new-message";
9
+ })(NotificationSetting || (exports.NotificationSetting = NotificationSetting = {}));
@@ -1,6 +1,6 @@
1
1
  import { CloudFunction } from "../enum";
2
- import { AddImagesRequest, AuthenticateBankIDRequest, CollectBankIDRequest, CreateAssessmentRequest, CreateBillingPortalRequest, CreateCheckoutSessionRequest, CreateLikeRequest, CreatePLSRequest, CreateReportRequest, CreateSubmissionRequest, GetAssessmentRequest, GetMatchableUserRequest, GetMatchCheckRequest, GetMatchesRequest, GetMatchRequest, GetMessagesRequest, GetProductsRequest, GetSubmissionRequest, GetUserRequest, HandleLikeSeenRequest, HandleMatchSeenRequest, RegisterUserRequest, RemoveMatchRequest, SendMessageRequest, SubmitCategoryFeedbackRequest, UpdateAnswerRequest, UpdateQuestionsRequest, UpdateUserRequest } from "./request.types";
3
- import { AddImagesResponse, AuthenticateBankIDResponse, CollectBankIDResponse, CreateAssessmentResponse, CreateBillingPortalResponse, CreateCheckoutSessionResponse, CreateLikeResponse, CreatePLSResponse, CreateReportResponse, CreateSubmissionResponse, GetAssessmentResponse, GetAssessmentsResponse, GetMatchableUserResponse, GetMatchableUsersResponse, GetMatchCheckResponse, GetMatchesResponse, GetMatchResponse, GetMessagesResponse, GetProductsResponse, GetSubmissionResponse, GetUserResponse, HandleLikeSeenResponse, HandleMatchSeenResponse, RegisterUserResponse, RemoveMatchResponse, SendMessageResponse, SubmitCategoryFeedbackResponse, UpdateAnswerResponse, UpdateQuestionsResponse, UpdateUserResponse } from "./response.types";
2
+ import { AddImagesRequest, AuthenticateBankIDRequest, CollectBankIDRequest, CreateAssessmentRequest, CreateBillingPortalRequest, CreateCheckoutSessionRequest, CreateLikeRequest, CreatePLSRequest, CreateReportRequest, CreateSubmissionRequest, GetAssessmentRequest, GetMatchableUserRequest, GetMatchCheckRequest, GetMatchesRequest, GetMatchRequest, GetMessagesRequest, GetProductsRequest, GetSubmissionRequest, GetUserRequest, HandleLikeSeenRequest, HandleMatchSeenRequest, RegisterOnboardingRequest, RegisterUserRequest, RemoveMatchRequest, SendMessageRequest, SubmitCategoryFeedbackRequest, UpdateAnswerRequest, UpdateQuestionsRequest, UpdateUserRequest } from "./request.types";
3
+ import { AddImagesResponse, AuthenticateBankIDResponse, CollectBankIDResponse, CreateAssessmentResponse, CreateBillingPortalResponse, CreateCheckoutSessionResponse, CreateLikeResponse, CreatePLSResponse, CreateReportResponse, CreateSubmissionResponse, GetAssessmentResponse, GetAssessmentsResponse, GetMatchableUserResponse, GetMatchableUsersResponse, GetMatchCheckResponse, GetMatchesResponse, GetMatchResponse, GetMessagesResponse, GetProductsResponse, GetSubmissionResponse, GetUserResponse, HandleLikeSeenResponse, HandleMatchSeenResponse, RegisterOnboardingResponse, RegisterUserResponse, RemoveMatchResponse, SendMessageResponse, SubmitCategoryFeedbackResponse, UpdateAnswerResponse, UpdateQuestionsResponse, UpdateUserResponse } from "./response.types";
4
4
  export type CloudFunctionTypes = {
5
5
  [CloudFunction.CREATE_ASSESSMENT]: {
6
6
  payload: CreateAssessmentRequest;
@@ -118,6 +118,10 @@ export type CloudFunctionTypes = {
118
118
  payload: CreateCheckoutSessionRequest;
119
119
  response: CreateCheckoutSessionResponse;
120
120
  };
121
+ [CloudFunction.REGISTER_ONBOARDING]: {
122
+ payload: RegisterOnboardingRequest;
123
+ response: RegisterOnboardingResponse;
124
+ };
121
125
  [CloudFunction.UPDATE_USER]: {
122
126
  payload: UpdateUserRequest;
123
127
  response: UpdateUserResponse;
@@ -0,0 +1,3 @@
1
+ export type DeepPartial<T> = {
2
+ [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
3
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +1,6 @@
1
1
  export * from "./assessment.types";
2
2
  export * from "./cloud-function-types";
3
+ export * from "./helper.types";
3
4
  export * from "./like.types";
4
5
  export * from "./match.types";
5
6
  export * from "./message.types";
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./assessment.types"), exports);
18
18
  __exportStar(require("./cloud-function-types"), exports);
19
+ __exportStar(require("./helper.types"), exports);
19
20
  __exportStar(require("./like.types"), exports);
20
21
  __exportStar(require("./match.types"), exports);
21
22
  __exportStar(require("./message.types"), exports);
@@ -1,5 +1,12 @@
1
- import { FeedbackAgreement, LikeType, ReportReason } from "../enum";
1
+ import { FeedbackAgreement, Gender, LikeType, ReportReason } from "../enum";
2
+ import { DeepPartial } from "./helper.types";
2
3
  import { Answer } from "./submission.types";
4
+ import { DatingPreferences, UserNotifications, UserProfile } from "./user.types";
5
+ export type RegisterUserRequest = {
6
+ email: string;
7
+ password: string;
8
+ referrerId?: string;
9
+ };
3
10
  export type CreateAssessmentRequest = {
4
11
  intimateTopics: boolean;
5
12
  };
@@ -87,13 +94,24 @@ export type CreateReportRequest = {
87
94
  export type CreateCheckoutSessionRequest = {
88
95
  priceId: string;
89
96
  };
90
- export type RegisterUserRequest = {
91
- email: string;
92
- password: string;
93
- referrerId?: string;
97
+ export type RegisterOnboardingRequest = {
98
+ firstName: string;
99
+ state: string;
100
+ birth: Date;
101
+ images: string[];
102
+ interestedIn: Gender[];
103
+ gender: Gender;
104
+ coordinates: {
105
+ lat: number;
106
+ lng: number;
107
+ };
94
108
  };
95
109
  export type GetUserRequest = undefined;
96
- export type UpdateUserRequest = Partial<any>;
110
+ export type UpdateUserRequest = {
111
+ profile?: DeepPartial<UserProfile>;
112
+ preferences?: DeepPartial<DatingPreferences>;
113
+ notifications?: DeepPartial<UserNotifications>;
114
+ };
97
115
  export type AddImagesRequest = {
98
116
  images: string[];
99
117
  };
@@ -5,6 +5,10 @@ import { Message } from "./message.types";
5
5
  import { StripeProduct } from "./stripe.types";
6
6
  import { User } from "./user.types";
7
7
  import { Like } from "./like.types";
8
+ export type RegisterUserResponse = {
9
+ success: boolean;
10
+ message: string;
11
+ };
8
12
  export type CreateAssessmentResponse = Assessment;
9
13
  export type GetAssessmentResponse = Assessment;
10
14
  export type GetAssessmentsResponse = FullAssessment[];
@@ -50,10 +54,7 @@ export type CreateCheckoutSessionResponse = {
50
54
  url: string;
51
55
  };
52
56
  export type GetProductsResponse = StripeProduct[];
53
- export type RegisterUserResponse = {
54
- success: boolean;
55
- message: string;
56
- };
57
+ export type RegisterOnboardingResponse = User;
57
58
  export type GetUserResponse = User;
58
59
  export type UpdateUserResponse = User;
59
60
  export type AddImagesResponse = {
@@ -1,14 +1,17 @@
1
- import { Gender } from "../enum";
1
+ import { Gender, NotificationSetting } from "../enum";
2
2
  export type User = {
3
3
  id: string;
4
4
  email: string;
5
- bankIDVerified: boolean;
6
- registrationReferralAllowed: boolean;
7
- profile: Profile;
5
+ created: Date;
6
+ permissions: UserPermissions;
7
+ profile: UserProfile;
8
8
  preferences: DatingPreferences;
9
9
  notifications: UserNotifications;
10
10
  };
11
- export type Profile = {
11
+ export type UserPermissions = {
12
+ registrationReferralAllowed: boolean;
13
+ };
14
+ export type UserProfile = {
12
15
  intro: string;
13
16
  firstName: string;
14
17
  state: string;
@@ -26,11 +29,9 @@ export type Profile = {
26
29
  };
27
30
  export type NotificationSettings = {
28
31
  enabled: boolean;
29
- settings: Record<string, boolean>;
32
+ settings: Record<NotificationSetting, boolean>;
30
33
  };
31
34
  export type UserNotifications = {
32
- pushNotificationsEnabled: boolean;
33
- emailNotificationsEnabled: boolean;
34
35
  pushNotificationSettings: NotificationSettings;
35
36
  emailNotificationSettings: NotificationSettings;
36
37
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "heartraite",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "Heartraite npm package for common functionality",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -29,6 +29,7 @@ export enum CloudFunction {
29
29
  STRIPE_WEBWOOK = "stripe/webhook",
30
30
  CREATE_BILLING_PORTAL = "stripe/create-billing-portal",
31
31
  CREATE_CHECKOUT_SESSION = "stripe/create-checkout-session",
32
+ REGISTER_ONBOARDING = "user/register-onboarding",
32
33
  UPDATE_USER = "user/update-user",
33
34
  GET_CURRENT_USER = "user/get-current-user",
34
35
  }
package/src/enum/index.ts CHANGED
@@ -8,3 +8,4 @@ export * from "./report.enum";
8
8
  export * from "./gender.enum";
9
9
  export * from "./provider.enum";
10
10
  export * from "./state.enum";
11
+ export * from "./notification.enum";
@@ -0,0 +1,5 @@
1
+ export enum NotificationSetting {
2
+ NEW_MATCH = "new-match",
3
+ NEW_LIKE = "new-like",
4
+ NEW_MESSAGE = "new-message",
5
+ }
@@ -21,6 +21,7 @@ import {
21
21
  GetUserRequest,
22
22
  HandleLikeSeenRequest,
23
23
  HandleMatchSeenRequest,
24
+ RegisterOnboardingRequest,
24
25
  RegisterUserRequest,
25
26
  RemoveMatchRequest,
26
27
  SendMessageRequest,
@@ -53,6 +54,7 @@ import {
53
54
  GetUserResponse,
54
55
  HandleLikeSeenResponse,
55
56
  HandleMatchSeenResponse,
57
+ RegisterOnboardingResponse,
56
58
  RegisterUserResponse,
57
59
  RemoveMatchResponse,
58
60
  SendMessageResponse,
@@ -193,6 +195,10 @@ export type CloudFunctionTypes = {
193
195
  response: CreateCheckoutSessionResponse;
194
196
  };
195
197
  // User
198
+ [CloudFunction.REGISTER_ONBOARDING]: {
199
+ payload: RegisterOnboardingRequest;
200
+ response: RegisterOnboardingResponse;
201
+ };
196
202
  [CloudFunction.UPDATE_USER]: {
197
203
  payload: UpdateUserRequest;
198
204
  response: UpdateUserResponse;
@@ -0,0 +1,3 @@
1
+ export type DeepPartial<T> = {
2
+ [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
3
+ };
@@ -1,5 +1,6 @@
1
1
  export * from "./assessment.types";
2
2
  export * from "./cloud-function-types";
3
+ export * from "./helper.types";
3
4
  export * from "./like.types";
4
5
  export * from "./match.types";
5
6
  export * from "./message.types";
@@ -1,5 +1,18 @@
1
- import { FeedbackAgreement, LikeType, ReportReason } from "../enum";
1
+ import { FeedbackAgreement, Gender, LikeType, ReportReason } from "../enum";
2
+ import { DeepPartial } from "./helper.types";
2
3
  import { Answer } from "./submission.types";
4
+ import {
5
+ DatingPreferences,
6
+ UserNotifications,
7
+ UserProfile,
8
+ } from "./user.types";
9
+
10
+ // auth
11
+ export type RegisterUserRequest = {
12
+ email: string;
13
+ password: string;
14
+ referrerId?: string;
15
+ };
3
16
 
4
17
  // assessment
5
18
  export type CreateAssessmentRequest = { intimateTopics: boolean };
@@ -83,13 +96,24 @@ export type CreateCheckoutSessionRequest = {
83
96
  };
84
97
 
85
98
  // user
86
- export type RegisterUserRequest = {
87
- email: string;
88
- password: string;
89
- referrerId?: string;
99
+ export type RegisterOnboardingRequest = {
100
+ firstName: string;
101
+ state: string;
102
+ birth: Date;
103
+ images: string[];
104
+ interestedIn: Gender[];
105
+ gender: Gender;
106
+ coordinates: {
107
+ lat: number;
108
+ lng: number;
109
+ };
90
110
  };
91
111
  export type GetUserRequest = undefined;
92
- export type UpdateUserRequest = Partial<any>; // TODO; fix typing
112
+ export type UpdateUserRequest = {
113
+ profile?: DeepPartial<UserProfile>;
114
+ preferences?: DeepPartial<DatingPreferences>;
115
+ notifications?: DeepPartial<UserNotifications>;
116
+ };
93
117
 
94
118
  // storage
95
119
  export type AddImagesRequest = { images: string[] };
@@ -6,6 +6,12 @@ import { StripeProduct } from "./stripe.types";
6
6
  import { User } from "./user.types";
7
7
  import { Like } from "./like.types";
8
8
 
9
+ // auth
10
+ export type RegisterUserResponse = {
11
+ success: boolean;
12
+ message: string;
13
+ };
14
+
9
15
  // assessment
10
16
  export type CreateAssessmentResponse = Assessment;
11
17
  export type GetAssessmentResponse = Assessment;
@@ -65,10 +71,7 @@ export type CreateCheckoutSessionResponse = { url: string };
65
71
  export type GetProductsResponse = StripeProduct[];
66
72
 
67
73
  // user
68
- export type RegisterUserResponse = {
69
- success: boolean;
70
- message: string;
71
- };
74
+ export type RegisterOnboardingResponse = User;
72
75
  export type GetUserResponse = User;
73
76
  export type UpdateUserResponse = User;
74
77
 
@@ -1,16 +1,20 @@
1
- import { Gender } from "../enum";
1
+ import { Gender, NotificationSetting } from "../enum";
2
2
 
3
3
  export type User = {
4
4
  id: string;
5
5
  email: string;
6
- bankIDVerified: boolean; // should this be used?
7
- registrationReferralAllowed: boolean; // should this be used?
8
- profile: Profile;
6
+ created: Date;
7
+ permissions: UserPermissions;
8
+ profile: UserProfile;
9
9
  preferences: DatingPreferences;
10
10
  notifications: UserNotifications;
11
11
  };
12
12
 
13
- export type Profile = {
13
+ export type UserPermissions = {
14
+ registrationReferralAllowed: boolean;
15
+ };
16
+
17
+ export type UserProfile = {
14
18
  intro: string;
15
19
  firstName: string;
16
20
  state: string;
@@ -29,12 +33,10 @@ export type Profile = {
29
33
 
30
34
  export type NotificationSettings = {
31
35
  enabled: boolean;
32
- settings: Record<string, boolean>; // e.g., push, email, etc.
36
+ settings: Record<NotificationSetting, boolean>;
33
37
  };
34
38
 
35
39
  export type UserNotifications = {
36
- pushNotificationsEnabled: boolean;
37
- emailNotificationsEnabled: boolean;
38
40
  pushNotificationSettings: NotificationSettings;
39
41
  emailNotificationSettings: NotificationSettings;
40
42
  };