@appcues/segment-react-native 5.0.0 → 5.0.2
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 +15 -1
- package/lib/commonjs/AppcuesPlugin.js +8 -10
- package/lib/commonjs/AppcuesPlugin.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/types.js.map +1 -1
- package/lib/module/AppcuesPlugin.js +9 -8
- package/lib/module/AppcuesPlugin.js.map +1 -1
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/package.json +1 -0
- package/lib/module/types.js +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/typescript/AppcuesPlugin.d.ts +5 -1
- package/lib/typescript/AppcuesPlugin.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +2 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/types.d.ts +23 -0
- package/lib/typescript/types.d.ts.map +1 -0
- package/package.json +9 -9
- package/src/AppcuesPlugin.ts +14 -7
- package/src/index.ts +1 -0
- package/src/types.ts +26 -3
package/README.md
CHANGED
|
@@ -7,11 +7,13 @@
|
|
|
7
7
|
You need to install the `@appcues/segment-react-native` and the `@appcues/react-native` dependency.
|
|
8
8
|
|
|
9
9
|
Using NPM:
|
|
10
|
+
|
|
10
11
|
```bash
|
|
11
12
|
npm install --save @appcues/segment-react-native @appcues/react-native
|
|
12
13
|
```
|
|
13
14
|
|
|
14
15
|
Using Yarn:
|
|
16
|
+
|
|
15
17
|
```bash
|
|
16
18
|
yarn add @appcues/segment-react-native @appcues/react-native
|
|
17
19
|
```
|
|
@@ -19,6 +21,7 @@ yarn add @appcues/segment-react-native @appcues/react-native
|
|
|
19
21
|
Run `pod install` after the installation to autolink the Appcues SDK.
|
|
20
22
|
|
|
21
23
|
See [Appcues React Native Module](https://github.com/appcues/appcues-react-native-module) for more details of this dependency.
|
|
24
|
+
|
|
22
25
|
## Usage
|
|
23
26
|
|
|
24
27
|
Follow the [instructions for adding plugins](https://github.com/segmentio/analytics-react-native#adding-plugins) on the main Analytics client:
|
|
@@ -31,12 +34,23 @@ import { createClient } from '@segment/analytics-react-native';
|
|
|
31
34
|
import { AppcuesPlugin } from '@appcues/segment-react-native';
|
|
32
35
|
|
|
33
36
|
const segmentClient = createClient({
|
|
34
|
-
writeKey: 'SEGMENT_KEY'
|
|
37
|
+
writeKey: 'SEGMENT_KEY',
|
|
35
38
|
});
|
|
36
39
|
|
|
37
40
|
segmentClient.add({ plugin: new AppcuesPlugin() });
|
|
38
41
|
```
|
|
39
42
|
|
|
43
|
+
You can optionally pass configuration options to the plugin that will be forwarded to the underlying `@appcues/react-native` SDK during initialization. For example, to configure for EU data residency:
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
segmentClient.add({
|
|
47
|
+
plugin: new AppcuesPlugin({
|
|
48
|
+
apiHost: 'https://api.eu.appcues.net',
|
|
49
|
+
settingsHost: 'https://fast.eu.appcues.com',
|
|
50
|
+
}),
|
|
51
|
+
});
|
|
52
|
+
```
|
|
53
|
+
|
|
40
54
|
## Supporting Builder Preview and Screen Capture
|
|
41
55
|
|
|
42
56
|
During installation, follow the steps outlined in in the Appcues React Native Module documentation for [Configuring the Appcues URL Scheme](https://github.com/appcues/appcues-react-native-module/blob/main/docs/URLSchemeConfiguring.md). This is necessary for the complete Appcues builder experience, supporting experience preview, screen capture and debugging.
|
|
@@ -6,17 +6,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.AppcuesPlugin = void 0;
|
|
7
7
|
var _analyticsReactNative = require("@segment/analytics-react-native");
|
|
8
8
|
var Appcues = _interopRequireWildcard(require("@appcues/react-native"));
|
|
9
|
-
function
|
|
10
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
11
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
13
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
9
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
14
10
|
class AppcuesPlugin extends _analyticsReactNative.DestinationPlugin {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
type = _analyticsReactNative.PluginType.destination;
|
|
12
|
+
key = 'Appcues Mobile';
|
|
13
|
+
isInitialized = false;
|
|
14
|
+
constructor(options) {
|
|
15
|
+
super();
|
|
16
|
+
this.options = options ?? {};
|
|
20
17
|
}
|
|
21
18
|
async update(settings, _) {
|
|
22
19
|
if (this.isInitialized) {
|
|
@@ -27,6 +24,7 @@ class AppcuesPlugin extends _analyticsReactNative.DestinationPlugin {
|
|
|
27
24
|
return;
|
|
28
25
|
}
|
|
29
26
|
Appcues.setup(appcuesSettings.accountId, appcuesSettings.applicationId, {
|
|
27
|
+
...this.options,
|
|
30
28
|
additionalAutoProperties: {
|
|
31
29
|
_segmentVersion: require('@segment/analytics-react-native/package.json').version
|
|
32
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_analyticsReactNative","require","Appcues","_interopRequireWildcard","
|
|
1
|
+
{"version":3,"names":["_analyticsReactNative","require","Appcues","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","AppcuesPlugin","DestinationPlugin","type","PluginType","destination","key","isInitialized","constructor","options","update","settings","_","appcuesSettings","integrations","undefined","setup","accountId","applicationId","additionalAutoProperties","_segmentVersion","version","then","identify","event","userId","traits","track","properties","screen","name","group","groupId","reset","exports"],"sourceRoot":"../../src","sources":["AppcuesPlugin.ts"],"mappings":";;;;;;AAAA,IAAAA,qBAAA,GAAAC,OAAA;AAWA,IAAAC,OAAA,GAAAC,uBAAA,CAAAF,OAAA;AAAiD,SAAAE,wBAAAC,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAH,uBAAA,YAAAA,CAAAC,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAA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,wBAAwB,EAAE;QACxBC,eAAe,EAAEzC,OAAO,CAAC,8CAA8C,CAAC,CACrE0C;MACL;IACF,CAAC,CAAC,CAACC,IAAI,CAAC,MAAM;MACZ,IAAI,CAACf,aAAa,GAAG,IAAI;IAC3B,CAAC,CAAC;EACJ;EAEAgB,QAAQA,CAACC,KAAwB,EAAE;IACjC,IAAI,IAAI,CAACjB,aAAa,IAAIiB,KAAK,CAACC,MAAM,IAAI,IAAI,EAAE;MAC9C7C,OAAO,CAAC2C,QAAQ,CAACC,KAAK,CAACC,MAAM,EAAED,KAAK,CAACE,MAAM,CAAC;IAC9C;IACA,OAAOF,KAAK;EACd;EAEAG,KAAKA,CAACH,KAAqB,EAAE;IAC3B,IAAI,IAAI,CAACjB,aAAa,EAAE;MACtB3B,OAAO,CAAC+C,KAAK,CAACH,KAAK,CAACA,KAAK,EAAEA,KAAK,CAACI,UAAU,CAAC;IAC9C;IACA,OAAOJ,KAAK;EACd;EAEAK,MAAMA,CAACL,KAAsB,EAAE;IAC7B,IAAI,IAAI,CAACjB,aAAa,EAAE;MACtB3B,OAAO,CAACiD,MAAM,CAACL,KAAK,CAACM,IAAI,EAAEN,KAAK,CAACI,UAAU,CAAC;IAC9C;IACA,OAAOJ,KAAK;EACd;EAEAO,KAAKA,CAACP,KAAqB,EAAE;IAC3B,IAAI,IAAI,CAACjB,aAAa,EAAE;MACtB3B,OAAO,CAACmD,KAAK,CAACP,KAAK,CAACQ,OAAO,EAAER,KAAK,CAACE,MAAM,CAAC;IAC5C;IACA,OAAOF,KAAK;EACd;EAEAS,KAAKA,CAAA,EAAS;IACZ,IAAI,IAAI,CAAC1B,aAAa,EAAE;MACtB3B,OAAO,CAACqD,KAAK,CAAC,CAAC;IACjB;EACF;AACF;AAACC,OAAA,CAAAjC,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_AppcuesPlugin","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"
|
|
1
|
+
{"version":3,"names":["_AppcuesPlugin","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,cAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,cAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,cAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
4
3
|
import { DestinationPlugin, PluginType } from '@segment/analytics-react-native';
|
|
5
4
|
import * as Appcues from '@appcues/react-native';
|
|
6
5
|
export class AppcuesPlugin extends DestinationPlugin {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
type = PluginType.destination;
|
|
7
|
+
key = 'Appcues Mobile';
|
|
8
|
+
isInitialized = false;
|
|
9
|
+
constructor(options) {
|
|
10
|
+
super();
|
|
11
|
+
this.options = options ?? {};
|
|
12
12
|
}
|
|
13
13
|
async update(settings, _) {
|
|
14
14
|
if (this.isInitialized) {
|
|
@@ -19,6 +19,7 @@ export class AppcuesPlugin extends DestinationPlugin {
|
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
21
|
Appcues.setup(appcuesSettings.accountId, appcuesSettings.applicationId, {
|
|
22
|
+
...this.options,
|
|
22
23
|
additionalAutoProperties: {
|
|
23
24
|
_segmentVersion: require('@segment/analytics-react-native/package.json').version
|
|
24
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DestinationPlugin","PluginType","Appcues","AppcuesPlugin","
|
|
1
|
+
{"version":3,"names":["DestinationPlugin","PluginType","Appcues","AppcuesPlugin","type","destination","key","isInitialized","constructor","options","update","settings","_","appcuesSettings","integrations","undefined","setup","accountId","applicationId","additionalAutoProperties","_segmentVersion","require","version","then","identify","event","userId","traits","track","properties","screen","name","group","groupId","reset"],"sourceRoot":"../../src","sources":["AppcuesPlugin.ts"],"mappings":";;AAAA,SACEA,iBAAiB,EACjBC,UAAU,QAOL,iCAAiC;AAExC,OAAO,KAAKC,OAAO,MAAM,uBAAuB;AAEhD,OAAO,MAAMC,aAAa,SAASH,iBAAiB,CAAC;EACnDI,IAAI,GAAGH,UAAU,CAACI,WAAW;EAC7BC,GAAG,GAAG,gBAAgB;EAEdC,aAAa,GAAY,KAAK;EAGtCC,WAAWA,CAACC,OAA8B,EAAE;IAC1C,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,OAAO,GAAGA,OAAO,IAAI,CAAC,CAAC;EAC9B;EAEA,MAAMC,MAAMA,CAACC,QAA4B,EAAEC,CAAa,EAAE;IACxD,IAAI,IAAI,CAACL,aAAa,EAAE;MACtB;IACF;IAEA,MAAMM,eAAe,GAAGF,QAAQ,CAACG,YAAY,CAC3C,IAAI,CAACR,GAAG,CACiB;IAE3B,IAAIO,eAAe,KAAKE,SAAS,EAAE;MACjC;I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GED
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,cAAc,iBAAiB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
package/lib/module/types.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
//# sourceMappingURL=types.js.map
|
package/lib/module/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { DestinationPlugin, PluginType, TrackEventType, ScreenEventType, SegmentAPISettings, UpdateType, IdentifyEventType, GroupEventType } from '@segment/analytics-react-native';
|
|
1
|
+
import { DestinationPlugin, PluginType, type TrackEventType, type ScreenEventType, type SegmentAPISettings, type UpdateType, type IdentifyEventType, type GroupEventType } from '@segment/analytics-react-native';
|
|
2
|
+
import type { AppcuesPluginOptions } from './types';
|
|
2
3
|
export declare class AppcuesPlugin extends DestinationPlugin {
|
|
3
4
|
type: PluginType;
|
|
4
5
|
key: string;
|
|
5
6
|
private isInitialized;
|
|
7
|
+
private options;
|
|
8
|
+
constructor(options?: AppcuesPluginOptions);
|
|
6
9
|
update(settings: SegmentAPISettings, _: UpdateType): Promise<void>;
|
|
7
10
|
identify(event: IdentifyEventType): IdentifyEventType;
|
|
8
11
|
track(event: TrackEventType): TrackEventType;
|
|
@@ -10,3 +13,4 @@ export declare class AppcuesPlugin extends DestinationPlugin {
|
|
|
10
13
|
group(event: GroupEventType): GroupEventType;
|
|
11
14
|
reset(): void;
|
|
12
15
|
}
|
|
16
|
+
//# sourceMappingURL=AppcuesPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppcuesPlugin.d.ts","sourceRoot":"","sources":["../../src/AppcuesPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,oBAAoB,EAA0B,MAAM,SAAS,CAAC;AAG5E,qBAAa,aAAc,SAAQ,iBAAiB;IAClD,IAAI,aAA0B;IAC9B,GAAG,SAAoB;IAEvB,OAAO,CAAC,aAAa,CAAkB;IACvC,OAAO,CAAC,OAAO,CAAuB;gBAE1B,OAAO,CAAC,EAAE,oBAAoB;IAKpC,MAAM,CAAC,QAAQ,EAAE,kBAAkB,EAAE,CAAC,EAAE,UAAU;IAwBxD,QAAQ,CAAC,KAAK,EAAE,iBAAiB;IAOjC,KAAK,CAAC,KAAK,EAAE,cAAc;IAO3B,MAAM,CAAC,KAAK,EAAE,eAAe;IAO7B,KAAK,CAAC,KAAK,EAAE,cAAc;IAO3B,KAAK,IAAI,IAAI;CAKd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,YAAY,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -2,3 +2,26 @@ export type SegmentAppcuesSettings = {
|
|
|
2
2
|
accountId: string;
|
|
3
3
|
applicationId: string;
|
|
4
4
|
};
|
|
5
|
+
/**
|
|
6
|
+
* Optional configuration for the Appcues plugin, passed to the
|
|
7
|
+
* underlying @appcues/react-native SDK during initialization.
|
|
8
|
+
*/
|
|
9
|
+
export type AppcuesPluginOptions = {
|
|
10
|
+
/** Enable SDK debug logging. */
|
|
11
|
+
logging?: boolean;
|
|
12
|
+
/** Override the default Appcues API host (e.g. for EU data residency). */
|
|
13
|
+
apiHost?: string;
|
|
14
|
+
/** Override the default Appcues settings host (e.g. for EU data residency). */
|
|
15
|
+
settingsHost?: string;
|
|
16
|
+
/** Session timeout in seconds. */
|
|
17
|
+
sessionTimeout?: number;
|
|
18
|
+
/** Maximum number of activity items to store locally. */
|
|
19
|
+
activityStorageMaxSize?: number;
|
|
20
|
+
/** Maximum age (in seconds) of locally stored activity items. */
|
|
21
|
+
activityStorageMaxAge?: number;
|
|
22
|
+
/** Enable text scaling based on device accessibility settings. */
|
|
23
|
+
enableTextScaling?: boolean;
|
|
24
|
+
/** Enable the step recovery observer for recovering from failed step transitions. */
|
|
25
|
+
enableStepRecoveryObserver?: boolean;
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,sBAAsB,GAAG;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,gCAAgC;IAChC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,0EAA0E;IAC1E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+EAA+E;IAC/E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kCAAkC;IAClC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,yDAAyD;IACzD,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,iEAAiE;IACjE,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,kEAAkE;IAClE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,qFAAqF;IACrF,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACtC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appcues/segment-react-native",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.2",
|
|
4
4
|
"description": "Segment destination plugin for Appcues.",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -42,26 +42,26 @@
|
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@appcues/react-native": "^5.0.
|
|
45
|
+
"@appcues/react-native": "^5.0.2",
|
|
46
46
|
"@segment/analytics-react-native": "*"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@babel/core": "^7.
|
|
50
|
-
"@babel/preset-env": "^7.
|
|
51
|
-
"@babel/runtime": "^7.
|
|
49
|
+
"@babel/core": "^7.25.2",
|
|
50
|
+
"@babel/preset-env": "^7.25.3",
|
|
51
|
+
"@babel/runtime": "^7.25.0",
|
|
52
52
|
"@commitlint/config-conventional": "^11.0.0",
|
|
53
53
|
"@react-native-community/eslint-config": "^2.0.0",
|
|
54
|
-
"@types/jest": "^
|
|
54
|
+
"@types/jest": "^29.5.5",
|
|
55
55
|
"commitlint": "^11.0.0",
|
|
56
56
|
"eslint": "^7.2.0",
|
|
57
57
|
"eslint-config-prettier": "^7.0.0",
|
|
58
58
|
"eslint-plugin-prettier": "^3.1.3",
|
|
59
59
|
"husky": "^6.0.0",
|
|
60
|
-
"jest": "^
|
|
60
|
+
"jest": "^29.7.0",
|
|
61
61
|
"pod-install": "^0.1.0",
|
|
62
62
|
"prettier": "^2.0.5",
|
|
63
|
-
"react-native-builder-bob": "^0.
|
|
64
|
-
"typescript": "^
|
|
63
|
+
"react-native-builder-bob": "^0.36.0",
|
|
64
|
+
"typescript": "^5.2.2"
|
|
65
65
|
},
|
|
66
66
|
"jest": {
|
|
67
67
|
"preset": "react-native",
|
package/src/AppcuesPlugin.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DestinationPlugin,
|
|
3
3
|
PluginType,
|
|
4
|
-
TrackEventType,
|
|
5
|
-
ScreenEventType,
|
|
6
|
-
SegmentAPISettings,
|
|
7
|
-
UpdateType,
|
|
8
|
-
IdentifyEventType,
|
|
9
|
-
GroupEventType,
|
|
4
|
+
type TrackEventType,
|
|
5
|
+
type ScreenEventType,
|
|
6
|
+
type SegmentAPISettings,
|
|
7
|
+
type UpdateType,
|
|
8
|
+
type IdentifyEventType,
|
|
9
|
+
type GroupEventType,
|
|
10
10
|
} from '@segment/analytics-react-native';
|
|
11
|
-
import type { SegmentAppcuesSettings } from './types';
|
|
11
|
+
import type { AppcuesPluginOptions, SegmentAppcuesSettings } from './types';
|
|
12
12
|
import * as Appcues from '@appcues/react-native';
|
|
13
13
|
|
|
14
14
|
export class AppcuesPlugin extends DestinationPlugin {
|
|
@@ -16,6 +16,12 @@ export class AppcuesPlugin extends DestinationPlugin {
|
|
|
16
16
|
key = 'Appcues Mobile';
|
|
17
17
|
|
|
18
18
|
private isInitialized: boolean = false;
|
|
19
|
+
private options: AppcuesPluginOptions;
|
|
20
|
+
|
|
21
|
+
constructor(options?: AppcuesPluginOptions) {
|
|
22
|
+
super();
|
|
23
|
+
this.options = options ?? {};
|
|
24
|
+
}
|
|
19
25
|
|
|
20
26
|
async update(settings: SegmentAPISettings, _: UpdateType) {
|
|
21
27
|
if (this.isInitialized) {
|
|
@@ -31,6 +37,7 @@ export class AppcuesPlugin extends DestinationPlugin {
|
|
|
31
37
|
}
|
|
32
38
|
|
|
33
39
|
Appcues.setup(appcuesSettings.accountId, appcuesSettings.applicationId, {
|
|
40
|
+
...this.options,
|
|
34
41
|
additionalAutoProperties: {
|
|
35
42
|
_segmentVersion: require('@segment/analytics-react-native/package.json')
|
|
36
43
|
.version,
|
package/src/index.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
export type SegmentAppcuesSettings = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
accountId: string;
|
|
3
|
+
applicationId: string;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Optional configuration for the Appcues plugin, passed to the
|
|
8
|
+
* underlying @appcues/react-native SDK during initialization.
|
|
9
|
+
*/
|
|
10
|
+
export type AppcuesPluginOptions = {
|
|
11
|
+
/** Enable SDK debug logging. */
|
|
12
|
+
logging?: boolean;
|
|
13
|
+
/** Override the default Appcues API host (e.g. for EU data residency). */
|
|
14
|
+
apiHost?: string;
|
|
15
|
+
/** Override the default Appcues settings host (e.g. for EU data residency). */
|
|
16
|
+
settingsHost?: string;
|
|
17
|
+
/** Session timeout in seconds. */
|
|
18
|
+
sessionTimeout?: number;
|
|
19
|
+
/** Maximum number of activity items to store locally. */
|
|
20
|
+
activityStorageMaxSize?: number;
|
|
21
|
+
/** Maximum age (in seconds) of locally stored activity items. */
|
|
22
|
+
activityStorageMaxAge?: number;
|
|
23
|
+
/** Enable text scaling based on device accessibility settings. */
|
|
24
|
+
enableTextScaling?: boolean;
|
|
25
|
+
/** Enable the step recovery observer for recovering from failed step transitions. */
|
|
26
|
+
enableStepRecoveryObserver?: boolean;
|
|
27
|
+
};
|