From ba480ac7a18d9697dbc57790fcebbfa4f3b0b1c3 Mon Sep 17 00:00:00 2001 From: David Nguyen Date: Thu, 1 Oct 2026 11:55:01 +1000 Subject: [PATCH] fix: change content embed variable --- .../envelope-editor-fields-page.tsx | 76 ++++++++++--------- .../envelope-editor/envelope-editor.tsx | 17 +---- apps/remix/app/routes/embed+/playground.tsx | 2 +- .../providers/envelope-editor-provider.tsx | 4 +- packages/lib/types/envelope-editor.ts | 6 +- packages/lib/utils/embed-config.ts | 3 +- 6 files changed, 49 insertions(+), 59 deletions(-) diff --git a/apps/remix/app/components/general/envelope-editor/envelope-editor-fields-page.tsx b/apps/remix/app/components/general/envelope-editor/envelope-editor-fields-page.tsx index 95d26e74a..4d18ca3cd 100644 --- a/apps/remix/app/components/general/envelope-editor/envelope-editor-fields-page.tsx +++ b/apps/remix/app/components/general/envelope-editor/envelope-editor-fields-page.tsx @@ -268,7 +268,9 @@ export const EnvelopeEditorFieldsPage = () => { }); }; - if (!editorConfig.general?.allowAddFieldsStep && !editorConfig.general?.allowAddContentsStep) { + const { allowContents } = editorConfig.actions; + + if (!editorConfig.general?.allowAddFieldsStep) { return null; } @@ -371,7 +373,7 @@ export const EnvelopeEditorFieldsPage = () => { customPageRenderer={EnvelopeEditorFieldsPageRenderer} scrollParentRef={scrollableContainerRef} errorMessage={PDF_VIEWER_ERROR_MESSAGES.editor} - toolbar={['zoom', 'fields', 'contents']} + toolbar={allowContents ? ['zoom', 'fields', 'contents'] : ['zoom', 'fields']} /> ) : (
@@ -391,7 +393,7 @@ export const EnvelopeEditorFieldsPage = () => { {currentEnvelopeItem && envelope.recipients.length > 0 && (
onEditorTabChange(value as EnvelopeEditorTab)}> - {editorConfig.general?.allowAddFieldsStep && editorConfig.general?.allowAddContentsStep && ( + {allowContents && ( { {/* Contents tab */} - -
-

- Add Content -

+ {allowContents && ( + +
+

+ Add Content +

- -
+ +
- {/* Content details section. */} - - {selectedContent && ( -
- + {/* Content details section. */} + + {selectedContent && ( +
+ -
-

- {_(ContentSettingsTypeTranslations[selectedContent.contentMeta.type])} -

+
+

+ {_(ContentSettingsTypeTranslations[selectedContent.contentMeta.type])} +

- {match(selectedContent.contentMeta.type) - .with(EnvelopeContentType.TEXT, () => ) - .with(EnvelopeContentType.LINE, () => ) - .with(EnvelopeContentType.SHAPE, () => ) - .with(EnvelopeContentType.HIGHLIGHT, () => ) - .with(EnvelopeContentType.IMAGE, () => ( - - )) - .exhaustive()} -
-
- )} -
- + {match(selectedContent.contentMeta.type) + .with(EnvelopeContentType.TEXT, () => ) + .with(EnvelopeContentType.LINE, () => ) + .with(EnvelopeContentType.SHAPE, () => ) + .with(EnvelopeContentType.HIGHLIGHT, () => ) + .with(EnvelopeContentType.IMAGE, () => ( + + )) + .exhaustive()} +
+ + )} + + + )}
)} diff --git a/apps/remix/app/components/general/envelope-editor/envelope-editor.tsx b/apps/remix/app/components/general/envelope-editor/envelope-editor.tsx index 03fee92b2..f715669e4 100644 --- a/apps/remix/app/components/general/envelope-editor/envelope-editor.tsx +++ b/apps/remix/app/components/general/envelope-editor/envelope-editor.tsx @@ -90,13 +90,7 @@ export const EnvelopeEditor = () => { const [searchParams, setSearchParams] = useSearchParams(); const { - general: { - minimizeLeftSidebar, - allowUploadAndRecipientStep, - allowAddFieldsStep, - allowAddContentsStep, - allowPreviewStep, - }, + general: { minimizeLeftSidebar, allowUploadAndRecipientStep, allowAddFieldsStep, allowPreviewStep }, actions: { allowDistributing, allowDirectLink, @@ -114,7 +108,7 @@ export const EnvelopeEditor = () => { steps.push(UPLOAD_STEP); } - if (allowAddFieldsStep || allowAddContentsStep) { + if (allowAddFieldsStep) { steps.push(ADD_FIELDS_STEP); } @@ -530,16 +524,11 @@ export const EnvelopeEditor = () => { pageToRender, allowUploadAndRecipientStep, allowAddFieldsStep, - allowAddContentsStep, allowPreviewStep, }) .with({ pageToRender: 'loading' }, () => ) .with({ pageToRender: 'upload', allowUploadAndRecipientStep: true }, () => ) - .with( - { pageToRender: 'addFields', allowAddFieldsStep: true }, - { pageToRender: 'addFields', allowAddContentsStep: true }, - () => , - ) + .with({ pageToRender: 'addFields', allowAddFieldsStep: true }, () => ) .with({ pageToRender: 'preview', allowPreviewStep: true }, () => ) .otherwise(() => null)} diff --git a/apps/remix/app/routes/embed+/playground.tsx b/apps/remix/app/routes/embed+/playground.tsx index 55a8bddfd..d443d1bfd 100644 --- a/apps/remix/app/routes/embed+/playground.tsx +++ b/apps/remix/app/routes/embed+/playground.tsx @@ -50,7 +50,6 @@ export default function EmbedPlaygroundPage() { allowConfigureEnvelopeTitle: true, allowUploadAndRecipientStep: true, allowAddFieldsStep: true, - allowAddContentsStep: true, allowPreviewStep: true, minimizeLeftSidebar: true, }); @@ -68,6 +67,7 @@ export default function EmbedPlaygroundPage() { }); const [actionsFeatures, setActionsFeatures] = useState({ + allowContents: true, allowAttachments: true, allowDistributing: false, allowDirectLink: false, diff --git a/packages/lib/client-only/providers/envelope-editor-provider.tsx b/packages/lib/client-only/providers/envelope-editor-provider.tsx index e3dc6f3e8..21be26d90 100644 --- a/packages/lib/client-only/providers/envelope-editor-provider.tsx +++ b/packages/lib/client-only/providers/envelope-editor-provider.tsx @@ -206,9 +206,7 @@ export const EnvelopeEditorProvider = ({ }; }, [isCscMode, providedEditorConfig]); - const [selectedEditorTab, setSelectedEditorTab] = useState( - editorConfig.general?.allowAddFieldsStep ? 'fields' : 'contents', - ); + const [selectedEditorTab, setSelectedEditorTab] = useState('fields'); const externalFlushCallbacksRef = useRef Promise>>(new Map()); const pendingMutationsRef = useRef>>(new Set()); diff --git a/packages/lib/types/envelope-editor.ts b/packages/lib/types/envelope-editor.ts index aa74d9308..4721ff48e 100644 --- a/packages/lib/types/envelope-editor.ts +++ b/packages/lib/types/envelope-editor.ts @@ -25,7 +25,6 @@ export const ZEnvelopeEditorSettingsSchema = z.object({ allowConfigureEnvelopeTitle: z.boolean(), allowUploadAndRecipientStep: z.boolean(), allowAddFieldsStep: z.boolean(), - allowAddContentsStep: z.boolean(), allowPreviewStep: z.boolean(), minimizeLeftSidebar: z.boolean(), }), @@ -54,6 +53,7 @@ export const ZEnvelopeEditorSettingsSchema = z.object({ * Action related configurations. */ actions: z.object({ + allowContents: z.boolean(), allowAttachments: z.boolean(), allowDistributing: z.boolean(), allowDirectLink: z.boolean(), @@ -113,7 +113,6 @@ export const DEFAULT_EDITOR_CONFIG: EnvelopeEditorConfig = { allowConfigureEnvelopeTitle: true, allowUploadAndRecipientStep: true, allowAddFieldsStep: true, - allowAddContentsStep: true, allowPreviewStep: true, minimizeLeftSidebar: false, }, @@ -130,6 +129,7 @@ export const DEFAULT_EDITOR_CONFIG: EnvelopeEditorConfig = { allowConfigureEmailReplyTo: true, }, actions: { + allowContents: true, allowAttachments: true, allowDistributing: true, allowDirectLink: true, @@ -173,7 +173,6 @@ export const DEFAULT_EMBEDDED_EDITOR_CONFIG = { allowConfigureEnvelopeTitle: true, allowUploadAndRecipientStep: true, allowAddFieldsStep: true, - allowAddContentsStep: true, allowPreviewStep: true, minimizeLeftSidebar: true, }, @@ -190,6 +189,7 @@ export const DEFAULT_EMBEDDED_EDITOR_CONFIG = { allowConfigureEmailReplyTo: true, }, actions: { + allowContents: true, allowAttachments: true, allowDistributing: false, // These are not supported for embeds, and are directly excluded in the embedded repo. allowDirectLink: false, // These are not supported for embeds, and are directly excluded in the embedded repo. diff --git a/packages/lib/utils/embed-config.ts b/packages/lib/utils/embed-config.ts index f59077a01..efe4f6f8a 100644 --- a/packages/lib/utils/embed-config.ts +++ b/packages/lib/utils/embed-config.ts @@ -92,8 +92,6 @@ export const buildEmbeddedFeatures = (features: DeepPartial