diff --git a/src/routes/console/project-[project]/messaging/create.svelte b/src/routes/console/project-[project]/messaging/create.svelte index 3c9924a976..feeb993e42 100644 --- a/src/routes/console/project-[project]/messaging/create.svelte +++ b/src/routes/console/project-[project]/messaging/create.svelte @@ -54,11 +54,18 @@ ); break; case ProviderTypes.Push: + const customData: Record = {}; + const { data } = $messageParams[ProviderTypes.Push]; + if (data && data.length > 0) { + data.forEach((item) => { + if (item[0] === '') return; + customData[item[0]] = item[1]; + }); + } + response = await sdk.forProject.client.call( 'POST', - new URL( - sdk.forProject.client.config.endpoint + '/messaging/providers/telesign' - ), + new URL(sdk.forProject.client.config.endpoint + '/messaging/messages/push'), { 'X-Appwrite-Project': sdk.forProject.client.config.project, 'content-type': 'application/json', @@ -66,6 +73,7 @@ }, { ...$messageParams[$providerType], + data: customData, messageId } ); diff --git a/src/routes/console/project-[project]/messaging/message-[message]/+page.svelte b/src/routes/console/project-[project]/messaging/message-[message]/+page.svelte index 8c5734c02a..c949eba855 100644 --- a/src/routes/console/project-[project]/messaging/message-[message]/+page.svelte +++ b/src/routes/console/project-[project]/messaging/message-[message]/+page.svelte @@ -6,6 +6,7 @@ import { message } from './store'; import { ProviderTypes } from '../providerType.svelte'; import SMSPreview from './smsPreview.svelte'; + import PushPreview from './pushPreview.svelte'; @@ -14,6 +15,8 @@ {:else if $message.providerType === ProviderTypes.Sms} + {:else if $message.providerType === ProviderTypes.Push} + {/if} diff --git a/src/routes/console/project-[project]/messaging/message-[message]/pushPreview.svelte b/src/routes/console/project-[project]/messaging/message-[message]/pushPreview.svelte new file mode 100644 index 0000000000..e632394d5c --- /dev/null +++ b/src/routes/console/project-[project]/messaging/message-[message]/pushPreview.svelte @@ -0,0 +1,31 @@ + + + +
+ Preview + +
+ + + + + + + + + + + + + +
diff --git a/src/routes/console/project-[project]/messaging/pushPhone.svelte b/src/routes/console/project-[project]/messaging/pushPhone.svelte new file mode 100644 index 0000000000..2acfc19f85 --- /dev/null +++ b/src/routes/console/project-[project]/messaging/pushPhone.svelte @@ -0,0 +1,16 @@ + + + +
+

{title}

+

{body}

+
+ + diff --git a/src/routes/console/project-[project]/messaging/wizard/pushFormList.svelte b/src/routes/console/project-[project]/messaging/wizard/pushFormList.svelte new file mode 100644 index 0000000000..49ec8bfcad --- /dev/null +++ b/src/routes/console/project-[project]/messaging/wizard/pushFormList.svelte @@ -0,0 +1,243 @@ + + + + +
+ + + +
+ + + + + + + + + + Enter the phone number to which the test message will be +
(selected = 'other')} + on:keyup|self={clickOnEnter} + role="button" + tabindex="0"> + +
+
+
+ + + + + +
+
+
+ +
+
    + {#each customData || [] as _, rowIndex} + + + + + + + + + {/each} +
+ {#if dataError} + {dataError} + {/if} + +
+
+ + + {#if !showCustomId} +
+ (showCustomId = !showCustomId)} + > +
+ {:else} + + {/if} +
+ +
diff --git a/src/routes/console/project-[project]/messaging/wizard/step1.svelte b/src/routes/console/project-[project]/messaging/wizard/step1.svelte index 7ef32a000d..4fffcc771d 100644 --- a/src/routes/console/project-[project]/messaging/wizard/step1.svelte +++ b/src/routes/console/project-[project]/messaging/wizard/step1.svelte @@ -5,12 +5,15 @@ import { ProviderTypes } from '../providerType.svelte'; import EmailFormList from './emailFormList.svelte'; import SmsFormList from './smsFormList.svelte'; + import PushFormList, { validateData } from './pushFormList.svelte'; - async function beforeSubmit() { - } + async function beforeSubmit() {} - + Message @@ -21,5 +24,7 @@ {:else if $providerType === ProviderTypes.Sms} + {:else if $providerType === ProviderTypes.Push} + {/if} diff --git a/src/routes/console/project-[project]/messaging/wizard/store.ts b/src/routes/console/project-[project]/messaging/wizard/store.ts index 6ec774cc82..df3fecdcec 100644 --- a/src/routes/console/project-[project]/messaging/wizard/store.ts +++ b/src/routes/console/project-[project]/messaging/wizard/store.ts @@ -30,7 +30,7 @@ export type SMSMessageParams = MessageParams & { export type PushMessageParams = MessageParams & { title: string; body: string; - data: Record; + data: [string, string][]; action?: string; icon?: string; sound?: string;