@saasquatch/mint-components 2.1.10-56 → 2.1.10

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 (152) hide show
  1. package/dist/cjs/{ShadowViewAddon-a26deae6.js → ShadowViewAddon-c97e80de.js} +422 -19
  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_46.cjs.entry.js → sqm-big-stat_45.cjs.entry.js} +264 -89
  5. package/dist/cjs/sqm-code-verification.cjs.entry.js +1 -1
  6. package/dist/cjs/sqm-email-verification.cjs.entry.js +1 -1
  7. package/dist/cjs/sqm-empty_4.cjs.entry.js +1 -1
  8. package/dist/cjs/{sqm-portal-container-view-70a47420.js → sqm-portal-container-view-757f921b.js} +5 -6
  9. package/dist/cjs/{sqm-portal-email-verification-view-c81fe7f1.js → sqm-portal-email-verification-view-abb773a7.js} +1 -1
  10. package/dist/cjs/sqm-portal-email-verification.cjs.entry.js +2 -2
  11. package/dist/cjs/sqm-portal-forgot-password_6.cjs.entry.js +5 -5
  12. package/dist/cjs/{sqm-portal-profile-view-639337e3.js → sqm-portal-profile-view-3515e1e5.js} +1 -1
  13. package/dist/cjs/sqm-portal-profile.cjs.entry.js +2 -2
  14. package/dist/cjs/{sqm-portal-registration-form-view-020f661c.js → sqm-portal-registration-form-view-a45f7a52.js} +1 -1
  15. package/dist/cjs/{sqm-portal-reset-password-view-6b1acd90.js → sqm-portal-reset-password-view-a767b044.js} +1 -1
  16. package/dist/cjs/sqm-portal-reset-password.cjs.entry.js +2 -2
  17. package/dist/cjs/{sqm-portal-verify-email-view-424e406a.js → sqm-portal-verify-email-view-717d0633.js} +1 -1
  18. package/dist/cjs/sqm-referral-table_11.cjs.entry.js +1 -1
  19. package/dist/cjs/sqm-rewards-table-customer-note-cell.cjs.entry.js +1 -1
  20. package/dist/cjs/sqm-stencilbook.cjs.entry.js +168 -59
  21. package/dist/cjs/{sqm-text-span-view-f274fdf2.js → sqm-text-span-view-b9e10f5d.js} +1 -1
  22. package/dist/cjs/sqm-text-span.cjs.entry.js +1 -1
  23. package/dist/collection/collection-manifest.json +0 -1
  24. package/dist/collection/components/sqm-password-field/sqm-password-field.js +1 -0
  25. package/dist/collection/components/sqm-portal-container/sqm-portal-container-view.js +6 -7
  26. package/dist/collection/components/sqm-portal-google-login/sqm-portal-google-login.js +1 -1
  27. package/dist/collection/components/sqm-portal-login/sqm-portal-login.js +1 -1
  28. package/dist/collection/components/sqm-share-code/sqm-share-code.js +0 -1
  29. package/dist/collection/components/sqm-share-link/ShareLink.stories.js +136 -11
  30. package/dist/collection/components/sqm-share-link/UseShareLink.stories.js +14 -5
  31. package/dist/collection/components/sqm-share-link/sqm-share-link-view.js +192 -0
  32. package/dist/collection/components/sqm-share-link/sqm-share-link.js +935 -48
  33. package/dist/collection/components/sqm-share-link/useShareLink.js +227 -14
  34. package/dist/collection/components/sqm-stencilbook/sqm-stencilbook.js +0 -2
  35. package/dist/collection/components/sqm-text-span/sqm-text-span-view.js +1 -1
  36. package/dist/esm/{ShadowViewAddon-47f1e579.js → ShadowViewAddon-33f1a8f7.js} +424 -22
  37. package/dist/esm/loader.js +1 -1
  38. package/dist/esm/mint-components.js +1 -1
  39. package/dist/esm/{sqm-big-stat_46.entry.js → sqm-big-stat_45.entry.js} +265 -89
  40. package/dist/esm/sqm-code-verification.entry.js +1 -1
  41. package/dist/esm/sqm-email-verification.entry.js +1 -1
  42. package/dist/esm/sqm-empty_4.entry.js +1 -1
  43. package/dist/esm/{sqm-portal-container-view-a8c708cd.js → sqm-portal-container-view-200c9df8.js} +6 -7
  44. package/dist/esm/{sqm-portal-email-verification-view-426370f1.js → sqm-portal-email-verification-view-04528277.js} +1 -1
  45. package/dist/esm/sqm-portal-email-verification.entry.js +2 -2
  46. package/dist/esm/sqm-portal-forgot-password_6.entry.js +5 -5
  47. package/dist/esm/{sqm-portal-profile-view-f015fd6a.js → sqm-portal-profile-view-b5ea620f.js} +1 -1
  48. package/dist/esm/sqm-portal-profile.entry.js +2 -2
  49. package/dist/esm/{sqm-portal-registration-form-view-2f4936ef.js → sqm-portal-registration-form-view-79265df5.js} +1 -1
  50. package/dist/esm/{sqm-portal-reset-password-view-cfbc0eb0.js → sqm-portal-reset-password-view-f84c04cf.js} +1 -1
  51. package/dist/esm/sqm-portal-reset-password.entry.js +2 -2
  52. package/dist/esm/{sqm-portal-verify-email-view-1a638fae.js → sqm-portal-verify-email-view-c61536b7.js} +1 -1
  53. package/dist/esm/sqm-referral-table_11.entry.js +1 -1
  54. package/dist/esm/sqm-rewards-table-customer-note-cell.entry.js +1 -1
  55. package/dist/esm/sqm-stencilbook.entry.js +168 -59
  56. package/dist/esm/{sqm-text-span-view-738acfb3.js → sqm-text-span-view-72f43dff.js} +1 -1
  57. package/dist/esm/sqm-text-span.entry.js +1 -1
  58. package/dist/esm-es5/ShadowViewAddon-33f1a8f7.js +1 -0
  59. package/dist/esm-es5/loader.js +1 -1
  60. package/dist/esm-es5/mint-components.js +1 -1
  61. package/dist/esm-es5/sqm-big-stat_45.entry.js +1 -0
  62. package/dist/esm-es5/sqm-code-verification.entry.js +1 -1
  63. package/dist/esm-es5/sqm-email-verification.entry.js +1 -1
  64. package/dist/esm-es5/sqm-empty_4.entry.js +1 -1
  65. package/dist/esm-es5/sqm-portal-container-view-200c9df8.js +1 -0
  66. package/dist/esm-es5/{sqm-portal-email-verification-view-426370f1.js → sqm-portal-email-verification-view-04528277.js} +1 -1
  67. package/dist/esm-es5/sqm-portal-email-verification.entry.js +1 -1
  68. package/dist/esm-es5/sqm-portal-forgot-password_6.entry.js +1 -1
  69. package/dist/esm-es5/{sqm-portal-profile-view-f015fd6a.js → sqm-portal-profile-view-b5ea620f.js} +1 -1
  70. package/dist/esm-es5/sqm-portal-profile.entry.js +1 -1
  71. package/dist/esm-es5/{sqm-portal-registration-form-view-2f4936ef.js → sqm-portal-registration-form-view-79265df5.js} +1 -1
  72. package/dist/esm-es5/{sqm-portal-reset-password-view-cfbc0eb0.js → sqm-portal-reset-password-view-f84c04cf.js} +1 -1
  73. package/dist/esm-es5/sqm-portal-reset-password.entry.js +1 -1
  74. package/dist/esm-es5/{sqm-portal-verify-email-view-1a638fae.js → sqm-portal-verify-email-view-c61536b7.js} +1 -1
  75. package/dist/esm-es5/sqm-referral-table_11.entry.js +1 -1
  76. package/dist/esm-es5/sqm-rewards-table-customer-note-cell.entry.js +1 -1
  77. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  78. package/dist/esm-es5/{sqm-text-span-view-738acfb3.js → sqm-text-span-view-72f43dff.js} +1 -1
  79. package/dist/esm-es5/sqm-text-span.entry.js +1 -1
  80. package/dist/mint-components/mint-components.esm.js +1 -1
  81. package/dist/mint-components/{p-ab0ea688.system.entry.js → p-00b235c5.system.entry.js} +1 -1
  82. package/dist/mint-components/p-08930b83.js +499 -0
  83. package/dist/mint-components/p-0b1e90fe.system.js +1 -0
  84. package/dist/mint-components/p-1021a49f.system.entry.js +1 -0
  85. package/dist/mint-components/{p-25558a33.entry.js → p-13292317.entry.js} +1 -1
  86. package/dist/mint-components/{p-d65991d0.entry.js → p-13d1b10d.entry.js} +1 -1
  87. package/dist/mint-components/{p-d4570314.entry.js → p-1d92c169.entry.js} +1 -1
  88. package/dist/mint-components/{p-7161e1a6.js → p-2668335b.js} +1 -1
  89. package/dist/mint-components/{p-6e512063.entry.js → p-3af3e2c1.entry.js} +1 -1
  90. package/dist/mint-components/{p-5ff7b000.entry.js → p-40bad95a.entry.js} +1 -1
  91. package/dist/mint-components/{p-f35d856a.system.js → p-43c31fd5.system.js} +1 -1
  92. package/dist/mint-components/p-5bc5c61e.entry.js +1 -0
  93. package/dist/mint-components/{p-dac20392.system.js → p-686dd5eb.system.js} +1 -1
  94. package/dist/mint-components/{p-7b909aa5.system.js → p-7562cd98.system.js} +1 -1
  95. package/dist/mint-components/p-76271ec4.entry.js +9 -0
  96. package/dist/mint-components/p-78b40f71.system.js +1 -0
  97. package/dist/mint-components/{p-cb0a5990.entry.js → p-7939e4af.entry.js} +1 -1
  98. package/dist/mint-components/{p-e6ace3ab.js → p-832aea99.js} +1 -1
  99. package/dist/mint-components/{p-a7f52290.entry.js → p-8784539d.entry.js} +21 -29
  100. package/dist/mint-components/{p-b9f57e84.system.entry.js → p-8899ff38.system.entry.js} +1 -1
  101. package/dist/mint-components/{p-fbe00c97.system.entry.js → p-892797eb.system.entry.js} +1 -1
  102. package/dist/mint-components/{p-d997001a.js → p-8962e023.js} +1 -1
  103. package/dist/mint-components/{p-dd368927.system.entry.js → p-9390586b.system.entry.js} +1 -1
  104. package/dist/mint-components/{p-3c46b4dd.system.js → p-a4825ec2.system.js} +1 -1
  105. package/dist/mint-components/{p-058aefe1.entry.js → p-af407cce.entry.js} +1 -1
  106. package/dist/mint-components/{p-56ca7e3c.js → p-b3ad957c.js} +1 -1
  107. package/dist/mint-components/{p-70570e4d.system.entry.js → p-b96e90a2.system.entry.js} +1 -1
  108. package/dist/mint-components/{p-c67f8558.system.entry.js → p-bba16a46.system.entry.js} +1 -1
  109. package/dist/mint-components/{p-669d52c4.js → p-bee4af5d.js} +1 -1
  110. package/dist/mint-components/p-c3c8d4ee.system.entry.js +1 -0
  111. package/dist/mint-components/{p-cabf6326.js → p-c813ec64.js} +1 -1
  112. package/dist/mint-components/p-ca098be1.system.js +1 -1
  113. package/dist/mint-components/{p-18133026.system.entry.js → p-d3b1ab20.system.entry.js} +1 -1
  114. package/dist/mint-components/{p-692e14c5.system.js → p-d55c50af.system.js} +1 -1
  115. package/dist/mint-components/p-dd12c32a.system.entry.js +1 -0
  116. package/dist/mint-components/p-e30abc44.js +1 -0
  117. package/dist/mint-components/{p-fb5c9802.entry.js → p-e506bf7f.entry.js} +1 -1
  118. package/dist/mint-components/{p-aefc6c4f.system.entry.js → p-e9485160.system.entry.js} +1 -1
  119. package/dist/mint-components/{p-f0baeed0.entry.js → p-f6528f8a.entry.js} +1 -1
  120. package/dist/mint-components/{p-5141769d.system.entry.js → p-f7ca4cc4.system.entry.js} +1 -1
  121. package/dist/mint-components/{p-e4f17c21.system.js → p-f8026ed6.system.js} +1 -1
  122. package/dist/types/components/sqm-share-link/ShareLink.stories.d.ts +9 -0
  123. package/dist/types/components/sqm-share-link/UseShareLink.stories.d.ts +6 -0
  124. package/dist/types/components/sqm-share-link/sqm-share-link-view.d.ts +41 -0
  125. package/dist/types/components/sqm-share-link/sqm-share-link.d.ts +195 -2
  126. package/dist/types/components/sqm-share-link/useShareLink.d.ts +33 -4
  127. package/dist/types/components.d.ts +349 -74
  128. package/docs/docs.docx +0 -0
  129. package/docs/raisins.json +1 -1
  130. package/docs/stats.json +122783 -0
  131. package/grapesjs/grapesjs.js +1 -1
  132. package/package.json +2 -2
  133. package/dist/collection/components/sqm-user-attribute/UserAttribute.stories.js +0 -25
  134. package/dist/collection/components/sqm-user-attribute/sqm-user-attribute-view.js +0 -19
  135. package/dist/collection/components/sqm-user-attribute/sqm-user-attribute.js +0 -163
  136. package/dist/collection/components/sqm-user-attribute/useUserAttribute.js +0 -26
  137. package/dist/esm-es5/ShadowViewAddon-47f1e579.js +0 -1
  138. package/dist/esm-es5/sqm-big-stat_46.entry.js +0 -1
  139. package/dist/esm-es5/sqm-portal-container-view-a8c708cd.js +0 -1
  140. package/dist/mint-components/p-0a3d4374.system.entry.js +0 -1
  141. package/dist/mint-components/p-217dedde.js +0 -463
  142. package/dist/mint-components/p-2cce6e14.entry.js +0 -9
  143. package/dist/mint-components/p-55676213.entry.js +0 -1
  144. package/dist/mint-components/p-8fb1708b.system.entry.js +0 -1
  145. package/dist/mint-components/p-b699f76e.system.js +0 -1
  146. package/dist/mint-components/p-b6a1e2ac.js +0 -1
  147. package/dist/mint-components/p-ce050888.system.js +0 -1
  148. package/dist/mint-components/p-e3497e0e.system.entry.js +0 -1
  149. package/dist/types/components/sqm-user-attribute/UserAttribute.stories.d.ts +0 -7
  150. package/dist/types/components/sqm-user-attribute/sqm-user-attribute-view.d.ts +0 -8
  151. package/dist/types/components/sqm-user-attribute/sqm-user-attribute.d.ts +0 -42
  152. package/dist/types/components/sqm-user-attribute/useUserAttribute.d.ts +0 -3
@@ -1,20 +1,20 @@
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
- import { b as browser, u as useMemo, k as useState } 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 } from './index.module-b23fdad8.js';
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, 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';
8
8
  import { a as REFERRAL_CODES_NAMESPACE, S as SET_CODE_COPIED } from './useReferralCodes-52ca720f.js';
9
9
  import { H as HostBlock, A as AuthWrapper, a as AuthColumn, b as AuthButtonsContainer, E as ErrorStyles } from './mixins-f750863a.js';
10
10
  import { C as CopyTextView } from './copy-text-view-87259b11.js';
11
- import { T as TextSpanView } from './sqm-text-span-view-738acfb3.js';
11
+ import { T as TextSpanView } from './sqm-text-span-view-72f43dff.js';
12
12
  import { u as useChildElements } from './useChildElements-9bccfb72.js';
13
13
  import { l as luxon } from './luxon-1be92a8e.js';
14
14
  import { p as pathToRegexp } from './index-ffa26b43.js';
15
15
  import { o as optimizeCloudinaryUrl } from './imageUrl-4775f17b.js';
16
16
  import { a as isValidColor, b as isMobile } from './utilities-77b1e0cc.js';
17
- import { a as PortalSectionView, P as PortalContainerView } from './sqm-portal-container-view-a8c708cd.js';
17
+ import { a as PortalSectionView, P as PortalContainerView } from './sqm-portal-container-view-200c9df8.js';
18
18
 
19
19
  function BigStatView(props) {
20
20
  const { statvalue, flexReverse, alignment, statTextColor, statFontSize, descriptionTextColor, descriptionFontSize, statFontWeight, } = props;
@@ -4227,15 +4227,203 @@ function useShareButton(props) {
4227
4227
  };
4228
4228
  }
4229
4229
 
4230
+ const vanillaStyle$6 = `
4231
+ :host {
4232
+ display: block;
4233
+ width: 100%;
4234
+ }
4235
+ `;
4236
+ function ShareLinkView(props) {
4237
+ const { copyTextViewProps, allowCustomization, customizeLinkLabel, saveLabelText, savingLabelText, cancelLabelText, editLabelText, charactersRemainingText, validatingLabelText, isEditing, editValue, domainPrefix, editsRemaining, limitReached, validationError, isValidating, isSaving, characterLimit, minCharacters, charactersRemaining, editLimitText, editLimitReachedText, supportLinkText, customizeDisabled, customizeDisabledTooltip, onCustomizeClick, onEditValueChange, onSave, onCancel, minCharactersText, } = props;
4238
+ const style = {
4239
+ Container: {
4240
+ display: "flex",
4241
+ flexDirection: "column",
4242
+ gap: "var(--sl-spacing-xx-small)",
4243
+ width: "100%",
4244
+ },
4245
+ CustomizeLinkText: {
4246
+ paddingTop: "var(--sl-spacing-xx-small)",
4247
+ margin: "0",
4248
+ fontSize: "var(--sl-font-size-small)",
4249
+ fontWeight: "600",
4250
+ cursor: "pointer",
4251
+ color: "var(--sl-color-neutral-900)",
4252
+ textAlign: "left",
4253
+ "&:hover": {
4254
+ textDecoration: "underline",
4255
+ },
4256
+ },
4257
+ CustomizeLinkDisabled: {
4258
+ paddingTop: "var(--sl-spacing-xx-small)",
4259
+ margin: "0",
4260
+ fontSize: "var(--sl-font-size-small)",
4261
+ fontWeight: "600",
4262
+ color: "var(--sl-color-neutral-400)",
4263
+ cursor: "default",
4264
+ textAlign: "left",
4265
+ },
4266
+ EditContainer: {
4267
+ display: "flex",
4268
+ flexDirection: "column",
4269
+ gap: "var(--sl-spacing-x-small)",
4270
+ width: "100%",
4271
+ },
4272
+ EditInputWrapper: {
4273
+ display: "flex",
4274
+ alignItems: "center",
4275
+ width: "100%",
4276
+ border: "var(--sqm-border-thickness, 1px) solid var(--sqm-input-border-color, #d1d5db)",
4277
+ borderRadius: "var(--sqm-border-radius-normal, 4px)",
4278
+ background: "var(--sqm-input-background, #fff)",
4279
+ overflow: "hidden",
4280
+ "&:focus-within": {
4281
+ borderColor: "#999999",
4282
+ boxShadow: "0 0 0 var(--sl-focus-ring-width) var(--sl-input-focus-ring-color)",
4283
+ },
4284
+ },
4285
+ DomainPrefix: {
4286
+ padding: "0 0 0 var(--sl-spacing-medium)",
4287
+ fontSize: "var(--sl-font-size-medium)",
4288
+ color: "var(--sl-color-neutral-500)",
4289
+ whiteSpace: "nowrap",
4290
+ userSelect: "none",
4291
+ lineHeight: "var(--sl-input-height-medium)",
4292
+ },
4293
+ EditInput: {
4294
+ "&::part(base)": {
4295
+ border: "none",
4296
+ borderRadius: "0",
4297
+ },
4298
+ "&::part(input)": {
4299
+ margin: 0,
4300
+ },
4301
+ },
4302
+ EditLabel: {
4303
+ margin: "0",
4304
+ fontSize: "var(--sl-font-size-small)",
4305
+ color: "var(--sl-color-neutral-500)",
4306
+ },
4307
+ HelperText: {
4308
+ paddingTop: "var(--sl-spacing-xx-small)",
4309
+ margin: "0",
4310
+ fontSize: "var(--sl-font-size-small)",
4311
+ color: "var(--sl-color-neutral-500)",
4312
+ },
4313
+ ErrorText: {
4314
+ margin: "0",
4315
+ fontSize: "var(--sl-font-size-small)",
4316
+ color: "var(--sqm-danger-color-text, #dc2626)",
4317
+ },
4318
+ ActionRow: {
4319
+ display: "flex",
4320
+ gap: "var(--sl-spacing-medium)",
4321
+ alignItems: "center",
4322
+ },
4323
+ SaveButton: {
4324
+ cursor: "pointer",
4325
+ fontFamily: "var(--sl-font-sans)",
4326
+ fontSize: "var(--sl-font-size-small)",
4327
+ fontWeight: "600",
4328
+ padding: "var(--sl-spacing-x-small) var(--sl-spacing-medium)",
4329
+ borderRadius: "var(--sqm-border-radius-normal, 4px)",
4330
+ border: "1px solid var(--sl-color-neutral-900)",
4331
+ background: "var(--sl-color-neutral-900)",
4332
+ color: "#fff",
4333
+ "&:disabled": {
4334
+ opacity: "0.5",
4335
+ cursor: "default",
4336
+ },
4337
+ },
4338
+ CancelButton: {
4339
+ margin: "0",
4340
+ fontSize: "var(--sl-font-size-small)",
4341
+ fontWeight: "600",
4342
+ cursor: "pointer",
4343
+ background: "none",
4344
+ border: "none",
4345
+ fontFamily: "var(--sl-font-sans)",
4346
+ color: "var(--sl-color-neutral-500)",
4347
+ "&::part(label)": {
4348
+ padding: "0",
4349
+ },
4350
+ },
4351
+ LimitReachedContainer: {
4352
+ display: "flex",
4353
+ alignItems: "center",
4354
+ gap: "var(--sl-spacing-x-small)",
4355
+ },
4356
+ };
4357
+ const sheet = createStyleSheet(style);
4358
+ const styleString = sheet.toString();
4359
+ const errorMessageType = (validationError === null || validationError === void 0 ? void 0 : validationError.code) === "EXISTING_CODE_CONFLICT" ? "info" : "warning";
4360
+ const showCharactersRemaining = charactersRemaining <= 14;
4361
+ const editLimitMessage = intl.formatMessage({
4362
+ id: "editLimitText",
4363
+ defaultMessage: editLimitText,
4364
+ }, { editsRemaining });
4365
+ // Editing state
4366
+ if (isEditing) {
4367
+ return (h("div", { class: sheet.classes.Container },
4368
+ h("style", { type: "text/css" },
4369
+ styleString,
4370
+ vanillaStyle$6),
4371
+ h("p", { class: sheet.classes.EditLabel }, editLabelText),
4372
+ h("div", { class: sheet.classes.EditInputWrapper },
4373
+ h("span", { class: sheet.classes.DomainPrefix }, domainPrefix),
4374
+ h("sl-input", { class: sheet.classes.EditInput, type: "text", value: editValue, onInput: (e) => onEditValueChange(e.target.value), onKeyDown: (e) => {
4375
+ if (e.key === "/" || e.key === "@")
4376
+ e.preventDefault();
4377
+ }, disabled: isSaving, maxLength: characterLimit })),
4378
+ h("p", { class: sheet.classes.HelperText },
4379
+ editLimitMessage,
4380
+ " ",
4381
+ charactersRemaining > 12 && minCharactersText,
4382
+ showCharactersRemaining &&
4383
+ ` ${intl.formatMessage({
4384
+ id: "charactersRemainingText",
4385
+ defaultMessage: charactersRemainingText,
4386
+ }, { charactersRemaining })}`),
4387
+ validationError && (h("sqm-form-message", { type: errorMessageType, style: { paddingBottom: "var(--sl-spacing-xx-small)" } },
4388
+ h("p", { part: "alert-title" }, validationError.title),
4389
+ validationError.description)),
4390
+ isValidating && (h("p", { class: sheet.classes.HelperText }, validatingLabelText)),
4391
+ h("div", { class: sheet.classes.ActionRow },
4392
+ h("button", { class: sheet.classes.SaveButton, onClick: onSave, disabled: isSaving ||
4393
+ isValidating ||
4394
+ !!validationError ||
4395
+ !editValue ||
4396
+ editValue.length < minCharacters }, isSaving ? savingLabelText : saveLabelText),
4397
+ h("sl-button", { type: "text", class: sheet.classes.CancelButton, onClick: onCancel, disabled: isSaving }, cancelLabelText))));
4398
+ }
4399
+ // Default / Customized / Limit reached states
4400
+ return (h("div", { class: sheet.classes.Container },
4401
+ h("style", { type: "text/css" },
4402
+ styleString,
4403
+ vanillaStyle$6),
4404
+ h(CopyTextView, Object.assign({}, copyTextViewProps)),
4405
+ allowCustomization &&
4406
+ (customizeDisabled ? (h("sl-tooltip", { content: customizeDisabledTooltip, placement: "top", style: { display: "inline-block", width: "fit-content" } },
4407
+ h("p", { class: sheet.classes.CustomizeLinkDisabled }, customizeLinkLabel))) : (h("div", { class: sheet.classes.LimitReachedContainer },
4408
+ h("p", { class: limitReached
4409
+ ? sheet.classes.CustomizeLinkDisabled
4410
+ : sheet.classes.CustomizeLinkText, onClick: limitReached ? undefined : onCustomizeClick }, customizeLinkLabel),
4411
+ allowCustomization && limitReached && (h("p", { class: sheet.classes.HelperText }, intl.formatMessage({
4412
+ id: "editLimitReached",
4413
+ defaultMessage: editLimitReachedText,
4414
+ }, {
4415
+ supportLink: (h("a", { target: "_blank", href: "https://help.impact.com/other/readme/get-help-and-support" }, supportLinkText)),
4416
+ }))))))));
4417
+ }
4418
+
4419
+ const MAX_EDITS = 5;
4420
+ const CHARACTER_LIMIT = 15;
4421
+ const MIN_CHARACTERS = 3;
4230
4422
  const MessageLinkQuery$1 = dist.gql `
4231
- query ($programId: ID, $engagementMedium: UserEngagementMedium!) {
4423
+ query ($programId: ID) {
4232
4424
  user: viewer {
4233
4425
  ... on User {
4234
- shareLink(
4235
- programId: $programId
4236
- engagementMedium: $engagementMedium
4237
- shareMedium: DIRECT
4238
- )
4426
+ shareLink(programId: $programId)
4239
4427
  }
4240
4428
  }
4241
4429
  }
@@ -4245,19 +4433,115 @@ const WIDGET_ENGAGEMENT_EVENT = dist.gql `
4245
4433
  createUserAnalyticsEvent(eventMeta: $eventMeta)
4246
4434
  }
4247
4435
  `;
4436
+ const ADD_SHARE_LINK_CODE = dist.gql `
4437
+ mutation ($addShareLinkCodeInput: AddShareLinkCodeInput!) {
4438
+ addShareLinkCode(addShareLinkCodeInput: $addShareLinkCodeInput) {
4439
+ linkCode {
4440
+ linkCode
4441
+ shortUrl
4442
+ referralCode {
4443
+ code
4444
+ }
4445
+ }
4446
+ }
4447
+ }
4448
+ `;
4449
+ const VALIDATE_LINK_CODE = dist.gql `
4450
+ query validateLinkCode($linkCode: String!) {
4451
+ validateLinkCode(linkCode: $linkCode) {
4452
+ valid
4453
+ invalidReason
4454
+ }
4455
+ }
4456
+ `;
4457
+ const GET_LINK_DOMAIN = dist.gql `
4458
+ query getLinkDomain {
4459
+ tenantSettings {
4460
+ primaryLinkDomain {
4461
+ host
4462
+ }
4463
+ }
4464
+ }
4465
+ `;
4466
+ const SHARE_LINK_EDIT_COUNT = dist.gql `
4467
+ query shareLinkEditCount {
4468
+ viewer {
4469
+ ... on User {
4470
+ shareLinkCodes {
4471
+ totalCount
4472
+ data {
4473
+ isVanity
4474
+ }
4475
+ }
4476
+ }
4477
+ }
4478
+ }
4479
+ `;
4480
+ function parseShareUrl(url) {
4481
+ try {
4482
+ const parsed = new URL(url);
4483
+ return {
4484
+ url: parsed.origin + parsed.pathname,
4485
+ domain: parsed.origin + "/",
4486
+ path: parsed.pathname.slice(1),
4487
+ };
4488
+ }
4489
+ catch {
4490
+ return { url, domain: url, path: "" };
4491
+ }
4492
+ }
4248
4493
  function useShareLink(props) {
4249
- var _a, _b;
4494
+ var _a, _b, _c, _d, _e, _f, _g;
4250
4495
  const { programId = H() } = props;
4251
4496
  const user = J();
4252
4497
  const engagementMedium = B();
4253
4498
  const contextData = Fn(REFERRAL_CODES_NAMESPACE);
4254
- const { data } = wn(MessageLinkQuery$1, { programId, engagementMedium }, !(user === null || user === void 0 ? void 0 : user.jwt) || !!props.linkOverride || (contextData === null || contextData === void 0 ? void 0 : contextData.shareLink) !== undefined);
4499
+ const { data, refetch } = wn(MessageLinkQuery$1, { programId }, !(user === null || user === void 0 ? void 0 : user.jwt) || !!props.linkOverride || (contextData === null || contextData === void 0 ? void 0 : contextData.shareLink) !== undefined);
4255
4500
  const [sendLoadEvent] = $e(WIDGET_ENGAGEMENT_EVENT);
4256
- const [setCopied, copiedRes] = $e(SET_CODE_COPIED);
4257
- 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
+ const [setCopied] = $e(SET_CODE_COPIED);
4502
+ const [addShareLinkCode, { loading: isSaving }] = $e(ADD_SHARE_LINK_CODE);
4503
+ const [validateLinkCode] = Xe(VALIDATE_LINK_CODE);
4504
+ const { refresh } = Qe();
4505
+ const { data: linkDomainData } = wn(GET_LINK_DOMAIN, {}, !(user === null || user === void 0 ? void 0 : user.jwt) || !props.allowCustomization);
4506
+ const { data: editCountData, refetch: refetchEditCount } = wn(SHARE_LINK_EDIT_COUNT, {}, !(user === null || user === void 0 ? void 0 : user.jwt) || !props.allowCustomization);
4507
+ 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 :
4258
4508
  // Shown during loading
4259
- "...";
4509
+ "...");
4260
4510
  const [open, setOpen] = useState(false);
4511
+ const [isEditing, setIsEditing] = useState(false);
4512
+ const [editValue, setEditValue] = useState("");
4513
+ const [validationError, setValidationError] = useState(null);
4514
+ const [isValidating, setIsValidating] = useState(false);
4515
+ const debounceTimerRef = useRef(undefined);
4516
+ const latestValidationValueRef = useRef("");
4517
+ const hasPrimaryLinkDomain = ((_c = linkDomainData === null || linkDomainData === void 0 ? void 0 : linkDomainData.tenantSettings) === null || _c === void 0 ? void 0 : _c.primaryLinkDomain) != null;
4518
+ const customizeDisabled = !hasPrimaryLinkDomain;
4519
+ 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;
4520
+ const editCount = vanityCount;
4521
+ const editsRemaining = Math.max(0, MAX_EDITS - editCount);
4522
+ const limitReached = editsRemaining <= 0;
4523
+ function mapErrorCodeToInfo(errorCode) {
4524
+ if (!errorCode)
4525
+ return null;
4526
+ const errorMap = {
4527
+ EXISTING_CODE_CONFLICT: {
4528
+ code: "EXISTING_CODE_CONFLICT",
4529
+ title: props.linkTakenErrorTitle,
4530
+ description: props.linkTakenErrorDescription,
4531
+ },
4532
+ INVALID_CHARACTER: {
4533
+ code: "INVALID_CHARACTER",
4534
+ title: props.invalidCharactersErrorTitle,
4535
+ description: props.invalidCharactersErrorDescription,
4536
+ },
4537
+ BLOCKED_WORD: {
4538
+ code: "BLOCKED_WORD",
4539
+ title: props.restrictedWordsErrorTitle,
4540
+ description: props.restrictedWordsErrorDescription,
4541
+ },
4542
+ };
4543
+ return errorMap[errorCode];
4544
+ }
4261
4545
  async function onClick() {
4262
4546
  if (contextData) {
4263
4547
  await setCopied({ referralCode: contextData.referralCode });
@@ -4281,7 +4565,125 @@ function useShareLink(props) {
4281
4565
  },
4282
4566
  });
4283
4567
  }
4284
- return { ...props, onClick, open, copyString: copyString };
4568
+ function onCustomizeClick() {
4569
+ if (limitReached || customizeDisabled)
4570
+ return;
4571
+ setIsEditing(true);
4572
+ setEditValue(editCount === 0 ? "" : pathSuffix);
4573
+ setValidationError(null);
4574
+ }
4575
+ function onEditValueChange(value) {
4576
+ const trimmed = value.slice(0, CHARACTER_LIMIT);
4577
+ setEditValue(trimmed);
4578
+ setValidationError(null);
4579
+ latestValidationValueRef.current = trimmed;
4580
+ if (debounceTimerRef.current)
4581
+ clearTimeout(debounceTimerRef.current);
4582
+ if (!trimmed || trimmed.length < MIN_CHARACTERS) {
4583
+ setIsValidating(false);
4584
+ return;
4585
+ }
4586
+ setIsValidating(true);
4587
+ debounceTimerRef.current = setTimeout(async () => {
4588
+ var _a, _b;
4589
+ const requestedValue = trimmed;
4590
+ try {
4591
+ const result = await validateLinkCode({ linkCode: requestedValue });
4592
+ // Discard stale responses if the user has continued typing
4593
+ if (latestValidationValueRef.current !== requestedValue)
4594
+ return;
4595
+ if (!((_a = result === null || result === void 0 ? void 0 : result.validateLinkCode) === null || _a === void 0 ? void 0 : _a.valid)) {
4596
+ const reason = (_b = result === null || result === void 0 ? void 0 : result.validateLinkCode) === null || _b === void 0 ? void 0 : _b.invalidReason;
4597
+ setValidationError(mapErrorCodeToInfo(reason));
4598
+ }
4599
+ }
4600
+ catch {
4601
+ // Validation query failed — don't block the user
4602
+ if (latestValidationValueRef.current !== requestedValue)
4603
+ return;
4604
+ }
4605
+ if (latestValidationValueRef.current === requestedValue) {
4606
+ setIsValidating(false);
4607
+ }
4608
+ }, 500);
4609
+ }
4610
+ async function onSave() {
4611
+ var _a, _b;
4612
+ if (!editValue ||
4613
+ editValue.length < MIN_CHARACTERS ||
4614
+ validationError ||
4615
+ isValidating)
4616
+ return;
4617
+ try {
4618
+ await addShareLinkCode({
4619
+ addShareLinkCodeInput: {
4620
+ userId: user === null || user === void 0 ? void 0 : user.id,
4621
+ accountId: user === null || user === void 0 ? void 0 : user.accountId,
4622
+ programId,
4623
+ linkCode: editValue,
4624
+ makeShareLinkCodePrimaryForReferralCode: true,
4625
+ },
4626
+ });
4627
+ setIsEditing(false);
4628
+ await Promise.all([refetch(), refetchEditCount()]);
4629
+ refresh();
4630
+ }
4631
+ catch (e) {
4632
+ const errorCode = (_a = e === null || e === void 0 ? void 0 : e.extensions) === null || _a === void 0 ? void 0 : _a.code;
4633
+ setValidationError((_b = mapErrorCodeToInfo(errorCode)) !== null && _b !== void 0 ? _b : {
4634
+ code: null,
4635
+ title: props.saveErrorTitle,
4636
+ description: (e === null || e === void 0 ? void 0 : e.message) || props.saveErrorDescription,
4637
+ });
4638
+ }
4639
+ }
4640
+ function onCancel() {
4641
+ setIsEditing(false);
4642
+ setEditValue("");
4643
+ setValidationError(null);
4644
+ setIsValidating(false);
4645
+ latestValidationValueRef.current = "";
4646
+ if (debounceTimerRef.current)
4647
+ clearTimeout(debounceTimerRef.current);
4648
+ }
4649
+ return {
4650
+ copyTextViewProps: {
4651
+ ...props,
4652
+ onClick,
4653
+ open,
4654
+ copyString,
4655
+ },
4656
+ minCharactersText: props.minCharactersText,
4657
+ allowCustomization: props.allowCustomization,
4658
+ customizeLinkLabel: props.customizeLinkButtonLabel,
4659
+ saveLabelText: props.saveLabelText,
4660
+ savingLabelText: props.savingLabelText,
4661
+ cancelLabelText: props.cancelLabelText,
4662
+ editLabelText: props.editLabelText,
4663
+ charactersRemainingText: props.charactersRemainingText,
4664
+ validatingLabelText: props.validatingLabelText,
4665
+ isEditing,
4666
+ editValue,
4667
+ domainPrefix,
4668
+ editsRemaining,
4669
+ maxEdits: MAX_EDITS,
4670
+ limitReached,
4671
+ validationError,
4672
+ isValidating,
4673
+ isSaving,
4674
+ characterLimit: CHARACTER_LIMIT,
4675
+ minCharacters: MIN_CHARACTERS,
4676
+ charactersRemaining: CHARACTER_LIMIT - editValue.length,
4677
+ editLimitText: props.editLimitText,
4678
+ editLimitReachedText: props.editLimitReachedText,
4679
+ supportLinkText: props.supportLinkText,
4680
+ customizeDisabled,
4681
+ customizeDisabledTooltip: props.customizeDisabledTooltip,
4682
+ onCustomizeClick,
4683
+ onEditValueChange,
4684
+ onSave,
4685
+ onCancel,
4686
+ };
4285
4687
  }
4286
4688
 
4287
4689
  const style$9 = {
@@ -4322,7 +4724,7 @@ const style$9 = {
4322
4724
  },
4323
4725
  ErrorStyle: ErrorStyles,
4324
4726
  };
4325
- const vanillaStyle$6 = `
4727
+ const vanillaStyle$7 = `
4326
4728
  sqm-portal-register {
4327
4729
  margin: 0 auto;
4328
4730
  width: 100%;
@@ -4354,7 +4756,7 @@ function LeadFormView(props) {
4354
4756
  return (h(Fragment, null,
4355
4757
  states.success && (h("div", { class: sheet$9.classes.Wrapper, part: "sqm-base" },
4356
4758
  h("style", { type: "text/css" },
4357
- vanillaStyle$6,
4759
+ vanillaStyle$7,
4358
4760
  styleString$9),
4359
4761
  h(TextSpanView, { type: "h3" }, content.pageLabel),
4360
4762
  h("sqm-form-message", { loading: states.loading, exportparts: "success-icon" },
@@ -4364,7 +4766,7 @@ function LeadFormView(props) {
4364
4766
  h("sl-button", { class: sheet$9.classes.ContinueButton, onClick: callbacks.resetForm, loading: states.loading, exportparts: "base: primarybutton-base", type: "default" }, content.resubmitFormLabel))),
4365
4767
  h("div", { class: sheet$9.classes.Wrapper, part: "sqm-base", style: { display: states.success ? "none" : "block" } },
4366
4768
  h("style", { type: "text/css" },
4367
- vanillaStyle$6,
4769
+ vanillaStyle$7,
4368
4770
  styleString$9),
4369
4771
  h(TextSpanView, { type: "h3" }, content.pageLabel),
4370
4772
  h("sl-form", { class: sheet$9.classes.Column, "onSl-submit": callbacks.submit, ref: (el) => (refs.formRef.current = el), novalidate: true },
@@ -4417,7 +4819,7 @@ const style$a = {
4417
4819
  "margin-bottom": "var(--sl-spacing-large)",
4418
4820
  },
4419
4821
  };
4420
- const vanillaStyle$7 = `
4822
+ const vanillaStyle$8 = `
4421
4823
  :host {
4422
4824
  margin: 0 auto;
4423
4825
  width: 100%;
@@ -4446,7 +4848,7 @@ function LeadDropdownFieldView(props) {
4446
4848
  });
4447
4849
  return (h("div", { class: sheet$a.classes.FieldContainer, part: "sqm-base" },
4448
4850
  h("style", { type: "text/css" },
4449
- vanillaStyle$7,
4851
+ vanillaStyle$8,
4450
4852
  styleString$a),
4451
4853
  h("sl-select", Object.assign({ style: { maxHeight: "100px" }, exportparts: "label: input-label, base: input-base", label: `${content.dropdownLabel}${content.dropdownOptional ? ` ${content.optionalLabel}` : ""}`, name: `/${content.dropdownName}`, multiple: content.multiple }, (!content.dropdownOptional ? { required: true } : []), { disabled: ((_b = states.leadFormState) === null || _b === void 0 ? void 0 : _b.loading) || ((_c = states.leadFormState) === null || _c === void 0 ? void 0 : _c.disabled), validationError: ({ value }) => {
4452
4854
  if (!value && !content.dropdownOptional) {
@@ -4497,4 +4899,4 @@ const ShadowViewAddon = ({ story }, children) => {
4497
4899
  h(TagName, { "stencilbook-shadow-view": randomInt })));
4498
4900
  };
4499
4901
 
4500
- export { empty as A, BigStatView as B, CardFeedView as C, DropdownFieldView as D, EditProfileView as E, rewardExchange as F, useShareButton as G, HeroView as H, InputFieldView as I, useShareLink as J, ProgressBarView as K, LeaderboardView as L, ProgressBar as M, NameFieldsView as N, LeadFormView as O, PortalChangePasswordView as P, LeadDropdownFieldView as Q, ReferralIframeView as R, StatContainerView as S, TaskCardView as T, ShadowViewAddon as U, useBigStat as V, withShadowView as W, demoRewardExchange as X, ShareButtonView as a, PoweredByImg as b, BaseRegistrationFormView as c, CheckboxFieldView as d, CouponCodeView as e, ChangeMarktingView as f, PortalFooterView as g, PortalFrameView as h, RewardExchangeView as i, rewardExchangeLongText as j, rewardExchangeSelected as k, chooseAmountFixed as l, chooseAmountFixedNoDescription as m, chooseAmountVariable as n, chooseAmountVariableNoDescription as o, chooseAmountVariableDisabled as p, chooseAmountVariableUnavailable as q, rewardExchangeCustomErrorMsg as r, confirmFixed as s, confirmVariable as t, useDemoBigStat as u, redemptionError as v, queryError as w, success as x, successVariable as y, loading as z };
4902
+ export { empty as A, BigStatView as B, CardFeedView as C, DropdownFieldView as D, EditProfileView as E, rewardExchange as F, useShareButton as G, HeroView as H, InputFieldView as I, ShareLinkView as J, useShareLink as K, LeaderboardView as L, ProgressBarView as M, NameFieldsView as N, ProgressBar as O, PortalChangePasswordView as P, LeadFormView as Q, ReferralIframeView as R, StatContainerView as S, TaskCardView as T, LeadDropdownFieldView as U, ShadowViewAddon as V, useBigStat as W, withShadowView as X, demoRewardExchange as Y, ShareButtonView as a, PoweredByImg as b, BaseRegistrationFormView as c, CheckboxFieldView as d, CouponCodeView as e, ChangeMarktingView as f, PortalFooterView as g, PortalFrameView as h, RewardExchangeView as i, rewardExchangeLongText as j, rewardExchangeSelected as k, chooseAmountFixed as l, chooseAmountFixedNoDescription as m, chooseAmountVariable as n, chooseAmountVariableNoDescription as o, chooseAmountVariableDisabled as p, chooseAmountVariableUnavailable as q, rewardExchangeCustomErrorMsg as r, confirmFixed as s, confirmVariable as t, useDemoBigStat as u, redemptionError as v, queryError as w, success as x, successVariable as y, loading as z };