open-index/open-npm huggingface dataset:
npm package: @ottoafrica/customer-sdk-js
Description: Customer-facing browser SDK for Otto loyalty interactions
Latest version: 0.1.3

# @ottoafrica/customer-sdk-js

Customer-facing JavaScript SDK for Otto loyalty interactions.

## Install

```bash
npm install @ottoafrica/customer-sdk-js
```

## Quick start

```js
import { OttoCustomerSdk } from "@ottoafrica/customer-sdk-js";

const sdk = new OttoCustomerSdk({
  baseUrl: "https://api.ottoafrica.com",
  clientToken: "<client-token>",
  onTokenExpiring: async () => {
    // fetch a fresh token from your backend
    return "<new-client-token>";
  }
});

const member = await sdk.lookupMember("ABCD-EFGH-IJKL");
console.log(member);
```

## API

- `lookupMember(memberCode)`
- `listPrograms()`
- `getProgram(programId)`
- `listRewards(programId)`
- `recordActivity(payload)`
- `trackTrigger(eventName, payload)`
- `redeemReward(rewardId, payload?)`

## Error handling

Methods throw an `Error` with:

- `httpStatus` (number)
- `details` (parsed error response when available)

## Versioning

This package follows semantic versioning.
npm package: @ottoafrica/events-sdk-node
Description: Merchant backend SDK for Otto loyalty/gift-card trigger events
Latest version: 0.1.3

# @ottoafrica/events-sdk-node

Merchant/backend SDK for Otto loyalty and gift-card trigger events.

## Installation

```bash
npm install @ottoafrica/events-sdk-node
```

## Quick start

```js
import { OttoEventsSdk } from "@ottoafrica/events-sdk-node";

const sdk = new OttoEventsSdk({
  baseUrl: "https://api.ottoafrica.com",
  apiKey: process.env.OTTO_API_KEY
});

const programs = await sdk.getPrograms();
console.log(programs);
```

## Usage

```js
await sdk.lookupMember("ABCD-EFGH-IJKL");
await sdk.recordActivity({
  member_code: "ABCD-EFGH-IJKL",
  amount: 100,
  activity_type: "GIFT_CARD_PURCHASE"
});
```

## API methods

- `trackTrigger(eventName, payload)`
- `lookupMember(memberCode)`
- `getPrograms()`
- `getProgram(programId)`
- `enrollMember(programId, identifier)`
- `recordActivity(payload)`
- `listRewards(programId)`
- `issueGiftCard(payload)`
- `claimGiftCard(token)`
- `mintClientToken(payload)`

## Error handling

On non-2xx responses, SDK throws an `Error` with:

- `error.message`
- `error.httpStatus`
- `error.details` (server payload when available)

## Support

- API base URL (production): `https://api.ottoafrica.com`
- Contract reference: `docs/openapi-loyalty-sdk-v1.json`
npm package: @ottoafrica/loyalty-popup-widget
Description: Drop-in popup widget for customer loyalty and gift-card actions
Latest version: 0.1.3

# @ottoafrica/loyalty-popup-widget

Drop-in popup helper for Otto loyalty interactions in browser apps.

## Install

```bash
npm install @ottoafrica/loyalty-popup-widget
```

## Usage

```js
import { openOttoLoyaltyPopup } from "@ottoafrica/loyalty-popup-widget";
import { OttoCustomerSdk } from "@ottoafrica/customer-sdk-js";

const customerSdk = new OttoCustomerSdk({
  baseUrl: "https://api.ottoafrica.com",
  clientToken: "<client-token>"
});

openOttoLoyaltyPopup({
  memberCode: "ABCD-EFGH-IJKL",
  customerSdk,
  onMemberValidated(member) {
    console.log("Member validated", member);
  },
  onActivityRecorded(result) {
    console.log("Activity recorded", result);
  },
  onError(error) {
    console.error("Popup error", error);
  }
});
```

## API

`openOttoLoyaltyPopup(options)`

- `memberCode: string`
- `customerSdk?: OttoCustomerSdk`
- `onMemberValidated?: (member) => void`
- `onRecordActivityRequested?: (payload) => boolean | void`
- `onActivityRecorded?: (result) => void`
- `onError?: (error) => void`
- `onClose?: () => void`

Returns a popup `Window` reference, or `null` when blocked.

## Notes

- Browser-only utility (`window.open`).
- This package delegates API calls to `@ottoafrica/customer-sdk-js`.