File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed
(app)/[orgId]/policies/[policyId]/editor/components Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,19 @@ import { PolicyEditor } from '@/components/editor/policy-editor';
44import '@comp/ui/editor.css' ;
55import type { JSONContent } from '@tiptap/react' ;
66import { 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+
720interface 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 />
Original file line number Diff line number Diff line change 11import { stripe } from '@/actions/organization/lib/stripe' ;
22import { 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
56export 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 ,
You can’t perform that action at this time.
0 commit comments