@tap-payments/auth-jsconnect 2.4.55-test → 2.4.57-test
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/build/utils/array.js +2 -2
- package/package.json +1 -1
package/build/utils/array.js
CHANGED
|
@@ -200,14 +200,14 @@ export var getRecentDocumentBasedOnPurpose = function (documents, purpose) {
|
|
|
200
200
|
if ((documents || []).length === 0)
|
|
201
201
|
return [];
|
|
202
202
|
var filteredByPurpose = documents.filter(function (doc) {
|
|
203
|
-
return doc.
|
|
203
|
+
return doc.type === purpose;
|
|
204
204
|
});
|
|
205
205
|
if ((filteredByPurpose || []).length > 0) {
|
|
206
206
|
return filteredByPurpose.sort(function (a, b) { return b.created - a.created; })[0];
|
|
207
207
|
}
|
|
208
208
|
else {
|
|
209
209
|
return documents
|
|
210
|
-
.filter(function (doc) { var _a; return !((_a = doc.file_details) === null || _a === void 0 ? void 0 : _a.length) &&
|
|
210
|
+
.filter(function (doc) { var _a; return !((_a = doc.file_details) === null || _a === void 0 ? void 0 : _a.length) && doc.id; })
|
|
211
211
|
.sort(function (a, b) { return b.created - a.created; })[0];
|
|
212
212
|
}
|
|
213
213
|
};
|