@reqquest/ui 1.3.1 → 1.5.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.
@@ -1,6 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { ActionSet, type ActionItem } from '@txstate-mws/carbon-svelte'
3
3
  import { DateTime } from 'luxon'
4
+ import { htmlEncode, isBlank } from 'txstate-utils'
4
5
 
5
6
  /**
6
7
  * The TEXT content of the comment.
@@ -40,11 +41,30 @@
40
41
  export let noborder = false
41
42
 
42
43
  $: createdAtDt = typeof createdAt === 'string' ? DateTime.fromISO(createdAt) : createdAt
44
+
45
+ // NOTE: Noticed that htmlEncode doesn't encode equal signs,
46
+ // but included here just in case that changes as unencoding doesn't cause issues.
47
+ function unencodeUrl (str: string) {
48
+ if (isBlank(str)) return ''
49
+ const map = new Map<string, string>([
50
+ ['&amp;', '&'],
51
+ ['&#x3D;', '=']
52
+ ])
53
+ return str.trim().replace(/&(amp|#x3D);/g, (m: string) => map.get(m) ?? '')
54
+ }
55
+
56
+ // People often put punctuation at the end or enclose url's in parentheses or quotes so do not include
57
+ // https://www.youtube.com/watch?v&#x3D;pYBrK1O4UEQ&amp;list&#x3D;UUHdD1ujwX1fCB0CiamefSWA.
58
+ // => href="https://www.youtube.com/watch?v=pYBrK1O4UEQ&list=UUHdD1ujwX1fCB0CiamefSWA"
59
+ function clickableUrl(str: string) {
60
+ return str.replace(/(\bhttps?:\/\/([^.,!?:)\n\r\t '"]+|[.,!?:)][^\n\r\t '")])+)/g, (m: string) => `<a href="${unencodeUrl(m)}" target="_blank">${m}</a>`)
61
+ }
62
+
43
63
  </script>
44
64
 
45
65
  <div class="comment-card">
46
66
  <div class="comment-box" class:noborder class:hasactions={actions.length > 0}>
47
- <div class="comment-content"><p>{content}</p></div>
67
+ <div class="comment-content"><p>{@html clickableUrl(htmlEncode(content))}</p></div>
48
68
  {#if actions.length}
49
69
  <div class="comment-actions">
50
70
  <ActionSet {actions} noPrimaryAction small forceOverflow />
@@ -317,6 +317,7 @@ export interface ApplicationMetric {
317
317
  }
318
318
  /** Application metric entry */
319
319
  export interface ApplicationMetricEntry {
320
+ appRequestId: Scalars['ID'];
320
321
  applicantFullname: Scalars['String'];
321
322
  applicantId: Scalars['ID'];
322
323
  applicantLogin: Scalars['String'];
@@ -482,8 +483,6 @@ export interface Mutation {
482
483
  roleDeleteGrant: AccessRoleValidatedResponse;
483
484
  roleUpdate: AccessRoleValidatedResponse;
484
485
  roleUpdateGrant: AccessRoleValidatedResponse;
485
- /** Stage the data for a prompt in this app request. */
486
- stagePrompt: ValidatedAppRequestResponse;
487
486
  /** Submit the app request. */
488
487
  submitAppRequest: ValidatedAppRequestResponse;
489
488
  /** Toggle an existing note's persistent status. */
@@ -695,10 +694,11 @@ export interface RequirementPrompt {
695
694
  moot: Scalars['Boolean'];
696
695
  /** A human readable title for the prompt in the navigation. You probably want it to be shorter than the full title. If not provided, the title will be used. */
697
696
  navTitle: Scalars['String'];
697
+ optOut: Scalars['Boolean'];
698
698
  /** Preload data that has been generated according to the prompt definition. For example, a prompt might query the database for answers given in previous requests or query an external API to learn facts about the user. */
699
699
  preloadData: (Scalars['JsonData'] | null);
700
- /** Smartly identifies if the prompt requires pre staging processing. */
701
- prestage: Scalars['Boolean'];
700
+ /** Prestage data that has been generated according to the prompt definition. A prompt might require data that should only be modified API side (not client manipulable), such as user specific info sourced from other systems. */
701
+ prestageData: (Scalars['JsonData'] | null);
702
702
  /** The requirement that this prompt is associated with. */
703
703
  requirement: ApplicationRequirement;
704
704
  /** A human readable title for the prompt. This is what will be shown to users. */
@@ -1220,6 +1220,7 @@ export interface ApplicationMetricGenqlSelection {
1220
1220
  }
1221
1221
  /** Application metric entry */
1222
1222
  export interface ApplicationMetricEntryGenqlSelection {
1223
+ appRequestId?: boolean | number;
1223
1224
  applicantFullname?: boolean | number;
1224
1225
  applicantId?: boolean | number;
1225
1226
  applicantLogin?: boolean | number;
@@ -1548,14 +1549,6 @@ export interface MutationGenqlSelection {
1548
1549
  validateOnly?: (Scalars['Boolean'] | null);
1549
1550
  };
1550
1551
  });
1551
- /** Stage the data for a prompt in this app request. */
1552
- stagePrompt?: (ValidatedAppRequestResponseGenqlSelection & {
1553
- __args: {
1554
- /** The data version of the app request at the time this prompt was loaded. If provided, the API will perform an optimistic concurrency check and fail the update if someone else has updated the data in the meantime. */
1555
- dataVersion?: (Scalars['Int'] | null);
1556
- promptId: Scalars['ID'];
1557
- };
1558
- });
1559
1552
  /** Submit the app request. */
1560
1553
  submitAppRequest?: (ValidatedAppRequestResponseGenqlSelection & {
1561
1554
  __args: {
@@ -1918,6 +1911,7 @@ export interface RequirementPromptGenqlSelection {
1918
1911
  moot?: boolean | number;
1919
1912
  /** A human readable title for the prompt in the navigation. You probably want it to be shorter than the full title. If not provided, the title will be used. */
1920
1913
  navTitle?: boolean | number;
1914
+ optOut?: boolean | number;
1921
1915
  /** Preload data that has been generated according to the prompt definition. For example, a prompt might query the database for answers given in previous requests or query an external API to learn facts about the user. */
1922
1916
  preloadData?: {
1923
1917
  __args: {
@@ -1925,8 +1919,13 @@ export interface RequirementPromptGenqlSelection {
1925
1919
  schemaVersion?: (Scalars['String'] | null);
1926
1920
  };
1927
1921
  } | boolean | number;
1928
- /** Smartly identifies if the prompt requires pre staging processing. */
1929
- prestage?: boolean | number;
1922
+ /** Prestage data that has been generated according to the prompt definition. A prompt might require data that should only be modified API side (not client manipulable), such as user specific info sourced from other systems. */
1923
+ prestageData?: {
1924
+ __args: {
1925
+ /** Provide the schemaVersion at the time the UI was built. Will throw an error if the client is too old, so it knows to refresh. */
1926
+ schemaVersion?: (Scalars['String'] | null);
1927
+ };
1928
+ } | boolean | number;
1930
1929
  /** The requirement that this prompt is associated with. */
1931
1930
  requirement?: ApplicationRequirementGenqlSelection;
1932
1931
  /** A human readable title for the prompt. This is what will be shown to users. */
@@ -803,6 +803,7 @@ type ApplicationMetric {
803
803
 
804
804
  """Application metric entry"""
805
805
  type ApplicationMetricEntry {
806
+ appRequestId: ID!
806
807
  applicantFullname: String!
807
808
  applicantId: ID!
808
809
  applicantLogin: String!
@@ -1285,15 +1286,6 @@ type Mutation {
1285
1286
  roleUpdate(role: AccessRoleInput!, roleId: ID!, validateOnly: Boolean): AccessRoleValidatedResponse!
1286
1287
  roleUpdateGrant(grant: AccessRoleGrantUpdate!, grantId: ID!, validateOnly: Boolean): AccessRoleValidatedResponse!
1287
1288
 
1288
- """Stage the data for a prompt in this app request."""
1289
- stagePrompt(
1290
- """
1291
- The data version of the app request at the time this prompt was loaded. If provided, the API will perform an optimistic concurrency check and fail the update if someone else has updated the data in the meantime.
1292
- """
1293
- dataVersion: Int
1294
- promptId: ID!
1295
- ): ValidatedAppRequestResponse!
1296
-
1297
1289
  """Submit the app request."""
1298
1290
  submitAppRequest(appRequestId: ID!): ValidatedAppRequestResponse!
1299
1291
 
@@ -1760,6 +1752,7 @@ type RequirementPrompt {
1760
1752
  A human readable title for the prompt in the navigation. You probably want it to be shorter than the full title. If not provided, the title will be used.
1761
1753
  """
1762
1754
  navTitle: String!
1755
+ optOut: Boolean!
1763
1756
 
1764
1757
  """
1765
1758
  Preload data that has been generated according to the prompt definition. For example, a prompt might query the database for answers given in previous requests or query an external API to learn facts about the user.
@@ -1771,8 +1764,15 @@ type RequirementPrompt {
1771
1764
  schemaVersion: String
1772
1765
  ): JsonData
1773
1766
 
1774
- """Smartly identifies if the prompt requires pre staging processing."""
1775
- prestage: Boolean!
1767
+ """
1768
+ Prestage data that has been generated according to the prompt definition. A prompt might require data that should only be modified API side (not client manipulable), such as user specific info sourced from other systems.
1769
+ """
1770
+ prestageData(
1771
+ """
1772
+ Provide the schemaVersion at the time the UI was built. Will throw an error if the client is too old, so it knows to refresh.
1773
+ """
1774
+ schemaVersion: String
1775
+ ): JsonData
1776
1776
 
1777
1777
  """The requirement that this prompt is associated with."""
1778
1778
  requirement: ApplicationRequirement!
@@ -312,6 +312,7 @@ declare const _default: {
312
312
  __typename: number[];
313
313
  };
314
314
  ApplicationMetricEntry: {
315
+ appRequestId: number[];
315
316
  applicantFullname: number[];
316
317
  applicantId: number[];
317
318
  applicantLogin: number[];
@@ -527,10 +528,6 @@ declare const _default: {
527
528
  grantId: (string | number)[];
528
529
  validateOnly: number[];
529
530
  })[];
530
- stagePrompt: (number | {
531
- dataVersion: number[];
532
- promptId: (string | number)[];
533
- })[];
534
531
  submitAppRequest: (number | {
535
532
  appRequestId: (string | number)[];
536
533
  })[];
@@ -764,10 +761,13 @@ declare const _default: {
764
761
  key: number[];
765
762
  moot: number[];
766
763
  navTitle: number[];
764
+ optOut: number[];
767
765
  preloadData: (number | {
768
766
  schemaVersion: number[];
769
767
  })[];
770
- prestage: number[];
768
+ prestageData: (number | {
769
+ schemaVersion: number[];
770
+ })[];
771
771
  requirement: number[];
772
772
  title: number[];
773
773
  visibility: number[];
@@ -808,6 +808,9 @@ export default {
808
808
  ]
809
809
  },
810
810
  "ApplicationMetricEntry": {
811
+ "appRequestId": [
812
+ 49
813
+ ],
811
814
  "applicantFullname": [
812
815
  85
813
816
  ],
@@ -1127,7 +1130,7 @@ export default {
1127
1130
  88,
1128
1131
  {
1129
1132
  "appRequestId": [
1130
- 46,
1133
+ 49,
1131
1134
  "ID!"
1132
1135
  ],
1133
1136
  "content": [
@@ -1386,18 +1389,6 @@ export default {
1386
1389
  ]
1387
1390
  }
1388
1391
  ],
1389
- "stagePrompt": [
1390
- 86,
1391
- {
1392
- "dataVersion": [
1393
- 53
1394
- ],
1395
- "promptId": [
1396
- 49,
1397
- "ID!"
1398
- ]
1399
- }
1400
- ],
1401
1392
  "submitAppRequest": [
1402
1393
  86,
1403
1394
  {
@@ -2013,6 +2004,9 @@ export default {
2013
2004
  "navTitle": [
2014
2005
  85
2015
2006
  ],
2007
+ "optOut": [
2008
+ 41
2009
+ ],
2016
2010
  "preloadData": [
2017
2011
  54,
2018
2012
  {
@@ -2021,8 +2015,13 @@ export default {
2021
2015
  ]
2022
2016
  }
2023
2017
  ],
2024
- "prestage": [
2025
- 41
2018
+ "prestageData": [
2019
+ 54,
2020
+ {
2021
+ "schemaVersion": [
2022
+ 85
2023
+ ]
2024
+ }
2026
2025
  ],
2027
2026
  "requirement": [
2028
2027
  39
package/dist/types.d.ts CHANGED
@@ -10,6 +10,7 @@ export interface AnsweredPrompt {
10
10
  invalidatedReason: string | null;
11
11
  moot: boolean | null;
12
12
  visibility: string;
13
+ optOut?: boolean | null;
13
14
  configurationData: Record<string, any>;
14
15
  gatheredConfigData: Record<string, any>;
15
16
  statusReasons: {
@@ -35,6 +36,8 @@ export interface AppRequestForDetails {
35
36
  updatedAt?: string;
36
37
  closedAt?: string | null;
37
38
  actions?: any;
39
+ dataVersion?: number;
40
+ data?: any;
38
41
  }
39
42
  export interface ApplicationForDetails {
40
43
  id: string;
@@ -46,6 +49,7 @@ export interface ApplicationForDetails {
46
49
  hasWarning: boolean;
47
50
  warningReasons: string[];
48
51
  ineligibleReasons: string[];
52
+ metReasons: string[];
49
53
  requirements: {
50
54
  id: string;
51
55
  type: RequirementType;
@@ -56,3 +60,6 @@ export interface ApplicationForDetails {
56
60
  }
57
61
  export declare const phaseChangeMutations: readonly ["submitAppRequest", "returnToApplicant", "completeReview", "returnToReview", "acceptOffer", "returnToOffer", "completeRequest", "returnToNonBlocking"];
58
62
  export type PhaseChangeMutations = typeof phaseChangeMutations[number];
63
+ export type OptOutApplication = ApplicationForDetails & {
64
+ prompt: AnsweredPrompt;
65
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reqquest/ui",
3
- "version": "1.3.1",
3
+ "version": "1.5.0",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./dist/index.d.ts",