0.1.128 • Published 8 months ago

@descope/access-key-management-widget v0.1.128

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

@descope/access-key-management-widget

Setup

Create an .env file

In the widget package create an .env file which includes;

DESCOPE_BASE_URL=   # env base url, default: "https://app.descope.com"
DESCOPE_PROJECT_ID= # your Descope's project ID
DESCOPE_TENANT=     # tenant ID
DEBUG_MODE=         # "true" / "false", default: "false"
DESCOPE_THEME=      # "light" / "dark" / "os", default: "light"
DESCOPE_WIDGET_ID=  # default: "access-key-management-widget"

Example

// replace x.x.x with the latest release of the widget: https://www.npmjs.com/package/@descope/access-key-management-widget
<script src="https://static.descope.com/npm/@descope/access-key-management-widget@x.x.x/dist/index.js"></script>
<descope-access-key-management-widget
  base-url="<DESCOPE_BASE_URL>"
  project-id="<DESCOPE_PROJECT_ID>"
  tenant="<DESCOPE_TENANT>"
  debug="<DEBUG_MODE>"
  theme="<DESCOPE_THEME>"
  widget-id="<DESCOPE_WIDGET_ID>"
></descope-access-key-management-widget>

Use widget-id access-key-management-widget for admin view, to manage all tenant users' access keys.

Use widget-id user-access-key-management-widget for user view, to mange access key for the logged-in tenant's user.

Start the widget

run npm start to start the widget.

Authenticate

In order to work with the widget, you must be logged in as the tenant admin In case you are not authenticated, a login flow will run first, and after logging in, the widget will be rendered

Project Structure

  • /app - contains index.html
  • /lib - widget's source code
  • lib/widget - widget related implementations
  • lib/widget/api - Logic related to API calls
  • lib/widget/mixins - Widget specific logic
  • lib/widget/state - State management logic

API


Mixins

The widget is composed of mixins, each mixin contains specific logic parts, and sometime exposes an API that can be used in other mixins.

Mixins can be composed on top of each other, so we can create new mixins by composing several mixins together.

Mixins Creators

Functions that create mixins, can get a configuration, and returns the mixin functions.

Singleton Mixin

Since mixins are composable, in some cases we want to make sure a mixin is loaded only once. For example: When there is no need for its logic to run multiple times when composed in different mixins.

For this case we have a wrapper function (createSingletonMixin) to ensure that a mixin is loaded only once, regardless how many times it will be composed.

Mixins should be wrapped with the createSingletonMixin wrapper function, unless there is a reason for running the mixin's logic multiple times.

State

We're using several tools to handle the widget's state:

  • Redux Toolkit for the widget's state management.
  • Redux Thunk for API calls and async operations we're using
  • Reselect to compute derived data without hitting performance or triggering state recalculation when state is not mutated.

Drivers

An abstraction layer that provides an API for components, and enables handling interactions with components within the widget.

The motivation to use drivers is to decouple the widget's code from the component's implementation, and therefore it's important to interact with components only using drivers (and not relying on component's implementation details).

Dev

Use mock screens

Since screen are fetched dynamically, when developing a new screen for the widget you will probably want to use mock templates. To do so, simply replace the call to fetchWidgetPage with a string which includes your HTML.

0.1.128

8 months ago

0.1.127

8 months ago

0.1.126

8 months ago

0.1.125

9 months ago

0.1.124

9 months ago

0.1.123

10 months ago

0.1.122

10 months ago

0.1.121

10 months ago

0.1.120

10 months ago

0.1.119

10 months ago

0.1.118

11 months ago

0.1.117

11 months ago

0.1.114

11 months ago

0.1.113

12 months ago

0.1.116

11 months ago

0.1.115

11 months ago

0.1.110

12 months ago

0.1.112

12 months ago

0.1.111

12 months ago

0.1.96

1 year ago

0.1.97

1 year ago

0.1.98

1 year ago

0.1.99

1 year ago

0.1.90

1 year ago

0.1.91

1 year ago

0.1.92

1 year ago

0.1.93

1 year ago

0.1.94

1 year ago

0.1.95

1 year ago

0.1.85

1 year ago

0.1.86

1 year ago

0.1.87

1 year ago

0.1.88

1 year ago

0.1.89

1 year ago

0.1.80

1 year ago

0.1.81

1 year ago

0.1.82

1 year ago

0.1.83

1 year ago

0.1.84

1 year ago

0.1.74

1 year ago

0.1.75

1 year ago

0.1.76

1 year ago

0.1.77

1 year ago

0.1.78

1 year ago

0.1.79

1 year ago

0.1.70

1 year ago

0.1.71

1 year ago

0.1.72

1 year ago

0.1.73

1 year ago

0.1.66

1 year ago

0.1.67

1 year ago

0.1.68

1 year ago

0.1.69

1 year ago

0.1.107

12 months ago

0.1.106

12 months ago

0.1.109

12 months ago

0.1.108

12 months ago

0.1.103

12 months ago

0.1.102

12 months ago

0.1.105

12 months ago

0.1.104

12 months ago

0.1.101

12 months ago

0.1.100

1 year ago

0.1.65

1 year ago

0.1.63

1 year ago

0.1.64

1 year ago

0.1.62

1 year ago

0.1.61

1 year ago

0.1.60

1 year ago

0.1.59

1 year ago

0.1.58

1 year ago

0.1.57

1 year ago

0.1.56

1 year ago

0.1.55

1 year ago

0.1.54

1 year ago

0.1.53

1 year ago

0.1.52

1 year ago

0.1.51

1 year ago

0.1.50

1 year ago

0.1.49

1 year ago

0.1.48

1 year ago

0.1.47

1 year ago

0.1.46

1 year ago

0.1.45

1 year ago

0.1.44

1 year ago

0.1.41

1 year ago

0.1.42

1 year ago

0.1.43

1 year ago

0.1.40

1 year ago

0.1.39

1 year ago

0.1.37

1 year ago

0.1.38

1 year ago

0.1.36

1 year ago

0.1.34

1 year ago

0.1.35

1 year ago

0.1.33

1 year ago

0.1.32

1 year ago

0.1.31

1 year ago

0.1.30

1 year ago

0.1.27

1 year ago

0.1.28

1 year ago

0.1.29

1 year ago

0.1.26

1 year ago

0.1.25

1 year ago

0.1.24

1 year ago

0.1.23

1 year ago

0.1.22

1 year ago

0.1.21

1 year ago

0.1.20

1 year ago

0.1.11

1 year ago

0.1.12

1 year ago

0.1.13

1 year ago

0.1.14

1 year ago

0.1.15

1 year ago

0.1.16

1 year ago

0.1.17

1 year ago

0.1.18

1 year ago

0.1.19

1 year ago

0.1.10

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.9

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago