@activepieces/piece-provenexpert 0.0.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.
Files changed (33) hide show
  1. package/package.json +17 -0
  2. package/src/index.d.ts +5 -0
  3. package/src/index.d.ts.map +1 -0
  4. package/src/index.js +43 -0
  5. package/src/index.js.map +1 -0
  6. package/src/lib/actions/create-survey-invitation-url.d.ts +12 -0
  7. package/src/lib/actions/create-survey-invitation-url.d.ts.map +1 -0
  8. package/src/lib/actions/create-survey-invitation-url.js +46 -0
  9. package/src/lib/actions/create-survey-invitation-url.js.map +1 -0
  10. package/src/lib/actions/get-profile.d.ts +5 -0
  11. package/src/lib/actions/get-profile.d.ts.map +1 -0
  12. package/src/lib/actions/get-profile.js +44 -0
  13. package/src/lib/actions/get-profile.js.map +1 -0
  14. package/src/lib/actions/get-rating-summary.d.ts +5 -0
  15. package/src/lib/actions/get-rating-summary.d.ts.map +1 -0
  16. package/src/lib/actions/get-rating-summary.js +29 -0
  17. package/src/lib/actions/get-rating-summary.js.map +1 -0
  18. package/src/lib/actions/list-surveys.d.ts +5 -0
  19. package/src/lib/actions/list-surveys.d.ts.map +1 -0
  20. package/src/lib/actions/list-surveys.js +41 -0
  21. package/src/lib/actions/list-surveys.js.map +1 -0
  22. package/src/lib/actions/send-survey-invitation-email.d.ts +16 -0
  23. package/src/lib/actions/send-survey-invitation-email.d.ts.map +1 -0
  24. package/src/lib/actions/send-survey-invitation-email.js +89 -0
  25. package/src/lib/actions/send-survey-invitation-email.js.map +1 -0
  26. package/src/lib/common/auth.d.ts +5 -0
  27. package/src/lib/common/auth.d.ts.map +1 -0
  28. package/src/lib/common/auth.js +44 -0
  29. package/src/lib/common/auth.js.map +1 -0
  30. package/src/lib/common/index.d.ts +23 -0
  31. package/src/lib/common/index.d.ts.map +1 -0
  32. package/src/lib/common/index.js +71 -0
  33. package/src/lib/common/index.js.map +1 -0
package/package.json ADDED
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "@activepieces/piece-provenexpert",
3
+ "version": "0.0.1",
4
+ "type": "commonjs",
5
+ "main": "./src/index.js",
6
+ "types": "./src/index.d.ts",
7
+ "dependencies": {
8
+ "@activepieces/pieces-common": "0.12.3",
9
+ "@activepieces/pieces-framework": "0.28.1",
10
+ "@activepieces/shared": "0.76.6",
11
+ "tslib": "2.3.0"
12
+ },
13
+ "scripts": {
14
+ "build": "tsc -p tsconfig.lib.json && cp package.json dist/",
15
+ "lint": "eslint 'src/**/*.ts'"
16
+ }
17
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ export declare const provenexpert: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ api_id: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
+ }>>;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,YAAY;;;GA8BvB,CAAC"}
package/src/index.js ADDED
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.provenexpert = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const pieces_common_1 = require("@activepieces/pieces-common");
7
+ const shared_1 = require("@activepieces/shared");
8
+ const common_1 = require("./lib/common");
9
+ const get_rating_summary_1 = require("./lib/actions/get-rating-summary");
10
+ const create_survey_invitation_url_1 = require("./lib/actions/create-survey-invitation-url");
11
+ const send_survey_invitation_email_1 = require("./lib/actions/send-survey-invitation-email");
12
+ const list_surveys_1 = require("./lib/actions/list-surveys");
13
+ const get_profile_1 = require("./lib/actions/get-profile");
14
+ const auth_1 = require("./lib/common/auth");
15
+ exports.provenexpert = (0, pieces_framework_1.createPiece)({
16
+ displayName: 'ProvenExpert',
17
+ description: 'Collect customer reviews, send survey invitations, and pull rating data from ProvenExpert.',
18
+ minimumSupportedRelease: '0.36.1',
19
+ logoUrl: 'https://cdn.activepieces.com/pieces/provenexpert.png',
20
+ categories: [shared_1.PieceCategory.MARKETING, shared_1.PieceCategory.FORMS_AND_SURVEYS],
21
+ auth: auth_1.provenExpertAuth,
22
+ authors: ['sanket-a11y'],
23
+ actions: [
24
+ get_rating_summary_1.getRatingSummaryAction,
25
+ create_survey_invitation_url_1.createSurveyInvitationUrlAction,
26
+ send_survey_invitation_email_1.sendSurveyInvitationEmailAction,
27
+ list_surveys_1.listSurveysAction,
28
+ get_profile_1.getProfileAction,
29
+ (0, pieces_common_1.createCustomApiCallAction)({
30
+ baseUrl: () => common_1.provenExpertCommon.baseUrl,
31
+ auth: auth_1.provenExpertAuth,
32
+ authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
33
+ const credentials = auth;
34
+ const encoded = Buffer.from(`${credentials.props.api_id}:${credentials.props.api_key}`).toString('base64');
35
+ return {
36
+ Authorization: `Basic ${encoded}`,
37
+ };
38
+ }),
39
+ }),
40
+ ],
41
+ triggers: [],
42
+ });
43
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,qEAA6D;AAC7D,+DAAwE;AACxE,iDAAqD;AACrD,yCAAkD;AAClD,yEAA0E;AAC1E,6FAA6F;AAC7F,6FAA6F;AAC7F,6DAA+D;AAC/D,2DAA6D;AAC7D,4CAAqD;AAExC,QAAA,YAAY,GAAG,IAAA,8BAAW,EAAC;IACtC,WAAW,EAAE,cAAc;IAC3B,WAAW,EACT,4FAA4F;IAC9F,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,sDAAsD;IAC/D,UAAU,EAAE,CAAC,sBAAa,CAAC,SAAS,EAAE,sBAAa,CAAC,iBAAiB,CAAC;IACtE,IAAI,EAAE,uBAAgB;IACtB,OAAO,EAAE,CAAC,aAAa,CAAC;IACxB,OAAO,EAAE;QACP,2CAAsB;QACtB,8DAA+B;QAC/B,8DAA+B;QAC/B,gCAAiB;QACjB,8BAAgB;QAChB,IAAA,yCAAyB,EAAC;YACxB,OAAO,EAAE,GAAG,EAAE,CAAC,2BAAkB,CAAC,OAAO;YACzC,IAAI,EAAE,uBAAgB;YACtB,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAC1B,MAAM,WAAW,GAAG,IAAI,CAAC;gBACzB,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CACzB,GAAG,WAAW,CAAC,KAAK,CAAC,MAAM,IAAI,WAAW,CAAC,KAAK,CAAC,OAAO,EAAE,CAC3D,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;gBACrB,OAAO;oBACL,aAAa,EAAE,SAAS,OAAO,EAAE;iBAClC,CAAC;YACJ,CAAC,CAAA;SACF,CAAC;KACH;IACD,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ export declare const createSurveyInvitationUrlAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ api_id: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
+ }>, {
5
+ survey_code: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
6
+ api_id: import("@activepieces/pieces-framework").ShortTextProperty<true>;
7
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
8
+ }>>;
9
+ email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
10
+ name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
11
+ }>;
12
+ //# sourceMappingURL=create-survey-invitation-url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-survey-invitation-url.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/create-survey-invitation-url.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,+BAA+B;;;;;;;;;;EA0C1C,CAAC"}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createSurveyInvitationUrlAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const common_1 = require("../common");
7
+ const auth_1 = require("../common/auth");
8
+ exports.createSurveyInvitationUrlAction = (0, pieces_framework_1.createAction)({
9
+ auth: auth_1.provenExpertAuth,
10
+ name: 'create_survey_invitation_url',
11
+ displayName: 'Create Survey Invitation URL',
12
+ description: 'Generates a personalised, one-time-use survey link that you can send to a customer.',
13
+ props: {
14
+ survey_code: common_1.provenExpertCommon.surveyDropdown,
15
+ email: pieces_framework_1.Property.ShortText({
16
+ displayName: 'Recipient Email',
17
+ description: 'Email address of the customer who will receive the survey link. The link is tied to this address.',
18
+ required: true,
19
+ }),
20
+ name: pieces_framework_1.Property.ShortText({
21
+ displayName: 'Recipient Name',
22
+ description: 'Optional full name of the recipient. Used to personalise the survey experience.',
23
+ required: false,
24
+ }),
25
+ },
26
+ run(context) {
27
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
28
+ var _a;
29
+ const { survey_code, email, name } = context.propsValue;
30
+ const response = yield common_1.provenExpertCommon.apiCall({
31
+ auth: context.auth.props,
32
+ path: '/invite/url/create',
33
+ body: Object.assign({ code: survey_code, email }, (name ? { name } : {})),
34
+ });
35
+ return {
36
+ status: response.body.status,
37
+ invitation_url: (_a = response.body.url) !== null && _a !== void 0 ? _a : null,
38
+ already_existed: response.body.exists === 1,
39
+ survey_code,
40
+ recipient_email: email,
41
+ recipient_name: name !== null && name !== void 0 ? name : null,
42
+ };
43
+ });
44
+ },
45
+ });
46
+ //# sourceMappingURL=create-survey-invitation-url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-survey-invitation-url.js","sourceRoot":"","sources":["../../../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I,aAAJ,IAAI,cAAJ,IAAI,GAAI,IAAI;aAC7B,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const getProfileAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ api_id: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
+ }>, {}>;
5
+ //# sourceMappingURL=get-profile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-profile.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/get-profile.ts"],"names":[],"mappings":"AAyBA,eAAO,MAAM,gBAAgB;;;OAgC3B,CAAC"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getProfileAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const auth_1 = require("../common/auth");
7
+ const common_1 = require("../common");
8
+ exports.getProfileAction = (0, pieces_framework_1.createAction)({
9
+ auth: auth_1.provenExpertAuth,
10
+ name: 'get_profile',
11
+ displayName: 'Get Profile',
12
+ description: 'Retrieves the company and contact details of your ProvenExpert profile.',
13
+ props: {},
14
+ run(context) {
15
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
16
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
17
+ const response = yield common_1.provenExpertCommon.apiCall({
18
+ auth: context.auth.props,
19
+ path: '/profile/get',
20
+ });
21
+ const profile = (_a = response.body.profile) !== null && _a !== void 0 ? _a : {};
22
+ const contact = (_b = profile.contact) !== null && _b !== void 0 ? _b : {};
23
+ return {
24
+ status: response.body.status,
25
+ created_at: profile.created
26
+ ? new Date(profile.created * 1000).toISOString()
27
+ : null,
28
+ email: (_c = profile.email) !== null && _c !== void 0 ? _c : null,
29
+ profile_url: (_d = profile.profileUrl) !== null && _d !== void 0 ? _d : null,
30
+ is_public: profile.public === 1,
31
+ company: (_e = profile.company) !== null && _e !== void 0 ? _e : null,
32
+ description: (_f = profile.description) !== null && _f !== void 0 ? _f : null,
33
+ contact_person: (_g = contact.person) !== null && _g !== void 0 ? _g : null,
34
+ contact_street: (_h = contact.street) !== null && _h !== void 0 ? _h : null,
35
+ contact_city: (_j = contact.city) !== null && _j !== void 0 ? _j : null,
36
+ contact_zip: (_k = contact.zip) !== null && _k !== void 0 ? _k : null,
37
+ contact_country: (_l = contact.country) !== null && _l !== void 0 ? _l : null,
38
+ contact_phone: (_m = contact.phone) !== null && _m !== void 0 ? _m : null,
39
+ contact_website: (_o = contact.website) !== null && _o !== void 0 ? _o : null,
40
+ };
41
+ });
42
+ },
43
+ });
44
+ //# sourceMappingURL=get-profile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-profile.js","sourceRoot":"","sources":["../../../../src/lib/actions/get-profile.ts"],"names":[],"mappings":";;;;AAAA,qEAA8D;AAC9D,yCAAkD;AAClD,sCAA+C;AAuBlC,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IAC3C,IAAI,EAAE,uBAAgB;IACtB,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,yEAAyE;IACtF,KAAK,EAAE,EAAE;IACH,GAAG,CAAC,OAAO;;;YACf,MAAM,QAAQ,GAAG,MAAM,2BAAkB,CAAC,OAAO,CAAkB;gBACjE,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK;gBACxB,IAAI,EAAE,cAAc;aACrB,CAAC,CAAC;YACH,MAAM,OAAO,GAAG,MAAA,QAAQ,CAAC,IAAI,CAAC,OAAO,mCAAI,EAAE,CAAC;YAC5C,MAAM,OAAO,GAAG,MAAA,OAAO,CAAC,OAAO,mCAAI,EAAE,CAAC;YACtC,OAAO;gBACL,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM;gBAC5B,UAAU,EAAE,OAAO,CAAC,OAAO;oBACzB,CAAC,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC,WAAW,EAAE;oBAChD,CAAC,CAAC,IAAI;gBACR,KAAK,EAAE,MAAA,OAAO,CAAC,KAAK,mCAAI,IAAI;gBAC5B,WAAW,EAAE,MAAA,OAAO,CAAC,UAAU,mCAAI,IAAI;gBACvC,SAAS,EAAE,OAAO,CAAC,MAAM,KAAK,CAAC;gBAC/B,OAAO,EAAE,MAAA,OAAO,CAAC,OAAO,mCAAI,IAAI;gBAChC,WAAW,EAAE,MAAA,OAAO,CAAC,WAAW,mCAAI,IAAI;gBACxC,cAAc,EAAE,MAAA,OAAO,CAAC,MAAM,mCAAI,IAAI;gBACtC,cAAc,EAAE,MAAA,OAAO,CAAC,MAAM,mCAAI,IAAI;gBACtC,YAAY,EAAE,MAAA,OAAO,CAAC,IAAI,mCAAI,IAAI;gBAClC,WAAW,EAAE,MAAA,OAAO,CAAC,GAAG,mCAAI,IAAI;gBAChC,eAAe,EAAE,MAAA,OAAO,CAAC,OAAO,mCAAI,IAAI;gBACxC,aAAa,EAAE,MAAA,OAAO,CAAC,KAAK,mCAAI,IAAI;gBACpC,eAAe,EAAE,MAAA,OAAO,CAAC,OAAO,mCAAI,IAAI;aACzC,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const getRatingSummaryAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ api_id: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
+ }>, {}>;
5
+ //# sourceMappingURL=get-rating-summary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-rating-summary.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/get-rating-summary.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,sBAAsB;;;OAqBjC,CAAC"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRatingSummaryAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const auth_1 = require("../common/auth");
7
+ const common_1 = require("../common");
8
+ exports.getRatingSummaryAction = (0, pieces_framework_1.createAction)({
9
+ auth: auth_1.provenExpertAuth,
10
+ name: 'get_rating_summary',
11
+ displayName: 'Get Rating Summary',
12
+ description: 'Retrieves the overall rating value and total review count for your ProvenExpert profile.',
13
+ props: {},
14
+ run(context) {
15
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
16
+ var _a, _b;
17
+ const response = yield common_1.provenExpertCommon.apiCall({
18
+ auth: context.auth.props,
19
+ path: '/rating/summary/get',
20
+ });
21
+ return {
22
+ status: response.body.status,
23
+ rating_value: (_a = response.body.ratingValue) !== null && _a !== void 0 ? _a : null,
24
+ review_count: (_b = response.body.reviewCount) !== null && _b !== void 0 ? _b : null,
25
+ };
26
+ });
27
+ },
28
+ });
29
+ //# sourceMappingURL=get-rating-summary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-rating-summary.js","sourceRoot":"","sources":["../../../../src/lib/actions/get-rating-summary.ts"],"names":[],"mappings":";;;;AAAA,qEAA8D;AAC9D,yCAAkD;AAClD,sCAA+C;AAElC,QAAA,sBAAsB,GAAG,IAAA,+BAAY,EAAC;IACjD,IAAI,EAAE,uBAAgB;IACtB,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,oBAAoB;IACjC,WAAW,EAAE,0FAA0F;IACvG,KAAK,EAAE,EAAE;IACH,GAAG,CAAC,OAAO;;;YACf,MAAM,QAAQ,GAAG,MAAM,2BAAkB,CAAC,OAAO,CAI9C;gBACD,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK;gBACxB,IAAI,EAAE,qBAAqB;aAC5B,CAAC,CAAC;YACH,OAAO;gBACL,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM;gBAC5B,YAAY,EAAE,MAAA,QAAQ,CAAC,IAAI,CAAC,WAAW,mCAAI,IAAI;gBAC/C,YAAY,EAAE,MAAA,QAAQ,CAAC,IAAI,CAAC,WAAW,mCAAI,IAAI;aAChD,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const listSurveysAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ api_id: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
+ }>, {}>;
5
+ //# sourceMappingURL=list-surveys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-surveys.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/list-surveys.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,iBAAiB;;;OA6B5B,CAAC"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.listSurveysAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const auth_1 = require("../common/auth");
7
+ const common_1 = require("../common");
8
+ exports.listSurveysAction = (0, pieces_framework_1.createAction)({
9
+ auth: auth_1.provenExpertAuth,
10
+ name: 'list_surveys',
11
+ displayName: 'List Surveys',
12
+ description: 'Returns all surveys on your ProvenExpert profile with their codes, names, and share links.',
13
+ props: {},
14
+ run(context) {
15
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
16
+ var _a;
17
+ const response = yield common_1.provenExpertCommon.apiCall({
18
+ auth: context.auth.props,
19
+ path: '/survey/get',
20
+ });
21
+ const surveys = (_a = response.body.surveys) !== null && _a !== void 0 ? _a : {};
22
+ return Object.values(surveys).map((s) => {
23
+ var _a, _b, _c, _d, _e;
24
+ return ({
25
+ code: s.code,
26
+ name: s.name,
27
+ active: s.active === 1,
28
+ created_at: s.created
29
+ ? new Date(s.created * 1000).toISOString()
30
+ : null,
31
+ position: (_a = s.pos) !== null && _a !== void 0 ? _a : null,
32
+ survey_url: (_b = s.url) !== null && _b !== void 0 ? _b : null,
33
+ qr_code_url: (_c = s.qr) !== null && _c !== void 0 ? _c : null,
34
+ print_png_url: (_d = s.printPng) !== null && _d !== void 0 ? _d : null,
35
+ print_pdf_url: (_e = s.printPdf) !== null && _e !== void 0 ? _e : null,
36
+ });
37
+ });
38
+ });
39
+ },
40
+ });
41
+ //# sourceMappingURL=list-surveys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-surveys.js","sourceRoot":"","sources":["../../../../src/lib/actions/list-surveys.ts"],"names":[],"mappings":";;;;AAAA,qEAA8D;AAC9D,yCAAkD;AAClD,sCAA+C;AAclC,QAAA,iBAAiB,GAAG,IAAA,+BAAY,EAAC;IAC5C,IAAI,EAAE,uBAAgB;IACtB,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,4FAA4F;IACzG,KAAK,EAAE,EAAE;IACH,GAAG,CAAC,OAAO;;;YACf,MAAM,QAAQ,GAAG,MAAM,2BAAkB,CAAC,OAAO,CAG9C;gBACD,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK;gBACxB,IAAI,EAAE,aAAa;aACpB,CAAC,CAAC;YACH,MAAM,OAAO,GAAG,MAAA,QAAQ,CAAC,IAAI,CAAC,OAAO,mCAAI,EAAE,CAAC;YAC5C,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;;gBAAC,OAAA,CAAC;oBACxC,IAAI,EAAE,CAAC,CAAC,IAAI;oBACZ,IAAI,EAAE,CAAC,CAAC,IAAI;oBACZ,MAAM,EAAE,CAAC,CAAC,MAAM,KAAK,CAAC;oBACtB,UAAU,EAAE,CAAC,CAAC,OAAO;wBACnB,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC,WAAW,EAAE;wBAC1C,CAAC,CAAC,IAAI;oBACR,QAAQ,EAAE,MAAA,CAAC,CAAC,GAAG,mCAAI,IAAI;oBACvB,UAAU,EAAE,MAAA,CAAC,CAAC,GAAG,mCAAI,IAAI;oBACzB,WAAW,EAAE,MAAA,CAAC,CAAC,EAAE,mCAAI,IAAI;oBACzB,aAAa,EAAE,MAAA,CAAC,CAAC,QAAQ,mCAAI,IAAI;oBACjC,aAAa,EAAE,MAAA,CAAC,CAAC,QAAQ,mCAAI,IAAI;iBAClC,CAAC,CAAA;aAAA,CAAC,CAAC;QACN,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,16 @@
1
+ export declare const sendSurveyInvitationEmailAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ api_id: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
+ }>, {
5
+ survey_code: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
6
+ api_id: import("@activepieces/pieces-framework").ShortTextProperty<true>;
7
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
8
+ }>>;
9
+ email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
10
+ name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
11
+ subject: import("@activepieces/pieces-framework").ShortTextProperty<false>;
12
+ salutation: import("@activepieces/pieces-framework").ShortTextProperty<false>;
13
+ text: import("@activepieces/pieces-framework").LongTextProperty<false>;
14
+ send_reminder: import("@activepieces/pieces-framework").CheckboxProperty<false>;
15
+ }>;
16
+ //# sourceMappingURL=send-survey-invitation-email.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-survey-invitation-email.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/send-survey-invitation-email.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;EA4F1C,CAAC"}
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendSurveyInvitationEmailAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const auth_1 = require("../common/auth");
7
+ const common_1 = require("../common");
8
+ exports.sendSurveyInvitationEmailAction = (0, pieces_framework_1.createAction)({
9
+ auth: auth_1.provenExpertAuth,
10
+ name: 'send_survey_invitation_email',
11
+ displayName: 'Send Survey Invitation Email',
12
+ description: 'Sends a survey invitation email through ProvenExpert to a single recipient. A 7-day reminder is sent automatically unless disabled.',
13
+ props: {
14
+ survey_code: common_1.provenExpertCommon.surveyDropdown,
15
+ email: pieces_framework_1.Property.ShortText({
16
+ displayName: 'Recipient Email',
17
+ description: 'Email address that should receive the invitation.',
18
+ required: true,
19
+ }),
20
+ name: pieces_framework_1.Property.ShortText({
21
+ displayName: 'Recipient Name',
22
+ description: 'Optional full name of the recipient — used to address them in the email.',
23
+ required: false,
24
+ }),
25
+ subject: pieces_framework_1.Property.ShortText({
26
+ displayName: 'Email Subject',
27
+ description: 'Optional custom subject line for the invitation. Leave empty to use the survey default.',
28
+ required: false,
29
+ }),
30
+ salutation: pieces_framework_1.Property.ShortText({
31
+ displayName: 'Email Salutation',
32
+ description: 'Optional custom greeting line (e.g. "Hi Jane,"). Leave empty to use the survey default.',
33
+ required: false,
34
+ }),
35
+ text: pieces_framework_1.Property.LongText({
36
+ displayName: 'Email Body',
37
+ description: 'Optional custom message body. Leave empty to use the survey default body.',
38
+ required: false,
39
+ }),
40
+ send_reminder: pieces_framework_1.Property.Checkbox({
41
+ displayName: 'Send 7-day Reminder',
42
+ description: 'When enabled, ProvenExpert sends a reminder email after 7 days if the recipient has not responded.',
43
+ required: false,
44
+ defaultValue: true,
45
+ }),
46
+ },
47
+ run(context) {
48
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
49
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
50
+ const { survey_code, email, name, subject, salutation, text, send_reminder, } = context.propsValue;
51
+ const recipient = { email };
52
+ if (name)
53
+ recipient['name'] = name;
54
+ if (subject)
55
+ recipient['subject'] = subject;
56
+ if (salutation)
57
+ recipient['salutation'] = salutation;
58
+ if (text)
59
+ recipient['text'] = text;
60
+ const response = yield common_1.provenExpertCommon.apiCall({
61
+ auth: context.auth.props,
62
+ path: '/invite/mail/create',
63
+ body: {
64
+ code: survey_code,
65
+ reminder: send_reminder === false ? 0 : 1,
66
+ recipients: [recipient],
67
+ },
68
+ });
69
+ const mailing = response.body.mailing;
70
+ return {
71
+ status: response.body.status,
72
+ mailing_id: (_a = mailing === null || mailing === void 0 ? void 0 : mailing.id) !== null && _a !== void 0 ? _a : null,
73
+ mailing_status: (_b = mailing === null || mailing === void 0 ? void 0 : mailing.status) !== null && _b !== void 0 ? _b : null,
74
+ total_recipients: (_d = (_c = mailing === null || mailing === void 0 ? void 0 : mailing.count) === null || _c === void 0 ? void 0 : _c.all) !== null && _d !== void 0 ? _d : null,
75
+ created_count: (_f = (_e = mailing === null || mailing === void 0 ? void 0 : mailing.count) === null || _e === void 0 ? void 0 : _e.created) !== null && _f !== void 0 ? _f : null,
76
+ error_count: (_h = (_g = mailing === null || mailing === void 0 ? void 0 : mailing.count) === null || _g === void 0 ? void 0 : _g.error) !== null && _h !== void 0 ? _h : null,
77
+ created_emails: Array.isArray((_j = mailing === null || mailing === void 0 ? void 0 : mailing.list) === null || _j === void 0 ? void 0 : _j.created)
78
+ ? mailing.list.created.join(', ')
79
+ : null,
80
+ error_emails: Array.isArray((_k = mailing === null || mailing === void 0 ? void 0 : mailing.list) === null || _k === void 0 ? void 0 : _k.error)
81
+ ? mailing.list.error.join(', ')
82
+ : null,
83
+ survey_code,
84
+ recipient_email: email,
85
+ };
86
+ });
87
+ },
88
+ });
89
+ //# sourceMappingURL=send-survey-invitation-email.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-survey-invitation-email.js","sourceRoot":"","sources":["../../../../src/lib/actions/send-survey-invitation-email.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,yCAAkD;AAClD,sCAA+C;AAElC,QAAA,+BAA+B,GAAG,IAAA,+BAAY,EAAC;IAC1D,IAAI,EAAE,uBAAgB;IACtB,IAAI,EAAE,8BAA8B;IACpC,WAAW,EAAE,8BAA8B;IAC3C,WAAW,EAAE,qIAAqI;IAClJ,KAAK,EAAE;QACL,WAAW,EAAE,2BAAkB,CAAC,cAAc;QAC9C,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,iBAAiB;YAC9B,WAAW,EAAE,mDAAmD;YAChE,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACvB,WAAW,EAAE,gBAAgB;YAC7B,WAAW,EAAE,0EAA0E;YACvF,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,eAAe;YAC5B,WAAW,EAAE,yFAAyF;YACtG,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,kBAAkB;YAC/B,WAAW,EAAE,yFAAyF;YACtG,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACtB,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,2EAA2E;YACxF,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,aAAa,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC/B,WAAW,EAAE,qBAAqB;YAClC,WAAW,EAAE,oGAAoG;YACjH,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,IAAI;SACn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A,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,0CAAE,OAAO,mCAAI,IAAI;gBAC9C,WAAW,EAAE,MAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,0CAAE,KAAK,mCAAI,IAAI;gBAC1C,cAAc,EAAE,KAAK,CAAC,OAAO,CAAC,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,0CAAE,OAAO,CAAC;oBACnD,CAAC,CAAC,OAAQ,CAAC,IAAK,CAAC,OAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;oBACpC,CAAC,CAAC,IAAI;gBACR,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,0CAAE,KAAK,CAAC;oBAC/C,CAAC,CAAC,OAAQ,CAAC,IAAK,CAAC,KAAM,CAAC,IAAI,CAAC,IAAI,CAAC;oBAClC,CAAC,CAAC,IAAI;gBACR,WAAW;gBACX,eAAe,EAAE,KAAK;aACvB,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const provenExpertAuth: import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ api_id: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
+ }>;
5
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/auth.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB;;;EAmC3B,CAAC"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.provenExpertAuth = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const _1 = require(".");
7
+ exports.provenExpertAuth = pieces_framework_1.PieceAuth.CustomAuth({
8
+ description: `Connect your ProvenExpert account to access reviews, surveys, and invitations.
9
+
10
+ **How to get your API credentials:**
11
+ 1. Log in to your [ProvenExpert account](https://www.provenexpert.com/).
12
+ 2. Go to **integrations ** from the left side panel.
13
+ 3. Copy your **Username** and **API Key**.
14
+ 4. Paste them into the fields below.`,
15
+ required: true,
16
+ props: {
17
+ api_id: pieces_framework_1.Property.ShortText({
18
+ displayName: 'Username',
19
+ description: 'Your ProvenExpert Username.',
20
+ required: true,
21
+ }),
22
+ api_key: pieces_framework_1.PieceAuth.SecretText({
23
+ displayName: 'API Key',
24
+ description: 'Your ProvenExpert API Key.',
25
+ required: true,
26
+ }),
27
+ },
28
+ validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
29
+ try {
30
+ yield _1.provenExpertCommon.apiCall({
31
+ auth,
32
+ path: '/profile/get',
33
+ });
34
+ return { valid: true };
35
+ }
36
+ catch (_b) {
37
+ return {
38
+ valid: false,
39
+ error: 'Invalid Username or API Key. Double-check your credentials in ProvenExpert under My Account → API Access.',
40
+ };
41
+ }
42
+ }),
43
+ });
44
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../src/lib/common/auth.ts"],"names":[],"mappings":";;;;AAAA,qEAAqE;AACrE,wBAAuC;AAE1B,QAAA,gBAAgB,GAAG,4BAAS,CAAC,UAAU,CAAC;IACnD,WAAW,EAAE;;;;;;qCAMsB;IACnC,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE;QACL,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACzB,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,6BAA6B;YAC1C,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,OAAO,EAAE,4BAAS,CAAC,UAAU,CAAC;YAC5B,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,4BAA4B;YACzC,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACD,QAAQ,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACvB,IAAI,CAAC;YACH,MAAM,qBAAkB,CAAC,OAAO,CAAC;gBAC/B,IAAI;gBACJ,IAAI,EAAE,cAAc;aACrB,CAAC,CAAC;YACH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QACzB,CAAC;QAAC,WAAM,CAAC;YACP,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,2GAA2G;aACnH,CAAC;QACJ,CAAC;IACH,CAAC,CAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { HttpMessageBody, HttpResponse } from '@activepieces/pieces-common';
2
+ declare function provenExpertApiCall<T extends HttpMessageBody>({ auth, path, body, }: {
3
+ auth: {
4
+ api_id: string;
5
+ api_key: string;
6
+ };
7
+ path: string;
8
+ body?: Record<string, unknown>;
9
+ }): Promise<HttpResponse<T>>;
10
+ export declare const provenExpertCommon: {
11
+ apiCall: typeof provenExpertApiCall;
12
+ surveyDropdown: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
13
+ api_id: import("@activepieces/pieces-framework").ShortTextProperty<true>;
14
+ api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
15
+ }>>;
16
+ baseUrl: string;
17
+ };
18
+ export type ProvenExpertAuth = {
19
+ api_id: string;
20
+ api_key: string;
21
+ };
22
+ export {};
23
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,eAAe,EACf,YAAY,EACb,MAAM,6BAA6B,CAAC;AAMrC,iBAAe,mBAAmB,CAAC,CAAC,SAAS,eAAe,EAAE,EAC5D,IAAI,EACJ,IAAI,EACJ,IAAI,GACL,EAAE;IACD,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAW3B;AAkDD,eAAO,MAAM,kBAAkB;;;;;;;CAI9B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC"}
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.provenExpertCommon = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_common_1 = require("@activepieces/pieces-common");
6
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
7
+ const auth_1 = require("./auth");
8
+ const BASE_URL = 'https://www.provenexpert.com/api/v1';
9
+ function provenExpertApiCall(_a) {
10
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, path, body, }) {
11
+ return yield pieces_common_1.httpClient.sendRequest({
12
+ method: pieces_common_1.HttpMethod.POST,
13
+ url: `${BASE_URL}${path}`,
14
+ authentication: {
15
+ type: pieces_common_1.AuthenticationType.BASIC,
16
+ username: auth.api_id,
17
+ password: auth.api_key,
18
+ },
19
+ body: body ? { data: body } : {},
20
+ });
21
+ });
22
+ }
23
+ const surveyDropdown = pieces_framework_1.Property.Dropdown({
24
+ auth: auth_1.provenExpertAuth,
25
+ displayName: 'Survey',
26
+ description: 'Pick the survey to use. Surveys are created in your ProvenExpert account under the Surveys section.',
27
+ refreshers: [],
28
+ required: true,
29
+ options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
30
+ var _b;
31
+ if (!auth) {
32
+ return {
33
+ disabled: true,
34
+ options: [],
35
+ placeholder: 'Please connect your ProvenExpert account first',
36
+ };
37
+ }
38
+ try {
39
+ const response = yield provenExpertApiCall({
40
+ auth: auth.props,
41
+ path: '/survey/get',
42
+ });
43
+ const surveys = (_b = response.body.surveys) !== null && _b !== void 0 ? _b : {};
44
+ const options = Object.values(surveys).map((s) => ({
45
+ label: s.active === 1 ? s.name : `${s.name} (inactive)`,
46
+ value: s.code,
47
+ }));
48
+ if (options.length === 0) {
49
+ return {
50
+ disabled: false,
51
+ options: [],
52
+ placeholder: 'No surveys found. Create one in your ProvenExpert dashboard first.',
53
+ };
54
+ }
55
+ return { disabled: false, options };
56
+ }
57
+ catch (_c) {
58
+ return {
59
+ disabled: true,
60
+ options: [],
61
+ placeholder: 'Failed to load surveys. Check your connection.',
62
+ };
63
+ }
64
+ }),
65
+ });
66
+ exports.provenExpertCommon = {
67
+ apiCall: provenExpertApiCall,
68
+ surveyDropdown,
69
+ baseUrl: BASE_URL,
70
+ };
71
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/common/index.ts"],"names":[],"mappings":";;;;AAAA,+DAMqC;AACrC,qEAA0D;AAC1D,iCAA0C;AAE1C,MAAM,QAAQ,GAAG,qCAAqC,CAAC;AAEvD,SAAe,mBAAmB;iEAA4B,EAC5D,IAAI,EACJ,IAAI,EACJ,IAAI,GAKL;QACC,OAAO,MAAM,0BAAU,CAAC,WAAW,CAAI;YACrC,MAAM,EAAE,0BAAU,CAAC,IAAI;YACvB,GAAG,EAAE,GAAG,QAAQ,GAAG,IAAI,EAAE;YACzB,cAAc,EAAE;gBACd,IAAI,EAAE,kCAAkB,CAAC,KAAK;gBAC9B,QAAQ,EAAE,IAAI,CAAC,MAAM;gBACrB,QAAQ,EAAE,IAAI,CAAC,OAAO;aACvB;YACD,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE;SACjC,CAAC,CAAC;IACL,CAAC;CAAA;AAED,MAA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