@loyaltte/node 0.0.0-stage → 0.1.1
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/LICENSE +21 -0
- package/README.md +238 -2
- package/dist/cjs/client.d.ts +105 -0
- package/dist/cjs/client.js +278 -0
- package/dist/cjs/errors.d.ts +61 -0
- package/dist/cjs/errors.js +96 -0
- package/dist/cjs/identity.d.ts +23 -0
- package/dist/cjs/identity.js +27 -0
- package/dist/cjs/index.d.ts +11 -0
- package/dist/cjs/index.js +27 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/transport.d.ts +50 -0
- package/dist/cjs/transport.js +212 -0
- package/dist/cjs/types.d.ts +195 -0
- package/dist/cjs/types.js +3 -0
- package/dist/cjs/version.d.ts +2 -0
- package/dist/cjs/version.js +5 -0
- package/dist/cjs/webhooks.d.ts +27 -0
- package/dist/cjs/webhooks.js +71 -0
- package/dist/esm/client.d.ts +105 -0
- package/dist/esm/client.js +273 -0
- package/dist/esm/errors.d.ts +61 -0
- package/dist/esm/errors.js +81 -0
- package/dist/esm/identity.d.ts +23 -0
- package/dist/esm/identity.js +24 -0
- package/dist/esm/index.d.ts +11 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/transport.d.ts +50 -0
- package/dist/esm/transport.js +206 -0
- package/dist/esm/types.d.ts +195 -0
- package/dist/esm/types.js +2 -0
- package/dist/esm/version.d.ts +2 -0
- package/dist/esm/version.js +2 -0
- package/dist/esm/webhooks.d.ts +27 -0
- package/dist/esm/webhooks.js +66 -0
- package/package.json +57 -3
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/** A decimal amount in rupees as text, like `"4200.00"`. Never a number: floats lose paise. */
|
|
2
|
+
export type Money = string;
|
|
3
|
+
export interface KeyInfo {
|
|
4
|
+
key_id: string;
|
|
5
|
+
/** `live` or `test`. */
|
|
6
|
+
mode: "live" | "test";
|
|
7
|
+
/** The permissions this key holds, e.g. `bills:write`. */
|
|
8
|
+
scopes: string[];
|
|
9
|
+
account: {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
};
|
|
13
|
+
/** The ids of the stores this key may use. */
|
|
14
|
+
stores: string[];
|
|
15
|
+
}
|
|
16
|
+
/** Say who a customer is: any one of these. */
|
|
17
|
+
export interface CustomerRef {
|
|
18
|
+
phone?: string | null;
|
|
19
|
+
customer_id?: string | null;
|
|
20
|
+
external_id?: string | null;
|
|
21
|
+
email?: string | null;
|
|
22
|
+
}
|
|
23
|
+
export interface ServerEvent {
|
|
24
|
+
/** Your id for the event; a resend with the same id is counted once. */
|
|
25
|
+
id?: string;
|
|
26
|
+
/** `page_viewed`, `product_viewed`, `cart_updated`, `checkout_started` or your own name. */
|
|
27
|
+
type: string;
|
|
28
|
+
/** ISO 8601; not older than 7 days. */
|
|
29
|
+
occurred_at?: string;
|
|
30
|
+
/** The visitor (8-128 letters, digits or . _ : -). */
|
|
31
|
+
anonymous_id?: string;
|
|
32
|
+
customer?: {
|
|
33
|
+
phone?: string;
|
|
34
|
+
email?: string;
|
|
35
|
+
external_id?: string;
|
|
36
|
+
};
|
|
37
|
+
properties?: Record<string, unknown>;
|
|
38
|
+
}
|
|
39
|
+
export interface EventsResult {
|
|
40
|
+
accepted: number;
|
|
41
|
+
duplicates: number;
|
|
42
|
+
rejected: {
|
|
43
|
+
index: number;
|
|
44
|
+
id?: string;
|
|
45
|
+
reason: string;
|
|
46
|
+
}[];
|
|
47
|
+
dropped_properties: unknown[];
|
|
48
|
+
}
|
|
49
|
+
export interface IdentifyParams {
|
|
50
|
+
/** The visitor's anonymous id. */
|
|
51
|
+
anonymous_id: string;
|
|
52
|
+
/** At least one of these says which customer. */
|
|
53
|
+
phone?: string;
|
|
54
|
+
email?: string;
|
|
55
|
+
external_id?: string;
|
|
56
|
+
}
|
|
57
|
+
export interface IdentifyResult {
|
|
58
|
+
status: string;
|
|
59
|
+
/** How many of the visitor's earlier events became the customer's. */
|
|
60
|
+
earlier_events: number;
|
|
61
|
+
}
|
|
62
|
+
export interface LookupParams {
|
|
63
|
+
phone?: string;
|
|
64
|
+
email?: string;
|
|
65
|
+
external_id?: string;
|
|
66
|
+
}
|
|
67
|
+
export interface Customer {
|
|
68
|
+
id: string;
|
|
69
|
+
name: string | null;
|
|
70
|
+
phone: string | null;
|
|
71
|
+
email: string | null;
|
|
72
|
+
external_ids: string[];
|
|
73
|
+
member: boolean;
|
|
74
|
+
program: string | null;
|
|
75
|
+
tier: string | null;
|
|
76
|
+
points_balance: number;
|
|
77
|
+
points_value: Money;
|
|
78
|
+
lifetime_spend: Money;
|
|
79
|
+
visits: number;
|
|
80
|
+
last_visit_at: string | null;
|
|
81
|
+
joined_at: string | null;
|
|
82
|
+
consent: Record<string, string>;
|
|
83
|
+
}
|
|
84
|
+
export interface LookupResult {
|
|
85
|
+
found: boolean;
|
|
86
|
+
customer: Customer | null;
|
|
87
|
+
}
|
|
88
|
+
export interface CustomerResult {
|
|
89
|
+
customer: Customer;
|
|
90
|
+
}
|
|
91
|
+
export interface Points {
|
|
92
|
+
customer_id: string;
|
|
93
|
+
balance: number;
|
|
94
|
+
lifetime_earned: number;
|
|
95
|
+
lifetime_redeemed: number;
|
|
96
|
+
/** Points expiring in the next 30 days. */
|
|
97
|
+
expiring_soon: number;
|
|
98
|
+
}
|
|
99
|
+
export interface BillLine {
|
|
100
|
+
amount: Money;
|
|
101
|
+
name?: string;
|
|
102
|
+
sku?: string | null;
|
|
103
|
+
category?: string | null;
|
|
104
|
+
quantity?: string | number;
|
|
105
|
+
}
|
|
106
|
+
export interface BillPreviewParams {
|
|
107
|
+
store_id: string;
|
|
108
|
+
amount: Money;
|
|
109
|
+
/** Leave out for a walk-in. */
|
|
110
|
+
customer?: CustomerRef | null;
|
|
111
|
+
items?: BillLine[];
|
|
112
|
+
redeem_points?: number;
|
|
113
|
+
voucher_code?: string | null;
|
|
114
|
+
bill_number?: string | null;
|
|
115
|
+
/** ISO 8601 with a timezone offset; at most 7 days in the past and 5 minutes ahead. */
|
|
116
|
+
occurred_at?: string | null;
|
|
117
|
+
ebill_consent?: boolean | null;
|
|
118
|
+
how_identified?: "phone" | "qr" | "member_code" | "pos" | null;
|
|
119
|
+
}
|
|
120
|
+
export interface BillParams extends BillPreviewParams {
|
|
121
|
+
/** Unique per bill: the same bill again returns the first receipt with `replayed: true`. */
|
|
122
|
+
bill_number: string;
|
|
123
|
+
}
|
|
124
|
+
export interface BillPreview {
|
|
125
|
+
customer_found: boolean;
|
|
126
|
+
member: boolean;
|
|
127
|
+
subtotal: Money;
|
|
128
|
+
voucher: unknown;
|
|
129
|
+
points_balance: number;
|
|
130
|
+
max_redeemable_points: number;
|
|
131
|
+
point_value: Money;
|
|
132
|
+
redeem_points: number;
|
|
133
|
+
points_discount: Money;
|
|
134
|
+
payable: Money;
|
|
135
|
+
earn: {
|
|
136
|
+
points: number;
|
|
137
|
+
};
|
|
138
|
+
program_here: boolean;
|
|
139
|
+
program_note: string | null;
|
|
140
|
+
referral: unknown;
|
|
141
|
+
/** Anything that would stop the bill going through. */
|
|
142
|
+
problems: unknown[];
|
|
143
|
+
limit_reached: boolean;
|
|
144
|
+
points_left_today: number | null;
|
|
145
|
+
ebill: unknown;
|
|
146
|
+
}
|
|
147
|
+
export interface Bill {
|
|
148
|
+
bill_id: string;
|
|
149
|
+
bill_number: string;
|
|
150
|
+
customer_id: string | null;
|
|
151
|
+
voucher: unknown;
|
|
152
|
+
points_discount: Money;
|
|
153
|
+
/** True when this is the first receipt again (a retry or a repeat), nothing new was recorded. */
|
|
154
|
+
replayed: boolean;
|
|
155
|
+
subtotal: Money;
|
|
156
|
+
discount: Money;
|
|
157
|
+
payable: Money;
|
|
158
|
+
points_earned: number;
|
|
159
|
+
points_spent: number;
|
|
160
|
+
referral_points: number;
|
|
161
|
+
points_balance: number;
|
|
162
|
+
earn: {
|
|
163
|
+
points: number;
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
export interface ReturnParams {
|
|
167
|
+
/** The original bill. */
|
|
168
|
+
bill_number: string;
|
|
169
|
+
/** Unique per return. */
|
|
170
|
+
return_number: string;
|
|
171
|
+
/** The amount returned, in rupees. */
|
|
172
|
+
amount: Money;
|
|
173
|
+
}
|
|
174
|
+
export interface BillReturn {
|
|
175
|
+
bill_id: string;
|
|
176
|
+
bill_number: string;
|
|
177
|
+
customer_id: string | null;
|
|
178
|
+
customer_name: string | null;
|
|
179
|
+
replayed: boolean;
|
|
180
|
+
returned_amount: Money;
|
|
181
|
+
points_taken_back: number;
|
|
182
|
+
points_given_back: number;
|
|
183
|
+
points_balance: number;
|
|
184
|
+
}
|
|
185
|
+
/** A webhook from Loyaltte, after `constructEvent` has verified it. */
|
|
186
|
+
export interface WebhookEvent<T = Record<string, unknown>> {
|
|
187
|
+
/** Unique per event: ignore one you have handled. */
|
|
188
|
+
id: string;
|
|
189
|
+
/** e.g. `purchase.completed`. */
|
|
190
|
+
type: string;
|
|
191
|
+
created_at: string;
|
|
192
|
+
account_id: string;
|
|
193
|
+
/** Always has `customer_id` and `store_id` (either may be null); never a phone number or email. */
|
|
194
|
+
data: T;
|
|
195
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { WebhookEvent } from "./types.js";
|
|
2
|
+
export interface VerifyParams {
|
|
3
|
+
/** The signing secret (`whsec_…`). During a rotation pass `secrets` instead. */
|
|
4
|
+
secret?: string;
|
|
5
|
+
/** Every signing secret you currently hold (two during a rotation). */
|
|
6
|
+
secrets?: string[];
|
|
7
|
+
/** The `Loyaltte-Signature` header: `t=<unix seconds>,v1=<hex>[,v1=<hex>]`. */
|
|
8
|
+
header: string | null | undefined;
|
|
9
|
+
/** The request body exactly as received: a Buffer or the raw string, never parsed-and-stringified JSON. */
|
|
10
|
+
rawBody: string | Buffer | Uint8Array;
|
|
11
|
+
/** How far `t` may be from now, in seconds. Default 300. */
|
|
12
|
+
toleranceSeconds?: number;
|
|
13
|
+
/** Unix seconds to treat as now (tests). */
|
|
14
|
+
now?: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Checks a webhook's signature. Never throws: a header it can't read, a stale timestamp or a wrong signature is
|
|
18
|
+
* `false`. The signature is the hex HMAC-SHA256, keyed with the signing secret, of `<t>.` plus the raw body;
|
|
19
|
+
* any `v1` in the header may match (a rotation sends two); the comparison is constant time.
|
|
20
|
+
*/
|
|
21
|
+
export declare function verify(params: VerifyParams): boolean;
|
|
22
|
+
/** Verifies the signature and returns the parsed event; throws `WebhookSignatureError` when it can't be trusted. */
|
|
23
|
+
export declare function constructEvent<T = Record<string, unknown>>(params: VerifyParams): WebhookEvent<T>;
|
|
24
|
+
export declare const webhooks: {
|
|
25
|
+
verify: typeof verify;
|
|
26
|
+
constructEvent: typeof constructEvent;
|
|
27
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.webhooks = void 0;
|
|
4
|
+
exports.verify = verify;
|
|
5
|
+
exports.constructEvent = constructEvent;
|
|
6
|
+
const node_crypto_1 = require("node:crypto");
|
|
7
|
+
const errors_js_1 = require("./errors.js");
|
|
8
|
+
const HEX64 = /^[0-9a-fA-F]{64}$/;
|
|
9
|
+
const DIGITS = /^\d{1,15}$/;
|
|
10
|
+
/**
|
|
11
|
+
* Checks a webhook's signature. Never throws: a header it can't read, a stale timestamp or a wrong signature is
|
|
12
|
+
* `false`. The signature is the hex HMAC-SHA256, keyed with the signing secret, of `<t>.` plus the raw body;
|
|
13
|
+
* any `v1` in the header may match (a rotation sends two); the comparison is constant time.
|
|
14
|
+
*/
|
|
15
|
+
function verify(params) {
|
|
16
|
+
try {
|
|
17
|
+
const { header, rawBody, toleranceSeconds = 300 } = params;
|
|
18
|
+
const secrets = [
|
|
19
|
+
...(Array.isArray(params.secrets) ? params.secrets : []),
|
|
20
|
+
...(params.secret ? [params.secret] : []),
|
|
21
|
+
].filter((s) => typeof s === "string" && s !== "");
|
|
22
|
+
if (typeof header !== "string" || secrets.length === 0)
|
|
23
|
+
return false;
|
|
24
|
+
if (!Number.isFinite(toleranceSeconds) || toleranceSeconds < 0)
|
|
25
|
+
return false; // never "accept everything"
|
|
26
|
+
const pairs = header.split(",").map((part) => {
|
|
27
|
+
const at = part.indexOf("=");
|
|
28
|
+
return at < 0 ? [part.trim(), ""] : [part.slice(0, at).trim(), part.slice(at + 1).trim()];
|
|
29
|
+
});
|
|
30
|
+
const stamps = pairs.filter(([k]) => k === "t").map(([, v]) => v);
|
|
31
|
+
const t = stamps[0];
|
|
32
|
+
if (stamps.length !== 1 || t === undefined || !DIGITS.test(t))
|
|
33
|
+
return false;
|
|
34
|
+
const now = params.now ?? Math.floor(Date.now() / 1000);
|
|
35
|
+
if (!Number.isFinite(now))
|
|
36
|
+
return false;
|
|
37
|
+
if (Math.abs(now - Number(t)) > toleranceSeconds)
|
|
38
|
+
return false;
|
|
39
|
+
const body = typeof rawBody === "string" ? Buffer.from(rawBody, "utf8") : Buffer.from(rawBody);
|
|
40
|
+
const given = pairs
|
|
41
|
+
.filter(([k, v]) => k === "v1" && HEX64.test(v ?? ""))
|
|
42
|
+
.map(([, v]) => Buffer.from(v, "hex"));
|
|
43
|
+
let matched = false;
|
|
44
|
+
for (const secret of secrets) {
|
|
45
|
+
const expected = (0, node_crypto_1.createHmac)("sha256", secret).update(`${t}.`).update(body).digest();
|
|
46
|
+
// every comparison runs, so the time doesn't say which one matched
|
|
47
|
+
for (const candidate of given)
|
|
48
|
+
if ((0, node_crypto_1.timingSafeEqual)(candidate, expected))
|
|
49
|
+
matched = true;
|
|
50
|
+
}
|
|
51
|
+
return matched;
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/** Verifies the signature and returns the parsed event; throws `WebhookSignatureError` when it can't be trusted. */
|
|
58
|
+
function constructEvent(params) {
|
|
59
|
+
if (!verify(params))
|
|
60
|
+
throw new errors_js_1.WebhookSignatureError();
|
|
61
|
+
const text = typeof params.rawBody === "string"
|
|
62
|
+
? params.rawBody
|
|
63
|
+
: Buffer.from(params.rawBody).toString("utf8");
|
|
64
|
+
try {
|
|
65
|
+
return JSON.parse(text);
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
throw new errors_js_1.WebhookSignatureError("The webhook body is signed but is not JSON.");
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.webhooks = { verify, constructEvent };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { signIdentity } from "./identity.js";
|
|
2
|
+
import { Transport, type FetchLike, type Operation } from "./transport.js";
|
|
3
|
+
import type { Bill, BillParams, BillPreview, BillPreviewParams, BillReturn, CustomerResult, EventsResult, IdentifyParams, IdentifyResult, KeyInfo, LookupParams, LookupResult, Points, ReturnParams, ServerEvent } from "./types.js";
|
|
4
|
+
/** `x-limits.maxEventsPerBatch` in the spec. */
|
|
5
|
+
export declare const MAX_EVENTS_PER_BATCH = 100;
|
|
6
|
+
/** `x-limits.maxBodyBytes` in the spec. */
|
|
7
|
+
export declare const MAX_BODY_BYTES = 65536;
|
|
8
|
+
export interface LoyaltteOptions {
|
|
9
|
+
/** Default `https://api.loyaltte.com`. */
|
|
10
|
+
baseUrl?: string;
|
|
11
|
+
/** Per attempt, in milliseconds. Default 30000. */
|
|
12
|
+
timeoutMs?: number;
|
|
13
|
+
/** Retries after the first attempt. Default 7 (the spec's 8 attempts); 0 turns retries off. */
|
|
14
|
+
maxRetries?: number;
|
|
15
|
+
/** Your own `fetch` (a proxy, a test double). Default: the global one. */
|
|
16
|
+
fetch?: FetchLike;
|
|
17
|
+
/** @internal Tests replace the wait between attempts. */
|
|
18
|
+
sleep?: (ms: number) => Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
export interface IdempotencyOptions {
|
|
21
|
+
/**
|
|
22
|
+
* 1-255 characters. Use your own order id and a retry from a crashed process is safe too. When left out the SDK
|
|
23
|
+
* makes a UUID v4 for the call and reuses it on every retry.
|
|
24
|
+
*/
|
|
25
|
+
idempotencyKey?: string;
|
|
26
|
+
}
|
|
27
|
+
/** `lyt_live_abcd…wxyz` -> `lyt_live_...wxyz`: enough to tell keys apart, never the key. */
|
|
28
|
+
export declare function maskKey(key: string): string;
|
|
29
|
+
declare class Resource {
|
|
30
|
+
#private;
|
|
31
|
+
constructor(transport: Transport);
|
|
32
|
+
protected call<T>(operation: Operation, input?: Parameters<Transport["request"]>[1]): Promise<T>;
|
|
33
|
+
}
|
|
34
|
+
/** `GET /v1/key`. */
|
|
35
|
+
declare class KeyResource extends Resource {
|
|
36
|
+
/** Which account and mode the key is for, its permissions and stores. A good first call. */
|
|
37
|
+
retrieve(): Promise<KeyInfo>;
|
|
38
|
+
}
|
|
39
|
+
declare class EventsResource extends Resource {
|
|
40
|
+
#private;
|
|
41
|
+
/**
|
|
42
|
+
* Sends events (`POST /v1/events`). A longer list is sent in order as several requests of at most 100 events and
|
|
43
|
+
* 64 KiB each, and the answers are summed (`accepted`, `duplicates`; `rejected` entries keep the index the server gave,
|
|
44
|
+
* which is within their own batch). An empty list is a ValidationError before anything is sent. If a batch fails the error is raised and the
|
|
45
|
+
* earlier batches stay accepted: give every event an `id` and resend them all, a repeat is counted once.
|
|
46
|
+
*/
|
|
47
|
+
send(events: ServerEvent[]): Promise<EventsResult>;
|
|
48
|
+
}
|
|
49
|
+
declare class VisitorsResource extends Resource {
|
|
50
|
+
/** Ties a visitor's `anonymous_id` to a customer (`POST /v1/identify`); their earlier events become the customer's. */
|
|
51
|
+
identify(params: IdentifyParams): Promise<IdentifyResult>;
|
|
52
|
+
}
|
|
53
|
+
declare class CustomersResource extends Resource {
|
|
54
|
+
/** Finds a customer by `phone`, `email` or `external_id` (`GET /v1/customers/lookup`). `found` is false when there is none. */
|
|
55
|
+
lookup(params: LookupParams): Promise<LookupResult>;
|
|
56
|
+
/** The profile summary (`GET /v1/customers/{id}`): membership, tier, points, lifetime spend, consent. */
|
|
57
|
+
retrieve(customerId: string): Promise<CustomerResult>;
|
|
58
|
+
/** The balance, lifetime earned and redeemed, and points expiring soon (`GET /v1/customers/{id}/points`). */
|
|
59
|
+
points(customerId: string): Promise<Points>;
|
|
60
|
+
}
|
|
61
|
+
declare class BillsResource extends Resource {
|
|
62
|
+
/** Works a bill out without recording it (`POST /v1/bills/preview`). Amounts are decimal strings. */
|
|
63
|
+
preview(body: BillPreviewParams): Promise<BillPreview>;
|
|
64
|
+
/**
|
|
65
|
+
* Records a bill (`POST /v1/bills`), exactly once: the call carries an Idempotency-Key (yours, or one the SDK
|
|
66
|
+
* makes) that every retry reuses, so a lost reply never records the bill twice. A repeat comes back with
|
|
67
|
+
* `replayed: true`.
|
|
68
|
+
*/
|
|
69
|
+
create(body: BillParams, options?: IdempotencyOptions): Promise<Bill>;
|
|
70
|
+
}
|
|
71
|
+
declare class ReturnsResource extends Resource {
|
|
72
|
+
/** Records a full or part return against an earlier bill (`POST /v1/returns`), exactly once like `bills.create`. */
|
|
73
|
+
create(body: ReturnParams, options?: IdempotencyOptions): Promise<BillReturn>;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The Loyaltte server client. Use a SECRET key (`lyt_live_…` / `lyt_test_…`) and only on your server.
|
|
77
|
+
*
|
|
78
|
+
* ```ts
|
|
79
|
+
* const loyaltte = new Loyaltte(process.env.LOYALTTE_SECRET_KEY!);
|
|
80
|
+
* const key = await loyaltte.key.retrieve();
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
export declare class Loyaltte {
|
|
84
|
+
/** Signs a customer in for the app SDK: see {@link signIdentity}. */
|
|
85
|
+
static readonly signIdentity: typeof signIdentity;
|
|
86
|
+
/** Checks and parses the webhooks Loyaltte sends. */
|
|
87
|
+
static readonly webhooks: {
|
|
88
|
+
verify: typeof import("./webhooks.js").verify;
|
|
89
|
+
constructEvent: typeof import("./webhooks.js").constructEvent;
|
|
90
|
+
};
|
|
91
|
+
readonly key: KeyResource;
|
|
92
|
+
readonly events: EventsResource;
|
|
93
|
+
readonly visitors: VisitorsResource;
|
|
94
|
+
readonly customers: CustomersResource;
|
|
95
|
+
readonly bills: BillsResource;
|
|
96
|
+
readonly returns: ReturnsResource;
|
|
97
|
+
/** The key, masked: `lyt_live_...wxyz`. The key itself is not kept anywhere you can read it. */
|
|
98
|
+
readonly maskedKey: string;
|
|
99
|
+
constructor(secretKey: string, options?: LoyaltteOptions);
|
|
100
|
+
toString(): string;
|
|
101
|
+
toJSON(): {
|
|
102
|
+
key: string;
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
export {};
|