Skip to content

Commit a145e78

Browse files
committed
[Components] leaddyno #17080
Sources - New Affiliates - New Leads - New Purchases Actions - Create Affiliate - Create Lead - Create Purchase - Retrieve Lead
1 parent 5a605a0 commit a145e78

File tree

13 files changed

+680
-7
lines changed

13 files changed

+680
-7
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
import leaddyno from "../../leaddyno.app.mjs";
2+
3+
export default {
4+
key: "leaddyno-create-affiliate",
5+
name: "Create Affiliate",
6+
description: "Creates a new affiliate in LeadDyno. [See the documentation](https://app.theneo.io/leaddyno/leaddyno-rest-api/affiliates/post-affiliates)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
leaddyno,
11+
email: {
12+
type: "string",
13+
label: "Email",
14+
description: "The email address of the affiliate",
15+
},
16+
firstName: {
17+
type: "string",
18+
label: "First Name",
19+
description: "The first name of the affiliate",
20+
optional: true,
21+
},
22+
lastName: {
23+
type: "string",
24+
label: "Last Name",
25+
description: "The last name of the affiliate",
26+
optional: true,
27+
},
28+
affiliateCode: {
29+
type: "string",
30+
label: "Affiliate Code",
31+
description: "A custom affiliate code for the new affiliate",
32+
optional: true,
33+
},
34+
paypalEmail: {
35+
type: "string",
36+
label: "PayPal Email",
37+
description: "The PayPal email address for affiliate payouts",
38+
optional: true,
39+
},
40+
unsubscribed: {
41+
type: "boolean",
42+
label: "Unsubscribed",
43+
description: "Indicates whether the affiliate is unsubscribed from communications",
44+
optional: true,
45+
},
46+
affiliateType: {
47+
type: "string",
48+
label: "Affiliate Type",
49+
description: "The code for the affiliate's group",
50+
optional: true,
51+
},
52+
overrideApproval: {
53+
type: "boolean",
54+
label: "Override Approval",
55+
description: "If set to true, the affiliate will not require approval",
56+
optional: true,
57+
},
58+
},
59+
async run({ $ }) {
60+
const response = await this.leaddyno.createAffiliate({
61+
$,
62+
data: {
63+
email: this.email,
64+
first_name: this.firstName,
65+
last_name: this.lastName,
66+
affiliate_code: this.affiliateCode,
67+
paypal_email: this.paypalEmail,
68+
unsubscribed: this.unsubscribed,
69+
affiliate_type: this.affiliateType,
70+
override_approval: this.overrideApproval,
71+
},
72+
});
73+
74+
$.export("$summary", `Successfully created affiliate with ID ${response.id}`);
75+
76+
return response;
77+
},
78+
};
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
import leaddyno from "../../leaddyno.app.mjs";
2+
3+
export default {
4+
key: "leaddyno-create-lead",
5+
name: "Create Lead",
6+
description: "Creates a new lead in LeadDyno. [See the documentation](https://app.theneo.io/leaddyno/leaddyno-rest-api/leaddyno-api#POSTCreate-a-lead)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
leaddyno,
11+
email: {
12+
type: "string",
13+
label: "Email",
14+
description: "The email address of the lead",
15+
},
16+
firstName: {
17+
type: "string",
18+
label: "First Name",
19+
description: "The first name of the lead",
20+
optional: true,
21+
},
22+
lastName: {
23+
type: "string",
24+
label: "Last Name",
25+
description: "The last name of the lead",
26+
optional: true,
27+
},
28+
address1: {
29+
type: "string",
30+
label: "Address 1",
31+
description: "The first line of the address of the lead",
32+
optional: true,
33+
},
34+
address2: {
35+
type: "string",
36+
label: "Address 2",
37+
description: "The second line of the address of the lead",
38+
optional: true,
39+
},
40+
city: {
41+
type: "string",
42+
label: "City",
43+
description: "The city of the lead",
44+
optional: true,
45+
},
46+
state: {
47+
type: "string",
48+
label: "State",
49+
description: "The state of the lead",
50+
optional: true,
51+
},
52+
zipcode: {
53+
type: "string",
54+
label: "Zipcode",
55+
description: "The zipcode of the lead",
56+
optional: true,
57+
},
58+
country: {
59+
type: "string",
60+
label: "Country",
61+
description: "The country of the lead",
62+
optional: true,
63+
},
64+
phone: {
65+
type: "string",
66+
label: "Phone",
67+
description: "The phone number of the lead",
68+
optional: true,
69+
},
70+
affiliate: {
71+
propDefinition: [
72+
leaddyno,
73+
"affiliate",
74+
],
75+
optional: true,
76+
},
77+
customStatus: {
78+
type: "string",
79+
label: "Custom Status",
80+
description: "The custom status of the lead",
81+
optional: true,
82+
},
83+
},
84+
async run({ $ }) {
85+
86+
const response = await this.leaddyno.createLead({
87+
$,
88+
data: {
89+
email: this.email,
90+
first_name: this.firstName,
91+
last_name: this.lastName,
92+
address1: this.address1,
93+
address2: this.address2,
94+
city: this.city,
95+
state: this.state,
96+
zipcode: this.zipcode,
97+
country: this.country,
98+
phone: this.phone,
99+
affiliate: this.affiliate,
100+
custom_status: this.customStatus,
101+
},
102+
});
103+
104+
$.export("$summary", `Successfully created lead with email ${this.email}`);
105+
106+
return response;
107+
},
108+
};
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
import leaddyno from "../../leaddyno.app.mjs";
2+
3+
export default {
4+
key: "leaddyno-create-purchase",
5+
name: "Create Purchase",
6+
description: "Creates a new purchase in LeadDyno. [See the documentation](https://app.theneo.io/leaddyno/leaddyno-rest-api/purchases/post-purchases)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
leaddyno,
11+
email: {
12+
propDefinition: [
13+
leaddyno,
14+
"leadEmail",
15+
],
16+
},
17+
purchaseCode: {
18+
type: "string",
19+
label: "Purchase Code",
20+
description: "A unique identifier for this purchase. If not provided, a unique ID will be generated",
21+
optional: true,
22+
},
23+
purchaseAmount: {
24+
type: "string",
25+
label: "Purchase Amount",
26+
description: "The total amount of the purchase, used for percentage commission calculations",
27+
optional: true,
28+
},
29+
planCode: {
30+
type: "string",
31+
label: "Plan Code",
32+
description: "The code of the reward structure used for calculating affiliate commissions",
33+
optional: true,
34+
},
35+
affiliateCode: {
36+
propDefinition: [
37+
leaddyno,
38+
"affiliateCode",
39+
],
40+
optional: true,
41+
},
42+
commissionAmount: {
43+
type: "string",
44+
label: "Commission Amount Override",
45+
description: "An overriding commission amount that will replace any predefined plan and provide an immediate fixed-amount commission. This value should be a decimal",
46+
optional: true,
47+
},
48+
description: {
49+
type: "string",
50+
label: "Description",
51+
description: "Text description of the purchase",
52+
optional: true,
53+
},
54+
reassignAffiliate: {
55+
type: "boolean",
56+
label: "Reassign Affiliate",
57+
description: "If set to false, the original affiliate of the lead will be retained.",
58+
optional: true,
59+
},
60+
lineItems: {
61+
type: "string[]",
62+
label: "Line Items",
63+
description: "A list of JSON object containing the line items associated with the purchase. **Format: [{\"sku\": \"string\", \"description\": \"string\", \"quantity\": \"string\", \"amount\": \"string\"}]**",
64+
optional: true,
65+
},
66+
},
67+
async run({ $ }) {
68+
const response = await this.leaddyno.createPurchase({
69+
$,
70+
data: {
71+
email: this.email,
72+
purchase_code: this.purchaseCode,
73+
purchase_amount: this.purchaseAmount && parseFloat(this.purchaseAmount),
74+
plan_code: this.planCode,
75+
code: this.affiliateCode,
76+
commission_amount_override: this.commissionAmount && parseFloat(this.commissionAmount),
77+
description: this.description,
78+
reassign_affiliate: this.reassignAffiliate,
79+
line_items: this.lineItems,
80+
},
81+
});
82+
83+
$.export("$summary", `Successfully created purchase with ID ${response.id}`);
84+
85+
return response;
86+
},
87+
};
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import leaddyno from "../../leaddyno.app.mjs";
2+
3+
export default {
4+
key: "leaddyno-retrieve-lead",
5+
name: "Retrieve Lead",
6+
description: "Retrieves information about a lead from LeadDyno. [See the documentation](https://app.theneo.io/leaddyno/leaddyno-rest-api/leads/retrieve-a-lead-by-id)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
leaddyno,
11+
leadId: {
12+
propDefinition: [
13+
leaddyno,
14+
"leadId",
15+
],
16+
description: "The ID of the lead to retrieve",
17+
},
18+
},
19+
async run({ $ }) {
20+
const response = await this.leaddyno.getLead({
21+
$,
22+
leadId: this.leadId,
23+
});
24+
25+
$.export("$summary", `Successfully retrieved lead with ID ${this.leadId}`);
26+
return response;
27+
},
28+
};

0 commit comments

Comments
 (0)