@paywithglide/glide-react 0.0.46 → 0.0.47
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 +40 -0
- package/dist/core.d.ts +2 -0
- package/dist/core.js +741 -0
- package/dist/glide.js +350 -929
- package/dist/pkg/GlideDeposit.d.ts +20 -1
- package/dist/pkg/analytics.d.ts +220 -0
- package/dist/pkg/core.d.ts +5 -0
- package/dist/pkg/index.d.ts +1 -0
- package/package.json +6 -2
- /package/dist/{index.d.ts → glide.d.ts} +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { GlideWidgetTheme } from './theme.ts';
|
|
2
2
|
import { CAIP2, Session } from '@paywithglide/glide-js';
|
|
3
|
+
import { GlideAnalyticsCallback } from './analytics.ts';
|
|
3
4
|
export type Hex = `0x${string}`;
|
|
4
5
|
export type EVMTransaction = {
|
|
5
6
|
chainId: number;
|
|
@@ -82,11 +83,15 @@ export type GlideLocalStorageProvider = {
|
|
|
82
83
|
removeItem: (key: string) => Promise<void>;
|
|
83
84
|
getKeys: () => Promise<string[]>;
|
|
84
85
|
};
|
|
85
|
-
export type FundingSource = "transfer" | "coinbase" | "coinbase_app" | "interac" | "fiat" | "wallet" | "debit_card_alias";
|
|
86
|
+
export type FundingSource = "transfer" | "coinbase" | "coinbase_app" | "interac" | "fiat" | "wallet" | "debit_card_alias" | "onramp";
|
|
86
87
|
export type ShowAppLogo = "default" | "always" | "never";
|
|
87
88
|
export type DebitCardAlias = "fiat" | "coinbase";
|
|
88
89
|
export type GlideDepositOptions = {
|
|
89
90
|
app: string;
|
|
91
|
+
/**
|
|
92
|
+
* Optional project ID for analytics segmentation
|
|
93
|
+
*/
|
|
94
|
+
projectId?: string;
|
|
90
95
|
recipient?: string;
|
|
91
96
|
mode?: "deposit" | "withdraw" | "pay" | "call" | "buy";
|
|
92
97
|
amount?: string;
|
|
@@ -138,10 +143,24 @@ export type GlideDepositOptions = {
|
|
|
138
143
|
popupsBlocked?: boolean;
|
|
139
144
|
baseUrl?: string;
|
|
140
145
|
debug?: boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Analytics callback for tracking user events and behavior
|
|
148
|
+
* Called with various events throughout the deposit/payment flow
|
|
149
|
+
* Use this to integrate with your own analytics platform (e.g., Amplitude, Mixpanel)
|
|
150
|
+
*/
|
|
151
|
+
onAnalyticsEvent?: GlideAnalyticsCallback;
|
|
141
152
|
};
|
|
142
153
|
export declare class GlideDeposit {
|
|
143
154
|
opts: GlideDepositOptions;
|
|
144
155
|
constructor(opts: GlideDepositOptions);
|
|
156
|
+
/**
|
|
157
|
+
* Get analytics context for events tracked directly in SDK
|
|
158
|
+
*/
|
|
159
|
+
private getAnalyticsContext;
|
|
160
|
+
/**
|
|
161
|
+
* Track an analytics event with context
|
|
162
|
+
*/
|
|
163
|
+
private trackEvent;
|
|
145
164
|
open: () => void;
|
|
146
165
|
get externalUrl(): string;
|
|
147
166
|
private initialize;
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Analytics Event Types for GLIDE SDK
|
|
3
|
+
*
|
|
4
|
+
* These events allow clients to track user behavior and conversions
|
|
5
|
+
* through their own analytics platforms (e.g., Amplitude, Mixpanel, etc.)
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Base context included with every analytics event
|
|
9
|
+
* This allows segmentation by client/project and user identification
|
|
10
|
+
*/
|
|
11
|
+
export type GlideAnalyticsContext = {
|
|
12
|
+
projectId?: string;
|
|
13
|
+
appSlug: string;
|
|
14
|
+
sdkVersion: string;
|
|
15
|
+
referrerDomain?: string;
|
|
16
|
+
walletAddress?: string;
|
|
17
|
+
device: {
|
|
18
|
+
isMobile: boolean;
|
|
19
|
+
platform: "ios" | "android" | "windows" | "macos" | "linux" | "unknown";
|
|
20
|
+
browser: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Raw event types (without context - used internally in the widget)
|
|
25
|
+
*/
|
|
26
|
+
export type GlideAnalyticsEventType = {
|
|
27
|
+
type: "modal_opened";
|
|
28
|
+
timestamp: number;
|
|
29
|
+
} | {
|
|
30
|
+
type: "modal_closed";
|
|
31
|
+
timestamp: number;
|
|
32
|
+
completedTransaction: boolean;
|
|
33
|
+
} | {
|
|
34
|
+
type: "mode_selected";
|
|
35
|
+
mode: "deposit" | "withdraw" | "pay" | "call" | "buy";
|
|
36
|
+
timestamp: number;
|
|
37
|
+
} | {
|
|
38
|
+
type: "step_viewed";
|
|
39
|
+
step: string;
|
|
40
|
+
timestamp: number;
|
|
41
|
+
} | {
|
|
42
|
+
type: "step_exited";
|
|
43
|
+
step: string;
|
|
44
|
+
timestamp: number;
|
|
45
|
+
direction: "forward" | "back";
|
|
46
|
+
} | {
|
|
47
|
+
type: "payment_method_selected";
|
|
48
|
+
paymentMethod: "wallet" | "transfer" | "coinbase" | "coinbase_app" | "fiat" | "interac" | "debit_card_alias";
|
|
49
|
+
timestamp: number;
|
|
50
|
+
} | {
|
|
51
|
+
type: "funding_source_viewed";
|
|
52
|
+
availableOptions: string[];
|
|
53
|
+
timestamp: number;
|
|
54
|
+
} | {
|
|
55
|
+
type: "funding_source_selected";
|
|
56
|
+
fundingSource: "wallet" | "crypto" | "fiat";
|
|
57
|
+
timestamp: number;
|
|
58
|
+
} | {
|
|
59
|
+
type: "wallet_connect_started";
|
|
60
|
+
timestamp: number;
|
|
61
|
+
} | {
|
|
62
|
+
type: "wallet_connected";
|
|
63
|
+
address: string;
|
|
64
|
+
chainId: number;
|
|
65
|
+
timestamp: number;
|
|
66
|
+
} | {
|
|
67
|
+
type: "wallet_connection_failed";
|
|
68
|
+
error: string;
|
|
69
|
+
timestamp: number;
|
|
70
|
+
} | {
|
|
71
|
+
type: "wallet_disconnected";
|
|
72
|
+
timestamp: number;
|
|
73
|
+
} | {
|
|
74
|
+
type: "chain_selected";
|
|
75
|
+
chainId: string;
|
|
76
|
+
chainName: string;
|
|
77
|
+
timestamp: number;
|
|
78
|
+
} | {
|
|
79
|
+
type: "currency_selected";
|
|
80
|
+
currencyId: string;
|
|
81
|
+
currencySymbol: string;
|
|
82
|
+
chainId: string;
|
|
83
|
+
timestamp: number;
|
|
84
|
+
} | {
|
|
85
|
+
type: "amount_entered";
|
|
86
|
+
amount: string;
|
|
87
|
+
currencySymbol: string;
|
|
88
|
+
amountUSD?: number;
|
|
89
|
+
timestamp: number;
|
|
90
|
+
} | {
|
|
91
|
+
type: "session_creation_started";
|
|
92
|
+
timestamp: number;
|
|
93
|
+
} | {
|
|
94
|
+
type: "session_created";
|
|
95
|
+
sessionId: string;
|
|
96
|
+
paymentMethod: string;
|
|
97
|
+
estimatedAmountUSD?: number;
|
|
98
|
+
timestamp: number;
|
|
99
|
+
} | {
|
|
100
|
+
type: "session_creation_failed";
|
|
101
|
+
error: string;
|
|
102
|
+
timestamp: number;
|
|
103
|
+
} | {
|
|
104
|
+
type: "transaction_started";
|
|
105
|
+
sessionId: string;
|
|
106
|
+
paymentMethod: string;
|
|
107
|
+
fromToken: string;
|
|
108
|
+
toToken: string;
|
|
109
|
+
amount: string;
|
|
110
|
+
estimatedAmountUSD?: number;
|
|
111
|
+
timestamp: number;
|
|
112
|
+
} | {
|
|
113
|
+
type: "transaction_signature_requested";
|
|
114
|
+
sessionId: string;
|
|
115
|
+
timestamp: number;
|
|
116
|
+
} | {
|
|
117
|
+
type: "transaction_signed";
|
|
118
|
+
sessionId: string;
|
|
119
|
+
txHash: string;
|
|
120
|
+
timestamp: number;
|
|
121
|
+
} | {
|
|
122
|
+
type: "transaction_signature_rejected";
|
|
123
|
+
sessionId: string;
|
|
124
|
+
timestamp: number;
|
|
125
|
+
} | {
|
|
126
|
+
type: "transaction_completed";
|
|
127
|
+
sessionId: string;
|
|
128
|
+
txHash: string;
|
|
129
|
+
paymentMethod: string;
|
|
130
|
+
success: boolean;
|
|
131
|
+
amountUSD?: number;
|
|
132
|
+
timestamp: number;
|
|
133
|
+
} | {
|
|
134
|
+
type: "transaction_failed";
|
|
135
|
+
sessionId: string;
|
|
136
|
+
error: string;
|
|
137
|
+
paymentMethod: string;
|
|
138
|
+
timestamp: number;
|
|
139
|
+
} | {
|
|
140
|
+
type: "onramp_window_opened";
|
|
141
|
+
provider: "coinbase" | "moonpay";
|
|
142
|
+
timestamp: number;
|
|
143
|
+
} | {
|
|
144
|
+
type: "onramp_window_closed";
|
|
145
|
+
provider: "coinbase" | "moonpay";
|
|
146
|
+
completed: boolean;
|
|
147
|
+
timestamp: number;
|
|
148
|
+
} | {
|
|
149
|
+
type: "deposit_address_generated";
|
|
150
|
+
sessionId: string;
|
|
151
|
+
chainId: string;
|
|
152
|
+
currencySymbol: string;
|
|
153
|
+
timestamp: number;
|
|
154
|
+
} | {
|
|
155
|
+
type: "deposit_address_copied";
|
|
156
|
+
sessionId: string;
|
|
157
|
+
timestamp: number;
|
|
158
|
+
} | {
|
|
159
|
+
type: "waiting_for_deposit";
|
|
160
|
+
sessionId: string;
|
|
161
|
+
chainId: string;
|
|
162
|
+
currencySymbol: string;
|
|
163
|
+
timestamp: number;
|
|
164
|
+
} | {
|
|
165
|
+
type: "deposit_detected";
|
|
166
|
+
sessionId: string;
|
|
167
|
+
amount: string;
|
|
168
|
+
currencySymbol: string;
|
|
169
|
+
timestamp: number;
|
|
170
|
+
} | {
|
|
171
|
+
type: "transfer_completed";
|
|
172
|
+
sessionId: string;
|
|
173
|
+
txHash: string;
|
|
174
|
+
chainId: string;
|
|
175
|
+
currencySymbol: string;
|
|
176
|
+
amount: string;
|
|
177
|
+
amountUSD?: number;
|
|
178
|
+
timestamp: number;
|
|
179
|
+
} | {
|
|
180
|
+
type: "error_occurred";
|
|
181
|
+
errorType: string;
|
|
182
|
+
errorMessage: string;
|
|
183
|
+
step?: string;
|
|
184
|
+
timestamp: number;
|
|
185
|
+
} | {
|
|
186
|
+
type: "conversion_completed";
|
|
187
|
+
sessionId: string;
|
|
188
|
+
paymentMethod: string;
|
|
189
|
+
amountUSD?: number;
|
|
190
|
+
duration: number;
|
|
191
|
+
timestamp: number;
|
|
192
|
+
};
|
|
193
|
+
/**
|
|
194
|
+
* Full analytics event with context
|
|
195
|
+
* This is what clients receive in their callback
|
|
196
|
+
*/
|
|
197
|
+
export type GlideAnalyticsEvent = GlideAnalyticsEventType & GlideAnalyticsContext;
|
|
198
|
+
/**
|
|
199
|
+
* Callback function type for analytics events
|
|
200
|
+
*/
|
|
201
|
+
export type GlideAnalyticsCallback = (event: GlideAnalyticsEvent) => void;
|
|
202
|
+
/**
|
|
203
|
+
* Helper class for emitting analytics events
|
|
204
|
+
*/
|
|
205
|
+
export declare class GlideAnalytics {
|
|
206
|
+
private callback?;
|
|
207
|
+
private startTime?;
|
|
208
|
+
private currentStep?;
|
|
209
|
+
constructor(callback?: GlideAnalyticsCallback);
|
|
210
|
+
setCallback(callback: GlideAnalyticsCallback | undefined): void;
|
|
211
|
+
track(event: GlideAnalyticsEvent): void;
|
|
212
|
+
modalOpened(): void;
|
|
213
|
+
modalClosed(completedTransaction: boolean): void;
|
|
214
|
+
stepViewed(step: string): void;
|
|
215
|
+
stepExited(step: string, direction: "forward" | "back"): void;
|
|
216
|
+
paymentMethodSelected(paymentMethod: "wallet" | "transfer" | "coinbase" | "coinbase_app" | "fiat" | "interac" | "debit_card_alias"): void;
|
|
217
|
+
transactionCompleted(sessionId: string, txHash: string, paymentMethod: string, amountUSD?: number): void;
|
|
218
|
+
errorOccurred(errorType: string, errorMessage: string, step?: string): void;
|
|
219
|
+
}
|
|
220
|
+
export declare const glideAnalytics: GlideAnalytics;
|
package/dist/pkg/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paywithglide/glide-react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.47",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
"types": "./dist/index.d.ts",
|
|
13
13
|
"default": "./dist/glide.js"
|
|
14
14
|
},
|
|
15
|
+
"./core": {
|
|
16
|
+
"types": "./dist/core.d.ts",
|
|
17
|
+
"default": "./dist/core.js"
|
|
18
|
+
},
|
|
15
19
|
"./package.json": "./package.json"
|
|
16
20
|
},
|
|
17
21
|
"sideEffects": false,
|
|
@@ -25,7 +29,7 @@
|
|
|
25
29
|
"prepublishOnly": "bun run build"
|
|
26
30
|
},
|
|
27
31
|
"dependencies": {
|
|
28
|
-
"@paywithglide/glide-js": "0.13.
|
|
32
|
+
"@paywithglide/glide-js": "0.13.32"
|
|
29
33
|
},
|
|
30
34
|
"devDependencies": {
|
|
31
35
|
"@antiwork/shortest": "^0.2.1",
|
|
File without changes
|