@saasquatch/mint-components 2.1.8-0 → 2.1.8-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.
- package/dist/cjs/{ShadowViewAddon-1d15cdf7.js → ShadowViewAddon-19755faf.js} +384 -9
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mint-components.cjs.js +1 -1
- package/dist/cjs/sqm-banking-info-form_10.cjs.entry.js +50 -391
- package/dist/cjs/sqm-big-stat_45.cjs.entry.js +172 -23
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +168 -18
- package/dist/collection/components/sqm-share-code/sqm-share-code.js +0 -1
- package/dist/collection/components/sqm-share-link/ShareLink.stories.js +142 -11
- package/dist/collection/components/sqm-share-link/UseShareLink.stories.js +14 -5
- package/dist/collection/components/sqm-share-link/sqm-share-link-view.js +173 -0
- package/dist/collection/components/sqm-share-link/sqm-share-link.js +536 -26
- package/dist/collection/components/sqm-share-link/useShareLink.js +210 -6
- package/dist/collection/components/tax-and-cash/sqm-banking-info-form/formDefinitions.js +37 -75
- package/dist/collection/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form.js +13 -688
- package/dist/collection/components/tax-and-cash/sqm-banking-info-form/useBankingInfoForm.js +1 -109
- package/dist/esm/{ShadowViewAddon-53b9090b.js → ShadowViewAddon-23d56d60.js} +386 -12
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mint-components.js +1 -1
- package/dist/esm/sqm-banking-info-form_10.entry.js +50 -391
- package/dist/esm/sqm-big-stat_45.entry.js +172 -23
- package/dist/esm/sqm-stencilbook.entry.js +168 -18
- package/dist/esm-es5/ShadowViewAddon-23d56d60.js +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/mint-components.js +1 -1
- package/dist/esm-es5/sqm-banking-info-form_10.entry.js +1 -1
- package/dist/esm-es5/sqm-big-stat_45.entry.js +1 -1
- package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
- package/dist/mint-components/mint-components.esm.js +1 -1
- package/dist/mint-components/p-182b5b6a.js +503 -0
- package/dist/mint-components/{p-0e6c90b1.entry.js → p-27ec70af.entry.js} +20 -20
- package/dist/mint-components/p-47b630aa.entry.js +9 -0
- package/dist/mint-components/p-644fca99.system.js +1 -0
- package/dist/mint-components/p-af8c2202.system.entry.js +1 -0
- package/dist/mint-components/p-ca098be1.system.js +1 -1
- package/dist/mint-components/p-cacb897d.system.entry.js +1 -0
- package/dist/mint-components/p-ebe1eb7a.system.entry.js +1 -0
- package/dist/mint-components/p-ff378015.entry.js +106 -0
- package/dist/types/components/sqm-share-link/ShareLink.stories.d.ts +10 -0
- package/dist/types/components/sqm-share-link/UseShareLink.stories.d.ts +6 -0
- package/dist/types/components/sqm-share-link/sqm-share-link-view.d.ts +37 -0
- package/dist/types/components/sqm-share-link/sqm-share-link.d.ts +107 -2
- package/dist/types/components/sqm-share-link/useShareLink.d.ts +27 -4
- package/dist/types/components/tax-and-cash/sqm-banking-info-form/formDefinitions.d.ts +0 -2
- package/dist/types/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form-view.d.ts +0 -4
- package/dist/types/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form.d.ts +0 -165
- package/dist/types/components.d.ts +183 -242
- package/docs/docs.docx +0 -0
- package/docs/raisins.json +1 -1
- package/grapesjs/grapesjs.js +1 -1
- package/package.json +1 -1
- package/dist/esm-es5/ShadowViewAddon-53b9090b.js +0 -1
- package/dist/mint-components/p-17b32de7.system.entry.js +0 -1
- package/dist/mint-components/p-54ea8b9b.system.entry.js +0 -1
- package/dist/mint-components/p-7d16ee0e.entry.js +0 -108
- package/dist/mint-components/p-807ed3bf.system.js +0 -1
- package/dist/mint-components/p-de7bb373.entry.js +0 -9
- package/dist/mint-components/p-e9258d20.system.entry.js +0 -1
- package/dist/mint-components/p-e980472a.js +0 -463
|
@@ -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
|
|
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 } = 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
|
-
|
|
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 refetch();
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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) {
|
|
@@ -4523,6 +4897,7 @@ exports.ReferralIframeView = ReferralIframeView;
|
|
|
4523
4897
|
exports.RewardExchangeView = RewardExchangeView;
|
|
4524
4898
|
exports.ShadowViewAddon = ShadowViewAddon;
|
|
4525
4899
|
exports.ShareButtonView = ShareButtonView;
|
|
4900
|
+
exports.ShareLinkView = ShareLinkView;
|
|
4526
4901
|
exports.StatContainerView = StatContainerView;
|
|
4527
4902
|
exports.TaskCardView = TaskCardView;
|
|
4528
4903
|
exports.chooseAmountFixed = chooseAmountFixed;
|