@simplelayer/graniteer-core 0.3.28 → 0.3.30
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.
|
@@ -99,6 +99,21 @@ export async function handle(req) {
|
|
|
99
99
|
return json(500, { ok: false, error: 'read_failed' });
|
|
100
100
|
if (!row)
|
|
101
101
|
return json(404, { ok: false, error: 'not_found' });
|
|
102
|
+
if (action === 'get_signed_url' || action === 'mark_printed') {
|
|
103
|
+
const { data: profile, error: optOutErr } = await admin
|
|
104
|
+
.from('member_profiles')
|
|
105
|
+
.select('wall_photo_opt_out')
|
|
106
|
+
.eq('auth_user_id', row.auth_user_id)
|
|
107
|
+
.maybeSingle();
|
|
108
|
+
if (optOutErr)
|
|
109
|
+
return json(500, { ok: false, error: 'opt_out_check_failed' });
|
|
110
|
+
if (profile?.wall_photo_opt_out === true) {
|
|
111
|
+
if (action === 'mark_printed') {
|
|
112
|
+
await audit({ queue_id: id, auth_user_id: row.auth_user_id, refused: 'opted_out' });
|
|
113
|
+
}
|
|
114
|
+
return json(409, { ok: false, error: 'opted_out' });
|
|
115
|
+
}
|
|
116
|
+
}
|
|
102
117
|
if (action === 'get_signed_url') {
|
|
103
118
|
if (!row.original_object_path)
|
|
104
119
|
return json(400, { ok: false, error: 'no_original_captured' });
|
|
@@ -40,6 +40,11 @@ export type VirtualOfficeWelcomeConfig = {
|
|
|
40
40
|
virtualOfficeSlug: string;
|
|
41
41
|
/** Absolute URL the magic link lands on once the member clicks it. */
|
|
42
42
|
portalRedirectUrl: string;
|
|
43
|
+
/**
|
|
44
|
+
* Accepted for config symmetry only: this sender emits a Supabase magic link,
|
|
45
|
+
* not GHL html, so there is no body to add the setup line to.
|
|
46
|
+
*/
|
|
47
|
+
setupUrl?: string;
|
|
43
48
|
};
|
|
44
49
|
export declare function sendVirtualOfficeWelcome(supabase: SupabaseLike, email: string, planId: string | null, plan: WelcomePlan, config: VirtualOfficeWelcomeConfig): Promise<WelcomeResult>;
|
|
45
50
|
/** Tenant-owned inputs to the host-hours card. */
|
|
@@ -68,6 +73,11 @@ export type MembershipWelcomeConfig = {
|
|
|
68
73
|
*/
|
|
69
74
|
addressRoomSlug: string;
|
|
70
75
|
hostHours: HostHoursConfig;
|
|
76
|
+
/**
|
|
77
|
+
* Optional https URL of the portal setup page. Rendered as one extra line in
|
|
78
|
+
* the email when set; omitted/invalid leaves the email unchanged.
|
|
79
|
+
*/
|
|
80
|
+
setupUrl?: string;
|
|
71
81
|
};
|
|
72
82
|
export declare function sendMembershipWelcome(supabase: SupabaseLike, email: string, planId: string | null, customerName: string | null, status: string | null, plan: WelcomePlan, config: MembershipWelcomeConfig, startsOnIso: string | null): Promise<WelcomeResult>;
|
|
73
83
|
/**
|
|
@@ -95,12 +105,22 @@ export type PrivateOfficeWelcomeConfig = {
|
|
|
95
105
|
* move-in. Tenant-owned; pass [] to send without a CC.
|
|
96
106
|
*/
|
|
97
107
|
staffCc: readonly string[];
|
|
108
|
+
/**
|
|
109
|
+
* Optional https URL of the portal setup page. Rendered as one extra line in
|
|
110
|
+
* the email when set; omitted/invalid leaves the email unchanged.
|
|
111
|
+
*/
|
|
112
|
+
setupUrl?: string;
|
|
98
113
|
};
|
|
99
114
|
export declare function sendPrivateOfficeWelcome(supabase: SupabaseLike, email: string, name: string | null, plan: WelcomePlan, config: PrivateOfficeWelcomeConfig, billing?: PrivateOfficeBilling | null): Promise<WelcomeResult>;
|
|
100
115
|
export type TeamSeatWelcomeConfig = {
|
|
101
116
|
operator: WelcomeOperator;
|
|
102
117
|
/** Plan slug of the operator's sponsored-seat ("company member") plan. */
|
|
103
118
|
teamSeatSlug: string;
|
|
119
|
+
/**
|
|
120
|
+
* Optional https URL of the portal setup page. Rendered as one extra line in
|
|
121
|
+
* the email when set; omitted/invalid leaves the email unchanged.
|
|
122
|
+
*/
|
|
123
|
+
setupUrl?: string;
|
|
104
124
|
};
|
|
105
125
|
/**
|
|
106
126
|
* Team-seat ("Company member") welcome.
|
|
@@ -27,6 +27,16 @@ function esc(v) {
|
|
|
27
27
|
.replace(/"/g, '"')
|
|
28
28
|
.replace(/'/g, ''');
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Optional "finish setting up" paragraph. Rendered only for a non-empty https
|
|
32
|
+
* URL; otherwise returns '' so the email is unchanged.
|
|
33
|
+
*/
|
|
34
|
+
function setupLine(p, setupUrl) {
|
|
35
|
+
const url = typeof setupUrl === 'string' ? setupUrl.trim() : '';
|
|
36
|
+
if (!/^https:\/\/\S+$/i.test(url))
|
|
37
|
+
return '';
|
|
38
|
+
return p(`<strong>Finish setting up your membership:</strong> add your photo and get your door app and WiFi login at <a href="${esc(url)}" style="color:#C98A5E">${esc(url.replace(/^https:\/\//i, ''))}</a>. It takes about a minute.`) + '\n';
|
|
39
|
+
}
|
|
30
40
|
/** Classify a caught error as transient (worth another event) or hopeless. */
|
|
31
41
|
function classifyError(e) {
|
|
32
42
|
const name = e instanceof Error ? e.name : '';
|
|
@@ -248,7 +258,7 @@ ${startsOnLabel
|
|
|
248
258
|
${p('<strong>You\'ll get a separate email inviting you to an app called UniFi Endpoint. That invitation is from us — it\'s how you unlock the door with your phone.</strong> It arrives with Ubiquiti branding, so please don\'t delete it as spam.')}
|
|
249
259
|
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" style="border-collapse:collapse;margin-top:12px">${doorCard}${wifiCard}${hostHoursCard}</table>
|
|
250
260
|
${p(`We're at ${esc(address)}.`)}
|
|
251
|
-
${p(`Questions? Just reply to this email — it reaches a real person here. You can also write to <a href="mailto:${operator.supportEmail}" style="color:#C98A5E">${operator.supportEmail}</a>.`)}
|
|
261
|
+
${setupLine(p, config.setupUrl)}${p(`Questions? Just reply to this email — it reaches a real person here. You can also write to <a href="mailto:${operator.supportEmail}" style="color:#C98A5E">${operator.supportEmail}</a>.`)}
|
|
252
262
|
<p style="margin:24px 0 0 0;color:#748272;font-family:Inter,Arial,sans-serif;font-size:13px;line-height:20px">${operator.name} · ${esc(address)}</p>
|
|
253
263
|
</td></tr></table></td></tr></table></div>`;
|
|
254
264
|
const emailRes = await fetch(`${GHL_BASE}/conversations/messages`, {
|
|
@@ -382,7 +392,7 @@ ${p(`Hi ${esc(greetingName)},`)}
|
|
|
382
392
|
${p(`You're all set — welcome to ${operator.name}. We're glad to have you as part of the community.`)}
|
|
383
393
|
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" style="border-collapse:collapse;margin-top:12px">${nextCard}${billingCard}</table>
|
|
384
394
|
|
|
385
|
-
${p(`If anything's unclear or you need something before you move in, just reply here or write to <a href="mailto:${operator.supportEmail}" style="color:#C98A5E">${operator.supportEmail}</a> — we're happy to help.`)}
|
|
395
|
+
${setupLine(p, config.setupUrl)}${p(`If anything's unclear or you need something before you move in, just reply here or write to <a href="mailto:${operator.supportEmail}" style="color:#C98A5E">${operator.supportEmail}</a> — we're happy to help.`)}
|
|
386
396
|
${p(`Welcome again,<br>The ${operator.name} team`)}
|
|
387
397
|
</td></tr></table></td></tr></table></div>`;
|
|
388
398
|
const emailRes = await fetch(`${GHL_BASE}/conversations/messages`, {
|
|
@@ -471,7 +481,7 @@ ${p(`Hi ${esc(greetingName)},`)}
|
|
|
471
481
|
${p(companyLine)}
|
|
472
482
|
${p(`<strong>Setting up your login:</strong> go to <a href="https://${operator.domain}/portal/login" style="color:#C98A5E">${operator.domain}/portal/login</a> and enter this email address (${esc(email)}). We'll email you a sign-in link — there's no password to remember.`)}
|
|
473
483
|
${p('<strong>Door and WiFi access:</strong> if your seat includes it, access is being set up now and can take a little while to go live. You may also receive a separate invite to an app called <strong>UniFi Endpoint</strong> — that\'s from us, and it\'s how you unlock the door with your phone.')}
|
|
474
|
-
${p(`Questions? Just reply to this email — it reaches a real person here. You can also write to <a href="mailto:${operator.supportEmail}" style="color:#C98A5E">${operator.supportEmail}</a>.`)}
|
|
484
|
+
${setupLine(p, config.setupUrl)}${p(`Questions? Just reply to this email — it reaches a real person here. You can also write to <a href="mailto:${operator.supportEmail}" style="color:#C98A5E">${operator.supportEmail}</a>.`)}
|
|
475
485
|
<p style="margin:24px 0 0 0;color:#748272;font-family:Inter,Arial,sans-serif;font-size:13px;line-height:20px">${operator.name}</p>
|
|
476
486
|
</td></tr></table></td></tr></table></div>`;
|
|
477
487
|
const emailRes = await fetch(`${GHL_BASE}/conversations/messages`, {
|