@segment/analytics-browser-appcues-web-actions 1.1.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.
- package/README.md +31 -0
- package/dist/cjs/constants.d.ts +4 -0
- package/dist/cjs/constants.js +8 -0
- package/dist/cjs/constants.js.map +1 -0
- package/dist/cjs/generated-types.d.ts +5 -0
- package/dist/cjs/generated-types.js +3 -0
- package/dist/cjs/generated-types.js.map +1 -0
- package/dist/cjs/group/generated-types.d.ts +6 -0
- package/dist/cjs/group/generated-types.js +3 -0
- package/dist/cjs/group/generated-types.js.map +1 -0
- package/dist/cjs/group/index.d.ts +6 -0
- package/dist/cjs/group/index.js +30 -0
- package/dist/cjs/group/index.js.map +1 -0
- package/dist/cjs/identify/generated-types.d.ts +6 -0
- package/dist/cjs/identify/generated-types.js +3 -0
- package/dist/cjs/identify/generated-types.js.map +1 -0
- package/dist/cjs/identify/index.d.ts +6 -0
- package/dist/cjs/identify/index.js +30 -0
- package/dist/cjs/identify/index.js.map +1 -0
- package/dist/cjs/index.d.ts +6 -0
- package/dist/cjs/index.js +67 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/page/generated-types.d.ts +2 -0
- package/dist/cjs/page/generated-types.js +3 -0
- package/dist/cjs/page/generated-types.js.map +1 -0
- package/dist/cjs/page/index.d.ts +6 -0
- package/dist/cjs/page/index.js +14 -0
- package/dist/cjs/page/index.js.map +1 -0
- package/dist/cjs/track/generated-types.d.ts +6 -0
- package/dist/cjs/track/generated-types.js +3 -0
- package/dist/cjs/track/generated-types.js.map +1 -0
- package/dist/cjs/track/index.d.ts +6 -0
- package/dist/cjs/track/index.js +30 -0
- package/dist/cjs/track/index.js.map +1 -0
- package/dist/cjs/types.d.ts +18 -0
- package/dist/cjs/types.js +3 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/esm/constants.d.ts +4 -0
- package/dist/esm/constants.js +5 -0
- package/dist/esm/constants.js.map +1 -0
- package/dist/esm/generated-types.d.ts +5 -0
- package/dist/esm/generated-types.js +2 -0
- package/dist/esm/generated-types.js.map +1 -0
- package/dist/esm/group/generated-types.d.ts +6 -0
- package/dist/esm/group/generated-types.js +2 -0
- package/dist/esm/group/generated-types.js.map +1 -0
- package/dist/esm/group/index.d.ts +6 -0
- package/dist/esm/group/index.js +28 -0
- package/dist/esm/group/index.js.map +1 -0
- package/dist/esm/identify/generated-types.d.ts +6 -0
- package/dist/esm/identify/generated-types.js +2 -0
- package/dist/esm/identify/generated-types.js.map +1 -0
- package/dist/esm/identify/index.d.ts +6 -0
- package/dist/esm/identify/index.js +28 -0
- package/dist/esm/identify/index.js.map +1 -0
- package/dist/esm/index.d.ts +6 -0
- package/dist/esm/index.js +63 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/page/generated-types.d.ts +2 -0
- package/dist/esm/page/generated-types.js +2 -0
- package/dist/esm/page/generated-types.js.map +1 -0
- package/dist/esm/page/index.d.ts +6 -0
- package/dist/esm/page/index.js +12 -0
- package/dist/esm/page/index.js.map +1 -0
- package/dist/esm/track/generated-types.d.ts +6 -0
- package/dist/esm/track/generated-types.js +2 -0
- package/dist/esm/track/generated-types.js.map +1 -0
- package/dist/esm/track/index.d.ts +6 -0
- package/dist/esm/track/index.js +28 -0
- package/dist/esm/track/index.js.map +1 -0
- package/dist/esm/types.d.ts +18 -0
- package/dist/esm/types.js +2 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +24 -0
- package/src/__tests__/initialization.test.ts +83 -0
- package/src/constants.ts +4 -0
- package/src/generated-types.ts +16 -0
- package/src/group/__tests__/index.test.ts +119 -0
- package/src/group/generated-types.ts +14 -0
- package/src/group/index.ts +33 -0
- package/src/identify/__tests__/index.test.ts +119 -0
- package/src/identify/generated-types.ts +14 -0
- package/src/identify/index.ts +33 -0
- package/src/index.ts +71 -0
- package/src/page/__tests__/index.test.ts +63 -0
- package/src/page/generated-types.ts +3 -0
- package/src/page/index.ts +17 -0
- package/src/track/__tests__/index.test.ts +125 -0
- package/src/track/generated-types.ts +14 -0
- package/src/track/index.ts +33 -0
- package/src/types.ts +21 -0
- package/tsconfig.json +9 -0
package/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# @segment/analytics-browser-appcues-web-actions
|
|
2
|
+
|
|
3
|
+
The Appcues Web browser action destination for use with @segment/analytics-next.
|
|
4
|
+
|
|
5
|
+
## License
|
|
6
|
+
|
|
7
|
+
MIT License
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2025 Segment
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions:
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
|
28
|
+
|
|
29
|
+
## Contributing
|
|
30
|
+
|
|
31
|
+
All third party contributors acknowledge that any contributions they provide will be made under the same open source license that the open source project is provided under.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,GAAG,GAAG;IACjB,EAAE,EAAE,kBAAkB;IACtB,EAAE,EAAE,qBAAqB;CAC1B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../src/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/group/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 type { Appcues } from '../types';
|
|
5
|
+
declare const action: BrowserActionDefinition<Settings, Appcues, Payload>;
|
|
6
|
+
export default action;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const action = {
|
|
4
|
+
title: 'Group',
|
|
5
|
+
description: 'Send Segment group events to Appcues.',
|
|
6
|
+
platform: 'web',
|
|
7
|
+
fields: {
|
|
8
|
+
groupId: {
|
|
9
|
+
label: 'Group ID',
|
|
10
|
+
description: 'The ID of the group to identify in Appcues.',
|
|
11
|
+
required: true,
|
|
12
|
+
type: 'string',
|
|
13
|
+
default: { '@path': '$.groupId' }
|
|
14
|
+
},
|
|
15
|
+
traits: {
|
|
16
|
+
label: 'Group traits',
|
|
17
|
+
description: 'Properties to associate with the group / account / company.',
|
|
18
|
+
required: false,
|
|
19
|
+
type: 'object',
|
|
20
|
+
default: { '@path': '$.traits' }
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
defaultSubscription: 'type = "group"',
|
|
24
|
+
perform: (appcues, { payload }) => {
|
|
25
|
+
const { groupId, traits } = payload;
|
|
26
|
+
appcues.group(groupId, traits);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
exports.default = action;
|
|
30
|
+
//# 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,uCAAuC;IACpD,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE;QACN,OAAO,EAAE;YACP,KAAK,EAAE,UAAU;YACjB,WAAW,EAAE,6CAA6C;YAC1D,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE;SAClC;QACD,MAAM,EAAE;YACN,KAAK,EAAE,cAAc;YACrB,WAAW,EAAE,6DAA6D;YAC1E,QAAQ,EAAE,KAAK;YACf,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;SACjC;KACF;IACD,mBAAmB,EAAE,gBAAgB;IACrC,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAChC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAA;QACnC,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IAChC,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -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 type { Appcues } from '../types';
|
|
5
|
+
declare const action: BrowserActionDefinition<Settings, Appcues, Payload>;
|
|
6
|
+
export default action;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const action = {
|
|
4
|
+
title: 'Identify',
|
|
5
|
+
description: 'Send Segment identify events to Appcues.',
|
|
6
|
+
platform: 'web',
|
|
7
|
+
fields: {
|
|
8
|
+
userId: {
|
|
9
|
+
label: 'User ID',
|
|
10
|
+
description: 'The ID of the user to identify in Appcues.',
|
|
11
|
+
required: true,
|
|
12
|
+
type: 'string',
|
|
13
|
+
default: { '@path': '$.userId' }
|
|
14
|
+
},
|
|
15
|
+
traits: {
|
|
16
|
+
label: 'User traits',
|
|
17
|
+
description: 'Properties to associate with the user.',
|
|
18
|
+
required: false,
|
|
19
|
+
type: 'object',
|
|
20
|
+
default: { '@path': '$.traits' }
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
defaultSubscription: 'type = "identify"',
|
|
24
|
+
perform: (appcues, { payload }) => {
|
|
25
|
+
const { userId, traits } = payload;
|
|
26
|
+
appcues.identify(userId, traits);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
exports.default = action;
|
|
30
|
+
//# 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,0CAA0C;IACvD,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE;QACN,MAAM,EAAE;YACN,KAAK,EAAE,SAAS;YAChB,WAAW,EAAE,4CAA4C;YACzD,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;SACjC;QACD,MAAM,EAAE;YACN,KAAK,EAAE,aAAa;YACpB,WAAW,EAAE,wCAAwC;YACrD,QAAQ,EAAE,KAAK;YACf,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;SACjC;KACF;IACD,mBAAmB,EAAE,mBAAmB;IACxC,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAChC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAA;QAClC,OAAO,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAClC,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Settings } from './generated-types';
|
|
2
|
+
import type { BrowserDestinationDefinition } from '@segment/browser-destination-runtime/types';
|
|
3
|
+
import type { Appcues } from './types';
|
|
4
|
+
export declare const destination: BrowserDestinationDefinition<Settings, Appcues>;
|
|
5
|
+
declare const _default: import("@segment/browser-destination-runtime/types").PluginFactory;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.destination = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const shim_1 = require("@segment/browser-destination-runtime/shim");
|
|
6
|
+
const track_1 = tslib_1.__importDefault(require("./track"));
|
|
7
|
+
const page_1 = tslib_1.__importDefault(require("./page"));
|
|
8
|
+
const identify_1 = tslib_1.__importDefault(require("./identify"));
|
|
9
|
+
const group_1 = tslib_1.__importDefault(require("./group"));
|
|
10
|
+
const constants_1 = require("./constants");
|
|
11
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
12
|
+
exports.destination = {
|
|
13
|
+
name: 'Appcues Web',
|
|
14
|
+
slug: 'appcues-web-actions',
|
|
15
|
+
mode: 'device',
|
|
16
|
+
settings: {
|
|
17
|
+
accountID: {
|
|
18
|
+
label: 'Appcues Account ID',
|
|
19
|
+
description: 'Your Appcues Account ID.',
|
|
20
|
+
type: 'password',
|
|
21
|
+
required: true
|
|
22
|
+
},
|
|
23
|
+
region: {
|
|
24
|
+
label: 'Region',
|
|
25
|
+
description: 'Select the Appcues region for your account.',
|
|
26
|
+
type: 'string',
|
|
27
|
+
required: true,
|
|
28
|
+
choices: [
|
|
29
|
+
{ label: 'US', value: 'US' },
|
|
30
|
+
{ label: 'EU', value: 'EU' }
|
|
31
|
+
],
|
|
32
|
+
default: 'US'
|
|
33
|
+
},
|
|
34
|
+
enableURLDetection: {
|
|
35
|
+
label: 'Enable URL Detection',
|
|
36
|
+
description: 'Enable or disable URL detection in Appcues. If enabled, page events should not be triggered manually using the page action.',
|
|
37
|
+
type: 'boolean',
|
|
38
|
+
required: true,
|
|
39
|
+
default: false
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
initialize: async ({ settings }, deps) => {
|
|
43
|
+
const { region, accountID, enableURLDetection } = settings;
|
|
44
|
+
const url = region === 'EU' ? constants_1.URL.EU : constants_1.URL.US;
|
|
45
|
+
window.AppcuesSettings = { enableURLDetection };
|
|
46
|
+
await deps.loadScript(`//${url}/${accountID}.js`);
|
|
47
|
+
await deps.resolveWhen(() => Object.prototype.hasOwnProperty.call(window, 'Appcues'), 100);
|
|
48
|
+
return window.Appcues;
|
|
49
|
+
},
|
|
50
|
+
presets: [
|
|
51
|
+
{
|
|
52
|
+
name: 'Page',
|
|
53
|
+
subscribe: 'type = "page"',
|
|
54
|
+
partnerAction: 'page',
|
|
55
|
+
mapping: (0, actions_core_1.defaultValues)(page_1.default.fields),
|
|
56
|
+
type: 'automatic'
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
actions: {
|
|
60
|
+
track: track_1.default,
|
|
61
|
+
page: page_1.default,
|
|
62
|
+
identify: identify_1.default,
|
|
63
|
+
group: group_1.default
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
exports.default = (0, shim_1.browserDestination)(exports.destination);
|
|
67
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAEA,oEAA8E;AAE9E,4DAA2B;AAC3B,0DAAyB;AACzB,kEAAiC;AACjC,4DAA2B;AAC3B,2CAAiC;AACjC,wDAAqD;AAExC,QAAA,WAAW,GAAoD;IAC1E,IAAI,EAAE,aAAa;IACnB,IAAI,EAAE,qBAAqB;IAC3B,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE;QACR,SAAS,EAAE;YACT,KAAK,EAAE,oBAAoB;YAC3B,WAAW,EAAE,0BAA0B;YACvC,IAAI,EAAE,UAAU;YAChB,QAAQ,EAAE,IAAI;SACf;QACD,MAAM,EAAE;YACN,KAAK,EAAE,QAAQ;YACf,WAAW,EAAE,6CAA6C;YAC1D,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE;gBAC5B,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE;aAC7B;YACD,OAAO,EAAE,IAAI;SACd;QACD,kBAAkB,EAAE;YAClB,KAAK,EAAE,sBAAsB;YAC7B,WAAW,EAAE,6HAA6H;YAC1I,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,KAAK;SACf;KACF;IACD,UAAU,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,EAAE;QACvC,MAAM,EACJ,MAAM,EACN,SAAS,EACT,kBAAkB,EACnB,GAAG,QAAQ,CAAA;QACZ,MAAM,GAAG,GAAG,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,eAAG,CAAC,EAAE,CAAC,CAAC,CAAC,eAAG,CAAC,EAAE,CAAA;QAC7C,MAAM,CAAC,eAAe,GAAG,EAAE,kBAAkB,EAAE,CAAA;QAC/C,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,GAAG,IAAI,SAAS,KAAK,CAAC,CAAA;QACjD,MAAM,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,GAAG,CAAC,CAAA;QAC1F,OAAO,MAAM,CAAC,OAAO,CAAA;IACvB,CAAC;IACD,OAAO,EAAE;QACP;YACE,IAAI,EAAE,MAAM;YACZ,SAAS,EAAE,eAAe;YAC1B,aAAa,EAAE,MAAM;YACrB,OAAO,EAAE,IAAA,4BAAa,EAAC,cAAI,CAAC,MAAM,CAAC;YACnC,IAAI,EAAE,WAAW;SAClB;KACF;IACD,OAAO,EAAE;QACP,KAAK,EAAL,eAAK;QACL,IAAI,EAAJ,cAAI;QACJ,QAAQ,EAAR,kBAAQ;QACR,KAAK,EAAL,eAAK;KACN;CACF,CAAA;AAED,kBAAe,IAAA,yBAAkB,EAAC,mBAAW,CAAC,CAAA"}
|
|
@@ -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 type { Appcues } from '../types';
|
|
5
|
+
declare const action: BrowserActionDefinition<Settings, Appcues, Payload>;
|
|
6
|
+
export default action;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const action = {
|
|
4
|
+
title: 'Page',
|
|
5
|
+
description: 'Send Segment page events to Appcues.',
|
|
6
|
+
platform: 'web',
|
|
7
|
+
fields: {},
|
|
8
|
+
defaultSubscription: 'type = "page"',
|
|
9
|
+
perform: (appcues) => {
|
|
10
|
+
appcues.page();
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
exports.default = action;
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/page/index.ts"],"names":[],"mappings":";;AAKA,MAAM,MAAM,GAAwD;IAClE,KAAK,EAAE,MAAM;IACb,WAAW,EAAE,sCAAsC;IACnD,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,EAAE;IACV,mBAAmB,EAAE,eAAe;IACpC,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE;QACnB,OAAO,CAAC,IAAI,EAAE,CAAA;IAChB,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -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 type { Appcues } from '../types';
|
|
5
|
+
declare const action: BrowserActionDefinition<Settings, Appcues, Payload>;
|
|
6
|
+
export default action;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const action = {
|
|
4
|
+
title: 'Track',
|
|
5
|
+
description: 'Send Segment track events to Appcues.',
|
|
6
|
+
platform: 'web',
|
|
7
|
+
fields: {
|
|
8
|
+
event: {
|
|
9
|
+
label: 'Event Name',
|
|
10
|
+
description: 'The name of the event to track in Appcues.',
|
|
11
|
+
required: true,
|
|
12
|
+
type: 'string',
|
|
13
|
+
default: { '@path': '$.event' }
|
|
14
|
+
},
|
|
15
|
+
properties: {
|
|
16
|
+
label: 'Event Properties',
|
|
17
|
+
description: 'Properties to associate with the event.',
|
|
18
|
+
required: false,
|
|
19
|
+
type: 'object',
|
|
20
|
+
default: { '@path': '$.properties' }
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
defaultSubscription: 'type = "track"',
|
|
24
|
+
perform: (appcues, { payload }) => {
|
|
25
|
+
const { event, properties } = payload;
|
|
26
|
+
appcues.track(event, properties);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
exports.default = action;
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/track/index.ts"],"names":[],"mappings":";;AAKA,MAAM,MAAM,GAAwD;IAClE,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,uCAAuC;IACpD,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE;QACN,KAAK,EAAE;YACL,KAAK,EAAE,YAAY;YACnB,WAAW,EAAE,4CAA4C;YACzD,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE;SAChC;QACD,UAAU,EAAE;YACV,KAAK,EAAE,kBAAkB;YACzB,WAAW,EAAE,yCAAyC;YACtD,QAAQ,EAAE,KAAK;YACf,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE;SACrC;KACF;IACD,mBAAmB,EAAE,gBAAgB;IACrC,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAChC,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,OAAO,CAAA;QACrC,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,UAAU,CAAC,CAAA;IAClC,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface Window {
|
|
3
|
+
Appcues: Appcues;
|
|
4
|
+
AppcuesSettings: AppcuesSettings;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
export interface Appcues {
|
|
8
|
+
track(event_name: string, properties?: Properties): void;
|
|
9
|
+
identify(userId: string, traits?: Properties): void;
|
|
10
|
+
group(groupId: string, traits?: Properties): void;
|
|
11
|
+
page(): void;
|
|
12
|
+
}
|
|
13
|
+
export interface AppcuesSettings {
|
|
14
|
+
enableURLDetection: boolean;
|
|
15
|
+
}
|
|
16
|
+
export type Properties = {
|
|
17
|
+
[k: string]: unknown;
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,GAAG,GAAG;IACjB,EAAE,EAAE,kBAAkB;IACtB,EAAE,EAAE,qBAAqB;CAC1B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../src/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/group/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 type { Appcues } from '../types';
|
|
5
|
+
declare const action: BrowserActionDefinition<Settings, Appcues, Payload>;
|
|
6
|
+
export default action;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const action = {
|
|
2
|
+
title: 'Group',
|
|
3
|
+
description: 'Send Segment group events to Appcues.',
|
|
4
|
+
platform: 'web',
|
|
5
|
+
fields: {
|
|
6
|
+
groupId: {
|
|
7
|
+
label: 'Group ID',
|
|
8
|
+
description: 'The ID of the group to identify in Appcues.',
|
|
9
|
+
required: true,
|
|
10
|
+
type: 'string',
|
|
11
|
+
default: { '@path': '$.groupId' }
|
|
12
|
+
},
|
|
13
|
+
traits: {
|
|
14
|
+
label: 'Group traits',
|
|
15
|
+
description: 'Properties to associate with the group / account / company.',
|
|
16
|
+
required: false,
|
|
17
|
+
type: 'object',
|
|
18
|
+
default: { '@path': '$.traits' }
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
defaultSubscription: 'type = "group"',
|
|
22
|
+
perform: (appcues, { payload }) => {
|
|
23
|
+
const { groupId, traits } = payload;
|
|
24
|
+
appcues.group(groupId, traits);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
export default action;
|
|
28
|
+
//# 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,uCAAuC;IACpD,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE;QACN,OAAO,EAAE;YACP,KAAK,EAAE,UAAU;YACjB,WAAW,EAAE,6CAA6C;YAC1D,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE;SAClC;QACD,MAAM,EAAE;YACN,KAAK,EAAE,cAAc;YACrB,WAAW,EAAE,6DAA6D;YAC1E,QAAQ,EAAE,KAAK;YACf,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;SACjC;KACF;IACD,mBAAmB,EAAE,gBAAgB;IACrC,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAChC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAA;QACnC,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IAChC,CAAC;CACF,CAAA;AAED,eAAe,MAAM,CAAA"}
|
|
@@ -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 type { Appcues } from '../types';
|
|
5
|
+
declare const action: BrowserActionDefinition<Settings, Appcues, Payload>;
|
|
6
|
+
export default action;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const action = {
|
|
2
|
+
title: 'Identify',
|
|
3
|
+
description: 'Send Segment identify events to Appcues.',
|
|
4
|
+
platform: 'web',
|
|
5
|
+
fields: {
|
|
6
|
+
userId: {
|
|
7
|
+
label: 'User ID',
|
|
8
|
+
description: 'The ID of the user to identify in Appcues.',
|
|
9
|
+
required: true,
|
|
10
|
+
type: 'string',
|
|
11
|
+
default: { '@path': '$.userId' }
|
|
12
|
+
},
|
|
13
|
+
traits: {
|
|
14
|
+
label: 'User traits',
|
|
15
|
+
description: 'Properties to associate with the user.',
|
|
16
|
+
required: false,
|
|
17
|
+
type: 'object',
|
|
18
|
+
default: { '@path': '$.traits' }
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
defaultSubscription: 'type = "identify"',
|
|
22
|
+
perform: (appcues, { payload }) => {
|
|
23
|
+
const { userId, traits } = payload;
|
|
24
|
+
appcues.identify(userId, traits);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
export default action;
|
|
28
|
+
//# 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,0CAA0C;IACvD,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE;QACN,MAAM,EAAE;YACN,KAAK,EAAE,SAAS;YAChB,WAAW,EAAE,4CAA4C;YACzD,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;SACjC;QACD,MAAM,EAAE;YACN,KAAK,EAAE,aAAa;YACpB,WAAW,EAAE,wCAAwC;YACrD,QAAQ,EAAE,KAAK;YACf,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;SACjC;KACF;IACD,mBAAmB,EAAE,mBAAmB;IACxC,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAChC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAA;QAClC,OAAO,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAClC,CAAC;CACF,CAAA;AAED,eAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Settings } from './generated-types';
|
|
2
|
+
import type { BrowserDestinationDefinition } from '@segment/browser-destination-runtime/types';
|
|
3
|
+
import type { Appcues } from './types';
|
|
4
|
+
export declare const destination: BrowserDestinationDefinition<Settings, Appcues>;
|
|
5
|
+
declare const _default: import("@segment/browser-destination-runtime/types").PluginFactory;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { browserDestination } from '@segment/browser-destination-runtime/shim';
|
|
2
|
+
import track from './track';
|
|
3
|
+
import page from './page';
|
|
4
|
+
import identify from './identify';
|
|
5
|
+
import group from './group';
|
|
6
|
+
import { URL } from './constants';
|
|
7
|
+
import { defaultValues } from '@segment/actions-core';
|
|
8
|
+
export const destination = {
|
|
9
|
+
name: 'Appcues Web',
|
|
10
|
+
slug: 'appcues-web-actions',
|
|
11
|
+
mode: 'device',
|
|
12
|
+
settings: {
|
|
13
|
+
accountID: {
|
|
14
|
+
label: 'Appcues Account ID',
|
|
15
|
+
description: 'Your Appcues Account ID.',
|
|
16
|
+
type: 'password',
|
|
17
|
+
required: true
|
|
18
|
+
},
|
|
19
|
+
region: {
|
|
20
|
+
label: 'Region',
|
|
21
|
+
description: 'Select the Appcues region for your account.',
|
|
22
|
+
type: 'string',
|
|
23
|
+
required: true,
|
|
24
|
+
choices: [
|
|
25
|
+
{ label: 'US', value: 'US' },
|
|
26
|
+
{ label: 'EU', value: 'EU' }
|
|
27
|
+
],
|
|
28
|
+
default: 'US'
|
|
29
|
+
},
|
|
30
|
+
enableURLDetection: {
|
|
31
|
+
label: 'Enable URL Detection',
|
|
32
|
+
description: 'Enable or disable URL detection in Appcues. If enabled, page events should not be triggered manually using the page action.',
|
|
33
|
+
type: 'boolean',
|
|
34
|
+
required: true,
|
|
35
|
+
default: false
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
initialize: async ({ settings }, deps) => {
|
|
39
|
+
const { region, accountID, enableURLDetection } = settings;
|
|
40
|
+
const url = region === 'EU' ? URL.EU : URL.US;
|
|
41
|
+
window.AppcuesSettings = { enableURLDetection };
|
|
42
|
+
await deps.loadScript(`//${url}/${accountID}.js`);
|
|
43
|
+
await deps.resolveWhen(() => Object.prototype.hasOwnProperty.call(window, 'Appcues'), 100);
|
|
44
|
+
return window.Appcues;
|
|
45
|
+
},
|
|
46
|
+
presets: [
|
|
47
|
+
{
|
|
48
|
+
name: 'Page',
|
|
49
|
+
subscribe: 'type = "page"',
|
|
50
|
+
partnerAction: 'page',
|
|
51
|
+
mapping: defaultValues(page.fields),
|
|
52
|
+
type: 'automatic'
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
actions: {
|
|
56
|
+
track,
|
|
57
|
+
page,
|
|
58
|
+
identify,
|
|
59
|
+
group
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
export default browserDestination(destination);
|
|
63
|
+
//# 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;AAE9E,OAAO,KAAK,MAAM,SAAS,CAAA;AAC3B,OAAO,IAAI,MAAM,QAAQ,CAAA;AACzB,OAAO,QAAQ,MAAM,YAAY,CAAA;AACjC,OAAO,KAAK,MAAM,SAAS,CAAA;AAC3B,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAErD,MAAM,CAAC,MAAM,WAAW,GAAoD;IAC1E,IAAI,EAAE,aAAa;IACnB,IAAI,EAAE,qBAAqB;IAC3B,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE;QACR,SAAS,EAAE;YACT,KAAK,EAAE,oBAAoB;YAC3B,WAAW,EAAE,0BAA0B;YACvC,IAAI,EAAE,UAAU;YAChB,QAAQ,EAAE,IAAI;SACf;QACD,MAAM,EAAE;YACN,KAAK,EAAE,QAAQ;YACf,WAAW,EAAE,6CAA6C;YAC1D,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE;gBAC5B,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE;aAC7B;YACD,OAAO,EAAE,IAAI;SACd;QACD,kBAAkB,EAAE;YAClB,KAAK,EAAE,sBAAsB;YAC7B,WAAW,EAAE,6HAA6H;YAC1I,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,KAAK;SACf;KACF;IACD,UAAU,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,EAAE;QACvC,MAAM,EACJ,MAAM,EACN,SAAS,EACT,kBAAkB,EACnB,GAAG,QAAQ,CAAA;QACZ,MAAM,GAAG,GAAG,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAA;QAC7C,MAAM,CAAC,eAAe,GAAG,EAAE,kBAAkB,EAAE,CAAA;QAC/C,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,GAAG,IAAI,SAAS,KAAK,CAAC,CAAA;QACjD,MAAM,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,GAAG,CAAC,CAAA;QAC1F,OAAO,MAAM,CAAC,OAAO,CAAA;IACvB,CAAC;IACD,OAAO,EAAE;QACP;YACE,IAAI,EAAE,MAAM;YACZ,SAAS,EAAE,eAAe;YAC1B,aAAa,EAAE,MAAM;YACrB,OAAO,EAAE,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC;YACnC,IAAI,EAAE,WAAW;SAClB;KACF;IACD,OAAO,EAAE;QACP,KAAK;QACL,IAAI;QACJ,QAAQ;QACR,KAAK;KACN;CACF,CAAA;AAED,eAAe,kBAAkB,CAAC,WAAW,CAAC,CAAA"}
|