@relai-team/access-sdk 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -2
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +23 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -177,8 +177,29 @@ the reason on the console and the sheet parameters in `error.details`.
|
|
|
177
177
|
Prices are configured in the portal (per app, with per-Exchange-Zone
|
|
178
178
|
overrides), in two styles:
|
|
179
179
|
|
|
180
|
-
- **Prepaid**: one
|
|
181
|
-
|
|
180
|
+
- **Prepaid**: one price collected at the drop-off; it covers the whole order,
|
|
181
|
+
including self re-opens and the pick-up.
|
|
182
|
+
|
|
183
|
+
An app may offer up to **ten pick-up windows**, each a length of time with its
|
|
184
|
+
own price, and the end user picks one. Read the menu off the Exchange Zone and
|
|
185
|
+
pass the chosen `hours` back:
|
|
186
|
+
|
|
187
|
+
```ts
|
|
188
|
+
const ez = await relai.exchangeZones.get(ezId);
|
|
189
|
+
const windows = ez.end_user_pricing?.pickup_windows ?? [];
|
|
190
|
+
// e.g. [{ hours: 2, price_cents: 300, total_cents: 371 }, { hours: 24, … }]
|
|
191
|
+
|
|
192
|
+
const order = await relai.orders.create({
|
|
193
|
+
exchangeZoneId: ez.id,
|
|
194
|
+
pickupWindowHours: windows[1]?.hours, // what the user tapped
|
|
195
|
+
});
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
`total_cents` already includes the Platform Fee and Processing lines, so show
|
|
199
|
+
it as-is. Omit `pickupWindowHours` and the shortest (cheapest) window applies.
|
|
200
|
+
An `hours` the app does not offer is rejected. When `pickup_windows` is absent
|
|
201
|
+
the app offers no choice and `prepaid_cents` is the price. Late fees start when
|
|
202
|
+
the chosen window runs out, and `order.pickup_window_hours` reports it back.
|
|
182
203
|
- **Pay-as-you-go** (self orders via `Intents.OccupyLongTerm`): a base at
|
|
183
204
|
drop-off, which may be zero (then the sheet only saves the card), plus an
|
|
184
205
|
hourly rate collected when the pick-up open is requested. Guests cannot
|
package/dist/index.cjs
CHANGED
|
@@ -360,6 +360,7 @@ var OrdersModule = class {
|
|
|
360
360
|
if (input.recipient !== void 0) body["recipient"] = input.recipient;
|
|
361
361
|
if (input.recipientUserId !== void 0) body["recipient_user_id"] = input.recipientUserId;
|
|
362
362
|
if (input.recipientEmail !== void 0) body["recipient_email"] = input.recipientEmail;
|
|
363
|
+
if (input.pickupWindowHours !== void 0) body["pickup_window_hours"] = input.pickupWindowHours;
|
|
363
364
|
if (input.promotionCode !== void 0) body["promotion_code"] = input.promotionCode;
|
|
364
365
|
if (input.metadata !== void 0) body["metadata"] = input.metadata;
|
|
365
366
|
return this.http.request({ method: "POST", path: "/orders", body });
|
package/dist/index.d.cts
CHANGED
|
@@ -101,6 +101,8 @@ interface Order extends OrderStatusFields {
|
|
|
101
101
|
} | null;
|
|
102
102
|
/** When the pick-up window closes; late fees escalate past it. Null = no window. */
|
|
103
103
|
pickup_window_expires_at: string | null;
|
|
104
|
+
/** The pick-up window this order was created under, in hours. */
|
|
105
|
+
pickup_window_hours: number | null;
|
|
104
106
|
/** The currently assessed late pick-up fee (flat step: $5 / $15 / $30). */
|
|
105
107
|
late_fee_cents: number;
|
|
106
108
|
late_fee_settled: boolean;
|
|
@@ -124,6 +126,8 @@ interface AccessLinkTarget {
|
|
|
124
126
|
node_id: string;
|
|
125
127
|
expires_at: string;
|
|
126
128
|
pickup_window_expires_at: string | null;
|
|
129
|
+
/** The pick-up window this order was created under, in hours. */
|
|
130
|
+
pickup_window_hours: number | null;
|
|
127
131
|
late_fee_cents: number;
|
|
128
132
|
}
|
|
129
133
|
/** A single-use override access link (bypasses every paywall). */
|
|
@@ -229,6 +233,18 @@ interface ExchangeZoneDetail extends ExchangeZone {
|
|
|
229
233
|
payg_base_cents: number;
|
|
230
234
|
payg_base_total_cents: number;
|
|
231
235
|
payg_hourly_cents: number;
|
|
236
|
+
/**
|
|
237
|
+
* The app's priced pick-up windows, shortest first. Present only when the
|
|
238
|
+
* app offers a choice; absent means `prepaid_cents` above is the price and
|
|
239
|
+
* there is nothing to pick. Each `total_cents` already includes the
|
|
240
|
+
* Platform Fee and Processing lines, so render it as-is and pass the
|
|
241
|
+
* chosen `hours` to `orders.create({ pickupWindowHours })`.
|
|
242
|
+
*/
|
|
243
|
+
pickup_windows?: {
|
|
244
|
+
hours: number;
|
|
245
|
+
price_cents: number;
|
|
246
|
+
total_cents: number;
|
|
247
|
+
}[];
|
|
232
248
|
};
|
|
233
249
|
}
|
|
234
250
|
interface TokenPair {
|
|
@@ -338,6 +354,13 @@ declare class OrdersModule {
|
|
|
338
354
|
* expired, or exhausted codes fail with `invalid_request` whose message
|
|
339
355
|
* is written for the person who typed the code.
|
|
340
356
|
*/
|
|
357
|
+
/**
|
|
358
|
+
* The pick-up window the end user chose, in hours. Must be one the app
|
|
359
|
+
* offers (see `end_user_pricing.pickup_windows` on the Exchange Zone); its
|
|
360
|
+
* price becomes this order's prepaid price. Omitted where the app offers a
|
|
361
|
+
* menu: the shortest, which is the cheapest.
|
|
362
|
+
*/
|
|
363
|
+
pickupWindowHours?: number;
|
|
341
364
|
promotionCode?: string;
|
|
342
365
|
metadata?: Record<string, string>;
|
|
343
366
|
}): Promise<Order>;
|
package/dist/index.d.ts
CHANGED
|
@@ -101,6 +101,8 @@ interface Order extends OrderStatusFields {
|
|
|
101
101
|
} | null;
|
|
102
102
|
/** When the pick-up window closes; late fees escalate past it. Null = no window. */
|
|
103
103
|
pickup_window_expires_at: string | null;
|
|
104
|
+
/** The pick-up window this order was created under, in hours. */
|
|
105
|
+
pickup_window_hours: number | null;
|
|
104
106
|
/** The currently assessed late pick-up fee (flat step: $5 / $15 / $30). */
|
|
105
107
|
late_fee_cents: number;
|
|
106
108
|
late_fee_settled: boolean;
|
|
@@ -124,6 +126,8 @@ interface AccessLinkTarget {
|
|
|
124
126
|
node_id: string;
|
|
125
127
|
expires_at: string;
|
|
126
128
|
pickup_window_expires_at: string | null;
|
|
129
|
+
/** The pick-up window this order was created under, in hours. */
|
|
130
|
+
pickup_window_hours: number | null;
|
|
127
131
|
late_fee_cents: number;
|
|
128
132
|
}
|
|
129
133
|
/** A single-use override access link (bypasses every paywall). */
|
|
@@ -229,6 +233,18 @@ interface ExchangeZoneDetail extends ExchangeZone {
|
|
|
229
233
|
payg_base_cents: number;
|
|
230
234
|
payg_base_total_cents: number;
|
|
231
235
|
payg_hourly_cents: number;
|
|
236
|
+
/**
|
|
237
|
+
* The app's priced pick-up windows, shortest first. Present only when the
|
|
238
|
+
* app offers a choice; absent means `prepaid_cents` above is the price and
|
|
239
|
+
* there is nothing to pick. Each `total_cents` already includes the
|
|
240
|
+
* Platform Fee and Processing lines, so render it as-is and pass the
|
|
241
|
+
* chosen `hours` to `orders.create({ pickupWindowHours })`.
|
|
242
|
+
*/
|
|
243
|
+
pickup_windows?: {
|
|
244
|
+
hours: number;
|
|
245
|
+
price_cents: number;
|
|
246
|
+
total_cents: number;
|
|
247
|
+
}[];
|
|
232
248
|
};
|
|
233
249
|
}
|
|
234
250
|
interface TokenPair {
|
|
@@ -338,6 +354,13 @@ declare class OrdersModule {
|
|
|
338
354
|
* expired, or exhausted codes fail with `invalid_request` whose message
|
|
339
355
|
* is written for the person who typed the code.
|
|
340
356
|
*/
|
|
357
|
+
/**
|
|
358
|
+
* The pick-up window the end user chose, in hours. Must be one the app
|
|
359
|
+
* offers (see `end_user_pricing.pickup_windows` on the Exchange Zone); its
|
|
360
|
+
* price becomes this order's prepaid price. Omitted where the app offers a
|
|
361
|
+
* menu: the shortest, which is the cheapest.
|
|
362
|
+
*/
|
|
363
|
+
pickupWindowHours?: number;
|
|
341
364
|
promotionCode?: string;
|
|
342
365
|
metadata?: Record<string, string>;
|
|
343
366
|
}): Promise<Order>;
|
package/dist/index.js
CHANGED
|
@@ -243,6 +243,7 @@ var OrdersModule = class {
|
|
|
243
243
|
if (input.recipient !== void 0) body["recipient"] = input.recipient;
|
|
244
244
|
if (input.recipientUserId !== void 0) body["recipient_user_id"] = input.recipientUserId;
|
|
245
245
|
if (input.recipientEmail !== void 0) body["recipient_email"] = input.recipientEmail;
|
|
246
|
+
if (input.pickupWindowHours !== void 0) body["pickup_window_hours"] = input.pickupWindowHours;
|
|
246
247
|
if (input.promotionCode !== void 0) body["promotion_code"] = input.promotionCode;
|
|
247
248
|
if (input.metadata !== void 0) body["metadata"] = input.metadata;
|
|
248
249
|
return this.http.request({ method: "POST", path: "/orders", body });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@relai-team/access-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Official Relai Access SDK, open Relai Exchange Zone nodes over BLE, backed by the Relai Access platform (server-owns-trust).",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"type": "module",
|