@redacto.io/consent-sdk-react 9.2.0-beta.1 → 9.2.0-beta.2

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/privacy-center.d.mts +6 -10
  3. package/dist/privacy-center.d.ts +6 -10
  4. package/dist/privacy-center.js +208 -850
  5. package/dist/privacy-center.mjs +208 -850
  6. package/package.json +1 -1
  7. package/src/RedactoPrivacyCenter/components/DataRequest/ProductSelectionSection.tsx +4 -4
  8. package/src/RedactoPrivacyCenter/components/Form.tsx +214 -866
  9. package/src/RedactoPrivacyCenter/components/RequestSubmit.tsx +44 -219
  10. package/src/RedactoPrivacyCenter/components/types.ts +14 -20
  11. package/src/RedactoPrivacyCenter/lib/api.ts +23 -58
  12. package/src/RedactoPrivacyCenter/lib/types.ts +0 -31
  13. package/src/RedactoPrivacyCenter/locales/as/translation.json +2 -2
  14. package/src/RedactoPrivacyCenter/locales/bho/translation.json +2 -2
  15. package/src/RedactoPrivacyCenter/locales/bn/translation.json +2 -2
  16. package/src/RedactoPrivacyCenter/locales/brx/translation.json +2 -2
  17. package/src/RedactoPrivacyCenter/locales/doi/translation.json +2 -2
  18. package/src/RedactoPrivacyCenter/locales/en/translation.json +2 -2
  19. package/src/RedactoPrivacyCenter/locales/gom/translation.json +2 -2
  20. package/src/RedactoPrivacyCenter/locales/gu/translation.json +2 -2
  21. package/src/RedactoPrivacyCenter/locales/hi/translation.json +2 -2
  22. package/src/RedactoPrivacyCenter/locales/kn/translation.json +2 -2
  23. package/src/RedactoPrivacyCenter/locales/ks/translation.json +2 -2
  24. package/src/RedactoPrivacyCenter/locales/mai/translation.json +2 -2
  25. package/src/RedactoPrivacyCenter/locales/ml/translation.json +2 -2
  26. package/src/RedactoPrivacyCenter/locales/mni-Mtei/translation.json +2 -2
  27. package/src/RedactoPrivacyCenter/locales/mr/translation.json +2 -2
  28. package/src/RedactoPrivacyCenter/locales/ne/translation.json +2 -2
  29. package/src/RedactoPrivacyCenter/locales/or/translation.json +2 -2
  30. package/src/RedactoPrivacyCenter/locales/pa/translation.json +2 -2
  31. package/src/RedactoPrivacyCenter/locales/sa/translation.json +2 -2
  32. package/src/RedactoPrivacyCenter/locales/sat/translation.json +2 -2
  33. package/src/RedactoPrivacyCenter/locales/sd/translation.json +2 -2
  34. package/src/RedactoPrivacyCenter/locales/ta/translation.json +2 -2
  35. package/src/RedactoPrivacyCenter/locales/te/translation.json +2 -2
  36. package/src/RedactoPrivacyCenter/locales/ur/translation.json +2 -2
  37. package/tests/Form.test.tsx +123 -149
  38. package/tests/ProductSelectionSection.test.tsx +39 -4
  39. package/tests/RequestSubmit.test.tsx +27 -187
@@ -430,8 +430,8 @@ var translation_default = {
430
430
  selectProductsForRequestGeneric: "Select a product to continue",
431
431
  yourData: "Your data",
432
432
  actingOnBehalfOf: "Acting on behalf of {{nominator}}",
433
- activePurposes_one: "{{count}} active purpose",
434
- activePurposes_other: "{{count}} active purposes",
433
+ activePurposes_one: "{{count}} purpose",
434
+ activePurposes_other: "{{count}} purposes",
435
435
  autoSelected: "Auto-selected",
436
436
  noProductsAvailable: "No products available",
437
437
  noProductsAvailableDescription: "You have no consents to manage yet.",
@@ -758,8 +758,8 @@ var translation_default2 = {
758
758
  selectProductsForRequestGeneric: "Select one or more products to continue",
759
759
  yourData: "Your data",
760
760
  actingOnBehalfOf: "Acting on behalf of {{nominator}}",
761
- activePurposes_one: "{{count}} active purpose",
762
- activePurposes_other: "{{count}} active purposes",
761
+ activePurposes_one: "{{count}} \u0989\u09A6\u09CD\u09A6\u09C7\u09B6\u09CD\u09AF",
762
+ activePurposes_other: "{{count}} \u0989\u09A6\u09CD\u09A6\u09C7\u09B6\u09CD\u09AF",
763
763
  autoSelected: "Auto-selected",
764
764
  noProductsAvailable: "No products available",
765
765
  noProductsAvailableDescription: "You have no consents to manage yet.",
@@ -1090,8 +1090,8 @@ var translation_default3 = {
1090
1090
  selectProductsForRequestGeneric: "Select one or more products to continue",
1091
1091
  yourData: "Your data",
1092
1092
  actingOnBehalfOf: "Acting on behalf of {{nominator}}",
1093
- activePurposes_one: "{{count}} active purpose",
1094
- activePurposes_other: "{{count}} active purposes",
1093
+ activePurposes_one: "{{count}} \u0989\u09A6\u09CD\u09A6\u09C7\u09B6\u09CD\u09AF",
1094
+ activePurposes_other: "{{count}} \u0989\u09A6\u09CD\u09A6\u09C7\u09B6\u09CD\u09AF",
1095
1095
  autoSelected: "Auto-selected",
1096
1096
  noProductsAvailable: "No products available",
1097
1097
  noProductsAvailableDescription: "You have no consents to manage yet.",
@@ -1422,8 +1422,8 @@ var translation_default4 = {
1422
1422
  selectProductsForRequestGeneric: "Select one or more products to continue",
1423
1423
  yourData: "Your data",
1424
1424
  actingOnBehalfOf: "Acting on behalf of {{nominator}}",
1425
- activePurposes_one: "{{count}} active purpose",
1426
- activePurposes_other: "{{count}} active purposes",
1425
+ activePurposes_one: "{{count}} \u0909\u0926\u094D\u0926\u0947\u0936\u094D\u092F",
1426
+ activePurposes_other: "{{count}} \u0909\u0926\u094D\u0926\u0947\u0936\u094D\u092F",
1427
1427
  autoSelected: "Auto-selected",
1428
1428
  noProductsAvailable: "No products available",
1429
1429
  noProductsAvailableDescription: "You have no consents to manage yet.",
@@ -1754,8 +1754,8 @@ var translation_default5 = {
1754
1754
  selectProductsForRequestGeneric: "Select one or more products to continue",
1755
1755
  yourData: "Your data",
1756
1756
  actingOnBehalfOf: "Acting on behalf of {{nominator}}",
1757
- activePurposes_one: "{{count}} active purpose",
1758
- activePurposes_other: "{{count}} active purposes",
1757
+ activePurposes_one: "{{count}} \u0909\u0926\u094D\u0926\u0947\u0936\u094D\u092F",
1758
+ activePurposes_other: "{{count}} \u0909\u0926\u094D\u0926\u0947\u0936\u094D\u092F",
1759
1759
  autoSelected: "Auto-selected",
1760
1760
  noProductsAvailable: "No products available",
1761
1761
  noProductsAvailableDescription: "You have no consents to manage yet.",
@@ -2086,8 +2086,8 @@ var translation_default6 = {
2086
2086
  selectProductsForRequestGeneric: "Select one or more products to continue",
2087
2087
  yourData: "Your data",
2088
2088
  actingOnBehalfOf: "Acting on behalf of {{nominator}}",
2089
- activePurposes_one: "{{count}} active purpose",
2090
- activePurposes_other: "{{count}} active purposes",
2089
+ activePurposes_one: "{{count}} \u0909\u0926\u094D\u0926\u0947\u0936\u094D\u092F",
2090
+ activePurposes_other: "{{count}} \u0909\u0926\u094D\u0926\u0947\u0936\u094D\u092F",
2091
2091
  autoSelected: "Auto-selected",
2092
2092
  noProductsAvailable: "No products available",
2093
2093
  noProductsAvailableDescription: "You have no consents to manage yet.",
@@ -2418,8 +2418,8 @@ var translation_default7 = {
2418
2418
  selectProductsForRequestGeneric: "Select one or more products to continue",
2419
2419
  yourData: "Your data",
2420
2420
  actingOnBehalfOf: "Acting on behalf of {{nominator}}",
2421
- activePurposes_one: "{{count}} active purpose",
2422
- activePurposes_other: "{{count}} active purposes",
2421
+ activePurposes_one: "{{count}} \u0909\u0926\u094D\u0926\u0947\u0936",
2422
+ activePurposes_other: "{{count}} \u0909\u0926\u094D\u0926\u0947\u0936",
2423
2423
  autoSelected: "Auto-selected",
2424
2424
  noProductsAvailable: "No products available",
2425
2425
  noProductsAvailableDescription: "You have no consents to manage yet.",
@@ -2750,8 +2750,8 @@ var translation_default8 = {
2750
2750
  selectProductsForRequestGeneric: "Select one or more products to continue",
2751
2751
  yourData: "Your data",
2752
2752
  actingOnBehalfOf: "Acting on behalf of {{nominator}}",
2753
- activePurposes_one: "{{count}} active purpose",
2754
- activePurposes_other: "{{count}} active purposes",
2753
+ activePurposes_one: "{{count}} \u0AB9\u0AC7\u0AA4\u0AC1",
2754
+ activePurposes_other: "{{count}} \u0AB9\u0AC7\u0AA4\u0AC1\u0A93",
2755
2755
  autoSelected: "Auto-selected",
2756
2756
  noProductsAvailable: "No products available",
2757
2757
  noProductsAvailableDescription: "You have no consents to manage yet.",
@@ -3085,8 +3085,8 @@ var translation_default9 = {
3085
3085
  selectProductsForRequestGeneric: "Select one or more products to continue",
3086
3086
  yourData: "Your data",
3087
3087
  actingOnBehalfOf: "Acting on behalf of {{nominator}}",
3088
- activePurposes_one: "{{count}} active purpose",
3089
- activePurposes_other: "{{count}} active purposes",
3088
+ activePurposes_one: "{{count}} \u0909\u0926\u094D\u0926\u0947\u0936\u094D\u092F",
3089
+ activePurposes_other: "{{count}} \u0909\u0926\u094D\u0926\u0947\u0936\u094D\u092F",
3090
3090
  autoSelected: "Auto-selected",
3091
3091
  noProductsAvailable: "No products available",
3092
3092
  noProductsAvailableDescription: "You have no consents to manage yet.",
@@ -3417,8 +3417,8 @@ var translation_default10 = {
3417
3417
  selectProductsForRequestGeneric: "Select one or more products to continue",
3418
3418
  yourData: "Your data",
3419
3419
  actingOnBehalfOf: "Acting on behalf of {{nominator}}",
3420
- activePurposes_one: "{{count}} active purpose",
3421
- activePurposes_other: "{{count}} active purposes",
3420
+ activePurposes_one: "{{count}} \u0C89\u0CA6\u0CCD\u0CA6\u0CC7\u0CB6",
3421
+ activePurposes_other: "{{count}} \u0C89\u0CA6\u0CCD\u0CA6\u0CC7\u0CB6\u0C97\u0CB3\u0CC1",
3422
3422
  autoSelected: "Auto-selected",
3423
3423
  noProductsAvailable: "No products available",
3424
3424
  noProductsAvailableDescription: "You have no consents to manage yet.",
@@ -3749,8 +3749,8 @@ var translation_default11 = {
3749
3749
  selectProductsForRequestGeneric: "Select one or more products to continue",
3750
3750
  yourData: "Your data",
3751
3751
  actingOnBehalfOf: "Acting on behalf of {{nominator}}",
3752
- activePurposes_one: "{{count}} active purpose",
3753
- activePurposes_other: "{{count}} active purposes",
3752
+ activePurposes_one: "{{count}} \u0645\u0642\u0635\u062F",
3753
+ activePurposes_other: "{{count}} \u0645\u0642\u0627\u0635\u062F",
3754
3754
  autoSelected: "Auto-selected",
3755
3755
  noProductsAvailable: "No products available",
3756
3756
  noProductsAvailableDescription: "You have no consents to manage yet.",
@@ -4081,8 +4081,8 @@ var translation_default12 = {
4081
4081
  selectProductsForRequestGeneric: "Select one or more products to continue",
4082
4082
  yourData: "Your data",
4083
4083
  actingOnBehalfOf: "Acting on behalf of {{nominator}}",
4084
- activePurposes_one: "{{count}} active purpose",
4085
- activePurposes_other: "{{count}} active purposes",
4084
+ activePurposes_one: "{{count}} \u0909\u0926\u094D\u0926\u0947\u0936\u094D\u092F",
4085
+ activePurposes_other: "{{count}} \u0909\u0926\u094D\u0926\u0947\u0936\u094D\u092F",
4086
4086
  autoSelected: "Auto-selected",
4087
4087
  noProductsAvailable: "No products available",
4088
4088
  noProductsAvailableDescription: "You have no consents to manage yet.",
@@ -4413,8 +4413,8 @@ var translation_default13 = {
4413
4413
  selectProductsForRequestGeneric: "Select one or more products to continue",
4414
4414
  yourData: "Your data",
4415
4415
  actingOnBehalfOf: "Acting on behalf of {{nominator}}",
4416
- activePurposes_one: "{{count}} active purpose",
4417
- activePurposes_other: "{{count}} active purposes",
4416
+ activePurposes_one: "{{count}} \u0D09\u0D26\u0D4D\u0D26\u0D47\u0D36\u0D4D\u0D2F\u0D02",
4417
+ activePurposes_other: "{{count}} \u0D09\u0D26\u0D4D\u0D26\u0D47\u0D36\u0D4D\u0D2F\u0D19\u0D4D\u0D19\u0D7E",
4418
4418
  autoSelected: "Auto-selected",
4419
4419
  noProductsAvailable: "No products available",
4420
4420
  noProductsAvailableDescription: "You have no consents to manage yet.",
@@ -4745,8 +4745,8 @@ var translation_default14 = {
4745
4745
  selectProductsForRequestGeneric: "Select one or more products to continue",
4746
4746
  yourData: "Your data",
4747
4747
  actingOnBehalfOf: "Acting on behalf of {{nominator}}",
4748
- activePurposes_one: "{{count}} active purpose",
4749
- activePurposes_other: "{{count}} active purposes",
4748
+ activePurposes_one: "{{count}} \uABC4\uABE5\uABDF\uABD7\uABDD",
4749
+ activePurposes_other: "{{count}} \uABC4\uABE5\uABDF\uABD7\uABDD",
4750
4750
  autoSelected: "Auto-selected",
4751
4751
  noProductsAvailable: "No products available",
4752
4752
  noProductsAvailableDescription: "You have no consents to manage yet.",
@@ -5077,8 +5077,8 @@ var translation_default15 = {
5077
5077
  selectProductsForRequestGeneric: "Select one or more products to continue",
5078
5078
  yourData: "Your data",
5079
5079
  actingOnBehalfOf: "Acting on behalf of {{nominator}}",
5080
- activePurposes_one: "{{count}} active purpose",
5081
- activePurposes_other: "{{count}} active purposes",
5080
+ activePurposes_one: "{{count}} \u0909\u0926\u094D\u0926\u0947\u0936",
5081
+ activePurposes_other: "{{count}} \u0909\u0926\u094D\u0926\u0947\u0936",
5082
5082
  autoSelected: "Auto-selected",
5083
5083
  noProductsAvailable: "No products available",
5084
5084
  noProductsAvailableDescription: "You have no consents to manage yet.",
@@ -5409,8 +5409,8 @@ var translation_default16 = {
5409
5409
  selectProductsForRequestGeneric: "Select one or more products to continue",
5410
5410
  yourData: "Your data",
5411
5411
  actingOnBehalfOf: "Acting on behalf of {{nominator}}",
5412
- activePurposes_one: "{{count}} active purpose",
5413
- activePurposes_other: "{{count}} active purposes",
5412
+ activePurposes_one: "{{count}} \u0909\u0926\u094D\u0926\u0947\u0936\u094D\u092F",
5413
+ activePurposes_other: "{{count}} \u0909\u0926\u094D\u0926\u0947\u0936\u094D\u092F",
5414
5414
  autoSelected: "Auto-selected",
5415
5415
  noProductsAvailable: "No products available",
5416
5416
  noProductsAvailableDescription: "You have no consents to manage yet.",
@@ -5741,8 +5741,8 @@ var translation_default17 = {
5741
5741
  selectProductsForRequestGeneric: "Select one or more products to continue",
5742
5742
  yourData: "Your data",
5743
5743
  actingOnBehalfOf: "Acting on behalf of {{nominator}}",
5744
- activePurposes_one: "{{count}} active purpose",
5745
- activePurposes_other: "{{count}} active purposes",
5744
+ activePurposes_one: "{{count}} \u0B09\u0B26\u0B4D\u0B26\u0B47\u0B36\u0B4D\u0B5F",
5745
+ activePurposes_other: "{{count}} \u0B09\u0B26\u0B4D\u0B26\u0B47\u0B36\u0B4D\u0B5F\u0B17\u0B41\u0B21\u0B3C\u0B3F\u0B15",
5746
5746
  autoSelected: "Auto-selected",
5747
5747
  noProductsAvailable: "No products available",
5748
5748
  noProductsAvailableDescription: "You have no consents to manage yet.",
@@ -6073,8 +6073,8 @@ var translation_default18 = {
6073
6073
  selectProductsForRequestGeneric: "Select one or more products to continue",
6074
6074
  yourData: "Your data",
6075
6075
  actingOnBehalfOf: "Acting on behalf of {{nominator}}",
6076
- activePurposes_one: "{{count}} active purpose",
6077
- activePurposes_other: "{{count}} active purposes",
6076
+ activePurposes_one: "{{count}} \u0A2E\u0A15\u0A38\u0A26",
6077
+ activePurposes_other: "{{count}} \u0A2E\u0A15\u0A38\u0A26",
6078
6078
  autoSelected: "Auto-selected",
6079
6079
  noProductsAvailable: "No products available",
6080
6080
  noProductsAvailableDescription: "You have no consents to manage yet.",
@@ -6405,8 +6405,8 @@ var translation_default19 = {
6405
6405
  selectProductsForRequestGeneric: "Select one or more products to continue",
6406
6406
  yourData: "Your data",
6407
6407
  actingOnBehalfOf: "Acting on behalf of {{nominator}}",
6408
- activePurposes_one: "{{count}} active purpose",
6409
- activePurposes_other: "{{count}} active purposes",
6408
+ activePurposes_one: "{{count}} \u092A\u094D\u0930\u092F\u094B\u091C\u0928\u092E\u094D",
6409
+ activePurposes_other: "{{count}} \u092A\u094D\u0930\u092F\u094B\u091C\u0928\u093E\u0928\u093F",
6410
6410
  autoSelected: "Auto-selected",
6411
6411
  noProductsAvailable: "No products available",
6412
6412
  noProductsAvailableDescription: "You have no consents to manage yet.",
@@ -6737,8 +6737,8 @@ var translation_default20 = {
6737
6737
  selectProductsForRequestGeneric: "Select one or more products to continue",
6738
6738
  yourData: "Your data",
6739
6739
  actingOnBehalfOf: "Acting on behalf of {{nominator}}",
6740
- activePurposes_one: "{{count}} active purpose",
6741
- activePurposes_other: "{{count}} active purposes",
6740
+ activePurposes_one: "{{count}} \u1C6F\u1C77\u1C6E\u1C70\u1C5F\u1C5B",
6741
+ activePurposes_other: "{{count}} \u1C6F\u1C77\u1C6E\u1C70\u1C5F\u1C5B",
6742
6742
  autoSelected: "Auto-selected",
6743
6743
  noProductsAvailable: "No products available",
6744
6744
  noProductsAvailableDescription: "You have no consents to manage yet.",
@@ -7069,8 +7069,8 @@ var translation_default21 = {
7069
7069
  selectProductsForRequestGeneric: "Select one or more products to continue",
7070
7070
  yourData: "Your data",
7071
7071
  actingOnBehalfOf: "Acting on behalf of {{nominator}}",
7072
- activePurposes_one: "{{count}} active purpose",
7073
- activePurposes_other: "{{count}} active purposes",
7072
+ activePurposes_one: "{{count}} \u0645\u0642\u0635\u062F",
7073
+ activePurposes_other: "{{count}} \u0645\u0642\u0635\u062F",
7074
7074
  autoSelected: "Auto-selected",
7075
7075
  noProductsAvailable: "No products available",
7076
7076
  noProductsAvailableDescription: "You have no consents to manage yet.",
@@ -7401,8 +7401,8 @@ var translation_default22 = {
7401
7401
  selectProductsForRequestGeneric: "Select one or more products to continue",
7402
7402
  yourData: "Your data",
7403
7403
  actingOnBehalfOf: "Acting on behalf of {{nominator}}",
7404
- activePurposes_one: "{{count}} active purpose",
7405
- activePurposes_other: "{{count}} active purposes",
7404
+ activePurposes_one: "{{count}} \u0BA8\u0BCB\u0B95\u0BCD\u0B95\u0BAE\u0BCD",
7405
+ activePurposes_other: "{{count}} \u0BA8\u0BCB\u0B95\u0BCD\u0B95\u0B99\u0BCD\u0B95\u0BB3\u0BCD",
7406
7406
  autoSelected: "Auto-selected",
7407
7407
  noProductsAvailable: "No products available",
7408
7408
  noProductsAvailableDescription: "You have no consents to manage yet.",
@@ -7733,8 +7733,8 @@ var translation_default23 = {
7733
7733
  selectProductsForRequestGeneric: "Select one or more products to continue",
7734
7734
  yourData: "Your data",
7735
7735
  actingOnBehalfOf: "Acting on behalf of {{nominator}}",
7736
- activePurposes_one: "{{count}} active purpose",
7737
- activePurposes_other: "{{count}} active purposes",
7736
+ activePurposes_one: "{{count}} \u0C09\u0C26\u0C4D\u0C26\u0C47\u0C36\u0C4D\u0C2F\u0C02",
7737
+ activePurposes_other: "{{count}} \u0C09\u0C26\u0C4D\u0C26\u0C47\u0C36\u0C4D\u0C2F\u0C3E\u0C32\u0C41",
7738
7738
  autoSelected: "Auto-selected",
7739
7739
  noProductsAvailable: "No products available",
7740
7740
  noProductsAvailableDescription: "You have no consents to manage yet.",
@@ -8065,8 +8065,8 @@ var translation_default24 = {
8065
8065
  selectProductsForRequestGeneric: "Select one or more products to continue",
8066
8066
  yourData: "Your data",
8067
8067
  actingOnBehalfOf: "Acting on behalf of {{nominator}}",
8068
- activePurposes_one: "{{count}} active purpose",
8069
- activePurposes_other: "{{count}} active purposes",
8068
+ activePurposes_one: "{{count}} \u0645\u0642\u0635\u062F",
8069
+ activePurposes_other: "{{count}} \u0645\u0642\u0627\u0635\u062F",
8070
8070
  autoSelected: "Auto-selected",
8071
8071
  noProductsAvailable: "No products available",
8072
8072
  noProductsAvailableDescription: "You have no consents to manage yet.",
@@ -8692,7 +8692,7 @@ var getFormData = async (organizationId, workspaceId, contact, _isPopup, useSess
8692
8692
  return null;
8693
8693
  }
8694
8694
  };
8695
- var createCaseRequestUnsafe = async (organizationId, workspaceId, data, _isPopup, useSessionAuth, authContext, consentClient) => {
8695
+ var createCaseRequest = async (organizationId, workspaceId, data, _isPopup, useSessionAuth, authContext, consentClient) => {
8696
8696
  try {
8697
8697
  if (useSessionAuth) {
8698
8698
  return await createCaseRequestServer(organizationId, workspaceId, data, void 0, true, consentClient);
@@ -8713,31 +8713,20 @@ var createCaseRequestUnsafe = async (organizationId, workspaceId, data, _isPopup
8713
8713
  const shouldRetry = await handleClientAuthError(error, organizationId, workspaceId, authContext, consentClient);
8714
8714
  if (shouldRetry) {
8715
8715
  const newAuthToken = sessionStorage.getItem("access_token") || (authContext == null ? void 0 : authContext.accessToken) || "";
8716
- return await createCaseRequestServer(
8717
- organizationId,
8718
- workspaceId,
8719
- data,
8720
- newAuthToken,
8721
- false,
8722
- consentClient
8723
- );
8716
+ try {
8717
+ return await createCaseRequestServer(
8718
+ organizationId,
8719
+ workspaceId,
8720
+ data,
8721
+ newAuthToken,
8722
+ false,
8723
+ consentClient
8724
+ );
8725
+ } catch (retryError) {
8726
+ console.error("Error creating case request after auth refresh:", retryError);
8727
+ return null;
8728
+ }
8724
8729
  }
8725
- console.error("Error creating case request:", error);
8726
- throw error;
8727
- }
8728
- };
8729
- var createCaseRequest = async (organizationId, workspaceId, data, isPopup, useSessionAuth, authContext, consentClient) => {
8730
- try {
8731
- return await createCaseRequestUnsafe(
8732
- organizationId,
8733
- workspaceId,
8734
- data,
8735
- isPopup,
8736
- useSessionAuth,
8737
- authContext,
8738
- consentClient
8739
- );
8740
- } catch (error) {
8741
8730
  console.error("Error creating case request:", error);
8742
8731
  return null;
8743
8732
  }
@@ -18668,7 +18657,7 @@ function ProductSelectionSection({
18668
18657
  children: [
18669
18658
  directGroups.map((group) => {
18670
18659
  const key = productGroupKey(group);
18671
- const activeCount = buildGroupPurposes(group).length;
18660
+ const purposeCount = buildGroupPurposes(group).length;
18672
18661
  return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
18673
18662
  ProductChip,
18674
18663
  {
@@ -18676,7 +18665,7 @@ function ProductSelectionSection({
18676
18665
  isSelected: selectedProductKey === key || isSingleGroup,
18677
18666
  isLocked: isSingleGroup,
18678
18667
  onSelect,
18679
- activePurposesLabel: t("activePurposes", { count: activeCount })
18668
+ activePurposesLabel: t("activePurposes", { count: purposeCount })
18680
18669
  },
18681
18670
  key
18682
18671
  );
@@ -18684,7 +18673,7 @@ function ProductSelectionSection({
18684
18673
  nominatedGroups.map((group) => {
18685
18674
  var _a2, _b2, _c, _d;
18686
18675
  const key = productGroupKey(group);
18687
- const activeCount = buildGroupPurposes(group).length;
18676
+ const purposeCount = buildGroupPurposes(group).length;
18688
18677
  const nominatorLabel = (_d = (_c = (_a2 = group.nominator) == null ? void 0 : _a2.name) != null ? _c : (_b2 = group.nominator) == null ? void 0 : _b2.email) != null ? _d : "";
18689
18678
  return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
18690
18679
  ProductChip,
@@ -18696,7 +18685,7 @@ function ProductSelectionSection({
18696
18685
  nominationSuffix: t("nominationChipSuffix", {
18697
18686
  nominator: nominatorLabel
18698
18687
  }),
18699
- activePurposesLabel: t("activePurposes", { count: activeCount })
18688
+ activePurposesLabel: t("activePurposes", { count: purposeCount })
18700
18689
  },
18701
18690
  key
18702
18691
  );
@@ -18999,227 +18988,14 @@ var import_react_i18next29 = require("react-i18next");
18999
18988
  var import_lucide_react15 = require("lucide-react");
19000
18989
  var import_jsx_runtime59 = require("react/jsx-runtime");
19001
18990
  var getVar20 = (varName) => `var(${varName})`;
19002
- var SummaryCard = ({
19003
- children,
19004
- backgroundColor,
19005
- borderColor
19006
- }) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
19007
- "div",
19008
- {
19009
- style: {
19010
- marginTop: pcStyles.mtMd.marginTop,
19011
- padding: pcStyles.pSm.padding,
19012
- ...backgroundColor === void 0 ? pcStyles.bgSecondary : { backgroundColor },
19013
- borderRadius: pcStyles.borderRadiusMd,
19014
- border: `1px solid ${borderColor != null ? borderColor : pcStyles.borderColor}`
19015
- },
19016
- children
19017
- }
19018
- );
19019
18991
  function RequestSubmit({
19020
18992
  result,
19021
18993
  contact,
19022
18994
  onCreateRequest,
19023
- onRetry,
19024
- retryingGroupKeys,
19025
18995
  revokeConsentOnFulfilment,
19026
18996
  revokedPurposeNames
19027
18997
  }) {
19028
18998
  const { t } = (0, import_react_i18next29.useTranslation)();
19029
- const succeeded = result.succeeded;
19030
- const failed = result.failed;
19031
- const successCount = succeeded.length;
19032
- const hasFailures = failed.length > 0;
19033
- const isSingleCase = successCount === 1 && !hasFailures;
19034
- const renderCaseList = () => {
19035
- if (successCount === 0) {
19036
- return null;
19037
- }
19038
- if (isSingleCase) {
19039
- const only = succeeded[0];
19040
- return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(SummaryCard, { children: [
19041
- only.product_name !== "" && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
19042
- PCText,
19043
- {
19044
- size: "sm",
19045
- weight: "medium",
19046
- style: {
19047
- marginBottom: pcStyles.mbXs.marginBottom,
19048
- wordBreak: "break-word"
19049
- },
19050
- children: only.product_name
19051
- }
19052
- ),
19053
- /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
19054
- PCText,
19055
- {
19056
- size: "base",
19057
- weight: "bold",
19058
- style: {
19059
- color: pcStyles.primary,
19060
- wordBreak: "break-word",
19061
- marginBottom: pcStyles.mbXs.marginBottom
19062
- },
19063
- className: "pc-text-responsive",
19064
- children: [
19065
- t("caseID"),
19066
- ": ",
19067
- only.case_id
19068
- ]
19069
- }
19070
- ),
19071
- /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(PCText, { size: "xs", weight: "medium", color: "secondary", children: [
19072
- t("saveThisID"),
19073
- "."
19074
- ] })
19075
- ] });
19076
- }
19077
- return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(SummaryCard, { children: [
19078
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
19079
- PCText,
19080
- {
19081
- size: "sm",
19082
- weight: "semibold",
19083
- style: {
19084
- color: pcStyles.primary,
19085
- marginBottom: pcStyles.mbSm.marginBottom
19086
- },
19087
- children: t("casesCreatedCount", { count: successCount })
19088
- }
19089
- ),
19090
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
19091
- "ul",
19092
- {
19093
- style: {
19094
- margin: 0,
19095
- padding: 0,
19096
- listStyle: "none",
19097
- display: "flex",
19098
- flexDirection: "column",
19099
- gap: getVar20("--pc-spacing-xs")
19100
- },
19101
- children: succeeded.map((entry) => /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
19102
- "li",
19103
- {
19104
- style: { wordBreak: "break-word" },
19105
- children: [
19106
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(PCText, { size: "sm", weight: "medium", children: entry.product_name }),
19107
- /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
19108
- PCText,
19109
- {
19110
- size: "sm",
19111
- weight: "bold",
19112
- style: { color: pcStyles.primary, wordBreak: "break-word" },
19113
- children: [
19114
- t("caseID"),
19115
- ": ",
19116
- entry.case_id
19117
- ]
19118
- }
19119
- )
19120
- ]
19121
- },
19122
- `${entry.group_key}:${entry.case_id}`
19123
- ))
19124
- }
19125
- ),
19126
- /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
19127
- PCText,
19128
- {
19129
- size: "xs",
19130
- weight: "medium",
19131
- color: "secondary",
19132
- style: { marginTop: pcStyles.mtSm.marginTop },
19133
- children: [
19134
- t("saveThisID"),
19135
- "."
19136
- ]
19137
- }
19138
- )
19139
- ] });
19140
- };
19141
- const renderFailures = () => {
19142
- if (!hasFailures) {
19143
- return null;
19144
- }
19145
- return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
19146
- SummaryCard,
19147
- {
19148
- backgroundColor: pcStyles.warningBg,
19149
- borderColor: pcStyles.warningBorder,
19150
- children: [
19151
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
19152
- PCText,
19153
- {
19154
- size: "sm",
19155
- weight: "semibold",
19156
- style: {
19157
- color: pcStyles.warningText,
19158
- marginBottom: pcStyles.mbSm.marginBottom
19159
- },
19160
- children: t("someRequestsFailed")
19161
- }
19162
- ),
19163
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
19164
- "ul",
19165
- {
19166
- style: {
19167
- margin: 0,
19168
- padding: 0,
19169
- listStyle: "none",
19170
- display: "flex",
19171
- flexDirection: "column",
19172
- gap: getVar20("--pc-spacing-sm")
19173
- },
19174
- children: failed.map((entry) => {
19175
- const isRetrying = (retryingGroupKeys == null ? void 0 : retryingGroupKeys.has(entry.group_key)) === true;
19176
- return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
19177
- "li",
19178
- {
19179
- style: {
19180
- display: "flex",
19181
- alignItems: "flex-start",
19182
- justifyContent: "space-between",
19183
- gap: getVar20("--pc-spacing-sm"),
19184
- flexWrap: "wrap"
19185
- },
19186
- children: [
19187
- /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
19188
- "div",
19189
- {
19190
- style: {
19191
- minWidth: 0,
19192
- flex: 1,
19193
- wordBreak: "break-word"
19194
- },
19195
- children: [
19196
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(PCText, { size: "sm", weight: "medium", children: entry.product_name }),
19197
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(PCText, { size: "xs", weight: "medium", color: "secondary", children: entry.error })
19198
- ]
19199
- }
19200
- ),
19201
- onRetry !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
19202
- PCButton,
19203
- {
19204
- variant: "outline",
19205
- size: "sm",
19206
- onClick: () => onRetry(entry.group_key),
19207
- disabled: isRetrying,
19208
- isLoading: isRetrying,
19209
- children: isRetrying ? t("retrying") : t("retry")
19210
- }
19211
- )
19212
- ]
19213
- },
19214
- entry.group_key
19215
- );
19216
- })
19217
- }
19218
- )
19219
- ]
19220
- }
19221
- );
19222
- };
19223
18999
  return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { style: { marginTop: pcStyles.mtMd.marginTop, position: "relative" }, children: [
19224
19000
  /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
19225
19001
  "img",
@@ -19327,8 +19103,54 @@ function RequestSubmit({
19327
19103
  ]
19328
19104
  }
19329
19105
  ),
19330
- renderCaseList(),
19331
- renderFailures(),
19106
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
19107
+ "div",
19108
+ {
19109
+ style: {
19110
+ marginTop: pcStyles.mtMd.marginTop,
19111
+ padding: pcStyles.pSm.padding,
19112
+ ...pcStyles.bgSecondary,
19113
+ borderRadius: pcStyles.borderRadiusMd,
19114
+ border: `1px solid ${pcStyles.borderColor}`
19115
+ },
19116
+ children: [
19117
+ result.product_name !== "" && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
19118
+ PCText,
19119
+ {
19120
+ size: "sm",
19121
+ weight: "medium",
19122
+ style: {
19123
+ marginBottom: pcStyles.mbXs.marginBottom,
19124
+ wordBreak: "break-word"
19125
+ },
19126
+ children: result.product_name
19127
+ }
19128
+ ),
19129
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
19130
+ PCText,
19131
+ {
19132
+ size: "base",
19133
+ weight: "bold",
19134
+ style: {
19135
+ color: pcStyles.primary,
19136
+ wordBreak: "break-word",
19137
+ marginBottom: pcStyles.mbXs.marginBottom
19138
+ },
19139
+ className: "pc-text-responsive",
19140
+ children: [
19141
+ t("caseID"),
19142
+ ": ",
19143
+ result.case_id
19144
+ ]
19145
+ }
19146
+ ),
19147
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(PCText, { size: "xs", weight: "medium", color: "secondary", children: [
19148
+ t("saveThisID"),
19149
+ "."
19150
+ ] })
19151
+ ]
19152
+ }
19153
+ ),
19332
19154
  /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
19333
19155
  "div",
19334
19156
  {
@@ -19485,12 +19307,12 @@ function RequestSubmit({
19485
19307
  var import_fi = require("react-icons/fi");
19486
19308
  var import_jsx_runtime60 = require("react/jsx-runtime");
19487
19309
  var getVar21 = (varName) => `var(${varName})`;
19488
- var GROUPED_REQUEST_TYPES = /* @__PURE__ */ new Set([
19310
+ var PRODUCT_SCOPED_REQUEST_TYPES = /* @__PURE__ */ new Set([
19489
19311
  "ACCESS" /* ACCESS */,
19490
19312
  "erasure" /* ERASURE */,
19491
19313
  "CORRECTION" /* CORRECTION */
19492
19314
  ]);
19493
- var isGroupedRequestType = (rt) => rt !== null && GROUPED_REQUEST_TYPES.has(rt);
19315
+ var isProductScopedRequestType = (rt) => rt !== null && PRODUCT_SCOPED_REQUEST_TYPES.has(rt);
19494
19316
  var extractCaseId = (response) => {
19495
19317
  var _a, _b, _c, _d;
19496
19318
  if (!response) {
@@ -19545,28 +19367,17 @@ function Form({
19545
19367
  additionalNote: "",
19546
19368
  confirmCheckBox: false
19547
19369
  });
19548
- const [erasurePurposes, setErasurePurposes] = (0, import_react39.useState)([]);
19549
- const [accessPurposes, setAccessPurposes] = (0, import_react39.useState)([]);
19550
19370
  const [selectedProductKey, setSelectedProductKey] = (0, import_react39.useState)(
19551
19371
  null
19552
19372
  );
19553
- const [purposesByGroupKey, setPurposesByGroupKey] = (0, import_react39.useState)(/* @__PURE__ */ new Map());
19373
+ const [selectedPurposes, setSelectedPurposes] = (0, import_react39.useState)([]);
19554
19374
  const [selectedCorrectionElements, setSelectedCorrectionElements] = (0, import_react39.useState)([]);
19555
- const [uniqueDataElements, setUniqueDataElements] = (0, import_react39.useState)(
19556
- []
19557
- );
19558
19375
  const [correctionValues, setCorrectionValues] = (0, import_react39.useState)({});
19559
- const [correctionElementsByGroupKey, setCorrectionElementsByGroupKey] = (0, import_react39.useState)(/* @__PURE__ */ new Map());
19560
- const [correctionValuesByGroupKey, setCorrectionValuesByGroupKey] = (0, import_react39.useState)(/* @__PURE__ */ new Map());
19561
- const [batchResult, setBatchResult] = (0, import_react39.useState)(
19376
+ const [submittedCase, setSubmittedCase] = (0, import_react39.useState)(
19562
19377
  null
19563
19378
  );
19564
- const [retryingGroupKeys, setRetryingGroupKeys] = (0, import_react39.useState)(
19565
- /* @__PURE__ */ new Set()
19566
- );
19567
19379
  const fileInputRef = (0, import_react39.useRef)(null);
19568
19380
  const englishDataRef = (0, import_react39.useRef)(null);
19569
- const selectionsToRestoreRef = (0, import_react39.useRef)(null);
19570
19381
  const [uploadedDocumentId, setUploadedDocumentId] = (0, import_react39.useState)([]);
19571
19382
  const [uploadedDocuments, setUploadedDocuments] = (0, import_react39.useState)([]);
19572
19383
  const [isDocumentUploading, setIsDocumentUploading] = (0, import_react39.useState)(false);
@@ -19590,127 +19401,30 @@ function Form({
19590
19401
  fileInputRef.current.value = "";
19591
19402
  }
19592
19403
  };
19593
- const useGroupedRender = (0, import_react39.useMemo)(
19594
- () => Array.isArray(data == null ? void 0 : data.direct_groups),
19595
- [data]
19596
- );
19597
- (0, import_react39.useEffect)(() => {
19598
- if (data && !useGroupedRender) {
19599
- console.warn(
19600
- "[consent-sdk] Backend response lacks direct_groups; falling back to legacy flat-purposes render. Update consent-server to Phase 1 to enable product-scoped DSAR."
19601
- );
19602
- }
19603
- }, [data, useGroupedRender]);
19604
19404
  const allGroups = (0, import_react39.useMemo)(() => {
19605
19405
  var _a2, _b2;
19606
- if (!useGroupedRender || !data) {
19406
+ if (!data) {
19607
19407
  return [];
19608
19408
  }
19609
19409
  return [...(_a2 = data.direct_groups) != null ? _a2 : [], ...(_b2 = data.nominated_groups) != null ? _b2 : []];
19610
- }, [data, useGroupedRender]);
19611
- const totalGroups = (0, import_react39.useMemo)(
19612
- () => {
19613
- var _a2, _b2, _c2, _d2;
19614
- return ((_b2 = (_a2 = data == null ? void 0 : data.direct_groups) == null ? void 0 : _a2.length) != null ? _b2 : 0) + ((_d2 = (_c2 = data == null ? void 0 : data.nominated_groups) == null ? void 0 : _c2.length) != null ? _d2 : 0);
19615
- },
19616
- [data]
19617
- );
19618
- const skipProductStep = totalGroups === 1;
19619
- const selectedGroups = (0, import_react39.useMemo)(() => {
19620
- var _a2, _b2, _c2;
19410
+ }, [data]);
19411
+ const skipProductStep = allGroups.length === 1;
19412
+ const selectedGroup = (0, import_react39.useMemo)(() => {
19413
+ var _a2, _b2;
19621
19414
  if (selectedProductKey) {
19622
- const group = allGroups.find(
19623
- (g) => productGroupKey(g) === selectedProductKey
19624
- );
19625
- if (group) {
19626
- return [group];
19627
- }
19415
+ return (_a2 = allGroups.find((g) => productGroupKey(g) === selectedProductKey)) != null ? _a2 : null;
19628
19416
  }
19629
19417
  if (skipProductStep) {
19630
- const onlyGroup = (_c2 = (_a2 = data == null ? void 0 : data.direct_groups) == null ? void 0 : _a2[0]) != null ? _c2 : (_b2 = data == null ? void 0 : data.nominated_groups) == null ? void 0 : _b2[0];
19631
- return onlyGroup ? [onlyGroup] : [];
19418
+ return (_b2 = allGroups[0]) != null ? _b2 : null;
19632
19419
  }
19633
- return [];
19634
- }, [allGroups, selectedProductKey, skipProductStep, data]);
19420
+ return null;
19421
+ }, [allGroups, selectedProductKey, skipProductStep]);
19635
19422
  const handleProductSelect = (0, import_react39.useCallback)(
19636
19423
  (key, _group) => {
19637
19424
  setSelectedProductKey(key);
19638
19425
  },
19639
19426
  []
19640
19427
  );
19641
- const setPurposesForGroup = (0, import_react39.useCallback)(
19642
- (key, updated) => {
19643
- setPurposesByGroupKey((prev) => {
19644
- const next = new Map(prev);
19645
- next.set(key, updated);
19646
- return next;
19647
- });
19648
- },
19649
- []
19650
- );
19651
- const setCorrectionElementsForGroup = (0, import_react39.useCallback)(
19652
- (key, values) => {
19653
- setCorrectionElementsByGroupKey((prev) => {
19654
- const next = new Map(prev);
19655
- next.set(key, values);
19656
- return next;
19657
- });
19658
- },
19659
- []
19660
- );
19661
- const setCorrectionValuesForGroup = (0, import_react39.useCallback)(
19662
- (key, values) => {
19663
- setCorrectionValuesByGroupKey((prev) => {
19664
- const next = new Map(prev);
19665
- next.set(key, values);
19666
- return next;
19667
- });
19668
- },
19669
- []
19670
- );
19671
- (0, import_react39.useEffect)(() => {
19672
- if (data == null ? void 0 : data.purposes) {
19673
- if (!Array.isArray(data.purposes)) {
19674
- console.warn("Form data purposes is not an array:", data.purposes);
19675
- return;
19676
- }
19677
- const extractedPurposes = data.purposes.map((p) => p == null ? void 0 : p.purpose).filter((p) => p !== null && p !== void 0);
19678
- if (extractedPurposes.length === 0) {
19679
- console.warn("No valid purposes found in form data");
19680
- return;
19681
- }
19682
- const uniqueElements = /* @__PURE__ */ new Map();
19683
- extractedPurposes.forEach((purpose) => {
19684
- const validDataElements = Array.isArray(purpose.data_elements) ? purpose.data_elements.filter(
19685
- (element) => element !== null && element !== void 0 && element.uuid
19686
- ) : [];
19687
- validDataElements.forEach((element) => {
19688
- if (element.uuid && !uniqueElements.has(element.uuid)) {
19689
- uniqueElements.set(element.uuid, {
19690
- ...element,
19691
- purposeName: purpose.name
19692
- });
19693
- }
19694
- });
19695
- });
19696
- setUniqueDataElements(
19697
- Array.from(uniqueElements.values())
19698
- );
19699
- const processedPurposes = extractedPurposes.map((p) => {
19700
- const validDataElements = Array.isArray(p.data_elements) ? p.data_elements.filter((de) => de !== null && de !== void 0 && de.uuid).map((de) => ({
19701
- ...de,
19702
- selected: false
19703
- })) : [];
19704
- return {
19705
- ...p,
19706
- selected: false,
19707
- data_elements: validDataElements
19708
- };
19709
- }).filter((p) => p.data_elements.length > 0);
19710
- setAccessPurposes(processedPurposes);
19711
- setErasurePurposes(processedPurposes);
19712
- }
19713
- }, [data]);
19714
19428
  const fetchAndApplyTranslations = (0, import_react39.useCallback)(async (langValue) => {
19715
19429
  if (!organizationId || !workspaceId || !data) {
19716
19430
  return;
@@ -19735,28 +19449,6 @@ function Form({
19735
19449
  toast.info(t("translationNotAvailable"));
19736
19450
  return;
19737
19451
  }
19738
- const currentAccessSelections = /* @__PURE__ */ new Map();
19739
- const currentErasureSelections = /* @__PURE__ */ new Map();
19740
- accessPurposes.forEach((purpose) => {
19741
- const dataElementSelections = /* @__PURE__ */ new Map();
19742
- purpose.data_elements.forEach((de) => {
19743
- dataElementSelections.set(de.uuid, de.selected);
19744
- });
19745
- currentAccessSelections.set(purpose.uuid, {
19746
- purposeSelected: purpose.selected,
19747
- dataElementSelections
19748
- });
19749
- });
19750
- erasurePurposes.forEach((purpose) => {
19751
- const dataElementSelections = /* @__PURE__ */ new Map();
19752
- purpose.data_elements.forEach((de) => {
19753
- dataElementSelections.set(de.uuid, de.selected);
19754
- });
19755
- currentErasureSelections.set(purpose.uuid, {
19756
- purposeSelected: purpose.selected,
19757
- dataElementSelections
19758
- });
19759
- });
19760
19452
  if (!translatedFormData.purposes || !Array.isArray(translatedFormData.purposes) || translatedFormData.purposes.length === 0) {
19761
19453
  toast.info(t("translationNotAvailable"));
19762
19454
  return;
@@ -19771,119 +19463,51 @@ function Form({
19771
19463
  });
19772
19464
  setSelectedGrievances(updatedGrievanceSelections);
19773
19465
  }
19774
- selectionsToRestoreRef.current = {
19775
- access: currentAccessSelections,
19776
- erasure: currentErasureSelections
19777
- };
19778
19466
  } catch (error) {
19779
19467
  console.error("Error fetching translation:", error);
19780
19468
  toast.info(t("translationNotAvailable"));
19781
19469
  } finally {
19782
19470
  setIsTranslating(false);
19783
19471
  }
19784
- }, [organizationId, workspaceId, data, formData.contact, isPopup, isCaseManagementContext, authContext, consentClient, accessPurposes, erasurePurposes, selectedGrievances, t]);
19472
+ }, [organizationId, workspaceId, data, formData.contact, isPopup, isCaseManagementContext, authContext, consentClient, selectedGrievances, t]);
19785
19473
  (0, import_react39.useEffect)(() => {
19786
- setSelectedCorrectionElements([]);
19787
- setCorrectionValues({});
19474
+ if (!skipProductStep) {
19475
+ setSelectedProductKey(null);
19476
+ }
19788
19477
  setNominationData({ nominee_email: "", nominee_mobile: "" });
19789
- setSelectedProductKey(null);
19790
- setPurposesByGroupKey(/* @__PURE__ */ new Map());
19791
- setCorrectionElementsByGroupKey(/* @__PURE__ */ new Map());
19792
- setCorrectionValuesByGroupKey(/* @__PURE__ */ new Map());
19793
- if ((data == null ? void 0 : data.purposes) && Array.isArray(data.purposes)) {
19794
- const extractedPurposes = data.purposes.map((p) => p == null ? void 0 : p.purpose).filter((p) => p !== null && p !== void 0);
19795
- const processedPurposes = extractedPurposes.map((p) => {
19796
- const validDataElements = Array.isArray(p.data_elements) ? p.data_elements.filter((de) => de !== null && de !== void 0 && de.uuid).map((de) => ({
19797
- ...de,
19798
- selected: false
19799
- })) : [];
19800
- return {
19801
- ...p,
19802
- selected: false,
19803
- data_elements: validDataElements
19804
- };
19805
- }).filter((p) => p.data_elements.length > 0);
19806
- setAccessPurposes(processedPurposes);
19807
- setErasurePurposes(processedPurposes);
19808
- if (requestType === "grievance" /* GRIEVANCE */ && grievanceOptions.length > 0) {
19809
- const resetGrievances = grievanceOptions.reduce(
19810
- (acc, option) => {
19811
- acc[option.value] = false;
19812
- return acc;
19813
- },
19814
- {}
19815
- );
19816
- setSelectedGrievances(resetGrievances);
19817
- }
19478
+ if (requestType === "grievance" /* GRIEVANCE */ && grievanceOptions.length > 0) {
19479
+ const resetGrievances = grievanceOptions.reduce(
19480
+ (acc, option) => {
19481
+ acc[option.value] = false;
19482
+ return acc;
19483
+ },
19484
+ {}
19485
+ );
19486
+ setSelectedGrievances(resetGrievances);
19818
19487
  }
19819
- }, [requestType, data, grievanceOptions]);
19488
+ }, [requestType, grievanceOptions, skipProductStep]);
19820
19489
  (0, import_react39.useEffect)(() => {
19821
- var _a2, _b2, _c2;
19822
19490
  if (!skipProductStep) {
19823
19491
  return;
19824
19492
  }
19825
- const onlyGroup = (_c2 = (_a2 = data == null ? void 0 : data.direct_groups) == null ? void 0 : _a2[0]) != null ? _c2 : (_b2 = data == null ? void 0 : data.nominated_groups) == null ? void 0 : _b2[0];
19493
+ const onlyGroup = allGroups[0];
19826
19494
  if (!onlyGroup) {
19827
19495
  return;
19828
19496
  }
19829
19497
  const key = productGroupKey(onlyGroup);
19830
19498
  setSelectedProductKey((prev) => prev === key ? prev : key);
19831
- }, [skipProductStep, data, requestType]);
19832
- (0, import_react39.useEffect)(() => {
19833
- setPurposesByGroupKey((prev) => {
19834
- const next = new Map(prev);
19835
- const selectedKeys = /* @__PURE__ */ new Set();
19836
- for (const group of selectedGroups) {
19837
- const key = productGroupKey(group);
19838
- selectedKeys.add(key);
19839
- if (!next.has(key)) {
19840
- next.set(key, buildGroupPurposes(group));
19841
- }
19842
- }
19843
- for (const existingKey of Array.from(next.keys())) {
19844
- if (!selectedKeys.has(existingKey)) {
19845
- next.delete(existingKey);
19846
- }
19847
- }
19848
- return next;
19849
- });
19850
- }, [selectedGroups]);
19499
+ }, [skipProductStep, allGroups, requestType]);
19851
19500
  (0, import_react39.useEffect)(() => {
19852
- setCorrectionElementsByGroupKey((prev) => {
19853
- const next = new Map(prev);
19854
- const selectedKeys = /* @__PURE__ */ new Set();
19855
- for (const group of selectedGroups) {
19856
- const key = productGroupKey(group);
19857
- selectedKeys.add(key);
19858
- if (!next.has(key)) {
19859
- next.set(key, []);
19860
- }
19861
- }
19862
- for (const existingKey of Array.from(next.keys())) {
19863
- if (!selectedKeys.has(existingKey)) {
19864
- next.delete(existingKey);
19865
- }
19866
- }
19867
- return next;
19868
- });
19869
- setCorrectionValuesByGroupKey((prev) => {
19870
- const next = new Map(prev);
19871
- const selectedKeys = /* @__PURE__ */ new Set();
19872
- for (const group of selectedGroups) {
19873
- const key = productGroupKey(group);
19874
- selectedKeys.add(key);
19875
- if (!next.has(key)) {
19876
- next.set(key, {});
19877
- }
19878
- }
19879
- for (const existingKey of Array.from(next.keys())) {
19880
- if (!selectedKeys.has(existingKey)) {
19881
- next.delete(existingKey);
19882
- }
19883
- }
19884
- return next;
19885
- });
19886
- }, [selectedGroups]);
19501
+ if (!selectedGroup || !isProductScopedRequestType(requestType)) {
19502
+ setSelectedPurposes([]);
19503
+ setSelectedCorrectionElements([]);
19504
+ setCorrectionValues({});
19505
+ return;
19506
+ }
19507
+ setSelectedPurposes(buildGroupPurposes(selectedGroup));
19508
+ setSelectedCorrectionElements([]);
19509
+ setCorrectionValues({});
19510
+ }, [selectedGroup, requestType]);
19887
19511
  (0, import_react39.useEffect)(() => {
19888
19512
  const handleLanguageChanged = () => {
19889
19513
  const lang = i18n_default.language;
@@ -20002,56 +19626,22 @@ function Form({
20002
19626
  if (!isFormValid) {
20003
19627
  return;
20004
19628
  }
20005
- void handleSubmit(false);
19629
+ void handleSubmit(requestType === "erasure" /* ERASURE */);
20006
19630
  };
20007
19631
  const handleSubmit = async (revokeConsent = false) => {
20008
- var _a2, _b2;
19632
+ var _a2, _b2, _c2, _d2;
20009
19633
  if (!isFormValid) {
20010
19634
  return;
20011
19635
  }
20012
- if (useGroupedRender && isGroupedRequestType(requestType) && selectedGroups.length > 0) {
20013
- try {
20014
- setIsLoading(true);
20015
- const result = await submitBatchCases(revokeConsent);
20016
- if (result.succeeded.length > 0) {
20017
- queryClient.invalidateQueries({ queryKey: ["caseHistory"] });
20018
- setBatchResult(result);
20019
- setIsSubmitted(true);
20020
- if (result.failed.length === 0) {
20021
- toast.success(t("requestSubmittedSuccess"));
20022
- } else {
20023
- toast.error(t("requestSubmissionFailed"));
20024
- }
20025
- if (isPopup) {
20026
- onCreateRequest == null ? void 0 : onCreateRequest();
20027
- }
20028
- } else {
20029
- toast.error(t("requestSubmissionFailed"));
20030
- }
20031
- } catch (error) {
20032
- console.error("Error submitting batch request:", error);
20033
- toast.error(t("submissionFailed"));
20034
- } finally {
20035
- setIsLoading(false);
20036
- if (isPopup) {
20037
- onClose == null ? void 0 : onClose();
20038
- }
20039
- }
20040
- return;
20041
- }
19636
+ const isProductScoped = isProductScopedRequestType(requestType);
19637
+ const anchorGroup = isProductScoped ? selectedGroup : null;
20042
19638
  const requestDetails = {
20043
19639
  purposes: [],
20044
19640
  correction_data: [],
20045
19641
  grievance_types: []
20046
19642
  };
20047
- if (requestType === "ACCESS" /* ACCESS */) {
20048
- requestDetails.purposes = accessPurposes.filter((p) => p.selected || p.data_elements.some((de) => de.selected)).map((p) => ({
20049
- purpose_uuid: p.uuid,
20050
- data_element_uuids: p.data_elements.filter((de) => de.selected).map((de) => de.uuid)
20051
- }));
20052
- }
20053
- if (requestType === "erasure" /* ERASURE */) {
20054
- requestDetails.purposes = erasurePurposes.filter((p) => p.selected || p.data_elements.some((de) => de.selected)).map((p) => ({
19643
+ if (requestType === "ACCESS" /* ACCESS */ || requestType === "erasure" /* ERASURE */) {
19644
+ requestDetails.purposes = selectedPurposes.filter((p) => p.selected || p.data_elements.some((de) => de.selected)).map((p) => ({
20055
19645
  purpose_uuid: p.uuid,
20056
19646
  data_element_uuids: p.data_elements.filter((de) => de.selected).map((de) => de.uuid)
20057
19647
  }));
@@ -20059,11 +19649,11 @@ function Form({
20059
19649
  if (requestType === "CORRECTION" /* CORRECTION */) {
20060
19650
  requestDetails.correction_data = selectedCorrectionElements.map(
20061
19651
  (name) => {
20062
- var _a3, _b3;
19652
+ var _a3, _b3, _c3, _d3;
20063
19653
  return {
20064
19654
  name: getEnglishDataElementName(name),
20065
- curr_value: ((_a3 = correctionValues[name]) == null ? void 0 : _a3.current) || "",
20066
- new_value: ((_b3 = correctionValues[name]) == null ? void 0 : _b3.updated) || ""
19655
+ curr_value: (_b3 = (_a3 = correctionValues[name]) == null ? void 0 : _a3.current) != null ? _b3 : "",
19656
+ new_value: (_d3 = (_c3 = correctionValues[name]) == null ? void 0 : _c3.updated) != null ? _d3 : ""
20067
19657
  };
20068
19658
  }
20069
19659
  );
@@ -20088,7 +19678,9 @@ function Form({
20088
19678
  request_details: requestDetails,
20089
19679
  time_period: requestType === "ACCESS" /* ACCESS */ ? parseInt(timePeriod || "30", 10) : 0,
20090
19680
  requestor_note: formData.additionalNote || "",
20091
- ...requestType === "erasure" /* ERASURE */ ? { revoke_consent_on_fulfilment: revokeConsent } : {}
19681
+ ...requestType === "erasure" /* ERASURE */ ? { revoke_consent_on_fulfilment: revokeConsent } : {},
19682
+ ...anchorGroup ? { product_uuid: anchorGroup.product_uuid } : {},
19683
+ ...(anchorGroup == null ? void 0 : anchorGroup.nominator) ? { data_principal_uuid: anchorGroup.nominator.uuid } : {}
20092
19684
  };
20093
19685
  try {
20094
19686
  setIsLoading(true);
@@ -20106,25 +19698,17 @@ function Form({
20106
19698
  const caseId = (extracted == null ? void 0 : extracted.case_id) || (extracted == null ? void 0 : extracted.uuid) || null;
20107
19699
  if (caseId) {
20108
19700
  queryClient.invalidateQueries({ queryKey: ["caseHistory"] });
20109
- const productInfo = useGroupedRender && selectedGroups.length === 1 ? {
20110
- group_key: productGroupKey(selectedGroups[0]),
20111
- product_uuid: selectedGroups[0].product_uuid,
20112
- product_name: selectedGroups[0].product_name
20113
- } : { group_key: "", product_uuid: "", product_name: "" };
20114
- setBatchResult({
20115
- succeeded: [
20116
- {
20117
- ...productInfo,
20118
- case_id: caseId,
20119
- uuid: (_b2 = extracted == null ? void 0 : extracted.uuid) != null ? _b2 : caseId
20120
- }
20121
- ],
20122
- failed: []
19701
+ setSubmittedCase({
19702
+ case_id: caseId,
19703
+ uuid: (_b2 = extracted == null ? void 0 : extracted.uuid) != null ? _b2 : caseId,
19704
+ product_name: (_c2 = anchorGroup == null ? void 0 : anchorGroup.product_name) != null ? _c2 : "",
19705
+ product_uuid: (_d2 = anchorGroup == null ? void 0 : anchorGroup.product_uuid) != null ? _d2 : ""
20123
19706
  });
20124
19707
  setIsSubmitted(true);
20125
19708
  toast.success(t("requestSubmittedSuccess"));
20126
19709
  if (isPopup) {
20127
19710
  onCreateRequest == null ? void 0 : onCreateRequest();
19711
+ onClose == null ? void 0 : onClose();
20128
19712
  }
20129
19713
  } else {
20130
19714
  toast.error(t("requestSubmissionFailed"));
@@ -20135,251 +19719,49 @@ function Form({
20135
19719
  toast.error(message);
20136
19720
  } finally {
20137
19721
  setIsLoading(false);
20138
- if (isPopup) {
20139
- onClose == null ? void 0 : onClose();
20140
- }
20141
19722
  }
20142
19723
  };
20143
- const submitSingleProductCase = async (group, revokeConsent) => {
20144
- var _a2, _b2, _c2;
20145
- const groupKey = productGroupKey(group);
20146
- const groupPurposes = (_a2 = purposesByGroupKey.get(groupKey)) != null ? _a2 : [];
20147
- const purposesPayload = requestType === "CORRECTION" /* CORRECTION */ ? [] : groupPurposes.filter(
20148
- (p) => p.selected || p.data_elements.some((de) => de.selected)
20149
- ).map((p) => ({
20150
- purpose_uuid: p.uuid,
20151
- data_element_uuids: p.data_elements.filter((de) => de.selected).map((de) => de.uuid)
20152
- }));
20153
- const groupSelectedNames = requestType === "CORRECTION" /* CORRECTION */ ? (_b2 = correctionElementsByGroupKey.get(groupKey)) != null ? _b2 : [] : [];
20154
- const groupValues = requestType === "CORRECTION" /* CORRECTION */ ? (_c2 = correctionValuesByGroupKey.get(groupKey)) != null ? _c2 : {} : {};
20155
- const correctionPayload = requestType === "CORRECTION" /* CORRECTION */ ? groupSelectedNames.map((name) => {
20156
- var _a3, _b3, _c3, _d2;
20157
- return {
20158
- name: getEnglishDataElementName(name),
20159
- curr_value: (_b3 = (_a3 = groupValues[name]) == null ? void 0 : _a3.current) != null ? _b3 : "",
20160
- new_value: (_d2 = (_c3 = groupValues[name]) == null ? void 0 : _c3.updated) != null ? _d2 : ""
20161
- };
20162
- }) : [];
20163
- const payload = {
20164
- name: " ",
20165
- contact: formData.contact,
20166
- request_type: requestType == null ? void 0 : requestType.toLowerCase(),
20167
- uuid: formData.uuid,
20168
- supporting_docs_uuids: [...uploadedDocumentId],
20169
- request_details: {
20170
- purposes: purposesPayload,
20171
- correction_data: correctionPayload,
20172
- grievance_types: []
20173
- },
20174
- time_period: requestType === "ACCESS" /* ACCESS */ ? parseInt(timePeriod || "30", 10) : 0,
20175
- requestor_note: formData.additionalNote || "",
20176
- ...requestType === "erasure" /* ERASURE */ ? { revoke_consent_on_fulfilment: revokeConsent } : {},
20177
- product_uuid: group.product_uuid,
20178
- // Only set data_principal_uuid for nominee-driven cases. Direct
20179
- // cards default server-side to the JWT-derived requestor_uuid.
20180
- ...group.nominator ? { data_principal_uuid: group.nominator.uuid } : {}
20181
- };
20182
- return await createCaseRequestUnsafe(
20183
- organizationId || "",
20184
- workspaceId || "",
20185
- payload,
20186
- isPopup,
20187
- isCaseManagementContext,
20188
- authContext,
20189
- consentClient
20190
- );
20191
- };
20192
- const submitBatchCases = async (revokeConsent) => {
20193
- const submissions = selectedGroups.map(
20194
- (group) => submitSingleProductCase(group, revokeConsent).then(
20195
- (response) => ({ group, response })
20196
- )
20197
- );
20198
- const results = await Promise.allSettled(submissions);
20199
- const batchResult2 = { succeeded: [], failed: [] };
20200
- results.forEach((result, idx) => {
20201
- const group = selectedGroups[idx];
20202
- const groupKey = productGroupKey(group);
20203
- if (result.status === "fulfilled") {
20204
- const extracted = extractCaseId(result.value.response);
20205
- if (extracted && (extracted.case_id || extracted.uuid)) {
20206
- batchResult2.succeeded.push({
20207
- group_key: groupKey,
20208
- product_uuid: group.product_uuid,
20209
- product_name: group.product_name,
20210
- case_id: extracted.case_id || extracted.uuid,
20211
- uuid: extracted.uuid || extracted.case_id
20212
- });
20213
- } else {
20214
- batchResult2.failed.push({
20215
- group_key: groupKey,
20216
- product_uuid: group.product_uuid,
20217
- product_name: group.product_name,
20218
- error: t("requestSubmissionFailed")
20219
- });
20220
- }
20221
- } else {
20222
- const reason = result.reason;
20223
- const message = reason instanceof Error ? reason.message : typeof reason === "string" ? reason : t("submissionFailed");
20224
- batchResult2.failed.push({
20225
- group_key: groupKey,
20226
- product_uuid: group.product_uuid,
20227
- product_name: group.product_name,
20228
- error: message
20229
- });
20230
- }
20231
- });
20232
- return batchResult2;
20233
- };
20234
- const handleRetry = (0, import_react39.useCallback)(
20235
- async (groupKey) => {
20236
- if (groupKey === "") {
20237
- return;
20238
- }
20239
- const group = selectedGroups.find(
20240
- (g) => productGroupKey(g) === groupKey
20241
- );
20242
- if (!group) {
20243
- return;
20244
- }
20245
- setRetryingGroupKeys((prev) => {
20246
- const next = new Set(prev);
20247
- next.add(groupKey);
20248
- return next;
20249
- });
20250
- try {
20251
- const response = await submitSingleProductCase(group, false);
20252
- const extracted = extractCaseId(response);
20253
- if (extracted && (extracted.case_id || extracted.uuid)) {
20254
- queryClient.invalidateQueries({ queryKey: ["caseHistory"] });
20255
- setBatchResult((prev) => {
20256
- if (!prev) {
20257
- return prev;
20258
- }
20259
- return {
20260
- succeeded: [
20261
- ...prev.succeeded,
20262
- {
20263
- group_key: groupKey,
20264
- product_uuid: group.product_uuid,
20265
- product_name: group.product_name,
20266
- case_id: extracted.case_id || extracted.uuid,
20267
- uuid: extracted.uuid || extracted.case_id
20268
- }
20269
- ],
20270
- failed: prev.failed.filter((f) => f.group_key !== groupKey)
20271
- };
20272
- });
20273
- toast.success(t("requestSubmittedSuccess"));
20274
- } else {
20275
- setBatchResult((prev) => {
20276
- if (!prev) {
20277
- return prev;
20278
- }
20279
- return {
20280
- succeeded: prev.succeeded,
20281
- failed: prev.failed.map(
20282
- (f) => f.group_key === groupKey ? { ...f, error: t("requestSubmissionFailed") } : f
20283
- )
20284
- };
20285
- });
20286
- }
20287
- } catch (error) {
20288
- const message = error instanceof Error ? error.message : t("submissionFailed");
20289
- setBatchResult((prev) => {
20290
- if (!prev) {
20291
- return prev;
20292
- }
20293
- return {
20294
- succeeded: prev.succeeded,
20295
- failed: prev.failed.map(
20296
- (f) => f.group_key === groupKey ? { ...f, error: message } : f
20297
- )
20298
- };
20299
- });
20300
- } finally {
20301
- setRetryingGroupKeys((prev) => {
20302
- const next = new Set(prev);
20303
- next.delete(groupKey);
20304
- return next;
20305
- });
20306
- }
20307
- },
20308
- // eslint-disable-next-line react-hooks/exhaustive-deps
20309
- [
20310
- selectedGroups,
20311
- queryClient,
20312
- t
20313
- // submitSingleProductCase closes over many form-state values; we
20314
- // intentionally don't list it to avoid identity churn re-rendering
20315
- // RequestSubmit while a retry is in flight.
20316
- ]
20317
- );
20318
19724
  const isRequestDetailsValid = (0, import_react39.useCallback)(() => {
20319
19725
  if (!requestType) {
20320
19726
  return false;
20321
19727
  }
20322
- if (useGroupedRender && isGroupedRequestType(requestType)) {
20323
- if (selectedGroups.length === 0) {
19728
+ if (isProductScopedRequestType(requestType)) {
19729
+ if (allGroups.length === 0) {
20324
19730
  return false;
20325
19731
  }
20326
- if (requestType === "CORRECTION" /* CORRECTION */) {
20327
- return selectedGroups.every((group) => {
20328
- var _a2, _b2;
20329
- const key = productGroupKey(group);
20330
- const selected = (_a2 = correctionElementsByGroupKey.get(key)) != null ? _a2 : [];
20331
- const values = (_b2 = correctionValuesByGroupKey.get(key)) != null ? _b2 : {};
20332
- return selected.length > 0 && selected.every(
20333
- (name) => {
20334
- var _a3, _b3, _c2, _d2;
20335
- return ((_b3 = (_a3 = values[name]) == null ? void 0 : _a3.current) == null ? void 0 : _b3.trim()) && ((_d2 = (_c2 = values[name]) == null ? void 0 : _c2.updated) == null ? void 0 : _d2.trim());
20336
- }
20337
- );
20338
- });
19732
+ if (!selectedGroup) {
19733
+ return false;
20339
19734
  }
20340
- return selectedGroups.every((group) => {
20341
- var _a2;
20342
- const purposes = (_a2 = purposesByGroupKey.get(productGroupKey(group))) != null ? _a2 : [];
20343
- return purposes.some(
20344
- (p) => p.selected || p.data_elements.some((de) => de.selected)
20345
- );
20346
- });
20347
- }
20348
- switch (requestType) {
20349
- case "ACCESS" /* ACCESS */:
20350
- return accessPurposes.some(
20351
- (p) => p.selected || p.data_elements.some((de) => de.selected)
20352
- );
20353
- case "erasure" /* ERASURE */:
20354
- return erasurePurposes.some(
20355
- (p) => p.selected || p.data_elements.some((de) => de.selected)
20356
- );
20357
- case "grievance" /* GRIEVANCE */:
20358
- return Object.values(selectedGrievances).some(Boolean);
20359
- case "CORRECTION" /* CORRECTION */:
19735
+ if (requestType === "CORRECTION" /* CORRECTION */) {
20360
19736
  return selectedCorrectionElements.length > 0 && selectedCorrectionElements.every(
20361
19737
  (name) => {
20362
19738
  var _a2, _b2, _c2, _d2;
20363
19739
  return ((_b2 = (_a2 = correctionValues[name]) == null ? void 0 : _a2.current) == null ? void 0 : _b2.trim()) && ((_d2 = (_c2 = correctionValues[name]) == null ? void 0 : _c2.updated) == null ? void 0 : _d2.trim());
20364
19740
  }
20365
19741
  );
19742
+ }
19743
+ return selectedPurposes.some(
19744
+ (p) => p.selected || p.data_elements.some((de) => de.selected)
19745
+ );
19746
+ }
19747
+ switch (requestType) {
19748
+ case "grievance" /* GRIEVANCE */:
19749
+ return Object.values(selectedGrievances).some(Boolean);
20366
19750
  case "nomination" /* NOMINATION */:
20367
- return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(nominationData.nominee_email.trim());
19751
+ return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(
19752
+ nominationData.nominee_email.trim()
19753
+ );
20368
19754
  default:
20369
19755
  return false;
20370
19756
  }
20371
19757
  }, [
20372
19758
  requestType,
20373
- useGroupedRender,
20374
- selectedGroups,
20375
- purposesByGroupKey,
20376
- correctionElementsByGroupKey,
20377
- correctionValuesByGroupKey,
20378
- accessPurposes,
20379
- erasurePurposes,
20380
- selectedGrievances,
19759
+ allGroups,
19760
+ selectedGroup,
19761
+ selectedPurposes,
20381
19762
  selectedCorrectionElements,
20382
19763
  correctionValues,
19764
+ selectedGrievances,
20383
19765
  nominationData
20384
19766
  ]);
20385
19767
  const isFormValid = (0, import_react39.useMemo)(() => {
@@ -20540,14 +19922,12 @@ function Form({
20540
19922
  setIsVerifyingContact(false);
20541
19923
  }
20542
19924
  };
20543
- return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_jsx_runtime60.Fragment, { children: isSubmitted && batchResult && !isPopup ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
19925
+ return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_jsx_runtime60.Fragment, { children: isSubmitted && submittedCase && !isPopup ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
20544
19926
  RequestSubmit,
20545
19927
  {
20546
- result: batchResult,
19928
+ result: submittedCase,
20547
19929
  contact: formData == null ? void 0 : formData.contact,
20548
- onCreateRequest,
20549
- onRetry: handleRetry,
20550
- retryingGroupKeys
19930
+ onCreateRequest
20551
19931
  }
20552
19932
  ) : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { children: [
20553
19933
  !isPopup && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("p", { style: {
@@ -20746,7 +20126,7 @@ function Form({
20746
20126
  ] }),
20747
20127
  isRequestDetailsExpanded && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { style: {
20748
20128
  padding: getVar21("--pc-spacing-md")
20749
- }, children: useGroupedRender && isGroupedRequestType(requestType) ? /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
20129
+ }, children: isProductScopedRequestType(requestType) ? /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
20750
20130
  "div",
20751
20131
  {
20752
20132
  style: {
@@ -20766,16 +20146,12 @@ function Form({
20766
20146
  isTranslating
20767
20147
  }
20768
20148
  ),
20769
- selectedGroups.length > 0 && (() => {
20770
- var _a2, _b2, _c2, _d2, _e;
20771
- const group = selectedGroups[0];
20772
- const key = productGroupKey(group);
20773
- const groupPurposes = (_a2 = purposesByGroupKey.get(key)) != null ? _a2 : [];
20149
+ selectedGroup && (() => {
20150
+ var _a2, _b2;
20151
+ const key = productGroupKey(selectedGroup);
20774
20152
  const isCorrection = requestType === "CORRECTION" /* CORRECTION */;
20775
- const groupDataElements = isCorrection ? buildGroupDataElements(group) : [];
20776
- const groupCorrectionSelected = (_b2 = correctionElementsByGroupKey.get(key)) != null ? _b2 : [];
20777
- const groupCorrectionValues = (_c2 = correctionValuesByGroupKey.get(key)) != null ? _c2 : {};
20778
- const nominatorLabel = group.nominator ? (_e = (_d2 = group.nominator.name) != null ? _d2 : group.nominator.email) != null ? _e : "" : "";
20153
+ const groupDataElements = isCorrection ? buildGroupDataElements(selectedGroup) : [];
20154
+ const nominatorLabel = selectedGroup.nominator ? (_b2 = (_a2 = selectedGroup.nominator.name) != null ? _a2 : selectedGroup.nominator.email) != null ? _b2 : "" : "";
20779
20155
  return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
20780
20156
  "div",
20781
20157
  {
@@ -20792,10 +20168,10 @@ function Form({
20792
20168
  weight: "semibold",
20793
20169
  color: "primary",
20794
20170
  className: "pc-product-purpose-panel-title",
20795
- children: group.product_name
20171
+ children: selectedGroup.product_name
20796
20172
  }
20797
20173
  ),
20798
- group.nominator && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
20174
+ selectedGroup.nominator && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
20799
20175
  PCText,
20800
20176
  {
20801
20177
  as: "span",
@@ -20829,17 +20205,17 @@ function Form({
20829
20205
  CorrectionDataSection,
20830
20206
  {
20831
20207
  dataElements: groupDataElements,
20832
- selected: groupCorrectionSelected,
20833
- setSelected: (values) => setCorrectionElementsForGroup(key, values),
20834
- correctionValues: groupCorrectionValues,
20835
- setCorrectionValues: (values) => setCorrectionValuesForGroup(key, values),
20208
+ selected: selectedCorrectionElements,
20209
+ setSelected: setSelectedCorrectionElements,
20210
+ correctionValues,
20211
+ setCorrectionValues,
20836
20212
  isTranslating
20837
20213
  }
20838
20214
  ) : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
20839
20215
  PurposeSelectionSection,
20840
20216
  {
20841
- purposes: groupPurposes,
20842
- setPurposes: (updated) => setPurposesForGroup(key, updated),
20217
+ purposes: selectedPurposes,
20218
+ setPurposes: setSelectedPurposes,
20843
20219
  requestType,
20844
20220
  isTranslating
20845
20221
  }
@@ -20852,24 +20228,6 @@ function Form({
20852
20228
  })()
20853
20229
  ]
20854
20230
  }
20855
- ) : requestType === "ACCESS" /* ACCESS */ || requestType === "erasure" /* ERASURE */ ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
20856
- PurposeSelectionSection,
20857
- {
20858
- purposes: requestType === "ACCESS" /* ACCESS */ ? accessPurposes : erasurePurposes,
20859
- setPurposes: requestType === "ACCESS" /* ACCESS */ ? setAccessPurposes : setErasurePurposes,
20860
- requestType,
20861
- isTranslating
20862
- }
20863
- ) : requestType === "CORRECTION" /* CORRECTION */ ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
20864
- CorrectionDataSection,
20865
- {
20866
- dataElements: uniqueDataElements,
20867
- selected: selectedCorrectionElements,
20868
- setSelected: setSelectedCorrectionElements,
20869
- correctionValues,
20870
- setCorrectionValues,
20871
- isTranslating
20872
- }
20873
20231
  ) : requestType === "grievance" /* GRIEVANCE */ ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
20874
20232
  GrievanceDataSection,
20875
20233
  {