@cofondateurauchomage/libs 1.1.144 → 1.1.145

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 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,16 @@ 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
+ stripeLastPaymentAt?: number;
35
+ stripeSubscriptionEndedAt?: number | null;
36
+ stripeCurrentPeriodEnd?: number | null;
37
+ stripeNetSpendDeltaCents?: number;
38
+ subscriptionCancellationFeedback?: string | null;
39
+ subscriptionCancellationComment?: string | null;
40
+ };
31
41
  addStatsAssociation: {};
32
42
  updateNewsletter: Omit<INewsletter, "new_profil_last_sent_date">;
33
43
  createProspect: Pick<IProspect, "email" | "referrer">;
@@ -79,6 +89,7 @@ export type ResponseForO<O extends CloudFunctionNames | RouteNames> = {
79
89
  updateVisibility: WriteResult;
80
90
  addStripeId: WriteResult;
81
91
  updatePlan: WriteResult;
92
+ updateMetaStripe: WriteResult;
82
93
  addStatsAssociation: WriteResult;
83
94
  updateNewsletter: WriteResult;
84
95
  createProspect: {
@@ -165,6 +165,16 @@ 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
+ stripeLastPaymentAt: zod_1.z.number().optional(),
172
+ stripeSubscriptionEndedAt: zod_1.z.union([zod_1.z.number(), zod_1.z.null()]).optional(),
173
+ stripeCurrentPeriodEnd: zod_1.z.union([zod_1.z.number(), zod_1.z.null()]).optional(),
174
+ stripeNetSpendDeltaCents: zod_1.z.number().int().optional(),
175
+ subscriptionCancellationFeedback: zod_1.z.union([zod_1.z.string(), zod_1.z.null()]).optional(),
176
+ subscriptionCancellationComment: zod_1.z.union([zod_1.z.string(), zod_1.z.null()]).optional(),
177
+ }),
168
178
  addStatsAssociation: zod_1.z.object({}),
169
179
  updateNewsletter: zod_1.z.object({
170
180
  match: zod_1.z.boolean().optional(),
@@ -260,7 +270,7 @@ function validateBodyForO(route, body) {
260
270
  const input = body;
261
271
  const data = parsed.data;
262
272
  const result = {};
263
- for (const key of Object.keys(schema.shape)) {
273
+ for (const key of Object.keys(data)) {
264
274
  if (input[key] !== undefined) {
265
275
  result[key] = data[key];
266
276
  }
@@ -8,7 +8,9 @@ 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
+ stripe_metas = "stripe_metas",
13
+ crm_profiles = "crm_profiles"
12
14
  }
13
15
  export type TSkill = "Sales" | "Operation" | "Design" | "Marketing" | "Produit" | "Tech" | "Growth" | "Finance";
14
16
  export type TPlan = "free" | "pro" | "premium";
@@ -82,6 +84,36 @@ export interface IProject {
82
84
  partner_swanbase?: boolean;
83
85
  partner_iii?: boolean;
84
86
  }
87
+ export interface IStripeMeta {
88
+ stripeId?: string;
89
+ /** First successful invoice payment tied to subscriptions (unix ms). */
90
+ stripeFirstPaidAt?: number;
91
+ /** Last successful invoice payment (unix ms). */
92
+ stripeLastPaymentAt?: number;
93
+ /** When the subscription last ended/churned (unix ms); cleared when a new subscription starts. */
94
+ stripeSubscriptionEndedAt?: number;
95
+ /** Stripe `current_period_end` for the active subscription (unix ms); cleared when no active sub. */
96
+ stripeCurrentPeriodEnd?: number;
97
+ /** Lifetime net cents (invoice payments − refunds handled via deltas from webhooks). */
98
+ stripeNetSpendCents?: number;
99
+ /** Stripe `cancellation_details.feedback`. */
100
+ subscriptionCancellationFeedback?: string;
101
+ subscriptionCancellationComment?: string;
102
+ }
103
+ /**
104
+ * CRM-side state: team actions, Stripe sync, billing overlay.
105
+ * Document id = canonicalId: `prospect:{docId}` | `user:{docId}` | `project:{docId}` under collection `crm_profiles`.
106
+ */
107
+ export interface ICrmProfile {
108
+ type: "prospect" | "user" | "project";
109
+ lastTeamCallAt?: number;
110
+ foundPartner?: boolean;
111
+ }
112
+ export interface ICrmNote {
113
+ text: string;
114
+ createdAt: number;
115
+ author: string;
116
+ }
85
117
  export interface IContact {
86
118
  email: string;
87
119
  linkedin?: string;
package/build/db.model.js CHANGED
@@ -13,4 +13,6 @@ var Collections;
13
13
  Collections["reactions"] = "reactions";
14
14
  Collections["visits"] = "visits";
15
15
  Collections["blogHtmlArticles"] = "blog_html_articles";
16
+ Collections["stripe_metas"] = "stripe_metas";
17
+ Collections["crm_profiles"] = "crm_profiles";
16
18
  })(Collections || (exports.Collections = Collections = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cofondateurauchomage/libs",
3
- "version": "1.1.144",
3
+ "version": "1.1.145",
4
4
  "description": "",
5
5
  "main": "build/index",
6
6
  "scripts": {