@segment/action-destinations 3.44.1-alpha.0 → 3.46.1-alpha.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/dist/destinations/adobe-target/generated-types.d.ts +3 -0
- package/dist/destinations/adobe-target/generated-types.js +3 -0
- package/dist/destinations/adobe-target/generated-types.js.map +1 -0
- package/dist/destinations/adobe-target/index.d.ts +4 -0
- package/dist/destinations/adobe-target/index.js +27 -0
- package/dist/destinations/adobe-target/index.js.map +1 -0
- package/dist/destinations/adobe-target/updateProfile/generated-types.d.ts +6 -0
- package/dist/destinations/adobe-target/updateProfile/generated-types.js +3 -0
- package/dist/destinations/adobe-target/updateProfile/generated-types.js.map +1 -0
- package/dist/destinations/adobe-target/updateProfile/index.d.ts +5 -0
- package/dist/destinations/adobe-target/updateProfile/index.js +58 -0
- package/dist/destinations/adobe-target/updateProfile/index.js.map +1 -0
- package/dist/destinations/close/createUpdateContactAndLead/generated-types.d.ts +12 -0
- package/dist/destinations/close/createUpdateContactAndLead/generated-types.js +3 -0
- package/dist/destinations/close/createUpdateContactAndLead/generated-types.js.map +1 -0
- package/dist/destinations/close/createUpdateContactAndLead/index.d.ts +5 -0
- package/dist/destinations/close/createUpdateContactAndLead/index.js +89 -0
- package/dist/destinations/close/createUpdateContactAndLead/index.js.map +1 -0
- package/dist/destinations/close/generated-types.d.ts +4 -0
- package/dist/destinations/close/generated-types.js +3 -0
- package/dist/destinations/close/generated-types.js.map +1 -0
- package/dist/destinations/close/index.d.ts +4 -0
- package/dist/destinations/close/index.js +49 -0
- package/dist/destinations/close/index.js.map +1 -0
- package/dist/destinations/customerio/utils.js +1 -1
- package/dist/destinations/customerio/utils.js.map +1 -1
- package/dist/destinations/friendbuy/cloudUtil.d.ts +4 -4
- package/dist/destinations/friendbuy/cloudUtil.js +31 -15
- package/dist/destinations/friendbuy/cloudUtil.js.map +1 -1
- package/dist/destinations/friendbuy/index.js +2 -2
- package/dist/destinations/friendbuy/index.js.map +1 -1
- package/dist/destinations/friendbuy/trackCustomEvent/generated-types.d.ts +1 -0
- package/dist/destinations/friendbuy/trackCustomEvent/index.js +8 -5
- package/dist/destinations/friendbuy/trackCustomEvent/index.js.map +1 -1
- package/dist/destinations/friendbuy/trackCustomer/index.js +4 -3
- package/dist/destinations/friendbuy/trackCustomer/index.js.map +1 -1
- package/dist/destinations/friendbuy/trackPurchase/generated-types.d.ts +2 -0
- package/dist/destinations/friendbuy/trackPurchase/index.js +29 -29
- package/dist/destinations/friendbuy/trackPurchase/index.js.map +1 -1
- package/dist/destinations/friendbuy/trackSignUp/generated-types.d.ts +3 -0
- package/dist/destinations/friendbuy/trackSignUp/index.js +7 -3
- package/dist/destinations/friendbuy/trackSignUp/index.js.map +1 -1
- package/dist/destinations/gainsight-px-cloud-action/common-fields.d.ts +2 -0
- package/dist/destinations/gainsight-px-cloud-action/common-fields.js +277 -0
- package/dist/destinations/gainsight-px-cloud-action/common-fields.js.map +1 -0
- package/dist/destinations/gainsight-px-cloud-action/generated-types.d.ts +4 -0
- package/dist/destinations/gainsight-px-cloud-action/generated-types.js +3 -0
- package/dist/destinations/gainsight-px-cloud-action/generated-types.js.map +1 -0
- package/dist/destinations/gainsight-px-cloud-action/groupIdentify/generated-types.d.ts +60 -0
- package/dist/destinations/gainsight-px-cloud-action/groupIdentify/generated-types.js +3 -0
- package/dist/destinations/gainsight-px-cloud-action/groupIdentify/generated-types.js.map +1 -0
- package/dist/destinations/gainsight-px-cloud-action/groupIdentify/index.d.ts +5 -0
- package/dist/destinations/gainsight-px-cloud-action/groupIdentify/index.js +38 -0
- package/dist/destinations/gainsight-px-cloud-action/groupIdentify/index.js.map +1 -0
- package/dist/destinations/gainsight-px-cloud-action/identifyUser/generated-types.d.ts +59 -0
- package/dist/destinations/gainsight-px-cloud-action/identifyUser/generated-types.js +3 -0
- package/dist/destinations/gainsight-px-cloud-action/identifyUser/generated-types.js.map +1 -0
- package/dist/destinations/gainsight-px-cloud-action/identifyUser/index.d.ts +5 -0
- package/dist/destinations/gainsight-px-cloud-action/identifyUser/index.js +29 -0
- package/dist/destinations/gainsight-px-cloud-action/identifyUser/index.js.map +1 -0
- package/dist/destinations/gainsight-px-cloud-action/index.d.ts +4 -0
- package/dist/destinations/gainsight-px-cloud-action/index.js +100 -0
- package/dist/destinations/gainsight-px-cloud-action/index.js.map +1 -0
- package/dist/destinations/gainsight-px-cloud-action/regional-endpoints.d.ts +12 -0
- package/dist/destinations/gainsight-px-cloud-action/regional-endpoints.js +19 -0
- package/dist/destinations/gainsight-px-cloud-action/regional-endpoints.js.map +1 -0
- package/dist/destinations/gainsight-px-cloud-action/trackEvent/generated-types.d.ts +60 -0
- package/dist/destinations/gainsight-px-cloud-action/trackEvent/generated-types.js +3 -0
- package/dist/destinations/gainsight-px-cloud-action/trackEvent/generated-types.js.map +1 -0
- package/dist/destinations/gainsight-px-cloud-action/trackEvent/index.d.ts +5 -0
- package/dist/destinations/gainsight-px-cloud-action/trackEvent/index.js +37 -0
- package/dist/destinations/gainsight-px-cloud-action/trackEvent/index.js.map +1 -0
- package/dist/destinations/gainsight-px-cloud-action/trackPageView/generated-types.d.ts +63 -0
- package/dist/destinations/gainsight-px-cloud-action/trackPageView/generated-types.js +3 -0
- package/dist/destinations/gainsight-px-cloud-action/trackPageView/generated-types.js.map +1 -0
- package/dist/destinations/gainsight-px-cloud-action/trackPageView/index.d.ts +5 -0
- package/dist/destinations/gainsight-px-cloud-action/trackPageView/index.js +60 -0
- package/dist/destinations/gainsight-px-cloud-action/trackPageView/index.js.map +1 -0
- package/dist/destinations/index.js +3 -0
- package/dist/destinations/index.js.map +1 -1
- package/dist/destinations/salesforce/lead/index.js +9 -9
- package/dist/destinations/salesforce/lead/index.js.map +1 -1
- package/dist/destinations/salesforce/sf-properties.d.ts +0 -2
- package/dist/destinations/salesforce/sf-properties.js +4 -20
- package/dist/destinations/salesforce/sf-properties.js.map +1 -1
- package/package.json +4 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/destinations/adobe-target/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const updateProfile_1 = __importDefault(require("./updateProfile"));
|
|
7
|
+
const destination = {
|
|
8
|
+
name: 'Adobe Target Cloud Mode',
|
|
9
|
+
slug: 'actions-adobe-target-cloud',
|
|
10
|
+
mode: 'cloud',
|
|
11
|
+
authentication: {
|
|
12
|
+
scheme: 'custom',
|
|
13
|
+
fields: {
|
|
14
|
+
client_code: {
|
|
15
|
+
label: 'Client Code',
|
|
16
|
+
description: 'Your Adobe Target client code. To find your client code in the Target UI click Administration > Implementation. The client code is shown up top under Account Details.',
|
|
17
|
+
type: 'string',
|
|
18
|
+
required: true
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
actions: {
|
|
23
|
+
updateProfile: updateProfile_1.default
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
exports.default = destination;
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/adobe-target/index.ts"],"names":[],"mappings":";;;;;AAGA,oEAA2C;AAE3C,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,yBAAyB;IAC/B,IAAI,EAAE,4BAA4B;IAClC,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,WAAW,EAAE;gBACX,KAAK,EAAE,aAAa;gBACpB,WAAW,EACT,wKAAwK;gBAC1K,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;SACF;KACF;IACD,OAAO,EAAE;QACP,aAAa,EAAb,uBAAa;KACd;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/adobe-target/updateProfile/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const attributes = {};
|
|
4
|
+
function getnestedObjects(obj, objectPath = '') {
|
|
5
|
+
if (obj.traits) {
|
|
6
|
+
obj = obj.traits;
|
|
7
|
+
}
|
|
8
|
+
Object.keys(obj).forEach((key) => {
|
|
9
|
+
const currObjectPath = objectPath ? `${objectPath}.${key}` : key;
|
|
10
|
+
if (typeof obj[key] !== 'object' && obj[key]) {
|
|
11
|
+
attributes[currObjectPath] = obj[key].toString();
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
getnestedObjects(obj[key], currObjectPath);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
return attributes;
|
|
18
|
+
}
|
|
19
|
+
const objectToQueryString = (object) => Object.keys(object)
|
|
20
|
+
.map((key) => `profile.${key}=${object[key].toString()}`)
|
|
21
|
+
.join('&');
|
|
22
|
+
const action = {
|
|
23
|
+
title: 'Update Profile',
|
|
24
|
+
description: '',
|
|
25
|
+
fields: {
|
|
26
|
+
user_id: {
|
|
27
|
+
label: 'User ID',
|
|
28
|
+
description: "The user's unique identifier",
|
|
29
|
+
type: 'string',
|
|
30
|
+
required: true,
|
|
31
|
+
default: {
|
|
32
|
+
'@path': '$.userId'
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
traits: {
|
|
36
|
+
label: 'Traits',
|
|
37
|
+
description: "The user's attributes that will be updated.",
|
|
38
|
+
type: 'object',
|
|
39
|
+
required: true,
|
|
40
|
+
default: {
|
|
41
|
+
'@path': '$.properties.traits'
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
perform: (request, data) => {
|
|
46
|
+
const array = [];
|
|
47
|
+
Object.entries(data.payload).forEach((entry) => array.push(entry[1]));
|
|
48
|
+
const clientCode = data.settings.client_code;
|
|
49
|
+
const userId = data.payload.user_id;
|
|
50
|
+
const traits = getnestedObjects(data.payload.traits);
|
|
51
|
+
const requestUrl = `https://${clientCode}.tt.omtrdc.net/m2/${clientCode}/profile/update?mbox3rdPartyId=${userId}&${objectToQueryString(traits)}`;
|
|
52
|
+
return request(requestUrl, {
|
|
53
|
+
method: 'POST'
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
exports.default = action;
|
|
58
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/adobe-target/updateProfile/index.ts"],"names":[],"mappings":";;AAOA,MAAM,UAAU,GAAyB,EAAE,CAAA;AAC3C,SAAS,gBAAgB,CAAC,GAAyB,EAAE,UAAU,GAAG,EAAE;IAClE,IAAI,GAAG,CAAC,MAAM,EAAE;QACd,GAAG,GAAG,GAAG,CAAC,MAAM,CAAA;KACjB;IACD,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QAC/B,MAAM,cAAc,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAA;QAChE,IAAI,OAAO,GAAG,CAAC,GAAG,CAAC,KAAK,QAAQ,IAAI,GAAG,CAAC,GAAG,CAAC,EAAE;YAC5C,UAAU,CAAC,cAAc,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAA;SACjD;aAAM;YACL,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,cAAc,C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,MAAM,UAAU,GAAG,WAAW,UAAU,qBAAqB,UAAU,kCAAkC,MAAM,IAAI,mBAAmB,CACpI,MAAM,CACP,EAAE,CAAA;QAEH,OAAO,OAAO,CAAC,UAAU,EAAE;YACzB,MAAM,EAAE,MAAM;SACf,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface Payload {
|
|
2
|
+
lead_name?: string;
|
|
3
|
+
contact_name?: string;
|
|
4
|
+
contact_email?: string;
|
|
5
|
+
contact_phone?: string;
|
|
6
|
+
contact_url?: string;
|
|
7
|
+
contact_title?: string;
|
|
8
|
+
contact_external_id?: string;
|
|
9
|
+
contact_custom_fields?: {
|
|
10
|
+
[k: string]: unknown;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/close/createUpdateContactAndLead/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const action = {
|
|
4
|
+
title: 'Create or Update Contact and Lead',
|
|
5
|
+
description: '',
|
|
6
|
+
defaultSubscription: 'type = "identify"',
|
|
7
|
+
fields: {
|
|
8
|
+
lead_name: {
|
|
9
|
+
label: 'Lead Name',
|
|
10
|
+
description: '',
|
|
11
|
+
type: 'string',
|
|
12
|
+
required: false,
|
|
13
|
+
default: {
|
|
14
|
+
'@path': '$.traits.company.name'
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
contact_name: {
|
|
18
|
+
label: 'Contact Name',
|
|
19
|
+
description: '',
|
|
20
|
+
type: 'string',
|
|
21
|
+
required: false,
|
|
22
|
+
default: {
|
|
23
|
+
'@path': '$.traits.name'
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
contact_email: {
|
|
27
|
+
label: 'Contact Email',
|
|
28
|
+
description: '',
|
|
29
|
+
type: 'string',
|
|
30
|
+
required: false,
|
|
31
|
+
default: {
|
|
32
|
+
'@path': '$.traits.email'
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
contact_phone: {
|
|
36
|
+
label: 'Contact Phone',
|
|
37
|
+
description: '',
|
|
38
|
+
type: 'string',
|
|
39
|
+
required: false,
|
|
40
|
+
default: {
|
|
41
|
+
'@path': '$.traits.phone'
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
contact_url: {
|
|
45
|
+
label: 'Contact URL',
|
|
46
|
+
description: '',
|
|
47
|
+
type: 'string',
|
|
48
|
+
required: false,
|
|
49
|
+
default: {
|
|
50
|
+
'@path': '$.traits.website'
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
contact_title: {
|
|
54
|
+
label: 'Contact Title',
|
|
55
|
+
description: '',
|
|
56
|
+
type: 'string',
|
|
57
|
+
required: false,
|
|
58
|
+
default: {
|
|
59
|
+
'@path': '$.traits.title'
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
contact_external_id: {
|
|
63
|
+
label: 'Contact User ID',
|
|
64
|
+
description: 'Your ID that identifies the Contact. Contact Custom Field ID for User ID must be defined in the global integration settings.',
|
|
65
|
+
type: 'string',
|
|
66
|
+
required: false,
|
|
67
|
+
default: {
|
|
68
|
+
'@path': '$.userId'
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
contact_custom_fields: {
|
|
72
|
+
label: 'Contact Custom Fields',
|
|
73
|
+
description: 'Custom Fields to set on the Contact. Key should be Custom Field ID (`cf_xxxx`).',
|
|
74
|
+
type: 'object',
|
|
75
|
+
required: false
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
perform: (request, data) => {
|
|
79
|
+
const settings = {
|
|
80
|
+
contact_custom_field_id_for_user_id: data.settings.contact_custom_field_id_for_user_id
|
|
81
|
+
};
|
|
82
|
+
return request('https://services.close.com/webhooks/segment/actions/create-update-contact-and-lead/', {
|
|
83
|
+
method: 'post',
|
|
84
|
+
json: { action_payload: data.payload, settings }
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
exports.default = action;
|
|
89
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/close/createUpdateContactAndLead/index.ts"],"names":[],"mappings":";;AAIA,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,mCAAmC;IAC1C,WAAW,EAAE,EAAE;IACf,mBAAmB,EAAE,mBAAmB;IACxC,MAAM,EAAE;QACN,SAAS,EAAE;YACT,KAAK,EAAE,WAAW;YAClB,WAAW,EAAE,EAAE;YACf,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,OAAO,EAAE,uBAAuB;aACjC;SACF;QACD,YAAY,EAAE;YACZ,KAAK,EAAE,cAAc;YACrB,WAAW,EAAE,EAAE;YACf,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,OAAO,EAAE,eAAe;aACzB;SACF;QACD,aAAa,EAAE;YACb,KAAK,EAAE,eAAe;YACtB,WAAW,EAAE,EAAE;YACf,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,OAAO,EAAE,gBAAgB;aAC1B;SACF;QACD,aAAa,EAAE;YACb,KAAK,EAAE,eAAe;YACtB,WAAW,EAAE,EAAE;YACf,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,OAAO,EAAE,gBAAgB;aAC1B;SACF;QACD,WAAW,EAAE;YACX,KAAK,EAAE,aAAa;YACpB,WAAW,EAAE,EAAE;YACf,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,OAAO,EAAE,kBAAkB;aAC5B;SACF;QACD,aAAa,EAAE;YACb,KAAK,EAAE,eAAe;YACtB,WAAW,EAAE,EAAE;YACf,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,OAAO,EAAE,gBAAgB;aAC1B;SACF;QACD,mBAAmB,EAAE;YACnB,KAAK,EAAE,iBAAiB;YACxB,WAAW,EACT,8HAA8H;YAChI,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,OAAO,EAAE,UAAU;aACpB;SACF;QACD,qBAAqB,EAAE;YACrB,KAAK,EAAE,uBAAuB;YAC9B,WAAW,EAAE,iFAAiF;YAC9F,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;SAChB;KACF;IAED,OAAO,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE;QACzB,MAAM,QAAQ,GAAG;YACf,mCAAmC,EAAE,IAAI,CAAC,QAAQ,CAAC,mCAAmC;SACvF,CAAA;QACD,OAAO,OAAO,CAAC,qFAAqF,EAAE;YACpG,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,EAAE,cAAc,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE;SACjD,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/destinations/close/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const createUpdateContactAndLead_1 = __importDefault(require("./createUpdateContactAndLead"));
|
|
7
|
+
const destination = {
|
|
8
|
+
name: 'Close',
|
|
9
|
+
slug: 'close',
|
|
10
|
+
mode: 'cloud',
|
|
11
|
+
authentication: {
|
|
12
|
+
scheme: 'basic',
|
|
13
|
+
fields: {
|
|
14
|
+
api_key: {
|
|
15
|
+
label: 'API key',
|
|
16
|
+
description: 'Your Close API key.',
|
|
17
|
+
type: 'string',
|
|
18
|
+
required: true
|
|
19
|
+
},
|
|
20
|
+
contact_custom_field_id_for_user_id: {
|
|
21
|
+
label: 'Contact Custom Field ID for User ID',
|
|
22
|
+
description: "Enter the ID of a Contact Custom Field that'll be " +
|
|
23
|
+
"used to store User ID. You'll need to create this Contact " +
|
|
24
|
+
'Custom Field in Close first, and then the integration will use ' +
|
|
25
|
+
'this field to store the User ID when creating new contacts, ' +
|
|
26
|
+
'and/or will be used as a lookup key when updating existing ' +
|
|
27
|
+
'Contacts. If this field is not filled out, it will only ' +
|
|
28
|
+
'lookup and de-dupe based on email.',
|
|
29
|
+
type: 'string',
|
|
30
|
+
default: '',
|
|
31
|
+
required: false
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
testAuthentication: (request) => {
|
|
35
|
+
return request(`https://api.close.com/api/v1/me/`);
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
extendRequest({ settings }) {
|
|
39
|
+
return {
|
|
40
|
+
username: settings.api_key,
|
|
41
|
+
password: ''
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
actions: {
|
|
45
|
+
createUpdateContactAndLead: createUpdateContactAndLead_1.default
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
exports.default = destination;
|
|
49
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/close/index.ts"],"names":[],"mappings":";;;;;AAGA,8FAAqE;AAErE,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,OAAO;QACf,MAAM,EAAE;YACN,OAAO,EAAE;gBACP,KAAK,EAAE,SAAS;gBAChB,WAAW,EAAE,qBAAqB;gBAClC,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;YACD,mCAAmC,EAAE;gBACnC,KAAK,EAAE,qCAAqC;gBAC5C,WAAW,EACT,oDAAoD;oBACpD,4DAA4D;oBAC5D,iEAAiE;oBACjE,8DAA8D;oBAC9D,6DAA6D;oBAC7D,0DAA0D;oBAC1D,oCAAoC;gBACtC,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,KAAK;aAChB;SACF;QACD,kBAAkB,EAAE,CAAC,OAAO,EAAE,EAAE;YAC9B,OAAO,OAAO,CAAC,kCAAkC,CAAC,CAAA;QACpD,CAAC;KACF;IAED,aAAa,CAAC,EAAE,QAAQ,EAAE;QACxB,OAAO;YACL,QAAQ,EAAE,QAAQ,CAAC,OAAO;YAC1B,QAAQ,EAAE,EAAE;SACb,CAAA;IACH,CAAC;IAQD,OAAO,EAAE;QACP,0BAA0B,EAA1B,oCAA0B;KAC3B;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
|
|
@@ -25,7 +25,7 @@ const isIsoDate = (value) => {
|
|
|
25
25
|
const isoformat = '^\\d{4}-\\d{2}-\\d{2}' +
|
|
26
26
|
'((T\\d{2}:\\d{2}(:\\d{2})?)' +
|
|
27
27
|
'(\\.\\d{1,6})?' +
|
|
28
|
-
'(Z|(\\+|-)\\d{2}
|
|
28
|
+
'(Z|(\\+|-)\\d{2}:?\\d{2})?)?$';
|
|
29
29
|
const matcher = new RegExp(isoformat);
|
|
30
30
|
return typeof value === 'string' && matcher.test(value) && !isNaN(Date.parse(value));
|
|
31
31
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/destinations/customerio/utils.ts"],"names":[],"mappings":";;;;;;AAAA,4DAAmC;AACnC,yEAAgD;AAEzC,MAAM,gBAAgB,GAAG,CAAC,aAAsB,EAAE,EAAE;IACzD,IAAI,aAAa,KAAK,aAAa,CAAC,EAAE,EAAE;QACtC,OAAO,8BAA8B,CAAA;KACtC;IAED,OAAO,2BAA2B,CAAA;AACpC,CAAC,CAAA;AANY,QAAA,gBAAgB,oBAM5B;AAED,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,mDAAc,CAAA;IACd,mDAAc,CAAA;AAChB,CAAC,EAHW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAGxB;AAED,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAoC,EAAE;IACpE,OAAO,uBAAa,CAAC,KAAK,CAAC,CAAA;AAC7B,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,CAAC,KAAa,EAAW,EAAE;IAE3C,MAAM,SAAS,GACb,uBAAuB;QACvB,6BAA6B;QAC7B,gBAAgB;QAChB,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/destinations/customerio/utils.ts"],"names":[],"mappings":";;;;;;AAAA,4DAAmC;AACnC,yEAAgD;AAEzC,MAAM,gBAAgB,GAAG,CAAC,aAAsB,EAAE,EAAE;IACzD,IAAI,aAAa,KAAK,aAAa,CAAC,EAAE,EAAE;QACtC,OAAO,8BAA8B,CAAA;KACtC;IAED,OAAO,2BAA2B,CAAA;AACpC,CAAC,CAAA;AANY,QAAA,gBAAgB,oBAM5B;AAED,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,mDAAc,CAAA;IACd,mDAAc,CAAA;AAChB,CAAC,EAHW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAGxB;AAED,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAoC,EAAE;IACpE,OAAO,uBAAa,CAAC,KAAK,CAAC,CAAA;AAC7B,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,CAAC,KAAa,EAAW,EAAE;IAE3C,MAAM,SAA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E;YACnB,KAAK,CAAC,GAAG,CAAC,GAAG,kCAA0B,CAAC,KAAK,CAAC,CAAA;YAE9C,OAAM;SACP;QAED,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;IACpB,CAAC,CAAC,CAAA;IAEF,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AA3BY,QAAA,0BAA0B,8BA2BtC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { JSONObject, RequestClient, RequestOptions } from '@segment/actions-core';
|
|
2
2
|
import { Settings } from './generated-types';
|
|
3
|
-
export declare const
|
|
4
|
-
export declare
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function getAuthToken(request: RequestClient,
|
|
3
|
+
export declare const defaultMapiBaseUrl = "https://mapi.fbot.me";
|
|
4
|
+
export declare function getMapiBaseUrl(authSecret: string): string[];
|
|
5
|
+
export declare function createMapiRequest(path: string, request: RequestClient, settings: Settings, friendbuyPayload: JSONObject): Promise<[string, RequestOptions]>;
|
|
6
|
+
export declare function getAuthToken(request: RequestClient, mapiBaseUrl: string, authKey: string, authSecret: string): Promise<string>;
|
|
@@ -1,29 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getAuthToken = exports.
|
|
4
|
-
exports.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
exports.getAuthToken = exports.createMapiRequest = exports.getMapiBaseUrl = exports.defaultMapiBaseUrl = void 0;
|
|
4
|
+
exports.defaultMapiBaseUrl = `https://mapi.fbot.me`;
|
|
5
|
+
function getMapiBaseUrl(authSecret) {
|
|
6
|
+
const colonPos = authSecret.indexOf(':');
|
|
7
|
+
if (colonPos <= 0) {
|
|
8
|
+
return [authSecret, exports.defaultMapiBaseUrl];
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
const realAuthSecret = authSecret.substring(colonPos + 1);
|
|
12
|
+
const environment = authSecret.substring(0, colonPos);
|
|
13
|
+
const mapiBaseUrl = `https://mapi.fbot-${environment}.me`;
|
|
14
|
+
return [realAuthSecret, mapiBaseUrl];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.getMapiBaseUrl = getMapiBaseUrl;
|
|
18
|
+
async function createMapiRequest(path, request, settings, friendbuyPayload) {
|
|
19
|
+
const [authSecret, mapiBaseUrl] = getMapiBaseUrl(settings.authSecret);
|
|
20
|
+
const authToken = await getAuthToken(request, mapiBaseUrl, settings.authKey, authSecret);
|
|
21
|
+
return [
|
|
22
|
+
`${mapiBaseUrl}/${path}`,
|
|
23
|
+
{
|
|
24
|
+
method: 'POST',
|
|
25
|
+
json: friendbuyPayload,
|
|
26
|
+
headers: {
|
|
27
|
+
Authorization: authToken
|
|
28
|
+
}
|
|
13
29
|
}
|
|
14
|
-
|
|
30
|
+
];
|
|
15
31
|
}
|
|
16
|
-
exports.
|
|
32
|
+
exports.createMapiRequest = createMapiRequest;
|
|
17
33
|
const AUTH_PADDING_MS = 10000;
|
|
18
34
|
let friendbuyAuth;
|
|
19
|
-
async function getAuthToken(request,
|
|
35
|
+
async function getAuthToken(request, mapiBaseUrl, authKey, authSecret) {
|
|
20
36
|
if (!friendbuyAuth || Date.now() >= friendbuyAuth.expiresEpoch) {
|
|
21
|
-
const r = await request(`${
|
|
37
|
+
const r = await request(`${mapiBaseUrl}/v1/authorization`, {
|
|
22
38
|
method: 'POST',
|
|
23
39
|
headers: {
|
|
24
40
|
'Content-Type': 'application/json'
|
|
25
41
|
},
|
|
26
|
-
json: { key:
|
|
42
|
+
json: { key: authKey, secret: authSecret }
|
|
27
43
|
});
|
|
28
44
|
if (r.data) {
|
|
29
45
|
const data = r.data;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloudUtil.js","sourceRoot":"","sources":["../../../src/destinations/friendbuy/cloudUtil.ts"],"names":[],"mappings":";;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OAAe,EAAE,UAAkB;IAEjH,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,GAAG,EAAE,IAAI,aAAa,CAAC,YAAY,EAAE;QAC9D,MAAM,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,WAAW,mBAAmB,EAAE;YACzD,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;YACD,IAAI,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE;SAC3C,CAAC,CAAA;QAEF,IAAI,CAAC,CAAC,IAAI,EAAE;YACV,MAAM,IAAI,GAAG,CAAC,CAAC,IAA0C,CAAA;YACzD,aAAa,GAAG;gBACd,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,eAAe;aACzD,CAAA;SACF;KACF;IAED,OAAO,aAAa,CAAC,KAAK,CAAA;AAC5B,CAAC;AArBD,oCAqBC"}
|
|
@@ -30,7 +30,7 @@ const destination = {
|
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
32
|
testAuthentication: (request, { settings }) => {
|
|
33
|
-
return request(`${cloudUtil_1.
|
|
33
|
+
return request(`${cloudUtil_1.defaultMapiBaseUrl}/v1/authorization`, {
|
|
34
34
|
method: 'POST',
|
|
35
35
|
json: { key: settings.authKey, secret: settings.authSecret }
|
|
36
36
|
});
|
|
@@ -39,7 +39,7 @@ const destination = {
|
|
|
39
39
|
onDelete: async (request, { payload }) => {
|
|
40
40
|
return !payload.userId
|
|
41
41
|
? true
|
|
42
|
-
: request(`${cloudUtil_1.
|
|
42
|
+
: request(`${cloudUtil_1.defaultMapiBaseUrl}/v1/user-data`, {
|
|
43
43
|
method: 'DELETE',
|
|
44
44
|
searchParams: {
|
|
45
45
|
customerId: payload.userId
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/friendbuy/index.ts"],"names":[],"mappings":";;;;;AAGA,oEAA2C;AAC3C,oEAA2C;AAC3C,gEAAuC;AACvC,0EAAiD;AACjD,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/friendbuy/index.ts"],"names":[],"mappings":";;;;;AAGA,oEAA2C;AAC3C,oEAA2C;AAC3C,gEAAuC;AACvC,0EAAiD;AACjD,2CAAgD;AAEhD,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,+BAA+B;IACrC,IAAI,EAAE,yBAAyB;IAC/B,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,OAAO,EAAE;gBACP,KAAK,EAAE,oBAAoB;gBAC3B,WAAW,EAAE,wFAAwF;gBACrG,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,MAAM;gBACd,QAAQ,EAAE,IAAI;aACf;YAGD,UAAU,EAAE;gBACV,KAAK,EAAE,uBAAuB;gBAC9B,WAAW,EAAE,yBAAyB;gBACtC,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;SACF;QACD,kBAAkB,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;YAE5C,OAAO,OAAO,CAAC,GAAG,8BAAkB,mBAAmB,EAAE;gBACvD,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,EAAE,GAAG,EAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,UAAU,EAAE;aAC7D,CAAC,CAAA;QACJ,CAAC;KACF;IAED,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAIvC,OAAO,CAAC,OAAO,CAAC,MAAM;YACpB,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,OAAO,CAAC,GAAG,8BAAkB,eAAe,EAAE;gBAC5C,MAAM,EAAE,QAAQ;gBAChB,YAAY,EAAE;oBACZ,UAAU,EAAE,OAAO,CAAC,MAAM;iBAC3B;aACF,CAAC,CAAA;IACR,CAAC;IAED,OAAO,EAAE;QACP,aAAa,EAAb,uBAAa;QACb,aAAa,EAAb,uBAAa;QACb,WAAW,EAAX,qBAAW;QACX,gBAAgB,EAAhB,0BAAgB;KACjB;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
|
|
@@ -5,6 +5,7 @@ const actions_shared_1 = require("@segment/actions-shared");
|
|
|
5
5
|
const actions_shared_2 = require("@segment/actions-shared");
|
|
6
6
|
const actions_shared_3 = require("@segment/actions-shared");
|
|
7
7
|
const actions_shared_4 = require("@segment/actions-shared");
|
|
8
|
+
const cloudTrackCustomEventFields = { ...actions_shared_3.trackCustomEventFields({ requireEmail: true }), ...actions_shared_1.contextFields };
|
|
8
9
|
const trackCustomEventMapi = {
|
|
9
10
|
fields: {
|
|
10
11
|
eventType: actions_shared_2.COPY,
|
|
@@ -17,19 +18,21 @@ const trackCustomEventMapi = {
|
|
|
17
18
|
lastName: actions_shared_2.COPY,
|
|
18
19
|
isNewCustomer: actions_shared_2.COPY,
|
|
19
20
|
ipAddress: actions_shared_2.COPY,
|
|
20
|
-
userAgent: actions_shared_2.COPY
|
|
21
|
+
userAgent: actions_shared_2.COPY,
|
|
22
|
+
pageUrl: actions_shared_2.DROP,
|
|
23
|
+
pageTitle: actions_shared_2.DROP
|
|
21
24
|
},
|
|
22
25
|
unmappedFieldObject: 'additionalProperties'
|
|
23
26
|
};
|
|
24
27
|
const action = {
|
|
25
28
|
title: 'Track Custom Event',
|
|
26
|
-
description: 'Record when a customer completes any custom event.',
|
|
27
|
-
fields:
|
|
29
|
+
description: 'Record when a customer completes any custom event that you define.',
|
|
30
|
+
fields: cloudTrackCustomEventFields,
|
|
28
31
|
perform: async (request, { settings, payload }) => {
|
|
29
32
|
const payload1 = actions_shared_4.moveEventPropertiesToRoot(payload);
|
|
30
33
|
const friendbuyPayload = actions_shared_2.mapEvent(trackCustomEventMapi, payload1);
|
|
31
|
-
const requestParams = await cloudUtil_1.
|
|
32
|
-
return request(
|
|
34
|
+
const [requestUrl, requestParams] = await cloudUtil_1.createMapiRequest('v1/event/custom', request, settings, friendbuyPayload);
|
|
35
|
+
return request(requestUrl, requestParams);
|
|
33
36
|
}
|
|
34
37
|
};
|
|
35
38
|
exports.default = action;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/friendbuy/trackCustomEvent/index.ts"],"names":[],"mappings":";;AAKA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/friendbuy/trackCustomEvent/index.ts"],"names":[],"mappings":";;AAKA,4CAAgD;AAChD,4DAAuD;AACvD,4DAAgF;AAChF,4DAAgE;AAChE,4DAAmE;AAEnE,MAAM,2BAA2B,GAAG,EAAE,GAAG,uCAAsB,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,8BAAa,EAAE,CAAA;AAE3G,MAAM,oBAAoB,GAAa;IACrC,MAAM,EAAE;QACN,SAAS,EAAE,qBAAI;QACf,eAAe,EAAE,qBAAI;QACrB,MAAM,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE;QAC9B,aAAa,EAAE,qBAAI;QACnB,YAAY,EAAE,qBAAI;QAIlB,KAAK,EAAE,qBAAI;QACX,SAAS,EAAE,qBAAI;QACf,QAAQ,EAAE,qBAAI;QACd,aAAa,EAAE,qBAAI;QAGnB,SAAS,EAAE,qBAAI;QACf,SAAS,EAAE,qBAAI;QACf,OAAO,EAAE,qBAAI;QACb,SAAS,EAAE,qBAAI;KAChB;IACD,mBAAmB,EAAE,sBAAsB;CAC5C,CAAA;AAED,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,oBAAoB;IAC3B,WAAW,EAAE,oEAAoE;IACjF,MAAM,EAAE,2BAA2B;IAEnC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;QAChD,MAAM,QAAQ,GAAG,0CAAyB,CAAC,OAAsC,CAAC,CAAA;QAClF,MAAM,gBAAgB,GAAG,yBAAQ,CAAC,oBAAoB,EAAE,QAAQ,CAAC,CAAA;QACjE,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,MAAM,6BAAiB,CAAC,iBAAiB,EAAE,OAAO,EAAE,QAAQ,EAAE,gBAAgB,CAAC,CAAA;QACnH,OAAO,OAAO,CAAC,UAAU,EAAE,aAAa,CAAC,CAAA;IAC3C,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -5,6 +5,7 @@ const actions_shared_1 = require("@segment/actions-shared");
|
|
|
5
5
|
const actions_shared_2 = require("@segment/actions-shared");
|
|
6
6
|
const actions_shared_3 = require("@segment/actions-shared");
|
|
7
7
|
const actions_shared_4 = require("@segment/actions-shared");
|
|
8
|
+
const cloudTrackCustomerFields = { ...actions_shared_3.trackCustomerFields, ...actions_shared_1.contextFields };
|
|
8
9
|
const trackCustomerMapi = {
|
|
9
10
|
fields: {
|
|
10
11
|
customerId: actions_shared_2.COPY,
|
|
@@ -33,11 +34,11 @@ const trackCustomerMapi = {
|
|
|
33
34
|
const action = {
|
|
34
35
|
title: 'Track Customer',
|
|
35
36
|
description: 'Create a new customer profile or update an existing customer profile.',
|
|
36
|
-
fields:
|
|
37
|
+
fields: cloudTrackCustomerFields,
|
|
37
38
|
perform: async (request, { settings, payload }) => {
|
|
38
39
|
const friendbuyPayload = actions_shared_2.mapEvent(trackCustomerMapi, payload);
|
|
39
|
-
const requestParams = await cloudUtil_1.
|
|
40
|
-
return request(
|
|
40
|
+
const [requestUrl, requestParams] = await cloudUtil_1.createMapiRequest('v1/customer', request, settings, friendbuyPayload);
|
|
41
|
+
return request(requestUrl, requestParams);
|
|
41
42
|
}
|
|
42
43
|
};
|
|
43
44
|
exports.default = action;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/friendbuy/trackCustomer/index.ts"],"names":[],"mappings":";;AAKA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/friendbuy/trackCustomer/index.ts"],"names":[],"mappings":";;AAKA,4CAAgD;AAChD,4DAAuD;AACvD,4DAA8D;AAC9D,4DAA6D;AAC7D,4DAAmD;AAEnD,MAAM,wBAAwB,GAAG,EAAE,GAAG,oCAAmB,EAAE,GAAG,8BAAa,EAAE,CAAA;AAE7E,MAAM,iBAAiB,GAAa;IAClC,MAAM,EAAE;QACN,UAAU,EAAE,qBAAI;QAEhB,KAAK,EAAE,qBAAI;QACX,aAAa,EAAE,qBAAI;QACnB,aAAa,EAAE,qBAAI;QACnB,QAAQ,EAAE,qBAAI;QACd,SAAS,EAAE,qBAAI;QACf,QAAQ,EAAE,qBAAI;QAEd,MAAM,EAAE,qBAAI;QACZ,GAAG,EAAE,qBAAI;QACT,QAAQ,EAAE,EAAE,OAAO,EAAE,0BAAuB,EAAE;QAC9C,QAAQ,EAAE,qBAAI;QACd,QAAQ,EAAE,qBAAI;QACd,cAAc,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;QACnC,YAAY,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;QAC/B,WAAW,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;QAC7B,iBAAiB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;QAGtC,SAAS,EAAE,qBAAI;QACf,SAAS,EAAE,qBAAI;QACf,OAAO,EAAE,qBAAI;QACb,SAAS,EAAE,qBAAI;KAChB;IACD,mBAAmB,EAAE,sBAAsB;CAC5C,CAAA;AAED,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,gBAAgB;IACvB,WAAW,EAAE,uEAAuE;IACpF,MAAM,EAAE,wBAAwB;IAEhC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,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