@saasquatch/mint-components 2.1.8-22 → 2.1.8-24

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 (77) hide show
  1. package/dist/cjs/{ShadowViewAddon-643b83e2.js → ShadowViewAddon-1ed8faf9.js} +12 -8
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/mint-components.cjs.js +1 -1
  4. package/dist/cjs/sqm-big-stat_45.cjs.entry.js +4 -4
  5. package/dist/cjs/sqm-stencilbook.cjs.entry.js +590 -1146
  6. package/dist/collection/components/sqm-share-link/ShareLink.stories.js +1 -1
  7. package/dist/collection/components/sqm-share-link/UseShareLink.stories.js +1 -1
  8. package/dist/collection/components/sqm-share-link/sqm-share-link-view.js +37 -7
  9. package/dist/collection/components/sqm-share-link/sqm-share-link.js +24 -7
  10. package/dist/collection/components/sqm-share-link/useShareLink.js +3 -3
  11. package/dist/esm/{ShadowViewAddon-fcb6446a.js → ShadowViewAddon-395ab799.js} +12 -8
  12. package/dist/esm/loader.js +1 -1
  13. package/dist/esm/mint-components.js +1 -1
  14. package/dist/esm/sqm-big-stat_45.entry.js +4 -4
  15. package/dist/esm/sqm-stencilbook.entry.js +2773 -3329
  16. package/dist/esm-es5/{ShadowViewAddon-fcb6446a.js → ShadowViewAddon-395ab799.js} +1 -1
  17. package/dist/esm-es5/loader.js +1 -1
  18. package/dist/esm-es5/mint-components.js +1 -1
  19. package/dist/esm-es5/sqm-big-stat_45.entry.js +1 -1
  20. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  21. package/dist/mint-components/mint-components.esm.js +1 -1
  22. package/dist/mint-components/{p-3692c0da.system.entry.js → p-2b108f39.system.entry.js} +1 -1
  23. package/dist/mint-components/p-4b365f1f.system.js +1 -1
  24. package/dist/mint-components/{p-8d7548fb.system.entry.js → p-8e5a6491.system.entry.js} +1 -1
  25. package/dist/mint-components/{p-04502b80.entry.js → p-ba640335.entry.js} +2 -2
  26. package/dist/mint-components/{p-0eeb5438.js → p-cd79864c.js} +6 -6
  27. package/dist/mint-components/{p-5284bb02.system.js → p-d7adb7f3.system.js} +1 -1
  28. package/dist/mint-components/{p-31757712.entry.js → p-e6cf9daa.entry.js} +2 -2
  29. package/dist/types/components/sqm-share-link/sqm-share-link-view.d.ts +1 -1
  30. package/dist/types/components/sqm-share-link/sqm-share-link.d.ts +2 -1
  31. package/dist/types/components/sqm-share-link/useShareLink.d.ts +1 -1
  32. package/dist/types/components.d.ts +18 -234
  33. package/dist/types/global/android.d.ts +7 -0
  34. package/dist/types/global/demo.d.ts +2 -0
  35. package/dist/types/stories/features.d.ts +4 -0
  36. package/dist/types/stories/templates.d.ts +4 -0
  37. package/docs/docs.docx +0 -0
  38. package/docs/raisins.json +1 -1
  39. package/grapesjs/grapesjs.js +1 -1
  40. package/package.json +1 -1
  41. package/dist/cjs/sqm-share-link.cjs.entry.js +0 -271
  42. package/dist/cjs/useShareLink-1282123e.js +0 -422
  43. package/dist/cjs/useShareLink-3c22b1b9.js +0 -448
  44. package/dist/cjs/useShareLink-54e24928.js +0 -448
  45. package/dist/cjs/useShareLink-b664fbc7.js +0 -450
  46. package/dist/cjs/useShareLink-bf04b25c.js +0 -450
  47. package/dist/cjs/useShareLink-e8e2ae6d.js +0 -448
  48. package/dist/esm/sqm-share-link.entry.js +0 -267
  49. package/dist/esm/useShareLink-023284f3.js +0 -445
  50. package/dist/esm/useShareLink-436e9cad.js +0 -445
  51. package/dist/esm/useShareLink-4ba01373.js +0 -447
  52. package/dist/esm/useShareLink-79056582.js +0 -445
  53. package/dist/esm/useShareLink-a3329e33.js +0 -419
  54. package/dist/esm/useShareLink-bc20ec4c.js +0 -447
  55. package/dist/esm-es5/sqm-share-link.entry.js +0 -1
  56. package/dist/esm-es5/useShareLink-023284f3.js +0 -1
  57. package/dist/esm-es5/useShareLink-436e9cad.js +0 -1
  58. package/dist/esm-es5/useShareLink-4ba01373.js +0 -1
  59. package/dist/esm-es5/useShareLink-79056582.js +0 -1
  60. package/dist/esm-es5/useShareLink-a3329e33.js +0 -1
  61. package/dist/esm-es5/useShareLink-bc20ec4c.js +0 -1
  62. package/dist/mint-components/sqm-share-link.entry.js +0 -267
  63. package/dist/mint-components/sqm-share-link.system.entry.js +0 -1
  64. package/dist/mint-components/sqm-stencilbook.entry.js +0 -22106
  65. package/dist/mint-components/sqm-stencilbook.system.entry.js +0 -1
  66. package/dist/mint-components/useShareLink-023284f3.js +0 -445
  67. package/dist/mint-components/useShareLink-1d7c9fd8.system.js +0 -1
  68. package/dist/mint-components/useShareLink-211e061c.system.js +0 -1
  69. package/dist/mint-components/useShareLink-2de7ffce.system.js +0 -1
  70. package/dist/mint-components/useShareLink-436e9cad.js +0 -445
  71. package/dist/mint-components/useShareLink-454939f5.system.js +0 -1
  72. package/dist/mint-components/useShareLink-4ba01373.js +0 -447
  73. package/dist/mint-components/useShareLink-79056582.js +0 -445
  74. package/dist/mint-components/useShareLink-a3329e33.js +0 -419
  75. package/dist/mint-components/useShareLink-bc20ec4c.js +0 -447
  76. package/dist/mint-components/useShareLink-c05fe151.system.js +0 -1
  77. package/dist/mint-components/useShareLink-cb5abd96.system.js +0 -1
@@ -1,448 +0,0 @@
1
- 'use strict';
2
-
3
- const index = require('./index-fd67d7bc.js');
4
- const global = require('./global-746daf93.js');
5
- const domContextHooks_module = require('./dom-context-hooks.module-224e09d4.js');
6
- const index_module = require('./index.module-c79bd5b0.js');
7
- const JSS = require('./JSS-518e9b4d.js');
8
- const useReferralCodes = require('./useReferralCodes-4304f68f.js');
9
- const copyTextView = require('./copy-text-view-fd17b89a.js');
10
-
11
- const vanillaStyle = `
12
- :host {
13
- display: block;
14
- width: 100%;
15
- }
16
- `;
17
- function ShareLinkView(props) {
18
- 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;
19
- const style = {
20
- Container: {
21
- display: "flex",
22
- flexDirection: "column",
23
- gap: "var(--sl-spacing-xx-small)",
24
- width: "100%",
25
- },
26
- CustomizeLinkText: {
27
- margin: "0",
28
- fontSize: "var(--sl-font-size-small)",
29
- fontWeight: "600",
30
- cursor: "pointer",
31
- color: "var(--sl-color-neutral-900)",
32
- textAlign: "left",
33
- padding: "var(--sl-spacing-small)",
34
- "&:hover": {
35
- textDecoration: "underline",
36
- },
37
- },
38
- CustomizeLinkDisabled: {
39
- margin: "0",
40
- fontSize: "var(--sl-font-size-small)",
41
- fontWeight: "600",
42
- color: "var(--sl-color-neutral-400)",
43
- cursor: "default",
44
- textAlign: "left",
45
- padding: "var(--sl-spacing-small)",
46
- },
47
- EditContainer: {
48
- display: "flex",
49
- flexDirection: "column",
50
- gap: "var(--sl-spacing-x-small)",
51
- width: "100%",
52
- },
53
- EditInputWrapper: {
54
- display: "flex",
55
- alignItems: "center",
56
- width: "100%",
57
- border: "var(--sqm-border-thickness, 1px) solid var(--sqm-input-border-color, #d1d5db)",
58
- borderRadius: "var(--sqm-border-radius-normal, 4px)",
59
- background: "var(--sqm-input-background, #fff)",
60
- overflow: "hidden",
61
- "&:focus-within": {
62
- borderColor: "#999999",
63
- boxShadow: "0 0 0 var(--sl-focus-ring-width) var(--sl-input-focus-ring-color)",
64
- },
65
- },
66
- DomainPrefix: {
67
- padding: "0 0 0 var(--sl-spacing-medium)",
68
- fontSize: "var(--sl-font-size-medium)",
69
- color: "var(--sl-color-neutral-500)",
70
- whiteSpace: "nowrap",
71
- userSelect: "none",
72
- lineHeight: "var(--sl-input-height-medium)",
73
- },
74
- EditInput: {
75
- flex: "1",
76
- border: "none",
77
- outline: "none",
78
- padding: "0 var(--sl-spacing-medium) 0 0",
79
- fontSize: "var(--sl-font-size-medium)",
80
- fontFamily: "var(--sl-font-sans)",
81
- color: "var(--sl-input-color)",
82
- background: "transparent",
83
- lineHeight: "var(--sl-input-height-medium)",
84
- minWidth: "0",
85
- },
86
- EditLabel: {
87
- margin: "0",
88
- fontSize: "var(--sl-font-size-small)",
89
- color: "var(--sl-color-neutral-500)",
90
- },
91
- HelperText: {
92
- margin: "0",
93
- fontSize: "var(--sl-font-size-small)",
94
- color: "var(--sl-color-neutral-500)",
95
- },
96
- ErrorText: {
97
- margin: "0",
98
- fontSize: "var(--sl-font-size-small)",
99
- color: "var(--sqm-danger-color-text, #dc2626)",
100
- },
101
- ActionRow: {
102
- display: "flex",
103
- gap: "var(--sl-spacing-medium)",
104
- alignItems: "center",
105
- },
106
- SaveButton: {
107
- cursor: "pointer",
108
- fontFamily: "var(--sl-font-sans)",
109
- fontSize: "var(--sl-font-size-small)",
110
- fontWeight: "600",
111
- padding: "var(--sl-spacing-x-small) var(--sl-spacing-medium)",
112
- borderRadius: "var(--sqm-border-radius-normal, 4px)",
113
- border: "1px solid var(--sl-color-neutral-900)",
114
- background: "var(--sl-color-neutral-900)",
115
- color: "#fff",
116
- "&:disabled": {
117
- opacity: "0.5",
118
- cursor: "default",
119
- },
120
- },
121
- CancelButton: {
122
- margin: "0",
123
- fontSize: "var(--sl-font-size-small)",
124
- fontWeight: "600",
125
- cursor: "pointer",
126
- background: "none",
127
- border: "none",
128
- padding: "0",
129
- fontFamily: "var(--sl-font-sans)",
130
- color: "var(--sl-color-neutral-500)",
131
- },
132
- LimitReachedContainer: {
133
- display: "flex",
134
- alignItems: "center",
135
- gap: "var(--sl-spacing-x-small)",
136
- },
137
- };
138
- const sheet = JSS.createStyleSheet(style);
139
- const styleString = sheet.toString();
140
- const errorMessageType = (validationError === null || validationError === void 0 ? void 0 : validationError.code) === "EXISTING_CODE_CONFLICT" ? "info" : "warning";
141
- const showCharactersRemaining = charactersRemaining <= 14;
142
- console.log(customizeUrl, limitReached, customizeDisabled, validationError, "customize URL state");
143
- // Editing state
144
- if (isEditing) {
145
- return (index.h("div", { class: sheet.classes.Container },
146
- index.h("style", { type: "text/css" },
147
- styleString,
148
- vanillaStyle),
149
- index.h("p", { class: sheet.classes.EditLabel }, "Enter your link"),
150
- index.h("div", { class: sheet.classes.EditInputWrapper },
151
- index.h("span", { class: sheet.classes.DomainPrefix }, domainPrefix),
152
- index.h("input", { class: sheet.classes.EditInput, type: "text", value: editValue, onInput: (e) => onEditValueChange(e.target.value), onKeyDown: (e) => {
153
- if (e.key === "/" || e.key === "@")
154
- e.preventDefault();
155
- }, disabled: isSaving, maxLength: characterLimit })),
156
- index.h("p", { class: sheet.classes.HelperText },
157
- editLimitText,
158
- showCharactersRemaining &&
159
- ` Characters remaining: ${charactersRemaining}`),
160
- validationError && (index.h("sqm-form-message", { type: errorMessageType, style: { paddingBottom: "var(--sl-spacing-xx-small)" } },
161
- index.h("p", { part: "alert-title" }, validationError.title),
162
- validationError.description)),
163
- isValidating && index.h("p", { class: sheet.classes.HelperText }, "Validating..."),
164
- index.h("div", { class: sheet.classes.ActionRow },
165
- index.h("sl-button", { class: sheet.classes.SaveButton, onClick: onSave, disabled: isSaving ||
166
- isValidating ||
167
- !!validationError ||
168
- !editValue ||
169
- editValue.length < minCharacters }, isSaving ? "Saving..." : saveLabelText),
170
- index.h("sl-button", { class: sheet.classes.CancelButton, onClick: onCancel, disabled: isSaving }, cancelLabelText))));
171
- }
172
- // Default / Customized / Limit reached states
173
- return (index.h("div", { class: sheet.classes.Container },
174
- index.h("style", { type: "text/css" },
175
- styleString,
176
- vanillaStyle),
177
- index.h(copyTextView.CopyTextView, Object.assign({}, copyTextViewProps)),
178
- customizeUrl &&
179
- (customizeDisabled ? (index.h("sl-tooltip", { content: customizeDisabledTooltip, placement: "top", style: { display: "inline-block", width: "fit-content" } },
180
- index.h("p", { class: sheet.classes.CustomizeLinkDisabled }, customizeLinkLabel))) : (index.h("div", { class: sheet.classes.LimitReachedContainer },
181
- index.h("p", { class: limitReached
182
- ? sheet.classes.CustomizeLinkDisabled
183
- : sheet.classes.CustomizeLinkText, onClick: limitReached ? undefined : onCustomizeClick }, customizeLinkLabel),
184
- customizeUrl && limitReached && (index.h("p", { class: sheet.classes.HelperText }, global.intl.formatMessage({
185
- id: "editLimitReached",
186
- defaultMessage: editLimitReachedText,
187
- }, {
188
- supportLink: (index.h("a", { target: "_blank", href: "https://help.impact.com/other/readme/get-help-and-support" }, supportLinkText)),
189
- }))))))));
190
- }
191
-
192
- const MAX_EDITS = 5;
193
- const CHARACTER_LIMIT = 15;
194
- const MIN_CHARACTERS = 3;
195
- const MessageLinkQuery = index_module.dist.gql `
196
- query ($programId: ID) {
197
- user: viewer {
198
- ... on User {
199
- shareLink(programId: $programId)
200
- }
201
- }
202
- }
203
- `;
204
- const WIDGET_ENGAGEMENT_EVENT = index_module.dist.gql `
205
- mutation loadEvent($eventMeta: UserAnalyticsEvent!) {
206
- createUserAnalyticsEvent(eventMeta: $eventMeta)
207
- }
208
- `;
209
- const ADD_SHARE_LINK_CODE = index_module.dist.gql `
210
- mutation ($addShareLinkCodeInput: AddShareLinkCodeInput!) {
211
- addShareLinkCode(addShareLinkCodeInput: $addShareLinkCodeInput) {
212
- linkCode {
213
- linkCode
214
- shortUrl
215
- referralCode {
216
- code
217
- }
218
- }
219
- }
220
- }
221
- `;
222
- const VALIDATE_LINK_CODE = index_module.dist.gql `
223
- query validateLinkCode($linkCode: String!) {
224
- validateLinkCode(linkCode: $linkCode) {
225
- valid
226
- invalidReason
227
- }
228
- }
229
- `;
230
- const GET_LINK_DOMAIN = index_module.dist.gql `
231
- query getLinkDomain {
232
- tenantSettings {
233
- primaryLinkDomain {
234
- host
235
- }
236
- }
237
- }
238
- `;
239
- const SHARE_LINK_EDIT_COUNT = index_module.dist.gql `
240
- query shareLinkEditCount {
241
- viewer {
242
- ... on User {
243
- shareLinkCodes {
244
- totalCount
245
- data {
246
- isVanity
247
- }
248
- }
249
- }
250
- }
251
- }
252
- `;
253
- function parseShareUrl(url) {
254
- try {
255
- const parsed = new URL(url);
256
- return {
257
- url: parsed.origin + parsed.pathname,
258
- domain: parsed.origin + "/",
259
- path: parsed.pathname.slice(1),
260
- };
261
- }
262
- catch {
263
- return { url, domain: url, path: "" };
264
- }
265
- }
266
- function useShareLink(props) {
267
- var _a, _b, _c, _d, _e, _f, _g;
268
- const { programId = index_module.H() } = props;
269
- const user = index_module.J();
270
- const engagementMedium = index_module.B();
271
- const contextData = index_module.Fn(useReferralCodes.REFERRAL_CODES_NAMESPACE);
272
- const { data, refetch } = index_module.wn(MessageLinkQuery, { programId }, !(user === null || user === void 0 ? void 0 : user.jwt) || !!props.linkOverride || (contextData === null || contextData === void 0 ? void 0 : contextData.shareLink) !== undefined);
273
- const [sendLoadEvent] = index_module.$e(WIDGET_ENGAGEMENT_EVENT);
274
- const [setCopied] = index_module.$e(useReferralCodes.SET_CODE_COPIED);
275
- const [addShareLinkCode, { loading: isSaving }] = index_module.$e(ADD_SHARE_LINK_CODE);
276
- const [validateLinkCode] = index_module.Xe(VALIDATE_LINK_CODE);
277
- const { refresh } = index_module.Qe();
278
- const { data: linkDomainData } = index_module.wn(GET_LINK_DOMAIN, {}, !(user === null || user === void 0 ? void 0 : user.jwt) || !props.customizeUrl);
279
- const { data: editCountData, refetch: refetchEditCount } = index_module.wn(SHARE_LINK_EDIT_COUNT, {}, !(user === null || user === void 0 ? void 0 : user.jwt) || !props.customizeUrl);
280
- const { url: copyString, domain: domainPrefix, path: pathSuffix, } = parseShareUrl((_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 :
281
- // Shown during loading
282
- "...");
283
- const [open, setOpen] = domContextHooks_module.useState(false);
284
- const [isEditing, setIsEditing] = domContextHooks_module.useState(false);
285
- const [editValue, setEditValue] = domContextHooks_module.useState("");
286
- const [validationError, setValidationError] = domContextHooks_module.useState(null);
287
- const [isValidating, setIsValidating] = domContextHooks_module.useState(false);
288
- const debounceTimerRef = domContextHooks_module.useRef(undefined);
289
- const hasPrimaryLinkDomain = ((_c = linkDomainData === null || linkDomainData === void 0 ? void 0 : linkDomainData.tenantSettings) === null || _c === void 0 ? void 0 : _c.primaryLinkDomain) != null;
290
- const customizeDisabled = !hasPrimaryLinkDomain;
291
- const vanityCount = (_g = (_f = (_e = (_d = editCountData === null || editCountData === void 0 ? void 0 : editCountData.viewer) === null || _d === void 0 ? void 0 : _d.shareLinkCodes) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f.filter((code) => code.isVanity).length) !== null && _g !== void 0 ? _g : 0;
292
- const editCount = vanityCount;
293
- const editsRemaining = Math.max(0, MAX_EDITS - editCount);
294
- const limitReached = editsRemaining <= 0;
295
- function mapErrorCodeToInfo(errorCode) {
296
- if (!errorCode)
297
- return null;
298
- const errorMap = {
299
- EXISTING_CODE_CONFLICT: {
300
- code: "EXISTING_CODE_CONFLICT",
301
- title: props.existingCodeConflictErrorTitle,
302
- description: props.existingCodeConflictErrorDescription,
303
- },
304
- INVALID_CHARACTER: {
305
- code: "INVALID_CHARACTER",
306
- title: props.invalidCharactersErrorTitle,
307
- description: props.invalidCharactersErrorDescription,
308
- },
309
- BLOCKED_WORD: {
310
- code: "BLOCKED_WORD",
311
- title: props.profanityErrorTitle,
312
- description: props.profanityErrorDescription,
313
- },
314
- };
315
- return errorMap[errorCode];
316
- }
317
- async function onClick() {
318
- if (contextData) {
319
- await setCopied({ referralCode: contextData.referralCode });
320
- contextData.refresh();
321
- }
322
- // Should well supported: https://developer.mozilla.org/en-US/docs/Web/API/Clipboard#browser_compatibility
323
- // Only if called from a user-initiated event
324
- navigator.clipboard.writeText(copyString);
325
- setOpen(true);
326
- setTimeout(() => setOpen(false), props.tooltiplifespan);
327
- sendLoadEvent({
328
- eventMeta: {
329
- programId,
330
- id: user === null || user === void 0 ? void 0 : user.id,
331
- accountId: user === null || user === void 0 ? void 0 : user.accountId,
332
- type: "USER_REFERRAL_PROGRAM_ENGAGEMENT_EVENT",
333
- meta: {
334
- engagementMedium,
335
- shareMedium: "DIRECT",
336
- },
337
- },
338
- });
339
- }
340
- function onCustomizeClick() {
341
- if (limitReached || customizeDisabled)
342
- return;
343
- setIsEditing(true);
344
- setEditValue(editCount === 0 ? "" : pathSuffix);
345
- setValidationError(null);
346
- }
347
- function onEditValueChange(value) {
348
- const trimmed = value.slice(0, CHARACTER_LIMIT);
349
- setEditValue(trimmed);
350
- setValidationError(null);
351
- if (debounceTimerRef.current)
352
- clearTimeout(debounceTimerRef.current);
353
- if (!trimmed || trimmed.length < MIN_CHARACTERS) {
354
- setIsValidating(false);
355
- return;
356
- }
357
- setIsValidating(true);
358
- debounceTimerRef.current = setTimeout(async () => {
359
- var _a, _b;
360
- try {
361
- const result = await validateLinkCode({ linkCode: trimmed });
362
- if (!((_a = result === null || result === void 0 ? void 0 : result.validateLinkCode) === null || _a === void 0 ? void 0 : _a.valid)) {
363
- const reason = (_b = result === null || result === void 0 ? void 0 : result.validateLinkCode) === null || _b === void 0 ? void 0 : _b.invalidReason;
364
- console.log(reason, "validation error reason from validateLinkCode query");
365
- setValidationError(mapErrorCodeToInfo(reason));
366
- }
367
- }
368
- catch {
369
- // Validation query failed — don't block the user
370
- }
371
- setIsValidating(false);
372
- }, 2000);
373
- }
374
- async function onSave() {
375
- var _a, _b;
376
- if (!editValue ||
377
- editValue.length < MIN_CHARACTERS ||
378
- validationError ||
379
- isValidating)
380
- return;
381
- try {
382
- await addShareLinkCode({
383
- addShareLinkCodeInput: {
384
- userId: user === null || user === void 0 ? void 0 : user.id,
385
- accountId: user === null || user === void 0 ? void 0 : user.accountId,
386
- programId,
387
- linkCode: editValue,
388
- makeShareLinkCodePrimaryForReferralCode: true,
389
- },
390
- });
391
- setIsEditing(false);
392
- await Promise.all([refetch(), refetchEditCount()]);
393
- refresh();
394
- }
395
- catch (e) {
396
- const errorCode = (_a = e === null || e === void 0 ? void 0 : e.extensions) === null || _a === void 0 ? void 0 : _a.code;
397
- console.log(errorCode, "errorCode from addSharelInkCodeMutation");
398
- setValidationError((_b = mapErrorCodeToInfo(errorCode)) !== null && _b !== void 0 ? _b : {
399
- code: null,
400
- title: "Error",
401
- description: (e === null || e === void 0 ? void 0 : e.message) || "Failed to save custom link. Please try again.",
402
- });
403
- }
404
- }
405
- function onCancel() {
406
- setIsEditing(false);
407
- setEditValue("");
408
- setValidationError(null);
409
- setIsValidating(false);
410
- }
411
- console.log(validationError, "validation error state"); // TEMP --- IGNORE ---
412
- return {
413
- copyTextViewProps: {
414
- ...props,
415
- onClick,
416
- open,
417
- copyString,
418
- },
419
- customizeUrl: props.customizeUrl,
420
- customizeLinkLabel: props.customizeLinkLabel,
421
- saveLabelText: props.saveLabelText,
422
- cancelLabelText: props.cancelLabelText,
423
- isEditing,
424
- editValue,
425
- domainPrefix,
426
- editsRemaining,
427
- maxEdits: MAX_EDITS,
428
- limitReached,
429
- validationError,
430
- isValidating,
431
- isSaving,
432
- characterLimit: CHARACTER_LIMIT,
433
- minCharacters: MIN_CHARACTERS,
434
- charactersRemaining: CHARACTER_LIMIT - editValue.length,
435
- editLimitText: props.editLimitText,
436
- editLimitReachedText: props.editLimitReachedText,
437
- supportLinkText: props.supportLinkText,
438
- customizeDisabled,
439
- customizeDisabledTooltip: props.customizeDisabledTooltip,
440
- onCustomizeClick,
441
- onEditValueChange,
442
- onSave,
443
- onCancel,
444
- };
445
- }
446
-
447
- exports.ShareLinkView = ShareLinkView;
448
- exports.useShareLink = useShareLink;