open-index/open-npm huggingface dataset:
npm package: @oak-digital/builder-helpers
Description: ## Install
Author: Oak Digital
Latest version: 0.1.0

# Builder.io helpers

## Install

```bash
npm i -D @oak-digital/builder-helpers
# or
pnpm add -D @oak-digital/builder-helpers
# or
yarn add -D @oak-digital/builder-helpers
```

## Infer props for a react component

With this library it is possible to infer the props for a react component from the component registration object to builder.
This means that you do not need to define the props for the react component as they can be inferred with a helper type.

You can use the helper type `RegisterObjectToProps` to get a type for the props of the react component based on the registration object for builder.

```ts
import { RegisterObjectToProps } from '@oak-digital/builder-helpers';
import { Component } from '@builder.io/sdk';
const registerObject = {
    inputs: [
        {
            name: 'text',
            type: 'string',
        },
    ];
} as const satisfies Component
type Props = RegisterObjectToProps<typeof registerObject>;
```

And then use `Props` as the props type for the component.

See the example below for how to make an existing component use this type helper.

<details>
    <summary>
        Here is an example with before and after:
    </summary>

**Before:**

```ts
// counter.tsx
type Props = {
    text: string;
};

const Counter = (props: Props) => {
    const [count, setCount] = React.useState(0);
    return (
        <button onClick={() => setCount(count + 1)}>
            {props.text}: {count}
        </button>
    )
};
export default Counter;
```

```ts
// builder-registry.ts
import Counter from './counter';
Builder.registerComponent(Counter, {
    name: 'Counter',
    inputs: [
        {
            name: 'text',
            type: 'string',
        },
    ];
});
```

**After:**

Since the props that the component needs is tightly coupled to the data from builder, we will be defining the builder registration object in the react component file.

```ts
// counter.tsx
import { Component } from '@builder.io/sdk';
import { RegisterObjectToProps } from '@oak-digital/builder-helpers';

export const counterRegisterObject = {
    name: 'Counter',
    inputs: [
        {
            name: 'text',
            type: 'string',
        },
    ];
} as const satisfies Component;

type Props = RegisterObjectToProps<typeof counterRegisterObject>;

const Counter = (props: Props) => {
    const [count, setCount] = React.useState(0);
    return (
        <button onClick={() => setCount(count + 1)}>
            {props.text}: {count}
        </button>
    )
};
export default Counter;
```

**NOTE** `as const` is required to make the type inference working correctly.<br />
**NOTE** `satisfies Component` gives you intelisense when writing the register object

```ts
// builder-registry.ts
import Counter, { counterRegisterObject } from './counter';
Builder.registerComponent(Counter, counterRegisterObject);
```
</details>
npm package: @oak-digital/customer-first-sdk
Description: SDK for CustomerFirst API
Author: Oak Digital
Latest version: 1.0.10

# CustomerFirst SDK

This SDK provides a convenient way to interact with the CustomerFirst API in JavaScript and TypeScript applications.

## Installation

Install the package using npm:

```bash
npm install customer-first-sdk
```

Or using yarn:

```bash
yarn add customer-first-sdk
```

## Usage

First, import the SDK in your project:

```javascript
import CustomerFirstAPI from "customer-first-sdk";
```

Then, initialize the API with your credentials:

```javascript
const api = new CustomerFirstAPI("your-api-key", "https://api.base.url");
```

Now you can use the various services provided by the SDK:

```javascript
// Example: Get a list of customers
const customers = await api.customers.getCustomers();

// Example: Create a new ticket
const newTicket = await api.tickets.createTicket({
  customerid: customer.content.id || 0, // Get the customer ID from the previous step
  assignee: 18400,
  workload: 1,
  storeid: 5737,
  status: TicketStatus.New,
  type: TicketType.Sale,
});
```

## Available Services

The SDK provides the following services:

- `customers`: Manage customer information
- `tickets`: Handle support tickets
- `products`: Manage product data
- `settings`: Configure API settings
- `users`: Manage user accounts
- `ticket tags`: Manage ticket tags

Each service provides methods for interacting with the corresponding API endpoints. Refer to the API documentation for detailed information on available methods and their parameters.

## TypeScript Support

This SDK is written in TypeScript and provides type definitions out of the box. You can enjoy full IntelliSense and type checking in TypeScript projects.

## Error Handling

The SDK uses Promise-based error handling. Wrap your API calls in try-catch blocks to handle any errors:

```javascript
try {
  const result = await api.customers.getCustomer("non-existent-id");
} catch (error) {
  console.error("An error occurred:", error.message);
}
```

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

## License

This project is licensed under the MIT License - see the LICENSE file for details.