-
Notifications
You must be signed in to change notification settings - Fork 48
Whatsapp Forms #3624
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
Open
akanshaaa19
wants to merge
12
commits into
master
Choose a base branch
from
feat/whatsapp-forms
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Whatsapp Forms #3624
Changes from 9 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
eaaa41e
Add WhatsApp Forms feature with create and update operations and UI c…
akanshaaa19 41aa284
Merge branch 'master' into feat/whatsapp-forms
akanshaaa19 ab532af
Merge branch 'master' into feat/whatsapp-forms
priyanshu6238 777610b
Add WhatsApp form response handling in ChatMessage component
akanshaaa19 6c7c220
Merge branch 'feat/whatsapp-forms' of github.com:glific/glific-fronte…
akanshaaa19 7aa46fe
add whatsappFormResponse field to various mocks
akanshaaa19 32e66c4
WhatsApp Forms: Add UI for listing WhatsApp flows (#3615)
priyanshu6238 4b91823
Whatsapp forms cleanup (#3629)
akanshaaa19 c2a8b06
Add new button to HSM for whatsapp forms (#3626)
akanshaaa19 bbd65d2
Merge branch 'master' into feat/whatsapp-forms
shijithkjayan 9a5e169
Added fields to subscription query
akanshaaa19 0edf13d
Merge branch 'master' into feat/whatsapp-forms
akanshaaa19 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| const WhatsAppForm = ({ color }: { color: string }) => { | ||
| return ( | ||
| <svg | ||
| className="w-6 h-6 " | ||
| aria-hidden="true" | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| width="24" | ||
| height="24" | ||
| fill="none" | ||
| viewBox="0 0 24 24" | ||
| color={color} | ||
| > | ||
| <path | ||
| stroke={'currentColor'} | ||
| strokeLinecap="round" | ||
| strokeLinejoin="round" | ||
| strokeWidth="2" | ||
| d="M15 4h3a1 1 0 0 1 1 1v15a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h3m0 3h6m-6 5h6m-6 4h6M10 3v4h4V3h-4Z" | ||
| /> | ||
| </svg> | ||
| ); | ||
| }; | ||
| export default WhatsAppForm; |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
26 changes: 26 additions & 0 deletions
26
...ainers/Chat/ChatMessages/ChatMessage/WhatsappFormResponse/WhatsAppFormResponse.module.css
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| .FormResponseContainer { | ||
| display: flex; | ||
| align-items: center; | ||
| padding: 12px 16px; | ||
| border-radius: 12px; | ||
| cursor: pointer; | ||
| max-width: 280px; | ||
| background-color: #0000004c; | ||
| } | ||
|
|
||
| .Content { | ||
| display: flex; | ||
| flex-direction: column; | ||
| color: #fff !important; | ||
| } | ||
|
|
||
| .Title { | ||
| font-weight: 500; | ||
| color: #fff; | ||
| margin-bottom: 2px; | ||
| } | ||
|
|
||
| .Subtitle { | ||
| color: #afafaf; | ||
| font-size: 12px; | ||
| } |
71 changes: 71 additions & 0 deletions
71
src/containers/Chat/ChatMessages/ChatMessage/WhatsappFormResponse/WhatsAppFormResponse.tsx
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| import { Typography } from '@mui/material'; | ||
|
|
||
| import { DialogBox } from 'components/UI/DialogBox/DialogBox'; | ||
| import { useEffect, useState } from 'react'; | ||
| import styles from './WhatsAppFormResponse.module.css'; | ||
|
|
||
| interface WhatsAppFormResponseProps { | ||
| rawResponse: string; | ||
| } | ||
akanshaaa19 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| export const WhatsAppFormResponse = ({ rawResponse }: WhatsAppFormResponseProps) => { | ||
| const [open, setOpen] = useState<boolean>(false); | ||
| const [parsedResponse, setParsedResponse] = useState<any>({}); | ||
akanshaaa19 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| const handleOpen = () => setOpen(true); | ||
| const handleClose = () => setOpen(false); | ||
|
|
||
| useEffect(() => { | ||
| if (rawResponse) { | ||
| try { | ||
| const response = JSON.parse(rawResponse); | ||
| setParsedResponse(response); | ||
| } catch (error) { | ||
| console.error('Error parsing WhatsApp form response:', error); | ||
| setParsedResponse({ error: 'Invalid response format' }); | ||
| } | ||
| } | ||
| }, [rawResponse]); | ||
|
|
||
| return ( | ||
| <> | ||
| <div className={styles.FormResponseContainer}> | ||
| <div onClick={handleOpen} className={styles.Content}> | ||
| <Typography variant="body2" className={styles.Title}> | ||
| View Response | ||
| </Typography> | ||
| <Typography variant="caption" className={styles.Subtitle}> | ||
| Response received | ||
| </Typography> | ||
| </div> | ||
| </div> | ||
| {open && ( | ||
| <DialogBox | ||
| open={open} | ||
| title="WhatsApp Form Response" | ||
| handleCancel={handleClose} | ||
| skipCancel | ||
| handleOk={handleClose} | ||
| buttonOk="Close" | ||
| > | ||
| {Object.keys(parsedResponse).length > 0 ? ( | ||
| <> | ||
| {Object.entries(parsedResponse).map(([key, value]) => ( | ||
| <div key={key} style={{ marginBottom: '8px' }}> | ||
| <Typography variant="subtitle2" style={{ fontWeight: 'bold' }}> | ||
| {key}: | ||
| </Typography> | ||
| <Typography variant="body2"> | ||
| {typeof value === 'object' ? JSON.stringify(value, null, 2) : String(value)} | ||
| </Typography> | ||
| </div> | ||
| ))} | ||
| </> | ||
| ) : ( | ||
| <Typography variant="body2">No response data available.</Typography> | ||
| )} | ||
| </DialogBox> | ||
| )} | ||
| </> | ||
| ); | ||
| }; | ||
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.