Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add decorators #5205

Merged
merged 31 commits into from
Jun 18, 2024
Merged

feat: Add decorators #5205

merged 31 commits into from
Jun 18, 2024

Conversation

OEvgeny
Copy link
Collaborator

@OEvgeny OEvgeny commented Jun 6, 2024

Fixes #

Changelog Entry

Added

  • (Experimental) Added initial decorators support, in PR #5205, by @OEvgeny
    • Introduced internal botframework-webchat-api/decorator import, in PR #5205, by @OEvgeny
    • Added DecoratorComposer and ActivityDecorator to be used for decorating activity border, in PR #5205, by @OEvgeny

Description

This adds a way to decorate various things in WebChat in the future. For now it supports activity decoration with a custom border.

Design

The design introduces decorators to WebChat. The current implementation includes support for activity decoration with custom border decorator.

Key components of the design:

  • ActivityBorderDecoratorMiddleware: Middleware stack for managing activity border changes
  • ActivityDecorator: A React component for decorating activities e.g. inside of the WebChat or activity middlewares
  • DecoratorComposer: Allows multiple decorators to be passed together and initialized according to the type of decorator
  • createDecoratorComposer: A factory function for creating decorator composer
  • ActivityDecoratorRequestType: Describes activity decorator request

Flow

  1. Users provide an array of middleware functions to DecoratorComposer
  2. The DecoratorComposer initializes these functions based on the decorators type
  3. When, for example, an activity is rendered, it passes the activity to the ActivityDecorator to form a request and process middlewars, which apply the appropriate changes

Specific Changes

  • added decorators for activity decoration
  • added ActivityBorder for activity decorators stack
  • added test
  • added example decorator implementation

-

  • I have added tests and executed them locally
  • I have updated CHANGELOG.md
  • I have updated documentation

Review Checklist

This section is for contributors to review your work.

  • Accessibility reviewed (tab order, content readability, alt text, color contrast)
  • Browser and platform compatibilities reviewed
  • CSS styles reviewed (minimal rules, no z-index)
  • Documents reviewed (docs, samples, live demo)
  • Internationalization reviewed (strings, unit formatting)
  • package.json and package-lock.json reviewed
  • Security reviewed (no data URIs, check for nonce leak)
  • Tests reviewed (coverage, legitimacy)

OEvgeny and others added 3 commits June 12, 2024 23:29
Co-authored-by: William Wong <compulim@users.noreply.github.com>
@OEvgeny OEvgeny requested a review from compulim June 13, 2024 00:43
@OEvgeny OEvgeny marked this pull request as ready for review June 14, 2024 18:03
@OEvgeny OEvgeny changed the title WIP: Add decorators feat: Add decorators Jun 14, 2024
This was referenced Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants