@coasy/piece-coasy 0.1.3 → 0.1.5
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/dist/packages/pieces/community/coasy/packages/pieces/community/coasy/README.md +146 -0
- 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 -48
- package/src/lib/actions/create-event-participant.ts +0 -25
- package/src/lib/actions/create-voucher.ts +0 -46
- 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 -61
- 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
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# Coasy Piece for Activepieces
|
|
2
|
+
|
|
3
|
+
This is the Coasy integration piece for Activepieces, providing actions and triggers to interact with the Coasy platform for funnel and webinar management.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The Coasy piece includes:
|
|
8
|
+
- **Actions**: Create funnel participants
|
|
9
|
+
- **Triggers**: New funnel participants, new webinar participants, new auth events
|
|
10
|
+
- **Authentication**: Custom auth with base URL and API key
|
|
11
|
+
|
|
12
|
+
## Development Setup
|
|
13
|
+
|
|
14
|
+
### Prerequisites
|
|
15
|
+
1. Clone the activepieces repository
|
|
16
|
+
2. Install dependencies: `npm install`
|
|
17
|
+
3. Ensure you're in the root directory of the activepieces monorepo
|
|
18
|
+
|
|
19
|
+
### Development Commands
|
|
20
|
+
|
|
21
|
+
#### Building the Piece
|
|
22
|
+
```bash
|
|
23
|
+
# Build the coasy piece specifically
|
|
24
|
+
nx build pieces-coasy
|
|
25
|
+
|
|
26
|
+
# Build with watch mode for development
|
|
27
|
+
nx build pieces-coasy --watch
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
#### Testing
|
|
31
|
+
```bash
|
|
32
|
+
# Run tests for the coasy piece
|
|
33
|
+
nx test pieces-coasy
|
|
34
|
+
|
|
35
|
+
# Run tests with watch mode
|
|
36
|
+
nx test pieces-coasy --watch
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
#### Linting
|
|
40
|
+
```bash
|
|
41
|
+
# Lint the coasy piece
|
|
42
|
+
nx lint pieces-coasy
|
|
43
|
+
|
|
44
|
+
# Auto-fix lint issues
|
|
45
|
+
nx lint pieces-coasy --fix
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Development Workflow
|
|
49
|
+
|
|
50
|
+
#### 1. Start Development Environment
|
|
51
|
+
```bash
|
|
52
|
+
# Start the full development environment (frontend + backend + engine + pieces)
|
|
53
|
+
npm run dev
|
|
54
|
+
|
|
55
|
+
# Or start just backend services if only testing the piece
|
|
56
|
+
npm run dev:backend
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
#### 2. Testing Your Changes
|
|
60
|
+
- Navigate to `http://localhost:4200` (frontend)
|
|
61
|
+
- Create a new flow and add Coasy actions/triggers
|
|
62
|
+
- Test authentication with your Coasy credentials
|
|
63
|
+
- Verify actions and triggers work as expected
|
|
64
|
+
|
|
65
|
+
#### 3. Adding New Features
|
|
66
|
+
|
|
67
|
+
**Adding a New Action:**
|
|
68
|
+
1. Create a new file in `src/lib/actions/`
|
|
69
|
+
2. Export the action from `src/index.ts`
|
|
70
|
+
3. Follow the existing patterns in `create-funnel-participant.ts`
|
|
71
|
+
|
|
72
|
+
**Adding a New Trigger:**
|
|
73
|
+
1. Create a new file in `src/lib/triggers/`
|
|
74
|
+
2. Export the trigger from `src/index.ts`
|
|
75
|
+
3. Follow the existing patterns in `new-funnel-participant.ts`
|
|
76
|
+
|
|
77
|
+
#### 4. File Structure
|
|
78
|
+
```
|
|
79
|
+
packages/pieces/community/coasy/
|
|
80
|
+
├── README.md # This file
|
|
81
|
+
├── package.json # Package configuration
|
|
82
|
+
├── project.json # Nx project configuration
|
|
83
|
+
├── tsconfig.json # TypeScript config
|
|
84
|
+
└── src/
|
|
85
|
+
├── index.ts # Main piece definition and exports
|
|
86
|
+
└── lib/
|
|
87
|
+
├── actions/ # Action implementations
|
|
88
|
+
├── triggers/ # Trigger implementations
|
|
89
|
+
└── common/ # Shared utilities
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Code Standards
|
|
93
|
+
|
|
94
|
+
### Authentication
|
|
95
|
+
The piece uses custom authentication with:
|
|
96
|
+
- `baseUrl`: Coasy instance base URL
|
|
97
|
+
- `apiKey`: API key for authentication
|
|
98
|
+
|
|
99
|
+
### Error Handling
|
|
100
|
+
- Use proper error messages for user-facing errors
|
|
101
|
+
- Handle API errors gracefully
|
|
102
|
+
- Validate inputs before making API calls
|
|
103
|
+
|
|
104
|
+
### Properties
|
|
105
|
+
- Use descriptive `displayName` and `description` for all properties
|
|
106
|
+
- Mark required fields appropriately
|
|
107
|
+
- Use proper property types from `@activepieces/pieces-framework`
|
|
108
|
+
|
|
109
|
+
## Testing in Activepieces
|
|
110
|
+
|
|
111
|
+
1. **Authentication Testing**:
|
|
112
|
+
- Verify connection works with valid credentials
|
|
113
|
+
- Test error handling with invalid credentials
|
|
114
|
+
|
|
115
|
+
2. **Action Testing**:
|
|
116
|
+
- Test with valid inputs
|
|
117
|
+
- Test error scenarios
|
|
118
|
+
- Verify data transformation
|
|
119
|
+
|
|
120
|
+
3. **Trigger Testing**:
|
|
121
|
+
- Set up webhooks/polling as needed
|
|
122
|
+
- Test trigger conditions
|
|
123
|
+
- Verify payload structure
|
|
124
|
+
|
|
125
|
+
## Publishing
|
|
126
|
+
|
|
127
|
+
The piece is published as `@coasy/piece-coasy` to npm. Version is currently `0.0.12`.
|
|
128
|
+
|
|
129
|
+
To publish a new version:
|
|
130
|
+
1. Navigate to the coasy piece directory:
|
|
131
|
+
```bash
|
|
132
|
+
cd packages/pieces/community/coasy
|
|
133
|
+
```
|
|
134
|
+
2. Update the `version` in `package.json` (e.g., from `0.0.11` to `0.0.12`)
|
|
135
|
+
3. Publish directly to npm:
|
|
136
|
+
```bash
|
|
137
|
+
npm publish
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**Note**: The monorepo's `npm run publish-piece` script currently has dependency resolution issues. Use the direct `npm publish` method above instead.
|
|
141
|
+
|
|
142
|
+
## Resources
|
|
143
|
+
|
|
144
|
+
- [Activepieces Documentation](https://www.activepieces.com/docs)
|
|
145
|
+
- [Pieces Framework Reference](https://www.activepieces.com/docs/developers/piece-reference/properties)
|
|
146
|
+
- [Piece Development Guide](https://www.activepieces.com/docs/developers/building-pieces/create-action)
|
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
|