@saasquatch/mint-components 2.1.8-1 → 2.1.8-11

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 (67) hide show
  1. package/dist/cjs/{ShadowViewAddon-5ce32291.js → ShadowViewAddon-0745de12.js} +384 -98
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/mint-components.cjs.js +1 -1
  4. package/dist/cjs/sqm-banking-info-form_10.cjs.entry.js +50 -377
  5. package/dist/cjs/{sqm-big-stat_46.cjs.entry.js → sqm-big-stat_45.cjs.entry.js} +172 -351
  6. package/dist/cjs/sqm-stencilbook.cjs.entry.js +168 -175
  7. package/dist/collection/collection-manifest.json +0 -1
  8. package/dist/collection/components/sqm-share-code/sqm-share-code.js +0 -1
  9. package/dist/collection/components/sqm-share-link/ShareLink.stories.js +142 -11
  10. package/dist/collection/components/sqm-share-link/UseShareLink.stories.js +14 -5
  11. package/dist/collection/components/sqm-share-link/sqm-share-link-view.js +173 -0
  12. package/dist/collection/components/sqm-share-link/sqm-share-link.js +536 -26
  13. package/dist/collection/components/sqm-share-link/useShareLink.js +210 -6
  14. package/dist/collection/components/sqm-stencilbook/sqm-stencilbook.js +0 -2
  15. package/dist/collection/components/tax-and-cash/sqm-banking-info-form/formDefinitions.js +37 -75
  16. package/dist/collection/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form.js +13 -688
  17. package/dist/collection/components/tax-and-cash/sqm-banking-info-form/useBankingInfoForm.js +1 -95
  18. package/dist/esm/{ShadowViewAddon-9d97b5d5.js → ShadowViewAddon-cd0033a6.js} +386 -100
  19. package/dist/esm/loader.js +1 -1
  20. package/dist/esm/mint-components.js +1 -1
  21. package/dist/esm/sqm-banking-info-form_10.entry.js +50 -377
  22. package/dist/esm/{sqm-big-stat_46.entry.js → sqm-big-stat_45.entry.js} +177 -355
  23. package/dist/esm/sqm-stencilbook.entry.js +168 -175
  24. package/dist/esm-es5/ShadowViewAddon-cd0033a6.js +1 -0
  25. package/dist/esm-es5/loader.js +1 -1
  26. package/dist/esm-es5/mint-components.js +1 -1
  27. package/dist/esm-es5/sqm-banking-info-form_10.entry.js +1 -1
  28. package/dist/esm-es5/sqm-big-stat_45.entry.js +1 -0
  29. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  30. package/dist/mint-components/mint-components.esm.js +1 -1
  31. package/dist/mint-components/{p-499885aa.entry.js → p-23e8dd9a.entry.js} +2 -2
  32. package/dist/mint-components/p-27e8efc8.system.js +1 -0
  33. package/dist/mint-components/p-2f314004.system.entry.js +1 -0
  34. package/dist/mint-components/{p-a6621899.system.entry.js → p-8c53dcc9.system.entry.js} +1 -1
  35. package/dist/mint-components/{p-22e39d2c.entry.js → p-a9bb29df.entry.js} +21 -90
  36. package/dist/mint-components/p-ca098be1.system.js +1 -1
  37. package/dist/mint-components/p-cacb897d.system.entry.js +1 -0
  38. package/dist/mint-components/p-fcb7e0a3.js +503 -0
  39. package/dist/mint-components/p-ff378015.entry.js +106 -0
  40. package/dist/types/components/sqm-share-link/ShareLink.stories.d.ts +10 -0
  41. package/dist/types/components/sqm-share-link/UseShareLink.stories.d.ts +6 -0
  42. package/dist/types/components/sqm-share-link/sqm-share-link-view.d.ts +37 -0
  43. package/dist/types/components/sqm-share-link/sqm-share-link.d.ts +107 -2
  44. package/dist/types/components/sqm-share-link/useShareLink.d.ts +27 -4
  45. package/dist/types/components/tax-and-cash/sqm-banking-info-form/formDefinitions.d.ts +0 -2
  46. package/dist/types/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form-view.d.ts +0 -4
  47. package/dist/types/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form.d.ts +0 -165
  48. package/dist/types/components.d.ts +183 -380
  49. package/docs/docs.docx +0 -0
  50. package/docs/raisins.json +1 -1
  51. package/grapesjs/grapesjs.js +1 -1
  52. package/package.json +1 -1
  53. package/dist/collection/components/sqm-partner-info-modal/PartnerInfoModal.stories.js +0 -143
  54. package/dist/collection/components/sqm-partner-info-modal/sqm-partner-info-modal-view.js +0 -90
  55. package/dist/collection/components/sqm-partner-info-modal/sqm-partner-info-modal.js +0 -462
  56. package/dist/collection/components/sqm-partner-info-modal/usePartnerInfoModal.js +0 -180
  57. package/dist/esm-es5/ShadowViewAddon-9d97b5d5.js +0 -1
  58. package/dist/esm-es5/sqm-big-stat_46.entry.js +0 -1
  59. package/dist/mint-components/p-0f036907.system.js +0 -1
  60. package/dist/mint-components/p-adc4e263.js +0 -463
  61. package/dist/mint-components/p-b0253f4c.entry.js +0 -108
  62. package/dist/mint-components/p-d93e19e9.system.entry.js +0 -1
  63. package/dist/mint-components/p-e45a9966.system.entry.js +0 -1
  64. package/dist/types/components/sqm-partner-info-modal/PartnerInfoModal.stories.d.ts +0 -13
  65. package/dist/types/components/sqm-partner-info-modal/sqm-partner-info-modal-view.d.ts +0 -41
  66. package/dist/types/components/sqm-partner-info-modal/sqm-partner-info-modal.d.ts +0 -80
  67. package/dist/types/components/sqm-partner-info-modal/usePartnerInfoModal.d.ts +0 -16
@@ -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
- 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 } 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';
@@ -4227,6 +4227,178 @@ 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, customizeUrl, customizeLinkLabel, saveLabelText, cancelLabelText, successMessage, isEditing, editValue, domainPrefix, editsRemaining, maxEdits, limitReached, validationError, isValidating, isSaving, showSuccess, characterLimit, charactersRemaining, editLimitText, editLimitReachedText, supportLinkText, customizeDisabled, customizeDisabledTooltip, onCustomizeClick, onEditValueChange, onSave, onCancel, } = props;
4238
+ const style = {
4239
+ Container: {
4240
+ display: "flex",
4241
+ flexDirection: "column",
4242
+ gap: "var(--sl-spacing-x-small)",
4243
+ width: "100%",
4244
+ },
4245
+ CustomizeLinkText: {
4246
+ margin: "0",
4247
+ fontSize: "var(--sl-font-size-small)",
4248
+ fontWeight: "600",
4249
+ cursor: "pointer",
4250
+ color: "var(--sl-color-neutral-900)",
4251
+ textAlign: "left",
4252
+ "&:hover": {
4253
+ textDecoration: "underline",
4254
+ },
4255
+ },
4256
+ CustomizeLinkDisabled: {
4257
+ margin: "0",
4258
+ fontSize: "var(--sl-font-size-small)",
4259
+ fontWeight: "600",
4260
+ color: "var(--sl-color-neutral-400)",
4261
+ cursor: "default",
4262
+ textAlign: "left",
4263
+ },
4264
+ EditContainer: {
4265
+ display: "flex",
4266
+ flexDirection: "column",
4267
+ gap: "var(--sl-spacing-x-small)",
4268
+ width: "100%",
4269
+ },
4270
+ EditInputWrapper: {
4271
+ display: "flex",
4272
+ alignItems: "center",
4273
+ width: "100%",
4274
+ border: "var(--sqm-border-thickness, 1px) solid var(--sqm-input-border-color, #d1d5db)",
4275
+ borderRadius: "var(--sqm-border-radius-normal, 4px)",
4276
+ background: "var(--sqm-input-background, #fff)",
4277
+ overflow: "hidden",
4278
+ "&:focus-within": {
4279
+ borderColor: "#999999",
4280
+ boxShadow: "0 0 0 var(--sl-focus-ring-width) var(--sl-input-focus-ring-color)",
4281
+ },
4282
+ },
4283
+ DomainPrefix: {
4284
+ padding: "0 0 0 var(--sl-spacing-medium)",
4285
+ fontSize: "var(--sl-font-size-medium)",
4286
+ color: "var(--sl-color-neutral-500)",
4287
+ whiteSpace: "nowrap",
4288
+ userSelect: "none",
4289
+ lineHeight: "var(--sl-input-height-medium)",
4290
+ },
4291
+ EditInput: {
4292
+ flex: "1",
4293
+ border: "none",
4294
+ outline: "none",
4295
+ padding: "0 var(--sl-spacing-medium) 0 0",
4296
+ fontSize: "var(--sl-font-size-medium)",
4297
+ fontFamily: "var(--sl-font-sans)",
4298
+ color: "var(--sl-input-color)",
4299
+ background: "transparent",
4300
+ lineHeight: "var(--sl-input-height-medium)",
4301
+ minWidth: "0",
4302
+ },
4303
+ EditLabel: {
4304
+ margin: "0",
4305
+ fontSize: "var(--sl-font-size-small)",
4306
+ color: "var(--sl-color-neutral-500)",
4307
+ },
4308
+ HelperText: {
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
+ SuccessText: {
4319
+ margin: "0",
4320
+ fontSize: "var(--sl-font-size-small)",
4321
+ color: "var(--sl-color-success-600, #16a34a)",
4322
+ },
4323
+ ActionRow: {
4324
+ display: "flex",
4325
+ gap: "var(--sl-spacing-medium)",
4326
+ alignItems: "center",
4327
+ },
4328
+ SaveButton: {
4329
+ cursor: "pointer",
4330
+ fontFamily: "var(--sl-font-sans)",
4331
+ fontSize: "var(--sl-font-size-small)",
4332
+ fontWeight: "600",
4333
+ padding: "var(--sl-spacing-x-small) var(--sl-spacing-medium)",
4334
+ borderRadius: "var(--sqm-border-radius-normal, 4px)",
4335
+ border: "1px solid var(--sl-color-neutral-900)",
4336
+ background: "var(--sl-color-neutral-900)",
4337
+ color: "#fff",
4338
+ "&:disabled": {
4339
+ opacity: "0.5",
4340
+ cursor: "default",
4341
+ },
4342
+ },
4343
+ CancelButton: {
4344
+ margin: "0",
4345
+ fontSize: "var(--sl-font-size-small)",
4346
+ fontWeight: "600",
4347
+ cursor: "pointer",
4348
+ background: "none",
4349
+ border: "none",
4350
+ padding: "0",
4351
+ fontFamily: "var(--sl-font-sans)",
4352
+ color: "var(--sl-color-neutral-500)",
4353
+ },
4354
+ };
4355
+ const sheet = createStyleSheet(style);
4356
+ const styleString = sheet.toString();
4357
+ const errorMessageType = (validationError === null || validationError === void 0 ? void 0 : validationError.code) === "EXISTING_CODE_CONFLICT" ? "info" : "warning";
4358
+ const showCharactersRemaining = charactersRemaining <= 7;
4359
+ // Editing state
4360
+ if (isEditing) {
4361
+ return (h("div", { class: sheet.classes.Container },
4362
+ h("style", { type: "text/css" },
4363
+ styleString,
4364
+ vanillaStyle$6),
4365
+ h("p", { class: sheet.classes.EditLabel }, "Enter your link"),
4366
+ h("div", { class: sheet.classes.EditInputWrapper },
4367
+ h("span", { class: sheet.classes.DomainPrefix }, domainPrefix),
4368
+ h("input", { class: sheet.classes.EditInput, type: "text", value: editValue, onInput: (e) => onEditValueChange(e.target.value), disabled: isSaving, maxLength: characterLimit })),
4369
+ h("p", { class: sheet.classes.HelperText },
4370
+ editLimitText,
4371
+ showCharactersRemaining &&
4372
+ ` Characters remaining: ${charactersRemaining}`),
4373
+ validationError && (h("sqm-form-message", { type: errorMessageType },
4374
+ h("p", { part: "alert-title" }, validationError.title),
4375
+ validationError.description)),
4376
+ isValidating && h("p", { class: sheet.classes.HelperText }, "Validating..."),
4377
+ h("div", { class: sheet.classes.ActionRow },
4378
+ h("button", { class: sheet.classes.SaveButton, onClick: onSave, disabled: isSaving || isValidating || !!validationError || !editValue }, isSaving ? "Saving..." : saveLabelText),
4379
+ h("button", { class: sheet.classes.CancelButton, onClick: onCancel, disabled: isSaving }, cancelLabelText))));
4380
+ }
4381
+ // Default / Customized / Limit reached states
4382
+ return (h("div", { class: sheet.classes.Container },
4383
+ h("style", { type: "text/css" },
4384
+ styleString,
4385
+ vanillaStyle$6),
4386
+ h(CopyTextView, Object.assign({}, copyTextViewProps)),
4387
+ showSuccess && h("p", { class: sheet.classes.SuccessText }, successMessage),
4388
+ customizeUrl && (customizeDisabled ? (h("sl-tooltip", { content: customizeDisabledTooltip, placement: "top", style: { display: "inline-block", width: "fit-content" } },
4389
+ h("p", { class: sheet.classes.CustomizeLinkDisabled }, customizeLinkLabel))) : (h("p", { class: limitReached
4390
+ ? sheet.classes.CustomizeLinkDisabled
4391
+ : sheet.classes.CustomizeLinkText, onClick: limitReached ? undefined : onCustomizeClick }, customizeLinkLabel))),
4392
+ customizeUrl && limitReached && (h("p", { class: sheet.classes.HelperText }, intl.formatMessage({
4393
+ id: "editLimitReached",
4394
+ defaultMessage: editLimitReachedText,
4395
+ }, {
4396
+ supportLink: (h("a", { target: "_blank", href: "https://example.com" }, supportLinkText)),
4397
+ })))));
4398
+ }
4399
+
4400
+ const MAX_EDITS = 5;
4401
+ const CHARACTER_LIMIT = 15;
4230
4402
  const MessageLinkQuery$1 = dist.gql `
4231
4403
  query ($programId: ID, $engagementMedium: UserEngagementMedium!) {
4232
4404
  user: viewer {
@@ -4245,19 +4417,121 @@ const WIDGET_ENGAGEMENT_EVENT = dist.gql `
4245
4417
  createUserAnalyticsEvent(eventMeta: $eventMeta)
4246
4418
  }
4247
4419
  `;
4420
+ const ADD_SHARE_LINK_CODE = dist.gql `
4421
+ mutation ($addShareLinkCodeInput: AddShareLinkCodeInput!) {
4422
+ addShareLinkCode(addShareLinkCodeInput: $addShareLinkCodeInput) {
4423
+ linkCode {
4424
+ linkCode
4425
+ shortUrl
4426
+ referralCode {
4427
+ code
4428
+ }
4429
+ }
4430
+ }
4431
+ }
4432
+ `;
4433
+ const VALIDATE_LINK_CODE = dist.gql `
4434
+ query validateLinkCode($linkCode: String!) {
4435
+ validateLinkCode(linkCode: $linkCode) {
4436
+ valid
4437
+ invalidReason
4438
+ }
4439
+ }
4440
+ `;
4441
+ const GET_LINK_DOMAIN = dist.gql `
4442
+ query getLinkDomain {
4443
+ tenantSettings {
4444
+ primaryLinkDomain {
4445
+ host
4446
+ }
4447
+ }
4448
+ }
4449
+ `;
4450
+ const SHARE_LINK_EDIT_COUNT = dist.gql `
4451
+ query shareLinkEditCount {
4452
+ viewer {
4453
+ ... on User {
4454
+ shareLinkCodes {
4455
+ totalCount
4456
+ data {
4457
+ isVanity
4458
+ }
4459
+ }
4460
+ }
4461
+ }
4462
+ }
4463
+ `;
4464
+ function parseDomainPrefix(url) {
4465
+ try {
4466
+ const parsed = new URL(url);
4467
+ return parsed.origin + "/";
4468
+ }
4469
+ catch {
4470
+ return url;
4471
+ }
4472
+ }
4473
+ function parsePathSuffix(url) {
4474
+ try {
4475
+ const parsed = new URL(url);
4476
+ // Remove leading slash
4477
+ return parsed.pathname.slice(1) + parsed.search + parsed.hash;
4478
+ }
4479
+ catch {
4480
+ return "";
4481
+ }
4482
+ }
4248
4483
  function useShareLink(props) {
4249
- var _a, _b;
4484
+ var _a, _b, _c, _d, _e, _f, _g;
4250
4485
  const { programId = H() } = props;
4251
4486
  const user = J();
4252
4487
  const engagementMedium = B();
4253
4488
  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);
4489
+ const { data, refetch } = 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);
4255
4490
  const [sendLoadEvent] = $e(WIDGET_ENGAGEMENT_EVENT);
4256
- const [setCopied, copiedRes] = $e(SET_CODE_COPIED);
4491
+ const [setCopied] = $e(SET_CODE_COPIED);
4492
+ const [addShareLinkCode, { loading: isSaving }] = $e(ADD_SHARE_LINK_CODE);
4493
+ const [validateLinkCode] = Xe(VALIDATE_LINK_CODE);
4494
+ const { data: linkDomainData } = wn(GET_LINK_DOMAIN, {}, !(user === null || user === void 0 ? void 0 : user.jwt) || !props.customizeUrl);
4495
+ const { data: editCountData, refetch: refetchEditCount } = wn(SHARE_LINK_EDIT_COUNT, {}, !(user === null || user === void 0 ? void 0 : user.jwt) || !props.customizeUrl);
4257
4496
  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 :
4258
4497
  // Shown during loading
4259
4498
  "...";
4260
4499
  const [open, setOpen] = useState(false);
4500
+ const [isEditing, setIsEditing] = useState(false);
4501
+ const [editValue, setEditValue] = useState("");
4502
+ const [validationError, setValidationError] = useState(null);
4503
+ const [isValidating, setIsValidating] = useState(false);
4504
+ const [showSuccess, setShowSuccess] = useState(false);
4505
+ const debounceTimerRef = useRef(undefined);
4506
+ const domainPrefix = parseDomainPrefix(copyString);
4507
+ const hasPrimaryLinkDomain = ((_c = linkDomainData === null || linkDomainData === void 0 ? void 0 : linkDomainData.tenantSettings) === null || _c === void 0 ? void 0 : _c.primaryLinkDomain) != null;
4508
+ const customizeDisabled = !hasPrimaryLinkDomain;
4509
+ 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;
4510
+ const editCount = vanityCount;
4511
+ const editsRemaining = Math.max(0, MAX_EDITS - editCount);
4512
+ const limitReached = editsRemaining <= 0;
4513
+ function mapErrorCodeToInfo(errorCode) {
4514
+ if (!errorCode)
4515
+ return null;
4516
+ const errorMap = {
4517
+ EXISTING_CODE_CONFLICT: {
4518
+ code: "EXISTING_CODE_CONFLICT",
4519
+ title: props.existingCodeConflictErrorTitle,
4520
+ description: props.existingCodeConflictErrorDescription,
4521
+ },
4522
+ INVALID_CHARACTERS: {
4523
+ code: "INVALID_CHARACTERS",
4524
+ title: props.invalidCharactersErrorTitle,
4525
+ description: props.invalidCharactersErrorDescription,
4526
+ },
4527
+ PROFANITY: {
4528
+ code: "PROFANITY",
4529
+ title: props.profanityErrorTitle,
4530
+ description: props.profanityErrorDescription,
4531
+ },
4532
+ };
4533
+ return errorMap[errorCode];
4534
+ }
4261
4535
  async function onClick() {
4262
4536
  if (contextData) {
4263
4537
  await setCopied({ referralCode: contextData.referralCode });
@@ -4281,7 +4555,107 @@ function useShareLink(props) {
4281
4555
  },
4282
4556
  });
4283
4557
  }
4284
- return { ...props, onClick, open, copyString: copyString };
4558
+ function onCustomizeClick() {
4559
+ if (limitReached || customizeDisabled)
4560
+ return;
4561
+ setIsEditing(true);
4562
+ setEditValue(editCount === 0 ? "" : parsePathSuffix(copyString));
4563
+ setValidationError(null);
4564
+ }
4565
+ function onEditValueChange(value) {
4566
+ const trimmed = value.slice(0, CHARACTER_LIMIT);
4567
+ setEditValue(trimmed);
4568
+ setValidationError(null);
4569
+ if (debounceTimerRef.current)
4570
+ clearTimeout(debounceTimerRef.current);
4571
+ if (!trimmed) {
4572
+ setIsValidating(false);
4573
+ return;
4574
+ }
4575
+ setIsValidating(true);
4576
+ debounceTimerRef.current = setTimeout(async () => {
4577
+ var _a, _b;
4578
+ try {
4579
+ const result = await validateLinkCode({ linkCode: trimmed });
4580
+ if (!((_a = result === null || result === void 0 ? void 0 : result.validateLinkCode) === null || _a === void 0 ? void 0 : _a.valid)) {
4581
+ const reason = (_b = result === null || result === void 0 ? void 0 : result.validateLinkCode) === null || _b === void 0 ? void 0 : _b.invalidReason;
4582
+ setValidationError(mapErrorCodeToInfo(reason));
4583
+ }
4584
+ }
4585
+ catch {
4586
+ // Validation query failed — don't block the user
4587
+ }
4588
+ setIsValidating(false);
4589
+ }, 2000);
4590
+ }
4591
+ async function onSave() {
4592
+ var _a, _b;
4593
+ if (!editValue || validationError || isValidating)
4594
+ return;
4595
+ try {
4596
+ await addShareLinkCode({
4597
+ addShareLinkCodeInput: {
4598
+ userId: user === null || user === void 0 ? void 0 : user.id,
4599
+ accountId: user === null || user === void 0 ? void 0 : user.accountId,
4600
+ programId,
4601
+ linkCode: editValue,
4602
+ makeShareLinkCodePrimaryForReferralCode: true,
4603
+ },
4604
+ });
4605
+ setIsEditing(false);
4606
+ setShowSuccess(true);
4607
+ await Promise.all([refetch(), refetchEditCount()]);
4608
+ setTimeout(() => setShowSuccess(false), 3000);
4609
+ }
4610
+ catch (e) {
4611
+ const errorCode = (_a = e === null || e === void 0 ? void 0 : e.extensions) === null || _a === void 0 ? void 0 : _a.code;
4612
+ setValidationError((_b = mapErrorCodeToInfo(errorCode)) !== null && _b !== void 0 ? _b : {
4613
+ code: null,
4614
+ title: "Error",
4615
+ description: (e === null || e === void 0 ? void 0 : e.message) || "Failed to save custom link. Please try again.",
4616
+ });
4617
+ }
4618
+ }
4619
+ function onCancel() {
4620
+ setIsEditing(false);
4621
+ setEditValue("");
4622
+ setValidationError(null);
4623
+ setIsValidating(false);
4624
+ }
4625
+ return {
4626
+ copyTextViewProps: {
4627
+ ...props,
4628
+ onClick,
4629
+ open,
4630
+ copyString,
4631
+ },
4632
+ customizeUrl: props.customizeUrl,
4633
+ customizeLinkLabel: props.customizeLinkLabel,
4634
+ saveLabelText: props.saveLabelText,
4635
+ cancelLabelText: props.cancelLabelText,
4636
+ successMessage: props.successMessage,
4637
+ isEditing,
4638
+ editValue,
4639
+ domainPrefix,
4640
+ editsRemaining,
4641
+ maxEdits: MAX_EDITS,
4642
+ limitReached,
4643
+ validationError,
4644
+ isValidating,
4645
+ isSaving,
4646
+ showSuccess,
4647
+ characterLimit: CHARACTER_LIMIT,
4648
+ charactersRemaining: CHARACTER_LIMIT - editValue.length,
4649
+ editLimitText: props.editLimitText,
4650
+ editLimitReachedText: props.editLimitReachedText,
4651
+ supportLinkText: props.supportLinkText,
4652
+ customizeDisabled,
4653
+ customizeDisabledTooltip: props.customizeDisabledTooltip,
4654
+ onCustomizeClick,
4655
+ onEditValueChange,
4656
+ onSave,
4657
+ onCancel,
4658
+ };
4285
4659
  }
4286
4660
 
4287
4661
  const style$9 = {
@@ -4322,7 +4696,7 @@ const style$9 = {
4322
4696
  },
4323
4697
  ErrorStyle: ErrorStyles,
4324
4698
  };
4325
- const vanillaStyle$6 = `
4699
+ const vanillaStyle$7 = `
4326
4700
  sqm-portal-register {
4327
4701
  margin: 0 auto;
4328
4702
  width: 100%;
@@ -4354,7 +4728,7 @@ function LeadFormView(props) {
4354
4728
  return (h(Fragment, null,
4355
4729
  states.success && (h("div", { class: sheet$9.classes.Wrapper, part: "sqm-base" },
4356
4730
  h("style", { type: "text/css" },
4357
- vanillaStyle$6,
4731
+ vanillaStyle$7,
4358
4732
  styleString$9),
4359
4733
  h(TextSpanView, { type: "h3" }, content.pageLabel),
4360
4734
  h("sqm-form-message", { loading: states.loading, exportparts: "success-icon" },
@@ -4364,7 +4738,7 @@ function LeadFormView(props) {
4364
4738
  h("sl-button", { class: sheet$9.classes.ContinueButton, onClick: callbacks.resetForm, loading: states.loading, exportparts: "base: primarybutton-base", type: "default" }, content.resubmitFormLabel))),
4365
4739
  h("div", { class: sheet$9.classes.Wrapper, part: "sqm-base", style: { display: states.success ? "none" : "block" } },
4366
4740
  h("style", { type: "text/css" },
4367
- vanillaStyle$6,
4741
+ vanillaStyle$7,
4368
4742
  styleString$9),
4369
4743
  h(TextSpanView, { type: "h3" }, content.pageLabel),
4370
4744
  h("sl-form", { class: sheet$9.classes.Column, "onSl-submit": callbacks.submit, ref: (el) => (refs.formRef.current = el), novalidate: true },
@@ -4417,7 +4791,7 @@ const style$a = {
4417
4791
  "margin-bottom": "var(--sl-spacing-large)",
4418
4792
  },
4419
4793
  };
4420
- const vanillaStyle$7 = `
4794
+ const vanillaStyle$8 = `
4421
4795
  :host {
4422
4796
  margin: 0 auto;
4423
4797
  width: 100%;
@@ -4446,7 +4820,7 @@ function LeadDropdownFieldView(props) {
4446
4820
  });
4447
4821
  return (h("div", { class: sheet$a.classes.FieldContainer, part: "sqm-base" },
4448
4822
  h("style", { type: "text/css" },
4449
- vanillaStyle$7,
4823
+ vanillaStyle$8,
4450
4824
  styleString$a),
4451
4825
  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
4826
  if (!value && !content.dropdownOptional) {
@@ -4463,94 +4837,6 @@ function LeadDropdownFieldView(props) {
4463
4837
  })))));
4464
4838
  }
4465
4839
 
4466
- const style$b = {
4467
- Dialog: {
4468
- "&::part(panel)": {
4469
- maxWidth: "480px",
4470
- },
4471
- "&::part(title)": {
4472
- fontSize: "var(--sl-font-size-x-large)",
4473
- fontWeight: "600",
4474
- padding: "var(--sl-spacing-x-large) var(--sl-spacing-x-large) 0 var(--sl-spacing-x-large)",
4475
- },
4476
- "&::part(body)": {
4477
- padding: "var(--sl-spacing-small) var(--sl-spacing-x-large)",
4478
- fontSize: "var(--sl-font-size-small)",
4479
- overflow: "visible",
4480
- },
4481
- "&::part(footer)": {
4482
- display: "flex",
4483
- flexDirection: "column",
4484
- gap: "var(--sl-spacing-small)",
4485
- padding: "var(--sl-spacing-small) var(--sl-spacing-x-large) var(--sl-spacing-x-large)",
4486
- },
4487
- "&::part(overlay)": {
4488
- background: "rgba(0, 0, 0, 0.5)",
4489
- },
4490
- "&::part(close-button)": {
4491
- display: "none",
4492
- },
4493
- },
4494
- FormFields: {
4495
- display: "flex",
4496
- gap: "var(--sl-spacing-medium)",
4497
- marginTop: "var(--sl-spacing-medium)",
4498
- "& > *": {
4499
- flex: 1,
4500
- },
4501
- },
4502
- ErrorMessage: {
4503
- color: "var(--sqm-danger-color-text, #d32f2f)",
4504
- fontSize: "var(--sl-font-size-small)",
4505
- marginTop: "var(--sl-spacing-x-small)",
4506
- },
4507
- SearchInput: {
4508
- "&::part(base)": {
4509
- border: "none",
4510
- borderBottom: "1px solid var(--sl-color-neutral-300)",
4511
- borderRadius: "0",
4512
- },
4513
- },
4514
- };
4515
- function PartnerInfoModalView(props) {
4516
- var _a, _b;
4517
- const { states, callbacks, text } = props;
4518
- const sheet = createStyleSheet(style$b);
4519
- const styleString = sheet.toString();
4520
- const description = states.isExistingPartner
4521
- ? text.descriptionExistingPartner
4522
- : text.descriptionNewPartner;
4523
- const buttonLabel = states.isExistingPartner
4524
- ? text.confirmButtonLabel
4525
- : text.submitButtonLabel;
4526
- return (h("sl-dialog", { class: sheet.classes.Dialog, open: states.open, noHeader: false, label: intl.formatMessage({
4527
- id: "modalBrandHeader",
4528
- defaultMessage: text.modalBrandHeader,
4529
- }, { brandName: states.brandName }), "onSl-request-close": (e) => {
4530
- e.preventDefault();
4531
- }, "onSl-hide": (e) => {
4532
- var _a;
4533
- // Prevent closing when clicking outside the dialog but not dropdowns
4534
- if (((_a = e.target) === null || _a === void 0 ? void 0 : _a.tagName) === "SL-DIALOG") {
4535
- e.preventDefault();
4536
- }
4537
- } },
4538
- h("style", { type: "text/css" }, styleString),
4539
- h("p", null, description),
4540
- h("div", { class: sheet.classes.FormFields },
4541
- h("sl-select", { exportparts: "label: input-label, base: input-base", label: text.countryLabel, value: states.countryCode, disabled: states.submitting, required: true, "onSl-select": callbacks.onCountryChange },
4542
- h("sl-input", { class: sheet.classes.SearchInput, placeholder: text.searchCountryPlaceholder, onKeyDown: (e) => e.stopPropagation(), "onSl-input": (e) => { var _a; return callbacks.onCountrySearch(((_a = e.target) === null || _a === void 0 ? void 0 : _a.value) || ""); } }), (_a = states.filteredCountries) === null || _a === void 0 ? void 0 :
4543
- _a.map((c) => (h("sl-menu-item", { value: c.countryCode }, c.displayName)))),
4544
- h("sl-select", { exportparts: "label: input-label, base: input-base", label: text.currencyLabel, value: states.currency, disabled: states.submitting, required: true, "onSl-select": callbacks.onCurrencyChange },
4545
- h("sl-input", { class: sheet.classes.SearchInput, placeholder: text.searchCurrencyPlaceholder, onKeyDown: (e) => e.stopPropagation(), "onSl-input": (e) => { var _a; return callbacks.onCurrencySearch(((_a = e.target) === null || _a === void 0 ? void 0 : _a.value) || ""); } }), (_b = states.filteredCurrencies) === null || _b === void 0 ? void 0 :
4546
- _b.map((c) => (h("sl-menu-item", { value: c.currencyCode },
4547
- c.currencyCode,
4548
- " - ",
4549
- c.displayName))))),
4550
- states.error && h("p", { class: sheet.classes.ErrorMessage }, states.error),
4551
- h("sl-button", { slot: "footer", type: "primary", loading: states.submitting, disabled: states.submitting || !states.countryCode || !states.currency, onClick: callbacks.onSubmit, style: { width: "100%" }, exportparts: "base: primarybutton-base" }, buttonLabel)));
4552
- }
4553
-
4554
4840
  const map = new Map();
4555
4841
  function withShadowView(component) {
4556
4842
  // TODO: Could only do this if rendered in a Stencilbook environment to prevent unintended side-effects
@@ -4585,4 +4871,4 @@ const ShadowViewAddon = ({ story }, children) => {
4585
4871
  h(TagName, { "stencilbook-shadow-view": randomInt })));
4586
4872
  };
4587
4873
 
4588
- 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, PartnerInfoModalView 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 };
4874
+ 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 };