@activepieces/piece-qwilr 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.
- package/README.md +7 -0
- package/package.json +25 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +47 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/create-page.d.ts +10 -0
- package/src/lib/actions/create-page.js +90 -0
- package/src/lib/actions/create-page.js.map +1 -0
- package/src/lib/common/auth.d.ts +1 -0
- package/src/lib/common/auth.js +13 -0
- package/src/lib/common/auth.js.map +1 -0
- package/src/lib/triggers/page-accepted.d.ts +2 -0
- package/src/lib/triggers/page-accepted.js +71 -0
- package/src/lib/triggers/page-accepted.js.map +1 -0
- package/src/lib/triggers/page-first-viewed.d.ts +2 -0
- package/src/lib/triggers/page-first-viewed.js +71 -0
- package/src/lib/triggers/page-first-viewed.js.map +1 -0
- package/src/lib/triggers/page-partially-accepted.d.ts +2 -0
- package/src/lib/triggers/page-partially-accepted.js +71 -0
- package/src/lib/triggers/page-partially-accepted.js.map +1 -0
- package/src/lib/triggers/page-preview-accepted.d.ts +2 -0
- package/src/lib/triggers/page-preview-accepted.js +71 -0
- package/src/lib/triggers/page-preview-accepted.js.map +1 -0
- package/src/lib/triggers/page-revived-live.d.ts +2 -0
- package/src/lib/triggers/page-revived-live.js +71 -0
- package/src/lib/triggers/page-revived-live.js.map +1 -0
- package/src/lib/triggers/page-set-live.d.ts +2 -0
- package/src/lib/triggers/page-set-live.js +71 -0
- package/src/lib/triggers/page-set-live.js.map +1 -0
- package/src/lib/triggers/page-viewed.d.ts +2 -0
- package/src/lib/triggers/page-viewed.js +71 -0
- package/src/lib/triggers/page-viewed.js.map +1 -0
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@activepieces/piece-qwilr",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "commonjs",
|
|
5
|
+
"main": "./src/index.js",
|
|
6
|
+
"types": "./src/index.d.ts",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@sinclair/typebox": "0.34.11",
|
|
9
|
+
"axios": "1.13.1",
|
|
10
|
+
"axios-retry": "4.4.1",
|
|
11
|
+
"deepmerge-ts": "7.1.0",
|
|
12
|
+
"mime-types": "2.1.35",
|
|
13
|
+
"nanoid": "3.3.8",
|
|
14
|
+
"semver": "7.6.0",
|
|
15
|
+
"socket.io-client": "4.8.1",
|
|
16
|
+
"tslib": "^2.3.0",
|
|
17
|
+
"zod": "4.1.13",
|
|
18
|
+
"@activepieces/pieces-common": "0.10.1",
|
|
19
|
+
"@activepieces/pieces-framework": "0.22.2",
|
|
20
|
+
"@activepieces/shared": "0.30.3"
|
|
21
|
+
},
|
|
22
|
+
"resolutions": {
|
|
23
|
+
"rollup": "npm:@rollup/wasm-node"
|
|
24
|
+
}
|
|
25
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const qwilr: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
package/src/index.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.qwilr = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const shared_1 = require("@activepieces/shared");
|
|
7
|
+
const auth_1 = require("./lib/common/auth");
|
|
8
|
+
const create_page_1 = require("./lib/actions/create-page");
|
|
9
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
10
|
+
const page_accepted_1 = require("./lib/triggers/page-accepted");
|
|
11
|
+
const page_partially_accepted_1 = require("./lib/triggers/page-partially-accepted");
|
|
12
|
+
const page_preview_accepted_1 = require("./lib/triggers/page-preview-accepted");
|
|
13
|
+
const page_viewed_1 = require("./lib/triggers/page-viewed");
|
|
14
|
+
const page_first_viewed_1 = require("./lib/triggers/page-first-viewed");
|
|
15
|
+
const page_set_live_1 = require("./lib/triggers/page-set-live");
|
|
16
|
+
const page_revived_live_1 = require("./lib/triggers/page-revived-live");
|
|
17
|
+
exports.qwilr = (0, pieces_framework_1.createPiece)({
|
|
18
|
+
displayName: "Qwilr",
|
|
19
|
+
description: "Create beautiful, interactive sales documents and proposals with Qwilr. Automate page creation, track views, and handle acceptance events.",
|
|
20
|
+
auth: auth_1.qwilrAuth,
|
|
21
|
+
minimumSupportedRelease: '0.36.1',
|
|
22
|
+
logoUrl: "https://cdn.activepieces.com/pieces/qwilr.png",
|
|
23
|
+
authors: ["onyedikachi-david"],
|
|
24
|
+
categories: [shared_1.PieceCategory.SALES_AND_CRM, shared_1.PieceCategory.CONTENT_AND_FILES],
|
|
25
|
+
actions: [
|
|
26
|
+
create_page_1.createPageAction,
|
|
27
|
+
(0, pieces_common_1.createCustomApiCallAction)({
|
|
28
|
+
auth: auth_1.qwilrAuth,
|
|
29
|
+
baseUrl: () => 'https://api.qwilr.com/v1',
|
|
30
|
+
authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
31
|
+
return {
|
|
32
|
+
'Authorization': `Bearer ${auth}`
|
|
33
|
+
};
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
],
|
|
37
|
+
triggers: [
|
|
38
|
+
page_accepted_1.pageAcceptedTrigger,
|
|
39
|
+
page_partially_accepted_1.pagePartiallyAcceptedTrigger,
|
|
40
|
+
page_preview_accepted_1.pagePreviewAcceptedTrigger,
|
|
41
|
+
page_viewed_1.pageViewedTrigger,
|
|
42
|
+
page_first_viewed_1.pageFirstViewedTrigger,
|
|
43
|
+
page_set_live_1.pageSetLiveTrigger,
|
|
44
|
+
page_revived_live_1.pageRevivedLiveTrigger
|
|
45
|
+
],
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/qwilr/src/index.ts"],"names":[],"mappings":";;;;AAAA,qEAA6D;AAC7D,iDAAqD;AACrD,4CAA8C;AAC9C,2DAA6D;AAC7D,+DAAwE;AACxE,gEAAmE;AACnE,oFAAsF;AACtF,gFAAkF;AAClF,4DAA+D;AAC/D,wEAA0E;AAC1E,gEAAkE;AAClE,wEAA0E;AAE7D,QAAA,KAAK,GAAG,IAAA,8BAAW,EAAC;IAC/B,WAAW,EAAE,OAAO;IACpB,WAAW,EAAE,4IAA4I;IACzJ,IAAI,EAAE,gBAAS;IACf,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,+CAA+C;IACxD,OAAO,EAAE,CAAC,mBAAmB,CAAC;IAC9B,UAAU,EAAE,CAAC,sBAAa,CAAC,aAAa,EAAE,sBAAa,CAAC,iBAAiB,CAAC;IAC1E,OAAO,EAAE;QACP,8BAAgB;QAChB,IAAA,yCAAyB,EAAC;YACxB,IAAI,EAAE,gBAAS;YACf,OAAO,EAAE,GAAG,EAAE,CAAC,0BAA0B;YACzC,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAC1B,OAAO;oBACL,eAAe,EAAE,UAAU,IAAI,EAAE;iBAClC,CAAA;YACH,CAAC,CAAA;SACF,CAAC;KACH;IACD,QAAQ,EAAE;QACR,mCAAmB;QACnB,sDAA4B;QAC5B,kDAA0B;QAC1B,+BAAiB;QACjB,0CAAsB;QACtB,kCAAkB;QAClB,0CAAsB;KACvB;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const createPageAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
templateId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
4
|
+
published: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
5
|
+
ownerId: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
+
tags: import("@activepieces/pieces-framework").ArrayProperty<false>;
|
|
7
|
+
metadata: import("@activepieces/pieces-framework").JsonProperty<false>;
|
|
8
|
+
substitutions: import("@activepieces/pieces-framework").JsonProperty<false>;
|
|
9
|
+
acceptSettings: import("@activepieces/pieces-framework").ObjectProperty<false>;
|
|
10
|
+
}>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createPageAction = 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 auth_1 = require("../common/auth");
|
|
8
|
+
exports.createPageAction = (0, pieces_framework_1.createAction)({
|
|
9
|
+
name: 'create_page',
|
|
10
|
+
displayName: 'Create Page',
|
|
11
|
+
description: 'Creates a new Qwilr page from saved blocks or template.',
|
|
12
|
+
auth: auth_1.qwilrAuth,
|
|
13
|
+
props: {
|
|
14
|
+
templateId: pieces_framework_1.Property.ShortText({
|
|
15
|
+
displayName: 'Template ID',
|
|
16
|
+
description: 'ID of the template to use for the page',
|
|
17
|
+
required: true
|
|
18
|
+
}),
|
|
19
|
+
name: pieces_framework_1.Property.ShortText({
|
|
20
|
+
displayName: 'Page Name',
|
|
21
|
+
description: 'Title of the page, visible as the browser page title',
|
|
22
|
+
required: false
|
|
23
|
+
}),
|
|
24
|
+
published: pieces_framework_1.Property.Checkbox({
|
|
25
|
+
displayName: 'Publish Page',
|
|
26
|
+
description: 'Whether the page is publicly available; false means the page will be in Draft status',
|
|
27
|
+
required: false,
|
|
28
|
+
defaultValue: false
|
|
29
|
+
}),
|
|
30
|
+
ownerId: pieces_framework_1.Property.ShortText({
|
|
31
|
+
displayName: 'Owner ID',
|
|
32
|
+
description: 'ID of the user that should own the page. If not specified, the owner of the access token will be the owner of the page.',
|
|
33
|
+
required: false
|
|
34
|
+
}),
|
|
35
|
+
tags: pieces_framework_1.Property.Array({
|
|
36
|
+
displayName: 'Tags',
|
|
37
|
+
description: 'The tags for your page. Tags are case-sensitive.',
|
|
38
|
+
required: false
|
|
39
|
+
}),
|
|
40
|
+
metadata: pieces_framework_1.Property.Json({
|
|
41
|
+
displayName: 'Metadata',
|
|
42
|
+
description: 'Data you provide, that will be returned as part of all Webhooks.',
|
|
43
|
+
required: false
|
|
44
|
+
}),
|
|
45
|
+
substitutions: pieces_framework_1.Property.Json({
|
|
46
|
+
displayName: 'Substitutions',
|
|
47
|
+
description: 'Mapping of token API reference keys to substitution values used throughout the page.',
|
|
48
|
+
required: false
|
|
49
|
+
}),
|
|
50
|
+
acceptSettings: pieces_framework_1.Property.Object({
|
|
51
|
+
displayName: 'Accept Settings',
|
|
52
|
+
description: 'Configures settings for the accept block in the template being used. Only relevant if you have an accept block.',
|
|
53
|
+
required: false
|
|
54
|
+
})
|
|
55
|
+
},
|
|
56
|
+
run(context) {
|
|
57
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
const { templateId, name, published, ownerId, tags, metadata, substitutions, acceptSettings } = context.propsValue;
|
|
59
|
+
const auth = context.auth;
|
|
60
|
+
const requestBody = {
|
|
61
|
+
templateId
|
|
62
|
+
};
|
|
63
|
+
if (name !== undefined)
|
|
64
|
+
requestBody.name = name;
|
|
65
|
+
if (published !== undefined)
|
|
66
|
+
requestBody.published = published;
|
|
67
|
+
if (ownerId !== undefined)
|
|
68
|
+
requestBody.ownerId = ownerId;
|
|
69
|
+
if (tags && tags.length > 0)
|
|
70
|
+
requestBody.tags = tags;
|
|
71
|
+
if (metadata !== undefined)
|
|
72
|
+
requestBody.metadata = metadata;
|
|
73
|
+
if (substitutions !== undefined)
|
|
74
|
+
requestBody.substitutions = substitutions;
|
|
75
|
+
if (acceptSettings !== undefined)
|
|
76
|
+
requestBody.acceptSettings = acceptSettings;
|
|
77
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
78
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
79
|
+
url: 'https://api.qwilr.com/v1/pages',
|
|
80
|
+
headers: {
|
|
81
|
+
'Authorization': `Bearer ${auth}`,
|
|
82
|
+
'Content-Type': 'application/json'
|
|
83
|
+
},
|
|
84
|
+
body: requestBody
|
|
85
|
+
});
|
|
86
|
+
return response.body;
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
//# sourceMappingURL=create-page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-page.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/qwilr/src/lib/actions/create-page.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,yCAA2C;AAE9B,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IACzC,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,yDAAyD;IACtE,IAAI,EAAE,gBAAS;IACf,KAAK,EAAE;QACH,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,wCAAwC;YACrD,QAAQ,EAAE,IAAI;SACjB,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACrB,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,sDAAsD;YACnE,QAAQ,EAAE,KAAK;SAClB,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACzB,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,sFAAsF;YACnG,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,KAAK;SACtB,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,yHA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QAAQ,CAAC;YAC5D,IAAI,aAAa,KAAK,SAAS;gBAAE,WAAW,CAAC,aAAa,GAAG,aAAa,CAAC;YAC3E,IAAI,cAAc,KAAK,SAAS;gBAAE,WAAW,CAAC,cAAc,GAAG,cAAc,CAAC;YAE9E,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC1C,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,gCAAgC;gBACrC,OAAO,EAAE;oBACL,eAAe,EAAE,UAAU,IAAI,EAAE;oBACjC,cAAc,EAAE,kBAAkB;iBACrC;gBACD,IAAI,EAAE,WAAW;aACpB,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACzB,CAAC;KAAA;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const qwilrAuth: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.qwilrAuth = void 0;
|
|
4
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
5
|
+
exports.qwilrAuth = pieces_framework_1.PieceAuth.SecretText({
|
|
6
|
+
displayName: 'API Key',
|
|
7
|
+
required: true,
|
|
8
|
+
description: `
|
|
9
|
+
1. Go to your Qwilr account settings.
|
|
10
|
+
2. Navigate to API Settings.
|
|
11
|
+
3. Copy your access token.`,
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/qwilr/src/lib/common/auth.ts"],"names":[],"mappings":";;;AAAA,qEAA2D;AAG9C,QAAA,SAAS,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC1C,WAAW,EAAE,SAAS;IACtB,QAAQ,EAAE,IAAI;IACd,WAAW,EAAE;;;+BAGc;CAC9B,CAAC,CAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
+
export declare const pageAcceptedTrigger: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pageAcceptedTrigger = 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 auth_1 = require("../../lib/common/auth");
|
|
8
|
+
const subscribeWebhook = (auth, event, targetUrl) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
9
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
10
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
11
|
+
url: 'https://api.qwilr.com/v1/webhooks',
|
|
12
|
+
headers: {
|
|
13
|
+
'Authorization': `Bearer ${auth}`,
|
|
14
|
+
'Content-Type': 'application/json'
|
|
15
|
+
},
|
|
16
|
+
body: {
|
|
17
|
+
event,
|
|
18
|
+
targetUrl
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
return response.body;
|
|
22
|
+
});
|
|
23
|
+
const unsubscribeWebhook = (auth, subscriptionId) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
24
|
+
yield pieces_common_1.httpClient.sendRequest({
|
|
25
|
+
method: pieces_common_1.HttpMethod.DELETE,
|
|
26
|
+
url: `https://api.qwilr.com/v1/webhooks/${subscriptionId}`,
|
|
27
|
+
headers: {
|
|
28
|
+
'Authorization': `Bearer ${auth}`
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
exports.pageAcceptedTrigger = (0, pieces_framework_1.createTrigger)({
|
|
33
|
+
auth: auth_1.qwilrAuth,
|
|
34
|
+
name: 'page_accepted',
|
|
35
|
+
displayName: 'Page Accepted',
|
|
36
|
+
description: 'Triggers when a Qwilr page is accepted',
|
|
37
|
+
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
38
|
+
props: {},
|
|
39
|
+
onEnable(context) {
|
|
40
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
var _a;
|
|
42
|
+
const webhookData = yield subscribeWebhook(context.auth.secret_text, 'pageAccepted', context.webhookUrl);
|
|
43
|
+
yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.put('_page_accepted_trigger', {
|
|
44
|
+
subscriptionId: webhookData.id,
|
|
45
|
+
}));
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
onDisable(context) {
|
|
49
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
var _a;
|
|
51
|
+
const response = yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.get('_page_accepted_trigger'));
|
|
52
|
+
if (response !== null && response !== undefined) {
|
|
53
|
+
yield unsubscribeWebhook(context.auth.secret_text, response.subscriptionId);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
run(context) {
|
|
58
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
return [context.payload.body];
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
sampleData: {
|
|
63
|
+
event: 'pageAccepted',
|
|
64
|
+
idempotencyKey: 'b1c51b5b4844a81f7c3745002dbbd871fdda6cabe019961bcc79f972d924a2b0',
|
|
65
|
+
page: {
|
|
66
|
+
id: '6ee0f841f3cc8900090d82dc',
|
|
67
|
+
metadata: {}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
//# sourceMappingURL=page-accepted.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-accepted.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/qwilr/src/lib/triggers/page-accepted.ts"],"names":[],"mappings":";;;;AAAA,qEAAgF;AAChF,+DAAqE;AACrE,gDAAkD;AAElD,MAAM,gBAAgB,GAAG,CAAO,IAAY,EAAE,KAAa,EAAE,SAAiB,EAAE,EAAE;IAChF,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;QAC5C,MAAM,EAAE,0BAAU,CAAC,IAAI;QACvB,GAAG,EAAE,mCAAmC;QACxC,OAAO,EAAE;YACP,eAAe,EAAE,UAAU,IAAI,EAAE;YACjC,cAAc,EAAE,kBAAkB;SACnC;QACD,IAAI,EAAE;YACJ,KAAK;YACL,SAAS;SACV;KACF,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC,IAAI,CAAC;AACvB,CAAC,CAAA,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAO,IAAY,EAAE,cAAsB,EAAE,EAAE;IACxE,MAAM,0BAAU,CAAC,WAAW,CAAC;QAC3B,MAAM,EAAE,0BAAU,CAAC,MAAM;QACzB,GAAG,EAAE,qCAAqC,cAAc,EAAE;QAC1D,OAAO,EAAE;YACP,eAAe,EAAE,UAAU,IAAI,EAAE;SAClC;KACF,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEW,QAAA,mBAAmB,GAAG,IAAA,gCAAa,EAAC;IAC/C,IAAI,EAAE,gBAAS;IACf,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,wCAAwC;IACrD,IAAI,EAAE,kCAAe,CAAC,OAAO;IAC7B,KAAK,EAAE,EAAE;IACH,QAAQ,CAAC,OAAO;;;YACpB,MAAM,WAAW,GAAG,MAAM,gBAAgB,CACxC,OAAO,CAAC,IAAI,CAAC,WAAW,EACxB,cAAc,EACd,OAAO,CAAC,UAAU,CACnB,CAAC;YAEF,MAAM,CAAA,MAAA,OAAO,CAAC,KAAK,0CAAE,GAAG,CAAC,wBAAwB,EAAE;gBACjD,cAAc,EAAE,WAAW,CAAC,EAAE;aAC/B,CAAC,CAAA,CAAC;QACL,CAAC;KAAA;IACK,SAAS,CAAC,OAAO;;;YACrB,MAAM,QAAQ,GAAsC,MAAM,CAAA,MAAA,OAAO,CAAC,KAAK,0CAAE,GAAG,CAAC,wBAAwB,CAAC,CAAA,CAAC;YAEvG,IAAI,QAAQ,KAAK,IAAI,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;gBAChD,MAAM,kBAAkB,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC;YAC9E,CAAC;QACH,CAAC;KAAA;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;KAAA;IACD,UAAU,EAAE;QACV,KAAK,EAAE,cAAc;QACrB,cAAc,EAAE,kEAAkE;QAClF,IAAI,EAAE;YACJ,EAAE,EAAE,0BAA0B;YAC9B,QAAQ,EAAE,EAAE;SACb;KACF;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
+
export declare const pageFirstViewedTrigger: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pageFirstViewedTrigger = 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 auth_1 = require("../../lib/common/auth");
|
|
8
|
+
const subscribeWebhook = (auth, event, targetUrl) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
9
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
10
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
11
|
+
url: 'https://api.qwilr.com/v1/webhooks',
|
|
12
|
+
headers: {
|
|
13
|
+
'Authorization': `Bearer ${auth}`,
|
|
14
|
+
'Content-Type': 'application/json'
|
|
15
|
+
},
|
|
16
|
+
body: {
|
|
17
|
+
event,
|
|
18
|
+
targetUrl
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
return response.body;
|
|
22
|
+
});
|
|
23
|
+
const unsubscribeWebhook = (auth, subscriptionId) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
24
|
+
yield pieces_common_1.httpClient.sendRequest({
|
|
25
|
+
method: pieces_common_1.HttpMethod.DELETE,
|
|
26
|
+
url: `https://api.qwilr.com/v1/webhooks/${subscriptionId}`,
|
|
27
|
+
headers: {
|
|
28
|
+
'Authorization': `Bearer ${auth}`
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
exports.pageFirstViewedTrigger = (0, pieces_framework_1.createTrigger)({
|
|
33
|
+
auth: auth_1.qwilrAuth,
|
|
34
|
+
name: 'page_first_viewed',
|
|
35
|
+
displayName: 'Page First Viewed',
|
|
36
|
+
description: 'Triggers when a Qwilr page is viewed for the first time',
|
|
37
|
+
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
38
|
+
props: {},
|
|
39
|
+
onEnable(context) {
|
|
40
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
var _a;
|
|
42
|
+
const webhookData = yield subscribeWebhook(context.auth.secret_text, 'pageFirstViewed', context.webhookUrl);
|
|
43
|
+
yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.put('_page_first_viewed_trigger', {
|
|
44
|
+
subscriptionId: webhookData.id,
|
|
45
|
+
}));
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
onDisable(context) {
|
|
49
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
var _a;
|
|
51
|
+
const response = yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.get('_page_first_viewed_trigger'));
|
|
52
|
+
if (response !== null && response !== undefined) {
|
|
53
|
+
yield unsubscribeWebhook(context.auth.secret_text, response.subscriptionId);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
run(context) {
|
|
58
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
return [context.payload.body];
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
sampleData: {
|
|
63
|
+
event: 'pageFirstViewed',
|
|
64
|
+
idempotencyKey: 'b1c51b5b4844a81f7c3745002dbbd871fdda6cabe019961bcc79f972d924a2b0',
|
|
65
|
+
page: {
|
|
66
|
+
id: '6ee0f841f3cc8900090d82dc',
|
|
67
|
+
metadata: {}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
//# sourceMappingURL=page-first-viewed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-first-viewed.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/qwilr/src/lib/triggers/page-first-viewed.ts"],"names":[],"mappings":";;;;AAAA,qEAAgF;AAChF,+DAAqE;AACrE,gDAAkD;AAElD,MAAM,gBAAgB,GAAG,CAAO,IAAY,EAAE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,CAAC,KAAK,0CAAE,GAAG,CAAC,4BAA4B,CAAC,CAAA,CAAC;YAE3G,IAAI,QAAQ,KAAK,IAAI,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;gBAChD,MAAM,kBAAkB,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC;YAC9E,CAAC;QACH,CAAC;KAAA;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;KAAA;IACD,UAAU,EAAE;QACV,KAAK,EAAE,iBAAiB;QACxB,cAAc,EAAE,kEAAkE;QAClF,IAAI,EAAE;YACJ,EAAE,EAAE,0BAA0B;YAC9B,QAAQ,EAAE,EAAE;SACb;KACF;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
+
export declare const pagePartiallyAcceptedTrigger: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pagePartiallyAcceptedTrigger = 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 auth_1 = require("../../lib/common/auth");
|
|
8
|
+
const subscribeWebhook = (auth, event, targetUrl) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
9
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
10
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
11
|
+
url: 'https://api.qwilr.com/v1/webhooks',
|
|
12
|
+
headers: {
|
|
13
|
+
'Authorization': `Bearer ${auth}`,
|
|
14
|
+
'Content-Type': 'application/json'
|
|
15
|
+
},
|
|
16
|
+
body: {
|
|
17
|
+
event,
|
|
18
|
+
targetUrl
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
return response.body;
|
|
22
|
+
});
|
|
23
|
+
const unsubscribeWebhook = (auth, subscriptionId) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
24
|
+
yield pieces_common_1.httpClient.sendRequest({
|
|
25
|
+
method: pieces_common_1.HttpMethod.DELETE,
|
|
26
|
+
url: `https://api.qwilr.com/v1/webhooks/${subscriptionId}`,
|
|
27
|
+
headers: {
|
|
28
|
+
'Authorization': `Bearer ${auth}`
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
exports.pagePartiallyAcceptedTrigger = (0, pieces_framework_1.createTrigger)({
|
|
33
|
+
auth: auth_1.qwilrAuth,
|
|
34
|
+
name: 'page_partially_accepted',
|
|
35
|
+
displayName: 'Page Partially Accepted',
|
|
36
|
+
description: 'Triggers when a Qwilr page is partially accepted',
|
|
37
|
+
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
38
|
+
props: {},
|
|
39
|
+
onEnable(context) {
|
|
40
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
var _a;
|
|
42
|
+
const webhookData = yield subscribeWebhook(context.auth.secret_text, 'pagePartiallyAccepted', context.webhookUrl);
|
|
43
|
+
yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.put('_page_partially_accepted_trigger', {
|
|
44
|
+
subscriptionId: webhookData.id,
|
|
45
|
+
}));
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
onDisable(context) {
|
|
49
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
var _a;
|
|
51
|
+
const response = yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.get('_page_partially_accepted_trigger'));
|
|
52
|
+
if (response !== null && response !== undefined) {
|
|
53
|
+
yield unsubscribeWebhook(context.auth.secret_text, response.subscriptionId);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
run(context) {
|
|
58
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
return [context.payload.body];
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
sampleData: {
|
|
63
|
+
event: 'pagePartiallyAccepted',
|
|
64
|
+
idempotencyKey: 'b1c51b5b4844a81f7c3745002dbbd871fdda6cabe019961bcc79f972d924a2b0',
|
|
65
|
+
page: {
|
|
66
|
+
id: '6ee0f841f3cc8900090d82dc',
|
|
67
|
+
metadata: {}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
//# sourceMappingURL=page-partially-accepted.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-partially-accepted.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/qwilr/src/lib/triggers/page-partially-accepted.ts"],"names":[],"mappings":";;;;AAAA,qEAAgF;AAChF,+DAAqE;AACrE,gDAAkD;AAElD,MAAM,gBAAgB,GAAG,CAAO,IAAY,EAAE,KAAa,EAAE,SAAiB,EAAE,EAAE;IAChF,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;QAC5C,MAAM,EAAE,0BAAU,CAAC,IAAI;QACvB,GAAG,EAAE,mCAAmC;QACxC,OAAO,EAAE;YACP,eAAe,EAAE,UAAU,IAAI,EAAE;YACjC,cAAc,EAAE,kBAAkB;SACnC;QACD,IAAI,EAAE;YACJ,KAAK;YACL,SAAS;SACV;KACF,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC,IAAI,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AC,CAAC;QAChC,CAAC;KAAA;IACD,UAAU,EAAE;QACV,KAAK,EAAE,uBAAuB;QAC9B,cAAc,EAAE,kEAAkE;QAClF,IAAI,EAAE;YACJ,EAAE,EAAE,0BAA0B;YAC9B,QAAQ,EAAE,EAAE;SACb;KACF;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
+
export declare const pagePreviewAcceptedTrigger: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pagePreviewAcceptedTrigger = 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 auth_1 = require("../../lib/common/auth");
|
|
8
|
+
const subscribeWebhook = (auth, event, targetUrl) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
9
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
10
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
11
|
+
url: 'https://api.qwilr.com/v1/webhooks',
|
|
12
|
+
headers: {
|
|
13
|
+
'Authorization': `Bearer ${auth}`,
|
|
14
|
+
'Content-Type': 'application/json'
|
|
15
|
+
},
|
|
16
|
+
body: {
|
|
17
|
+
event,
|
|
18
|
+
targetUrl
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
return response.body;
|
|
22
|
+
});
|
|
23
|
+
const unsubscribeWebhook = (auth, subscriptionId) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
24
|
+
yield pieces_common_1.httpClient.sendRequest({
|
|
25
|
+
method: pieces_common_1.HttpMethod.DELETE,
|
|
26
|
+
url: `https://api.qwilr.com/v1/webhooks/${subscriptionId}`,
|
|
27
|
+
headers: {
|
|
28
|
+
'Authorization': `Bearer ${auth}`
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
exports.pagePreviewAcceptedTrigger = (0, pieces_framework_1.createTrigger)({
|
|
33
|
+
auth: auth_1.qwilrAuth,
|
|
34
|
+
name: 'page_preview_accepted',
|
|
35
|
+
displayName: 'Page Preview Accepted',
|
|
36
|
+
description: 'Triggers when a Qwilr page preview is accepted',
|
|
37
|
+
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
38
|
+
props: {},
|
|
39
|
+
onEnable(context) {
|
|
40
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
var _a;
|
|
42
|
+
const webhookData = yield subscribeWebhook(context.auth.secret_text, 'pagePreviewAccepted', context.webhookUrl);
|
|
43
|
+
yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.put('_page_preview_accepted_trigger', {
|
|
44
|
+
subscriptionId: webhookData.id,
|
|
45
|
+
}));
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
onDisable(context) {
|
|
49
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
var _a;
|
|
51
|
+
const response = yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.get('_page_preview_accepted_trigger'));
|
|
52
|
+
if (response !== null && response !== undefined) {
|
|
53
|
+
yield unsubscribeWebhook(context.auth.secret_text, response.subscriptionId);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
run(context) {
|
|
58
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
return [context.payload.body];
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
sampleData: {
|
|
63
|
+
event: 'pagePreviewAccepted',
|
|
64
|
+
idempotencyKey: 'b1c51b5b4844a81f7c3745002dbbd871fdda6cabe019961bcc79f972d924a2b0',
|
|
65
|
+
page: {
|
|
66
|
+
id: '6ee0f841f3cc8900090d82dc',
|
|
67
|
+
metadata: {}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
//# sourceMappingURL=page-preview-accepted.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-preview-accepted.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/qwilr/src/lib/triggers/page-preview-accepted.ts"],"names":[],"mappings":";;;;AAAA,qEAAgF;AAChF,+DAAqE;AACrE,gDAAkD;AAElD,MAAM,gBAAgB,GAAG,CAAO,IAAY,EAAE,KAAa,EAAE,SAAiB,EAAE,EAAE;IAChF,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;QAC5C,MAAM,EAAE,0BAAU,CAAC,IAAI;QACvB,GAAG,EAAE,mCAAmC;QACxC,OAAO,EAAE;YACP,eAAe,EAAE,UAAU,IAAI,EAAE;YACjC,cAAc,EAAE,kBAAkB;SACnC;QACD,IAAI,EAAE;YACJ,KAAK;YACL,SAAS;SACV;KACF,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC,IAAI,CAAC;AACvB,CAAC,CAAA,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAO,IAAY,EAAE,cAAsB,EAAE,EAAE;IACxE,MAAM,0BAAU,CAAC,WAAW,CAAC;QAC3B,MAAM,EAAE,0BAAU,CAAC,MAAM;QACzB,GAAG,EAAE,qCAAqC,cAAc,EAAE;QAC1D,OAAO,EAAE;YACP,eAAe,EAAE,UAAU,IAAI,EAAE;SAClC;KACF,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEW,QAAA,0BAA0B,GAAG,IAAA,gCAAa,EAAC;IACtD,IAAI,EAAE,gBAAS;IACf,IAAI,EAAE,uBAAuB;IAC7B,WAAW,EAAE,uBAAuB;IACpC,WAAW,EAAE,gDAAgD;IAC7D,IAAI,EAAE,kCAAe,CAAC,OAAO;IAC7B,KAAK,EAAE,EAAE;IACH,QAAQ,CAAC,OAAO;;;YACpB,MAAM,WAAW,GAAG,MAAM,gBAAgB,CACxC,OAAO,CAAC,IAAI,CAAC,WAAW,EACxB,qBAAqB,EACrB,OAAO,CAAC,UAAU,CACnB,CAAC;YAEF,MAAM,CAAA,MAAA,OAAO,CAAC,KAAK,0CAAE,GAAG,CAAC,gCAAgC,EAAE;gBACzD,cAAc,EAAE,WAAW,CAAC,EAAE;aAC/B,CAAC,CAAA,CAAC;QACL,CAAC;KAAA;IACK,SAAS,CAAC,OAAO;;;YACrB,MAAM,QAAQ,GAAsC,MAAM,CAAA,MAAA,OAAO,CAAC,KAAK,0CAAE,GAAG,CAAC,gCAAgC,CAAC,CAAA,CAAC;YAE/G,IAAI,QAAQ,KAAK,IAAI,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;gBAChD,MAAM,kBAAkB,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC;YAC9E,CAAC;QACH,CAAC;KAAA;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;KAAA;IACD,UAAU,EAAE;QACV,KAAK,EAAE,qBAAqB;QAC5B,cAAc,EAAE,kEAAkE;QAClF,IAAI,EAAE;YACJ,EAAE,EAAE,0BAA0B;YAC9B,QAAQ,EAAE,EAAE;SACb;KACF;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
+
export declare const pageRevivedLiveTrigger: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pageRevivedLiveTrigger = 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 auth_1 = require("../../lib/common/auth");
|
|
8
|
+
const subscribeWebhook = (auth, event, targetUrl) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
9
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
10
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
11
|
+
url: 'https://api.qwilr.com/v1/webhooks',
|
|
12
|
+
headers: {
|
|
13
|
+
'Authorization': `Bearer ${auth}`,
|
|
14
|
+
'Content-Type': 'application/json'
|
|
15
|
+
},
|
|
16
|
+
body: {
|
|
17
|
+
event,
|
|
18
|
+
targetUrl
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
return response.body;
|
|
22
|
+
});
|
|
23
|
+
const unsubscribeWebhook = (auth, subscriptionId) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
24
|
+
yield pieces_common_1.httpClient.sendRequest({
|
|
25
|
+
method: pieces_common_1.HttpMethod.DELETE,
|
|
26
|
+
url: `https://api.qwilr.com/v1/webhooks/${subscriptionId}`,
|
|
27
|
+
headers: {
|
|
28
|
+
'Authorization': `Bearer ${auth}`
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
exports.pageRevivedLiveTrigger = (0, pieces_framework_1.createTrigger)({
|
|
33
|
+
auth: auth_1.qwilrAuth,
|
|
34
|
+
name: 'page_revived_live',
|
|
35
|
+
displayName: 'Page Revived Live',
|
|
36
|
+
description: 'Triggers when a Qwilr page is revived to live status',
|
|
37
|
+
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
38
|
+
props: {},
|
|
39
|
+
onEnable(context) {
|
|
40
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
var _a;
|
|
42
|
+
const webhookData = yield subscribeWebhook(context.auth.secret_text, 'pageRevivedLive', context.webhookUrl);
|
|
43
|
+
yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.put('_page_revived_live_trigger', {
|
|
44
|
+
subscriptionId: webhookData.id,
|
|
45
|
+
}));
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
onDisable(context) {
|
|
49
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
var _a;
|
|
51
|
+
const response = yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.get('_page_revived_live_trigger'));
|
|
52
|
+
if (response !== null && response !== undefined) {
|
|
53
|
+
yield unsubscribeWebhook(context.auth.secret_text, response.subscriptionId);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
run(context) {
|
|
58
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
return [context.payload.body];
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
sampleData: {
|
|
63
|
+
event: 'pageRevivedLive',
|
|
64
|
+
idempotencyKey: 'b1c51b5b4844a81f7c3745002dbbd871fdda6cabe019961bcc79f972d924a2b0',
|
|
65
|
+
page: {
|
|
66
|
+
id: '6ee0f841f3cc8900090d82dc',
|
|
67
|
+
metadata: {}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
//# sourceMappingURL=page-revived-live.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-revived-live.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/qwilr/src/lib/triggers/page-revived-live.ts"],"names":[],"mappings":";;;;AAAA,qEAAgF;AAChF,+DAAqE;AACrE,gDAAkD;AAElD,MAAM,gBAAgB,GAAG,CAAO,IAAY,EAAE,KAAa,EAAE,SAAiB,EAAE,EAAE;IAChF,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;QAC5C,MAAM,EAAE,0BAAU,CAAC,IAAI;QACvB,GAAG,EAAE,mCAAmC;QACxC,OAAO,EAAE;YACP,eAAe,EAAE,UAAU,IAAI,EAAE;YACjC,cAAc,EAAE,kBAAkB;SACnC;QACD,IAAI,EAAE;YACJ,KAAK;YACL,SAAS;SACV;KACF,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC,IAAI,CAAC;AACvB,CAAC,CAAA,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAO,IAAY,EAAE,cAAsB,EAAE,EAAE;IACxE,MAAM,0BAAU,CAAC,WAAW,CAAC;QAC3B,MAAM,EAAE,0BAAU,CAAC,MAAM;QACzB,GAAG,EAAE,qCAAqC,cAAc,EAAE;QAC1D,OAAO,EAAE;YACP,eAAe,EAAE,UAAU,IAAI,EAAE;SAClC;KACF,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEW,QAAA,sBAAsB,GAAG,IAAA,gCAAa,EAAC;IAClD,IAAI,EAAE,gBAAS;IACf,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,mBAAmB;IAChC,WAAW,EAAE,sDAAsD;IACnE,IAAI,EAAE,kCAAe,CAAC,OAAO;IAC7B,KAAK,EAAE,EAAE;IACH,QAAQ,CAAC,OAAO;;;YACpB,MAAM,WAAW,GAAG,MAAM,gBAAgB,CACxC,OAAO,CAAC,IAAI,CAAC,WAAW,EACxB,iBAAiB,EACjB,OAAO,CAAC,UAAU,CACnB,CAAC;YAEF,MAAM,CAAA,MAAA,OAAO,CAAC,KAAK,0CAAE,GAAG,CAAC,4BAA4B,EAAE;gBACrD,cAAc,EAAE,WAAW,CAAC,EAAE;aAC/B,CAAC,CAAA,CAAC;QACL,CAAC;KAAA;IACK,SAAS,CAAC,OAAO;;;YACrB,MAAM,QAAQ,GAAsC,MAAM,CAAA,MAAA,OAAO,CAAC,KAAK,0CAAE,GAAG,CAAC,4BAA4B,CAAC,CAAA,CAAC;YAE3G,IAAI,QAAQ,KAAK,IAAI,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;gBAChD,MAAM,kBAAkB,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC;YAC9E,CAAC;QACH,CAAC;KAAA;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;KAAA;IACD,UAAU,EAAE;QACV,KAAK,EAAE,iBAAiB;QACxB,cAAc,EAAE,kEAAkE;QAClF,IAAI,EAAE;YACJ,EAAE,EAAE,0BAA0B;YAC9B,QAAQ,EAAE,EAAE;SACb;KACF;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
+
export declare const pageSetLiveTrigger: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pageSetLiveTrigger = 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 auth_1 = require("../../lib/common/auth");
|
|
8
|
+
const subscribeWebhook = (auth, event, targetUrl) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
9
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
10
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
11
|
+
url: 'https://api.qwilr.com/v1/webhooks',
|
|
12
|
+
headers: {
|
|
13
|
+
'Authorization': `Bearer ${auth}`,
|
|
14
|
+
'Content-Type': 'application/json'
|
|
15
|
+
},
|
|
16
|
+
body: {
|
|
17
|
+
event,
|
|
18
|
+
targetUrl
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
return response.body;
|
|
22
|
+
});
|
|
23
|
+
const unsubscribeWebhook = (auth, subscriptionId) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
24
|
+
yield pieces_common_1.httpClient.sendRequest({
|
|
25
|
+
method: pieces_common_1.HttpMethod.DELETE,
|
|
26
|
+
url: `https://api.qwilr.com/v1/webhooks/${subscriptionId}`,
|
|
27
|
+
headers: {
|
|
28
|
+
'Authorization': `Bearer ${auth}`
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
exports.pageSetLiveTrigger = (0, pieces_framework_1.createTrigger)({
|
|
33
|
+
auth: auth_1.qwilrAuth,
|
|
34
|
+
name: 'page_set_live',
|
|
35
|
+
displayName: 'Page Set Live',
|
|
36
|
+
description: 'Triggers when a Qwilr page is set to live',
|
|
37
|
+
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
38
|
+
props: {},
|
|
39
|
+
onEnable(context) {
|
|
40
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
var _a;
|
|
42
|
+
const webhookData = yield subscribeWebhook(context.auth.secret_text, 'pageSetLive', context.webhookUrl);
|
|
43
|
+
yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.put('_page_set_live_trigger', {
|
|
44
|
+
subscriptionId: webhookData.id,
|
|
45
|
+
}));
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
onDisable(context) {
|
|
49
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
var _a;
|
|
51
|
+
const response = yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.get('_page_set_live_trigger'));
|
|
52
|
+
if (response !== null && response !== undefined) {
|
|
53
|
+
yield unsubscribeWebhook(context.auth.secret_text, response.subscriptionId);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
run(context) {
|
|
58
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
return [context.payload.body];
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
sampleData: {
|
|
63
|
+
event: 'pageSetLive',
|
|
64
|
+
idempotencyKey: 'b1c51b5b4844a81f7c3745002dbbd871fdda6cabe019961bcc79f972d924a2b0',
|
|
65
|
+
page: {
|
|
66
|
+
id: '6ee0f841f3cc8900090d82dc',
|
|
67
|
+
metadata: {}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
//# sourceMappingURL=page-set-live.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-set-live.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/qwilr/src/lib/triggers/page-set-live.ts"],"names":[],"mappings":";;;;AAAA,qEAAgF;AAChF,+DAAqE;AACrE,gDAAkD;AAElD,MAAM,gBAAgB,GAAG,CAAO,IAAY,EAAE,KAAa,EAAE,SAAiB,EAAE,EAAE;IAChF,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;QAC5C,MAAM,EAAE,0BAAU,CAAC,IAAI;QACvB,GAAG,EAAE,mCAAmC;QACxC,OAAO,EAAE;YACP,eAAe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AAE,QAAQ,CAAC,cAAc,CAAC,CAAC;YAC9E,CAAC;QACH,CAAC;KAAA;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;KAAA;IACD,UAAU,EAAE;QACV,KAAK,EAAE,aAAa;QACpB,cAAc,EAAE,kEAAkE;QAClF,IAAI,EAAE;YACJ,EAAE,EAAE,0BAA0B;YAC9B,QAAQ,EAAE,EAAE;SACb;KACF;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
+
export declare const pageViewedTrigger: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pageViewedTrigger = 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 auth_1 = require("../../lib/common/auth");
|
|
8
|
+
const subscribeWebhook = (auth, event, targetUrl) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
9
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
10
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
11
|
+
url: 'https://api.qwilr.com/v1/webhooks',
|
|
12
|
+
headers: {
|
|
13
|
+
'Authorization': `Bearer ${auth}`,
|
|
14
|
+
'Content-Type': 'application/json'
|
|
15
|
+
},
|
|
16
|
+
body: {
|
|
17
|
+
event,
|
|
18
|
+
targetUrl
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
return response.body;
|
|
22
|
+
});
|
|
23
|
+
const unsubscribeWebhook = (auth, subscriptionId) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
24
|
+
yield pieces_common_1.httpClient.sendRequest({
|
|
25
|
+
method: pieces_common_1.HttpMethod.DELETE,
|
|
26
|
+
url: `https://api.qwilr.com/v1/webhooks/${subscriptionId}`,
|
|
27
|
+
headers: {
|
|
28
|
+
'Authorization': `Bearer ${auth}`
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
exports.pageViewedTrigger = (0, pieces_framework_1.createTrigger)({
|
|
33
|
+
auth: auth_1.qwilrAuth,
|
|
34
|
+
name: 'page_viewed',
|
|
35
|
+
displayName: 'Page Viewed',
|
|
36
|
+
description: 'Triggers when a Qwilr page is viewed',
|
|
37
|
+
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
38
|
+
props: {},
|
|
39
|
+
onEnable(context) {
|
|
40
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
var _a;
|
|
42
|
+
const webhookData = yield subscribeWebhook(context.auth.secret_text, 'pageViewed', context.webhookUrl);
|
|
43
|
+
yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.put('_page_viewed_trigger', {
|
|
44
|
+
subscriptionId: webhookData.id,
|
|
45
|
+
}));
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
onDisable(context) {
|
|
49
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
var _a;
|
|
51
|
+
const response = yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.get('_page_viewed_trigger'));
|
|
52
|
+
if (response !== null && response !== undefined) {
|
|
53
|
+
yield unsubscribeWebhook(context.auth.secret_text, response.subscriptionId);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
run(context) {
|
|
58
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
return [context.payload.body];
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
sampleData: {
|
|
63
|
+
event: 'pageViewed',
|
|
64
|
+
idempotencyKey: 'b1c51b5b4844a81f7c3745002dbbd871fdda6cabe019961bcc79f972d924a2b0',
|
|
65
|
+
page: {
|
|
66
|
+
id: '6ee0f841f3cc8900090d82dc',
|
|
67
|
+
metadata: {}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
//# sourceMappingURL=page-viewed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-viewed.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/qwilr/src/lib/triggers/page-viewed.ts"],"names":[],"mappings":";;;;AAAA,qEAAgF;AAChF,+DAAqE;AACrE,gDAAkD;AAElD,MAAM,gBAAgB,GAAG,CAAO,IAAY,EAAE,KAAa,EAAE,SAAiB,EAAE,EAAE;IAChF,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;QAC5C,MAAM,EAAE,0BAAU,CAAC,IAAI;QACvB,GAAG,EAAE,mCAAmC;QACxC,OAAO,EAAE;YACP,eAAe,EAAE,UAAU,IAAI,EAAE;YACjC,cAAc,EAAE,kBAAkB;SACnC;QACD,IAAI,EAAE;YACJ,KAAK;YACL,SAAS;SACV;KACF,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC,IAAI,CAAC;AACvB,CAAC,CAAA,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAO,IAAY,EAAE,cAAsB,EAAE,EAAE;IACxE,MAAM,0BAAU,CAAC,WAAW,CAAC;QAC3B,MAAM,EAAE,0BAAU,CAAC,MAAM;QACzB,GAAG,EAAE,qCAAqC,cAAc,EAAE;QAC1D,OAAO,EAAE;YACP,eAAe,EAAE,UAAU,IAAI,E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