@dotbots-boutique/auth-sdk 1.0.11 → 1.0.12
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/cjs/index.js
CHANGED
|
@@ -196,10 +196,10 @@ class PostMessageHandler {
|
|
|
196
196
|
/**
|
|
197
197
|
* Notify the parent of a successful charge (for real-time payment indicator).
|
|
198
198
|
*/
|
|
199
|
-
sendCharge(appId, featureCode,
|
|
199
|
+
sendCharge(appId, featureCode, quantity, transactionId) {
|
|
200
200
|
if (this.isInIframe()) {
|
|
201
|
-
console.warn(`[DotBotsAuth] Sending DOTBOTS_CHARGE postMessage — featureCode: ${featureCode},
|
|
202
|
-
window.parent.postMessage({ type: 'DOTBOTS_CHARGE', appId, featureCode,
|
|
201
|
+
console.warn(`[DotBotsAuth] Sending DOTBOTS_CHARGE postMessage — featureCode: ${featureCode}, quantity: ${quantity}, transactionId: ${transactionId}`);
|
|
202
|
+
window.parent.postMessage({ type: 'DOTBOTS_CHARGE', appId, featureCode, quantity, transactionId }, this.marketplaceOrigin);
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
}
|
|
@@ -353,8 +353,9 @@ class DotBotsAuth {
|
|
|
353
353
|
throw new DotBotsAuthError('NETWORK_ERROR', 'Payment request failed');
|
|
354
354
|
}
|
|
355
355
|
const result = await response.json();
|
|
356
|
-
|
|
357
|
-
|
|
356
|
+
const qty = quantity ?? 1;
|
|
357
|
+
console.warn(`[DotBotsAuth] charge() success — transactionId: ${result.transactionId}, quantity: ${qty}`);
|
|
358
|
+
this.postMessageHandler.sendCharge(this.config.appId, featureCode, qty, result.transactionId);
|
|
358
359
|
this.emit('charged');
|
|
359
360
|
return result;
|
|
360
361
|
}
|
|
@@ -448,7 +449,7 @@ class DotBotsAuth {
|
|
|
448
449
|
}
|
|
449
450
|
}
|
|
450
451
|
}
|
|
451
|
-
DotBotsAuth.SDK_VERSION = '1.0.
|
|
452
|
+
DotBotsAuth.SDK_VERSION = '1.0.12';
|
|
452
453
|
|
|
453
454
|
exports.DotBotsAuth = DotBotsAuth;
|
|
454
455
|
exports.DotBotsAuthError = DotBotsAuthError;
|
package/dist/esm/index.js
CHANGED
|
@@ -194,10 +194,10 @@ class PostMessageHandler {
|
|
|
194
194
|
/**
|
|
195
195
|
* Notify the parent of a successful charge (for real-time payment indicator).
|
|
196
196
|
*/
|
|
197
|
-
sendCharge(appId, featureCode,
|
|
197
|
+
sendCharge(appId, featureCode, quantity, transactionId) {
|
|
198
198
|
if (this.isInIframe()) {
|
|
199
|
-
console.warn(`[DotBotsAuth] Sending DOTBOTS_CHARGE postMessage — featureCode: ${featureCode},
|
|
200
|
-
window.parent.postMessage({ type: 'DOTBOTS_CHARGE', appId, featureCode,
|
|
199
|
+
console.warn(`[DotBotsAuth] Sending DOTBOTS_CHARGE postMessage — featureCode: ${featureCode}, quantity: ${quantity}, transactionId: ${transactionId}`);
|
|
200
|
+
window.parent.postMessage({ type: 'DOTBOTS_CHARGE', appId, featureCode, quantity, transactionId }, this.marketplaceOrigin);
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
}
|
|
@@ -351,8 +351,9 @@ class DotBotsAuth {
|
|
|
351
351
|
throw new DotBotsAuthError('NETWORK_ERROR', 'Payment request failed');
|
|
352
352
|
}
|
|
353
353
|
const result = await response.json();
|
|
354
|
-
|
|
355
|
-
|
|
354
|
+
const qty = quantity ?? 1;
|
|
355
|
+
console.warn(`[DotBotsAuth] charge() success — transactionId: ${result.transactionId}, quantity: ${qty}`);
|
|
356
|
+
this.postMessageHandler.sendCharge(this.config.appId, featureCode, qty, result.transactionId);
|
|
356
357
|
this.emit('charged');
|
|
357
358
|
return result;
|
|
358
359
|
}
|
|
@@ -446,6 +447,6 @@ class DotBotsAuth {
|
|
|
446
447
|
}
|
|
447
448
|
}
|
|
448
449
|
}
|
|
449
|
-
DotBotsAuth.SDK_VERSION = '1.0.
|
|
450
|
+
DotBotsAuth.SDK_VERSION = '1.0.12';
|
|
450
451
|
|
|
451
452
|
export { DotBotsAuth, DotBotsAuthError };
|
|
@@ -8,7 +8,7 @@ export declare class DotBotsAuth {
|
|
|
8
8
|
private readonly listeners;
|
|
9
9
|
private cachedUser;
|
|
10
10
|
private initialized;
|
|
11
|
-
static readonly SDK_VERSION = "1.0.
|
|
11
|
+
static readonly SDK_VERSION = "1.0.12";
|
|
12
12
|
constructor(config: DotBotsConfig);
|
|
13
13
|
initialize(): Promise<void>;
|
|
14
14
|
getUser(): Promise<DotBotsUser>;
|
|
@@ -18,5 +18,5 @@ export declare class PostMessageHandler {
|
|
|
18
18
|
/**
|
|
19
19
|
* Notify the parent of a successful charge (for real-time payment indicator).
|
|
20
20
|
*/
|
|
21
|
-
sendCharge(appId: string, featureCode: string,
|
|
21
|
+
sendCharge(appId: string, featureCode: string, quantity: number, transactionId: string): void;
|
|
22
22
|
}
|
package/dist/types/index.js
CHANGED
|
@@ -194,10 +194,10 @@ class PostMessageHandler {
|
|
|
194
194
|
/**
|
|
195
195
|
* Notify the parent of a successful charge (for real-time payment indicator).
|
|
196
196
|
*/
|
|
197
|
-
sendCharge(appId, featureCode,
|
|
197
|
+
sendCharge(appId, featureCode, quantity, transactionId) {
|
|
198
198
|
if (this.isInIframe()) {
|
|
199
|
-
console.warn(`[DotBotsAuth] Sending DOTBOTS_CHARGE postMessage — featureCode: ${featureCode},
|
|
200
|
-
window.parent.postMessage({ type: 'DOTBOTS_CHARGE', appId, featureCode,
|
|
199
|
+
console.warn(`[DotBotsAuth] Sending DOTBOTS_CHARGE postMessage — featureCode: ${featureCode}, quantity: ${quantity}, transactionId: ${transactionId}`);
|
|
200
|
+
window.parent.postMessage({ type: 'DOTBOTS_CHARGE', appId, featureCode, quantity, transactionId }, this.marketplaceOrigin);
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
}
|
|
@@ -351,8 +351,9 @@ class DotBotsAuth {
|
|
|
351
351
|
throw new DotBotsAuthError('NETWORK_ERROR', 'Payment request failed');
|
|
352
352
|
}
|
|
353
353
|
const result = await response.json();
|
|
354
|
-
|
|
355
|
-
|
|
354
|
+
const qty = quantity ?? 1;
|
|
355
|
+
console.warn(`[DotBotsAuth] charge() success — transactionId: ${result.transactionId}, quantity: ${qty}`);
|
|
356
|
+
this.postMessageHandler.sendCharge(this.config.appId, featureCode, qty, result.transactionId);
|
|
356
357
|
this.emit('charged');
|
|
357
358
|
return result;
|
|
358
359
|
}
|
|
@@ -446,6 +447,6 @@ class DotBotsAuth {
|
|
|
446
447
|
}
|
|
447
448
|
}
|
|
448
449
|
}
|
|
449
|
-
DotBotsAuth.SDK_VERSION = '1.0.
|
|
450
|
+
DotBotsAuth.SDK_VERSION = '1.0.12';
|
|
450
451
|
|
|
451
452
|
export { DotBotsAuth, DotBotsAuthError };
|