Skip to content

Commit e85e607

Browse files
Merge pull request #531 from gridaco/enterprise
Enterprise - Customer Portal Customization
2 parents b7d035b + b73b6da commit e85e607

File tree

24 files changed

+2968
-860
lines changed

24 files changed

+2968
-860
lines changed

database/database-generated.types.ts

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,39 @@ export type Database = {
187187
}
188188
Relationships: []
189189
}
190+
portal_preset: {
191+
Row: {
192+
created_at: string
193+
id: string
194+
is_primary: boolean
195+
name: string
196+
portal_login_page: Json
197+
project_id: number
198+
updated_at: string
199+
verification_email_template: Json
200+
}
201+
Insert: {
202+
created_at?: string
203+
id?: string
204+
is_primary?: boolean
205+
name: string
206+
portal_login_page?: Json
207+
project_id: number
208+
updated_at?: string
209+
verification_email_template?: Json
210+
}
211+
Update: {
212+
created_at?: string
213+
id?: string
214+
is_primary?: boolean
215+
name?: string
216+
portal_login_page?: Json
217+
project_id?: number
218+
updated_at?: string
219+
verification_email_template?: Json
220+
}
221+
Relationships: []
222+
}
190223
}
191224
Views: {
192225
[_ in never]: never
@@ -295,6 +328,39 @@ export type Database = {
295328
}
296329
Relationships: []
297330
}
331+
portal_preset: {
332+
Row: {
333+
created_at: string | null
334+
id: string | null
335+
is_primary: boolean | null
336+
name: string | null
337+
portal_login_page: Json | null
338+
project_id: number | null
339+
updated_at: string | null
340+
verification_email_template: Json | null
341+
}
342+
Insert: {
343+
created_at?: string | null
344+
id?: string | null
345+
is_primary?: boolean | null
346+
name?: string | null
347+
portal_login_page?: Json | null
348+
project_id?: number | null
349+
updated_at?: string | null
350+
verification_email_template?: Json | null
351+
}
352+
Update: {
353+
created_at?: string | null
354+
id?: string | null
355+
is_primary?: boolean | null
356+
name?: string | null
357+
portal_login_page?: Json | null
358+
project_id?: number | null
359+
updated_at?: string | null
360+
verification_email_template?: Json | null
361+
}
362+
Relationships: []
363+
}
298364
}
299365
Functions: {
300366
create_customer_otp_challenge: {
@@ -337,6 +403,10 @@ export type Database = {
337403
Args: { p_customer_uid: string; p_project_id: number }
338404
Returns: undefined
339405
}
406+
set_primary_portal_preset: {
407+
Args: { p_preset_id: string; p_project_id: number }
408+
Returns: undefined
409+
}
340410
touch_customer_portal_session: {
341411
Args: { p_min_seconds_between_touches?: number; p_token: string }
342412
Returns: {

database/database.types.ts

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,40 @@ export type FormNotificationRespondentEmailConfig = {
4949
reply_to?: string | null;
5050
};
5151

52+
/**
53+
* `grida_ciam.portal_preset.verification_email_template`
54+
*
55+
* DB-enforced JSON schema (same shape as FormNotificationRespondentEmailConfig).
56+
*/
57+
export type PortalPresetVerificationEmailTemplate = {
58+
enabled?: boolean;
59+
from_name?: string | null;
60+
subject_template?: string | null;
61+
body_html_template?: string | null;
62+
reply_to?: string | null;
63+
};
64+
65+
/**
66+
* `grida_ciam.portal_preset.portal_login_page`
67+
*
68+
* DB-enforced JSON schema for login page text overrides.
69+
*
70+
* The required `template_id` discriminator allows future schema revisions:
71+
* introduce a new template_id value (e.g. "202607-v2") with its own shape,
72+
* add it to the union, and the old DB constraint will reject stale rows,
73+
* forcing an explicit data migration.
74+
*/
75+
export type PortalPresetLoginPage = PortalPresetLoginPage_202602Default;
76+
77+
export type PortalPresetLoginPage_202602Default = {
78+
template_id: "202602-default";
79+
email_step_title?: string | null;
80+
email_step_description?: string | null;
81+
email_step_button_label?: string | null;
82+
otp_step_title?: string | null;
83+
otp_step_description?: string | null;
84+
};
85+
5286
// Override the type for a specific column in a view:
5387
export type Database = MergeDeep<
5488
DatabaseGenerated,
@@ -74,6 +108,22 @@ export type Database = MergeDeep<
74108
tags?: string[] | null;
75109
};
76110
};
111+
portal_preset: {
112+
// View mirrors the table 1:1; reference the table type and only
113+
// narrow the two JSONB columns from Json to their enforced shapes.
114+
Row: Omit<DatabaseGenerated["grida_ciam"]["Tables"]["portal_preset"]["Row"], "verification_email_template" | "portal_login_page"> & {
115+
verification_email_template: PortalPresetVerificationEmailTemplate;
116+
portal_login_page: PortalPresetLoginPage;
117+
};
118+
Insert: Omit<DatabaseGenerated["grida_ciam"]["Tables"]["portal_preset"]["Insert"], "verification_email_template" | "portal_login_page"> & {
119+
verification_email_template?: PortalPresetVerificationEmailTemplate;
120+
portal_login_page?: PortalPresetLoginPage;
121+
};
122+
Update: Omit<DatabaseGenerated["grida_ciam"]["Tables"]["portal_preset"]["Update"], "verification_email_template" | "portal_login_page"> & {
123+
verification_email_template?: PortalPresetVerificationEmailTemplate;
124+
portal_login_page?: PortalPresetLoginPage;
125+
};
126+
};
77127
};
78128
};
79129
grida_library: {
Lines changed: 40 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,45 @@
1-
import MailAppFrame from "@/components/frames/mail-app-frame";
1+
import {
2+
EmailFrame,
3+
EmailFrameSubject,
4+
EmailFrameSender,
5+
EmailFrameBody,
6+
} from "@/components/frames/email-frame";
27

38
export default function MailFramePage() {
49
return (
5-
<MailAppFrame
6-
sidebarHidden
7-
message={{
8-
at: "2021-10-06T14:00:00Z",
9-
from: {
10-
name: "Grida Forms",
11-
email: "notifications@forms.grida.co",
12-
avatar: "GR",
13-
},
14-
title: "New Feature Update",
15-
}}
16-
messages={[]}
17-
>
18-
<p>Dear team,</p>
19-
<p>
20-
Im excited to announce the release of our latest feature update. This
21-
release includes several new capabilities that will help you work more
22-
efficiently and effectively.
23-
</p>
24-
<p>Some of the key highlights include:</p>
25-
<ul>
26-
<li>Improved email search and filtering</li>
27-
<li>Enhanced email templates and signatures</li>
28-
<li>Seamless integration with our project management tools</li>
29-
</ul>
30-
<p>
31-
Weve been working hard to deliver these improvements, and were confident
32-
they will have a positive impact on your daily workflow. Please let me
33-
know if you have any questions or feedback.
34-
</p>
35-
<p>
36-
Best regards,
37-
<br />
38-
Jared
39-
</p>
40-
</MailAppFrame>
10+
<main className="container max-w-2xl mx-auto py-10">
11+
<EmailFrame className="flex flex-col">
12+
<EmailFrameSubject>New Feature Update</EmailFrameSubject>
13+
<EmailFrameSender
14+
name="Grida Forms"
15+
email="notifications@forms.grida.co"
16+
date="2021-10-06T14:00:00Z"
17+
/>
18+
<EmailFrameBody className="prose prose-stone dark:prose-invert max-w-none">
19+
<p>Dear team,</p>
20+
<p>
21+
Im excited to announce the release of our latest feature update. This
22+
release includes several new capabilities that will help you work
23+
more efficiently and effectively.
24+
</p>
25+
<p>Some of the key highlights include:</p>
26+
<ul>
27+
<li>Improved email search and filtering</li>
28+
<li>Enhanced email templates and signatures</li>
29+
<li>Seamless integration with our project management tools</li>
30+
</ul>
31+
<p>
32+
Weve been working hard to deliver these improvements, and were
33+
confident they will have a positive impact on your daily workflow.
34+
Please let me know if you have any questions or feedback.
35+
</p>
36+
<p>
37+
Best regards,
38+
<br />
39+
Jared
40+
</p>
41+
</EmailFrameBody>
42+
</EmailFrame>
43+
</main>
4144
);
4245
}

0 commit comments

Comments
 (0)