@activepieces/piece-klaviyo 0.1.1 → 0.1.3
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/package.json +7 -13
- package/src/index.js +31 -53
- package/src/index.d.ts +0 -2
- package/src/index.d.ts.map +0 -1
- package/src/index.js.map +0 -1
- package/src/lib/actions/add-profile-to-list.d.ts +0 -5
- package/src/lib/actions/add-profile-to-list.d.ts.map +0 -1
- package/src/lib/actions/add-profile-to-list.js +0 -44
- package/src/lib/actions/add-profile-to-list.js.map +0 -1
- package/src/lib/actions/create-list.d.ts +0 -4
- package/src/lib/actions/create-list.d.ts.map +0 -1
- package/src/lib/actions/create-list.js +0 -44
- package/src/lib/actions/create-list.js.map +0 -1
- package/src/lib/actions/create-profile.d.ts +0 -25
- package/src/lib/actions/create-profile.d.ts.map +0 -1
- package/src/lib/actions/create-profile.js +0 -203
- package/src/lib/actions/create-profile.js.map +0 -1
- package/src/lib/actions/find-list-by-name.d.ts +0 -5
- package/src/lib/actions/find-list-by-name.d.ts.map +0 -1
- package/src/lib/actions/find-list-by-name.js +0 -69
- package/src/lib/actions/find-list-by-name.js.map +0 -1
- package/src/lib/actions/find-profile-by-email-phone.d.ts +0 -5
- package/src/lib/actions/find-profile-by-email-phone.d.ts.map +0 -1
- package/src/lib/actions/find-profile-by-email-phone.js +0 -91
- package/src/lib/actions/find-profile-by-email-phone.js.map +0 -1
- package/src/lib/actions/find-tag-by-name.d.ts +0 -4
- package/src/lib/actions/find-tag-by-name.d.ts.map +0 -1
- package/src/lib/actions/find-tag-by-name.js +0 -60
- package/src/lib/actions/find-tag-by-name.js.map +0 -1
- package/src/lib/actions/remove-profile-from-list.d.ts +0 -5
- package/src/lib/actions/remove-profile-from-list.d.ts.map +0 -1
- package/src/lib/actions/remove-profile-from-list.js +0 -47
- package/src/lib/actions/remove-profile-from-list.js.map +0 -1
- package/src/lib/actions/subscribe-profile.d.ts +0 -10
- package/src/lib/actions/subscribe-profile.d.ts.map +0 -1
- package/src/lib/actions/subscribe-profile.js +0 -121
- package/src/lib/actions/subscribe-profile.js.map +0 -1
- package/src/lib/actions/unsubscribe-profile.d.ts +0 -8
- package/src/lib/actions/unsubscribe-profile.d.ts.map +0 -1
- package/src/lib/actions/unsubscribe-profile.js +0 -105
- package/src/lib/actions/unsubscribe-profile.js.map +0 -1
- package/src/lib/actions/update-profile.d.ts +0 -27
- package/src/lib/actions/update-profile.d.ts.map +0 -1
- package/src/lib/actions/update-profile.js +0 -216
- package/src/lib/actions/update-profile.js.map +0 -1
- package/src/lib/common/auth.d.ts +0 -5
- package/src/lib/common/auth.d.ts.map +0 -1
- package/src/lib/common/auth.js +0 -76
- package/src/lib/common/auth.js.map +0 -1
- package/src/lib/common/client.d.ts +0 -7
- package/src/lib/common/client.d.ts.map +0 -1
- package/src/lib/common/client.js +0 -82
- package/src/lib/common/client.js.map +0 -1
- package/src/lib/common/props.d.ts +0 -6
- package/src/lib/common/props.d.ts.map +0 -1
- package/src/lib/common/props.js +0 -129
- package/src/lib/common/props.js.map +0 -1
- package/src/lib/triggers/new-profile.d.ts +0 -3
- package/src/lib/triggers/new-profile.d.ts.map +0 -1
- package/src/lib/triggers/new-profile.js +0 -144
- package/src/lib/triggers/new-profile.js.map +0 -1
- package/src/lib/triggers/profile-added-to-list-segment.d.ts +0 -19
- package/src/lib/triggers/profile-added-to-list-segment.d.ts.map +0 -1
- package/src/lib/triggers/profile-added-to-list-segment.js +0 -232
- package/src/lib/triggers/profile-added-to-list-segment.js.map +0 -1
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare const subscribeProfile: import("@activepieces/pieces-framework").IAction<(import("@activepieces/pieces-framework").SecretTextProperty<true> | import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>)[], {
|
|
2
|
-
list_id: import("@activepieces/pieces-framework").DropdownProperty<string, true, (import("@activepieces/pieces-framework").SecretTextProperty<true> | import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>)[]>;
|
|
3
|
-
profile_ids: import("@activepieces/pieces-framework").MultiSelectDropdownProperty<string, true, (import("@activepieces/pieces-framework").SecretTextProperty<true> | import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>)[]>;
|
|
4
|
-
subscribe_email: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
5
|
-
subscribe_sms: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
6
|
-
historical_import: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
7
|
-
consented_at: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
-
custom_source: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
9
|
-
}>;
|
|
10
|
-
//# sourceMappingURL=subscribe-profile.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subscribe-profile.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/subscribe-profile.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,gBAAgB;;;;;;;;EAqI3B,CAAC"}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.subscribeProfile = 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 props_1 = require("../common/props");
|
|
8
|
-
const client_1 = require("../common/client");
|
|
9
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
10
|
-
exports.subscribeProfile = (0, pieces_framework_1.createAction)({
|
|
11
|
-
auth: auth_1.klaviyoAuth,
|
|
12
|
-
name: 'subscribeProfile',
|
|
13
|
-
displayName: 'Subscribe Profile',
|
|
14
|
-
description: 'Subscribe profiles to email or SMS marketing on a list.',
|
|
15
|
-
props: {
|
|
16
|
-
list_id: props_1.listIdDropdown,
|
|
17
|
-
profile_ids: props_1.profileIdsMultiSelectDropdown,
|
|
18
|
-
subscribe_email: pieces_framework_1.Property.Checkbox({
|
|
19
|
-
displayName: 'Subscribe to Email',
|
|
20
|
-
description: 'Subscribe selected profiles to email marketing.',
|
|
21
|
-
required: false,
|
|
22
|
-
defaultValue: true,
|
|
23
|
-
}),
|
|
24
|
-
subscribe_sms: pieces_framework_1.Property.Checkbox({
|
|
25
|
-
displayName: 'Subscribe to SMS',
|
|
26
|
-
description: 'Subscribe selected profiles to SMS marketing.',
|
|
27
|
-
required: false,
|
|
28
|
-
defaultValue: false,
|
|
29
|
-
}),
|
|
30
|
-
historical_import: pieces_framework_1.Property.Checkbox({
|
|
31
|
-
displayName: 'Historical Import',
|
|
32
|
-
description: 'Bypass double opt-in and mark as a historical import.',
|
|
33
|
-
required: false,
|
|
34
|
-
defaultValue: false,
|
|
35
|
-
}),
|
|
36
|
-
consented_at: pieces_framework_1.Property.ShortText({
|
|
37
|
-
displayName: 'Consent Date',
|
|
38
|
-
description: 'ISO 8601 datetime when consent was given (required for historical import, e.g. 2024-01-15T10:00:00Z).',
|
|
39
|
-
required: false,
|
|
40
|
-
}),
|
|
41
|
-
custom_source: pieces_framework_1.Property.ShortText({
|
|
42
|
-
displayName: 'Custom Source',
|
|
43
|
-
description: 'Label for the subscription source (e.g. "Website Form").',
|
|
44
|
-
required: false,
|
|
45
|
-
}),
|
|
46
|
-
},
|
|
47
|
-
run(_a) {
|
|
48
|
-
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
|
|
49
|
-
var _b;
|
|
50
|
-
const { list_id, profile_ids: rawProfileIds, subscribe_email, subscribe_sms, historical_import, consented_at, custom_source, } = propsValue;
|
|
51
|
-
const profile_ids = (0, client_1.normalizeProfileIds)(rawProfileIds);
|
|
52
|
-
if (!profile_ids || profile_ids.length === 0) {
|
|
53
|
-
throw new Error('At least one profile must be selected.');
|
|
54
|
-
}
|
|
55
|
-
if (profile_ids.length > 1000) {
|
|
56
|
-
throw new Error('Maximum of 1000 profiles can be subscribed at once.');
|
|
57
|
-
}
|
|
58
|
-
if (!subscribe_email && !subscribe_sms) {
|
|
59
|
-
throw new Error('At least one subscription channel must be selected (Email or SMS).');
|
|
60
|
-
}
|
|
61
|
-
if (historical_import && !consented_at) {
|
|
62
|
-
throw new Error('Consent Date is required when Historical Import is enabled.');
|
|
63
|
-
}
|
|
64
|
-
// Batch-fetch profile details to include email/phone_number (required by Klaviyo)
|
|
65
|
-
const profileMap = yield (0, client_1.fetchProfilesByIds)(auth, profile_ids);
|
|
66
|
-
const profileData = profile_ids.map((profileId) => {
|
|
67
|
-
var _a;
|
|
68
|
-
const attrs = (_a = profileMap.get(profileId)) !== null && _a !== void 0 ? _a : {};
|
|
69
|
-
const subscriptions = {};
|
|
70
|
-
if (subscribe_email) {
|
|
71
|
-
subscriptions.email = { marketing: { consent: 'SUBSCRIBED' } };
|
|
72
|
-
if (historical_import && consented_at) {
|
|
73
|
-
subscriptions.email.marketing.consented_at = consented_at;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
if (subscribe_sms) {
|
|
77
|
-
subscriptions.sms = { marketing: { consent: 'SUBSCRIBED' } };
|
|
78
|
-
if (historical_import && consented_at) {
|
|
79
|
-
subscriptions.sms.marketing.consented_at = consented_at;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
const profileAttrs = { subscriptions };
|
|
83
|
-
if (subscribe_email && attrs.email)
|
|
84
|
-
profileAttrs.email = attrs.email;
|
|
85
|
-
if (subscribe_sms && attrs.phone_number)
|
|
86
|
-
profileAttrs.phone_number = attrs.phone_number;
|
|
87
|
-
return { type: 'profile', id: profileId, attributes: profileAttrs };
|
|
88
|
-
});
|
|
89
|
-
const requestBody = {
|
|
90
|
-
data: {
|
|
91
|
-
type: 'profile-subscription-bulk-create-job',
|
|
92
|
-
attributes: {
|
|
93
|
-
profiles: { data: profileData },
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
};
|
|
97
|
-
if (list_id) {
|
|
98
|
-
requestBody.data.relationships = {
|
|
99
|
-
list: { data: { type: 'list', id: list_id } },
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
if (custom_source) {
|
|
103
|
-
requestBody.data.attributes.custom_source = custom_source;
|
|
104
|
-
}
|
|
105
|
-
if (historical_import) {
|
|
106
|
-
requestBody.data.attributes.historical_import = true;
|
|
107
|
-
}
|
|
108
|
-
const response = yield (0, client_1.makeRequest)(auth, pieces_common_1.HttpMethod.POST, '/profile-subscription-bulk-create-jobs', requestBody);
|
|
109
|
-
return {
|
|
110
|
-
success: true,
|
|
111
|
-
job_id: (_b = response === null || response === void 0 ? void 0 : response.data) === null || _b === void 0 ? void 0 : _b.id,
|
|
112
|
-
profiles_count: profileData.length,
|
|
113
|
-
list_id: list_id || null,
|
|
114
|
-
subscribed_email: subscribe_email !== null && subscribe_email !== void 0 ? subscribe_email : false,
|
|
115
|
-
subscribed_sms: subscribe_sms !== null && subscribe_sms !== void 0 ? subscribe_sms : false,
|
|
116
|
-
historical_import: historical_import !== null && historical_import !== void 0 ? historical_import : false,
|
|
117
|
-
};
|
|
118
|
-
});
|
|
119
|
-
},
|
|
120
|
-
});
|
|
121
|
-
//# sourceMappingURL=subscribe-profile.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subscribe-profile.js","sourceRoot":"","sources":["../../../../src/lib/actions/subscribe-profile.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,yCAA+D;AAC/D,2CAAgF;AAChF,6CAAwF;AACxF,+DAAyD;AAE5C,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IAC3C,IAAI,EAAE,kBAAW;IACjB,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,mBAAmB;IAChC,WAAW,EAAE,yDAAyD;IACtE,KAAK,EAAE;QACL,OAAO,EAAE,sBAAc;QACvB,WAAW,EAAE,qCAA6B;QAC1C,e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K;gBACtC,iBAAiB,EAAE,iBAAiB,aAAjB,iBAAiB,cAAjB,iBAAiB,GAAI,KAAK;aAC9C,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare const unsubscribeProfile: import("@activepieces/pieces-framework").IAction<(import("@activepieces/pieces-framework").SecretTextProperty<true> | import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>)[], {
|
|
2
|
-
list_id: import("@activepieces/pieces-framework").DropdownProperty<string, true, (import("@activepieces/pieces-framework").SecretTextProperty<true> | import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>)[]>;
|
|
3
|
-
profile_ids: import("@activepieces/pieces-framework").MultiSelectDropdownProperty<string, true, (import("@activepieces/pieces-framework").SecretTextProperty<true> | import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>)[]>;
|
|
4
|
-
unsubscribe_email: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
5
|
-
unsubscribe_sms: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
6
|
-
unsubscribe_sms_transactional: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
7
|
-
}>;
|
|
8
|
-
//# sourceMappingURL=unsubscribe-profile.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unsubscribe-profile.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/unsubscribe-profile.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,kBAAkB;;;;;;EA4H7B,CAAC"}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.unsubscribeProfile = 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 props_1 = require("../common/props");
|
|
8
|
-
const client_1 = require("../common/client");
|
|
9
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
10
|
-
exports.unsubscribeProfile = (0, pieces_framework_1.createAction)({
|
|
11
|
-
auth: auth_1.klaviyoAuth,
|
|
12
|
-
name: 'unsubscribeProfile',
|
|
13
|
-
displayName: 'Unsubscribe Profile',
|
|
14
|
-
description: 'Unsubscribe profiles from email or SMS marketing on a list.',
|
|
15
|
-
props: {
|
|
16
|
-
list_id: props_1.listIdDropdown,
|
|
17
|
-
profile_ids: props_1.profileIdsMultiSelectDropdown,
|
|
18
|
-
unsubscribe_email: pieces_framework_1.Property.Checkbox({
|
|
19
|
-
displayName: 'Unsubscribe from Email',
|
|
20
|
-
description: 'Unsubscribe selected profiles from email marketing.',
|
|
21
|
-
required: false,
|
|
22
|
-
defaultValue: true,
|
|
23
|
-
}),
|
|
24
|
-
unsubscribe_sms: pieces_framework_1.Property.Checkbox({
|
|
25
|
-
displayName: 'Unsubscribe from SMS',
|
|
26
|
-
description: 'Unsubscribe selected profiles from SMS marketing.',
|
|
27
|
-
required: false,
|
|
28
|
-
defaultValue: false,
|
|
29
|
-
}),
|
|
30
|
-
unsubscribe_sms_transactional: pieces_framework_1.Property.Checkbox({
|
|
31
|
-
displayName: 'Unsubscribe from SMS Transactional',
|
|
32
|
-
description: 'Unsubscribe selected profiles from SMS transactional messages.',
|
|
33
|
-
required: false,
|
|
34
|
-
defaultValue: false,
|
|
35
|
-
}),
|
|
36
|
-
},
|
|
37
|
-
run(_a) {
|
|
38
|
-
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
|
|
39
|
-
var _b;
|
|
40
|
-
const { list_id, profile_ids: rawProfileIds, unsubscribe_email, unsubscribe_sms, unsubscribe_sms_transactional, } = propsValue;
|
|
41
|
-
const profile_ids = (0, client_1.normalizeProfileIds)(rawProfileIds);
|
|
42
|
-
if (!profile_ids || profile_ids.length === 0) {
|
|
43
|
-
throw new Error('At least one profile must be selected.');
|
|
44
|
-
}
|
|
45
|
-
if (profile_ids.length > 100) {
|
|
46
|
-
throw new Error('Maximum of 100 profiles can be unsubscribed at once.');
|
|
47
|
-
}
|
|
48
|
-
if (!unsubscribe_email &&
|
|
49
|
-
!unsubscribe_sms &&
|
|
50
|
-
!unsubscribe_sms_transactional) {
|
|
51
|
-
throw new Error('At least one unsubscribe channel must be selected.');
|
|
52
|
-
}
|
|
53
|
-
// Fetch profile details to include email/phone_number
|
|
54
|
-
const profileDetails = yield Promise.all(profile_ids.map((id) => (0, client_1.makeRequest)(auth, pieces_common_1.HttpMethod.GET, `/profiles/${id}`, {})));
|
|
55
|
-
const profileData = profile_ids.map((profileId, index) => {
|
|
56
|
-
var _a, _b, _c;
|
|
57
|
-
const attrs = (_c = (_b = (_a = profileDetails[index]) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.attributes) !== null && _c !== void 0 ? _c : {};
|
|
58
|
-
const subscriptions = {};
|
|
59
|
-
if (unsubscribe_email) {
|
|
60
|
-
subscriptions.email = { marketing: { consent: 'UNSUBSCRIBED' } };
|
|
61
|
-
}
|
|
62
|
-
if (unsubscribe_sms) {
|
|
63
|
-
subscriptions.sms = subscriptions.sms || {};
|
|
64
|
-
subscriptions.sms.marketing = { consent: 'UNSUBSCRIBED' };
|
|
65
|
-
}
|
|
66
|
-
if (unsubscribe_sms_transactional) {
|
|
67
|
-
subscriptions.sms = subscriptions.sms || {};
|
|
68
|
-
subscriptions.sms.transactional = { consent: 'UNSUBSCRIBED' };
|
|
69
|
-
}
|
|
70
|
-
const profileAttrs = { subscriptions };
|
|
71
|
-
if (unsubscribe_email && attrs.email)
|
|
72
|
-
profileAttrs.email = attrs.email;
|
|
73
|
-
if ((unsubscribe_sms || unsubscribe_sms_transactional) &&
|
|
74
|
-
attrs.phone_number) {
|
|
75
|
-
profileAttrs.phone_number = attrs.phone_number;
|
|
76
|
-
}
|
|
77
|
-
return { type: 'profile', id: profileId, attributes: profileAttrs };
|
|
78
|
-
});
|
|
79
|
-
const requestBody = {
|
|
80
|
-
data: {
|
|
81
|
-
type: 'profile-subscription-bulk-delete-job',
|
|
82
|
-
attributes: {
|
|
83
|
-
profiles: { data: profileData },
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
};
|
|
87
|
-
if (list_id) {
|
|
88
|
-
requestBody.data.relationships = {
|
|
89
|
-
list: { data: { type: 'list', id: list_id } },
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
const response = yield (0, client_1.makeRequest)(auth, pieces_common_1.HttpMethod.POST, '/profile-subscription-bulk-delete-jobs', requestBody);
|
|
93
|
-
return {
|
|
94
|
-
success: true,
|
|
95
|
-
job_id: (_b = response === null || response === void 0 ? void 0 : response.data) === null || _b === void 0 ? void 0 : _b.id,
|
|
96
|
-
profiles_count: profileData.length,
|
|
97
|
-
list_id: list_id || null,
|
|
98
|
-
unsubscribed_email: unsubscribe_email !== null && unsubscribe_email !== void 0 ? unsubscribe_email : false,
|
|
99
|
-
unsubscribed_sms: unsubscribe_sms !== null && unsubscribe_sms !== void 0 ? unsubscribe_sms : false,
|
|
100
|
-
unsubscribed_sms_transactional: unsubscribe_sms_transactional !== null && unsubscribe_sms_transactional !== void 0 ? unsubscribe_sms_transactional : false,
|
|
101
|
-
};
|
|
102
|
-
});
|
|
103
|
-
},
|
|
104
|
-
});
|
|
105
|
-
//# sourceMappingURL=unsubscribe-profile.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unsubscribe-profile.js","sourceRoot":"","sources":["../../../../src/lib/actions/unsubscribe-profile.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,yCAA+D;AAC/D,2CAAgF;AAChF,6CAAoE;AACpE,+DAAyD;AAE5C,QAAA,kBAAkB,GAAG,IAAA,+BAAY,EAAC;IAC7C,IAAI,EAAE,kBAAW;IACjB,IAAI,EAAE,oBAAoB;IAC1B,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,CAAC,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;gBACjD,CAAC;gBAED,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC;YACtE,CAAC,CAAC,CAAC;YAEH,MAAM,WAAW,GAAQ;gBACvB,IAAI,EAAE;oBACJ,IAAI,EAAE,sCAAsC;oBAC5C,UAAU,EAAE;wBACV,QAAQ,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;qBAChC;iBACF;aACF,CAAC;YAEF,IAAI,OAAO,EAAE,CAAC;gBACZ,WAAW,CAAC,IAAI,CAAC,aAAa,GAAG;oBAC/B,IAAI,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE;iBAC9C,CAAC;YACJ,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAW,EAChC,IAAmC,EACnC,0BAAU,CAAC,IAAI,EACf,wCAAwC,EACxC,WAAW,CACZ,CAAC;YAEF,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,MAAM,EAAE,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,0CAAE,EAAE;gBAC1B,cAAc,EAAE,WAAW,CAAC,MAAM;gBAClC,OAAO,EAAE,OAAO,IAAI,IAAI;gBACxB,kBAAkB,EAAE,iBAAiB,aAAjB,iBAAiB,cAAjB,iBAAiB,GAAI,KAAK;gBAC9C,gBAAgB,EAAE,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,KAAK;gBAC1C,8BAA8B,EAAE,6BAA6B,aAA7B,6BAA6B,cAA7B,6BAA6B,GAAI,KAAK;aACvE,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export declare const updateProfile: import("@activepieces/pieces-framework").IAction<(import("@activepieces/pieces-framework").SecretTextProperty<true> | import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>)[], {
|
|
2
|
-
profile_id: import("@activepieces/pieces-framework").DropdownProperty<string, true, (import("@activepieces/pieces-framework").SecretTextProperty<true> | import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>)[]>;
|
|
3
|
-
email: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
4
|
-
phone_number: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
5
|
-
external_id: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
-
anonymous_id: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
7
|
-
first_name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
-
last_name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
9
|
-
organization: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
10
|
-
locale: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
11
|
-
title: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
12
|
-
image: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
13
|
-
address1: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
14
|
-
address2: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
15
|
-
city: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
16
|
-
country: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
17
|
-
region: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
18
|
-
zip: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
19
|
-
timezone: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
20
|
-
ip: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
21
|
-
latitude: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
22
|
-
longitude: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
23
|
-
custom_properties: import("@activepieces/pieces-framework").ObjectProperty<false>;
|
|
24
|
-
include_subscriptions: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
25
|
-
include_predictive_analytics: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
26
|
-
}>;
|
|
27
|
-
//# sourceMappingURL=update-profile.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-profile.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/update-profile.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;EAqOxB,CAAC"}
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateProfile = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const props_1 = require("../common/props");
|
|
7
|
-
const auth_1 = require("../common/auth");
|
|
8
|
-
const client_1 = require("../common/client");
|
|
9
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
10
|
-
exports.updateProfile = (0, pieces_framework_1.createAction)({
|
|
11
|
-
auth: auth_1.klaviyoAuth,
|
|
12
|
-
name: 'updateProfile',
|
|
13
|
-
displayName: 'Update Profile',
|
|
14
|
-
description: 'Update existing profile data and preferences.',
|
|
15
|
-
props: {
|
|
16
|
-
profile_id: props_1.profileIdDropdown,
|
|
17
|
-
email: pieces_framework_1.Property.ShortText({
|
|
18
|
-
displayName: 'Email',
|
|
19
|
-
description: "Individual's email address",
|
|
20
|
-
required: false,
|
|
21
|
-
}),
|
|
22
|
-
phone_number: pieces_framework_1.Property.ShortText({
|
|
23
|
-
displayName: 'Phone Number',
|
|
24
|
-
description: 'Phone number in E.164 format (e.g., +15005550006)',
|
|
25
|
-
required: false,
|
|
26
|
-
}),
|
|
27
|
-
external_id: pieces_framework_1.Property.ShortText({
|
|
28
|
-
displayName: 'External ID',
|
|
29
|
-
description: 'Unique identifier from external system (e.g., POS system)',
|
|
30
|
-
required: false,
|
|
31
|
-
}),
|
|
32
|
-
anonymous_id: pieces_framework_1.Property.ShortText({
|
|
33
|
-
displayName: 'Anonymous ID',
|
|
34
|
-
description: 'Anonymous identifier for the profile',
|
|
35
|
-
required: false,
|
|
36
|
-
}),
|
|
37
|
-
first_name: pieces_framework_1.Property.ShortText({
|
|
38
|
-
displayName: 'First Name',
|
|
39
|
-
description: "Individual's first name",
|
|
40
|
-
required: false,
|
|
41
|
-
}),
|
|
42
|
-
last_name: pieces_framework_1.Property.ShortText({
|
|
43
|
-
displayName: 'Last Name',
|
|
44
|
-
description: "Individual's last name",
|
|
45
|
-
required: false,
|
|
46
|
-
}),
|
|
47
|
-
organization: pieces_framework_1.Property.ShortText({
|
|
48
|
-
displayName: 'Organization',
|
|
49
|
-
description: 'Company or organization name',
|
|
50
|
-
required: false,
|
|
51
|
-
}),
|
|
52
|
-
locale: pieces_framework_1.Property.ShortText({
|
|
53
|
-
displayName: 'Locale',
|
|
54
|
-
description: 'Locale in IETF BCP 47 format (e.g., en-US)',
|
|
55
|
-
required: false,
|
|
56
|
-
}),
|
|
57
|
-
title: pieces_framework_1.Property.ShortText({
|
|
58
|
-
displayName: 'Title',
|
|
59
|
-
description: "Individual's job title",
|
|
60
|
-
required: false,
|
|
61
|
-
}),
|
|
62
|
-
image: pieces_framework_1.Property.ShortText({
|
|
63
|
-
displayName: 'Image URL',
|
|
64
|
-
description: 'URL pointing to profile image location',
|
|
65
|
-
required: false,
|
|
66
|
-
}),
|
|
67
|
-
// Location fields
|
|
68
|
-
address1: pieces_framework_1.Property.ShortText({
|
|
69
|
-
displayName: 'Address 1',
|
|
70
|
-
description: 'First line of street address',
|
|
71
|
-
required: false,
|
|
72
|
-
}),
|
|
73
|
-
address2: pieces_framework_1.Property.ShortText({
|
|
74
|
-
displayName: 'Address 2',
|
|
75
|
-
description: 'Second line of street address',
|
|
76
|
-
required: false,
|
|
77
|
-
}),
|
|
78
|
-
city: pieces_framework_1.Property.ShortText({
|
|
79
|
-
displayName: 'City',
|
|
80
|
-
description: 'City name',
|
|
81
|
-
required: false,
|
|
82
|
-
}),
|
|
83
|
-
country: props_1.countryCode,
|
|
84
|
-
region: pieces_framework_1.Property.ShortText({
|
|
85
|
-
displayName: 'Region',
|
|
86
|
-
description: 'Region within country (state/province)',
|
|
87
|
-
required: false,
|
|
88
|
-
}),
|
|
89
|
-
zip: pieces_framework_1.Property.ShortText({
|
|
90
|
-
displayName: 'Zip Code',
|
|
91
|
-
description: 'Postal/zip code',
|
|
92
|
-
required: false,
|
|
93
|
-
}),
|
|
94
|
-
timezone: pieces_framework_1.Property.ShortText({
|
|
95
|
-
displayName: 'Timezone',
|
|
96
|
-
description: 'IANA timezone (e.g., America/New_York)',
|
|
97
|
-
required: false,
|
|
98
|
-
}),
|
|
99
|
-
ip: pieces_framework_1.Property.ShortText({
|
|
100
|
-
displayName: 'IP Address',
|
|
101
|
-
description: 'IP address of the profile',
|
|
102
|
-
required: false,
|
|
103
|
-
}),
|
|
104
|
-
latitude: pieces_framework_1.Property.Number({
|
|
105
|
-
displayName: 'Latitude',
|
|
106
|
-
description: 'Latitude coordinate (4 decimal places recommended)',
|
|
107
|
-
required: false,
|
|
108
|
-
}),
|
|
109
|
-
longitude: pieces_framework_1.Property.Number({
|
|
110
|
-
displayName: 'Longitude',
|
|
111
|
-
description: 'Longitude coordinate (4 decimal places recommended)',
|
|
112
|
-
required: false,
|
|
113
|
-
}),
|
|
114
|
-
custom_properties: pieces_framework_1.Property.Object({
|
|
115
|
-
displayName: 'Custom Properties',
|
|
116
|
-
description: 'Key/value pairs for custom profile properties',
|
|
117
|
-
required: false,
|
|
118
|
-
}),
|
|
119
|
-
include_subscriptions: pieces_framework_1.Property.Checkbox({
|
|
120
|
-
displayName: 'Include Subscriptions',
|
|
121
|
-
description: 'Include subscription data in response',
|
|
122
|
-
required: false,
|
|
123
|
-
defaultValue: false,
|
|
124
|
-
}),
|
|
125
|
-
include_predictive_analytics: pieces_framework_1.Property.Checkbox({
|
|
126
|
-
displayName: 'Include Predictive Analytics',
|
|
127
|
-
description: 'Include predictive analytics data in response',
|
|
128
|
-
required: false,
|
|
129
|
-
defaultValue: false,
|
|
130
|
-
}),
|
|
131
|
-
},
|
|
132
|
-
run(_a) {
|
|
133
|
-
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
|
|
134
|
-
const { profile_id, email, phone_number, external_id, anonymous_id, first_name, last_name, organization, locale, title, image, address1, address2, city, country, region, zip, timezone, ip, latitude, longitude, custom_properties, include_subscriptions, include_predictive_analytics, } = propsValue;
|
|
135
|
-
const attributes = {};
|
|
136
|
-
if (email !== undefined)
|
|
137
|
-
attributes['email'] = email;
|
|
138
|
-
if (phone_number !== undefined)
|
|
139
|
-
attributes['phone_number'] = phone_number;
|
|
140
|
-
if (external_id !== undefined)
|
|
141
|
-
attributes['external_id'] = external_id;
|
|
142
|
-
if (anonymous_id !== undefined)
|
|
143
|
-
attributes['anonymous_id'] = anonymous_id;
|
|
144
|
-
if (first_name !== undefined)
|
|
145
|
-
attributes['first_name'] = first_name;
|
|
146
|
-
if (last_name !== undefined)
|
|
147
|
-
attributes['last_name'] = last_name;
|
|
148
|
-
if (organization !== undefined)
|
|
149
|
-
attributes['organization'] = organization;
|
|
150
|
-
if (locale !== undefined)
|
|
151
|
-
attributes['locale'] = locale;
|
|
152
|
-
if (title !== undefined)
|
|
153
|
-
attributes['title'] = title;
|
|
154
|
-
if (image !== undefined)
|
|
155
|
-
attributes['image'] = image;
|
|
156
|
-
const hasLocationData = address1 !== undefined ||
|
|
157
|
-
address2 !== undefined ||
|
|
158
|
-
city !== undefined ||
|
|
159
|
-
country !== undefined ||
|
|
160
|
-
region !== undefined ||
|
|
161
|
-
zip !== undefined ||
|
|
162
|
-
timezone !== undefined ||
|
|
163
|
-
ip !== undefined ||
|
|
164
|
-
latitude !== undefined ||
|
|
165
|
-
longitude !== undefined;
|
|
166
|
-
if (hasLocationData) {
|
|
167
|
-
const location = {};
|
|
168
|
-
if (address1 !== undefined)
|
|
169
|
-
location['address1'] = address1;
|
|
170
|
-
if (address2 !== undefined)
|
|
171
|
-
location['address2'] = address2;
|
|
172
|
-
if (city !== undefined)
|
|
173
|
-
location['city'] = city;
|
|
174
|
-
if (country !== undefined)
|
|
175
|
-
location['country'] = country;
|
|
176
|
-
if (region !== undefined)
|
|
177
|
-
location['region'] = region;
|
|
178
|
-
if (zip !== undefined)
|
|
179
|
-
location['zip'] = zip;
|
|
180
|
-
if (timezone !== undefined)
|
|
181
|
-
location['timezone'] = timezone;
|
|
182
|
-
if (ip !== undefined)
|
|
183
|
-
location['ip'] = ip;
|
|
184
|
-
if (latitude !== undefined)
|
|
185
|
-
location['latitude'] = latitude;
|
|
186
|
-
if (longitude !== undefined)
|
|
187
|
-
location['longitude'] = longitude;
|
|
188
|
-
attributes['location'] = location;
|
|
189
|
-
}
|
|
190
|
-
if (custom_properties !== undefined) {
|
|
191
|
-
attributes['properties'] = custom_properties;
|
|
192
|
-
}
|
|
193
|
-
const body = {
|
|
194
|
-
data: {
|
|
195
|
-
type: 'profile',
|
|
196
|
-
id: profile_id,
|
|
197
|
-
attributes,
|
|
198
|
-
},
|
|
199
|
-
};
|
|
200
|
-
const queryParams = [];
|
|
201
|
-
const additionalFields = [];
|
|
202
|
-
if (include_subscriptions) {
|
|
203
|
-
additionalFields.push('subscriptions');
|
|
204
|
-
}
|
|
205
|
-
if (include_predictive_analytics) {
|
|
206
|
-
additionalFields.push('predictive_analytics');
|
|
207
|
-
}
|
|
208
|
-
if (additionalFields.length > 0) {
|
|
209
|
-
queryParams.push(`additional-fields[profile]=${additionalFields.join(',')}`);
|
|
210
|
-
}
|
|
211
|
-
const queryString = queryParams.length > 0 ? `?${queryParams.join('&')}` : '';
|
|
212
|
-
return yield (0, client_1.makeRequest)(auth, pieces_common_1.HttpMethod.PATCH, `/profiles/${profile_id}${queryString}`, body);
|
|
213
|
-
});
|
|
214
|
-
},
|
|
215
|
-
});
|
|
216
|
-
//# sourceMappingURL=update-profile.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-profile.js","sourceRoot":"","sources":["../../../../src/lib/actions/update-profile.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,2CAAiE;AACjE,yCAA+D;AAC/D,6CAA+C;AAC/C,+DAAyD;AAE5C,QAAA,aAAa,GAAG,IAAA,+BAAY,EAAC;IACxC,IAAI,EAAE,kBAAW;IACjB,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,+CAA+C;IAC5D,KAAK,EAAE;QACL,UAAU,EAAE,yBAAiB;QAC7B,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,4BAA4B;YACzC,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,YAAY,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC/B,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,mDAAmD;YAChE,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,WAAW,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC9B,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,2DAA2D;YACxE,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,YAAY,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC/B,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,sCAAsC;YACnD,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,yBAAyB;YACtC,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC5B,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,wBAAwB;YACrC,QAAQ,EAAE,K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EF,MAAM,WAAW,GAAa,EAAE,CAAC;YACjC,MAAM,gBAAgB,GAAa,EAAE,CAAC;YAEtC,IAAI,qBAAqB,EAAE,CAAC;gBAC1B,gBAAgB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YACzC,CAAC;YACD,IAAI,4BAA4B,EAAE,CAAC;gBACjC,gBAAgB,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;YAChD,CAAC;YAED,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAChC,WAAW,CAAC,IAAI,CACd,8BAA8B,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAC3D,CAAC;YACJ,CAAC;YAED,MAAM,WAAW,GACf,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAE5D,OAAO,MAAM,IAAA,oBAAW,EACtB,IAAwB,EACxB,0BAAU,CAAC,KAAK,EAChB,aAAa,UAAU,GAAG,WAAW,EAAE,EACvC,IAAI,CACL,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
|
package/src/lib/common/auth.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { AppConnectionValueForAuthProperty } from '@activepieces/pieces-framework';
|
|
2
|
-
export declare const klaviyoAuth: (import("@activepieces/pieces-framework").SecretTextProperty<true> | import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>)[];
|
|
3
|
-
export type KlaviyoAuthValue = AppConnectionValueForAuthProperty<typeof klaviyoAuth>;
|
|
4
|
-
export declare function getAuthorizationHeader(auth: KlaviyoAuthValue): string;
|
|
5
|
-
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,EAGlC,MAAM,gCAAgC,CAAC;AAIxC,eAAO,MAAM,WAAW,uLA4DvB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,iCAAiC,CAC9D,OAAO,WAAW,CACnB,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM,CAKrE"}
|
package/src/lib/common/auth.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.klaviyoAuth = void 0;
|
|
4
|
-
exports.getAuthorizationHeader = getAuthorizationHeader;
|
|
5
|
-
const tslib_1 = require("tslib");
|
|
6
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
8
|
-
const shared_1 = require("@activepieces/shared");
|
|
9
|
-
exports.klaviyoAuth = [
|
|
10
|
-
pieces_framework_1.PieceAuth.SecretText({
|
|
11
|
-
displayName: 'Private API Key',
|
|
12
|
-
description: `Authenticate using your Klaviyo Private API Key.\n\n**Steps:**\n1. Log in to Klaviyo → go to **Settings → API Keys**\n2. Click **Create Private API Key**\n3. Give it a name and select the required scopes\n4. Copy the key (starts with \`pk_\`) and paste it below`,
|
|
13
|
-
required: true,
|
|
14
|
-
validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
15
|
-
try {
|
|
16
|
-
yield pieces_common_1.httpClient.sendRequest({
|
|
17
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
18
|
-
url: 'https://a.klaviyo.com/api/accounts',
|
|
19
|
-
headers: {
|
|
20
|
-
Authorization: `Klaviyo-API-Key ${auth}`,
|
|
21
|
-
revision: '2025-04-15',
|
|
22
|
-
accept: 'application/vnd.api+json',
|
|
23
|
-
},
|
|
24
|
-
});
|
|
25
|
-
return { valid: true };
|
|
26
|
-
}
|
|
27
|
-
catch (e) {
|
|
28
|
-
return {
|
|
29
|
-
valid: false,
|
|
30
|
-
error: 'Invalid Private API Key. Check your key in Klaviyo → Settings → API Keys.',
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
}),
|
|
34
|
-
}),
|
|
35
|
-
pieces_framework_1.PieceAuth.OAuth2({
|
|
36
|
-
description: `
|
|
37
|
-
To connect via OAuth2, follow the [Klaviyo OAuth setup guide](https://developers.klaviyo.com/en/docs/set_up_oauth) to register your app, then set the **Redirect URI** to {{redirectUrl}} and enable the following **scopes** in your app settings:
|
|
38
|
-
- profiles:read
|
|
39
|
-
- profiles:write
|
|
40
|
-
- lists:read
|
|
41
|
-
- lists:write
|
|
42
|
-
- tags:read
|
|
43
|
-
- segments:read
|
|
44
|
-
- events:read
|
|
45
|
-
- events:write
|
|
46
|
-
- subscriptions:read
|
|
47
|
-
- subscriptions:write
|
|
48
|
-
- accounts:read`,
|
|
49
|
-
authUrl: 'https://www.klaviyo.com/oauth/authorize',
|
|
50
|
-
tokenUrl: 'https://a.klaviyo.com/oauth/token',
|
|
51
|
-
required: true,
|
|
52
|
-
scope: [
|
|
53
|
-
'profiles:read',
|
|
54
|
-
'profiles:write',
|
|
55
|
-
'lists:read',
|
|
56
|
-
'lists:write',
|
|
57
|
-
'tags:read',
|
|
58
|
-
'segments:read',
|
|
59
|
-
'events:read',
|
|
60
|
-
'events:write',
|
|
61
|
-
'subscriptions:read',
|
|
62
|
-
'subscriptions:write',
|
|
63
|
-
'accounts:read',
|
|
64
|
-
],
|
|
65
|
-
pkce: true,
|
|
66
|
-
pkceMethod: 'S256',
|
|
67
|
-
authorizationMethod: pieces_framework_1.OAuth2AuthorizationMethod.HEADER,
|
|
68
|
-
}),
|
|
69
|
-
];
|
|
70
|
-
function getAuthorizationHeader(auth) {
|
|
71
|
-
if (auth.type === shared_1.AppConnectionType.SECRET_TEXT) {
|
|
72
|
-
return `Klaviyo-API-Key ${auth.secret_text}`;
|
|
73
|
-
}
|
|
74
|
-
return `Bearer ${auth.access_token}`;
|
|
75
|
-
}
|
|
76
|
-
//# sourceMappingURL=auth.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../src/lib/common/auth.ts"],"names":[],"mappings":";;;AA0EA,wDAKC;;AA/ED,qEAIwC;AACxC,+DAAqE;AACrE,iDAAyD;AAE5C,QAAA,WAAW,GAAG;IACzB,4BAAS,CAAC,UAAU,CAAC;QACnB,WAAW,EAAE,iBAAiB;QAC9B,WAAW,EAAE,uQAAuQ;QACpR,QAAQ,EAAE,IAAI;QACd,QAAQ,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;YACvB,IAAI,CAAC;gBACH,MAAM,0BAAU,CAAC,WAAW,CAAC;oBAC3B,MAAM,EAAE,0BAAU,CAAC,GAAG;oBACtB,GAAG,EAAE,oCAAoC;oBACzC,OAAO,EAAE;wBACP,aAAa,EAAE,mBAAmB,IAAI,EAAE;wBACxC,QAAQ,EAAE,YAAY;wBACtB,MAAM,EAAE,0BAA0B;qBACnC;iBACF,CAAC,CAAC;gBACH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;YACzB,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,OAAO;oBACL,KAAK,EAAE,KAAK;oBACZ,KAAK,EACH,2EAA2E;iBAC9E,CAAC;YACJ,CAAC;QACH,CAAC,CAAA;KACF,CAAC;IACF,4BAAS,CAAC,MAAM,CAAC;QACf,WAAW,EAAE;;;;;;;;;;;;kBAYC;QACd,OAAO,EAAE,yCAAyC;QAClD,QAAQ,EAAE,mCAAmC;QAC7C,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE;YACL,eAAe;YACf,gBAAgB;YAChB,YAAY;YACZ,aAAa;YACb,WAAW;YACX,eAAe;YACf,aAAa;YACb,cAAc;YACd,oBAAoB;YACpB,qBAAqB;YACrB,eAAe;SAChB;QACD,IAAI,EAAE,IAAI;QACV,UAAU,EAAE,MAAM;QAClB,mBAAmB,EAAE,4CAAyB,CAAC,MAAM;KACtD,CAAC;CACH,CAAC;AAMF,SAAgB,sBAAsB,CAAC,IAAsB;IAC3D,IAAI,IAAI,CAAC,IAAI,KAAK,0BAAiB,CAAC,WAAW,EAAE,CAAC;QAChD,OAAO,mBAAmB,IAAI,CAAC,WAAW,EAAE,CAAC;IAC/C,CAAC;IACD,OAAO,UAAU,IAAI,CAAC,YAAY,EAAE,CAAC;AACvC,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { HttpMethod } from '@activepieces/pieces-common';
|
|
2
|
-
import { KlaviyoAuthValue } from './auth';
|
|
3
|
-
export declare function fetchProfilesByIds(auth: KlaviyoAuthValue, ids: string[]): Promise<Map<string, Record<string, unknown>>>;
|
|
4
|
-
export declare function normalizeProfileIds(value: unknown): string[];
|
|
5
|
-
export declare const BASE_URL = "https://a.klaviyo.com/api";
|
|
6
|
-
export declare function makeRequest(auth: KlaviyoAuthValue, method: HttpMethod, path: string, body?: unknown): Promise<any>;
|
|
7
|
-
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAc,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAA0B,MAAM,QAAQ,CAAC;AAElE,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,gBAAgB,EACtB,GAAG,EAAE,MAAM,EAAE,GACZ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAiB/C;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAe5D;AAED,eAAO,MAAM,QAAQ,8BAA8B,CAAC;AAEpD,wBAAsB,WAAW,CAC/B,IAAI,EAAE,gBAAgB,EACtB,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,OAAO,gBAwCf"}
|