PageSourceSearch

https://mlf.no/wp-content/plugins/klarna-payments-for-woocommerce/assets/js/klarna-interoperability-token.js

js mlf.no collected 2026-10-08 10:45:32 UTC 1,726 bytes, 64 lines download raw bytes

1jQuery( function ( $ ) {
2	"use strict"
3
4	const kp_interoperability_token = {
5		params: null,
6		klarnaBindAttempts: 0,
7
8		init: function () {
9			this.params = klarna_interoperability_token_params
10			this.updateGlobalToken( this.params.token )
11			this.bindKlarnaEvents()
12		},
13
14		bindKlarnaEvents: function () {
15			// Ensure the Klarna object exists in the global scope.
16			if ( typeof window.Klarna === "undefined" || typeof window.Klarna.Interoperability === "undefined" ) {
17				if ( kp_interoperability_token.klarnaBindAttempts >= 10 ) {
18					return
19				}
20
21				kp_interoperability_token.klarnaBindAttempts++
22				setTimeout( kp_interoperability_token.bindKlarnaEvents, 250 )
23				return
24			}
25			Klarna.Interoperability.on( "tokenupdate", kp_interoperability_token.updateSessionToken )
26
27			// If we did not get a token from Klarna yet, trigger the token request.
28			if ( undefined === window.klarna_interoperability_token ) {
29				Klarna.Interoperability.token()
30			}
31		},
32
33		updateGlobalToken: function ( token ) {
34			// If the token is not set, return.
35			if ( ! token || token === "" ) {
36				return
37			}
38
39			window.klarna_interoperability_token = token
40		},
41
42		updateSessionToken: function ( token ) {
43			const interoperabilityToken = token.interoperabilityToken
44			const { url, nonce } = kp_interoperability_token.params.ajax
45
46			$.ajax( {
47				url: url,
48				type: "POST",
49				data: {
50					token: interoperabilityToken,
51					nonce: nonce,
52				},
53				success: function ( response ) {
54					kp_interoperability_token.updateGlobalToken( interoperabilityToken )
55				},
56				error: function ( error ) {
57					console.error( "Error updating Interoperability Token:", error )
58				},
59			} )
60		},
61	}
62
63	kp_interoperability_token.init()
64} )

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.