mirror of
https://github.com/rowyio/rowy.git
synced 2025-12-29 00:16:39 +01:00
Merge branch 'develop' of https://github.com/rowyio/rowy into develop
This commit is contained in:
@@ -3,15 +3,6 @@ import WarningIcon from "@mui/icons-material/WarningAmber";
|
||||
import { TableSettings } from "@src/types/table";
|
||||
import { IWebhook } from "@src/components/TableModals/WebhooksModal/utils";
|
||||
|
||||
export const webhookTypes = [
|
||||
"basic",
|
||||
"typeform",
|
||||
"sendgrid",
|
||||
//"shopify",
|
||||
//"twitter",
|
||||
//"stripe",
|
||||
] as const;
|
||||
|
||||
const requestType = [
|
||||
"declare type WebHookRequest {",
|
||||
" /**",
|
||||
|
||||
@@ -2,5 +2,6 @@ import basic from "./basic";
|
||||
import typeform from "./typeform";
|
||||
import sendgrid from "./sendgrid";
|
||||
import webform from "./webform";
|
||||
import stripe from "./stripe";
|
||||
|
||||
export { basic, typeform, sendgrid, webform };
|
||||
export { basic, typeform, sendgrid, webform, stripe };
|
||||
|
||||
95
src/components/TableModals/WebhooksModal/Schemas/stripe.tsx
Normal file
95
src/components/TableModals/WebhooksModal/Schemas/stripe.tsx
Normal file
@@ -0,0 +1,95 @@
|
||||
import { Typography, Link, TextField } from "@mui/material";
|
||||
import InlineOpenInNewIcon from "@src/components/InlineOpenInNewIcon";
|
||||
import { TableSettings } from "@src/types/table";
|
||||
import { IWebhook } from "@src/components/TableModals/WebhooksModal/utils";
|
||||
|
||||
export const webhookStripe = {
|
||||
name: "Stripe",
|
||||
parser: {
|
||||
additionalVariables: null,
|
||||
extraLibs: null,
|
||||
template: (
|
||||
table: TableSettings
|
||||
) => `const sendgridParser: Parser = async ({ req, db, ref }) => {
|
||||
const event = req.body
|
||||
switch (event.type) {
|
||||
case "payment_intent.succeeded":
|
||||
break;
|
||||
case "payment_intent.payment_failed":
|
||||
break;
|
||||
default:
|
||||
// all other types
|
||||
}
|
||||
};`,
|
||||
},
|
||||
condition: {
|
||||
additionalVariables: null,
|
||||
extraLibs: null,
|
||||
template: (
|
||||
table: TableSettings
|
||||
) => `const condition: Condition = async({ref,req,db}) => {
|
||||
// feel free to add your own code logic here
|
||||
return true;
|
||||
}`,
|
||||
},
|
||||
auth: (webhookObject: IWebhook, setWebhookObject: (w: IWebhook) => void) => {
|
||||
return (
|
||||
<>
|
||||
<Typography gutterBottom>
|
||||
Get your{" "}
|
||||
<Link
|
||||
href="https://dashboard.stripe.com/apikeys"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
variant="inherit"
|
||||
>
|
||||
secret key
|
||||
<InlineOpenInNewIcon />
|
||||
</Link>{" "}
|
||||
and{" "}
|
||||
<Link
|
||||
href="https://dashboard.stripe.com/webhooks"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
variant="inherit"
|
||||
>
|
||||
signing key
|
||||
<InlineOpenInNewIcon />
|
||||
</Link>{" "}
|
||||
from Stripe dashboard.
|
||||
<br />
|
||||
Then add the secret below.
|
||||
</Typography>
|
||||
|
||||
<TextField
|
||||
id="stripe-secret-key"
|
||||
label="Secret key"
|
||||
value={webhookObject.auth.secretKey}
|
||||
fullWidth
|
||||
multiline
|
||||
onChange={(e) => {
|
||||
setWebhookObject({
|
||||
...webhookObject,
|
||||
auth: { ...webhookObject.auth, secretKey: e.target.value },
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<TextField
|
||||
id="stripe-signing-secret"
|
||||
label="Signing key"
|
||||
value={webhookObject.auth.signingSecret}
|
||||
fullWidth
|
||||
multiline
|
||||
onChange={(e) => {
|
||||
setWebhookObject({
|
||||
...webhookObject,
|
||||
auth: { ...webhookObject.auth, signingSecret: e.target.value },
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
export default webhookStripe;
|
||||
@@ -1,6 +1,7 @@
|
||||
import { TableSettings } from "@src/types/table";
|
||||
import { generateId } from "@src/utils/table";
|
||||
import { typeform, basic, sendgrid, webform } from "./Schemas";
|
||||
import { typeform, basic, sendgrid, webform, stripe } from "./Schemas";
|
||||
|
||||
export const webhookTypes = [
|
||||
"basic",
|
||||
"typeform",
|
||||
@@ -8,7 +9,7 @@ export const webhookTypes = [
|
||||
"webform",
|
||||
//"shopify",
|
||||
//"twitter",
|
||||
//"stripe",
|
||||
"stripe",
|
||||
] as const;
|
||||
|
||||
const requestType = [
|
||||
@@ -53,7 +54,7 @@ export const webhookNames: Record<WebhookType, string> = {
|
||||
//github:"GitHub",
|
||||
// shopify: "Shopify",
|
||||
// twitter: "Twitter",
|
||||
// stripe: "Stripe",
|
||||
stripe: "Stripe",
|
||||
basic: "Basic",
|
||||
webform: "Web form",
|
||||
};
|
||||
@@ -82,6 +83,7 @@ export const webhookSchemas = {
|
||||
typeform,
|
||||
sendgrid,
|
||||
webform,
|
||||
stripe,
|
||||
};
|
||||
|
||||
export function emptyWebhookObject(
|
||||
|
||||
Reference in New Issue
Block a user