@tolinku/web-sdk 0.1.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 +52 -2
- package/dist/index.d.mts +145 -3
- package/dist/index.d.ts +145 -3
- package/dist/index.js +454 -56
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +454 -56
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -84,6 +84,32 @@ await tolinku.referrals.claimReward(referral_code);
|
|
|
84
84
|
const { leaderboard } = await tolinku.referrals.leaderboard(10);
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
+
### Ecommerce
|
|
88
|
+
|
|
89
|
+
Track purchases, cart activity, and product events with built-in revenue analytics. Available on paid plans.
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
tolinku.setUserId('user_123');
|
|
93
|
+
|
|
94
|
+
// Track a product view
|
|
95
|
+
await tolinku.ecommerce.viewItem({
|
|
96
|
+
items: [{ item_id: 'sku_1', item_name: 'T-Shirt', price: 24.99 }]
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
// Track a purchase
|
|
100
|
+
await tolinku.ecommerce.purchase({
|
|
101
|
+
transaction_id: 'order_456',
|
|
102
|
+
revenue: 49.99,
|
|
103
|
+
currency: 'USD',
|
|
104
|
+
items: [{ item_id: 'sku_1', item_name: 'T-Shirt', price: 24.99, quantity: 2 }]
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
// Flush ecommerce events
|
|
108
|
+
await tolinku.ecommerce.flush();
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
The SDK supports 13 event types: `viewItem`, `addToCart`, `removeFromCart`, `addToWishlist`, `viewCart`, `addPaymentInfo`, `beginCheckout`, `purchase`, `refund`, `search`, `share`, `rate`, and `spendCredits`. Cart IDs are managed automatically via `sessionStorage` and cleared after purchase.
|
|
112
|
+
|
|
87
113
|
### Deferred Deep Links
|
|
88
114
|
|
|
89
115
|
Recover deep link context for users who installed your app after clicking a link. Deferred deep linking lets you route users to specific content even when the app was not installed at the time of the click.
|
|
@@ -95,12 +121,17 @@ if (link) {
|
|
|
95
121
|
console.log(link.deep_link_path); // e.g. "/merchant/xyz"
|
|
96
122
|
}
|
|
97
123
|
|
|
98
|
-
// Claim by device signal matching
|
|
124
|
+
// Claim by device signal matching. Timezone, language, screen size and pixel ratio
|
|
125
|
+
// are detected for you.
|
|
99
126
|
const link = await tolinku.deferred.claimBySignals({
|
|
100
|
-
appspaceId: '
|
|
127
|
+
appspaceId: '64f0a1b2c3d4e5f60718',
|
|
101
128
|
});
|
|
102
129
|
```
|
|
103
130
|
|
|
131
|
+
`appspaceId` is your Appspace ID, not your subdomain or slug. Copy it from the dashboard
|
|
132
|
+
under **Integrate** or **Settings**. It looks like `64f0a1b2c3d4e5f60718`.
|
|
133
|
+
|
|
134
|
+
|
|
104
135
|
### In-App Messages
|
|
105
136
|
|
|
106
137
|
Display visually rich, server-configured messages as modal overlays. Create and manage messages from the Tolinku dashboard without shipping app updates.
|
|
@@ -175,6 +206,25 @@ tolinku.setUserId('user_123');
|
|
|
175
206
|
| `claimReward(code)` | Claim a referral reward |
|
|
176
207
|
| `leaderboard(limit?)` | Fetch the referral leaderboard |
|
|
177
208
|
|
|
209
|
+
### `tolinku.ecommerce`
|
|
210
|
+
|
|
211
|
+
| Method | Description |
|
|
212
|
+
|--------|-------------|
|
|
213
|
+
| `viewItem(params)` | Track a product view |
|
|
214
|
+
| `addToCart(params)` | Track item added to cart |
|
|
215
|
+
| `removeFromCart(params)` | Track item removed from cart |
|
|
216
|
+
| `addToWishlist(params)` | Track item added to wishlist |
|
|
217
|
+
| `viewCart()` | Track cart view |
|
|
218
|
+
| `addPaymentInfo()` | Track payment info entered |
|
|
219
|
+
| `beginCheckout(params?)` | Track checkout started |
|
|
220
|
+
| `purchase(params)` | Track a purchase |
|
|
221
|
+
| `refund(params)` | Track a refund |
|
|
222
|
+
| `search(params)` | Track a product search |
|
|
223
|
+
| `share(params)` | Track a product share |
|
|
224
|
+
| `rate(params)` | Track a product rating |
|
|
225
|
+
| `spendCredits(params)` | Track loyalty credits spent |
|
|
226
|
+
| `flush()` | Send all queued ecommerce events |
|
|
227
|
+
|
|
178
228
|
### `tolinku.deferred`
|
|
179
229
|
|
|
180
230
|
| Method | Description |
|
package/dist/index.d.mts
CHANGED
|
@@ -98,6 +98,8 @@ interface ClaimBySignalsOptions {
|
|
|
98
98
|
language?: string;
|
|
99
99
|
screenWidth?: number;
|
|
100
100
|
screenHeight?: number;
|
|
101
|
+
/** Defaults to `window.devicePixelRatio`. Override only if you report a custom screen size. */
|
|
102
|
+
devicePixelRatio?: number;
|
|
101
103
|
}
|
|
102
104
|
/** Banner config returned by the API */
|
|
103
105
|
interface BannerConfig {
|
|
@@ -118,13 +120,47 @@ interface BannerItem {
|
|
|
118
120
|
text_color: string;
|
|
119
121
|
cta_text: string | null;
|
|
120
122
|
position: string | null;
|
|
123
|
+
style: string | null;
|
|
124
|
+
shadow: string | null;
|
|
125
|
+
radius: number | null;
|
|
126
|
+
margin: number | null;
|
|
121
127
|
dismiss_days: number | null;
|
|
122
128
|
priority: number;
|
|
123
129
|
}
|
|
124
|
-
/** Options for showing a banner
|
|
130
|
+
/** Options for showing a banner. All fields are optional.
|
|
131
|
+
* Resolution chain per value: option → server config → theme → built-in default. */
|
|
125
132
|
interface ShowBannerOptions {
|
|
126
133
|
position?: 'top' | 'bottom';
|
|
134
|
+
style?: 'pinned' | 'floating' | 'stacked';
|
|
135
|
+
animation?: 'slide' | 'fade' | 'pop' | 'none';
|
|
136
|
+
theme?: 'light' | 'dark';
|
|
127
137
|
label?: string;
|
|
138
|
+
delay?: number;
|
|
139
|
+
/** Stacked-mode only: CSS selector for the element to inject before (top) or after (bottom).
|
|
140
|
+
* Falls back to auto-detect when omitted. */
|
|
141
|
+
anchor?: string;
|
|
142
|
+
bg?: string;
|
|
143
|
+
border?: string;
|
|
144
|
+
radius?: number;
|
|
145
|
+
margin?: number;
|
|
146
|
+
shadow?: 'none' | 'sm' | 'md' | 'lg';
|
|
147
|
+
titleColor?: string;
|
|
148
|
+
titleSize?: number;
|
|
149
|
+
titleWeight?: 400 | 500 | 600 | 700;
|
|
150
|
+
bodyColor?: string;
|
|
151
|
+
bodySize?: number;
|
|
152
|
+
bodyWeight?: 400 | 500 | 600 | 700;
|
|
153
|
+
ctaBg?: string;
|
|
154
|
+
ctaColor?: string;
|
|
155
|
+
ctaSize?: number;
|
|
156
|
+
ctaWeight?: 400 | 500 | 600 | 700;
|
|
157
|
+
ctaRadius?: number;
|
|
158
|
+
iconSize?: number;
|
|
159
|
+
iconRadius?: number;
|
|
160
|
+
hideIcon?: boolean;
|
|
161
|
+
hideClose?: boolean;
|
|
162
|
+
hideBody?: boolean;
|
|
163
|
+
customClass?: string;
|
|
128
164
|
}
|
|
129
165
|
/** In-app message from the API */
|
|
130
166
|
interface Message {
|
|
@@ -160,6 +196,78 @@ interface ShowMessageOptions {
|
|
|
160
196
|
onDismiss?: (messageId: string) => void;
|
|
161
197
|
onButtonPress?: (action: string, messageId: string) => void;
|
|
162
198
|
}
|
|
199
|
+
interface EcommerceItem {
|
|
200
|
+
item_id: string;
|
|
201
|
+
item_name?: string;
|
|
202
|
+
item_category?: string;
|
|
203
|
+
item_brand?: string;
|
|
204
|
+
item_variant?: string;
|
|
205
|
+
item_list_name?: string;
|
|
206
|
+
item_list_id?: string;
|
|
207
|
+
item_image_url?: string;
|
|
208
|
+
price?: number;
|
|
209
|
+
quantity?: number;
|
|
210
|
+
currency?: string;
|
|
211
|
+
coupon_code?: string;
|
|
212
|
+
discount?: number;
|
|
213
|
+
}
|
|
214
|
+
interface PurchaseParams {
|
|
215
|
+
transaction_id: string;
|
|
216
|
+
revenue: number;
|
|
217
|
+
currency: string;
|
|
218
|
+
items?: EcommerceItem[];
|
|
219
|
+
cart_id?: string;
|
|
220
|
+
coupon_code?: string;
|
|
221
|
+
discount?: number;
|
|
222
|
+
shipping?: number;
|
|
223
|
+
tax?: number;
|
|
224
|
+
}
|
|
225
|
+
interface AddToCartParams {
|
|
226
|
+
items: EcommerceItem[];
|
|
227
|
+
cart_id?: string;
|
|
228
|
+
}
|
|
229
|
+
interface RemoveFromCartParams {
|
|
230
|
+
items: EcommerceItem[];
|
|
231
|
+
cart_id?: string;
|
|
232
|
+
}
|
|
233
|
+
interface AddToWishlistParams {
|
|
234
|
+
items: EcommerceItem[];
|
|
235
|
+
}
|
|
236
|
+
interface BeginCheckoutParams {
|
|
237
|
+
revenue?: number;
|
|
238
|
+
currency?: string;
|
|
239
|
+
cart_id?: string;
|
|
240
|
+
items?: EcommerceItem[];
|
|
241
|
+
}
|
|
242
|
+
interface RefundParams {
|
|
243
|
+
transaction_id: string;
|
|
244
|
+
revenue: number;
|
|
245
|
+
currency?: string;
|
|
246
|
+
items?: EcommerceItem[];
|
|
247
|
+
}
|
|
248
|
+
interface ViewItemParams {
|
|
249
|
+
items: EcommerceItem[];
|
|
250
|
+
}
|
|
251
|
+
interface SearchParams {
|
|
252
|
+
search_term: string;
|
|
253
|
+
}
|
|
254
|
+
interface AddPaymentInfoParams {
|
|
255
|
+
cart_id?: string;
|
|
256
|
+
}
|
|
257
|
+
interface ShareParams {
|
|
258
|
+
item_id?: string;
|
|
259
|
+
url?: string;
|
|
260
|
+
method?: string;
|
|
261
|
+
}
|
|
262
|
+
interface RateParams {
|
|
263
|
+
item_id: string;
|
|
264
|
+
rating: number;
|
|
265
|
+
max_rating?: number;
|
|
266
|
+
}
|
|
267
|
+
interface SpendCreditsParams {
|
|
268
|
+
revenue: number;
|
|
269
|
+
currency: string;
|
|
270
|
+
}
|
|
163
271
|
|
|
164
272
|
declare class HttpClient {
|
|
165
273
|
private _baseUrl;
|
|
@@ -225,6 +333,38 @@ declare class Analytics {
|
|
|
225
333
|
destroy(): void;
|
|
226
334
|
}
|
|
227
335
|
|
|
336
|
+
declare class Ecommerce {
|
|
337
|
+
private client;
|
|
338
|
+
private queue;
|
|
339
|
+
private flushTimer;
|
|
340
|
+
private unloadHandler;
|
|
341
|
+
private getUserId;
|
|
342
|
+
private memoryCartId;
|
|
343
|
+
constructor(client: HttpClient, getUserId: () => string | null);
|
|
344
|
+
viewItem(params: ViewItemParams): Promise<void>;
|
|
345
|
+
addToCart(params: AddToCartParams): Promise<void>;
|
|
346
|
+
removeFromCart(params: RemoveFromCartParams): Promise<void>;
|
|
347
|
+
addToWishlist(params: AddToWishlistParams): Promise<void>;
|
|
348
|
+
viewCart(): Promise<void>;
|
|
349
|
+
addPaymentInfo(params?: AddPaymentInfoParams): Promise<void>;
|
|
350
|
+
beginCheckout(params: BeginCheckoutParams): Promise<void>;
|
|
351
|
+
purchase(params: PurchaseParams): Promise<void>;
|
|
352
|
+
refund(params: RefundParams): Promise<void>;
|
|
353
|
+
search(params: SearchParams): Promise<void>;
|
|
354
|
+
share(params: ShareParams): Promise<void>;
|
|
355
|
+
rate(params: RateParams): Promise<void>;
|
|
356
|
+
spendCredits(params: SpendCreditsParams): Promise<void>;
|
|
357
|
+
flush(): Promise<void>;
|
|
358
|
+
destroy(): void;
|
|
359
|
+
private enqueue;
|
|
360
|
+
private flushBeacon;
|
|
361
|
+
private getOrCreateCartId;
|
|
362
|
+
private getCartId;
|
|
363
|
+
private setCartId;
|
|
364
|
+
private clearCartId;
|
|
365
|
+
private generateId;
|
|
366
|
+
}
|
|
367
|
+
|
|
228
368
|
declare class Referrals {
|
|
229
369
|
private client;
|
|
230
370
|
constructor(client: HttpClient);
|
|
@@ -261,6 +401,8 @@ declare class Tolinku {
|
|
|
261
401
|
private client;
|
|
262
402
|
/** Analytics: track custom events */
|
|
263
403
|
readonly analytics: Analytics;
|
|
404
|
+
/** Ecommerce: track purchases, carts, products, revenue */
|
|
405
|
+
readonly ecommerce: Ecommerce;
|
|
264
406
|
/** Referrals: create, complete, milestone, leaderboard */
|
|
265
407
|
readonly referrals: Referrals;
|
|
266
408
|
/** Deferred deep links: claim by token or signals */
|
|
@@ -289,10 +431,10 @@ declare class Tolinku {
|
|
|
289
431
|
showMessage(options?: ShowMessageOptions): Promise<void>;
|
|
290
432
|
/** Dismiss the currently visible in-app message */
|
|
291
433
|
dismissMessage(): void;
|
|
292
|
-
/** Flush any queued analytics events immediately */
|
|
434
|
+
/** Flush any queued analytics and ecommerce events immediately */
|
|
293
435
|
flush(): Promise<void>;
|
|
294
436
|
/** Clean up all DOM elements, flush events, and cancel in-flight requests (e.g. before unmounting in SPAs) */
|
|
295
437
|
destroy(): void;
|
|
296
438
|
}
|
|
297
439
|
|
|
298
|
-
export { type BannerConfig, type BannerItem, type ClaimBySignalsOptions, type CompleteReferralOptions, type CompleteReferralResult, type CreateReferralOptions, type CreateReferralResult, type DeferredLink, type LeaderboardEntry, type Message, type MessageComponent, type MessageContent, type MilestoneOptions, type MilestoneResult, type ReferralInfo, type ShowBannerOptions, type ShowMessageOptions, Tolinku, type TolinkuConfig, TolinkuError, type TrackProperties };
|
|
440
|
+
export { type AddPaymentInfoParams, type AddToCartParams, type AddToWishlistParams, type BannerConfig, type BannerItem, type BeginCheckoutParams, type ClaimBySignalsOptions, type CompleteReferralOptions, type CompleteReferralResult, type CreateReferralOptions, type CreateReferralResult, type DeferredLink, type EcommerceItem, type LeaderboardEntry, type Message, type MessageComponent, type MessageContent, type MilestoneOptions, type MilestoneResult, type PurchaseParams, type RateParams, type ReferralInfo, type RefundParams, type RemoveFromCartParams, type SearchParams, type ShareParams, type ShowBannerOptions, type ShowMessageOptions, type SpendCreditsParams, Tolinku, type TolinkuConfig, TolinkuError, type TrackProperties, type ViewItemParams };
|
package/dist/index.d.ts
CHANGED
|
@@ -98,6 +98,8 @@ interface ClaimBySignalsOptions {
|
|
|
98
98
|
language?: string;
|
|
99
99
|
screenWidth?: number;
|
|
100
100
|
screenHeight?: number;
|
|
101
|
+
/** Defaults to `window.devicePixelRatio`. Override only if you report a custom screen size. */
|
|
102
|
+
devicePixelRatio?: number;
|
|
101
103
|
}
|
|
102
104
|
/** Banner config returned by the API */
|
|
103
105
|
interface BannerConfig {
|
|
@@ -118,13 +120,47 @@ interface BannerItem {
|
|
|
118
120
|
text_color: string;
|
|
119
121
|
cta_text: string | null;
|
|
120
122
|
position: string | null;
|
|
123
|
+
style: string | null;
|
|
124
|
+
shadow: string | null;
|
|
125
|
+
radius: number | null;
|
|
126
|
+
margin: number | null;
|
|
121
127
|
dismiss_days: number | null;
|
|
122
128
|
priority: number;
|
|
123
129
|
}
|
|
124
|
-
/** Options for showing a banner
|
|
130
|
+
/** Options for showing a banner. All fields are optional.
|
|
131
|
+
* Resolution chain per value: option → server config → theme → built-in default. */
|
|
125
132
|
interface ShowBannerOptions {
|
|
126
133
|
position?: 'top' | 'bottom';
|
|
134
|
+
style?: 'pinned' | 'floating' | 'stacked';
|
|
135
|
+
animation?: 'slide' | 'fade' | 'pop' | 'none';
|
|
136
|
+
theme?: 'light' | 'dark';
|
|
127
137
|
label?: string;
|
|
138
|
+
delay?: number;
|
|
139
|
+
/** Stacked-mode only: CSS selector for the element to inject before (top) or after (bottom).
|
|
140
|
+
* Falls back to auto-detect when omitted. */
|
|
141
|
+
anchor?: string;
|
|
142
|
+
bg?: string;
|
|
143
|
+
border?: string;
|
|
144
|
+
radius?: number;
|
|
145
|
+
margin?: number;
|
|
146
|
+
shadow?: 'none' | 'sm' | 'md' | 'lg';
|
|
147
|
+
titleColor?: string;
|
|
148
|
+
titleSize?: number;
|
|
149
|
+
titleWeight?: 400 | 500 | 600 | 700;
|
|
150
|
+
bodyColor?: string;
|
|
151
|
+
bodySize?: number;
|
|
152
|
+
bodyWeight?: 400 | 500 | 600 | 700;
|
|
153
|
+
ctaBg?: string;
|
|
154
|
+
ctaColor?: string;
|
|
155
|
+
ctaSize?: number;
|
|
156
|
+
ctaWeight?: 400 | 500 | 600 | 700;
|
|
157
|
+
ctaRadius?: number;
|
|
158
|
+
iconSize?: number;
|
|
159
|
+
iconRadius?: number;
|
|
160
|
+
hideIcon?: boolean;
|
|
161
|
+
hideClose?: boolean;
|
|
162
|
+
hideBody?: boolean;
|
|
163
|
+
customClass?: string;
|
|
128
164
|
}
|
|
129
165
|
/** In-app message from the API */
|
|
130
166
|
interface Message {
|
|
@@ -160,6 +196,78 @@ interface ShowMessageOptions {
|
|
|
160
196
|
onDismiss?: (messageId: string) => void;
|
|
161
197
|
onButtonPress?: (action: string, messageId: string) => void;
|
|
162
198
|
}
|
|
199
|
+
interface EcommerceItem {
|
|
200
|
+
item_id: string;
|
|
201
|
+
item_name?: string;
|
|
202
|
+
item_category?: string;
|
|
203
|
+
item_brand?: string;
|
|
204
|
+
item_variant?: string;
|
|
205
|
+
item_list_name?: string;
|
|
206
|
+
item_list_id?: string;
|
|
207
|
+
item_image_url?: string;
|
|
208
|
+
price?: number;
|
|
209
|
+
quantity?: number;
|
|
210
|
+
currency?: string;
|
|
211
|
+
coupon_code?: string;
|
|
212
|
+
discount?: number;
|
|
213
|
+
}
|
|
214
|
+
interface PurchaseParams {
|
|
215
|
+
transaction_id: string;
|
|
216
|
+
revenue: number;
|
|
217
|
+
currency: string;
|
|
218
|
+
items?: EcommerceItem[];
|
|
219
|
+
cart_id?: string;
|
|
220
|
+
coupon_code?: string;
|
|
221
|
+
discount?: number;
|
|
222
|
+
shipping?: number;
|
|
223
|
+
tax?: number;
|
|
224
|
+
}
|
|
225
|
+
interface AddToCartParams {
|
|
226
|
+
items: EcommerceItem[];
|
|
227
|
+
cart_id?: string;
|
|
228
|
+
}
|
|
229
|
+
interface RemoveFromCartParams {
|
|
230
|
+
items: EcommerceItem[];
|
|
231
|
+
cart_id?: string;
|
|
232
|
+
}
|
|
233
|
+
interface AddToWishlistParams {
|
|
234
|
+
items: EcommerceItem[];
|
|
235
|
+
}
|
|
236
|
+
interface BeginCheckoutParams {
|
|
237
|
+
revenue?: number;
|
|
238
|
+
currency?: string;
|
|
239
|
+
cart_id?: string;
|
|
240
|
+
items?: EcommerceItem[];
|
|
241
|
+
}
|
|
242
|
+
interface RefundParams {
|
|
243
|
+
transaction_id: string;
|
|
244
|
+
revenue: number;
|
|
245
|
+
currency?: string;
|
|
246
|
+
items?: EcommerceItem[];
|
|
247
|
+
}
|
|
248
|
+
interface ViewItemParams {
|
|
249
|
+
items: EcommerceItem[];
|
|
250
|
+
}
|
|
251
|
+
interface SearchParams {
|
|
252
|
+
search_term: string;
|
|
253
|
+
}
|
|
254
|
+
interface AddPaymentInfoParams {
|
|
255
|
+
cart_id?: string;
|
|
256
|
+
}
|
|
257
|
+
interface ShareParams {
|
|
258
|
+
item_id?: string;
|
|
259
|
+
url?: string;
|
|
260
|
+
method?: string;
|
|
261
|
+
}
|
|
262
|
+
interface RateParams {
|
|
263
|
+
item_id: string;
|
|
264
|
+
rating: number;
|
|
265
|
+
max_rating?: number;
|
|
266
|
+
}
|
|
267
|
+
interface SpendCreditsParams {
|
|
268
|
+
revenue: number;
|
|
269
|
+
currency: string;
|
|
270
|
+
}
|
|
163
271
|
|
|
164
272
|
declare class HttpClient {
|
|
165
273
|
private _baseUrl;
|
|
@@ -225,6 +333,38 @@ declare class Analytics {
|
|
|
225
333
|
destroy(): void;
|
|
226
334
|
}
|
|
227
335
|
|
|
336
|
+
declare class Ecommerce {
|
|
337
|
+
private client;
|
|
338
|
+
private queue;
|
|
339
|
+
private flushTimer;
|
|
340
|
+
private unloadHandler;
|
|
341
|
+
private getUserId;
|
|
342
|
+
private memoryCartId;
|
|
343
|
+
constructor(client: HttpClient, getUserId: () => string | null);
|
|
344
|
+
viewItem(params: ViewItemParams): Promise<void>;
|
|
345
|
+
addToCart(params: AddToCartParams): Promise<void>;
|
|
346
|
+
removeFromCart(params: RemoveFromCartParams): Promise<void>;
|
|
347
|
+
addToWishlist(params: AddToWishlistParams): Promise<void>;
|
|
348
|
+
viewCart(): Promise<void>;
|
|
349
|
+
addPaymentInfo(params?: AddPaymentInfoParams): Promise<void>;
|
|
350
|
+
beginCheckout(params: BeginCheckoutParams): Promise<void>;
|
|
351
|
+
purchase(params: PurchaseParams): Promise<void>;
|
|
352
|
+
refund(params: RefundParams): Promise<void>;
|
|
353
|
+
search(params: SearchParams): Promise<void>;
|
|
354
|
+
share(params: ShareParams): Promise<void>;
|
|
355
|
+
rate(params: RateParams): Promise<void>;
|
|
356
|
+
spendCredits(params: SpendCreditsParams): Promise<void>;
|
|
357
|
+
flush(): Promise<void>;
|
|
358
|
+
destroy(): void;
|
|
359
|
+
private enqueue;
|
|
360
|
+
private flushBeacon;
|
|
361
|
+
private getOrCreateCartId;
|
|
362
|
+
private getCartId;
|
|
363
|
+
private setCartId;
|
|
364
|
+
private clearCartId;
|
|
365
|
+
private generateId;
|
|
366
|
+
}
|
|
367
|
+
|
|
228
368
|
declare class Referrals {
|
|
229
369
|
private client;
|
|
230
370
|
constructor(client: HttpClient);
|
|
@@ -261,6 +401,8 @@ declare class Tolinku {
|
|
|
261
401
|
private client;
|
|
262
402
|
/** Analytics: track custom events */
|
|
263
403
|
readonly analytics: Analytics;
|
|
404
|
+
/** Ecommerce: track purchases, carts, products, revenue */
|
|
405
|
+
readonly ecommerce: Ecommerce;
|
|
264
406
|
/** Referrals: create, complete, milestone, leaderboard */
|
|
265
407
|
readonly referrals: Referrals;
|
|
266
408
|
/** Deferred deep links: claim by token or signals */
|
|
@@ -289,10 +431,10 @@ declare class Tolinku {
|
|
|
289
431
|
showMessage(options?: ShowMessageOptions): Promise<void>;
|
|
290
432
|
/** Dismiss the currently visible in-app message */
|
|
291
433
|
dismissMessage(): void;
|
|
292
|
-
/** Flush any queued analytics events immediately */
|
|
434
|
+
/** Flush any queued analytics and ecommerce events immediately */
|
|
293
435
|
flush(): Promise<void>;
|
|
294
436
|
/** Clean up all DOM elements, flush events, and cancel in-flight requests (e.g. before unmounting in SPAs) */
|
|
295
437
|
destroy(): void;
|
|
296
438
|
}
|
|
297
439
|
|
|
298
|
-
export { type BannerConfig, type BannerItem, type ClaimBySignalsOptions, type CompleteReferralOptions, type CompleteReferralResult, type CreateReferralOptions, type CreateReferralResult, type DeferredLink, type LeaderboardEntry, type Message, type MessageComponent, type MessageContent, type MilestoneOptions, type MilestoneResult, type ReferralInfo, type ShowBannerOptions, type ShowMessageOptions, Tolinku, type TolinkuConfig, TolinkuError, type TrackProperties };
|
|
440
|
+
export { type AddPaymentInfoParams, type AddToCartParams, type AddToWishlistParams, type BannerConfig, type BannerItem, type BeginCheckoutParams, type ClaimBySignalsOptions, type CompleteReferralOptions, type CompleteReferralResult, type CreateReferralOptions, type CreateReferralResult, type DeferredLink, type EcommerceItem, type LeaderboardEntry, type Message, type MessageComponent, type MessageContent, type MilestoneOptions, type MilestoneResult, type PurchaseParams, type RateParams, type ReferralInfo, type RefundParams, type RemoveFromCartParams, type SearchParams, type ShareParams, type ShowBannerOptions, type ShowMessageOptions, type SpendCreditsParams, Tolinku, type TolinkuConfig, TolinkuError, type TrackProperties, type ViewItemParams };
|