Skip to content

Commit e203c42

Browse files
committed
Updated NPM package with support for onDataChanged and user-id
1 parent 9f8470a commit e203c42

2 files changed

Lines changed: 156 additions & 146 deletions

File tree

src/global.d.ts

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,38 @@
11
interface Window {
22
_faslet?: {
3-
id: string; // The product identifier
4-
sku: string; // The product SKU if it exists
5-
shopUrl: string;
6-
addToCart?: (variantId: string) => Promise<unknown>;
7-
onButtonShow?: () => unknown;
8-
onButtonHidden?: () => unknown;
9-
openWidget?: () => unknown;
10-
onResult?: (
11-
{ label: string },
12-
resultType: 'auto' | 'result-screen'
13-
) => unknown;
14-
onColorSelected?: (colorId: string) => unknown;
15-
selectColor?: (colorId: string) => unknown;
3+
id: string // The product identifier
4+
sku: string // The product SKU if it exists
5+
shopUrl: string
6+
addToCart?: (variantId: string) => Promise<unknown>
7+
onButtonShow?: () => unknown
8+
onButtonHidden?: () => unknown
9+
openWidget?: () => unknown
10+
onResult?: ({ label: string }, resultType: 'auto' | 'result-screen') => unknown
11+
onColorSelected?: (colorId: string) => unknown
12+
selectColor?: (colorId: string) => unknown
1613
variants: {
17-
size: string;
18-
color?: string;
19-
id: string;
20-
available: boolean;
21-
sku: string;
22-
price?: number;
23-
imageUrl?: string;
24-
}[];
14+
size: string
15+
color?: string
16+
id: string
17+
available: boolean
18+
sku: string
19+
price?: number
20+
imageUrl?: string
21+
}[]
2522
colors?: {
26-
id: string;
27-
name: string;
28-
}[];
29-
};
23+
id: string
24+
name: string
25+
}[]
26+
onDataChanged?: (userData: {
27+
userId: string
28+
widgetVersion?: string
29+
seenExperiments?: string
30+
experimentVariants?: string
31+
profile?: unknown
32+
}) => unknown
33+
}
3034
_faslet_orders?: {
31-
configure: () => unknown;
32-
event: (name: string, shopId: string, eventData: unknown) => unknown;
33-
};
35+
configure: () => unknown
36+
event: (name: string, shopId: string, eventData: unknown) => unknown
37+
}
3438
}

0 commit comments

Comments
 (0)