@paydock/client-sdk 1.111.0-beta → 1.111.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/bundles/index.cjs +35 -15
- package/bundles/index.cjs.d.ts +3 -3
- package/bundles/index.mjs +35 -15
- package/bundles/index.mjs.d.ts +3 -3
- package/bundles/types/api/api-base.d.ts +2 -2
- package/bundles/types/api/api-base.d.ts.map +1 -1
- package/bundles/types/api/api-checkout-internal.d.ts +1 -1
- package/bundles/types/api/api-checkout-internal.d.ts.map +1 -1
- package/bundles/types/checkout/checkout.d.ts.map +1 -1
- package/bundles/types/checkout/helpers/session-helper.d.ts +5 -0
- package/bundles/types/checkout/helpers/session-helper.d.ts.map +1 -0
- package/bundles/widget.umd.js +35 -15
- package/bundles/widget.umd.js.d.ts +3 -3
- package/bundles/widget.umd.js.min.d.ts +3 -3
- package/bundles/widget.umd.min.js +6 -6
- package/package.json +1 -1
package/bundles/index.cjs
CHANGED
|
@@ -930,7 +930,7 @@ SDK.headerKeys = Object.freeze({
|
|
|
930
930
|
version: 'x-sdk-version',
|
|
931
931
|
type: 'x-sdk-type'
|
|
932
932
|
});
|
|
933
|
-
SDK._version = 'v1.111.
|
|
933
|
+
SDK._version = 'v1.111.1';
|
|
934
934
|
|
|
935
935
|
/******************************************************************************
|
|
936
936
|
Copyright (c) Microsoft Corporation.
|
|
@@ -3997,8 +3997,8 @@ function createNewrelicConfig() {
|
|
|
3997
3997
|
var params = {
|
|
3998
3998
|
enabled: 'true',
|
|
3999
3999
|
accountId: '974691',
|
|
4000
|
-
agentId: '
|
|
4001
|
-
applicationId: '
|
|
4000
|
+
agentId: '1386157152',
|
|
4001
|
+
applicationId: '1386157152',
|
|
4002
4002
|
licenseKey: '4848a32285',
|
|
4003
4003
|
trustKey: '974691'
|
|
4004
4004
|
};
|
|
@@ -4187,6 +4187,21 @@ var EventRepository = /*#__PURE__*/function () {
|
|
|
4187
4187
|
}();
|
|
4188
4188
|
new EventRepository();
|
|
4189
4189
|
|
|
4190
|
+
var SessionHelper = /*#__PURE__*/function () {
|
|
4191
|
+
function SessionHelper() {
|
|
4192
|
+
_classCallCheck(this, SessionHelper);
|
|
4193
|
+
}
|
|
4194
|
+
return _createClass(SessionHelper, null, [{
|
|
4195
|
+
key: "sessionId",
|
|
4196
|
+
get: function get() {
|
|
4197
|
+
return window.sessionStorage.getItem('sessionId');
|
|
4198
|
+
},
|
|
4199
|
+
set: function set(value) {
|
|
4200
|
+
window.sessionStorage.setItem('sessionId', value);
|
|
4201
|
+
}
|
|
4202
|
+
}]);
|
|
4203
|
+
}();
|
|
4204
|
+
|
|
4190
4205
|
var API_AUTH_TYPE;
|
|
4191
4206
|
(function (API_AUTH_TYPE) {
|
|
4192
4207
|
API_AUTH_TYPE[API_AUTH_TYPE["PUBLIC_KEY"] = 0] = "PUBLIC_KEY";
|
|
@@ -4223,16 +4238,16 @@ var ApiBase = /*#__PURE__*/function () {
|
|
|
4223
4238
|
}
|
|
4224
4239
|
}, {
|
|
4225
4240
|
key: "longPollingObservable",
|
|
4226
|
-
value: function longPollingObservable(method, url, requestBody) {
|
|
4241
|
+
value: function longPollingObservable(method, url, requestBody, sessionId) {
|
|
4227
4242
|
var _this = this;
|
|
4228
|
-
var reconnectInterval = arguments.length >
|
|
4243
|
+
var reconnectInterval = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1000;
|
|
4229
4244
|
return new Observable(function (subscriber) {
|
|
4230
|
-
_this.longPull(subscriber, method, _this.env.getConf().url + url, _this.auth, requestBody, reconnectInterval);
|
|
4245
|
+
_this.longPull(subscriber, method, _this.env.getConf().url + url, _this.auth, requestBody, sessionId, reconnectInterval);
|
|
4231
4246
|
});
|
|
4232
4247
|
}
|
|
4233
4248
|
}, {
|
|
4234
4249
|
key: "longPull",
|
|
4235
|
-
value: function longPull(subscriber, method, link, auth, requestBody, reconnectInterval) {
|
|
4250
|
+
value: function longPull(subscriber, method, link, auth, requestBody, sessionId, reconnectInterval) {
|
|
4236
4251
|
var _this2 = this;
|
|
4237
4252
|
if (this.stoppedPooling) return;
|
|
4238
4253
|
var request = new XMLHttpRequest();
|
|
@@ -4244,11 +4259,15 @@ var ApiBase = /*#__PURE__*/function () {
|
|
|
4244
4259
|
if (request.readyState === 4) {
|
|
4245
4260
|
if (request.status === 200 || request.status === 201) {
|
|
4246
4261
|
var data = JSON.parse(request.responseText);
|
|
4262
|
+
if (SessionHelper.sessionId !== data.resource.data.intent_id) {
|
|
4263
|
+
_this2.stoppedPooling = false;
|
|
4264
|
+
return;
|
|
4265
|
+
}
|
|
4247
4266
|
subscriber.next(data.resource.data);
|
|
4248
|
-
_this2.longPull(subscriber, method, link, auth, requestBody, reconnectInterval);
|
|
4267
|
+
_this2.longPull(subscriber, method, link, auth, requestBody, sessionId, reconnectInterval);
|
|
4249
4268
|
} else {
|
|
4250
|
-
setTimeout(function () {
|
|
4251
|
-
_this2.longPull(subscriber, method, link, auth, requestBody, reconnectInterval);
|
|
4269
|
+
if (SessionHelper.sessionId === sessionId) setTimeout(function () {
|
|
4270
|
+
_this2.longPull(subscriber, method, link, auth, requestBody, sessionId, reconnectInterval);
|
|
4252
4271
|
}, reconnectInterval);
|
|
4253
4272
|
}
|
|
4254
4273
|
}
|
|
@@ -5130,8 +5149,8 @@ var ApiCheckoutInternal = /*#__PURE__*/function () {
|
|
|
5130
5149
|
}
|
|
5131
5150
|
return _createClass(ApiCheckoutInternal, [{
|
|
5132
5151
|
key: "instructions",
|
|
5133
|
-
value: function instructions() {
|
|
5134
|
-
return this.api.longPollingObservable('GET', INSTRUCTION_LINK, {}, 1000);
|
|
5152
|
+
value: function instructions(session_id) {
|
|
5153
|
+
return this.api.longPollingObservable('GET', INSTRUCTION_LINK, {}, session_id, 1000);
|
|
5135
5154
|
}
|
|
5136
5155
|
}, {
|
|
5137
5156
|
key: "callback",
|
|
@@ -15371,7 +15390,8 @@ var Checkout = /*#__PURE__*/function () {
|
|
|
15371
15390
|
this.setEnv(this.intentTokenPayload.env, this.intentTokenPayload.env_alias);
|
|
15372
15391
|
this.instructions = this.initContractVersion(this.intentTokenPayload.version);
|
|
15373
15392
|
if (this.debug) return;
|
|
15374
|
-
this.listenInstructions(intentToken);
|
|
15393
|
+
this.listenInstructions(intentToken, this.intentTokenPayload.intent_id);
|
|
15394
|
+
SessionHelper.sessionId = this.intentTokenPayload.intent_id;
|
|
15375
15395
|
this.ready();
|
|
15376
15396
|
} catch (e) {
|
|
15377
15397
|
console.error(e.message);
|
|
@@ -15409,10 +15429,10 @@ var Checkout = /*#__PURE__*/function () {
|
|
|
15409
15429
|
}
|
|
15410
15430
|
}, {
|
|
15411
15431
|
key: "listenInstructions",
|
|
15412
|
-
value: function listenInstructions(token) {
|
|
15432
|
+
value: function listenInstructions(token, session_id) {
|
|
15413
15433
|
var _this = this;
|
|
15414
15434
|
this.createWidgetStructure();
|
|
15415
|
-
this.api.checkout().instructions().subscribe({
|
|
15435
|
+
this.api.checkout().instructions(session_id).subscribe({
|
|
15416
15436
|
next: function next(response) {
|
|
15417
15437
|
var _a;
|
|
15418
15438
|
if (!(response === null || response === void 0 ? void 0 : response.event)) throw new Error('Instruction structure inconsistent');
|
package/bundles/index.cjs.d.ts
CHANGED
|
@@ -128,8 +128,8 @@ declare class ApiBase {
|
|
|
128
128
|
* @param {string} [alias] - Own domain alias
|
|
129
129
|
*/
|
|
130
130
|
setEnv(env: string, alias?: string): ApiBase;
|
|
131
|
-
longPollingObservable<Req extends object, Res>(method: 'GET' | 'POST', url: string, requestBody: Req, reconnectInterval?: number): Observable<Res>;
|
|
132
|
-
longPull(subscriber: Subscriber<any>, method: any, link: any, auth: any, requestBody: any, reconnectInterval: any): void;
|
|
131
|
+
longPollingObservable<Req extends object, Res>(method: 'GET' | 'POST', url: string, requestBody: Req, sessionId: string, reconnectInterval?: number): Observable<Res>;
|
|
132
|
+
longPull(subscriber: Subscriber<any>, method: any, link: any, auth: any, requestBody: any, sessionId: any, reconnectInterval: any): void;
|
|
133
133
|
destroyLongPolling(): void;
|
|
134
134
|
setAuthType(): API_AUTH_TYPE;
|
|
135
135
|
getClient(method: Extract<HttpRequestMethod, 'GET' | 'POST'>, link: string): {
|
|
@@ -1913,7 +1913,7 @@ interface GetConfigResponse {
|
|
|
1913
1913
|
declare class ApiCheckoutInternal {
|
|
1914
1914
|
protected api: ApiInternal;
|
|
1915
1915
|
constructor(api: ApiInternal);
|
|
1916
|
-
instructions(): Observable<object>;
|
|
1916
|
+
instructions(session_id: string): Observable<object>;
|
|
1917
1917
|
callback(payload: Object): Promise<Object>;
|
|
1918
1918
|
}
|
|
1919
1919
|
|
package/bundles/index.mjs
CHANGED
|
@@ -928,7 +928,7 @@ SDK.headerKeys = Object.freeze({
|
|
|
928
928
|
version: 'x-sdk-version',
|
|
929
929
|
type: 'x-sdk-type'
|
|
930
930
|
});
|
|
931
|
-
SDK._version = 'v1.111.
|
|
931
|
+
SDK._version = 'v1.111.1';
|
|
932
932
|
|
|
933
933
|
/******************************************************************************
|
|
934
934
|
Copyright (c) Microsoft Corporation.
|
|
@@ -3995,8 +3995,8 @@ function createNewrelicConfig() {
|
|
|
3995
3995
|
var params = {
|
|
3996
3996
|
enabled: 'true',
|
|
3997
3997
|
accountId: '974691',
|
|
3998
|
-
agentId: '
|
|
3999
|
-
applicationId: '
|
|
3998
|
+
agentId: '1386157152',
|
|
3999
|
+
applicationId: '1386157152',
|
|
4000
4000
|
licenseKey: '4848a32285',
|
|
4001
4001
|
trustKey: '974691'
|
|
4002
4002
|
};
|
|
@@ -4185,6 +4185,21 @@ var EventRepository = /*#__PURE__*/function () {
|
|
|
4185
4185
|
}();
|
|
4186
4186
|
new EventRepository();
|
|
4187
4187
|
|
|
4188
|
+
var SessionHelper = /*#__PURE__*/function () {
|
|
4189
|
+
function SessionHelper() {
|
|
4190
|
+
_classCallCheck(this, SessionHelper);
|
|
4191
|
+
}
|
|
4192
|
+
return _createClass(SessionHelper, null, [{
|
|
4193
|
+
key: "sessionId",
|
|
4194
|
+
get: function get() {
|
|
4195
|
+
return window.sessionStorage.getItem('sessionId');
|
|
4196
|
+
},
|
|
4197
|
+
set: function set(value) {
|
|
4198
|
+
window.sessionStorage.setItem('sessionId', value);
|
|
4199
|
+
}
|
|
4200
|
+
}]);
|
|
4201
|
+
}();
|
|
4202
|
+
|
|
4188
4203
|
var API_AUTH_TYPE;
|
|
4189
4204
|
(function (API_AUTH_TYPE) {
|
|
4190
4205
|
API_AUTH_TYPE[API_AUTH_TYPE["PUBLIC_KEY"] = 0] = "PUBLIC_KEY";
|
|
@@ -4221,16 +4236,16 @@ var ApiBase = /*#__PURE__*/function () {
|
|
|
4221
4236
|
}
|
|
4222
4237
|
}, {
|
|
4223
4238
|
key: "longPollingObservable",
|
|
4224
|
-
value: function longPollingObservable(method, url, requestBody) {
|
|
4239
|
+
value: function longPollingObservable(method, url, requestBody, sessionId) {
|
|
4225
4240
|
var _this = this;
|
|
4226
|
-
var reconnectInterval = arguments.length >
|
|
4241
|
+
var reconnectInterval = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1000;
|
|
4227
4242
|
return new Observable(function (subscriber) {
|
|
4228
|
-
_this.longPull(subscriber, method, _this.env.getConf().url + url, _this.auth, requestBody, reconnectInterval);
|
|
4243
|
+
_this.longPull(subscriber, method, _this.env.getConf().url + url, _this.auth, requestBody, sessionId, reconnectInterval);
|
|
4229
4244
|
});
|
|
4230
4245
|
}
|
|
4231
4246
|
}, {
|
|
4232
4247
|
key: "longPull",
|
|
4233
|
-
value: function longPull(subscriber, method, link, auth, requestBody, reconnectInterval) {
|
|
4248
|
+
value: function longPull(subscriber, method, link, auth, requestBody, sessionId, reconnectInterval) {
|
|
4234
4249
|
var _this2 = this;
|
|
4235
4250
|
if (this.stoppedPooling) return;
|
|
4236
4251
|
var request = new XMLHttpRequest();
|
|
@@ -4242,11 +4257,15 @@ var ApiBase = /*#__PURE__*/function () {
|
|
|
4242
4257
|
if (request.readyState === 4) {
|
|
4243
4258
|
if (request.status === 200 || request.status === 201) {
|
|
4244
4259
|
var data = JSON.parse(request.responseText);
|
|
4260
|
+
if (SessionHelper.sessionId !== data.resource.data.intent_id) {
|
|
4261
|
+
_this2.stoppedPooling = false;
|
|
4262
|
+
return;
|
|
4263
|
+
}
|
|
4245
4264
|
subscriber.next(data.resource.data);
|
|
4246
|
-
_this2.longPull(subscriber, method, link, auth, requestBody, reconnectInterval);
|
|
4265
|
+
_this2.longPull(subscriber, method, link, auth, requestBody, sessionId, reconnectInterval);
|
|
4247
4266
|
} else {
|
|
4248
|
-
setTimeout(function () {
|
|
4249
|
-
_this2.longPull(subscriber, method, link, auth, requestBody, reconnectInterval);
|
|
4267
|
+
if (SessionHelper.sessionId === sessionId) setTimeout(function () {
|
|
4268
|
+
_this2.longPull(subscriber, method, link, auth, requestBody, sessionId, reconnectInterval);
|
|
4250
4269
|
}, reconnectInterval);
|
|
4251
4270
|
}
|
|
4252
4271
|
}
|
|
@@ -5128,8 +5147,8 @@ var ApiCheckoutInternal = /*#__PURE__*/function () {
|
|
|
5128
5147
|
}
|
|
5129
5148
|
return _createClass(ApiCheckoutInternal, [{
|
|
5130
5149
|
key: "instructions",
|
|
5131
|
-
value: function instructions() {
|
|
5132
|
-
return this.api.longPollingObservable('GET', INSTRUCTION_LINK, {}, 1000);
|
|
5150
|
+
value: function instructions(session_id) {
|
|
5151
|
+
return this.api.longPollingObservable('GET', INSTRUCTION_LINK, {}, session_id, 1000);
|
|
5133
5152
|
}
|
|
5134
5153
|
}, {
|
|
5135
5154
|
key: "callback",
|
|
@@ -15369,7 +15388,8 @@ var Checkout = /*#__PURE__*/function () {
|
|
|
15369
15388
|
this.setEnv(this.intentTokenPayload.env, this.intentTokenPayload.env_alias);
|
|
15370
15389
|
this.instructions = this.initContractVersion(this.intentTokenPayload.version);
|
|
15371
15390
|
if (this.debug) return;
|
|
15372
|
-
this.listenInstructions(intentToken);
|
|
15391
|
+
this.listenInstructions(intentToken, this.intentTokenPayload.intent_id);
|
|
15392
|
+
SessionHelper.sessionId = this.intentTokenPayload.intent_id;
|
|
15373
15393
|
this.ready();
|
|
15374
15394
|
} catch (e) {
|
|
15375
15395
|
console.error(e.message);
|
|
@@ -15407,10 +15427,10 @@ var Checkout = /*#__PURE__*/function () {
|
|
|
15407
15427
|
}
|
|
15408
15428
|
}, {
|
|
15409
15429
|
key: "listenInstructions",
|
|
15410
|
-
value: function listenInstructions(token) {
|
|
15430
|
+
value: function listenInstructions(token, session_id) {
|
|
15411
15431
|
var _this = this;
|
|
15412
15432
|
this.createWidgetStructure();
|
|
15413
|
-
this.api.checkout().instructions().subscribe({
|
|
15433
|
+
this.api.checkout().instructions(session_id).subscribe({
|
|
15414
15434
|
next: function next(response) {
|
|
15415
15435
|
var _a;
|
|
15416
15436
|
if (!(response === null || response === void 0 ? void 0 : response.event)) throw new Error('Instruction structure inconsistent');
|
package/bundles/index.mjs.d.ts
CHANGED
|
@@ -128,8 +128,8 @@ declare class ApiBase {
|
|
|
128
128
|
* @param {string} [alias] - Own domain alias
|
|
129
129
|
*/
|
|
130
130
|
setEnv(env: string, alias?: string): ApiBase;
|
|
131
|
-
longPollingObservable<Req extends object, Res>(method: 'GET' | 'POST', url: string, requestBody: Req, reconnectInterval?: number): Observable<Res>;
|
|
132
|
-
longPull(subscriber: Subscriber<any>, method: any, link: any, auth: any, requestBody: any, reconnectInterval: any): void;
|
|
131
|
+
longPollingObservable<Req extends object, Res>(method: 'GET' | 'POST', url: string, requestBody: Req, sessionId: string, reconnectInterval?: number): Observable<Res>;
|
|
132
|
+
longPull(subscriber: Subscriber<any>, method: any, link: any, auth: any, requestBody: any, sessionId: any, reconnectInterval: any): void;
|
|
133
133
|
destroyLongPolling(): void;
|
|
134
134
|
setAuthType(): API_AUTH_TYPE;
|
|
135
135
|
getClient(method: Extract<HttpRequestMethod, 'GET' | 'POST'>, link: string): {
|
|
@@ -1913,7 +1913,7 @@ interface GetConfigResponse {
|
|
|
1913
1913
|
declare class ApiCheckoutInternal {
|
|
1914
1914
|
protected api: ApiInternal;
|
|
1915
1915
|
constructor(api: ApiInternal);
|
|
1916
|
-
instructions(): Observable<object>;
|
|
1916
|
+
instructions(session_id: string): Observable<object>;
|
|
1917
1917
|
callback(payload: Object): Promise<Object>;
|
|
1918
1918
|
}
|
|
1919
1919
|
|
|
@@ -22,8 +22,8 @@ export declare class ApiBase {
|
|
|
22
22
|
* @param {string} [alias] - Own domain alias
|
|
23
23
|
*/
|
|
24
24
|
setEnv(env: string, alias?: string): ApiBase;
|
|
25
|
-
longPollingObservable<Req extends object, Res>(method: 'GET' | 'POST', url: string, requestBody: Req, reconnectInterval?: number): Observable<Res>;
|
|
26
|
-
longPull(subscriber: Subscriber<any>, method: any, link: any, auth: any, requestBody: any, reconnectInterval: any): void;
|
|
25
|
+
longPollingObservable<Req extends object, Res>(method: 'GET' | 'POST', url: string, requestBody: Req, sessionId: string, reconnectInterval?: number): Observable<Res>;
|
|
26
|
+
longPull(subscriber: Subscriber<any>, method: any, link: any, auth: any, requestBody: any, sessionId: any, reconnectInterval: any): void;
|
|
27
27
|
destroyLongPolling(): void;
|
|
28
28
|
setAuthType(): API_AUTH_TYPE;
|
|
29
29
|
getClient(method: Extract<HttpRequestMethod, 'GET' | 'POST'>, link: string): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-base.d.ts","sourceRoot":"","sources":["../../src/api/api-base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAE9C,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,aAAa,EAAmB,MAAM,iDAAiD,CAAC;
|
|
1
|
+
{"version":3,"file":"api-base.d.ts","sourceRoot":"","sources":["../../src/api/api-base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,GAAG,EA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,CAAC,iBAAiB,EAAE,KAAK,GAAG,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,GACjE;QACC,MAAM,EAAE,cAAc,CAAC;QACvB,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;KACrC;IA6BD,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,EAAE,KAAA,EAAE,OAAO,KAAA;IAkBtE,aAAa,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,GAAG,CAAC;IAkBpF,WAAW,EAAE,aAAa,CAExB;IAEF,WAAW,EAAE,aAAa,CAExB;IAEF,SAAS,CAAC,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,iBAAiB,EAAE,KAAK,GAAG,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM;IAmBxF,SAAS,KAAK,GAAG;;;;MAMhB;CACJ"}
|
|
@@ -3,7 +3,7 @@ import { Observable } from "rxjs";
|
|
|
3
3
|
export declare class ApiCheckoutInternal {
|
|
4
4
|
protected api: ApiInternal;
|
|
5
5
|
constructor(api: ApiInternal);
|
|
6
|
-
instructions(): Observable<object>;
|
|
6
|
+
instructions(session_id: string): Observable<object>;
|
|
7
7
|
callback(payload: Object): Promise<Object>;
|
|
8
8
|
}
|
|
9
9
|
export interface HandleResponseInterface {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-checkout-internal.d.ts","sourceRoot":"","sources":["../../src/api/api-checkout-internal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAC,UAAU,EAAC,MAAM,MAAM,CAAC;AAKhC,qBAA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EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE;QACL,SAAS,EAAE,MAAM,CAAC;QAClB,aAAa,EAAE,MAAM,CAAC;QACtB,mBAAmB,EAAE,OAAO,CAAC;QAC7B,YAAY,EAAE,OAAO,CAAC;QACtB,UAAU,EAAE,MAAM,CAAC;QACnB,YAAY,EAAE,MAAM,CAAC;QACrB,YAAY,EAAE,MAAM,CAAC;QACrB,SAAS,EAAE,MAAM,CAAC;QAClB,WAAW,EAAE,MAAM,CAAC;QACpB,aAAa,EAAE,MAAM,CAAC;QACtB,OAAO,EAAE,OAAO,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,CAAC,EAAE,MAAM,CAAC;KACxB,CAAC;CACL"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkout.d.ts","sourceRoot":"","sources":["../../src/checkout/checkout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAiB,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGjE,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC9F,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"checkout.d.ts","sourceRoot":"","sources":["../../src/checkout/checkout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO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AAO,CAAC,MAAM;IAId,OAAO,CAAC,qBAAqB;IAoB7B;;;;;;;;OAQG;IACI,mBAAmB,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI;IAI9D;;;;;;;;OAQG;IACI,gBAAgB,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI;IAI3D;;;;;;;;OAQG;IACI,gBAAgB,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI;IAI3D,OAAO,CAAC,SAAS;CAOpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-helper.d.ts","sourceRoot":"","sources":["../../../src/checkout/helpers/session-helper.ts"],"names":[],"mappings":"AAAA,qBAAa,aAAa;IACtB,MAAM,KAAK,SAAS,IAAI,MAAM,CAE7B;IAED,MAAM,KAAK,SAAS,CAAC,KAAK,EAAE,MAAM,EAEjC;CACJ"}
|
package/bundles/widget.umd.js
CHANGED
|
@@ -932,7 +932,7 @@
|
|
|
932
932
|
version: 'x-sdk-version',
|
|
933
933
|
type: 'x-sdk-type'
|
|
934
934
|
});
|
|
935
|
-
SDK._version = 'v1.111.
|
|
935
|
+
SDK._version = 'v1.111.1';
|
|
936
936
|
|
|
937
937
|
/******************************************************************************
|
|
938
938
|
Copyright (c) Microsoft Corporation.
|
|
@@ -3999,8 +3999,8 @@
|
|
|
3999
3999
|
var params = {
|
|
4000
4000
|
enabled: 'true',
|
|
4001
4001
|
accountId: '974691',
|
|
4002
|
-
agentId: '
|
|
4003
|
-
applicationId: '
|
|
4002
|
+
agentId: '1386157152',
|
|
4003
|
+
applicationId: '1386157152',
|
|
4004
4004
|
licenseKey: '4848a32285',
|
|
4005
4005
|
trustKey: '974691'
|
|
4006
4006
|
};
|
|
@@ -4189,6 +4189,21 @@
|
|
|
4189
4189
|
}();
|
|
4190
4190
|
new EventRepository();
|
|
4191
4191
|
|
|
4192
|
+
var SessionHelper = /*#__PURE__*/function () {
|
|
4193
|
+
function SessionHelper() {
|
|
4194
|
+
_classCallCheck(this, SessionHelper);
|
|
4195
|
+
}
|
|
4196
|
+
return _createClass(SessionHelper, null, [{
|
|
4197
|
+
key: "sessionId",
|
|
4198
|
+
get: function get() {
|
|
4199
|
+
return window.sessionStorage.getItem('sessionId');
|
|
4200
|
+
},
|
|
4201
|
+
set: function set(value) {
|
|
4202
|
+
window.sessionStorage.setItem('sessionId', value);
|
|
4203
|
+
}
|
|
4204
|
+
}]);
|
|
4205
|
+
}();
|
|
4206
|
+
|
|
4192
4207
|
var API_AUTH_TYPE;
|
|
4193
4208
|
(function (API_AUTH_TYPE) {
|
|
4194
4209
|
API_AUTH_TYPE[API_AUTH_TYPE["PUBLIC_KEY"] = 0] = "PUBLIC_KEY";
|
|
@@ -4225,16 +4240,16 @@
|
|
|
4225
4240
|
}
|
|
4226
4241
|
}, {
|
|
4227
4242
|
key: "longPollingObservable",
|
|
4228
|
-
value: function longPollingObservable(method, url, requestBody) {
|
|
4243
|
+
value: function longPollingObservable(method, url, requestBody, sessionId) {
|
|
4229
4244
|
var _this = this;
|
|
4230
|
-
var reconnectInterval = arguments.length >
|
|
4245
|
+
var reconnectInterval = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1000;
|
|
4231
4246
|
return new Observable(function (subscriber) {
|
|
4232
|
-
_this.longPull(subscriber, method, _this.env.getConf().url + url, _this.auth, requestBody, reconnectInterval);
|
|
4247
|
+
_this.longPull(subscriber, method, _this.env.getConf().url + url, _this.auth, requestBody, sessionId, reconnectInterval);
|
|
4233
4248
|
});
|
|
4234
4249
|
}
|
|
4235
4250
|
}, {
|
|
4236
4251
|
key: "longPull",
|
|
4237
|
-
value: function longPull(subscriber, method, link, auth, requestBody, reconnectInterval) {
|
|
4252
|
+
value: function longPull(subscriber, method, link, auth, requestBody, sessionId, reconnectInterval) {
|
|
4238
4253
|
var _this2 = this;
|
|
4239
4254
|
if (this.stoppedPooling) return;
|
|
4240
4255
|
var request = new XMLHttpRequest();
|
|
@@ -4246,11 +4261,15 @@
|
|
|
4246
4261
|
if (request.readyState === 4) {
|
|
4247
4262
|
if (request.status === 200 || request.status === 201) {
|
|
4248
4263
|
var data = JSON.parse(request.responseText);
|
|
4264
|
+
if (SessionHelper.sessionId !== data.resource.data.intent_id) {
|
|
4265
|
+
_this2.stoppedPooling = false;
|
|
4266
|
+
return;
|
|
4267
|
+
}
|
|
4249
4268
|
subscriber.next(data.resource.data);
|
|
4250
|
-
_this2.longPull(subscriber, method, link, auth, requestBody, reconnectInterval);
|
|
4269
|
+
_this2.longPull(subscriber, method, link, auth, requestBody, sessionId, reconnectInterval);
|
|
4251
4270
|
} else {
|
|
4252
|
-
setTimeout(function () {
|
|
4253
|
-
_this2.longPull(subscriber, method, link, auth, requestBody, reconnectInterval);
|
|
4271
|
+
if (SessionHelper.sessionId === sessionId) setTimeout(function () {
|
|
4272
|
+
_this2.longPull(subscriber, method, link, auth, requestBody, sessionId, reconnectInterval);
|
|
4254
4273
|
}, reconnectInterval);
|
|
4255
4274
|
}
|
|
4256
4275
|
}
|
|
@@ -5132,8 +5151,8 @@
|
|
|
5132
5151
|
}
|
|
5133
5152
|
return _createClass(ApiCheckoutInternal, [{
|
|
5134
5153
|
key: "instructions",
|
|
5135
|
-
value: function instructions() {
|
|
5136
|
-
return this.api.longPollingObservable('GET', INSTRUCTION_LINK, {}, 1000);
|
|
5154
|
+
value: function instructions(session_id) {
|
|
5155
|
+
return this.api.longPollingObservable('GET', INSTRUCTION_LINK, {}, session_id, 1000);
|
|
5137
5156
|
}
|
|
5138
5157
|
}, {
|
|
5139
5158
|
key: "callback",
|
|
@@ -15373,7 +15392,8 @@
|
|
|
15373
15392
|
this.setEnv(this.intentTokenPayload.env, this.intentTokenPayload.env_alias);
|
|
15374
15393
|
this.instructions = this.initContractVersion(this.intentTokenPayload.version);
|
|
15375
15394
|
if (this.debug) return;
|
|
15376
|
-
this.listenInstructions(intentToken);
|
|
15395
|
+
this.listenInstructions(intentToken, this.intentTokenPayload.intent_id);
|
|
15396
|
+
SessionHelper.sessionId = this.intentTokenPayload.intent_id;
|
|
15377
15397
|
this.ready();
|
|
15378
15398
|
} catch (e) {
|
|
15379
15399
|
console.error(e.message);
|
|
@@ -15411,10 +15431,10 @@
|
|
|
15411
15431
|
}
|
|
15412
15432
|
}, {
|
|
15413
15433
|
key: "listenInstructions",
|
|
15414
|
-
value: function listenInstructions(token) {
|
|
15434
|
+
value: function listenInstructions(token, session_id) {
|
|
15415
15435
|
var _this = this;
|
|
15416
15436
|
this.createWidgetStructure();
|
|
15417
|
-
this.api.checkout().instructions().subscribe({
|
|
15437
|
+
this.api.checkout().instructions(session_id).subscribe({
|
|
15418
15438
|
next: function next(response) {
|
|
15419
15439
|
var _a;
|
|
15420
15440
|
if (!(response === null || response === void 0 ? void 0 : response.event)) throw new Error('Instruction structure inconsistent');
|
|
@@ -128,8 +128,8 @@ declare class ApiBase {
|
|
|
128
128
|
* @param {string} [alias] - Own domain alias
|
|
129
129
|
*/
|
|
130
130
|
setEnv(env: string, alias?: string): ApiBase;
|
|
131
|
-
longPollingObservable<Req extends object, Res>(method: 'GET' | 'POST', url: string, requestBody: Req, reconnectInterval?: number): Observable<Res>;
|
|
132
|
-
longPull(subscriber: Subscriber<any>, method: any, link: any, auth: any, requestBody: any, reconnectInterval: any): void;
|
|
131
|
+
longPollingObservable<Req extends object, Res>(method: 'GET' | 'POST', url: string, requestBody: Req, sessionId: string, reconnectInterval?: number): Observable<Res>;
|
|
132
|
+
longPull(subscriber: Subscriber<any>, method: any, link: any, auth: any, requestBody: any, sessionId: any, reconnectInterval: any): void;
|
|
133
133
|
destroyLongPolling(): void;
|
|
134
134
|
setAuthType(): API_AUTH_TYPE;
|
|
135
135
|
getClient(method: Extract<HttpRequestMethod, 'GET' | 'POST'>, link: string): {
|
|
@@ -1913,7 +1913,7 @@ interface GetConfigResponse {
|
|
|
1913
1913
|
declare class ApiCheckoutInternal {
|
|
1914
1914
|
protected api: ApiInternal;
|
|
1915
1915
|
constructor(api: ApiInternal);
|
|
1916
|
-
instructions(): Observable<object>;
|
|
1916
|
+
instructions(session_id: string): Observable<object>;
|
|
1917
1917
|
callback(payload: Object): Promise<Object>;
|
|
1918
1918
|
}
|
|
1919
1919
|
|
|
@@ -128,8 +128,8 @@ declare class ApiBase {
|
|
|
128
128
|
* @param {string} [alias] - Own domain alias
|
|
129
129
|
*/
|
|
130
130
|
setEnv(env: string, alias?: string): ApiBase;
|
|
131
|
-
longPollingObservable<Req extends object, Res>(method: 'GET' | 'POST', url: string, requestBody: Req, reconnectInterval?: number): Observable<Res>;
|
|
132
|
-
longPull(subscriber: Subscriber<any>, method: any, link: any, auth: any, requestBody: any, reconnectInterval: any): void;
|
|
131
|
+
longPollingObservable<Req extends object, Res>(method: 'GET' | 'POST', url: string, requestBody: Req, sessionId: string, reconnectInterval?: number): Observable<Res>;
|
|
132
|
+
longPull(subscriber: Subscriber<any>, method: any, link: any, auth: any, requestBody: any, sessionId: any, reconnectInterval: any): void;
|
|
133
133
|
destroyLongPolling(): void;
|
|
134
134
|
setAuthType(): API_AUTH_TYPE;
|
|
135
135
|
getClient(method: Extract<HttpRequestMethod, 'GET' | 'POST'>, link: string): {
|
|
@@ -1913,7 +1913,7 @@ interface GetConfigResponse {
|
|
|
1913
1913
|
declare class ApiCheckoutInternal {
|
|
1914
1914
|
protected api: ApiInternal;
|
|
1915
1915
|
constructor(api: ApiInternal);
|
|
1916
|
-
instructions(): Observable<object>;
|
|
1916
|
+
instructions(session_id: string): Observable<object>;
|
|
1917
1917
|
callback(payload: Object): Promise<Object>;
|
|
1918
1918
|
}
|
|
1919
1919
|
|