diff --git a/.changeset/young-peaches-occur.md b/.changeset/young-peaches-occur.md
new file mode 100644
index 00000000..a7827b73
--- /dev/null
+++ b/.changeset/young-peaches-occur.md
@@ -0,0 +1,6 @@
+---
+'@flatfile/embedded-utils': patch
+'@flatfile/javascript': patch
+---
+
+JavaScript: allow specifying submit complete options
diff --git a/apps/vanilla/cdn.html b/apps/vanilla/cdn.html
index a295438c..f0f1dc2e 100644
--- a/apps/vanilla/cdn.html
+++ b/apps/vanilla/cdn.html
@@ -1,7 +1,6 @@
-
-
+
Hello, world!
@@ -11,35 +10,50 @@
-
+
-
+
-
-
+
diff --git a/packages/embedded-utils/src/types/Space.ts b/packages/embedded-utils/src/types/Space.ts
index ab050ac6..bc2c0058 100644
--- a/packages/embedded-utils/src/types/Space.ts
+++ b/packages/embedded-utils/src/types/Space.ts
@@ -101,6 +101,10 @@ export interface ReusedSpaceWithAccessToken extends BaseSpace {
}
type SubmitSettings = {
+ complete?: {
+ acknowledge?: boolean
+ message?: string
+ }
deleteSpaceAfterSubmit?: boolean
}
export const DefaultSubmitSettings = {
diff --git a/packages/javascript/src/listener.ts b/packages/javascript/src/listener.ts
index d58c1073..697bc5be 100644
--- a/packages/javascript/src/listener.ts
+++ b/packages/javascript/src/listener.ts
@@ -87,7 +87,8 @@ export const createSimpleListener = ({
await api.jobs.complete(jobId, {
outcome: {
- message: 'complete',
+ acknowledge: submitSettings?.complete?.acknowledge ?? true,
+ message: submitSettings?.complete?.message ?? 'complete',
},
})
if (onSubmitSettings.deleteSpaceAfterSubmit) {
diff --git a/packages/javascript/src/startFlatfile.ts b/packages/javascript/src/startFlatfile.ts
index a69c3277..18547a4f 100644
--- a/packages/javascript/src/startFlatfile.ts
+++ b/packages/javascript/src/startFlatfile.ts
@@ -170,6 +170,7 @@ export async function startFlatfile(options: SimpleOnboarding | ISpace) {
onRecordHook: simpleOnboardingOptions?.onRecordHook,
onSubmit: simpleOnboardingOptions?.onSubmit,
slug: simpleListenerSlug,
+ submitSettings: simpleOnboardingOptions?.submitSettings,
}),
closeSpace,
closeSpaceNow,