@tagadapay/plugin-sdk 4.0.2 → 4.0.4
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/dist/external-tracker.js +1 -1
- package/dist/external-tracker.min.js +1 -1
- package/dist/tagada-react-sdk-minimal.min.js +1 -1
- package/dist/tagada-react-sdk-minimal.min.js.map +1 -1
- package/dist/tagada-react-sdk.js +18 -15
- package/dist/tagada-react-sdk.min.js +2 -2
- package/dist/tagada-react-sdk.min.js.map +3 -3
- package/dist/tagada-sdk.js +17 -11
- package/dist/tagada-sdk.min.js +2 -2
- package/dist/tagada-sdk.min.js.map +3 -3
- package/dist/v2/core/resources/offers.d.ts +2 -2
- package/dist/v2/core/resources/offers.js +10 -4
- package/dist/v2/react/hooks/useOfferQuery.d.ts +11 -0
- package/dist/v2/react/hooks/useOfferQuery.js +11 -0
- package/dist/v2/react/hooks/usePreviewOffer.js +3 -7
- package/dist/v2/react/index.d.ts +1 -0
- package/dist/v2/react/index.js +1 -0
- package/package.json +1 -1
package/dist/tagada-sdk.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* TagadaPay SDK v4.0.
|
|
2
|
+
* TagadaPay SDK v4.0.4
|
|
3
3
|
* CDN Bundle - Full standalone SDK (Debug Build)
|
|
4
4
|
* Usage: window.tgd.createTagadaClient(), window.tgd.formatMoney(), etc.
|
|
5
5
|
* @license MIT
|
|
@@ -11060,6 +11060,7 @@ var TagadaSDKBundle = (() => {
|
|
|
11060
11060
|
|
|
11061
11061
|
// src/v2/core/resources/offers.ts
|
|
11062
11062
|
init_previewMode();
|
|
11063
|
+
init_funnelClient();
|
|
11063
11064
|
var OffersResource = class {
|
|
11064
11065
|
constructor(apiClient) {
|
|
11065
11066
|
this.apiClient = apiClient;
|
|
@@ -11124,13 +11125,14 @@ var TagadaSDKBundle = (() => {
|
|
|
11124
11125
|
* @param mainOrderId - Optional main order ID (for upsells)
|
|
11125
11126
|
*/
|
|
11126
11127
|
async payPreviewedOffer(offerId, currency = "", lineItems, returnUrl, mainOrderId, initiatedBy) {
|
|
11128
|
+
const effectiveInitiatedBy = initiatedBy != null ? initiatedBy : getAssignedPaymentInitiator();
|
|
11127
11129
|
console.log("\u{1F4B3} [OffersResource] Calling pay-preview API:", {
|
|
11128
11130
|
offerId,
|
|
11129
11131
|
currency,
|
|
11130
11132
|
lineItems,
|
|
11131
11133
|
returnUrl,
|
|
11132
11134
|
mainOrderId,
|
|
11133
|
-
initiatedBy,
|
|
11135
|
+
initiatedBy: effectiveInitiatedBy,
|
|
11134
11136
|
endpoint: "/api/v1/offers/".concat(offerId, "/pay-preview")
|
|
11135
11137
|
});
|
|
11136
11138
|
const response = await this.apiClient.post("/api/v1/offers/".concat(offerId, "/pay-preview"), __spreadValues({
|
|
@@ -11139,7 +11141,7 @@ var TagadaSDKBundle = (() => {
|
|
|
11139
11141
|
lineItems,
|
|
11140
11142
|
returnUrl: returnUrl || (typeof window !== "undefined" ? window.location.href : ""),
|
|
11141
11143
|
mainOrderId
|
|
11142
|
-
},
|
|
11144
|
+
}, effectiveInitiatedBy ? { initiatedBy: effectiveInitiatedBy } : {}));
|
|
11143
11145
|
console.log("\u{1F4E5} [OffersResource] Pay-preview API response:", response);
|
|
11144
11146
|
return response;
|
|
11145
11147
|
}
|
|
@@ -11204,31 +11206,35 @@ var TagadaSDKBundle = (() => {
|
|
|
11204
11206
|
/**
|
|
11205
11207
|
* Pay with checkout session
|
|
11206
11208
|
*/
|
|
11207
|
-
async payWithCheckoutSession(checkoutSessionId, orderId) {
|
|
11209
|
+
async payWithCheckoutSession(checkoutSessionId, orderId, initiatedBy) {
|
|
11208
11210
|
const draft = isDraftMode();
|
|
11209
|
-
|
|
11211
|
+
const effectiveInitiatedBy = initiatedBy != null ? initiatedBy : getAssignedPaymentInitiator();
|
|
11212
|
+
await this.apiClient.post("/api/v1/checkout-sessions/".concat(checkoutSessionId, "/pay"), __spreadProps(__spreadValues({
|
|
11210
11213
|
checkoutSessionId,
|
|
11211
11214
|
draft,
|
|
11212
11215
|
// 🎯 Use dynamic draft mode instead of hardcoded false
|
|
11213
|
-
returnUrl: typeof window !== "undefined" ? window.location.href : ""
|
|
11216
|
+
returnUrl: typeof window !== "undefined" ? window.location.href : ""
|
|
11217
|
+
}, effectiveInitiatedBy ? { initiatedBy: effectiveInitiatedBy } : {}), {
|
|
11214
11218
|
metadata: {
|
|
11215
11219
|
comingFromPostPurchase: true,
|
|
11216
11220
|
postOrder: orderId,
|
|
11217
11221
|
upsell: true,
|
|
11218
11222
|
source: "offer"
|
|
11219
11223
|
}
|
|
11220
|
-
});
|
|
11224
|
+
}));
|
|
11221
11225
|
}
|
|
11222
11226
|
/**
|
|
11223
11227
|
* Pay for an offer directly
|
|
11224
11228
|
*/
|
|
11225
|
-
async payOffer(offerId, orderId) {
|
|
11229
|
+
async payOffer(offerId, orderId, initiatedBy) {
|
|
11226
11230
|
const draft = isDraftMode();
|
|
11227
|
-
|
|
11231
|
+
const effectiveInitiatedBy = initiatedBy != null ? initiatedBy : getAssignedPaymentInitiator();
|
|
11232
|
+
return this.apiClient.post("/api/v1/offers/".concat(offerId, "/pay"), __spreadProps(__spreadValues({
|
|
11228
11233
|
offerId,
|
|
11229
11234
|
draft,
|
|
11230
11235
|
// 🎯 Use dynamic draft mode instead of hardcoded false
|
|
11231
|
-
returnUrl: typeof window !== "undefined" ? window.location.href : ""
|
|
11236
|
+
returnUrl: typeof window !== "undefined" ? window.location.href : ""
|
|
11237
|
+
}, effectiveInitiatedBy ? { initiatedBy: effectiveInitiatedBy } : {}), {
|
|
11232
11238
|
metadata: orderId ? {
|
|
11233
11239
|
comingFromPostPurchase: true,
|
|
11234
11240
|
postOrder: orderId,
|
|
@@ -11238,7 +11244,7 @@ var TagadaSDKBundle = (() => {
|
|
|
11238
11244
|
upsell: true,
|
|
11239
11245
|
source: "offer"
|
|
11240
11246
|
}
|
|
11241
|
-
});
|
|
11247
|
+
}));
|
|
11242
11248
|
}
|
|
11243
11249
|
/**
|
|
11244
11250
|
* Transform offer to checkout session with dynamic variant selection
|