From d08633c3135e40d8c97515a17e3f0aac6c2a2d72 Mon Sep 17 00:00:00 2001 From: Alex Rock Date: Thu, 11 Apr 2024 15:13:12 -0600 Subject: [PATCH 1/3] feat: fix build bug, remove environmentId requirement and stop deleting spaces --- package-lock.json | 120 ++++++++++++++++++ .../space/space-frame/spaceFrame.component.ts | 2 +- .../spaces/src/utils/createSimpleListener.ts | 24 ++-- .../spaces/src/utils/useInitializeSpace.ts | 4 - packages/angular/src/app/app.component.ts | 4 +- 5 files changed, 139 insertions(+), 15 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9806ae07..1ac41bf3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -41083,6 +41083,126 @@ "@vue/server-renderer": "3.3.4", "@vue/shared": "3.3.4" } + }, + "node_modules/@next/swc-darwin-x64": { + "version": "13.5.1", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.5.1.tgz", + "integrity": "sha512-uvTZrZa4D0bdWa1jJ7X1tBGIxzpqSnw/ATxWvoRO9CVBvXSx87JyuISY+BWsfLFF59IRodESdeZwkWM2l6+Kjg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm64-gnu": { + "version": "13.5.1", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.5.1.tgz", + "integrity": "sha512-/52ThlqdORPQt3+AlMoO+omicdYyUEDeRDGPAj86ULpV4dg+/GCFCKAmFWT0Q4zChFwsAoZUECLcKbRdcc0SNg==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm64-musl": { + "version": "13.5.1", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.5.1.tgz", + "integrity": "sha512-L4qNXSOHeu1hEAeeNsBgIYVnvm0gg9fj2O2Yx/qawgQEGuFBfcKqlmIE/Vp8z6gwlppxz5d7v6pmHs1NB6R37w==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-x64-gnu": { + "version": "13.5.1", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.5.1.tgz", + "integrity": "sha512-QVvMrlrFFYvLtABk092kcZ5Mzlmsk2+SV3xYuAu8sbTuIoh0U2+HGNhVklmuYCuM3DAAxdiMQTNlRQmNH11udw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-x64-musl": { + "version": "13.5.1", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.5.1.tgz", + "integrity": "sha512-bBnr+XuWc28r9e8gQ35XBtyi5KLHLhTbEvrSgcWna8atI48sNggjIK8IyiEBO3KIrcUVXYkldAzGXPEYMnKt1g==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-arm64-msvc": { + "version": "13.5.1", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.5.1.tgz", + "integrity": "sha512-EQGeE4S5c9v06jje9gr4UlxqUEA+zrsgPi6kg9VwR+dQHirzbnVJISF69UfKVkmLntknZJJI9XpWPB6q0Z7mTg==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-ia32-msvc": { + "version": "13.5.1", + "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.5.1.tgz", + "integrity": "sha512-1y31Q6awzofVjmbTLtRl92OX3s+W0ZfO8AP8fTnITcIo9a6ATDc/eqa08fd6tSpFu6IFpxOBbdevOjwYTGx/AQ==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-x64-msvc": { + "version": "13.5.1", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.5.1.tgz", + "integrity": "sha512-+9XBQizy7X/GuwNegq+5QkkxAPV7SBsIwapVRQd9WSvvU20YO23B3bZUpevdabi4fsd25y9RJDDncljy/V54ww==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } } } } diff --git a/packages/angular/projects/spaces/src/lib/space/space-frame/spaceFrame.component.ts b/packages/angular/projects/spaces/src/lib/space/space-frame/spaceFrame.component.ts index 540214bf..ff31a095 100644 --- a/packages/angular/projects/spaces/src/lib/space/space-frame/spaceFrame.component.ts +++ b/packages/angular/projects/spaces/src/lib/space/space-frame/spaceFrame.component.ts @@ -57,7 +57,7 @@ export class SpaceFrame implements OnInit { const dispatchEvent = (event: any) => { if (!event) return - const eventPayload = event.src ? event.src : event + const eventPayload = event.src || event const eventInstance = new FlatfileEvent(eventPayload, accessToken, apiUrl) return listenerInstance?.dispatchEvent(eventInstance) diff --git a/packages/angular/projects/spaces/src/utils/createSimpleListener.ts b/packages/angular/projects/spaces/src/utils/createSimpleListener.ts index 32c0d472..6a420bab 100644 --- a/packages/angular/projects/spaces/src/utils/createSimpleListener.ts +++ b/packages/angular/projects/spaces/src/utils/createSimpleListener.ts @@ -1,5 +1,6 @@ -import api from '@flatfile/api' +import { FlatfileClient } from '@flatfile/api' import { + DefaultSubmitSettings, JobHandler, SheetHandler, SimpleOnboarding, @@ -9,14 +10,20 @@ import { FlatfileEvent, FlatfileListener } from '@flatfile/listener' import { recordHook } from '@flatfile/plugin-record-hook' interface SimpleListenerType - extends Pick { + extends Pick< + SimpleOnboarding, + 'onRecordHook' | 'onSubmit' | 'submitSettings' + > { slug: string } +const api = new FlatfileClient() + const createSimpleListener = ({ onRecordHook, onSubmit, slug, + submitSettings, }: SimpleListenerType) => FlatfileListener.create((client: FlatfileListener) => { if (onRecordHook) { @@ -24,12 +31,12 @@ const createSimpleListener = ({ recordHook( slug, async (record: FlatfileRecord, event?: FlatfileEvent) => - // @ts-ignore - something weird with the `data` prop and the types upstream in the packages being declared in different places, but overall this is fine onRecordHook(record, event) ) ) } if (onSubmit) { + const onSubmitSettings = { ...DefaultSubmitSettings, ...submitSettings } client.filter( { job: 'workbook:simpleSubmitAction' }, (configure: FlatfileListener) => { @@ -46,21 +53,22 @@ const createSimpleListener = ({ // this assumes we are only allowing 1 sheet here (which we've talked about doing initially) const sheet = new SheetHandler(workbookSheets[0].id) - await onSubmit({ job, sheet }) + if (onSubmit) { + await onSubmit({ job, sheet, event }) + } await api.jobs.complete(jobId, { outcome: { message: 'complete', }, }) - await api.spaces.delete(spaceId) + if (onSubmitSettings.deleteSpaceAfterSubmit) { + await api.spaces.archiveSpace(spaceId) + } } catch (error: any) { if (jobId) { await api.jobs.cancel(jobId) } - if (spaceId) { - await api.spaces.delete(spaceId) - } console.error('Error:', error.stack) } }) diff --git a/packages/angular/projects/spaces/src/utils/useInitializeSpace.ts b/packages/angular/projects/spaces/src/utils/useInitializeSpace.ts index fd0ba0f1..97572741 100644 --- a/packages/angular/projects/spaces/src/utils/useInitializeSpace.ts +++ b/packages/angular/projects/spaces/src/utils/useInitializeSpace.ts @@ -38,10 +38,6 @@ const useInitializeSpace = ( throw new Error('Missing required publishable key') } - if (!environmentId) { - throw new Error('Missing required environment id') - } - const limitedAccessApi = authenticate(publishableKey, apiUrl) const spaceRequestBody = { name, diff --git a/packages/angular/src/app/app.component.ts b/packages/angular/src/app/app.component.ts index 11fc3510..8bc30c35 100644 --- a/packages/angular/src/app/app.component.ts +++ b/packages/angular/src/app/app.component.ts @@ -24,8 +24,8 @@ export class AppComponent { spaceProps: ISpace = { name: 'Trste!', - environmentId: 'us_env_1234', - publishableKey: 'sk_1234', + environmentId: 'us_env_ZvaDGP3B', + publishableKey: 'pk_0d40167fccfc47e9a4ec0223e9787e63', workbook, listener, userInfo: { From 7c240914d90759b96baf6a2b2ae3bfff9fb74e01 Mon Sep 17 00:00:00 2001 From: Alex Rock Date: Thu, 11 Apr 2024 22:21:25 -0600 Subject: [PATCH 2/3] feat: cleanup --- packages/angular/projects/spaces/package.json | 2 +- .../space/space-frame/spaceFrame.component.ts | 98 +++++++++++-------- .../spaces/src/lib/space/space.component.ts | 4 +- packages/angular/src/app/app.component.ts | 4 +- packages/angular/src/app/sheet.ts | 23 +++++ .../angular/src/app/simplified.component.ts | 27 +---- packages/angular/src/app/workbook.ts | 30 +----- 7 files changed, 87 insertions(+), 101 deletions(-) create mode 100644 packages/angular/src/app/sheet.ts diff --git a/packages/angular/projects/spaces/package.json b/packages/angular/projects/spaces/package.json index 00268c7d..35cd54c1 100644 --- a/packages/angular/projects/spaces/package.json +++ b/packages/angular/projects/spaces/package.json @@ -1,6 +1,6 @@ { "name": "@flatfile/angular-sdk", - "version": "1.1.0", + "version": "1.3.0", "homepage": "https://flatfile.com/", "description": "Angular flatfile sdk", "license": "MIT", diff --git a/packages/angular/projects/spaces/src/lib/space/space-frame/spaceFrame.component.ts b/packages/angular/projects/spaces/src/lib/space/space-frame/spaceFrame.component.ts index ff31a095..e9ec8382 100644 --- a/packages/angular/projects/spaces/src/lib/space/space-frame/spaceFrame.component.ts +++ b/packages/angular/projects/spaces/src/lib/space/space-frame/spaceFrame.component.ts @@ -1,19 +1,19 @@ -import { Component, Input, OnInit } from "@angular/core"; -import { ISpace, SimpleOnboarding } from "@flatfile/embedded-utils"; -import { Browser, FlatfileEvent } from '@flatfile/listener'; - -import addSpaceInfo from '../../../utils/addSpaceInfo'; -import authenticate from "../../../utils/authenticate"; -import createSimpleListener from "../../../utils/createSimpleListener"; -import { SpaceCloseModalPropsType } from "../space-close-modal/spaceCloseModal.component"; -import { getContainerStyles, getIframeStyles } from "./embeddedStyles"; - -export type SpaceFramePropsType = ISpace & { - spaceId: string; - spaceUrl: string; - localAccessToken: string; - handleCloseInstance: () => void; - closeInstance: boolean; +import { Component, Input, OnInit } from '@angular/core' +import { ISpace, SimpleOnboarding } from '@flatfile/embedded-utils' +import { Browser, FlatfileEvent } from '@flatfile/listener' + +import addSpaceInfo from '../../../utils/addSpaceInfo' +import authenticate from '../../../utils/authenticate' +import createSimpleListener from '../../../utils/createSimpleListener' +import { SpaceCloseModalPropsType } from '../space-close-modal/spaceCloseModal.component' +import { getContainerStyles, getIframeStyles } from './embeddedStyles' + +export type SpaceFramePropsType = ISpace & { + spaceId: string + spaceUrl: string + localAccessToken: string + handleCloseInstance: () => void + closeInstance: boolean } @Component({ @@ -28,21 +28,28 @@ export class SpaceFrame implements OnInit { {} as SpaceCloseModalPropsType iframeWrapperStyle = {} iframeStyle = {} - handlePostMessageInstance: ((event: MessageEvent<{ flatfileEvent: FlatfileEvent }>) => void) = () => {} + handlePostMessageInstance: ( + event: MessageEvent<{ flatfileEvent: FlatfileEvent }> + ) => void = () => {} - @Input({required: true}) spaceFrameProps: SpaceFramePropsType = {} as SpaceFramePropsType - @Input({required: true}) loading: boolean = false + @Input({ required: true }) spaceFrameProps: SpaceFramePropsType = + {} as SpaceFramePropsType + @Input({ required: true }) loading: boolean = false async created() { - const { listener, apiUrl, closeSpace, workbook } = this.spaceFrameProps; + const { listener, apiUrl, closeSpace, workbook } = this.spaceFrameProps const accessToken = this.spaceFrameProps.localAccessToken const simpleListenerSlug = workbook?.sheets?.[0].slug || 'slug' - const listenerInstance = listener || createSimpleListener({ - onRecordHook: (this.spaceFrameProps as SimpleOnboarding).onRecordHook, - onSubmit: (this.spaceFrameProps as SimpleOnboarding).onSubmit, - slug: simpleListenerSlug, - }) + const listenerInstance = + listener || + createSimpleListener({ + onRecordHook: (this.spaceFrameProps as SimpleOnboarding).onRecordHook, + onSubmit: (this.spaceFrameProps as SimpleOnboarding).onSubmit, + submitSettings: (this.spaceFrameProps as SimpleOnboarding) + .submitSettings, + slug: simpleListenerSlug, + }) if (listenerInstance && typeof apiUrl === 'string') { listenerInstance.mount( @@ -63,7 +70,9 @@ export class SpaceFrame implements OnInit { return listenerInstance?.dispatchEvent(eventInstance) } - const handlePostMessage = (event: MessageEvent<{ flatfileEvent:FlatfileEvent }>) => { + const handlePostMessage = ( + event: MessageEvent<{ flatfileEvent: FlatfileEvent }> + ) => { const { flatfileEvent } = event.data if (!flatfileEvent) return if ( @@ -91,24 +100,27 @@ export class SpaceFrame implements OnInit { sidebarConfig, userInfo, spaceId, - apiUrl = "https://platform.flatfile.com/api" - } = this.spaceFrameProps; - - const accessToken = this.spaceFrameProps.localAccessToken; - - if(publishableKey) { - const fullAccessApi = authenticate(accessToken, apiUrl); - await addSpaceInfo({ - publishableKey, - workbook, - environmentId, - document, - themeConfig, - sidebarConfig, - userInfo - }, spaceId, fullAccessApi); + apiUrl = 'https://platform.flatfile.com/api', + } = this.spaceFrameProps + + const accessToken = this.spaceFrameProps.localAccessToken + + if (publishableKey) { + const fullAccessApi = authenticate(accessToken, apiUrl) + await addSpaceInfo( + { + publishableKey, + workbook, + environmentId, + document, + themeConfig, + sidebarConfig, + userInfo, + }, + spaceId, + fullAccessApi + ) } - } openCloseModalDialog() { diff --git a/packages/angular/projects/spaces/src/lib/space/space.component.ts b/packages/angular/projects/spaces/src/lib/space/space.component.ts index 8de2e274..caa6ef31 100644 --- a/packages/angular/projects/spaces/src/lib/space/space.component.ts +++ b/packages/angular/projects/spaces/src/lib/space/space.component.ts @@ -5,7 +5,7 @@ import useInitializeSpace from '../../utils/useInitializeSpace'; import { SpaceFramePropsType } from './space-frame/spaceFrame.component'; import { SpaceService } from './space.service'; -type ReusedOrObording = ReusedSpaceWithAccessToken | SimpleOnboarding +type ReusedOrOnboarding = ReusedSpaceWithAccessToken | SimpleOnboarding @Component({ selector: 'flatfile-space', @@ -43,7 +43,7 @@ export class Space implements OnInit{ this.closeInstance = true; } - initSpace = async (spaceProps: ReusedOrObording) => { + initSpace = async (spaceProps: ReusedOrOnboarding) => { this.closeInstance = false const { space, initializeSpace } = useInitializeSpace(spaceProps as SimpleOnboarding); diff --git a/packages/angular/src/app/app.component.ts b/packages/angular/src/app/app.component.ts index 8bc30c35..11fc3510 100644 --- a/packages/angular/src/app/app.component.ts +++ b/packages/angular/src/app/app.component.ts @@ -24,8 +24,8 @@ export class AppComponent { spaceProps: ISpace = { name: 'Trste!', - environmentId: 'us_env_ZvaDGP3B', - publishableKey: 'pk_0d40167fccfc47e9a4ec0223e9787e63', + environmentId: 'us_env_1234', + publishableKey: 'sk_1234', workbook, listener, userInfo: { diff --git a/packages/angular/src/app/sheet.ts b/packages/angular/src/app/sheet.ts new file mode 100644 index 00000000..2ecee15d --- /dev/null +++ b/packages/angular/src/app/sheet.ts @@ -0,0 +1,23 @@ +import { Flatfile } from '@flatfile/api' + +export const sheet: Flatfile.SheetConfig = { + name: 'Contacts', + slug: 'contacts', + fields: [ + { + key: 'firstName', + type: 'string', + label: 'First Name', + }, + { + key: 'lastName', + type: 'string', + label: 'Last Name', + }, + { + key: 'email', + type: 'string', + label: 'Email', + }, + ], +} diff --git a/packages/angular/src/app/simplified.component.ts b/packages/angular/src/app/simplified.component.ts index 08ad33f6..39de35ad 100644 --- a/packages/angular/src/app/simplified.component.ts +++ b/packages/angular/src/app/simplified.component.ts @@ -1,30 +1,5 @@ import { Component, OnInit } from '@angular/core'; -import { Flatfile } from '@flatfile/api' - -const sheet = { - name: 'Contacts', - slug: 'contacts', - fields: [ - { - key: 'firstName', - type: 'string', - label: 'First Name', - config: undefined, - } as Flatfile.Property.String, - { - key: 'lastName', - type: 'string', - label: 'Last Name', - config: undefined, - } as Flatfile.Property.String, - { - key: 'email', - type: 'string', - label: 'Email', - config: undefined, - } as Flatfile.Property.String, - ], -} +import { sheet } from './sheet'; @Component({ selector: 'app-root', diff --git a/packages/angular/src/app/workbook.ts b/packages/angular/src/app/workbook.ts index cfa1756c..b77374f4 100644 --- a/packages/angular/src/app/workbook.ts +++ b/packages/angular/src/app/workbook.ts @@ -1,34 +1,10 @@ import { Flatfile } from '@flatfile/api' +import { sheet } from './sheet' -export const workbook: Pick< - Flatfile.CreateWorkbookConfig, - 'name' | 'labels' | 'sheets' | 'actions' -> = { +export const workbook: Flatfile.CreateWorkbookConfig = { name: 'All Data', labels: ['pinned'], - sheets: [ - { - name: 'Contacts', - slug: 'contacts', - fields: [ - { - key: 'firstName', - type: 'string', - label: 'First Name', - }, - { - key: 'lastName', - type: 'string', - label: 'Last Name', - }, - { - key: 'email', - type: 'string', - label: 'Email', - }, - ], - }, - ], + sheets: [sheet], actions: [ { operation: 'submitActionFg', From 2ec3c1a18a426fd86b19db0ce65f6492c5c5fb9b Mon Sep 17 00:00:00 2001 From: Alex Rock Date: Thu, 11 Apr 2024 22:44:00 -0600 Subject: [PATCH 3/3] feat: update dependencies --- package-lock.json | 154 +----------------- packages/angular/package.json | 8 +- .../angular/projects/spaces/package-lock.json | 20 +-- packages/angular/projects/spaces/package.json | 2 +- .../projects/spaces/src/utils/addSpaceInfo.ts | 4 +- .../spaces/src/utils/useInitializeSpace.ts | 2 +- packages/angular/src/app/app.component.ts | 11 +- packages/angular/src/app/reuse.component.ts | 11 +- .../angular/src/app/simplified.component.ts | 30 ++-- 9 files changed, 49 insertions(+), 193 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1ac41bf3..6868a4a5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31352,10 +31352,10 @@ "@angular/platform-browser": "^16.2.0", "@angular/platform-browser-dynamic": "^16.2.0", "@angular/router": "^16.2.0", - "@flatfile/api": "^1.6.7", - "@flatfile/embedded-utils": "1.1.14", - "@flatfile/listener": "1.0.1", - "@flatfile/plugin-record-hook": "1.4.1", + "@flatfile/api": "^1.7.11", + "@flatfile/embedded-utils": "^1.1.15", + "@flatfile/listener": "^1.0.2", + "@flatfile/plugin-record-hook": "^1.4.1", "rxjs": "~7.8.0", "symbol-observable": "^4.0.0", "tslib": "^2.3.0", @@ -32272,32 +32272,6 @@ "resolved": "https://registry.npmjs.org/@flatfile/cross-env-config/-/cross-env-config-0.0.4.tgz", "integrity": "sha512-mNaqtASTly4N09pjQts5zDnYXFLC891TCxJEiFUnil8p6lQciyd0gnPSnhJD0TTlO5817gX3mLE9RDoAETtIbg==" }, - "packages/angular/node_modules/@flatfile/embedded-utils": { - "version": "1.1.14", - "resolved": "https://registry.npmjs.org/@flatfile/embedded-utils/-/embedded-utils-1.1.14.tgz", - "integrity": "sha512-34P6yVGKRBcKjME+krzEvlyztzgJVoeZnWx5CpXNpflKYMMnskEOOIJh5ytUtcvBI3gnfIn8Mv9dTe+cCpzS3Q==", - "dependencies": { - "@flatfile/api": "^1.7.11", - "@flatfile/listener": "^1.0.0", - "@flatfile/util-common": "^1.1.0", - "pubnub": "^7.2.2" - } - }, - "packages/angular/node_modules/@flatfile/listener": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@flatfile/listener/-/listener-1.0.1.tgz", - "integrity": "sha512-XClO1KhQDL9Q7zfTANcMeole7Q/2QaIhzttZI+p04PjB+bUlIvk+yUbHvhnLahNkvLHRoIth4p+oBj8tPC1cxA==", - "dependencies": { - "ansi-colors": "^4.1.3", - "cross-fetch": "^4.0.0", - "flat": "^5.0.2", - "pako": "^2.1.0", - "wildcard-match": "^5.1.2" - }, - "peerDependencies": { - "@flatfile/api": "^1.5.10" - } - }, "packages/angular/node_modules/@flatfile/plugin-record-hook": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/@flatfile/plugin-record-hook/-/plugin-record-hook-1.4.1.tgz", @@ -41083,126 +41057,6 @@ "@vue/server-renderer": "3.3.4", "@vue/shared": "3.3.4" } - }, - "node_modules/@next/swc-darwin-x64": { - "version": "13.5.1", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.5.1.tgz", - "integrity": "sha512-uvTZrZa4D0bdWa1jJ7X1tBGIxzpqSnw/ATxWvoRO9CVBvXSx87JyuISY+BWsfLFF59IRodESdeZwkWM2l6+Kjg==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-linux-arm64-gnu": { - "version": "13.5.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.5.1.tgz", - "integrity": "sha512-/52ThlqdORPQt3+AlMoO+omicdYyUEDeRDGPAj86ULpV4dg+/GCFCKAmFWT0Q4zChFwsAoZUECLcKbRdcc0SNg==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-linux-arm64-musl": { - "version": "13.5.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.5.1.tgz", - "integrity": "sha512-L4qNXSOHeu1hEAeeNsBgIYVnvm0gg9fj2O2Yx/qawgQEGuFBfcKqlmIE/Vp8z6gwlppxz5d7v6pmHs1NB6R37w==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-linux-x64-gnu": { - "version": "13.5.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.5.1.tgz", - "integrity": "sha512-QVvMrlrFFYvLtABk092kcZ5Mzlmsk2+SV3xYuAu8sbTuIoh0U2+HGNhVklmuYCuM3DAAxdiMQTNlRQmNH11udw==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-linux-x64-musl": { - "version": "13.5.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.5.1.tgz", - "integrity": "sha512-bBnr+XuWc28r9e8gQ35XBtyi5KLHLhTbEvrSgcWna8atI48sNggjIK8IyiEBO3KIrcUVXYkldAzGXPEYMnKt1g==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-win32-arm64-msvc": { - "version": "13.5.1", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.5.1.tgz", - "integrity": "sha512-EQGeE4S5c9v06jje9gr4UlxqUEA+zrsgPi6kg9VwR+dQHirzbnVJISF69UfKVkmLntknZJJI9XpWPB6q0Z7mTg==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-win32-ia32-msvc": { - "version": "13.5.1", - "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.5.1.tgz", - "integrity": "sha512-1y31Q6awzofVjmbTLtRl92OX3s+W0ZfO8AP8fTnITcIo9a6ATDc/eqa08fd6tSpFu6IFpxOBbdevOjwYTGx/AQ==", - "cpu": [ - "ia32" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-win32-x64-msvc": { - "version": "13.5.1", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.5.1.tgz", - "integrity": "sha512-+9XBQizy7X/GuwNegq+5QkkxAPV7SBsIwapVRQd9WSvvU20YO23B3bZUpevdabi4fsd25y9RJDDncljy/V54ww==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10" - } } } } diff --git a/packages/angular/package.json b/packages/angular/package.json index bdc93506..e01249ba 100644 --- a/packages/angular/package.json +++ b/packages/angular/package.json @@ -18,10 +18,10 @@ "@angular/platform-browser": "^16.2.0", "@angular/platform-browser-dynamic": "^16.2.0", "@angular/router": "^16.2.0", - "@flatfile/api": "^1.6.7", - "@flatfile/embedded-utils": "1.1.14", - "@flatfile/listener": "1.0.1", - "@flatfile/plugin-record-hook": "1.4.1", + "@flatfile/api": "^1.7.11", + "@flatfile/embedded-utils": "^1.1.15", + "@flatfile/listener": "^1.0.2", + "@flatfile/plugin-record-hook": "^1.4.1", "rxjs": "~7.8.0", "symbol-observable": "^4.0.0", "tslib": "^2.3.0", diff --git a/packages/angular/projects/spaces/package-lock.json b/packages/angular/projects/spaces/package-lock.json index 84eb0460..ff2a4a9e 100644 --- a/packages/angular/projects/spaces/package-lock.json +++ b/packages/angular/projects/spaces/package-lock.json @@ -1,15 +1,15 @@ { "name": "@flatfile/angular-sdk", - "version": "1.1.0", + "version": "1.3.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@flatfile/angular-sdk", - "version": "1.1.0", + "version": "1.3.0", "license": "MIT", "dependencies": { - "@flatfile/embedded-utils": "1.1.14", + "@flatfile/embedded-utils": "1.1.15", "@flatfile/hooks": "^1.3.2", "tslib": "^2.3.0" }, @@ -71,12 +71,12 @@ "integrity": "sha512-mNaqtASTly4N09pjQts5zDnYXFLC891TCxJEiFUnil8p6lQciyd0gnPSnhJD0TTlO5817gX3mLE9RDoAETtIbg==" }, "node_modules/@flatfile/embedded-utils": { - "version": "1.1.14", - "resolved": "https://registry.npmjs.org/@flatfile/embedded-utils/-/embedded-utils-1.1.14.tgz", - "integrity": "sha512-34P6yVGKRBcKjME+krzEvlyztzgJVoeZnWx5CpXNpflKYMMnskEOOIJh5ytUtcvBI3gnfIn8Mv9dTe+cCpzS3Q==", + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/@flatfile/embedded-utils/-/embedded-utils-1.1.15.tgz", + "integrity": "sha512-xi0XWDo7ZdTHwDcNgfM3Mewg6w2kD14w1lpvQB0/KW6SOCjxSHd6CY/GazWVXf0DOSaaaW2UaiVrsH855cOwfA==", "dependencies": { "@flatfile/api": "^1.7.11", - "@flatfile/listener": "^1.0.0", + "@flatfile/listener": "^1.0.2", "@flatfile/util-common": "^1.1.0", "pubnub": "^7.2.2" } @@ -87,9 +87,9 @@ "integrity": "sha512-5HUBar6CnhhMU7lr4DnD79QfV4MtR1dUjZQJdt50HCS5pxy+tbF70JJSnoF/6itj+0hATkSC/Ep5C1XfABAGYw==" }, "node_modules/@flatfile/listener": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@flatfile/listener/-/listener-1.0.1.tgz", - "integrity": "sha512-XClO1KhQDL9Q7zfTANcMeole7Q/2QaIhzttZI+p04PjB+bUlIvk+yUbHvhnLahNkvLHRoIth4p+oBj8tPC1cxA==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@flatfile/listener/-/listener-1.0.2.tgz", + "integrity": "sha512-/VW0UvSGBwDG85LbSOa9Nj2aCQ8pMNsaGqiK7N/tWCXtiwF0Pnani1KoESMsGN3ECS7IIrDNuGYmtlc1igUDiQ==", "dependencies": { "ansi-colors": "^4.1.3", "cross-fetch": "^4.0.0", diff --git a/packages/angular/projects/spaces/package.json b/packages/angular/projects/spaces/package.json index 35cd54c1..db7a57da 100644 --- a/packages/angular/projects/spaces/package.json +++ b/packages/angular/projects/spaces/package.json @@ -17,7 +17,7 @@ "@angular/core": "^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" }, "dependencies": { - "@flatfile/embedded-utils": "1.1.14", + "@flatfile/embedded-utils": "1.1.15", "@flatfile/hooks": "^1.3.2", "tslib": "^2.3.0" }, diff --git a/packages/angular/projects/spaces/src/utils/addSpaceInfo.ts b/packages/angular/projects/spaces/src/utils/addSpaceInfo.ts index 3700c8e9..67ff0938 100644 --- a/packages/angular/projects/spaces/src/utils/addSpaceInfo.ts +++ b/packages/angular/projects/spaces/src/utils/addSpaceInfo.ts @@ -23,7 +23,7 @@ const addSpaceInfo = async ( if (workbook) { const localWorkbook = await api.workbooks.create({ spaceId, - environmentId, + ...(environmentId ? { environmentId } : {}), ...workbook, }) if (!localWorkbook || !localWorkbook.data || !localWorkbook.data.id) { @@ -32,7 +32,7 @@ const addSpaceInfo = async ( } const updatedSpace = await api.spaces.update(spaceId, { - environmentId, + ...(environmentId ? { environmentId } : {}), metadata: { theme: themeConfig, sidebarConfig: sidebarConfig || { showSidebar: false }, diff --git a/packages/angular/projects/spaces/src/utils/useInitializeSpace.ts b/packages/angular/projects/spaces/src/utils/useInitializeSpace.ts index 97572741..6666f883 100644 --- a/packages/angular/projects/spaces/src/utils/useInitializeSpace.ts +++ b/packages/angular/projects/spaces/src/utils/useInitializeSpace.ts @@ -56,7 +56,7 @@ const useInitializeSpace = ( try { space = await limitedAccessApi.spaces.create({ - environmentId, + ...(environmentId ? { environmentId } : {}), ...spaceRequestBody, }) } catch (error) { diff --git a/packages/angular/src/app/app.component.ts b/packages/angular/src/app/app.component.ts index 11fc3510..51d11360 100644 --- a/packages/angular/src/app/app.component.ts +++ b/packages/angular/src/app/app.component.ts @@ -1,7 +1,7 @@ -import { Component } from '@angular/core'; +import { Component } from '@angular/core' import { ISpace, SpaceService } from '@flatfile/angular' -import { workbook } from "./workbook"; -import { listener } from "./listener"; +import { workbook } from './workbook' +import { listener } from './listener' @Component({ selector: 'app-root', @@ -9,13 +9,13 @@ import { listener } from "./listener"; styleUrls: ['./app.component.scss'], }) export class AppComponent { - showSpace: boolean = false; + showSpace: boolean = false constructor(private spaceService: SpaceService) {} toggleSpace() { this.spaceService.OpenEmbed() - this.showSpace = !this.showSpace; + this.showSpace = !this.showSpace } closeSpace() { @@ -24,7 +24,6 @@ export class AppComponent { spaceProps: ISpace = { name: 'Trste!', - environmentId: 'us_env_1234', publishableKey: 'sk_1234', workbook, listener, diff --git a/packages/angular/src/app/reuse.component.ts b/packages/angular/src/app/reuse.component.ts index 7e017a7c..91213e6b 100644 --- a/packages/angular/src/app/reuse.component.ts +++ b/packages/angular/src/app/reuse.component.ts @@ -1,6 +1,6 @@ -import { Component } from '@angular/core'; +import { Component } from '@angular/core' import { ISpace, SpaceService } from '@flatfile/angular' -import { listener } from "./listener"; +import { listener } from './listener' @Component({ selector: 'app-root', @@ -8,13 +8,13 @@ import { listener } from "./listener"; styleUrls: ['./app.component.scss'], }) export class AppComponent { - showSpace: boolean = false; + showSpace: boolean = false constructor(private spaceService: SpaceService) {} toggleSpace() { this.spaceService.OpenEmbed() - this.showSpace = !this.showSpace; + this.showSpace = !this.showSpace } closeSpace() { @@ -24,9 +24,8 @@ export class AppComponent { spaceProps: ISpace = { space: { id: 'us_sp_123', - accessToken: 'sk_1234' + accessToken: 'sk_1234', }, - environmentId: 'us_env_1234', listener, closeSpace: { operation: 'submitActionFg', diff --git a/packages/angular/src/app/simplified.component.ts b/packages/angular/src/app/simplified.component.ts index 39de35ad..2a409a18 100644 --- a/packages/angular/src/app/simplified.component.ts +++ b/packages/angular/src/app/simplified.component.ts @@ -1,36 +1,40 @@ -import { Component, OnInit } from '@angular/core'; -import { sheet } from './sheet'; +import { Component, OnInit } from '@angular/core' +import { sheet } from './sheet' @Component({ selector: 'app-root', templateUrl: './app.component.html', - styleUrls: ['./app.component.scss'] + styleUrls: ['./app.component.scss'], }) export class AppComponent implements OnInit { - showSpace: boolean = false; - data: any; + showSpace: boolean = false + data: any constructor() {} - ngOnInit() { } - - title = 'angular'; + ngOnInit() {} + title = 'angular' toggleSpace() { - this.showSpace = !this.showSpace; + this.showSpace = !this.showSpace } closeSpace() { - this.showSpace = false; + this.showSpace = false } spaceProps = { name: 'My space!', - environmentId: 'us_env_1234', publishableKey: 'sk_1234', sheet, - onSubmit: async ({ job, sheet, }: { job?: any, sheet?: any }): Promise => { + onSubmit: async ({ + job, + sheet, + }: { + job?: any + sheet?: any + }): Promise => { const data = await sheet.allData() console.log('onSubmit', data) }, @@ -46,6 +50,6 @@ export class AppComponent implements OnInit { closeSpace: { operation: 'submitActionFg', onClose: this.closeSpace.bind(this), - } + }, } }