@shopgate/pwa-core 7.30.0-alpha.7 → 7.30.0-alpha.8
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/classes/AppCommand/index.js +115 -11
- package/classes/AppCommand/spec.js +260 -6
- package/classes/AppCommandRequest/index.js +129 -20
- package/classes/AppPermissionsRequest/AppPermissionsRequest.js +45 -7
- package/classes/AppPermissionsRequest/GetAppPermissionsRequest.js +48 -9
- package/classes/AppPermissionsRequest/RequestAppPermissionsRequest.js +54 -9
- package/classes/Bridge/index.js +34 -4
- package/classes/Bridge/spec.js +24 -1
- package/classes/BrightnessRequest/index.js +59 -10
- package/classes/BrightnessRequest/spec.js +111 -6
- package/classes/BrowserConnector/index.js +180 -26
- package/classes/Conditioner/index.js +74 -8
- package/classes/Conditioner/spec.js +75 -1
- package/classes/DataRequest/index.js +116 -13
- package/classes/DevServerBridge/index.js +86 -9
- package/classes/DevServerBridge/spec.js +231 -14
- package/classes/ErrorManager/index.js +144 -20
- package/classes/ErrorManager/spec.js +244 -2
- package/classes/Event/index.js +101 -15
- package/classes/HttpRequest/index.js +182 -21
- package/classes/PipelineDependencies/index.js +42 -6
- package/classes/PipelineDependencies/spec.js +46 -3
- package/classes/PipelineManager/index.js +517 -71
- package/classes/PipelineManager/spec.js +733 -15
- package/classes/PipelineRequest/index.js +167 -19
- package/classes/PipelineRequest/mock.js +118 -21
- package/classes/PipelineRequest/spec.js +333 -2
- package/classes/PipelineSequence/index.js +34 -6
- package/classes/Request/index.js +61 -13
- package/classes/RequestBuffer/index.js +43 -6
- package/classes/RequestManager/index.js +216 -33
- package/classes/RequestManager/spec.js +188 -1
- package/classes/Scanner/index.js +246 -67
- package/classes/ScannerEvent/index.js +23 -9
- package/classes/ScannerEventHandler/index.js +39 -16
- package/classes/ScannerEventListener/index.js +84 -24
- package/classes/ScannerManager/ScanProcessingError.js +11 -3
- package/classes/ScannerManager/index.js +133 -21
- package/classes/WebStorageRequest/index.js +76 -9
- package/commands/analyticsSetCustomValues.js +8 -2
- package/commands/appPermissions.js +10 -3
- package/commands/brightness.js +33 -5
- package/commands/broadcastEvent.js +8 -2
- package/commands/cleanTab.js +11 -3
- package/commands/closeInAppBrowser.js +22 -2
- package/commands/flushTab.js +8 -2
- package/commands/getWebStorageEntry.js +11 -2
- package/commands/hideMenuBar.js +8 -2
- package/commands/hideNavigationBar.js +8 -2
- package/commands/hideSplashScreen.js +8 -2
- package/commands/onload.js +13 -3
- package/commands/openAppSettings.js +8 -2
- package/commands/openPage.js +8 -2
- package/commands/openPageExtern.js +8 -2
- package/commands/performCommandsAfterDelay.js +11 -3
- package/commands/plotProjects.js +65 -7
- package/commands/popTabToRoot.js +11 -3
- package/commands/registerEvents.js +10 -2
- package/commands/scanner.js +76 -7
- package/commands/setCookie.js +8 -2
- package/commands/setDebugLoggingEnabled.js +8 -2
- package/commands/setScrollingEnabled.js +7 -2
- package/commands/setWebStorageEntry.js +8 -2
- package/commands/shareItem.js +18 -2
- package/commands/showNavigationBar.js +8 -2
- package/commands/showTab.js +13 -2
- package/commands/unifiedTracking.js +128 -30
- package/constants/AppCommands.js +6 -1
- package/constants/AppEvents.js +9 -1
- package/constants/AppPermissions.js +57 -13
- package/constants/Command.js +1 -1
- package/constants/ErrorHandleTypes.js +2 -1
- package/constants/ErrorManager.js +15 -1
- package/constants/Pipeline.js +52 -17
- package/constants/ProcessTypes.js +3 -1
- package/constants/RequestManagerModes.js +19 -7
- package/constants/RequestTypes.js +2 -1
- package/constants/Scanner.js +39 -10
- package/constants/Trilean.js +6 -1
- package/emitters/ui.js +2 -1
- package/helpers/index.js +66 -8
- package/helpers/logGroup.js +56 -8
- package/helpers/version.js +216 -22
- package/index.js +60 -5
- package/package.json +1 -1
package/commands/plotProjects.js
CHANGED
|
@@ -1,9 +1,26 @@
|
|
|
1
|
-
|
|
1
|
+
import AppCommand from "../classes/AppCommand";
|
|
2
|
+
import { logger } from "../helpers";
|
|
3
|
+
|
|
4
|
+
/**
|
|
2
5
|
* Enables the geofencing provider plotProjects
|
|
3
6
|
* @param {string} token The public token that is needed to enable plot projects
|
|
4
|
-
*/
|
|
7
|
+
*/
|
|
8
|
+
export function plotProjectsEnable(token) {
|
|
9
|
+
const command = new AppCommand();
|
|
10
|
+
command.setCommandName('plotProjectsEnable').setLibVersion('18.0').dispatch({
|
|
11
|
+
publicToken: token
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
5
16
|
* Disables the geofencing provider plotProjects
|
|
6
|
-
*/
|
|
17
|
+
*/
|
|
18
|
+
export function plotProjectsDisable() {
|
|
19
|
+
const command = new AppCommand();
|
|
20
|
+
command.setCommandName('plotProjectsDisable').setLibVersion('18.0').dispatch();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
7
24
|
* This command sets a Segmentation Properties within PlotProjects
|
|
8
25
|
* @param {Array} inputProperties Array that contains the information about the segmentation
|
|
9
26
|
* properties
|
|
@@ -15,7 +32,48 @@ function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="s
|
|
|
15
32
|
* @param {any} [inputProperties.value] The value that shall be set for that property. In case the
|
|
16
33
|
* value is <Null> or omitted, the property will be cleared. Only supported for strings
|
|
17
34
|
* @return {boolean|undefined}
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
35
|
+
*/
|
|
36
|
+
export function plotProjectsSetSegmentationProperties(inputProperties) {
|
|
37
|
+
const possibleTypes = ['string', 'integer', 'double', 'date', 'bool', null];
|
|
38
|
+
|
|
39
|
+
// validate properties
|
|
40
|
+
const properties = inputProperties.filter(({
|
|
41
|
+
key,
|
|
42
|
+
type,
|
|
43
|
+
value
|
|
44
|
+
}) => {
|
|
45
|
+
if (typeof key !== 'string') {
|
|
46
|
+
logger.error(`Unsupported plotprojects property "key". found "${key}" (typeof "${typeof key}") expected "string"`);
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// plotProjects only allows max 40 characters as key
|
|
51
|
+
if (key.length > 40) {
|
|
52
|
+
logger.error('plotprojects property "key" exceeded length limit of 40');
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
if (typeof value === 'string' && value.length > 40) {
|
|
56
|
+
logger.error('plotprojects property "value" exceeded length limit of 40');
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
if (typeof type !== 'undefined' && !possibleTypes.includes(type)) {
|
|
60
|
+
logger.error(`Unsupported plotprojects property "type". found "${type}" expected:`, possibleTypes);
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// clear is only supported for strings at the moment
|
|
65
|
+
if (typeof type !== 'string' && (value === null || typeof value === 'undefined')) {
|
|
66
|
+
logger.error(`plotprojects. Clearing is only supported for type=string. found "${value}" for type "${type}"`);
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
return true;
|
|
70
|
+
});
|
|
71
|
+
if (!properties.length) {
|
|
72
|
+
logger.error('No valid plotprojects properties found', inputProperties);
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
const command = new AppCommand();
|
|
76
|
+
return command.setCommandName('plotProjectsSetSegmentationProperties').setCommandParams({
|
|
77
|
+
properties
|
|
78
|
+
}).setLibVersion('25.0').dispatch();
|
|
79
|
+
}
|
package/commands/popTabToRoot.js
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
import AppCommand from"../classes/AppCommand"
|
|
1
|
+
import AppCommand from "../classes/AppCommand";
|
|
2
|
+
|
|
3
|
+
/**
|
|
2
4
|
* Builds an popTabToRoot command.
|
|
3
5
|
* @param {Object} params The command parameters.
|
|
4
6
|
* @param {string} params.targetTab The navigation stack that shall be popped to root view.
|
|
5
7
|
* @return {AppCommand}
|
|
6
|
-
*/
|
|
8
|
+
*/
|
|
9
|
+
export const popTabToRootCmd = params => new AppCommand().setCommandName('popTabToRoot').setCommandParams(params);
|
|
10
|
+
|
|
11
|
+
/**
|
|
7
12
|
* Sends an popTabToRoot command to the app.
|
|
8
13
|
* @param {Object} params The command parameters.
|
|
9
14
|
* @param {string} params.targetTab The navigation stack that shall be popped to root view.
|
|
10
|
-
*/
|
|
15
|
+
*/
|
|
16
|
+
export default function popTabToRoot(params) {
|
|
17
|
+
popTabToRootCmd(params).dispatch();
|
|
18
|
+
}
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
import AppCommand from"../classes/AppCommand"
|
|
1
|
+
import AppCommand from "../classes/AppCommand";
|
|
2
|
+
|
|
3
|
+
/**
|
|
2
4
|
* Sends registerEvents command to the app.
|
|
3
5
|
* This registers the WebView to certain app events.
|
|
4
6
|
* @param {Array} events Events that should be registered.
|
|
5
|
-
*/
|
|
7
|
+
*/
|
|
8
|
+
export default function registerEvents(events) {
|
|
9
|
+
const command = new AppCommand(true, false);
|
|
10
|
+
command.setCommandName('registerEvents').dispatch({
|
|
11
|
+
events
|
|
12
|
+
});
|
|
13
|
+
}
|
package/commands/scanner.js
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
import
|
|
1
|
+
import merge from 'lodash/merge';
|
|
2
|
+
import AppCommand from "../classes/AppCommand";
|
|
3
|
+
import { PWA_DEFAULT_TAB } from "../constants/Command";
|
|
4
|
+
import { SCANNER_ANIMATION_FOREGROUND_BOTTOM, SCANNER_TYPE_BARCODE, SCANNER_TYPE_CARD, SCANNER_TYPE_IMAGE, SCANNER_MODE_ON, SCANNER_MODE_OFF } from "../constants/Scanner";
|
|
5
|
+
|
|
6
|
+
/**
|
|
2
7
|
* Data definition the scanner modes parameters. Possible values are "on" or "off".
|
|
3
8
|
* @typedef {string} ScannerType
|
|
4
9
|
* @typedef {Object} ScannerModes
|
|
5
10
|
* @property {ScannerType} barcodeRecognition Shall the scanner try to recognize barcodes.
|
|
6
11
|
* @property {ScannerType} imageCapturing Shall the scanner try to capture images.
|
|
7
12
|
* @property {ScannerType} cardRecognition Shall the scanner try to recognize credit cards.
|
|
8
|
-
*/
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
9
16
|
* Sends an openScanner command to the app.
|
|
10
17
|
* @param {Object} params The command parameters.
|
|
11
18
|
* @param {string} params.src The URL to the webview which overlays the scanner feed.
|
|
@@ -13,17 +20,79 @@ import _regeneratorRuntime from"@babel/runtime/regenerator";function asyncGenera
|
|
|
13
20
|
* "updateTemplateContent" SGEvent to the scanner webview.
|
|
14
21
|
* @param {string} [params.animation] The entry animation for the webview.
|
|
15
22
|
* @param {ScannerModes} params.modes The scanner modes.
|
|
16
|
-
*/
|
|
23
|
+
*/
|
|
24
|
+
export function openScanner(params) {
|
|
25
|
+
const defaults = {
|
|
26
|
+
src: 'sgapi:scanner',
|
|
27
|
+
animation: SCANNER_ANIMATION_FOREGROUND_BOTTOM,
|
|
28
|
+
modes: {
|
|
29
|
+
[SCANNER_TYPE_BARCODE]: SCANNER_MODE_OFF,
|
|
30
|
+
[SCANNER_TYPE_IMAGE]: SCANNER_MODE_OFF,
|
|
31
|
+
[SCANNER_TYPE_CARD]: SCANNER_MODE_OFF
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
let merged = merge(defaults, params);
|
|
35
|
+
const {
|
|
36
|
+
barcodeRecognition,
|
|
37
|
+
imageCapturing,
|
|
38
|
+
cardRecognition
|
|
39
|
+
} = merged.modes;
|
|
40
|
+
const eventParams = {
|
|
41
|
+
eventParams: {
|
|
42
|
+
scannerData: {
|
|
43
|
+
modes: {
|
|
44
|
+
[SCANNER_TYPE_BARCODE]: barcodeRecognition === SCANNER_MODE_ON,
|
|
45
|
+
[SCANNER_TYPE_IMAGE]: imageCapturing === SCANNER_MODE_ON,
|
|
46
|
+
[SCANNER_TYPE_CARD]: cardRecognition === SCANNER_MODE_ON
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
sourceTab: PWA_DEFAULT_TAB
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
merged = merge(merged, eventParams);
|
|
53
|
+
const command = new AppCommand();
|
|
54
|
+
command.setCommandName('openScanner').dispatch(merged);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
17
58
|
* Sends a closeScanner command to the app.
|
|
18
59
|
* @param {Object} params The command parameters.
|
|
19
60
|
* @param {string} [params.animation] The exit animation for the webview.
|
|
20
|
-
*/
|
|
61
|
+
*/
|
|
62
|
+
export function closeScanner(params = {}) {
|
|
63
|
+
const defaults = {
|
|
64
|
+
animation: SCANNER_ANIMATION_FOREGROUND_BOTTOM
|
|
65
|
+
};
|
|
66
|
+
const merged = merge(defaults, params);
|
|
67
|
+
const command = new AppCommand();
|
|
68
|
+
command.setCommandName('closeScanner').dispatch(merged);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
21
72
|
* Sends a startScanner command to the app.
|
|
22
73
|
* It activates the content recognition of the scanner.
|
|
23
|
-
*/
|
|
74
|
+
*/
|
|
75
|
+
export function startScanner() {
|
|
76
|
+
const command = new AppCommand();
|
|
77
|
+
command.setCommandName('startScanner').dispatch();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
24
81
|
* Sends a stopScanner command to the app.
|
|
25
82
|
* It deactivates the content recognition of the scanner.
|
|
26
|
-
*/
|
|
83
|
+
*/
|
|
84
|
+
export async function stopScanner() {
|
|
85
|
+
const command = new AppCommand();
|
|
86
|
+
await command.setCommandName('stopScanner').dispatch();
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
27
90
|
* Sends a setFlashlightMode command to the app.
|
|
28
91
|
* @param {boolean} enable Enables or disables the flashlight of the camera.
|
|
29
|
-
*/
|
|
92
|
+
*/
|
|
93
|
+
export function setFlashlightMode(enable) {
|
|
94
|
+
const command = new AppCommand();
|
|
95
|
+
command.setCommandName('setFlashlightMode').dispatch({
|
|
96
|
+
mode: enable ? SCANNER_MODE_ON : SCANNER_MODE_OFF
|
|
97
|
+
});
|
|
98
|
+
}
|
package/commands/setCookie.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import AppCommand from"../classes/AppCommand"
|
|
1
|
+
import AppCommand from "../classes/AppCommand";
|
|
2
|
+
|
|
3
|
+
/**
|
|
2
4
|
* Sends an setCookie command to the app.
|
|
3
5
|
* @param {Object} params The command parameters
|
|
4
6
|
* @param {string} params.name The name of the cookie
|
|
@@ -8,4 +10,8 @@ import AppCommand from"../classes/AppCommand";/**
|
|
|
8
10
|
* @param {string} params.path The path for the cookie
|
|
9
11
|
* @param {boolean} params.secure Set is secure
|
|
10
12
|
* @param {boolean} params.httpOnly Set is http only
|
|
11
|
-
*/
|
|
13
|
+
*/
|
|
14
|
+
export default function setCookie(params) {
|
|
15
|
+
const command = new AppCommand();
|
|
16
|
+
command.setCommandName('setCookie').setLibVersion('14.0').dispatch(params);
|
|
17
|
+
}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import AppCommand from"../classes/AppCommand"
|
|
1
|
+
import AppCommand from "../classes/AppCommand";
|
|
2
|
+
|
|
3
|
+
/**
|
|
2
4
|
* Sends a setDebugLoggingEnabled command to the app.
|
|
3
5
|
* @param {Object} params The command parameters.
|
|
4
|
-
*/
|
|
6
|
+
*/
|
|
7
|
+
export default function setDebugLoggingEnabled(params = {}) {
|
|
8
|
+
const command = new AppCommand();
|
|
9
|
+
command.setCommandName('setDebugLoggingEnabled').dispatch(params);
|
|
10
|
+
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import AppCommand from"../classes/AppCommand"
|
|
1
|
+
import AppCommand from "../classes/AppCommand";
|
|
2
|
+
|
|
3
|
+
/**
|
|
2
4
|
* Sends a setScrollingEnabled command to the app.
|
|
3
5
|
* @param {Object} params The command parameters.
|
|
4
6
|
* @param {boolean} params.enabled Target tab for the page.
|
|
5
|
-
*/
|
|
7
|
+
*/
|
|
8
|
+
export default function setScrollingEnabled(params) {
|
|
9
|
+
new AppCommand().setCommandName('setScrollingEnabled').setCommandParams(params).dispatch();
|
|
10
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import AppCommand from"../classes/AppCommand"
|
|
1
|
+
import AppCommand from "../classes/AppCommand";
|
|
2
|
+
|
|
3
|
+
/**
|
|
2
4
|
* This commands set up entries with values in the WebStorageRequest. This storage is mainly meant
|
|
3
5
|
* to be a data storage for web views. The entry with its value can fetched by using
|
|
4
6
|
* getWebStorageEntry.
|
|
@@ -8,4 +10,8 @@ import AppCommand from"../classes/AppCommand";/**
|
|
|
8
10
|
* that the entry will be deleted.
|
|
9
11
|
* @param {number} params.timeout The cache time how long the entry shall be stored in seconds
|
|
10
12
|
* 0 or omitting means that the entry won't be deleted automatically
|
|
11
|
-
*/
|
|
13
|
+
*/
|
|
14
|
+
export default function setWebStorageEntry(params) {
|
|
15
|
+
const command = new AppCommand();
|
|
16
|
+
command.setCommandName('setWebStorageEntry').dispatch(params);
|
|
17
|
+
}
|
package/commands/shareItem.js
CHANGED
|
@@ -1,7 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
import "core-js/modules/es.string.replace.js";
|
|
2
|
+
import AppCommand from "../classes/AppCommand";
|
|
3
|
+
|
|
4
|
+
/**
|
|
2
5
|
* Sends a shareItem command to the app.
|
|
3
6
|
* @param {Object} params The command paramters.
|
|
4
7
|
* @param {string} params.title The product title
|
|
5
8
|
* @param {string} params.imageURL The products image url to be loaded
|
|
6
9
|
* @param {string} params.deepLink The products deep link
|
|
7
|
-
*/
|
|
10
|
+
*/
|
|
11
|
+
export default params => {
|
|
12
|
+
const merged = {
|
|
13
|
+
title: '',
|
|
14
|
+
imageURL: '',
|
|
15
|
+
deepLink: '',
|
|
16
|
+
...params
|
|
17
|
+
};
|
|
18
|
+
if (merged.deepLink) {
|
|
19
|
+
merged.deepLink = merged.deepLink.replace(/(\?|&)shopgate_redirect=1/i, '');
|
|
20
|
+
}
|
|
21
|
+
const command = new AppCommand();
|
|
22
|
+
command.setCommandName('shareItem').dispatch(merged);
|
|
23
|
+
};
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import AppCommand from"../classes/AppCommand"
|
|
1
|
+
import AppCommand from "../classes/AppCommand";
|
|
2
|
+
|
|
3
|
+
/**
|
|
2
4
|
* Sends showNavigationBar command to the app.
|
|
3
5
|
* @param {Object} [params=null] The command parameters.
|
|
4
|
-
*/
|
|
6
|
+
*/
|
|
7
|
+
export default function showNavigationBar(params = null) {
|
|
8
|
+
const command = new AppCommand();
|
|
9
|
+
command.setCommandName('showNavigationBar').dispatch(params);
|
|
10
|
+
}
|
package/commands/showTab.js
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
import AppCommand from"../classes/AppCommand";
|
|
1
|
+
import AppCommand from "../classes/AppCommand";
|
|
2
|
+
import { logger, hasSGJavaScriptBridge } from "../helpers";
|
|
3
|
+
|
|
4
|
+
/**
|
|
2
5
|
* Sends a showTab command to the app.
|
|
3
6
|
* @param {params} params The command parameters
|
|
4
7
|
* @param {string} params.targetTab The navigation stack which shall be displayed.
|
|
5
8
|
* @param {string} [params.transition] The type of the transition.
|
|
6
9
|
* @param {number} [params.speedFactor] Speeds up or slows down the transition. Number
|
|
7
10
|
* between 0 and 1 speeds up. Number above 1 slows down.
|
|
8
|
-
*/
|
|
11
|
+
*/
|
|
12
|
+
export default function showTab(params) {
|
|
13
|
+
if (!hasSGJavaScriptBridge()) {
|
|
14
|
+
logger.warn('WARNING: \'showTab\' can only be called in an app environment!');
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const command = new AppCommand();
|
|
18
|
+
command.setCommandName('showTab').dispatch(params);
|
|
19
|
+
}
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import AppCommand from"../classes/AppCommand"
|
|
1
|
+
import AppCommand from "../classes/AppCommand";
|
|
2
|
+
|
|
3
|
+
/**
|
|
2
4
|
* Data definitions of the multiple tracking events
|
|
3
|
-
*/
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
4
8
|
* Data definition for a pageview event within the unified tracking system
|
|
5
9
|
* @typedef {Object} UnifiedPageview
|
|
6
10
|
* @property {string} type The type of the current page. Something like "Product" or "Checkout"
|
|
7
11
|
* @property {string} id A unique identifier for the current page, like an item number or page title
|
|
8
12
|
* @property {string} name A name to easier distinguish this item in the tracking tool
|
|
9
13
|
* @property {UnifiedRestrictions} [restrictions] Restrictions for the command
|
|
10
|
-
*/
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
11
17
|
* Data definition for the payload of a custom event within the unified tracking system
|
|
12
18
|
* @typedef {Object} UnifiedEvent
|
|
13
19
|
* @property {string} shortName Short name of the event that shall be logged
|
|
@@ -16,7 +22,9 @@ import AppCommand from"../classes/AppCommand";/**
|
|
|
16
22
|
* @property {string} name Name of the event
|
|
17
23
|
* @property {Object} [customParams] Custom parameters that will be logged with the event
|
|
18
24
|
* @property {UnifiedRestrictions} [restrictions] Restrictions for the command
|
|
19
|
-
*/
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/**
|
|
20
28
|
* Data definition for a purchase event within the unified tracking system
|
|
21
29
|
* @typedef {Object} UnifiedPurchase
|
|
22
30
|
* @property {string} id A unique ID representing the transaction.
|
|
@@ -35,19 +43,25 @@ import AppCommand from"../classes/AppCommand";/**
|
|
|
35
43
|
* @property {string} [type] Type of checkout
|
|
36
44
|
* @property {boolean} [success] Whether the Purchase was successful, or not
|
|
37
45
|
* @property {UnifiedRestrictions} [restrictions] Restrictions for the command
|
|
38
|
-
*/
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
/**
|
|
39
49
|
* Data definition for an addToCart event within the unified tracking system
|
|
40
50
|
* @typedef {Object} UnifiedAddToCart
|
|
41
51
|
* @property {UnifiedAddToCartItem[]} items Array of unified items
|
|
42
52
|
* @property {string} position Position where the add to cart took place
|
|
43
53
|
* @property {UnifiedRestrictions} [restrictions] Restrictions for the command
|
|
44
|
-
*/
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
/**
|
|
45
57
|
* Data definition for an addedPaymentInfo event within the unified tracking system
|
|
46
58
|
* @typedef {Object} UnifiedAddedPaymentInfo
|
|
47
59
|
* @property {bool} success If it was success or not
|
|
48
60
|
* @property {string} name Name of the payment method
|
|
49
61
|
* @property {UnifiedRestrictions} [restrictions] Restrictions for the command
|
|
50
|
-
*/
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
/**
|
|
51
65
|
* Data definition for an InitiatedCheckout event within the unified tracking system
|
|
52
66
|
* @typedef {Object} UnifiedInitiatedCheckout
|
|
53
67
|
* @property {number} valueNet The net value of the items in the cart
|
|
@@ -57,18 +71,24 @@ import AppCommand from"../classes/AppCommand";/**
|
|
|
57
71
|
* @property {boolean} [paymentInfoAvailable] Whether the paymentInfo is available
|
|
58
72
|
* @property {string} [currency] The currency code as ISO 4217 string.
|
|
59
73
|
* @property {UnifiedRestrictions} [restrictions] Restrictions for the command
|
|
60
|
-
*/
|
|
74
|
+
*/
|
|
75
|
+
|
|
76
|
+
/**
|
|
61
77
|
* Data definition for a completedRegistration within the unified tracking system
|
|
62
78
|
* @typedef {Object} UnifiedCompletedRegistration
|
|
63
79
|
* @property {string} registrationMethod The type of the registration
|
|
64
80
|
* (default_account, guest_account, facebook, 'connect_register')
|
|
65
81
|
* @property {UnifiedRestrictions} [restrictions] Restrictions for the command
|
|
66
|
-
*/
|
|
82
|
+
*/
|
|
83
|
+
|
|
84
|
+
/**
|
|
67
85
|
* Data definition for an addToWishlist event within the unified tracking system
|
|
68
86
|
* @typedef {Object} UnifiedAddToWishlist
|
|
69
87
|
* @property {UnifiedAddToWishlistItem[]} items Array of unified wishlist items
|
|
70
88
|
* @property {UnifiedRestrictions} [restrictions] Restrictions for the command
|
|
71
|
-
*/
|
|
89
|
+
*/
|
|
90
|
+
|
|
91
|
+
/**
|
|
72
92
|
* Data definition for an addToWishlist item within the unified tracking system
|
|
73
93
|
* @typedef {Object} UnifiedAddToWishlistItem
|
|
74
94
|
* @property {number} priceNet The net price of the product
|
|
@@ -80,7 +100,9 @@ import AppCommand from"../classes/AppCommand";/**
|
|
|
80
100
|
* @property {string} type The type of the item, eg "product"
|
|
81
101
|
* @property {string} name The name of the item
|
|
82
102
|
* @property {string} [brand] The brand of the product
|
|
83
|
-
*/
|
|
103
|
+
*/
|
|
104
|
+
|
|
105
|
+
/**
|
|
84
106
|
* Data definition for an search event within the unified tracking system
|
|
85
107
|
* @typedef {Object} UnifiedSearched
|
|
86
108
|
* @property {string} [query] The query string that has been used for the search
|
|
@@ -88,12 +110,16 @@ import AppCommand from"../classes/AppCommand";/**
|
|
|
88
110
|
* @property {string} [type] The type of the content that has been searched
|
|
89
111
|
* @property {number} [hits] Amount of hits, the search brought.
|
|
90
112
|
* @property {UnifiedRestrictions} [restrictions] Restrictions for the command
|
|
91
|
-
*/
|
|
113
|
+
*/
|
|
114
|
+
|
|
115
|
+
/**
|
|
92
116
|
* Data definition for a set campaign with url command payload within the unified tracking system
|
|
93
117
|
* @typedef {Object} UnifiedSetCampaignWithUrl
|
|
94
118
|
* @property {string} url The campaign url that shall be set
|
|
95
119
|
* @property {UnifiedRestrictions} [restrictions] Restrictions for the command
|
|
96
|
-
*/
|
|
120
|
+
*/
|
|
121
|
+
|
|
122
|
+
/**
|
|
97
123
|
* Data definition for a log item view command payload within the unified tracking system
|
|
98
124
|
* @typedef {Object} UnifiedItemView
|
|
99
125
|
* @property {string} id A unique identifier for the item
|
|
@@ -107,58 +133,130 @@ import AppCommand from"../classes/AppCommand";/**
|
|
|
107
133
|
* @property {string} [categoryId] A unique identifier for the category of the item
|
|
108
134
|
* @property {string} [categoryName] Category path of the item (apparel/shoes/sneakers)
|
|
109
135
|
* @property {UnifiedRestrictions} [restrictions] Restrictions for the command
|
|
110
|
-
*/
|
|
136
|
+
*/
|
|
137
|
+
|
|
138
|
+
/**
|
|
111
139
|
* Data definition for a log login command payload within the unified tracking system
|
|
112
140
|
* @typedef {Object} UnifiedLogin
|
|
113
141
|
* @property {string} type Defines the type of the login. “guest”, “facebook”.
|
|
114
142
|
* @property {UnifiedRestrictions} [restrictions] Restrictions for the command
|
|
115
|
-
*/
|
|
143
|
+
*/
|
|
144
|
+
|
|
145
|
+
/**
|
|
116
146
|
* Additional definitions of data for the multiple tracking events
|
|
117
|
-
*/
|
|
147
|
+
*/
|
|
148
|
+
|
|
149
|
+
/**
|
|
118
150
|
* Restrictions for a unified tracking command
|
|
119
151
|
* @typedef {Object} UnifiedRestrictions
|
|
120
152
|
* @property {boolean} blacklist If set to TRUE, this event is not sent to the trackers named
|
|
121
153
|
* in the tracker-array within this restriction object, if set to FALSE, this event is only sent
|
|
122
154
|
* to the trackers in the tracker-array.
|
|
123
155
|
* @property {Array} trackers List of tracker names that are concerned of this restriction
|
|
124
|
-
*/
|
|
156
|
+
*/
|
|
157
|
+
|
|
158
|
+
/**
|
|
125
159
|
* Executes a unified tracking command
|
|
126
160
|
* @param {string} name The name of the command
|
|
127
161
|
* @param {Object} params The payload for the command
|
|
128
|
-
*/
|
|
162
|
+
*/
|
|
163
|
+
function executeCommand(name = '', params = {}) {
|
|
164
|
+
const command = new AppCommand();
|
|
165
|
+
command.setCommandName(name).dispatch(params);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
129
169
|
* This command can be used to log a viewContent event to all installed trackers. *
|
|
130
170
|
* @param {UnifiedPageview} data The payload for the command
|
|
131
|
-
*/
|
|
171
|
+
*/
|
|
172
|
+
export function analyticsLogPageview(data) {
|
|
173
|
+
executeCommand('analyticsLogPageview', data);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
132
177
|
* This command can be used to log an event to all installed trackers.
|
|
133
178
|
* @param {UnifiedEvent} data The payload for the command
|
|
134
|
-
*/
|
|
179
|
+
*/
|
|
180
|
+
export function analyticsLogEvent(data) {
|
|
181
|
+
executeCommand('analyticsLogEvent', data);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
135
185
|
* This command can be used to log a purchase event to all installed trackers.
|
|
136
186
|
* @param {UnifiedPurchase} data The payload for the command
|
|
137
|
-
*/
|
|
187
|
+
*/
|
|
188
|
+
export function analyticsLogPurchase(data) {
|
|
189
|
+
executeCommand('analyticsLogPurchase', data);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
138
193
|
* This command can be used to log an addToCart event to all installed trackers.
|
|
139
194
|
* @param {UnifiedAddToCart} data The payload for the command
|
|
140
|
-
*/
|
|
195
|
+
*/
|
|
196
|
+
export function analyticsLogAddToCart(data) {
|
|
197
|
+
executeCommand('analyticsLogAddToCart', data);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
141
201
|
* This command can be used to log an analyticsLogAddedPaymentInfo event to all installed trackers.
|
|
142
202
|
* @param {UnifiedAddedPaymentInfo} data The payload for the command
|
|
143
|
-
*/
|
|
203
|
+
*/
|
|
204
|
+
export function analyticsLogAddedPaymentInfo(data) {
|
|
205
|
+
executeCommand('analyticsLogAddedPaymentInfo', data);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
144
209
|
* This command can be used to log an initiated checkout event.
|
|
145
210
|
* @param {UnifiedInitiatedCheckout} data The payload for the command
|
|
146
|
-
*/
|
|
211
|
+
*/
|
|
212
|
+
export function analyticsLogInitiatedCheckout(data) {
|
|
213
|
+
executeCommand('analyticsLogInitiatedCheckout', data);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
147
217
|
* Logs which registration type was done.
|
|
148
218
|
* @param {UnifiedCompletedRegistration} data The payload for the command
|
|
149
|
-
*/
|
|
219
|
+
*/
|
|
220
|
+
export function analyticsLogCompletedRegistration(data) {
|
|
221
|
+
executeCommand('analyticsLogCompletedRegistration', data);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
150
225
|
* This command can be used to log an addToWishlist event to all installed trackers.
|
|
151
226
|
* @param {UnifiedAddToWishlist} data The payload for the command
|
|
152
|
-
*/
|
|
227
|
+
*/
|
|
228
|
+
export function analyticsLogAddToWishlist(data) {
|
|
229
|
+
executeCommand('analyticsLogAddToWishlist', data);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
153
233
|
* This command can be used to log a searched event to all installed trackers.
|
|
154
234
|
* @param {UnifiedSearched} data The payload for the command
|
|
155
|
-
*/
|
|
235
|
+
*/
|
|
236
|
+
export function analyticsLogSearch(data) {
|
|
237
|
+
executeCommand('analyticsLogSearch', data);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
156
241
|
* This command set a campaign url a user followed.
|
|
157
242
|
* @param {UnifiedSetCampaignWithUrl} data The payload for the command
|
|
158
|
-
*/
|
|
243
|
+
*/
|
|
244
|
+
export function analyticsSetCampaignWithUrl(data) {
|
|
245
|
+
executeCommand('analyticsSetCampaignWithUrl', data);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
159
249
|
* This command can be used to log an item view event to all installed trackers.
|
|
160
250
|
* @param {UnifiedItemView} data The payload for the command
|
|
161
|
-
*/
|
|
251
|
+
*/
|
|
252
|
+
export function analyticsLogItemView(data) {
|
|
253
|
+
executeCommand('analyticsLogItemView', data);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
162
257
|
* This command can be used to log a login event to all installed trackers.
|
|
163
258
|
* @param {UnifiedLogin} data The payload for the command
|
|
164
|
-
*/
|
|
259
|
+
*/
|
|
260
|
+
export function analyticsLogLogin(data) {
|
|
261
|
+
executeCommand('analyticsLogLogin', data);
|
|
262
|
+
}
|
package/constants/AppCommands.js
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
export
|
|
1
|
+
export const COMMAND_SEND_PIPELINE_REQUEST = 'sendPipelineRequest';
|
|
2
|
+
export const COMMAND_SEND_HTTP_REQUEST = 'sendHttpRequest';
|
|
3
|
+
export const COMMAND_SEND_DATA_REQUEST = 'sendDataRequest';
|
|
4
|
+
export const COMMAND_GET_WEBSTORAGE_ENTRY = 'getWebStorageEntry';
|
|
5
|
+
export const COMMAND_GET_APP_PERMISSIONS = 'getAppPermissions';
|
|
6
|
+
export const COMMAND_REQUEST_APP_PERMISSIONS = 'requestAppPermissions';
|
package/constants/AppEvents.js
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
-
export
|
|
1
|
+
export const EVENT_KEYBOARD_WILL_CHANGE = 'keyboardWillChange';
|
|
2
|
+
export const APP_EVENT_VIEW_DID_APPEAR = 'viewDidAppear';
|
|
3
|
+
export const APP_EVENT_VIEW_WILL_APPEAR = 'viewWillAppear';
|
|
4
|
+
export const APP_EVENT_VIEW_WILL_DISAPPEAR = 'viewWillDisappear';
|
|
5
|
+
export const APP_EVENT_VIEW_DID_DISAPPEAR = 'viewDidDisappear';
|
|
6
|
+
export const APP_EVENT_APPLICATION_WILL_ENTER_FOREGROUND = 'applicationWillEnterForeground';
|
|
7
|
+
export const APP_EVENT_SCANNER_DID_SCAN = 'scannerDidScan';
|
|
8
|
+
export const APP_EVENT_SCANNER_DID_APPEAR = 'scannerDidAppear';
|
|
9
|
+
export const APP_EVENT_SCANNER_DID_DISAPPEAR = 'scannerDidDisappear';
|