Zapier integration (#491)

* create zapier app

* install sanctum

* move OAuthProviderController

* make `api-external` middleware

* add zapier endpoints

* add tests

* token management

* zapier event handler

* add policy

* use `slug` instead of `id`

* wip

* check policies

* change api prefix to `external`

* ui tweaks

* validate token abilities

* open zapier URL

* zapier ui tweaks

* update zap

* Fix linting

* Added sample endpoints + minor UI changes

* Run PHP code linter

---------

Co-authored-by: Julien Nahum <julien@nahum.net>
This commit is contained in:
Boris Lepikhin
2024-08-12 02:14:02 -07:00
committed by GitHub
parent 7ad62fb3ea
commit 517bccc695
61 changed files with 5799 additions and 51 deletions

47
client/stores/access_tokens.js vendored Normal file
View File

@@ -0,0 +1,47 @@
import { defineStore } from "pinia"
import { useContentStore } from "~/composables/stores/useContentStore.js"
export const useAccessTokenStore = defineStore("access_tokens", () => {
const contentStore = useContentStore()
const abilities = [
{
title: 'Manage integrations',
name: 'manage-integrations',
},
{
title: 'List forms',
name: 'list-forms',
},
{
title: 'List workspaces',
name: 'list-workspaces',
},
]
const fetchTokens = () => {
contentStore.resetState()
contentStore.startLoading()
return opnFetch('/settings/tokens').then(
(data) => {
contentStore.save(data)
contentStore.stopLoading()
},
)
}
const tokens = computed(() => contentStore.getAll.value)
const getAbility = (name) => {
return abilities.find(ability => ability.name == name)
}
return {
...contentStore,
fetchTokens,
tokens,
abilities,
getAbility
}
})