Skip to content

grab/superapp-sdk / skills

grabjs-superapp-sdk

Verified

API reference for `@grabjs/superapp-sdk`. Use when building a MiniApp that runs in the Grab SuperApp WebView and needs to call native features (camera, payments, authorization, authentication, permission, location, device storage, container UI customization) via the Grab `JSBridge`. Keywords: miniapp, webview, android, ios, jsbridge, grab, superapp.

references/modules/LoyaltyModule.md

View on GitHub
# LoyaltyModule

## API Reference

SDK module for Loyalty features via `JSBridge`.

| Method | Returns | Description |
| :--- | :--- | :--- |
| `estimateRewards(request: EstimateRewardsRequest)` | `Promise<EstimateRewardsResponse>` | Estimates the rewards for a list of items. |

## `estimateRewards`

Estimates the rewards for a list of items.

**OAuth Scope:** mobile.loyalty | **Minimum Grab App Version:** Android: 5.424.0, iOS: 5.424.0

**Signature:** `estimateRewards(request: EstimateRewardsRequest): Promise<EstimateRewardsResponse>`

This method can return the following `status_code` values:
- `200` (OK): Estimation successful. The `result` contains EstimateRewardsResult.
  Each entry in `result.items` has its own `status_code`: `SUCCESS`, `NOT_APPLICABLE`, or `ERROR`.
- `400` (Bad Request): Invalid request parameters (for example, empty items array or missing fields).
- `403` (Forbidden): Client is not authorized to estimate rewards.
- `424` (Failed Dependency): An underlying native or backend dependency failed.
- `426` (Upgrade Required): Feature requires a minimum Grab app version.
- `500` (Internal Server Error): An unexpected error occurred.
- `501` (Not Implemented): Requires Grab app environment.

```typescript
import { LoyaltyModule, isSuccess, isError } from '@grabjs/superapp-sdk';

const loyalty = new LoyaltyModule();

const response = await loyalty.estimateRewards({
  items: [
    { id: 'trip-456', amount_in_minor_units: 75000, currency_code: 'SGD' },
    { id: 'trip-789', amount_in_minor_units: 25000000, currency_code: 'IDR' },
  ],
});

if (isSuccess(response) && response.status_code === 200) {
  for (const entry of response.result.items) {
    if (entry.status_code === 'SUCCESS') {
      console.log(`${entry.id}: ${entry.result.reward.display_amount} ${entry.result.reward.currency_code}`);
    } else if (entry.status_code === 'NOT_APPLICABLE') {
      console.log(`${entry.id}: not applicable (${entry.reason_code})`);
    } else {
      console.error(`${entry.id}: estimation failed (${entry.reason_code})`);
    }
  }
} else if (isError(response)) {
  console.error(`Error ${response.status_code}: ${response.error}`);
}
```
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 322kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall