@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,75 +1,75 @@
|
|
|
1
|
-
import api from '../../Api';
|
|
2
|
-
|
|
3
|
-
import { addShippingInfoAction } from '../events/actions/addShippingInfo';
|
|
4
|
-
import { addToCartAction } from '../events/actions/addToCart';
|
|
5
|
-
import { purchaseAction } from '../events/actions/purchase';
|
|
6
|
-
import { removeFromCartAction } from '../events/actions/removeFromCart';
|
|
7
|
-
import { shippingCalculationAction } from '../events/actions/shippingCalculation';
|
|
8
|
-
import { upsertToCartAction } from '../events/actions/upsertToCart';
|
|
9
|
-
|
|
10
|
-
import type { UpsertTrackingCartRequest } from '../types';
|
|
11
|
-
import type {
|
|
12
|
-
BuyCartRequest,
|
|
13
|
-
CartResponse,
|
|
14
|
-
DeleteCartRequest,
|
|
15
|
-
SelectShipimentRequest,
|
|
16
|
-
ShipmentQuoteCartRequest,
|
|
17
|
-
UpsertCartRequest,
|
|
18
|
-
} from '../../Api/types';
|
|
19
|
-
|
|
20
|
-
export function listDetail() {
|
|
21
|
-
return api.cart.listDetail().then(data => {
|
|
22
|
-
return data;
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function addProduct(payload: UpsertTrackingCartRequest) {
|
|
27
|
-
return api.cart.addProduct(payload as UpsertCartRequest).then(data => {
|
|
28
|
-
addToCartAction(payload, data);
|
|
29
|
-
return data;
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function upsertProduct(payload: UpsertTrackingCartRequest) {
|
|
34
|
-
return api.cart
|
|
35
|
-
.upsertProduct(payload as UpsertCartRequest)
|
|
36
|
-
.then(data => {
|
|
37
|
-
upsertToCartAction(payload, data);
|
|
38
|
-
return data;
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export function deleteProduct(
|
|
43
|
-
payload: DeleteCartRequest,
|
|
44
|
-
oldCartResponse: CartResponse,
|
|
45
|
-
) {
|
|
46
|
-
return api.cart.deleteProduct(payload).then(data => {
|
|
47
|
-
removeFromCartAction(payload, data, oldCartResponse);
|
|
48
|
-
return data;
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export function selectShipment(payload: SelectShipimentRequest) {
|
|
53
|
-
return api.cart.selectShipment(payload).then(data => {
|
|
54
|
-
addShippingInfoAction(data);
|
|
55
|
-
return data;
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export function shipmentQuote(payload: ShipmentQuoteCartRequest) {
|
|
60
|
-
return api.cart.shipmentQuote(payload).then(data => {
|
|
61
|
-
shippingCalculationAction();
|
|
62
|
-
return data;
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export function buy(
|
|
67
|
-
payload: BuyCartRequest,
|
|
68
|
-
paymentMethod: string,
|
|
69
|
-
cartResponse: CartResponse,
|
|
70
|
-
) {
|
|
71
|
-
return api.cart.buy(payload).then(data => {
|
|
72
|
-
purchaseAction(paymentMethod, cartResponse);
|
|
73
|
-
return data;
|
|
74
|
-
});
|
|
75
|
-
}
|
|
1
|
+
import api from '../../Api';
|
|
2
|
+
|
|
3
|
+
import { addShippingInfoAction } from '../events/actions/addShippingInfo';
|
|
4
|
+
import { addToCartAction } from '../events/actions/addToCart';
|
|
5
|
+
import { purchaseAction } from '../events/actions/purchase';
|
|
6
|
+
import { removeFromCartAction } from '../events/actions/removeFromCart';
|
|
7
|
+
import { shippingCalculationAction } from '../events/actions/shippingCalculation';
|
|
8
|
+
import { upsertToCartAction } from '../events/actions/upsertToCart';
|
|
9
|
+
|
|
10
|
+
import type { UpsertTrackingCartRequest } from '../types';
|
|
11
|
+
import type {
|
|
12
|
+
BuyCartRequest,
|
|
13
|
+
CartResponse,
|
|
14
|
+
DeleteCartRequest,
|
|
15
|
+
SelectShipimentRequest,
|
|
16
|
+
ShipmentQuoteCartRequest,
|
|
17
|
+
UpsertCartRequest,
|
|
18
|
+
} from '../../Api/types';
|
|
19
|
+
|
|
20
|
+
export function listDetail() {
|
|
21
|
+
return api.cart.listDetail().then(data => {
|
|
22
|
+
return data;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function addProduct(payload: UpsertTrackingCartRequest) {
|
|
27
|
+
return api.cart.addProduct(payload as UpsertCartRequest).then(data => {
|
|
28
|
+
addToCartAction(payload, data);
|
|
29
|
+
return data;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function upsertProduct(payload: UpsertTrackingCartRequest) {
|
|
34
|
+
return api.cart
|
|
35
|
+
.upsertProduct(payload as UpsertCartRequest)
|
|
36
|
+
.then(data => {
|
|
37
|
+
upsertToCartAction(payload, data);
|
|
38
|
+
return data;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function deleteProduct(
|
|
43
|
+
payload: DeleteCartRequest,
|
|
44
|
+
oldCartResponse: CartResponse,
|
|
45
|
+
) {
|
|
46
|
+
return api.cart.deleteProduct(payload).then(data => {
|
|
47
|
+
removeFromCartAction(payload, data, oldCartResponse);
|
|
48
|
+
return data;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function selectShipment(payload: SelectShipimentRequest) {
|
|
53
|
+
return api.cart.selectShipment(payload).then(data => {
|
|
54
|
+
addShippingInfoAction(data);
|
|
55
|
+
return data;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function shipmentQuote(payload: ShipmentQuoteCartRequest) {
|
|
60
|
+
return api.cart.shipmentQuote(payload).then(data => {
|
|
61
|
+
shippingCalculationAction();
|
|
62
|
+
return data;
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function buy(
|
|
67
|
+
payload: BuyCartRequest,
|
|
68
|
+
paymentMethod: string,
|
|
69
|
+
cartResponse: CartResponse,
|
|
70
|
+
) {
|
|
71
|
+
return api.cart.buy(payload).then(data => {
|
|
72
|
+
purchaseAction(paymentMethod, cartResponse);
|
|
73
|
+
return data;
|
|
74
|
+
});
|
|
75
|
+
}
|
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
import publicApi from '../../Api';
|
|
2
|
-
|
|
3
|
-
import type { TrackingCustomerFields } from './types';
|
|
4
|
-
|
|
5
|
-
import { customerProfileAction } from '../events/actions/customerProfile';
|
|
6
|
-
import { generateLead } from '../events/actions/generateLead';
|
|
7
|
-
import { loginAction } from '../events/actions/login';
|
|
8
|
-
import { signupAction } from '../events/actions/signup';
|
|
9
|
-
|
|
10
|
-
import type { CustomerLead } from '../types';
|
|
11
|
-
import type {
|
|
12
|
-
ApiParams,
|
|
13
|
-
CustomerConditionFields,
|
|
14
|
-
CustomerFields,
|
|
15
|
-
CustomerSortFields,
|
|
16
|
-
SigninCustomerByDocument,
|
|
17
|
-
SigninCustomerByEmail,
|
|
18
|
-
SignupCustomer,
|
|
19
|
-
} from '../../Api/types';
|
|
20
|
-
|
|
21
|
-
export function detail(
|
|
22
|
-
options?: Pick<
|
|
23
|
-
ApiParams<
|
|
24
|
-
TrackingCustomerFields,
|
|
25
|
-
CustomerSortFields,
|
|
26
|
-
CustomerConditionFields
|
|
27
|
-
>,
|
|
28
|
-
'condition' | 'fields' | 'order'
|
|
29
|
-
>,
|
|
30
|
-
) {
|
|
31
|
-
|
|
32
|
-
let fields: Array<CustomerFields> = ['addresses', 'flags'];
|
|
33
|
-
|
|
34
|
-
if (options?.fields) fields = [...options.fields, ...fields];
|
|
35
|
-
|
|
36
|
-
return publicApi.customer
|
|
37
|
-
.detail({ ...options, fields })
|
|
38
|
-
.then(data => {
|
|
39
|
-
customerProfileAction(data);
|
|
40
|
-
|
|
41
|
-
return data;
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export function signup(payload: SignupCustomer) {
|
|
46
|
-
return publicApi.customer.signup(payload).then(data => {
|
|
47
|
-
signupAction();
|
|
48
|
-
return data;
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export function signinByEmail(payload: SigninCustomerByEmail) {
|
|
53
|
-
return publicApi.customer.signinByEmail(payload).then(data => {
|
|
54
|
-
loginAction();
|
|
55
|
-
return data;
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export function signinByDocument(payload: SigninCustomerByDocument) {
|
|
60
|
-
return publicApi.customer.signinByDocument(payload).then(data => {
|
|
61
|
-
loginAction();
|
|
62
|
-
return data;
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export function addNewsletter(payload: CustomerLead) {
|
|
67
|
-
return publicApi.customer.addNewsletter(payload).then(data => {
|
|
68
|
-
generateLead(payload);
|
|
69
|
-
return data;
|
|
70
|
-
});
|
|
71
|
-
}
|
|
1
|
+
import publicApi from '../../Api';
|
|
2
|
+
|
|
3
|
+
import type { TrackingCustomerFields } from './types';
|
|
4
|
+
|
|
5
|
+
import { customerProfileAction } from '../events/actions/customerProfile';
|
|
6
|
+
import { generateLead } from '../events/actions/generateLead';
|
|
7
|
+
import { loginAction } from '../events/actions/login';
|
|
8
|
+
import { signupAction } from '../events/actions/signup';
|
|
9
|
+
|
|
10
|
+
import type { CustomerLead } from '../types';
|
|
11
|
+
import type {
|
|
12
|
+
ApiParams,
|
|
13
|
+
CustomerConditionFields,
|
|
14
|
+
CustomerFields,
|
|
15
|
+
CustomerSortFields,
|
|
16
|
+
SigninCustomerByDocument,
|
|
17
|
+
SigninCustomerByEmail,
|
|
18
|
+
SignupCustomer,
|
|
19
|
+
} from '../../Api/types';
|
|
20
|
+
|
|
21
|
+
export function detail(
|
|
22
|
+
options?: Pick<
|
|
23
|
+
ApiParams<
|
|
24
|
+
TrackingCustomerFields,
|
|
25
|
+
CustomerSortFields,
|
|
26
|
+
CustomerConditionFields
|
|
27
|
+
>,
|
|
28
|
+
'condition' | 'fields' | 'order'
|
|
29
|
+
>,
|
|
30
|
+
) {
|
|
31
|
+
|
|
32
|
+
let fields: Array<CustomerFields> = ['addresses', 'flags'];
|
|
33
|
+
|
|
34
|
+
if (options?.fields) fields = [...options.fields, ...fields];
|
|
35
|
+
|
|
36
|
+
return publicApi.customer
|
|
37
|
+
.detail({ ...options, fields })
|
|
38
|
+
.then(data => {
|
|
39
|
+
customerProfileAction(data);
|
|
40
|
+
|
|
41
|
+
return data;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function signup(payload: SignupCustomer) {
|
|
46
|
+
return publicApi.customer.signup(payload).then(data => {
|
|
47
|
+
signupAction();
|
|
48
|
+
return data;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function signinByEmail(payload: SigninCustomerByEmail) {
|
|
53
|
+
return publicApi.customer.signinByEmail(payload).then(data => {
|
|
54
|
+
loginAction();
|
|
55
|
+
return data;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function signinByDocument(payload: SigninCustomerByDocument) {
|
|
60
|
+
return publicApi.customer.signinByDocument(payload).then(data => {
|
|
61
|
+
loginAction();
|
|
62
|
+
return data;
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function addNewsletter(payload: CustomerLead) {
|
|
67
|
+
return publicApi.customer.addNewsletter(payload).then(data => {
|
|
68
|
+
generateLead(payload);
|
|
69
|
+
return data;
|
|
70
|
+
});
|
|
71
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { CustomerFields, ProductFields } from '../../Api/types';
|
|
2
|
-
|
|
3
|
-
export type TrackingCustomerFields = Exclude<
|
|
4
|
-
CustomerFields,
|
|
5
|
-
'addresses' | 'documents'
|
|
6
|
-
>;
|
|
7
|
-
|
|
8
|
-
export type TrackingProductFields = Exclude<
|
|
9
|
-
ProductFields,
|
|
10
|
-
'price' | 'variation' | 'mainCategory' | 'brand'
|
|
11
|
-
>;
|
|
1
|
+
import type { CustomerFields, ProductFields } from '../../Api/types';
|
|
2
|
+
|
|
3
|
+
export type TrackingCustomerFields = Exclude<
|
|
4
|
+
CustomerFields,
|
|
5
|
+
'addresses' | 'documents'
|
|
6
|
+
>;
|
|
7
|
+
|
|
8
|
+
export type TrackingProductFields = Exclude<
|
|
9
|
+
ProductFields,
|
|
10
|
+
'price' | 'variation' | 'mainCategory' | 'brand'
|
|
11
|
+
>;
|
|
@@ -1,31 +1,31 @@
|
|
|
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 addPaymentInfoAction(
|
|
7
|
-
paymentMethod: string,
|
|
8
|
-
cartPayload: CartResponse,
|
|
9
|
-
) {
|
|
10
|
-
pushDatalayer({
|
|
11
|
-
event: 'add_payment_info',
|
|
12
|
-
ecommerce: {
|
|
13
|
-
currency: 'BRL',
|
|
14
|
-
value: totalValue(cartPayload),
|
|
15
|
-
coupon: cartPayload.discountMap.coupon?.discountMainCode || '',
|
|
16
|
-
payment_type: paymentMethod,
|
|
17
|
-
items: getAddedCartItems(cartPayload).map(item => {
|
|
18
|
-
return {
|
|
19
|
-
item_category: '',
|
|
20
|
-
coupon: cartPayload.discountMap.coupon?.discountMainCode || '',
|
|
21
|
-
item_brand: `${item.product.brandId}`,
|
|
22
|
-
item_id: item.product.productId,
|
|
23
|
-
item_name: item.product.name,
|
|
24
|
-
item_variant: getVariant(item),
|
|
25
|
-
price: item.unitValue,
|
|
26
|
-
quantity: item.quantity,
|
|
27
|
-
};
|
|
28
|
-
}),
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
}
|
|
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 addPaymentInfoAction(
|
|
7
|
+
paymentMethod: string,
|
|
8
|
+
cartPayload: CartResponse,
|
|
9
|
+
) {
|
|
10
|
+
pushDatalayer({
|
|
11
|
+
event: 'add_payment_info',
|
|
12
|
+
ecommerce: {
|
|
13
|
+
currency: 'BRL',
|
|
14
|
+
value: totalValue(cartPayload),
|
|
15
|
+
coupon: cartPayload.discountMap.coupon?.discountMainCode || '',
|
|
16
|
+
payment_type: paymentMethod,
|
|
17
|
+
items: getAddedCartItems(cartPayload).map(item => {
|
|
18
|
+
return {
|
|
19
|
+
item_category: '',
|
|
20
|
+
coupon: cartPayload.discountMap.coupon?.discountMainCode || '',
|
|
21
|
+
item_brand: `${item.product.brandId}`,
|
|
22
|
+
item_id: item.product.productId,
|
|
23
|
+
item_name: item.product.name,
|
|
24
|
+
item_variant: getVariant(item),
|
|
25
|
+
price: item.unitValue,
|
|
26
|
+
quantity: item.quantity,
|
|
27
|
+
};
|
|
28
|
+
}),
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
}
|
|
@@ -1,27 +1,27 @@
|
|
|
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 addShippingInfoAction(cartPayload: CartResponse) {
|
|
7
|
-
pushDatalayer({
|
|
8
|
-
event: 'add_shipping_info',
|
|
9
|
-
ecommerce: {
|
|
10
|
-
currency: 'BRL',
|
|
11
|
-
value: totalValue(cartPayload),
|
|
12
|
-
coupon: cartPayload.discountMap.coupon?.discountMainCode || '',
|
|
13
|
-
items: getAddedCartItems(cartPayload).map(item => {
|
|
14
|
-
return {
|
|
15
|
-
item_category: '',
|
|
16
|
-
coupon: cartPayload.discountMap.coupon?.discountMainCode || '',
|
|
17
|
-
item_brand: `${item.product.brandId}`,
|
|
18
|
-
item_id: item.product.productId,
|
|
19
|
-
item_name: item.product.name,
|
|
20
|
-
item_variant: getVariant(item),
|
|
21
|
-
price: item.unitValue,
|
|
22
|
-
quantity: item.quantity,
|
|
23
|
-
};
|
|
24
|
-
}),
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
}
|
|
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 addShippingInfoAction(cartPayload: CartResponse) {
|
|
7
|
+
pushDatalayer({
|
|
8
|
+
event: 'add_shipping_info',
|
|
9
|
+
ecommerce: {
|
|
10
|
+
currency: 'BRL',
|
|
11
|
+
value: totalValue(cartPayload),
|
|
12
|
+
coupon: cartPayload.discountMap.coupon?.discountMainCode || '',
|
|
13
|
+
items: getAddedCartItems(cartPayload).map(item => {
|
|
14
|
+
return {
|
|
15
|
+
item_category: '',
|
|
16
|
+
coupon: cartPayload.discountMap.coupon?.discountMainCode || '',
|
|
17
|
+
item_brand: `${item.product.brandId}`,
|
|
18
|
+
item_id: item.product.productId,
|
|
19
|
+
item_name: item.product.name,
|
|
20
|
+
item_variant: getVariant(item),
|
|
21
|
+
price: item.unitValue,
|
|
22
|
+
quantity: item.quantity,
|
|
23
|
+
};
|
|
24
|
+
}),
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
}
|
|
@@ -1,35 +1,35 @@
|
|
|
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 addToCartAction(
|
|
8
|
-
upsertPayload: UpsertTrackingCartRequest,
|
|
9
|
-
cartPayload: CartResponse,
|
|
10
|
-
) {
|
|
11
|
-
if (!getAddedCartItems(cartPayload, upsertPayload).length) return;
|
|
12
|
-
|
|
13
|
-
pushDatalayer({
|
|
14
|
-
event: 'add_to_cart',
|
|
15
|
-
ecommerce: {
|
|
16
|
-
currency: 'BRL',
|
|
17
|
-
value: totalValue(cartPayload, upsertPayload),
|
|
18
|
-
items: getAddedCartItems(cartPayload, upsertPayload).map(item => {
|
|
19
|
-
return {
|
|
20
|
-
item_category: '',
|
|
21
|
-
coupon: cartPayload.discountMap.coupon?.discountMainCode || '',
|
|
22
|
-
item_brand: `${item.product.brandId}`,
|
|
23
|
-
item_id: item.product.productId,
|
|
24
|
-
item_name: item.product.name,
|
|
25
|
-
item_variant: getVariant(item),
|
|
26
|
-
price: item.unitValue,
|
|
27
|
-
quantity:
|
|
28
|
-
item.quantity > item.oldQuantity!
|
|
29
|
-
? item.quantity - item.oldQuantity!
|
|
30
|
-
: item.oldQuantity! - item.quantity,
|
|
31
|
-
};
|
|
32
|
-
}),
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
}
|
|
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 addToCartAction(
|
|
8
|
+
upsertPayload: UpsertTrackingCartRequest,
|
|
9
|
+
cartPayload: CartResponse,
|
|
10
|
+
) {
|
|
11
|
+
if (!getAddedCartItems(cartPayload, upsertPayload).length) return;
|
|
12
|
+
|
|
13
|
+
pushDatalayer({
|
|
14
|
+
event: 'add_to_cart',
|
|
15
|
+
ecommerce: {
|
|
16
|
+
currency: 'BRL',
|
|
17
|
+
value: totalValue(cartPayload, upsertPayload),
|
|
18
|
+
items: getAddedCartItems(cartPayload, upsertPayload).map(item => {
|
|
19
|
+
return {
|
|
20
|
+
item_category: '',
|
|
21
|
+
coupon: cartPayload.discountMap.coupon?.discountMainCode || '',
|
|
22
|
+
item_brand: `${item.product.brandId}`,
|
|
23
|
+
item_id: item.product.productId,
|
|
24
|
+
item_name: item.product.name,
|
|
25
|
+
item_variant: getVariant(item),
|
|
26
|
+
price: item.unitValue,
|
|
27
|
+
quantity:
|
|
28
|
+
item.quantity > item.oldQuantity!
|
|
29
|
+
? item.quantity - item.oldQuantity!
|
|
30
|
+
: item.oldQuantity! - item.quantity,
|
|
31
|
+
};
|
|
32
|
+
}),
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
}
|
|
@@ -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 beginCheckoutAction(cartPayload: CartResponse) {
|
|
7
|
-
pushDatalayer({
|
|
8
|
-
event: 'begin_checkout',
|
|
9
|
-
ecommerce: {
|
|
10
|
-
currency: 'BRL',
|
|
11
|
-
value: totalValue(cartPayload),
|
|
12
|
-
shipping_tier: 'Ground',
|
|
13
|
-
coupon: cartPayload.discountMap.coupon?.discountMainCode || '',
|
|
14
|
-
items: getAddedCartItems(cartPayload).map(item => {
|
|
15
|
-
return {
|
|
16
|
-
item_category: '',
|
|
17
|
-
coupon: cartPayload.discountMap.coupon?.discountMainCode || '',
|
|
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 beginCheckoutAction(cartPayload: CartResponse) {
|
|
7
|
+
pushDatalayer({
|
|
8
|
+
event: 'begin_checkout',
|
|
9
|
+
ecommerce: {
|
|
10
|
+
currency: 'BRL',
|
|
11
|
+
value: totalValue(cartPayload),
|
|
12
|
+
shipping_tier: 'Ground',
|
|
13
|
+
coupon: cartPayload.discountMap.coupon?.discountMainCode || '',
|
|
14
|
+
items: getAddedCartItems(cartPayload).map(item => {
|
|
15
|
+
return {
|
|
16
|
+
item_category: '',
|
|
17
|
+
coupon: cartPayload.discountMap.coupon?.discountMainCode || '',
|
|
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,36 +1,36 @@
|
|
|
1
|
-
import { pushDatalayer } from '../../utils/pushDatalayer';
|
|
2
|
-
|
|
3
|
-
import type { CustomerResponse } from '../../../Api/types';
|
|
4
|
-
|
|
5
|
-
export function customerProfileAction(payload?: CustomerResponse) {
|
|
6
|
-
if (!payload) {
|
|
7
|
-
pushDatalayer({
|
|
8
|
-
event: 'customer_profile',
|
|
9
|
-
customer: {
|
|
10
|
-
id: 0,
|
|
11
|
-
birthdate: '',
|
|
12
|
-
email: '',
|
|
13
|
-
name: 'Visitante',
|
|
14
|
-
gender: 'undefined',
|
|
15
|
-
flags: null,
|
|
16
|
-
address: null,
|
|
17
|
-
loginStatus: false,
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
pushDatalayer({
|
|
24
|
-
event: 'customer_profile',
|
|
25
|
-
customer: {
|
|
26
|
-
id: payload.id,
|
|
27
|
-
birthdate: payload.birthdate,
|
|
28
|
-
email: payload.email,
|
|
29
|
-
name: payload.nameCorporateName,
|
|
30
|
-
gender: payload.gender,
|
|
31
|
-
flags: payload.flags,
|
|
32
|
-
address: payload.addresses,
|
|
33
|
-
loginStatus: true,
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
}
|
|
1
|
+
import { pushDatalayer } from '../../utils/pushDatalayer';
|
|
2
|
+
|
|
3
|
+
import type { CustomerResponse } from '../../../Api/types';
|
|
4
|
+
|
|
5
|
+
export function customerProfileAction(payload?: CustomerResponse) {
|
|
6
|
+
if (!payload) {
|
|
7
|
+
pushDatalayer({
|
|
8
|
+
event: 'customer_profile',
|
|
9
|
+
customer: {
|
|
10
|
+
id: 0,
|
|
11
|
+
birthdate: '',
|
|
12
|
+
email: '',
|
|
13
|
+
name: 'Visitante',
|
|
14
|
+
gender: 'undefined',
|
|
15
|
+
flags: null,
|
|
16
|
+
address: null,
|
|
17
|
+
loginStatus: false,
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
pushDatalayer({
|
|
24
|
+
event: 'customer_profile',
|
|
25
|
+
customer: {
|
|
26
|
+
id: payload.id,
|
|
27
|
+
birthdate: payload.birthdate,
|
|
28
|
+
email: payload.email,
|
|
29
|
+
name: payload.nameCorporateName,
|
|
30
|
+
gender: payload.gender,
|
|
31
|
+
flags: payload.flags,
|
|
32
|
+
address: payload.addresses,
|
|
33
|
+
loginStatus: true,
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { pushDatalayer } from '../../utils/pushDatalayer';
|
|
2
|
-
|
|
3
|
-
import type { CustomerLead } from '../../types';
|
|
4
|
-
|
|
5
|
-
export function generateLead(customer: CustomerLead) {
|
|
6
|
-
pushDatalayer({
|
|
7
|
-
event: 'generate_lead',
|
|
8
|
-
name: customer.name,
|
|
9
|
-
email: customer.email,
|
|
10
|
-
phone: customer.phone,
|
|
11
|
-
});
|
|
12
|
-
}
|
|
1
|
+
import { pushDatalayer } from '../../utils/pushDatalayer';
|
|
2
|
+
|
|
3
|
+
import type { CustomerLead } from '../../types';
|
|
4
|
+
|
|
5
|
+
export function generateLead(customer: CustomerLead) {
|
|
6
|
+
pushDatalayer({
|
|
7
|
+
event: 'generate_lead',
|
|
8
|
+
name: customer.name,
|
|
9
|
+
email: customer.email,
|
|
10
|
+
phone: customer.phone,
|
|
11
|
+
});
|
|
12
|
+
}
|