template
This commit is contained in:
parent
29d867438c
commit
94cd48d1ac
1 changed files with 11 additions and 0 deletions
|
|
@ -186,6 +186,16 @@ export function WhatsAppBroadcastPage() {
|
||||||
const mediaHeader = ['IMAGE', 'VIDEO', 'DOCUMENT'].includes(selectedTemplate?.header_format || '')
|
const mediaHeader = ['IMAGE', 'VIDEO', 'DOCUMENT'].includes(selectedTemplate?.header_format || '')
|
||||||
const savedSample = Boolean(selectedTemplate?.sample_stored)
|
const savedSample = Boolean(selectedTemplate?.sample_stored)
|
||||||
const headerLabel = selectedTemplate?.header_format === 'VIDEO' ? 'video' : selectedTemplate?.header_format === 'DOCUMENT' ? 'document' : 'image'
|
const headerLabel = selectedTemplate?.header_format === 'VIDEO' ? 'video' : selectedTemplate?.header_format === 'DOCUMENT' ? 'document' : 'image'
|
||||||
|
|
||||||
|
function downloadSampleCsv() {
|
||||||
|
const blob = new Blob(['phone_number\n'], { type: 'text/csv;charset=utf-8' })
|
||||||
|
const url = URL.createObjectURL(blob)
|
||||||
|
const link = document.createElement('a')
|
||||||
|
link.href = url
|
||||||
|
link.download = 'whatsapp-broadcast-sample.csv'
|
||||||
|
link.click()
|
||||||
|
URL.revokeObjectURL(url)
|
||||||
|
}
|
||||||
const selectedJob = jobs.find((job) => job.id === selectedJobId) || null
|
const selectedJob = jobs.find((job) => job.id === selectedJobId) || null
|
||||||
|
|
||||||
async function startCsv() {
|
async function startCsv() {
|
||||||
|
|
@ -346,6 +356,7 @@ export function WhatsAppBroadcastPage() {
|
||||||
onChange={(event) => setCsvFile(event.target.files?.[0] || null)}
|
onChange={(event) => setCsvFile(event.target.files?.[0] || null)}
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
|
<button className="text-button" type="button" onClick={downloadSampleCsv}>Download a blank sample CSV</button>
|
||||||
<button className="secondary-button" type="button" disabled={csvBusy || !accountId || !csvFile} onClick={() => void startCsv()}>
|
<button className="secondary-button" type="button" disabled={csvBusy || !accountId || !csvFile} onClick={() => void startCsv()}>
|
||||||
{csvBusy ? <Loader2 size={16} className="wa-spin" /> : null}
|
{csvBusy ? <Loader2 size={16} className="wa-spin" /> : null}
|
||||||
{csvFile ? `Start ${csvFile.name}` : 'Start CSV broadcast'}
|
{csvFile ? `Start ${csvFile.name}` : 'Start CSV broadcast'}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue