@uappi/public-sdk 1.17.0 → 1.18.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/components/PaymentHosted/PaymentHosted.vue +2 -0
- package/modules/Api/endpoints/ThirdPartyComposable.ts +9 -0
- package/modules/Api/index.ts +2 -0
- package/modules/Api/types/endpoints/third-party/facebook.interfaces.ts +4 -0
- package/modules/Api/types/index.ts +2 -0
- package/modules/Tracking/endpoints/CartComposable.ts +1 -1
- package/modules/Tracking/facebook/events/actions/purchase.ts +5 -0
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@ import { ref, shallowRef, computed, onMounted, onUnmounted } from 'vue';
|
|
|
3
3
|
|
|
4
4
|
import api from '../../modules/Api';
|
|
5
5
|
import { purchaseAction } from '../../modules/Tracking/gtm/events/actions/purchase';
|
|
6
|
+
import { purchaseAction as facebookPurchaseAction } from '../../modules/Tracking/facebook/events/actions/purchase';
|
|
6
7
|
|
|
7
8
|
import type { Props, Emits, PaymentSuccessData, PaymentRedirectData } from './types';
|
|
8
9
|
import type { CartResponse } from '../../modules/Api/types';
|
|
@@ -135,6 +136,7 @@ function handleIframeMessage(event: MessageEvent): void {
|
|
|
135
136
|
} else {
|
|
136
137
|
console.error('[PaymentHosted] Carrinho indisponível: evento de tracking de compra (purchase) não foi disparado.');
|
|
137
138
|
}
|
|
139
|
+
facebookPurchaseAction(data.id);
|
|
138
140
|
emit('payment-success', data);
|
|
139
141
|
break;
|
|
140
142
|
|
|
@@ -7,6 +7,7 @@ import type {
|
|
|
7
7
|
FacebookAddToCartRequest,
|
|
8
8
|
FacebookAddPaymentInfoRequest,
|
|
9
9
|
FacebookSearchRequest,
|
|
10
|
+
FacebookPurchaseRequest,
|
|
10
11
|
} from '../types';
|
|
11
12
|
|
|
12
13
|
export function oauthRedirect(type: OauthType, payload: RedirectRequest) {
|
|
@@ -55,6 +56,14 @@ export function facebookAddPaymentInfo(payload: FacebookAddPaymentInfoRequest) {
|
|
|
55
56
|
});
|
|
56
57
|
}
|
|
57
58
|
|
|
59
|
+
export function facebookPurchase(payload: FacebookPurchaseRequest) {
|
|
60
|
+
return usePublicApi<void, FacebookPurchaseRequest>({
|
|
61
|
+
endpoint: '/third-party/facebook/event/purchase',
|
|
62
|
+
method: 'POST',
|
|
63
|
+
payload,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
58
67
|
export function facebookSearch(payload: FacebookSearchRequest) {
|
|
59
68
|
return usePublicApi<void, FacebookSearchRequest>({
|
|
60
69
|
endpoint: '/third-party/facebook/event/search',
|
package/modules/Api/index.ts
CHANGED
|
@@ -95,6 +95,7 @@ import {
|
|
|
95
95
|
facebookInitiateCheckout,
|
|
96
96
|
facebookAddPaymentInfo,
|
|
97
97
|
facebookSearch,
|
|
98
|
+
facebookPurchase,
|
|
98
99
|
} from './endpoints/ThirdPartyComposable';
|
|
99
100
|
|
|
100
101
|
import { sendMfa, confirmMfa, loginMfa, deleteMFA, mfaSetup } from './endpoints/MFAComposable';
|
|
@@ -110,6 +111,7 @@ const thirdParty = {
|
|
|
110
111
|
facebookInitiateCheckout,
|
|
111
112
|
facebookAddPaymentInfo,
|
|
112
113
|
facebookSearch,
|
|
114
|
+
facebookPurchase,
|
|
113
115
|
}
|
|
114
116
|
|
|
115
117
|
const customization = {
|
|
@@ -12,6 +12,10 @@ export interface FacebookAddPaymentInfoRequest {
|
|
|
12
12
|
totalValue: number;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
export interface FacebookPurchaseRequest {
|
|
16
|
+
orderGroupId: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
15
19
|
export interface FacebookSearchRequest {
|
|
16
20
|
searchTerm: string;
|
|
17
21
|
contentIds?: Array<string>;
|
|
@@ -254,6 +254,7 @@ import type {
|
|
|
254
254
|
FacebookAddToCartRequest,
|
|
255
255
|
FacebookAddPaymentInfoRequest,
|
|
256
256
|
FacebookSearchRequest,
|
|
257
|
+
FacebookPurchaseRequest,
|
|
257
258
|
} from './endpoints/third-party/facebook.interfaces';
|
|
258
259
|
|
|
259
260
|
import type {
|
|
@@ -319,6 +320,7 @@ export type {
|
|
|
319
320
|
FacebookAddToCartRequest,
|
|
320
321
|
FacebookAddPaymentInfoRequest,
|
|
321
322
|
FacebookSearchRequest,
|
|
323
|
+
FacebookPurchaseRequest,
|
|
322
324
|
|
|
323
325
|
// banner
|
|
324
326
|
Banner,
|
|
@@ -32,7 +32,7 @@ export function addProduct(payload: UpsertTrackingCartRequest) {
|
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
export function upsertProduct(payload: UpsertTrackingCartRequest
|
|
35
|
+
export function upsertProduct(payload: UpsertTrackingCartRequest) {
|
|
36
36
|
return api.cart
|
|
37
37
|
.upsertProduct(payload as UpsertCartRequest)
|
|
38
38
|
.then(data => {
|