@trii/components 2.0.19 → 2.0.21
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 +681 -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 +683 -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/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import React__default, { useEffect } from 'react';
|
|
3
|
-
import { Button, styled as styled$3, Box, IconButton, Avatar, Typography, Tooltip, Chip, Popper, ClickAwayListener, CardContent } from '@mui/material';
|
|
2
|
+
import React__default, { useCallback, useEffect } from 'react';
|
|
3
|
+
import { Button, styled as styled$3, Box, IconButton, Avatar, Typography, CircularProgress, Tooltip, Chip, Popper, ClickAwayListener, CardContent } from '@mui/material';
|
|
4
4
|
import { withEmotionCache, ThemeContext, CacheProvider, Global, css, keyframes } from '@emotion/react';
|
|
5
5
|
|
|
6
6
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
@@ -3022,6 +3022,422 @@ var capitalize = /*#__PURE__*/Object.freeze({
|
|
|
3022
3022
|
default: capitalize$1
|
|
3023
3023
|
});
|
|
3024
3024
|
|
|
3025
|
+
/**
|
|
3026
|
+
* Safe chained function.
|
|
3027
|
+
*
|
|
3028
|
+
* Will only create a new function if needed,
|
|
3029
|
+
* otherwise will pass back existing functions or null.
|
|
3030
|
+
*/
|
|
3031
|
+
function createChainedFunction(...funcs) {
|
|
3032
|
+
return funcs.reduce((acc, func) => {
|
|
3033
|
+
if (func == null) {
|
|
3034
|
+
return acc;
|
|
3035
|
+
}
|
|
3036
|
+
return function chainedFunction(...args) {
|
|
3037
|
+
acc.apply(this, args);
|
|
3038
|
+
func.apply(this, args);
|
|
3039
|
+
};
|
|
3040
|
+
}, () => {});
|
|
3041
|
+
}
|
|
3042
|
+
|
|
3043
|
+
// Corresponds to 10 frames at 60 Hz.
|
|
3044
|
+
// A few bytes payload overhead when lodash/debounce is ~3 kB and debounce ~300 B.
|
|
3045
|
+
function debounce(func, wait = 166) {
|
|
3046
|
+
let timeout;
|
|
3047
|
+
function debounced(...args) {
|
|
3048
|
+
const later = () => {
|
|
3049
|
+
// @ts-ignore
|
|
3050
|
+
func.apply(this, args);
|
|
3051
|
+
};
|
|
3052
|
+
clearTimeout(timeout);
|
|
3053
|
+
timeout = setTimeout(later, wait);
|
|
3054
|
+
}
|
|
3055
|
+
debounced.clear = () => {
|
|
3056
|
+
clearTimeout(timeout);
|
|
3057
|
+
};
|
|
3058
|
+
return debounced;
|
|
3059
|
+
}
|
|
3060
|
+
|
|
3061
|
+
function deprecatedPropType(validator, reason) {
|
|
3062
|
+
if (process.env.NODE_ENV === 'production') {
|
|
3063
|
+
return () => null;
|
|
3064
|
+
}
|
|
3065
|
+
return (props, propName, componentName, location, propFullName) => {
|
|
3066
|
+
const componentNameSafe = componentName || '<<anonymous>>';
|
|
3067
|
+
const propFullNameSafe = propFullName || propName;
|
|
3068
|
+
if (typeof props[propName] !== 'undefined') {
|
|
3069
|
+
return new Error(`The ${location} \`${propFullNameSafe}\` of ` + `\`${componentNameSafe}\` is deprecated. ${reason}`);
|
|
3070
|
+
}
|
|
3071
|
+
return null;
|
|
3072
|
+
};
|
|
3073
|
+
}
|
|
3074
|
+
|
|
3075
|
+
function isMuiElement(element, muiNames) {
|
|
3076
|
+
var _muiName, _element$type;
|
|
3077
|
+
return /*#__PURE__*/React.isValidElement(element) && muiNames.indexOf( // For server components `muiName` is avaialble in element.type._payload.value.muiName
|
|
3078
|
+
// relevant info - https://github.com/facebook/react/blob/2807d781a08db8e9873687fccc25c0f12b4fb3d4/packages/react/src/ReactLazy.js#L45
|
|
3079
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
3080
|
+
(_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;
|
|
3081
|
+
}
|
|
3082
|
+
|
|
3083
|
+
function ownerDocument(node) {
|
|
3084
|
+
return node && node.ownerDocument || document;
|
|
3085
|
+
}
|
|
3086
|
+
|
|
3087
|
+
function ownerWindow(node) {
|
|
3088
|
+
const doc = ownerDocument(node);
|
|
3089
|
+
return doc.defaultView || window;
|
|
3090
|
+
}
|
|
3091
|
+
|
|
3092
|
+
function requirePropFactory(componentNameInError, Component) {
|
|
3093
|
+
if (process.env.NODE_ENV === 'production') {
|
|
3094
|
+
return () => null;
|
|
3095
|
+
}
|
|
3096
|
+
|
|
3097
|
+
// eslint-disable-next-line react/forbid-foreign-prop-types
|
|
3098
|
+
const prevPropTypes = Component ? _extends$1({}, Component.propTypes) : null;
|
|
3099
|
+
const requireProp = requiredProp => (props, propName, componentName, location, propFullName, ...args) => {
|
|
3100
|
+
const propFullNameSafe = propFullName || propName;
|
|
3101
|
+
const defaultTypeChecker = prevPropTypes == null ? void 0 : prevPropTypes[propFullNameSafe];
|
|
3102
|
+
if (defaultTypeChecker) {
|
|
3103
|
+
const typeCheckerResult = defaultTypeChecker(props, propName, componentName, location, propFullName, ...args);
|
|
3104
|
+
if (typeCheckerResult) {
|
|
3105
|
+
return typeCheckerResult;
|
|
3106
|
+
}
|
|
3107
|
+
}
|
|
3108
|
+
if (typeof props[propName] !== 'undefined' && !props[requiredProp]) {
|
|
3109
|
+
return new Error(`The prop \`${propFullNameSafe}\` of ` + `\`${componentNameInError}\` can only be used together with the \`${requiredProp}\` prop.`);
|
|
3110
|
+
}
|
|
3111
|
+
return null;
|
|
3112
|
+
};
|
|
3113
|
+
return requireProp;
|
|
3114
|
+
}
|
|
3115
|
+
|
|
3116
|
+
/**
|
|
3117
|
+
* TODO v5: consider making it private
|
|
3118
|
+
*
|
|
3119
|
+
* passes {value} to {ref}
|
|
3120
|
+
*
|
|
3121
|
+
* WARNING: Be sure to only call this inside a callback that is passed as a ref.
|
|
3122
|
+
* Otherwise, make sure to cleanup the previous {ref} if it changes. See
|
|
3123
|
+
* https://github.com/mui/material-ui/issues/13539
|
|
3124
|
+
*
|
|
3125
|
+
* Useful if you want to expose the ref of an inner component to the public API
|
|
3126
|
+
* while still using it inside the component.
|
|
3127
|
+
* @param ref A ref callback or ref object. If anything falsy, this is a no-op.
|
|
3128
|
+
*/
|
|
3129
|
+
function setRef(ref, value) {
|
|
3130
|
+
if (typeof ref === 'function') {
|
|
3131
|
+
ref(value);
|
|
3132
|
+
} else if (ref) {
|
|
3133
|
+
ref.current = value;
|
|
3134
|
+
}
|
|
3135
|
+
}
|
|
3136
|
+
|
|
3137
|
+
/**
|
|
3138
|
+
* A version of `React.useLayoutEffect` that does not show a warning when server-side rendering.
|
|
3139
|
+
* This is useful for effects that are only needed for client-side rendering but not for SSR.
|
|
3140
|
+
*
|
|
3141
|
+
* Before you use this hook, make sure to read https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85
|
|
3142
|
+
* and confirm it doesn't apply to your use-case.
|
|
3143
|
+
*/
|
|
3144
|
+
const useEnhancedEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
|
|
3145
|
+
var useEnhancedEffect$1 = useEnhancedEffect;
|
|
3146
|
+
|
|
3147
|
+
let globalId = 0;
|
|
3148
|
+
function useGlobalId(idOverride) {
|
|
3149
|
+
const [defaultId, setDefaultId] = React.useState(idOverride);
|
|
3150
|
+
const id = idOverride || defaultId;
|
|
3151
|
+
React.useEffect(() => {
|
|
3152
|
+
if (defaultId == null) {
|
|
3153
|
+
// Fallback to this default id when possible.
|
|
3154
|
+
// Use the incrementing value for client-side rendering only.
|
|
3155
|
+
// We can't use it server-side.
|
|
3156
|
+
// If you want to use random values please consider the Birthday Problem: https://en.wikipedia.org/wiki/Birthday_problem
|
|
3157
|
+
globalId += 1;
|
|
3158
|
+
setDefaultId(`mui-${globalId}`);
|
|
3159
|
+
}
|
|
3160
|
+
}, [defaultId]);
|
|
3161
|
+
return id;
|
|
3162
|
+
}
|
|
3163
|
+
|
|
3164
|
+
// downstream bundlers may remove unnecessary concatenation, but won't remove toString call -- Workaround for https://github.com/webpack/webpack/issues/14814
|
|
3165
|
+
const maybeReactUseId = React['useId'.toString()];
|
|
3166
|
+
/**
|
|
3167
|
+
*
|
|
3168
|
+
* @example <div id={useId()} />
|
|
3169
|
+
* @param idOverride
|
|
3170
|
+
* @returns {string}
|
|
3171
|
+
*/
|
|
3172
|
+
function useId(idOverride) {
|
|
3173
|
+
if (maybeReactUseId !== undefined) {
|
|
3174
|
+
const reactId = maybeReactUseId();
|
|
3175
|
+
return idOverride != null ? idOverride : reactId;
|
|
3176
|
+
}
|
|
3177
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- `React.useId` is invariant at runtime.
|
|
3178
|
+
return useGlobalId(idOverride);
|
|
3179
|
+
}
|
|
3180
|
+
|
|
3181
|
+
function unsupportedProp(props, propName, componentName, location, propFullName) {
|
|
3182
|
+
if (process.env.NODE_ENV === 'production') {
|
|
3183
|
+
return null;
|
|
3184
|
+
}
|
|
3185
|
+
const propFullNameSafe = propFullName || propName;
|
|
3186
|
+
if (typeof props[propName] !== 'undefined') {
|
|
3187
|
+
return new Error(`The prop \`${propFullNameSafe}\` is not supported. Please remove it.`);
|
|
3188
|
+
}
|
|
3189
|
+
return null;
|
|
3190
|
+
}
|
|
3191
|
+
|
|
3192
|
+
function useControlled({
|
|
3193
|
+
controlled,
|
|
3194
|
+
default: defaultProp,
|
|
3195
|
+
name,
|
|
3196
|
+
state = 'value'
|
|
3197
|
+
}) {
|
|
3198
|
+
// isControlled is ignored in the hook dependency lists as it should never change.
|
|
3199
|
+
const {
|
|
3200
|
+
current: isControlled
|
|
3201
|
+
} = React.useRef(controlled !== undefined);
|
|
3202
|
+
const [valueState, setValue] = React.useState(defaultProp);
|
|
3203
|
+
const value = isControlled ? controlled : valueState;
|
|
3204
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3205
|
+
React.useEffect(() => {
|
|
3206
|
+
if (isControlled !== (controlled !== undefined)) {
|
|
3207
|
+
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'));
|
|
3208
|
+
}
|
|
3209
|
+
}, [state, name, controlled]);
|
|
3210
|
+
const {
|
|
3211
|
+
current: defaultValue
|
|
3212
|
+
} = React.useRef(defaultProp);
|
|
3213
|
+
React.useEffect(() => {
|
|
3214
|
+
if (!isControlled && defaultValue !== defaultProp) {
|
|
3215
|
+
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'));
|
|
3216
|
+
}
|
|
3217
|
+
}, [JSON.stringify(defaultProp)]);
|
|
3218
|
+
}
|
|
3219
|
+
const setValueIfUncontrolled = React.useCallback(newValue => {
|
|
3220
|
+
if (!isControlled) {
|
|
3221
|
+
setValue(newValue);
|
|
3222
|
+
}
|
|
3223
|
+
}, []);
|
|
3224
|
+
return [value, setValueIfUncontrolled];
|
|
3225
|
+
}
|
|
3226
|
+
|
|
3227
|
+
/**
|
|
3228
|
+
* Inspired by https://github.com/facebook/react/issues/14099#issuecomment-440013892
|
|
3229
|
+
* See RFC in https://github.com/reactjs/rfcs/pull/220
|
|
3230
|
+
*/
|
|
3231
|
+
|
|
3232
|
+
function useEventCallback(fn) {
|
|
3233
|
+
const ref = React.useRef(fn);
|
|
3234
|
+
useEnhancedEffect$1(() => {
|
|
3235
|
+
ref.current = fn;
|
|
3236
|
+
});
|
|
3237
|
+
return React.useRef((...args) =>
|
|
3238
|
+
// @ts-expect-error hide `this`
|
|
3239
|
+
(0, ref.current)(...args)).current;
|
|
3240
|
+
}
|
|
3241
|
+
|
|
3242
|
+
function useForkRef(...refs) {
|
|
3243
|
+
/**
|
|
3244
|
+
* This will create a new function if the refs passed to this hook change and are all defined.
|
|
3245
|
+
* This means react will call the old forkRef with `null` and the new forkRef
|
|
3246
|
+
* with the ref. Cleanup naturally emerges from this behavior.
|
|
3247
|
+
*/
|
|
3248
|
+
return React.useMemo(() => {
|
|
3249
|
+
if (refs.every(ref => ref == null)) {
|
|
3250
|
+
return null;
|
|
3251
|
+
}
|
|
3252
|
+
return instance => {
|
|
3253
|
+
refs.forEach(ref => {
|
|
3254
|
+
setRef(ref, instance);
|
|
3255
|
+
});
|
|
3256
|
+
};
|
|
3257
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3258
|
+
}, refs);
|
|
3259
|
+
}
|
|
3260
|
+
|
|
3261
|
+
class Timeout {
|
|
3262
|
+
constructor() {
|
|
3263
|
+
this.currentId = null;
|
|
3264
|
+
this.clear = () => {
|
|
3265
|
+
if (this.currentId !== null) {
|
|
3266
|
+
clearTimeout(this.currentId);
|
|
3267
|
+
this.currentId = null;
|
|
3268
|
+
}
|
|
3269
|
+
};
|
|
3270
|
+
this.disposeEffect = () => {
|
|
3271
|
+
return this.clear;
|
|
3272
|
+
};
|
|
3273
|
+
}
|
|
3274
|
+
static create() {
|
|
3275
|
+
return new Timeout();
|
|
3276
|
+
}
|
|
3277
|
+
/**
|
|
3278
|
+
* Executes `fn` after `delay`, clearing any previously scheduled call.
|
|
3279
|
+
*/
|
|
3280
|
+
start(delay, fn) {
|
|
3281
|
+
this.clear();
|
|
3282
|
+
this.currentId = setTimeout(() => {
|
|
3283
|
+
this.currentId = null;
|
|
3284
|
+
fn();
|
|
3285
|
+
}, delay);
|
|
3286
|
+
}
|
|
3287
|
+
}
|
|
3288
|
+
|
|
3289
|
+
let hadKeyboardEvent = true;
|
|
3290
|
+
let hadFocusVisibleRecently = false;
|
|
3291
|
+
const hadFocusVisibleRecentlyTimeout = new Timeout();
|
|
3292
|
+
const inputTypesWhitelist = {
|
|
3293
|
+
text: true,
|
|
3294
|
+
search: true,
|
|
3295
|
+
url: true,
|
|
3296
|
+
tel: true,
|
|
3297
|
+
email: true,
|
|
3298
|
+
password: true,
|
|
3299
|
+
number: true,
|
|
3300
|
+
date: true,
|
|
3301
|
+
month: true,
|
|
3302
|
+
week: true,
|
|
3303
|
+
time: true,
|
|
3304
|
+
datetime: true,
|
|
3305
|
+
'datetime-local': true
|
|
3306
|
+
};
|
|
3307
|
+
|
|
3308
|
+
/**
|
|
3309
|
+
* Computes whether the given element should automatically trigger the
|
|
3310
|
+
* `focus-visible` class being added, i.e. whether it should always match
|
|
3311
|
+
* `:focus-visible` when focused.
|
|
3312
|
+
* @param {Element} node
|
|
3313
|
+
* @returns {boolean}
|
|
3314
|
+
*/
|
|
3315
|
+
function focusTriggersKeyboardModality(node) {
|
|
3316
|
+
const {
|
|
3317
|
+
type,
|
|
3318
|
+
tagName
|
|
3319
|
+
} = node;
|
|
3320
|
+
if (tagName === 'INPUT' && inputTypesWhitelist[type] && !node.readOnly) {
|
|
3321
|
+
return true;
|
|
3322
|
+
}
|
|
3323
|
+
if (tagName === 'TEXTAREA' && !node.readOnly) {
|
|
3324
|
+
return true;
|
|
3325
|
+
}
|
|
3326
|
+
if (node.isContentEditable) {
|
|
3327
|
+
return true;
|
|
3328
|
+
}
|
|
3329
|
+
return false;
|
|
3330
|
+
}
|
|
3331
|
+
|
|
3332
|
+
/**
|
|
3333
|
+
* Keep track of our keyboard modality state with `hadKeyboardEvent`.
|
|
3334
|
+
* If the most recent user interaction was via the keyboard;
|
|
3335
|
+
* and the key press did not include a meta, alt/option, or control key;
|
|
3336
|
+
* then the modality is keyboard. Otherwise, the modality is not keyboard.
|
|
3337
|
+
* @param {KeyboardEvent} event
|
|
3338
|
+
*/
|
|
3339
|
+
function handleKeyDown(event) {
|
|
3340
|
+
if (event.metaKey || event.altKey || event.ctrlKey) {
|
|
3341
|
+
return;
|
|
3342
|
+
}
|
|
3343
|
+
hadKeyboardEvent = true;
|
|
3344
|
+
}
|
|
3345
|
+
|
|
3346
|
+
/**
|
|
3347
|
+
* If at any point a user clicks with a pointing device, ensure that we change
|
|
3348
|
+
* the modality away from keyboard.
|
|
3349
|
+
* This avoids the situation where a user presses a key on an already focused
|
|
3350
|
+
* element, and then clicks on a different element, focusing it with a
|
|
3351
|
+
* pointing device, while we still think we're in keyboard modality.
|
|
3352
|
+
*/
|
|
3353
|
+
function handlePointerDown() {
|
|
3354
|
+
hadKeyboardEvent = false;
|
|
3355
|
+
}
|
|
3356
|
+
function handleVisibilityChange() {
|
|
3357
|
+
if (this.visibilityState === 'hidden') {
|
|
3358
|
+
// If the tab becomes active again, the browser will handle calling focus
|
|
3359
|
+
// on the element (Safari actually calls it twice).
|
|
3360
|
+
// If this tab change caused a blur on an element with focus-visible,
|
|
3361
|
+
// re-apply the class when the user switches back to the tab.
|
|
3362
|
+
if (hadFocusVisibleRecently) {
|
|
3363
|
+
hadKeyboardEvent = true;
|
|
3364
|
+
}
|
|
3365
|
+
}
|
|
3366
|
+
}
|
|
3367
|
+
function prepare(doc) {
|
|
3368
|
+
doc.addEventListener('keydown', handleKeyDown, true);
|
|
3369
|
+
doc.addEventListener('mousedown', handlePointerDown, true);
|
|
3370
|
+
doc.addEventListener('pointerdown', handlePointerDown, true);
|
|
3371
|
+
doc.addEventListener('touchstart', handlePointerDown, true);
|
|
3372
|
+
doc.addEventListener('visibilitychange', handleVisibilityChange, true);
|
|
3373
|
+
}
|
|
3374
|
+
function isFocusVisible(event) {
|
|
3375
|
+
const {
|
|
3376
|
+
target
|
|
3377
|
+
} = event;
|
|
3378
|
+
try {
|
|
3379
|
+
return target.matches(':focus-visible');
|
|
3380
|
+
} catch (error) {
|
|
3381
|
+
// Browsers not implementing :focus-visible will throw a SyntaxError.
|
|
3382
|
+
// We use our own heuristic for those browsers.
|
|
3383
|
+
// Rethrow might be better if it's not the expected error but do we really
|
|
3384
|
+
// want to crash if focus-visible malfunctioned?
|
|
3385
|
+
}
|
|
3386
|
+
|
|
3387
|
+
// No need for validFocusTarget check. The user does that by attaching it to
|
|
3388
|
+
// focusable events only.
|
|
3389
|
+
return hadKeyboardEvent || focusTriggersKeyboardModality(target);
|
|
3390
|
+
}
|
|
3391
|
+
function useIsFocusVisible() {
|
|
3392
|
+
const ref = React.useCallback(node => {
|
|
3393
|
+
if (node != null) {
|
|
3394
|
+
prepare(node.ownerDocument);
|
|
3395
|
+
}
|
|
3396
|
+
}, []);
|
|
3397
|
+
const isFocusVisibleRef = React.useRef(false);
|
|
3398
|
+
|
|
3399
|
+
/**
|
|
3400
|
+
* Should be called if a blur event is fired
|
|
3401
|
+
*/
|
|
3402
|
+
function handleBlurVisible() {
|
|
3403
|
+
// checking against potential state variable does not suffice if we focus and blur synchronously.
|
|
3404
|
+
// React wouldn't have time to trigger a re-render so `focusVisible` would be stale.
|
|
3405
|
+
// Ideally we would adjust `isFocusVisible(event)` to look at `relatedTarget` for blur events.
|
|
3406
|
+
// This doesn't work in IE11 due to https://github.com/facebook/react/issues/3751
|
|
3407
|
+
// TODO: check again if React releases their internal changes to focus event handling (https://github.com/facebook/react/pull/19186).
|
|
3408
|
+
if (isFocusVisibleRef.current) {
|
|
3409
|
+
// To detect a tab/window switch, we look for a blur event followed
|
|
3410
|
+
// rapidly by a visibility change.
|
|
3411
|
+
// If we don't see a visibility change within 100ms, it's probably a
|
|
3412
|
+
// regular focus change.
|
|
3413
|
+
hadFocusVisibleRecently = true;
|
|
3414
|
+
hadFocusVisibleRecentlyTimeout.start(100, () => {
|
|
3415
|
+
hadFocusVisibleRecently = false;
|
|
3416
|
+
});
|
|
3417
|
+
isFocusVisibleRef.current = false;
|
|
3418
|
+
return true;
|
|
3419
|
+
}
|
|
3420
|
+
return false;
|
|
3421
|
+
}
|
|
3422
|
+
|
|
3423
|
+
/**
|
|
3424
|
+
* Should be called if a blur event is fired
|
|
3425
|
+
*/
|
|
3426
|
+
function handleFocusVisible(event) {
|
|
3427
|
+
if (isFocusVisible(event)) {
|
|
3428
|
+
isFocusVisibleRef.current = true;
|
|
3429
|
+
return true;
|
|
3430
|
+
}
|
|
3431
|
+
return false;
|
|
3432
|
+
}
|
|
3433
|
+
return {
|
|
3434
|
+
isFocusVisibleRef,
|
|
3435
|
+
onFocus: handleFocusVisible,
|
|
3436
|
+
onBlur: handleBlurVisible,
|
|
3437
|
+
ref
|
|
3438
|
+
};
|
|
3439
|
+
}
|
|
3440
|
+
|
|
3025
3441
|
/**
|
|
3026
3442
|
* Add keys, values of `defaultProps` that does not exist in `props`
|
|
3027
3443
|
* @param {object} defaultProps
|
|
@@ -6635,7 +7051,7 @@ var require$$1 = /*@__PURE__*/getAugmentedNamespace(formatMuiErrorMessage);
|
|
|
6635
7051
|
|
|
6636
7052
|
var require$$2 = /*@__PURE__*/getAugmentedNamespace(clamp);
|
|
6637
7053
|
|
|
6638
|
-
var _interopRequireDefault$
|
|
7054
|
+
var _interopRequireDefault$3 = interopRequireDefaultExports;
|
|
6639
7055
|
Object.defineProperty(colorManipulator, "__esModule", {
|
|
6640
7056
|
value: true
|
|
6641
7057
|
});
|
|
@@ -6657,8 +7073,8 @@ colorManipulator.private_safeEmphasize = private_safeEmphasize;
|
|
|
6657
7073
|
colorManipulator.private_safeLighten = private_safeLighten;
|
|
6658
7074
|
colorManipulator.recomposeColor = recomposeColor;
|
|
6659
7075
|
colorManipulator.rgbToHex = rgbToHex;
|
|
6660
|
-
var _formatMuiErrorMessage2 = _interopRequireDefault$
|
|
6661
|
-
var _clamp = _interopRequireDefault$
|
|
7076
|
+
var _formatMuiErrorMessage2 = _interopRequireDefault$3(require$$1);
|
|
7077
|
+
var _clamp = _interopRequireDefault$3(require$$2);
|
|
6662
7078
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
6663
7079
|
|
|
6664
7080
|
/**
|
|
@@ -7780,21 +8196,21 @@ var require$$7 = /*@__PURE__*/getAugmentedNamespace(createTheme$1);
|
|
|
7780
8196
|
|
|
7781
8197
|
var require$$8 = /*@__PURE__*/getAugmentedNamespace(styleFunctionSx);
|
|
7782
8198
|
|
|
7783
|
-
var _interopRequireDefault = interopRequireDefaultExports;
|
|
8199
|
+
var _interopRequireDefault$2 = interopRequireDefaultExports;
|
|
7784
8200
|
Object.defineProperty(createStyled$1, "__esModule", {
|
|
7785
8201
|
value: true
|
|
7786
8202
|
});
|
|
7787
8203
|
var _default = createStyled$1.default = createStyled;
|
|
7788
8204
|
createStyled$1.shouldForwardProp = shouldForwardProp;
|
|
7789
8205
|
createStyled$1.systemDefaultTheme = void 0;
|
|
7790
|
-
var _extends2 = _interopRequireDefault(require_extends());
|
|
7791
|
-
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(requireObjectWithoutPropertiesLoose());
|
|
8206
|
+
var _extends2 = _interopRequireDefault$2(require_extends());
|
|
8207
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault$2(requireObjectWithoutPropertiesLoose());
|
|
7792
8208
|
var _styledEngine = _interopRequireWildcard(require$$3);
|
|
7793
8209
|
var _deepmerge = require$$4;
|
|
7794
|
-
var _capitalize = _interopRequireDefault(require$$5);
|
|
7795
|
-
var _getDisplayName = _interopRequireDefault(require$$6);
|
|
7796
|
-
var _createTheme = _interopRequireDefault(require$$7);
|
|
7797
|
-
var _styleFunctionSx = _interopRequireDefault(require$$8);
|
|
8210
|
+
var _capitalize = _interopRequireDefault$2(require$$5);
|
|
8211
|
+
var _getDisplayName = _interopRequireDefault$2(require$$6);
|
|
8212
|
+
var _createTheme = _interopRequireDefault$2(require$$7);
|
|
8213
|
+
var _styleFunctionSx = _interopRequireDefault$2(require$$8);
|
|
7798
8214
|
const _excluded$1 = ["ownerState"],
|
|
7799
8215
|
_excluded2 = ["variants"],
|
|
7800
8216
|
_excluded3 = ["name", "slot", "skipVariantsResolver", "skipSx", "overridesResolver"];
|
|
@@ -8224,7 +8640,7 @@ process.env.NODE_ENV !== "production" ? SvgIcon.propTypes /* remove-proptypes */
|
|
|
8224
8640
|
SvgIcon.muiName = 'SvgIcon';
|
|
8225
8641
|
var SvgIcon$1 = SvgIcon;
|
|
8226
8642
|
|
|
8227
|
-
function createSvgIcon(path, displayName) {
|
|
8643
|
+
function createSvgIcon$1(path, displayName) {
|
|
8228
8644
|
function Component(props, ref) {
|
|
8229
8645
|
return /*#__PURE__*/jsxRuntimeExports.jsx(SvgIcon$1, _extends$1({
|
|
8230
8646
|
"data-testid": `${displayName}Icon`,
|
|
@@ -8242,45 +8658,127 @@ function createSvgIcon(path, displayName) {
|
|
|
8242
8658
|
return /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(Component));
|
|
8243
8659
|
}
|
|
8244
8660
|
|
|
8245
|
-
|
|
8661
|
+
// TODO: remove this export once ClassNameGenerator is stable
|
|
8662
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
8663
|
+
const unstable_ClassNameGenerator = {
|
|
8664
|
+
configure: generator => {
|
|
8665
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
8666
|
+
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'));
|
|
8667
|
+
}
|
|
8668
|
+
ClassNameGenerator$1.configure(generator);
|
|
8669
|
+
}
|
|
8670
|
+
};
|
|
8671
|
+
|
|
8672
|
+
var utils = /*#__PURE__*/Object.freeze({
|
|
8673
|
+
__proto__: null,
|
|
8674
|
+
capitalize: capitalize$1,
|
|
8675
|
+
createChainedFunction: createChainedFunction,
|
|
8676
|
+
createSvgIcon: createSvgIcon$1,
|
|
8677
|
+
debounce: debounce,
|
|
8678
|
+
deprecatedPropType: deprecatedPropType,
|
|
8679
|
+
isMuiElement: isMuiElement,
|
|
8680
|
+
ownerDocument: ownerDocument,
|
|
8681
|
+
ownerWindow: ownerWindow,
|
|
8682
|
+
requirePropFactory: requirePropFactory,
|
|
8683
|
+
setRef: setRef,
|
|
8684
|
+
unstable_ClassNameGenerator: unstable_ClassNameGenerator,
|
|
8685
|
+
unstable_useEnhancedEffect: useEnhancedEffect$1,
|
|
8686
|
+
unstable_useId: useId,
|
|
8687
|
+
unsupportedProp: unsupportedProp,
|
|
8688
|
+
useControlled: useControlled,
|
|
8689
|
+
useEventCallback: useEventCallback,
|
|
8690
|
+
useForkRef: useForkRef,
|
|
8691
|
+
useIsFocusVisible: useIsFocusVisible
|
|
8692
|
+
});
|
|
8693
|
+
|
|
8694
|
+
var Email = createSvgIcon$1( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
|
|
8246
8695
|
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"
|
|
8247
8696
|
}), 'Email');
|
|
8248
8697
|
|
|
8249
|
-
var Facebook = createSvgIcon( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
|
|
8698
|
+
var Facebook = createSvgIcon$1( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
|
|
8250
8699
|
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"
|
|
8251
8700
|
}), 'Facebook');
|
|
8252
8701
|
|
|
8253
|
-
var Handyman = createSvgIcon([/*#__PURE__*/jsxRuntimeExports.jsx("path", {
|
|
8702
|
+
var Handyman = createSvgIcon$1([/*#__PURE__*/jsxRuntimeExports.jsx("path", {
|
|
8254
8703
|
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"
|
|
8255
8704
|
}, "0"), /*#__PURE__*/jsxRuntimeExports.jsx("path", {
|
|
8256
8705
|
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"
|
|
8257
8706
|
}, "1")], 'Handyman');
|
|
8258
8707
|
|
|
8259
|
-
var Instagram = createSvgIcon( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
|
|
8708
|
+
var Instagram = createSvgIcon$1( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
|
|
8260
8709
|
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"
|
|
8261
8710
|
}), 'Instagram');
|
|
8262
8711
|
|
|
8263
|
-
var
|
|
8264
|
-
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"
|
|
8265
|
-
}), 'OpenInNew');
|
|
8266
|
-
|
|
8267
|
-
var PhoneEnabled = createSvgIcon( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
|
|
8712
|
+
var PhoneEnabled = createSvgIcon$1( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
|
|
8268
8713
|
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"
|
|
8269
8714
|
}), 'PhoneEnabled');
|
|
8270
8715
|
|
|
8271
|
-
var ThreeP = createSvgIcon( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
|
|
8716
|
+
var ThreeP = createSvgIcon$1( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
|
|
8272
8717
|
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"
|
|
8273
8718
|
}), 'ThreeP');
|
|
8274
8719
|
|
|
8275
|
-
var WhatsApp = createSvgIcon( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
|
|
8720
|
+
var WhatsApp = createSvgIcon$1( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
|
|
8276
8721
|
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"
|
|
8277
8722
|
}), 'WhatsApp');
|
|
8278
8723
|
|
|
8724
|
+
var ArrowForward = {};
|
|
8725
|
+
|
|
8726
|
+
var createSvgIcon = {};
|
|
8727
|
+
|
|
8728
|
+
var require$$0 = /*@__PURE__*/getAugmentedNamespace(utils);
|
|
8729
|
+
|
|
8730
|
+
var hasRequiredCreateSvgIcon;
|
|
8731
|
+
|
|
8732
|
+
function requireCreateSvgIcon () {
|
|
8733
|
+
if (hasRequiredCreateSvgIcon) return createSvgIcon;
|
|
8734
|
+
hasRequiredCreateSvgIcon = 1;
|
|
8735
|
+
(function (exports) {
|
|
8736
|
+
'use client';
|
|
8737
|
+
|
|
8738
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8739
|
+
value: true
|
|
8740
|
+
});
|
|
8741
|
+
Object.defineProperty(exports, "default", {
|
|
8742
|
+
enumerable: true,
|
|
8743
|
+
get: function () {
|
|
8744
|
+
return _utils.createSvgIcon;
|
|
8745
|
+
}
|
|
8746
|
+
});
|
|
8747
|
+
var _utils = require$$0;
|
|
8748
|
+
} (createSvgIcon));
|
|
8749
|
+
return createSvgIcon;
|
|
8750
|
+
}
|
|
8751
|
+
|
|
8752
|
+
var _interopRequireDefault$1 = interopRequireDefaultExports;
|
|
8753
|
+
Object.defineProperty(ArrowForward, "__esModule", {
|
|
8754
|
+
value: true
|
|
8755
|
+
});
|
|
8756
|
+
var default_1$1 = ArrowForward.default = void 0;
|
|
8757
|
+
var _createSvgIcon$1 = _interopRequireDefault$1(requireCreateSvgIcon());
|
|
8758
|
+
var _jsxRuntime$1 = jsxRuntimeExports;
|
|
8759
|
+
default_1$1 = ArrowForward.default = (0, _createSvgIcon$1.default)( /*#__PURE__*/(0, _jsxRuntime$1.jsx)("path", {
|
|
8760
|
+
d: "m12 4-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"
|
|
8761
|
+
}), 'ArrowForward');
|
|
8762
|
+
|
|
8763
|
+
var Message = {};
|
|
8764
|
+
|
|
8765
|
+
var _interopRequireDefault = interopRequireDefaultExports;
|
|
8766
|
+
Object.defineProperty(Message, "__esModule", {
|
|
8767
|
+
value: true
|
|
8768
|
+
});
|
|
8769
|
+
var default_1 = Message.default = void 0;
|
|
8770
|
+
var _createSvgIcon = _interopRequireDefault(requireCreateSvgIcon());
|
|
8771
|
+
var _jsxRuntime = jsxRuntimeExports;
|
|
8772
|
+
default_1 = Message.default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
8773
|
+
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"
|
|
8774
|
+
}), 'Message');
|
|
8775
|
+
|
|
8279
8776
|
const ButtonsContainer = styled$3(Box)(({ theme }) => ({
|
|
8280
8777
|
position: 'absolute',
|
|
8281
8778
|
top: 8,
|
|
8282
8779
|
right: 8,
|
|
8283
8780
|
display: 'flex',
|
|
8781
|
+
flexDirection: 'column',
|
|
8284
8782
|
gap: 4,
|
|
8285
8783
|
zIndex: 1,
|
|
8286
8784
|
//@ts-ignore
|
|
@@ -8294,6 +8792,7 @@ const HeaderContainer = styled$3(Box)({
|
|
|
8294
8792
|
flexDirection: 'column',
|
|
8295
8793
|
alignItems: 'center',
|
|
8296
8794
|
marginBottom: '16px',
|
|
8795
|
+
position: 'relative',
|
|
8297
8796
|
});
|
|
8298
8797
|
const ContactAvatar = styled$3(Avatar)({
|
|
8299
8798
|
width: 60,
|
|
@@ -8307,14 +8806,59 @@ const ContactName = styled$3(Typography)({
|
|
|
8307
8806
|
maxWidth: 200,
|
|
8308
8807
|
textAlign: 'center',
|
|
8309
8808
|
});
|
|
8310
|
-
const
|
|
8311
|
-
|
|
8312
|
-
|
|
8313
|
-
|
|
8314
|
-
|
|
8315
|
-
|
|
8316
|
-
|
|
8317
|
-
|
|
8809
|
+
const LoadingContainer = styled$3(Box)({
|
|
8810
|
+
display: 'flex',
|
|
8811
|
+
justifyContent: 'center',
|
|
8812
|
+
alignItems: 'center',
|
|
8813
|
+
width: 60,
|
|
8814
|
+
height: 60,
|
|
8815
|
+
marginBottom: 8,
|
|
8816
|
+
});
|
|
8817
|
+
const Header = ({ imgUrl, name, contactId, navigate, isLoading = false, onError, onClose, isBusiness }) => {
|
|
8818
|
+
const handleNavigation = useCallback((url) => (event) => {
|
|
8819
|
+
try {
|
|
8820
|
+
event.preventDefault();
|
|
8821
|
+
event.stopPropagation();
|
|
8822
|
+
if (!url) {
|
|
8823
|
+
throw new Error('Navigation URL is required');
|
|
8824
|
+
}
|
|
8825
|
+
const isNewTab = event.ctrlKey || event.metaKey || event.button === 1; // Ctrl+Click, Cmd+Click, Middle Mouse
|
|
8826
|
+
if (isNewTab) {
|
|
8827
|
+
window.open(url, '_blank', 'noopener,noreferrer');
|
|
8828
|
+
}
|
|
8829
|
+
else {
|
|
8830
|
+
navigate(url);
|
|
8831
|
+
}
|
|
8832
|
+
}
|
|
8833
|
+
catch (error) {
|
|
8834
|
+
onError?.(error instanceof Error ? error : new Error('Navigation failed'));
|
|
8835
|
+
}
|
|
8836
|
+
}, [navigate, onError]);
|
|
8837
|
+
const handleNavigateToContacts = handleNavigation(isBusiness
|
|
8838
|
+
? `/a/contacts/business/${contactId}`
|
|
8839
|
+
: `/a/contacts/contacts/${contactId}`);
|
|
8840
|
+
const handleNavigateToConversations = handleNavigation('/a/conversations/conversations');
|
|
8841
|
+
const displayName = name || 'Unknown Contact';
|
|
8842
|
+
const avatarAlt = `Avatar for ${displayName}`;
|
|
8843
|
+
return (jsxRuntimeExports.jsxs(HeaderContainer, { children: [jsxRuntimeExports.jsxs(ButtonsContainer, { children: [jsxRuntimeExports.jsx(SmallIconButton, { color: "info", size: "small", onClick: (e) => {
|
|
8844
|
+
handleNavigateToContacts(e);
|
|
8845
|
+
onClose();
|
|
8846
|
+
}, onMouseDown: (e) => {
|
|
8847
|
+
if (e.button === 1) {
|
|
8848
|
+
// Middle mouse button
|
|
8849
|
+
handleNavigateToContacts(e);
|
|
8850
|
+
onClose();
|
|
8851
|
+
}
|
|
8852
|
+
}, disabled: !contactId, "aria-label": "View contact details", children: jsxRuntimeExports.jsx(default_1$1, { fontSize: "small" }) }), jsxRuntimeExports.jsx(SmallIconButton, { color: "info", size: "small", onClick: (e) => {
|
|
8853
|
+
handleNavigateToConversations(e);
|
|
8854
|
+
onClose();
|
|
8855
|
+
}, onMouseDown: (e) => {
|
|
8856
|
+
if (e.button === 1) {
|
|
8857
|
+
// Middle mouse button
|
|
8858
|
+
handleNavigateToConversations(e);
|
|
8859
|
+
onClose();
|
|
8860
|
+
}
|
|
8861
|
+
}, "aria-label": "Go to conversations", children: jsxRuntimeExports.jsx(default_1, { fontSize: "small" }) })] }), isLoading ? (jsxRuntimeExports.jsx(LoadingContainer, { children: jsxRuntimeExports.jsx(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 })] }));
|
|
8318
8862
|
};
|
|
8319
8863
|
|
|
8320
8864
|
const Container$1 = styled$3(Box)({
|
|
@@ -14163,7 +14707,7 @@ const Container = styled$3(Box)({
|
|
|
14163
14707
|
alignItems: 'center',
|
|
14164
14708
|
gap: 8,
|
|
14165
14709
|
});
|
|
14166
|
-
const SectionTitle$
|
|
14710
|
+
const SectionTitle$3 = styled$3(Typography)({
|
|
14167
14711
|
borderBottom: `1px solid lightgray`,
|
|
14168
14712
|
width: '100%',
|
|
14169
14713
|
});
|
|
@@ -14221,7 +14765,105 @@ const Properties = ({ properties, title }) => {
|
|
|
14221
14765
|
}
|
|
14222
14766
|
return value;
|
|
14223
14767
|
};
|
|
14224
|
-
return (jsxRuntimeExports.jsxs(Container, { children: [jsxRuntimeExports.jsx(SectionTitle$
|
|
14768
|
+
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)))] }));
|
|
14769
|
+
};
|
|
14770
|
+
|
|
14771
|
+
const SectionTitle$2 = styled$3(Typography)({
|
|
14772
|
+
fontWeight: 'bold',
|
|
14773
|
+
marginBottom: '8px',
|
|
14774
|
+
marginTop: '16px',
|
|
14775
|
+
borderBottom: `1px solid lightgray`,
|
|
14776
|
+
});
|
|
14777
|
+
const TagContainer = styled$3(Box)({
|
|
14778
|
+
marginBottom: 16,
|
|
14779
|
+
});
|
|
14780
|
+
const StyledChip = styled$3(Chip)(({ theme }) => ({
|
|
14781
|
+
marginRight: 8,
|
|
14782
|
+
marginBottom: 8,
|
|
14783
|
+
backgroundColor: `${theme.palette.primary.main}b3`,
|
|
14784
|
+
}));
|
|
14785
|
+
const LabelsSection = ({ contactData, title }) => {
|
|
14786
|
+
if (!contactData)
|
|
14787
|
+
return null;
|
|
14788
|
+
if (!contactData.tags?.length)
|
|
14789
|
+
return null;
|
|
14790
|
+
return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(SectionTitle$2, { gutterBottom: true, mt: 2, variant: "subtitle1", children: title }), jsxRuntimeExports.jsx(TagContainer, { children: contactData?.tags
|
|
14791
|
+
?.filter((tag) => tag.name?.trim())
|
|
14792
|
+
.map((tag) => (jsxRuntimeExports.jsx(StyledChip, { label: tag.name, color: "primary", size: "small" }, tag.id))) })] }));
|
|
14793
|
+
};
|
|
14794
|
+
|
|
14795
|
+
/**
|
|
14796
|
+
* Type guard to check if an object is an IContact
|
|
14797
|
+
* @param obj The object to check
|
|
14798
|
+
* @returns True if the object is an IContact
|
|
14799
|
+
*/
|
|
14800
|
+
function isContact(obj) {
|
|
14801
|
+
return (obj !== null &&
|
|
14802
|
+
typeof obj === 'object' &&
|
|
14803
|
+
typeof obj.id === 'string' &&
|
|
14804
|
+
typeof obj.spaceId === 'string' &&
|
|
14805
|
+
typeof obj.name === 'string' &&
|
|
14806
|
+
typeof obj.firstName === 'string' &&
|
|
14807
|
+
typeof obj.lastName === 'string' &&
|
|
14808
|
+
Array.isArray(obj.phones) &&
|
|
14809
|
+
Array.isArray(obj.emails) &&
|
|
14810
|
+
'origin' in obj &&
|
|
14811
|
+
typeof obj.isSpam === 'boolean' &&
|
|
14812
|
+
(!obj.businessId || typeof obj.businessId === 'string'));
|
|
14813
|
+
}
|
|
14814
|
+
|
|
14815
|
+
const SectionTitle$1 = styled$3(Typography)({
|
|
14816
|
+
fontWeight: 'bold',
|
|
14817
|
+
marginBottom: '8px',
|
|
14818
|
+
marginTop: '16px',
|
|
14819
|
+
borderBottom: `1px solid lightgray`,
|
|
14820
|
+
});
|
|
14821
|
+
const BusinessSection = ({ contactData, title }) => {
|
|
14822
|
+
if (!contactData || !isContact(contactData))
|
|
14823
|
+
return null;
|
|
14824
|
+
return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(SectionTitle$1, { gutterBottom: true, mt: 2, variant: "subtitle1", children: title }), jsxRuntimeExports.jsx(Typography, { variant: "body2", color: "text.secondary", children: contactData?.businessName })] }));
|
|
14825
|
+
};
|
|
14826
|
+
|
|
14827
|
+
/**
|
|
14828
|
+
* Type guard to check if an object is an IBusiness
|
|
14829
|
+
* @param obj The object to check
|
|
14830
|
+
* @returns True if the object is an IBusiness
|
|
14831
|
+
*/
|
|
14832
|
+
function isBusiness(obj) {
|
|
14833
|
+
// Si el objeto tiene explícitamente la propiedad isBusiness como true, lo consideramos un negocio
|
|
14834
|
+
if (obj?.isBusiness === true) {
|
|
14835
|
+
return true;
|
|
14836
|
+
}
|
|
14837
|
+
// De lo contrario, realizamos las comprobaciones tradicionales
|
|
14838
|
+
return (obj !== null &&
|
|
14839
|
+
typeof obj === 'object' &&
|
|
14840
|
+
typeof obj.id === 'string' &&
|
|
14841
|
+
typeof obj.spaceId === 'string' &&
|
|
14842
|
+
typeof obj.name === 'string' &&
|
|
14843
|
+
Array.isArray(obj.membersId) &&
|
|
14844
|
+
Array.isArray(obj.members) &&
|
|
14845
|
+
Array.isArray(obj.phones) &&
|
|
14846
|
+
Array.isArray(obj.emails) &&
|
|
14847
|
+
typeof obj.imageUrl === 'string' &&
|
|
14848
|
+
!('firstName' in obj) &&
|
|
14849
|
+
!('lastName' in obj));
|
|
14850
|
+
}
|
|
14851
|
+
|
|
14852
|
+
// Components
|
|
14853
|
+
const MemberItem = ({ name }) => {
|
|
14854
|
+
return (jsxRuntimeExports.jsx(Typography, { variant: "body2", color: "text.secondary", children: name }));
|
|
14855
|
+
};
|
|
14856
|
+
|
|
14857
|
+
const SectionTitle = styled$3(Typography)({
|
|
14858
|
+
fontWeight: 'bold',
|
|
14859
|
+
marginBottom: '8px',
|
|
14860
|
+
marginTop: '16px',
|
|
14861
|
+
borderBottom: `1px solid lightgray`,
|
|
14862
|
+
});
|
|
14863
|
+
const MembersSection = ({ contactData, title }) => {
|
|
14864
|
+
if (!contactData || !isBusiness(contactData) || !contactData.members?.length)
|
|
14865
|
+
return null;
|
|
14866
|
+
return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(SectionTitle, { gutterBottom: true, mt: 2, variant: "subtitle1", children: title }), jsxRuntimeExports.jsx(Typography, { variant: "body2", color: "text.secondary", children: contactData?.members.map((member) => (jsxRuntimeExports.jsx(MemberItem, { name: member.name }, member.id))) })] }));
|
|
14225
14867
|
};
|
|
14226
14868
|
|
|
14227
14869
|
const PopupContainer = styled$3(Box)(({ theme }) => ({
|
|
@@ -14251,28 +14893,17 @@ const PopupContainer = styled$3(Box)(({ theme }) => ({
|
|
|
14251
14893
|
background: '#616161',
|
|
14252
14894
|
},
|
|
14253
14895
|
}));
|
|
14254
|
-
const
|
|
14255
|
-
fontWeight: 'bold',
|
|
14256
|
-
marginBottom: '8px',
|
|
14257
|
-
marginTop: '16px',
|
|
14258
|
-
borderBottom: `1px solid lightgray`,
|
|
14259
|
-
});
|
|
14260
|
-
const TagContainer = styled$3(Box)({
|
|
14261
|
-
marginBottom: 16,
|
|
14262
|
-
});
|
|
14263
|
-
const StyledChip = styled$3(Chip)(({ theme }) => ({
|
|
14264
|
-
marginRight: 8,
|
|
14265
|
-
marginBottom: 8,
|
|
14266
|
-
backgroundColor: `${theme.palette.primary.main}b3`
|
|
14267
|
-
}));
|
|
14268
|
-
const ContactInfoPopup = ({ open, anchorEl, onClose, contactData, avatarImgUrl, t = (key) => ({
|
|
14896
|
+
const ContactInfoPopup = ({ open, anchorEl, onClose, contactData, avatarImgUrl, navigate, t = (key) => ({
|
|
14269
14897
|
labels: 'Etiquetas',
|
|
14270
14898
|
phone: 'Teléfono',
|
|
14271
14899
|
business: 'Empresa',
|
|
14900
|
+
businessMembers: 'Miembros de la empresa',
|
|
14272
14901
|
properties: 'Propiedades',
|
|
14273
14902
|
view: 'Ver',
|
|
14274
|
-
|
|
14903
|
+
email: 'Correo Electrónico',
|
|
14275
14904
|
}[key] || key), }) => {
|
|
14905
|
+
const dataIsBusiness = isBusiness(contactData);
|
|
14906
|
+
const dataIsContact = isContact(contactData);
|
|
14276
14907
|
const contactMethods = [
|
|
14277
14908
|
{
|
|
14278
14909
|
icon: jsxRuntimeExports.jsx(PhoneEnabled, { fontSize: "small" }),
|
|
@@ -14282,7 +14913,7 @@ const ContactInfoPopup = ({ open, anchorEl, onClose, contactData, avatarImgUrl,
|
|
|
14282
14913
|
},
|
|
14283
14914
|
{
|
|
14284
14915
|
icon: jsxRuntimeExports.jsx(Email, { fontSize: "small" }),
|
|
14285
|
-
title: t('
|
|
14916
|
+
title: t('email'),
|
|
14286
14917
|
contactList: contactData?.emails || [],
|
|
14287
14918
|
showTitle: true,
|
|
14288
14919
|
},
|
|
@@ -14321,7 +14952,7 @@ const ContactInfoPopup = ({ open, anchorEl, onClose, contactData, avatarImgUrl,
|
|
|
14321
14952
|
window.removeEventListener('keydown', handleKeyDown);
|
|
14322
14953
|
};
|
|
14323
14954
|
}, [open, onClose]);
|
|
14324
|
-
return (jsxRuntimeExports.jsx(Popper, { sx: { zIndex: 1300 }, open: open, anchorEl: anchorEl, placement: "bottom-start", "data-popper-child": "true", children: jsxRuntimeExports.jsx(ClickAwayListener, { onClickAway: onClose, children: jsxRuntimeExports.jsx(PopupContainer, { children: jsxRuntimeExports.jsxs(CardContent, { children: [jsxRuntimeExports.jsx(Header, { contactId: contactData?.id, imgUrl: avatarImgUrl, name: contactData?.name
|
|
14955
|
+
return (jsxRuntimeExports.jsx(Popper, { sx: { zIndex: 1300 }, open: open, anchorEl: anchorEl, placement: "bottom-start", "data-popper-child": "true", children: jsxRuntimeExports.jsx(ClickAwayListener, { onClickAway: onClose, children: jsxRuntimeExports.jsx(PopupContainer, { children: jsxRuntimeExports.jsxs(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') })] }) }) }) }));
|
|
14325
14956
|
};
|
|
14326
14957
|
|
|
14327
14958
|
export { ContactInfoPopup, TestBox };
|