2022-03-09 08:56:55 +00:00
|
|
|
import { appsSection, customAppListPath } from "@saleor/apps/urls";
|
2021-08-09 15:27:13 +00:00
|
|
|
import { stringifyQs } from "@saleor/utils/urls";
|
2019-10-09 06:01:52 +00:00
|
|
|
import urlJoin from "url-join";
|
|
|
|
|
2020-07-22 10:54:15 +00:00
|
|
|
import { ActiveTab, Dialog, SingleAction, TabActionDialog } from "../types";
|
2019-10-09 06:01:52 +00:00
|
|
|
|
2019-12-06 14:58:28 +00:00
|
|
|
export const webhookSection = "/webhooks/";
|
|
|
|
export const webhookListPath = webhookSection;
|
2020-07-22 10:54:15 +00:00
|
|
|
|
2019-10-15 10:06:19 +00:00
|
|
|
export type WebhookListUrlDialog = "remove" | TabActionDialog;
|
2020-07-22 10:54:15 +00:00
|
|
|
|
2019-12-17 17:13:56 +00:00
|
|
|
export type WebhookListUrlQueryParams = ActiveTab &
|
2019-10-15 10:06:19 +00:00
|
|
|
Dialog<WebhookListUrlDialog> &
|
2020-07-22 10:54:15 +00:00
|
|
|
SingleAction;
|
|
|
|
|
|
|
|
export const webhookPath = (id: string) =>
|
|
|
|
urlJoin(appsSection, webhookSection, id);
|
2019-10-09 06:01:52 +00:00
|
|
|
|
2019-10-10 05:38:21 +00:00
|
|
|
export type WebhookUrlDialog = "remove";
|
2019-12-06 14:58:28 +00:00
|
|
|
export type WebhookUrlQueryParams = Dialog<WebhookUrlDialog> & SingleAction;
|
|
|
|
export const webhookUrl = (id: string, params?: WebhookUrlQueryParams) =>
|
|
|
|
webhookPath(encodeURIComponent(id)) + "?" + stringifyQs(params);
|
2019-10-09 20:50:03 +00:00
|
|
|
|
2020-07-22 10:54:15 +00:00
|
|
|
export const webhookAddPath = (id: string) =>
|
|
|
|
urlJoin(customAppListPath, id, webhookSection, "add");
|
2019-12-06 14:58:28 +00:00
|
|
|
export const webhookAddUrl = webhookAddPath;
|