@mailbiz/onsite-yampi-vendor 0.1.0-alpha.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 ADDED
@@ -0,0 +1,3 @@
1
+ # @mailbiz/onsite-yampi-vendor
2
+
3
+ Copyright (c) 2026 Mailbiz.
@@ -0,0 +1,458 @@
1
+ import { OnsiteCoreWindow } from "@mailbiz/onsite-core";
2
+ //#region [Window]
3
+ interface YampiWindow extends OnsiteCoreWindow {
4
+ data?: {
5
+ product?: {
6
+ data?: YampiProductContext;
7
+ };
8
+ };
9
+ checkout?: YampiCheckoutContext;
10
+ orderData?: YampiOrderData;
11
+ }
12
+ //#endregion
13
+ //#region [Global contexts]
14
+ interface YampiProductContext {
15
+ id: number;
16
+ sku_id: number;
17
+ gift_value: number;
18
+ simple: boolean;
19
+ has_variations: boolean;
20
+ is_digital: boolean;
21
+ warranty: number;
22
+ custom_shipping: boolean;
23
+ shipping_price: number;
24
+ name: string;
25
+ slug: string;
26
+ sku: string;
27
+ blocked_sale: boolean;
28
+ rating: string;
29
+ total_approved_reviews: number;
30
+ url: string;
31
+ url_path: string;
32
+ use_different_images: number;
33
+ brand?: {
34
+ data?: {
35
+ id: number;
36
+ name: string;
37
+ logo_url: string | null;
38
+ };
39
+ };
40
+ images?: {
41
+ data?: Array<{
42
+ url: string;
43
+ }>;
44
+ };
45
+ prices?: {
46
+ data?: {
47
+ currency: string;
48
+ price_cost: number;
49
+ price_cost_formated: string;
50
+ price: number;
51
+ price_formated: string;
52
+ base_amount: string;
53
+ fraction_amount: string;
54
+ price_sale: number;
55
+ price_sale_formated: string;
56
+ price_discount: number;
57
+ price_discount_formated: string;
58
+ has_promotion: boolean;
59
+ percent_discount: number;
60
+ };
61
+ };
62
+ skus?: {
63
+ data?: YampiSkuData[];
64
+ };
65
+ categories?: {
66
+ data?: YampiCategoryData[];
67
+ };
68
+ quantity: number;
69
+ }
70
+ interface YampiSkuData {
71
+ id: number;
72
+ product_id: number;
73
+ sku: string;
74
+ blocked_sale: boolean;
75
+ title: string;
76
+ availability: number;
77
+ variations: YampiGridItem[];
78
+ days_availability_formated: string;
79
+ price_sale: number;
80
+ price_discount: number;
81
+ combinations: string;
82
+ order: number;
83
+ total_in_stock: number;
84
+ allow_sell_without_customization: boolean;
85
+ image_reference_sku_id: number | null;
86
+ purchase_url: string;
87
+ prices?: {
88
+ data?: {
89
+ currency: string;
90
+ price_cost?: number;
91
+ price_cost_formated?: string;
92
+ price: number;
93
+ price_formated: string;
94
+ base_amount?: string;
95
+ fraction_amount?: string;
96
+ price_sale: number;
97
+ price_sale_formated: string;
98
+ price_discount: number;
99
+ price_discount_formated: string;
100
+ has_promotion: boolean;
101
+ percent_discount: number;
102
+ };
103
+ };
104
+ images?: {
105
+ data?: Array<{
106
+ url: string;
107
+ }>;
108
+ };
109
+ customizations?: {
110
+ data?: unknown[];
111
+ };
112
+ }
113
+ interface YampiCategoryData {
114
+ id: number;
115
+ name: string;
116
+ parent_id: number | null;
117
+ slug: string;
118
+ active: boolean;
119
+ url_path: string;
120
+ }
121
+ interface YampiCheckoutContext {
122
+ referrer_url?: string;
123
+ cart?: YampiCheckoutCart;
124
+ state?: {
125
+ updateDomAfterInstallmentLoad?: boolean;
126
+ eventsInitialized?: boolean;
127
+ };
128
+ }
129
+ interface YampiCheckoutCart {
130
+ id: number;
131
+ customer_id: number | null;
132
+ token: string;
133
+ optionsIds?: string[];
134
+ skusIds?: string[];
135
+ isShopify?: boolean;
136
+ prices?: YampiCheckoutPrices;
137
+ items?: YampiCheckoutCartItem[];
138
+ discounts?: Array<{
139
+ name: string;
140
+ value: number;
141
+ accumulate: boolean;
142
+ }>;
143
+ cashback?: {
144
+ has_offer: boolean;
145
+ value: number;
146
+ };
147
+ model?: YampiCartModel;
148
+ promocode?: {
149
+ id: number;
150
+ code: string;
151
+ };
152
+ }
153
+ interface YampiCheckoutPrices {
154
+ items_amount: number;
155
+ total_items: string;
156
+ subtotal: number;
157
+ discount: number;
158
+ discount_without_wallet: number;
159
+ items_discount: number;
160
+ shipment: number;
161
+ shipment_original_value: number | null;
162
+ total: number;
163
+ value_for_free_shipment: number;
164
+ }
165
+ interface YampiGridItem {
166
+ name: string;
167
+ value: string;
168
+ }
169
+ interface YampiCheckoutCartItem {
170
+ id: number;
171
+ cart_id: number;
172
+ product_option_id: number;
173
+ kit_id: number | null;
174
+ bundle_id: number | null;
175
+ upsell_id: number | null;
176
+ freebie_id: number | null;
177
+ quantity: number;
178
+ gift: number;
179
+ created_at: string;
180
+ updated_at: string;
181
+ brand?: {
182
+ id: number;
183
+ name: string;
184
+ slug: string;
185
+ };
186
+ is_in_promotional_rack: boolean;
187
+ custom_shipping: boolean;
188
+ free_shipping: boolean;
189
+ shipping_price: number;
190
+ weight: number;
191
+ product_id: number;
192
+ option_id: number;
193
+ link: string;
194
+ is_bundle: boolean;
195
+ is_freebie: boolean;
196
+ freebie: unknown | null;
197
+ group_name: string;
198
+ product_metadata: Record<string, string>;
199
+ metadata: unknown[];
200
+ small: string;
201
+ thumb: string;
202
+ medium: string;
203
+ has_price_discount: boolean;
204
+ price_gift: string;
205
+ price_gift_formated: string;
206
+ price_sale: string;
207
+ price_sale_formated: string;
208
+ price: string;
209
+ price_total: number;
210
+ price_total_with_item_discount: number;
211
+ price_formated: string;
212
+ price_total_formated: string;
213
+ name: string;
214
+ name_with_grids: string;
215
+ sku: string;
216
+ availability_days: number;
217
+ availability_text: string;
218
+ categories: number[];
219
+ categories_names: string[];
220
+ grids: YampiGridItem[];
221
+ is_digital: boolean;
222
+ short_description: string;
223
+ customizations: unknown[];
224
+ customized: boolean;
225
+ allow_sell_without_customization: number;
226
+ selected_customizations: number;
227
+ product_option?: {
228
+ id: number;
229
+ store_id: number;
230
+ product_id: number;
231
+ price_sale: string;
232
+ price_discount: string;
233
+ sku: string;
234
+ quantity_managed: number;
235
+ availability: number;
236
+ availability_soldout: number;
237
+ allow_sell_without_customization: number;
238
+ product?: {
239
+ id: number;
240
+ name: string;
241
+ slug: string;
242
+ gift_value: string;
243
+ is_digital: number;
244
+ seo_description: string;
245
+ brand_id: number;
246
+ custom_shipping: number;
247
+ shipping_price: string;
248
+ store_id: number;
249
+ simple: number;
250
+ brand?: {
251
+ id: number;
252
+ name: string;
253
+ };
254
+ };
255
+ };
256
+ }
257
+ interface YampiOrderData {
258
+ pageCategory?: string;
259
+ order?: YampiOrder;
260
+ }
261
+ interface YampiOrder {
262
+ id: number;
263
+ token: string;
264
+ payment_method: string;
265
+ new_customer: boolean;
266
+ coupon: string;
267
+ number: string;
268
+ total: number;
269
+ total_without_taxes: number;
270
+ total_without_shipping: number;
271
+ customer_id: number;
272
+ customer?: YampiCustomer;
273
+ authorized: number;
274
+ optionsIds?: string[];
275
+ skusIds?: string[];
276
+ status: string;
277
+ prices?: {
278
+ total: number;
279
+ };
280
+ address_info?: {
281
+ hashed_first_name?: string;
282
+ hashed_last_name?: string;
283
+ hashed_street_address?: string;
284
+ city?: string;
285
+ state?: string;
286
+ postal_code?: string;
287
+ country_code?: string;
288
+ };
289
+ items?: YampiOrderItem[];
290
+ }
291
+ interface YampiOrderItem {
292
+ product: {
293
+ id: string;
294
+ sku: string;
295
+ price: number;
296
+ brand: string;
297
+ categories: string[];
298
+ image_url: string;
299
+ metadata: unknown[];
300
+ };
301
+ quantity: number;
302
+ name: string;
303
+ product_id: number;
304
+ categories_names: string[];
305
+ }
306
+ interface YampiCustomer {
307
+ id: number;
308
+ first_name?: string;
309
+ last_name?: string;
310
+ document?: string;
311
+ document_type?: string;
312
+ birthday?: string | null;
313
+ phone_number?: string;
314
+ wallet_balance?: number;
315
+ full_name?: string;
316
+ email?: string;
317
+ name?: string;
318
+ cpf?: string;
319
+ homephone?: string;
320
+ }
321
+ interface YampiCartModel {
322
+ id: number;
323
+ store_id: number;
324
+ customer_id: number | null;
325
+ promocode_id: number | null;
326
+ payment_id: number | null;
327
+ address_id: number | null;
328
+ seller_id: number | null;
329
+ done: number;
330
+ token: string;
331
+ has_recomm: number;
332
+ value_shipment: number | null;
333
+ zipcode: string | null;
334
+ shipment_service_id: number | null;
335
+ payment_alias: string | null;
336
+ tracking_data?: string | null;
337
+ utm_source?: string | null;
338
+ utm_campaign?: string | null;
339
+ utm_medium?: string | null;
340
+ utm_term?: string | null;
341
+ utm_content?: string | null;
342
+ created_at: string;
343
+ updated_at: string;
344
+ deleted_at: string | null;
345
+ items?: YampiCartModelItem[];
346
+ customer?: YampiCustomer;
347
+ payment?: unknown | null;
348
+ kits?: unknown[];
349
+ store?: YampiStore;
350
+ promocode?: YampiCartModelPromocode | null;
351
+ }
352
+ interface YampiCartModelPromocode {
353
+ id: number;
354
+ store_id: number;
355
+ customer_id: null;
356
+ active: number;
357
+ for_the_price_of: number;
358
+ cart_default: number;
359
+ description: string;
360
+ type_increment_value: string;
361
+ value: string;
362
+ price_products: string;
363
+ percent_products: string;
364
+ code: string;
365
+ quantity: number;
366
+ product_quantity: number;
367
+ product_max_quantity: number;
368
+ used: number;
369
+ items_count: number;
370
+ min_value: string;
371
+ shipment_percent: string;
372
+ accumulate: number;
373
+ once_per_customer: number;
374
+ abandoned_cart: number;
375
+ newsletter: number;
376
+ free_shipment: number;
377
+ ignore_promotion_products: number;
378
+ start_at: string;
379
+ end_at: string;
380
+ created_at: string;
381
+ updated_at: string;
382
+ deleted_at: null;
383
+ }
384
+ interface YampiCartModelItem {
385
+ id: number;
386
+ cart_id: number;
387
+ product_option_id: number;
388
+ kit_id: number | null;
389
+ upsell_id: number | null;
390
+ bundle_id: number | null;
391
+ quantity: number;
392
+ gift: number;
393
+ has_recomm: number;
394
+ custom_value: unknown | null;
395
+ created_at: string;
396
+ updated_at: string;
397
+ freebie_id: number | null;
398
+ product_option?: {
399
+ id: number;
400
+ store_id: number;
401
+ product_id: number;
402
+ sku: string;
403
+ token: string;
404
+ barcode: string;
405
+ allow_sell_without_customization: number;
406
+ price_sale: string;
407
+ price_discount: string;
408
+ quantity_managed: number;
409
+ availability: number;
410
+ availability_soldout: number;
411
+ blocked_sale: number;
412
+ order: number;
413
+ created_at: string;
414
+ updated_at: string;
415
+ stocks?: Array<{
416
+ id: number;
417
+ option_id: number;
418
+ stock_id: number;
419
+ quantity: number;
420
+ min_quantity: number;
421
+ created_at: string;
422
+ updated_at: string;
423
+ }>;
424
+ };
425
+ customizations?: unknown[];
426
+ cart?: YampiCartModel;
427
+ discounts?: unknown[];
428
+ }
429
+ interface YampiStore {
430
+ id: number;
431
+ store_type_id: number | null;
432
+ template_id: number | null;
433
+ theme_id: number;
434
+ preset_id: number;
435
+ active: number;
436
+ internal_active: number;
437
+ is_subdomain: number;
438
+ is_published: number;
439
+ corporate: number;
440
+ is_marketplace: number;
441
+ use_only_checkout: number;
442
+ profile: string;
443
+ alias: string;
444
+ domain: string;
445
+ suspended_at: string | null;
446
+ created_at: string;
447
+ deleted_at: string | null;
448
+ checkout_config?: {
449
+ id: number;
450
+ store_id: number;
451
+ active: number;
452
+ currency: string;
453
+ };
454
+ }
455
+ declare global {
456
+ interface Window extends YampiWindow {
457
+ }
458
+ }