@mobilon-dev/chotto 0.3.77 → 0.3.79

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.
@@ -13,6 +13,8 @@ declare const _default: import("vue").DefineComponent<{}, {
13
13
  attributeTooltips: Record<string, any>;
14
14
  attributeIndicatorTooltips: Record<string, any>;
15
15
  showChannelIcons: boolean;
16
+ channelOrder?: unknown[] | undefined;
17
+ visibleChannelTypes?: unknown[] | undefined;
16
18
  $props: {
17
19
  readonly channels?: unknown[] | undefined;
18
20
  readonly messages?: unknown[] | undefined;
@@ -27,6 +29,8 @@ declare const _default: import("vue").DefineComponent<{}, {
27
29
  readonly attributeTooltips?: Record<string, any> | undefined;
28
30
  readonly attributeIndicatorTooltips?: Record<string, any> | undefined;
29
31
  readonly showChannelIcons?: boolean | undefined;
32
+ readonly channelOrder?: unknown[] | undefined;
33
+ readonly visibleChannelTypes?: unknown[] | undefined;
30
34
  };
31
35
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
32
36
  export default _default;
@@ -1,4 +1,5 @@
1
1
  import { type Ref, type ComputedRef } from 'vue';
2
+ import { type ChannelType } from './useCommunicationChannels';
2
3
  /** Допустимые статусы контактного атрибута */
3
4
  export declare const CONTACT_ATTRIBUTE_STATUSES: readonly ["confirmed", "unconfirmed"];
4
5
  export type ContactAttributeStatus = (typeof CONTACT_ATTRIBUTE_STATUSES)[number];
@@ -54,11 +55,12 @@ type MaybeRef<T> = T | Ref<T> | ComputedRef<T>;
54
55
  /**
55
56
  * Параметры composable для работы с контактными атрибутами.
56
57
  */
58
+ type PanelChannelTypesRef = MaybeRef<readonly ChannelType[]>;
57
59
  interface UseCommunicationAttributesOptions {
58
60
  /** Реактивный список контактных атрибутов */
59
61
  contactAttributes: MaybeRef<ContactAttribute[]>;
60
- /** Текущий активный тип канала */
61
- activeChannelType: Ref<string | null>;
62
+ /** Типы каналов, отображаемые в панели */
63
+ panelChannelTypes: PanelChannelTypesRef;
62
64
  /** Текущий замороженный атрибут (подсвеченный) */
63
65
  frozenAttribute: Ref<{
64
66
  id?: string;
@@ -67,7 +69,7 @@ interface UseCommunicationAttributesOptions {
67
69
  /**
68
70
  * Формирует структуру организованных атрибутов.
69
71
  */
70
- export declare function useCommunicationAttributes({ contactAttributes, frozenAttribute, }: UseCommunicationAttributesOptions): {
72
+ export declare function useCommunicationAttributes({ contactAttributes, panelChannelTypes, frozenAttribute, }: UseCommunicationAttributesOptions): {
71
73
  organizedContactAttributes: Ref<Record<string, ContactAttribute[]>, Record<string, ContactAttribute[]>>;
72
74
  organizeContactAttributes: () => void;
73
75
  isAttributeFrozen: (attribute: ContactAttribute | null | undefined) => boolean;
@@ -1,9 +1,17 @@
1
1
  import { type Component, type ComputedRef, type Ref } from 'vue';
2
2
  /**
3
- * Список поддерживаемых типов каналов в панели коммуникаций.
3
+ * Все поддерживаемые типы каналов в панели коммуникаций.
4
4
  */
5
5
  export declare const CHANNEL_TYPES: readonly ["whatsapp", "telegram", "max", "sms", "phone"];
6
6
  export type ChannelType = (typeof CHANNEL_TYPES)[number];
7
+ /** Порядок кнопок каналов по умолчанию. */
8
+ export declare const DEFAULT_CHANNEL_ORDER: readonly ChannelType[];
9
+ export declare function isChannelType(value: string): value is ChannelType;
10
+ /**
11
+ * Собирает итоговый список типов для панели: порядок из channelOrder, видимость из visibleChannelTypes.
12
+ * Типы из visibleChannelTypes, отсутствующие в channelOrder, добавляются в конце.
13
+ */
14
+ export declare function resolvePanelChannelTypes(channelOrder: readonly string[] | undefined, visibleChannelTypes: readonly string[] | undefined): ChannelType[];
7
15
  /**
8
16
  * Базовое описание канала.
9
17
  */
@@ -16,15 +24,21 @@ type MaybeRef<T> = T | Ref<T> | ComputedRef<T>;
16
24
  type ChannelTooltips = Record<string, string>;
17
25
  type ChannelsRef = MaybeRef<Channel[]>;
18
26
  type ChannelTooltipsRef = MaybeRef<ChannelTooltips | undefined>;
27
+ type ChannelTypesRef = MaybeRef<readonly string[] | undefined>;
19
28
  interface UseCommunicationChannelsOptions {
20
29
  /** Реактивный список каналов */
21
30
  channels: ChannelsRef;
22
31
  /** Реактивная карта пользовательских подсказок */
23
32
  channelTooltips?: ChannelTooltipsRef;
33
+ /** Порядок кнопок каналов в панели */
34
+ channelOrder?: ChannelTypesRef;
35
+ /** Типы каналов, которые нужно отображать (с бэка — доступные пользователю) */
36
+ visibleChannelTypes?: ChannelTypesRef;
24
37
  /** Текущий выбранный тип канала */
25
38
  selectedChannelType: Ref<string | null>;
26
39
  }
27
- export declare function useCommunicationChannels({ channels, channelTooltips, selectedChannelType }: UseCommunicationChannelsOptions): {
40
+ export declare function useCommunicationChannels({ channels, channelTooltips, channelOrder, visibleChannelTypes, selectedChannelType, }: UseCommunicationChannelsOptions): {
41
+ panelChannelTypes: ComputedRef<("phone" | "whatsapp" | "telegram" | "sms" | "max")[]>;
28
42
  channelsTypes: ComputedRef<{
29
43
  type: "phone" | "whatsapp" | "telegram" | "sms" | "max";
30
44
  component: Component;
@@ -16,6 +16,8 @@ declare const meta: {
16
16
  attributeTooltips: Record<string, any>;
17
17
  attributeIndicatorTooltips: Record<string, any>;
18
18
  showChannelIcons: boolean;
19
+ channelOrder?: unknown[] | undefined;
20
+ visibleChannelTypes?: unknown[] | undefined;
19
21
  $props: {
20
22
  readonly channels?: unknown[] | undefined;
21
23
  readonly messages?: unknown[] | undefined;
@@ -30,6 +32,8 @@ declare const meta: {
30
32
  readonly attributeTooltips?: Record<string, any> | undefined;
31
33
  readonly attributeIndicatorTooltips?: Record<string, any> | undefined;
32
34
  readonly showChannelIcons?: boolean | undefined;
35
+ readonly channelOrder?: unknown[] | undefined;
36
+ readonly visibleChannelTypes?: unknown[] | undefined;
33
37
  };
34
38
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
35
39
  args: {};
@@ -37,4 +41,8 @@ declare const meta: {
37
41
  export default meta;
38
42
  type Story = StoryObj<typeof meta>;
39
43
  export declare const Default: Story;
44
+ /** Только телефон — без мессенджеров (нет доступных каналов связи). */
45
+ export declare const PhoneOnly: Story;
46
+ /** Доступны только WhatsApp и Telegram, свой порядок. */
47
+ export declare const LimitedMessengers: Story;
40
48
  export declare const InteractiveWithFeed: Story;
@@ -446,6 +446,8 @@ export interface CommunicationPanelThemeCSSVariables {
446
446
  '--chotto-communicationpanel-blocked-indicator-display': string;
447
447
  /** Радиус маркера blocked */
448
448
  '--chotto-communicationpanel-blocked-indicator-border-radius': string;
449
+ /** Фон маркера blocked (прозрачный — только зона для тултипа) */
450
+ '--chotto-communicationpanel-blocked-indicator-mark-background': string;
449
451
  /** Прозрачность маркера blocked */
450
452
  '--chotto-communicationpanel-blocked-indicator-opacity': string;
451
453
  /** Цвет спиннера подтверждения атрибута */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mobilon-dev/chotto",
3
- "version": "0.3.77",
3
+ "version": "0.3.79",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",