@dotbots-boutique/auth-sdk 1.0.12 → 1.0.13
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, amount, 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}, amount: ${amount}, transactionId: ${transactionId}`);
|
|
202
|
+
window.parent.postMessage({ type: 'DOTBOTS_CHARGE', appId, featureCode, amount, transactionId }, this.marketplaceOrigin);
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
}
|
|
@@ -352,12 +352,11 @@ class DotBotsAuth {
|
|
|
352
352
|
console.error(`[DotBotsAuth] charge() failed — HTTP ${response.status}`);
|
|
353
353
|
throw new DotBotsAuthError('NETWORK_ERROR', 'Payment request failed');
|
|
354
354
|
}
|
|
355
|
-
const
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
this.postMessageHandler.sendCharge(this.config.appId, featureCode, qty, result.transactionId);
|
|
355
|
+
const data = await response.json();
|
|
356
|
+
console.warn(`[DotBotsAuth] charge() success — transactionId: ${data.transactionId}, amount: ${data.amount}`);
|
|
357
|
+
this.postMessageHandler.sendCharge(this.config.appId, featureCode, data.amount, data.transactionId);
|
|
359
358
|
this.emit('charged');
|
|
360
|
-
return
|
|
359
|
+
return data;
|
|
361
360
|
}
|
|
362
361
|
async logout() {
|
|
363
362
|
this.assertInitialized();
|
|
@@ -449,7 +448,7 @@ class DotBotsAuth {
|
|
|
449
448
|
}
|
|
450
449
|
}
|
|
451
450
|
}
|
|
452
|
-
DotBotsAuth.SDK_VERSION = '1.0.
|
|
451
|
+
DotBotsAuth.SDK_VERSION = '1.0.13';
|
|
453
452
|
|
|
454
453
|
exports.DotBotsAuth = DotBotsAuth;
|
|
455
454
|
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, amount, 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}, amount: ${amount}, transactionId: ${transactionId}`);
|
|
200
|
+
window.parent.postMessage({ type: 'DOTBOTS_CHARGE', appId, featureCode, amount, transactionId }, this.marketplaceOrigin);
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
}
|
|
@@ -350,12 +350,11 @@ class DotBotsAuth {
|
|
|
350
350
|
console.error(`[DotBotsAuth] charge() failed — HTTP ${response.status}`);
|
|
351
351
|
throw new DotBotsAuthError('NETWORK_ERROR', 'Payment request failed');
|
|
352
352
|
}
|
|
353
|
-
const
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
this.postMessageHandler.sendCharge(this.config.appId, featureCode, qty, result.transactionId);
|
|
353
|
+
const data = await response.json();
|
|
354
|
+
console.warn(`[DotBotsAuth] charge() success — transactionId: ${data.transactionId}, amount: ${data.amount}`);
|
|
355
|
+
this.postMessageHandler.sendCharge(this.config.appId, featureCode, data.amount, data.transactionId);
|
|
357
356
|
this.emit('charged');
|
|
358
|
-
return
|
|
357
|
+
return data;
|
|
359
358
|
}
|
|
360
359
|
async logout() {
|
|
361
360
|
this.assertInitialized();
|
|
@@ -447,6 +446,6 @@ class DotBotsAuth {
|
|
|
447
446
|
}
|
|
448
447
|
}
|
|
449
448
|
}
|
|
450
|
-
DotBotsAuth.SDK_VERSION = '1.0.
|
|
449
|
+
DotBotsAuth.SDK_VERSION = '1.0.13';
|
|
451
450
|
|
|
452
451
|
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.13";
|
|
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, amount: 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, amount, 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}, amount: ${amount}, transactionId: ${transactionId}`);
|
|
200
|
+
window.parent.postMessage({ type: 'DOTBOTS_CHARGE', appId, featureCode, amount, transactionId }, this.marketplaceOrigin);
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
}
|
|
@@ -350,12 +350,11 @@ class DotBotsAuth {
|
|
|
350
350
|
console.error(`[DotBotsAuth] charge() failed — HTTP ${response.status}`);
|
|
351
351
|
throw new DotBotsAuthError('NETWORK_ERROR', 'Payment request failed');
|
|
352
352
|
}
|
|
353
|
-
const
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
this.postMessageHandler.sendCharge(this.config.appId, featureCode, qty, result.transactionId);
|
|
353
|
+
const data = await response.json();
|
|
354
|
+
console.warn(`[DotBotsAuth] charge() success — transactionId: ${data.transactionId}, amount: ${data.amount}`);
|
|
355
|
+
this.postMessageHandler.sendCharge(this.config.appId, featureCode, data.amount, data.transactionId);
|
|
357
356
|
this.emit('charged');
|
|
358
|
-
return
|
|
357
|
+
return data;
|
|
359
358
|
}
|
|
360
359
|
async logout() {
|
|
361
360
|
this.assertInitialized();
|
|
@@ -447,6 +446,6 @@ class DotBotsAuth {
|
|
|
447
446
|
}
|
|
448
447
|
}
|
|
449
448
|
}
|
|
450
|
-
DotBotsAuth.SDK_VERSION = '1.0.
|
|
449
|
+
DotBotsAuth.SDK_VERSION = '1.0.13';
|
|
451
450
|
|
|
452
451
|
export { DotBotsAuth, DotBotsAuthError };
|