feat(jotform): add jotform integration
This commit is contained in:
32
packages/backend/src/apps/jotform/auth/index.js
Normal file
32
packages/backend/src/apps/jotform/auth/index.js
Normal file
@@ -0,0 +1,32 @@
|
||||
import verifyCredentials from './verify-credentials.js';
|
||||
import isStillVerified from './is-still-verified.js';
|
||||
|
||||
export default {
|
||||
fields: [
|
||||
{
|
||||
key: 'instanceUrl',
|
||||
label: 'Jotform instance URL',
|
||||
type: 'string',
|
||||
required: false,
|
||||
readOnly: false,
|
||||
value: null,
|
||||
placeholder: 'https://${subdomain}.jotform.com',
|
||||
description: 'If you have an enterprise plan, you can use your api url.',
|
||||
clickToCopy: true,
|
||||
},
|
||||
{
|
||||
key: 'apiKey',
|
||||
label: 'API Key',
|
||||
type: 'string',
|
||||
required: true,
|
||||
readOnly: false,
|
||||
value: null,
|
||||
placeholder: null,
|
||||
description: 'Jotform API key of your account.',
|
||||
clickToCopy: false,
|
||||
},
|
||||
],
|
||||
|
||||
verifyCredentials,
|
||||
isStillVerified,
|
||||
};
|
@@ -0,0 +1,8 @@
|
||||
import getCurrentUser from '../common/get-current-user.js';
|
||||
|
||||
const isStillVerified = async ($) => {
|
||||
const user = await getCurrentUser($);
|
||||
return !!user.username;
|
||||
};
|
||||
|
||||
export default isStillVerified;
|
14
packages/backend/src/apps/jotform/auth/verify-credentials.js
Normal file
14
packages/backend/src/apps/jotform/auth/verify-credentials.js
Normal file
@@ -0,0 +1,14 @@
|
||||
import getCurrentUser from '../common/get-current-user.js';
|
||||
|
||||
const verifyCredentials = async ($) => {
|
||||
const user = await getCurrentUser($);
|
||||
|
||||
const screenName = [user.username, user.email].filter(Boolean).join(' @ ');
|
||||
|
||||
await $.auth.set({
|
||||
screenName,
|
||||
apiKey: $.auth.data.apiKey,
|
||||
});
|
||||
};
|
||||
|
||||
export default verifyCredentials;
|
Reference in New Issue
Block a user