@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
@@ -4229,6 +4229,178 @@ function useShareButton(props) {
4229
4229
  };
4230
4230
  }
4231
4231
 
4232
+ const vanillaStyle$6 = `
4233
+ :host {
4234
+ display: block;
4235
+ width: 100%;
4236
+ }
4237
+ `;
4238
+ function ShareLinkView(props) {
4239
+ 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;
4240
+ const style = {
4241
+ Container: {
4242
+ display: "flex",
4243
+ flexDirection: "column",
4244
+ gap: "var(--sl-spacing-x-small)",
4245
+ width: "100%",
4246
+ },
4247
+ CustomizeLinkText: {
4248
+ margin: "0",
4249
+ fontSize: "var(--sl-font-size-small)",
4250
+ fontWeight: "600",
4251
+ cursor: "pointer",
4252
+ color: "var(--sl-color-neutral-900)",
4253
+ textAlign: "left",
4254
+ "&:hover": {
4255
+ textDecoration: "underline",
4256
+ },
4257
+ },
4258
+ CustomizeLinkDisabled: {
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
+ flex: "1",
4295
+ border: "none",
4296
+ outline: "none",
4297
+ padding: "0 var(--sl-spacing-medium) 0 0",
4298
+ fontSize: "var(--sl-font-size-medium)",
4299
+ fontFamily: "var(--sl-font-sans)",
4300
+ color: "var(--sl-input-color)",
4301
+ background: "transparent",
4302
+ lineHeight: "var(--sl-input-height-medium)",
4303
+ minWidth: "0",
4304
+ },
4305
+ EditLabel: {
4306
+ margin: "0",
4307
+ fontSize: "var(--sl-font-size-small)",
4308
+ color: "var(--sl-color-neutral-500)",
4309
+ },
4310
+ HelperText: {
4311
+ margin: "0",
4312
+ fontSize: "var(--sl-font-size-small)",
4313
+ color: "var(--sl-color-neutral-500)",
4314
+ },
4315
+ ErrorText: {
4316
+ margin: "0",
4317
+ fontSize: "var(--sl-font-size-small)",
4318
+ color: "var(--sqm-danger-color-text, #dc2626)",
4319
+ },
4320
+ SuccessText: {
4321
+ margin: "0",
4322
+ fontSize: "var(--sl-font-size-small)",
4323
+ color: "var(--sl-color-success-600, #16a34a)",
4324
+ },
4325
+ ActionRow: {
4326
+ display: "flex",
4327
+ gap: "var(--sl-spacing-medium)",
4328
+ alignItems: "center",
4329
+ },
4330
+ SaveButton: {
4331
+ cursor: "pointer",
4332
+ fontFamily: "var(--sl-font-sans)",
4333
+ fontSize: "var(--sl-font-size-small)",
4334
+ fontWeight: "600",
4335
+ padding: "var(--sl-spacing-x-small) var(--sl-spacing-medium)",
4336
+ borderRadius: "var(--sqm-border-radius-normal, 4px)",
4337
+ border: "1px solid var(--sl-color-neutral-900)",
4338
+ background: "var(--sl-color-neutral-900)",
4339
+ color: "#fff",
4340
+ "&:disabled": {
4341
+ opacity: "0.5",
4342
+ cursor: "default",
4343
+ },
4344
+ },
4345
+ CancelButton: {
4346
+ margin: "0",
4347
+ fontSize: "var(--sl-font-size-small)",
4348
+ fontWeight: "600",
4349
+ cursor: "pointer",
4350
+ background: "none",
4351
+ border: "none",
4352
+ padding: "0",
4353
+ fontFamily: "var(--sl-font-sans)",
4354
+ color: "var(--sl-color-neutral-500)",
4355
+ },
4356
+ };
4357
+ const sheet = JSS.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 <= 7;
4361
+ // Editing state
4362
+ if (isEditing) {
4363
+ return (index.h("div", { class: sheet.classes.Container },
4364
+ index.h("style", { type: "text/css" },
4365
+ styleString,
4366
+ vanillaStyle$6),
4367
+ index.h("p", { class: sheet.classes.EditLabel }, "Enter your link"),
4368
+ index.h("div", { class: sheet.classes.EditInputWrapper },
4369
+ index.h("span", { class: sheet.classes.DomainPrefix }, domainPrefix),
4370
+ index.h("input", { class: sheet.classes.EditInput, type: "text", value: editValue, onInput: (e) => onEditValueChange(e.target.value), disabled: isSaving, maxLength: characterLimit })),
4371
+ index.h("p", { class: sheet.classes.HelperText },
4372
+ editLimitText,
4373
+ showCharactersRemaining &&
4374
+ ` Characters remaining: ${charactersRemaining}`),
4375
+ validationError && (index.h("sqm-form-message", { type: errorMessageType },
4376
+ index.h("p", { part: "alert-title" }, validationError.title),
4377
+ validationError.description)),
4378
+ isValidating && index.h("p", { class: sheet.classes.HelperText }, "Validating..."),
4379
+ index.h("div", { class: sheet.classes.ActionRow },
4380
+ index.h("button", { class: sheet.classes.SaveButton, onClick: onSave, disabled: isSaving || isValidating || !!validationError || !editValue }, isSaving ? "Saving..." : saveLabelText),
4381
+ index.h("button", { class: sheet.classes.CancelButton, onClick: onCancel, disabled: isSaving }, cancelLabelText))));
4382
+ }
4383
+ // Default / Customized / Limit reached states
4384
+ return (index.h("div", { class: sheet.classes.Container },
4385
+ index.h("style", { type: "text/css" },
4386
+ styleString,
4387
+ vanillaStyle$6),
4388
+ index.h(copyTextView.CopyTextView, Object.assign({}, copyTextViewProps)),
4389
+ showSuccess && index.h("p", { class: sheet.classes.SuccessText }, successMessage),
4390
+ customizeUrl && (customizeDisabled ? (index.h("sl-tooltip", { content: customizeDisabledTooltip, placement: "top", style: { display: "inline-block", width: "fit-content" } },
4391
+ index.h("p", { class: sheet.classes.CustomizeLinkDisabled }, customizeLinkLabel))) : (index.h("p", { class: limitReached
4392
+ ? sheet.classes.CustomizeLinkDisabled
4393
+ : sheet.classes.CustomizeLinkText, onClick: limitReached ? undefined : onCustomizeClick }, customizeLinkLabel))),
4394
+ customizeUrl && limitReached && (index.h("p", { class: sheet.classes.HelperText }, global.intl.formatMessage({
4395
+ id: "editLimitReached",
4396
+ defaultMessage: editLimitReachedText,
4397
+ }, {
4398
+ supportLink: (index.h("a", { target: "_blank", href: "https://example.com" }, supportLinkText)),
4399
+ })))));
4400
+ }
4401
+
4402
+ const MAX_EDITS = 5;
4403
+ const CHARACTER_LIMIT = 15;
4232
4404
  const MessageLinkQuery$1 = index_module.dist.gql `
4233
4405
  query ($programId: ID, $engagementMedium: UserEngagementMedium!) {
4234
4406
  user: viewer {
@@ -4247,19 +4419,121 @@ const WIDGET_ENGAGEMENT_EVENT = index_module.dist.gql `
4247
4419
  createUserAnalyticsEvent(eventMeta: $eventMeta)
4248
4420
  }
4249
4421
  `;
4422
+ const ADD_SHARE_LINK_CODE = index_module.dist.gql `
4423
+ mutation ($addShareLinkCodeInput: AddShareLinkCodeInput!) {
4424
+ addShareLinkCode(addShareLinkCodeInput: $addShareLinkCodeInput) {
4425
+ linkCode {
4426
+ linkCode
4427
+ shortUrl
4428
+ referralCode {
4429
+ code
4430
+ }
4431
+ }
4432
+ }
4433
+ }
4434
+ `;
4435
+ const VALIDATE_LINK_CODE = index_module.dist.gql `
4436
+ query validateLinkCode($linkCode: String!) {
4437
+ validateLinkCode(linkCode: $linkCode) {
4438
+ valid
4439
+ invalidReason
4440
+ }
4441
+ }
4442
+ `;
4443
+ const GET_LINK_DOMAIN = index_module.dist.gql `
4444
+ query getLinkDomain {
4445
+ tenantSettings {
4446
+ primaryLinkDomain {
4447
+ host
4448
+ }
4449
+ }
4450
+ }
4451
+ `;
4452
+ const SHARE_LINK_EDIT_COUNT = index_module.dist.gql `
4453
+ query shareLinkEditCount {
4454
+ viewer {
4455
+ ... on User {
4456
+ shareLinkCodes {
4457
+ totalCount
4458
+ data {
4459
+ isVanity
4460
+ }
4461
+ }
4462
+ }
4463
+ }
4464
+ }
4465
+ `;
4466
+ function parseDomainPrefix(url) {
4467
+ try {
4468
+ const parsed = new URL(url);
4469
+ return parsed.origin + "/";
4470
+ }
4471
+ catch {
4472
+ return url;
4473
+ }
4474
+ }
4475
+ function parsePathSuffix(url) {
4476
+ try {
4477
+ const parsed = new URL(url);
4478
+ // Remove leading slash
4479
+ return parsed.pathname.slice(1) + parsed.search + parsed.hash;
4480
+ }
4481
+ catch {
4482
+ return "";
4483
+ }
4484
+ }
4250
4485
  function useShareLink(props) {
4251
- var _a, _b;
4486
+ var _a, _b, _c, _d, _e, _f, _g;
4252
4487
  const { programId = index_module.H() } = props;
4253
4488
  const user = index_module.J();
4254
4489
  const engagementMedium = index_module.B();
4255
4490
  const contextData = index_module.Fn(useReferralCodes.REFERRAL_CODES_NAMESPACE);
4256
- const { data } = index_module.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);
4491
+ const { data, refetch } = index_module.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);
4257
4492
  const [sendLoadEvent] = index_module.$e(WIDGET_ENGAGEMENT_EVENT);
4258
- const [setCopied, copiedRes] = index_module.$e(useReferralCodes.SET_CODE_COPIED);
4493
+ const [setCopied] = index_module.$e(useReferralCodes.SET_CODE_COPIED);
4494
+ const [addShareLinkCode, { loading: isSaving }] = index_module.$e(ADD_SHARE_LINK_CODE);
4495
+ const [validateLinkCode] = index_module.Xe(VALIDATE_LINK_CODE);
4496
+ const { data: linkDomainData } = index_module.wn(GET_LINK_DOMAIN, {}, !(user === null || user === void 0 ? void 0 : user.jwt) || !props.customizeUrl);
4497
+ const { data: editCountData, refetch: refetchEditCount } = index_module.wn(SHARE_LINK_EDIT_COUNT, {}, !(user === null || user === void 0 ? void 0 : user.jwt) || !props.customizeUrl);
4259
4498
  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 :
4260
4499
  // Shown during loading
4261
4500
  "...";
4262
4501
  const [open, setOpen] = domContextHooks_module.useState(false);
4502
+ const [isEditing, setIsEditing] = domContextHooks_module.useState(false);
4503
+ const [editValue, setEditValue] = domContextHooks_module.useState("");
4504
+ const [validationError, setValidationError] = domContextHooks_module.useState(null);
4505
+ const [isValidating, setIsValidating] = domContextHooks_module.useState(false);
4506
+ const [showSuccess, setShowSuccess] = domContextHooks_module.useState(false);
4507
+ const debounceTimerRef = domContextHooks_module.useRef(undefined);
4508
+ const domainPrefix = parseDomainPrefix(copyString);
4509
+ const hasPrimaryLinkDomain = ((_c = linkDomainData === null || linkDomainData === void 0 ? void 0 : linkDomainData.tenantSettings) === null || _c === void 0 ? void 0 : _c.primaryLinkDomain) != null;
4510
+ const customizeDisabled = !hasPrimaryLinkDomain;
4511
+ 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;
4512
+ const editCount = vanityCount;
4513
+ const editsRemaining = Math.max(0, MAX_EDITS - editCount);
4514
+ const limitReached = editsRemaining <= 0;
4515
+ function mapErrorCodeToInfo(errorCode) {
4516
+ if (!errorCode)
4517
+ return null;
4518
+ const errorMap = {
4519
+ EXISTING_CODE_CONFLICT: {
4520
+ code: "EXISTING_CODE_CONFLICT",
4521
+ title: props.existingCodeConflictErrorTitle,
4522
+ description: props.existingCodeConflictErrorDescription,
4523
+ },
4524
+ INVALID_CHARACTERS: {
4525
+ code: "INVALID_CHARACTERS",
4526
+ title: props.invalidCharactersErrorTitle,
4527
+ description: props.invalidCharactersErrorDescription,
4528
+ },
4529
+ PROFANITY: {
4530
+ code: "PROFANITY",
4531
+ title: props.profanityErrorTitle,
4532
+ description: props.profanityErrorDescription,
4533
+ },
4534
+ };
4535
+ return errorMap[errorCode];
4536
+ }
4263
4537
  async function onClick() {
4264
4538
  if (contextData) {
4265
4539
  await setCopied({ referralCode: contextData.referralCode });
@@ -4283,7 +4557,107 @@ function useShareLink(props) {
4283
4557
  },
4284
4558
  });
4285
4559
  }
4286
- return { ...props, onClick, open, copyString: copyString };
4560
+ function onCustomizeClick() {
4561
+ if (limitReached || customizeDisabled)
4562
+ return;
4563
+ setIsEditing(true);
4564
+ setEditValue(editCount === 0 ? "" : parsePathSuffix(copyString));
4565
+ setValidationError(null);
4566
+ }
4567
+ function onEditValueChange(value) {
4568
+ const trimmed = value.slice(0, CHARACTER_LIMIT);
4569
+ setEditValue(trimmed);
4570
+ setValidationError(null);
4571
+ if (debounceTimerRef.current)
4572
+ clearTimeout(debounceTimerRef.current);
4573
+ if (!trimmed) {
4574
+ setIsValidating(false);
4575
+ return;
4576
+ }
4577
+ setIsValidating(true);
4578
+ debounceTimerRef.current = setTimeout(async () => {
4579
+ var _a, _b;
4580
+ try {
4581
+ const result = await validateLinkCode({ linkCode: trimmed });
4582
+ if (!((_a = result === null || result === void 0 ? void 0 : result.validateLinkCode) === null || _a === void 0 ? void 0 : _a.valid)) {
4583
+ const reason = (_b = result === null || result === void 0 ? void 0 : result.validateLinkCode) === null || _b === void 0 ? void 0 : _b.invalidReason;
4584
+ setValidationError(mapErrorCodeToInfo(reason));
4585
+ }
4586
+ }
4587
+ catch {
4588
+ // Validation query failed — don't block the user
4589
+ }
4590
+ setIsValidating(false);
4591
+ }, 2000);
4592
+ }
4593
+ async function onSave() {
4594
+ var _a, _b;
4595
+ if (!editValue || validationError || isValidating)
4596
+ return;
4597
+ try {
4598
+ await addShareLinkCode({
4599
+ addShareLinkCodeInput: {
4600
+ userId: user === null || user === void 0 ? void 0 : user.id,
4601
+ accountId: user === null || user === void 0 ? void 0 : user.accountId,
4602
+ programId,
4603
+ linkCode: editValue,
4604
+ makeShareLinkCodePrimaryForReferralCode: true,
4605
+ },
4606
+ });
4607
+ setIsEditing(false);
4608
+ setShowSuccess(true);
4609
+ await Promise.all([refetch(), refetchEditCount()]);
4610
+ setTimeout(() => setShowSuccess(false), 3000);
4611
+ }
4612
+ catch (e) {
4613
+ const errorCode = (_a = e === null || e === void 0 ? void 0 : e.extensions) === null || _a === void 0 ? void 0 : _a.code;
4614
+ setValidationError((_b = mapErrorCodeToInfo(errorCode)) !== null && _b !== void 0 ? _b : {
4615
+ code: null,
4616
+ title: "Error",
4617
+ description: (e === null || e === void 0 ? void 0 : e.message) || "Failed to save custom link. Please try again.",
4618
+ });
4619
+ }
4620
+ }
4621
+ function onCancel() {
4622
+ setIsEditing(false);
4623
+ setEditValue("");
4624
+ setValidationError(null);
4625
+ setIsValidating(false);
4626
+ }
4627
+ return {
4628
+ copyTextViewProps: {
4629
+ ...props,
4630
+ onClick,
4631
+ open,
4632
+ copyString,
4633
+ },
4634
+ customizeUrl: props.customizeUrl,
4635
+ customizeLinkLabel: props.customizeLinkLabel,
4636
+ saveLabelText: props.saveLabelText,
4637
+ cancelLabelText: props.cancelLabelText,
4638
+ successMessage: props.successMessage,
4639
+ isEditing,
4640
+ editValue,
4641
+ domainPrefix,
4642
+ editsRemaining,
4643
+ maxEdits: MAX_EDITS,
4644
+ limitReached,
4645
+ validationError,
4646
+ isValidating,
4647
+ isSaving,
4648
+ showSuccess,
4649
+ characterLimit: CHARACTER_LIMIT,
4650
+ charactersRemaining: CHARACTER_LIMIT - editValue.length,
4651
+ editLimitText: props.editLimitText,
4652
+ editLimitReachedText: props.editLimitReachedText,
4653
+ supportLinkText: props.supportLinkText,
4654
+ customizeDisabled,
4655
+ customizeDisabledTooltip: props.customizeDisabledTooltip,
4656
+ onCustomizeClick,
4657
+ onEditValueChange,
4658
+ onSave,
4659
+ onCancel,
4660
+ };
4287
4661
  }
4288
4662
 
4289
4663
  const style$9 = {
@@ -4324,7 +4698,7 @@ const style$9 = {
4324
4698
  },
4325
4699
  ErrorStyle: mixins.ErrorStyles,
4326
4700
  };
4327
- const vanillaStyle$6 = `
4701
+ const vanillaStyle$7 = `
4328
4702
  sqm-portal-register {
4329
4703
  margin: 0 auto;
4330
4704
  width: 100%;
@@ -4356,7 +4730,7 @@ function LeadFormView(props) {
4356
4730
  return (index.h(index.Fragment, null,
4357
4731
  states.success && (index.h("div", { class: sheet$9.classes.Wrapper, part: "sqm-base" },
4358
4732
  index.h("style", { type: "text/css" },
4359
- vanillaStyle$6,
4733
+ vanillaStyle$7,
4360
4734
  styleString$9),
4361
4735
  index.h(sqmTextSpanView.TextSpanView, { type: "h3" }, content.pageLabel),
4362
4736
  index.h("sqm-form-message", { loading: states.loading, exportparts: "success-icon" },
@@ -4366,7 +4740,7 @@ function LeadFormView(props) {
4366
4740
  index.h("sl-button", { class: sheet$9.classes.ContinueButton, onClick: callbacks.resetForm, loading: states.loading, exportparts: "base: primarybutton-base", type: "default" }, content.resubmitFormLabel))),
4367
4741
  index.h("div", { class: sheet$9.classes.Wrapper, part: "sqm-base", style: { display: states.success ? "none" : "block" } },
4368
4742
  index.h("style", { type: "text/css" },
4369
- vanillaStyle$6,
4743
+ vanillaStyle$7,
4370
4744
  styleString$9),
4371
4745
  index.h(sqmTextSpanView.TextSpanView, { type: "h3" }, content.pageLabel),
4372
4746
  index.h("sl-form", { class: sheet$9.classes.Column, "onSl-submit": callbacks.submit, ref: (el) => (refs.formRef.current = el), novalidate: true },
@@ -4419,7 +4793,7 @@ const style$a = {
4419
4793
  "margin-bottom": "var(--sl-spacing-large)",
4420
4794
  },
4421
4795
  };
4422
- const vanillaStyle$7 = `
4796
+ const vanillaStyle$8 = `
4423
4797
  :host {
4424
4798
  margin: 0 auto;
4425
4799
  width: 100%;
@@ -4448,7 +4822,7 @@ function LeadDropdownFieldView(props) {
4448
4822
  });
4449
4823
  return (index.h("div", { class: sheet$a.classes.FieldContainer, part: "sqm-base" },
4450
4824
  index.h("style", { type: "text/css" },
4451
- vanillaStyle$7,
4825
+ vanillaStyle$8,
4452
4826
  styleString$a),
4453
4827
  index.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 }) => {
4454
4828
  if (!value && !content.dropdownOptional) {
@@ -4465,94 +4839,6 @@ function LeadDropdownFieldView(props) {
4465
4839
  })))));
4466
4840
  }
4467
4841
 
4468
- const style$b = {
4469
- Dialog: {
4470
- "&::part(panel)": {
4471
- maxWidth: "480px",
4472
- },
4473
- "&::part(title)": {
4474
- fontSize: "var(--sl-font-size-x-large)",
4475
- fontWeight: "600",
4476
- padding: "var(--sl-spacing-x-large) var(--sl-spacing-x-large) 0 var(--sl-spacing-x-large)",
4477
- },
4478
- "&::part(body)": {
4479
- padding: "var(--sl-spacing-small) var(--sl-spacing-x-large)",
4480
- fontSize: "var(--sl-font-size-small)",
4481
- overflow: "visible",
4482
- },
4483
- "&::part(footer)": {
4484
- display: "flex",
4485
- flexDirection: "column",
4486
- gap: "var(--sl-spacing-small)",
4487
- padding: "var(--sl-spacing-small) var(--sl-spacing-x-large) var(--sl-spacing-x-large)",
4488
- },
4489
- "&::part(overlay)": {
4490
- background: "rgba(0, 0, 0, 0.5)",
4491
- },
4492
- "&::part(close-button)": {
4493
- display: "none",
4494
- },
4495
- },
4496
- FormFields: {
4497
- display: "flex",
4498
- gap: "var(--sl-spacing-medium)",
4499
- marginTop: "var(--sl-spacing-medium)",
4500
- "& > *": {
4501
- flex: 1,
4502
- },
4503
- },
4504
- ErrorMessage: {
4505
- color: "var(--sqm-danger-color-text, #d32f2f)",
4506
- fontSize: "var(--sl-font-size-small)",
4507
- marginTop: "var(--sl-spacing-x-small)",
4508
- },
4509
- SearchInput: {
4510
- "&::part(base)": {
4511
- border: "none",
4512
- borderBottom: "1px solid var(--sl-color-neutral-300)",
4513
- borderRadius: "0",
4514
- },
4515
- },
4516
- };
4517
- function PartnerInfoModalView(props) {
4518
- var _a, _b;
4519
- const { states, callbacks, text } = props;
4520
- const sheet = JSS.createStyleSheet(style$b);
4521
- const styleString = sheet.toString();
4522
- const description = states.isExistingPartner
4523
- ? text.descriptionExistingPartner
4524
- : text.descriptionNewPartner;
4525
- const buttonLabel = states.isExistingPartner
4526
- ? text.confirmButtonLabel
4527
- : text.submitButtonLabel;
4528
- return (index.h("sl-dialog", { class: sheet.classes.Dialog, open: states.open, noHeader: false, label: global.intl.formatMessage({
4529
- id: "modalBrandHeader",
4530
- defaultMessage: text.modalBrandHeader,
4531
- }, { brandName: states.brandName }), "onSl-request-close": (e) => {
4532
- e.preventDefault();
4533
- }, "onSl-hide": (e) => {
4534
- var _a;
4535
- // Prevent closing when clicking outside the dialog but not dropdowns
4536
- if (((_a = e.target) === null || _a === void 0 ? void 0 : _a.tagName) === "SL-DIALOG") {
4537
- e.preventDefault();
4538
- }
4539
- } },
4540
- index.h("style", { type: "text/css" }, styleString),
4541
- index.h("p", null, description),
4542
- index.h("div", { class: sheet.classes.FormFields },
4543
- index.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 },
4544
- index.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 :
4545
- _a.map((c) => (index.h("sl-menu-item", { value: c.countryCode }, c.displayName)))),
4546
- index.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 },
4547
- index.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 :
4548
- _b.map((c) => (index.h("sl-menu-item", { value: c.currencyCode },
4549
- c.currencyCode,
4550
- " - ",
4551
- c.displayName))))),
4552
- states.error && index.h("p", { class: sheet.classes.ErrorMessage }, states.error),
4553
- index.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)));
4554
- }
4555
-
4556
4842
  const map = new Map();
4557
4843
  function withShadowView(component) {
4558
4844
  // TODO: Could only do this if rendered in a Stencilbook environment to prevent unintended side-effects
@@ -4601,7 +4887,6 @@ exports.LeadDropdownFieldView = LeadDropdownFieldView;
4601
4887
  exports.LeadFormView = LeadFormView;
4602
4888
  exports.LeaderboardView = LeaderboardView;
4603
4889
  exports.NameFieldsView = NameFieldsView;
4604
- exports.PartnerInfoModalView = PartnerInfoModalView;
4605
4890
  exports.PortalChangePasswordView = PortalChangePasswordView;
4606
4891
  exports.PortalFooterView = PortalFooterView;
4607
4892
  exports.PortalFrameView = PortalFrameView;
@@ -4612,6 +4897,7 @@ exports.ReferralIframeView = ReferralIframeView;
4612
4897
  exports.RewardExchangeView = RewardExchangeView;
4613
4898
  exports.ShadowViewAddon = ShadowViewAddon;
4614
4899
  exports.ShareButtonView = ShareButtonView;
4900
+ exports.ShareLinkView = ShareLinkView;
4615
4901
  exports.StatContainerView = StatContainerView;
4616
4902
  exports.TaskCardView = TaskCardView;
4617
4903
  exports.chooseAmountFixed = chooseAmountFixed;