Skip to content

Commit 632fc2c

Browse files
authored
Merge pull request #985 from trycompai/main
[comp] Production Deploy
2 parents 4fc3a1d + e090686 commit 632fc2c

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

apps/app/src/app/(app)/[orgId]/policies/[policyId]/editor/components/PolicyDetails.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@ import { PolicyEditor } from '@/components/editor/policy-editor';
44
import '@comp/ui/editor.css';
55
import type { JSONContent } from '@tiptap/react';
66
import { updatePolicy } from '../actions/update-policy';
7+
8+
const removeUnsupportedMarks = (node: JSONContent): JSONContent => {
9+
if (node.marks) {
10+
node.marks = node.marks.filter((mark) => mark.type !== 'textStyle');
11+
}
12+
13+
if (node.content) {
14+
node.content = node.content.map(removeUnsupportedMarks);
15+
}
16+
17+
return node;
18+
};
19+
720
interface PolicyDetailsProps {
821
policyId: string;
922
policyContent: JSONContent | JSONContent[];
@@ -20,7 +33,7 @@ export function PolicyPageEditor({
2033
: typeof policyContent === 'object' && policyContent !== null
2134
? [policyContent as JSONContent]
2235
: [];
23-
36+
const sanitizedContent = formattedContent.map(removeUnsupportedMarks);
2437
const handleSavePolicy = async (policyContent: JSONContent[]): Promise<void> => {
2538
if (!policyId) return;
2639

@@ -35,7 +48,7 @@ export function PolicyPageEditor({
3548
return (
3649
<div className="flex h-full flex-col border">
3750
<PolicyEditor
38-
content={formattedContent}
51+
content={sanitizedContent}
3952
onSave={handleSavePolicy}
4053
readOnly={isPendingApproval}
4154
/>

apps/app/src/app/api/stripe/syncStripeDataToKv.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { stripe } from '@/actions/organization/lib/stripe';
22
import { client } from '@comp/kv';
3+
import { STRIPE_SUB_CACHE } from './stripeDataToKv.type';
34

45
// The contents of this function should probably be wrapped in a try/catch
56
export async function syncStripeDataToKV(customerId: string) {
@@ -12,7 +13,7 @@ export async function syncStripeDataToKV(customerId: string) {
1213
});
1314

1415
if (subscriptions.data.length === 0) {
15-
const subData = { status: 'none' };
16+
const subData: STRIPE_SUB_CACHE = { status: 'none' };
1617
await client.set(`stripe:customer:${customerId}`, subData);
1718
return subData;
1819
}
@@ -21,7 +22,7 @@ export async function syncStripeDataToKV(customerId: string) {
2122
const subscription = subscriptions.data[0];
2223

2324
// Store complete subscription state
24-
const subData = {
25+
const subData: STRIPE_SUB_CACHE = {
2526
subscriptionId: subscription.id,
2627
status: subscription.status,
2728
priceId: subscription.items.data[0].price.id,

0 commit comments

Comments
 (0)