cozy-client 43.5.1 → 44.0.0

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.
@@ -2703,7 +2703,7 @@ var CozyClient = /*#__PURE__*/function () {
2703
2703
  CozyClient.hooks = CozyClient.hooks || {};
2704
2704
  CozyClient.fetchPolicies = _policies.default; //COZY_CLIENT_VERSION_PACKAGE in replaced by babel. See babel config
2705
2705
 
2706
- CozyClient.version = "43.5.1";
2706
+ CozyClient.version = "44.0.0";
2707
2707
 
2708
2708
  _microee.default.mixin(CozyClient);
2709
2709
 
@@ -488,6 +488,19 @@
488
488
  "sourceSubCategory": "sport",
489
489
  "subjects": ["permit", "invoice"]
490
490
  },
491
+ {
492
+ "label": "real_estate_insurance",
493
+ "purpose": "contract",
494
+ "sourceCategory": "insurance",
495
+ "sourceSubCategory": "real_estate",
496
+ "subjects": ["insurance"]
497
+ },
498
+ {
499
+ "label": "person_insurance",
500
+ "purpose": "contract",
501
+ "sourceCategory": "insurance",
502
+ "subjects": ["insurance"]
503
+ },
491
504
  {
492
505
  "label": "other_administrative_document"
493
506
  },
@@ -35,7 +35,7 @@ var identityLabels = ['identity_photo', 'national_id_card', 'passport', 'residen
35
35
  * @type {Array<import("../../types").FamilyLabel>}
36
36
  */
37
37
 
38
- var familyLabels = ['family_record_book', 'birth_certificate', 'wedding', 'pacs', 'single_parent_benefit', 'divorce', 'large_family_card', 'caf', 'payment_proof_family_allowance', 'note_family_document', 'other_family_document'];
38
+ var familyLabels = ['family_record_book', 'birth_certificate', 'wedding', 'pacs', 'single_parent_benefit', 'divorce', 'large_family_card', 'caf', 'payment_proof_family_allowance', 'note_family_document', 'other_family_document', 'person_insurance'];
39
39
  /**
40
40
  * @type {Array<import("../../types").WorkStudyLabels>}
41
41
  */
@@ -50,7 +50,7 @@ var healthLabels = ['health_certificate', 'health_book', 'national_health_insura
50
50
  * @type {Array<import("../../types").HomeLabels>}
51
51
  */
52
52
 
53
- var homeLabels = ['phone_invoice', 'isp_invoice', 'telecom_invoice', 'energy_invoice', 'water_invoice', 'other_invoice', 'work_invoice', 'house_sale_agreeement', 'building_permit', 'technical_diagnostic_record', 'unfit_for_habitation_declaration', 'lease', 'rent_receipt', 'accommodation_proof', 'house_insurance', 'work_quote', 'note_house_document', 'other_house_document'];
53
+ var homeLabels = ['phone_invoice', 'isp_invoice', 'telecom_invoice', 'energy_invoice', 'water_invoice', 'other_invoice', 'work_invoice', 'house_sale_agreeement', 'building_permit', 'technical_diagnostic_record', 'unfit_for_habitation_declaration', 'lease', 'rent_receipt', 'accommodation_proof', 'house_insurance', 'work_quote', 'note_house_document', 'other_house_document', 'real_estate_insurance'];
54
54
  /**
55
55
  * @type {Array<import("../../types").TransportLabels>}
56
56
  */
@@ -89,10 +89,12 @@
89
89
  "pay_sheet": "Pay sheet |||| Pay sheets",
90
90
  "payment_proof_family_allowance": "family allowance payment proof |||| family allowance payment proofs",
91
91
  "pension": "Pension |||| Pensions",
92
+ "person_insurance": "Individual insurance certificate |||| Individual insurance certificates",
92
93
  "personal_sporting_licence": "Sporting licence |||| Sporting licences",
93
94
  "phone_invoice": "Phone invoice |||| Phone invoices",
94
95
  "pregnancy_medical_certificate": "Certificate of pregnancy |||| Certificates of pregnancy",
95
96
  "prescription": "Prescription |||| Prescriptions",
97
+ "real_estate_insurance" : "Real estate insurance certificate |||| Real estate insurance certificates",
96
98
  "real_estate_tax": "Real estate tax |||| Real estate taxes",
97
99
  "receipt": "Receipt |||| Receipts",
98
100
  "rent_receipt": "Rent receipt |||| Rent receipts",
@@ -89,10 +89,12 @@
89
89
  "pay_sheet": "Fiche de paie |||| Fiches de paie",
90
90
  "payment_proof_family_allowance": "Attestation de paiement CAF |||| Attestations de paiement CAF",
91
91
  "pension": "Retraite |||| Retraites",
92
+ "person_insurance": "Attestation d'assurance individuelle |||| Attestations d'assurance individuelle",
92
93
  "personal_sporting_licence": "Licence sportive |||| Licences sportives",
93
94
  "phone_invoice": "Facture de téléphone |||| Factures de téléphone",
94
95
  "pregnancy_medical_certificate": "Certificat de grossesse |||| Certificats de grossesse",
95
96
  "prescription": "Ordonnance |||| Ordonnances",
97
+ "real_estate_insurance" : "Attestation d'assurance immobilière |||| Attestations d'assurance immobilière",
96
98
  "real_estate_tax": "Taxe foncière |||| Taxes foncières",
97
99
  "receipt": "Accusé de réception |||| Accusés de réception",
98
100
  "rent_receipt": "Quittance de loyer |||| Quittances de loyer",
@@ -659,33 +659,27 @@ var overrideFileForPath = /*#__PURE__*/function () {
659
659
  * Method to generate a new filename if there is a conflict
660
660
  *
661
661
  * @param {string} filenameWithoutExtension - A filename without the extension
662
- * @param {RegExp} [originalNameFormatRegex] - A regex to check if the name is still in his original format
662
+ * @param {import('../types').ConflictOptions} [conflictOptions] - Conflict options
663
663
  * @returns {string} A filename with the right suffix
664
664
  */
665
665
 
666
666
 
667
667
  exports.overrideFileForPath = overrideFileForPath;
668
668
 
669
- var generateNewFileNameOnConflict = function generateNewFileNameOnConflict(filenameWithoutExtension, originalNameFormatRegex) {
670
- var isOriginalNameFormat = false;
669
+ var generateNewFileNameOnConflict = function generateNewFileNameOnConflict(filenameWithoutExtension, conflictOptions) {
670
+ var delimiter = (conflictOptions === null || conflictOptions === void 0 ? void 0 : conflictOptions.delimiter) || '_'; //Check if the string ends by _1
671
671
 
672
- if (originalNameFormatRegex && originalNameFormatRegex.test(filenameWithoutExtension)) {
673
- isOriginalNameFormat = true;
674
- } //Check if the string ends by _1
675
-
676
-
677
- var regex = new RegExp('(_)([0-9]+)$');
672
+ var regex = new RegExp("(".concat(delimiter, ")([0-9]+)$"));
678
673
  var matches = filenameWithoutExtension.match(regex);
679
- var shouldIncrement = matches && !isOriginalNameFormat;
680
674
 
681
- if (shouldIncrement) {
675
+ if (matches) {
682
676
  var versionNumber = parseInt(matches[2]); //increment versionNumber
683
677
 
684
678
  versionNumber++;
685
- var newFilenameWithoutExtension = filenameWithoutExtension.replace(new RegExp('(_)([0-9]+)$'), "_".concat(versionNumber));
679
+ var newFilenameWithoutExtension = filenameWithoutExtension.replace(new RegExp("(".concat(delimiter, ")([0-9]+)$")), "".concat(delimiter).concat(versionNumber));
686
680
  return newFilenameWithoutExtension;
687
681
  } else {
688
- return "".concat(filenameWithoutExtension, "_1");
682
+ return "".concat(filenameWithoutExtension).concat(delimiter, "1");
689
683
  }
690
684
  };
691
685
  /**
@@ -569,31 +569,44 @@ describe('File Model', () => {
569
569
  expect(filename2).toEqual('test_2')
570
570
  const filename3 = fileModel.generateNewFileNameOnConflict('test_1_1_test')
571
571
  expect(filename3).toEqual('test_1_1_test_1')
572
- const filename4 = fileModel.generateNewFileNameOnConflict('test_')
573
- expect(filename4).toEqual('test__1')
574
- const filename5 = fileModel.generateNewFileNameOnConflict('test_1_1')
575
- expect(filename5).toEqual('test_1_2')
572
+ const filename4 = fileModel.generateNewFileNameOnConflict(
573
+ 'test_1_1_test_1'
574
+ )
575
+ expect(filename4).toEqual('test_1_1_test_2')
576
+ const filename5 = fileModel.generateNewFileNameOnConflict('test_')
577
+ expect(filename5).toEqual('test__1')
576
578
  })
577
579
 
578
- it('should generate the right file name with _X when passing a format', () => {
579
- const regex = new RegExp('^([a-z]+)(_)([0-9]+)$') // test_1
580
+ it('should generate the right file name with _cozyX', () => {
581
+ const conflictOptions = {
582
+ delimiter: '_cozy'
583
+ }
580
584
 
581
- const filename1 = fileModel.generateNewFileNameOnConflict('test', regex)
582
- expect(filename1).toEqual('test_1')
583
- const filename2 = fileModel.generateNewFileNameOnConflict('test_1', regex)
584
- expect(filename2).toEqual('test_1_1')
585
+ const filename1 = fileModel.generateNewFileNameOnConflict(
586
+ 'test',
587
+ conflictOptions
588
+ )
589
+ expect(filename1).toEqual('test_cozy1')
590
+ const filename2 = fileModel.generateNewFileNameOnConflict(
591
+ 'test_cozy1',
592
+ conflictOptions
593
+ )
594
+ expect(filename2).toEqual('test_cozy2')
585
595
  const filename3 = fileModel.generateNewFileNameOnConflict(
586
- 'test_1_1_test',
587
- regex
596
+ 'test_cozy1_test',
597
+ conflictOptions
588
598
  )
589
- expect(filename3).toEqual('test_1_1_test_1')
590
- const filename4 = fileModel.generateNewFileNameOnConflict('test_', regex)
591
- expect(filename4).toEqual('test__1')
599
+ expect(filename3).toEqual('test_cozy1_test_cozy1')
600
+ const filename4 = fileModel.generateNewFileNameOnConflict(
601
+ 'test_cozy1_test_cozy1',
602
+ conflictOptions
603
+ )
604
+ expect(filename4).toEqual('test_cozy1_test_cozy2')
592
605
  const filename5 = fileModel.generateNewFileNameOnConflict(
593
- 'test_1_1',
594
- regex
606
+ 'test_',
607
+ conflictOptions
595
608
  )
596
- expect(filename5).toEqual('test_1_2')
609
+ expect(filename5).toEqual('test__cozy1')
597
610
  })
598
611
  })
599
612
 
package/dist/types.js CHANGED
@@ -525,13 +525,13 @@ var _dsl = require("./queries/dsl");
525
525
  /**
526
526
  * @typedef {'identity_photo'|'national_id_card'|'passport'|'residence_permit'|'family_record_book'|'birth_certificate'|'driver_license'|'other_identity_document'|'citizen_registration_certificate'|'personal_sporting_licence'|'electoral_card'|'note_identity_document'} IdentityLabel
527
527
  *
528
- * @typedef {'family_record_book'|'birth_certificate'|'wedding'|'pacs'|'divorce'|'large_family_card'|'caf'|'other_family_document'|'payment_proof_family_allowance'|'single_parent_benefit'|'note_family_document'} FamilyLabel
528
+ * @typedef {'family_record_book'|'birth_certificate'|'wedding'|'pacs'|'divorce'|'large_family_card'|'caf'|'other_family_document'|'payment_proof_family_allowance'|'single_parent_benefit'|'note_family_document'|'person_insurance'} FamilyLabel
529
529
  *
530
530
  * @typedef {'diploma'|'work_contract'|'pay_sheet'|'unemployment_benefit'|'pension'|'gradebook'|'student_card'|'resume'|'motivation_letter'|'other_work_document'|'work_disability_recognition'|'school_attendance_certificate'|'employment_center_certificate'|'school_insurance_certificate'|'note_work_document'|'expense_claim'} WorkStudyLabels
531
531
  *
532
532
  * @typedef {'health_certificate'|'health_book'|'national_health_insurance_card'|'health_insurance_card'|'prescription'|'health_invoice'|'national_health_insurance_right_certificate'|'work_disability_recognition'|'pregnancy_medical_certificate'|'other_health_document'|'note_health_document'} HealthLabels
533
533
  *
534
- * @typedef {'phone_invoice'|'isp_invoice'|'telecom_invoice'|'energy_invoice'|'water_invoice'|'other_invoice'|'house_sale_agreeement'|'building_permit'|'technical_diagnostic_record'|'lease'|'rent_receipt'|'house_insurance'|'work_quote'|'work_invoice'|'other_house_document'|'unfit_for_habitation_declaration'|'accommodation_proof'|'note_house_document'} HomeLabels
534
+ * @typedef {'phone_invoice'|'isp_invoice'|'telecom_invoice'|'energy_invoice'|'water_invoice'|'other_invoice'|'house_sale_agreeement'|'building_permit'|'technical_diagnostic_record'|'lease'|'rent_receipt'|'house_insurance'|'work_quote'|'work_invoice'|'other_house_document'|'unfit_for_habitation_declaration'|'accommodation_proof'|'note_house_document'|'real_estate_insurance'} HomeLabels
535
535
  *
536
536
  * @typedef {'driver_license'|'vehicle_registration'|'car_insurance'|'mechanic_invoice'|'transport_invoice'|'other_transport_document'|'transport_card'|'note_transport_document'} TransportLabels
537
537
  *
@@ -652,6 +652,13 @@ var _dsl = require("./queries/dsl");
652
652
  * @property {string} hash - The redirect link's path (i.e. '/folder/SOME_FOLDER_ID')
653
653
  */
654
654
 
655
+ /**
656
+ * Represents available options of generateNewFileNameOnConflict method
657
+ *
658
+ * @typedef {object} ConflictOptions
659
+ * @property {string} [delimiter] - Delimiter before the incremented number. Default to '_'
660
+ */
661
+
655
662
  /**
656
663
  * Template to type useState
657
664
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-client",
3
- "version": "43.5.1",
3
+ "version": "44.0.0",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.node.js",
6
6
  "browser": "dist/index.js",
@@ -18,7 +18,7 @@
18
18
  "@types/jest": "^26.0.20",
19
19
  "@types/lodash": "^4.14.170",
20
20
  "btoa": "^1.2.1",
21
- "cozy-stack-client": "^43.0.0",
21
+ "cozy-stack-client": "^44.0.0",
22
22
  "date-fns": "2.29.3",
23
23
  "json-stable-stringify": "^1.0.1",
24
24
  "lodash": "^4.17.13",
@@ -75,5 +75,5 @@
75
75
  "react-native-ios11-devicecheck": "https://github.com/cozy/react-native-devicecheck#app-attest-v0.1"
76
76
  },
77
77
  "sideEffects": false,
78
- "gitHead": "61af4bcb1a0537b2f958cfa956298e5b537889e7"
78
+ "gitHead": "852539500a548a92416af09279398e6ded88bd7f"
79
79
  }
@@ -52,7 +52,7 @@ export function move(client: CozyClient, fileId: string, destination: {
52
52
  path: string;
53
53
  }, force?: boolean): Promise<any>;
54
54
  export function overrideFileForPath(client: CozyClient, dirPath: string, file: object, metadata: object): Promise<import("../types").IOCozyFile>;
55
- export function generateNewFileNameOnConflict(filenameWithoutExtension: string, originalNameFormatRegex?: RegExp): string;
55
+ export function generateNewFileNameOnConflict(filenameWithoutExtension: string, conflictOptions?: import('../types').ConflictOptions): string;
56
56
  export function generateFileNameForRevision(file: import("../types").IOCozyFile, revision: object, f: Function): string;
57
57
  export function uploadFileWithConflictStrategy(client: CozyClient, file: string | ArrayBuffer, options: FileUploadOptions): any;
58
58
  export function readMobileFile(fileURL: string): Promise<any>;
package/types/types.d.ts CHANGED
@@ -900,16 +900,16 @@ export type QualificationAttributes = {
900
900
  subjects?: Array<string>;
901
901
  };
902
902
  export type IdentityLabel = "identity_photo" | "national_id_card" | "passport" | "residence_permit" | "family_record_book" | "birth_certificate" | "driver_license" | "other_identity_document" | "electoral_card" | "citizen_registration_certificate" | "personal_sporting_licence" | "note_identity_document";
903
- export type FamilyLabel = "family_record_book" | "birth_certificate" | "wedding" | "pacs" | "divorce" | "large_family_card" | "caf" | "other_family_document" | "single_parent_benefit" | "payment_proof_family_allowance" | "note_family_document";
903
+ export type FamilyLabel = "family_record_book" | "birth_certificate" | "wedding" | "pacs" | "divorce" | "large_family_card" | "caf" | "other_family_document" | "single_parent_benefit" | "payment_proof_family_allowance" | "person_insurance" | "note_family_document";
904
904
  export type WorkStudyLabels = "resume" | "diploma" | "work_contract" | "pay_sheet" | "employment_center_certificate" | "unemployment_benefit" | "pension" | "gradebook" | "student_card" | "motivation_letter" | "other_work_document" | "work_disability_recognition" | "school_attendance_certificate" | "school_insurance_certificate" | "expense_claim" | "note_work_document";
905
905
  export type HealthLabels = "health_book" | "health_certificate" | "pregnancy_medical_certificate" | "work_disability_recognition" | "national_health_insurance_card" | "national_health_insurance_right_certificate" | "health_insurance_card" | "prescription" | "health_invoice" | "other_health_document" | "note_health_document";
906
- export type HomeLabels = "house_sale_agreeement" | "building_permit" | "technical_diagnostic_record" | "lease" | "rent_receipt" | "house_insurance" | "work_quote" | "work_invoice" | "other_house_document" | "phone_invoice" | "isp_invoice" | "telecom_invoice" | "energy_invoice" | "water_invoice" | "other_invoice" | "unfit_for_habitation_declaration" | "accommodation_proof" | "note_house_document";
906
+ export type HomeLabels = "house_sale_agreeement" | "building_permit" | "technical_diagnostic_record" | "lease" | "rent_receipt" | "house_insurance" | "work_quote" | "work_invoice" | "other_house_document" | "phone_invoice" | "isp_invoice" | "telecom_invoice" | "energy_invoice" | "water_invoice" | "other_invoice" | "unfit_for_habitation_declaration" | "accommodation_proof" | "real_estate_insurance" | "note_house_document";
907
907
  export type TransportLabels = "driver_license" | "transport_card" | "vehicle_registration" | "car_insurance" | "mechanic_invoice" | "transport_invoice" | "other_transport_document" | "note_transport_document";
908
908
  export type FinanceLabels = "pay_sheet" | "single_parent_benefit" | "other_revenue" | "real_estate_tax" | "tax_return" | "tax_notice" | "tax_timetable" | "other_tax_document" | "bank_details" | "bank_statement" | "loan_agreement" | "other_bank_document" | "receipt" | "payment_proof_family_allowance" | "expense_claim" | "note_finance";
909
909
  export type InvoiceLabels = "health_invoice" | "transport_invoice" | "work_invoice" | "phone_invoice" | "isp_invoice" | "telecom_invoice" | "energy_invoice" | "water_invoice" | "appliance_invoice" | "web_service_invoice" | "restaurant_invoice" | "other_invoice" | "expense_claim" | "note_invoice";
910
910
  export type ActivityLabels = "fidelity_card" | "library_card" | "personal_sporting_licence" | "other_activity_document" | "note_activity_document";
911
911
  export type OthersLabels = "other_administrative_document" | "note_other";
912
- export type ItemsLabels = "resume" | "identity_photo" | "national_id_card" | "passport" | "residence_permit" | "family_record_book" | "birth_certificate" | "driver_license" | "other_identity_document" | "wedding" | "pacs" | "divorce" | "large_family_card" | "caf" | "other_family_document" | "diploma" | "work_contract" | "pay_sheet" | "fidelity_card" | "library_card" | "single_parent_benefit" | "transport_card" | "electoral_card" | "employment_center_certificate" | "unemployment_benefit" | "pension" | "other_revenue" | "gradebook" | "student_card" | "motivation_letter" | "other_work_document" | "health_book" | "health_certificate" | "pregnancy_medical_certificate" | "work_disability_recognition" | "national_health_insurance_card" | "national_health_insurance_right_certificate" | "health_insurance_card" | "prescription" | "health_invoice" | "other_health_document" | "vehicle_registration" | "car_insurance" | "mechanic_invoice" | "transport_invoice" | "other_transport_document" | "house_sale_agreeement" | "real_estate_tax" | "building_permit" | "technical_diagnostic_record" | "lease" | "rent_receipt" | "house_insurance" | "work_quote" | "work_invoice" | "other_house_document" | "phone_invoice" | "isp_invoice" | "telecom_invoice" | "energy_invoice" | "water_invoice" | "appliance_invoice" | "web_service_invoice" | "restaurant_invoice" | "other_invoice" | "tax_return" | "tax_notice" | "tax_timetable" | "other_tax_document" | "bank_details" | "bank_statement" | "loan_agreement" | "other_bank_document" | "receipt" | "payment_proof_family_allowance" | "school_attendance_certificate" | "school_insurance_certificate" | "unfit_for_habitation_declaration" | "accommodation_proof" | "citizen_registration_certificate" | "personal_sporting_licence" | "other_activity_document" | "other_administrative_document" | "expense_claim" | "note_identity_document" | "note_family_document" | "note_work_document" | "note_health_document" | "note_house_document" | "note_transport_document" | "note_activity_document" | "note_finance" | "note_invoice" | "note_other";
912
+ export type ItemsLabels = "resume" | "identity_photo" | "national_id_card" | "passport" | "residence_permit" | "family_record_book" | "birth_certificate" | "driver_license" | "other_identity_document" | "wedding" | "pacs" | "divorce" | "large_family_card" | "caf" | "other_family_document" | "diploma" | "work_contract" | "pay_sheet" | "fidelity_card" | "library_card" | "single_parent_benefit" | "transport_card" | "electoral_card" | "employment_center_certificate" | "unemployment_benefit" | "pension" | "other_revenue" | "gradebook" | "student_card" | "motivation_letter" | "other_work_document" | "health_book" | "health_certificate" | "pregnancy_medical_certificate" | "work_disability_recognition" | "national_health_insurance_card" | "national_health_insurance_right_certificate" | "health_insurance_card" | "prescription" | "health_invoice" | "other_health_document" | "vehicle_registration" | "car_insurance" | "mechanic_invoice" | "transport_invoice" | "other_transport_document" | "house_sale_agreeement" | "real_estate_tax" | "building_permit" | "technical_diagnostic_record" | "lease" | "rent_receipt" | "house_insurance" | "work_quote" | "work_invoice" | "other_house_document" | "phone_invoice" | "isp_invoice" | "telecom_invoice" | "energy_invoice" | "water_invoice" | "appliance_invoice" | "web_service_invoice" | "restaurant_invoice" | "other_invoice" | "tax_return" | "tax_notice" | "tax_timetable" | "other_tax_document" | "bank_details" | "bank_statement" | "loan_agreement" | "other_bank_document" | "receipt" | "payment_proof_family_allowance" | "school_attendance_certificate" | "school_insurance_certificate" | "unfit_for_habitation_declaration" | "accommodation_proof" | "citizen_registration_certificate" | "personal_sporting_licence" | "other_activity_document" | "real_estate_insurance" | "person_insurance" | "other_administrative_document" | "expense_claim" | "note_identity_document" | "note_family_document" | "note_work_document" | "note_health_document" | "note_house_document" | "note_transport_document" | "note_activity_document" | "note_finance" | "note_invoice" | "note_other";
913
913
  /**
914
914
  * See https://github.com/cozy/DACC
915
915
  */
@@ -1092,6 +1092,15 @@ export type RedirectLinkData = {
1092
1092
  */
1093
1093
  hash: string;
1094
1094
  };
1095
+ /**
1096
+ * Represents available options of generateNewFileNameOnConflict method
1097
+ */
1098
+ export type ConflictOptions = {
1099
+ /**
1100
+ * - Delimiter before the incremented number. Default to '_'
1101
+ */
1102
+ delimiter?: string;
1103
+ };
1095
1104
  /**
1096
1105
  * Template to type useState
1097
1106
  */