@coasy/piece-coasy 0.1.0 → 0.1.1-dev.1
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 +5 -1
- package/dist/packages/pieces/community/framework/packages/pieces/community/framework/README.md +11 -0
- package/dist/packages/shared/packages/shared/README.md +7 -0
- package/package.json +1 -1
- package/src/lib/actions/create-event-participant.ts +16 -25
- package/src/lib/actions/create-funnel-participant.ts +10 -17
- package/src/lib/actions/create-voucher.ts +5 -13
- package/src/lib/actions/enroll-user-course.ts +19 -29
- package/src/lib/actions/find-event.ts +13 -21
- package/src/lib/common/actions.ts +24 -0
- package/src/lib/common/triggers.ts +40 -25
- package/src/lib/triggers/cancelled-membership.ts +38 -21
- package/src/lib/triggers/cancelled-order-item.ts +48 -21
- package/src/lib/triggers/cancelled-order.ts +52 -21
- package/src/lib/triggers/cancelled-orderprocess.ts +40 -22
- package/src/lib/triggers/cancelled-subscription.ts +38 -21
- package/src/lib/triggers/get-events.ts +27 -20
- package/src/lib/triggers/new-event-participant.ts +43 -21
- package/src/lib/triggers/new-lead.ts +33 -22
- package/src/lib/triggers/new-membership.ts +38 -21
- package/src/lib/triggers/new-order-item.ts +46 -25
- package/src/lib/triggers/new-order.ts +48 -21
- package/src/lib/triggers/new-subscription.ts +38 -21
- package/src/lib/triggers/new-webinar-participant.ts +57 -30
- package/src/lib/triggers/webinar-participant-attend.ts +50 -38
- package/src/lib/triggers/webinar-participant-reminder.ts +48 -37
|
@@ -1,34 +1,52 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createTrigger,
|
|
3
|
+
Property,
|
|
4
|
+
TriggerStrategy,
|
|
5
|
+
} from '@activepieces/pieces-framework';
|
|
2
6
|
import { coasyAuth } from '../..';
|
|
3
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
createCoasyTrigger,
|
|
9
|
+
destroyCoasyTrigger,
|
|
10
|
+
testCoasyTrigger,
|
|
11
|
+
} from '../common/triggers';
|
|
4
12
|
|
|
5
|
-
const triggerName =
|
|
13
|
+
const triggerName = 'CANCELLED_ORDERPROCESS';
|
|
6
14
|
|
|
7
15
|
export const cancelledOrderprocess = createTrigger({
|
|
8
16
|
auth: coasyAuth,
|
|
9
17
|
name: 'cancelledOrderprocess',
|
|
10
18
|
displayName: 'Cancelled Order Process',
|
|
11
|
-
description:
|
|
12
|
-
|
|
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
|
+
},
|
|
13
28
|
sampleData: {},
|
|
14
29
|
type: TriggerStrategy.WEBHOOK,
|
|
15
|
-
onEnable: (context) =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
+
}),
|
|
31
49
|
async run(context) {
|
|
32
50
|
return [context.payload.body];
|
|
33
|
-
}
|
|
51
|
+
},
|
|
34
52
|
});
|
|
@@ -1,34 +1,51 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createTrigger,
|
|
3
|
+
Property,
|
|
4
|
+
TriggerStrategy,
|
|
5
|
+
} from '@activepieces/pieces-framework';
|
|
2
6
|
import { coasyAuth } from '../..';
|
|
3
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
createCoasyTrigger,
|
|
9
|
+
destroyCoasyTrigger,
|
|
10
|
+
testCoasyTrigger,
|
|
11
|
+
} from '../common/triggers';
|
|
4
12
|
|
|
5
|
-
const triggerName =
|
|
13
|
+
const triggerName = 'CANCELLED_SUBSCRIPTION';
|
|
6
14
|
|
|
7
15
|
export const cancelledSubscription = createTrigger({
|
|
8
16
|
auth: coasyAuth,
|
|
9
17
|
name: 'cancelledSubscription',
|
|
10
18
|
displayName: 'Cancelled Subscription',
|
|
11
19
|
description: 'Triggers when a customer requests a subscription cancellation.',
|
|
12
|
-
props: {
|
|
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
|
+
},
|
|
13
27
|
sampleData: {},
|
|
14
28
|
type: TriggerStrategy.WEBHOOK,
|
|
15
|
-
onEnable: (context) =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
+
}),
|
|
31
48
|
async run(context) {
|
|
32
49
|
return [context.payload.body];
|
|
33
|
-
}
|
|
50
|
+
},
|
|
34
51
|
});
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { createTrigger,
|
|
1
|
+
import { createTrigger, TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
2
|
import { coasyAuth } from '../..';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
createCoasyTrigger,
|
|
5
|
+
destroyCoasyTrigger,
|
|
6
|
+
testCoasyTrigger,
|
|
7
|
+
} from '../common/triggers';
|
|
4
8
|
|
|
5
|
-
const triggerName =
|
|
9
|
+
const triggerName = 'GET_EVENTS';
|
|
6
10
|
|
|
7
11
|
export const getEvents = createTrigger({
|
|
8
12
|
auth: coasyAuth,
|
|
@@ -12,23 +16,26 @@ export const getEvents = createTrigger({
|
|
|
12
16
|
props: {},
|
|
13
17
|
sampleData: {},
|
|
14
18
|
type: TriggerStrategy.WEBHOOK,
|
|
15
|
-
onEnable: (context) =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
+
}),
|
|
31
38
|
async run(context) {
|
|
32
39
|
return [context.payload.body];
|
|
33
|
-
}
|
|
40
|
+
},
|
|
34
41
|
});
|
|
@@ -1,34 +1,56 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createTrigger,
|
|
3
|
+
Property,
|
|
4
|
+
TriggerStrategy,
|
|
5
|
+
} from '@activepieces/pieces-framework';
|
|
2
6
|
import { coasyAuth } from '../..';
|
|
3
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
createCoasyTrigger,
|
|
9
|
+
destroyCoasyTrigger,
|
|
10
|
+
testCoasyTrigger,
|
|
11
|
+
} from '../common/triggers';
|
|
4
12
|
|
|
5
|
-
const triggerName =
|
|
13
|
+
const triggerName = 'NEW_EVENT_PARTICIPANT';
|
|
6
14
|
|
|
7
15
|
export const newEventParticipant = createTrigger({
|
|
8
16
|
auth: coasyAuth,
|
|
9
17
|
name: 'newEventParticipant',
|
|
10
18
|
displayName: 'New Event Participant',
|
|
11
19
|
description: 'Triggers when a new Event Participant is created.',
|
|
12
|
-
props: {
|
|
20
|
+
props: {
|
|
21
|
+
eventIds: Property.Array({
|
|
22
|
+
displayName: 'Event IDs',
|
|
23
|
+
description: 'IDs of events to react to',
|
|
24
|
+
required: false,
|
|
25
|
+
}),
|
|
26
|
+
eventTypeIds: Property.Array({
|
|
27
|
+
displayName: 'Event Type IDs',
|
|
28
|
+
description: 'IDs of event types to react to',
|
|
29
|
+
required: false,
|
|
30
|
+
}),
|
|
31
|
+
},
|
|
13
32
|
sampleData: {},
|
|
14
33
|
type: TriggerStrategy.WEBHOOK,
|
|
15
|
-
onEnable: (context) =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
34
|
+
onEnable: (context) =>
|
|
35
|
+
createCoasyTrigger({
|
|
36
|
+
triggerName,
|
|
37
|
+
webhookUrl: context.webhookUrl,
|
|
38
|
+
auth: context.auth,
|
|
39
|
+
filter: context.propsValue,
|
|
40
|
+
store: context.store,
|
|
41
|
+
}),
|
|
42
|
+
onDisable: (context) =>
|
|
43
|
+
destroyCoasyTrigger({
|
|
44
|
+
triggerName,
|
|
45
|
+
auth: context.auth,
|
|
46
|
+
store: context.store,
|
|
47
|
+
}),
|
|
48
|
+
test: (context) =>
|
|
49
|
+
testCoasyTrigger({
|
|
50
|
+
triggerName,
|
|
51
|
+
auth: context.auth,
|
|
52
|
+
}),
|
|
31
53
|
async run(context) {
|
|
32
54
|
return [context.payload.body];
|
|
33
|
-
}
|
|
55
|
+
},
|
|
34
56
|
});
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createTrigger,
|
|
3
|
+
Property,
|
|
4
|
+
TriggerStrategy,
|
|
5
|
+
} from '@activepieces/pieces-framework';
|
|
2
6
|
import { coasyAuth } from '../..';
|
|
3
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
createCoasyTrigger,
|
|
9
|
+
destroyCoasyTrigger,
|
|
10
|
+
testCoasyTrigger,
|
|
11
|
+
} from '../common/triggers';
|
|
4
12
|
|
|
5
|
-
const triggerName =
|
|
13
|
+
const triggerName = 'NEW_LEAD';
|
|
6
14
|
|
|
7
15
|
export const newLead = createTrigger({
|
|
8
16
|
auth: coasyAuth,
|
|
@@ -13,28 +21,31 @@ export const newLead = createTrigger({
|
|
|
13
21
|
funnelId: Property.ShortText({
|
|
14
22
|
displayName: 'Funnel ID',
|
|
15
23
|
description: 'ID of funnel to react to',
|
|
16
|
-
required: false
|
|
17
|
-
})
|
|
24
|
+
required: false,
|
|
25
|
+
}),
|
|
18
26
|
},
|
|
19
27
|
sampleData: {},
|
|
20
28
|
type: TriggerStrategy.WEBHOOK,
|
|
21
|
-
onEnable: (context) =>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
+
}),
|
|
37
48
|
async run(context) {
|
|
38
49
|
return [context.payload.body];
|
|
39
|
-
}
|
|
50
|
+
},
|
|
40
51
|
});
|
|
@@ -1,34 +1,51 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createTrigger,
|
|
3
|
+
Property,
|
|
4
|
+
TriggerStrategy,
|
|
5
|
+
} from '@activepieces/pieces-framework';
|
|
2
6
|
import { coasyAuth } from '../..';
|
|
3
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
createCoasyTrigger,
|
|
9
|
+
destroyCoasyTrigger,
|
|
10
|
+
testCoasyTrigger,
|
|
11
|
+
} from '../common/triggers';
|
|
4
12
|
|
|
5
|
-
const triggerName =
|
|
13
|
+
const triggerName = 'NEW_MEMBERSHIP';
|
|
6
14
|
|
|
7
15
|
export const newMembership = createTrigger({
|
|
8
16
|
auth: coasyAuth,
|
|
9
17
|
name: 'newMembership',
|
|
10
18
|
displayName: 'New Membership',
|
|
11
19
|
description: 'Triggers when a new membership is created.',
|
|
12
|
-
props: {
|
|
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
|
+
},
|
|
13
27
|
sampleData: {},
|
|
14
28
|
type: TriggerStrategy.WEBHOOK,
|
|
15
|
-
onEnable: (context) =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
+
}),
|
|
31
48
|
async run(context) {
|
|
32
49
|
return [context.payload.body];
|
|
33
|
-
}
|
|
50
|
+
},
|
|
34
51
|
});
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createTrigger,
|
|
3
|
+
Property,
|
|
4
|
+
TriggerStrategy,
|
|
5
|
+
} from '@activepieces/pieces-framework';
|
|
2
6
|
import { coasyAuth } from '../..';
|
|
3
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
createCoasyTrigger,
|
|
9
|
+
destroyCoasyTrigger,
|
|
10
|
+
testCoasyTrigger,
|
|
11
|
+
} from '../common/triggers';
|
|
4
12
|
|
|
5
|
-
const triggerName =
|
|
13
|
+
const triggerName = 'NEW_ORDER_ITEM';
|
|
6
14
|
|
|
7
15
|
export const newOrderItem = createTrigger({
|
|
8
16
|
auth: coasyAuth,
|
|
@@ -10,32 +18,45 @@ export const newOrderItem = createTrigger({
|
|
|
10
18
|
displayName: 'New Order Item',
|
|
11
19
|
description: 'Triggers for each item in a new Order.',
|
|
12
20
|
props: {
|
|
13
|
-
|
|
14
|
-
displayName: 'Offer IDs',
|
|
15
|
-
description: 'IDs of
|
|
16
|
-
required: false
|
|
17
|
-
})
|
|
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
|
+
}),
|
|
18
36
|
},
|
|
19
37
|
|
|
20
38
|
sampleData: {},
|
|
21
39
|
type: TriggerStrategy.WEBHOOK,
|
|
22
|
-
onEnable: (context) =>
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
onEnable: (context) =>
|
|
41
|
+
createCoasyTrigger({
|
|
42
|
+
triggerName,
|
|
43
|
+
webhookUrl: context.webhookUrl,
|
|
44
|
+
auth: context.auth,
|
|
45
|
+
filter: context.propsValue,
|
|
46
|
+
store: context.store,
|
|
47
|
+
}),
|
|
48
|
+
onDisable: (context) =>
|
|
49
|
+
destroyCoasyTrigger({
|
|
50
|
+
triggerName,
|
|
51
|
+
auth: context.auth,
|
|
52
|
+
store: context.store,
|
|
53
|
+
}),
|
|
54
|
+
test: (context) =>
|
|
55
|
+
testCoasyTrigger({
|
|
56
|
+
triggerName,
|
|
57
|
+
auth: context.auth,
|
|
58
|
+
}),
|
|
38
59
|
async run(context) {
|
|
39
60
|
return [context.payload.body];
|
|
40
|
-
}
|
|
61
|
+
},
|
|
41
62
|
});
|
|
@@ -1,34 +1,61 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createTrigger,
|
|
3
|
+
Property,
|
|
4
|
+
TriggerStrategy,
|
|
5
|
+
} from '@activepieces/pieces-framework';
|
|
2
6
|
import { coasyAuth } from '../..';
|
|
3
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
createCoasyTrigger,
|
|
9
|
+
destroyCoasyTrigger,
|
|
10
|
+
testCoasyTrigger,
|
|
11
|
+
} from '../common/triggers';
|
|
4
12
|
|
|
5
|
-
const triggerName =
|
|
13
|
+
const triggerName = 'NEW_ORDER';
|
|
6
14
|
|
|
7
15
|
export const newOrder = createTrigger({
|
|
8
16
|
auth: coasyAuth,
|
|
9
17
|
name: 'newOrder',
|
|
10
18
|
displayName: 'New Order',
|
|
11
19
|
description: 'Triggers when a new order is created.',
|
|
12
|
-
props: {
|
|
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
|
+
},
|
|
13
37
|
sampleData: {},
|
|
14
38
|
type: TriggerStrategy.WEBHOOK,
|
|
15
|
-
onEnable: (context) =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
+
}),
|
|
31
58
|
async run(context) {
|
|
32
59
|
return [context.payload.body];
|
|
33
|
-
}
|
|
60
|
+
},
|
|
34
61
|
});
|
|
@@ -1,34 +1,51 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createTrigger,
|
|
3
|
+
Property,
|
|
4
|
+
TriggerStrategy,
|
|
5
|
+
} from '@activepieces/pieces-framework';
|
|
2
6
|
import { coasyAuth } from '../..';
|
|
3
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
createCoasyTrigger,
|
|
9
|
+
destroyCoasyTrigger,
|
|
10
|
+
testCoasyTrigger,
|
|
11
|
+
} from '../common/triggers';
|
|
4
12
|
|
|
5
|
-
const triggerName =
|
|
13
|
+
const triggerName = 'NEW_SUBSCRIPTION';
|
|
6
14
|
|
|
7
15
|
export const newSubscription = createTrigger({
|
|
8
16
|
auth: coasyAuth,
|
|
9
17
|
name: 'newSubscription',
|
|
10
18
|
displayName: 'New Subscription',
|
|
11
19
|
description: 'Triggers when a new subscription is created.',
|
|
12
|
-
props: {
|
|
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
|
+
},
|
|
13
27
|
sampleData: {},
|
|
14
28
|
type: TriggerStrategy.WEBHOOK,
|
|
15
|
-
onEnable: (context) =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
+
}),
|
|
31
48
|
async run(context) {
|
|
32
49
|
return [context.payload.body];
|
|
33
|
-
}
|
|
50
|
+
},
|
|
34
51
|
});
|