@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
|
@@ -25,109 +25,6 @@ export const paypalFeeMap = {
|
|
|
25
25
|
const ACH_PAYMENT_METHOD = 3;
|
|
26
26
|
const WIRE_PAYMENT_METHOD = 5;
|
|
27
27
|
const PAYPAL_PAYMENT_METHOD = 7;
|
|
28
|
-
/**
|
|
29
|
-
* Maps GraphQL validation error field names to form field names.
|
|
30
|
-
*
|
|
31
|
-
* The Impact API returns UpperCamelCase field names (e.g. `BankAccountNumber`).
|
|
32
|
-
* The GraphQL layer in `UserServiceImpl.java` converts these to lowerCamelCase
|
|
33
|
-
* via `CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, errorDto.field)`.
|
|
34
|
-
*
|
|
35
|
-
* Most converted field names already match the form field names exactly
|
|
36
|
-
* (e.g. `bankAccountNumber`, `swiftCode`, `routingCode`). Only entries
|
|
37
|
-
* where the GraphQL field name differs from the form field name need
|
|
38
|
-
* to be listed here.
|
|
39
|
-
*/
|
|
40
|
-
const API_FIELD_TO_FORM_FIELD = {
|
|
41
|
-
// bankProvinceState → form uses bankState
|
|
42
|
-
bankProvinceState: "bankState",
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* Maps Impact API error code paths (from validationErrors[].errorPath) to short,
|
|
46
|
-
* readable frontend error codes used in the ICU select props.
|
|
47
|
-
*
|
|
48
|
-
* The Impact API returns a stable dot-delimited error path (e.g.
|
|
49
|
-
* "withdrawal.settings.error.routingcode") alongside the human-readable message.
|
|
50
|
-
* The GraphQL layer exposes this as `errorPath`. The keys below match those paths
|
|
51
|
-
* to short frontend codes used in the ICU `{errorCode, select, ...}` props.
|
|
52
|
-
*/
|
|
53
|
-
const API_ERROR_PATH_TO_FRONTEND = {
|
|
54
|
-
// Beneficiary account name
|
|
55
|
-
"withdrawal.settings.error.empty_beneficiaryname": "empty",
|
|
56
|
-
"withdrawal.settings.error.invalid_character_beneficiaryname": "invalidCharacters",
|
|
57
|
-
"withdrawal.settings.error.numeric_beneficiaryname": "numeric",
|
|
58
|
-
"withdrawal_settings.error.beneficiaryname.size": "tooLong",
|
|
59
|
-
"withdrawal.settings.error.non_english_beneficiaryname": "nonEnglish",
|
|
60
|
-
"withdrawal_settings.error.business_beneficiaryname_match": "businessNameMismatch",
|
|
61
|
-
"withdrawal_settings.error.beneficiaryname_match": "nameMismatch",
|
|
62
|
-
"withdrawal_settings.error.business_checkpayeename_match": "businessPayeeMismatch",
|
|
63
|
-
"withdrawal_settings.error.checkpayeename_match": "payeeMismatch",
|
|
64
|
-
// Bank account number
|
|
65
|
-
"withdrawal.settings.error.accountnumber.empty": "empty",
|
|
66
|
-
"withdrawal.settings.error.accountnumber.uk": "invalidUk",
|
|
67
|
-
"withdrawal.settings.error.bankaccount.invalid": "invalid",
|
|
68
|
-
// IBAN
|
|
69
|
-
"withdrawal.settings.error.iban": "ibanEmpty",
|
|
70
|
-
"withdrawal.settings.error.iban.alphanumeric": "ibanAlphanumeric",
|
|
71
|
-
"withdrawal.settings.error.iban.invalid": "ibanInvalid",
|
|
72
|
-
"withdrawal.settings.error.iban.uk.country.mismatch": "ibanCountryMismatch",
|
|
73
|
-
// Routing code
|
|
74
|
-
"withdrawal.settings.error.bsbNumber": "invalidBsb",
|
|
75
|
-
"withdrawal.settings.error.sortcode": "invalidSortCode",
|
|
76
|
-
"withdrawal.settings.error.routingNumber": "empty",
|
|
77
|
-
"withdrawal.settings.error.routingcode": "invalid",
|
|
78
|
-
// SWIFT / BIC
|
|
79
|
-
"withdrawal.settings.error.bic": "empty",
|
|
80
|
-
"withdrawal.settings.error.bic.alphanumeric": "alphanumeric",
|
|
81
|
-
"withdrawal.settings.error.bic.invalid": "invalid",
|
|
82
|
-
// Bank account type
|
|
83
|
-
"global.error.invalid.accounttype": "empty",
|
|
84
|
-
// Bank name
|
|
85
|
-
"withdrawal.settings.error.bankName": "empty",
|
|
86
|
-
// Tax payer ID
|
|
87
|
-
"withdrawal.settings.error.taxPayerId": "empty",
|
|
88
|
-
"withdrawal.settings.error.taxPayerId.ar": "emptyAr",
|
|
89
|
-
"withdrawal.settings.error.taxPayerId.kr": "emptyKr",
|
|
90
|
-
"withdrawal.settings.error.taxPayerId.alphanumeric": "alphanumeric",
|
|
91
|
-
"withdrawal.settings.error.taxPayerId.alphanumeric.ar": "alphanumericAr",
|
|
92
|
-
"withdrawal.settings.error.taxPayerId.alphanumeric.kr": "alphanumericKr",
|
|
93
|
-
"withdrawal.settings.error.taxPayerId.invalid": "invalid",
|
|
94
|
-
"withdrawal.settings.error.taxPayerId.invalid.ar": "invalidAr",
|
|
95
|
-
"withdrawal.settings.error.taxPayerId.invalid.kr": "invalidKr",
|
|
96
|
-
"withdrawal.settings.error.taxPayerId.invalid.kzt": "invalidKzt",
|
|
97
|
-
"withdrawal.settings.error.taxPayerId.cnpj": "cnpjTooShort",
|
|
98
|
-
"withdrawal.settings.error.taxPayerId.cpf": "cpfTooShort",
|
|
99
|
-
// Patronymic name
|
|
100
|
-
"withdrawal.settings.error.patronymicName": "empty",
|
|
101
|
-
"withdrawal.settings.error.patronymicName.alphanumeric": "alphanumeric",
|
|
102
|
-
// VO code
|
|
103
|
-
"withdrawal.settings.error.voCode": "empty",
|
|
104
|
-
"withdrawal.settings.error.voCode.alphanumeric": "alphanumeric",
|
|
105
|
-
// Agency code
|
|
106
|
-
"withdrawal.settings.error.agencyCode": "empty",
|
|
107
|
-
"withdrawal.settings.error.agencyCode.alphanumeric": "alphanumeric",
|
|
108
|
-
"withdrawal.settings.error.agencyCode.length": "tooShort",
|
|
109
|
-
// Bank address fields
|
|
110
|
-
"withdrawal.settings.error.bankAddress": "empty",
|
|
111
|
-
"withdrawal.settings.error.bankCity": "empty",
|
|
112
|
-
"withdrawal.settings.error.bankProvinceState": "empty",
|
|
113
|
-
"withdrawal.settings.error.bankPostalCode": "empty",
|
|
114
|
-
// Branch code / name
|
|
115
|
-
"withdrawal.settings.error.branchCode": "invalid",
|
|
116
|
-
"withdrawal.settings.error.branchName": "empty",
|
|
117
|
-
// Classification code
|
|
118
|
-
"withdrawal.settings.error.classificationCode.invalid": "empty",
|
|
119
|
-
"withdrawal.settings.error.classificationCode.invalid.kzt": "invalidKzt",
|
|
120
|
-
// PayPal
|
|
121
|
-
"payment.error.email": "empty",
|
|
122
|
-
"payment.error.paypal_not_supported": "unsupportedCurrency",
|
|
123
|
-
"payment.error.email.invalid": "invalidEmail",
|
|
124
|
-
"payment.error.paypal_verification_incomplete": "verificationIncomplete",
|
|
125
|
-
// Payment schedule
|
|
126
|
-
"payment.error.no_threshold": "empty",
|
|
127
|
-
"payment.error.invalid_threshold": "invalid",
|
|
128
|
-
"payment.error.no_dayOfMonth": "empty",
|
|
129
|
-
"payment.error.invalid_dayOfMonth": "invalid",
|
|
130
|
-
};
|
|
131
28
|
export function getFormInputs({ bitset, formMap }) {
|
|
132
29
|
// Convert bitset to binary representation
|
|
133
30
|
const binary = bitset.toString(2).padStart(Object.keys(formMap).length, "0");
|
|
@@ -151,7 +48,6 @@ const SAVE_WITHDRAWAL_SETTINGS = gql `
|
|
|
151
48
|
validationErrors {
|
|
152
49
|
field
|
|
153
50
|
message
|
|
154
|
-
errorPath
|
|
155
51
|
}
|
|
156
52
|
}
|
|
157
53
|
}
|
|
@@ -167,7 +63,6 @@ const UPDATE_WITHDRAWAL_SETTINGS = gql `
|
|
|
167
63
|
validationErrors {
|
|
168
64
|
field
|
|
169
65
|
message
|
|
170
|
-
errorPath
|
|
171
66
|
}
|
|
172
67
|
}
|
|
173
68
|
}
|
|
@@ -340,13 +235,10 @@ export function useBankingInfoForm(props) {
|
|
|
340
235
|
else if (!success) {
|
|
341
236
|
console.error("Validation failed: ", validationErrors);
|
|
342
237
|
const mappedValidationErrors = validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors.reduce((agg, error) => {
|
|
343
|
-
const formField = API_FIELD_TO_FORM_FIELD[error.field] || error.field;
|
|
344
|
-
const errorCode = API_ERROR_PATH_TO_FRONTEND[error.errorPath] || error.errorPath;
|
|
345
238
|
return {
|
|
346
239
|
...agg,
|
|
347
|
-
[
|
|
240
|
+
[error.field]: {
|
|
348
241
|
type: "invalid",
|
|
349
|
-
errorCode,
|
|
350
242
|
},
|
|
351
243
|
};
|
|
352
244
|
}, {});
|
|
@@ -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
|
|
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 } = 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
|
-
|
|
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 refetch();
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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) {
|
|
@@ -4497,4 +4871,4 @@ const ShadowViewAddon = ({ story }, children) => {
|
|
|
4497
4871
|
h(TagName, { "stencilbook-shadow-view": randomInt })));
|
|
4498
4872
|
};
|
|
4499
4873
|
|
|
4500
|
-
export { empty as A, BigStatView as B, CardFeedView as C, DropdownFieldView as D, EditProfileView as E, rewardExchange as F, useShareButton as G, HeroView as H, InputFieldView as I,
|
|
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 };
|