@procivis/one-react-native-components 0.3.115 → 0.3.130
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/lib/commonjs/components/credential/credential.js +2 -1
- package/lib/commonjs/components/credential/credential.js.map +1 -1
- package/lib/commonjs/components/history/history-list-item-icon.js +3 -3
- package/lib/commonjs/components/history/history-list-item-icon.js.map +1 -1
- package/lib/commonjs/components/history/history-list-item.js +2 -8
- package/lib/commonjs/components/history/history-list-item.js.map +1 -1
- package/lib/commonjs/components/history/history-list-screen.js +1 -1
- package/lib/commonjs/components/history/history-list-screen.js.map +1 -1
- package/lib/commonjs/components/index.js +11 -11
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/components/proof-request/v1/select-credential.js +2 -1
- package/lib/commonjs/components/proof-request/v1/select-credential.js.map +1 -1
- package/lib/commonjs/components/proof-request/v1/share-credential.js +2 -1
- package/lib/commonjs/components/proof-request/v1/share-credential.js.map +1 -1
- package/lib/commonjs/components/proof-request/v2/select-credential-v2.js +2 -1
- package/lib/commonjs/components/proof-request/v2/select-credential-v2.js.map +1 -1
- package/lib/commonjs/components/proof-request/v2/share-credential-v2-group.js +3 -1
- package/lib/commonjs/components/proof-request/v2/share-credential-v2-group.js.map +1 -1
- package/lib/commonjs/components/proof-request/v2/share-credential-v2.js +4 -2
- package/lib/commonjs/components/proof-request/v2/share-credential-v2.js.map +1 -1
- package/lib/commonjs/components/trust-info/index.js +29 -0
- package/lib/commonjs/components/trust-info/index.js.map +1 -0
- package/lib/commonjs/components/trust-info/trust-info.js +79 -0
- package/lib/commonjs/components/trust-info/trust-info.js.map +1 -0
- package/lib/commonjs/ui-components/credential/card/credential-details-card.js +3 -1
- package/lib/commonjs/ui-components/credential/card/credential-details-card.js.map +1 -1
- package/lib/commonjs/ui-components/header/foldable-header.js.map +1 -1
- package/lib/commonjs/ui-components/header/header.js +2 -0
- package/lib/commonjs/ui-components/header/header.js.map +1 -1
- package/lib/commonjs/ui-components/history/history-details.js +2 -2
- package/lib/commonjs/ui-components/history/history-details.js.map +1 -1
- package/lib/commonjs/ui-components/icons/contact.js +45 -0
- package/lib/commonjs/ui-components/icons/contact.js.map +1 -0
- package/lib/commonjs/ui-components/icons/credential.js +3 -3
- package/lib/commonjs/ui-components/icons/credential.js.map +1 -1
- package/lib/commonjs/ui-components/icons/icons.js +20 -1
- package/lib/commonjs/ui-components/icons/icons.js.map +1 -1
- package/lib/commonjs/ui-components/icons/index.js +11 -0
- package/lib/commonjs/ui-components/icons/index.js.map +1 -1
- package/lib/commonjs/ui-components/loader/loading-result.js +2 -0
- package/lib/commonjs/ui-components/loader/loading-result.js.map +1 -1
- package/lib/commonjs/ui-components/screens/index.js +7 -0
- package/lib/commonjs/ui-components/screens/index.js.map +1 -1
- package/lib/commonjs/ui-components/screens/nerd-mode-screen.js +28 -24
- package/lib/commonjs/ui-components/screens/nerd-mode-screen.js.map +1 -1
- package/lib/commonjs/ui-components/screens/trust-info-details-screen.js +384 -0
- package/lib/commonjs/ui-components/screens/trust-info-details-screen.js.map +1 -0
- package/lib/commonjs/utils/date.js +4 -5
- package/lib/commonjs/utils/date.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/cache.js +8 -4
- package/lib/commonjs/utils/hooks/core/cache.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/core-config.js +1 -6
- package/lib/commonjs/utils/hooks/core/core-config.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/core-context.js +0 -15
- package/lib/commonjs/utils/hooks/core/core-context.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/credentials.js +40 -1
- package/lib/commonjs/utils/hooks/core/credentials.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/index.js +0 -11
- package/lib/commonjs/utils/hooks/core/index.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/proofs.js +12 -1
- package/lib/commonjs/utils/hooks/core/proofs.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/trust-list.js +19 -3
- package/lib/commonjs/utils/hooks/core/trust-list.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/verifier-instance.js +22 -3
- package/lib/commonjs/utils/hooks/core/verifier-instance.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/wallet-unit.js +2 -2
- package/lib/commonjs/utils/hooks/core/wallet-unit.js.map +1 -1
- package/lib/commonjs/utils/parsers/credential-sharing-v2.js +14 -14
- package/lib/commonjs/utils/parsers/credential-sharing-v2.js.map +1 -1
- package/lib/commonjs/utils/parsers/credential-sharing.js +20 -18
- package/lib/commonjs/utils/parsers/credential-sharing.js.map +1 -1
- package/lib/commonjs/utils/parsers/credential.js +36 -22
- package/lib/commonjs/utils/parsers/credential.js.map +1 -1
- package/lib/commonjs/utils/parsers/query.js +1 -1
- package/lib/commonjs/utils/parsers/query.js.map +1 -1
- package/lib/commonjs/utils/translations.js +15 -0
- package/lib/commonjs/utils/translations.js.map +1 -0
- package/lib/module/components/credential/credential.js +2 -1
- package/lib/module/components/credential/credential.js.map +1 -1
- package/lib/module/components/history/history-list-item-icon.js +3 -3
- package/lib/module/components/history/history-list-item-icon.js.map +1 -1
- package/lib/module/components/history/history-list-item.js +3 -9
- package/lib/module/components/history/history-list-item.js.map +1 -1
- package/lib/module/components/history/history-list-screen.js +1 -1
- package/lib/module/components/history/history-list-screen.js.map +1 -1
- package/lib/module/components/index.js +1 -1
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/components/proof-request/v1/select-credential.js +2 -1
- package/lib/module/components/proof-request/v1/select-credential.js.map +1 -1
- package/lib/module/components/proof-request/v1/share-credential.js +2 -1
- package/lib/module/components/proof-request/v1/share-credential.js.map +1 -1
- package/lib/module/components/proof-request/v2/select-credential-v2.js +2 -1
- package/lib/module/components/proof-request/v2/select-credential-v2.js.map +1 -1
- package/lib/module/components/proof-request/v2/share-credential-v2-group.js +3 -1
- package/lib/module/components/proof-request/v2/share-credential-v2-group.js.map +1 -1
- package/lib/module/components/proof-request/v2/share-credential-v2.js +4 -2
- package/lib/module/components/proof-request/v2/share-credential-v2.js.map +1 -1
- package/lib/module/components/trust-info/index.js +4 -0
- package/lib/module/components/trust-info/index.js.map +1 -0
- package/lib/module/components/trust-info/trust-info.js +70 -0
- package/lib/module/components/trust-info/trust-info.js.map +1 -0
- package/lib/module/ui-components/credential/card/credential-details-card.js +3 -1
- package/lib/module/ui-components/credential/card/credential-details-card.js.map +1 -1
- package/lib/module/ui-components/header/foldable-header.js.map +1 -1
- package/lib/module/ui-components/header/header.js +2 -0
- package/lib/module/ui-components/header/header.js.map +1 -1
- package/lib/module/ui-components/history/history-details.js +3 -3
- package/lib/module/ui-components/history/history-details.js.map +1 -1
- package/lib/module/ui-components/icons/contact.js +34 -0
- package/lib/module/ui-components/icons/contact.js.map +1 -0
- package/lib/module/ui-components/icons/credential.js +1 -1
- package/lib/module/ui-components/icons/credential.js.map +1 -1
- package/lib/module/ui-components/icons/icons.js +18 -0
- package/lib/module/ui-components/icons/icons.js.map +1 -1
- package/lib/module/ui-components/icons/index.js +1 -0
- package/lib/module/ui-components/icons/index.js.map +1 -1
- package/lib/module/ui-components/loader/loading-result.js +2 -0
- package/lib/module/ui-components/loader/loading-result.js.map +1 -1
- package/lib/module/ui-components/screens/index.js +2 -0
- package/lib/module/ui-components/screens/index.js.map +1 -1
- package/lib/module/ui-components/screens/nerd-mode-screen.js +29 -25
- package/lib/module/ui-components/screens/nerd-mode-screen.js.map +1 -1
- package/lib/module/ui-components/screens/trust-info-details-screen.js +375 -0
- package/lib/module/ui-components/screens/trust-info-details-screen.js.map +1 -0
- package/lib/module/utils/date.js +4 -5
- package/lib/module/utils/date.js.map +1 -1
- package/lib/module/utils/hooks/core/cache.js +8 -4
- package/lib/module/utils/hooks/core/cache.js.map +1 -1
- package/lib/module/utils/hooks/core/core-config.js +0 -4
- package/lib/module/utils/hooks/core/core-config.js.map +1 -1
- package/lib/module/utils/hooks/core/core-context.js +0 -15
- package/lib/module/utils/hooks/core/core-context.js.map +1 -1
- package/lib/module/utils/hooks/core/credentials.js +37 -1
- package/lib/module/utils/hooks/core/credentials.js.map +1 -1
- package/lib/module/utils/hooks/core/index.js +0 -1
- package/lib/module/utils/hooks/core/index.js.map +1 -1
- package/lib/module/utils/hooks/core/proofs.js +10 -0
- package/lib/module/utils/hooks/core/proofs.js.map +1 -1
- package/lib/module/utils/hooks/core/trust-list.js +20 -4
- package/lib/module/utils/hooks/core/trust-list.js.map +1 -1
- package/lib/module/utils/hooks/core/verifier-instance.js +20 -2
- package/lib/module/utils/hooks/core/verifier-instance.js.map +1 -1
- package/lib/module/utils/hooks/core/wallet-unit.js +2 -2
- package/lib/module/utils/hooks/core/wallet-unit.js.map +1 -1
- package/lib/module/utils/parsers/credential-sharing-v2.js +15 -15
- package/lib/module/utils/parsers/credential-sharing-v2.js.map +1 -1
- package/lib/module/utils/parsers/credential-sharing.js +20 -18
- package/lib/module/utils/parsers/credential-sharing.js.map +1 -1
- package/lib/module/utils/parsers/credential.js +37 -23
- package/lib/module/utils/parsers/credential.js.map +1 -1
- package/lib/module/utils/parsers/query.js +1 -1
- package/lib/module/utils/parsers/query.js.map +1 -1
- package/lib/module/utils/translations.js +8 -0
- package/lib/module/utils/translations.js.map +1 -0
- package/lib/typescript/components/credential/credential.d.ts +1 -0
- package/lib/typescript/components/history/history-list-item.d.ts +1 -1
- package/lib/typescript/components/index.d.ts +1 -1
- package/lib/typescript/components/proof-request/v1/select-credential.d.ts +1 -0
- package/lib/typescript/components/proof-request/v1/share-credential.d.ts +1 -0
- package/lib/typescript/components/proof-request/v2/select-credential-v2.d.ts +1 -0
- package/lib/typescript/components/proof-request/v2/share-credential-v2-group.d.ts +1 -0
- package/lib/typescript/components/proof-request/v2/share-credential-v2.d.ts +1 -0
- package/lib/typescript/components/trust-info/index.d.ts +3 -0
- package/lib/typescript/components/trust-info/trust-info.d.ts +19 -0
- package/lib/typescript/ui-components/header/header.d.ts +2 -0
- package/lib/typescript/ui-components/history/history-details.d.ts +2 -2
- package/lib/typescript/ui-components/icons/contact.d.ts +4 -0
- package/lib/typescript/ui-components/icons/credential.d.ts +1 -1
- package/lib/typescript/ui-components/icons/icons.d.ts +1 -0
- package/lib/typescript/ui-components/icons/index.d.ts +1 -0
- package/lib/typescript/ui-components/screens/index.d.ts +3 -0
- package/lib/typescript/ui-components/screens/nerd-mode-screen.d.ts +5 -12
- package/lib/typescript/ui-components/screens/trust-info-details-screen.d.ts +32 -0
- package/lib/typescript/utils/hooks/core/core-config.d.ts +0 -1
- package/lib/typescript/utils/hooks/core/core-context.d.ts +0 -1
- package/lib/typescript/utils/hooks/core/credentials.d.ts +5 -1
- package/lib/typescript/utils/hooks/core/index.d.ts +0 -1
- package/lib/typescript/utils/hooks/core/proofs.d.ts +2 -0
- package/lib/typescript/utils/hooks/core/trust-list.d.ts +1 -4
- package/lib/typescript/utils/hooks/core/verifier-instance.d.ts +2 -0
- package/lib/typescript/utils/hooks/core/wallet-unit.d.ts +2 -2
- package/lib/typescript/utils/parsers/credential-sharing-v2.d.ts +3 -3
- package/lib/typescript/utils/parsers/credential-sharing.d.ts +6 -6
- package/lib/typescript/utils/parsers/credential.d.ts +5 -5
- package/lib/typescript/utils/parsers/query.d.ts +1 -1
- package/lib/typescript/utils/translations.d.ts +1 -0
- package/package.json +8 -8
- package/src/components/credential/credential.tsx +3 -0
- package/src/components/history/history-list-item-icon.tsx +2 -2
- package/src/components/history/history-list-item.tsx +4 -9
- package/src/components/history/history-list-screen.tsx +1 -1
- package/src/components/index.ts +1 -1
- package/src/components/proof-request/v1/select-credential.tsx +3 -1
- package/src/components/proof-request/v1/share-credential.tsx +3 -0
- package/src/components/proof-request/v2/select-credential-v2.tsx +3 -1
- package/src/components/proof-request/v2/share-credential-v2-group.tsx +4 -0
- package/src/components/proof-request/v2/share-credential-v2.tsx +5 -0
- package/src/components/trust-info/index.ts +4 -0
- package/src/components/trust-info/trust-info.tsx +90 -0
- package/src/ui-components/credential/card/credential-details-card.tsx +3 -2
- package/src/ui-components/header/foldable-header.tsx +10 -9
- package/src/ui-components/header/header.tsx +18 -3
- package/src/ui-components/history/history-details.tsx +4 -4
- package/src/ui-components/icons/contact.tsx +26 -0
- package/src/ui-components/icons/credential.tsx +1 -1
- package/src/ui-components/icons/icons.tsx +18 -0
- package/src/ui-components/icons/index.ts +1 -0
- package/src/ui-components/loader/loading-result.tsx +7 -1
- package/src/ui-components/screens/index.ts +3 -0
- package/src/ui-components/screens/nerd-mode-screen.tsx +49 -41
- package/src/ui-components/screens/trust-info-details-screen.tsx +472 -0
- package/src/utils/date.ts +7 -14
- package/src/utils/hooks/core/cache.ts +12 -4
- package/src/utils/hooks/core/core-config.ts +1 -6
- package/src/utils/hooks/core/core-context.tsx +0 -24
- package/src/utils/hooks/core/credentials.ts +43 -1
- package/src/utils/hooks/core/index.ts +0 -1
- package/src/utils/hooks/core/proofs.ts +14 -0
- package/src/utils/hooks/core/trust-list.ts +22 -11
- package/src/utils/hooks/core/verifier-instance.ts +23 -2
- package/src/utils/hooks/core/wallet-unit.ts +3 -3
- package/src/utils/parsers/credential-sharing-v2.tsx +29 -12
- package/src/utils/parsers/credential-sharing.tsx +33 -16
- package/src/utils/parsers/credential.ts +45 -14
- package/src/utils/parsers/query.ts +3 -0
- package/src/utils/translations.ts +10 -0
- package/lib/commonjs/components/entity/EntityButtons.js +0 -64
- package/lib/commonjs/components/entity/EntityButtons.js.map +0 -1
- package/lib/commonjs/components/entity/entity-attributes.js +0 -65
- package/lib/commonjs/components/entity/entity-attributes.js.map +0 -1
- package/lib/commonjs/components/entity/entity-details-with-buttons.js +0 -67
- package/lib/commonjs/components/entity/entity-details-with-buttons.js.map +0 -1
- package/lib/commonjs/components/entity/entity-details.js +0 -101
- package/lib/commonjs/components/entity/entity-details.js.map +0 -1
- package/lib/commonjs/components/entity/index.js +0 -14
- package/lib/commonjs/components/entity/index.js.map +0 -1
- package/lib/commonjs/utils/hooks/core/trust-entity.js +0 -147
- package/lib/commonjs/utils/hooks/core/trust-entity.js.map +0 -1
- package/lib/module/components/entity/EntityButtons.js +0 -56
- package/lib/module/components/entity/EntityButtons.js.map +0 -1
- package/lib/module/components/entity/entity-attributes.js +0 -57
- package/lib/module/components/entity/entity-attributes.js.map +0 -1
- package/lib/module/components/entity/entity-details-with-buttons.js +0 -58
- package/lib/module/components/entity/entity-details-with-buttons.js.map +0 -1
- package/lib/module/components/entity/entity-details.js +0 -92
- package/lib/module/components/entity/entity-details.js.map +0 -1
- package/lib/module/components/entity/index.js +0 -3
- package/lib/module/components/entity/index.js.map +0 -1
- package/lib/module/utils/hooks/core/trust-entity.js +0 -136
- package/lib/module/utils/hooks/core/trust-entity.js.map +0 -1
- package/lib/typescript/components/entity/EntityButtons.d.ts +0 -14
- package/lib/typescript/components/entity/entity-attributes.d.ts +0 -15
- package/lib/typescript/components/entity/entity-details-with-buttons.d.ts +0 -18
- package/lib/typescript/components/entity/entity-details.d.ts +0 -21
- package/lib/typescript/components/entity/index.d.ts +0 -3
- package/lib/typescript/utils/hooks/core/trust-entity.d.ts +0 -17
- package/src/components/entity/EntityButtons.tsx +0 -79
- package/src/components/entity/entity-attributes.tsx +0 -80
- package/src/components/entity/entity-details-with-buttons.tsx +0 -75
- package/src/components/entity/entity-details.tsx +0 -145
- package/src/components/entity/index.ts +0 -4
- package/src/utils/hooks/core/trust-entity.ts +0 -172
|
@@ -6,12 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.formatTimestamp = exports.formatTimeAgo = exports.formatTime = exports.formatMonth = exports.formatDateTimeLocalized = exports.formatDateTime = exports.formatDateOnlyFromUTCTimestamp = exports.formatDateLocalized = exports.formatDate = exports.convertDateToUTCTimestamp = exports.convertDateStrToLocalDate = void 0;
|
|
7
7
|
var _reactNative = require("react-native");
|
|
8
8
|
var _timeago = require("timeago.js");
|
|
9
|
-
var
|
|
9
|
+
var _ref; // Date & Time formatted as specified in SW-610
|
|
10
10
|
const MINUTE = 60 * 1000;
|
|
11
11
|
const DAY = 24 * 60 * MINUTE;
|
|
12
12
|
|
|
13
13
|
// OS locale
|
|
14
|
-
const systemLocale = (
|
|
14
|
+
const systemLocale = (_ref = _reactNative.Platform.OS === 'ios' ? _reactNative.Settings.get('AppleLocale') : _reactNative.I18nManager.getConstants().localeIdentifier) === null || _ref === void 0 || (_ref = _ref.match(/[a-zA-Z]+_[a-zA-Z]+/)[0]) === null || _ref === void 0 ? void 0 : _ref.replaceAll('_', '-');
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Date only format
|
|
@@ -142,13 +142,12 @@ const formatDateOnlyFromUTCTimestamp = utcTimestamp => {
|
|
|
142
142
|
return (_formatDate = formatDate(convertDateStrToLocalDate(`${utcDate.getUTCFullYear()}-${pad(utcDate.getUTCMonth() + 1)}-${pad(utcDate.getUTCDate())}`))) !== null && _formatDate !== void 0 ? _formatDate : '';
|
|
143
143
|
};
|
|
144
144
|
exports.formatDateOnlyFromUTCTimestamp = formatDateOnlyFromUTCTimestamp;
|
|
145
|
-
const locale = (_ref = _reactNative.Platform.OS === 'ios' ? _reactNative.Settings.get('AppleLocale') : _reactNative.I18nManager.getConstants().localeIdentifier) === null || _ref === void 0 ? void 0 : _ref.split('@')[0].replace('_', '-');
|
|
146
145
|
const formatDateTimeLocalized = date => {
|
|
147
|
-
return formatDateTime(date,
|
|
146
|
+
return formatDateTime(date, systemLocale);
|
|
148
147
|
};
|
|
149
148
|
exports.formatDateTimeLocalized = formatDateTimeLocalized;
|
|
150
149
|
const formatDateLocalized = date => {
|
|
151
|
-
return formatDate(date,
|
|
150
|
+
return formatDate(date, systemLocale);
|
|
152
151
|
};
|
|
153
152
|
exports.formatDateLocalized = formatDateLocalized;
|
|
154
153
|
//# sourceMappingURL=date.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_timeago","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_timeago","_ref","MINUTE","DAY","systemLocale","Platform","OS","Settings","get","I18nManager","getConstants","localeIdentifier","match","replaceAll","formatDate","date","locale","options","toLocaleDateString","undefined","exports","formatTime","toLocaleTimeString","hour","minute","formatDateTime","toLocaleString","year","month","day","hour12","formatMonth","getFullYear","formatTimeAgo","format","formatTimestamp","nowLabel","_formatDateTime2","now","Date","timestamp","getTime","_formatDateTime","pad","x","String","convertDateToUTCTimestamp","parse","getMonth","getDate","convertDateStrToLocalDate","select","android","timezoneOffset","getTimezoneOffset","default","formatDateOnlyFromUTCTimestamp","utcTimestamp","_formatDate","utcDate","getUTCFullYear","getUTCMonth","getUTCDate","formatDateTimeLocalized","formatDateLocalized"],"sources":["date.ts"],"sourcesContent":["// Date & Time formatted as specified in SW-610\n\nimport { I18nManager, Platform, Settings } from 'react-native';\nimport { format } from 'timeago.js';\n\nconst MINUTE = 60 * 1000;\nconst DAY = 24 * 60 * MINUTE;\n\n// OS locale\nconst systemLocale: string | undefined = (\n Platform.OS === 'ios' ? Settings.get('AppleLocale') : I18nManager.getConstants().localeIdentifier\n)\n ?.match(/[a-zA-Z]+_[a-zA-Z]+/)[0]\n ?.replaceAll('_', '-');\n\n/**\n * Date only format\n */\nexport const formatDate = (date: Date, locale?: string, options?: Intl.DateTimeFormatOptions) => {\n try {\n return date.toLocaleDateString(locale || systemLocale, options);\n } catch {\n return undefined;\n }\n};\n\n/**\n * Time only format\n */\nexport const formatTime = (date: Date, locale?: string) => {\n try {\n return date.toLocaleTimeString(locale || systemLocale, { hour: '2-digit', minute: '2-digit' });\n } catch {\n return undefined;\n }\n};\n\n/**\n * Date and time format\n */\nexport const formatDateTime = (date: Date, locale?: string) => {\n try {\n return date.toLocaleString(locale || systemLocale, {\n hour: '2-digit',\n minute: '2-digit',\n year: 'numeric',\n month: 'numeric',\n day: 'numeric',\n hour12: locale === 'en-US',\n });\n } catch {\n return undefined;\n }\n};\n\n/**\n * Month format\n */\nexport const formatMonth = (date: Date, locale: string): string => {\n return `${date.toLocaleString(locale, {\n month: 'long',\n })} ${date.getFullYear()}`;\n};\n\n/**\n * Time-ago format\n */\nexport const formatTimeAgo = (date: Date, locale: string): string => {\n return format(date, locale);\n};\n\n/**\n * Timestamp formatted for general use\n */\nexport const formatTimestamp = (date: Date, locale: string, nowLabel: string): string => {\n const now = Date.now();\n const timestamp = date.getTime();\n if (now < timestamp) {\n // in the future\n return formatDateTime(date, locale) ?? '';\n }\n\n // in the past\n if (now - timestamp < MINUTE) {\n // less than a minute ago\n return nowLabel;\n }\n\n // less than a day ago\n if (now - timestamp < DAY) {\n return formatTimeAgo(date, locale);\n }\n\n // longer ago\n return formatDateTime(date, locale) ?? '';\n};\n\nconst pad = (x: number) => (x >= 0 && x < 10 ? `0${x}` : String(x));\n\n/**\n * Utility function to deal with `date`-type attributes\n * @param {Date} date local timezone representation\n * @returns {number} the same day, but UTC timezone with midnight time\n */\nexport const convertDateToUTCTimestamp = (date: Date): number =>\n Date.parse(`${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`);\n\n/**\n * Utility function to deal with `date`-type attributes\n * @param {string} date in YYYY-MM-DD representation\n * @returns {Date} the same day, but local timezone with midnight time\n */\nexport const convertDateStrToLocalDate = (date: string): Date =>\n Platform.select({\n // android conversion using the standard date parsing doesn't work, computing the timestamp manually\n android: (() => {\n const timestamp = Date.parse(date);\n const timezoneOffset = new Date(date).getTimezoneOffset();\n return new Date(timestamp + timezoneOffset * MINUTE);\n })(),\n default: new Date(`${date}T00:00:00`),\n });\n\n/**\n * Inverted function to {@link convertDateToUTCTimestamp}\n * @param {number} utcTimestamp date timestamp represented as midnight UTC time\n * @returns {string} formatted date (based on locale settings, e.g. `21/02/2021`)\n */\nexport const formatDateOnlyFromUTCTimestamp = (utcTimestamp: number): string => {\n const utcDate = new Date(utcTimestamp);\n return (\n formatDate(\n convertDateStrToLocalDate(\n `${utcDate.getUTCFullYear()}-${pad(utcDate.getUTCMonth() + 1)}-${pad(utcDate.getUTCDate())}`,\n ),\n ) ?? ''\n );\n};\n\nexport const formatDateTimeLocalized = (date: Date) => {\n return formatDateTime(date, systemLocale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ACJqD,OAAO,EAAE,IAAIhB,IAAI,CAAC,GAAGxB,IAAI,WAAW;AACtC,CAAC,CAAC;;AAEJ;AACA;AACA;AACA;AACA;AAJAK,OAAA,CAAA8B,yBAAA,GAAAA,yBAAA;AAKO,MAAMM,8BAA8B,GAAIC,YAAoB,IAAa;EAAA,IAAAC,WAAA;EAC9E,MAAMC,OAAO,GAAG,IAAIpB,IAAI,CAACkB,YAAY,CAAC;EACtC,QAAAC,WAAA,GACE5C,UAAU,CACRoC,yBAAyB,CACvB,GAAGS,OAAO,CAACC,cAAc,CAAC,CAAC,IAAIjB,GAAG,CAACgB,OAAO,CAACE,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,IAAIlB,GAAG,CAACgB,OAAO,CAACG,UAAU,CAAC,CAAC,CAAC,EAC5F,CACF,CAAC,cAAAJ,WAAA,cAAAA,WAAA,GAAI,EAAE;AAEX,CAAC;AAACtC,OAAA,CAAAoC,8BAAA,GAAAA,8BAAA;AAEK,MAAMO,uBAAuB,GAAIhD,IAAU,IAAK;EACrD,OAAOU,cAAc,CAACV,IAAI,EAAEX,YAAY,CAAC;AAC3C,CAAC;AAACgB,OAAA,CAAA2C,uBAAA,GAAAA,uBAAA;AAEK,MAAMC,mBAAmB,GAAIjD,IAAU,IAAK;EACjD,OAAOD,UAAU,CAACC,IAAI,EAAEX,YAAY,CAAC;AACvC,CAAC;AAACgB,OAAA,CAAA4C,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|
|
@@ -8,9 +8,10 @@ var _reactNativeOneCore = require("@procivis/react-native-one-core");
|
|
|
8
8
|
var _reactQuery = require("react-query");
|
|
9
9
|
var _coreContext = require("./core-context");
|
|
10
10
|
var _credentials = require("./credentials");
|
|
11
|
-
var
|
|
11
|
+
var _verifierInstance = require("./verifier-instance");
|
|
12
|
+
var _walletUnit = require("./wallet-unit");
|
|
12
13
|
const CREDENTIAL_QUERY_KEYS = [_credentials.CREDENTIAL_LIST_QUERY_KEY, _credentials.CREDENTIAL_LIST_PAGED_QUERY_KEY, _credentials.CREDENTIAL_DETAIL_QUERY_KEY];
|
|
13
|
-
const
|
|
14
|
+
const WALLET_VERIFIER_INSTANCE_QUERY_KEYS = [_walletUnit.WALLET_UNIT_TRUST_COLLECTIONS_QUERY_KEY, _walletUnit.WALLET_UNIT_QUERY_KEY, _verifierInstance.VERIFIER_INSTANCE_TRUST_COLLECTIONS_QUERY_KEY];
|
|
14
15
|
|
|
15
16
|
// Map each CacheType to the query keys that should be invalidated when that cache is cleared.
|
|
16
17
|
const cacheTypeToQueryKeys = {
|
|
@@ -19,10 +20,13 @@ const cacheTypeToQueryKeys = {
|
|
|
19
20
|
[_reactNativeOneCore.CacheType.STATUS_LIST_CREDENTIAL]: CREDENTIAL_QUERY_KEYS,
|
|
20
21
|
[_reactNativeOneCore.CacheType.VCT_METADATA]: CREDENTIAL_QUERY_KEYS,
|
|
21
22
|
[_reactNativeOneCore.CacheType.JSON_SCHEMA]: CREDENTIAL_QUERY_KEYS,
|
|
22
|
-
[_reactNativeOneCore.CacheType.TRUST_LIST]:
|
|
23
|
+
[_reactNativeOneCore.CacheType.TRUST_LIST]: CREDENTIAL_QUERY_KEYS,
|
|
23
24
|
[_reactNativeOneCore.CacheType.X509_CRL]: CREDENTIAL_QUERY_KEYS,
|
|
24
25
|
[_reactNativeOneCore.CacheType.ANDROID_ATTESTATION_CRL]: CREDENTIAL_QUERY_KEYS,
|
|
25
|
-
[_reactNativeOneCore.CacheType.
|
|
26
|
+
[_reactNativeOneCore.CacheType.OPEN_ID_METADATA_HOLDER]: CREDENTIAL_QUERY_KEYS,
|
|
27
|
+
[_reactNativeOneCore.CacheType.OPEN_ID_METADATA_ISSUER]: CREDENTIAL_QUERY_KEYS,
|
|
28
|
+
[_reactNativeOneCore.CacheType.WALLET_PROVIDER_METADATA]: WALLET_VERIFIER_INSTANCE_QUERY_KEYS,
|
|
29
|
+
[_reactNativeOneCore.CacheType.REMOTE_TRUST_COLLECTION]: WALLET_VERIFIER_INSTANCE_QUERY_KEYS
|
|
26
30
|
};
|
|
27
31
|
const useCacheClear = () => {
|
|
28
32
|
const queryClient = (0, _reactQuery.useQueryClient)();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNativeOneCore","require","_reactQuery","_coreContext","_credentials","
|
|
1
|
+
{"version":3,"names":["_reactNativeOneCore","require","_reactQuery","_coreContext","_credentials","_verifierInstance","_walletUnit","CREDENTIAL_QUERY_KEYS","CREDENTIAL_LIST_QUERY_KEY","CREDENTIAL_LIST_PAGED_QUERY_KEY","CREDENTIAL_DETAIL_QUERY_KEY","WALLET_VERIFIER_INSTANCE_QUERY_KEYS","WALLET_UNIT_TRUST_COLLECTIONS_QUERY_KEY","WALLET_UNIT_QUERY_KEY","VERIFIER_INSTANCE_TRUST_COLLECTIONS_QUERY_KEY","cacheTypeToQueryKeys","CacheType","DID_DOCUMENT","JSON_LD_CONTEXT","STATUS_LIST_CREDENTIAL","VCT_METADATA","JSON_SCHEMA","TRUST_LIST","X509_CRL","ANDROID_ATTESTATION_CRL","OPEN_ID_METADATA_HOLDER","OPEN_ID_METADATA_ISSUER","WALLET_PROVIDER_METADATA","REMOTE_TRUST_COLLECTION","useCacheClear","queryClient","useQueryClient","core","useONECore","useMutation","cacheTypes","deleteCache","onSuccess","_","queryKeysToInvalidate","Set","forEach","cacheType","keys","key","add","Promise","all","map","queryKey","invalidateQueries","exports"],"sources":["cache.ts"],"sourcesContent":["import { CacheType } from '@procivis/react-native-one-core';\nimport { useMutation, useQueryClient } from 'react-query';\n\nimport { useONECore } from './core-context';\nimport { CREDENTIAL_DETAIL_QUERY_KEY, CREDENTIAL_LIST_PAGED_QUERY_KEY, CREDENTIAL_LIST_QUERY_KEY } from './credentials';\nimport { VERIFIER_INSTANCE_TRUST_COLLECTIONS_QUERY_KEY } from './verifier-instance';\nimport { WALLET_UNIT_QUERY_KEY, WALLET_UNIT_TRUST_COLLECTIONS_QUERY_KEY } from './wallet-unit';\n\nconst CREDENTIAL_QUERY_KEYS = [CREDENTIAL_LIST_QUERY_KEY, CREDENTIAL_LIST_PAGED_QUERY_KEY, CREDENTIAL_DETAIL_QUERY_KEY];\nconst WALLET_VERIFIER_INSTANCE_QUERY_KEYS = [\n WALLET_UNIT_TRUST_COLLECTIONS_QUERY_KEY,\n WALLET_UNIT_QUERY_KEY,\n VERIFIER_INSTANCE_TRUST_COLLECTIONS_QUERY_KEY,\n];\n\n// Map each CacheType to the query keys that should be invalidated when that cache is cleared.\nconst cacheTypeToQueryKeys: Record<CacheType, string[]> = {\n [CacheType.DID_DOCUMENT]: CREDENTIAL_QUERY_KEYS,\n [CacheType.JSON_LD_CONTEXT]: CREDENTIAL_QUERY_KEYS,\n [CacheType.STATUS_LIST_CREDENTIAL]: CREDENTIAL_QUERY_KEYS,\n [CacheType.VCT_METADATA]: CREDENTIAL_QUERY_KEYS,\n [CacheType.JSON_SCHEMA]: CREDENTIAL_QUERY_KEYS,\n [CacheType.TRUST_LIST]: CREDENTIAL_QUERY_KEYS,\n [CacheType.X509_CRL]: CREDENTIAL_QUERY_KEYS,\n [CacheType.ANDROID_ATTESTATION_CRL]: CREDENTIAL_QUERY_KEYS,\n [CacheType.OPEN_ID_METADATA_HOLDER]: CREDENTIAL_QUERY_KEYS,\n [CacheType.OPEN_ID_METADATA_ISSUER]: CREDENTIAL_QUERY_KEYS,\n [CacheType.WALLET_PROVIDER_METADATA]: WALLET_VERIFIER_INSTANCE_QUERY_KEYS,\n [CacheType.REMOTE_TRUST_COLLECTION]: WALLET_VERIFIER_INSTANCE_QUERY_KEYS,\n};\n\nexport const useCacheClear = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(\n async (cacheTypes: CacheType[]) => {\n await core.deleteCache(cacheTypes);\n return cacheTypes;\n },\n {\n onSuccess: async (_, cacheTypes) => {\n const queryKeysToInvalidate = new Set<string>();\n\n cacheTypes.forEach((cacheType) => {\n const keys = cacheTypeToQueryKeys[cacheType] || [];\n keys.forEach((key) => queryKeysToInvalidate.add(key));\n });\n\n await Promise.all([...queryKeysToInvalidate].map((queryKey) => queryClient.invalidateQueries(queryKey)));\n },\n },\n );\n};\n"],"mappings":";;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAEA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAEA,MAAMM,qBAAqB,GAAG,CAACC,sCAAyB,EAAEC,4CAA+B,EAAEC,wCAA2B,CAAC;AACvH,MAAMC,mCAAmC,GAAG,CAC1CC,mDAAuC,EACvCC,iCAAqB,EACrBC,+DAA6C,CAC9C;;AAED;AACA,MAAMC,oBAAiD,GAAG;EACxD,CAACC,6BAAS,CAACC,YAAY,GAAGV,qBAAqB;EAC/C,CAACS,6BAAS,CAACE,eAAe,GAAGX,qBAAqB;EAClD,CAACS,6BAAS,CAACG,sBAAsB,GAAGZ,qBAAqB;EACzD,CAACS,6BAAS,CAACI,YAAY,GAAGb,qBAAqB;EAC/C,CAACS,6BAAS,CAACK,WAAW,GAAGd,qBAAqB;EAC9C,CAACS,6BAAS,CAACM,UAAU,GAAGf,qBAAqB;EAC7C,CAACS,6BAAS,CAACO,QAAQ,GAAGhB,qBAAqB;EAC3C,CAACS,6BAAS,CAACQ,uBAAuB,GAAGjB,qBAAqB;EAC1D,CAACS,6BAAS,CAACS,uBAAuB,GAAGlB,qBAAqB;EAC1D,CAACS,6BAAS,CAACU,uBAAuB,GAAGnB,qBAAqB;EAC1D,CAACS,6BAAS,CAACW,wBAAwB,GAAGhB,mCAAmC;EACzE,CAACK,6BAAS,CAACY,uBAAuB,GAAGjB;AACvC,CAAC;AAEM,MAAMkB,aAAa,GAAGA,CAAA,KAAM;EACjC,MAAMC,WAAW,GAAG,IAAAC,0BAAc,EAAC,CAAC;EACpC,MAAM;IAAEC;EAAK,CAAC,GAAG,IAAAC,uBAAU,EAAC,CAAC;EAE7B,OAAO,IAAAC,uBAAW,EAChB,MAAOC,UAAuB,IAAK;IACjC,MAAMH,IAAI,CAACI,WAAW,CAACD,UAAU,CAAC;IAClC,OAAOA,UAAU;EACnB,CAAC,EACD;IACEE,SAAS,EAAE,MAAAA,CAAOC,CAAC,EAAEH,UAAU,KAAK;MAClC,MAAMI,qBAAqB,GAAG,IAAIC,GAAG,CAAS,CAAC;MAE/CL,UAAU,CAACM,OAAO,CAAEC,SAAS,IAAK;QAChC,MAAMC,IAAI,GAAG5B,oBAAoB,CAAC2B,SAAS,CAAC,IAAI,EAAE;QAClDC,IAAI,CAACF,OAAO,CAAEG,GAAG,IAAKL,qBAAqB,CAACM,GAAG,CAACD,GAAG,CAAC,CAAC;MACvD,CAAC,CAAC;MAEF,MAAME,OAAO,CAACC,GAAG,CAAC,CAAC,GAAGR,qBAAqB,CAAC,CAACS,GAAG,CAAEC,QAAQ,IAAKnB,WAAW,CAACoB,iBAAiB,CAACD,QAAQ,CAAC,CAAC,CAAC;IAC1G;EACF,CACF,CAAC;AACH,CAAC;AAACE,OAAA,CAAAtB,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.useCoreConfig = exports.
|
|
6
|
+
exports.useCoreConfig = exports.getEnabledTransports = exports.getEnabledExchangeProtocols = void 0;
|
|
7
7
|
var _reactQuery = require("react-query");
|
|
8
8
|
var _coreContext = require("./core-context");
|
|
9
9
|
const CONFIG_QUERY_KEY = 'config';
|
|
@@ -25,9 +25,4 @@ const getEnabledExchangeProtocols = exchangeProtocol => {
|
|
|
25
25
|
return Object.values(exchangeProtocol !== null && exchangeProtocol !== void 0 ? exchangeProtocol : {}).filter(t => t.enabled !== false).map(exchange => exchange.type);
|
|
26
26
|
};
|
|
27
27
|
exports.getEnabledExchangeProtocols = getEnabledExchangeProtocols;
|
|
28
|
-
const getEnabledTrustManagement = config => {
|
|
29
|
-
var _config$trustManageme;
|
|
30
|
-
return Object.values((_config$trustManageme = config === null || config === void 0 ? void 0 : config.trustManagement) !== null && _config$trustManageme !== void 0 ? _config$trustManageme : {}).filter(t => t.enabled !== false).map(trustManagement => trustManagement.type);
|
|
31
|
-
};
|
|
32
|
-
exports.getEnabledTrustManagement = getEnabledTrustManagement;
|
|
33
28
|
//# sourceMappingURL=core-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactQuery","require","_coreContext","CONFIG_QUERY_KEY","useCoreConfig","core","useONECore","useQuery","getConfig","keepPreviousData","exports","getEnabledTransports","config","_config$transport","Object","values","transport","filter","t","enabled","map","type","getEnabledExchangeProtocols","exchangeProtocol","exchange"
|
|
1
|
+
{"version":3,"names":["_reactQuery","require","_coreContext","CONFIG_QUERY_KEY","useCoreConfig","core","useONECore","useQuery","getConfig","keepPreviousData","exports","getEnabledTransports","config","_config$transport","Object","values","transport","filter","t","enabled","map","type","getEnabledExchangeProtocols","exchangeProtocol","exchange"],"sources":["core-config.ts"],"sourcesContent":["import { ConfigEntities, CoreConfig } from '@procivis/react-native-one-core';\nimport { useQuery } from 'react-query';\n\nimport { useONECore } from './core-context';\n\nconst CONFIG_QUERY_KEY = 'config';\n\nexport const useCoreConfig = () => {\n const { core } = useONECore();\n\n return useQuery([CONFIG_QUERY_KEY], () => core?.getConfig(), {\n keepPreviousData: true,\n });\n};\n\nexport const getEnabledTransports = (config: CoreConfig): string[] => {\n return Object.values(config?.transport ?? {})\n .filter((t) => t.enabled !== false)\n .map((transport) => transport.type);\n};\n\nexport const getEnabledExchangeProtocols = (exchangeProtocol: ConfigEntities<any>): string[] => {\n return Object.values(exchangeProtocol ?? {})\n .filter((t) => t.enabled !== false)\n .map((exchange) => exchange.type);\n};\n\n"],"mappings":";;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AAEA,IAAAC,YA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|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _reporting = require("../../reporting");
|
|
10
|
-
var _coreConfig = require("./core-config");
|
|
11
|
-
var _trustEntity = require("./trust-entity");
|
|
12
10
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
13
11
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
12
|
const defaultContextValue = {
|
|
@@ -20,11 +18,9 @@ const ONECoreContext = /*#__PURE__*/(0, _react.createContext)(defaultContextValu
|
|
|
20
18
|
const ONECoreContextProvider = ({
|
|
21
19
|
children,
|
|
22
20
|
organisationId = defaultContextValue.organisationId,
|
|
23
|
-
publisherReference,
|
|
24
21
|
config
|
|
25
22
|
}) => {
|
|
26
23
|
const [core, setCore] = (0, _react.useState)();
|
|
27
|
-
const createTrustAnchor = (0, _trustEntity.useCreateTrustAnchor)();
|
|
28
24
|
const initialize = (0, _react.useCallback)(async force => {
|
|
29
25
|
if (core && !force) {
|
|
30
26
|
return core;
|
|
@@ -48,17 +44,6 @@ const ONECoreContextProvider = ({
|
|
|
48
44
|
},
|
|
49
45
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
50
46
|
[]);
|
|
51
|
-
(0, _react.useEffect)(() => {
|
|
52
|
-
if (!core || !publisherReference) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
core.getConfig().then(coreConfig => {
|
|
56
|
-
const trustManagementEnabled = (0, _coreConfig.getEnabledTrustManagement)(coreConfig).includes(_trustEntity.TrustManagementEnum.SimpleTrustList);
|
|
57
|
-
if (trustManagementEnabled) {
|
|
58
|
-
createTrustAnchor(core, publisherReference).catch(() => {});
|
|
59
|
-
}
|
|
60
|
-
}).catch(() => {});
|
|
61
|
-
}, [core, createTrustAnchor, publisherReference]);
|
|
62
47
|
const contextValue = (0, _react.useMemo)(() => ({
|
|
63
48
|
core: core !== null && core !== void 0 ? core : defaultContextValue.core,
|
|
64
49
|
organisationId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNativeOneCore","require","_react","_interopRequireWildcard","_reporting","
|
|
1
|
+
{"version":3,"names":["_reactNativeOneCore","require","_react","_interopRequireWildcard","_reporting","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","defaultContextValue","core","organisationId","initialize","Promise","reject","ONECoreContext","createContext","ONECoreContextProvider","children","config","setCore","useState","useCallback","force","coreInstance","initializeCore","reportException","useEffect","corePromise","then","c","uninitialize","catch","contextValue","useMemo","createElement","Provider","value","exports","useONECore","useContext"],"sources":["core-context.tsx"],"sourcesContent":["import { initializeCore, ONECore } from '@procivis/react-native-one-core';\nimport React, {\n createContext,\n FC,\n PropsWithChildren,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from 'react';\n\nimport { reportException } from '../../reporting';\n\ninterface ContextValue {\n core: ONECore;\n organisationId: string;\n initialize: (force?: boolean) => Promise<ONECore>;\n}\n\nconst defaultContextValue: ContextValue = {\n core: {} as ONECore,\n organisationId: '11111111-2222-3333-a444-ffffffffffff',\n initialize: () => Promise.reject(),\n};\n\nexport type ONECoreContextProviderProps = {\n config?: Record<string, unknown>;\n organisationId?: string;\n};\n\nconst ONECoreContext = createContext<ContextValue>(defaultContextValue);\n\nexport const ONECoreContextProvider: FC<PropsWithChildren<ONECoreContextProviderProps>> = ({\n children,\n organisationId = defaultContextValue.organisationId,\n config,\n}) => {\n const [core, setCore] = useState<ONECore>();\n\n const initialize = useCallback(\n async (force?: boolean) => {\n if (core && !force) {\n return core;\n }\n\n try {\n const coreInstance = await initializeCore(config);\n setCore(coreInstance);\n return coreInstance;\n } catch (e) {\n reportException(e, 'Failed to initialize core');\n throw e;\n }\n },\n [core, config],\n );\n\n useEffect(\n () => {\n const corePromise = initialize();\n return () => {\n corePromise\n .then((c) => c?.uninitialize(false))\n .catch((e) => {\n reportException(e, 'Core uninitialization error');\n });\n };\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [],\n );\n\n const contextValue = useMemo(\n () => ({\n core: core ?? defaultContextValue.core,\n organisationId,\n initialize,\n }),\n [core, initialize, organisationId],\n );\n\n if (!core) {\n return null;\n }\n\n return <ONECoreContext.Provider value={contextValue}>{children}</ONECoreContext.Provider>;\n};\n\nexport const useONECore = () => useContext(ONECoreContext);\n"],"mappings":";;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AAWA,IAAAG,UAAA,GAAAH,OAAA;AAAkD,SAAAI,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,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AAY;IACrB,CAAC,CAAC,OAAOlC,CAAC,EAAE;MACV,IAAAoC,0BAAe,EAACpC,CAAC,EAAE,2BAA2B,CAAC;MAC/C,MAAMA,CAAC;IACT;EACF,CAAC,EACD,CAACoB,IAAI,EAAES,MAAM,CACf,CAAC;EAED,IAAAQ,gBAAS,EACP,MAAM;IACJ,MAAMC,WAAW,GAAGhB,UAAU,CAAC,CAAC;IAChC,OAAO,MAAM;MACXgB,WAAW,CACRC,IAAI,CAAEC,CAAC,IAAKA,CAAC,aAADA,CAAC,uBAADA,CAAC,CAAEC,YAAY,CAAC,KAAK,CAAC,CAAC,CACnCC,KAAK,CAAE1C,CAAC,IAAK;QACZ,IAAAoC,0BAAe,EAACpC,CAAC,EAAE,6BAA6B,CAAC;MACnD,CAAC,CAAC;IACN,CAAC;EACH,CAAC;EACD;EACA,EACF,CAAC;EAED,MAAM2C,YAAY,GAAG,IAAAC,cAAO,EAC1B,OAAO;IACLxB,IAAI,EAAEA,IAAI,aAAJA,IAAI,cAAJA,IAAI,GAAID,mBAAmB,CAACC,IAAI;IACtCC,cAAc;IACdC;EACF,CAAC,CAAC,EACF,CAACF,IAAI,EAAEE,UAAU,EAAED,cAAc,CACnC,CAAC;EAED,IAAI,CAACD,IAAI,EAAE;IACT,OAAO,IAAI;EACb;EAEA,oBAAOxB,MAAA,CAAAS,OAAA,CAAAwC,aAAA,CAACpB,cAAc,CAACqB,QAAQ;IAACC,KAAK,EAAEJ;EAAa,GAAEf,QAAkC,CAAC;AAC3F,CAAC;AAACoB,OAAA,CAAArB,sBAAA,GAAAA,sBAAA;AAEK,MAAMsB,UAAU,GAAGA,CAAA,KAAM,IAAAC,iBAAU,EAACzB,cAAc,CAAC;AAACuB,OAAA,CAAAC,UAAA,GAAAA,UAAA","ignoreList":[]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.usePagedCredentials = exports.useInvitationHandler = exports.useInvalidateCredentialDetails = exports.useInitiateIssuance = exports.useCredentials = exports.useCredentialRevocationCheck = exports.useCredentialReject = exports.useCredentialDetail = exports.useCredentialDelete = exports.useCredentialAccept = exports.useContinueIssuance = exports.CREDENTIAL_LIST_QUERY_KEY = exports.CREDENTIAL_LIST_PAGED_QUERY_KEY = exports.CREDENTIAL_DETAIL_QUERY_KEY = void 0;
|
|
6
|
+
exports.usePagedCredentials = exports.useInvitationHandler = exports.useInvalidateCredentialDetails = exports.useInitiateIssuance = exports.useCredentialsTrustInformation = exports.useCredentials = exports.useCredentialTrustInformation = exports.useCredentialRevocationCheck = exports.useCredentialReject = exports.useCredentialRefresh = exports.useCredentialDetail = exports.useCredentialDelete = exports.useCredentialAccept = exports.useContinueIssuance = exports.CREDENTIAL_TRUST_INFORMATION_QUERY_KEY = exports.CREDENTIAL_LIST_QUERY_KEY = exports.CREDENTIAL_LIST_PAGED_QUERY_KEY = exports.CREDENTIAL_DETAIL_QUERY_KEY = void 0;
|
|
7
7
|
var _reactNativeOneCore = require("@procivis/react-native-one-core");
|
|
8
8
|
var _reactQuery = require("react-query");
|
|
9
9
|
var _query = require("../../parsers/query");
|
|
@@ -16,6 +16,7 @@ const PAGE_SIZE = 20;
|
|
|
16
16
|
const CREDENTIAL_LIST_QUERY_KEY = exports.CREDENTIAL_LIST_QUERY_KEY = 'credential-list';
|
|
17
17
|
const CREDENTIAL_LIST_PAGED_QUERY_KEY = exports.CREDENTIAL_LIST_PAGED_QUERY_KEY = 'credential-list-paged';
|
|
18
18
|
const CREDENTIAL_DETAIL_QUERY_KEY = exports.CREDENTIAL_DETAIL_QUERY_KEY = 'credential-detail';
|
|
19
|
+
const CREDENTIAL_TRUST_INFORMATION_QUERY_KEY = exports.CREDENTIAL_TRUST_INFORMATION_QUERY_KEY = 'credential-trust-information';
|
|
19
20
|
const useCredentials = queryParams => {
|
|
20
21
|
const {
|
|
21
22
|
core,
|
|
@@ -153,6 +154,20 @@ const useCredentialDelete = () => {
|
|
|
153
154
|
});
|
|
154
155
|
};
|
|
155
156
|
exports.useCredentialDelete = useCredentialDelete;
|
|
157
|
+
const useCredentialRefresh = () => {
|
|
158
|
+
const queryClient = (0, _reactQuery.useQueryClient)();
|
|
159
|
+
const {
|
|
160
|
+
core
|
|
161
|
+
} = (0, _coreContext.useONECore)();
|
|
162
|
+
return (0, _reactQuery.useMutation)(async interactionId => core.holderRefreshCredential(interactionId), {
|
|
163
|
+
onSuccess: async () => {
|
|
164
|
+
await queryClient.invalidateQueries(CREDENTIAL_LIST_QUERY_KEY);
|
|
165
|
+
await queryClient.invalidateQueries(CREDENTIAL_DETAIL_QUERY_KEY);
|
|
166
|
+
await queryClient.invalidateQueries(_history.HISTORY_LIST_QUERY_KEY);
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
exports.useCredentialRefresh = useCredentialRefresh;
|
|
156
171
|
const useInvalidateCredentialDetails = () => {
|
|
157
172
|
const queryClient = (0, _reactQuery.useQueryClient)();
|
|
158
173
|
return credentialId => queryClient.invalidateQueries([CREDENTIAL_DETAIL_QUERY_KEY, credentialId]);
|
|
@@ -189,4 +204,28 @@ const useContinueIssuance = () => {
|
|
|
189
204
|
});
|
|
190
205
|
};
|
|
191
206
|
exports.useContinueIssuance = useContinueIssuance;
|
|
207
|
+
const useCredentialTrustInformation = credentialId => {
|
|
208
|
+
const {
|
|
209
|
+
core
|
|
210
|
+
} = (0, _coreContext.useONECore)();
|
|
211
|
+
return (0, _reactQuery.useQuery)([CREDENTIAL_TRUST_INFORMATION_QUERY_KEY, credentialId], () => credentialId ? core.getCredentialTrustInformation(credentialId) : undefined, {
|
|
212
|
+
enabled: Boolean(credentialId),
|
|
213
|
+
keepPreviousData: true
|
|
214
|
+
});
|
|
215
|
+
};
|
|
216
|
+
exports.useCredentialTrustInformation = useCredentialTrustInformation;
|
|
217
|
+
const useCredentialsTrustInformation = credentialIds => {
|
|
218
|
+
const {
|
|
219
|
+
core
|
|
220
|
+
} = (0, _coreContext.useONECore)();
|
|
221
|
+
return (0, _reactQuery.useQueries)(credentialIds.map(id => ({
|
|
222
|
+
keepPreviousData: true,
|
|
223
|
+
meta: {
|
|
224
|
+
id
|
|
225
|
+
},
|
|
226
|
+
queryFn: () => core.getCredentialTrustInformation(id),
|
|
227
|
+
queryKey: [CREDENTIAL_TRUST_INFORMATION_QUERY_KEY, id]
|
|
228
|
+
})));
|
|
229
|
+
};
|
|
230
|
+
exports.useCredentialsTrustInformation = useCredentialsTrustInformation;
|
|
192
231
|
//# sourceMappingURL=credentials.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNativeOneCore","require","_reactQuery","_query","_coreContext","_credentialSchemas","_errorCode","_history","_proofs","PAGE_SIZE","CREDENTIAL_LIST_QUERY_KEY","exports","CREDENTIAL_LIST_PAGED_QUERY_KEY","CREDENTIAL_DETAIL_QUERY_KEY","useCredentials","queryParams","core","organisationId","useONECore","useQuery","getQueryKeyFromCredentialListQueryParams","values","listCredentials","page","pageSize","states","CredentialState","ACCEPTED","SUSPENDED","REVOKED","keepPreviousData","usePagedCredentials","useInfiniteQuery","pageParam","getNextPageParam","lastPage","allPages","length","totalPages","undefined","useCredentialDetail","credentialId","active","getCredential","enabled","Boolean","useInvitationHandler","queryClient","useQueryClient","useMutation","request","handleInvitation","onSuccess","result","type_","invalidateQueries","PROOF_LIST_QUERY_KEY","CREDENTIAL_SCHEMA_LIST_QUERY_KEY","CREDENTIAL_SCHEMA_DETAIL_QUERY_KEY","HISTORY_LIST_QUERY_KEY","useCredentialAccept","credentialAcceptHookParams","holderAcceptCredential","useCredentialReject","interactionId","holderRejectCredential","catch","e","OneError","code","OneErrorCode","OperationNotSupported","useCredentialRevocationCheck","forceRefresh","credentialIds","checkRevocation","useCredentialDelete","deleteCredential","_","removeQueries","useInvalidateCredentialDetails","useInitiateIssuance","initiateIssuance","useContinueIssuance","url","continueIssuance"],"sources":["credentials.ts"],"sourcesContent":["import {\n CredentialListQuery,\n CredentialState,\n HandleInvitationRequest,\n HandleInvitationResponse,\n HolderAcceptCredentialRequest,\n InitiateIssuanceRequest,\n OneError,\n} from '@procivis/react-native-one-core';\nimport { useInfiniteQuery, useMutation, useQuery, useQueryClient } from 'react-query';\n\nimport { getQueryKeyFromCredentialListQueryParams } from '../../parsers/query';\nimport { useONECore } from './core-context';\nimport { CREDENTIAL_SCHEMA_DETAIL_QUERY_KEY, CREDENTIAL_SCHEMA_LIST_QUERY_KEY } from './credential-schemas';\nimport { OneErrorCode } from './error-code';\nimport { HISTORY_LIST_QUERY_KEY } from './history';\nimport { PROOF_LIST_QUERY_KEY } from './proofs';\n\nconst PAGE_SIZE = 20;\nexport const CREDENTIAL_LIST_QUERY_KEY = 'credential-list';\nexport const CREDENTIAL_LIST_PAGED_QUERY_KEY = 'credential-list-paged';\nexport const CREDENTIAL_DETAIL_QUERY_KEY = 'credential-detail';\n\nexport const useCredentials = (queryParams?: Partial<CredentialListQuery>) => {\n const { core, organisationId } = useONECore();\n\n return useQuery(\n [CREDENTIAL_LIST_QUERY_KEY, ...getQueryKeyFromCredentialListQueryParams(queryParams)],\n async () => {\n const { values } = await core.listCredentials({\n organisationId,\n page: 0,\n // TODO: workaround pagination for now, until it's supported by UI\n pageSize: 10000,\n states: [CredentialState.ACCEPTED, CredentialState.SUSPENDED, CredentialState.REVOKED],\n ...queryParams,\n });\n return values;\n },\n {\n keepPreviousData: true,\n },\n );\n};\n\nexport const usePagedCredentials = (queryParams?: Partial<CredentialListQuery>) => {\n const { core, organisationId } = useONECore();\n\n return useInfiniteQuery(\n [\n CREDENTIAL_LIST_QUERY_KEY,\n CREDENTIAL_LIST_PAGED_QUERY_KEY,\n ...getQueryKeyFromCredentialListQueryParams(queryParams),\n ],\n ({ pageParam = 0 }) =>\n core.listCredentials({\n organisationId,\n page: pageParam,\n pageSize: PAGE_SIZE,\n states: [CredentialState.ACCEPTED, CredentialState.SUSPENDED, CredentialState.REVOKED],\n ...queryParams,\n }),\n {\n getNextPageParam: (lastPage, allPages) => (allPages.length < lastPage.totalPages ? allPages.length : undefined),\n keepPreviousData: true,\n },\n );\n};\n\nexport const useCredentialDetail = (credentialId: string | undefined, active = true) => {\n const { core } = useONECore();\n\n return useQuery(\n [CREDENTIAL_DETAIL_QUERY_KEY, credentialId],\n () => (credentialId ? core.getCredential(credentialId) : undefined),\n {\n enabled: active && Boolean(credentialId),\n keepPreviousData: true,\n },\n );\n};\n\nexport const useInvitationHandler = () => {\n const queryClient = useQueryClient();\n const { core, organisationId } = useONECore();\n\n return useMutation(\n async (request: Omit<HandleInvitationRequest, 'organisationId'>) =>\n core.handleInvitation({ organisationId, ...request }),\n {\n onSuccess: async (result: HandleInvitationResponse) => {\n if (result.type_ === 'PROOF_REQUEST') {\n await queryClient.invalidateQueries(PROOF_LIST_QUERY_KEY);\n } else {\n await queryClient.invalidateQueries(CREDENTIAL_LIST_QUERY_KEY);\n await queryClient.invalidateQueries(CREDENTIAL_SCHEMA_LIST_QUERY_KEY);\n await queryClient.invalidateQueries(CREDENTIAL_SCHEMA_DETAIL_QUERY_KEY);\n }\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n },\n );\n};\n\nexport const useCredentialAccept = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(\n async (credentialAcceptHookParams: HolderAcceptCredentialRequest) =>\n core.holderAcceptCredential(credentialAcceptHookParams),\n {\n onSuccess: async () => {\n await queryClient.invalidateQueries(CREDENTIAL_LIST_QUERY_KEY);\n await queryClient.invalidateQueries(CREDENTIAL_SCHEMA_LIST_QUERY_KEY);\n await queryClient.invalidateQueries(CREDENTIAL_SCHEMA_DETAIL_QUERY_KEY);\n await queryClient.invalidateQueries(CREDENTIAL_DETAIL_QUERY_KEY);\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n },\n );\n};\n\nexport const useCredentialReject = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(\n async (interactionId: string) =>\n core.holderRejectCredential(interactionId).catch((e) => {\n if (e instanceof OneError && e.code === OneErrorCode.OperationNotSupported) {\n return;\n }\n throw e;\n }),\n {\n onSuccess: async () => {\n await queryClient.invalidateQueries(CREDENTIAL_LIST_QUERY_KEY);\n await queryClient.invalidateQueries(CREDENTIAL_DETAIL_QUERY_KEY);\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n },\n );\n};\n\nexport const useCredentialRevocationCheck = (forceRefresh: boolean) => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(async (credentialIds: string[]) => core.checkRevocation(credentialIds, forceRefresh), {\n onSuccess: async () => {\n await queryClient.invalidateQueries(CREDENTIAL_LIST_QUERY_KEY);\n await queryClient.invalidateQueries(CREDENTIAL_DETAIL_QUERY_KEY);\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n });\n};\n\nexport const useCredentialDelete = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(async (credentialId: string) => core.deleteCredential(credentialId), {\n onSuccess: async (_, credentialId) => {\n await queryClient.invalidateQueries(CREDENTIAL_LIST_QUERY_KEY);\n await queryClient.removeQueries([CREDENTIAL_DETAIL_QUERY_KEY, credentialId]);\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n });\n};\n\nexport const useInvalidateCredentialDetails = () => {\n const queryClient = useQueryClient();\n\n return (credentialId: string | undefined) =>\n queryClient.invalidateQueries([CREDENTIAL_DETAIL_QUERY_KEY, credentialId]);\n};\n\nexport const useInitiateIssuance = () => {\n const queryClient = useQueryClient();\n const { core, organisationId } = useONECore();\n\n return useMutation(\n async (request: Omit<InitiateIssuanceRequest, 'organisationId'>) =>\n core.initiateIssuance({ organisationId, ...request }),\n {\n onSuccess: async () => {\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n },\n );\n};\n\nexport const useContinueIssuance = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(async (url: string) => core.continueIssuance(url), {\n onSuccess: async () => {\n await queryClient.invalidateQueries(CREDENTIAL_LIST_QUERY_KEY);\n await queryClient.invalidateQueries(CREDENTIAL_SCHEMA_LIST_QUERY_KEY);\n await queryClient.invalidateQueries(CREDENTIAL_SCHEMA_DETAIL_QUERY_KEY);\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AASA,IAAAC,WAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,kBAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAEA,MAAMQ,SAAS,GAAG,EAAE;AACb,MAAMC,yBAAyB,GAAAC,OAAA,CAAAD,yBAAA,GAAG,iBAAiB;AACnD,MAAME,+BAA+B,GAAAD,OAAA,CAAAC,+BAAA,GAAG,uBAAuB;AAC/D,MAAMC,2BAA2B,GAAAF,OAAA,CAAAE,2BAAA,GAAG,mBAAmB;AAEvD,MAAMC,cAAc,GAAIC,WAA0C,IAAK;EAC5E,MAAM;IAAEC,IAAI;IAAEC;EAAe,CAAC,GAAG,IAAAC,uBAAU,EAAC,CAAC;EAE7C,OAAO,IAAAC,oBAAQ,EACb,CAACT,yBAAyB,EAAE,GAAG,IAAAU,+CAAwC,EAACL,WAAW,CAAC,CAAC,EACrF,YAAY;IACV,MAAM;MAAEM;IAAO,CAAC,GAAG,MAAML,IAAI,CAACM,eAAe,CAAC;MAC5CL,cAAc;MACdM,IAAI,EAAE,CAAC;MACP;MACAC,QAAQ,EAAE,KAAK;MACfC,MAAM,EAAE,CAACC,mCAAe,CAACC,QAAQ,EAAED,mCAAe,CAACE,SAAS,EAAEF,mCAAe,CAACG,OAAO,C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BAAA,GAAAA,8BAAA;AAEK,MAAMC,mBAAmB,GAAGA,CAAA,KAAM;EACvC,MAAMlC,WAAW,GAAG,IAAAC,0BAAc,EAAC,CAAC;EACpC,MAAM;IAAEhC,IAAI;IAAEC;EAAe,CAAC,GAAG,IAAAC,uBAAU,EAAC,CAAC;EAE7C,OAAO,IAAA+B,uBAAW,EAChB,MAAOC,OAAwD,IAC7DlC,IAAI,CAACkE,gBAAgB,CAAC;IAAEjE,cAAc;IAAE,GAAGiC;EAAQ,CAAC,CAAC,EACvD;IACEE,SAAS,EAAE,MAAAA,CAAA,KAAY;MACrB,MAAML,WAAW,CAACQ,iBAAiB,CAACI,+BAAsB,CAAC;IAC7D;EACF,CACF,CAAC;AACH,CAAC;AAAChD,OAAA,CAAAsE,mBAAA,GAAAA,mBAAA;AAEK,MAAME,mBAAmB,GAAGA,CAAA,KAAM;EACvC,MAAMpC,WAAW,GAAG,IAAAC,0BAAc,EAAC,CAAC;EACpC,MAAM;IAAEhC;EAAK,CAAC,GAAG,IAAAE,uBAAU,EAAC,CAAC;EAE7B,OAAO,IAAA+B,uBAAW,EAAC,MAAOmC,GAAW,IAAKpE,IAAI,CAACqE,gBAAgB,CAACD,GAAG,CAAC,EAAE;IACpEhC,SAAS,EAAE,MAAAA,CAAA,KAAY;MACrB,MAAML,WAAW,CAACQ,iBAAiB,CAAC7C,yBAAyB,CAAC;MAC9D,MAAMqC,WAAW,CAACQ,iBAAiB,CAACE,mDAAgC,CAAC;MACrE,MAAMV,WAAW,CAACQ,iBAAiB,CAACG,qDAAkC,CAAC;MACvE,MAAMX,WAAW,CAACQ,iBAAiB,CAACI,+BAAsB,CAAC;IAC7D;EACF,CAAC,CAAC;AACJ,CAAC;AAAChD,OAAA,CAAAwE,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_reactNativeOneCore","require","_reactQuery","_query","_coreContext","_credentialSchemas","_errorCode","_history","_proofs","PAGE_SIZE","CREDENTIAL_LIST_QUERY_KEY","exports","CREDENTIAL_LIST_PAGED_QUERY_KEY","CREDENTIAL_DETAIL_QUERY_KEY","CREDENTIAL_TRUST_INFORMATION_QUERY_KEY","useCredentials","queryParams","core","organisationId","useONECore","useQuery","getQueryKeyFromCredentialListQueryParams","values","listCredentials","page","pageSize","states","CredentialState","ACCEPTED","SUSPENDED","REVOKED","keepPreviousData","usePagedCredentials","useInfiniteQuery","pageParam","getNextPageParam","lastPage","allPages","length","totalPages","undefined","useCredentialDetail","credentialId","active","getCredential","enabled","Boolean","useInvitationHandler","queryClient","useQueryClient","useMutation","request","handleInvitation","onSuccess","result","type_","invalidateQueries","PROOF_LIST_QUERY_KEY","CREDENTIAL_SCHEMA_LIST_QUERY_KEY","CREDENTIAL_SCHEMA_DETAIL_QUERY_KEY","HISTORY_LIST_QUERY_KEY","useCredentialAccept","credentialAcceptHookParams","holderAcceptCredential","useCredentialReject","interactionId","holderRejectCredential","catch","e","OneError","code","OneErrorCode","OperationNotSupported","useCredentialRevocationCheck","forceRefresh","credentialIds","checkRevocation","useCredentialDelete","deleteCredential","_","removeQueries","useCredentialRefresh","holderRefreshCredential","useInvalidateCredentialDetails","useInitiateIssuance","initiateIssuance","useContinueIssuance","url","continueIssuance","useCredentialTrustInformation","getCredentialTrustInformation","useCredentialsTrustInformation","useQueries","map","id","meta","queryFn","queryKey"],"sources":["credentials.ts"],"sourcesContent":["import {\n CredentialListQuery,\n CredentialState,\n HandleInvitationRequest,\n HandleInvitationResponse,\n HolderAcceptCredentialRequest,\n InitiateIssuanceRequest,\n OneError,\n} from '@procivis/react-native-one-core';\nimport { useInfiniteQuery, useMutation, useQueries, useQuery, useQueryClient } from 'react-query';\n\nimport { getQueryKeyFromCredentialListQueryParams } from '../../parsers/query';\nimport { useONECore } from './core-context';\nimport { CREDENTIAL_SCHEMA_DETAIL_QUERY_KEY, CREDENTIAL_SCHEMA_LIST_QUERY_KEY } from './credential-schemas';\nimport { OneErrorCode } from './error-code';\nimport { HISTORY_LIST_QUERY_KEY } from './history';\nimport { PROOF_LIST_QUERY_KEY } from './proofs';\n\nconst PAGE_SIZE = 20;\nexport const CREDENTIAL_LIST_QUERY_KEY = 'credential-list';\nexport const CREDENTIAL_LIST_PAGED_QUERY_KEY = 'credential-list-paged';\nexport const CREDENTIAL_DETAIL_QUERY_KEY = 'credential-detail';\nexport const CREDENTIAL_TRUST_INFORMATION_QUERY_KEY = 'credential-trust-information';\n\nexport const useCredentials = (queryParams?: Partial<CredentialListQuery>) => {\n const { core, organisationId } = useONECore();\n\n return useQuery(\n [CREDENTIAL_LIST_QUERY_KEY, ...getQueryKeyFromCredentialListQueryParams(queryParams)],\n async () => {\n const { values } = await core.listCredentials({\n organisationId,\n page: 0,\n // TODO: workaround pagination for now, until it's supported by UI\n pageSize: 10000,\n states: [CredentialState.ACCEPTED, CredentialState.SUSPENDED, CredentialState.REVOKED],\n ...queryParams,\n });\n return values;\n },\n {\n keepPreviousData: true,\n },\n );\n};\n\nexport const usePagedCredentials = (queryParams?: Partial<CredentialListQuery>) => {\n const { core, organisationId } = useONECore();\n\n return useInfiniteQuery(\n [\n CREDENTIAL_LIST_QUERY_KEY,\n CREDENTIAL_LIST_PAGED_QUERY_KEY,\n ...getQueryKeyFromCredentialListQueryParams(queryParams),\n ],\n ({ pageParam = 0 }) =>\n core.listCredentials({\n organisationId,\n page: pageParam,\n pageSize: PAGE_SIZE,\n states: [CredentialState.ACCEPTED, CredentialState.SUSPENDED, CredentialState.REVOKED],\n ...queryParams,\n }),\n {\n getNextPageParam: (lastPage, allPages) => (allPages.length < lastPage.totalPages ? allPages.length : undefined),\n keepPreviousData: true,\n },\n );\n};\n\nexport const useCredentialDetail = (credentialId: string | undefined, active = true) => {\n const { core } = useONECore();\n\n return useQuery(\n [CREDENTIAL_DETAIL_QUERY_KEY, credentialId],\n () => (credentialId ? core.getCredential(credentialId) : undefined),\n {\n enabled: active && Boolean(credentialId),\n keepPreviousData: true,\n },\n );\n};\n\nexport const useInvitationHandler = () => {\n const queryClient = useQueryClient();\n const { core, organisationId } = useONECore();\n\n return useMutation(\n async (request: Omit<HandleInvitationRequest, 'organisationId'>) =>\n core.handleInvitation({ organisationId, ...request }),\n {\n onSuccess: async (result: HandleInvitationResponse) => {\n if (result.type_ === 'PROOF_REQUEST') {\n await queryClient.invalidateQueries(PROOF_LIST_QUERY_KEY);\n } else {\n await queryClient.invalidateQueries(CREDENTIAL_LIST_QUERY_KEY);\n await queryClient.invalidateQueries(CREDENTIAL_SCHEMA_LIST_QUERY_KEY);\n await queryClient.invalidateQueries(CREDENTIAL_SCHEMA_DETAIL_QUERY_KEY);\n }\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n },\n );\n};\n\nexport const useCredentialAccept = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(\n async (credentialAcceptHookParams: HolderAcceptCredentialRequest) =>\n core.holderAcceptCredential(credentialAcceptHookParams),\n {\n onSuccess: async () => {\n await queryClient.invalidateQueries(CREDENTIAL_LIST_QUERY_KEY);\n await queryClient.invalidateQueries(CREDENTIAL_SCHEMA_LIST_QUERY_KEY);\n await queryClient.invalidateQueries(CREDENTIAL_SCHEMA_DETAIL_QUERY_KEY);\n await queryClient.invalidateQueries(CREDENTIAL_DETAIL_QUERY_KEY);\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n },\n );\n};\n\nexport const useCredentialReject = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(\n async (interactionId: string) =>\n core.holderRejectCredential(interactionId).catch((e) => {\n if (e instanceof OneError && e.code === OneErrorCode.OperationNotSupported) {\n return;\n }\n throw e;\n }),\n {\n onSuccess: async () => {\n await queryClient.invalidateQueries(CREDENTIAL_LIST_QUERY_KEY);\n await queryClient.invalidateQueries(CREDENTIAL_DETAIL_QUERY_KEY);\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n },\n );\n};\n\nexport const useCredentialRevocationCheck = (forceRefresh: boolean) => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(async (credentialIds: string[]) => core.checkRevocation(credentialIds, forceRefresh), {\n onSuccess: async () => {\n await queryClient.invalidateQueries(CREDENTIAL_LIST_QUERY_KEY);\n await queryClient.invalidateQueries(CREDENTIAL_DETAIL_QUERY_KEY);\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n });\n};\n\nexport const useCredentialDelete = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(async (credentialId: string) => core.deleteCredential(credentialId), {\n onSuccess: async (_, credentialId) => {\n await queryClient.invalidateQueries(CREDENTIAL_LIST_QUERY_KEY);\n await queryClient.removeQueries([CREDENTIAL_DETAIL_QUERY_KEY, credentialId]);\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n });\n};\n\nexport const useCredentialRefresh = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(async (interactionId: string) => core.holderRefreshCredential(interactionId), {\n onSuccess: async () => {\n await queryClient.invalidateQueries(CREDENTIAL_LIST_QUERY_KEY);\n await queryClient.invalidateQueries(CREDENTIAL_DETAIL_QUERY_KEY);\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n });\n};\n\nexport const useInvalidateCredentialDetails = () => {\n const queryClient = useQueryClient();\n\n return (credentialId: string | undefined) =>\n queryClient.invalidateQueries([CREDENTIAL_DETAIL_QUERY_KEY, credentialId]);\n};\n\nexport const useInitiateIssuance = () => {\n const queryClient = useQueryClient();\n const { core, organisationId } = useONECore();\n\n return useMutation(\n async (request: Omit<InitiateIssuanceRequest, 'organisationId'>) =>\n core.initiateIssuance({ organisationId, ...request }),\n {\n onSuccess: async () => {\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n },\n );\n};\n\nexport const useContinueIssuance = () => {\n const queryClient = useQueryClient();\n const { core } = useONECore();\n\n return useMutation(async (url: string) => core.continueIssuance(url), {\n onSuccess: async () => {\n await queryClient.invalidateQueries(CREDENTIAL_LIST_QUERY_KEY);\n await queryClient.invalidateQueries(CREDENTIAL_SCHEMA_LIST_QUERY_KEY);\n await queryClient.invalidateQueries(CREDENTIAL_SCHEMA_DETAIL_QUERY_KEY);\n await queryClient.invalidateQueries(HISTORY_LIST_QUERY_KEY);\n },\n });\n};\n\nexport const useCredentialTrustInformation = (credentialId: string | undefined) => {\n const { core } = useONECore();\n\n return useQuery(\n [CREDENTIAL_TRUST_INFORMATION_QUERY_KEY, credentialId],\n () => (credentialId ? core.getCredentialTrustInformation(credentialId) : undefined),\n {\n enabled: Boolean(credentialId),\n keepPreviousData: true,\n },\n );\n};\n\nexport const useCredentialsTrustInformation = (credentialIds: string[]) => {\n const { core } = useONECore();\n\n return useQueries(\n credentialIds.map((id) => ({\n keepPreviousData: true,\n meta: {\n id,\n },\n queryFn: () => core.getCredentialTrustInformation(id),\n queryKey: [CREDENTIAL_TRUST_INFORMATION_QUERY_KEY, id],\n })),\n );\n};\n"],"mappings":";;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AASA,IAAAC,WAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,kBAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAEA,MAAMQ,SAAS,GAAG,EAAE;AACb,MAAMC,yBAAyB,GAAAC,OAAA,CAAAD,yBAAA,GAAG,iBAAiB;AACnD,MAAME,+BAA+B,GAAAD,OAAA,CAAAC,+BAAA,GAAG,uBAAuB;AAC/D,MAAMC,2BAA2B,GAAAF,OAAA,CAAAE,2BAAA,GAAG,mBAAmB;AACvD,MAAMC,sCAAsC,GAAAH,OAAA,CAAAG,sCAAA,GAAG,8BAA8B;AAE7E,MAAMC,cAAc,GAAIC,WAA0C,IAAK;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,6BAAA,GAAAA,6BAAA;AAEK,MAAME,8BAA8B,GAAIhB,aAAuB,IAAK;EACzE,MAAM;IAAE1D;EAAK,CAAC,GAAG,IAAAE,uBAAU,EAAC,CAAC;EAE7B,OAAO,IAAAyE,sBAAU,EACfjB,aAAa,CAACkB,GAAG,CAAEC,EAAE,KAAM;IACzB/D,gBAAgB,EAAE,IAAI;IACtBgE,IAAI,EAAE;MACJD;IACF,CAAC;IACDE,OAAO,EAAEA,CAAA,KAAM/E,IAAI,CAACyE,6BAA6B,CAACI,EAAE,CAAC;IACrDG,QAAQ,EAAE,CAACnF,sCAAsC,EAAEgF,EAAE;EACvD,CAAC,CAAC,CACJ,CAAC;AACH,CAAC;AAACnF,OAAA,CAAAgF,8BAAA,GAAAA,8BAAA","ignoreList":[]}
|
|
@@ -146,17 +146,6 @@ Object.keys(_query).forEach(function (key) {
|
|
|
146
146
|
}
|
|
147
147
|
});
|
|
148
148
|
});
|
|
149
|
-
var _trustEntity = require("./trust-entity");
|
|
150
|
-
Object.keys(_trustEntity).forEach(function (key) {
|
|
151
|
-
if (key === "default" || key === "__esModule") return;
|
|
152
|
-
if (key in exports && exports[key] === _trustEntity[key]) return;
|
|
153
|
-
Object.defineProperty(exports, key, {
|
|
154
|
-
enumerable: true,
|
|
155
|
-
get: function () {
|
|
156
|
-
return _trustEntity[key];
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
149
|
var _trustList = require("./trust-list");
|
|
161
150
|
Object.keys(_trustList).forEach(function (key) {
|
|
162
151
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_backup","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_cache","_coreConfig","_coreContext","_coreInit","_credentialSchemas","_credentials","_dids","_history","_identifiers","_proofSchemas","_proofs","_query","
|
|
1
|
+
{"version":3,"names":["_backup","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_cache","_coreConfig","_coreContext","_coreInit","_credentialSchemas","_credentials","_dids","_history","_identifiers","_proofSchemas","_proofs","_query","_trustList","_verifierInstance","_walletUnit"],"sources":["index.ts"],"sourcesContent":["export * from './backup';\nexport * from './cache';\nexport * from './core-config';\nexport * from './core-context';\nexport * from './core-init';\nexport * from './credential-schemas';\nexport * from './credentials';\nexport * from './dids';\nexport * from './history';\nexport * from './identifiers';\nexport * from './proof-schemas';\nexport * from './proofs';\nexport * from './query';\nexport * from './trust-list';\nexport * from './verifier-instance';\nexport * from './wallet-unit';\n"],"mappings":";;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,OAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,OAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,OAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,MAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,MAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,MAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,MAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,WAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,WAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA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List":[]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.useShareProof = exports.useRetainProofCheck = exports.useProposeProof = exports.useProofs = exports.useProofUrl = exports.useProofState = exports.useProofReject = exports.useProofForSchemaIdWithTransport = exports.useProofDetail = exports.useProofDelete = exports.useProofCreate = exports.useProofAccept = exports.useDeleteProofData = exports.useDeleteAllProofsData = exports.useCleanupUnusedProofs = exports.VerificationProtocol = exports.VerificationEngagement = exports.PROOF_STATE_QUERY_KEY = exports.PROOF_LIST_QUERY_KEY = exports.PROOF_DETAIL_QUERY_KEY = exports.IssuanceProtocol = void 0;
|
|
6
|
+
exports.useShareProof = exports.useRetainProofCheck = exports.useProposeProof = exports.useProofs = exports.useProofUrl = exports.useProofState = exports.useProofRequestTrustInformation = exports.useProofReject = exports.useProofForSchemaIdWithTransport = exports.useProofDetail = exports.useProofDelete = exports.useProofCreate = exports.useProofAccept = exports.useDeleteProofData = exports.useDeleteAllProofsData = exports.useCleanupUnusedProofs = exports.VerificationProtocol = exports.VerificationEngagement = exports.PROOF_STATE_QUERY_KEY = exports.PROOF_REQUEST_TRUST_INFORMATION_QUERY_KEY = exports.PROOF_LIST_QUERY_KEY = exports.PROOF_DETAIL_QUERY_KEY = exports.IssuanceProtocol = void 0;
|
|
7
7
|
var _reactNativeOneCore = require("@procivis/react-native-one-core");
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _reactQuery = require("react-query");
|
|
@@ -19,6 +19,7 @@ const PAGE_SIZE = 10;
|
|
|
19
19
|
const PROOF_DETAIL_QUERY_KEY = exports.PROOF_DETAIL_QUERY_KEY = 'proof-detail';
|
|
20
20
|
const PROOF_STATE_QUERY_KEY = exports.PROOF_STATE_QUERY_KEY = 'proof-state';
|
|
21
21
|
const PROOF_LIST_QUERY_KEY = exports.PROOF_LIST_QUERY_KEY = 'proof-list';
|
|
22
|
+
const PROOF_REQUEST_TRUST_INFORMATION_QUERY_KEY = exports.PROOF_REQUEST_TRUST_INFORMATION_QUERY_KEY = 'proof-request-trust-information';
|
|
22
23
|
const useProofDetail = proofId => {
|
|
23
24
|
const {
|
|
24
25
|
core
|
|
@@ -421,4 +422,14 @@ const useDeleteAllProofsData = schemaId => {
|
|
|
421
422
|
});
|
|
422
423
|
};
|
|
423
424
|
exports.useDeleteAllProofsData = useDeleteAllProofsData;
|
|
425
|
+
const useProofRequestTrustInformation = credentialId => {
|
|
426
|
+
const {
|
|
427
|
+
core
|
|
428
|
+
} = (0, _coreContext.useONECore)();
|
|
429
|
+
return (0, _reactQuery.useQuery)([PROOF_REQUEST_TRUST_INFORMATION_QUERY_KEY, credentialId], () => credentialId ? core.getProofTrustInformation(credentialId) : undefined, {
|
|
430
|
+
enabled: Boolean(credentialId),
|
|
431
|
+
keepPreviousData: true
|
|
432
|
+
});
|
|
433
|
+
};
|
|
434
|
+
exports.useProofRequestTrustInformation = useProofRequestTrustInformation;
|
|
424
435
|
//# sourceMappingURL=proofs.js.map
|