mirror of
https://github.com/mosip/inji-wallet.git
synced 2026-01-11 06:27:57 -05:00
* [INJIMOB-3153]: add support for online sharing of mdoc VC Signed-off-by: Alka Prasad <prasadalka1998@gmail.com> * [INJIMOB-3153]: avoid stringifying the mdoc VC before sending to ovp library Signed-off-by: Alka Prasad <prasadalka1998@gmail.com> * [INJIMOB-3153]: send mdoc signature in device authentication class instead of map Signed-off-by: Alka Prasad <prasadalka1998@gmail.com> * [INJIMOB-3153]: update the openid4vp java bridge to accomodate the library structure changes Signed-off-by: Alka Prasad <prasadalka1998@gmail.com> * [INJIMOB-3153]: handle error display for duplicate mdoc sharing Signed-off-by: Alka Prasad <prasadalka1998@gmail.com> * [INJIMOB-3153]: rename authenticationContainer to VpTokenSigningResult Signed-off-by: Alka Prasad <prasadalka1998@gmail.com> * [INJIMOB-3015] support for mdoc in ios native maodule Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJIMOB-3015] update wallet metadata initial config Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJIMOB-3015] update wallet_metadat key for mdoc Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJIMOB-3015] update share vp api call label as per lib Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJIMOB-3015] update share vp api call label as per lib Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJIMOB-3153]: rename Vp to VP for consistency Signed-off-by: Alka Prasad <prasadalka1998@gmail.com> * [INJIMOB-3153]: correct the ovp version Signed-off-by: Alka Prasad <prasadalka1998@gmail.com> * [INJIMOB-3153]: remove mavenLocal from code Signed-off-by: Alka Prasad <prasadalka1998@gmail.com> * [INJIMOB-3015] rename deviceAuthenticationBytesSigned to docTypeToDeviceAuthentication in MdocVPTokenSigningResult Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJIMOB-3015] update pixelpass and openid4vp sswift libraries Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> --------- Signed-off-by: Alka Prasad <prasadalka1998@gmail.com> Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> Co-authored-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com>
184 lines
4.3 KiB
JavaScript
184 lines
4.3 KiB
JavaScript
import telemetry from 'telemetry-sdk';
|
|
import {Platform} from 'react-native';
|
|
import {MIMOTO_BASE_URL} from '../constants';
|
|
import i18next from 'i18next';
|
|
import {
|
|
__AppId,
|
|
__InjiVersion,
|
|
__SelectedLanguage,
|
|
__SessionId,
|
|
__TuvaliVersion,
|
|
} from '../GlobalVariables';
|
|
import {OBSRV_HOST} from 'react-native-dotenv';
|
|
import DeviceInfo from 'react-native-device-info';
|
|
import {isHardwareKeystoreExists} from '../cryptoutil/cryptoUtil';
|
|
import * as RNLocalize from 'react-native-localize';
|
|
import {TelemetryConstants} from './TelemetryConstants';
|
|
|
|
export function sendStartEvent(data) {
|
|
//telemetry.start({}, '', '', data, {});
|
|
}
|
|
|
|
export function sendEndEvent(data) {
|
|
//telemetry.end(data, {});
|
|
}
|
|
|
|
export function sendImpressionEvent(data) {
|
|
//telemetry.impression(data, {});
|
|
}
|
|
|
|
export function sendInteractEvent(data) {
|
|
//telemetry.interact(data, {});
|
|
}
|
|
|
|
export function sendAppInfoEvent(data) {
|
|
//telemetry.appinfo(data);
|
|
}
|
|
|
|
export function sendErrorEvent(data) {
|
|
//telemetry.error(data, {});
|
|
}
|
|
|
|
export function initializeTelemetry(config) {
|
|
//telemetry.initialize(config);
|
|
}
|
|
|
|
export function getTelemetryConfigData() {
|
|
return {
|
|
authtoken: '',
|
|
appid: __AppId.getValue(),
|
|
sid: __SessionId.getValue(),
|
|
batchsize: 5,
|
|
host: OBSRV_HOST,
|
|
endpoint: '/obsrv/v1/data/create/mosip-dataset',
|
|
telemetryDebugEnabled: false,
|
|
enableValidation: true,
|
|
schemaBaseUrl: 'http://mosip.io/telemetry/',
|
|
};
|
|
}
|
|
|
|
export function getStartEventData(type, additionalParameters = {}) {
|
|
return {
|
|
type: type,
|
|
additionalParameters: additionalParameters,
|
|
};
|
|
}
|
|
|
|
export function getEndEventData(type, status, additionalParameters = {}) {
|
|
return {
|
|
type: type,
|
|
status: status,
|
|
additionalParameters: additionalParameters,
|
|
};
|
|
}
|
|
|
|
export function getInteractEventData(
|
|
type,
|
|
ineteractionType,
|
|
interactingOn,
|
|
additionParameters = {},
|
|
) {
|
|
const subtype = getInteractDataSubtype(ineteractionType, interactingOn);
|
|
return {
|
|
type,
|
|
subtype,
|
|
additionParameters: additionParameters,
|
|
};
|
|
}
|
|
|
|
export const getInteractDataSubtype = (ineteractionType, interactingOn) => {
|
|
return ineteractionType + '_' + interactingOn;
|
|
};
|
|
|
|
export function getImpressionEventData(
|
|
type,
|
|
subtype,
|
|
additionalParameters = {},
|
|
) {
|
|
return {
|
|
type,
|
|
subtype,
|
|
additionalParameters: additionalParameters,
|
|
};
|
|
}
|
|
|
|
export function getErrorEventData(
|
|
type,
|
|
errorId,
|
|
errorMessage,
|
|
stacktrace = {},
|
|
) {
|
|
return {
|
|
type: type,
|
|
errorId: errorId,
|
|
errorMessage: errorMessage,
|
|
stacktrace: stacktrace,
|
|
...getAppInfoEventData(),
|
|
};
|
|
}
|
|
|
|
export function getAppInfoEventData() {
|
|
return {
|
|
env: MIMOTO_BASE_URL,
|
|
brandName: DeviceInfo.getBrand(),
|
|
modelName: DeviceInfo.getModel(),
|
|
osName: DeviceInfo.getSystemName(),
|
|
osVersion: DeviceInfo.getSystemVersion(),
|
|
osApiLevel: Platform.Version.toString(),
|
|
isHardwareKeystoreSupported: isHardwareKeystoreExists,
|
|
dateTime: new Date().getTime(),
|
|
zone: RNLocalize.getTimeZone(),
|
|
offset: new Date().getTimezoneOffset() * 60 * 1000,
|
|
preferredLanguage: languageCodeMap[i18next.language] ?? i18next.language,
|
|
buildNumber: DeviceInfo.getBuildNumber(),
|
|
injiVersion: __InjiVersion.getValue(),
|
|
tuvaliVersion: __TuvaliVersion.getValue(),
|
|
};
|
|
}
|
|
|
|
let retryCount = 0;
|
|
|
|
export const incrementRetryCount = (eventType, screen) => {
|
|
if (retryCount < 4) {
|
|
retryCount += 1;
|
|
} else {
|
|
const [errorId, errorMessage] =
|
|
screen === TelemetryConstants.Screens.passcode
|
|
? [
|
|
TelemetryConstants.ErrorId.mismatch,
|
|
TelemetryConstants.ErrorMessage.passcodeDidNotMatch,
|
|
]
|
|
: [
|
|
TelemetryConstants.ErrorId.resend,
|
|
TelemetryConstants.ErrorMessage.resendOtp,
|
|
];
|
|
sendErrorEvent(getErrorEventData(eventType, errorId, errorMessage));
|
|
retryCount = 0;
|
|
}
|
|
};
|
|
|
|
export const resetRetryCount = () => {
|
|
retryCount = 0;
|
|
};
|
|
|
|
export function configureTelemetry() {
|
|
const config = getTelemetryConfigData();
|
|
initializeTelemetry(config);
|
|
sendAppInfoEvent(getAppInfoEventData());
|
|
}
|
|
|
|
export function getEventType(isSettingUp) {
|
|
return isSettingUp
|
|
? TelemetryConstants.FlowType.appOnboarding
|
|
: TelemetryConstants.FlowType.appLogin;
|
|
}
|
|
|
|
const languageCodeMap = {
|
|
en: 'English',
|
|
fil: 'Filipino',
|
|
ar: 'Arabic',
|
|
hi: 'Hindi',
|
|
kn: 'Kannada',
|
|
ta: 'Tamil',
|
|
};
|