@usions/sdk 2.24.0 → 2.24.1
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/package.json +1 -1
- package/src/browser.js +13 -2
- package/src/modules/core.js +12 -1
package/package.json
CHANGED
package/src/browser.js
CHANGED
|
@@ -191,7 +191,7 @@ var Usion = (function () {
|
|
|
191
191
|
* Core Usion object with init, _post, _request
|
|
192
192
|
*/
|
|
193
193
|
const core = {
|
|
194
|
-
version: '2.24.
|
|
194
|
+
version: '2.24.1', // injected from package.json at build
|
|
195
195
|
config: {},
|
|
196
196
|
_initialized: false,
|
|
197
197
|
_initCallback: null,
|
|
@@ -271,8 +271,19 @@ var Usion = (function () {
|
|
|
271
271
|
|
|
272
272
|
// Handle INIT message
|
|
273
273
|
if (data.type === 'INIT' && data.config) {
|
|
274
|
-
//
|
|
274
|
+
// Re-INIT = credential/state refresh, not a re-boot. Hosts re-mint the
|
|
275
|
+
// scoped iframe token and re-INIT before it expires (and retry failed
|
|
276
|
+
// mints with backoff) — dropping these left long-lived iframes 401ing
|
|
277
|
+
// forever once their first token raced the mint or hit the 60-min TTL.
|
|
278
|
+
// Merge the refreshed fields; never re-fire the init callback.
|
|
275
279
|
if (self._initialized) {
|
|
280
|
+
if (data.config.authToken) {
|
|
281
|
+
self.config.authToken = data.config.authToken;
|
|
282
|
+
if (self.user) self.user._token = data.config.authToken;
|
|
283
|
+
}
|
|
284
|
+
if (data.config.balance !== undefined && self.wallet) {
|
|
285
|
+
self.wallet._balance = data.config.balance;
|
|
286
|
+
}
|
|
276
287
|
return;
|
|
277
288
|
}
|
|
278
289
|
|
package/src/modules/core.js
CHANGED
|
@@ -148,8 +148,19 @@ export const core = {
|
|
|
148
148
|
|
|
149
149
|
// Handle INIT message
|
|
150
150
|
if (data.type === 'INIT' && data.config) {
|
|
151
|
-
//
|
|
151
|
+
// Re-INIT = credential/state refresh, not a re-boot. Hosts re-mint the
|
|
152
|
+
// scoped iframe token and re-INIT before it expires (and retry failed
|
|
153
|
+
// mints with backoff) — dropping these left long-lived iframes 401ing
|
|
154
|
+
// forever once their first token raced the mint or hit the 60-min TTL.
|
|
155
|
+
// Merge the refreshed fields; never re-fire the init callback.
|
|
152
156
|
if (self._initialized) {
|
|
157
|
+
if (data.config.authToken) {
|
|
158
|
+
self.config.authToken = data.config.authToken;
|
|
159
|
+
if (self.user) self.user._token = data.config.authToken;
|
|
160
|
+
}
|
|
161
|
+
if (data.config.balance !== undefined && self.wallet) {
|
|
162
|
+
self.wallet._balance = data.config.balance;
|
|
163
|
+
}
|
|
153
164
|
return;
|
|
154
165
|
}
|
|
155
166
|
|