@octap/contracts 0.2.0 → 0.3.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 CHANGED
@@ -1,6 +1,42 @@
1
- # Shared API contracts
2
- Framework-free TypeScript wire types used by the API and both SDKs: `src/loyalty.ts` (points)
3
- and `src/rewards.ts` (vouchers). This package is separate from on-chain Move contracts.
4
- These types also drive the OpenAPI document's request and response schemas (`npm run openapi:schemas`,
5
- see `api/README.md`): a JSDoc comment on a field becomes its description there, and `@format uuid`
6
- becomes its format. Runtime validation and protobuf generation do not exist yet.
1
+ # @octap/contracts
2
+
3
+ TypeScript types for the Octap Core REST API: every request and response body, the webhook events,
4
+ and the status values. `@octap/sdk`, `@octap/browser-sdk`, `@octap/mcp` and `@octap/verify` all use
5
+ them, and so does Core itself.
6
+
7
+ It is types only: nothing here runs, and nothing validates a value at runtime.
8
+
9
+ ```bash
10
+ npm install @octap/contracts
11
+ ```
12
+
13
+ ```ts
14
+ import type { WebhookEvent } from '@octap/contracts';
15
+
16
+ function onEvent(event: WebhookEvent) {
17
+ if (event.type === 'credits.earn.confirmed') {
18
+ // event.data is CreditsChainConfirmedEventData
19
+ }
20
+ }
21
+ ```
22
+
23
+ You don't need this package if you use `@octap/sdk`: it re-exports the types its methods take and
24
+ return. Install it on its own for code that only handles the data, such as a webhook receiver in
25
+ another service or a typed frontend.
26
+
27
+ ## What's in it
28
+
29
+ | Area | Examples |
30
+ | --- | --- |
31
+ | Points | `EarnPointsRequest`, `CreditBalanceSnapshot`, `LoyaltyTransactionDto`, `ReservePosRedemptionResponse` |
32
+ | Vouchers | `VoucherDto`, `VoucherStatus`, `VoucherOwnershipDto`, `VoucherOwnershipStatus`, `ClaimVoucherResponse` |
33
+ | Voucher batches and refunds | `VoucherBatchDto`, `VoucherBatchItem`, `VoucherRefundPolicyDto` |
34
+ | Webhooks | `WebhookEvent` (discriminated on `type`), `WebhookEventType`, `WebhookEventData<T>` |
35
+ | Members and identity | `VerifyCustomerResponse`, `MemberProfile` |
36
+ | Evidence, audit and analytics | `EvidenceBundle`, `AuditLogEntry`, `ProgramAnalyticsSummary` |
37
+
38
+ Each type's JSDoc says what its fields mean. The same comments describe the fields in Core's OpenAPI
39
+ document.
40
+
41
+ This package is not the on-chain Move contracts: those are in `contracts/` in the
42
+ [octap-core repository](https://github.com/OctaPointees/octap-core).
@@ -54,3 +54,165 @@ export interface ProgramAnalyticsSummary {
54
54
  vouchers: VoucherPerformance;
55
55
  dailyTrend: ProgramAnalyticsDay[];
56
56
  }
57
+ /**
58
+ * `GET /v1/console/organizations/{organizationId}/analytics/vouchers`: how each voucher did in the
59
+ * window, for its Owner and Business Developers. Same counting as `VoucherPerformance`, per voucher.
60
+ */
61
+ export interface VoucherPerformanceQuery extends ProgramAnalyticsQuery {
62
+ /** Only this campaign's vouchers. */
63
+ campaignId?: string;
64
+ /** 1–100, default 50. */
65
+ limit?: number;
66
+ }
67
+ export interface VoucherPerformanceRow {
68
+ voucherId: string;
69
+ code: string;
70
+ title: string;
71
+ status: string;
72
+ campaignId: string | null;
73
+ /** Claimed by a customer in the window. */
74
+ claimed: number;
75
+ /** Used at the merchant in the window. */
76
+ redeemed: number;
77
+ /** Claimed copies whose deadline passed unused in the window (up to now). */
78
+ expiredUnused: number;
79
+ }
80
+ /** Vouchers with any activity in the window, most claimed first. */
81
+ export interface VoucherPerformanceList {
82
+ from: string;
83
+ to: string;
84
+ items: VoucherPerformanceRow[];
85
+ }
86
+ /**
87
+ * `GET /v1/console/organizations/{organizationId}/analytics/campaigns`: what each campaign running
88
+ * during the window did in it.
89
+ */
90
+ export interface CampaignPerformanceRow {
91
+ campaignId: string;
92
+ name: string;
93
+ status: string;
94
+ startsAt: string;
95
+ endsAt: string;
96
+ /** CONFIRMED earns its multiplier boosted, in the window. */
97
+ boostedEarns: number;
98
+ /** Points those earns credited, boost included. */
99
+ boostedPoints: number;
100
+ /** Its vouchers claimed in the window. */
101
+ vouchersClaimed: number;
102
+ /** Its vouchers used in the window. */
103
+ vouchersRedeemed: number;
104
+ }
105
+ /** Campaigns whose dates overlap the window, newest start first. */
106
+ export interface CampaignPerformanceList {
107
+ from: string;
108
+ to: string;
109
+ items: CampaignPerformanceRow[];
110
+ }
111
+ /**
112
+ * `GET /v1/console/organizations/{organizationId}/analytics/members`: where the organization's members
113
+ * are now, by their last CONFIRMED earn or redemption. Every enrolled member is in exactly one segment.
114
+ */
115
+ export interface MemberSegments {
116
+ asOf: string;
117
+ /** Last earn or redemption within `activeDays` (30) days. */
118
+ active: number;
119
+ /** Last one between `activeDays` and `dormantDays` (90) days ago: worth a nudge. */
120
+ lapsing: number;
121
+ /** Last one more than `dormantDays` days ago. */
122
+ dormant: number;
123
+ /** Enrolled, never earned or redeemed. */
124
+ neverTransacted: number;
125
+ enrolled: number;
126
+ activeDays: number;
127
+ dormantDays: number;
128
+ }
129
+ /** What Core noticed, for an assistant to explain. Each comes with the numbers behind it. */
130
+ export type ProgramSignalCode =
131
+ /** Points earned fell by 20% or more against the previous period. */
132
+ 'EARN_DOWN'
133
+ /** Points earned rose by 20% or more against the previous period. */
134
+ | 'EARN_UP'
135
+ /** At the current pace, the issuance budget runs out within 14 days. */
136
+ | 'BUDGET_LOW'
137
+ /** Claimed vouchers will expire unused in the next 7 days. */
138
+ | 'VOUCHERS_EXPIRING'
139
+ /** More members are lapsing (30–90 days quiet) than are active. */
140
+ | 'MEMBERS_LAPSING'
141
+ /** Reversed points are 10% or more of points earned. */
142
+ | 'REVERSALS_HIGH';
143
+ export interface ProgramSignal {
144
+ code: ProgramSignalCode;
145
+ /** The figure behind it: a percentage change, days left, a count or a share. */
146
+ value: number;
147
+ }
148
+ /**
149
+ * `GET /v1/console/organizations/{organizationId}/analytics/insights`: one answer to "how are we
150
+ * doing?", for the console and the MCP assistant. The window (default 30 days) against the window of
151
+ * the same length right before it, plus where things are heading.
152
+ */
153
+ export interface ProgramInsights {
154
+ from: string;
155
+ to: string;
156
+ previous: {
157
+ from: string;
158
+ to: string;
159
+ };
160
+ circulation: {
161
+ current: ProgramCirculation;
162
+ previous: ProgramCirculation;
163
+ };
164
+ activeMembers: {
165
+ current: number;
166
+ previous: number;
167
+ };
168
+ vouchers: {
169
+ current: VoucherPerformance;
170
+ previous: VoucherPerformance;
171
+ };
172
+ /** Null when the chain can't be read right now; the rest still answers. */
173
+ budget: {
174
+ remaining: number;
175
+ capacity: number;
176
+ /** Points earned per day in the window, on average. */
177
+ earnedPerDay: number;
178
+ /** `remaining / earnedPerDay`, rounded down; null when nothing was earned. */
179
+ daysLeft: number | null;
180
+ } | null;
181
+ /** Claimed, unused vouchers whose deadline falls in the next `days` days. */
182
+ expiringSoon: {
183
+ days: number;
184
+ vouchers: number;
185
+ };
186
+ segments: MemberSegments;
187
+ /** The three most claimed vouchers in the window. */
188
+ topVouchers: VoucherPerformanceRow[];
189
+ signals: ProgramSignal[];
190
+ }
191
+ /**
192
+ * `GET /v1/console/organizations/{organizationId}/analytics/members/{memberId}`: one member's activity
193
+ * in the window (default 30 days) and over all time, in one read, so nobody pages through their
194
+ * transactions to add them up. CONFIRMED transactions only, counted as the program summary counts: a
195
+ * PENDING earn shows in their transaction list but not here until the chain confirms it.
196
+ */
197
+ export interface MemberActivitySummary {
198
+ memberId: string;
199
+ from: string;
200
+ to: string;
201
+ /** In the window. */
202
+ points: ProgramCirculation;
203
+ /** The same over all time, since they joined. */
204
+ lifetime: ProgramCirculation;
205
+ /** CONFIRMED earns and redemptions in the window. */
206
+ transactions: {
207
+ earns: number;
208
+ redemptions: number;
209
+ };
210
+ /** Over all time: their first and last CONFIRMED earn or redemption; null if none. */
211
+ firstActivityAt: string | null;
212
+ lastActivityAt: string | null;
213
+ /** Unused vouchers they hold now, and vouchers they used in the window. */
214
+ vouchers: {
215
+ held: number;
216
+ usedInWindow: number;
217
+ };
218
+ }
@@ -8,6 +8,14 @@ export interface AssistantTurn {
8
8
  /** Plain text of that turn. */
9
9
  text: string;
10
10
  }
11
+ /** The console pages a question can be asked beside. */
12
+ export type AssistantPageName = 'dashboard' | 'insights' | 'vouchers' | 'campaigns' | 'members' | 'transactions' | 'api-keys' | 'webhooks' | 'team' | 'settings';
13
+ /** The page the user has open, for what their question leaves out, such as its period. */
14
+ export interface AssistantPage {
15
+ name: AssistantPageName;
16
+ /** What it shows, such as its period or filters, in one line. At most 300 characters. */
17
+ showing?: string;
18
+ }
11
19
  /** `POST /v1/console/organizations/:organizationId/assistant/messages` */
12
20
  export interface AssistantMessageBody {
13
21
  /** The new question. 1–4000 characters. */
@@ -17,6 +25,14 @@ export interface AssistantMessageBody {
17
25
  * characters together with the new message.
18
26
  */
19
27
  history?: AssistantTurn[];
28
+ /** The user's IANA time zone, such as `Asia/Ho_Chi_Minh`, for "today" and "last week". UTC without it. */
29
+ timeZone?: string;
30
+ /**
31
+ * The browser's id for this chat (a UUID). With it, Core keeps what the tools returned for a short
32
+ * while, so a follow-up need not read it again. It names the chat only among this user's own.
33
+ */
34
+ chatId?: string;
35
+ page?: AssistantPage;
20
36
  }
21
37
  /**
22
38
  * One event of the answer stream (`text/event-stream`; each `data:` line is one JSON event, and the
@@ -32,11 +48,19 @@ export type AssistantStreamEvent =
32
48
  | {
33
49
  type: 'tool';
34
50
  name: string;
51
+ id?: string;
35
52
  }
36
53
  /** That tool failed or was refused, e.g. because the user's access changed. */
37
54
  | {
38
55
  type: 'tool_error';
39
56
  name: string;
57
+ id?: string;
58
+ }
59
+ /** The tool call with this id returned. */
60
+ | {
61
+ type: 'tool_done';
62
+ name: string;
63
+ id: string;
40
64
  }
41
65
  /** The model declined to answer. `category` is the provider's refusal category, when there is one. */
42
66
  | {
@@ -0,0 +1,64 @@
1
+ import type { VoucherBatchActionResult, VoucherDto } from './rewards.js';
2
+ /**
3
+ * DRAFT until an Owner activates it, which approves it. ACTIVE and PAUSED move back and forth;
4
+ * ENDED (by the Owner, or automatically once `endsAt` has passed) and ARCHIVED are final.
5
+ */
6
+ export type CampaignStatus = 'DRAFT' | 'ACTIVE' | 'PAUSED' | 'ENDED' | 'ARCHIVED';
7
+ /** The most an earn may be boosted: 10x, enforced on-chain too. */
8
+ export declare const CAMPAIGN_MAX_MULTIPLIER_BPS = 100000;
9
+ export declare const CAMPAIGN_MAX_NAME_LENGTH = 160;
10
+ export declare const CAMPAIGN_MAX_DESCRIPTION_LENGTH = 2000;
11
+ /**
12
+ * A named, time-boxed promotion (OCT-340). It may boost earn, group vouchers, or both:
13
+ * - Earn: an earn that sends this campaign's id as `campaignId` gets `multiplierBps` on top of the
14
+ * program's rate, while the campaign is ACTIVE and `startsAt <= now <= endsAt`. Otherwise the earn is
15
+ * refused (422), never earned at the base rate instead.
16
+ * - Vouchers: a voucher created with `campaignId`, alone or in a batch, belongs to it.
17
+ */
18
+ export interface CampaignDto {
19
+ id: string;
20
+ organizationId: string;
21
+ name: string;
22
+ description: string | null;
23
+ status: CampaignStatus;
24
+ startsAt: string;
25
+ endsAt: string;
26
+ /** 20000 is 2x. `null`: the campaign boosts no earn, it only groups vouchers. */
27
+ multiplierBps: number | null;
28
+ /** Whether an earn naming it is boosted right now: ACTIVE, within its window, with a multiplier. */
29
+ earnBoostLive: boolean;
30
+ createdByUserId: string | null;
31
+ /** The Owner whose first activation approved it. */
32
+ approvedByUserId: string | null;
33
+ approvedAt: string | null;
34
+ createdAt: string;
35
+ updatedAt: string;
36
+ }
37
+ export interface ListCampaignsRequest {
38
+ /** Only campaigns that boost an earn right now (`earnBoostLive`). Defaults to `false`. */
39
+ live?: boolean;
40
+ }
41
+ /** A campaign with its vouchers, in `code` order. */
42
+ export interface CampaignDetailDto extends CampaignDto {
43
+ vouchers: VoucherDto[];
44
+ }
45
+ /** Created as a DRAFT; nothing is boosted until an Owner activates it. */
46
+ export interface CreateCampaignRequest {
47
+ name: string;
48
+ description?: string | null;
49
+ /** ISO 8601. */
50
+ startsAt: string;
51
+ /** ISO 8601, after `startsAt`. */
52
+ endsAt: string;
53
+ /**
54
+ * The earn boost, above 10000 (1x) and at most `CAMPAIGN_MAX_MULTIPLIER_BPS` (10x). Omit or `null` for
55
+ * a campaign that only groups vouchers.
56
+ * @TJS-type ["integer", "null"]
57
+ */
58
+ multiplierBps?: number | null;
59
+ }
60
+ /** `activate`, `pause`, `resume` or `archive` on every voucher of a campaign, with each voucher's outcome. */
61
+ export interface CampaignVoucherActionResponse {
62
+ campaign: CampaignDto;
63
+ vouchers: VoucherBatchActionResult[];
64
+ }
@@ -0,0 +1,5 @@
1
+ /** The most an earn may be boosted: 10x, enforced on-chain too. */
2
+ export const CAMPAIGN_MAX_MULTIPLIER_BPS = 100_000;
3
+ export const CAMPAIGN_MAX_NAME_LENGTH = 160;
4
+ export const CAMPAIGN_MAX_DESCRIPTION_LENGTH = 2000;
5
+ //# sourceMappingURL=campaigns.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"campaigns.js","sourceRoot":"","sources":["../src/campaigns.ts"],"names":[],"mappings":"AAQA,mEAAmE;AACnE,MAAM,CAAC,MAAM,2BAA2B,GAAG,OAAO,CAAC;AACnD,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAC5C,MAAM,CAAC,MAAM,+BAA+B,GAAG,IAAI,CAAC"}
package/dist/console.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { ProgramTerms } from './organizations.js';
1
2
  import type { CreateVoucherRequest, UpdateVoucherRequest } from './rewards.js';
2
3
  import type { OrganizationPersona } from './system-users.js';
3
4
  export type OrganizationType = 'INDIVIDUAL_HOUSEHOLD' | 'COMPANY';
@@ -55,8 +56,14 @@ export interface ConsoleOrganization {
55
56
  logoUrl: string | null;
56
57
  /** Business Developers' vouchers need an Owner's approval before they go live. */
57
58
  voucherApprovalRequired: boolean;
59
+ /** IANA time zone its days start in, e.g. `Asia/Ho_Chi_Minh`. */
60
+ timeZone: string;
61
+ /** ISO 4217 code of its purchase amounts, e.g. `VND`. */
62
+ currency: string;
58
63
  /** Returned only to Business Owners. Never the full CCCD. */
59
64
  nationalIdLast4?: string | null;
65
+ /** The loyalty program's current terms; null until a `PROVISION_PROGRAM` request is approved and run. */
66
+ program: ProgramTerms | null;
60
67
  }
61
68
  export interface ConsoleStaff {
62
69
  id: string;
@@ -128,14 +135,18 @@ export interface ConsoleInvitationInput {
128
135
  email: string;
129
136
  persona?: 'BUSINESS_DEVELOPER';
130
137
  }
131
- /** `PATCH /v1/console/organizations/:id/settings`, Owner only. */
138
+ /** `PATCH /v1/console/organizations/:id/settings`, Owner only. Send one field or more. */
132
139
  export interface OrganizationSettingsInput {
133
140
  /**
134
141
  * When on, a Business Developer submits a voucher for approval instead of activating it, and an
135
142
  * API key asking for `ACTIVE` puts it in `PENDING_APPROVAL`. Owners never need approval. Turning
136
143
  * it off leaves vouchers already waiting as they are.
137
144
  */
138
- voucherApprovalRequired: boolean;
145
+ voucherApprovalRequired?: boolean;
146
+ /** An IANA time zone, e.g. `Asia/Ho_Chi_Minh`. */
147
+ timeZone?: string;
148
+ /** An ISO 4217 currency code, e.g. `VND`. */
149
+ currency?: string;
139
150
  }
140
151
  /**
141
152
  * `PATCH /v1/console/organizations/:id/vouchers/:voucherId`. `expectedUpdatedAt` is the voucher's
@@ -0,0 +1,36 @@
1
+ /**
2
+ * CSV exports: the organization's data as a file, for the console and, through a download link, the
3
+ * MCP assistant. `GET /v1/console/organizations/{organizationId}/exports/{dataset}.csv` streams the file
4
+ * to a signed-in user; `POST …/exports` returns a link to it, for 5 minutes, used once.
5
+ *
6
+ * Every file is UTF-8 with a byte order mark (so Excel reads Vietnamese names), comma-separated with
7
+ * RFC 4180 quoting, dates as ISO 8601 in the organization's time zone, and text cells that start
8
+ * with `=`, `+`, `-`, `@` or a control character prefixed with `'` so a spreadsheet never runs them as a
9
+ * formula. Every export is recorded in the organization's audit log (`export.<dataset>`).
10
+ */
11
+ export type ExportDataset = 'transactions' | 'members' | 'vouchers' | 'program-report' | 'audit-log';
12
+ /**
13
+ * Filters, by dataset. `from`/`to` (ISO 8601 with an offset; default the last 30 days, at most 366)
14
+ * apply to every dataset except `members`. `transactions` also takes `type`, `status` and `memberId`;
15
+ * `audit-log` takes `action` (exact, or a prefix ending in `.`).
16
+ */
17
+ export interface ExportQuery {
18
+ from?: string;
19
+ to?: string;
20
+ type?: string;
21
+ status?: string;
22
+ memberId?: string;
23
+ action?: string;
24
+ }
25
+ /** `POST /v1/console/organizations/{organizationId}/exports`. */
26
+ export interface ExportLinkInput extends ExportQuery {
27
+ dataset: ExportDataset;
28
+ }
29
+ /** A download link: anyone holding it downloads the file once, within 5 minutes, as the user who asked. */
30
+ export interface ExportLink {
31
+ dataset: ExportDataset;
32
+ url: string;
33
+ expiresAt: string;
34
+ /** Rows the file holds, counted when the link was made. */
35
+ rows: number;
36
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=exports.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exports.js","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":""}
@@ -1,5 +1,5 @@
1
1
  import type { OrganizationIdentityInput, OrganizationType } from './console.js';
2
- export type GovernanceRequestType = 'UPDATE_PROFILE' | 'TRANSFER_OWNERSHIP' | 'DEACTIVATE' | 'BUDGET_TOP_UP' | 'SUSPEND' | 'REINSTATE' | 'UPDATE_IDENTITY';
2
+ export type GovernanceRequestType = 'UPDATE_PROFILE' | 'TRANSFER_OWNERSHIP' | 'DEACTIVATE' | 'BUDGET_TOP_UP' | 'SUSPEND' | 'REINSTATE' | 'UPDATE_IDENTITY' | 'UPDATE_EARN_RATE' | 'PROVISION_PROGRAM';
3
3
  /**
4
4
  * `UPDATE_IDENTITY` replaces an organization's legal details once a System Admin approves it. Send
5
5
  * at least one field; `organizationType` only classifies an organization that has none yet. The
@@ -11,10 +11,23 @@ export interface IdentityChangePayload extends OrganizationIdentityInput {
11
11
  export interface GovernanceProposal {
12
12
  requestType: GovernanceRequestType;
13
13
  reason: string;
14
+ /**
15
+ * The program terms are the merchant's to choose and are proposed by the organization's Owner
16
+ * only; a System Admin approves or rejects them with a reason, and never proposes them:
17
+ * - `PROVISION_PROGRAM`: `{ earnBps, expiryDays, totalBudget }` sets up the organization's loyalty
18
+ * program. `earnBps` 0–10000 (points per 10,000 units of purchase), `expiryDays` 1–3650 (how
19
+ * long earned points last; never changes afterwards), `totalBudget` a positive whole number of
20
+ * points it may issue.
21
+ * - `BUDGET_TOP_UP`: `{ amount }`, a positive whole number of points. The budget only grows.
22
+ * - `UPDATE_EARN_RATE`: `{ earnBps }`, 0–10000, which replaces the base earn rate once approved.
23
+ */
14
24
  payload: {
15
25
  name?: string;
16
26
  targetUserId?: string;
17
27
  amount?: number;
28
+ earnBps?: number;
29
+ expiryDays?: number;
30
+ totalBudget?: number;
18
31
  } & IdentityChangePayload;
19
32
  }
20
33
  export interface GovernanceRequest {
@@ -44,6 +57,47 @@ export interface GovernanceRequestListQuery {
44
57
  /** @format uuid */
45
58
  organizationId?: string;
46
59
  }
60
+ /** `GET /v1/console/organizations/:id/change-requests` query: the organization's own requests. */
61
+ export interface ConsoleChangeRequestListQuery {
62
+ /** 1–100, default 25. */
63
+ limit?: number;
64
+ /** The last page's `nextCursor`. @format uuid */
65
+ cursor?: string;
66
+ status?: GovernanceRequestStatus;
67
+ requestType?: GovernanceRequestType;
68
+ }
69
+ /**
70
+ * The worker command an approved program request queued (`PROVISION_PROGRAM`, `BUDGET_TOP_UP`,
71
+ * `UPDATE_EARN_RATE`). `PENDING`/`PROCESSING`: being applied. `SUBMITTED`: applied. `FAILED`: not
72
+ * applied, nothing reached the chain. `UNKNOWN`: may have reached the chain; OctaP is checking it.
73
+ */
74
+ export interface ChangeRequestCommand {
75
+ operationId: string;
76
+ status: 'PENDING' | 'PROCESSING' | 'SUBMITTED' | 'FAILED' | 'UNKNOWN';
77
+ errorMessage: string | null;
78
+ updatedAt: string;
79
+ }
80
+ /** One of the organization's change requests, as its Owner and Business Developers see it. */
81
+ export interface ConsoleChangeRequest {
82
+ id: string;
83
+ requestType: GovernanceRequestType | 'CREATE_ORGANIZATION';
84
+ status: GovernanceRequestStatus;
85
+ /** What was asked for. Never a CCCD: `UPDATE_IDENTITY` keeps only `nationalIdLast4`. */
86
+ payload: unknown;
87
+ requestedById: string;
88
+ /** The proposer's reason. */
89
+ requestReason: string | null;
90
+ /** The System Admin's reason; null while `PENDING`. */
91
+ reviewReason: string | null;
92
+ reviewedAt: string | null;
93
+ createdAt: string;
94
+ /** Null for a request that queues no command, or one not approved. */
95
+ command: ChangeRequestCommand | null;
96
+ }
97
+ export interface ConsoleChangeRequestPage {
98
+ items: ConsoleChangeRequest[];
99
+ nextCursor: string | null;
100
+ }
47
101
  /** Body of an approve or reject decision. */
48
102
  export interface ReviewDecisionInput {
49
103
  /** 1–1000 characters. */
@@ -1,30 +1,57 @@
1
- export interface GoogleLoginRequest {
2
- idToken: string;
1
+ /** The zkLogin proof for the merchant page's own ephemeral key, as `@mysten/sui/zklogin` reads it. */
2
+ export interface ZkLoginProofInputs {
3
+ proofPoints: {
4
+ a: string[];
5
+ b: string[][];
6
+ c: string[];
7
+ };
8
+ issBase64Details: {
9
+ value: string;
10
+ indexMod4: number;
11
+ };
12
+ headerBase64: string;
13
+ addressSeed: string;
3
14
  }
4
- export interface GoogleLoginResponse {
5
- endUserId: string;
6
- suiAddress: string;
7
- isNewUser: boolean;
15
+ /**
16
+ * What Core's hosted sign-in page posts to the merchant page that opened it (OCT-394), and the
17
+ * response of `POST /v1/identity/sign-in/complete`. Google's id_token is not in it.
18
+ */
19
+ export interface CustomerSignInResult {
20
+ /** For the merchant's backend to check with `verifyCustomer`. Valid for this organization only. */
21
+ customerToken: string;
22
+ user: {
23
+ endUserId: string;
24
+ /** The customer's `organizationEndUserId` in this organization. */
25
+ memberId: string;
26
+ suiAddress: string;
27
+ };
28
+ /** Lets the page sign with its ephemeral key until `expiresAt` (ms since the epoch). */
29
+ signer: {
30
+ proof: ZkLoginProofInputs;
31
+ maxEpoch: number;
32
+ expiresAt: number;
33
+ };
8
34
  }
9
- export interface EnrollMemberRequest {
10
- /** Proves which customer is enrolling; the end user is derived from it, never supplied. */
11
- idToken: string;
12
- }
13
- export interface EnrollMemberResponse {
14
- organizationEndUserId: string;
15
- /** The end user the id_token proved, so a caller can check it against the customer it expected. */
16
- endUserId: string;
17
- isNewEnrollment: boolean;
35
+ export interface CompleteCustomerSignInRequest {
36
+ requestId: string;
37
+ /** Google's credential, posted by Core's own sign-in page. */
38
+ credential: string;
18
39
  }
19
40
  export interface VerifyCustomerRequest {
41
+ /** The customer token from `@octap/browser-sdk`'s `getIdToken()`. */
20
42
  idToken: string;
21
43
  }
22
44
  export interface VerifyCustomerResponse {
23
- /** Null when this Google account has never signed in to OctaP. */
45
+ /** Null only when the customer's account was removed after they signed in. */
24
46
  endUserId: string | null;
25
47
  suiAddress: string;
26
- /** The `organizationEndUserId` in the calling organization; null until the customer enrolls. */
48
+ /** The `organizationEndUserId` in the calling organization; null if the membership was removed. */
27
49
  memberId: string | null;
28
50
  /** True only when reward operations will accept this member: enrolled and not blocked. */
29
51
  active: boolean;
30
52
  }
53
+ /** The web origins whose pages may receive a customer's sign-in for one organization (OCT-394). */
54
+ export interface SignInOriginsDto {
55
+ /** e.g. `https://shop.example`; `http://localhost:3000` for development. Empty refuses every page. */
56
+ origins: string[];
57
+ }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './loyalty.js';
2
2
  export * from './rewards.js';
3
+ export * from './campaigns.js';
3
4
  export * from './voucher-refunds.js';
4
5
  export * from './webhooks.js';
5
6
  export * from './organization-events.js';
@@ -10,8 +11,14 @@ export * from './members.js';
10
11
  export * from './governance.js';
11
12
  export * from './organizations.js';
12
13
  export * from './mcp-auth.js';
14
+ export * from './mcp-tool-calls.js';
13
15
  export * from './assistant.js';
14
16
  export * from './request-logs.js';
17
+ export * from './licensing.js';
15
18
  export * from './audit.js';
16
19
  export * from './evidence.js';
17
20
  export * from './analytics.js';
21
+ export * from './exports.js';
22
+ export * from './member-insights.js';
23
+ export * from './platform-observability.js';
24
+ export * from './notifications.js';
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './loyalty.js';
2
2
  export * from './rewards.js';
3
+ export * from './campaigns.js';
3
4
  export * from './voucher-refunds.js';
4
5
  export * from './webhooks.js';
5
6
  export * from './organization-events.js';
@@ -10,9 +11,15 @@ export * from './members.js';
10
11
  export * from './governance.js';
11
12
  export * from './organizations.js';
12
13
  export * from './mcp-auth.js';
14
+ export * from './mcp-tool-calls.js';
13
15
  export * from './assistant.js';
14
16
  export * from './request-logs.js';
17
+ export * from './licensing.js';
15
18
  export * from './audit.js';
16
19
  export * from './evidence.js';
17
20
  export * from './analytics.js';
21
+ export * from './exports.js';
22
+ export * from './member-insights.js';
23
+ export * from './platform-observability.js';
24
+ export * from './notifications.js';
18
25
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC"}