@cofondateurauchomage/libs 1.1.136 → 1.1.140
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.
- package/build/api.d.ts +13 -1
- package/build/api.validate.js +12 -1
- package/build/db.model.d.ts +32 -1
- package/build/db.model.js +1 -0
- package/package.json +1 -1
package/build/api.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IBlogHtmlArticle, IContact, INewsletter, IProject, IProspect, IReactionStatus, IUser, TPlan, TPlanOption, TVisibility } from "./db.model";
|
|
2
|
-
export type CloudFunctionNames = "createProject" | "updateProject" | "deleteProject" | "createUser" | "updateUser" | "deleteUser" | "updateVisibility" | "addStripeId" | "updatePlan" | "addStatsAssociation" | "updateNewsletter" | "createProspect" | "getProspect" | "updateProspect" | "createReaction" | "deleteReaction" | "createBlogHtmlArticle";
|
|
2
|
+
export type CloudFunctionNames = "createProject" | "updateProject" | "deleteProject" | "createUser" | "updateUser" | "deleteUser" | "updateVisibility" | "addStripeId" | "updatePlan" | "updateMetaStripe" | "addStatsAssociation" | "updateNewsletter" | "createProspect" | "getProspect" | "updateProspect" | "createReaction" | "deleteReaction" | "createBlogHtmlArticle";
|
|
3
3
|
export type RouteNames = "checkout_session" | "delete_customer" | "portal_session" | "webhook";
|
|
4
4
|
export type BodyForO<O extends CloudFunctionNames | RouteNames> = {
|
|
5
5
|
createProject: Omit<IProject, "id" | "plan" | "visibility" | "clicks" | "creationDate" | "lastConnection" | "stripeId" | "referrer" | "postedOnLinkedInAt"> & IContact & {
|
|
@@ -28,6 +28,17 @@ export type BodyForO<O extends CloudFunctionNames | RouteNames> = {
|
|
|
28
28
|
email: string;
|
|
29
29
|
plan: TPlan;
|
|
30
30
|
};
|
|
31
|
+
updateMetaStripe: {
|
|
32
|
+
apiSecretKey: string;
|
|
33
|
+
stripeId: string;
|
|
34
|
+
stripeFirstPaidAt?: number;
|
|
35
|
+
stripeLastPaymentAt?: number;
|
|
36
|
+
stripeSubscriptionEndedAt?: number | null;
|
|
37
|
+
stripeCurrentPeriodEnd?: number | null;
|
|
38
|
+
stripeNetSpendDeltaCents?: number;
|
|
39
|
+
subscriptionCancellationFeedback?: string | null;
|
|
40
|
+
subscriptionCancellationComment?: string | null;
|
|
41
|
+
};
|
|
31
42
|
addStatsAssociation: {};
|
|
32
43
|
updateNewsletter: Omit<INewsletter, "new_profil_last_sent_date">;
|
|
33
44
|
createProspect: Pick<IProspect, "email" | "referrer">;
|
|
@@ -79,6 +90,7 @@ export type ResponseForO<O extends CloudFunctionNames | RouteNames> = {
|
|
|
79
90
|
updateVisibility: WriteResult;
|
|
80
91
|
addStripeId: WriteResult;
|
|
81
92
|
updatePlan: WriteResult;
|
|
93
|
+
updateMetaStripe: WriteResult;
|
|
82
94
|
addStatsAssociation: WriteResult;
|
|
83
95
|
updateNewsletter: WriteResult;
|
|
84
96
|
createProspect: {
|
package/build/api.validate.js
CHANGED
|
@@ -165,6 +165,17 @@ const schemasForAllRoutes = {
|
|
|
165
165
|
email: zod_1.z.string(),
|
|
166
166
|
plan: zod_1.z.enum(["free", "pro", "premium"]),
|
|
167
167
|
}),
|
|
168
|
+
updateMetaStripe: zod_1.z.object({
|
|
169
|
+
apiSecretKey: zod_1.z.string(),
|
|
170
|
+
stripeId: zStrMax50,
|
|
171
|
+
stripeFirstPaidAt: zod_1.z.number().optional(),
|
|
172
|
+
stripeLastPaymentAt: zod_1.z.number().optional(),
|
|
173
|
+
stripeSubscriptionEndedAt: zod_1.z.union([zod_1.z.number(), zod_1.z.null()]).optional(),
|
|
174
|
+
stripeCurrentPeriodEnd: zod_1.z.union([zod_1.z.number(), zod_1.z.null()]).optional(),
|
|
175
|
+
stripeNetSpendDeltaCents: zod_1.z.number().int().optional(),
|
|
176
|
+
subscriptionCancellationFeedback: zod_1.z.union([zod_1.z.string(), zod_1.z.null()]).optional(),
|
|
177
|
+
subscriptionCancellationComment: zod_1.z.union([zod_1.z.string(), zod_1.z.null()]).optional(),
|
|
178
|
+
}),
|
|
168
179
|
addStatsAssociation: zod_1.z.object({}),
|
|
169
180
|
updateNewsletter: zod_1.z.object({
|
|
170
181
|
match: zod_1.z.boolean().optional(),
|
|
@@ -260,7 +271,7 @@ function validateBodyForO(route, body) {
|
|
|
260
271
|
const input = body;
|
|
261
272
|
const data = parsed.data;
|
|
262
273
|
const result = {};
|
|
263
|
-
for (const key of Object.keys(
|
|
274
|
+
for (const key of Object.keys(data)) {
|
|
264
275
|
if (input[key] !== undefined) {
|
|
265
276
|
result[key] = data[key];
|
|
266
277
|
}
|
package/build/db.model.d.ts
CHANGED
|
@@ -8,7 +8,8 @@ export declare enum Collections {
|
|
|
8
8
|
prospects = "prospects",
|
|
9
9
|
reactions = "reactions",
|
|
10
10
|
visits = "visits",
|
|
11
|
-
blogHtmlArticles = "blog_html_articles"
|
|
11
|
+
blogHtmlArticles = "blog_html_articles",
|
|
12
|
+
crm_profiles = "crm_profiles"
|
|
12
13
|
}
|
|
13
14
|
export type TSkill = "Sales" | "Operation" | "Design" | "Marketing" | "Produit" | "Tech" | "Growth" | "Finance";
|
|
14
15
|
export type TPlan = "free" | "pro" | "premium";
|
|
@@ -82,6 +83,36 @@ export interface IProject {
|
|
|
82
83
|
partner_swanbase?: boolean;
|
|
83
84
|
partner_iii?: boolean;
|
|
84
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* CRM-side state: team actions, Stripe sync, billing overlay.
|
|
88
|
+
* Document id = canonicalId: `user:{uid}` | `project:{uid}` | `prospect:{docId}` under collection `crm_profiles`.
|
|
89
|
+
*/
|
|
90
|
+
export interface ICrmProfile {
|
|
91
|
+
lastTeamCallAt?: number;
|
|
92
|
+
foundPartner?: boolean;
|
|
93
|
+
/** Stripe infos */
|
|
94
|
+
/** First successful invoice payment tied to subscriptions (unix ms). */
|
|
95
|
+
stripeFirstPaidAt?: number;
|
|
96
|
+
/** Last successful invoice payment (unix ms). */
|
|
97
|
+
stripeLastPaymentAt?: number;
|
|
98
|
+
/** When the subscription last ended/churned (unix ms); cleared when a new subscription starts. */
|
|
99
|
+
stripeSubscriptionEndedAt?: number;
|
|
100
|
+
/** Stripe `current_period_end` for the active subscription (unix ms); cleared when no active sub. */
|
|
101
|
+
stripeCurrentPeriodEnd?: number;
|
|
102
|
+
/** Lifetime net cents (invoice payments − refunds handled via deltas from webhooks). */
|
|
103
|
+
stripeNetSpendCents?: number;
|
|
104
|
+
/** Stripe `cancellation_details.feedback`. */
|
|
105
|
+
subscriptionCancellationFeedback?: string;
|
|
106
|
+
subscriptionCancellationComment?: string;
|
|
107
|
+
/** Team-granted Pro (unix ms); orthogonal to Stripe. */
|
|
108
|
+
complimentaryProGrantedAt?: number;
|
|
109
|
+
complimentaryProRevokedAt?: number;
|
|
110
|
+
}
|
|
111
|
+
export interface ICrmNote {
|
|
112
|
+
text: string;
|
|
113
|
+
createdAt: number;
|
|
114
|
+
author: string;
|
|
115
|
+
}
|
|
85
116
|
export interface IContact {
|
|
86
117
|
email: string;
|
|
87
118
|
linkedin?: string;
|
package/build/db.model.js
CHANGED
|
@@ -13,4 +13,5 @@ var Collections;
|
|
|
13
13
|
Collections["reactions"] = "reactions";
|
|
14
14
|
Collections["visits"] = "visits";
|
|
15
15
|
Collections["blogHtmlArticles"] = "blog_html_articles";
|
|
16
|
+
Collections["crm_profiles"] = "crm_profiles";
|
|
16
17
|
})(Collections || (exports.Collections = Collections = {}));
|