@segment/analytics-browser-actions-ripe 1.0.0 → 1.3.0

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 (75) hide show
  1. package/.eslintcache +1 -0
  2. package/dist/cjs/generated-types.d.ts +5 -0
  3. package/dist/cjs/generated-types.js +3 -0
  4. package/dist/cjs/generated-types.js.map +1 -0
  5. package/dist/cjs/group/generated-types.d.ts +9 -0
  6. package/dist/cjs/group/generated-types.js +3 -0
  7. package/dist/cjs/group/generated-types.js.map +1 -0
  8. package/dist/cjs/group/index.d.ts +6 -0
  9. package/dist/cjs/group/index.js +58 -0
  10. package/dist/cjs/group/index.js.map +1 -0
  11. package/dist/cjs/identify/generated-types.d.ts +9 -0
  12. package/dist/cjs/identify/generated-types.js +3 -0
  13. package/dist/cjs/identify/generated-types.js.map +1 -0
  14. package/dist/cjs/identify/index.d.ts +6 -0
  15. package/dist/cjs/identify/index.js +58 -0
  16. package/dist/cjs/identify/index.js.map +1 -0
  17. package/dist/cjs/index.d.ts +11 -0
  18. package/dist/cjs/index.js +91 -0
  19. package/dist/cjs/index.js.map +1 -0
  20. package/dist/cjs/init-script.d.ts +1 -0
  21. package/dist/cjs/init-script.js +19 -0
  22. package/dist/cjs/init-script.js.map +1 -0
  23. package/dist/cjs/page/generated-types.d.ts +11 -0
  24. package/dist/cjs/page/generated-types.js +3 -0
  25. package/dist/cjs/page/generated-types.js.map +1 -0
  26. package/dist/cjs/page/index.d.ts +6 -0
  27. package/dist/cjs/page/index.js +86 -0
  28. package/dist/cjs/page/index.js.map +1 -0
  29. package/dist/cjs/track/generated-types.d.ts +10 -0
  30. package/dist/cjs/track/generated-types.js +3 -0
  31. package/dist/cjs/track/generated-types.js.map +1 -0
  32. package/dist/cjs/track/index.d.ts +6 -0
  33. package/dist/cjs/track/index.js +68 -0
  34. package/dist/cjs/track/index.js.map +1 -0
  35. package/dist/cjs/types.d.ts +34 -0
  36. package/dist/cjs/types.js +3 -0
  37. package/dist/cjs/types.js.map +1 -0
  38. package/dist/esm/generated-types.d.ts +5 -0
  39. package/dist/esm/generated-types.js +2 -0
  40. package/dist/esm/generated-types.js.map +1 -0
  41. package/dist/esm/group/generated-types.d.ts +9 -0
  42. package/dist/esm/group/generated-types.js +2 -0
  43. package/dist/esm/group/generated-types.js.map +1 -0
  44. package/dist/esm/group/index.d.ts +6 -0
  45. package/dist/esm/group/index.js +56 -0
  46. package/dist/esm/group/index.js.map +1 -0
  47. package/dist/esm/identify/generated-types.d.ts +9 -0
  48. package/dist/esm/identify/generated-types.js +2 -0
  49. package/dist/esm/identify/generated-types.js.map +1 -0
  50. package/dist/esm/identify/index.d.ts +6 -0
  51. package/dist/esm/identify/index.js +56 -0
  52. package/dist/esm/identify/index.js.map +1 -0
  53. package/dist/esm/index.d.ts +11 -0
  54. package/dist/esm/index.js +87 -0
  55. package/dist/esm/index.js.map +1 -0
  56. package/dist/esm/init-script.d.ts +1 -0
  57. package/dist/esm/init-script.js +15 -0
  58. package/dist/esm/init-script.js.map +1 -0
  59. package/dist/esm/page/generated-types.d.ts +11 -0
  60. package/dist/esm/page/generated-types.js +2 -0
  61. package/dist/esm/page/generated-types.js.map +1 -0
  62. package/dist/esm/page/index.d.ts +6 -0
  63. package/dist/esm/page/index.js +84 -0
  64. package/dist/esm/page/index.js.map +1 -0
  65. package/dist/esm/track/generated-types.d.ts +10 -0
  66. package/dist/esm/track/generated-types.js +2 -0
  67. package/dist/esm/track/generated-types.js.map +1 -0
  68. package/dist/esm/track/index.d.ts +6 -0
  69. package/dist/esm/track/index.js +66 -0
  70. package/dist/esm/track/index.js.map +1 -0
  71. package/dist/esm/types.d.ts +34 -0
  72. package/dist/esm/types.js +2 -0
  73. package/dist/esm/types.js.map +1 -0
  74. package/dist/tsconfig.tsbuildinfo +1 -0
  75. package/package.json +5 -4
@@ -0,0 +1,6 @@
1
+ import type { BrowserActionDefinition } from '@segment/browser-destination-runtime/types';
2
+ import type { Settings } from '../generated-types';
3
+ import type { Payload } from './generated-types';
4
+ import { RipeSDK } from '../types';
5
+ declare const action: BrowserActionDefinition<Settings, RipeSDK, Payload>;
6
+ export default action;
@@ -0,0 +1,56 @@
1
+ const action = {
2
+ title: 'Group',
3
+ description: 'Group user in Ripe',
4
+ defaultSubscription: 'type = "group"',
5
+ platform: 'web',
6
+ fields: {
7
+ anonymousId: {
8
+ type: 'string',
9
+ required: true,
10
+ description: 'The anonymous id',
11
+ label: 'Anonymous ID',
12
+ default: { '@path': '$.anonymousId' }
13
+ },
14
+ userId: {
15
+ type: 'string',
16
+ required: false,
17
+ allowNull: true,
18
+ description: 'The ID associated with the user',
19
+ label: 'User ID',
20
+ default: { '@path': '$.userId' }
21
+ },
22
+ groupId: {
23
+ type: 'string',
24
+ required: true,
25
+ allowNull: true,
26
+ description: 'The ID associated groupId',
27
+ label: 'Group ID',
28
+ default: { '@path': '$.groupId' }
29
+ },
30
+ traits: {
31
+ type: 'object',
32
+ label: 'Traits',
33
+ description: 'Traits to associate with the group',
34
+ required: false,
35
+ default: { '@path': '$.traits' }
36
+ },
37
+ messageId: {
38
+ type: 'string',
39
+ required: false,
40
+ description: 'The Segment messageId',
41
+ label: 'MessageId',
42
+ default: { '@path': '$.messageId' }
43
+ }
44
+ },
45
+ perform: async (ripe, { payload }) => {
46
+ return ripe.group({
47
+ messageId: payload.messageId,
48
+ anonymousId: payload.anonymousId,
49
+ userId: payload.userId,
50
+ groupId: payload.groupId,
51
+ traits: payload.traits
52
+ });
53
+ }
54
+ };
55
+ export default action;
56
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/group/index.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,GAAwD;IAClE,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,oBAAoB;IACjC,mBAAmB,EAAE,gBAAgB;IACrC,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE;QACN,WAAW,EAAE;YACX,IAAI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 +1,9 @@
1
+ export interface Payload {
2
+ anonymousId: string;
3
+ userId?: string | null;
4
+ groupId?: string | null;
5
+ traits?: {
6
+ [k: string]: unknown;
7
+ };
8
+ messageId?: string;
9
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/identify/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import type { BrowserActionDefinition } from '@segment/browser-destination-runtime/types';
2
+ import type { Settings } from '../generated-types';
3
+ import type { Payload } from './generated-types';
4
+ import { RipeSDK } from '../types';
5
+ declare const action: BrowserActionDefinition<Settings, RipeSDK, Payload>;
6
+ export default action;
@@ -0,0 +1,56 @@
1
+ const action = {
2
+ title: 'Identify',
3
+ description: 'Identify user in Ripe',
4
+ defaultSubscription: 'type = "identify"',
5
+ platform: 'web',
6
+ fields: {
7
+ anonymousId: {
8
+ type: 'string',
9
+ required: true,
10
+ description: 'The anonymous id',
11
+ label: 'Anonymous ID',
12
+ default: { '@path': '$.anonymousId' }
13
+ },
14
+ userId: {
15
+ type: 'string',
16
+ required: false,
17
+ allowNull: true,
18
+ description: 'The ID associated with the user',
19
+ label: 'User ID',
20
+ default: { '@path': '$.userId' }
21
+ },
22
+ groupId: {
23
+ type: 'string',
24
+ required: false,
25
+ allowNull: true,
26
+ description: 'The ID associated groupId',
27
+ label: 'Group ID',
28
+ default: { '@path': '$.context.groupId' }
29
+ },
30
+ traits: {
31
+ type: 'object',
32
+ label: 'Traits',
33
+ description: 'Traits to associate with the user',
34
+ required: false,
35
+ default: { '@path': '$.traits' }
36
+ },
37
+ messageId: {
38
+ type: 'string',
39
+ required: false,
40
+ description: 'The Segment messageId',
41
+ label: 'MessageId',
42
+ default: { '@path': '$.messageId' }
43
+ }
44
+ },
45
+ perform: async (ripe, { payload }) => {
46
+ return ripe.identify({
47
+ messageId: payload.messageId,
48
+ anonymousId: payload.anonymousId,
49
+ userId: payload.userId,
50
+ groupId: payload.groupId,
51
+ traits: payload.traits
52
+ });
53
+ }
54
+ };
55
+ export default action;
56
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/identify/index.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,GAAwD;IAClE,KAAK,EAAE,UAAU;IACjB,WAAW,EAAE,uBAAuB;IACpC,mBAAmB,EAAE,mBAAmB;IACxC,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE;QACN,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,kBAAkB;YAC/B,KAAK,EAAE,cAAc;YACrB,OAAO,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE;SACtC;QACD,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,SAAS,EAAE,IAAI;YACf,WAAW,EAAE,iCAAiC;YAC9C,KAAK,EAAE,SAAS;YAChB,OAAO,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;SACjC;QACD,OAAO,EAAE;YACP,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,SAAS,EAAE,IAAI;YACf,WAAW,EAAE,2BAA2B;YACxC,KAAK,EAAE,UAAU;YACjB,OAAO,EAAE,EAAE,OAAO,EAAE,mBAAmB,EAAE;SAC1C;QACD,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,QAAQ;YACf,WAAW,EAAE,mCAAmC;YAChD,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;SACjC;QACD,SAAS,EAAE;YACT,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,uBAAuB;YACpC,KAAK,EAAE,WAAW;YAClB,OAAO,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE;SACpC;KACF;IACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACnC,OAAO,IAAI,CAAC,QAAQ,CAAC;YACnB,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,eAAe,MAAM,CAAA"}
@@ -0,0 +1,11 @@
1
+ import type { Settings } from './generated-types';
2
+ import type { BrowserDestinationDefinition } from '@segment/browser-destination-runtime/types';
3
+ import { RipeSDK } from './types';
4
+ declare global {
5
+ interface Window {
6
+ Ripe: RipeSDK;
7
+ }
8
+ }
9
+ export declare const destination: BrowserDestinationDefinition<Settings, RipeSDK>;
10
+ declare const _default: import("@segment/browser-destination-runtime/types").PluginFactory;
11
+ export default _default;
@@ -0,0 +1,87 @@
1
+ import { browserDestination } from '@segment/browser-destination-runtime/shim';
2
+ import group from './group';
3
+ import identify from './identify';
4
+ import track from './track';
5
+ import { defaultValues } from '@segment/actions-core';
6
+ import { initScript } from './init-script';
7
+ import page from './page';
8
+ const defaultVersion = 'latest';
9
+ export const destination = {
10
+ name: 'Ripe Device Mode (Actions)',
11
+ slug: 'actions-ripe',
12
+ mode: 'device',
13
+ settings: {
14
+ sdkVersion: {
15
+ description: 'The version of the Ripe Widget SDK to use',
16
+ label: 'SDK Version',
17
+ type: 'string',
18
+ choices: [
19
+ {
20
+ value: 'latest',
21
+ label: 'latest'
22
+ }
23
+ ],
24
+ default: defaultVersion,
25
+ required: false
26
+ },
27
+ apiKey: {
28
+ description: 'The Ripe API key found in the Ripe App',
29
+ label: 'API Key',
30
+ type: 'string',
31
+ required: true
32
+ },
33
+ endpoint: {
34
+ label: 'API Endpoint',
35
+ description: `The Ripe API endpoint (do not change this unless you know what you're doing)`,
36
+ type: 'string',
37
+ format: 'uri',
38
+ default: 'https://storage.getripe.com'
39
+ }
40
+ },
41
+ initialize: async ({ settings }, deps) => {
42
+ initScript();
43
+ const { sdkVersion, apiKey } = settings;
44
+ const version = sdkVersion ?? defaultVersion;
45
+ const endpoint = settings.endpoint || 'https://storage.getripe.com';
46
+ await deps
47
+ .loadScript(`${endpoint}/sdk/${version}/sdk.umd.js`)
48
+ .catch((err) => console.error('Unable to load Ripe SDK script', err));
49
+ await deps.resolveWhen(() => Object.prototype.hasOwnProperty.call(window, 'Ripe'), 100);
50
+ await window.Ripe.init(apiKey);
51
+ return window.Ripe;
52
+ },
53
+ actions: {
54
+ group,
55
+ identify,
56
+ page,
57
+ track
58
+ },
59
+ presets: [
60
+ {
61
+ name: 'Group user',
62
+ subscribe: 'type = "group"',
63
+ partnerAction: 'group',
64
+ mapping: defaultValues(group.fields)
65
+ },
66
+ {
67
+ name: 'Identify user',
68
+ subscribe: 'type = "identify"',
69
+ partnerAction: 'identify',
70
+ mapping: defaultValues(identify.fields)
71
+ },
72
+ {
73
+ name: 'Page view',
74
+ subscribe: 'type = "page"',
75
+ partnerAction: 'page',
76
+ mapping: defaultValues(page.fields)
77
+ },
78
+ {
79
+ name: 'Track event',
80
+ subscribe: 'type = "track"',
81
+ partnerAction: 'track',
82
+ mapping: defaultValues(track.fields)
83
+ }
84
+ ]
85
+ };
86
+ export default browserDestination(destination);
87
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAA;AAG9E,OAAO,KAAK,MAAM,SAAS,CAAA;AAC3B,OAAO,QAAQ,MAAM,YAAY,CAAA;AACjC,OAAO,KAAK,MAAM,SAAS,CAAA;AAE3B,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AACrD,OAAO,EA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AC,WAAW,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,CAAA;QACvF,MAAM,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAE9B,OAAO,MAAM,CAAC,IAAI,CAAA;IACpB,CAAC;IAED,OAAO,EAAE;QACP,KAAK;QACL,QAAQ;QACR,IAAI;QACJ,KAAK;KACN;IAED,OAAO,EAAE;QACP;YACE,IAAI,EAAE,YAAY;YAClB,SAAS,EAAE,gBAAgB;YAC3B,aAAa,EAAE,OAAO;YACtB,OAAO,EAAE,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC;SACrC;QACD;YACE,IAAI,EAAE,eAAe;YACrB,SAAS,EAAE,mBAAmB;YAC9B,aAAa,EAAE,UAAU;YACzB,OAAO,EAAE,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC;SACxC;QACD;YACE,IAAI,EAAE,WAAW;YACjB,SAAS,EAAE,eAAe;YAC1B,aAAa,EAAE,MAAM;YACrB,OAAO,EAAE,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC;SACpC;QACD;YACE,IAAI,EAAE,aAAa;YACnB,SAAS,EAAE,gBAAgB;YAC3B,aAAa,EAAE,OAAO;YACtB,OAAO,EAAE,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC;SACrC;KACF;CACF,CAAA;AAED,eAAe,kBAAkB,CAAC,WAAW,CAAC,CAAA"}
@@ -0,0 +1 @@
1
+ export declare function initScript(): void;
@@ -0,0 +1,15 @@
1
+ export function initScript() {
2
+ if (window.Ripe) {
3
+ return;
4
+ }
5
+ window.Ripe = [];
6
+ ['group', 'identify', 'init', 'page', 'track'].forEach(function (method) {
7
+ window.Ripe[method] = function () {
8
+ let args = Array.from(arguments);
9
+ args.unshift(method);
10
+ window.Ripe.push(args);
11
+ return window.Ripe;
12
+ };
13
+ });
14
+ }
15
+ //# sourceMappingURL=init-script.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init-script.js","sourceRoot":"","sources":["../../src/init-script.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,UAAU;IACxB,IAAI,MAAM,CAAC,IAAI,EAAE;QACf,OAAM;KACP;IAED,MAAM,CAAC,IAAI,GAAG,EAAE,CACf;IAAA,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,UAAU,MAAM;QACtE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG;YACpB,IAAI,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;YAChC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;YACpB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YACtB,OAAO,MAAM,CAAC,IAAI,CAAA;QACpB,CAAC,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ export interface Payload {
2
+ anonymousId: string;
3
+ userId?: string | null;
4
+ groupId?: string | null;
5
+ category?: string;
6
+ name?: string;
7
+ properties?: {
8
+ [k: string]: unknown;
9
+ };
10
+ messageId?: string;
11
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/page/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import type { BrowserActionDefinition } from '@segment/browser-destination-runtime/types';
2
+ import type { Settings } from '../generated-types';
3
+ import type { Payload } from './generated-types';
4
+ import { RipeSDK } from '../types';
5
+ declare const action: BrowserActionDefinition<Settings, RipeSDK, Payload>;
6
+ export default action;
@@ -0,0 +1,84 @@
1
+ const action = {
2
+ title: 'Page',
3
+ description: 'Register page view in Ripe',
4
+ defaultSubscription: 'type = "page"',
5
+ platform: 'web',
6
+ fields: {
7
+ anonymousId: {
8
+ type: 'string',
9
+ required: true,
10
+ description: 'The anonymous id',
11
+ label: 'Anonymous ID',
12
+ default: { '@path': '$.anonymousId' }
13
+ },
14
+ userId: {
15
+ type: 'string',
16
+ required: false,
17
+ allowNull: true,
18
+ description: 'The ID associated with the user',
19
+ label: 'User ID',
20
+ default: { '@path': '$.userId' }
21
+ },
22
+ groupId: {
23
+ type: 'string',
24
+ required: false,
25
+ allowNull: true,
26
+ description: 'The ID associated groupId',
27
+ label: 'Group ID',
28
+ default: { '@path': '$.context.groupId' }
29
+ },
30
+ category: {
31
+ type: 'string',
32
+ required: false,
33
+ description: 'The category of the page',
34
+ label: 'Category',
35
+ default: {
36
+ '@if': {
37
+ exists: { '@path': '$.category' },
38
+ then: { '@path': '$.category' },
39
+ else: { '@path': '$.context.category' }
40
+ }
41
+ }
42
+ },
43
+ name: {
44
+ type: 'string',
45
+ required: false,
46
+ description: 'The name of the page',
47
+ label: 'Name',
48
+ default: {
49
+ '@if': {
50
+ exists: { '@path': '$.name' },
51
+ then: { '@path': '$.name' },
52
+ else: { '@path': '$.context.name' }
53
+ }
54
+ }
55
+ },
56
+ properties: {
57
+ type: 'object',
58
+ required: false,
59
+ description: 'Page properties',
60
+ label: 'Properties',
61
+ default: { '@path': '$.properties' }
62
+ },
63
+ messageId: {
64
+ type: 'string',
65
+ required: false,
66
+ description: 'The Segment messageId',
67
+ label: 'MessageId',
68
+ default: { '@path': '$.messageId' }
69
+ }
70
+ },
71
+ perform: async (ripe, { payload }) => {
72
+ return ripe.page({
73
+ messageId: payload.messageId,
74
+ anonymousId: payload.anonymousId,
75
+ userId: payload.userId,
76
+ groupId: payload.groupId,
77
+ category: payload.category,
78
+ name: payload.name,
79
+ properties: payload.properties
80
+ });
81
+ }
82
+ };
83
+ export default action;
84
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/page/index.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AE;oBAC7B,IAAI,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;oBAC3B,IAAI,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE;iBACpC;aACF;SACF;QACD,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,iBAAiB;YAC9B,KAAK,EAAE,YAAY;YACnB,OAAO,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE;SACrC;QACD,SAAS,EAAE;YACT,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,uBAAuB;YACpC,KAAK,EAAE,WAAW;YAClB,OAAO,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE;SACpC;KACF;IACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACnC,OAAO,IAAI,CAAC,IAAI,CAAC;YACf,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,UAAU,EAAE,OAAO,CAAC,UAAU;SAC/B,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,eAAe,MAAM,CAAA"}
@@ -0,0 +1,10 @@
1
+ export interface Payload {
2
+ anonymousId: string;
3
+ userId?: string | null;
4
+ groupId?: string | null;
5
+ event: string;
6
+ properties?: {
7
+ [k: string]: unknown;
8
+ };
9
+ messageId?: string;
10
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/track/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import type { BrowserActionDefinition } from '@segment/browser-destination-runtime/types';
2
+ import type { Settings } from '../generated-types';
3
+ import type { Payload } from './generated-types';
4
+ import { RipeSDK } from '../types';
5
+ declare const action: BrowserActionDefinition<Settings, RipeSDK, Payload>;
6
+ export default action;
@@ -0,0 +1,66 @@
1
+ const action = {
2
+ title: 'Track',
3
+ description: 'Send user events to Ripe',
4
+ defaultSubscription: 'type = "track"',
5
+ platform: 'web',
6
+ fields: {
7
+ anonymousId: {
8
+ type: 'string',
9
+ required: true,
10
+ description: 'The anonymous id',
11
+ label: 'Anonymous ID',
12
+ default: { '@path': '$.anonymousId' }
13
+ },
14
+ userId: {
15
+ type: 'string',
16
+ required: false,
17
+ allowNull: true,
18
+ description: 'The ID associated with the user',
19
+ label: 'User ID',
20
+ default: { '@path': '$.userId' }
21
+ },
22
+ groupId: {
23
+ type: 'string',
24
+ required: false,
25
+ allowNull: true,
26
+ description: 'The ID associated groupId',
27
+ label: 'Group ID',
28
+ default: { '@path': '$.context.groupId' }
29
+ },
30
+ event: {
31
+ type: 'string',
32
+ required: true,
33
+ description: 'The event name',
34
+ label: 'Event Name',
35
+ default: { '@path': '$.event' }
36
+ },
37
+ properties: {
38
+ type: 'object',
39
+ required: false,
40
+ description: 'Properties to send with the event',
41
+ label: 'Event properties',
42
+ default: { '@path': '$.properties' }
43
+ },
44
+ messageId: {
45
+ type: 'string',
46
+ required: false,
47
+ description: 'The Segment messageId',
48
+ label: 'MessageId',
49
+ default: { '@path': '$.messageId' }
50
+ }
51
+ },
52
+ perform: async (ripe, { payload }) => {
53
+ if (payload?.event) {
54
+ return ripe.track({
55
+ messageId: payload.messageId,
56
+ anonymousId: payload.anonymousId,
57
+ userId: payload.userId,
58
+ groupId: payload.groupId,
59
+ event: payload.event,
60
+ properties: payload.properties
61
+ });
62
+ }
63
+ }
64
+ };
65
+ export default action;
66
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/track/index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ACF;IACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACnC,IAAI,OAAO,EAAE,KAAK,EAAE;YAClB,OAAO,IAAI,CAAC,KAAK,CAAC;gBAChB,SAAS,EAAE,OAAO,CAAC,SAAS;gBAC5B,WAAW,EAAE,OAAO,CAAC,WAAW;gBAChC,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,UAAU,EAAE,OAAO,CAAC,UAAU;aAC/B,CAAC,CAAA;SACH;IACH,CAAC;CACF,CAAA;AAED,eAAe,MAAM,CAAA"}
@@ -0,0 +1,34 @@
1
+ export interface RipeSDK {
2
+ group: ({ anonymousId, userId, messageId, groupId, traits }: {
3
+ messageId?: string;
4
+ anonymousId: string;
5
+ userId?: string | null;
6
+ groupId: string | null;
7
+ traits?: Record<string, unknown>;
8
+ }) => Promise<void>;
9
+ identify: ({ messageId, anonymousId, userId, groupId, traits }: {
10
+ messageId?: string;
11
+ anonymousId: string;
12
+ userId?: string | null;
13
+ groupId?: string | null;
14
+ traits?: Record<string, unknown>;
15
+ }) => Promise<void>;
16
+ init: (apiKey: string) => Promise<void>;
17
+ page: ({ messageId, anonymousId, userId, groupId, category, name, properties }: {
18
+ messageId?: string;
19
+ anonymousId: string;
20
+ userId?: string | null;
21
+ groupId?: string | null;
22
+ category?: string;
23
+ name?: string;
24
+ properties?: Record<string, unknown>;
25
+ }) => Promise<void>;
26
+ track: ({ messageId, anonymousId, userId, groupId, event, properties }: {
27
+ messageId?: string;
28
+ anonymousId: string;
29
+ userId?: string | null;
30
+ groupId?: string | null;
31
+ event: string;
32
+ properties?: Record<string, unknown>;
33
+ }) => Promise<void>;
34
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}