@saasquatch/mint-components 2.1.9 → 2.1.10-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.
Files changed (54) hide show
  1. package/dist/cjs/{ShadowViewAddon-1798acd3.js → ShadowViewAddon-c97e80de.js} +39 -22
  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 +62 -2
  5. package/dist/cjs/sqm-empty_4.cjs.entry.js +1 -1
  6. package/dist/cjs/{sqm-portal-container-view-70a47420.js → sqm-portal-container-view-757f921b.js} +5 -6
  7. package/dist/cjs/sqm-stencilbook.cjs.entry.js +6 -2
  8. package/dist/collection/components/sqm-portal-container/sqm-portal-container-view.js +6 -7
  9. package/dist/collection/components/sqm-share-link/ShareLink.stories.js +4 -0
  10. package/dist/collection/components/sqm-share-link/sqm-share-link-view.js +16 -16
  11. package/dist/collection/components/sqm-share-link/sqm-share-link.js +247 -18
  12. package/dist/collection/components/sqm-share-link/useShareLink.js +22 -5
  13. package/dist/esm/{ShadowViewAddon-44c263e0.js → ShadowViewAddon-33f1a8f7.js} +39 -22
  14. package/dist/esm/loader.js +1 -1
  15. package/dist/esm/mint-components.js +1 -1
  16. package/dist/esm/sqm-big-stat_45.entry.js +62 -2
  17. package/dist/esm/sqm-empty_4.entry.js +1 -1
  18. package/dist/esm/{sqm-portal-container-view-a8c708cd.js → sqm-portal-container-view-200c9df8.js} +6 -7
  19. package/dist/esm/sqm-stencilbook.entry.js +6 -2
  20. package/dist/esm-es5/{ShadowViewAddon-44c263e0.js → ShadowViewAddon-33f1a8f7.js} +1 -1
  21. package/dist/esm-es5/loader.js +1 -1
  22. package/dist/esm-es5/mint-components.js +1 -1
  23. package/dist/esm-es5/sqm-big-stat_45.entry.js +1 -1
  24. package/dist/esm-es5/sqm-empty_4.entry.js +1 -1
  25. package/dist/esm-es5/sqm-portal-container-view-200c9df8.js +1 -0
  26. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  27. package/dist/mint-components/mint-components.esm.js +1 -1
  28. package/dist/mint-components/{p-eab25269.js → p-08930b83.js} +4 -4
  29. package/dist/mint-components/p-0b1e90fe.system.js +1 -0
  30. package/dist/mint-components/{p-b04289d6.entry.js → p-76271ec4.entry.js} +2 -2
  31. package/dist/mint-components/{p-df073770.system.js → p-78b40f71.system.js} +1 -1
  32. package/dist/mint-components/{p-d2e8359a.entry.js → p-8784539d.entry.js} +10 -10
  33. package/dist/mint-components/{p-058aefe1.entry.js → p-af407cce.entry.js} +1 -1
  34. package/dist/mint-components/{p-a171767a.system.entry.js → p-c3c8d4ee.system.entry.js} +1 -1
  35. package/dist/mint-components/p-ca098be1.system.js +1 -1
  36. package/dist/mint-components/{p-4900c740.system.entry.js → p-dd12c32a.system.entry.js} +1 -1
  37. package/dist/mint-components/p-e30abc44.js +1 -0
  38. package/dist/mint-components/{p-aefc6c4f.system.entry.js → p-e9485160.system.entry.js} +1 -1
  39. package/dist/types/components/sqm-share-link/sqm-share-link-view.d.ts +4 -0
  40. package/dist/types/components/sqm-share-link/sqm-share-link.d.ts +56 -1
  41. package/dist/types/components/sqm-share-link/useShareLink.d.ts +6 -0
  42. package/dist/types/components.d.ts +100 -2
  43. package/docs/docs.docx +0 -0
  44. package/docs/raisins.json +1 -1
  45. package/docs/stats.json +122783 -0
  46. package/grapesjs/grapesjs.js +1 -1
  47. package/package.json +2 -2
  48. package/dist/esm-es5/sqm-portal-container-view-a8c708cd.js +0 -1
  49. package/dist/mint-components/p-b699f76e.system.js +0 -1
  50. package/dist/mint-components/p-b6a1e2ac.js +0 -1
  51. package/dist/types/global/android.d.ts +0 -7
  52. package/dist/types/global/demo.d.ts +0 -2
  53. package/dist/types/stories/features.d.ts +0 -4
  54. package/dist/types/stories/templates.d.ts +0 -4
@@ -16,7 +16,7 @@ const luxon = require('./luxon-c1ad356a.js');
16
16
  const index$1 = require('./index-8c6255f5.js');
17
17
  const imageUrl$1 = require('./imageUrl-a7880cab.js');
18
18
  const utilities = require('./utilities-fcdb9504.js');
19
- const sqmPortalContainerView = require('./sqm-portal-container-view-70a47420.js');
19
+ const sqmPortalContainerView = require('./sqm-portal-container-view-757f921b.js');
20
20
 
21
21
  function BigStatView(props) {
22
22
  const { statvalue, flexReverse, alignment, statTextColor, statFontSize, descriptionTextColor, descriptionFontSize, statFontWeight, } = props;
@@ -4236,7 +4236,7 @@ const vanillaStyle$6 = `
4236
4236
  }
4237
4237
  `;
4238
4238
  function ShareLinkView(props) {
4239
- const { copyTextViewProps, allowCustomization, customizeLinkLabel, saveLabelText, cancelLabelText, isEditing, editValue, domainPrefix, editsRemaining, maxEdits, limitReached, validationError, isValidating, isSaving, characterLimit, minCharacters, charactersRemaining, editLimitText, editLimitReachedText, supportLinkText, customizeDisabled, customizeDisabledTooltip, onCustomizeClick, onEditValueChange, onSave, onCancel, minCharactersText, } = props;
4239
+ 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;
4240
4240
  const style = {
4241
4241
  Container: {
4242
4242
  display: "flex",
@@ -4293,16 +4293,13 @@ function ShareLinkView(props) {
4293
4293
  lineHeight: "var(--sl-input-height-medium)",
4294
4294
  },
4295
4295
  EditInput: {
4296
- flex: "1",
4297
- border: "none",
4298
- outline: "none",
4299
- padding: "0 var(--sl-spacing-medium) 0 0",
4300
- fontSize: "var(--sl-font-size-medium)",
4301
- fontFamily: "var(--sl-font-sans)",
4302
- color: "var(--sl-input-color)",
4303
- background: "transparent",
4304
- lineHeight: "var(--sl-input-height-medium)",
4305
- minWidth: "0",
4296
+ "&::part(base)": {
4297
+ border: "none",
4298
+ borderRadius: "0",
4299
+ },
4300
+ "&::part(input)": {
4301
+ margin: 0,
4302
+ },
4306
4303
  },
4307
4304
  EditLabel: {
4308
4305
  margin: "0",
@@ -4373,10 +4370,10 @@ function ShareLinkView(props) {
4373
4370
  index.h("style", { type: "text/css" },
4374
4371
  styleString,
4375
4372
  vanillaStyle$6),
4376
- index.h("p", { class: sheet.classes.EditLabel }, "Enter your link"),
4373
+ index.h("p", { class: sheet.classes.EditLabel }, editLabelText),
4377
4374
  index.h("div", { class: sheet.classes.EditInputWrapper },
4378
4375
  index.h("span", { class: sheet.classes.DomainPrefix }, domainPrefix),
4379
- index.h("input", { class: sheet.classes.EditInput, type: "text", value: editValue, onInput: (e) => onEditValueChange(e.target.value), onKeyDown: (e) => {
4376
+ index.h("sl-input", { class: sheet.classes.EditInput, type: "text", value: editValue, onInput: (e) => onEditValueChange(e.target.value), onKeyDown: (e) => {
4380
4377
  if (e.key === "/" || e.key === "@")
4381
4378
  e.preventDefault();
4382
4379
  }, disabled: isSaving, maxLength: characterLimit })),
@@ -4385,17 +4382,20 @@ function ShareLinkView(props) {
4385
4382
  " ",
4386
4383
  charactersRemaining > 12 && minCharactersText,
4387
4384
  showCharactersRemaining &&
4388
- ` Characters remaining: ${charactersRemaining}`),
4385
+ ` ${global.intl.formatMessage({
4386
+ id: "charactersRemainingText",
4387
+ defaultMessage: charactersRemainingText,
4388
+ }, { charactersRemaining })}`),
4389
4389
  validationError && (index.h("sqm-form-message", { type: errorMessageType, style: { paddingBottom: "var(--sl-spacing-xx-small)" } },
4390
4390
  index.h("p", { part: "alert-title" }, validationError.title),
4391
4391
  validationError.description)),
4392
- isValidating && index.h("p", { class: sheet.classes.HelperText }, "Validating..."),
4392
+ isValidating && (index.h("p", { class: sheet.classes.HelperText }, validatingLabelText)),
4393
4393
  index.h("div", { class: sheet.classes.ActionRow },
4394
4394
  index.h("button", { class: sheet.classes.SaveButton, onClick: onSave, disabled: isSaving ||
4395
4395
  isValidating ||
4396
4396
  !!validationError ||
4397
4397
  !editValue ||
4398
- editValue.length < minCharacters }, isSaving ? "Saving..." : saveLabelText),
4398
+ editValue.length < minCharacters }, isSaving ? savingLabelText : saveLabelText),
4399
4399
  index.h("sl-button", { type: "text", class: sheet.classes.CancelButton, onClick: onCancel, disabled: isSaving }, cancelLabelText))));
4400
4400
  }
4401
4401
  // Default / Customized / Limit reached states
@@ -4515,6 +4515,7 @@ function useShareLink(props) {
4515
4515
  const [validationError, setValidationError] = domContextHooks_module.useState(null);
4516
4516
  const [isValidating, setIsValidating] = domContextHooks_module.useState(false);
4517
4517
  const debounceTimerRef = domContextHooks_module.useRef(undefined);
4518
+ const latestValidationValueRef = domContextHooks_module.useRef("");
4518
4519
  const hasPrimaryLinkDomain = ((_c = linkDomainData === null || linkDomainData === void 0 ? void 0 : linkDomainData.tenantSettings) === null || _c === void 0 ? void 0 : _c.primaryLinkDomain) != null;
4519
4520
  const customizeDisabled = !hasPrimaryLinkDomain;
4520
4521
  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;
@@ -4577,6 +4578,7 @@ function useShareLink(props) {
4577
4578
  const trimmed = value.slice(0, CHARACTER_LIMIT);
4578
4579
  setEditValue(trimmed);
4579
4580
  setValidationError(null);
4581
+ latestValidationValueRef.current = trimmed;
4580
4582
  if (debounceTimerRef.current)
4581
4583
  clearTimeout(debounceTimerRef.current);
4582
4584
  if (!trimmed || trimmed.length < MIN_CHARACTERS) {
@@ -4586,8 +4588,12 @@ function useShareLink(props) {
4586
4588
  setIsValidating(true);
4587
4589
  debounceTimerRef.current = setTimeout(async () => {
4588
4590
  var _a, _b;
4591
+ const requestedValue = trimmed;
4589
4592
  try {
4590
- const result = await validateLinkCode({ linkCode: trimmed });
4593
+ const result = await validateLinkCode({ linkCode: requestedValue });
4594
+ // Discard stale responses if the user has continued typing
4595
+ if (latestValidationValueRef.current !== requestedValue)
4596
+ return;
4591
4597
  if (!((_a = result === null || result === void 0 ? void 0 : result.validateLinkCode) === null || _a === void 0 ? void 0 : _a.valid)) {
4592
4598
  const reason = (_b = result === null || result === void 0 ? void 0 : result.validateLinkCode) === null || _b === void 0 ? void 0 : _b.invalidReason;
4593
4599
  setValidationError(mapErrorCodeToInfo(reason));
@@ -4595,9 +4601,13 @@ function useShareLink(props) {
4595
4601
  }
4596
4602
  catch {
4597
4603
  // Validation query failed — don't block the user
4604
+ if (latestValidationValueRef.current !== requestedValue)
4605
+ return;
4598
4606
  }
4599
- setIsValidating(false);
4600
- }, 2000);
4607
+ if (latestValidationValueRef.current === requestedValue) {
4608
+ setIsValidating(false);
4609
+ }
4610
+ }, 500);
4601
4611
  }
4602
4612
  async function onSave() {
4603
4613
  var _a, _b;
@@ -4624,8 +4634,8 @@ function useShareLink(props) {
4624
4634
  const errorCode = (_a = e === null || e === void 0 ? void 0 : e.extensions) === null || _a === void 0 ? void 0 : _a.code;
4625
4635
  setValidationError((_b = mapErrorCodeToInfo(errorCode)) !== null && _b !== void 0 ? _b : {
4626
4636
  code: null,
4627
- title: "Error",
4628
- description: (e === null || e === void 0 ? void 0 : e.message) || "Failed to save custom link. Please try again.",
4637
+ title: props.saveErrorTitle,
4638
+ description: (e === null || e === void 0 ? void 0 : e.message) || props.saveErrorDescription,
4629
4639
  });
4630
4640
  }
4631
4641
  }
@@ -4634,6 +4644,9 @@ function useShareLink(props) {
4634
4644
  setEditValue("");
4635
4645
  setValidationError(null);
4636
4646
  setIsValidating(false);
4647
+ latestValidationValueRef.current = "";
4648
+ if (debounceTimerRef.current)
4649
+ clearTimeout(debounceTimerRef.current);
4637
4650
  }
4638
4651
  return {
4639
4652
  copyTextViewProps: {
@@ -4646,7 +4659,11 @@ function useShareLink(props) {
4646
4659
  allowCustomization: props.allowCustomization,
4647
4660
  customizeLinkLabel: props.customizeLinkButtonLabel,
4648
4661
  saveLabelText: props.saveLabelText,
4662
+ savingLabelText: props.savingLabelText,
4649
4663
  cancelLabelText: props.cancelLabelText,
4664
+ editLabelText: props.editLabelText,
4665
+ charactersRemainingText: props.charactersRemainingText,
4666
+ validatingLabelText: props.validatingLabelText,
4650
4667
  isEditing,
4651
4668
  editValue,
4652
4669
  domainPrefix,