-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
plugin-flow-builder: WebviewContentsContext and useWebviewContents #2810
Merged
Iru89
merged 15 commits into
master-lts
from
feature/blt-674-task-plugin-flow-builder-new-endpoint-for-webview-contents
Apr 17, 2024
Merged
plugin-flow-builder: WebviewContentsContext and useWebviewContents #2810
Iru89
merged 15 commits into
master-lts
from
feature/blt-674-task-plugin-flow-builder-new-endpoint-for-webview-contents
Apr 17, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… return a webviewContext
Iru89
requested review from
asastre,
vanbasten17,
alexgimenez02,
AinaVendrell,
AlbertGom and
CarlosELorenzo
April 10, 2024 08:08
vanbasten17
approved these changes
Apr 10, 2024
packages/botonic-plugin-flow-builder/src/webview/use-webview-contents.ts
Outdated
Show resolved
Hide resolved
packages/botonic-plugin-flow-builder/src/webview/use-webview-contents.ts
Outdated
Show resolved
Hide resolved
…, add locale as state and export function to change it
asastre
reviewed
Apr 15, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some doubts before approving
packages/botonic-plugin-flow-builder/src/webview/use-webview-contents.ts
Outdated
Show resolved
Hide resolved
packages/botonic-plugin-flow-builder/src/webview/use-webview-contents.ts
Outdated
Show resolved
Hide resolved
…Version in BotonicPluginFlowBuilderOptions as optionals, use production api and latest version for default
Iru89
force-pushed
the
feature/blt-674-task-plugin-flow-builder-new-endpoint-for-webview-contents
branch
from
April 15, 2024 15:02
fcdc782
to
185ecb6
Compare
vanbasten17
approved these changes
Apr 16, 2024
Iru89
changed the title
plugin-flow-builder: create a hook to call webview contents and…
plugin-flow-builder: WebviewContentsContext and useWebviewContents
Apr 16, 2024
AinaVendrell
approved these changes
Apr 16, 2024
CarlosELorenzo
approved these changes
Apr 16, 2024
…react and plugin-flow-builder
Iru89
deleted the
feature/blt-674-task-plugin-flow-builder-new-endpoint-for-webview-contents
branch
April 17, 2024 09:37
Iru89
added a commit
that referenced
this pull request
Apr 19, 2024
…2810) ## Description **@botonic/core** Update interface Session to add `organization_id` **@botonic/react** Create `WebviewRequestContext` to properly type what is received in the request context of a webview, the functions: `getString` and `closeWebview` and the objects `session` and `params`. Also add the `closeWebview` function in the browser API, now we will be able to do `Botonic.closeWebview()` **@botonic/plugin-flow-builder** Change `BotonicPluginFlowBuilderOptions` remove `flowUrl` and add `apiUrl` and `jsonVersion` as optionals params. If this params are undefined the plugin build flowUrl using PROD URL and latest version. Create a hook `useWebviewContents` and `WebviewContentsContext` ## Approach taken / Explain the design **@botonic/plugin-flow-builder** The call to fetch the contents should only be made once at the start of the webview. This hook gets the contents of the webview and returns `isLoading`, `error`and the `webviewContentsContext` With the `webviewContentsContext` the `WebviewContentsContext` has to be created. This has the functions `getTextContent` and `getImageSrc` to use in the renders of each component. ## Tests Add organization and organization_id in @botonic/react helpers to have green tests
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
@botonic/core
Update interface Session to add
organization_id
@botonic/react
Create
WebviewRequestContext
to properly type what is received in the request context of a webview, the functions:getString
andcloseWebview
and the objectssession
andparams
.Also add the
closeWebview
function in the browser API, now we will be able to doBotonic.closeWebview()
@botonic/plugin-flow-builder
Change
BotonicPluginFlowBuilderOptions
removeflowUrl
and addapiUrl
andjsonVersion
as optionals params. If this params are undefined the plugin build flowUrl using PROD URL and latest version.Create a hook
useWebviewContents
andWebviewContentsContext
Approach taken / Explain the design
@botonic/plugin-flow-builder
The call to fetch the contents should only be made once at the start of the webview.
This hook gets the contents of the webview and returns
isLoading
,error
and thewebviewContentsContext
With the
webviewContentsContext
theWebviewContentsContext
has to be created.This has the functions
getTextContent
andgetImageSrc
to use in the renders of each component.To document / Usage example
This is just an example to see how to use the hook and context inside a webview, webviews is a folder inside the bot code.
webviews/flow-builder-webview-example/index.tsx
webviews/flow-builder-webview-example/step1.tsx
webviews/flow-builder-webview-example/step2.tsx
Tests
Add organization and organization_id in @botonic/react helpers to have green tests