@coasy/piece-coasy 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +1 -5
- package/package.json +1 -1
- package/src/index.ts +8 -57
- package/src/lib/actions/create-funnel-participant.ts +17 -10
- package/src/lib/common/coasyClient.ts +9 -11
- package/src/lib/common/triggers.ts +25 -40
- package/src/lib/triggers/new-auth-event.ts +37 -49
- package/src/lib/triggers/new-funnel-participant.ts +2 -2
- package/src/lib/triggers/new-webinar-participant.ts +30 -57
- package/src/lib/actions/create-event-participant.ts +0 -25
- package/src/lib/actions/create-voucher.ts +0 -20
- package/src/lib/actions/enroll-user-course.ts +0 -30
- package/src/lib/actions/find-event.ts +0 -20
- package/src/lib/common/actions.ts +0 -24
- package/src/lib/triggers/cancelled-membership.ts +0 -51
- package/src/lib/triggers/cancelled-order-item.ts +0 -61
- package/src/lib/triggers/cancelled-order.ts +0 -65
- package/src/lib/triggers/cancelled-orderprocess.ts +0 -52
- package/src/lib/triggers/cancelled-subscription.ts +0 -51
- package/src/lib/triggers/get-events.ts +0 -41
- package/src/lib/triggers/new-app-user-sign-up.ts +0 -34
- package/src/lib/triggers/new-customer.ts +0 -34
- package/src/lib/triggers/new-event-participant.ts +0 -56
- package/src/lib/triggers/new-lead.ts +0 -51
- package/src/lib/triggers/new-membership.ts +0 -51
- package/src/lib/triggers/new-order-item.ts +0 -62
- package/src/lib/triggers/new-order.ts +0 -61
- package/src/lib/triggers/new-subscription.ts +0 -51
- package/src/lib/triggers/webinar-participant-attend.ts +0 -73
- package/src/lib/triggers/webinar-participant-reminder.ts +0 -72
package/.eslintrc.json
CHANGED
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,32 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createPiece,
|
|
3
|
-
PieceAuth,
|
|
4
|
-
Property,
|
|
5
|
-
} from '@activepieces/pieces-framework';
|
|
6
|
-
import { createEventParticipant } from './lib/actions/create-event-participant';
|
|
1
|
+
import { createPiece, PieceAuth, Property } from '@activepieces/pieces-framework';
|
|
7
2
|
import { createFunnelParticipant } from './lib/actions/create-funnel-participant';
|
|
8
|
-
import { createVoucher } from './lib/actions/create-voucher';
|
|
9
|
-
import { enrollUserCourse } from './lib/actions/enroll-user-course';
|
|
10
|
-
import { findEvent } from './lib/actions/find-event';
|
|
11
|
-
import { cancelledMembership } from './lib/triggers/cancelled-membership';
|
|
12
|
-
import { cancelledOrder } from './lib/triggers/cancelled-order';
|
|
13
|
-
import { cancelledOrderItem } from './lib/triggers/cancelled-order-item';
|
|
14
|
-
import { cancelledOrderprocess } from './lib/triggers/cancelled-orderprocess';
|
|
15
|
-
import { cancelledSubscription } from './lib/triggers/cancelled-subscription';
|
|
16
|
-
import { getEvents } from './lib/triggers/get-events';
|
|
17
|
-
import { newAppUserSignUp } from './lib/triggers/new-app-user-sign-up';
|
|
18
|
-
import { newAuthEvent } from './lib/triggers/new-auth-event';
|
|
19
|
-
import { newCustomer } from './lib/triggers/new-customer';
|
|
20
|
-
import { newEventParticipant } from './lib/triggers/new-event-participant';
|
|
21
3
|
import { newFunnelParticipant } from './lib/triggers/new-funnel-participant';
|
|
22
|
-
import { newLead } from './lib/triggers/new-lead';
|
|
23
|
-
import { newMembership } from './lib/triggers/new-membership';
|
|
24
|
-
import { newOrder } from './lib/triggers/new-order';
|
|
25
|
-
import { newOrderItem } from './lib/triggers/new-order-item';
|
|
26
|
-
import { newSubscription } from './lib/triggers/new-subscription';
|
|
27
4
|
import { newWebinarParticipant } from './lib/triggers/new-webinar-participant';
|
|
28
|
-
import {
|
|
29
|
-
import { webinarParticipantReminder } from './lib/triggers/webinar-participant-reminder';
|
|
5
|
+
import { newAuthEvent } from './lib/triggers/new-auth-event';
|
|
30
6
|
|
|
31
7
|
export const coasyAuth = PieceAuth.CustomAuth({
|
|
32
8
|
required: true,
|
|
@@ -41,8 +17,8 @@ export const coasyAuth = PieceAuth.CustomAuth({
|
|
|
41
17
|
apiKey: PieceAuth.SecretText({
|
|
42
18
|
displayName: 'API Key',
|
|
43
19
|
description: 'Enter the api key',
|
|
44
|
-
required: true
|
|
45
|
-
})
|
|
20
|
+
required: true
|
|
21
|
+
})
|
|
46
22
|
},
|
|
47
23
|
});
|
|
48
24
|
|
|
@@ -52,33 +28,8 @@ export const coasy = createPiece({
|
|
|
52
28
|
description: 'Communicate with Coasy',
|
|
53
29
|
minimumSupportedRelease: '0.20.0',
|
|
54
30
|
logoUrl: 'https://console.coasy.io/favicon/apple-icon.png',
|
|
55
|
-
authors: [
|
|
56
|
-
actions: [
|
|
57
|
-
|
|
58
|
-
createFunnelParticipant,
|
|
59
|
-
createVoucher,
|
|
60
|
-
enrollUserCourse,
|
|
61
|
-
findEvent,
|
|
62
|
-
],
|
|
63
|
-
triggers: [
|
|
64
|
-
cancelledMembership,
|
|
65
|
-
cancelledOrder,
|
|
66
|
-
cancelledOrderItem,
|
|
67
|
-
cancelledOrderprocess,
|
|
68
|
-
cancelledSubscription,
|
|
69
|
-
getEvents,
|
|
70
|
-
newAppUserSignUp,
|
|
71
|
-
newAuthEvent,
|
|
72
|
-
newCustomer,
|
|
73
|
-
newEventParticipant,
|
|
74
|
-
newFunnelParticipant,
|
|
75
|
-
newLead,
|
|
76
|
-
newMembership,
|
|
77
|
-
newOrder,
|
|
78
|
-
newOrderItem,
|
|
79
|
-
newSubscription,
|
|
80
|
-
newWebinarParticipant,
|
|
81
|
-
webinarParticipantAttend,
|
|
82
|
-
webinarParticipantReminder,
|
|
83
|
-
],
|
|
31
|
+
authors: ["christian-schab"],
|
|
32
|
+
actions: [createFunnelParticipant],
|
|
33
|
+
triggers: [newFunnelParticipant, newWebinarParticipant, newAuthEvent]
|
|
84
34
|
});
|
|
35
|
+
|
|
@@ -1,35 +1,42 @@
|
|
|
1
1
|
import { createAction, Property } from '@activepieces/pieces-framework';
|
|
2
2
|
import { coasyAuth } from '../../index';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const name = 'createFunnelParticipant';
|
|
3
|
+
import { CoasyClient } from '../common/coasyClient';
|
|
6
4
|
|
|
7
5
|
export const createFunnelParticipant = createAction({
|
|
8
6
|
auth: coasyAuth,
|
|
9
|
-
name,
|
|
7
|
+
name: 'createFunnelParticipant',
|
|
10
8
|
displayName: 'Create Funnel Participant',
|
|
11
9
|
description: 'Create a new funnel participant',
|
|
12
10
|
props: {
|
|
13
11
|
funnelId: Property.ShortText({
|
|
14
12
|
displayName: 'Funnel ID',
|
|
15
13
|
description: 'ID of funnel',
|
|
16
|
-
required: true
|
|
14
|
+
required: true
|
|
17
15
|
}),
|
|
18
16
|
firstName: Property.ShortText({
|
|
19
17
|
displayName: 'First name',
|
|
20
18
|
description: 'first name of participant',
|
|
21
|
-
required: true
|
|
19
|
+
required: true
|
|
22
20
|
}),
|
|
23
21
|
lastName: Property.ShortText({
|
|
24
22
|
displayName: 'Last name',
|
|
25
23
|
description: 'last name of participant',
|
|
26
|
-
required: false
|
|
24
|
+
required: false
|
|
27
25
|
}),
|
|
28
26
|
email: Property.ShortText({
|
|
29
27
|
displayName: 'Email',
|
|
30
28
|
description: 'email address of partipant',
|
|
31
|
-
required: true
|
|
32
|
-
})
|
|
29
|
+
required: true
|
|
30
|
+
})
|
|
33
31
|
},
|
|
34
|
-
run
|
|
32
|
+
async run(configValue) {
|
|
33
|
+
const { propsValue, auth } = configValue;
|
|
34
|
+
const client = new CoasyClient(auth.baseUrl ?? 'https://backend.api.prod.coasy.io', auth.apiKey);
|
|
35
|
+
const request = {
|
|
36
|
+
email: propsValue.email,
|
|
37
|
+
firstName: propsValue.firstName,
|
|
38
|
+
funnelId: propsValue.funnelId
|
|
39
|
+
};
|
|
40
|
+
return client.action('createFunnelParticipant', request);
|
|
41
|
+
}
|
|
35
42
|
});
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AuthenticationType,
|
|
3
|
-
httpClient,
|
|
4
|
-
HttpMethod,
|
|
5
|
-
HttpRequest,
|
|
6
|
-
} from '@activepieces/pieces-common';
|
|
1
|
+
import { AuthenticationType, httpClient, HttpMethod, HttpRequest } from '@activepieces/pieces-common';
|
|
7
2
|
|
|
8
3
|
export class CoasyClient {
|
|
9
4
|
private baseUrl: string;
|
|
@@ -14,6 +9,7 @@ export class CoasyClient {
|
|
|
14
9
|
this.apiKey = apiKey;
|
|
15
10
|
}
|
|
16
11
|
|
|
12
|
+
|
|
17
13
|
async action(actionName: string, request: any) {
|
|
18
14
|
return this.request(`/apps/actions/${actionName}`, request);
|
|
19
15
|
}
|
|
@@ -22,20 +18,21 @@ export class CoasyClient {
|
|
|
22
18
|
return this.request(`/apps/triggers/create`, {
|
|
23
19
|
hookUrl,
|
|
24
20
|
trigger,
|
|
25
|
-
filter
|
|
21
|
+
filter
|
|
26
22
|
});
|
|
27
23
|
}
|
|
28
24
|
|
|
29
25
|
async destroyTrigger(webhookId: string) {
|
|
30
|
-
return this.request(`/apps/triggers/destroy`, { webhookId
|
|
26
|
+
return this.request(`/apps/triggers/destroy`, { webhookId})
|
|
31
27
|
}
|
|
32
28
|
|
|
33
29
|
async listTriggerEvents(trigger: string) {
|
|
34
30
|
return this.request(`/apps/list`, {
|
|
35
|
-
trigger
|
|
36
|
-
})
|
|
31
|
+
trigger
|
|
32
|
+
})
|
|
37
33
|
}
|
|
38
34
|
|
|
35
|
+
|
|
39
36
|
async request(path: string, requestBody: any) {
|
|
40
37
|
const request: HttpRequest<string> = {
|
|
41
38
|
method: HttpMethod.POST,
|
|
@@ -43,7 +40,7 @@ export class CoasyClient {
|
|
|
43
40
|
body: JSON.stringify(requestBody),
|
|
44
41
|
authentication: {
|
|
45
42
|
type: AuthenticationType.BEARER_TOKEN,
|
|
46
|
-
token: this.apiKey
|
|
43
|
+
token: this.apiKey
|
|
47
44
|
},
|
|
48
45
|
};
|
|
49
46
|
|
|
@@ -55,4 +52,5 @@ export class CoasyClient {
|
|
|
55
52
|
return response.body;
|
|
56
53
|
}
|
|
57
54
|
}
|
|
55
|
+
|
|
58
56
|
}
|
|
@@ -1,73 +1,58 @@
|
|
|
1
|
+
|
|
1
2
|
import { CoasyClient } from './coasyClient';
|
|
2
3
|
|
|
3
|
-
import {
|
|
4
|
-
SecretTextProperty,
|
|
5
|
-
ShortTextProperty,
|
|
6
|
-
StaticPropsValue,
|
|
7
|
-
Store,
|
|
8
|
-
} from '@activepieces/pieces-framework';
|
|
4
|
+
import { SecretTextProperty, ShortTextProperty, StaticPropsValue, Store } from '@activepieces/pieces-framework';
|
|
9
5
|
|
|
10
6
|
export interface CreateTriggerRequest {
|
|
11
7
|
triggerName: string;
|
|
12
8
|
webhookUrl: string;
|
|
13
|
-
auth:
|
|
14
|
-
baseUrl: ShortTextProperty<false
|
|
15
|
-
apiKey: SecretTextProperty<true
|
|
16
|
-
}
|
|
9
|
+
auth: StaticPropsValue<{
|
|
10
|
+
baseUrl: ShortTextProperty<false>,
|
|
11
|
+
apiKey: SecretTextProperty<true>
|
|
12
|
+
}>
|
|
17
13
|
filter: any;
|
|
18
14
|
store: Store;
|
|
19
15
|
}
|
|
20
16
|
|
|
21
17
|
export interface DestroyTriggerRequest {
|
|
22
18
|
triggerName: string;
|
|
23
|
-
auth:
|
|
24
|
-
baseUrl: ShortTextProperty<false
|
|
25
|
-
apiKey: SecretTextProperty<true
|
|
26
|
-
}
|
|
19
|
+
auth: StaticPropsValue<{
|
|
20
|
+
baseUrl: ShortTextProperty<false>,
|
|
21
|
+
apiKey: SecretTextProperty<true>
|
|
22
|
+
}>
|
|
27
23
|
store: Store;
|
|
28
24
|
}
|
|
29
25
|
|
|
30
26
|
export interface TestTriggerRequest {
|
|
31
27
|
triggerName: string;
|
|
32
|
-
auth:
|
|
33
|
-
baseUrl: ShortTextProperty<false
|
|
34
|
-
apiKey: SecretTextProperty<true
|
|
35
|
-
}
|
|
28
|
+
auth: StaticPropsValue<{
|
|
29
|
+
baseUrl: ShortTextProperty<false>,
|
|
30
|
+
apiKey: SecretTextProperty<true>
|
|
31
|
+
}>
|
|
36
32
|
}
|
|
37
33
|
|
|
38
34
|
export const createCoasyTrigger = async (request: CreateTriggerRequest) => {
|
|
39
|
-
const { triggerName, webhookUrl, filter, auth, store
|
|
40
|
-
const client = new CoasyClient(
|
|
41
|
-
auth.baseUrl ?? 'https://backend.api.prod.coasy.io',
|
|
42
|
-
auth.apiKey
|
|
43
|
-
);
|
|
35
|
+
const { triggerName, webhookUrl, filter, auth, store} = request;
|
|
36
|
+
const client = new CoasyClient(auth.baseUrl ?? 'https://backend.api.prod.coasy.io', auth.apiKey);
|
|
44
37
|
const response = await client.createTrigger(triggerName, webhookUrl, filter);
|
|
45
38
|
if (!response.id) throw new Error(`Failed to create Trigger!`);
|
|
46
39
|
await store.put<string>(`${triggerName}__WEBHOOK_ID`, response.id);
|
|
47
40
|
};
|
|
48
41
|
|
|
49
|
-
export const destroyCoasyTrigger = async (request: DestroyTriggerRequest) =>
|
|
50
|
-
const { triggerName, auth, store
|
|
42
|
+
export const destroyCoasyTrigger = async (request: DestroyTriggerRequest) => {
|
|
43
|
+
const { triggerName, auth, store} = request;
|
|
51
44
|
const webhookId = await store.get<string>(`${triggerName}__WEBHOOK_ID`);
|
|
52
45
|
if (!webhookId) throw new Error(`Webhook Id not found!`);
|
|
53
46
|
|
|
54
|
-
const client = new CoasyClient(
|
|
55
|
-
auth.baseUrl ?? 'https://backend.api.prod.coasy.io',
|
|
56
|
-
auth.apiKey
|
|
57
|
-
);
|
|
47
|
+
const client = new CoasyClient(auth.baseUrl ?? 'https://backend.api.prod.coasy.io', auth.apiKey);
|
|
58
48
|
await client.destroyTrigger(webhookId);
|
|
59
|
-
}
|
|
49
|
+
}
|
|
60
50
|
|
|
61
|
-
export const testCoasyTrigger = async (
|
|
62
|
-
request
|
|
63
|
-
): Promise<any[]> => {
|
|
64
|
-
const { triggerName, auth } = request;
|
|
51
|
+
export const testCoasyTrigger = async (request: TestTriggerRequest): Promise<any[]> => {
|
|
52
|
+
const { triggerName, auth} = request;
|
|
65
53
|
|
|
66
|
-
const client = new CoasyClient(
|
|
67
|
-
auth.baseUrl ?? 'https://backend.api.prod.coasy.io',
|
|
68
|
-
auth.apiKey
|
|
69
|
-
);
|
|
54
|
+
const client = new CoasyClient(auth.baseUrl ?? 'https://backend.api.prod.coasy.io', auth.apiKey);
|
|
70
55
|
const response = await client.listTriggerEvents(triggerName);
|
|
71
56
|
|
|
72
|
-
return [{ test: true
|
|
73
|
-
}
|
|
57
|
+
return [{ test: true}];
|
|
58
|
+
}
|
|
@@ -15,70 +15,58 @@ export const newAuthEvent = createTrigger({
|
|
|
15
15
|
description: 'categories of trigger',
|
|
16
16
|
required: true,
|
|
17
17
|
options: {
|
|
18
|
-
options: [
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
{
|
|
36
|
-
value: 'VerifyAuthChallengeResponse',
|
|
37
|
-
label: 'Verify Auth Challenge Response',
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
},
|
|
18
|
+
options: [{
|
|
19
|
+
value: "CustomEmailSender",
|
|
20
|
+
label: "Custom Email Sender"
|
|
21
|
+
}, {
|
|
22
|
+
value: "UserMigration",
|
|
23
|
+
label: "User Migration"
|
|
24
|
+
}, {
|
|
25
|
+
value: "DefineAuthChallenge",
|
|
26
|
+
label: "Define Auth Challenge"
|
|
27
|
+
}, {
|
|
28
|
+
value: "CreateAuthChallenge",
|
|
29
|
+
label: "Create Auth Challenge"
|
|
30
|
+
}, {
|
|
31
|
+
value: "VerifyAuthChallengeResponse",
|
|
32
|
+
label: "Verify Auth Challenge Response"
|
|
33
|
+
}]
|
|
34
|
+
}
|
|
41
35
|
}),
|
|
42
36
|
triggerNames: Property.StaticMultiSelectDropdown({
|
|
43
37
|
displayName: 'Triggers',
|
|
44
38
|
description: 'Select triggers to react on',
|
|
45
39
|
required: true,
|
|
46
40
|
options: {
|
|
47
|
-
options: [
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
value: 'ELSE',
|
|
66
|
-
label: 'Else',
|
|
67
|
-
},
|
|
68
|
-
],
|
|
69
|
-
},
|
|
70
|
-
}),
|
|
41
|
+
options: [{
|
|
42
|
+
value: "SignUp",
|
|
43
|
+
label: "Sign Up"
|
|
44
|
+
}, {
|
|
45
|
+
value: "ResendCode",
|
|
46
|
+
label: "Resend Code"
|
|
47
|
+
}, {
|
|
48
|
+
value: "ForgotPassword",
|
|
49
|
+
label: "Forgot Password"
|
|
50
|
+
}, {
|
|
51
|
+
value: "Authentication",
|
|
52
|
+
label: "Authentication"
|
|
53
|
+
}, {
|
|
54
|
+
value: "ELSE",
|
|
55
|
+
label: "Else"
|
|
56
|
+
}]
|
|
57
|
+
}
|
|
58
|
+
})
|
|
71
59
|
},
|
|
72
60
|
sampleData: {},
|
|
73
61
|
type: TriggerStrategy.WEBHOOK,
|
|
74
|
-
onEnable: (context) => createCoasyTrigger({
|
|
62
|
+
onEnable : (context) => createCoasyTrigger({
|
|
75
63
|
triggerName,
|
|
76
64
|
webhookUrl: context.webhookUrl,
|
|
77
65
|
auth: context.auth,
|
|
78
66
|
filter: context.propsValue,
|
|
79
67
|
store: context.store
|
|
80
68
|
}),
|
|
81
|
-
onDisable: (context) => destroyCoasyTrigger({
|
|
69
|
+
onDisable : (context) => destroyCoasyTrigger({
|
|
82
70
|
triggerName,
|
|
83
71
|
auth: context.auth,
|
|
84
72
|
store: context.store
|
|
@@ -18,14 +18,14 @@ export const newFunnelParticipant = createTrigger({
|
|
|
18
18
|
},
|
|
19
19
|
sampleData: {},
|
|
20
20
|
type: TriggerStrategy.WEBHOOK,
|
|
21
|
-
onEnable: (context) => createCoasyTrigger({
|
|
21
|
+
onEnable : (context) => createCoasyTrigger({
|
|
22
22
|
triggerName,
|
|
23
23
|
webhookUrl: context.webhookUrl,
|
|
24
24
|
auth: context.auth,
|
|
25
25
|
filter: context.propsValue,
|
|
26
26
|
store: context.store
|
|
27
27
|
}),
|
|
28
|
-
onDisable: (context) => destroyCoasyTrigger({
|
|
28
|
+
onDisable : (context) => destroyCoasyTrigger({
|
|
29
29
|
triggerName,
|
|
30
30
|
auth: context.auth,
|
|
31
31
|
store: context.store
|
|
@@ -1,16 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createTrigger,
|
|
3
|
-
Property,
|
|
4
|
-
TriggerStrategy,
|
|
5
|
-
} from '@activepieces/pieces-framework';
|
|
1
|
+
import { createTrigger, Property, TriggerStrategy } from '@activepieces/pieces-framework';
|
|
6
2
|
import { coasyAuth } from '../..';
|
|
7
|
-
import {
|
|
8
|
-
createCoasyTrigger,
|
|
9
|
-
destroyCoasyTrigger,
|
|
10
|
-
testCoasyTrigger,
|
|
11
|
-
} from '../common/triggers';
|
|
3
|
+
import { createCoasyTrigger, destroyCoasyTrigger, testCoasyTrigger } from '../common/triggers';
|
|
12
4
|
|
|
13
|
-
const triggerName =
|
|
5
|
+
const triggerName = "NEW_WEBINAR_PARTICIPANT";
|
|
14
6
|
|
|
15
7
|
export const newWebinarParticipant = createTrigger({
|
|
16
8
|
auth: coasyAuth,
|
|
@@ -21,61 +13,42 @@ export const newWebinarParticipant = createTrigger({
|
|
|
21
13
|
webinarIds: Property.Array({
|
|
22
14
|
displayName: 'Webinar IDs',
|
|
23
15
|
description: 'IDs of webinar to react to',
|
|
24
|
-
required: false
|
|
16
|
+
required: false
|
|
25
17
|
}),
|
|
26
18
|
selectedStartType: Property.StaticDropdown({
|
|
27
19
|
displayName: 'Selected start type',
|
|
28
20
|
description: 'filter only those participants',
|
|
29
21
|
required: false,
|
|
30
22
|
options: {
|
|
31
|
-
options: [
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
label: 'Not Attended',
|
|
43
|
-
value: 'NOT_ATTENDED',
|
|
44
|
-
=======
|
|
45
|
-
label: 'Instantly',
|
|
46
|
-
value: 'INSTANTLY',
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
label: 'Later',
|
|
50
|
-
value: 'LATER',
|
|
51
|
-
>>>>>>> Stashed changes
|
|
52
|
-
},
|
|
53
|
-
],
|
|
54
|
-
},
|
|
55
|
-
}),
|
|
23
|
+
options: [{
|
|
24
|
+
label: "Instantly",
|
|
25
|
+
value: "INSTANTLY"
|
|
26
|
+
}, {
|
|
27
|
+
label: "Later",
|
|
28
|
+
value: "LATER"
|
|
29
|
+
}]
|
|
30
|
+
}
|
|
31
|
+
})
|
|
56
32
|
},
|
|
57
33
|
sampleData: {},
|
|
58
34
|
type: TriggerStrategy.WEBHOOK,
|
|
59
|
-
onEnable: (context) =>
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
triggerName,
|
|
76
|
-
auth: context.auth,
|
|
77
|
-
}),
|
|
35
|
+
onEnable : (context) => createCoasyTrigger({
|
|
36
|
+
triggerName,
|
|
37
|
+
webhookUrl: context.webhookUrl,
|
|
38
|
+
auth: context.auth,
|
|
39
|
+
filter: context.propsValue,
|
|
40
|
+
store: context.store
|
|
41
|
+
}),
|
|
42
|
+
onDisable : (context) => destroyCoasyTrigger({
|
|
43
|
+
triggerName,
|
|
44
|
+
auth: context.auth,
|
|
45
|
+
store: context.store
|
|
46
|
+
}),
|
|
47
|
+
test: (context) => testCoasyTrigger({
|
|
48
|
+
triggerName,
|
|
49
|
+
auth: context.auth
|
|
50
|
+
}),
|
|
78
51
|
async run(context) {
|
|
79
52
|
return [context.payload.body];
|
|
80
|
-
}
|
|
53
|
+
}
|
|
81
54
|
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { createAction, Property } from '@activepieces/pieces-framework';
|
|
2
|
-
import { coasyAuth } from '../..';
|
|
3
|
-
import { runCoasyAction } from '../common/actions';
|
|
4
|
-
|
|
5
|
-
const name = 'createEventParticipant';
|
|
6
|
-
|
|
7
|
-
export const createEventParticipant = createAction({
|
|
8
|
-
auth: coasyAuth,
|
|
9
|
-
name,
|
|
10
|
-
displayName: 'Create Event Participant',
|
|
11
|
-
description: 'Creates a new event participant',
|
|
12
|
-
props: {
|
|
13
|
-
eventId: Property.ShortText({
|
|
14
|
-
displayName: 'Event ID',
|
|
15
|
-
description: 'ID of event',
|
|
16
|
-
required: true,
|
|
17
|
-
}),
|
|
18
|
-
categoryId: Property.ShortText({
|
|
19
|
-
displayName: 'Category ID',
|
|
20
|
-
description: 'ID of category',
|
|
21
|
-
required: false,
|
|
22
|
-
}),
|
|
23
|
-
},
|
|
24
|
-
run: (configValue) => runCoasyAction(configValue, name),
|
|
25
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { createAction, Property } from '@activepieces/pieces-framework';
|
|
2
|
-
import { coasyAuth } from '../..';
|
|
3
|
-
import { runCoasyAction } from '../common/actions';
|
|
4
|
-
|
|
5
|
-
const name = 'createVoucher';
|
|
6
|
-
|
|
7
|
-
export const createVoucher = createAction({
|
|
8
|
-
auth: coasyAuth,
|
|
9
|
-
name,
|
|
10
|
-
displayName: 'Create Voucher',
|
|
11
|
-
description: 'Creates a new voucher',
|
|
12
|
-
props: {
|
|
13
|
-
offerId: Property.ShortText({
|
|
14
|
-
displayName: 'Offer ID',
|
|
15
|
-
description: 'ID of offer',
|
|
16
|
-
required: true,
|
|
17
|
-
}),
|
|
18
|
-
},
|
|
19
|
-
run: (configValue) => runCoasyAction(configValue, name),
|
|
20
|
-
});
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { createAction, Property } from '@activepieces/pieces-framework';
|
|
2
|
-
import { coasyAuth } from '../..';
|
|
3
|
-
import { runCoasyAction } from '../common/actions';
|
|
4
|
-
|
|
5
|
-
const name = 'enrollUserCourse';
|
|
6
|
-
|
|
7
|
-
export const enrollUserCourse = createAction({
|
|
8
|
-
auth: coasyAuth,
|
|
9
|
-
name,
|
|
10
|
-
displayName: 'Enroll User Course',
|
|
11
|
-
description: 'Enrolls user course',
|
|
12
|
-
props: {
|
|
13
|
-
userId: Property.ShortText({
|
|
14
|
-
displayName: 'User ID',
|
|
15
|
-
description: 'ID of User',
|
|
16
|
-
required: true,
|
|
17
|
-
}),
|
|
18
|
-
courseId: Property.ShortText({
|
|
19
|
-
displayName: 'Course ID',
|
|
20
|
-
description: 'ID of Course',
|
|
21
|
-
required: true,
|
|
22
|
-
}),
|
|
23
|
-
directGrant: Property.Checkbox({
|
|
24
|
-
displayName: 'Direct Grant',
|
|
25
|
-
description: 'Give direct grant',
|
|
26
|
-
required: true,
|
|
27
|
-
}),
|
|
28
|
-
},
|
|
29
|
-
run: configValue => runCoasyAction(configValue, name),
|
|
30
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { createAction, Property } from '@activepieces/pieces-framework';
|
|
2
|
-
import { coasyAuth } from '../..';
|
|
3
|
-
import { runCoasyAction } from '../common/actions';
|
|
4
|
-
|
|
5
|
-
const name = 'findEvent';
|
|
6
|
-
|
|
7
|
-
export const findEvent = createAction({
|
|
8
|
-
auth: coasyAuth,
|
|
9
|
-
name,
|
|
10
|
-
displayName: 'Find Event',
|
|
11
|
-
description: 'Finds Event',
|
|
12
|
-
props: {
|
|
13
|
-
title: Property.ShortText({
|
|
14
|
-
displayName: 'Title',
|
|
15
|
-
description: 'Title Name',
|
|
16
|
-
required: false,
|
|
17
|
-
}),
|
|
18
|
-
},
|
|
19
|
-
run: configValue => runCoasyAction(configValue, name),
|
|
20
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ActionContext,
|
|
3
|
-
InputPropertyMap,
|
|
4
|
-
} from '@activepieces/pieces-framework';
|
|
5
|
-
import { coasyAuth } from '../..';
|
|
6
|
-
import { CoasyClient } from './coasyClient';
|
|
7
|
-
|
|
8
|
-
export const runCoasyAction = async <T extends InputPropertyMap>(
|
|
9
|
-
configValue: ActionContext<typeof coasyAuth, T>,
|
|
10
|
-
action: string
|
|
11
|
-
) => {
|
|
12
|
-
const { propsValue, auth: authPayload } = configValue;
|
|
13
|
-
const client = new CoasyClient(
|
|
14
|
-
authPayload.baseUrl ?? 'https://backend.api.prod.coasy.io',
|
|
15
|
-
authPayload.apiKey
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
const { ...restPropsValue } = propsValue;
|
|
19
|
-
|
|
20
|
-
delete restPropsValue['auth'];
|
|
21
|
-
|
|
22
|
-
const request = { ...restPropsValue };
|
|
23
|
-
return client.action(action, request);
|
|
24
|
-
};
|