@coasy/piece-coasy 0.1.6 → 0.1.8

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 (120) hide show
  1. package/package.json +36 -2
  2. package/src/index.d.ts +8 -0
  3. package/src/index.js +82 -0
  4. package/src/index.js.map +1 -0
  5. package/src/lib/actions/create-event-participant.d.ts +7 -0
  6. package/src/lib/actions/create-event-participant.js +27 -0
  7. package/src/lib/actions/create-event-participant.js.map +1 -0
  8. package/src/lib/actions/create-funnel-participant.d.ts +9 -0
  9. package/src/lib/actions/create-funnel-participant.js +37 -0
  10. package/src/lib/actions/create-funnel-participant.js.map +1 -0
  11. package/src/lib/actions/create-voucher.d.ts +8 -0
  12. package/src/lib/actions/create-voucher.js +48 -0
  13. package/src/lib/actions/create-voucher.js.map +1 -0
  14. package/src/lib/actions/enroll-user-course.d.ts +8 -0
  15. package/src/lib/actions/enroll-user-course.js +32 -0
  16. package/src/lib/actions/enroll-user-course.js.map +1 -0
  17. package/src/lib/actions/find-event.d.ts +6 -0
  18. package/src/lib/actions/find-event.js +22 -0
  19. package/src/lib/actions/find-event.js.map +1 -0
  20. package/src/lib/common/actions.d.ts +3 -0
  21. package/src/lib/common/actions.js +16 -0
  22. package/src/lib/common/actions.js.map +1 -0
  23. package/src/lib/common/coasyClient.d.ts +10 -0
  24. package/src/lib/common/coasyClient.js +59 -0
  25. package/src/lib/common/coasyClient.js.map +1 -0
  26. package/src/lib/common/triggers.d.ts +29 -0
  27. package/src/lib/common/triggers.js +34 -0
  28. package/src/lib/common/triggers.js.map +1 -0
  29. package/src/lib/triggers/cancelled-membership.d.ts +17 -0
  30. package/src/lib/triggers/cancelled-membership.js +45 -0
  31. package/src/lib/triggers/cancelled-membership.js.map +1 -0
  32. package/src/lib/triggers/cancelled-order-item.d.ts +23 -0
  33. package/src/lib/triggers/cancelled-order-item.js +55 -0
  34. package/src/lib/triggers/cancelled-order-item.js.map +1 -0
  35. package/src/lib/triggers/cancelled-order.d.ts +23 -0
  36. package/src/lib/triggers/cancelled-order.js +55 -0
  37. package/src/lib/triggers/cancelled-order.js.map +1 -0
  38. package/src/lib/triggers/cancelled-orderprocess.d.ts +17 -0
  39. package/src/lib/triggers/cancelled-orderprocess.js +45 -0
  40. package/src/lib/triggers/cancelled-orderprocess.js.map +1 -0
  41. package/src/lib/triggers/cancelled-subscription.d.ts +17 -0
  42. package/src/lib/triggers/cancelled-subscription.js +45 -0
  43. package/src/lib/triggers/cancelled-subscription.js.map +1 -0
  44. package/src/lib/triggers/get-events.d.ts +11 -0
  45. package/src/lib/triggers/get-events.js +39 -0
  46. package/src/lib/triggers/get-events.js.map +1 -0
  47. package/src/lib/triggers/new-app-user-sign-up.d.ts +11 -0
  48. package/src/lib/triggers/new-app-user-sign-up.js +39 -0
  49. package/src/lib/triggers/new-app-user-sign-up.js.map +1 -0
  50. package/src/lib/triggers/new-auth-event.d.ts +20 -0
  51. package/src/lib/triggers/new-auth-event.js +98 -0
  52. package/src/lib/triggers/new-auth-event.js.map +1 -0
  53. package/src/lib/triggers/new-customer.d.ts +11 -0
  54. package/src/lib/triggers/new-customer.js +39 -0
  55. package/src/lib/triggers/new-customer.js.map +1 -0
  56. package/src/lib/triggers/new-event-participant.d.ts +20 -0
  57. package/src/lib/triggers/new-event-participant.js +50 -0
  58. package/src/lib/triggers/new-event-participant.js.map +1 -0
  59. package/src/lib/triggers/new-funnel-participant.d.ts +17 -0
  60. package/src/lib/triggers/new-funnel-participant.js +46 -0
  61. package/src/lib/triggers/new-funnel-participant.js.map +1 -0
  62. package/src/lib/triggers/new-lead.d.ts +17 -0
  63. package/src/lib/triggers/new-lead.js +45 -0
  64. package/src/lib/triggers/new-lead.js.map +1 -0
  65. package/src/lib/triggers/new-membership.d.ts +17 -0
  66. package/src/lib/triggers/new-membership.js +45 -0
  67. package/src/lib/triggers/new-membership.js.map +1 -0
  68. package/src/lib/triggers/new-order-item.d.ts +23 -0
  69. package/src/lib/triggers/new-order-item.js +55 -0
  70. package/src/lib/triggers/new-order-item.js.map +1 -0
  71. package/src/lib/triggers/new-order.d.ts +23 -0
  72. package/src/lib/triggers/new-order.js +55 -0
  73. package/src/lib/triggers/new-order.js.map +1 -0
  74. package/src/lib/triggers/new-subscription.d.ts +17 -0
  75. package/src/lib/triggers/new-subscription.js +45 -0
  76. package/src/lib/triggers/new-subscription.js.map +1 -0
  77. package/src/lib/triggers/new-webinar-participant.d.ts +20 -0
  78. package/src/lib/triggers/new-webinar-participant.js +66 -0
  79. package/src/lib/triggers/new-webinar-participant.js.map +1 -0
  80. package/src/lib/triggers/webinar-participant-attend.d.ts +20 -0
  81. package/src/lib/triggers/webinar-participant-attend.js +66 -0
  82. package/src/lib/triggers/webinar-participant-attend.js.map +1 -0
  83. package/src/lib/triggers/webinar-participant-reminder.d.ts +20 -0
  84. package/src/lib/triggers/webinar-participant-reminder.js +66 -0
  85. package/src/lib/triggers/webinar-participant-reminder.js.map +1 -0
  86. package/.eslintrc.json +0 -37
  87. package/dist/packages/pieces/community/coasy/packages/pieces/community/coasy/README.md +0 -146
  88. package/dist/packages/pieces/community/framework/packages/pieces/community/framework/README.md +0 -11
  89. package/dist/packages/shared/packages/shared/README.md +0 -7
  90. package/project.json +0 -38
  91. package/src/index.ts +0 -84
  92. package/src/lib/actions/create-event-participant.ts +0 -25
  93. package/src/lib/actions/create-funnel-participant.ts +0 -35
  94. package/src/lib/actions/create-voucher.ts +0 -46
  95. package/src/lib/actions/enroll-user-course.ts +0 -30
  96. package/src/lib/actions/find-event.ts +0 -20
  97. package/src/lib/common/actions.ts +0 -24
  98. package/src/lib/common/coasyClient.ts +0 -58
  99. package/src/lib/common/triggers.ts +0 -73
  100. package/src/lib/triggers/cancelled-membership.ts +0 -51
  101. package/src/lib/triggers/cancelled-order-item.ts +0 -61
  102. package/src/lib/triggers/cancelled-order.ts +0 -61
  103. package/src/lib/triggers/cancelled-orderprocess.ts +0 -52
  104. package/src/lib/triggers/cancelled-subscription.ts +0 -51
  105. package/src/lib/triggers/get-events.ts +0 -41
  106. package/src/lib/triggers/new-app-user-sign-up.ts +0 -34
  107. package/src/lib/triggers/new-auth-event.ts +0 -93
  108. package/src/lib/triggers/new-customer.ts +0 -46
  109. package/src/lib/triggers/new-event-participant.ts +0 -56
  110. package/src/lib/triggers/new-funnel-participant.ts +0 -51
  111. package/src/lib/triggers/new-lead.ts +0 -51
  112. package/src/lib/triggers/new-membership.ts +0 -51
  113. package/src/lib/triggers/new-order-item.ts +0 -62
  114. package/src/lib/triggers/new-order.ts +0 -61
  115. package/src/lib/triggers/new-subscription.ts +0 -51
  116. package/src/lib/triggers/new-webinar-participant.ts +0 -72
  117. package/src/lib/triggers/webinar-participant-attend.ts +0 -73
  118. package/src/lib/triggers/webinar-participant-reminder.ts +0 -72
  119. package/tsconfig.json +0 -19
  120. package/tsconfig.lib.json +0 -11
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.webinarParticipantAttend = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const __1 = require("../..");
7
+ const triggers_1 = require("../common/triggers");
8
+ const triggerName = 'WEBINAR_PARTICIPANT_ATTEND';
9
+ exports.webinarParticipantAttend = (0, pieces_framework_1.createTrigger)({
10
+ auth: __1.coasyAuth,
11
+ name: 'webinarParticipantAttend',
12
+ displayName: 'Webinar Participant Attend',
13
+ description: 'Triggers when a webinar participant has attended or not attended',
14
+ props: {
15
+ selectedStartType: pieces_framework_1.Property.StaticDropdown({
16
+ displayName: 'Selected start type',
17
+ description: 'filter only those participants',
18
+ required: false,
19
+ options: {
20
+ options: [
21
+ {
22
+ label: 'Upcoming',
23
+ value: 'UPCOMING',
24
+ },
25
+ {
26
+ label: 'Attended',
27
+ value: 'ATTENDED',
28
+ },
29
+ {
30
+ label: 'Not Attended',
31
+ value: 'NOT_ATTENDED',
32
+ },
33
+ ],
34
+ },
35
+ }),
36
+ webinarIds: pieces_framework_1.Property.Array({
37
+ displayName: 'Webinar IDs',
38
+ description: 'IDs of webinar to react to',
39
+ required: false,
40
+ }),
41
+ },
42
+ sampleData: {},
43
+ type: pieces_framework_1.TriggerStrategy.WEBHOOK,
44
+ onEnable: (context) => (0, triggers_1.createCoasyTrigger)({
45
+ triggerName,
46
+ webhookUrl: context.webhookUrl,
47
+ auth: context.auth,
48
+ filter: context.propsValue,
49
+ store: context.store,
50
+ }),
51
+ onDisable: (context) => (0, triggers_1.destroyCoasyTrigger)({
52
+ triggerName,
53
+ auth: context.auth,
54
+ store: context.store,
55
+ }),
56
+ test: (context) => (0, triggers_1.testCoasyTrigger)({
57
+ triggerName,
58
+ auth: context.auth,
59
+ }),
60
+ run(context) {
61
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
62
+ return [context.payload.body];
63
+ });
64
+ },
65
+ });
66
+ //# sourceMappingURL=webinar-participant-attend.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webinar-participant-attend.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/coasy/src/lib/triggers/webinar-participant-attend.ts"],"names":[],"mappings":";;;;AAAA,qEAIwC;AACxC,6BAAkC;AAClC,iDAI4B;AAE5B,MAAM,WAAW,GAAG,4BAA4B,CAAC;AAEpC,QAAA,wBAAwB,GAAG,IAAA,gCAAa,EAAC;IACpD,IAAI,EAAE,aAAS;IACf,IAAI,EAAE,0BAA0B;IAChC,WAAW,EAAE,4BAA4B;IACzC,WAAW,EACT,kEAAkE;IACpE,KAAK,EAAE;QACL,iBAAiB,EAAE,2BAAQ,CAAC,cAAc,CAAC;YACzC,WAAW,EAAE,qBAAqB;YAClC,WAAW,EAAE,gCAAgC;YAC7C,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP;wBACE,KAAK,EAAE,UAAU;wBACjB,KAAK,EAAE,UAAU;qBAClB;oBACD;wBACE,KAAK,EAAE,UAAU;wBACjB,KAAK,EAAE,UAAU;qBAClB;oBACD;wBACE,KAAK,EAAE,cAAc;wBACrB,KAAK,EAAE,cAAc;qBACtB;iBACF;aACF;SACF,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,KAAK,CAAC;YACzB,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,4BAA4B;YACzC,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACD,UAAU,EAAE,EAAE;IACd,IAAI,EAAE,kCAAe,CAAC,OAAO;IAC7B,QAAQ,EAAE,CAAC,OAAO,EAAE,EAAE,CACpB,IAAA,6BAAkB,EAAC;QACjB,WAAW;QACX,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,MAAM,EAAE,OAAO,CAAC,UAAU;QAC1B,KAAK,EAAE,OAAO,CAAC,KAAK;KACrB,CAAC;IACJ,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,CACrB,IAAA,8BAAmB,EAAC;QAClB,WAAW;QACX,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,KAAK,EAAE,OAAO,CAAC,KAAK;KACrB,CAAC;IACJ,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE,CAChB,IAAA,2BAAgB,EAAC;QACf,WAAW;QACX,IAAI,EAAE,OAAO,CAAC,IAAI;KACnB,CAAC;IACE,GAAG,CAAC,OAAO;;YACf,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { TriggerStrategy } from '@activepieces/pieces-framework';
2
+ export declare const webinarParticipantReminder: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
3
+ baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<false>;
4
+ apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
5
+ }>, {
6
+ selectedStartType: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
7
+ webinarIds: import("@activepieces/pieces-framework").ArrayProperty<false>;
8
+ }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").CustomAuthProperty<{
9
+ baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<false>;
10
+ apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
11
+ }>, {
12
+ selectedStartType: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
13
+ webinarIds: import("@activepieces/pieces-framework").ArrayProperty<false>;
14
+ }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
15
+ baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<false>;
16
+ apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
17
+ }>, {
18
+ selectedStartType: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
19
+ webinarIds: import("@activepieces/pieces-framework").ArrayProperty<false>;
20
+ }>;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.webinarParticipantReminder = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const __1 = require("../..");
7
+ const triggers_1 = require("../common/triggers");
8
+ const triggerName = 'WEBINAR_PARTICIPANT_REMINDER';
9
+ exports.webinarParticipantReminder = (0, pieces_framework_1.createTrigger)({
10
+ auth: __1.coasyAuth,
11
+ name: 'webinarParticipantReminder',
12
+ displayName: 'Webinar Participant Reminder',
13
+ description: 'Triggers when a webinar participant is reminded',
14
+ props: {
15
+ selectedStartType: pieces_framework_1.Property.StaticDropdown({
16
+ displayName: 'Selected start type',
17
+ description: 'filter only those participants',
18
+ required: false,
19
+ options: {
20
+ options: [
21
+ {
22
+ label: 'Upcoming',
23
+ value: 'UPCOMING',
24
+ },
25
+ {
26
+ label: 'Attended',
27
+ value: 'ATTENDED',
28
+ },
29
+ {
30
+ label: 'Not Attended',
31
+ value: 'NOT_ATTENDED',
32
+ },
33
+ ],
34
+ },
35
+ }),
36
+ webinarIds: pieces_framework_1.Property.Array({
37
+ displayName: 'Webinar IDs',
38
+ description: 'IDs of webinar to react to',
39
+ required: false,
40
+ }),
41
+ },
42
+ sampleData: {},
43
+ type: pieces_framework_1.TriggerStrategy.WEBHOOK,
44
+ onEnable: (context) => (0, triggers_1.createCoasyTrigger)({
45
+ triggerName,
46
+ webhookUrl: context.webhookUrl,
47
+ auth: context.auth,
48
+ filter: context.propsValue,
49
+ store: context.store,
50
+ }),
51
+ onDisable: (context) => (0, triggers_1.destroyCoasyTrigger)({
52
+ triggerName,
53
+ auth: context.auth,
54
+ store: context.store,
55
+ }),
56
+ test: (context) => (0, triggers_1.testCoasyTrigger)({
57
+ triggerName,
58
+ auth: context.auth,
59
+ }),
60
+ run(context) {
61
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
62
+ return [context.payload.body];
63
+ });
64
+ },
65
+ });
66
+ //# sourceMappingURL=webinar-participant-reminder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webinar-participant-reminder.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/coasy/src/lib/triggers/webinar-participant-reminder.ts"],"names":[],"mappings":";;;;AAAA,qEAIwC;AACxC,6BAAkC;AAClC,iDAI4B;AAE5B,MAAM,WAAW,GAAG,8BAA8B,CAAC;AAEtC,QAAA,0BAA0B,GAAG,IAAA,gCAAa,EAAC;IACtD,IAAI,EAAE,aAAS;IACf,IAAI,EAAE,4BAA4B;IAClC,WAAW,EAAE,8BAA8B;IAC3C,WAAW,EAAE,iDAAiD;IAC9D,KAAK,EAAE;QACL,iBAAiB,EAAE,2BAAQ,CAAC,cAAc,CAAC;YACzC,WAAW,EAAE,qBAAqB;YAClC,WAAW,EAAE,gCAAgC;YAC7C,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP;wBACE,KAAK,EAAE,UAAU;wBACjB,KAAK,EAAE,UAAU;qBAClB;oBACD;wBACE,KAAK,EAAE,UAAU;wBACjB,KAAK,EAAE,UAAU;qBAClB;oBACD;wBACE,KAAK,EAAE,cAAc;wBACrB,KAAK,EAAE,cAAc;qBACtB;iBACF;aACF;SACF,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,KAAK,CAAC;YACzB,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,4BAA4B;YACzC,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACD,UAAU,EAAE,EAAE;IACd,IAAI,EAAE,kCAAe,CAAC,OAAO;IAC7B,QAAQ,EAAE,CAAC,OAAO,EAAE,EAAE,CACpB,IAAA,6BAAkB,EAAC;QACjB,WAAW;QACX,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,MAAM,EAAE,OAAO,CAAC,UAAU;QAC1B,KAAK,EAAE,OAAO,CAAC,KAAK;KACrB,CAAC;IACJ,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,CACrB,IAAA,8BAAmB,EAAC;QAClB,WAAW;QACX,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,KAAK,EAAE,OAAO,CAAC,KAAK;KACrB,CAAC;IACJ,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE,CAChB,IAAA,2BAAgB,EAAC;QACf,WAAW;QACX,IAAI,EAAE,OAAO,CAAC,IAAI;KACnB,CAAC;IACE,GAAG,CAAC,OAAO;;YACf,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;KAAA;CACF,CAAC,CAAC"}
package/.eslintrc.json DELETED
@@ -1,37 +0,0 @@
1
- {
2
- "extends": [
3
- "../../../../.eslintrc.base.json"
4
- ],
5
- "ignorePatterns": [
6
- "!**/*"
7
- ],
8
- "overrides": [
9
- {
10
- "files": [
11
- "*.ts",
12
- "*.tsx",
13
- "*.js",
14
- "*.jsx"
15
- ],
16
- "rules": {},
17
- "extends": [
18
- "plugin:prettier/recommended"
19
- ],
20
- "plugins": ["prettier"]
21
- },
22
- {
23
- "files": [
24
- "*.ts",
25
- "*.tsx"
26
- ],
27
- "rules": {}
28
- },
29
- {
30
- "files": [
31
- "*.js",
32
- "*.jsx"
33
- ],
34
- "rules": {}
35
- }
36
- ]
37
- }
@@ -1,146 +0,0 @@
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)
@@ -1,11 +0,0 @@
1
- # pieces-framework
2
-
3
- This library was generated with [Nx](https://nx.dev).
4
-
5
- ## Building
6
-
7
- Run `nx build pieces-framework` to build the library.
8
-
9
- ## Running unit tests
10
-
11
- Run `nx test pieces-framework` to execute the unit tests via [Jest](https://jestjs.io).
@@ -1,7 +0,0 @@
1
- # shared
2
-
3
- This library was generated with [Nx](https://nx.dev).
4
-
5
- ## Building
6
-
7
- Run `nx build shared` to build the library.
package/project.json DELETED
@@ -1,38 +0,0 @@
1
- {
2
- "name": "pieces-coasy",
3
- "$schema": "../../../../node_modules/nx/schemas/project-schema.json",
4
- "sourceRoot": "packages/pieces/community/coasy/src",
5
- "projectType": "library",
6
- "targets": {
7
- "build": {
8
- "executor": "@nx/js:tsc",
9
- "outputs": [
10
- "{options.outputPath}"
11
- ],
12
- "options": {
13
- "outputPath": "dist/packages/pieces/community/coasy",
14
- "tsConfig": "packages/pieces/community/coasy/tsconfig.lib.json",
15
- "packageJson": "packages/pieces/community/coasy/package.json",
16
- "main": "packages/pieces/community/coasy/src/index.ts",
17
- "assets": [
18
- "packages/pieces/community/coasy/*.md"
19
- ],
20
- "buildableProjectDepsInPackageJsonType": "dependencies",
21
- "updateBuildableProjectDepsInPackageJson": true
22
- }
23
- },
24
- "publish": {
25
- "command": "node tools/scripts/publish.mjs pieces-coasy {args.ver} {args.tag}",
26
- "dependsOn": [
27
- "build"
28
- ]
29
- },
30
- "lint": {
31
- "executor": "@nx/eslint:lint",
32
- "outputs": [
33
- "{options.outputFile}"
34
- ]
35
- }
36
- },
37
- "tags": []
38
- }
package/src/index.ts DELETED
@@ -1,84 +0,0 @@
1
- import {
2
- createPiece,
3
- PieceAuth,
4
- Property,
5
- } from '@activepieces/pieces-framework';
6
- import { createEventParticipant } from './lib/actions/create-event-participant';
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';
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';
27
- import { newWebinarParticipant } from './lib/triggers/new-webinar-participant';
28
- import { webinarParticipantAttend } from './lib/triggers/webinar-participant-attend';
29
- import { webinarParticipantReminder } from './lib/triggers/webinar-participant-reminder';
30
-
31
- export const coasyAuth = PieceAuth.CustomAuth({
32
- required: true,
33
- description: 'Enter coasy authentication details',
34
- props: {
35
- baseUrl: Property.ShortText({
36
- displayName: 'Base URL',
37
- description: 'Enter the base URL',
38
- required: false,
39
- defaultValue: 'https://backend.api.prod.coasy.io',
40
- }),
41
- apiKey: PieceAuth.SecretText({
42
- displayName: 'API Key',
43
- description: 'Enter the api key',
44
- required: true,
45
- }),
46
- },
47
- });
48
-
49
- export const coasy = createPiece({
50
- displayName: 'Coasy',
51
- auth: coasyAuth,
52
- description: 'Communicate with Coasy',
53
- minimumSupportedRelease: '0.20.0',
54
- logoUrl: 'https://console.coasy.io/favicon/apple-icon.png',
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
- ],
84
- });
@@ -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,35 +0,0 @@
1
- import { createAction, Property } from '@activepieces/pieces-framework';
2
- import { coasyAuth } from '../../index';
3
- import { runCoasyAction } from '../common/actions';
4
-
5
- const name = 'createFunnelParticipant';
6
-
7
- export const createFunnelParticipant = createAction({
8
- auth: coasyAuth,
9
- name,
10
- displayName: 'Create Funnel Participant',
11
- description: 'Create a new funnel participant',
12
- props: {
13
- funnelId: Property.ShortText({
14
- displayName: 'Funnel ID',
15
- description: 'ID of funnel',
16
- required: true,
17
- }),
18
- firstName: Property.ShortText({
19
- displayName: 'First name',
20
- description: 'first name of participant',
21
- required: true,
22
- }),
23
- lastName: Property.ShortText({
24
- displayName: 'Last name',
25
- description: 'last name of participant',
26
- required: false,
27
- }),
28
- email: Property.ShortText({
29
- displayName: 'Email',
30
- description: 'email address of partipant',
31
- required: true,
32
- }),
33
- },
34
- run: (configValue) => runCoasyAction(configValue, name),
35
- });
@@ -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
- };