@ekomerc/storefront 0.1.0 → 0.1.3
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 +237 -10
- package/dist/README.md +679 -0
- package/dist/errors.d.cts +74 -0
- package/dist/errors.d.ts +74 -80
- package/dist/index.cjs +2840 -1810
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1493 -0
- package/dist/index.d.ts +1493 -952
- package/dist/index.js +2841 -1811
- package/dist/index.js.map +1 -1
- package/dist/package.json +45 -0
- package/dist/types.d.cts +656 -0
- package/dist/types.d.ts +656 -1
- package/package.json +12 -5
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ekomerc/storefront",
|
|
3
|
+
"version": "0.1.3",
|
|
4
|
+
"description": "TypeScript SDK for ekomerc storefronts",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"main": "./index.cjs",
|
|
8
|
+
"module": "./index.js",
|
|
9
|
+
"types": "./index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": {
|
|
13
|
+
"types": "./index.d.ts",
|
|
14
|
+
"default": "./index.js"
|
|
15
|
+
},
|
|
16
|
+
"require": {
|
|
17
|
+
"types": "./index.d.cts",
|
|
18
|
+
"default": "./index.cjs"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"./types": {
|
|
22
|
+
"import": {
|
|
23
|
+
"types": "./types.d.ts",
|
|
24
|
+
"default": "./types.js"
|
|
25
|
+
},
|
|
26
|
+
"require": {
|
|
27
|
+
"types": "./types.d.cts",
|
|
28
|
+
"default": "./types.cjs"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"./errors": {
|
|
32
|
+
"import": {
|
|
33
|
+
"types": "./errors.d.ts",
|
|
34
|
+
"default": "./errors.js"
|
|
35
|
+
},
|
|
36
|
+
"require": {
|
|
37
|
+
"types": "./errors.d.cts",
|
|
38
|
+
"default": "./errors.cjs"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"neverthrow": "8.2.0"
|
|
44
|
+
}
|
|
45
|
+
}
|
package/dist/types.d.cts
ADDED
|
@@ -0,0 +1,656 @@
|
|
|
1
|
+
import { Result } from 'neverthrow';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Base class for all Storefront SDK errors
|
|
5
|
+
*/
|
|
6
|
+
declare class StorefrontError extends Error {
|
|
7
|
+
readonly code: string;
|
|
8
|
+
constructor(message: string, code: string, options?: {
|
|
9
|
+
cause?: Error;
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
declare const TRACKING_POLICY_EVENT_TYPES: readonly ["analytics.page_view", "analytics.product_view", "analytics.collection_view", "analytics.search_performed", "analytics.add_to_cart", "analytics.remove_from_cart", "analytics.checkout_started", "analytics.checkout_step_completed", "analytics.checkout_completed", "analytics.custom"];
|
|
14
|
+
type TrackingPolicyEventType = (typeof TRACKING_POLICY_EVENT_TYPES)[number];
|
|
15
|
+
declare const TRACKING_PROVIDERS: readonly ["gtm", "meta", "tiktok"];
|
|
16
|
+
type TrackingProvider = (typeof TRACKING_PROVIDERS)[number];
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Consent states emitted with browser-side analytics events.
|
|
20
|
+
*/
|
|
21
|
+
type AnalyticsConsentState = "granted" | "denied" | "unknown";
|
|
22
|
+
/**
|
|
23
|
+
* Runtime policies controlling how consent gates browser event dispatch.
|
|
24
|
+
*/
|
|
25
|
+
type AnalyticsDispatchOnUnknownConsent = boolean;
|
|
26
|
+
/**
|
|
27
|
+
* UTM parameters captured for a visitor session.
|
|
28
|
+
*/
|
|
29
|
+
interface AnalyticsUtm {
|
|
30
|
+
schemaVersion: 1;
|
|
31
|
+
source: string | null;
|
|
32
|
+
medium: string | null;
|
|
33
|
+
campaign: string | null;
|
|
34
|
+
term: string | null;
|
|
35
|
+
content: string | null;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Click identifiers captured from ad platforms and passed through analytics events.
|
|
39
|
+
*/
|
|
40
|
+
interface AnalyticsClickIds {
|
|
41
|
+
schemaVersion: 1;
|
|
42
|
+
capturedAt: string | null;
|
|
43
|
+
gclid: string | null;
|
|
44
|
+
gbraid: string | null;
|
|
45
|
+
wbraid: string | null;
|
|
46
|
+
ttclid: string | null;
|
|
47
|
+
fbclid: string | null;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Request context attached to each browser analytics event.
|
|
51
|
+
*/
|
|
52
|
+
interface AnalyticsEventContextPayload {
|
|
53
|
+
schemaVersion: 1;
|
|
54
|
+
path: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Primitive JSON values supported inside analytics properties.
|
|
58
|
+
*/
|
|
59
|
+
type AnalyticsJsonPrimitive = string | number | boolean | null;
|
|
60
|
+
/**
|
|
61
|
+
* Recursive JSON value shape supported by analytics event properties.
|
|
62
|
+
*/
|
|
63
|
+
type AnalyticsJsonValue = AnalyticsJsonPrimitive | AnalyticsJsonValue[] | {
|
|
64
|
+
[key: string]: AnalyticsJsonValue;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Arbitrary analytics event properties sent to ingest and browser adapters.
|
|
68
|
+
*/
|
|
69
|
+
interface AnalyticsProperties {
|
|
70
|
+
[key: string]: AnalyticsJsonValue;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Best-effort browser device fingerprint attached to an analytics event.
|
|
74
|
+
*/
|
|
75
|
+
interface AnalyticsBrowserEventDevice {
|
|
76
|
+
deviceType: string;
|
|
77
|
+
deviceOs: string | null;
|
|
78
|
+
deviceBrowser: string | null;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Canonical browser analytics event shape used by the storefront SDK.
|
|
82
|
+
*/
|
|
83
|
+
interface AnalyticsBrowserEvent {
|
|
84
|
+
schemaVersion: 1;
|
|
85
|
+
eventId: string;
|
|
86
|
+
eventType: TrackingPolicyEventType;
|
|
87
|
+
occurredAt: string;
|
|
88
|
+
sessionId: string;
|
|
89
|
+
visitorId: string;
|
|
90
|
+
customerId: string | null;
|
|
91
|
+
consentState: AnalyticsConsentState;
|
|
92
|
+
context: AnalyticsEventContextPayload;
|
|
93
|
+
referrer: string | null;
|
|
94
|
+
utm: AnalyticsUtm;
|
|
95
|
+
clickIds: AnalyticsClickIds;
|
|
96
|
+
device: AnalyticsBrowserEventDevice;
|
|
97
|
+
properties: AnalyticsProperties;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Consent state payload passed to browser adapters and diagnostics.
|
|
101
|
+
*/
|
|
102
|
+
interface AnalyticsConsentUpdate {
|
|
103
|
+
consentState: AnalyticsConsentState;
|
|
104
|
+
dispatchOnUnknownConsent: AnalyticsDispatchOnUnknownConsent;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Input provided to a browser adapter when dispatching an analytics event.
|
|
108
|
+
*/
|
|
109
|
+
interface AnalyticsAdapterDispatchInput {
|
|
110
|
+
event: AnalyticsBrowserEvent;
|
|
111
|
+
consent: AnalyticsConsentUpdate;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Reasons a browser adapter may skip dispatch instead of throwing.
|
|
115
|
+
*/
|
|
116
|
+
type AnalyticsAdapterSkipReason = "unsupported_event" | "consent_blocked" | "runtime_unavailable";
|
|
117
|
+
/**
|
|
118
|
+
* Structured result returned when a browser adapter intentionally skips dispatch.
|
|
119
|
+
*/
|
|
120
|
+
interface AnalyticsAdapterOperationSkippedResult {
|
|
121
|
+
status: "skipped";
|
|
122
|
+
reason: "runtime_unavailable";
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Result returned by browser adapter dispatch and consent-update hooks.
|
|
126
|
+
*/
|
|
127
|
+
type AnalyticsAdapterOperationResult = void | {
|
|
128
|
+
status: "success";
|
|
129
|
+
} | AnalyticsAdapterOperationSkippedResult;
|
|
130
|
+
/**
|
|
131
|
+
* Browser-side analytics adapter contract for GTM, Meta, TikTok, or custom integrations.
|
|
132
|
+
*/
|
|
133
|
+
interface AnalyticsBrowserAdapter {
|
|
134
|
+
provider: TrackingProvider;
|
|
135
|
+
dispatch(input: AnalyticsAdapterDispatchInput): AnalyticsAdapterOperationResult | Promise<AnalyticsAdapterOperationResult>;
|
|
136
|
+
updateConsent?(input: AnalyticsConsentUpdate): AnalyticsAdapterOperationResult | Promise<AnalyticsAdapterOperationResult>;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Diagnostic events emitted by the analytics runtime for ingest and adapter activity.
|
|
140
|
+
*/
|
|
141
|
+
type AnalyticsDiagnostic = {
|
|
142
|
+
target: "ingest";
|
|
143
|
+
status: "success";
|
|
144
|
+
event: AnalyticsBrowserEvent;
|
|
145
|
+
response: {
|
|
146
|
+
acceptedCount: number;
|
|
147
|
+
duplicateCount: number;
|
|
148
|
+
rejectedCount: number;
|
|
149
|
+
};
|
|
150
|
+
} | {
|
|
151
|
+
target: "ingest";
|
|
152
|
+
status: "error";
|
|
153
|
+
event: AnalyticsBrowserEvent;
|
|
154
|
+
error: Error;
|
|
155
|
+
} | {
|
|
156
|
+
target: "ingest";
|
|
157
|
+
status: "accepted_unknown";
|
|
158
|
+
event: AnalyticsBrowserEvent;
|
|
159
|
+
} | {
|
|
160
|
+
target: "queue";
|
|
161
|
+
status: "enqueued";
|
|
162
|
+
event: AnalyticsBrowserEvent;
|
|
163
|
+
} | {
|
|
164
|
+
target: "queue";
|
|
165
|
+
status: "flushed";
|
|
166
|
+
count: number;
|
|
167
|
+
} | {
|
|
168
|
+
target: "queue";
|
|
169
|
+
status: "evicted_full";
|
|
170
|
+
event: AnalyticsBrowserEvent;
|
|
171
|
+
} | {
|
|
172
|
+
target: "queue";
|
|
173
|
+
status: "evicted_expired";
|
|
174
|
+
eventId: string;
|
|
175
|
+
} | {
|
|
176
|
+
target: "adapter";
|
|
177
|
+
status: "success";
|
|
178
|
+
provider: TrackingProvider;
|
|
179
|
+
event: AnalyticsBrowserEvent;
|
|
180
|
+
} | {
|
|
181
|
+
target: "adapter";
|
|
182
|
+
status: "skipped";
|
|
183
|
+
provider: TrackingProvider;
|
|
184
|
+
event: AnalyticsBrowserEvent;
|
|
185
|
+
reason: AnalyticsAdapterSkipReason;
|
|
186
|
+
} | {
|
|
187
|
+
target: "adapter";
|
|
188
|
+
status: "error";
|
|
189
|
+
provider: TrackingProvider;
|
|
190
|
+
event: AnalyticsBrowserEvent;
|
|
191
|
+
error: Error;
|
|
192
|
+
} | {
|
|
193
|
+
target: "consent_bridge";
|
|
194
|
+
status: "success";
|
|
195
|
+
provider: TrackingProvider;
|
|
196
|
+
consent: AnalyticsConsentUpdate;
|
|
197
|
+
} | {
|
|
198
|
+
target: "consent_bridge";
|
|
199
|
+
status: "skipped";
|
|
200
|
+
provider: TrackingProvider;
|
|
201
|
+
consent: AnalyticsConsentUpdate;
|
|
202
|
+
reason: "runtime_unavailable";
|
|
203
|
+
} | {
|
|
204
|
+
target: "consent_bridge";
|
|
205
|
+
status: "error";
|
|
206
|
+
provider: TrackingProvider;
|
|
207
|
+
consent: AnalyticsConsentUpdate;
|
|
208
|
+
error: Error;
|
|
209
|
+
} | {
|
|
210
|
+
target: "consent";
|
|
211
|
+
status: "error";
|
|
212
|
+
error: Error;
|
|
213
|
+
};
|
|
214
|
+
/**
|
|
215
|
+
* Optional browser analytics runtime hooks passed to `createStorefrontClient()`.
|
|
216
|
+
*/
|
|
217
|
+
interface StorefrontTrackingRuntimeConfig {
|
|
218
|
+
dispatchOnUnknownConsent?: AnalyticsDispatchOnUnknownConsent;
|
|
219
|
+
resolveConsentState?: () => AnalyticsConsentState | Promise<AnalyticsConsentState>;
|
|
220
|
+
adapters?: AnalyticsBrowserAdapter[];
|
|
221
|
+
onDiagnostic?: (diagnostic: AnalyticsDiagnostic) => void;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Re-export generated GraphQL types once codegen runs
|
|
226
|
+
* For now, define placeholder types that will be replaced
|
|
227
|
+
*/
|
|
228
|
+
interface StorageAdapter {
|
|
229
|
+
get(key: string): string | null;
|
|
230
|
+
set(key: string, value: string): void;
|
|
231
|
+
remove(key: string): void;
|
|
232
|
+
}
|
|
233
|
+
interface StorefrontClientConfig {
|
|
234
|
+
endpoint: string;
|
|
235
|
+
apiKey: string;
|
|
236
|
+
storage?: StorageAdapter;
|
|
237
|
+
cacheTTL?: number;
|
|
238
|
+
/**
|
|
239
|
+
* How long stored landing attribution remains valid, in milliseconds.
|
|
240
|
+
* Defaults to 30 days.
|
|
241
|
+
*/
|
|
242
|
+
trackingAttributionTTL?: number;
|
|
243
|
+
/**
|
|
244
|
+
* Deprecated. Pass runtime analytics hooks to `client.init({ analytics: ... })`.
|
|
245
|
+
*/
|
|
246
|
+
tracking?: StorefrontTrackingRuntimeConfig;
|
|
247
|
+
}
|
|
248
|
+
interface StorefrontAnalyticsInitConfig extends StorefrontTrackingRuntimeConfig {
|
|
249
|
+
stripUrl?: boolean;
|
|
250
|
+
}
|
|
251
|
+
interface StorefrontInitOptions {
|
|
252
|
+
analytics?: StorefrontAnalyticsInitConfig;
|
|
253
|
+
}
|
|
254
|
+
interface ResolvedStorefrontAnalyticsConfig {
|
|
255
|
+
enabled: boolean;
|
|
256
|
+
dispatchOnUnknownConsent: boolean;
|
|
257
|
+
gtm: {
|
|
258
|
+
enabled: boolean;
|
|
259
|
+
containerId: string | null;
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
interface ResolvedStorefrontInitConfig {
|
|
263
|
+
analytics: ResolvedStorefrontAnalyticsConfig;
|
|
264
|
+
}
|
|
265
|
+
interface PageInfo {
|
|
266
|
+
hasNextPage: boolean;
|
|
267
|
+
hasPreviousPage: boolean;
|
|
268
|
+
startCursor: string | null;
|
|
269
|
+
endCursor: string | null;
|
|
270
|
+
}
|
|
271
|
+
interface PaginatedResult<T> {
|
|
272
|
+
items: T[];
|
|
273
|
+
pageInfo: PageInfo;
|
|
274
|
+
}
|
|
275
|
+
type StorefrontResult<T> = Result<T, StorefrontError>;
|
|
276
|
+
type WeightUnit = "g" | "kg" | "lb" | "oz";
|
|
277
|
+
interface ProductOptionValue {
|
|
278
|
+
id: string;
|
|
279
|
+
value: string;
|
|
280
|
+
position: number;
|
|
281
|
+
}
|
|
282
|
+
interface ProductOption {
|
|
283
|
+
id: string;
|
|
284
|
+
name: string;
|
|
285
|
+
position: number;
|
|
286
|
+
values: ProductOptionValue[];
|
|
287
|
+
}
|
|
288
|
+
interface ProductImage {
|
|
289
|
+
id: string;
|
|
290
|
+
url: string;
|
|
291
|
+
altText: string | null;
|
|
292
|
+
position: number;
|
|
293
|
+
}
|
|
294
|
+
interface QuantityPricingTier {
|
|
295
|
+
minQuantity: number;
|
|
296
|
+
price: number;
|
|
297
|
+
}
|
|
298
|
+
interface ProductVariant {
|
|
299
|
+
id: string;
|
|
300
|
+
title: string;
|
|
301
|
+
sku: string | null;
|
|
302
|
+
price: number;
|
|
303
|
+
compareAtPrice: number | null;
|
|
304
|
+
weight: number | null;
|
|
305
|
+
weightUnit: WeightUnit;
|
|
306
|
+
requiresShipping: boolean;
|
|
307
|
+
availableForSale: boolean;
|
|
308
|
+
quantity: number;
|
|
309
|
+
selectedOptions: ProductOptionValue[];
|
|
310
|
+
image: ProductImage | null;
|
|
311
|
+
isOnSale: boolean;
|
|
312
|
+
quantityPricing: QuantityPricingTier[];
|
|
313
|
+
}
|
|
314
|
+
interface Category {
|
|
315
|
+
id: string;
|
|
316
|
+
name: string;
|
|
317
|
+
handle: string;
|
|
318
|
+
description: string | null;
|
|
319
|
+
metaTitle: string | null;
|
|
320
|
+
metaDescription: string | null;
|
|
321
|
+
imageAsset: {
|
|
322
|
+
url: string;
|
|
323
|
+
altText: string | null;
|
|
324
|
+
width: number | null;
|
|
325
|
+
height: number | null;
|
|
326
|
+
} | null;
|
|
327
|
+
parent: Category | null;
|
|
328
|
+
children: Category[];
|
|
329
|
+
ancestors: Category[];
|
|
330
|
+
productCount: number;
|
|
331
|
+
}
|
|
332
|
+
interface FlatCategory {
|
|
333
|
+
id: string;
|
|
334
|
+
name: string;
|
|
335
|
+
handle: string;
|
|
336
|
+
description: string | null;
|
|
337
|
+
metaTitle: string | null;
|
|
338
|
+
metaDescription: string | null;
|
|
339
|
+
imageUrl: string | null;
|
|
340
|
+
parentId: string | null;
|
|
341
|
+
depth: number;
|
|
342
|
+
hasChildren: boolean;
|
|
343
|
+
productCount: number;
|
|
344
|
+
}
|
|
345
|
+
interface Tag {
|
|
346
|
+
id: string;
|
|
347
|
+
name: string;
|
|
348
|
+
}
|
|
349
|
+
type SectionType = "RICH_TEXT" | "BULLET_LIST" | "TABLE";
|
|
350
|
+
type DisplayIntent = "ACCORDION" | "SPECIFICATIONS" | "BOTH";
|
|
351
|
+
interface DetailSectionBase {
|
|
352
|
+
id: string;
|
|
353
|
+
title: string;
|
|
354
|
+
displayIntent: DisplayIntent;
|
|
355
|
+
position: number;
|
|
356
|
+
}
|
|
357
|
+
interface RichTextDetailSection extends DetailSectionBase {
|
|
358
|
+
sectionType: "RICH_TEXT";
|
|
359
|
+
content: {
|
|
360
|
+
html: string;
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
interface BulletListDetailSection extends DetailSectionBase {
|
|
364
|
+
sectionType: "BULLET_LIST";
|
|
365
|
+
content: {
|
|
366
|
+
items: string[];
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
interface TableDetailSection extends DetailSectionBase {
|
|
370
|
+
sectionType: "TABLE";
|
|
371
|
+
content: {
|
|
372
|
+
rows: [string, string][];
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
type DetailSection = RichTextDetailSection | BulletListDetailSection | TableDetailSection;
|
|
376
|
+
interface Product {
|
|
377
|
+
id: string;
|
|
378
|
+
handle: string;
|
|
379
|
+
title: string;
|
|
380
|
+
description: string | null;
|
|
381
|
+
vendor: string | null;
|
|
382
|
+
productType: string | null;
|
|
383
|
+
metaTitle: string | null;
|
|
384
|
+
metaDescription: string | null;
|
|
385
|
+
publishedAt: string | null;
|
|
386
|
+
createdAt: string;
|
|
387
|
+
availableForSale: boolean;
|
|
388
|
+
media: ProductImage[];
|
|
389
|
+
options: ProductOption[];
|
|
390
|
+
variants: ProductVariant[];
|
|
391
|
+
categories: Category[];
|
|
392
|
+
primaryCategory: Category | null;
|
|
393
|
+
tags: Tag[];
|
|
394
|
+
detailSections: DetailSection[];
|
|
395
|
+
}
|
|
396
|
+
type ProductSortKey = "CREATED_AT" | "TITLE" | "PRICE_ASC" | "PRICE_DESC" | "BEST_SELLING";
|
|
397
|
+
interface ProductFilter {
|
|
398
|
+
search?: string | null;
|
|
399
|
+
categoryHandle?: string | null;
|
|
400
|
+
categoryId?: string | null;
|
|
401
|
+
includeDescendants?: boolean | null;
|
|
402
|
+
collectionHandle?: string | null;
|
|
403
|
+
collectionId?: string | null;
|
|
404
|
+
tags?: string[] | null;
|
|
405
|
+
vendor?: string | null;
|
|
406
|
+
productType?: string | null;
|
|
407
|
+
minPrice?: number | null;
|
|
408
|
+
maxPrice?: number | null;
|
|
409
|
+
availableForSale?: boolean | null;
|
|
410
|
+
}
|
|
411
|
+
type CollectionType = "manual" | "intelligent";
|
|
412
|
+
type CollectionSortOrder = "manual" | "best_selling" | "newest" | "price_asc" | "price_desc";
|
|
413
|
+
interface Collection {
|
|
414
|
+
id: string;
|
|
415
|
+
handle: string;
|
|
416
|
+
title: string;
|
|
417
|
+
description: string | null;
|
|
418
|
+
type: CollectionType;
|
|
419
|
+
sortOrder: CollectionSortOrder;
|
|
420
|
+
metaTitle: string | null;
|
|
421
|
+
metaDescription: string | null;
|
|
422
|
+
productCount: number;
|
|
423
|
+
imageAsset: {
|
|
424
|
+
url: string;
|
|
425
|
+
altText: string | null;
|
|
426
|
+
width: number | null;
|
|
427
|
+
height: number | null;
|
|
428
|
+
} | null;
|
|
429
|
+
}
|
|
430
|
+
interface CartItem {
|
|
431
|
+
id: string;
|
|
432
|
+
variantId: string;
|
|
433
|
+
quantity: number;
|
|
434
|
+
priceAtAdd: number;
|
|
435
|
+
effectiveUnitPrice: number;
|
|
436
|
+
lineTotal: number;
|
|
437
|
+
taxAmount: number;
|
|
438
|
+
variant: ProductVariant | null;
|
|
439
|
+
}
|
|
440
|
+
type CartStatus = "active" | "checkout" | "converted" | "expired";
|
|
441
|
+
interface AppliedPromoCode {
|
|
442
|
+
code: string;
|
|
443
|
+
discountType: string;
|
|
444
|
+
discountAmount: number;
|
|
445
|
+
description: string;
|
|
446
|
+
}
|
|
447
|
+
interface AppliedDiscount {
|
|
448
|
+
promotionId: string;
|
|
449
|
+
discountClass: string;
|
|
450
|
+
discountType: string;
|
|
451
|
+
discountAmount: number;
|
|
452
|
+
description: string;
|
|
453
|
+
isAutomatic: boolean;
|
|
454
|
+
}
|
|
455
|
+
interface Cart {
|
|
456
|
+
id: string;
|
|
457
|
+
token: string;
|
|
458
|
+
status: CartStatus;
|
|
459
|
+
items: CartItem[];
|
|
460
|
+
totalItems: number;
|
|
461
|
+
totalPrice: number;
|
|
462
|
+
taxTotal: number;
|
|
463
|
+
shippingTotal: number;
|
|
464
|
+
total: number;
|
|
465
|
+
discountTotal: number;
|
|
466
|
+
appliedPromoCode: AppliedPromoCode | null;
|
|
467
|
+
appliedDiscounts: AppliedDiscount[];
|
|
468
|
+
customerEmail: string | null;
|
|
469
|
+
customerPhone: string | null;
|
|
470
|
+
shippingAddress: Address | null;
|
|
471
|
+
billingAddress: Address | null;
|
|
472
|
+
notes: string | null;
|
|
473
|
+
paymentMethod: string | null;
|
|
474
|
+
shippingRateId: string | null;
|
|
475
|
+
checkoutStartedAt?: string | null;
|
|
476
|
+
checkoutExpiresAt?: string | null;
|
|
477
|
+
createdAt: string;
|
|
478
|
+
updatedAt: string;
|
|
479
|
+
}
|
|
480
|
+
interface Address {
|
|
481
|
+
firstName: string | null;
|
|
482
|
+
lastName: string | null;
|
|
483
|
+
company: string | null;
|
|
484
|
+
addressLine1: string;
|
|
485
|
+
addressLine2: string | null;
|
|
486
|
+
city: string;
|
|
487
|
+
province: string | null;
|
|
488
|
+
provinceCode: string | null;
|
|
489
|
+
country: string;
|
|
490
|
+
countryCode: string;
|
|
491
|
+
zip: string;
|
|
492
|
+
phone: string | null;
|
|
493
|
+
}
|
|
494
|
+
interface CheckoutData {
|
|
495
|
+
email?: string;
|
|
496
|
+
phone?: string;
|
|
497
|
+
shippingAddress?: Address;
|
|
498
|
+
billingAddress?: Address;
|
|
499
|
+
notes?: string;
|
|
500
|
+
emailMarketingConsent?: boolean | null;
|
|
501
|
+
paymentMethod?: string;
|
|
502
|
+
shippingRateId?: string;
|
|
503
|
+
}
|
|
504
|
+
interface ShippingRate {
|
|
505
|
+
id: string;
|
|
506
|
+
name: string;
|
|
507
|
+
price: number;
|
|
508
|
+
minOrderAmount: number | null;
|
|
509
|
+
estimatedDaysMin: number | null;
|
|
510
|
+
estimatedDaysMax: number | null;
|
|
511
|
+
isFree: boolean;
|
|
512
|
+
}
|
|
513
|
+
interface AvailablePaymentMethod {
|
|
514
|
+
method: string;
|
|
515
|
+
displayName: string;
|
|
516
|
+
additionalFee: number;
|
|
517
|
+
}
|
|
518
|
+
interface SocialLinks {
|
|
519
|
+
instagram?: string;
|
|
520
|
+
facebook?: string;
|
|
521
|
+
tiktok?: string;
|
|
522
|
+
twitter?: string;
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* Public GTM settings returned by the storefront `store` query.
|
|
526
|
+
*/
|
|
527
|
+
interface GtmBrowserTrackingConfig {
|
|
528
|
+
enabled: boolean;
|
|
529
|
+
containerId: string | null;
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* Browser-side tracking configuration returned by the storefront `store` query.
|
|
533
|
+
*/
|
|
534
|
+
interface BrowserTrackingConfig {
|
|
535
|
+
gtm: GtmBrowserTrackingConfig;
|
|
536
|
+
}
|
|
537
|
+
interface StoreAnalyticsConfig {
|
|
538
|
+
enabled: boolean;
|
|
539
|
+
dispatchOnUnknownConsent: boolean;
|
|
540
|
+
gtm: GtmBrowserTrackingConfig;
|
|
541
|
+
}
|
|
542
|
+
interface Store {
|
|
543
|
+
id: string;
|
|
544
|
+
name: string;
|
|
545
|
+
slug: string;
|
|
546
|
+
description: string | null;
|
|
547
|
+
currency: string;
|
|
548
|
+
timezone: string;
|
|
549
|
+
logoUrl: string | null;
|
|
550
|
+
contactEmail: string | null;
|
|
551
|
+
contactPhone: string | null;
|
|
552
|
+
trackingDispatchOnUnknownConsent: boolean;
|
|
553
|
+
browserTrackingConfig: BrowserTrackingConfig;
|
|
554
|
+
analytics: StoreAnalyticsConfig;
|
|
555
|
+
socialLinks: SocialLinks;
|
|
556
|
+
}
|
|
557
|
+
interface PaymentInstructions {
|
|
558
|
+
bankAccount: string;
|
|
559
|
+
recipientName: string;
|
|
560
|
+
referenceNumber: string;
|
|
561
|
+
ipsQrCodeBase64: string;
|
|
562
|
+
expiresAt: string;
|
|
563
|
+
}
|
|
564
|
+
interface OrderItem {
|
|
565
|
+
id: string;
|
|
566
|
+
productTitle: string;
|
|
567
|
+
variantTitle: string | null;
|
|
568
|
+
sku: string | null;
|
|
569
|
+
quantity: number;
|
|
570
|
+
unitPrice: number;
|
|
571
|
+
totalPrice: number;
|
|
572
|
+
}
|
|
573
|
+
interface Order {
|
|
574
|
+
id: string;
|
|
575
|
+
orderNumber: string;
|
|
576
|
+
email: string | null;
|
|
577
|
+
phone: string | null;
|
|
578
|
+
status: string;
|
|
579
|
+
shippingAddress: Address | null;
|
|
580
|
+
subtotal: number;
|
|
581
|
+
total: number;
|
|
582
|
+
note: string | null;
|
|
583
|
+
items: OrderItem[];
|
|
584
|
+
paymentInstructions: PaymentInstructions | null;
|
|
585
|
+
createdAt: string;
|
|
586
|
+
}
|
|
587
|
+
interface Customer {
|
|
588
|
+
id: string;
|
|
589
|
+
name: string | null;
|
|
590
|
+
email: string;
|
|
591
|
+
emailVerified: boolean;
|
|
592
|
+
}
|
|
593
|
+
interface CustomerAddress {
|
|
594
|
+
id: string;
|
|
595
|
+
label: string | null;
|
|
596
|
+
firstName: string | null;
|
|
597
|
+
lastName: string | null;
|
|
598
|
+
addressLine1: string;
|
|
599
|
+
addressLine2: string | null;
|
|
600
|
+
city: string;
|
|
601
|
+
zip: string | null;
|
|
602
|
+
phone: string | null;
|
|
603
|
+
isDefault: boolean;
|
|
604
|
+
createdAt: string;
|
|
605
|
+
}
|
|
606
|
+
interface CustomerAddressInput {
|
|
607
|
+
label?: string;
|
|
608
|
+
firstName?: string;
|
|
609
|
+
lastName?: string;
|
|
610
|
+
addressLine1: string;
|
|
611
|
+
addressLine2?: string;
|
|
612
|
+
city: string;
|
|
613
|
+
zip?: string;
|
|
614
|
+
phone?: string;
|
|
615
|
+
isDefault?: boolean;
|
|
616
|
+
}
|
|
617
|
+
interface CustomerAddressUpdateInput {
|
|
618
|
+
label?: string;
|
|
619
|
+
firstName?: string;
|
|
620
|
+
lastName?: string;
|
|
621
|
+
addressLine1?: string;
|
|
622
|
+
addressLine2?: string;
|
|
623
|
+
city?: string;
|
|
624
|
+
zip?: string;
|
|
625
|
+
phone?: string;
|
|
626
|
+
isDefault?: boolean;
|
|
627
|
+
}
|
|
628
|
+
interface CustomerUpdateInput {
|
|
629
|
+
name?: string;
|
|
630
|
+
email?: string;
|
|
631
|
+
currentPassword?: string;
|
|
632
|
+
newPassword?: string;
|
|
633
|
+
}
|
|
634
|
+
interface CustomerOrderItem {
|
|
635
|
+
id: string;
|
|
636
|
+
productTitle: string;
|
|
637
|
+
variantTitle: string | null;
|
|
638
|
+
sku: string | null;
|
|
639
|
+
quantity: number;
|
|
640
|
+
unitPrice: number;
|
|
641
|
+
totalPrice: number;
|
|
642
|
+
}
|
|
643
|
+
interface CustomerOrder {
|
|
644
|
+
id: string;
|
|
645
|
+
orderNumber: string;
|
|
646
|
+
status: string;
|
|
647
|
+
email: string;
|
|
648
|
+
phone: string | null;
|
|
649
|
+
subtotal: number;
|
|
650
|
+
total: number;
|
|
651
|
+
note: string | null;
|
|
652
|
+
items: CustomerOrderItem[];
|
|
653
|
+
createdAt: string;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
export type { Address, AppliedDiscount, AppliedPromoCode, AvailablePaymentMethod, BrowserTrackingConfig, BulletListDetailSection, Cart, CartItem, CartStatus, Category, CheckoutData, Collection, CollectionSortOrder, CollectionType, Customer, CustomerAddress, CustomerAddressInput, CustomerAddressUpdateInput, CustomerOrder, CustomerOrderItem, CustomerUpdateInput, DetailSection, DisplayIntent, FlatCategory, GtmBrowserTrackingConfig, Order, OrderItem, PageInfo, PaginatedResult, PaymentInstructions, Product, ProductFilter, ProductImage, ProductOption, ProductOptionValue, ProductSortKey, ProductVariant, QuantityPricingTier, ResolvedStorefrontAnalyticsConfig, ResolvedStorefrontInitConfig, RichTextDetailSection, SectionType, ShippingRate, SocialLinks, StorageAdapter, Store, StoreAnalyticsConfig, StorefrontAnalyticsInitConfig, StorefrontClientConfig, StorefrontInitOptions, StorefrontResult, TableDetailSection, Tag, WeightUnit };
|