@coasy/piece-coasy 0.1.5 → 0.1.6

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 (30) hide show
  1. package/.eslintrc.json +5 -1
  2. package/package.json +1 -1
  3. package/src/index.ts +57 -8
  4. package/src/lib/actions/create-event-participant.ts +25 -0
  5. package/src/lib/actions/create-funnel-participant.ts +10 -17
  6. package/src/lib/actions/create-voucher.ts +46 -0
  7. package/src/lib/actions/enroll-user-course.ts +30 -0
  8. package/src/lib/actions/find-event.ts +20 -0
  9. package/src/lib/common/actions.ts +24 -0
  10. package/src/lib/common/coasyClient.ts +11 -9
  11. package/src/lib/common/triggers.ts +40 -25
  12. package/src/lib/triggers/cancelled-membership.ts +51 -0
  13. package/src/lib/triggers/cancelled-order-item.ts +61 -0
  14. package/src/lib/triggers/cancelled-order.ts +61 -0
  15. package/src/lib/triggers/cancelled-orderprocess.ts +52 -0
  16. package/src/lib/triggers/cancelled-subscription.ts +51 -0
  17. package/src/lib/triggers/get-events.ts +41 -0
  18. package/src/lib/triggers/new-app-user-sign-up.ts +34 -0
  19. package/src/lib/triggers/new-auth-event.ts +49 -37
  20. package/src/lib/triggers/new-customer.ts +46 -0
  21. package/src/lib/triggers/new-event-participant.ts +56 -0
  22. package/src/lib/triggers/new-funnel-participant.ts +33 -22
  23. package/src/lib/triggers/new-lead.ts +51 -0
  24. package/src/lib/triggers/new-membership.ts +51 -0
  25. package/src/lib/triggers/new-order-item.ts +62 -0
  26. package/src/lib/triggers/new-order.ts +61 -0
  27. package/src/lib/triggers/new-subscription.ts +51 -0
  28. package/src/lib/triggers/new-webinar-participant.ts +48 -30
  29. package/src/lib/triggers/webinar-participant-attend.ts +73 -0
  30. package/src/lib/triggers/webinar-participant-reminder.ts +72 -0
package/.eslintrc.json CHANGED
@@ -13,7 +13,11 @@
13
13
  "*.js",
14
14
  "*.jsx"
15
15
  ],
16
- "rules": {}
16
+ "rules": {},
17
+ "extends": [
18
+ "plugin:prettier/recommended"
19
+ ],
20
+ "plugins": ["prettier"]
17
21
  },
18
22
  {
19
23
  "files": [
package/package.json CHANGED
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@coasy/piece-coasy",
3
- "version": "0.1.5"
3
+ "version": "0.1.6"
4
4
  }
package/src/index.ts CHANGED
@@ -1,8 +1,32 @@
1
- import { createPiece, PieceAuth, Property } from '@activepieces/pieces-framework';
1
+ import {
2
+ createPiece,
3
+ PieceAuth,
4
+ Property,
5
+ } from '@activepieces/pieces-framework';
6
+ import { createEventParticipant } from './lib/actions/create-event-participant';
2
7
  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';
3
21
  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';
4
27
  import { newWebinarParticipant } from './lib/triggers/new-webinar-participant';
5
- import { newAuthEvent } from './lib/triggers/new-auth-event';
28
+ import { webinarParticipantAttend } from './lib/triggers/webinar-participant-attend';
29
+ import { webinarParticipantReminder } from './lib/triggers/webinar-participant-reminder';
6
30
 
7
31
  export const coasyAuth = PieceAuth.CustomAuth({
8
32
  required: true,
@@ -17,8 +41,8 @@ export const coasyAuth = PieceAuth.CustomAuth({
17
41
  apiKey: PieceAuth.SecretText({
18
42
  displayName: 'API Key',
19
43
  description: 'Enter the api key',
20
- required: true
21
- })
44
+ required: true,
45
+ }),
22
46
  },
23
47
  });
24
48
 
@@ -28,8 +52,33 @@ export const coasy = createPiece({
28
52
  description: 'Communicate with Coasy',
29
53
  minimumSupportedRelease: '0.20.0',
30
54
  logoUrl: 'https://console.coasy.io/favicon/apple-icon.png',
31
- authors: ["christian-schab"],
32
- actions: [createFunnelParticipant],
33
- triggers: [newFunnelParticipant, newWebinarParticipant, newAuthEvent]
55
+ authors: ['christian-schab'],
56
+ actions: [
57
+ createEventParticipant,
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
+ ],
34
84
  });
35
-
@@ -0,0 +1,25 @@
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,42 +1,35 @@
1
1
  import { createAction, Property } from '@activepieces/pieces-framework';
2
2
  import { coasyAuth } from '../../index';
3
- import { CoasyClient } from '../common/coasyClient';
3
+ import { runCoasyAction } from '../common/actions';
4
+
5
+ const name = 'createFunnelParticipant';
4
6
 
5
7
  export const createFunnelParticipant = createAction({
6
8
  auth: coasyAuth,
7
- name: 'createFunnelParticipant',
9
+ name,
8
10
  displayName: 'Create Funnel Participant',
9
11
  description: 'Create a new funnel participant',
10
12
  props: {
11
13
  funnelId: Property.ShortText({
12
14
  displayName: 'Funnel ID',
13
15
  description: 'ID of funnel',
14
- required: true
16
+ required: true,
15
17
  }),
16
18
  firstName: Property.ShortText({
17
19
  displayName: 'First name',
18
20
  description: 'first name of participant',
19
- required: true
21
+ required: true,
20
22
  }),
21
23
  lastName: Property.ShortText({
22
24
  displayName: 'Last name',
23
25
  description: 'last name of participant',
24
- required: false
26
+ required: false,
25
27
  }),
26
28
  email: Property.ShortText({
27
29
  displayName: 'Email',
28
30
  description: 'email address of partipant',
29
- required: true
30
- })
31
+ required: true,
32
+ }),
31
33
  },
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
- }
34
+ run: (configValue) => runCoasyAction(configValue, name),
42
35
  });
@@ -0,0 +1,46 @@
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
+ });
@@ -0,0 +1,30 @@
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
+ });
@@ -0,0 +1,20 @@
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
+ });
@@ -0,0 +1,24 @@
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,4 +1,9 @@
1
- import { AuthenticationType, httpClient, HttpMethod, HttpRequest } from '@activepieces/pieces-common';
1
+ import {
2
+ AuthenticationType,
3
+ httpClient,
4
+ HttpMethod,
5
+ HttpRequest,
6
+ } from '@activepieces/pieces-common';
2
7
 
3
8
  export class CoasyClient {
4
9
  private baseUrl: string;
@@ -9,7 +14,6 @@ export class CoasyClient {
9
14
  this.apiKey = apiKey;
10
15
  }
11
16
 
12
-
13
17
  async action(actionName: string, request: any) {
14
18
  return this.request(`/apps/actions/${actionName}`, request);
15
19
  }
@@ -18,21 +22,20 @@ export class CoasyClient {
18
22
  return this.request(`/apps/triggers/create`, {
19
23
  hookUrl,
20
24
  trigger,
21
- filter
25
+ filter,
22
26
  });
23
27
  }
24
28
 
25
29
  async destroyTrigger(webhookId: string) {
26
- return this.request(`/apps/triggers/destroy`, { webhookId})
30
+ return this.request(`/apps/triggers/destroy`, { webhookId });
27
31
  }
28
32
 
29
33
  async listTriggerEvents(trigger: string) {
30
34
  return this.request(`/apps/list`, {
31
- trigger
32
- })
35
+ trigger,
36
+ });
33
37
  }
34
38
 
35
-
36
39
  async request(path: string, requestBody: any) {
37
40
  const request: HttpRequest<string> = {
38
41
  method: HttpMethod.POST,
@@ -40,7 +43,7 @@ export class CoasyClient {
40
43
  body: JSON.stringify(requestBody),
41
44
  authentication: {
42
45
  type: AuthenticationType.BEARER_TOKEN,
43
- token: this.apiKey
46
+ token: this.apiKey,
44
47
  },
45
48
  };
46
49
 
@@ -52,5 +55,4 @@ export class CoasyClient {
52
55
  return response.body;
53
56
  }
54
57
  }
55
-
56
58
  }
@@ -1,58 +1,73 @@
1
-
2
1
  import { CoasyClient } from './coasyClient';
3
2
 
4
- import { SecretTextProperty, ShortTextProperty, StaticPropsValue, Store } from '@activepieces/pieces-framework';
3
+ import {
4
+ SecretTextProperty,
5
+ ShortTextProperty,
6
+ StaticPropsValue,
7
+ Store,
8
+ } from '@activepieces/pieces-framework';
5
9
 
6
10
  export interface CreateTriggerRequest {
7
11
  triggerName: string;
8
12
  webhookUrl: string;
9
- auth: StaticPropsValue<{
10
- baseUrl: ShortTextProperty<false>,
11
- apiKey: SecretTextProperty<true>
12
- }>
13
+ auth: StaticPropsValue<{
14
+ baseUrl: ShortTextProperty<false>;
15
+ apiKey: SecretTextProperty<true>;
16
+ }>;
13
17
  filter: any;
14
18
  store: Store;
15
19
  }
16
20
 
17
21
  export interface DestroyTriggerRequest {
18
22
  triggerName: string;
19
- auth: StaticPropsValue<{
20
- baseUrl: ShortTextProperty<false>,
21
- apiKey: SecretTextProperty<true>
22
- }>
23
+ auth: StaticPropsValue<{
24
+ baseUrl: ShortTextProperty<false>;
25
+ apiKey: SecretTextProperty<true>;
26
+ }>;
23
27
  store: Store;
24
28
  }
25
29
 
26
30
  export interface TestTriggerRequest {
27
31
  triggerName: string;
28
- auth: StaticPropsValue<{
29
- baseUrl: ShortTextProperty<false>,
30
- apiKey: SecretTextProperty<true>
31
- }>
32
+ auth: StaticPropsValue<{
33
+ baseUrl: ShortTextProperty<false>;
34
+ apiKey: SecretTextProperty<true>;
35
+ }>;
32
36
  }
33
37
 
34
38
  export const createCoasyTrigger = async (request: CreateTriggerRequest) => {
35
- const { triggerName, webhookUrl, filter, auth, store} = request;
36
- const client = new CoasyClient(auth.baseUrl ?? 'https://backend.api.prod.coasy.io', auth.apiKey);
39
+ const { triggerName, webhookUrl, filter, auth, store } = request;
40
+ const client = new CoasyClient(
41
+ auth.baseUrl ?? 'https://backend.api.prod.coasy.io',
42
+ auth.apiKey
43
+ );
37
44
  const response = await client.createTrigger(triggerName, webhookUrl, filter);
38
45
  if (!response.id) throw new Error(`Failed to create Trigger!`);
39
46
  await store.put<string>(`${triggerName}__WEBHOOK_ID`, response.id);
40
47
  };
41
48
 
42
- export const destroyCoasyTrigger = async (request: DestroyTriggerRequest) => {
43
- const { triggerName, auth, store} = request;
49
+ export const destroyCoasyTrigger = async (request: DestroyTriggerRequest) => {
50
+ const { triggerName, auth, store } = request;
44
51
  const webhookId = await store.get<string>(`${triggerName}__WEBHOOK_ID`);
45
52
  if (!webhookId) throw new Error(`Webhook Id not found!`);
46
53
 
47
- const client = new CoasyClient(auth.baseUrl ?? 'https://backend.api.prod.coasy.io', auth.apiKey);
54
+ const client = new CoasyClient(
55
+ auth.baseUrl ?? 'https://backend.api.prod.coasy.io',
56
+ auth.apiKey
57
+ );
48
58
  await client.destroyTrigger(webhookId);
49
- }
59
+ };
50
60
 
51
- export const testCoasyTrigger = async (request: TestTriggerRequest): Promise<any[]> => {
52
- const { triggerName, auth} = request;
61
+ export const testCoasyTrigger = async (
62
+ request: TestTriggerRequest
63
+ ): Promise<any[]> => {
64
+ const { triggerName, auth } = request;
53
65
 
54
- const client = new CoasyClient(auth.baseUrl ?? 'https://backend.api.prod.coasy.io', auth.apiKey);
66
+ const client = new CoasyClient(
67
+ auth.baseUrl ?? 'https://backend.api.prod.coasy.io',
68
+ auth.apiKey
69
+ );
55
70
  const response = await client.listTriggerEvents(triggerName);
56
71
 
57
- return [{ test: true}];
58
- }
72
+ return [{ test: true, response }];
73
+ };
@@ -0,0 +1,51 @@
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
+ });
@@ -0,0 +1,61 @@
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
+ });
@@ -0,0 +1,61 @@
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
+ });