Merge branch '1.5.x' into feat-messaging-sdk

This commit is contained in:
Torsten Dittmann authored and GitHub committed 2024-02-08 10:04:35 +01:00
commit 4cf5d3d6f7
4 files changed
+60 -26

No files matched your search

+2 -1
View File
@@ -23,6 +23,7 @@
export let maxlength: number = null;
export let tooltip: string = null;
export let isMultiple = false;
export let isPopoverDefined = true;
let element: HTMLInputElement;
let error: string;
@@ -76,7 +77,7 @@
<svelte:component this={wrapper} {fullWidth}>
{#if label}
<Label {required} {hideRequired} {tooltip} {optionalText} hide={!showLabel} for={id}>
{label}{#if $$slots.popover}
{label}{#if $$slots.popover && isPopoverDefined}
<Drop bind:show display="inline-block">
<!-- TODO: make unclicked icon greyed out and hover and clicked filled -->
&nbsp;<button
@@ -21,11 +21,12 @@ type ProvidersMap = {
imageIcon?: string;
classIcon?: string;
title: string;
link: string;
description: string;
configure: {
label: string;
name: string;
type: 'text' | 'phone' | 'email' | 'domain' | 'file' | 'switch' | 'select';
type: 'text' | 'password' | 'phone' | 'email' | 'domain' | 'file' | 'switch' | 'select';
placeholder?: string;
description?: string;
popover?: string[];
@@ -47,6 +48,7 @@ export const providers: ProvidersMap = {
[Providers.FCM]: {
imageIcon: 'firebase',
title: 'FCM',
link: 'https://firebase.google.com/',
description: 'Firebase Cloud Messaging',
configure: [
{
@@ -56,7 +58,7 @@ export const providers: ProvidersMap = {
allowedFileExtensions: ['json'],
placeholder: 'Enter service account JSON',
popover: [
'<b>How to get the FCM service account JSON?</b>',
'<b>How to get the <a style="text-decoration:underline" href="https://firebase.google.com" target="_blank">FCM</a> service account JSON?</b>',
'Head to <b>Project settings -> Service accounts -> Generate new private key.</b>',
'Generating the new key will result in the download of a JSON file.'
]
@@ -66,6 +68,7 @@ export const providers: ProvidersMap = {
[Providers.APNS]: {
imageIcon: 'apple',
title: 'APNS',
link: 'https://idmsa.apple.com/IDMSWebAuth/signin?appIdKey=891bd3417a7776362562d2197f89480a8547b108fd934911bcbea0110d07f757&path=%2Faccount%2F&rv=1',
description: 'Apple Push Notification Service',
configure: [
{
@@ -75,7 +78,7 @@ export const providers: ProvidersMap = {
placeholder: 'Enter team ID',
popover: [
'<b>How to get the team ID?</b>',
'Head to <b>Apple Developer Member Center -> Membership details -> Team ID.</b>'
'Head to <b><a style="text-decoration:underline" href="https://idmsa.apple.com/IDMSWebAuth/signin?appIdKey=891bd3417a7776362562d2197f89480a8547b108fd934911bcbea0110d07f757&path=%2Faccount%2F&rv=1" target="_blank">Apple Developer Member Center</a> -> Membership details -> Team ID.</b>'
]
},
{
@@ -85,7 +88,7 @@ export const providers: ProvidersMap = {
placeholder: 'Enter bundle ID',
popover: [
'<b>How to get the bundle ID?</b>',
'Head to <b>Apple Developer Member Center -> Certificates, Identifiers & Profiles -> Identifiers.</b>',
'Head to <b><a style="text-decoration:underline" href="https://idmsa.apple.com/IDMSWebAuth/signin?appIdKey=891bd3417a7776362562d2197f89480a8547b108fd934911bcbea0110d07f757&path=%2Faccount%2F&rv=1" target="_blank">Apple Developer Member Center</a> -> Certificates, Identifiers & Profiles -> Identifiers.</b>',
`<a
href="/images/apns-bundle-id.png"
class="file-preview is-with-image"
@@ -114,7 +117,7 @@ export const providers: ProvidersMap = {
placeholder: 'Enter key ID',
popover: [
'<b>How to get the auth key ID?</b>',
'Head to <b>Apple Developer Member Center -> Certificates, Identifiers & Profiles -> Keys.</b>',
'Head to <b><a style="text-decoration:underline" href="https://idmsa.apple.com/IDMSWebAuth/signin?appIdKey=891bd3417a7776362562d2197f89480a8547b108fd934911bcbea0110d07f757&path=%2Faccount%2F&rv=1" target="_blank">Apple Developer Member Center</a> -> Certificates, Identifiers & Profiles -> Keys.</b>',
'Click on your key to view details.'
]
},
@@ -125,7 +128,7 @@ export const providers: ProvidersMap = {
allowedFileExtensions: ['p8'],
popover: [
'<b>How to get the authentication key?</b>',
'Head to <b>Apple Developer Member Center</b> (under Program resources) <b>-> Certificates, Identifiers & Profiles -> Keys.</b>',
'Head to <b><a style="text-decoration:underline" href="https://idmsa.apple.com/IDMSWebAuth/signin?appIdKey=891bd3417a7776362562d2197f89480a8547b108fd934911bcbea0110d07f757&path=%2Faccount%2F&rv=1" target="_blank">Apple Developer Member Center</a></b> (under Program resources) <b>-> Certificates, Identifiers & Profiles -> Keys.</b>',
'Create a key and give it a name. Enable the Apple Push Notifications service (APNS), and register your key.'
]
}
@@ -146,6 +149,7 @@ export const providers: ProvidersMap = {
[Providers.Mailgun]: {
imageIcon: 'mailgun',
title: 'Mailgun',
link: 'https://signup.mailgun.com/new/signup',
description: '',
configure: [
{
@@ -155,7 +159,7 @@ export const providers: ProvidersMap = {
placeholder: 'Enter API key',
popover: [
'<b>How to get the API key?</b>',
'Create an account in Mailgun.',
'Create an account in <a style="text-decoration:underline" href="https://signup.mailgun.com/new/signup" target="_blank">Mailgun</a>.',
'Head to <b>Profile -> API Security -> Add new key.</b>'
]
},
@@ -167,7 +171,7 @@ export const providers: ProvidersMap = {
popover: [
'<b>How to create a domain?</b>',
'Head to <b>Sending -> Domains -> Add new domain.</b>',
'Follow <b>Mailgun instructions</b> to verify the domain name.'
'Follow <b><a style="text-decoration:underline" href="https://signup.mailgun.com/new/signup" target="_blank">Mailgun</a> instructions</b> to verify the domain name.'
]
},
{
@@ -209,6 +213,7 @@ export const providers: ProvidersMap = {
[Providers.Sendgrid]: {
imageIcon: 'sendgrid',
title: 'Sendgrid',
link: 'https://login.sendgrid.com/login/identifier?_gl=1*3vtcwz*_ga*MTMzODgwNDQ5OC4xNzA2MjAxMDUz*_ga_8W5LR442LD*MTcwNjIwMTA1My4xLjAuMTcwNjIwMTA1My4wLjAuMA..',
description: '',
configure: [
{
@@ -218,8 +223,8 @@ export const providers: ProvidersMap = {
placeholder: 'Enter API key',
popover: [
'<b>How to get the API key?</b>',
'Create an account in Mailgun.',
'Head to <b>Profile -> API Security -> Add new key.</b>'
'Create an account in <a style="text-decoration:underline" href="https://login.sendgrid.com/login/identifier?_gl=1*3vtcwz*_ga*MTMzODgwNDQ5OC4xNzA2MjAxMDUz*_ga_8W5LR442LD*MTcwNjIwMTA1My4xLjAuMTcwNjIwMTA1My4wLjAuMA.." target="_blank">Sendgrid</a>.',
'Head to <b>Settings -> API Keys -> Create API key.</b>'
]
},
{
@@ -347,6 +352,7 @@ export const providers: ProvidersMap = {
[Providers.Twilio]: {
imageIcon: 'twilio',
title: 'Twilio',
link: 'https://login.twilio.com/u/signup?state=hKFo2SBaQktjdzI0ZHdKdm44QUc5YzBRXzlNMmlyTExkRWVTTaFur3VuaXZlcnNhbC1sb2dpbqN0aWTZIHpwNUVrWDJzeFRJdUczVU5LTk16X0FHWEQ3dHU0S3hko2NpZNkgTW05M1lTTDVSclpmNzdobUlKZFI3QktZYjZPOXV1cks',
description: '',
configure: [
{
@@ -356,7 +362,7 @@ export const providers: ProvidersMap = {
placeholder: 'Enter Account SID',
popover: [
'<b>How to get the Account SID?</b>',
'Head to <b>Twilio console -> Account info -> Account SID.</b>'
'Head to <b><a style="text-decoration:underline" href="https://login.twilio.com/u/signup?state=hKFo2SBaQktjdzI0ZHdKdm44QUc5YzBRXzlNMmlyTExkRWVTTaFur3VuaXZlcnNhbC1sb2dpbqN0aWTZIHpwNUVrWDJzeFRJdUczVU5LTk16X0FHWEQ3dHU0S3hko2NpZNkgTW05M1lTTDVSclpmNzdobUlKZFI3QktZYjZPOXV1cks" target="_blank">Twilio</a> console -> Account info -> Account SID.</b>'
]
},
{
@@ -366,7 +372,7 @@ export const providers: ProvidersMap = {
placeholder: 'Enter Auth token',
popover: [
'<b>How to get the Auth token?</b>',
'Head to <b>Twilio console -> Account info -> Auth Token.</b>'
'Head to <b><a style="text-decoration:underline" href="https://login.twilio.com/u/signup?state=hKFo2SBaQktjdzI0ZHdKdm44QUc5YzBRXzlNMmlyTExkRWVTTaFur3VuaXZlcnNhbC1sb2dpbqN0aWTZIHpwNUVrWDJzeFRJdUczVU5LTk16X0FHWEQ3dHU0S3hko2NpZNkgTW05M1lTTDVSclpmNzdobUlKZFI3QktZYjZPOXV1cks" target="_blank">Twilio</a> console -> Account info -> Auth Token.</b>'
]
},
{
@@ -376,8 +382,8 @@ export const providers: ProvidersMap = {
placeholder: 'Enter phone',
popover: [
'<b>How to get sender number?</b>',
'Head to <b>Twilio console -> Account info -> My Twilio phone number.</b>',
'If you have multiple Twilio phone numbers, you can select one as the default number.'
'Head to <b><a style="text-decoration:underline" href="https://login.twilio.com/u/signup?state=hKFo2SBaQktjdzI0ZHdKdm44QUc5YzBRXzlNMmlyTExkRWVTTaFur3VuaXZlcnNhbC1sb2dpbqN0aWTZIHpwNUVrWDJzeFRJdUczVU5LTk16X0FHWEQ3dHU0S3hko2NpZNkgTW05M1lTTDVSclpmNzdobUlKZFI3QktZYjZPOXV1cks" target="_blank">Twilio</a> console -> Account info -> My Twilio phone number.</b>',
'If you have multiple <a style="text-decoration:underline" href="https://login.twilio.com/u/signup?state=hKFo2SBaQktjdzI0ZHdKdm44QUc5YzBRXzlNMmlyTExkRWVTTaFur3VuaXZlcnNhbC1sb2dpbqN0aWTZIHpwNUVrWDJzeFRJdUczVU5LTk16X0FHWEQ3dHU0S3hko2NpZNkgTW05M1lTTDVSclpmNzdobUlKZFI3QktZYjZPOXV1cks" target="_blank">Twilio</a> phone numbers, you can select one as the default number.'
]
}
]
@@ -385,6 +391,7 @@ export const providers: ProvidersMap = {
[Providers.Msg91]: {
imageIcon: 'msg91',
title: 'MSG91',
link: 'https://control.msg91.com/signin/',
description: '',
configure: [
{
@@ -394,7 +401,7 @@ export const providers: ProvidersMap = {
placeholder: 'Enter auth key',
popover: [
'<b>How to get the Auth key?</b>',
'Create an account in MSG91.',
'Create an account in <a style="text-decoration:underline" href="https://control.msg91.com/signin/" target="_blank">MSG91</a>.',
'Click to open the <b>Username dropdown -> Authkey -> Verify your mobile number -> Create Authkey.</b>'
]
},
@@ -405,7 +412,7 @@ export const providers: ProvidersMap = {
placeholder: 'Enter sender ID',
popover: [
'<b>How to create a Sender ID?</b>',
'Head to <b>MSG91 dashboard -> SMS -> Sender ID -> Create sender ID.</b>'
'Head to <b><a style="text-decoration:underline" href="https://control.msg91.com/signin/" target="_blank">MSG91</a> dashboard -> SMS -> Sender ID -> Create sender ID.</b>'
]
},
{
@@ -419,6 +426,7 @@ export const providers: ProvidersMap = {
[Providers.Telesign]: {
imageIcon: 'telesign',
title: 'Telesign',
link: 'https://www.telesign.com/',
description: '',
configure: [
{
@@ -430,7 +438,7 @@ export const providers: ProvidersMap = {
{
label: 'Password',
name: 'password',
type: 'text',
type: 'password',
placeholder: 'Enter password'
},
{
@@ -443,7 +451,8 @@ export const providers: ProvidersMap = {
},
[Providers.Textmagic]: {
imageIcon: 'textmagic',
title: 'Textmagic',
title: 'TextMagic',
link: 'https://app.textmagic.com/login',
description: '',
configure: [
{
@@ -453,8 +462,8 @@ export const providers: ProvidersMap = {
placeholder: 'Enter API key',
popover: [
'<b>How to get the API key?</b>',
'Create an account in Textmagic.',
'Head to <b>TextMagic dashboard -> API Settings -> Add new API key.</b>'
'Create an account in <a style="text-decoration:underline" href="https://app.textmagic.com/login" target="_blank">TextMagic</a>.',
'Head to <b><a style="text-decoration:underline" href="https://app.textmagic.com/login" target="_blank">TextMagic</a> dashboard -> API Settings -> Add new API key.</b>'
]
},
{
@@ -474,6 +483,7 @@ export const providers: ProvidersMap = {
[Providers.Vonage]: {
imageIcon: 'vonage',
title: 'Vonage',
link: 'https://www.vonage.com/?bypassgeoloc=true',
description: '',
configure: [
{
@@ -484,7 +494,7 @@ export const providers: ProvidersMap = {
popover: [
'<b>How to get the API key?</b>',
'Create an account in Vonage.',
'Head to <b>Vonage dashboard and copy the API key.</b>'
'Head to <b><a style="text-decoration:underline" href="https://www.vonage.com/?bypassgeoloc=true" blank="_target">Vonage</a> dashboard and copy the API key.</b>'
]
},
{
@@ -494,7 +504,7 @@ export const providers: ProvidersMap = {
placeholder: 'Enter API secret',
popover: [
'<b>How to get the API secret?</b>',
'Head to <b>Vonage dashboard and copy the API secret.</b>'
'Head to <b><a style="text-decoration:underline" href="https://www.vonage.com/?bypassgeoloc=true" target="_blank">Vonage</a> dashboard and copy the API secret.</b>'
]
},
{
@@ -6,8 +6,10 @@
InputFile,
InputSelect,
InputSwitch,
InputText
InputText,
InputPassword
} from '$lib/elements/forms';
import InputPhone from '$lib/elements/forms/inputPhone.svelte';
import { WizardStep } from '$lib/layout';
import { onMount } from 'svelte';
@@ -58,11 +60,22 @@
label={input.label}
placeholder={input.placeholder}
required={!input.optional}
isPopoverDefined={input.popover !== undefined}
bind:value={$providerParams[$provider][input.name]}>
<svelte:fragment slot="popover">
{@html input.popover?.join('<br/><br/>')}
</svelte:fragment>
</InputText>
{:else if input.type === 'password'}
<InputPassword
id={input.name}
label={input.label}
placeholder={input.placeholder}
bind:value={$providerParams[$provider][input.name]}>
<svelte:fragment slot="popover">
{@html input.popover?.join('<br/><br/>')}
</svelte:fragment>
</InputPassword>
{:else if input.type === 'email'}
<InputEmail
id={input.name}
@@ -8,6 +8,17 @@
import { MessagingProviderType } from '@appwrite.io/console';
async function beforeSubmit() {}
const createMessage = (providerText:string) => {
const vowels = ['a', 'e', 'i', 'o', 'u'];
const firstLetter = providerText.toLowerCase().charAt(0);
const lastLetter = providerText.toLowerCase().charAt(providerText.length - 1);
let article = vowels.includes(firstLetter) ? 'an' : 'a';
article = lastLetter === 's' ? '' : article;
providerText = providerText.toLowerCase() === 'sms' ? 'SMS messages' : providerText;
return `Create ${article} ${providerText} that will be displayed to your subscribers. Learn more in our documentation.`;
};
</script>
<WizardStep
@@ -17,8 +28,7 @@
<svelte:fragment slot="title">Message</svelte:fragment>
<svelte:fragment slot="subtitle">
<!-- TODO: update documentation link -->
Create an {providers[$providerType].text} that will be displayed to your subscribers. Learn more
in our documentation.
{createMessage(providers[$providerType].text)}
</svelte:fragment>
{#if $providerType === MessagingProviderType.Email}
<EmailFormList />