@uappi/public-sdk 1.2.8 → 1.2.10
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/.gitlab-ci.yml +43 -0
- package/.husky/pre-push +1 -0
- package/.vscode/extensions.json +4 -4
- package/.vscode/settings.json +6 -6
- package/README.md +67 -0
- package/components/Animations/ExpandTransition.ts +89 -89
- package/components/Animations/index.ts +1 -1
- package/components/ColorTheme/ColorTheme.ts +80 -80
- package/components/ColorTheme/index.ts +1 -1
- package/components/ColorTheme/types.ts +18 -18
- package/components/SocialAuth/FacebookAuth/types.ts +2 -2
- package/components/SocialAuth/GoogleAuth/types.ts +2 -2
- package/components/SocialAuth/index.ts +1 -1
- package/components/index.ts +2 -2
- package/eslint.config.mjs +19 -0
- package/main.ts +4 -4
- package/modules/Api/README.md +469 -469
- package/modules/Api/endpoints/CommonComposable.ts +24 -24
- package/modules/Api/endpoints/CouponComposable.ts +18 -18
- package/modules/Api/endpoints/CustomerComposable.ts +1 -1
- package/modules/Api/endpoints/LoggoutComposable.ts +8 -8
- package/modules/Api/endpoints/MFAComposable.ts +43 -43
- package/modules/Api/endpoints/PaymentComposable.ts +14 -14
- package/modules/Api/endpoints/PublicComposable.ts +8 -8
- package/modules/Api/endpoints/TemplateComposable.ts +7 -7
- package/modules/Api/endpoints/ThirdPartyComposable.ts +13 -13
- package/modules/Api/endpoints/UpsellComposable.ts +17 -18
- package/modules/Api/endpoints/VerifyComposable.ts +7 -7
- package/modules/Api/endpoints/WalletComposable.ts +36 -36
- package/modules/Api/paramsSerializer/encodeWafNormalizer.ts +7 -7
- package/modules/Api/types/context/api-config.types.ts +0 -1
- package/modules/Api/types/endpoints/cart/cart.interfaces.ts +161 -161
- package/modules/Api/types/endpoints/cart/cart.types.ts +27 -27
- package/modules/Api/types/endpoints/common/common.interfaces.ts +21 -21
- package/modules/Api/types/endpoints/country/country.types.ts +7502 -7502
- package/modules/Api/types/endpoints/coupon/coupon.interfaces.ts +13 -13
- package/modules/Api/types/endpoints/discounts/discounts.interfaces.ts +9 -9
- package/modules/Api/types/endpoints/mfa/mfa.interfaces.ts +51 -51
- package/modules/Api/types/endpoints/payment/payment.interfaces.ts +103 -103
- package/modules/Api/types/endpoints/payment/payment.types.ts +27 -27
- package/modules/Api/types/endpoints/price/price.interfaces.ts +21 -21
- package/modules/Api/types/endpoints/template/template.interfaces.ts +29 -29
- package/modules/Api/types/endpoints/third-party/oauth.interfaces.ts +5 -5
- package/modules/Api/types/endpoints/upsell/upsell.interfaces.ts +12 -12
- package/modules/Api/types/endpoints/wallet/wallet-obsearch.ts +8 -8
- package/modules/Api/types/endpoints/wallet/wallet.interfaces.ts +57 -57
- package/modules/Api/types/endpoints/zipcode/zipcode.interfaces.ts +23 -23
- package/modules/Api/types/index.ts +504 -504
- package/modules/Tracking/endpoints/CartComposable.ts +75 -75
- package/modules/Tracking/endpoints/CustomerComposable.ts +71 -71
- package/modules/Tracking/endpoints/types.ts +11 -11
- package/modules/Tracking/events/actions/addPaymentInfo.ts +31 -31
- package/modules/Tracking/events/actions/addShippingInfo.ts +27 -27
- package/modules/Tracking/events/actions/addToCart.ts +35 -35
- package/modules/Tracking/events/actions/beginCheckout.ts +28 -28
- package/modules/Tracking/events/actions/customerProfile.ts +36 -36
- package/modules/Tracking/events/actions/generateLead.ts +12 -12
- package/modules/Tracking/events/actions/login.ts +8 -8
- package/modules/Tracking/events/actions/purchase.ts +42 -42
- package/modules/Tracking/events/actions/removeFromCart.ts +52 -52
- package/modules/Tracking/events/actions/search.ts +8 -8
- package/modules/Tracking/events/actions/selectItem.ts +64 -64
- package/modules/Tracking/events/actions/selectPromotion.ts +24 -24
- package/modules/Tracking/events/actions/shippingCalculation.ts +7 -7
- package/modules/Tracking/events/actions/signup.ts +8 -8
- package/modules/Tracking/events/actions/upsertToCart.ts +62 -62
- package/modules/Tracking/events/views/viewCart.ts +28 -28
- package/modules/Tracking/events/views/viewHome.ts +5 -5
- package/modules/Tracking/events/views/viewItem.ts +31 -31
- package/modules/Tracking/events/views/viewItemList.ts +65 -65
- package/modules/Tracking/events/views/viewNotFound.ts +5 -5
- package/modules/Tracking/events/views/viewOther.ts +5 -5
- package/modules/Tracking/events/views/viewPayment.ts +7 -7
- package/modules/Tracking/events/views/viewPromotion.ts +28 -28
- package/modules/Tracking/events/views/viewShipping.ts +7 -7
- package/modules/Tracking/index.ts +84 -84
- package/modules/Tracking/publicApiTracking.ts +35 -36
- package/modules/Tracking/types/actions/add-payment-info.interfaces.ts +12 -12
- package/modules/Tracking/types/actions/add-shipping-info.interfaces.ts +11 -11
- package/modules/Tracking/types/actions/add-to-cart.interfaces.ts +10 -10
- package/modules/Tracking/types/actions/begin-checkout.interfaces.ts +12 -12
- package/modules/Tracking/types/actions/customer-profile.interfaces.ts +19 -19
- package/modules/Tracking/types/actions/file-download.interfaces.ts +4 -4
- package/modules/Tracking/types/actions/generate-lead.interfaces.ts +12 -12
- package/modules/Tracking/types/actions/login.interfaces.ts +4 -4
- package/modules/Tracking/types/actions/purchase.interfaces.ts +18 -18
- package/modules/Tracking/types/actions/remove-from-cart.interfaces.ts +10 -10
- package/modules/Tracking/types/actions/search.interfaces.ts +4 -4
- package/modules/Tracking/types/actions/select-item.interfaces.ts +16 -16
- package/modules/Tracking/types/actions/select-promotion.interfaces.ts +8 -8
- package/modules/Tracking/types/actions/share.interfaces.ts +4 -4
- package/modules/Tracking/types/actions/shipping-calculation.interfaces.ts +3 -3
- package/modules/Tracking/types/actions/signup.interfaces.ts +4 -4
- package/modules/Tracking/types/event.types.ts +54 -54
- package/modules/Tracking/types/index.ts +37 -37
- package/modules/Tracking/types/item.interfaces.ts +30 -30
- package/modules/Tracking/types/views/view-cart.interfaces.ts +11 -11
- package/modules/Tracking/types/views/view-home.interfaces.ts +3 -3
- package/modules/Tracking/types/views/view-item-list.interfaces.ts +11 -11
- package/modules/Tracking/types/views/view-item.interfaces.ts +15 -15
- package/modules/Tracking/types/views/view-not-found.interfaces.ts +3 -3
- package/modules/Tracking/types/views/view-other.interfaces.ts +3 -3
- package/modules/Tracking/types/views/view-payment.interfaces.ts +3 -3
- package/modules/Tracking/types/views/view-promotion.interfaces.ts +8 -8
- package/modules/Tracking/types/views/view-shipping.interfaces.ts +3 -3
- package/modules/Tracking/utils/cart.ts +100 -100
- package/modules/Tracking/utils/pushDatalayer.ts +7 -7
- package/modules/index.ts +1 -1
- package/package.json +18 -2
- package/scripts/release.sh +34 -0
- package/shims.d.ts +5 -0
- package/tsconfig.json +17 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { pushDatalayer } from '../../utils/pushDatalayer';
|
|
2
|
-
|
|
3
|
-
export function loginAction() {
|
|
4
|
-
pushDatalayer({
|
|
5
|
-
event: 'login',
|
|
6
|
-
method: 'Internal',
|
|
7
|
-
});
|
|
8
|
-
}
|
|
1
|
+
import { pushDatalayer } from '../../utils/pushDatalayer';
|
|
2
|
+
|
|
3
|
+
export function loginAction() {
|
|
4
|
+
pushDatalayer({
|
|
5
|
+
event: 'login',
|
|
6
|
+
method: 'Internal',
|
|
7
|
+
});
|
|
8
|
+
}
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import { getAddedCartItems, getVariant, totalValue } from '../../utils/cart';
|
|
2
|
-
import { pushDatalayer } from '../../utils/pushDatalayer';
|
|
3
|
-
|
|
4
|
-
import type { CartResponse } from '../../../Api/types';
|
|
5
|
-
|
|
6
|
-
export function purchaseAction(
|
|
7
|
-
paymentMethod: string,
|
|
8
|
-
cartPayload: CartResponse,
|
|
9
|
-
) {
|
|
10
|
-
pushDatalayer({
|
|
11
|
-
event: 'purchase',
|
|
12
|
-
ecommerce: {
|
|
13
|
-
currency: 'BRL',
|
|
14
|
-
affiliation: 'Loja Virtual',
|
|
15
|
-
|
|
16
|
-
payment_status: 'em aberto',
|
|
17
|
-
payment_type: paymentMethod,
|
|
18
|
-
|
|
19
|
-
shipping: cartPayload.shippingValue,
|
|
20
|
-
shipping_tier: cartPayload.orders[0].shippingOptions.find(
|
|
21
|
-
shippingOption => shippingOption.selected,
|
|
22
|
-
)!.label,
|
|
23
|
-
tax: 0,
|
|
24
|
-
transaction_id: '',
|
|
25
|
-
|
|
26
|
-
value: totalValue(cartPayload),
|
|
27
|
-
coupon: cartPayload.discountMap.coupon?.discountMainCode || '',
|
|
28
|
-
items: getAddedCartItems(cartPayload).map(item => {
|
|
29
|
-
return {
|
|
30
|
-
item_category: '',
|
|
31
|
-
coupon: cartPayload.discountMap.coupon?.discountMainCode || '',
|
|
32
|
-
item_brand: `${item.product.brandId}`,
|
|
33
|
-
item_id: item.product.productId,
|
|
34
|
-
item_name: item.product.name,
|
|
35
|
-
item_variant: getVariant(item),
|
|
36
|
-
price: item.unitValue,
|
|
37
|
-
quantity: item.quantity,
|
|
38
|
-
};
|
|
39
|
-
}),
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
}
|
|
1
|
+
import { getAddedCartItems, getVariant, totalValue } from '../../utils/cart';
|
|
2
|
+
import { pushDatalayer } from '../../utils/pushDatalayer';
|
|
3
|
+
|
|
4
|
+
import type { CartResponse } from '../../../Api/types';
|
|
5
|
+
|
|
6
|
+
export function purchaseAction(
|
|
7
|
+
paymentMethod: string,
|
|
8
|
+
cartPayload: CartResponse,
|
|
9
|
+
) {
|
|
10
|
+
pushDatalayer({
|
|
11
|
+
event: 'purchase',
|
|
12
|
+
ecommerce: {
|
|
13
|
+
currency: 'BRL',
|
|
14
|
+
affiliation: 'Loja Virtual',
|
|
15
|
+
|
|
16
|
+
payment_status: 'em aberto',
|
|
17
|
+
payment_type: paymentMethod,
|
|
18
|
+
|
|
19
|
+
shipping: cartPayload.shippingValue,
|
|
20
|
+
shipping_tier: cartPayload.orders[0].shippingOptions.find(
|
|
21
|
+
shippingOption => shippingOption.selected,
|
|
22
|
+
)!.label,
|
|
23
|
+
tax: 0,
|
|
24
|
+
transaction_id: '',
|
|
25
|
+
|
|
26
|
+
value: totalValue(cartPayload),
|
|
27
|
+
coupon: cartPayload.discountMap.coupon?.discountMainCode || '',
|
|
28
|
+
items: getAddedCartItems(cartPayload).map(item => {
|
|
29
|
+
return {
|
|
30
|
+
item_category: '',
|
|
31
|
+
coupon: cartPayload.discountMap.coupon?.discountMainCode || '',
|
|
32
|
+
item_brand: `${item.product.brandId}`,
|
|
33
|
+
item_id: item.product.productId,
|
|
34
|
+
item_name: item.product.name,
|
|
35
|
+
item_variant: getVariant(item),
|
|
36
|
+
price: item.unitValue,
|
|
37
|
+
quantity: item.quantity,
|
|
38
|
+
};
|
|
39
|
+
}),
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
}
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
import { getAddedCartItems, getVariant, totalValue } from '../../utils/cart';
|
|
2
|
-
import { pushDatalayer } from '../../utils/pushDatalayer';
|
|
3
|
-
|
|
4
|
-
import type { CartResponse, DeleteCartRequest } from '../../../Api/types';
|
|
5
|
-
|
|
6
|
-
export function removeFromCartAction(
|
|
7
|
-
deletePayload: DeleteCartRequest,
|
|
8
|
-
cartPayload: CartResponse,
|
|
9
|
-
oldCartResponse?: CartResponse,
|
|
10
|
-
) {
|
|
11
|
-
if (!cartPayload.orders.length) {
|
|
12
|
-
pushDatalayer({
|
|
13
|
-
event: 'remove_from_cart',
|
|
14
|
-
ecommerce: {
|
|
15
|
-
currency: 'BRL',
|
|
16
|
-
value: 0,
|
|
17
|
-
items: [
|
|
18
|
-
{
|
|
19
|
-
coupon: cartPayload.discountMap.coupon?.discountMainCode || '',
|
|
20
|
-
item_category: '',
|
|
21
|
-
item_brand: `${oldCartResponse!.orders[0].items[0].product.brandId}`,
|
|
22
|
-
item_id: oldCartResponse!.orders[0].items[0].product.productId,
|
|
23
|
-
item_name: oldCartResponse!.orders[0].items[0].product.name,
|
|
24
|
-
item_variant: getVariant(oldCartResponse!.orders[0].items[0]),
|
|
25
|
-
price: oldCartResponse!.orders[0].items[0].unitValue,
|
|
26
|
-
quantity: 1,
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
pushDatalayer({
|
|
34
|
-
event: 'remove_from_cart',
|
|
35
|
-
ecommerce: {
|
|
36
|
-
currency: 'BRL',
|
|
37
|
-
value: totalValue(cartPayload, deletePayload),
|
|
38
|
-
items: getAddedCartItems(cartPayload, deletePayload).map(item => {
|
|
39
|
-
return {
|
|
40
|
-
coupon: cartPayload.discountMap.coupon?.discountMainCode || '',
|
|
41
|
-
item_category: '',
|
|
42
|
-
item_brand: `${item.product.brandId}`,
|
|
43
|
-
item_id: item.product.productId,
|
|
44
|
-
item_name: item.product.name,
|
|
45
|
-
item_variant: getVariant(item),
|
|
46
|
-
price: item.unitValue,
|
|
47
|
-
quantity: item.quantity,
|
|
48
|
-
};
|
|
49
|
-
}),
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
}
|
|
1
|
+
import { getAddedCartItems, getVariant, totalValue } from '../../utils/cart';
|
|
2
|
+
import { pushDatalayer } from '../../utils/pushDatalayer';
|
|
3
|
+
|
|
4
|
+
import type { CartResponse, DeleteCartRequest } from '../../../Api/types';
|
|
5
|
+
|
|
6
|
+
export function removeFromCartAction(
|
|
7
|
+
deletePayload: DeleteCartRequest,
|
|
8
|
+
cartPayload: CartResponse,
|
|
9
|
+
oldCartResponse?: CartResponse,
|
|
10
|
+
) {
|
|
11
|
+
if (!cartPayload.orders.length) {
|
|
12
|
+
pushDatalayer({
|
|
13
|
+
event: 'remove_from_cart',
|
|
14
|
+
ecommerce: {
|
|
15
|
+
currency: 'BRL',
|
|
16
|
+
value: 0,
|
|
17
|
+
items: [
|
|
18
|
+
{
|
|
19
|
+
coupon: cartPayload.discountMap.coupon?.discountMainCode || '',
|
|
20
|
+
item_category: '',
|
|
21
|
+
item_brand: `${oldCartResponse!.orders[0].items[0].product.brandId}`,
|
|
22
|
+
item_id: oldCartResponse!.orders[0].items[0].product.productId,
|
|
23
|
+
item_name: oldCartResponse!.orders[0].items[0].product.name,
|
|
24
|
+
item_variant: getVariant(oldCartResponse!.orders[0].items[0]),
|
|
25
|
+
price: oldCartResponse!.orders[0].items[0].unitValue,
|
|
26
|
+
quantity: 1,
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
pushDatalayer({
|
|
34
|
+
event: 'remove_from_cart',
|
|
35
|
+
ecommerce: {
|
|
36
|
+
currency: 'BRL',
|
|
37
|
+
value: totalValue(cartPayload, deletePayload),
|
|
38
|
+
items: getAddedCartItems(cartPayload, deletePayload).map(item => {
|
|
39
|
+
return {
|
|
40
|
+
coupon: cartPayload.discountMap.coupon?.discountMainCode || '',
|
|
41
|
+
item_category: '',
|
|
42
|
+
item_brand: `${item.product.brandId}`,
|
|
43
|
+
item_id: item.product.productId,
|
|
44
|
+
item_name: item.product.name,
|
|
45
|
+
item_variant: getVariant(item),
|
|
46
|
+
price: item.unitValue,
|
|
47
|
+
quantity: item.quantity,
|
|
48
|
+
};
|
|
49
|
+
}),
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { pushDatalayer } from '../../utils/pushDatalayer';
|
|
2
|
-
|
|
3
|
-
export function searchAction(term: string) {
|
|
4
|
-
pushDatalayer({
|
|
5
|
-
event: 'search',
|
|
6
|
-
search_term: term,
|
|
7
|
-
});
|
|
8
|
-
}
|
|
1
|
+
import { pushDatalayer } from '../../utils/pushDatalayer';
|
|
2
|
+
|
|
3
|
+
export function searchAction(term: string) {
|
|
4
|
+
pushDatalayer({
|
|
5
|
+
event: 'search',
|
|
6
|
+
search_term: term,
|
|
7
|
+
});
|
|
8
|
+
}
|
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
import { getVariant } from '../../utils/cart';
|
|
2
|
-
import { pushDatalayer } from '../../utils/pushDatalayer';
|
|
3
|
-
|
|
4
|
-
import type {
|
|
5
|
-
Search,
|
|
6
|
-
Showcase,
|
|
7
|
-
UrlBrand,
|
|
8
|
-
UrlListing,
|
|
9
|
-
} from '../../../Api/types';
|
|
10
|
-
|
|
11
|
-
export function selectItemAction(
|
|
12
|
-
page: UrlBrand | UrlListing | Showcase | Search,
|
|
13
|
-
productIndex: number,
|
|
14
|
-
) {
|
|
15
|
-
if ('type' in page) {
|
|
16
|
-
const product = page.content.registers[productIndex];
|
|
17
|
-
pushDatalayer({
|
|
18
|
-
event: 'select_item',
|
|
19
|
-
ecommerce: {
|
|
20
|
-
item_list_id: page.type === 'search' ? 'Search' : page.entity.name,
|
|
21
|
-
item_list_name: page.type === 'search' ? 'Search' : page.entity.name,
|
|
22
|
-
currency: 'BRL',
|
|
23
|
-
items: [
|
|
24
|
-
{
|
|
25
|
-
item_id: product.id,
|
|
26
|
-
item_name: product.name,
|
|
27
|
-
item_list_id: page.type === 'search' ? 'Search' : page.entity.name,
|
|
28
|
-
item_list_name:
|
|
29
|
-
page.type === 'search' ? 'Search' : page.entity.name,
|
|
30
|
-
item_brand: product.brand?.name || '',
|
|
31
|
-
item_variant: getVariant(product),
|
|
32
|
-
item_category: product.mainCategory?.name || '',
|
|
33
|
-
price: product.price?.salePrice || 0,
|
|
34
|
-
index: productIndex + 1,
|
|
35
|
-
},
|
|
36
|
-
],
|
|
37
|
-
},
|
|
38
|
-
});
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const product = page.products[productIndex];
|
|
43
|
-
pushDatalayer({
|
|
44
|
-
event: 'select_item',
|
|
45
|
-
ecommerce: {
|
|
46
|
-
item_list_id: page.name,
|
|
47
|
-
item_list_name: page.name,
|
|
48
|
-
currency: 'BRL',
|
|
49
|
-
items: [
|
|
50
|
-
{
|
|
51
|
-
item_id: product.id,
|
|
52
|
-
item_name: product.name,
|
|
53
|
-
item_list_id: page.name,
|
|
54
|
-
item_list_name: page.name,
|
|
55
|
-
item_brand: product.brand?.name || '',
|
|
56
|
-
item_variant: getVariant(product),
|
|
57
|
-
item_category: product.mainCategory?.name || '',
|
|
58
|
-
price: product.price?.salePrice || 0,
|
|
59
|
-
index: productIndex + 1,
|
|
60
|
-
},
|
|
61
|
-
],
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
|
-
}
|
|
1
|
+
import { getVariant } from '../../utils/cart';
|
|
2
|
+
import { pushDatalayer } from '../../utils/pushDatalayer';
|
|
3
|
+
|
|
4
|
+
import type {
|
|
5
|
+
Search,
|
|
6
|
+
Showcase,
|
|
7
|
+
UrlBrand,
|
|
8
|
+
UrlListing,
|
|
9
|
+
} from '../../../Api/types';
|
|
10
|
+
|
|
11
|
+
export function selectItemAction(
|
|
12
|
+
page: UrlBrand | UrlListing | Showcase | Search,
|
|
13
|
+
productIndex: number,
|
|
14
|
+
) {
|
|
15
|
+
if ('type' in page) {
|
|
16
|
+
const product = page.content.registers[productIndex];
|
|
17
|
+
pushDatalayer({
|
|
18
|
+
event: 'select_item',
|
|
19
|
+
ecommerce: {
|
|
20
|
+
item_list_id: page.type === 'search' ? 'Search' : page.entity.name,
|
|
21
|
+
item_list_name: page.type === 'search' ? 'Search' : page.entity.name,
|
|
22
|
+
currency: 'BRL',
|
|
23
|
+
items: [
|
|
24
|
+
{
|
|
25
|
+
item_id: product.id,
|
|
26
|
+
item_name: product.name,
|
|
27
|
+
item_list_id: page.type === 'search' ? 'Search' : page.entity.name,
|
|
28
|
+
item_list_name:
|
|
29
|
+
page.type === 'search' ? 'Search' : page.entity.name,
|
|
30
|
+
item_brand: product.brand?.name || '',
|
|
31
|
+
item_variant: getVariant(product),
|
|
32
|
+
item_category: product.mainCategory?.name || '',
|
|
33
|
+
price: product.price?.salePrice || 0,
|
|
34
|
+
index: productIndex + 1,
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const product = page.products[productIndex];
|
|
43
|
+
pushDatalayer({
|
|
44
|
+
event: 'select_item',
|
|
45
|
+
ecommerce: {
|
|
46
|
+
item_list_id: page.name,
|
|
47
|
+
item_list_name: page.name,
|
|
48
|
+
currency: 'BRL',
|
|
49
|
+
items: [
|
|
50
|
+
{
|
|
51
|
+
item_id: product.id,
|
|
52
|
+
item_name: product.name,
|
|
53
|
+
item_list_id: page.name,
|
|
54
|
+
item_list_name: page.name,
|
|
55
|
+
item_brand: product.brand?.name || '',
|
|
56
|
+
item_variant: getVariant(product),
|
|
57
|
+
item_category: product.mainCategory?.name || '',
|
|
58
|
+
price: product.price?.salePrice || 0,
|
|
59
|
+
index: productIndex + 1,
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { pushDatalayer } from '../../utils/pushDatalayer';
|
|
2
|
-
|
|
3
|
-
import type { BannerItem } from '../../types';
|
|
4
|
-
import type { Banner } from '../../../Api/types';
|
|
5
|
-
|
|
6
|
-
export function selectPromotionAction<AdditionalParameters>(
|
|
7
|
-
banner: Banner<AdditionalParameters>,
|
|
8
|
-
index: number,
|
|
9
|
-
) {
|
|
10
|
-
pushDatalayer({
|
|
11
|
-
event: 'select_promotion',
|
|
12
|
-
ecommerce: {
|
|
13
|
-
items: [
|
|
14
|
-
{
|
|
15
|
-
promotion_id: banner.id,
|
|
16
|
-
promotion_name: 'Banners' as BannerItem['promotion_name'],
|
|
17
|
-
creative_name: `${banner.scheduling?.startDate.slice(0, 10)}-${banner.name.replaceAll(' ', '-')}`,
|
|
18
|
-
creative_slot: index + 1,
|
|
19
|
-
index: index + 1,
|
|
20
|
-
},
|
|
21
|
-
],
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
}
|
|
1
|
+
import { pushDatalayer } from '../../utils/pushDatalayer';
|
|
2
|
+
|
|
3
|
+
import type { BannerItem } from '../../types';
|
|
4
|
+
import type { Banner } from '../../../Api/types';
|
|
5
|
+
|
|
6
|
+
export function selectPromotionAction<AdditionalParameters>(
|
|
7
|
+
banner: Banner<AdditionalParameters>,
|
|
8
|
+
index: number,
|
|
9
|
+
) {
|
|
10
|
+
pushDatalayer({
|
|
11
|
+
event: 'select_promotion',
|
|
12
|
+
ecommerce: {
|
|
13
|
+
items: [
|
|
14
|
+
{
|
|
15
|
+
promotion_id: banner.id,
|
|
16
|
+
promotion_name: 'Banners' as BannerItem['promotion_name'],
|
|
17
|
+
creative_name: `${banner.scheduling?.startDate.slice(0, 10)}-${banner.name.replaceAll(' ', '-')}`,
|
|
18
|
+
creative_slot: index + 1,
|
|
19
|
+
index: index + 1,
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { pushDatalayer } from '../../utils/pushDatalayer';
|
|
2
|
-
|
|
3
|
-
export function shippingCalculationAction() {
|
|
4
|
-
pushDatalayer({
|
|
5
|
-
event: 'item_view_shipping_calculation',
|
|
6
|
-
});
|
|
7
|
-
}
|
|
1
|
+
import { pushDatalayer } from '../../utils/pushDatalayer';
|
|
2
|
+
|
|
3
|
+
export function shippingCalculationAction() {
|
|
4
|
+
pushDatalayer({
|
|
5
|
+
event: 'item_view_shipping_calculation',
|
|
6
|
+
});
|
|
7
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { pushDatalayer } from '../../utils/pushDatalayer';
|
|
2
|
-
|
|
3
|
-
export function signupAction() {
|
|
4
|
-
pushDatalayer({
|
|
5
|
-
event: 'sign_up',
|
|
6
|
-
method: 'Internal',
|
|
7
|
-
});
|
|
8
|
-
}
|
|
1
|
+
import { pushDatalayer } from '../../utils/pushDatalayer';
|
|
2
|
+
|
|
3
|
+
export function signupAction() {
|
|
4
|
+
pushDatalayer({
|
|
5
|
+
event: 'sign_up',
|
|
6
|
+
method: 'Internal',
|
|
7
|
+
});
|
|
8
|
+
}
|
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
import { getAddedCartItems, getVariant, totalValue } from '../../utils/cart';
|
|
2
|
-
import { pushDatalayer } from '../../utils/pushDatalayer';
|
|
3
|
-
|
|
4
|
-
import type { UpsertTrackingCartRequest } from '../../types';
|
|
5
|
-
import type { CartResponse } from '../../../Api/types';
|
|
6
|
-
|
|
7
|
-
export function upsertToCartAction(
|
|
8
|
-
upsertPayload: UpsertTrackingCartRequest,
|
|
9
|
-
cartPayload: CartResponse,
|
|
10
|
-
) {
|
|
11
|
-
if (!getAddedCartItems(cartPayload, upsertPayload).length) return;
|
|
12
|
-
|
|
13
|
-
if (
|
|
14
|
-
upsertPayload.items.some(item => (item.oldQuantity || 0) > item.quantity!)
|
|
15
|
-
) {
|
|
16
|
-
pushDatalayer({
|
|
17
|
-
event: 'remove_from_cart',
|
|
18
|
-
ecommerce: {
|
|
19
|
-
currency: 'BRL',
|
|
20
|
-
value: totalValue(cartPayload, upsertPayload),
|
|
21
|
-
items: getAddedCartItems(cartPayload, upsertPayload).map(item => {
|
|
22
|
-
return {
|
|
23
|
-
item_category: '',
|
|
24
|
-
item_list_name: '',
|
|
25
|
-
item_brand: `${item.product.brandId}`,
|
|
26
|
-
item_id: item.product.productId,
|
|
27
|
-
coupon: cartPayload.discountMap.coupon?.discountMainCode || '',
|
|
28
|
-
item_name: item.product.name,
|
|
29
|
-
item_variant: getVariant(item),
|
|
30
|
-
price: item.unitValue,
|
|
31
|
-
quantity: item.oldQuantity! - item.quantity,
|
|
32
|
-
};
|
|
33
|
-
}),
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
pushDatalayer({
|
|
41
|
-
event: 'add_to_cart',
|
|
42
|
-
ecommerce: {
|
|
43
|
-
currency: 'BRL',
|
|
44
|
-
value: totalValue(cartPayload, upsertPayload),
|
|
45
|
-
items: getAddedCartItems(cartPayload, upsertPayload).map(item => {
|
|
46
|
-
return {
|
|
47
|
-
item_category: '',
|
|
48
|
-
item_list_name: '',
|
|
49
|
-
item_brand: `${item.product.brandId}`,
|
|
50
|
-
item_id: item.product.productId,
|
|
51
|
-
coupon: cartPayload.discountMap.coupon?.discountMainCode || '',
|
|
52
|
-
item_name: item.product.name,
|
|
53
|
-
item_variant: getVariant(item),
|
|
54
|
-
price: item.unitValue,
|
|
55
|
-
quantity: item.oldQuantity
|
|
56
|
-
? item.quantity - item.oldQuantity
|
|
57
|
-
: item.quantity,
|
|
58
|
-
};
|
|
59
|
-
}),
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
}
|
|
1
|
+
import { getAddedCartItems, getVariant, totalValue } from '../../utils/cart';
|
|
2
|
+
import { pushDatalayer } from '../../utils/pushDatalayer';
|
|
3
|
+
|
|
4
|
+
import type { UpsertTrackingCartRequest } from '../../types';
|
|
5
|
+
import type { CartResponse } from '../../../Api/types';
|
|
6
|
+
|
|
7
|
+
export function upsertToCartAction(
|
|
8
|
+
upsertPayload: UpsertTrackingCartRequest,
|
|
9
|
+
cartPayload: CartResponse,
|
|
10
|
+
) {
|
|
11
|
+
if (!getAddedCartItems(cartPayload, upsertPayload).length) return;
|
|
12
|
+
|
|
13
|
+
if (
|
|
14
|
+
upsertPayload.items.some(item => (item.oldQuantity || 0) > item.quantity!)
|
|
15
|
+
) {
|
|
16
|
+
pushDatalayer({
|
|
17
|
+
event: 'remove_from_cart',
|
|
18
|
+
ecommerce: {
|
|
19
|
+
currency: 'BRL',
|
|
20
|
+
value: totalValue(cartPayload, upsertPayload),
|
|
21
|
+
items: getAddedCartItems(cartPayload, upsertPayload).map(item => {
|
|
22
|
+
return {
|
|
23
|
+
item_category: '',
|
|
24
|
+
item_list_name: '',
|
|
25
|
+
item_brand: `${item.product.brandId}`,
|
|
26
|
+
item_id: item.product.productId,
|
|
27
|
+
coupon: cartPayload.discountMap.coupon?.discountMainCode || '',
|
|
28
|
+
item_name: item.product.name,
|
|
29
|
+
item_variant: getVariant(item),
|
|
30
|
+
price: item.unitValue,
|
|
31
|
+
quantity: item.oldQuantity! - item.quantity,
|
|
32
|
+
};
|
|
33
|
+
}),
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
pushDatalayer({
|
|
41
|
+
event: 'add_to_cart',
|
|
42
|
+
ecommerce: {
|
|
43
|
+
currency: 'BRL',
|
|
44
|
+
value: totalValue(cartPayload, upsertPayload),
|
|
45
|
+
items: getAddedCartItems(cartPayload, upsertPayload).map(item => {
|
|
46
|
+
return {
|
|
47
|
+
item_category: '',
|
|
48
|
+
item_list_name: '',
|
|
49
|
+
item_brand: `${item.product.brandId}`,
|
|
50
|
+
item_id: item.product.productId,
|
|
51
|
+
coupon: cartPayload.discountMap.coupon?.discountMainCode || '',
|
|
52
|
+
item_name: item.product.name,
|
|
53
|
+
item_variant: getVariant(item),
|
|
54
|
+
price: item.unitValue,
|
|
55
|
+
quantity: item.oldQuantity
|
|
56
|
+
? item.quantity - item.oldQuantity
|
|
57
|
+
: item.quantity,
|
|
58
|
+
};
|
|
59
|
+
}),
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { getAddedCartItems, getVariant, totalValue } from '../../utils/cart';
|
|
2
|
-
import { pushDatalayer } from '../../utils/pushDatalayer';
|
|
3
|
-
|
|
4
|
-
import type { CartResponse } from '../../../Api/types';
|
|
5
|
-
|
|
6
|
-
export function viewCart(cartPayload: CartResponse) {
|
|
7
|
-
pushDatalayer({
|
|
8
|
-
event: 'view_cart',
|
|
9
|
-
ecommerce: {
|
|
10
|
-
currency: 'BRL',
|
|
11
|
-
value: totalValue(cartPayload),
|
|
12
|
-
coupon: cartPayload.discountMap.coupon?.discountMainCode || '',
|
|
13
|
-
items: getAddedCartItems(cartPayload).map(item => {
|
|
14
|
-
return {
|
|
15
|
-
coupon: cartPayload.discountMap.coupon?.discountMainCode || '',
|
|
16
|
-
item_category: '',
|
|
17
|
-
item_list_name: '',
|
|
18
|
-
item_brand: `${item.product.brandId}`,
|
|
19
|
-
item_id: item.product.productId,
|
|
20
|
-
item_name: item.product.name,
|
|
21
|
-
item_variant: getVariant(item),
|
|
22
|
-
price: item.unitValue,
|
|
23
|
-
quantity: item.quantity,
|
|
24
|
-
};
|
|
25
|
-
}),
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
}
|
|
1
|
+
import { getAddedCartItems, getVariant, totalValue } from '../../utils/cart';
|
|
2
|
+
import { pushDatalayer } from '../../utils/pushDatalayer';
|
|
3
|
+
|
|
4
|
+
import type { CartResponse } from '../../../Api/types';
|
|
5
|
+
|
|
6
|
+
export function viewCart(cartPayload: CartResponse) {
|
|
7
|
+
pushDatalayer({
|
|
8
|
+
event: 'view_cart',
|
|
9
|
+
ecommerce: {
|
|
10
|
+
currency: 'BRL',
|
|
11
|
+
value: totalValue(cartPayload),
|
|
12
|
+
coupon: cartPayload.discountMap.coupon?.discountMainCode || '',
|
|
13
|
+
items: getAddedCartItems(cartPayload).map(item => {
|
|
14
|
+
return {
|
|
15
|
+
coupon: cartPayload.discountMap.coupon?.discountMainCode || '',
|
|
16
|
+
item_category: '',
|
|
17
|
+
item_list_name: '',
|
|
18
|
+
item_brand: `${item.product.brandId}`,
|
|
19
|
+
item_id: item.product.productId,
|
|
20
|
+
item_name: item.product.name,
|
|
21
|
+
item_variant: getVariant(item),
|
|
22
|
+
price: item.unitValue,
|
|
23
|
+
quantity: item.quantity,
|
|
24
|
+
};
|
|
25
|
+
}),
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { pushDatalayer } from '../../utils/pushDatalayer';
|
|
2
|
-
|
|
3
|
-
export function viewHome() {
|
|
4
|
-
pushDatalayer({ event: 'view_home' });
|
|
5
|
-
}
|
|
1
|
+
import { pushDatalayer } from '../../utils/pushDatalayer';
|
|
2
|
+
|
|
3
|
+
export function viewHome() {
|
|
4
|
+
pushDatalayer({ event: 'view_home' });
|
|
5
|
+
}
|