Module intercom_python_sdk.canvas.components

Expand source code
from typing import List, Optional
from dataclasses import dataclass, field
from enum import Enum


DEFAULT_SUBMIT_TEXT = "Submit"


class ActionType(Enum):
    SUBMIT = "submit"
    URL = "url"
    SHEET = "sheet"


class SpacerSize(Enum):
    EXTRA_SMALL = "xs"
    SMALL = "s"
    MEDIUM = "m"
    LARGE = "l"
    EXTRA_LARGE = "xl"


class TextStyle(Enum):
    HEADER = "header"
    MUTED = "muted"
    PARAGRAPH = "paragraph"
    ERROR = "error"


class TextAlign(Enum):
    LEFT = "left"
    CENTER = "center"
    RIGHT = "right"


class ButtonStyle(Enum):
    PRIMARY = "primary"
    SECONDARY = "secondary"
    LINK = "link"


@dataclass
class InputParameters:
    """
    This class is used to configure an input component.

    References:
    https://developers.intercom.com/docs/references/canvas-kit/interactivecomponents/input/#parameters
    """

    id: str
    label: str = "label"
    placeholder: Optional[str] = None
    value: Optional[str] = None
    disabled: bool = False


@dataclass
class TextParameters:
    """
    This class is used to configure a text component.

    References:
    https://developers.intercom.com/docs/references/canvas-kit/presentationcomponents/text/#parameters
    """

    id: Optional[str] = None
    text: str = "text"
    style: TextStyle = TextStyle.PARAGRAPH
    align: TextAlign = TextAlign.LEFT


@dataclass
class OptionParameters:
    """
    This class is used to configure an option component.

    References:
    https://developers.intercom.com/docs/references/canvas-kit/interactivecomponents/dropdown/#dropdown-parameters
    """

    id: Optional[str]
    text: str = "text"
    disabled: bool = False


@dataclass
class DropdownParameters:
    """
    This class is used to configure a dropdown component.

    References:
    https://developers.intercom.com/docs/references/canvas-kit/interactivecomponents/dropdown/#dropdown-parameters
    """

    id: str
    options: List[OptionParameters]
    label: str = "label"
    value: Optional[str] = None
    disabled: bool = False


@dataclass
class ActionParameters:
    """
    This class is used to configure an action component. It has three types: submit, url, and sheet.

    References:
    https://developers.intercom.com/docs/references/canvas-kit/actioncomponents/submit-action/#parameters
    https://developers.intercom.com/docs/references/canvas-kit/actioncomponents/url-action/#parameters
    https://developers.intercom.com/docs/references/canvas-kit/actioncomponents/sheets-action/
    """

    type: ActionType = ActionType.SUBMIT
    url: Optional[str] = None


@dataclass
class ButtonParameters:
    """
    This class is used to configure a button component.

    References:
    https://developers.intercom.com/docs/references/canvas-kit/interactivecomponents/button/#parameters
    """

    id: str
    label: str = "label"
    disabled: bool = False
    style: ButtonStyle = ButtonStyle.PRIMARY
    action: ActionParameters = field(default_factory=lambda: ActionParameters())


@dataclass
class SpacerParameters:
    id: Optional[str] = None
    size: SpacerSize = SpacerSize.MEDIUM

Classes

class ActionParameters (type: ActionType = ActionType.SUBMIT, url: Optional[str] = None)
Expand source code
@dataclass
class ActionParameters:
    """
    This class is used to configure an action component. It has three types: submit, url, and sheet.

    References:
    https://developers.intercom.com/docs/references/canvas-kit/actioncomponents/submit-action/#parameters
    https://developers.intercom.com/docs/references/canvas-kit/actioncomponents/url-action/#parameters
    https://developers.intercom.com/docs/references/canvas-kit/actioncomponents/sheets-action/
    """

    type: ActionType = ActionType.SUBMIT
    url: Optional[str] = None

Class variables

var typeActionType
var url : Optional[str]
class ActionType (value, names=None, *, module=None, qualname=None, type=None, start=1)

An enumeration.

Expand source code
class ActionType(Enum):
    SUBMIT = "submit"
    URL = "url"
    SHEET = "sheet"

Ancestors

  • enum.Enum

Class variables

var SHEET
var SUBMIT
var URL
class ButtonParameters (id: str, label: str = 'label', disabled: bool = False, style: ButtonStyle = ButtonStyle.PRIMARY, action: ActionParameters = <factory>)
Expand source code
@dataclass
class ButtonParameters:
    """
    This class is used to configure a button component.

    References:
    https://developers.intercom.com/docs/references/canvas-kit/interactivecomponents/button/#parameters
    """

    id: str
    label: str = "label"
    disabled: bool = False
    style: ButtonStyle = ButtonStyle.PRIMARY
    action: ActionParameters = field(default_factory=lambda: ActionParameters())

Class variables

var actionActionParameters
var disabled : bool
var id : str
var label : str
var styleButtonStyle
class ButtonStyle (value, names=None, *, module=None, qualname=None, type=None, start=1)

An enumeration.

Expand source code
class ButtonStyle(Enum):
    PRIMARY = "primary"
    SECONDARY = "secondary"
    LINK = "link"

Ancestors

  • enum.Enum

Class variables

var PRIMARY
var SECONDARY
class DropdownParameters (id: str, options: List[OptionParameters], label: str = 'label', value: Optional[str] = None, disabled: bool = False)
Expand source code
@dataclass
class DropdownParameters:
    """
    This class is used to configure a dropdown component.

    References:
    https://developers.intercom.com/docs/references/canvas-kit/interactivecomponents/dropdown/#dropdown-parameters
    """

    id: str
    options: List[OptionParameters]
    label: str = "label"
    value: Optional[str] = None
    disabled: bool = False

Class variables

var disabled : bool
var id : str
var label : str
var options : List[OptionParameters]
var value : Optional[str]
class InputParameters (id: str, label: str = 'label', placeholder: Optional[str] = None, value: Optional[str] = None, disabled: bool = False)
Expand source code
@dataclass
class InputParameters:
    """
    This class is used to configure an input component.

    References:
    https://developers.intercom.com/docs/references/canvas-kit/interactivecomponents/input/#parameters
    """

    id: str
    label: str = "label"
    placeholder: Optional[str] = None
    value: Optional[str] = None
    disabled: bool = False

Class variables

var disabled : bool
var id : str
var label : str
var placeholder : Optional[str]
var value : Optional[str]
class OptionParameters (id: Optional[str], text: str = 'text', disabled: bool = False)
Expand source code
@dataclass
class OptionParameters:
    """
    This class is used to configure an option component.

    References:
    https://developers.intercom.com/docs/references/canvas-kit/interactivecomponents/dropdown/#dropdown-parameters
    """

    id: Optional[str]
    text: str = "text"
    disabled: bool = False

Class variables

var disabled : bool
var id : Optional[str]
var text : str
class SpacerParameters (id: Optional[str] = None, size: SpacerSize = SpacerSize.MEDIUM)

SpacerParameters(id: Optional[str] = None, size: intercom_python_sdk.canvas.components.SpacerSize = )

Expand source code
@dataclass
class SpacerParameters:
    id: Optional[str] = None
    size: SpacerSize = SpacerSize.MEDIUM

Class variables

var id : Optional[str]
var sizeSpacerSize
class SpacerSize (value, names=None, *, module=None, qualname=None, type=None, start=1)

An enumeration.

Expand source code
class SpacerSize(Enum):
    EXTRA_SMALL = "xs"
    SMALL = "s"
    MEDIUM = "m"
    LARGE = "l"
    EXTRA_LARGE = "xl"

Ancestors

  • enum.Enum

Class variables

var EXTRA_LARGE
var EXTRA_SMALL
var LARGE
var MEDIUM
var SMALL
class TextAlign (value, names=None, *, module=None, qualname=None, type=None, start=1)

An enumeration.

Expand source code
class TextAlign(Enum):
    LEFT = "left"
    CENTER = "center"
    RIGHT = "right"

Ancestors

  • enum.Enum

Class variables

var CENTER
var LEFT
var RIGHT
class TextParameters (id: Optional[str] = None, text: str = 'text', style: TextStyle = TextStyle.PARAGRAPH, align: TextAlign = TextAlign.LEFT)
Expand source code
@dataclass
class TextParameters:
    """
    This class is used to configure a text component.

    References:
    https://developers.intercom.com/docs/references/canvas-kit/presentationcomponents/text/#parameters
    """

    id: Optional[str] = None
    text: str = "text"
    style: TextStyle = TextStyle.PARAGRAPH
    align: TextAlign = TextAlign.LEFT

Class variables

var alignTextAlign
var id : Optional[str]
var styleTextStyle
var text : str
class TextStyle (value, names=None, *, module=None, qualname=None, type=None, start=1)

An enumeration.

Expand source code
class TextStyle(Enum):
    HEADER = "header"
    MUTED = "muted"
    PARAGRAPH = "paragraph"
    ERROR = "error"

Ancestors

  • enum.Enum

Class variables

var ERROR
var HEADER
var MUTED
var PARAGRAPH