@reqquest/ui 1.3.0 → 1.4.1
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
|
+
['&', '&'],
|
|
51
|
+
['=', '=']
|
|
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=pYBrK1O4UEQ&list=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 />
|
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;
|
|
@@ -56,3 +59,6 @@ export interface ApplicationForDetails {
|
|
|
56
59
|
}
|
|
57
60
|
export declare const phaseChangeMutations: readonly ["submitAppRequest", "returnToApplicant", "completeReview", "returnToReview", "acceptOffer", "returnToOffer", "completeRequest", "returnToNonBlocking"];
|
|
58
61
|
export type PhaseChangeMutations = typeof phaseChangeMutations[number];
|
|
62
|
+
export type OptOutApplication = ApplicationForDetails & {
|
|
63
|
+
prompt: AnsweredPrompt;
|
|
64
|
+
};
|