@@ -51,6 +51,138 @@ declare module 'vue-analytics' {
5151 } ) : void ;
5252 }
5353
54+ interface EcommerceItem {
55+ id : string ;
56+ name : string ;
57+ sku ?: string ;
58+ category ?: string ;
59+ price ?: string ;
60+ quantity ?: number ;
61+ }
62+
63+ interface EcommerceTransaction {
64+ id : string ;
65+ affiliation ?: string ;
66+ revenue ?: string ;
67+ shipping ?: string ;
68+ tax ?: string ;
69+ }
70+
71+ interface EcommerceImpressionBase {
72+ list ?: string ;
73+ brand ?: string ;
74+ category ?: string ;
75+ variant ?: string ;
76+ position ?: number ;
77+ price ?: string ;
78+ }
79+
80+ interface EcommerceImpressionWithId extends EcommerceImpressionBase {
81+ id : string ;
82+ }
83+
84+ interface EcommerceImpressionWithName extends EcommerceImpressionBase {
85+ name : string ;
86+ }
87+
88+ type EcommerceImpression = EcommerceImpressionWithId | EcommerceImpressionWithName ;
89+
90+ interface EcommerceProductBase {
91+ brand ?: string ;
92+ category ?: string ;
93+ variant ?: string ;
94+ price ?: string ;
95+ quantity ?: number ;
96+ coupon ?: string ;
97+ position ?: number ;
98+ }
99+
100+ interface EcommerceProductWithId extends EcommerceProductBase {
101+ id : string ;
102+ }
103+
104+ interface EcommerceProductWithName extends EcommerceProductBase {
105+ name : string ;
106+ }
107+
108+ type EcommerceProduct = EcommerceImpressionWithId | EcommerceImpressionWithName ;
109+
110+ type EcommerceAction =
111+ | 'click'
112+ | 'detail'
113+ | 'add'
114+ | 'remove'
115+ | 'checkout'
116+ | 'checkout_option'
117+ | 'purchase'
118+ | 'refund'
119+ | 'promo_click'
120+
121+ interface EcommerceActionData {
122+ id ?: string ;
123+ affiliation ?: string ;
124+ revenue ?: number ;
125+ tax ?: number ;
126+ shipping ?: number ;
127+ coupon ?: string ;
128+ list ?: string ;
129+ step ?: number ;
130+ option ?: string ;
131+ }
132+
133+ interface EcommercePromoBase {
134+ creative ?: string ;
135+ position ?: string ;
136+ }
137+
138+ interface EcommercePromoWithId extends EcommercePromoBase {
139+ id : string ;
140+ }
141+
142+ interface EcommercePromoWithName extends EcommercePromoBase {
143+ name : string ;
144+ }
145+
146+ type EcommercePromo = EcommercePromoWithId | EcommercePromoWithName ;
147+
148+ interface Ecommerce {
149+ addItem ( item : EcommerceItem ) : void ;
150+ addTransaction ( transaction : EcommerceTransaction ) : void ;
151+ addProduct ( product : EcommerceProduct ) : void ;
152+ addImpression ( impression : EcommerceImpression ) : void ;
153+ setAction ( action : EcommerceAction , data : EcommerceActionData ) : void ;
154+ addPromo ( product : EcommercePromo ) : void ;
155+ send ( ) : void ;
156+ }
157+
158+ interface screenviewFn {
159+ ( screen : string ) :void ;
160+ ( option : {
161+ screenName : string ;
162+ [ otherProperties : string ] : any ;
163+ } ) : void ;
164+ }
165+
166+ interface requireFn {
167+ ( pluginName : string , options ?: any ) : void
168+ }
169+
170+ interface exceptionFn {
171+ ( exception : Error | string ) : void ;
172+ }
173+
174+ interface queryFn {
175+ ( ...args : any [ ] ) : any ;
176+ }
177+
178+ interface analyticsMiddlewareFn {
179+ < T > ( store : Store < T > ) : void ;
180+ }
181+
182+ interface onAnalyticsReadyFn {
183+ ( ) : Promise < void > ;
184+ }
185+
54186 export interface InstallOptions {
55187 id : string | string [ ] | ( ( ) => string ) | ( ( ) => Promise < string > ) | Promise < string > ,
56188 router ?: VueRouter ,
@@ -107,7 +239,7 @@ declare module 'vue-analytics' {
107239 analyticsMiddleware : any ;
108240 onAnalyticsReady : ( ) => Promise < void > ;
109241 event : eventFn ;
110- ecommerce : any ;
242+ ecommerce : Ecommerce ;
111243 set : setFn ;
112244 page : pageFn ;
113245 query : any ;
0 commit comments