@proveanything/smartlinks 2.1.27 → 2.1.29
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/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/wallet.d.ts +93 -0
- package/dist/api/wallet.js +86 -0
- package/dist/docs/API_SUMMARY.md +124 -10
- package/dist/docs/wallet-passes.md +87 -0
- package/dist/openapi.yaml +154 -8
- package/dist/types/broadcasts.d.ts +2 -4
- package/dist/types/comms.d.ts +1 -4
- package/dist/types/contact.d.ts +0 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/wallet.d.ts +92 -0
- package/dist/types/wallet.js +1 -0
- package/docs/API_SUMMARY.md +124 -10
- package/docs/wallet-passes.md +87 -0
- package/openapi.yaml +154 -8
- package/package.json +87 -87
|
@@ -3,7 +3,8 @@ export interface ListBroadcastsQuery {
|
|
|
3
3
|
offset?: number;
|
|
4
4
|
appId?: string;
|
|
5
5
|
}
|
|
6
|
-
|
|
6
|
+
/** Broadcast channels. Wallet is not one: wallet passes are messaged one-to-one (`comms.send` with `channel: 'wallet'`). */
|
|
7
|
+
export type BroadcastChannel = 'email' | 'push' | 'sms';
|
|
7
8
|
export interface BroadcastRecord {
|
|
8
9
|
id: string;
|
|
9
10
|
collectionId: string;
|
|
@@ -80,9 +81,6 @@ export type BroadcastPreviewResponse = {
|
|
|
80
81
|
} | {
|
|
81
82
|
channel: 'sms';
|
|
82
83
|
body: string;
|
|
83
|
-
} | {
|
|
84
|
-
channel: 'wallet';
|
|
85
|
-
payload: any;
|
|
86
84
|
};
|
|
87
85
|
export interface BroadcastSendTestRequest {
|
|
88
86
|
contactId?: string;
|
package/dist/types/comms.d.ts
CHANGED
|
@@ -294,7 +294,6 @@ export interface SubscriptionsResolveRequest {
|
|
|
294
294
|
userId?: string;
|
|
295
295
|
pushEndpoint?: string;
|
|
296
296
|
email?: string;
|
|
297
|
-
walletObjectId?: string;
|
|
298
297
|
};
|
|
299
298
|
}
|
|
300
299
|
export interface SubscriptionsResolveResponse {
|
|
@@ -308,11 +307,9 @@ export interface SubscriptionsResolveResponse {
|
|
|
308
307
|
contactId: string;
|
|
309
308
|
subscribed: boolean;
|
|
310
309
|
channels?: Partial<Record<BroadcastChannel, boolean>>;
|
|
311
|
-
walletForSubject?: boolean;
|
|
312
310
|
}>;
|
|
313
311
|
anySubscribed: boolean;
|
|
314
312
|
anyMethods: boolean;
|
|
315
|
-
anyWalletForSubject: boolean;
|
|
316
313
|
}
|
|
317
314
|
/**
|
|
318
315
|
* Send a single message to one contact using a template.
|
|
@@ -439,7 +436,7 @@ export interface TransactionalSendError {
|
|
|
439
436
|
* - `transactional.phone_missing`
|
|
440
437
|
* - `transactional.whatsapp_missing`
|
|
441
438
|
* - `transactional.no_push_methods`
|
|
442
|
-
* - `transactional.
|
|
439
|
+
* - `transactional.no_wallet_passes` (`channel: 'wallet'`: the person has no wallet passes from this app)
|
|
443
440
|
* - `transactional.opted_out` (category `'service'`: the person turned that channel off, or the email is suppressed)
|
|
444
441
|
* - `transactional.template_or_message` / `transactional.message_invalid` / `transactional.about_invalid`
|
|
445
442
|
*/
|
package/dist/types/contact.d.ts
CHANGED
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js
CHANGED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/** Wallet passes: what a pass is and shows (docs/wallet-passes.md). */
|
|
2
|
+
export type WalletPassKind = 'event' | 'booking' | 'membership' | 'loyalty';
|
|
3
|
+
/** What the pass is for: a booking, the person ('contact'), or your own record type. */
|
|
4
|
+
export interface WalletPassRef {
|
|
5
|
+
type: 'booking' | 'contact' | string;
|
|
6
|
+
id: string;
|
|
7
|
+
}
|
|
8
|
+
/** What a pass shows. Branding (name, logo, colours) always comes from the site. */
|
|
9
|
+
export interface WalletPassContent {
|
|
10
|
+
kind: WalletPassKind;
|
|
11
|
+
/** The main line: the event, "Table for 4", "Gold member". */
|
|
12
|
+
title: string;
|
|
13
|
+
subtitle?: string;
|
|
14
|
+
/** ISO times (events and bookings); the pass surfaces near `start`. */
|
|
15
|
+
start?: string;
|
|
16
|
+
end?: string;
|
|
17
|
+
/** IANA timezone, e.g. 'Europe/London'. */
|
|
18
|
+
timezone?: string;
|
|
19
|
+
/** `lat` / `lng` make the pass appear when the person is nearby. */
|
|
20
|
+
venue?: {
|
|
21
|
+
name?: string;
|
|
22
|
+
address?: string;
|
|
23
|
+
lat?: number;
|
|
24
|
+
lng?: number;
|
|
25
|
+
};
|
|
26
|
+
holder?: string;
|
|
27
|
+
/** A booking reference or member number. */
|
|
28
|
+
number?: string;
|
|
29
|
+
level?: string;
|
|
30
|
+
/** Loyalty balance. */
|
|
31
|
+
points?: number;
|
|
32
|
+
validUntil?: string;
|
|
33
|
+
/** Up to 4 extra lines on the front. */
|
|
34
|
+
fields?: Array<{
|
|
35
|
+
label: string;
|
|
36
|
+
value: string;
|
|
37
|
+
}>;
|
|
38
|
+
/** Lines on the back. */
|
|
39
|
+
back?: Array<{
|
|
40
|
+
label: string;
|
|
41
|
+
value: string;
|
|
42
|
+
}>;
|
|
43
|
+
/** https only. */
|
|
44
|
+
image?: string;
|
|
45
|
+
url?: string;
|
|
46
|
+
/** The QR value; the pass's own code unless you give one. */
|
|
47
|
+
barcode?: string;
|
|
48
|
+
}
|
|
49
|
+
/** "Add to Wallet" links that work for this pass now (a wallet that isn't set up is left out). */
|
|
50
|
+
export interface WalletPassLinks {
|
|
51
|
+
google?: string;
|
|
52
|
+
apple?: string;
|
|
53
|
+
}
|
|
54
|
+
/** A pass as the person sees it (public calls). */
|
|
55
|
+
export interface WalletPassSummary {
|
|
56
|
+
id: string;
|
|
57
|
+
kind: WalletPassKind;
|
|
58
|
+
ref: WalletPassRef;
|
|
59
|
+
title?: string;
|
|
60
|
+
start?: string;
|
|
61
|
+
links: WalletPassLinks;
|
|
62
|
+
}
|
|
63
|
+
/** A pass as an admin or app sees it. */
|
|
64
|
+
export interface WalletPass {
|
|
65
|
+
id: string;
|
|
66
|
+
collectionId: string;
|
|
67
|
+
kind: WalletPassKind;
|
|
68
|
+
ref: WalletPassRef;
|
|
69
|
+
contactId?: string | null;
|
|
70
|
+
status: 'active' | 'voided';
|
|
71
|
+
/** The app that issued it. */
|
|
72
|
+
issuedBy?: string | null;
|
|
73
|
+
model: WalletPassContent;
|
|
74
|
+
/** The value in its QR code (check it with `wallet.byCode`). */
|
|
75
|
+
code: string;
|
|
76
|
+
version: number;
|
|
77
|
+
notice?: {
|
|
78
|
+
header: string;
|
|
79
|
+
body: string;
|
|
80
|
+
at: string;
|
|
81
|
+
};
|
|
82
|
+
voidReason?: string | null;
|
|
83
|
+
links?: WalletPassLinks;
|
|
84
|
+
createdAt?: string;
|
|
85
|
+
updatedAt?: string;
|
|
86
|
+
}
|
|
87
|
+
export interface IssueWalletPassRequest {
|
|
88
|
+
ref: WalletPassRef;
|
|
89
|
+
contactId?: string;
|
|
90
|
+
appId?: string;
|
|
91
|
+
pass: WalletPassContent;
|
|
92
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/docs/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.29 | Generated: 2026-11-20T10:17:06.171Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -170,6 +170,7 @@ The Smartlinks SDK is organized into the following namespaces:
|
|
|
170
170
|
- **template** - Functions for template operations
|
|
171
171
|
- **translations** - Functions for translations operations
|
|
172
172
|
- **userGroups** - Functions for userGroups operations
|
|
173
|
+
- **wallet** - Functions for wallet operations
|
|
173
174
|
|
|
174
175
|
## HTTP Utilities
|
|
175
176
|
|
|
@@ -6040,7 +6041,7 @@ interface BroadcastAppendBulkBody {
|
|
|
6040
6041
|
}
|
|
6041
6042
|
```
|
|
6042
6043
|
|
|
6043
|
-
**BroadcastChannel** = `'email' | 'push' | 'sms'
|
|
6044
|
+
**BroadcastChannel** = `'email' | 'push' | 'sms'`
|
|
6044
6045
|
|
|
6045
6046
|
**BroadcastPreviewResponse** = ``
|
|
6046
6047
|
|
|
@@ -6931,7 +6932,7 @@ interface RegisterMethodResponse {
|
|
|
6931
6932
|
```typescript
|
|
6932
6933
|
interface SubscriptionsResolveRequest {
|
|
6933
6934
|
subject: { type: SubjectType; id: string; productId?: string }
|
|
6934
|
-
hints: { userId?: string; pushEndpoint?: string; email?: string
|
|
6935
|
+
hints: { userId?: string; pushEndpoint?: string; email?: string }
|
|
6935
6936
|
}
|
|
6936
6937
|
```
|
|
6937
6938
|
|
|
@@ -6944,11 +6945,9 @@ interface SubscriptionsResolveResponse {
|
|
|
6944
6945
|
contactId: string
|
|
6945
6946
|
subscribed: boolean
|
|
6946
6947
|
channels?: Partial<Record<BroadcastChannel, boolean>>
|
|
6947
|
-
walletForSubject?: boolean
|
|
6948
6948
|
}>
|
|
6949
6949
|
anySubscribed: boolean
|
|
6950
6950
|
anyMethods: boolean
|
|
6951
|
-
anyWalletForSubject: boolean
|
|
6952
6951
|
}
|
|
6953
6952
|
```
|
|
6954
6953
|
|
|
@@ -7292,7 +7291,7 @@ export interface RegisterMethodResponse { ok: true; contactId: string }
|
|
|
7292
7291
|
|
|
7293
7292
|
export interface SubscriptionsResolveRequest {
|
|
7294
7293
|
subject: { type: SubjectType; id: string; productId?: string }
|
|
7295
|
-
hints: { userId?: string; pushEndpoint?: string; email?: string
|
|
7294
|
+
hints: { userId?: string; pushEndpoint?: string; email?: string }
|
|
7296
7295
|
}
|
|
7297
7296
|
export interface SubscriptionsResolveResponse {
|
|
7298
7297
|
ok: true
|
|
@@ -7301,11 +7300,9 @@ export interface SubscriptionsResolveResponse {
|
|
|
7301
7300
|
contactId: string
|
|
7302
7301
|
subscribed: boolean
|
|
7303
7302
|
channels?: Partial<Record<BroadcastChannel, boolean>>
|
|
7304
|
-
walletForSubject?: boolean
|
|
7305
7303
|
}>
|
|
7306
7304
|
anySubscribed: boolean
|
|
7307
7305
|
anyMethods: boolean
|
|
7308
|
-
anyWalletForSubject: boolean
|
|
7309
7306
|
}
|
|
7310
7307
|
|
|
7311
7308
|
// Transactional send (single-contact, single-message)
|
|
@@ -7433,7 +7430,7 @@ export interface TransactionalSendError {
|
|
|
7433
7430
|
* - `transactional.phone_missing`
|
|
7434
7431
|
* - `transactional.whatsapp_missing`
|
|
7435
7432
|
* - `transactional.no_push_methods`
|
|
7436
|
-
* - `transactional.
|
|
7433
|
+
* - `transactional.no_wallet_passes` (`channel: 'wallet'`: the person has no wallet passes from this app)
|
|
7437
7434
|
* - `transactional.opted_out` (category `'service'`: the person turned that channel off, or the email is suppressed)
|
|
7438
7435
|
* - `transactional.template_or_message` / `transactional.message_invalid` / `transactional.about_invalid`
|
|
7439
7436
|
*/
|
|
@@ -7692,7 +7689,6 @@ interface CommMethodMeta {
|
|
|
7692
7689
|
auth?: string
|
|
7693
7690
|
phone?: string
|
|
7694
7691
|
email?: string
|
|
7695
|
-
walletObjectId?: string
|
|
7696
7692
|
subjectType?: SubjectType
|
|
7697
7693
|
subjectId?: string
|
|
7698
7694
|
productId?: string
|
|
@@ -12256,6 +12252,92 @@ interface VariantUpdateRequest {
|
|
|
12256
12252
|
}
|
|
12257
12253
|
```
|
|
12258
12254
|
|
|
12255
|
+
### wallet
|
|
12256
|
+
|
|
12257
|
+
**WalletPassRef** (interface)
|
|
12258
|
+
```typescript
|
|
12259
|
+
interface WalletPassRef {
|
|
12260
|
+
type: 'booking' | 'contact' | string
|
|
12261
|
+
id: string
|
|
12262
|
+
}
|
|
12263
|
+
```
|
|
12264
|
+
|
|
12265
|
+
**WalletPassContent** (interface)
|
|
12266
|
+
```typescript
|
|
12267
|
+
interface WalletPassContent {
|
|
12268
|
+
kind: WalletPassKind
|
|
12269
|
+
title: string
|
|
12270
|
+
subtitle?: string
|
|
12271
|
+
start?: string
|
|
12272
|
+
end?: string
|
|
12273
|
+
timezone?: string
|
|
12274
|
+
venue?: { name?: string; address?: string; lat?: number; lng?: number }
|
|
12275
|
+
holder?: string
|
|
12276
|
+
number?: string
|
|
12277
|
+
level?: string
|
|
12278
|
+
points?: number
|
|
12279
|
+
validUntil?: string
|
|
12280
|
+
fields?: Array<{ label: string; value: string }>
|
|
12281
|
+
back?: Array<{ label: string; value: string }>
|
|
12282
|
+
image?: string
|
|
12283
|
+
url?: string
|
|
12284
|
+
barcode?: string
|
|
12285
|
+
}
|
|
12286
|
+
```
|
|
12287
|
+
|
|
12288
|
+
**WalletPassLinks** (interface)
|
|
12289
|
+
```typescript
|
|
12290
|
+
interface WalletPassLinks {
|
|
12291
|
+
google?: string
|
|
12292
|
+
apple?: string
|
|
12293
|
+
}
|
|
12294
|
+
```
|
|
12295
|
+
|
|
12296
|
+
**WalletPassSummary** (interface)
|
|
12297
|
+
```typescript
|
|
12298
|
+
interface WalletPassSummary {
|
|
12299
|
+
id: string
|
|
12300
|
+
kind: WalletPassKind
|
|
12301
|
+
ref: WalletPassRef
|
|
12302
|
+
title?: string
|
|
12303
|
+
start?: string
|
|
12304
|
+
links: WalletPassLinks
|
|
12305
|
+
}
|
|
12306
|
+
```
|
|
12307
|
+
|
|
12308
|
+
**WalletPass** (interface)
|
|
12309
|
+
```typescript
|
|
12310
|
+
interface WalletPass {
|
|
12311
|
+
id: string
|
|
12312
|
+
collectionId: string
|
|
12313
|
+
kind: WalletPassKind
|
|
12314
|
+
ref: WalletPassRef
|
|
12315
|
+
contactId?: string | null
|
|
12316
|
+
status: 'active' | 'voided'
|
|
12317
|
+
issuedBy?: string | null
|
|
12318
|
+
model: WalletPassContent
|
|
12319
|
+
code: string
|
|
12320
|
+
version: number
|
|
12321
|
+
notice?: { header: string; body: string; at: string }
|
|
12322
|
+
voidReason?: string | null
|
|
12323
|
+
links?: WalletPassLinks
|
|
12324
|
+
createdAt?: string
|
|
12325
|
+
updatedAt?: string
|
|
12326
|
+
}
|
|
12327
|
+
```
|
|
12328
|
+
|
|
12329
|
+
**IssueWalletPassRequest** (interface)
|
|
12330
|
+
```typescript
|
|
12331
|
+
interface IssueWalletPassRequest {
|
|
12332
|
+
ref: WalletPassRef
|
|
12333
|
+
contactId?: string
|
|
12334
|
+
appId?: string
|
|
12335
|
+
pass: WalletPassContent
|
|
12336
|
+
}
|
|
12337
|
+
```
|
|
12338
|
+
|
|
12339
|
+
**WalletPassKind** = `'event' | 'booking' | 'membership' | 'loyalty'`
|
|
12340
|
+
|
|
12259
12341
|
### widgets
|
|
12260
12342
|
|
|
12261
12343
|
**NavigationRequest** (interface)
|
|
@@ -15556,3 +15638,35 @@ Listen for voice input
|
|
|
15556
15638
|
**speak**(text: string, options?: { voice?: string; rate?: number }) → `Promise<void>`
|
|
15557
15639
|
Speak text
|
|
15558
15640
|
|
|
15641
|
+
### wallet
|
|
15642
|
+
|
|
15643
|
+
**addLinks**(collectionId: string, ref: WalletPassRef) → `Promise<`
|
|
15644
|
+
"Add to Wallet" links for the signed-in person's pass about `ref` (made on first ask for a booking or a membership card). ```typescript const { pass } = await wallet.addLinks('coll_123', { type: 'booking', id: booking.id }) if (pass.links.apple) appleButton.href = pass.links.apple if (pass.links.google) googleButton.href = pass.links.google ```
|
|
15645
|
+
|
|
15646
|
+
**mine**(collectionId: string) → `Promise<`
|
|
15647
|
+
The signed-in person's active passes on this site, with their links.
|
|
15648
|
+
|
|
15649
|
+
**status**(collectionId: string) → `Promise<`
|
|
15650
|
+
Which wallets are switched on (admin).
|
|
15651
|
+
|
|
15652
|
+
**list**(collectionId: string, query: { refType?: string; refId?: string; contactId?: string; includeVoided?: boolean }) → `Promise<`
|
|
15653
|
+
Passes for one thing (`refType` + `refId`) or one person (`contactId`) (admin).
|
|
15654
|
+
|
|
15655
|
+
**get**(collectionId: string, passId: string) → `Promise<`
|
|
15656
|
+
One pass, with its links (admin).
|
|
15657
|
+
|
|
15658
|
+
**byCode**(collectionId: string, code: string) → `Promise<`
|
|
15659
|
+
The pass whose QR this is, for checking a ticket at the door (admin). `valid` is false for a voided pass. ```typescript const { pass, valid } = await wallet.byCode('coll_123', scannedValue) ```
|
|
15660
|
+
|
|
15661
|
+
**issue**(collectionId: string, input: IssueWalletPassRequest) → `Promise<`
|
|
15662
|
+
Issue a pass (admin). Issuing again for the same thing, person and kind changes the existing pass.
|
|
15663
|
+
|
|
15664
|
+
**update**(collectionId: string, passId: string, fields: Partial<Omit<WalletPassContent, "kind">>) → `Promise<`
|
|
15665
|
+
Change what a pass shows; both wallets follow (admin).
|
|
15666
|
+
|
|
15667
|
+
**voidPass**(collectionId: string, passId: string, reason?: string) → `Promise<`
|
|
15668
|
+
The pass no longer counts: shown as void on the phone (admin).
|
|
15669
|
+
|
|
15670
|
+
**message**(collectionId: string, passId: string, msg: { header?: string; body: string }) → `Promise<`
|
|
15671
|
+
A lock-screen message on the pass (admin).
|
|
15672
|
+
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Wallet passes
|
|
2
|
+
|
|
3
|
+
Put an **event ticket**, a **booking**, a **membership card** or a **loyalty card** in the person's Apple Wallet or
|
|
4
|
+
Google Wallet. SmartLinks is the issuer and signs the passes. Each pass is branded from your site's name, logo and
|
|
5
|
+
colour, and your app decides what it says.
|
|
6
|
+
|
|
7
|
+
- **Who gets one:** only someone the business knows. A pass is issued to the signed-in owner of what it's for, or
|
|
8
|
+
by your app's own server function.
|
|
9
|
+
- **What the phone does:** the pass shows its QR code offline, appears near the time (and place, if you give
|
|
10
|
+
`venue.lat` / `lng`), and updates when you change it.
|
|
11
|
+
- **Bookings look after themselves:** when a booking is moved its pass shows the new time, and when it's cancelled
|
|
12
|
+
the pass is voided.
|
|
13
|
+
|
|
14
|
+
## In a page: "Add to Wallet"
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import { wallet } from '@proveanything/smartlinks'
|
|
18
|
+
|
|
19
|
+
// The signed-in person's booking, membership card, or a pass your app issued them
|
|
20
|
+
const { pass } = await wallet.addLinks(collectionId, { type: 'booking', id: booking.id })
|
|
21
|
+
// pass.links.apple → opens the .pkpass on an iPhone
|
|
22
|
+
// pass.links.google → opens Google's "Save to Google Wallet" page
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
- `{ type: 'booking', id }` and `{ type: 'contact', id: 'me' }` are made on first ask:
|
|
26
|
+
- a booking pass, from the booking's date and time
|
|
27
|
+
- a membership card, from the person's `level` and `memberUntil` fields
|
|
28
|
+
- For anything else (an event ticket with your own title, a loyalty card with points), issue the pass in your server
|
|
29
|
+
function first. `addLinks` then returns that pass for its owner.
|
|
30
|
+
- Show the official "Add to Apple Wallet" and "Add to Google Wallet" badges, and only the one that suits the
|
|
31
|
+
device. A wallet that isn't set up yet is left out of `links`.
|
|
32
|
+
- `wallet.mine(collectionId)` lists the person's passes.
|
|
33
|
+
|
|
34
|
+
## In a server function: issue, change, void, message
|
|
35
|
+
|
|
36
|
+
Declare `sl:wallet:write` in the function's capabilities.
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
// An event ticket
|
|
40
|
+
const pass = await ctx.sl.wallet.issue({
|
|
41
|
+
ref: { type: 'booking', id: booking.id }, // what it's for; issuing again changes the same pass
|
|
42
|
+
pass: {
|
|
43
|
+
kind: 'event',
|
|
44
|
+
title: 'Jazz on the Terrace',
|
|
45
|
+
start: '2026-12-24T19:00:00Z', end: '2026-12-24T22:00:00Z', timezone: 'Europe/London',
|
|
46
|
+
venue: { name: 'The Terrace', address: '1 High St, Bath', lat: 51.38, lng: -2.36 },
|
|
47
|
+
holder: 'Sam Lee', number: 'T-0042',
|
|
48
|
+
fields: [{ label: 'Seat', value: 'Table 6' }],
|
|
49
|
+
},
|
|
50
|
+
})
|
|
51
|
+
return { links: pass.links } // hand these to the page
|
|
52
|
+
|
|
53
|
+
// A loyalty card, kept up to date
|
|
54
|
+
await ctx.sl.wallet.issue({ ref: { type: 'loyalty', id: accountId }, pass: { kind: 'loyalty', title: 'Bloom Rewards', points: 120, holder: 'Sam' } })
|
|
55
|
+
await ctx.sl.wallet.update(passId, { points: 145 })
|
|
56
|
+
|
|
57
|
+
await ctx.sl.wallet.void(passId, 'refunded')
|
|
58
|
+
await ctx.sl.wallet.message(passId, { header: 'Doors open', body: 'Doors open at 7pm. See you soon!' })
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
- **Contact:** `contactId` defaults to the caller's contact.
|
|
62
|
+
- **Reading:** `ctx.sl.wallet.get(passId)`, `forRef(ref)`, `byCode(code)` and `mine()` need only `sl:wallet:read`.
|
|
63
|
+
- **Messages:** you can also send a message to wallet with `ctx.sl.messages` and `channel: 'wallet'`. It goes to the
|
|
64
|
+
person's passes about the message's `about`, otherwise to your app's own passes for them. It's worded from the
|
|
65
|
+
template's push version.
|
|
66
|
+
|
|
67
|
+
## Checking a pass at the door
|
|
68
|
+
|
|
69
|
+
The QR holds the pass's own code, never an id. Scan it, then:
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
const { pass, valid } = await wallet.byCode(collectionId, scanned) // admin
|
|
73
|
+
// or in a function: await ctx.sl.wallet.byCode(scanned)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## What a pass can show
|
|
77
|
+
|
|
78
|
+
| Field | Use |
|
|
79
|
+
|---|---|
|
|
80
|
+
| `kind` | `event`, `booking`, `membership` or `loyalty` |
|
|
81
|
+
| `title` / `subtitle` | the main line and a second line |
|
|
82
|
+
| `start` / `end` / `timezone` | when; the pass surfaces near `start` |
|
|
83
|
+
| `venue` | `name`, `address`, and `lat` / `lng` for the lock screen nearby |
|
|
84
|
+
| `holder`, `number`, `level`, `points`, `validUntil` | the person, a reference or member number, a level, a balance, an end date |
|
|
85
|
+
| `fields` (up to 4), `back` | extra lines on the front and the back |
|
|
86
|
+
| `image`, `url` | https only: a picture, a link back to your site |
|
|
87
|
+
| `barcode` | your own QR value, instead of the pass's code |
|
package/openapi.yaml
CHANGED
|
@@ -27248,7 +27248,6 @@ components:
|
|
|
27248
27248
|
- email
|
|
27249
27249
|
- push
|
|
27250
27250
|
- sms
|
|
27251
|
-
- wallet
|
|
27252
27251
|
BroadcastPreviewResponse:
|
|
27253
27252
|
type: object
|
|
27254
27253
|
additionalProperties: true
|
|
@@ -28797,14 +28796,10 @@ components:
|
|
|
28797
28796
|
type: boolean
|
|
28798
28797
|
channels:
|
|
28799
28798
|
$ref: "#/components/schemas/BroadcastChannel"
|
|
28800
|
-
walletForSubject:
|
|
28801
|
-
type: boolean
|
|
28802
28799
|
anySubscribed:
|
|
28803
28800
|
type: boolean
|
|
28804
28801
|
anyMethods:
|
|
28805
28802
|
type: boolean
|
|
28806
|
-
anyWalletForSubject:
|
|
28807
|
-
type: boolean
|
|
28808
28803
|
required:
|
|
28809
28804
|
- ok
|
|
28810
28805
|
- subject
|
|
@@ -28813,7 +28808,6 @@ components:
|
|
|
28813
28808
|
- subscribed
|
|
28814
28809
|
- anySubscribed
|
|
28815
28810
|
- anyMethods
|
|
28816
|
-
- anyWalletForSubject
|
|
28817
28811
|
TransactionalSendRequest:
|
|
28818
28812
|
type: object
|
|
28819
28813
|
properties:
|
|
@@ -29420,8 +29414,6 @@ components:
|
|
|
29420
29414
|
type: string
|
|
29421
29415
|
email:
|
|
29422
29416
|
type: string
|
|
29423
|
-
walletObjectId:
|
|
29424
|
-
type: string
|
|
29425
29417
|
subjectType:
|
|
29426
29418
|
$ref: "#/components/schemas/SubjectType"
|
|
29427
29419
|
subjectId:
|
|
@@ -37368,6 +37360,160 @@ components:
|
|
|
37368
37360
|
properties:
|
|
37369
37361
|
name:
|
|
37370
37362
|
type: string
|
|
37363
|
+
WalletPassRef:
|
|
37364
|
+
type: object
|
|
37365
|
+
properties:
|
|
37366
|
+
type:
|
|
37367
|
+
type: string
|
|
37368
|
+
enum:
|
|
37369
|
+
- booking
|
|
37370
|
+
- contact
|
|
37371
|
+
id:
|
|
37372
|
+
type: string
|
|
37373
|
+
required:
|
|
37374
|
+
- type
|
|
37375
|
+
- id
|
|
37376
|
+
WalletPassContent:
|
|
37377
|
+
type: object
|
|
37378
|
+
properties:
|
|
37379
|
+
kind:
|
|
37380
|
+
$ref: "#/components/schemas/WalletPassKind"
|
|
37381
|
+
title:
|
|
37382
|
+
type: string
|
|
37383
|
+
subtitle:
|
|
37384
|
+
type: string
|
|
37385
|
+
start:
|
|
37386
|
+
type: string
|
|
37387
|
+
end:
|
|
37388
|
+
type: string
|
|
37389
|
+
timezone:
|
|
37390
|
+
type: string
|
|
37391
|
+
venue:
|
|
37392
|
+
type: object
|
|
37393
|
+
additionalProperties: true
|
|
37394
|
+
holder:
|
|
37395
|
+
type: string
|
|
37396
|
+
number:
|
|
37397
|
+
type: string
|
|
37398
|
+
level:
|
|
37399
|
+
type: string
|
|
37400
|
+
points:
|
|
37401
|
+
type: number
|
|
37402
|
+
validUntil:
|
|
37403
|
+
type: string
|
|
37404
|
+
fields:
|
|
37405
|
+
type: array
|
|
37406
|
+
items:
|
|
37407
|
+
type: object
|
|
37408
|
+
additionalProperties: true
|
|
37409
|
+
back:
|
|
37410
|
+
type: array
|
|
37411
|
+
items:
|
|
37412
|
+
type: object
|
|
37413
|
+
additionalProperties: true
|
|
37414
|
+
image:
|
|
37415
|
+
type: string
|
|
37416
|
+
url:
|
|
37417
|
+
type: string
|
|
37418
|
+
barcode:
|
|
37419
|
+
type: string
|
|
37420
|
+
required:
|
|
37421
|
+
- kind
|
|
37422
|
+
- title
|
|
37423
|
+
WalletPassLinks:
|
|
37424
|
+
type: object
|
|
37425
|
+
properties:
|
|
37426
|
+
google:
|
|
37427
|
+
type: string
|
|
37428
|
+
apple:
|
|
37429
|
+
type: string
|
|
37430
|
+
WalletPassSummary:
|
|
37431
|
+
type: object
|
|
37432
|
+
properties:
|
|
37433
|
+
id:
|
|
37434
|
+
type: string
|
|
37435
|
+
kind:
|
|
37436
|
+
$ref: "#/components/schemas/WalletPassKind"
|
|
37437
|
+
ref:
|
|
37438
|
+
$ref: "#/components/schemas/WalletPassRef"
|
|
37439
|
+
title:
|
|
37440
|
+
type: string
|
|
37441
|
+
start:
|
|
37442
|
+
type: string
|
|
37443
|
+
links:
|
|
37444
|
+
$ref: "#/components/schemas/WalletPassLinks"
|
|
37445
|
+
required:
|
|
37446
|
+
- id
|
|
37447
|
+
- kind
|
|
37448
|
+
- ref
|
|
37449
|
+
- links
|
|
37450
|
+
WalletPass:
|
|
37451
|
+
type: object
|
|
37452
|
+
properties:
|
|
37453
|
+
id:
|
|
37454
|
+
type: string
|
|
37455
|
+
collectionId:
|
|
37456
|
+
type: string
|
|
37457
|
+
kind:
|
|
37458
|
+
$ref: "#/components/schemas/WalletPassKind"
|
|
37459
|
+
ref:
|
|
37460
|
+
$ref: "#/components/schemas/WalletPassRef"
|
|
37461
|
+
contactId:
|
|
37462
|
+
type: string
|
|
37463
|
+
status:
|
|
37464
|
+
type: string
|
|
37465
|
+
enum:
|
|
37466
|
+
- active
|
|
37467
|
+
- voided
|
|
37468
|
+
issuedBy:
|
|
37469
|
+
type: string
|
|
37470
|
+
model:
|
|
37471
|
+
$ref: "#/components/schemas/WalletPassContent"
|
|
37472
|
+
code:
|
|
37473
|
+
type: string
|
|
37474
|
+
version:
|
|
37475
|
+
type: number
|
|
37476
|
+
notice:
|
|
37477
|
+
type: object
|
|
37478
|
+
additionalProperties: true
|
|
37479
|
+
voidReason:
|
|
37480
|
+
type: string
|
|
37481
|
+
links:
|
|
37482
|
+
$ref: "#/components/schemas/WalletPassLinks"
|
|
37483
|
+
createdAt:
|
|
37484
|
+
type: string
|
|
37485
|
+
updatedAt:
|
|
37486
|
+
type: string
|
|
37487
|
+
required:
|
|
37488
|
+
- id
|
|
37489
|
+
- collectionId
|
|
37490
|
+
- kind
|
|
37491
|
+
- ref
|
|
37492
|
+
- status
|
|
37493
|
+
- model
|
|
37494
|
+
- code
|
|
37495
|
+
- version
|
|
37496
|
+
IssueWalletPassRequest:
|
|
37497
|
+
type: object
|
|
37498
|
+
properties:
|
|
37499
|
+
ref:
|
|
37500
|
+
$ref: "#/components/schemas/WalletPassRef"
|
|
37501
|
+
contactId:
|
|
37502
|
+
type: string
|
|
37503
|
+
appId:
|
|
37504
|
+
type: string
|
|
37505
|
+
pass:
|
|
37506
|
+
$ref: "#/components/schemas/WalletPassContent"
|
|
37507
|
+
required:
|
|
37508
|
+
- ref
|
|
37509
|
+
- pass
|
|
37510
|
+
WalletPassKind:
|
|
37511
|
+
type: string
|
|
37512
|
+
enum:
|
|
37513
|
+
- event
|
|
37514
|
+
- booking
|
|
37515
|
+
- membership
|
|
37516
|
+
- loyalty
|
|
37371
37517
|
NavigationRequest:
|
|
37372
37518
|
type: object
|
|
37373
37519
|
properties:
|