1.7.0 • Published 20 hours ago

buttonize v1.7.0

Weekly downloads
8
License
MIT
Repository
github
Last release
20 hours ago

Buttonize enables you to build internals tools with AWS CDK.

Hook-up UI components directly to AWS Lambda functions. Just install Buttonize and deploy your CDK. That's it.

Getting started

Installation

  1. Sign-up at buttonize.io
  2. $ npm i -D buttonize
  3. Create your first Buttonize App :tada:

Example

// MyStack.ts

import * as path from 'path'
import { Stack, StackProps } from 'aws-cdk-lib'
import { NodejsFunction } from 'aws-cdk-lib/aws-lambda-nodejs'
import { Action, Buttonize, ButtonizeApp, Display, Input } from '@buttonize/cdk'
import { Construct } from 'constructs'

export class MyStack extends cdk.Stack {
  constructor(scope: Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props)

    Buttonize.init(this, {
      apiKey: 'btnz_mybuttonizekey1234567',
      externalId: 'this-is-super-secret-99'
    })

    const discountGenerator = new NodejsFunction(this, 'DiscountGenerator', {
      entry: path.join(__dirname, 'discountGenerator.ts')
    })

    new ButtonizeApp(this, 'DemoApp', {
      name: 'Discount code generator',
      description:
        'Select the discount amount and you will get the discount code on the next page.'
    })
      .page('InputPage', {
        body: [
          Display.heading('Generate discount code for customer'),
          Input.select({
            id: 'discount',
            label: 'Discount value',
            options: [
              { label: '30%', value: 30 },
              { label: '60%', value: 60 }
            ]
          }),
          Display.button({
            label: 'Generate discount',
            onClick: Action.aws.lambda.invoke(
              discountGenerator,
              { Payload: { discountValue: '{{discount}}' } },
              { id: 'discountGenerator' }
            ),
            onClickFinished: Action.buttonize.app.changePage('DonePage')
          })
        ]
      })
      .page('DonePage', {
        body: [
          Display.heading('Discount generated'),
          Display.text('Discount code: {{InputPage.discountGenerator.code}}')
        ]
      })
  }
}
// discountGenerator.ts

export const handler = async (event: { discountValue: number }) => {
  console.log(`Generating discount of value ${event.discountValue}`)

  return {
    discountValue: event.discountValue,
    code: `${Math.random()}`.split('.')[1]
  }
}

Result


Buttonize Docs

Learn more at docs.buttonize.io


Join our community Discord | Twitter

1.8.0-next.10

20 hours ago

1.8.0-next.9

21 hours ago

1.8.0-next.8

2 days ago

1.8.0-next.7

3 days ago

1.8.0-next.6

3 days ago

1.8.0-next.4

3 days ago

1.8.0-next.5

3 days ago

1.8.0-next.3

5 days ago

1.8.0-next.2

6 days ago

1.7.0

8 days ago

1.8.0-next.1

8 days ago

1.7.0-next.6

16 days ago

1.7.0-next.7

15 days ago

1.7.0-next.4

16 days ago

1.7.0-next.5

16 days ago

1.3.0-next.19

17 days ago

1.7.0-next.1

17 days ago

1.7.0-next.2

17 days ago

1.7.0-next.3

17 days ago

1.3.0-next.18

18 days ago

1.3.0-next.17

18 days ago

1.3.0-next.16

18 days ago

1.3.0-next.14

21 days ago

1.3.0-next.15

21 days ago

1.3.0-next.13

22 days ago

1.3.0-next.12

22 days ago

1.6.0

25 days ago

1.3.0-next.11

25 days ago

1.3.0-next.10

29 days ago

1.5.2

29 days ago

1.4.2

1 month ago

1.3.0-next.7

1 month ago

1.3.0-next.8

1 month ago

1.3.0-next.9

1 month ago

1.5.1

1 month ago

1.5.0

1 month ago

1.4.1

1 month ago

1.4.0

1 month ago

1.3.1

1 month ago

1.3.0

1 month ago

1.3.0-next.2

1 month ago

1.3.0-next.3

1 month ago

1.3.0-next.4

1 month ago

1.3.0-next.5

1 month ago

1.3.0-next.1

1 month ago

1.3.0-next.6

1 month ago

1.2.1

1 month ago

1.2.1-next.1

1 month ago

1.2.0

2 months ago

1.1.2

2 months ago

1.1.1

2 months ago

1.1.1-next.2

2 months ago

1.0.1-next.1

2 months ago

1.1.1-next.1

2 months ago

1.1.0

2 months ago

1.0.0-next.1

2 months ago

0.5.0

2 months ago

0.5.0-next.1

3 months ago

0.4.1-next.1

3 months ago

0.4.0

3 months ago

0.1.2-next.2

3 months ago

0.1.4-next.1

3 months ago

0.1.3-next.1

3 months ago

0.2.1-next.1

3 months ago

0.2.1-next.2

3 months ago

0.3.0-next.2

3 months ago

0.3.0-next.1

3 months ago

0.3.0

3 months ago

0.1.2

3 months ago

0.3.0-next.3

3 months ago

0.2.0

3 months ago

0.3.1-next.1

3 months ago

0.1.3

3 months ago

0.4.0-next.1

3 months ago

0.1.0

3 months ago

0.1.2-next.1

3 months ago

0.1.1-next.1

3 months ago

0.1.1

3 months ago

1.0.2

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago