@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.
Files changed (31) hide show
  1. package/.eslintrc.json +1 -5
  2. package/dist/packages/pieces/community/coasy/packages/pieces/community/coasy/README.md +146 -0
  3. package/package.json +1 -1
  4. package/src/index.ts +8 -57
  5. package/src/lib/actions/create-funnel-participant.ts +17 -10
  6. package/src/lib/common/coasyClient.ts +9 -11
  7. package/src/lib/common/triggers.ts +25 -40
  8. package/src/lib/triggers/new-auth-event.ts +37 -49
  9. package/src/lib/triggers/new-funnel-participant.ts +2 -2
  10. package/src/lib/triggers/new-webinar-participant.ts +30 -48
  11. package/src/lib/actions/create-event-participant.ts +0 -25
  12. package/src/lib/actions/create-voucher.ts +0 -46
  13. package/src/lib/actions/enroll-user-course.ts +0 -30
  14. package/src/lib/actions/find-event.ts +0 -20
  15. package/src/lib/common/actions.ts +0 -24
  16. package/src/lib/triggers/cancelled-membership.ts +0 -51
  17. package/src/lib/triggers/cancelled-order-item.ts +0 -61
  18. package/src/lib/triggers/cancelled-order.ts +0 -61
  19. package/src/lib/triggers/cancelled-orderprocess.ts +0 -52
  20. package/src/lib/triggers/cancelled-subscription.ts +0 -51
  21. package/src/lib/triggers/get-events.ts +0 -41
  22. package/src/lib/triggers/new-app-user-sign-up.ts +0 -34
  23. package/src/lib/triggers/new-customer.ts +0 -34
  24. package/src/lib/triggers/new-event-participant.ts +0 -56
  25. package/src/lib/triggers/new-lead.ts +0 -51
  26. package/src/lib/triggers/new-membership.ts +0 -51
  27. package/src/lib/triggers/new-order-item.ts +0 -62
  28. package/src/lib/triggers/new-order.ts +0 -61
  29. package/src/lib/triggers/new-subscription.ts +0 -51
  30. package/src/lib/triggers/webinar-participant-attend.ts +0 -73
  31. package/src/lib/triggers/webinar-participant-reminder.ts +0 -72
@@ -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 = 'NEW_WEBINAR_PARTICIPANT';
5
+ const triggerName = "NEW_WEBINAR_PARTICIPANT";
14
6
 
15
7
  export const newWebinarParticipant = createTrigger({
16
8
  auth: coasyAuth,
@@ -21,52 +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
- label: 'Upcoming',
34
- value: 'UPCOMING',
35
- },
36
- {
37
- label: 'Attended',
38
- value: 'ATTENDED',
39
- },
40
- {
41
- label: 'Not Attended',
42
- value: 'NOT_ATTENDED',
43
- },
44
- ],
45
- },
46
- }),
23
+ options: [{
24
+ label: "Instantly",
25
+ value: "INSTANTLY"
26
+ }, {
27
+ label: "Later",
28
+ value: "LATER"
29
+ }]
30
+ }
31
+ })
47
32
  },
48
33
  sampleData: {},
49
34
  type: TriggerStrategy.WEBHOOK,
50
- onEnable: (context) =>
51
- createCoasyTrigger({
52
- triggerName,
53
- webhookUrl: context.webhookUrl,
54
- auth: context.auth,
55
- filter: context.propsValue,
56
- store: context.store,
57
- }),
58
- onDisable: (context) =>
59
- destroyCoasyTrigger({
60
- triggerName,
61
- auth: context.auth,
62
- store: context.store,
63
- }),
64
- test: (context) =>
65
- testCoasyTrigger({
66
- triggerName,
67
- auth: context.auth,
68
- }),
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
+ }),
69
51
  async run(context) {
70
52
  return [context.payload.body];
71
- },
53
+ }
72
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
- eventCategoryId: Property.ShortText({
19
- displayName: 'Category ID',
20
- description: 'ID of category',
21
- required: true,
22
- }),
23
- },
24
- run: (configValue) => runCoasyAction(configValue, name),
25
- });
@@ -1,46 +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
- offerIds: Property.Array({
14
- displayName: 'Offer ID',
15
- description: 'ID of offer',
16
- required: false,
17
- }),
18
- countLeft: Property.Number({
19
- displayName: 'Quantity',
20
- description: 'Count of vouchers',
21
- required: false,
22
- }),
23
- recurringPeriod: Property.StaticDropdown({
24
- displayName: 'Recurring period',
25
- description: 'How the voucher will recurre',
26
- required: false,
27
- options: {
28
- options: [
29
- {
30
- label: 'Monthly',
31
- value: 'MONTHLY',
32
- },
33
- {
34
- label: 'Quarterly',
35
- value: 'QUARTERLY',
36
- },
37
- {
38
- label: 'Yearly',
39
- value: 'YEARLY',
40
- },
41
- ],
42
- },
43
- }),
44
- },
45
- run: (configValue) => runCoasyAction(configValue, name),
46
- });
@@ -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: false,
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
- };
@@ -1,51 +0,0 @@
1
- import {
2
- createTrigger,
3
- Property,
4
- TriggerStrategy,
5
- } from '@activepieces/pieces-framework';
6
- import { coasyAuth } from '../..';
7
- import {
8
- createCoasyTrigger,
9
- destroyCoasyTrigger,
10
- testCoasyTrigger,
11
- } from '../common/triggers';
12
-
13
- const triggerName = 'CANCELLED_MEMBERSHIP';
14
-
15
- export const cancelledMembership = createTrigger({
16
- auth: coasyAuth,
17
- name: 'cancelledMembership',
18
- displayName: 'Cancelled Membership',
19
- description: 'Triggers when a customer requests a membership cancellation.',
20
- props: {
21
- membershipTypeIds: Property.Array({
22
- displayName: 'Membership Type IDs',
23
- description: 'IDs of membership types to react to',
24
- required: false,
25
- }),
26
- },
27
- sampleData: {},
28
- type: TriggerStrategy.WEBHOOK,
29
- onEnable: (context) =>
30
- createCoasyTrigger({
31
- triggerName,
32
- webhookUrl: context.webhookUrl,
33
- auth: context.auth,
34
- filter: context.propsValue,
35
- store: context.store,
36
- }),
37
- onDisable: (context) =>
38
- destroyCoasyTrigger({
39
- triggerName,
40
- auth: context.auth,
41
- store: context.store,
42
- }),
43
- test: (context) =>
44
- testCoasyTrigger({
45
- triggerName,
46
- auth: context.auth,
47
- }),
48
- async run(context) {
49
- return [context.payload.body];
50
- },
51
- });
@@ -1,61 +0,0 @@
1
- import {
2
- createTrigger,
3
- Property,
4
- TriggerStrategy,
5
- } from '@activepieces/pieces-framework';
6
- import { coasyAuth } from '../..';
7
- import {
8
- createCoasyTrigger,
9
- destroyCoasyTrigger,
10
- testCoasyTrigger,
11
- } from '../common/triggers';
12
-
13
- const triggerName = 'CANCELLED_ORDER_ITEM';
14
-
15
- export const cancelledOrderItem = createTrigger({
16
- auth: coasyAuth,
17
- name: 'cancelledOrderItem',
18
- displayName: 'Cancelled Order Item',
19
- description: 'Triggers when an order item is cancelled.',
20
- props: {
21
- mainOfferIds: Property.Array({
22
- displayName: 'Main Offer IDs',
23
- description: 'IDs of main offers to react to',
24
- required: false,
25
- }),
26
- selectedPaymentPlans: Property.Array({
27
- displayName: 'Selected Payment Plans',
28
- description: 'Payment plans to filter by',
29
- required: false,
30
- }),
31
- selectedShippingOptions: Property.Array({
32
- displayName: 'Selected Shipping Options',
33
- description: 'Shipping options to filter by',
34
- required: false,
35
- }),
36
- },
37
- sampleData: {},
38
- type: TriggerStrategy.WEBHOOK,
39
- onEnable: (context) =>
40
- createCoasyTrigger({
41
- triggerName,
42
- webhookUrl: context.webhookUrl,
43
- auth: context.auth,
44
- filter: context.propsValue,
45
- store: context.store,
46
- }),
47
- onDisable: (context) =>
48
- destroyCoasyTrigger({
49
- triggerName,
50
- auth: context.auth,
51
- store: context.store,
52
- }),
53
- test: (context) =>
54
- testCoasyTrigger({
55
- triggerName,
56
- auth: context.auth,
57
- }),
58
- async run(context) {
59
- return [context.payload.body];
60
- },
61
- });
@@ -1,61 +0,0 @@
1
- import {
2
- createTrigger,
3
- Property,
4
- TriggerStrategy,
5
- } from '@activepieces/pieces-framework';
6
- import { coasyAuth } from '../..';
7
- import {
8
- createCoasyTrigger,
9
- destroyCoasyTrigger,
10
- testCoasyTrigger,
11
- } from '../common/triggers';
12
-
13
- const triggerName = 'CANCELLED_ORDER';
14
-
15
- export const cancelledOrder = createTrigger({
16
- auth: coasyAuth,
17
- name: 'cancelledOrder',
18
- displayName: 'Cancelled Order',
19
- description: 'Triggers when an order is cancelled.',
20
- props: {
21
- mainOfferIds: Property.Array({
22
- displayName: 'Main Offer IDs',
23
- description: 'IDs of main offers to react to',
24
- required: false,
25
- }),
26
- selectedPaymentPlans: Property.Array({
27
- displayName: 'Selected Payment Plans',
28
- description: 'Payment plans to filter by',
29
- required: false,
30
- }),
31
- selectedShippingOptions: Property.Array({
32
- displayName: 'Selected Shipping Options',
33
- description: 'Shipping options to filter by',
34
- required: false,
35
- }),
36
- },
37
- sampleData: {},
38
- type: TriggerStrategy.WEBHOOK,
39
- onEnable: (context) =>
40
- createCoasyTrigger({
41
- triggerName,
42
- webhookUrl: context.webhookUrl,
43
- auth: context.auth,
44
- filter: context.propsValue,
45
- store: context.store,
46
- }),
47
- onDisable: (context) =>
48
- destroyCoasyTrigger({
49
- triggerName,
50
- auth: context.auth,
51
- store: context.store,
52
- }),
53
- test: (context) =>
54
- testCoasyTrigger({
55
- triggerName,
56
- auth: context.auth,
57
- }),
58
- async run(context) {
59
- return [context.payload.body];
60
- },
61
- });
@@ -1,52 +0,0 @@
1
- import {
2
- createTrigger,
3
- Property,
4
- TriggerStrategy,
5
- } from '@activepieces/pieces-framework';
6
- import { coasyAuth } from '../..';
7
- import {
8
- createCoasyTrigger,
9
- destroyCoasyTrigger,
10
- testCoasyTrigger,
11
- } from '../common/triggers';
12
-
13
- const triggerName = 'CANCELLED_ORDERPROCESS';
14
-
15
- export const cancelledOrderprocess = createTrigger({
16
- auth: coasyAuth,
17
- name: 'cancelledOrderprocess',
18
- displayName: 'Cancelled Order Process',
19
- description:
20
- 'Triggers when a customer starts checkout but does not finish within 1 hour.',
21
- props: {
22
- mainOfferIds: Property.Array({
23
- displayName: 'Main Offer IDs',
24
- description: 'IDs of main offers to react to',
25
- required: false,
26
- }),
27
- },
28
- sampleData: {},
29
- type: TriggerStrategy.WEBHOOK,
30
- onEnable: (context) =>
31
- createCoasyTrigger({
32
- triggerName,
33
- webhookUrl: context.webhookUrl,
34
- auth: context.auth,
35
- filter: context.propsValue,
36
- store: context.store,
37
- }),
38
- onDisable: (context) =>
39
- destroyCoasyTrigger({
40
- triggerName,
41
- auth: context.auth,
42
- store: context.store,
43
- }),
44
- test: (context) =>
45
- testCoasyTrigger({
46
- triggerName,
47
- auth: context.auth,
48
- }),
49
- async run(context) {
50
- return [context.payload.body];
51
- },
52
- });
@@ -1,51 +0,0 @@
1
- import {
2
- createTrigger,
3
- Property,
4
- TriggerStrategy,
5
- } from '@activepieces/pieces-framework';
6
- import { coasyAuth } from '../..';
7
- import {
8
- createCoasyTrigger,
9
- destroyCoasyTrigger,
10
- testCoasyTrigger,
11
- } from '../common/triggers';
12
-
13
- const triggerName = 'CANCELLED_SUBSCRIPTION';
14
-
15
- export const cancelledSubscription = createTrigger({
16
- auth: coasyAuth,
17
- name: 'cancelledSubscription',
18
- displayName: 'Cancelled Subscription',
19
- description: 'Triggers when a customer requests a subscription cancellation.',
20
- props: {
21
- membershipTypeIds: Property.Array({
22
- displayName: 'Membership Type IDs',
23
- description: 'IDs of membership types to react to',
24
- required: false,
25
- }),
26
- },
27
- sampleData: {},
28
- type: TriggerStrategy.WEBHOOK,
29
- onEnable: (context) =>
30
- createCoasyTrigger({
31
- triggerName,
32
- webhookUrl: context.webhookUrl,
33
- auth: context.auth,
34
- filter: context.propsValue,
35
- store: context.store,
36
- }),
37
- onDisable: (context) =>
38
- destroyCoasyTrigger({
39
- triggerName,
40
- auth: context.auth,
41
- store: context.store,
42
- }),
43
- test: (context) =>
44
- testCoasyTrigger({
45
- triggerName,
46
- auth: context.auth,
47
- }),
48
- async run(context) {
49
- return [context.payload.body];
50
- },
51
- });
@@ -1,41 +0,0 @@
1
- import { createTrigger, TriggerStrategy } from '@activepieces/pieces-framework';
2
- import { coasyAuth } from '../..';
3
- import {
4
- createCoasyTrigger,
5
- destroyCoasyTrigger,
6
- testCoasyTrigger,
7
- } from '../common/triggers';
8
-
9
- const triggerName = 'GET_EVENTS';
10
-
11
- export const getEvents = createTrigger({
12
- auth: coasyAuth,
13
- name: 'getEvents',
14
- displayName: 'Get Events',
15
- description: 'Get a list of all events.',
16
- props: {},
17
- sampleData: {},
18
- type: TriggerStrategy.WEBHOOK,
19
- onEnable: (context) =>
20
- createCoasyTrigger({
21
- triggerName,
22
- webhookUrl: context.webhookUrl,
23
- auth: context.auth,
24
- filter: context.propsValue,
25
- store: context.store,
26
- }),
27
- onDisable: (context) =>
28
- destroyCoasyTrigger({
29
- triggerName,
30
- auth: context.auth,
31
- store: context.store,
32
- }),
33
- test: (context) =>
34
- testCoasyTrigger({
35
- triggerName,
36
- auth: context.auth,
37
- }),
38
- async run(context) {
39
- return [context.payload.body];
40
- },
41
- });
@@ -1,34 +0,0 @@
1
- import { createTrigger, Property, TriggerStrategy } from '@activepieces/pieces-framework';
2
- import { coasyAuth } from '../..';
3
- import { createCoasyTrigger, destroyCoasyTrigger, testCoasyTrigger } from '../common/triggers';
4
-
5
- const triggerName = "NEW_APP_USER_SIGN_UP";
6
-
7
- export const newAppUserSignUp = createTrigger({
8
- auth: coasyAuth,
9
- name: 'newAppUserSignUp',
10
- displayName: 'New App User Sign Up',
11
- description: 'Triggers when a new app user sign up.',
12
- props: {},
13
- sampleData: {},
14
- type: TriggerStrategy.WEBHOOK,
15
- onEnable: (context) => createCoasyTrigger({
16
- triggerName,
17
- webhookUrl: context.webhookUrl,
18
- auth: context.auth,
19
- filter: context.propsValue,
20
- store: context.store
21
- }),
22
- onDisable: (context) => destroyCoasyTrigger({
23
- triggerName,
24
- auth: context.auth,
25
- store: context.store
26
- }),
27
- test: (context) => testCoasyTrigger({
28
- triggerName,
29
- auth: context.auth
30
- }),
31
- async run(context) {
32
- return [context.payload.body];
33
- }
34
- });
@@ -1,34 +0,0 @@
1
- import { createTrigger, Property, TriggerStrategy } from '@activepieces/pieces-framework';
2
- import { coasyAuth } from '../..';
3
- import { createCoasyTrigger, destroyCoasyTrigger, testCoasyTrigger } from '../common/triggers';
4
-
5
- const triggerName = "NEW_CUSTOMER";
6
-
7
- export const newCustomer = createTrigger({
8
- auth: coasyAuth,
9
- name: 'newCustomer',
10
- displayName: 'New Customer',
11
- description: 'Triggers when a new Customer is created.',
12
- props: {},
13
- sampleData: {},
14
- type: TriggerStrategy.WEBHOOK,
15
- onEnable: (context) => createCoasyTrigger({
16
- triggerName,
17
- webhookUrl: context.webhookUrl,
18
- auth: context.auth,
19
- filter: context.propsValue,
20
- store: context.store
21
- }),
22
- onDisable: (context) => destroyCoasyTrigger({
23
- triggerName,
24
- auth: context.auth,
25
- store: context.store
26
- }),
27
- test: (context) => testCoasyTrigger({
28
- triggerName,
29
- auth: context.auth
30
- }),
31
- async run(context) {
32
- return [context.payload.body];
33
- }
34
- });