@trii/components 2.0.20 → 2.0.22
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/index.js +683 -50
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/ContactInfoPopup/ContactInfoPopup.d.ts +4 -3
- package/dist/cjs/types/components/ContactInfoPopup/components/BusinessSection/BusinessSection.d.ts +7 -0
- package/dist/cjs/types/components/ContactInfoPopup/components/BusinessSection/index.d.ts +1 -0
- package/dist/cjs/types/components/ContactInfoPopup/components/Header/Header.d.ts +9 -4
- package/dist/cjs/types/components/ContactInfoPopup/components/LabelsSection/LabelsSection.d.ts +7 -0
- package/dist/cjs/types/components/ContactInfoPopup/components/LabelsSection/index.d.ts +1 -0
- package/dist/cjs/types/components/ContactInfoPopup/components/MembersSection/MembersSection.d.ts +7 -0
- package/dist/cjs/types/components/ContactInfoPopup/components/MembersSection/components/MemberItem/MemberItem.d.ts +4 -0
- package/dist/cjs/types/components/ContactInfoPopup/components/MembersSection/components/MemberItem/index.d.ts +1 -0
- package/dist/cjs/types/components/ContactInfoPopup/components/MembersSection/components/index.d.ts +1 -0
- package/dist/cjs/types/components/ContactInfoPopup/components/MembersSection/index.d.ts +1 -0
- package/dist/cjs/types/components/ContactInfoPopup/components/index.d.ts +3 -0
- package/dist/cjs/types/components/ContactInfoPopup/types/is-business.typeguard.d.ts +7 -0
- package/dist/cjs/types/components/ContactInfoPopup/types/is-contact.typeguard.d.ts +7 -0
- package/dist/esm/index.js +685 -52
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/ContactInfoPopup/ContactInfoPopup.d.ts +4 -3
- package/dist/esm/types/components/ContactInfoPopup/components/BusinessSection/BusinessSection.d.ts +7 -0
- package/dist/esm/types/components/ContactInfoPopup/components/BusinessSection/index.d.ts +1 -0
- package/dist/esm/types/components/ContactInfoPopup/components/Header/Header.d.ts +9 -4
- package/dist/esm/types/components/ContactInfoPopup/components/LabelsSection/LabelsSection.d.ts +7 -0
- package/dist/esm/types/components/ContactInfoPopup/components/LabelsSection/index.d.ts +1 -0
- package/dist/esm/types/components/ContactInfoPopup/components/MembersSection/MembersSection.d.ts +7 -0
- package/dist/esm/types/components/ContactInfoPopup/components/MembersSection/components/MemberItem/MemberItem.d.ts +4 -0
- package/dist/esm/types/components/ContactInfoPopup/components/MembersSection/components/MemberItem/index.d.ts +1 -0
- package/dist/esm/types/components/ContactInfoPopup/components/MembersSection/components/index.d.ts +1 -0
- package/dist/esm/types/components/ContactInfoPopup/components/MembersSection/index.d.ts +1 -0
- package/dist/esm/types/components/ContactInfoPopup/components/index.d.ts +3 -0
- package/dist/esm/types/components/ContactInfoPopup/types/is-business.typeguard.d.ts +7 -0
- package/dist/esm/types/components/ContactInfoPopup/types/is-contact.typeguard.d.ts +7 -0
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -3042,6 +3042,422 @@ var capitalize = /*#__PURE__*/Object.freeze({
|
|
|
3042
3042
|
default: capitalize$1
|
|
3043
3043
|
});
|
|
3044
3044
|
|
|
3045
|
+
/**
|
|
3046
|
+
* Safe chained function.
|
|
3047
|
+
*
|
|
3048
|
+
* Will only create a new function if needed,
|
|
3049
|
+
* otherwise will pass back existing functions or null.
|
|
3050
|
+
*/
|
|
3051
|
+
function createChainedFunction(...funcs) {
|
|
3052
|
+
return funcs.reduce((acc, func) => {
|
|
3053
|
+
if (func == null) {
|
|
3054
|
+
return acc;
|
|
3055
|
+
}
|
|
3056
|
+
return function chainedFunction(...args) {
|
|
3057
|
+
acc.apply(this, args);
|
|
3058
|
+
func.apply(this, args);
|
|
3059
|
+
};
|
|
3060
|
+
}, () => {});
|
|
3061
|
+
}
|
|
3062
|
+
|
|
3063
|
+
// Corresponds to 10 frames at 60 Hz.
|
|
3064
|
+
// A few bytes payload overhead when lodash/debounce is ~3 kB and debounce ~300 B.
|
|
3065
|
+
function debounce(func, wait = 166) {
|
|
3066
|
+
let timeout;
|
|
3067
|
+
function debounced(...args) {
|
|
3068
|
+
const later = () => {
|
|
3069
|
+
// @ts-ignore
|
|
3070
|
+
func.apply(this, args);
|
|
3071
|
+
};
|
|
3072
|
+
clearTimeout(timeout);
|
|
3073
|
+
timeout = setTimeout(later, wait);
|
|
3074
|
+
}
|
|
3075
|
+
debounced.clear = () => {
|
|
3076
|
+
clearTimeout(timeout);
|
|
3077
|
+
};
|
|
3078
|
+
return debounced;
|
|
3079
|
+
}
|
|
3080
|
+
|
|
3081
|
+
function deprecatedPropType(validator, reason) {
|
|
3082
|
+
if (process.env.NODE_ENV === 'production') {
|
|
3083
|
+
return () => null;
|
|
3084
|
+
}
|
|
3085
|
+
return (props, propName, componentName, location, propFullName) => {
|
|
3086
|
+
const componentNameSafe = componentName || '<<anonymous>>';
|
|
3087
|
+
const propFullNameSafe = propFullName || propName;
|
|
3088
|
+
if (typeof props[propName] !== 'undefined') {
|
|
3089
|
+
return new Error(`The ${location} \`${propFullNameSafe}\` of ` + `\`${componentNameSafe}\` is deprecated. ${reason}`);
|
|
3090
|
+
}
|
|
3091
|
+
return null;
|
|
3092
|
+
};
|
|
3093
|
+
}
|
|
3094
|
+
|
|
3095
|
+
function isMuiElement(element, muiNames) {
|
|
3096
|
+
var _muiName, _element$type;
|
|
3097
|
+
return /*#__PURE__*/React__namespace.isValidElement(element) && muiNames.indexOf( // For server components `muiName` is avaialble in element.type._payload.value.muiName
|
|
3098
|
+
// relevant info - https://github.com/facebook/react/blob/2807d781a08db8e9873687fccc25c0f12b4fb3d4/packages/react/src/ReactLazy.js#L45
|
|
3099
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
3100
|
+
(_muiName = element.type.muiName) != null ? _muiName : (_element$type = element.type) == null || (_element$type = _element$type._payload) == null || (_element$type = _element$type.value) == null ? void 0 : _element$type.muiName) !== -1;
|
|
3101
|
+
}
|
|
3102
|
+
|
|
3103
|
+
function ownerDocument(node) {
|
|
3104
|
+
return node && node.ownerDocument || document;
|
|
3105
|
+
}
|
|
3106
|
+
|
|
3107
|
+
function ownerWindow(node) {
|
|
3108
|
+
const doc = ownerDocument(node);
|
|
3109
|
+
return doc.defaultView || window;
|
|
3110
|
+
}
|
|
3111
|
+
|
|
3112
|
+
function requirePropFactory(componentNameInError, Component) {
|
|
3113
|
+
if (process.env.NODE_ENV === 'production') {
|
|
3114
|
+
return () => null;
|
|
3115
|
+
}
|
|
3116
|
+
|
|
3117
|
+
// eslint-disable-next-line react/forbid-foreign-prop-types
|
|
3118
|
+
const prevPropTypes = Component ? _extends$1({}, Component.propTypes) : null;
|
|
3119
|
+
const requireProp = requiredProp => (props, propName, componentName, location, propFullName, ...args) => {
|
|
3120
|
+
const propFullNameSafe = propFullName || propName;
|
|
3121
|
+
const defaultTypeChecker = prevPropTypes == null ? void 0 : prevPropTypes[propFullNameSafe];
|
|
3122
|
+
if (defaultTypeChecker) {
|
|
3123
|
+
const typeCheckerResult = defaultTypeChecker(props, propName, componentName, location, propFullName, ...args);
|
|
3124
|
+
if (typeCheckerResult) {
|
|
3125
|
+
return typeCheckerResult;
|
|
3126
|
+
}
|
|
3127
|
+
}
|
|
3128
|
+
if (typeof props[propName] !== 'undefined' && !props[requiredProp]) {
|
|
3129
|
+
return new Error(`The prop \`${propFullNameSafe}\` of ` + `\`${componentNameInError}\` can only be used together with the \`${requiredProp}\` prop.`);
|
|
3130
|
+
}
|
|
3131
|
+
return null;
|
|
3132
|
+
};
|
|
3133
|
+
return requireProp;
|
|
3134
|
+
}
|
|
3135
|
+
|
|
3136
|
+
/**
|
|
3137
|
+
* TODO v5: consider making it private
|
|
3138
|
+
*
|
|
3139
|
+
* passes {value} to {ref}
|
|
3140
|
+
*
|
|
3141
|
+
* WARNING: Be sure to only call this inside a callback that is passed as a ref.
|
|
3142
|
+
* Otherwise, make sure to cleanup the previous {ref} if it changes. See
|
|
3143
|
+
* https://github.com/mui/material-ui/issues/13539
|
|
3144
|
+
*
|
|
3145
|
+
* Useful if you want to expose the ref of an inner component to the public API
|
|
3146
|
+
* while still using it inside the component.
|
|
3147
|
+
* @param ref A ref callback or ref object. If anything falsy, this is a no-op.
|
|
3148
|
+
*/
|
|
3149
|
+
function setRef(ref, value) {
|
|
3150
|
+
if (typeof ref === 'function') {
|
|
3151
|
+
ref(value);
|
|
3152
|
+
} else if (ref) {
|
|
3153
|
+
ref.current = value;
|
|
3154
|
+
}
|
|
3155
|
+
}
|
|
3156
|
+
|
|
3157
|
+
/**
|
|
3158
|
+
* A version of `React.useLayoutEffect` that does not show a warning when server-side rendering.
|
|
3159
|
+
* This is useful for effects that are only needed for client-side rendering but not for SSR.
|
|
3160
|
+
*
|
|
3161
|
+
* Before you use this hook, make sure to read https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85
|
|
3162
|
+
* and confirm it doesn't apply to your use-case.
|
|
3163
|
+
*/
|
|
3164
|
+
const useEnhancedEffect = typeof window !== 'undefined' ? React__namespace.useLayoutEffect : React__namespace.useEffect;
|
|
3165
|
+
var useEnhancedEffect$1 = useEnhancedEffect;
|
|
3166
|
+
|
|
3167
|
+
let globalId = 0;
|
|
3168
|
+
function useGlobalId(idOverride) {
|
|
3169
|
+
const [defaultId, setDefaultId] = React__namespace.useState(idOverride);
|
|
3170
|
+
const id = idOverride || defaultId;
|
|
3171
|
+
React__namespace.useEffect(() => {
|
|
3172
|
+
if (defaultId == null) {
|
|
3173
|
+
// Fallback to this default id when possible.
|
|
3174
|
+
// Use the incrementing value for client-side rendering only.
|
|
3175
|
+
// We can't use it server-side.
|
|
3176
|
+
// If you want to use random values please consider the Birthday Problem: https://en.wikipedia.org/wiki/Birthday_problem
|
|
3177
|
+
globalId += 1;
|
|
3178
|
+
setDefaultId(`mui-${globalId}`);
|
|
3179
|
+
}
|
|
3180
|
+
}, [defaultId]);
|
|
3181
|
+
return id;
|
|
3182
|
+
}
|
|
3183
|
+
|
|
3184
|
+
// downstream bundlers may remove unnecessary concatenation, but won't remove toString call -- Workaround for https://github.com/webpack/webpack/issues/14814
|
|
3185
|
+
const maybeReactUseId = React__namespace['useId'.toString()];
|
|
3186
|
+
/**
|
|
3187
|
+
*
|
|
3188
|
+
* @example <div id={useId()} />
|
|
3189
|
+
* @param idOverride
|
|
3190
|
+
* @returns {string}
|
|
3191
|
+
*/
|
|
3192
|
+
function useId(idOverride) {
|
|
3193
|
+
if (maybeReactUseId !== undefined) {
|
|
3194
|
+
const reactId = maybeReactUseId();
|
|
3195
|
+
return idOverride != null ? idOverride : reactId;
|
|
3196
|
+
}
|
|
3197
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- `React.useId` is invariant at runtime.
|
|
3198
|
+
return useGlobalId(idOverride);
|
|
3199
|
+
}
|
|
3200
|
+
|
|
3201
|
+
function unsupportedProp(props, propName, componentName, location, propFullName) {
|
|
3202
|
+
if (process.env.NODE_ENV === 'production') {
|
|
3203
|
+
return null;
|
|
3204
|
+
}
|
|
3205
|
+
const propFullNameSafe = propFullName || propName;
|
|
3206
|
+
if (typeof props[propName] !== 'undefined') {
|
|
3207
|
+
return new Error(`The prop \`${propFullNameSafe}\` is not supported. Please remove it.`);
|
|
3208
|
+
}
|
|
3209
|
+
return null;
|
|
3210
|
+
}
|
|
3211
|
+
|
|
3212
|
+
function useControlled({
|
|
3213
|
+
controlled,
|
|
3214
|
+
default: defaultProp,
|
|
3215
|
+
name,
|
|
3216
|
+
state = 'value'
|
|
3217
|
+
}) {
|
|
3218
|
+
// isControlled is ignored in the hook dependency lists as it should never change.
|
|
3219
|
+
const {
|
|
3220
|
+
current: isControlled
|
|
3221
|
+
} = React__namespace.useRef(controlled !== undefined);
|
|
3222
|
+
const [valueState, setValue] = React__namespace.useState(defaultProp);
|
|
3223
|
+
const value = isControlled ? controlled : valueState;
|
|
3224
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3225
|
+
React__namespace.useEffect(() => {
|
|
3226
|
+
if (isControlled !== (controlled !== undefined)) {
|
|
3227
|
+
console.error([`MUI: A component is changing the ${isControlled ? '' : 'un'}controlled ${state} state of ${name} to be ${isControlled ? 'un' : ''}controlled.`, 'Elements should not switch from uncontrolled to controlled (or vice versa).', `Decide between using a controlled or uncontrolled ${name} ` + 'element for the lifetime of the component.', "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", 'More info: https://fb.me/react-controlled-components'].join('\n'));
|
|
3228
|
+
}
|
|
3229
|
+
}, [state, name, controlled]);
|
|
3230
|
+
const {
|
|
3231
|
+
current: defaultValue
|
|
3232
|
+
} = React__namespace.useRef(defaultProp);
|
|
3233
|
+
React__namespace.useEffect(() => {
|
|
3234
|
+
if (!isControlled && defaultValue !== defaultProp) {
|
|
3235
|
+
console.error([`MUI: A component is changing the default ${state} state of an uncontrolled ${name} after being initialized. ` + `To suppress this warning opt to use a controlled ${name}.`].join('\n'));
|
|
3236
|
+
}
|
|
3237
|
+
}, [JSON.stringify(defaultProp)]);
|
|
3238
|
+
}
|
|
3239
|
+
const setValueIfUncontrolled = React__namespace.useCallback(newValue => {
|
|
3240
|
+
if (!isControlled) {
|
|
3241
|
+
setValue(newValue);
|
|
3242
|
+
}
|
|
3243
|
+
}, []);
|
|
3244
|
+
return [value, setValueIfUncontrolled];
|
|
3245
|
+
}
|
|
3246
|
+
|
|
3247
|
+
/**
|
|
3248
|
+
* Inspired by https://github.com/facebook/react/issues/14099#issuecomment-440013892
|
|
3249
|
+
* See RFC in https://github.com/reactjs/rfcs/pull/220
|
|
3250
|
+
*/
|
|
3251
|
+
|
|
3252
|
+
function useEventCallback(fn) {
|
|
3253
|
+
const ref = React__namespace.useRef(fn);
|
|
3254
|
+
useEnhancedEffect$1(() => {
|
|
3255
|
+
ref.current = fn;
|
|
3256
|
+
});
|
|
3257
|
+
return React__namespace.useRef((...args) =>
|
|
3258
|
+
// @ts-expect-error hide `this`
|
|
3259
|
+
(0, ref.current)(...args)).current;
|
|
3260
|
+
}
|
|
3261
|
+
|
|
3262
|
+
function useForkRef(...refs) {
|
|
3263
|
+
/**
|
|
3264
|
+
* This will create a new function if the refs passed to this hook change and are all defined.
|
|
3265
|
+
* This means react will call the old forkRef with `null` and the new forkRef
|
|
3266
|
+
* with the ref. Cleanup naturally emerges from this behavior.
|
|
3267
|
+
*/
|
|
3268
|
+
return React__namespace.useMemo(() => {
|
|
3269
|
+
if (refs.every(ref => ref == null)) {
|
|
3270
|
+
return null;
|
|
3271
|
+
}
|
|
3272
|
+
return instance => {
|
|
3273
|
+
refs.forEach(ref => {
|
|
3274
|
+
setRef(ref, instance);
|
|
3275
|
+
});
|
|
3276
|
+
};
|
|
3277
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3278
|
+
}, refs);
|
|
3279
|
+
}
|
|
3280
|
+
|
|
3281
|
+
class Timeout {
|
|
3282
|
+
constructor() {
|
|
3283
|
+
this.currentId = null;
|
|
3284
|
+
this.clear = () => {
|
|
3285
|
+
if (this.currentId !== null) {
|
|
3286
|
+
clearTimeout(this.currentId);
|
|
3287
|
+
this.currentId = null;
|
|
3288
|
+
}
|
|
3289
|
+
};
|
|
3290
|
+
this.disposeEffect = () => {
|
|
3291
|
+
return this.clear;
|
|
3292
|
+
};
|
|
3293
|
+
}
|
|
3294
|
+
static create() {
|
|
3295
|
+
return new Timeout();
|
|
3296
|
+
}
|
|
3297
|
+
/**
|
|
3298
|
+
* Executes `fn` after `delay`, clearing any previously scheduled call.
|
|
3299
|
+
*/
|
|
3300
|
+
start(delay, fn) {
|
|
3301
|
+
this.clear();
|
|
3302
|
+
this.currentId = setTimeout(() => {
|
|
3303
|
+
this.currentId = null;
|
|
3304
|
+
fn();
|
|
3305
|
+
}, delay);
|
|
3306
|
+
}
|
|
3307
|
+
}
|
|
3308
|
+
|
|
3309
|
+
let hadKeyboardEvent = true;
|
|
3310
|
+
let hadFocusVisibleRecently = false;
|
|
3311
|
+
const hadFocusVisibleRecentlyTimeout = new Timeout();
|
|
3312
|
+
const inputTypesWhitelist = {
|
|
3313
|
+
text: true,
|
|
3314
|
+
search: true,
|
|
3315
|
+
url: true,
|
|
3316
|
+
tel: true,
|
|
3317
|
+
email: true,
|
|
3318
|
+
password: true,
|
|
3319
|
+
number: true,
|
|
3320
|
+
date: true,
|
|
3321
|
+
month: true,
|
|
3322
|
+
week: true,
|
|
3323
|
+
time: true,
|
|
3324
|
+
datetime: true,
|
|
3325
|
+
'datetime-local': true
|
|
3326
|
+
};
|
|
3327
|
+
|
|
3328
|
+
/**
|
|
3329
|
+
* Computes whether the given element should automatically trigger the
|
|
3330
|
+
* `focus-visible` class being added, i.e. whether it should always match
|
|
3331
|
+
* `:focus-visible` when focused.
|
|
3332
|
+
* @param {Element} node
|
|
3333
|
+
* @returns {boolean}
|
|
3334
|
+
*/
|
|
3335
|
+
function focusTriggersKeyboardModality(node) {
|
|
3336
|
+
const {
|
|
3337
|
+
type,
|
|
3338
|
+
tagName
|
|
3339
|
+
} = node;
|
|
3340
|
+
if (tagName === 'INPUT' && inputTypesWhitelist[type] && !node.readOnly) {
|
|
3341
|
+
return true;
|
|
3342
|
+
}
|
|
3343
|
+
if (tagName === 'TEXTAREA' && !node.readOnly) {
|
|
3344
|
+
return true;
|
|
3345
|
+
}
|
|
3346
|
+
if (node.isContentEditable) {
|
|
3347
|
+
return true;
|
|
3348
|
+
}
|
|
3349
|
+
return false;
|
|
3350
|
+
}
|
|
3351
|
+
|
|
3352
|
+
/**
|
|
3353
|
+
* Keep track of our keyboard modality state with `hadKeyboardEvent`.
|
|
3354
|
+
* If the most recent user interaction was via the keyboard;
|
|
3355
|
+
* and the key press did not include a meta, alt/option, or control key;
|
|
3356
|
+
* then the modality is keyboard. Otherwise, the modality is not keyboard.
|
|
3357
|
+
* @param {KeyboardEvent} event
|
|
3358
|
+
*/
|
|
3359
|
+
function handleKeyDown(event) {
|
|
3360
|
+
if (event.metaKey || event.altKey || event.ctrlKey) {
|
|
3361
|
+
return;
|
|
3362
|
+
}
|
|
3363
|
+
hadKeyboardEvent = true;
|
|
3364
|
+
}
|
|
3365
|
+
|
|
3366
|
+
/**
|
|
3367
|
+
* If at any point a user clicks with a pointing device, ensure that we change
|
|
3368
|
+
* the modality away from keyboard.
|
|
3369
|
+
* This avoids the situation where a user presses a key on an already focused
|
|
3370
|
+
* element, and then clicks on a different element, focusing it with a
|
|
3371
|
+
* pointing device, while we still think we're in keyboard modality.
|
|
3372
|
+
*/
|
|
3373
|
+
function handlePointerDown() {
|
|
3374
|
+
hadKeyboardEvent = false;
|
|
3375
|
+
}
|
|
3376
|
+
function handleVisibilityChange() {
|
|
3377
|
+
if (this.visibilityState === 'hidden') {
|
|
3378
|
+
// If the tab becomes active again, the browser will handle calling focus
|
|
3379
|
+
// on the element (Safari actually calls it twice).
|
|
3380
|
+
// If this tab change caused a blur on an element with focus-visible,
|
|
3381
|
+
// re-apply the class when the user switches back to the tab.
|
|
3382
|
+
if (hadFocusVisibleRecently) {
|
|
3383
|
+
hadKeyboardEvent = true;
|
|
3384
|
+
}
|
|
3385
|
+
}
|
|
3386
|
+
}
|
|
3387
|
+
function prepare(doc) {
|
|
3388
|
+
doc.addEventListener('keydown', handleKeyDown, true);
|
|
3389
|
+
doc.addEventListener('mousedown', handlePointerDown, true);
|
|
3390
|
+
doc.addEventListener('pointerdown', handlePointerDown, true);
|
|
3391
|
+
doc.addEventListener('touchstart', handlePointerDown, true);
|
|
3392
|
+
doc.addEventListener('visibilitychange', handleVisibilityChange, true);
|
|
3393
|
+
}
|
|
3394
|
+
function isFocusVisible(event) {
|
|
3395
|
+
const {
|
|
3396
|
+
target
|
|
3397
|
+
} = event;
|
|
3398
|
+
try {
|
|
3399
|
+
return target.matches(':focus-visible');
|
|
3400
|
+
} catch (error) {
|
|
3401
|
+
// Browsers not implementing :focus-visible will throw a SyntaxError.
|
|
3402
|
+
// We use our own heuristic for those browsers.
|
|
3403
|
+
// Rethrow might be better if it's not the expected error but do we really
|
|
3404
|
+
// want to crash if focus-visible malfunctioned?
|
|
3405
|
+
}
|
|
3406
|
+
|
|
3407
|
+
// No need for validFocusTarget check. The user does that by attaching it to
|
|
3408
|
+
// focusable events only.
|
|
3409
|
+
return hadKeyboardEvent || focusTriggersKeyboardModality(target);
|
|
3410
|
+
}
|
|
3411
|
+
function useIsFocusVisible() {
|
|
3412
|
+
const ref = React__namespace.useCallback(node => {
|
|
3413
|
+
if (node != null) {
|
|
3414
|
+
prepare(node.ownerDocument);
|
|
3415
|
+
}
|
|
3416
|
+
}, []);
|
|
3417
|
+
const isFocusVisibleRef = React__namespace.useRef(false);
|
|
3418
|
+
|
|
3419
|
+
/**
|
|
3420
|
+
* Should be called if a blur event is fired
|
|
3421
|
+
*/
|
|
3422
|
+
function handleBlurVisible() {
|
|
3423
|
+
// checking against potential state variable does not suffice if we focus and blur synchronously.
|
|
3424
|
+
// React wouldn't have time to trigger a re-render so `focusVisible` would be stale.
|
|
3425
|
+
// Ideally we would adjust `isFocusVisible(event)` to look at `relatedTarget` for blur events.
|
|
3426
|
+
// This doesn't work in IE11 due to https://github.com/facebook/react/issues/3751
|
|
3427
|
+
// TODO: check again if React releases their internal changes to focus event handling (https://github.com/facebook/react/pull/19186).
|
|
3428
|
+
if (isFocusVisibleRef.current) {
|
|
3429
|
+
// To detect a tab/window switch, we look for a blur event followed
|
|
3430
|
+
// rapidly by a visibility change.
|
|
3431
|
+
// If we don't see a visibility change within 100ms, it's probably a
|
|
3432
|
+
// regular focus change.
|
|
3433
|
+
hadFocusVisibleRecently = true;
|
|
3434
|
+
hadFocusVisibleRecentlyTimeout.start(100, () => {
|
|
3435
|
+
hadFocusVisibleRecently = false;
|
|
3436
|
+
});
|
|
3437
|
+
isFocusVisibleRef.current = false;
|
|
3438
|
+
return true;
|
|
3439
|
+
}
|
|
3440
|
+
return false;
|
|
3441
|
+
}
|
|
3442
|
+
|
|
3443
|
+
/**
|
|
3444
|
+
* Should be called if a blur event is fired
|
|
3445
|
+
*/
|
|
3446
|
+
function handleFocusVisible(event) {
|
|
3447
|
+
if (isFocusVisible(event)) {
|
|
3448
|
+
isFocusVisibleRef.current = true;
|
|
3449
|
+
return true;
|
|
3450
|
+
}
|
|
3451
|
+
return false;
|
|
3452
|
+
}
|
|
3453
|
+
return {
|
|
3454
|
+
isFocusVisibleRef,
|
|
3455
|
+
onFocus: handleFocusVisible,
|
|
3456
|
+
onBlur: handleBlurVisible,
|
|
3457
|
+
ref
|
|
3458
|
+
};
|
|
3459
|
+
}
|
|
3460
|
+
|
|
3045
3461
|
/**
|
|
3046
3462
|
* Add keys, values of `defaultProps` that does not exist in `props`
|
|
3047
3463
|
* @param {object} defaultProps
|
|
@@ -6655,7 +7071,7 @@ var require$$1 = /*@__PURE__*/getAugmentedNamespace(formatMuiErrorMessage);
|
|
|
6655
7071
|
|
|
6656
7072
|
var require$$2 = /*@__PURE__*/getAugmentedNamespace(clamp);
|
|
6657
7073
|
|
|
6658
|
-
var _interopRequireDefault$
|
|
7074
|
+
var _interopRequireDefault$3 = interopRequireDefaultExports;
|
|
6659
7075
|
Object.defineProperty(colorManipulator, "__esModule", {
|
|
6660
7076
|
value: true
|
|
6661
7077
|
});
|
|
@@ -6677,8 +7093,8 @@ colorManipulator.private_safeEmphasize = private_safeEmphasize;
|
|
|
6677
7093
|
colorManipulator.private_safeLighten = private_safeLighten;
|
|
6678
7094
|
colorManipulator.recomposeColor = recomposeColor;
|
|
6679
7095
|
colorManipulator.rgbToHex = rgbToHex;
|
|
6680
|
-
var _formatMuiErrorMessage2 = _interopRequireDefault$
|
|
6681
|
-
var _clamp = _interopRequireDefault$
|
|
7096
|
+
var _formatMuiErrorMessage2 = _interopRequireDefault$3(require$$1);
|
|
7097
|
+
var _clamp = _interopRequireDefault$3(require$$2);
|
|
6682
7098
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
6683
7099
|
|
|
6684
7100
|
/**
|
|
@@ -7800,21 +8216,21 @@ var require$$7 = /*@__PURE__*/getAugmentedNamespace(createTheme$1);
|
|
|
7800
8216
|
|
|
7801
8217
|
var require$$8 = /*@__PURE__*/getAugmentedNamespace(styleFunctionSx);
|
|
7802
8218
|
|
|
7803
|
-
var _interopRequireDefault = interopRequireDefaultExports;
|
|
8219
|
+
var _interopRequireDefault$2 = interopRequireDefaultExports;
|
|
7804
8220
|
Object.defineProperty(createStyled$1, "__esModule", {
|
|
7805
8221
|
value: true
|
|
7806
8222
|
});
|
|
7807
8223
|
var _default = createStyled$1.default = createStyled;
|
|
7808
8224
|
createStyled$1.shouldForwardProp = shouldForwardProp;
|
|
7809
8225
|
createStyled$1.systemDefaultTheme = void 0;
|
|
7810
|
-
var _extends2 = _interopRequireDefault(require_extends());
|
|
7811
|
-
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(requireObjectWithoutPropertiesLoose());
|
|
8226
|
+
var _extends2 = _interopRequireDefault$2(require_extends());
|
|
8227
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault$2(requireObjectWithoutPropertiesLoose());
|
|
7812
8228
|
var _styledEngine = _interopRequireWildcard(require$$3);
|
|
7813
8229
|
var _deepmerge = require$$4;
|
|
7814
|
-
var _capitalize = _interopRequireDefault(require$$5);
|
|
7815
|
-
var _getDisplayName = _interopRequireDefault(require$$6);
|
|
7816
|
-
var _createTheme = _interopRequireDefault(require$$7);
|
|
7817
|
-
var _styleFunctionSx = _interopRequireDefault(require$$8);
|
|
8230
|
+
var _capitalize = _interopRequireDefault$2(require$$5);
|
|
8231
|
+
var _getDisplayName = _interopRequireDefault$2(require$$6);
|
|
8232
|
+
var _createTheme = _interopRequireDefault$2(require$$7);
|
|
8233
|
+
var _styleFunctionSx = _interopRequireDefault$2(require$$8);
|
|
7818
8234
|
const _excluded$1 = ["ownerState"],
|
|
7819
8235
|
_excluded2 = ["variants"],
|
|
7820
8236
|
_excluded3 = ["name", "slot", "skipVariantsResolver", "skipSx", "overridesResolver"];
|
|
@@ -8244,7 +8660,7 @@ process.env.NODE_ENV !== "production" ? SvgIcon.propTypes /* remove-proptypes */
|
|
|
8244
8660
|
SvgIcon.muiName = 'SvgIcon';
|
|
8245
8661
|
var SvgIcon$1 = SvgIcon;
|
|
8246
8662
|
|
|
8247
|
-
function createSvgIcon(path, displayName) {
|
|
8663
|
+
function createSvgIcon$1(path, displayName) {
|
|
8248
8664
|
function Component(props, ref) {
|
|
8249
8665
|
return /*#__PURE__*/jsxRuntimeExports.jsx(SvgIcon$1, _extends$1({
|
|
8250
8666
|
"data-testid": `${displayName}Icon`,
|
|
@@ -8262,45 +8678,127 @@ function createSvgIcon(path, displayName) {
|
|
|
8262
8678
|
return /*#__PURE__*/React__namespace.memo( /*#__PURE__*/React__namespace.forwardRef(Component));
|
|
8263
8679
|
}
|
|
8264
8680
|
|
|
8265
|
-
|
|
8681
|
+
// TODO: remove this export once ClassNameGenerator is stable
|
|
8682
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
8683
|
+
const unstable_ClassNameGenerator = {
|
|
8684
|
+
configure: generator => {
|
|
8685
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
8686
|
+
console.warn(['MUI: `ClassNameGenerator` import from `@mui/material/utils` is outdated and might cause unexpected issues.', '', "You should use `import { unstable_ClassNameGenerator } from '@mui/material/className'` instead", '', 'The detail of the issue: https://github.com/mui/material-ui/issues/30011#issuecomment-1024993401', '', 'The updated documentation: https://mui.com/guides/classname-generator/'].join('\n'));
|
|
8687
|
+
}
|
|
8688
|
+
ClassNameGenerator$1.configure(generator);
|
|
8689
|
+
}
|
|
8690
|
+
};
|
|
8691
|
+
|
|
8692
|
+
var utils = /*#__PURE__*/Object.freeze({
|
|
8693
|
+
__proto__: null,
|
|
8694
|
+
capitalize: capitalize$1,
|
|
8695
|
+
createChainedFunction: createChainedFunction,
|
|
8696
|
+
createSvgIcon: createSvgIcon$1,
|
|
8697
|
+
debounce: debounce,
|
|
8698
|
+
deprecatedPropType: deprecatedPropType,
|
|
8699
|
+
isMuiElement: isMuiElement,
|
|
8700
|
+
ownerDocument: ownerDocument,
|
|
8701
|
+
ownerWindow: ownerWindow,
|
|
8702
|
+
requirePropFactory: requirePropFactory,
|
|
8703
|
+
setRef: setRef,
|
|
8704
|
+
unstable_ClassNameGenerator: unstable_ClassNameGenerator,
|
|
8705
|
+
unstable_useEnhancedEffect: useEnhancedEffect$1,
|
|
8706
|
+
unstable_useId: useId,
|
|
8707
|
+
unsupportedProp: unsupportedProp,
|
|
8708
|
+
useControlled: useControlled,
|
|
8709
|
+
useEventCallback: useEventCallback,
|
|
8710
|
+
useForkRef: useForkRef,
|
|
8711
|
+
useIsFocusVisible: useIsFocusVisible
|
|
8712
|
+
});
|
|
8713
|
+
|
|
8714
|
+
var Email = createSvgIcon$1( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
|
|
8266
8715
|
d: "M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2m0 4-8 5-8-5V6l8 5 8-5z"
|
|
8267
8716
|
}), 'Email');
|
|
8268
8717
|
|
|
8269
|
-
var Facebook = createSvgIcon( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
|
|
8718
|
+
var Facebook = createSvgIcon$1( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
|
|
8270
8719
|
d: "M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2m13 2h-2.5A3.5 3.5 0 0 0 12 8.5V11h-2v3h2v7h3v-7h3v-3h-3V9a1 1 0 0 1 1-1h2V5z"
|
|
8271
8720
|
}), 'Facebook');
|
|
8272
8721
|
|
|
8273
|
-
var Handyman = createSvgIcon([/*#__PURE__*/jsxRuntimeExports.jsx("path", {
|
|
8722
|
+
var Handyman = createSvgIcon$1([/*#__PURE__*/jsxRuntimeExports.jsx("path", {
|
|
8274
8723
|
d: "m21.67 18.17-5.3-5.3h-.99l-2.54 2.54v.99l5.3 5.3c.39.39 1.02.39 1.41 0l2.12-2.12c.39-.38.39-1.02 0-1.41"
|
|
8275
8724
|
}, "0"), /*#__PURE__*/jsxRuntimeExports.jsx("path", {
|
|
8276
8725
|
d: "m17.34 10.19 1.41-1.41 2.12 2.12c1.17-1.17 1.17-3.07 0-4.24l-3.54-3.54-1.41 1.41V1.71l-.7-.71-3.54 3.54.71.71h2.83l-1.41 1.41 1.06 1.06-2.89 2.89-4.13-4.13V5.06L4.83 2.04 2 4.87 5.03 7.9h1.41l4.13 4.13-.85.85H7.6l-5.3 5.3c-.39.39-.39 1.02 0 1.41l2.12 2.12c.39.39 1.02.39 1.41 0l5.3-5.3v-2.12l5.15-5.15z"
|
|
8277
8726
|
}, "1")], 'Handyman');
|
|
8278
8727
|
|
|
8279
|
-
var Instagram = createSvgIcon( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
|
|
8728
|
+
var Instagram = createSvgIcon$1( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
|
|
8280
8729
|
d: "M7.8 2h8.4C19.4 2 22 4.6 22 7.8v8.4a5.8 5.8 0 0 1-5.8 5.8H7.8C4.6 22 2 19.4 2 16.2V7.8A5.8 5.8 0 0 1 7.8 2m-.2 2A3.6 3.6 0 0 0 4 7.6v8.8C4 18.39 5.61 20 7.6 20h8.8a3.6 3.6 0 0 0 3.6-3.6V7.6C20 5.61 18.39 4 16.4 4H7.6m9.65 1.5a1.25 1.25 0 0 1 1.25 1.25A1.25 1.25 0 0 1 17.25 8 1.25 1.25 0 0 1 16 6.75a1.25 1.25 0 0 1 1.25-1.25M12 7a5 5 0 0 1 5 5 5 5 0 0 1-5 5 5 5 0 0 1-5-5 5 5 0 0 1 5-5m0 2a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3z"
|
|
8281
8730
|
}), 'Instagram');
|
|
8282
8731
|
|
|
8283
|
-
var
|
|
8284
|
-
d: "M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3z"
|
|
8285
|
-
}), 'OpenInNew');
|
|
8286
|
-
|
|
8287
|
-
var PhoneEnabled = createSvgIcon( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
|
|
8732
|
+
var PhoneEnabled = createSvgIcon$1( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
|
|
8288
8733
|
d: "m17.38 10.79-2.2-2.2c-.28-.28-.36-.67-.25-1.02.37-1.12.57-2.32.57-3.57 0-.55.45-1 1-1H20c.55 0 1 .45 1 1 0 9.39-7.61 17-17 17-.55 0-1-.45-1-1v-3.49c0-.55.45-1 1-1 1.24 0 2.45-.2 3.57-.57.35-.12.75-.03 1.02.24l2.2 2.2c2.83-1.45 5.15-3.76 6.59-6.59"
|
|
8289
8734
|
}), 'PhoneEnabled');
|
|
8290
8735
|
|
|
8291
|
-
var ThreeP = createSvgIcon( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
|
|
8736
|
+
var ThreeP = createSvgIcon$1( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
|
|
8292
8737
|
d: "M20 2H4.01c-1.1 0-2 .9-2 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m-8 4c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2m4 8H8v-.57c0-.81.48-1.53 1.22-1.85.85-.37 1.79-.58 2.78-.58.99 0 1.93.21 2.78.58.74.32 1.22 1.04 1.22 1.85z"
|
|
8293
8738
|
}), 'ThreeP');
|
|
8294
8739
|
|
|
8295
|
-
var WhatsApp = createSvgIcon( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
|
|
8740
|
+
var WhatsApp = createSvgIcon$1( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
|
|
8296
8741
|
d: "M16.75 13.96c.25.13.41.2.46.3.06.11.04.61-.21 1.18-.2.56-1.24 1.1-1.7 1.12-.46.02-.47.36-2.96-.73-2.49-1.09-3.99-3.75-4.11-3.92-.12-.17-.96-1.38-.92-2.61.05-1.22.69-1.8.95-2.04.24-.26.51-.29.68-.26h.47c.15 0 .36-.06.55.45l.69 1.87c.06.13.1.28.01.44l-.27.41-.39.42c-.12.12-.26.25-.12.5.12.26.62 1.09 1.32 1.78.91.88 1.71 1.17 1.95 1.3.24.14.39.12.54-.04l.81-.94c.19-.25.35-.19.58-.11l1.67.88M12 2a10 10 0 0 1 10 10 10 10 0 0 1-10 10c-1.97 0-3.8-.57-5.35-1.55L2 22l1.55-4.65A9.969 9.969 0 0 1 2 12 10 10 0 0 1 12 2m0 2a8 8 0 0 0-8 8c0 1.72.54 3.31 1.46 4.61L4.5 19.5l2.89-.96A7.95 7.95 0 0 0 12 20a8 8 0 0 0 8-8 8 8 0 0 0-8-8z"
|
|
8297
8742
|
}), 'WhatsApp');
|
|
8298
8743
|
|
|
8744
|
+
var ArrowForward = {};
|
|
8745
|
+
|
|
8746
|
+
var createSvgIcon = {};
|
|
8747
|
+
|
|
8748
|
+
var require$$0 = /*@__PURE__*/getAugmentedNamespace(utils);
|
|
8749
|
+
|
|
8750
|
+
var hasRequiredCreateSvgIcon;
|
|
8751
|
+
|
|
8752
|
+
function requireCreateSvgIcon () {
|
|
8753
|
+
if (hasRequiredCreateSvgIcon) return createSvgIcon;
|
|
8754
|
+
hasRequiredCreateSvgIcon = 1;
|
|
8755
|
+
(function (exports) {
|
|
8756
|
+
'use client';
|
|
8757
|
+
|
|
8758
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8759
|
+
value: true
|
|
8760
|
+
});
|
|
8761
|
+
Object.defineProperty(exports, "default", {
|
|
8762
|
+
enumerable: true,
|
|
8763
|
+
get: function () {
|
|
8764
|
+
return _utils.createSvgIcon;
|
|
8765
|
+
}
|
|
8766
|
+
});
|
|
8767
|
+
var _utils = require$$0;
|
|
8768
|
+
} (createSvgIcon));
|
|
8769
|
+
return createSvgIcon;
|
|
8770
|
+
}
|
|
8771
|
+
|
|
8772
|
+
var _interopRequireDefault$1 = interopRequireDefaultExports;
|
|
8773
|
+
Object.defineProperty(ArrowForward, "__esModule", {
|
|
8774
|
+
value: true
|
|
8775
|
+
});
|
|
8776
|
+
var default_1$1 = ArrowForward.default = void 0;
|
|
8777
|
+
var _createSvgIcon$1 = _interopRequireDefault$1(requireCreateSvgIcon());
|
|
8778
|
+
var _jsxRuntime$1 = jsxRuntimeExports;
|
|
8779
|
+
default_1$1 = ArrowForward.default = (0, _createSvgIcon$1.default)( /*#__PURE__*/(0, _jsxRuntime$1.jsx)("path", {
|
|
8780
|
+
d: "m12 4-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"
|
|
8781
|
+
}), 'ArrowForward');
|
|
8782
|
+
|
|
8783
|
+
var Message = {};
|
|
8784
|
+
|
|
8785
|
+
var _interopRequireDefault = interopRequireDefaultExports;
|
|
8786
|
+
Object.defineProperty(Message, "__esModule", {
|
|
8787
|
+
value: true
|
|
8788
|
+
});
|
|
8789
|
+
var default_1 = Message.default = void 0;
|
|
8790
|
+
var _createSvgIcon = _interopRequireDefault(requireCreateSvgIcon());
|
|
8791
|
+
var _jsxRuntime = jsxRuntimeExports;
|
|
8792
|
+
default_1 = Message.default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
8793
|
+
d: "M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m-2 12H6v-2h12zm0-3H6V9h12zm0-3H6V6h12z"
|
|
8794
|
+
}), 'Message');
|
|
8795
|
+
|
|
8299
8796
|
const ButtonsContainer = material.styled(material.Box)(({ theme }) => ({
|
|
8300
8797
|
position: 'absolute',
|
|
8301
8798
|
top: 8,
|
|
8302
8799
|
right: 8,
|
|
8303
8800
|
display: 'flex',
|
|
8801
|
+
flexDirection: 'column',
|
|
8304
8802
|
gap: 4,
|
|
8305
8803
|
zIndex: 1,
|
|
8306
8804
|
//@ts-ignore
|
|
@@ -8314,6 +8812,7 @@ const HeaderContainer = material.styled(material.Box)({
|
|
|
8314
8812
|
flexDirection: 'column',
|
|
8315
8813
|
alignItems: 'center',
|
|
8316
8814
|
marginBottom: '16px',
|
|
8815
|
+
position: 'relative',
|
|
8317
8816
|
});
|
|
8318
8817
|
const ContactAvatar = material.styled(material.Avatar)({
|
|
8319
8818
|
width: 60,
|
|
@@ -8327,14 +8826,61 @@ const ContactName = material.styled(material.Typography)({
|
|
|
8327
8826
|
maxWidth: 200,
|
|
8328
8827
|
textAlign: 'center',
|
|
8329
8828
|
});
|
|
8330
|
-
const
|
|
8331
|
-
|
|
8332
|
-
|
|
8333
|
-
|
|
8334
|
-
|
|
8335
|
-
|
|
8336
|
-
|
|
8337
|
-
|
|
8829
|
+
const LoadingContainer = material.styled(material.Box)({
|
|
8830
|
+
display: 'flex',
|
|
8831
|
+
justifyContent: 'center',
|
|
8832
|
+
alignItems: 'center',
|
|
8833
|
+
width: 60,
|
|
8834
|
+
height: 60,
|
|
8835
|
+
marginBottom: 8,
|
|
8836
|
+
});
|
|
8837
|
+
const Header = ({ imgUrl, name, contactId, navigate, isLoading = false, onError, onClose, isBusiness }) => {
|
|
8838
|
+
const handleNavigation = React.useCallback((url) => (event) => {
|
|
8839
|
+
try {
|
|
8840
|
+
event.preventDefault();
|
|
8841
|
+
event.stopPropagation();
|
|
8842
|
+
if (!url) {
|
|
8843
|
+
throw new Error('Navigation URL is required');
|
|
8844
|
+
}
|
|
8845
|
+
const isNewTab = event.ctrlKey || event.metaKey || event.button === 1; // Ctrl+Click, Cmd+Click, Middle Mouse
|
|
8846
|
+
if (isNewTab) {
|
|
8847
|
+
window.open(url, '_blank', 'noopener,noreferrer');
|
|
8848
|
+
}
|
|
8849
|
+
else {
|
|
8850
|
+
navigate(url);
|
|
8851
|
+
}
|
|
8852
|
+
}
|
|
8853
|
+
catch (error) {
|
|
8854
|
+
onError?.(error instanceof Error ? error : new Error('Navigation failed'));
|
|
8855
|
+
}
|
|
8856
|
+
}, [navigate, onError]);
|
|
8857
|
+
const handleNavigateToContacts = handleNavigation(isBusiness
|
|
8858
|
+
? `/a/contacts/business/${contactId}`
|
|
8859
|
+
: `/a/contacts/contacts/${contactId}`);
|
|
8860
|
+
const handleNavigateToConversations = handleNavigation(contactId
|
|
8861
|
+
? `/a/conversations/conversations?conversationId=${contactId}`
|
|
8862
|
+
: '/a/conversations/conversations');
|
|
8863
|
+
const displayName = name || 'Unknown Contact';
|
|
8864
|
+
const avatarAlt = `Avatar for ${displayName}`;
|
|
8865
|
+
return (jsxRuntimeExports.jsxs(HeaderContainer, { children: [jsxRuntimeExports.jsxs(ButtonsContainer, { children: [jsxRuntimeExports.jsx(SmallIconButton, { color: "info", size: "small", onClick: (e) => {
|
|
8866
|
+
handleNavigateToContacts(e);
|
|
8867
|
+
onClose();
|
|
8868
|
+
}, onMouseDown: (e) => {
|
|
8869
|
+
if (e.button === 1) {
|
|
8870
|
+
// Middle mouse button
|
|
8871
|
+
handleNavigateToContacts(e);
|
|
8872
|
+
onClose();
|
|
8873
|
+
}
|
|
8874
|
+
}, disabled: !contactId, "aria-label": "View contact details", children: jsxRuntimeExports.jsx(default_1$1, { fontSize: "small" }) }), jsxRuntimeExports.jsx(SmallIconButton, { color: "info", size: "small", onClick: (e) => {
|
|
8875
|
+
handleNavigateToConversations(e);
|
|
8876
|
+
onClose();
|
|
8877
|
+
}, onMouseDown: (e) => {
|
|
8878
|
+
if (e.button === 1) {
|
|
8879
|
+
// Middle mouse button
|
|
8880
|
+
handleNavigateToConversations(e);
|
|
8881
|
+
onClose();
|
|
8882
|
+
}
|
|
8883
|
+
}, "aria-label": "Go to conversations", children: jsxRuntimeExports.jsx(default_1, { fontSize: "small" }) })] }), isLoading ? (jsxRuntimeExports.jsx(LoadingContainer, { children: jsxRuntimeExports.jsx(material.CircularProgress, { size: 24 }) })) : (jsxRuntimeExports.jsx(ContactAvatar, { src: imgUrl, alt: avatarAlt, onError: () => onError?.(new Error('Failed to load avatar')) })), jsxRuntimeExports.jsx(ContactName, { variant: "h6", title: displayName, children: displayName })] }));
|
|
8338
8884
|
};
|
|
8339
8885
|
|
|
8340
8886
|
const Container$1 = material.styled(material.Box)({
|
|
@@ -14183,7 +14729,7 @@ const Container = material.styled(material.Box)({
|
|
|
14183
14729
|
alignItems: 'center',
|
|
14184
14730
|
gap: 8,
|
|
14185
14731
|
});
|
|
14186
|
-
const SectionTitle$
|
|
14732
|
+
const SectionTitle$3 = material.styled(material.Typography)({
|
|
14187
14733
|
borderBottom: `1px solid lightgray`,
|
|
14188
14734
|
width: '100%',
|
|
14189
14735
|
});
|
|
@@ -14241,7 +14787,105 @@ const Properties = ({ properties, title }) => {
|
|
|
14241
14787
|
}
|
|
14242
14788
|
return value;
|
|
14243
14789
|
};
|
|
14244
|
-
return (jsxRuntimeExports.jsxs(Container, { children: [jsxRuntimeExports.jsx(SectionTitle$
|
|
14790
|
+
return (jsxRuntimeExports.jsxs(Container, { children: [jsxRuntimeExports.jsx(SectionTitle$3, { fontWeight: "bold", gutterBottom: true, mt: 2, variant: "subtitle1", children: title }), properties?.map((property, i) => property.value.length > 0 && (jsxRuntimeExports.jsxs(PropertyItem, { children: [jsxRuntimeExports.jsx(PropertyIcon, {}), jsxRuntimeExports.jsxs(PropertyText, { children: [getPropertyTitle(property.nameKey), ":", ' ', formatPropertyValue(property.value, property.type)] })] }, i)))] }));
|
|
14791
|
+
};
|
|
14792
|
+
|
|
14793
|
+
const SectionTitle$2 = material.styled(material.Typography)({
|
|
14794
|
+
fontWeight: 'bold',
|
|
14795
|
+
marginBottom: '8px',
|
|
14796
|
+
marginTop: '16px',
|
|
14797
|
+
borderBottom: `1px solid lightgray`,
|
|
14798
|
+
});
|
|
14799
|
+
const TagContainer = material.styled(material.Box)({
|
|
14800
|
+
marginBottom: 16,
|
|
14801
|
+
});
|
|
14802
|
+
const StyledChip = material.styled(material.Chip)(({ theme }) => ({
|
|
14803
|
+
marginRight: 8,
|
|
14804
|
+
marginBottom: 8,
|
|
14805
|
+
backgroundColor: `${theme.palette.primary.main}b3`,
|
|
14806
|
+
}));
|
|
14807
|
+
const LabelsSection = ({ contactData, title }) => {
|
|
14808
|
+
if (!contactData)
|
|
14809
|
+
return null;
|
|
14810
|
+
if (!contactData.tags?.length)
|
|
14811
|
+
return null;
|
|
14812
|
+
return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(SectionTitle$2, { gutterBottom: true, mt: 2, variant: "subtitle1", children: title }), jsxRuntimeExports.jsx(TagContainer, { children: contactData?.tags
|
|
14813
|
+
?.filter((tag) => tag.name?.trim())
|
|
14814
|
+
.map((tag) => (jsxRuntimeExports.jsx(StyledChip, { label: tag.name, color: "primary", size: "small" }, tag.id))) })] }));
|
|
14815
|
+
};
|
|
14816
|
+
|
|
14817
|
+
/**
|
|
14818
|
+
* Type guard to check if an object is an IContact
|
|
14819
|
+
* @param obj The object to check
|
|
14820
|
+
* @returns True if the object is an IContact
|
|
14821
|
+
*/
|
|
14822
|
+
function isContact(obj) {
|
|
14823
|
+
return (obj !== null &&
|
|
14824
|
+
typeof obj === 'object' &&
|
|
14825
|
+
typeof obj.id === 'string' &&
|
|
14826
|
+
typeof obj.spaceId === 'string' &&
|
|
14827
|
+
typeof obj.name === 'string' &&
|
|
14828
|
+
typeof obj.firstName === 'string' &&
|
|
14829
|
+
typeof obj.lastName === 'string' &&
|
|
14830
|
+
Array.isArray(obj.phones) &&
|
|
14831
|
+
Array.isArray(obj.emails) &&
|
|
14832
|
+
'origin' in obj &&
|
|
14833
|
+
typeof obj.isSpam === 'boolean' &&
|
|
14834
|
+
(!obj.businessId || typeof obj.businessId === 'string'));
|
|
14835
|
+
}
|
|
14836
|
+
|
|
14837
|
+
const SectionTitle$1 = material.styled(material.Typography)({
|
|
14838
|
+
fontWeight: 'bold',
|
|
14839
|
+
marginBottom: '8px',
|
|
14840
|
+
marginTop: '16px',
|
|
14841
|
+
borderBottom: `1px solid lightgray`,
|
|
14842
|
+
});
|
|
14843
|
+
const BusinessSection = ({ contactData, title }) => {
|
|
14844
|
+
if (!contactData || !isContact(contactData))
|
|
14845
|
+
return null;
|
|
14846
|
+
return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(SectionTitle$1, { gutterBottom: true, mt: 2, variant: "subtitle1", children: title }), jsxRuntimeExports.jsx(material.Typography, { variant: "body2", color: "text.secondary", children: contactData?.businessName })] }));
|
|
14847
|
+
};
|
|
14848
|
+
|
|
14849
|
+
/**
|
|
14850
|
+
* Type guard to check if an object is an IBusiness
|
|
14851
|
+
* @param obj The object to check
|
|
14852
|
+
* @returns True if the object is an IBusiness
|
|
14853
|
+
*/
|
|
14854
|
+
function isBusiness(obj) {
|
|
14855
|
+
// Si el objeto tiene explícitamente la propiedad isBusiness como true, lo consideramos un negocio
|
|
14856
|
+
if (obj?.isBusiness === true) {
|
|
14857
|
+
return true;
|
|
14858
|
+
}
|
|
14859
|
+
// De lo contrario, realizamos las comprobaciones tradicionales
|
|
14860
|
+
return (obj !== null &&
|
|
14861
|
+
typeof obj === 'object' &&
|
|
14862
|
+
typeof obj.id === 'string' &&
|
|
14863
|
+
typeof obj.spaceId === 'string' &&
|
|
14864
|
+
typeof obj.name === 'string' &&
|
|
14865
|
+
Array.isArray(obj.membersId) &&
|
|
14866
|
+
Array.isArray(obj.members) &&
|
|
14867
|
+
Array.isArray(obj.phones) &&
|
|
14868
|
+
Array.isArray(obj.emails) &&
|
|
14869
|
+
typeof obj.imageUrl === 'string' &&
|
|
14870
|
+
!('firstName' in obj) &&
|
|
14871
|
+
!('lastName' in obj));
|
|
14872
|
+
}
|
|
14873
|
+
|
|
14874
|
+
// Components
|
|
14875
|
+
const MemberItem = ({ name }) => {
|
|
14876
|
+
return (jsxRuntimeExports.jsx(material.Typography, { variant: "body2", color: "text.secondary", children: name }));
|
|
14877
|
+
};
|
|
14878
|
+
|
|
14879
|
+
const SectionTitle = material.styled(material.Typography)({
|
|
14880
|
+
fontWeight: 'bold',
|
|
14881
|
+
marginBottom: '8px',
|
|
14882
|
+
marginTop: '16px',
|
|
14883
|
+
borderBottom: `1px solid lightgray`,
|
|
14884
|
+
});
|
|
14885
|
+
const MembersSection = ({ contactData, title }) => {
|
|
14886
|
+
if (!contactData || !isBusiness(contactData) || !contactData.members?.length)
|
|
14887
|
+
return null;
|
|
14888
|
+
return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(SectionTitle, { gutterBottom: true, mt: 2, variant: "subtitle1", children: title }), jsxRuntimeExports.jsx(material.Typography, { variant: "body2", color: "text.secondary", children: contactData?.members.map((member) => (jsxRuntimeExports.jsx(MemberItem, { name: member.name }, member.id))) })] }));
|
|
14245
14889
|
};
|
|
14246
14890
|
|
|
14247
14891
|
const PopupContainer = material.styled(material.Box)(({ theme }) => ({
|
|
@@ -14271,28 +14915,17 @@ const PopupContainer = material.styled(material.Box)(({ theme }) => ({
|
|
|
14271
14915
|
background: '#616161',
|
|
14272
14916
|
},
|
|
14273
14917
|
}));
|
|
14274
|
-
const
|
|
14275
|
-
fontWeight: 'bold',
|
|
14276
|
-
marginBottom: '8px',
|
|
14277
|
-
marginTop: '16px',
|
|
14278
|
-
borderBottom: `1px solid lightgray`,
|
|
14279
|
-
});
|
|
14280
|
-
const TagContainer = material.styled(material.Box)({
|
|
14281
|
-
marginBottom: 16,
|
|
14282
|
-
});
|
|
14283
|
-
const StyledChip = material.styled(material.Chip)(({ theme }) => ({
|
|
14284
|
-
marginRight: 8,
|
|
14285
|
-
marginBottom: 8,
|
|
14286
|
-
backgroundColor: `${theme.palette.primary.main}b3`
|
|
14287
|
-
}));
|
|
14288
|
-
const ContactInfoPopup = ({ open, anchorEl, onClose, contactData, avatarImgUrl, t = (key) => ({
|
|
14918
|
+
const ContactInfoPopup = ({ open, anchorEl, onClose, contactData, avatarImgUrl, navigate, t = (key) => ({
|
|
14289
14919
|
labels: 'Etiquetas',
|
|
14290
14920
|
phone: 'Teléfono',
|
|
14291
14921
|
business: 'Empresa',
|
|
14922
|
+
businessMembers: 'Miembros de la empresa',
|
|
14292
14923
|
properties: 'Propiedades',
|
|
14293
14924
|
view: 'Ver',
|
|
14294
|
-
|
|
14925
|
+
email: 'Correo Electrónico',
|
|
14295
14926
|
}[key] || key), }) => {
|
|
14927
|
+
const dataIsBusiness = isBusiness(contactData);
|
|
14928
|
+
const dataIsContact = isContact(contactData);
|
|
14296
14929
|
const contactMethods = [
|
|
14297
14930
|
{
|
|
14298
14931
|
icon: jsxRuntimeExports.jsx(PhoneEnabled, { fontSize: "small" }),
|
|
@@ -14302,7 +14935,7 @@ const ContactInfoPopup = ({ open, anchorEl, onClose, contactData, avatarImgUrl,
|
|
|
14302
14935
|
},
|
|
14303
14936
|
{
|
|
14304
14937
|
icon: jsxRuntimeExports.jsx(Email, { fontSize: "small" }),
|
|
14305
|
-
title: t('
|
|
14938
|
+
title: t('email'),
|
|
14306
14939
|
contactList: contactData?.emails || [],
|
|
14307
14940
|
showTitle: true,
|
|
14308
14941
|
},
|
|
@@ -14341,7 +14974,7 @@ const ContactInfoPopup = ({ open, anchorEl, onClose, contactData, avatarImgUrl,
|
|
|
14341
14974
|
window.removeEventListener('keydown', handleKeyDown);
|
|
14342
14975
|
};
|
|
14343
14976
|
}, [open, onClose]);
|
|
14344
|
-
return (jsxRuntimeExports.jsx(material.Popper, { sx: { zIndex: 1300 }, open: open, anchorEl: anchorEl, placement: "bottom-start", "data-popper-child": "true", children: jsxRuntimeExports.jsx(material.ClickAwayListener, { onClickAway: onClose, children: jsxRuntimeExports.jsx(PopupContainer, { children: jsxRuntimeExports.jsxs(material.CardContent, { children: [jsxRuntimeExports.jsx(Header, { contactId: contactData?.id, imgUrl: avatarImgUrl, name: contactData?.name
|
|
14977
|
+
return (jsxRuntimeExports.jsx(material.Popper, { sx: { zIndex: 1300 }, open: open, anchorEl: anchorEl, placement: "bottom-start", "data-popper-child": "true", children: jsxRuntimeExports.jsx(material.ClickAwayListener, { onClickAway: onClose, children: jsxRuntimeExports.jsx(PopupContainer, { children: jsxRuntimeExports.jsxs(material.CardContent, { children: [jsxRuntimeExports.jsx(Header, { navigate: navigate, contactId: contactData?.id, imgUrl: avatarImgUrl, name: contactData?.name, onClose: onClose, isBusiness: dataIsBusiness }), jsxRuntimeExports.jsx(LabelsSection, { contactData: contactData, title: t('labels') }), dataIsContact && (jsxRuntimeExports.jsx(BusinessSection, { contactData: contactData, title: t('business') })), dataIsBusiness && (jsxRuntimeExports.jsx(MembersSection, { contactData: contactData, title: t('businessMembers') })), contactMethods.map((method, index) => (jsxRuntimeExports.jsx(ContactMethod, { icon: method.icon, title: method.title, contactList: method.contactList, showTitle: method.showTitle }, index))), jsxRuntimeExports.jsx(Properties, { properties: contactData?.properties, title: t('properties') })] }) }) }) }));
|
|
14345
14978
|
};
|
|
14346
14979
|
|
|
14347
14980
|
exports.ContactInfoPopup = ContactInfoPopup;
|