{{define "instagram-dm"}}

{{$.I18n.T "DM keyword"}}

{{with .InstagramDM}}{{if .Enabled}}{{if $.ProductionInstagram}}{{$.I18n.T "Enabled"}}{{else}}{{$.I18n.T "Enabled in sandbox"}}{{end}}{{else}}{{$.I18n.T "Paused"}}{{end}}{{else}}{{$.I18n.T "Draft"}}{{end}}
{{if .InstagramDMError}}{{end}}

{{$.I18n.T "The link appears below your reply."}} {{$.I18n.T "1,000 characters available."}}

{{$.I18n.T "Keyword matching options"}}

{{$.I18n.T "Capitalisation and surrounding spaces are ignored."}}

{{if not .InstagramDMForm.Editable}}

{{$.I18n.T "Pause automatic replies to edit the message."}}

{{else}}{{end}}

{{$.I18n.T "Test conversation"}}

{{if and .InstagramDM (not .InstagramDMError)}}{{$.I18n.T "Saved reply preview"}}{{else}}{{$.I18n.T "Reply preview"}}{{end}}

{{if .InstagramDMForm.ReplyText}}{{.InstagramDMForm.ReplyText}}{{else}}{{$.I18n.T "Your reply will appear here."}}{{end}}

{{.InstagramDMForm.URL}}
{{with .InstagramDM}}
{{if or .Enabled $.InstagramDMSandboxReady}}
{{else}}

{{if $.Workspace}}{{$.I18n.T "Connect Instagram in workspace settings to enable automatic replies."}}{{else}}{{$.I18n.T "Connect the Instagram sandbox to enable automatic replies."}}{{end}}

{{end}}

{{$.I18n.T "Story mentions"}}

{{if $.InstagramStoryCampaign}}

{{$.I18n.T "Story mentions use the reply for"}} {{$.InstagramStoryCampaign.Title}}.

{{else if or .StoryEnabled $.InstagramStoryReady}}

{{if $.ProductionInstagram}}{{$.I18n.T "Send this reply when someone tags your Instagram account in a Story."}}{{else}}{{$.I18n.T "Send this same reply when the test supporter tags the Instagram account in a Story."}}{{end}}

{{else}}

{{if $.Workspace}}{{$.I18n.T "Connect Instagram in workspace settings to enable Story replies."}}{{else}}{{$.I18n.T "Connect the sandbox Story webhook to enable automatic replies."}}{{end}}

{{end}}
{{else}}

{{$.I18n.T "Save a keyword, reply and link to try a test DM."}}

{{$.I18n.T "Story mentions"}}

{{$.I18n.T "Story mentions use this campaign’s saved reply."}}

{{end}}
{{if or .InstagramDM .CampaignCommentRules .InstagramAudience}}
{{$.I18n.T "Instagram audience · %d" (len .InstagramAudience)}}

{{$.I18n.T "Supporters matched by this campaign’s DM keyword, post comment or Story mention"}}{{if not $.ProductionInstagram}} {{$.I18n.T "in the sandbox"}}{{end}}.

{{if .InstagramAudience}}{{end}}
{{end}}
{{end}}