@segment/action-destinations 3.205.3 → 3.207.0-staging-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.
Files changed (136) hide show
  1. package/dist/destinations/absmartly/attribute.d.ts +5 -0
  2. package/dist/destinations/{liveramp-audiences/audienceEnteredSFTP.types.js → absmartly/attribute.js} +1 -1
  3. package/dist/destinations/absmartly/attribute.js.map +1 -0
  4. package/dist/destinations/absmartly/event.d.ts +20 -0
  5. package/dist/destinations/absmartly/event.js +51 -0
  6. package/dist/destinations/absmartly/event.js.map +1 -0
  7. package/dist/destinations/absmartly/exposure.d.ts +9 -0
  8. package/dist/destinations/absmartly/exposure.js +59 -0
  9. package/dist/destinations/absmartly/exposure.js.map +1 -0
  10. package/dist/destinations/absmartly/generated-types.d.ts +5 -0
  11. package/dist/destinations/absmartly/generated-types.js +3 -0
  12. package/dist/destinations/absmartly/generated-types.js.map +1 -0
  13. package/dist/destinations/absmartly/goal.d.ts +17 -0
  14. package/dist/destinations/absmartly/goal.js +80 -0
  15. package/dist/destinations/absmartly/goal.js.map +1 -0
  16. package/dist/destinations/absmartly/index.d.ts +4 -0
  17. package/dist/destinations/absmartly/index.js +101 -0
  18. package/dist/destinations/absmartly/index.js.map +1 -0
  19. package/dist/destinations/absmartly/timestamp.d.ts +3 -0
  20. package/dist/destinations/absmartly/timestamp.js +20 -0
  21. package/dist/destinations/absmartly/timestamp.js.map +1 -0
  22. package/dist/destinations/absmartly/trackExposure/generated-types.d.ts +8 -0
  23. package/dist/destinations/absmartly/trackExposure/generated-types.js +3 -0
  24. package/dist/destinations/absmartly/trackExposure/generated-types.js.map +1 -0
  25. package/dist/destinations/absmartly/trackExposure/index.d.ts +5 -0
  26. package/dist/destinations/absmartly/trackExposure/index.js +15 -0
  27. package/dist/destinations/absmartly/trackExposure/index.js.map +1 -0
  28. package/dist/destinations/absmartly/trackGoal/generated-types.d.ts +13 -0
  29. package/dist/destinations/absmartly/trackGoal/generated-types.js +3 -0
  30. package/dist/destinations/absmartly/trackGoal/generated-types.js.map +1 -0
  31. package/dist/destinations/absmartly/trackGoal/index.d.ts +5 -0
  32. package/dist/destinations/absmartly/trackGoal/index.js +15 -0
  33. package/dist/destinations/absmartly/trackGoal/index.js.map +1 -0
  34. package/dist/destinations/absmartly/unit.d.ts +8 -0
  35. package/dist/destinations/absmartly/unit.js +16 -0
  36. package/dist/destinations/absmartly/unit.js.map +1 -0
  37. package/dist/destinations/engage/sendgrid/sendEmail/SendEmailPerformer.js +2 -10
  38. package/dist/destinations/engage/sendgrid/sendEmail/SendEmailPerformer.js.map +1 -1
  39. package/dist/destinations/engage/utils/EngageStats.js.map +1 -1
  40. package/dist/destinations/hubspot/index.js +1 -0
  41. package/dist/destinations/hubspot/index.js.map +1 -1
  42. package/dist/destinations/hubspot/upsertContact/generated-types.d.ts +1 -0
  43. package/dist/destinations/hubspot/upsertContact/index.d.ts +22 -0
  44. package/dist/destinations/hubspot/upsertContact/index.js +141 -0
  45. package/dist/destinations/hubspot/upsertContact/index.js.map +1 -1
  46. package/dist/destinations/index.js +1 -0
  47. package/dist/destinations/index.js.map +1 -1
  48. package/dist/destinations/linkedin-audiences/updateAudience/index.js +1 -2
  49. package/dist/destinations/linkedin-audiences/updateAudience/index.js.map +1 -1
  50. package/dist/destinations/listrak/updateEmailContactProfileFields/index.js.map +1 -1
  51. package/dist/destinations/m3ter/auth.js.map +1 -1
  52. package/dist/destinations/m3ter/submitMeasurements/index.js +3 -3
  53. package/dist/destinations/m3ter/submitMeasurements/index.js.map +1 -1
  54. package/dist/destinations/optimizely-feature-experimentation-actions/index.js +3 -1
  55. package/dist/destinations/optimizely-feature-experimentation-actions/index.js.map +1 -1
  56. package/dist/destinations/optimizely-feature-experimentation-actions/trackEvent/functions.js +3 -1
  57. package/dist/destinations/optimizely-feature-experimentation-actions/trackEvent/functions.js.map +1 -1
  58. package/dist/destinations/optimizely-feature-experimentation-actions/trackEvent/index.js +3 -1
  59. package/dist/destinations/optimizely-feature-experimentation-actions/trackEvent/index.js.map +1 -1
  60. package/dist/destinations/playerzero-cloud/identifyUser/index.js +3 -3
  61. package/dist/destinations/salesforce/account/generated-types.d.ts +1 -0
  62. package/dist/destinations/salesforce/account/index.js +1 -0
  63. package/dist/destinations/salesforce/account/index.js.map +1 -1
  64. package/dist/destinations/salesforce/cases/generated-types.d.ts +1 -0
  65. package/dist/destinations/salesforce/cases/index.js +1 -0
  66. package/dist/destinations/salesforce/cases/index.js.map +1 -1
  67. package/dist/destinations/salesforce/contact/generated-types.d.ts +1 -0
  68. package/dist/destinations/salesforce/contact/index.js +1 -0
  69. package/dist/destinations/salesforce/contact/index.js.map +1 -1
  70. package/dist/destinations/salesforce/customObject/generated-types.d.ts +1 -0
  71. package/dist/destinations/salesforce/customObject/index.js +1 -0
  72. package/dist/destinations/salesforce/customObject/index.js.map +1 -1
  73. package/dist/destinations/salesforce/lead/generated-types.d.ts +1 -0
  74. package/dist/destinations/salesforce/lead/index.js +1 -0
  75. package/dist/destinations/salesforce/lead/index.js.map +1 -1
  76. package/dist/destinations/salesforce/opportunity/generated-types.d.ts +1 -0
  77. package/dist/destinations/salesforce/opportunity/index.js +1 -0
  78. package/dist/destinations/salesforce/opportunity/index.js.map +1 -1
  79. package/dist/destinations/salesforce/sf-operations.d.ts +7 -6
  80. package/dist/destinations/salesforce/sf-operations.js +15 -8
  81. package/dist/destinations/salesforce/sf-operations.js.map +1 -1
  82. package/dist/destinations/salesforce/sf-properties.d.ts +1 -0
  83. package/dist/destinations/salesforce/sf-properties.js +9 -1
  84. package/dist/destinations/salesforce/sf-properties.js.map +1 -1
  85. package/dist/destinations/salesforce/sf-utils.js +8 -10
  86. package/dist/destinations/salesforce/sf-utils.js.map +1 -1
  87. package/dist/destinations/salesforce-marketing-cloud/contactDataExtension/generated-types.d.ts +1 -0
  88. package/dist/destinations/salesforce-marketing-cloud/contactDataExtension/index.js +2 -1
  89. package/dist/destinations/salesforce-marketing-cloud/contactDataExtension/index.js.map +1 -1
  90. package/dist/destinations/salesforce-marketing-cloud/dataExtension/generated-types.d.ts +1 -0
  91. package/dist/destinations/salesforce-marketing-cloud/dataExtension/index.js +2 -1
  92. package/dist/destinations/salesforce-marketing-cloud/dataExtension/index.js.map +1 -1
  93. package/dist/destinations/salesforce-marketing-cloud/sfmc-properties.d.ts +1 -0
  94. package/dist/destinations/salesforce-marketing-cloud/sfmc-properties.js +8 -1
  95. package/dist/destinations/salesforce-marketing-cloud/sfmc-properties.js.map +1 -1
  96. package/dist/destinations/segment/properties.js +4 -4
  97. package/dist/destinations/segment/properties.js.map +1 -1
  98. package/dist/destinations/segment/sendGroup/index.js +6 -1
  99. package/dist/destinations/segment/sendGroup/index.js.map +1 -1
  100. package/dist/destinations/segment/sendIdentify/index.js +6 -1
  101. package/dist/destinations/segment/sendIdentify/index.js.map +1 -1
  102. package/dist/destinations/segment/sendPage/index.js +6 -1
  103. package/dist/destinations/segment/sendPage/index.js.map +1 -1
  104. package/dist/destinations/segment/sendScreen/index.js +6 -1
  105. package/dist/destinations/segment/sendScreen/index.js.map +1 -1
  106. package/dist/destinations/segment/sendTrack/index.js +6 -1
  107. package/dist/destinations/segment/sendTrack/index.js.map +1 -1
  108. package/dist/destinations/segment-profiles/index.js +3 -1
  109. package/dist/destinations/segment-profiles/index.js.map +1 -1
  110. package/dist/destinations/segment-profiles/segment-properties.d.ts +6 -0
  111. package/dist/destinations/segment-profiles/segment-properties.js +34 -1
  112. package/dist/destinations/segment-profiles/segment-properties.js.map +1 -1
  113. package/dist/destinations/segment-profiles/sendGroup/index.js +5 -1
  114. package/dist/destinations/segment-profiles/sendGroup/index.js.map +1 -1
  115. package/dist/destinations/segment-profiles/sendIdentify/index.js +8 -3
  116. package/dist/destinations/segment-profiles/sendIdentify/index.js.map +1 -1
  117. package/dist/destinations/segment-profiles/sendSubscription/generated-types.d.ts +16 -0
  118. package/dist/destinations/segment-profiles/sendSubscription/generated-types.js +3 -0
  119. package/dist/destinations/segment-profiles/sendSubscription/generated-types.js.map +1 -0
  120. package/dist/destinations/segment-profiles/sendSubscription/index.d.ts +5 -0
  121. package/dist/destinations/segment-profiles/sendSubscription/index.js +117 -0
  122. package/dist/destinations/segment-profiles/sendSubscription/index.js.map +1 -0
  123. package/dist/destinations/snap-conversions-api/_tests_/index.test.js +37 -0
  124. package/dist/destinations/snap-conversions-api/_tests_/index.test.js.map +1 -1
  125. package/dist/destinations/snap-conversions-api/reportConversionEvent/generated-types.d.ts +8 -0
  126. package/dist/destinations/snap-conversions-api/reportConversionEvent/index.js +2 -0
  127. package/dist/destinations/snap-conversions-api/reportConversionEvent/index.js.map +1 -1
  128. package/dist/destinations/snap-conversions-api/snap-capi-properties.d.ts +2 -0
  129. package/dist/destinations/snap-conversions-api/snap-capi-properties.js +96 -5
  130. package/dist/destinations/snap-conversions-api/snap-capi-properties.js.map +1 -1
  131. package/dist/destinations/the-trade-desk-crm/index.js +1 -1
  132. package/dist/destinations/webhook-audiences/index.js +13 -1
  133. package/dist/destinations/webhook-audiences/index.js.map +1 -1
  134. package/package.json +4 -4
  135. package/dist/destinations/liveramp-audiences/audienceEnteredSFTP.types.d.ts +0 -16
  136. package/dist/destinations/liveramp-audiences/audienceEnteredSFTP.types.js.map +0 -1
@@ -0,0 +1,5 @@
1
+ export interface PublishRequestAttribute {
2
+ name: string;
3
+ value: string;
4
+ setAt: number;
5
+ }
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=audienceEnteredSFTP.types.js.map
3
+ //# sourceMappingURL=attribute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attribute.js","sourceRoot":"","sources":["../../../src/destinations/absmartly/attribute.ts"],"names":[],"mappings":""}
@@ -0,0 +1,20 @@
1
+ import { InputField, JSONObject, ModifiedResponse, RequestClient } from '@segment/actions-core';
2
+ import { Settings } from './generated-types';
3
+ import { PublishRequestUnit } from './unit';
4
+ import { PublishRequestAttribute } from './attribute';
5
+ import { PublishRequestGoal } from './goal';
6
+ import { Data } from 'ws';
7
+ export interface PublishRequestEvent {
8
+ publishedAt: number;
9
+ units: PublishRequestUnit[];
10
+ goals?: PublishRequestGoal[];
11
+ exposures?: JSONObject[];
12
+ attributes?: PublishRequestAttribute[];
13
+ }
14
+ export interface DefaultPayload {
15
+ publishedAt: string | number;
16
+ agent?: string;
17
+ application?: string;
18
+ }
19
+ export declare const defaultEventFields: Record<string, InputField>;
20
+ export declare function sendEvent(request: RequestClient, settings: Settings, event: PublishRequestEvent, agent?: string, application?: string): Promise<ModifiedResponse<Data>>;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendEvent = exports.defaultEventFields = void 0;
4
+ exports.defaultEventFields = {
5
+ publishedAt: {
6
+ label: 'Event Sent Time',
7
+ type: 'datetime',
8
+ required: true,
9
+ description: 'Exact timestamp when the event was sent (measured by the client clock). Must be an ISO 8601 date-time string, or a Unix timestamp (milliseconds) number',
10
+ default: {
11
+ '@path': '$.sentAt'
12
+ }
13
+ },
14
+ agent: {
15
+ label: 'Agent',
16
+ type: 'string',
17
+ required: false,
18
+ description: 'Optional agent identifier that originated the event. Used to identify which SDK generated the event.',
19
+ default: {
20
+ '@if': {
21
+ exists: { '@path': '$.context.library.name' },
22
+ then: { '@path': '$.context.library.name' },
23
+ else: 'segment'
24
+ }
25
+ }
26
+ },
27
+ application: {
28
+ label: 'Application',
29
+ type: 'string',
30
+ required: false,
31
+ description: 'Optional application name that originated this event. Must exist if not empty. Create Applications in the Settings > Applications section of the ABsmartly Web Console'
32
+ }
33
+ };
34
+ function sendEvent(request, settings, event, agent, application) {
35
+ agent = agent?.trim() ?? '';
36
+ application = application?.trim() ?? '';
37
+ const headers = {
38
+ 'X-Agent': agent.length > 0 ? agent : 'segment'
39
+ };
40
+ if (application !== '') {
41
+ headers['X-Application'] = application;
42
+ headers['X-Application-Version'] = '0';
43
+ }
44
+ return request(`${settings.collectorEndpoint}/context`, {
45
+ method: 'put',
46
+ headers,
47
+ json: event
48
+ });
49
+ }
50
+ exports.sendEvent = sendEvent;
51
+ //# sourceMappingURL=event.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event.js","sourceRoot":"","sources":["../../../src/destinations/absmartly/event.ts"],"names":[],"mappings":";;;AAqBa,QAAA,kBAAkB,GAA+B;IAC5D,WAAW,EAAE;QACX,KAAK,EAAE,iBAAiB;QACxB,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE,IAAI;QACd,WAAW,EACT,yJAAyJ;QAC3J,OAAO,EAAE;YACP,OAAO,EAAE,UAAU;SACpB;KACF;IACD,KAAK,EAAE;QACL,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,KAAK;QACf,WAAW,EAAE,sGAAsG;QACnH,OAAO,EAAE;YACP,KAAK,EAAE;gBACL,MAAM,EAAE,EAAE,OAAO,EAAE,wBAAwB,EAAE;gBAC7C,IAAI,EAAE,EAAE,OAAO,EAAE,wBAAwB,EAAE;gBAC3C,IAAI,EAAE,SAAS;aAChB;SACF;KACF;IACD,WAAW,EAAE;QACX,KAAK,EAAE,aAAa;QACpB,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,KAAK;QACf,WAAW,EACT,wKAAwK;KAC3K;CACF,CAAA;AAED,SAAgB,SAAS,CACvB,OAAsB,EACtB,QAAkB,EAClB,KAA0B,EAC1B,KAAc,EACd,WAAoB;IAEpB,KAAK,GAAG,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,CAAA;IAC3B,WAAW,GAAG,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,CAAA;IAEvC,MAAM,OAAO,GAA2B;QACtC,SAAS,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;KAChD,CAAA;IAED,IAAI,WAAW,KAAK,EAAE,EAAE;QACtB,OAAO,CAAC,eAAe,CAAC,GAAG,WAAW,CAAA;QACtC,OAAO,CAAC,uBAAuB,CAAC,GAAG,GAAG,CAAA;KACvC;IAED,OAAO,OAAO,CAAC,GAAG,QAAQ,CAAC,iBAAiB,UAAU,EAAE;QACtD,MAAM,EAAE,KAAK;QACb,OAAO;QACP,IAAI,EAAE,KAAK;KACZ,CAAC,CAAA;AACJ,CAAC;AAxBD,8BAwBC"}
@@ -0,0 +1,9 @@
1
+ import { InputField, ModifiedResponse, RequestClient } from '@segment/actions-core';
2
+ import { DefaultPayload } from './event';
3
+ import { Settings } from './generated-types';
4
+ import { Data } from 'ws';
5
+ export interface ExposurePayload extends DefaultPayload {
6
+ exposure: Record<string, unknown>;
7
+ }
8
+ export declare const defaultExposureFields: Record<string, InputField>;
9
+ export declare function sendExposure(request: RequestClient, payload: ExposurePayload, settings: Settings): Promise<ModifiedResponse<Data>>;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendExposure = exports.defaultExposureFields = void 0;
4
+ const actions_core_1 = require("@segment/actions-core");
5
+ const event_1 = require("./event");
6
+ const timestamp_1 = require("./timestamp");
7
+ exports.defaultExposureFields = {
8
+ exposure: {
9
+ label: 'ABsmartly Exposure Payload',
10
+ type: 'object',
11
+ defaultObjectUI: 'object:only',
12
+ required: true,
13
+ description: 'The ABsmartly exposure payload without any goals. Generated by the ABsmartly SDK and should not be modified.',
14
+ default: {
15
+ '@path': '$.properties.exposure'
16
+ }
17
+ },
18
+ ...event_1.defaultEventFields
19
+ };
20
+ function isValidExposure(exposure) {
21
+ if (exposure == null || typeof exposure != 'object') {
22
+ return false;
23
+ }
24
+ const units = exposure['units'];
25
+ if (!Array.isArray(units) || units.length == 0) {
26
+ return false;
27
+ }
28
+ const exposures = exposure['exposures'];
29
+ if (!Array.isArray(exposures) || exposures.length === 0) {
30
+ return false;
31
+ }
32
+ const goals = exposure['goals'];
33
+ if (goals != null && (!Array.isArray(goals) || goals.length > 0)) {
34
+ return false;
35
+ }
36
+ const attributes = exposure['attributes'];
37
+ if (attributes != null && !Array.isArray(attributes)) {
38
+ return false;
39
+ }
40
+ return true;
41
+ }
42
+ function sendExposure(request, payload, settings) {
43
+ if (!timestamp_1.isValidTimestamp(payload.publishedAt)) {
44
+ throw new actions_core_1.PayloadValidationError('Exposure `publishedAt` is required to be an ISO 8601 date-time string, or a Unix timestamp (milliseconds) number');
45
+ }
46
+ const exposure = payload.exposure;
47
+ if (exposure == null || typeof exposure != 'object') {
48
+ throw new actions_core_1.PayloadValidationError('Field `exposure` is required to be an object when tracking exposures');
49
+ }
50
+ if (!isValidExposure(exposure)) {
51
+ throw new actions_core_1.PayloadValidationError('Field `exposure` is malformed or contains goals. Ensure you are sending a valid ABsmartly exposure payload without goals.');
52
+ }
53
+ return event_1.sendEvent(request, settings, {
54
+ ...exposure,
55
+ publishedAt: timestamp_1.unixTimestampOf(payload.publishedAt)
56
+ }, payload.agent, payload.application);
57
+ }
58
+ exports.sendExposure = sendExposure;
59
+ //# sourceMappingURL=exposure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exposure.js","sourceRoot":"","sources":["../../../src/destinations/absmartly/exposure.ts"],"names":[],"mappings":";;;AAAA,wDAA2G;AAC3G,mCAA4F;AAE5F,2CAA+D;AAOlD,QAAA,qBAAqB,GAA+B;IAC/D,QAAQ,EAAE;QACR,KAAK,EAAE,4BAA4B;QACnC,IAAI,EAAE,QAAQ;QACd,eAAe,EAAE,aAAa;QAC9B,QAAQ,EAAE,IAAI;QACd,WAAW,EACT,8GAA8G;QAChH,OAAO,EAAE;YACP,OAAO,EAAE,uBAAuB;SACjC;KACF;IACD,GAAG,0BAAkB;CACtB,CAAA;AAED,SAAS,eAAe,CAAC,QAAwD;IAC/E,IAAI,QAAQ,IAAI,IAAI,IAAI,OAAO,QAAQ,IAAI,QAAQ,EAAE;QACnD,OAAO,KAAK,CAAA;KACb;IAED,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAA;IAC/B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC,EAAE;QAC9C,OAAO,KAAK,CAAA;KACb;IAED,MAAM,SAAS,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAA;IACvC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;QACvD,OAAO,KAAK,CAAA;KACb;IAED,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAA;IAC/B,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE;QAChE,OAAO,KAAK,CAAA;KACb;IAED,MAAM,UAAU,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAA;IACzC,IAAI,UAAU,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;QACpD,OAAO,KAAK,CAAA;KACb;IAED,OAAO,IAAI,CAAA;AACb,CAAC;AAED,SAAgB,YAAY,CAC1B,OAAsB,EACtB,OAAwB,EACxB,QAAkB;IAElB,IAAI,CAAC,4BAAgB,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;QAC1C,MAAM,IAAI,qCAAsB,CAC9B,kHAAkH,CACnH,CAAA;KACF;IAED,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;IACjC,IAAI,QAAQ,IAAI,IAAI,IAAI,OAAO,QAAQ,IAAI,QAAQ,EAAE;QACnD,MAAM,IAAI,qCAAsB,CAAC,sEAAsE,CAAC,CAAA;KACzG;IAED,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE;QAC9B,MAAM,IAAI,qCAAsB,CAC9B,2HAA2H,CAC5H,CAAA;KACF;IAED,OAAO,iBAAS,CACd,OAAO,EACP,QAAQ,EACR;QACE,GAAG,QAAQ;QACX,WAAW,EAAE,2BAAe,CAAC,OAAO,CAAC,WAAW,CAAC;KAClD,EACD,OAAO,CAAC,KAAK,EACb,OAAO,CAAC,WAAW,CACpB,CAAA;AACH,CAAC;AAhCD,oCAgCC"}
@@ -0,0 +1,5 @@
1
+ export interface Settings {
2
+ collectorEndpoint: string;
3
+ apiKey: string;
4
+ environment: string;
5
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/destinations/absmartly/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import { Units } from './unit';
2
+ import { InputField, ModifiedResponse, RequestClient } from '@segment/actions-core';
3
+ import { DefaultPayload } from './event';
4
+ import { Settings } from './generated-types';
5
+ import { Data } from 'ws';
6
+ export interface PublishRequestGoal {
7
+ name: string;
8
+ achievedAt: number;
9
+ properties: null | Record<string, unknown>;
10
+ }
11
+ export interface GoalPayload extends Units, DefaultPayload {
12
+ name: string;
13
+ achievedAt: string | number;
14
+ properties?: null | Record<string, unknown>;
15
+ }
16
+ export declare const defaultGoalFields: Record<string, InputField>;
17
+ export declare function sendGoal(request: RequestClient, payload: GoalPayload, settings: Settings): Promise<ModifiedResponse<Data>>;
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendGoal = exports.defaultGoalFields = void 0;
4
+ const unit_1 = require("./unit");
5
+ const actions_core_1 = require("@segment/actions-core");
6
+ const event_1 = require("./event");
7
+ const timestamp_1 = require("./timestamp");
8
+ exports.defaultGoalFields = {
9
+ units: {
10
+ label: 'Units',
11
+ type: 'object',
12
+ required: true,
13
+ description: 'The units of the goal to track. Mapping of unit name to source property in the event payload. Create Units in the Settings > Units section of the ABsmartly Web Console',
14
+ defaultObjectUI: 'keyvalue:only',
15
+ default: {
16
+ anonymousId: {
17
+ '@path': '$.anonymousId'
18
+ },
19
+ userId: {
20
+ '@path': '$.userId'
21
+ }
22
+ }
23
+ },
24
+ name: {
25
+ label: 'Goal Name',
26
+ type: 'string',
27
+ required: true,
28
+ description: 'The name of the goal to track',
29
+ default: {
30
+ '@path': '$.event'
31
+ }
32
+ },
33
+ achievedAt: {
34
+ label: 'Goal Achievement Time',
35
+ type: 'datetime',
36
+ required: true,
37
+ description: 'Exact timestamp when the goal was achieved (measured by the client clock). Must be an ISO 8601 date-time string, or a Unix timestamp (milliseconds) number',
38
+ default: {
39
+ '@path': '$.originalTimestamp'
40
+ }
41
+ },
42
+ properties: {
43
+ label: 'Goal Properties',
44
+ type: 'object',
45
+ required: true,
46
+ description: 'Custom properties of the goal',
47
+ default: {
48
+ '@path': '$.properties'
49
+ }
50
+ },
51
+ ...event_1.defaultEventFields
52
+ };
53
+ function sendGoal(request, payload, settings) {
54
+ if (typeof payload.name !== 'string' || payload.name.length == 0) {
55
+ throw new actions_core_1.PayloadValidationError('Goal `name` is required to be a non-empty string');
56
+ }
57
+ if (!timestamp_1.isValidTimestamp(payload.publishedAt)) {
58
+ throw new actions_core_1.PayloadValidationError('Goal `publishedAt` is required to be an ISO 8601 date-time string, or a Unix timestamp (milliseconds) number');
59
+ }
60
+ if (!timestamp_1.isValidTimestamp(payload.achievedAt)) {
61
+ throw new actions_core_1.PayloadValidationError('Goal `achievedAt` is required to be an ISO 8601 date-time string, or a Unix timestamp (milliseconds) number');
62
+ }
63
+ if (payload.properties != null && typeof payload.properties != 'object') {
64
+ throw new actions_core_1.PayloadValidationError('Goal `properties` if present is required to be an object');
65
+ }
66
+ const event = {
67
+ publishedAt: timestamp_1.unixTimestampOf(payload.publishedAt),
68
+ units: unit_1.mapUnits(payload),
69
+ goals: [
70
+ {
71
+ name: payload.name,
72
+ achievedAt: timestamp_1.unixTimestampOf(payload.achievedAt),
73
+ properties: payload.properties ?? null
74
+ }
75
+ ]
76
+ };
77
+ return event_1.sendEvent(request, settings, event, payload.agent, payload.application);
78
+ }
79
+ exports.sendGoal = sendGoal;
80
+ //# sourceMappingURL=goal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"goal.js","sourceRoot":"","sources":["../../../src/destinations/absmartly/goal.ts"],"names":[],"mappings":";;;AAAA,iCAAwC;AACxC,wDAA2G;AAC3G,mCAA4F;AAE5F,2CAA+D;AAelD,QAAA,iBAAiB,GAA+B;IAC3D,KAAK,EAAE;QACL,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,WAAW,EACT,yKAAyK;QAC3K,eAAe,EAAE,eAAe;QAChC,OAAO,EAAE;YACP,WAAW,EAAE;gBACX,OAAO,EAAE,eAAe;aACzB;YACD,MAAM,EAAE;gBACN,OAAO,EAAE,UAAU;aACpB;SACF;KACF;IACD,IAAI,EAAE;QACJ,KAAK,EAAE,WAAW;QAClB,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,+BAA+B;QAC5C,OAAO,EAAE;YACP,OAAO,EAAE,SAAS;SACnB;KACF;IACD,UAAU,EAAE;QACV,KAAK,EAAE,uBAAuB;QAC9B,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE,IAAI;QACd,WAAW,EACT,4JAA4J;QAC9J,OAAO,EAAE;YACP,OAAO,EAAE,qBAAqB;SAC/B;KACF;IACD,UAAU,EAAE;QACV,KAAK,EAAE,iBAAiB;QACxB,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,+BAA+B;QAC5C,OAAO,EAAE;YACP,OAAO,EAAE,cAAc;SACxB;KACF;IACD,GAAG,0BAAkB;CACtB,CAAA;AAED,SAAgB,QAAQ,CACtB,OAAsB,EACtB,OAAoB,EACpB,QAAkB;IAElB,IAAI,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,EAAE;QAChE,MAAM,IAAI,qCAAsB,CAAC,kDAAkD,CAAC,CAAA;KACrF;IAED,IAAI,CAAC,4BAAgB,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;QAC1C,MAAM,IAAI,qCAAsB,CAC9B,8GAA8G,CAC/G,CAAA;KACF;IAED,IAAI,CAAC,4BAAgB,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;QACzC,MAAM,IAAI,qCAAsB,CAC9B,6GAA6G,CAC9G,CAAA;KACF;IAED,IAAI,OAAO,CAAC,UAAU,IAAI,IAAI,IAAI,OAAO,OAAO,CAAC,UAAU,IAAI,QAAQ,EAAE;QACvE,MAAM,IAAI,qCAAsB,CAAC,0DAA0D,CAAC,CAAA;KAC7F;IAED,MAAM,KAAK,GAAwB;QACjC,WAAW,EAAE,2BAAe,CAAC,OAAO,CAAC,WAAW,CAAC;QACjD,KAAK,EAAE,eAAQ,CAAC,OAAO,CAAC;QACxB,KAAK,EAAE;YACL;gBACE,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,UAAU,EAAE,2BAAe,CAAC,OAAO,CAAC,UAAU,CAAC;gBAC/C,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,IAAI;aACvC;SACF;KACF,CAAA;IAED,OAAO,iBAAS,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,WAAW,CAAC,CAAA;AAChF,CAAC;AAtCD,4BAsCC"}
@@ -0,0 +1,4 @@
1
+ import type { DestinationDefinition } from '@segment/actions-core';
2
+ import type { Settings } from './generated-types';
3
+ declare const destination: DestinationDefinition<Settings>;
4
+ export default destination;
@@ -0,0 +1,101 @@
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 trackGoal_1 = __importDefault(require("./trackGoal"));
7
+ const trackExposure_1 = __importDefault(require("./trackExposure"));
8
+ const actions_core_1 = require("@segment/actions-core");
9
+ function patch(field, patch) {
10
+ return {
11
+ ...field,
12
+ ...patch
13
+ };
14
+ }
15
+ const presets = [
16
+ {
17
+ name: 'Track Calls',
18
+ subscribe: 'type = "track" and event != "Experiment Viewed"',
19
+ partnerAction: 'trackGoal',
20
+ mapping: actions_core_1.defaultValues(trackGoal_1.default.fields),
21
+ type: 'automatic'
22
+ },
23
+ {
24
+ name: 'Page Calls',
25
+ subscribe: 'type = "page"',
26
+ partnerAction: 'trackGoal',
27
+ mapping: actions_core_1.defaultValues({
28
+ ...trackGoal_1.default.fields,
29
+ name: patch(trackGoal_1.default.fields.name, { default: { '@template': 'Page: {{ name }}' } })
30
+ }),
31
+ type: 'automatic'
32
+ },
33
+ {
34
+ name: 'Screen Calls',
35
+ subscribe: 'type = "screen"',
36
+ partnerAction: 'trackGoal',
37
+ mapping: actions_core_1.defaultValues({
38
+ ...trackGoal_1.default.fields,
39
+ name: patch(trackGoal_1.default.fields.name, { default: { '@template': 'Screen: {{ name }}' } })
40
+ }),
41
+ type: 'automatic'
42
+ },
43
+ {
44
+ name: 'Exposures (Verbatim)',
45
+ subscribe: 'type = "track" and event = "Experiment Viewed"',
46
+ partnerAction: 'trackExposure',
47
+ mapping: actions_core_1.defaultValues(trackExposure_1.default.fields),
48
+ type: 'automatic'
49
+ }
50
+ ];
51
+ const destination = {
52
+ name: 'ABsmartly (Actions)',
53
+ slug: 'actions-absmartly',
54
+ mode: 'cloud',
55
+ description: 'ABsmartly is an online experimentation service. Send events to ABsmartly to track experiments and goals.',
56
+ authentication: {
57
+ scheme: 'custom',
58
+ fields: {
59
+ collectorEndpoint: {
60
+ label: 'Collector Endpoint',
61
+ description: "ABsmartly Collector endpoint, for example: https://you-subdomain.absmartly.io/v1 - Contact ABsmartly Support if you don't know your Collector Endpoint.",
62
+ format: 'uri',
63
+ type: 'string',
64
+ required: true
65
+ },
66
+ apiKey: {
67
+ label: 'API Key',
68
+ description: 'ABsmartly SDK API Key. Create SDK Api Keys in the Settings > API Keys section of the ABsmartly Web Console',
69
+ type: 'string',
70
+ required: true
71
+ },
72
+ environment: {
73
+ label: 'Environment',
74
+ description: "Environment name. Environment name needs to match what's in the Web Console. Create Environments in the Settings > Environments section of the ABsmartly Web Console",
75
+ type: 'string',
76
+ required: true
77
+ }
78
+ },
79
+ testAuthentication: async (request, { settings }) => {
80
+ return request(`${settings.collectorEndpoint}/context/authed`, {
81
+ method: 'get'
82
+ });
83
+ }
84
+ },
85
+ extendRequest({ settings }) {
86
+ return {
87
+ headers: {
88
+ 'X-API-Key': settings.apiKey,
89
+ 'X-Environment': settings.environment,
90
+ 'Content-Type': 'application/json'
91
+ }
92
+ };
93
+ },
94
+ presets,
95
+ actions: {
96
+ trackGoal: trackGoal_1.default,
97
+ trackExposure: trackExposure_1.default
98
+ }
99
+ };
100
+ exports.default = destination;
101
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/absmartly/index.ts"],"names":[],"mappings":";;;;;AAGA,4DAAmC;AACnC,oEAA2C;AAC3C,wDAAiE;AAEjE,SAAS,KAAK,CAAC,KAAiB,EAAE,KAA0B;IAC1D,OAAO;QACL,GAAG,KAAK;QACR,GAAG,KAAK;KACT,CAAA;AACH,CAAC;AAED,MAAM,OAAO,GAAa;IACxB;QACE,IAAI,EAAE,aAAa;QACnB,SAAS,EAAE,iDAAiD;QAC5D,aAAa,EAAE,WAAW;QAC1B,OAAO,EAAE,4BAAa,CAAC,mBAAS,CAAC,MAAM,CAAC;QACxC,IAAI,EAAE,WAAW;KAClB;IACD;QACE,IAAI,EAAE,YAAY;QAClB,SAAS,EAAE,eAAe;QAC1B,aAAa,EAAE,WAAW;QAC1B,OAAO,EAAE,4BAAa,CAAC;YACrB,GAAG,mBAAS,CAAC,MAAM;YACnB,IAAI,EAAE,KAAK,CAAC,mBAAS,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,EAAE,WAAW,EAAE,kBAAkB,EAAE,EAAE,CAAC;SACrF,CAAC;QACF,IAAI,EAAE,WAAW;KAClB;IACD;QACE,IAAI,EAAE,cAAc;QACpB,SAAS,EAAE,iBAAiB;QAC5B,aAAa,EAAE,WAAW;QAC1B,OAAO,EAAE,4BAAa,CAAC;YACrB,GAAG,mBAAS,CAAC,MAAM;YACnB,IAAI,EAAE,KAAK,CAAC,mBAAS,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,EAAE,WAAW,EAAE,oBAAoB,EAAE,EAAE,CAAC;SACvF,CAAC;QACF,IAAI,EAAE,WAAW;KAClB;IACD;QACE,IAAI,EAAE,sBAAsB;QAC5B,SAAS,EAAE,gDAAgD;QAC3D,aAAa,EAAE,eAAe;QAC9B,OAAO,EAAE,4BAAa,CAAC,uBAAa,CAAC,MAAM,CAAC;QAC5C,IAAI,EAAE,WAAW;KAClB;CACF,CAAA;AAED,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,qBAAqB;IAC3B,IAAI,EAAE,mBAAmB;IACzB,IAAI,EAAE,OAAO;IACb,WAAW,EACT,0GAA0G;IAE5G,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,iBAAiB,EAAE;gBACjB,KAAK,EAAE,oBAAoB;gBAC3B,WAAW,EACT,yJAAyJ;gBAC3J,MAAM,EAAE,KAAK;gBACb,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;YACD,MAAM,EAAE;gBACN,KAAK,EAAE,SAAS;gBAChB,WAAW,EACT,4GAA4G;gBAC9G,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;YACD,WAAW,EAAE;gBACX,KAAK,EAAE,aAAa;gBACpB,WAAW,EACT,sKAAsK;gBACxK,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;SACF;QACD,kBAAkB,EAAE,KAAK,EAAE,OAAsB,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;YACjE,OAAO,OAAO,CAAC,GAAG,QAAQ,CAAC,iBAAiB,iBAAiB,EAAE;gBAC7D,MAAM,EAAE,KAAK;aACd,CAAC,CAAA;QACJ,CAAC;KACF;IAED,aAAa,CAAC,EAAE,QAAQ,EAAE;QACxB,OAAO;YACL,OAAO,EAAE;gBACP,WAAW,EAAE,QAAQ,CAAC,MAAM;gBAC5B,eAAe,EAAE,QAAQ,CAAC,WAAW;gBACrC,cAAc,EAAE,kBAAkB;aACnC;SACF,CAAA;IACH,CAAC;IAUD,OAAO;IACP,OAAO,EAAE;QACP,SAAS,EAAT,mBAAS;QACT,aAAa,EAAb,uBAAa;KACd;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
@@ -0,0 +1,3 @@
1
+ import { JSONPrimitive } from '@segment/actions-core';
2
+ export declare function isValidTimestamp(timestamp: JSONPrimitive): boolean;
3
+ export declare function unixTimestampOf(timestamp: JSONPrimitive): number;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.unixTimestampOf = exports.isValidTimestamp = void 0;
4
+ function isValidTimestamp(timestamp) {
5
+ if (typeof timestamp === 'number') {
6
+ return timestamp >= 1262304000000 && timestamp <= 2524608000000;
7
+ }
8
+ else if (typeof timestamp === 'string') {
9
+ return !isNaN(Date.parse(timestamp));
10
+ }
11
+ return false;
12
+ }
13
+ exports.isValidTimestamp = isValidTimestamp;
14
+ function unixTimestampOf(timestamp) {
15
+ if (typeof timestamp === 'number')
16
+ return timestamp;
17
+ return Date.parse(timestamp);
18
+ }
19
+ exports.unixTimestampOf = unixTimestampOf;
20
+ //# sourceMappingURL=timestamp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timestamp.js","sourceRoot":"","sources":["../../../src/destinations/absmartly/timestamp.ts"],"names":[],"mappings":";;;AAEA,SAAgB,gBAAgB,CAAC,SAAwB;IACvD,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;QACjC,OAAO,SAAS,IAAI,aAAa,IAAI,SAAS,IAAI,aAAa,CAAA;KAChE;SAAM,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;QACxC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAA;KACrC;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAPD,4CAOC;AAED,SAAgB,eAAe,CAAC,SAAwB;IACtD,IAAI,OAAO,SAAS,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAA;IACnD,OAAO,IAAI,CAAC,KAAK,CAAC,SAAmB,CAAC,CAAA;AACxC,CAAC;AAHD,0CAGC"}
@@ -0,0 +1,8 @@
1
+ export interface Payload {
2
+ exposure: {
3
+ [k: string]: unknown;
4
+ };
5
+ publishedAt: string | number;
6
+ agent?: string;
7
+ application?: string;
8
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/absmartly/trackExposure/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import type { ActionDefinition } from '@segment/actions-core';
2
+ import type { Settings } from '../generated-types';
3
+ import type { Payload } from './generated-types';
4
+ declare const action: ActionDefinition<Settings, Payload>;
5
+ export default action;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const exposure_1 = require("../exposure");
4
+ const fields = { ...exposure_1.defaultExposureFields };
5
+ const action = {
6
+ title: 'Track Exposure',
7
+ description: 'Send an experiment exposure event to ABsmartly',
8
+ fields: fields,
9
+ defaultSubscription: 'type = "track" and event = "Experiment Viewed"',
10
+ perform: (request, { payload, settings }) => {
11
+ return exposure_1.sendExposure(request, payload, settings);
12
+ }
13
+ };
14
+ exports.default = action;
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/absmartly/trackExposure/index.ts"],"names":[],"mappings":";;AAGA,0CAAiE;AAEjE,MAAM,MAAM,GAAG,EAAE,GAAG,gCAAqB,EAAE,CAAA;AAE3C,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,gBAAgB;IACvB,WAAW,EAAE,gDAAgD;IAC7D,MAAM,EAAE,MAAM;IACd,mBAAmB,EAAE,gDAAgD;IACrE,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;QAC1C,OAAO,uBAAY,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAA;IACjD,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -0,0 +1,13 @@
1
+ export interface Payload {
2
+ units: {
3
+ [k: string]: unknown;
4
+ };
5
+ name: string;
6
+ achievedAt: string | number;
7
+ properties: {
8
+ [k: string]: unknown;
9
+ };
10
+ publishedAt: string | number;
11
+ agent?: string;
12
+ application?: string;
13
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/absmartly/trackGoal/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import type { ActionDefinition } from '@segment/actions-core';
2
+ import type { Settings } from '../generated-types';
3
+ import type { Payload } from './generated-types';
4
+ declare const action: ActionDefinition<Settings, Payload>;
5
+ export default action;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const goal_1 = require("../goal");
4
+ const fields = { ...goal_1.defaultGoalFields };
5
+ const action = {
6
+ title: 'Track Goal',
7
+ description: 'Send a goal event to ABsmartly',
8
+ fields: fields,
9
+ defaultSubscription: 'type = "track" and event != "Experiment Viewed"',
10
+ perform: (request, { payload, settings }) => {
11
+ return goal_1.sendGoal(request, payload, settings);
12
+ }
13
+ };
14
+ exports.default = action;
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/absmartly/trackGoal/index.ts"],"names":[],"mappings":";;AAGA,kCAAqD;AAErD,MAAM,MAAM,GAAG,EAAE,GAAG,wBAAiB,EAAE,CAAA;AAEvC,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,YAAY;IACnB,WAAW,EAAE,gCAAgC;IAC7C,MAAM,EAAE,MAAM;IACd,mBAAmB,EAAE,iDAAiD;IACtE,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;QAC1C,OAAO,eAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAA;IAC7C,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -0,0 +1,8 @@
1
+ export interface Units {
2
+ units: Record<string, unknown>;
3
+ }
4
+ export interface PublishRequestUnit {
5
+ type: string;
6
+ uid: string;
7
+ }
8
+ export declare function mapUnits(payload: Units): PublishRequestUnit[];
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mapUnits = void 0;
4
+ function isUnit(value) {
5
+ return (typeof value === 'string' && value.trim().length > 0) || typeof value === 'number';
6
+ }
7
+ function mapUnits(payload) {
8
+ return Object.entries(payload.units)
9
+ .filter(([, uid]) => isUnit(uid))
10
+ .map(([type, uid]) => ({
11
+ type,
12
+ uid: String(uid)
13
+ }));
14
+ }
15
+ exports.mapUnits = mapUnits;
16
+ //# sourceMappingURL=unit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unit.js","sourceRoot":"","sources":["../../../src/destinations/absmartly/unit.ts"],"names":[],"mappings":";;;AASA,SAAS,MAAM,CAAC,KAAc;IAC5B,OAAO,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAA;AAC5F,CAAC;AAED,SAAgB,QAAQ,CAAC,OAAc;IACrC,OAAO,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC;SACjC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;SAChC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;QACrB,IAAI;QACJ,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC;KACjB,CAAC,CAAC,CAAA;AACP,CAAC;AAPD,4BAOC"}
@@ -181,16 +181,8 @@ class SendEmailPerformer extends utils_1.MessageSendPerformer {
181
181
  parsedBodyHtml = await this.parseTemplating(this.payload.bodyHtml ?? '', { profile, [previewApiLookup_1.apiLookupLiquidKey]: apiLookupData }, 'Body HTML');
182
182
  }
183
183
  if (this.payload.previewText) {
184
- try {
185
- const parsedPreviewText = await this.parseTemplating(this.payload.previewText, { profile }, 'Preview text');
186
- parsedBodyHtml = insertEmailPreviewText_1.insertEmailPreviewText(parsedBodyHtml, parsedPreviewText);
187
- }
188
- catch (ex) {
189
- this.logger?.error('Error inserting preview text, using original html', {
190
- ex
191
- });
192
- this.statsClient.incr('insert_preview_fail', 1);
193
- }
184
+ const parsedPreviewText = await this.parseTemplating(this.payload.previewText, { profile }, 'Preview text');
185
+ parsedBodyHtml = insertEmailPreviewText_1.insertEmailPreviewText(parsedBodyHtml, parsedPreviewText);
194
186
  }
195
187
  parsedBodyHtml = this.insertUnsubscribeLinks(parsedBodyHtml, emailProfile);
196
188
  return parsedBodyHtml;