@saasquatch/mint-components 2.1.8-12 → 2.1.8-13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{ShadowViewAddon-41b061c2.js → ShadowViewAddon-43300e54.js} +8 -16
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mint-components.cjs.js +1 -1
- package/dist/cjs/sqm-big-stat_45.cjs.entry.js +2 -13
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +3 -15
- package/dist/collection/components/sqm-share-link/ShareLink.stories.js +1 -12
- package/dist/collection/components/sqm-share-link/sqm-share-link-view.js +2 -8
- package/dist/collection/components/sqm-share-link/sqm-share-link.js +2 -37
- package/dist/collection/components/sqm-share-link/useShareLink.js +7 -9
- package/dist/esm/{ShadowViewAddon-0f97b25e.js → ShadowViewAddon-cb281da9.js} +9 -17
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mint-components.js +1 -1
- package/dist/esm/sqm-big-stat_45.entry.js +2 -13
- package/dist/esm/sqm-stencilbook.entry.js +3 -15
- package/dist/esm-es5/ShadowViewAddon-cb281da9.js +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/mint-components.js +1 -1
- package/dist/esm-es5/sqm-big-stat_45.entry.js +1 -1
- package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
- package/dist/mint-components/mint-components.esm.js +1 -1
- package/dist/mint-components/{p-58f63dec.system.entry.js → p-20d4c76b.system.entry.js} +1 -1
- package/dist/mint-components/{p-3ee8b29b.entry.js → p-54985e41.entry.js} +2 -2
- package/dist/mint-components/{p-01274e61.entry.js → p-784e77ea.entry.js} +2 -2
- package/dist/mint-components/{p-4a69495a.js → p-c7081350.js} +29 -29
- package/dist/mint-components/p-ca098be1.system.js +1 -1
- package/dist/mint-components/{p-c3346e74.system.entry.js → p-ca2276d9.system.entry.js} +1 -1
- package/dist/mint-components/p-eb7919cd.system.js +1 -0
- package/dist/types/components/sqm-share-link/ShareLink.stories.d.ts +0 -1
- package/dist/types/components/sqm-share-link/sqm-share-link-view.d.ts +1 -2
- package/dist/types/components/sqm-share-link/sqm-share-link.d.ts +0 -7
- package/dist/types/components/sqm-share-link/useShareLink.d.ts +0 -1
- package/dist/types/components.d.ts +0 -12
- package/docs/docs.docx +0 -0
- package/docs/raisins.json +1 -1
- package/grapesjs/grapesjs.js +1 -1
- package/package.json +1 -1
- package/dist/esm-es5/ShadowViewAddon-0f97b25e.js +0 -1
- package/dist/mint-components/p-c519220a.system.js +0 -1
- package/dist/types/global/android.d.ts +0 -7
- package/dist/types/global/demo.d.ts +0 -2
- package/dist/types/stories/features.d.ts +0 -4
- package/dist/types/stories/templates.d.ts +0 -4
|
@@ -9,7 +9,7 @@ const vanillaStyle = `
|
|
|
9
9
|
}
|
|
10
10
|
`;
|
|
11
11
|
export function ShareLinkView(props) {
|
|
12
|
-
const { copyTextViewProps, customizeUrl, customizeLinkLabel, saveLabelText, cancelLabelText,
|
|
12
|
+
const { copyTextViewProps, customizeUrl, customizeLinkLabel, saveLabelText, cancelLabelText, isEditing, editValue, domainPrefix, editsRemaining, maxEdits, limitReached, validationError, isValidating, isSaving, characterLimit, minCharacters, charactersRemaining, editLimitText, editLimitReachedText, supportLinkText, customizeDisabled, customizeDisabledTooltip, onCustomizeClick, onEditValueChange, onSave, onCancel, } = props;
|
|
13
13
|
const style = {
|
|
14
14
|
Container: {
|
|
15
15
|
display: "flex",
|
|
@@ -90,11 +90,6 @@ export function ShareLinkView(props) {
|
|
|
90
90
|
fontSize: "var(--sl-font-size-small)",
|
|
91
91
|
color: "var(--sqm-danger-color-text, #dc2626)",
|
|
92
92
|
},
|
|
93
|
-
SuccessText: {
|
|
94
|
-
margin: "0",
|
|
95
|
-
fontSize: "var(--sl-font-size-small)",
|
|
96
|
-
color: "var(--sl-color-success-600, #16a34a)",
|
|
97
|
-
},
|
|
98
93
|
ActionRow: {
|
|
99
94
|
display: "flex",
|
|
100
95
|
gap: "var(--sl-spacing-medium)",
|
|
@@ -150,7 +145,7 @@ export function ShareLinkView(props) {
|
|
|
150
145
|
validationError.description)),
|
|
151
146
|
isValidating && h("p", { class: sheet.classes.HelperText }, "Validating..."),
|
|
152
147
|
h("div", { class: sheet.classes.ActionRow },
|
|
153
|
-
h("button", { class: sheet.classes.SaveButton, onClick: onSave, disabled: isSaving || isValidating || !!validationError || !editValue }, isSaving ? "Saving..." : saveLabelText),
|
|
148
|
+
h("button", { class: sheet.classes.SaveButton, onClick: onSave, disabled: isSaving || isValidating || !!validationError || !editValue || editValue.length < minCharacters }, isSaving ? "Saving..." : saveLabelText),
|
|
154
149
|
h("button", { class: sheet.classes.CancelButton, onClick: onCancel, disabled: isSaving }, cancelLabelText))));
|
|
155
150
|
}
|
|
156
151
|
// Default / Customized / Limit reached states
|
|
@@ -159,7 +154,6 @@ export function ShareLinkView(props) {
|
|
|
159
154
|
styleString,
|
|
160
155
|
vanillaStyle),
|
|
161
156
|
h(CopyTextView, Object.assign({}, copyTextViewProps)),
|
|
162
|
-
showSuccess && h("p", { class: sheet.classes.SuccessText }, successMessage),
|
|
163
157
|
customizeUrl && (customizeDisabled ? (h("sl-tooltip", { content: customizeDisabledTooltip, placement: "top", style: { display: "inline-block", width: "fit-content" } },
|
|
164
158
|
h("p", { class: sheet.classes.CustomizeLinkDisabled }, customizeLinkLabel))) : (h("p", { class: limitReached
|
|
165
159
|
? sheet.classes.CustomizeLinkDisabled
|
|
@@ -86,13 +86,6 @@ export class ShareLink {
|
|
|
86
86
|
* @uiType string
|
|
87
87
|
*/
|
|
88
88
|
this.cancelLabelText = "Cancel";
|
|
89
|
-
/**
|
|
90
|
-
* Message shown briefly after successfully saving a custom link
|
|
91
|
-
*
|
|
92
|
-
* @uiName Success message
|
|
93
|
-
* @uiType string
|
|
94
|
-
*/
|
|
95
|
-
this.successMessage = "Link updated successfully";
|
|
96
89
|
/**
|
|
97
90
|
* Title text shown when the custom link is already taken
|
|
98
91
|
*
|
|
@@ -570,30 +563,6 @@ export class ShareLink {
|
|
|
570
563
|
"reflect": false,
|
|
571
564
|
"defaultValue": "\"Cancel\""
|
|
572
565
|
},
|
|
573
|
-
"successMessage": {
|
|
574
|
-
"type": "string",
|
|
575
|
-
"mutable": false,
|
|
576
|
-
"complexType": {
|
|
577
|
-
"original": "string",
|
|
578
|
-
"resolved": "string",
|
|
579
|
-
"references": {}
|
|
580
|
-
},
|
|
581
|
-
"required": false,
|
|
582
|
-
"optional": true,
|
|
583
|
-
"docs": {
|
|
584
|
-
"tags": [{
|
|
585
|
-
"text": "Success message",
|
|
586
|
-
"name": "uiName"
|
|
587
|
-
}, {
|
|
588
|
-
"text": "string",
|
|
589
|
-
"name": "uiType"
|
|
590
|
-
}],
|
|
591
|
-
"text": "Message shown briefly after successfully saving a custom link"
|
|
592
|
-
},
|
|
593
|
-
"attribute": "success-message",
|
|
594
|
-
"reflect": false,
|
|
595
|
-
"defaultValue": "\"Link updated successfully\""
|
|
596
|
-
},
|
|
597
566
|
"existingCodeConflictErrorTitle": {
|
|
598
567
|
"type": "string",
|
|
599
568
|
"mutable": false,
|
|
@@ -839,7 +808,7 @@ export class ShareLink {
|
|
|
839
808
|
"mutable": false,
|
|
840
809
|
"complexType": {
|
|
841
810
|
"original": "DemoData<ShareLinkViewProps>",
|
|
842
|
-
"resolved": "{ copyTextViewProps?: CopyTextViewProps; customizeUrl?: boolean; customizeLinkLabel?: string; saveLabelText?: string; cancelLabelText?: string;
|
|
811
|
+
"resolved": "{ copyTextViewProps?: CopyTextViewProps; customizeUrl?: boolean; customizeLinkLabel?: string; saveLabelText?: string; cancelLabelText?: string; isEditing?: boolean; editValue?: string; domainPrefix?: string; editsRemaining?: number; maxEdits?: number; limitReached?: boolean; validationError?: ValidationErrorInfo; isValidating?: boolean; isSaving?: boolean; characterLimit?: number; minCharacters?: number; charactersRemaining?: number; editLimitText?: string; editLimitReachedText?: string; supportLinkText?: string; customizeDisabled?: boolean; customizeDisabledTooltip?: string; onCustomizeClick?: () => void; onEditValueChange?: (value: string) => void; onSave?: () => void; onCancel?: () => void; }",
|
|
843
812
|
"references": {
|
|
844
813
|
"DemoData": {
|
|
845
814
|
"location": "import",
|
|
@@ -871,7 +840,6 @@ function useDemoShareLink(props) {
|
|
|
871
840
|
const [open, setOpen] = useState(false);
|
|
872
841
|
const [isEditing, setIsEditing] = useState(false);
|
|
873
842
|
const [editValue, setEditValue] = useState("");
|
|
874
|
-
const [showSuccess, setShowSuccess] = useState(false);
|
|
875
843
|
const copyString = "https://www.example.com/sharelink/abc";
|
|
876
844
|
const domainPrefix = "https://www.example.com/";
|
|
877
845
|
const baseProps = {
|
|
@@ -897,7 +865,6 @@ function useDemoShareLink(props) {
|
|
|
897
865
|
customizeLinkLabel: props.customizeLinkLabel,
|
|
898
866
|
saveLabelText: props.saveLabelText,
|
|
899
867
|
cancelLabelText: props.cancelLabelText,
|
|
900
|
-
successMessage: props.successMessage,
|
|
901
868
|
isEditing,
|
|
902
869
|
editValue,
|
|
903
870
|
domainPrefix,
|
|
@@ -907,8 +874,8 @@ function useDemoShareLink(props) {
|
|
|
907
874
|
validationError: null,
|
|
908
875
|
isValidating: false,
|
|
909
876
|
isSaving: false,
|
|
910
|
-
showSuccess,
|
|
911
877
|
characterLimit: 15,
|
|
878
|
+
minCharacters: 3,
|
|
912
879
|
charactersRemaining: 15 - editValue.length,
|
|
913
880
|
editLimitText: props.editLimitText,
|
|
914
881
|
editLimitReachedText: props.editLimitReachedText,
|
|
@@ -924,8 +891,6 @@ function useDemoShareLink(props) {
|
|
|
924
891
|
},
|
|
925
892
|
onSave: () => {
|
|
926
893
|
setIsEditing(false);
|
|
927
|
-
setShowSuccess(true);
|
|
928
|
-
setTimeout(() => setShowSuccess(false), 3000);
|
|
929
894
|
},
|
|
930
895
|
onCancel: () => {
|
|
931
896
|
setIsEditing(false);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { useEngagementMedium, useLazyQuery, useMutation, useParentValue, useProgramId, useQuery, useUserIdentity, } from "@saasquatch/component-boilerplate";
|
|
1
|
+
import { useEngagementMedium, useLazyQuery, useMutation, useParentValue, useProgramId, useQuery, useRefreshDispatcher, useUserIdentity, } from "@saasquatch/component-boilerplate";
|
|
2
2
|
import { useRef, useState } from "@saasquatch/universal-hooks";
|
|
3
3
|
import { gql } from "graphql-request";
|
|
4
4
|
import { REFERRAL_CODES_NAMESPACE, SET_CODE_COPIED, } from "../sqm-referral-codes/useReferralCodes";
|
|
5
5
|
const MAX_EDITS = 5;
|
|
6
6
|
const CHARACTER_LIMIT = 15;
|
|
7
|
+
const MIN_CHARACTERS = 3;
|
|
7
8
|
const MessageLinkQuery = gql `
|
|
8
9
|
query ($programId: ID, $engagementMedium: UserEngagementMedium!) {
|
|
9
10
|
user: viewer {
|
|
@@ -96,6 +97,7 @@ export function useShareLink(props) {
|
|
|
96
97
|
const [setCopied] = useMutation(SET_CODE_COPIED);
|
|
97
98
|
const [addShareLinkCode, { loading: isSaving }] = useMutation(ADD_SHARE_LINK_CODE);
|
|
98
99
|
const [validateLinkCode] = useLazyQuery(VALIDATE_LINK_CODE);
|
|
100
|
+
const { refresh } = useRefreshDispatcher();
|
|
99
101
|
const { data: linkDomainData } = useQuery(GET_LINK_DOMAIN, {}, !(user === null || user === void 0 ? void 0 : user.jwt) || !props.customizeUrl);
|
|
100
102
|
const { data: editCountData, refetch: refetchEditCount } = useQuery(SHARE_LINK_EDIT_COUNT, {}, !(user === null || user === void 0 ? void 0 : user.jwt) || !props.customizeUrl);
|
|
101
103
|
const copyString = (_b = ((contextData === null || contextData === void 0 ? void 0 : contextData.shareLink) || ((_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.shareLink))) !== null && _b !== void 0 ? _b :
|
|
@@ -106,7 +108,6 @@ export function useShareLink(props) {
|
|
|
106
108
|
const [editValue, setEditValue] = useState("");
|
|
107
109
|
const [validationError, setValidationError] = useState(null);
|
|
108
110
|
const [isValidating, setIsValidating] = useState(false);
|
|
109
|
-
const [showSuccess, setShowSuccess] = useState(false);
|
|
110
111
|
const debounceTimerRef = useRef(undefined);
|
|
111
112
|
const domainPrefix = parseDomainPrefix(copyString);
|
|
112
113
|
const hasPrimaryLinkDomain = ((_c = linkDomainData === null || linkDomainData === void 0 ? void 0 : linkDomainData.tenantSettings) === null || _c === void 0 ? void 0 : _c.primaryLinkDomain) != null;
|
|
@@ -115,7 +116,6 @@ export function useShareLink(props) {
|
|
|
115
116
|
const editCount = vanityCount;
|
|
116
117
|
const editsRemaining = Math.max(0, MAX_EDITS - editCount);
|
|
117
118
|
const limitReached = editsRemaining <= 0;
|
|
118
|
-
console.log({ vanityCount, editCount, editsRemaining });
|
|
119
119
|
function mapErrorCodeToInfo(errorCode) {
|
|
120
120
|
if (!errorCode)
|
|
121
121
|
return null;
|
|
@@ -174,7 +174,7 @@ export function useShareLink(props) {
|
|
|
174
174
|
setValidationError(null);
|
|
175
175
|
if (debounceTimerRef.current)
|
|
176
176
|
clearTimeout(debounceTimerRef.current);
|
|
177
|
-
if (!trimmed) {
|
|
177
|
+
if (!trimmed || trimmed.length < MIN_CHARACTERS) {
|
|
178
178
|
setIsValidating(false);
|
|
179
179
|
return;
|
|
180
180
|
}
|
|
@@ -196,7 +196,7 @@ export function useShareLink(props) {
|
|
|
196
196
|
}
|
|
197
197
|
async function onSave() {
|
|
198
198
|
var _a, _b;
|
|
199
|
-
if (!editValue || validationError || isValidating)
|
|
199
|
+
if (!editValue || editValue.length < MIN_CHARACTERS || validationError || isValidating)
|
|
200
200
|
return;
|
|
201
201
|
try {
|
|
202
202
|
await addShareLinkCode({
|
|
@@ -209,9 +209,8 @@ export function useShareLink(props) {
|
|
|
209
209
|
},
|
|
210
210
|
});
|
|
211
211
|
setIsEditing(false);
|
|
212
|
-
setShowSuccess(true);
|
|
213
212
|
await Promise.all([refetch(), refetchEditCount()]);
|
|
214
|
-
|
|
213
|
+
refresh();
|
|
215
214
|
}
|
|
216
215
|
catch (e) {
|
|
217
216
|
const errorCode = (_a = e === null || e === void 0 ? void 0 : e.extensions) === null || _a === void 0 ? void 0 : _a.code;
|
|
@@ -239,7 +238,6 @@ export function useShareLink(props) {
|
|
|
239
238
|
customizeLinkLabel: props.customizeLinkLabel,
|
|
240
239
|
saveLabelText: props.saveLabelText,
|
|
241
240
|
cancelLabelText: props.cancelLabelText,
|
|
242
|
-
successMessage: props.successMessage,
|
|
243
241
|
isEditing,
|
|
244
242
|
editValue,
|
|
245
243
|
domainPrefix,
|
|
@@ -249,8 +247,8 @@ export function useShareLink(props) {
|
|
|
249
247
|
validationError,
|
|
250
248
|
isValidating,
|
|
251
249
|
isSaving,
|
|
252
|
-
showSuccess,
|
|
253
250
|
characterLimit: CHARACTER_LIMIT,
|
|
251
|
+
minCharacters: MIN_CHARACTERS,
|
|
254
252
|
charactersRemaining: CHARACTER_LIMIT - editValue.length,
|
|
255
253
|
editLimitText: props.editLimitText,
|
|
256
254
|
editLimitReachedText: props.editLimitReachedText,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { h, c as Host, d as getAssetPath, F as Fragment, g as getElement } from './index-38ad4957.js';
|
|
2
2
|
import { i as intl } from './global-96c14d63.js';
|
|
3
3
|
import { b as browser, u as useMemo, k as useState, m as useRef } from './dom-context-hooks.module-50442785.js';
|
|
4
|
-
import { H, L, J, d as dist, w as wn, B, F as Fn, $ as $e, g as getEnvironmentSDK, X as Xe } from './index.module-b23fdad8.js';
|
|
4
|
+
import { H, L, J, d as dist, w as wn, B, F as Fn, $ as $e, g as getEnvironmentSDK, X as Xe, Q as Qe } from './index.module-b23fdad8.js';
|
|
5
5
|
import { c as cjs } from './cjs-bdfb4486.js';
|
|
6
6
|
import { l as luxonLocale } from './utils-334c1e34.js';
|
|
7
7
|
import { c as createStyleSheet, j as jss, a as create } from './JSS-67b5cff8.js';
|
|
@@ -4234,7 +4234,7 @@ const vanillaStyle$6 = `
|
|
|
4234
4234
|
}
|
|
4235
4235
|
`;
|
|
4236
4236
|
function ShareLinkView(props) {
|
|
4237
|
-
const { copyTextViewProps, customizeUrl, customizeLinkLabel, saveLabelText, cancelLabelText,
|
|
4237
|
+
const { copyTextViewProps, customizeUrl, customizeLinkLabel, saveLabelText, cancelLabelText, isEditing, editValue, domainPrefix, editsRemaining, maxEdits, limitReached, validationError, isValidating, isSaving, characterLimit, minCharacters, charactersRemaining, editLimitText, editLimitReachedText, supportLinkText, customizeDisabled, customizeDisabledTooltip, onCustomizeClick, onEditValueChange, onSave, onCancel, } = props;
|
|
4238
4238
|
const style = {
|
|
4239
4239
|
Container: {
|
|
4240
4240
|
display: "flex",
|
|
@@ -4315,11 +4315,6 @@ function ShareLinkView(props) {
|
|
|
4315
4315
|
fontSize: "var(--sl-font-size-small)",
|
|
4316
4316
|
color: "var(--sqm-danger-color-text, #dc2626)",
|
|
4317
4317
|
},
|
|
4318
|
-
SuccessText: {
|
|
4319
|
-
margin: "0",
|
|
4320
|
-
fontSize: "var(--sl-font-size-small)",
|
|
4321
|
-
color: "var(--sl-color-success-600, #16a34a)",
|
|
4322
|
-
},
|
|
4323
4318
|
ActionRow: {
|
|
4324
4319
|
display: "flex",
|
|
4325
4320
|
gap: "var(--sl-spacing-medium)",
|
|
@@ -4375,7 +4370,7 @@ function ShareLinkView(props) {
|
|
|
4375
4370
|
validationError.description)),
|
|
4376
4371
|
isValidating && h("p", { class: sheet.classes.HelperText }, "Validating..."),
|
|
4377
4372
|
h("div", { class: sheet.classes.ActionRow },
|
|
4378
|
-
h("button", { class: sheet.classes.SaveButton, onClick: onSave, disabled: isSaving || isValidating || !!validationError || !editValue }, isSaving ? "Saving..." : saveLabelText),
|
|
4373
|
+
h("button", { class: sheet.classes.SaveButton, onClick: onSave, disabled: isSaving || isValidating || !!validationError || !editValue || editValue.length < minCharacters }, isSaving ? "Saving..." : saveLabelText),
|
|
4379
4374
|
h("button", { class: sheet.classes.CancelButton, onClick: onCancel, disabled: isSaving }, cancelLabelText))));
|
|
4380
4375
|
}
|
|
4381
4376
|
// Default / Customized / Limit reached states
|
|
@@ -4384,7 +4379,6 @@ function ShareLinkView(props) {
|
|
|
4384
4379
|
styleString,
|
|
4385
4380
|
vanillaStyle$6),
|
|
4386
4381
|
h(CopyTextView, Object.assign({}, copyTextViewProps)),
|
|
4387
|
-
showSuccess && h("p", { class: sheet.classes.SuccessText }, successMessage),
|
|
4388
4382
|
customizeUrl && (customizeDisabled ? (h("sl-tooltip", { content: customizeDisabledTooltip, placement: "top", style: { display: "inline-block", width: "fit-content" } },
|
|
4389
4383
|
h("p", { class: sheet.classes.CustomizeLinkDisabled }, customizeLinkLabel))) : (h("p", { class: limitReached
|
|
4390
4384
|
? sheet.classes.CustomizeLinkDisabled
|
|
@@ -4399,6 +4393,7 @@ function ShareLinkView(props) {
|
|
|
4399
4393
|
|
|
4400
4394
|
const MAX_EDITS = 5;
|
|
4401
4395
|
const CHARACTER_LIMIT = 15;
|
|
4396
|
+
const MIN_CHARACTERS = 3;
|
|
4402
4397
|
const MessageLinkQuery$1 = dist.gql `
|
|
4403
4398
|
query ($programId: ID, $engagementMedium: UserEngagementMedium!) {
|
|
4404
4399
|
user: viewer {
|
|
@@ -4491,6 +4486,7 @@ function useShareLink(props) {
|
|
|
4491
4486
|
const [setCopied] = $e(SET_CODE_COPIED);
|
|
4492
4487
|
const [addShareLinkCode, { loading: isSaving }] = $e(ADD_SHARE_LINK_CODE);
|
|
4493
4488
|
const [validateLinkCode] = Xe(VALIDATE_LINK_CODE);
|
|
4489
|
+
const { refresh } = Qe();
|
|
4494
4490
|
const { data: linkDomainData } = wn(GET_LINK_DOMAIN, {}, !(user === null || user === void 0 ? void 0 : user.jwt) || !props.customizeUrl);
|
|
4495
4491
|
const { data: editCountData, refetch: refetchEditCount } = wn(SHARE_LINK_EDIT_COUNT, {}, !(user === null || user === void 0 ? void 0 : user.jwt) || !props.customizeUrl);
|
|
4496
4492
|
const copyString = (_b = ((contextData === null || contextData === void 0 ? void 0 : contextData.shareLink) || ((_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.shareLink))) !== null && _b !== void 0 ? _b :
|
|
@@ -4501,7 +4497,6 @@ function useShareLink(props) {
|
|
|
4501
4497
|
const [editValue, setEditValue] = useState("");
|
|
4502
4498
|
const [validationError, setValidationError] = useState(null);
|
|
4503
4499
|
const [isValidating, setIsValidating] = useState(false);
|
|
4504
|
-
const [showSuccess, setShowSuccess] = useState(false);
|
|
4505
4500
|
const debounceTimerRef = useRef(undefined);
|
|
4506
4501
|
const domainPrefix = parseDomainPrefix(copyString);
|
|
4507
4502
|
const hasPrimaryLinkDomain = ((_c = linkDomainData === null || linkDomainData === void 0 ? void 0 : linkDomainData.tenantSettings) === null || _c === void 0 ? void 0 : _c.primaryLinkDomain) != null;
|
|
@@ -4510,7 +4505,6 @@ function useShareLink(props) {
|
|
|
4510
4505
|
const editCount = vanityCount;
|
|
4511
4506
|
const editsRemaining = Math.max(0, MAX_EDITS - editCount);
|
|
4512
4507
|
const limitReached = editsRemaining <= 0;
|
|
4513
|
-
console.log({ vanityCount, editCount, editsRemaining });
|
|
4514
4508
|
function mapErrorCodeToInfo(errorCode) {
|
|
4515
4509
|
if (!errorCode)
|
|
4516
4510
|
return null;
|
|
@@ -4569,7 +4563,7 @@ function useShareLink(props) {
|
|
|
4569
4563
|
setValidationError(null);
|
|
4570
4564
|
if (debounceTimerRef.current)
|
|
4571
4565
|
clearTimeout(debounceTimerRef.current);
|
|
4572
|
-
if (!trimmed) {
|
|
4566
|
+
if (!trimmed || trimmed.length < MIN_CHARACTERS) {
|
|
4573
4567
|
setIsValidating(false);
|
|
4574
4568
|
return;
|
|
4575
4569
|
}
|
|
@@ -4591,7 +4585,7 @@ function useShareLink(props) {
|
|
|
4591
4585
|
}
|
|
4592
4586
|
async function onSave() {
|
|
4593
4587
|
var _a, _b;
|
|
4594
|
-
if (!editValue || validationError || isValidating)
|
|
4588
|
+
if (!editValue || editValue.length < MIN_CHARACTERS || validationError || isValidating)
|
|
4595
4589
|
return;
|
|
4596
4590
|
try {
|
|
4597
4591
|
await addShareLinkCode({
|
|
@@ -4604,9 +4598,8 @@ function useShareLink(props) {
|
|
|
4604
4598
|
},
|
|
4605
4599
|
});
|
|
4606
4600
|
setIsEditing(false);
|
|
4607
|
-
setShowSuccess(true);
|
|
4608
4601
|
await Promise.all([refetch(), refetchEditCount()]);
|
|
4609
|
-
|
|
4602
|
+
refresh();
|
|
4610
4603
|
}
|
|
4611
4604
|
catch (e) {
|
|
4612
4605
|
const errorCode = (_a = e === null || e === void 0 ? void 0 : e.extensions) === null || _a === void 0 ? void 0 : _a.code;
|
|
@@ -4634,7 +4627,6 @@ function useShareLink(props) {
|
|
|
4634
4627
|
customizeLinkLabel: props.customizeLinkLabel,
|
|
4635
4628
|
saveLabelText: props.saveLabelText,
|
|
4636
4629
|
cancelLabelText: props.cancelLabelText,
|
|
4637
|
-
successMessage: props.successMessage,
|
|
4638
4630
|
isEditing,
|
|
4639
4631
|
editValue,
|
|
4640
4632
|
domainPrefix,
|
|
@@ -4644,8 +4636,8 @@ function useShareLink(props) {
|
|
|
4644
4636
|
validationError,
|
|
4645
4637
|
isValidating,
|
|
4646
4638
|
isSaving,
|
|
4647
|
-
showSuccess,
|
|
4648
4639
|
characterLimit: CHARACTER_LIMIT,
|
|
4640
|
+
minCharacters: MIN_CHARACTERS,
|
|
4649
4641
|
charactersRemaining: CHARACTER_LIMIT - editValue.length,
|
|
4650
4642
|
editLimitText: props.editLimitText,
|
|
4651
4643
|
editLimitReachedText: props.editLimitReachedText,
|