diff --git a/src/lib/commandCenter/panels/ai.svelte b/src/lib/commandCenter/panels/ai.svelte index f2887239b..1c589e138 100644 --- a/src/lib/commandCenter/panels/ai.svelte +++ b/src/lib/commandCenter/panels/ai.svelte @@ -15,9 +15,10 @@ const { input, handleSubmit, completion, isLoading, complete, error } = useCompletion({ api: endpoint + '/console/assistant', headers: { - 'x-appwrite-mode': 'admin', - 'content-type': 'application/json' - } + 'content-type': 'application/json', + 'x-appwrite-project': 'console' + }, + credentials: 'include' }); let question = $input; diff --git a/src/lib/components/limit.svelte b/src/lib/components/limit.svelte index bf5ed752c..934354860 100644 --- a/src/lib/components/limit.svelte +++ b/src/lib/components/limit.svelte @@ -41,5 +41,5 @@ {options} bind:value={limit} on:change={limitChange} /> -
{name} per page. Total results: {sum}
+{name} per page. Total results: {sum >= 5000 ? `${sum}+` : sum}
diff --git a/src/lib/layout/shell.svelte b/src/lib/layout/shell.svelte index f5435516d..318ef0000 100644 --- a/src/lib/layout/shell.svelte +++ b/src/lib/layout/shell.svelte @@ -30,8 +30,7 @@ * Cancel navigation when wizard is open and triggered by popstate */ beforeNavigate((n) => { - const external = n?.to?.url?.hostname !== globalThis?.location?.hostname; - if (external) return; + if (n.willUnload) return; if (!($wizard.show || $wizard.cover)) return; if (n.type === 'popstate') { n.cancel(); diff --git a/src/lib/layout/wizard.svelte b/src/lib/layout/wizard.svelte index 8d75f2c82..7ca87bfdd 100644 --- a/src/lib/layout/wizard.svelte +++ b/src/lib/layout/wizard.svelte @@ -75,8 +75,13 @@ wizard.setInterceptor(null); if (isLastStep) { + $wizard.nextDisabled = true; trackEvent('wizard_finish'); dispatch('finish'); + //Reactivate button in case there are errors + setTimeout(() => { + $wizard.nextDisabled = false; + }, 2000); } else { if (steps.get($wizard.step + 1)?.disabled) { $wizard.step++; diff --git a/src/lib/stores/marketplace.ts b/src/lib/stores/marketplace.ts index 9433a3f82..5c95eb771 100644 --- a/src/lib/stores/marketplace.ts +++ b/src/lib/stores/marketplace.ts @@ -132,7 +132,7 @@ export const marketplace: MarketplaceTemplate[] = [ { name: 'node-18.0', commands: 'npm install && npm run setup', - entrypoint: 'src/main.js && npm run setup', + entrypoint: 'src/main.js', providerRootDirectory: 'node/discord-command-bot' }, { @@ -150,9 +150,25 @@ export const marketplace: MarketplaceTemplate[] = [ variables: [ { name: 'DISCORD_PUBLIC_KEY', - description: `Discord Public Key to verify request signature. Learn more.`, + description: `Public Key of your application in Discord Developer Portal. Learn more.`, value: '', - placeholder: 'd1efb...aec35', + placeholder: 'db9...980', + required: true, + type: 'password' + }, + { + name: 'DISCORD_APPLICATION_ID', + description: `ID of your application in Discord Developer Portal. Learn more.`, + value: '', + placeholder: '427...169', + required: true, + type: 'password' + }, + { + name: 'DISCORD_TOKEN', + description: `Bot token of your application in Discord Developer Portal. Learn more.`, + value: '', + placeholder: 'NDI...LUfg', required: true, type: 'password' } @@ -698,7 +714,7 @@ export const marketplace: MarketplaceTemplate[] = [ value: '', placeholder: 'smtp.mailgun.org', required: true, - type: 'url' + type: 'text' }, { name: 'SMTP_PORT', @@ -737,6 +753,134 @@ export const marketplace: MarketplaceTemplate[] = [ type: 'text' } ] + }, + { + icon: 'icon-stripe', + id: 'subscriptions-with-stripe', + name: 'Subscriptions with Stripe', + tagline: 'Receive recurring card payments and grant subscribers extra permissions.', + permissions: ['any'], + events: [], + cron: '', + timeout: 15, + usecases: ['Utilities'], + runtimes: [ + { + name: 'node-18.0', + commands: 'npm install', + entrypoint: 'src/main.js', + providerRootDirectory: 'node/subscriptions-with-stripe' + } + ], + instructions: `For documentation and instructions check out file.`, + vcsProvider: 'github', + providerRepositoryId: 'templates', + providerOwner: 'appwrite', + providerBranch: 'main', + variables: [ + { + name: 'APPWRITE_API_KEY', + description: `The API Key to talk to Appwrite backend APIs. Learn more.`, + value: '', + placeholder: 'd1efb...aec35', + required: true, + type: 'password' + }, + { + name: 'APPWRITE_ENDPOINT', + description: `The URL endpoint of the Appwrite server. Learn more.`, + value: 'https://cloud.appwrite.io/v1', + placeholder: 'https://cloud.appwrite.io/v1', + required: false, + type: 'url' + }, + { + name: 'STRIPE_SECRET_KEY', + description: `Secret for sending requests to the Stripe API. Learn more.`, + placeholder: 'sk_test_51J...', + required: true, + type: 'password' + }, + { + name: 'STRIPE_WEBHOOK_SECRET', + description: `Secret used to validate the Stripe Webhook signature. Learn more.`, + placeholder: 'whsec_...', + required: true, + type: 'password' + } + ] + }, + { + icon: 'icon-stripe', + id: 'payments-with-stripe', + name: 'Payments with Stripe', + tagline: 'Receive card payments and store paid orders.', + permissions: ['any'], + events: [], + cron: '', + timeout: 15, + usecases: ['Utilities'], + runtimes: [ + { + name: 'node-18.0', + commands: 'npm install && npm run setup', + entrypoint: 'src/main.js', + providerRootDirectory: 'node/payments-with-stripe' + } + ], + instructions: `For documentation and instructions check out file.`, + vcsProvider: 'github', + providerRepositoryId: 'templates', + providerOwner: 'appwrite', + providerBranch: 'main', + variables: [ + { + name: 'APPWRITE_API_KEY', + description: `The API Key to talk to Appwrite backend APIs. Learn more.`, + value: '', + placeholder: 'd1efb...aec35', + required: true, + type: 'password' + }, + { + name: 'APPWRITE_ENDPOINT', + description: `The URL endpoint of the Appwrite server. Learn more.`, + value: 'https://cloud.appwrite.io/v1', + placeholder: 'https://cloud.appwrite.io/v1', + required: false, + type: 'url' + }, + { + name: 'STRIPE_SECRET_KEY', + description: `Secret for sending requests to the Stripe API. Learn more.`, + placeholder: 'sk_test_51J...', + required: true, + type: 'password' + }, + { + name: 'STRIPE_WEBHOOK_SECRET', + description: `Secret used to validate the Stripe Webhook signature. Learn more.`, + placeholder: 'whsec_...', + required: true, + type: 'password' + }, + { + name: 'APPWRITE_DATABASE_ID', + description: `The ID of the database to store paid orders. Learn more.`, + value: 'orders', + placeholder: 'orders', + required: false, + type: 'text' + }, + { + name: 'APPWRITE_COLLECTION_ID', + description: `The ID of the collection to store paid orders. Learn more.`, + value: 'orders', + placeholder: 'orders', + required: false, + type: 'text' + } + ] } ]; diff --git a/src/lib/wizards/functions/cover.svelte b/src/lib/wizards/functions/cover.svelte index 069005605..189ed47d2 100644 --- a/src/lib/wizards/functions/cover.svelte +++ b/src/lib/wizards/functions/cover.svelte @@ -106,21 +106,22 @@ {/each} {:then response} - {@const runtimes = response.runtimes} - {#each quickStart.runtimes.filter((_template, index) => index < 6) as runtime} - {@const runtimeDetail = runtimes.find( - (r) => r.$id === runtime.name - )} + {@const runtimes = new Map(response.runtimes.map((r) => [r.$id, r]))} + {@const templates = quickStart.runtimes.filter((_template) => + runtimes.has(_template.name) + )} + {#each templates.slice(0, 6) as template} + {@const runtimeDetail = runtimes.get(template.name)}