@liquidcommercedev/rmn-sdk 1.5.0-beta.34 → 1.5.0-beta.36

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/index.esm.js CHANGED
@@ -82,38 +82,6 @@ var RMN_ENV;
82
82
  RMN_ENV["PRODUCTION"] = "production";
83
83
  })(RMN_ENV || (RMN_ENV = {}));
84
84
 
85
- /******************************************************************************
86
- Copyright (c) Microsoft Corporation.
87
-
88
- Permission to use, copy, modify, and/or distribute this software for any
89
- purpose with or without fee is hereby granted.
90
-
91
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
92
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
93
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
94
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
95
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
96
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
97
- PERFORMANCE OF THIS SOFTWARE.
98
- ***************************************************************************** */
99
- /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
100
-
101
-
102
- function __awaiter(thisArg, _arguments, P, generator) {
103
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
104
- return new (P || (P = Promise))(function (resolve, reject) {
105
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
106
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
107
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
108
- step((generator = generator.apply(thisArg, _arguments || [])).next());
109
- });
110
- }
111
-
112
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
113
- var e = new Error(message);
114
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
115
- };
116
-
117
85
  const REQUEST_CLOUD_PARTNER_SITE = 'X-Liquid-Partner-Site';
118
86
  const REQUEST_CLOUD_PROTECTED_KEY = 'X-Liquid-Protected';
119
87
  const REQUEST_CLOUD_PROTECTED_TIMESTAMP = 'X-Liquid-Timestamp';
@@ -7403,22 +7371,53 @@ const GENERAL_PUNCTUATION_MAP = {
7403
7371
  const OTHERS_MAP = {
7404
7372
  Nº: 'No',
7405
7373
  };
7406
- const SPECIAL_CHARS_MAP = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, LATIN_MAP), SYMBOLS_MAP), GREEK_MAP), TURKISH_MAP), GERMAN_MAP), ROMANIAN_MAP), RUSSIAN_MAP), UKRAINIAN_MAP), CZECH_MAP), GEORGIAN_MAP), ITALIAN_MAP), FRENCH_MAP), PORTUGUESE_MAP), NORDIC_MAP), HUNGARIAN_MAP), VIETNAMESE_MAP), CROATIOAN_SEERBIAN_MAP), BALLTIC_MAP), CHINESE_JAPANESE_PUNCTUATION_MAP), SPANISH_MAP), SLOVAK_MAP), POLISH_MAP), LATVIAN_MAP), ARABIC_MAP), LITHUANIAN_MAP), SERBIAN_MAP), AZERBAIJANI_MAP), GEORGIAN_MAP), GEOMETRIC_SHAPES_MAP), BLOCK_ELEMENTS_MAP), BOX_DRAWING_MAP), OPTICAL_CHARACTER_RECOGNITION_MAP), CONTROL_PICTURES_MAP), MISCELLANEOUS_TECHNICAL_MAP), MATHEMATICAL_OPERATORS_MAP), SUBSCRIPTS_AND_SUPERSCRIPTS_MAP), NUMBER_FORMS_MAP), LETTERLIKE_SYMBOLS_MAP), CURRENCY_SYMBOLS_MAP), COMBINING_DIACRITICAL_MARKS_MAP), GENERAL_PUNCTUATION_MAP), OTHERS_MAP);
7374
+ const SPECIAL_CHARS_MAP = {
7375
+ ...LATIN_MAP,
7376
+ ...SYMBOLS_MAP,
7377
+ ...GREEK_MAP,
7378
+ ...TURKISH_MAP,
7379
+ ...GERMAN_MAP,
7380
+ ...ROMANIAN_MAP,
7381
+ ...RUSSIAN_MAP,
7382
+ ...UKRAINIAN_MAP,
7383
+ ...CZECH_MAP,
7384
+ ...GEORGIAN_MAP,
7385
+ ...ITALIAN_MAP,
7386
+ ...FRENCH_MAP,
7387
+ ...PORTUGUESE_MAP,
7388
+ ...NORDIC_MAP,
7389
+ ...HUNGARIAN_MAP,
7390
+ ...VIETNAMESE_MAP,
7391
+ ...CROATIOAN_SEERBIAN_MAP,
7392
+ ...BALLTIC_MAP,
7393
+ ...CHINESE_JAPANESE_PUNCTUATION_MAP,
7394
+ ...SPANISH_MAP,
7395
+ ...SLOVAK_MAP,
7396
+ ...POLISH_MAP,
7397
+ ...LATVIAN_MAP,
7398
+ ...ARABIC_MAP,
7399
+ ...LITHUANIAN_MAP,
7400
+ ...SERBIAN_MAP,
7401
+ ...AZERBAIJANI_MAP,
7402
+ ...GEORGIAN_MAP,
7403
+ ...GEOMETRIC_SHAPES_MAP,
7404
+ ...BLOCK_ELEMENTS_MAP,
7405
+ ...BOX_DRAWING_MAP,
7406
+ ...OPTICAL_CHARACTER_RECOGNITION_MAP,
7407
+ ...CONTROL_PICTURES_MAP,
7408
+ ...MISCELLANEOUS_TECHNICAL_MAP,
7409
+ ...MATHEMATICAL_OPERATORS_MAP,
7410
+ ...SUBSCRIPTS_AND_SUPERSCRIPTS_MAP,
7411
+ ...NUMBER_FORMS_MAP,
7412
+ ...LETTERLIKE_SYMBOLS_MAP,
7413
+ ...CURRENCY_SYMBOLS_MAP,
7414
+ ...COMBINING_DIACRITICAL_MARKS_MAP,
7415
+ ...GENERAL_PUNCTUATION_MAP,
7416
+ ...OTHERS_MAP,
7417
+ };
7407
7418
 
7408
7419
  class NormalizeStringHelper {
7409
7420
  constructor() {
7410
- Object.defineProperty(this, "characterMaps", {
7411
- enumerable: true,
7412
- configurable: true,
7413
- writable: true,
7414
- value: void 0
7415
- });
7416
- Object.defineProperty(this, "regex", {
7417
- enumerable: true,
7418
- configurable: true,
7419
- writable: true,
7420
- value: void 0
7421
- });
7422
7421
  this.characterMaps = SPECIAL_CHARS_MAP;
7423
7422
  this.regex = new RegExp(Object.keys(this.characterMaps).join('|'), 'g');
7424
7423
  }
@@ -7484,12 +7483,7 @@ class SingletonManager {
7484
7483
  return instance;
7485
7484
  }
7486
7485
  }
7487
- Object.defineProperty(SingletonManager, "instances", {
7488
- enumerable: true,
7489
- configurable: true,
7490
- writable: true,
7491
- value: new Map()
7492
- });
7486
+ SingletonManager.instances = new Map();
7493
7487
 
7494
7488
  class ObjectHelper {
7495
7489
  /**
@@ -7617,7 +7611,7 @@ class ObjectHelper {
7617
7611
  this.innerMerge(targetValue, value);
7618
7612
  return targetValue;
7619
7613
  }
7620
- return value ? Object.assign({}, value) : value;
7614
+ return value ? { ...value } : value;
7621
7615
  }
7622
7616
  /**
7623
7617
  * Merges the properties of the source object into the target object.
@@ -7635,31 +7629,29 @@ class ObjectHelper {
7635
7629
  }
7636
7630
 
7637
7631
  // Fallback method using fetch if sendBeacon isn't available
7638
- function fallbackEventFire(url) {
7639
- return __awaiter(this, void 0, void 0, function* () {
7640
- try {
7641
- const racePromise = Promise.race([
7642
- // Promise #1: The fetch request
7643
- fetch(url, {
7644
- method: 'POST',
7645
- keepalive: true,
7646
- }),
7647
- // Promise #2: The timeout
7648
- new Promise((_, reject) => setTimeout(() => reject(new Error('Request timeout')), 2000)),
7649
- ]);
7650
- /**
7651
- * Prevent requests from hanging indefinitely
7652
- * Improve user experience by failing fast
7653
- * Handle slow network conditions gracefully
7654
- * Ensure resources are freed up in a timely manner
7655
- */
7656
- const response = yield racePromise;
7657
- return response.ok;
7658
- }
7659
- catch (_a) {
7660
- return false;
7661
- }
7662
- });
7632
+ async function fallbackEventFire(url) {
7633
+ try {
7634
+ const racePromise = Promise.race([
7635
+ // Promise #1: The fetch request
7636
+ fetch(url, {
7637
+ method: 'POST',
7638
+ keepalive: true,
7639
+ }),
7640
+ // Promise #2: The timeout
7641
+ new Promise((_, reject) => setTimeout(() => reject(new Error('Request timeout')), 2000)),
7642
+ ]);
7643
+ /**
7644
+ * Prevent requests from hanging indefinitely
7645
+ * Improve user experience by failing fast
7646
+ * Handle slow network conditions gracefully
7647
+ * Ensure resources are freed up in a timely manner
7648
+ */
7649
+ const response = await racePromise;
7650
+ return response.ok;
7651
+ }
7652
+ catch (_a) {
7653
+ return false;
7654
+ }
7663
7655
  }
7664
7656
  /**
7665
7657
  * Helper function to decode base64 string and parse JSON
@@ -7716,26 +7708,24 @@ function getRedirectUrlFromPayload(url) {
7716
7708
  * @param {string} params.eventUrl - The URL to which the event is sent.
7717
7709
  * @returns {Promise<void>} - A promise that resolves when the event is fired.
7718
7710
  */
7719
- function fireEvent(_a) {
7720
- return __awaiter(this, arguments, void 0, function* ({ spotType, event, eventUrl }) {
7721
- var _b;
7722
- try {
7723
- const didFireEvent = ((_b = navigator === null || navigator === void 0 ? void 0 : navigator.sendBeacon) === null || _b === void 0 ? void 0 : _b.call(navigator, eventUrl)) || (yield fallbackEventFire(eventUrl));
7724
- if (!didFireEvent) {
7725
- return;
7726
- }
7727
- // Redirect user if the event is a click event
7728
- if (event === RMN_SPOT_EVENT.CLICK && spotType !== RMN_SPOT_TYPE.RB_VIDEO_PLAYER) {
7729
- const redirectUrl = getRedirectUrlFromPayload(eventUrl);
7730
- if (redirectUrl) {
7731
- window.location.href = redirectUrl;
7732
- }
7733
- }
7711
+ async function fireEvent({ spotType, event, eventUrl }) {
7712
+ var _a;
7713
+ try {
7714
+ const didFireEvent = ((_a = navigator === null || navigator === void 0 ? void 0 : navigator.sendBeacon) === null || _a === void 0 ? void 0 : _a.call(navigator, eventUrl)) || (await fallbackEventFire(eventUrl));
7715
+ if (!didFireEvent) {
7716
+ return;
7734
7717
  }
7735
- catch (_c) {
7736
- // Handle errors silently
7718
+ // Redirect user if the event is a click event
7719
+ if (event === RMN_SPOT_EVENT.CLICK && spotType !== RMN_SPOT_TYPE.RB_VIDEO_PLAYER) {
7720
+ const redirectUrl = getRedirectUrlFromPayload(eventUrl);
7721
+ if (redirectUrl) {
7722
+ window.location.href = redirectUrl;
7723
+ }
7737
7724
  }
7738
- });
7725
+ }
7726
+ catch (_b) {
7727
+ // Handle errors silently
7728
+ }
7739
7729
  }
7740
7730
  function calculateScaleFactor(elementScale) {
7741
7731
  // Step 1: Apply square root for non-linear scaling
@@ -7910,44 +7900,14 @@ class UniqueIdGenerator {
7910
7900
  }
7911
7901
  }
7912
7902
  // Constants for bit manipulation
7913
- Object.defineProperty(UniqueIdGenerator, "epoch", {
7914
- enumerable: true,
7915
- configurable: true,
7916
- writable: true,
7917
- value: 1577836800000
7918
- }); // 2020-01-01 as epoch
7919
- Object.defineProperty(UniqueIdGenerator, "nodeBits", {
7920
- enumerable: true,
7921
- configurable: true,
7922
- writable: true,
7923
- value: 10
7924
- });
7925
- Object.defineProperty(UniqueIdGenerator, "sequenceBits", {
7926
- enumerable: true,
7927
- configurable: true,
7928
- writable: true,
7929
- value: 12
7930
- });
7903
+ UniqueIdGenerator.epoch = 1577836800000; // 2020-01-01 as epoch
7904
+ UniqueIdGenerator.nodeBits = 10;
7905
+ UniqueIdGenerator.sequenceBits = 12;
7931
7906
  // Instance variables
7932
- Object.defineProperty(UniqueIdGenerator, "lastTimestamp", {
7933
- enumerable: true,
7934
- configurable: true,
7935
- writable: true,
7936
- value: -1
7937
- });
7938
- Object.defineProperty(UniqueIdGenerator, "sequence", {
7939
- enumerable: true,
7940
- configurable: true,
7941
- writable: true,
7942
- value: 0
7943
- });
7907
+ UniqueIdGenerator.lastTimestamp = -1;
7908
+ UniqueIdGenerator.sequence = 0;
7944
7909
  // Character set for base32 encoding (excluding similar looking characters)
7945
- Object.defineProperty(UniqueIdGenerator, "base32Chars", {
7946
- enumerable: true,
7947
- configurable: true,
7948
- writable: true,
7949
- value: '0123456789ABCDEFGHJKMNPQRSTVWXYZ'
7950
- });
7910
+ UniqueIdGenerator.base32Chars = '0123456789ABCDEFGHJKMNPQRSTVWXYZ';
7951
7911
 
7952
7912
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
7953
7913
 
@@ -16696,18 +16656,6 @@ class SignJWT extends ProduceJWT {
16696
16656
  class ApiError {
16697
16657
  constructor(error) {
16698
16658
  var _a, _b, _c, _d, _e, _f, _g;
16699
- Object.defineProperty(this, "cause", {
16700
- enumerable: true,
16701
- configurable: true,
16702
- writable: true,
16703
- value: void 0
16704
- });
16705
- Object.defineProperty(this, "errorMessage", {
16706
- enumerable: true,
16707
- configurable: true,
16708
- writable: true,
16709
- value: void 0
16710
- });
16711
16659
  const e = error;
16712
16660
  this.cause = (_d = (_b = (_a = e === null || e === void 0 ? void 0 : e.response) === null || _a === void 0 ? void 0 : _a.data.statusCode) !== null && _b !== void 0 ? _b : (_c = e === null || e === void 0 ? void 0 : e.response) === null || _c === void 0 ? void 0 : _c.status) !== null && _d !== void 0 ? _d : 0;
16713
16661
  this.errorMessage =
@@ -16717,12 +16665,6 @@ class ApiError {
16717
16665
 
16718
16666
  class EncryptedApi {
16719
16667
  constructor(apiKey) {
16720
- Object.defineProperty(this, "apiKey", {
16721
- enumerable: true,
16722
- configurable: true,
16723
- writable: true,
16724
- value: void 0
16725
- });
16726
16668
  this.apiKey = apiKey;
16727
16669
  }
16728
16670
  /**
@@ -16740,19 +16682,17 @@ class EncryptedApi {
16740
16682
  * @param {number} LT - The LT (Lifetime) value used for encryption.
16741
16683
  * @returns {Promise<string | undefined>} - The encrypted data as a string, or undefined if encryption fails.
16742
16684
  */
16743
- handleEncryption(data, LT) {
16744
- return __awaiter(this, void 0, void 0, function* () {
16745
- const key = this.getKey(LT);
16746
- try {
16747
- return this.joseEncrypt(data, key, this.forwardInMinutes(30, LT));
16748
- }
16749
- catch (_a) {
16750
- this.handleError({
16751
- cause: 'Payload decryption error',
16752
- message: 'The decryption of the payload failed',
16753
- });
16754
- }
16755
- });
16685
+ async handleEncryption(data, LT) {
16686
+ const key = this.getKey(LT);
16687
+ try {
16688
+ return this.joseEncrypt(data, key, this.forwardInMinutes(30, LT));
16689
+ }
16690
+ catch (_a) {
16691
+ this.handleError({
16692
+ cause: 'Payload decryption error',
16693
+ message: 'The decryption of the payload failed',
16694
+ });
16695
+ }
16756
16696
  }
16757
16697
  /**
16758
16698
  * Decrypts the given data using a key generated based on LT.
@@ -16761,11 +16701,9 @@ class EncryptedApi {
16761
16701
  * @param {number} LT - The LT value used to generate the decryption key.
16762
16702
  * @return {Promise<JWTVerifyResult>} A promise that resolves with the decrypted data.
16763
16703
  */
16764
- handleDecryption(data, LT) {
16765
- return __awaiter(this, void 0, void 0, function* () {
16766
- const key = this.getKey(LT);
16767
- return this.joseDecrypt(data, key);
16768
- });
16704
+ async handleDecryption(data, LT) {
16705
+ const key = this.getKey(LT);
16706
+ return this.joseDecrypt(data, key);
16769
16707
  }
16770
16708
  /**
16771
16709
  * Returns the key based on the given LT value.
@@ -16794,13 +16732,11 @@ class EncryptedApi {
16794
16732
  * @param {string} key - The key used for decryption.
16795
16733
  * @return {Promise<JWTVerifyResult>} A Promise that resolves to the decrypted JWT payload.
16796
16734
  */
16797
- joseDecrypt(data, key) {
16798
- return __awaiter(this, void 0, void 0, function* () {
16799
- // Decrypt and format payload back to string
16800
- const decryptedString = cryptoJsExports.AES.decrypt(data, key).toString(cryptoJsExports.enc.Utf8);
16801
- // Allow decoding only if secret is matching
16802
- return jwtVerify(decryptedString, Buffer.from(key));
16803
- });
16735
+ async joseDecrypt(data, key) {
16736
+ // Decrypt and format payload back to string
16737
+ const decryptedString = cryptoJsExports.AES.decrypt(data, key).toString(cryptoJsExports.enc.Utf8);
16738
+ // Allow decoding only if secret is matching
16739
+ return jwtVerify(decryptedString, Buffer.from(key));
16804
16740
  }
16805
16741
  /**
16806
16742
  * Encrypts and signs the given data using the JOSE encryption standard.
@@ -16809,18 +16745,16 @@ class EncryptedApi {
16809
16745
  * @param {Date | number} exp - The expiration time for the encrypted data.
16810
16746
  * @returns {Promise<string>} - The encrypted and signed data as a string.
16811
16747
  */
16812
- joseEncrypt(data, key, exp) {
16813
- return __awaiter(this, void 0, void 0, function* () {
16814
- // Encode and sign data
16815
- const currentDate = new Date();
16816
- const token = new SignJWT(data)
16817
- .setProtectedHeader({ alg: 'HS256' })
16818
- .setIssuedAt(currentDate.getTime())
16819
- .setExpirationTime(exp);
16820
- const signedToken = yield token.sign(Buffer.from(key));
16821
- // Encrypt and format payload
16822
- return cryptoJsExports.AES.encrypt(signedToken, key).toString();
16823
- });
16748
+ async joseEncrypt(data, key, exp) {
16749
+ // Encode and sign data
16750
+ const currentDate = new Date();
16751
+ const token = new SignJWT(data)
16752
+ .setProtectedHeader({ alg: 'HS256' })
16753
+ .setIssuedAt(currentDate.getTime())
16754
+ .setExpirationTime(exp);
16755
+ const signedToken = await token.sign(Buffer.from(key));
16756
+ // Encrypt and format payload
16757
+ return cryptoJsExports.AES.encrypt(signedToken, key).toString();
16824
16758
  }
16825
16759
  /**
16826
16760
  * Handles the error by throwing an ApiError.
@@ -16837,36 +16771,6 @@ class BaseApi extends BaseApiAbstract {
16837
16771
  constructor(auth) {
16838
16772
  var _a;
16839
16773
  super();
16840
- Object.defineProperty(this, "authInfo", {
16841
- enumerable: true,
16842
- configurable: true,
16843
- writable: true,
16844
- value: void 0
16845
- });
16846
- Object.defineProperty(this, "baseUrl", {
16847
- enumerable: true,
16848
- configurable: true,
16849
- writable: true,
16850
- value: void 0
16851
- });
16852
- Object.defineProperty(this, "objectHelper", {
16853
- enumerable: true,
16854
- configurable: true,
16855
- writable: true,
16856
- value: void 0
16857
- });
16858
- Object.defineProperty(this, "encryptedApi", {
16859
- enumerable: true,
16860
- configurable: true,
16861
- writable: true,
16862
- value: void 0
16863
- });
16864
- Object.defineProperty(this, "client", {
16865
- enumerable: true,
16866
- configurable: true,
16867
- writable: true,
16868
- value: void 0
16869
- });
16870
16774
  this.authInfo = auth;
16871
16775
  this.encryptedApi = EncryptedApi.getInstance(this.authInfo.apiKey);
16872
16776
  this.objectHelper = ObjectHelper.getInstance();
@@ -16879,7 +16783,10 @@ class BaseApi extends BaseApiAbstract {
16879
16783
  if (partnerSite && isPartnerSiteValid) {
16880
16784
  configHeaders[REQUEST_CLOUD_PARTNER_SITE] = partnerSite;
16881
16785
  }
16882
- this.client = axios.create(Object.assign({ baseURL: this.baseUrl }, this.getConfig(configHeaders)));
16786
+ this.client = axios.create({
16787
+ baseURL: this.baseUrl,
16788
+ ...this.getConfig(configHeaders),
16789
+ });
16883
16790
  }
16884
16791
  getPartnerSite() {
16885
16792
  if (typeof window !== 'undefined' && window.location) {
@@ -16895,7 +16802,11 @@ class BaseApi extends BaseApiAbstract {
16895
16802
  */
16896
16803
  getConfig(headers) {
16897
16804
  return {
16898
- headers: Object.assign({ 'Content-Type': 'application/json', [REQUEST_CLOUD_API_ENV]: this.authInfo.env }, headers),
16805
+ headers: {
16806
+ 'Content-Type': 'application/json',
16807
+ [REQUEST_CLOUD_API_ENV]: this.authInfo.env,
16808
+ ...headers,
16809
+ },
16899
16810
  };
16900
16811
  }
16901
16812
  /**
@@ -16905,10 +16816,8 @@ class BaseApi extends BaseApiAbstract {
16905
16816
  * @param {AxiosRequestConfig} configOverrides - Additional configuration options for the request.
16906
16817
  * @returns {Promise<Result<T | null, ApiError>>} A promise that resolves to the result, which can be either data of type T or null, or an error of type ApiError.
16907
16818
  */
16908
- get(path, configOverrides) {
16909
- return __awaiter(this, void 0, void 0, function* () {
16910
- return this.createRequest(path, configOverrides, this.client.get);
16911
- });
16819
+ async get(path, configOverrides) {
16820
+ return this.createRequest(path, configOverrides, this.client.get);
16912
16821
  }
16913
16822
  /**
16914
16823
  * Sends a POST request to the specified path with the given data and configuration overrides.
@@ -16919,18 +16828,24 @@ class BaseApi extends BaseApiAbstract {
16919
16828
  *
16920
16829
  * @returns {Promise<Result<T | null, ApiError>>} - A Promise that resolves to the result of the POST request.
16921
16830
  */
16922
- post(path, data, configOverrides) {
16923
- return __awaiter(this, void 0, void 0, function* () {
16924
- let requestData = data;
16925
- if (![RMN_ENV.LOCAL, RMN_ENV.DEVELOPMENT].includes(this.authInfo.env)) {
16926
- const timestamp = new Date().getTime();
16927
- configOverrides = Object.assign(Object.assign({}, configOverrides), { headers: Object.assign(Object.assign({}, configOverrides === null || configOverrides === void 0 ? void 0 : configOverrides.headers), { [REQUEST_CLOUD_PROTECTED_KEY]: 'true', [REQUEST_CLOUD_PROTECTED_TIMESTAMP]: timestamp, [SDK_CONFIG.apiHeader]: this.authInfo.apiKey }) });
16928
- requestData = {
16929
- t: yield this.encryptedApi.handleEncryption(data, timestamp),
16930
- };
16931
- }
16932
- return this.createRequest(path, configOverrides, (url, config) => this.client.post(url, requestData, config));
16933
- });
16831
+ async post(path, data, configOverrides) {
16832
+ let requestData = data;
16833
+ if (![RMN_ENV.LOCAL, RMN_ENV.DEVELOPMENT].includes(this.authInfo.env)) {
16834
+ const timestamp = new Date().getTime();
16835
+ configOverrides = {
16836
+ ...configOverrides,
16837
+ headers: {
16838
+ ...configOverrides === null || configOverrides === void 0 ? void 0 : configOverrides.headers,
16839
+ [REQUEST_CLOUD_PROTECTED_KEY]: 'true',
16840
+ [REQUEST_CLOUD_PROTECTED_TIMESTAMP]: timestamp,
16841
+ [SDK_CONFIG.apiHeader]: this.authInfo.apiKey,
16842
+ },
16843
+ };
16844
+ requestData = {
16845
+ t: await this.encryptedApi.handleEncryption(data, timestamp),
16846
+ };
16847
+ }
16848
+ return this.createRequest(path, configOverrides, (url, config) => this.client.post(url, requestData, config));
16934
16849
  }
16935
16850
  /**
16936
16851
  * Create a request to the API server.
@@ -16939,18 +16854,16 @@ class BaseApi extends BaseApiAbstract {
16939
16854
  * @param {function} requestFunction - The function to send the request, must accept the URL and config as parameters and return a promise of the Axios response or null.
16940
16855
  * @returns {Promise<Result<T | null, ApiError>>} - A promise that resolves to a Result object containing the response data or null on success, or an ApiError object on failure.
16941
16856
  */
16942
- createRequest(subPath, configOverrides, requestFunction) {
16943
- return __awaiter(this, void 0, void 0, function* () {
16944
- try {
16945
- const url = this.createURL(subPath);
16946
- const fullConfig = this.createFullConfig(configOverrides);
16947
- const response = yield this.sendRequest(url, fullConfig, requestFunction);
16948
- return yield this.getResponse(response);
16949
- }
16950
- catch (error) {
16951
- return { isOk: false, val: null, isErr: new ApiError(error) };
16952
- }
16953
- });
16857
+ async createRequest(subPath, configOverrides, requestFunction) {
16858
+ try {
16859
+ const url = this.createURL(subPath);
16860
+ const fullConfig = this.createFullConfig(configOverrides);
16861
+ const response = await this.sendRequest(url, fullConfig, requestFunction);
16862
+ return await this.getResponse(response);
16863
+ }
16864
+ catch (error) {
16865
+ return { isOk: false, val: null, isErr: new ApiError(error) };
16866
+ }
16954
16867
  }
16955
16868
  /**
16956
16869
  * Private method that creates a full Axios request configuration.
@@ -16971,10 +16884,8 @@ class BaseApi extends BaseApiAbstract {
16971
16884
  * @return {Promise<AxiosResponse | null>} - A Promise that resolves with the response from the request function,
16972
16885
  * or null if the request was unsuccessful.
16973
16886
  */
16974
- sendRequest(url, config, requestFunction) {
16975
- return __awaiter(this, void 0, void 0, function* () {
16976
- return requestFunction(url, config);
16977
- });
16887
+ async sendRequest(url, config, requestFunction) {
16888
+ return requestFunction(url, config);
16978
16889
  }
16979
16890
  /**
16980
16891
  * Gets the response from an Axios response object and handles decryption if necessary.
@@ -16983,36 +16894,34 @@ class BaseApi extends BaseApiAbstract {
16983
16894
  * @param {AxiosResponse | null} response - The Axios response object.
16984
16895
  * @returns {Promise<Result<T | null, ApiError>>} - A promise that resolves to a Result object containing the response data or an ApiError.
16985
16896
  */
16986
- getResponse(response) {
16987
- return __awaiter(this, void 0, void 0, function* () {
16988
- var _a, _b, _c, _d, _e, _f, _g;
16989
- let responseData = (response === null || response === void 0 ? void 0 : response.data) ? response.data : null;
16990
- let isEncrypted = false;
16991
- let timestamp = 0;
16992
- if ((response === null || response === void 0 ? void 0 : response.headers) &&
16993
- ((_a = response === null || response === void 0 ? void 0 : response.headers) === null || _a === void 0 ? void 0 : _a.has) &&
16994
- ((_b = response === null || response === void 0 ? void 0 : response.headers) === null || _b === void 0 ? void 0 : _b.has(REQUEST_CLOUD_PROTECTED_KEY)) &&
16995
- ((_c = response === null || response === void 0 ? void 0 : response.headers) === null || _c === void 0 ? void 0 : _c.has(REQUEST_CLOUD_PROTECTED_TIMESTAMP)) &&
16996
- ((_d = response === null || response === void 0 ? void 0 : response.headers) === null || _d === void 0 ? void 0 : _d.get)) {
16997
- isEncrypted = ((_e = response === null || response === void 0 ? void 0 : response.headers) === null || _e === void 0 ? void 0 : _e.get(REQUEST_CLOUD_PROTECTED_KEY)) === 'true';
16998
- timestamp = ((_f = response === null || response === void 0 ? void 0 : response.headers) === null || _f === void 0 ? void 0 : _f.get(REQUEST_CLOUD_PROTECTED_TIMESTAMP))
16999
- ? Number((_g = response === null || response === void 0 ? void 0 : response.headers) === null || _g === void 0 ? void 0 : _g.get(REQUEST_CLOUD_PROTECTED_TIMESTAMP))
17000
- : 0;
17001
- }
17002
- if (responseData &&
17003
- isEncrypted &&
17004
- this.objectHelper.includes(responseData, 't') &&
17005
- timestamp > 0) {
17006
- const { t: encryptedPayload } = responseData;
17007
- const decryptedData = yield this.encryptedApi.handleDecryption(encryptedPayload, timestamp);
17008
- if (decryptedData === null || decryptedData === void 0 ? void 0 : decryptedData.payload) {
17009
- delete decryptedData.payload.exp;
17010
- delete decryptedData.payload.iat;
17011
- responseData = decryptedData.payload;
17012
- }
16897
+ async getResponse(response) {
16898
+ var _a, _b, _c, _d, _e, _f, _g;
16899
+ let responseData = (response === null || response === void 0 ? void 0 : response.data) ? response.data : null;
16900
+ let isEncrypted = false;
16901
+ let timestamp = 0;
16902
+ if ((response === null || response === void 0 ? void 0 : response.headers) &&
16903
+ ((_a = response === null || response === void 0 ? void 0 : response.headers) === null || _a === void 0 ? void 0 : _a.has) &&
16904
+ ((_b = response === null || response === void 0 ? void 0 : response.headers) === null || _b === void 0 ? void 0 : _b.has(REQUEST_CLOUD_PROTECTED_KEY)) &&
16905
+ ((_c = response === null || response === void 0 ? void 0 : response.headers) === null || _c === void 0 ? void 0 : _c.has(REQUEST_CLOUD_PROTECTED_TIMESTAMP)) &&
16906
+ ((_d = response === null || response === void 0 ? void 0 : response.headers) === null || _d === void 0 ? void 0 : _d.get)) {
16907
+ isEncrypted = ((_e = response === null || response === void 0 ? void 0 : response.headers) === null || _e === void 0 ? void 0 : _e.get(REQUEST_CLOUD_PROTECTED_KEY)) === 'true';
16908
+ timestamp = ((_f = response === null || response === void 0 ? void 0 : response.headers) === null || _f === void 0 ? void 0 : _f.get(REQUEST_CLOUD_PROTECTED_TIMESTAMP))
16909
+ ? Number((_g = response === null || response === void 0 ? void 0 : response.headers) === null || _g === void 0 ? void 0 : _g.get(REQUEST_CLOUD_PROTECTED_TIMESTAMP))
16910
+ : 0;
16911
+ }
16912
+ if (responseData &&
16913
+ isEncrypted &&
16914
+ this.objectHelper.includes(responseData, 't') &&
16915
+ timestamp > 0) {
16916
+ const { t: encryptedPayload } = responseData;
16917
+ const decryptedData = await this.encryptedApi.handleDecryption(encryptedPayload, timestamp);
16918
+ if (decryptedData === null || decryptedData === void 0 ? void 0 : decryptedData.payload) {
16919
+ delete decryptedData.payload.exp;
16920
+ delete decryptedData.payload.iat;
16921
+ responseData = decryptedData.payload;
17013
16922
  }
17014
- return { isOk: true, val: responseData, isErr: false };
17015
- });
16923
+ }
16924
+ return { isOk: true, val: responseData, isErr: false };
17016
16925
  }
17017
16926
  /**
17018
16927
  * Creates a URL by concatenating the base URL with the provided path.
@@ -17053,25 +16962,23 @@ class AuthService extends BaseApi {
17053
16962
  * @returns {Promise<IAuthCredentials>} A Promise that resolves to the authenticated credentials.
17054
16963
  * @throws {Error} If there is an error during authentication or the authentication response is unsuccessful.
17055
16964
  */
17056
- initialize() {
17057
- return __awaiter(this, void 0, void 0, function* () {
17058
- const { isOk, isErr, val } = yield this.get(AUTH_API_PATH, {
17059
- headers: {
17060
- [SDK_CONFIG.apiHeader]: this.authInfo.apiKey,
17061
- },
17062
- });
17063
- if (isErr) {
17064
- throw new Error(`There was an error during authentication: (${isErr === null || isErr === void 0 ? void 0 : isErr.errorMessage})`);
17065
- }
17066
- if (isOk && (val === null || val === void 0 ? void 0 : val.data.token)) {
17067
- this.authInfo.token = val.data.token;
17068
- this.authInfo.authenticated = true;
17069
- }
17070
- else {
17071
- throw new Error('Auth response was not successful');
17072
- }
17073
- return this.authInfo;
16965
+ async initialize() {
16966
+ const { isOk, isErr, val } = await this.get(AUTH_API_PATH, {
16967
+ headers: {
16968
+ [SDK_CONFIG.apiHeader]: this.authInfo.apiKey,
16969
+ },
17074
16970
  });
16971
+ if (isErr) {
16972
+ throw new Error(`There was an error during authentication: (${isErr === null || isErr === void 0 ? void 0 : isErr.errorMessage})`);
16973
+ }
16974
+ if (isOk && (val === null || val === void 0 ? void 0 : val.data.token)) {
16975
+ this.authInfo.token = val.data.token;
16976
+ this.authInfo.authenticated = true;
16977
+ }
16978
+ else {
16979
+ throw new Error('Auth response was not successful');
16980
+ }
16981
+ return this.authInfo;
17075
16982
  }
17076
16983
  }
17077
16984
 
@@ -17124,24 +17031,9 @@ const SPOT_DIMENSIONS = {
17124
17031
 
17125
17032
  class DummyHTMLElement {
17126
17033
  constructor() {
17127
- Object.defineProperty(this, "shadowRoot", {
17128
- enumerable: true,
17129
- configurable: true,
17130
- writable: true,
17131
- value: null
17132
- });
17133
- Object.defineProperty(this, "tagName", {
17134
- enumerable: true,
17135
- configurable: true,
17136
- writable: true,
17137
- value: 'div'
17138
- });
17139
- Object.defineProperty(this, "innerHTML", {
17140
- enumerable: true,
17141
- configurable: true,
17142
- writable: true,
17143
- value: ''
17144
- });
17034
+ this.shadowRoot = null;
17035
+ this.tagName = 'div';
17036
+ this.innerHTML = '';
17145
17037
  }
17146
17038
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
17147
17039
  attachShadow(_options) {
@@ -17156,36 +17048,8 @@ const BaseElement = (isBrowser ? HTMLElement : DummyHTMLElement);
17156
17048
  class BaseSpotComponent extends BaseElement {
17157
17049
  constructor() {
17158
17050
  super();
17159
- Object.defineProperty(this, "initialized", {
17160
- enumerable: true,
17161
- configurable: true,
17162
- writable: true,
17163
- value: false
17164
- });
17165
- Object.defineProperty(this, "dataInitialized", {
17166
- enumerable: true,
17167
- configurable: true,
17168
- writable: true,
17169
- value: false
17170
- });
17171
- Object.defineProperty(this, "_data", {
17172
- enumerable: true,
17173
- configurable: true,
17174
- writable: true,
17175
- value: void 0
17176
- });
17177
- Object.defineProperty(this, "_config", {
17178
- enumerable: true,
17179
- configurable: true,
17180
- writable: true,
17181
- value: void 0
17182
- });
17183
- Object.defineProperty(this, "_container", {
17184
- enumerable: true,
17185
- configurable: true,
17186
- writable: true,
17187
- value: void 0
17188
- });
17051
+ this.initialized = false;
17052
+ this.dataInitialized = false;
17189
17053
  }
17190
17054
  initializeData(data, config) {
17191
17055
  if (this.dataInitialized) {
@@ -17277,12 +17141,6 @@ const SPOT_EVENTS_ARRAY_INDEX = {
17277
17141
  };
17278
17142
  class LocalStorageService {
17279
17143
  constructor() {
17280
- Object.defineProperty(this, "spots", {
17281
- enumerable: true,
17282
- configurable: true,
17283
- writable: true,
17284
- value: void 0
17285
- });
17286
17144
  this.setUserId();
17287
17145
  this.spots = new Map();
17288
17146
  // Sync local storage with the current state
@@ -17515,82 +17373,15 @@ class LocalStorageService {
17515
17373
  return this.unicodeDecode(data);
17516
17374
  }
17517
17375
  }
17518
- Object.defineProperty(LocalStorageService, "localStorageKeyPrefix", {
17519
- enumerable: true,
17520
- configurable: true,
17521
- writable: true,
17522
- value: 'lc_rmn'
17523
- });
17524
- Object.defineProperty(LocalStorageService, "localStorageKey", {
17525
- enumerable: true,
17526
- configurable: true,
17527
- writable: true,
17528
- value: ''
17529
- });
17530
- Object.defineProperty(LocalStorageService, "spotExpirationTime", {
17531
- enumerable: true,
17532
- configurable: true,
17533
- writable: true,
17534
- value: 1000 * 60 * 60 * 24 * 7
17535
- }); // 7 days
17536
- Object.defineProperty(LocalStorageService, "encryptData", {
17537
- enumerable: true,
17538
- configurable: true,
17539
- writable: true,
17540
- value: true
17541
- });
17376
+ LocalStorageService.localStorageKeyPrefix = 'lc_rmn';
17377
+ LocalStorageService.localStorageKey = '';
17378
+ LocalStorageService.spotExpirationTime = 1000 * 60 * 60 * 24 * 7; // 7 days
17379
+ LocalStorageService.encryptData = true;
17542
17380
 
17543
17381
  class ProximityObserver {
17544
17382
  constructor(elementIds, callback, options = {}) {
17545
17383
  var _a, _b;
17546
- Object.defineProperty(this, "intersectionObserver", {
17547
- enumerable: true,
17548
- configurable: true,
17549
- writable: true,
17550
- value: void 0
17551
- });
17552
- Object.defineProperty(this, "mutationObserver", {
17553
- enumerable: true,
17554
- configurable: true,
17555
- writable: true,
17556
- value: void 0
17557
- });
17558
- Object.defineProperty(this, "targetIds", {
17559
- enumerable: true,
17560
- configurable: true,
17561
- writable: true,
17562
- value: void 0
17563
- });
17564
- Object.defineProperty(this, "processedIds", {
17565
- enumerable: true,
17566
- configurable: true,
17567
- writable: true,
17568
- value: void 0
17569
- });
17570
- Object.defineProperty(this, "callback", {
17571
- enumerable: true,
17572
- configurable: true,
17573
- writable: true,
17574
- value: void 0
17575
- });
17576
- Object.defineProperty(this, "proximityThreshold", {
17577
- enumerable: true,
17578
- configurable: true,
17579
- writable: true,
17580
- value: void 0
17581
- });
17582
- Object.defineProperty(this, "intersectionMargin", {
17583
- enumerable: true,
17584
- configurable: true,
17585
- writable: true,
17586
- value: void 0
17587
- });
17588
- Object.defineProperty(this, "maxGroupSize", {
17589
- enumerable: true,
17590
- configurable: true,
17591
- writable: true,
17592
- value: 20
17593
- });
17384
+ this.maxGroupSize = 20;
17594
17385
  this.targetIds = new Set(elementIds);
17595
17386
  this.processedIds = new Set();
17596
17387
  this.callback = callback;
@@ -17727,12 +17518,7 @@ class PubsubService {
17727
17518
  /**
17728
17519
  * Object to store subscribers for each event type
17729
17520
  */
17730
- Object.defineProperty(this, "subscribers", {
17731
- enumerable: true,
17732
- configurable: true,
17733
- writable: true,
17734
- value: {}
17735
- });
17521
+ this.subscribers = {};
17736
17522
  }
17737
17523
  static getInstance() {
17738
17524
  return SingletonManager.getInstance('PubsubService', () => new PubsubService());
@@ -17802,42 +17588,6 @@ class PubsubService {
17802
17588
 
17803
17589
  class ResizeObserverService {
17804
17590
  constructor({ element, maxSize, minScale }) {
17805
- Object.defineProperty(this, "element", {
17806
- enumerable: true,
17807
- configurable: true,
17808
- writable: true,
17809
- value: void 0
17810
- });
17811
- Object.defineProperty(this, "container", {
17812
- enumerable: true,
17813
- configurable: true,
17814
- writable: true,
17815
- value: void 0
17816
- });
17817
- Object.defineProperty(this, "resizeObserver", {
17818
- enumerable: true,
17819
- configurable: true,
17820
- writable: true,
17821
- value: void 0
17822
- });
17823
- Object.defineProperty(this, "maxSize", {
17824
- enumerable: true,
17825
- configurable: true,
17826
- writable: true,
17827
- value: void 0
17828
- });
17829
- Object.defineProperty(this, "minSize", {
17830
- enumerable: true,
17831
- configurable: true,
17832
- writable: true,
17833
- value: void 0
17834
- });
17835
- Object.defineProperty(this, "aspectRatio", {
17836
- enumerable: true,
17837
- configurable: true,
17838
- writable: true,
17839
- value: void 0
17840
- });
17841
17591
  this.element = element;
17842
17592
  if (!element.parentElement) {
17843
17593
  throw new Error('RmnSdk: Spot element must have a parent container.');
@@ -17951,18 +17701,7 @@ function generateGradientColor(overlay, fallback = '') {
17951
17701
  class BillboardV1SE extends BaseSpotComponent {
17952
17702
  constructor() {
17953
17703
  super();
17954
- Object.defineProperty(this, "resizeObserver", {
17955
- enumerable: true,
17956
- configurable: true,
17957
- writable: true,
17958
- value: void 0
17959
- });
17960
- Object.defineProperty(this, "originalFontSizes", {
17961
- enumerable: true,
17962
- configurable: true,
17963
- writable: true,
17964
- value: new Map()
17965
- });
17704
+ this.originalFontSizes = new Map();
17966
17705
  }
17967
17706
  connected() {
17968
17707
  this.setupResizeObserver();
@@ -19446,24 +19185,9 @@ class RbSmallDiscoverToutSE extends BaseSpotComponent {
19446
19185
  class RbVideoPlayerSE extends BaseSpotComponent {
19447
19186
  constructor() {
19448
19187
  super();
19449
- Object.defineProperty(this, "videoSelector", {
19450
- enumerable: true,
19451
- configurable: true,
19452
- writable: true,
19453
- value: () => `.${this._config.prefix}__video-element`
19454
- });
19455
- Object.defineProperty(this, "muteButtonSelector", {
19456
- enumerable: true,
19457
- configurable: true,
19458
- writable: true,
19459
- value: () => `.${this._config.prefix}__mute-button`
19460
- });
19461
- Object.defineProperty(this, "video", {
19462
- enumerable: true,
19463
- configurable: true,
19464
- writable: true,
19465
- value: null
19466
- });
19188
+ this.videoSelector = () => `.${this._config.prefix}__video-element`;
19189
+ this.muteButtonSelector = () => `.${this._config.prefix}__mute-button`;
19190
+ this.video = null;
19467
19191
  this.bindEventHandlers();
19468
19192
  }
19469
19193
  // Initialization Methods
@@ -19692,18 +19416,6 @@ class RbVideoPlayerSE extends BaseSpotComponent {
19692
19416
 
19693
19417
  class SpotTemplateService {
19694
19418
  constructor() {
19695
- Object.defineProperty(this, "rbTemplates", {
19696
- enumerable: true,
19697
- configurable: true,
19698
- writable: true,
19699
- value: void 0
19700
- });
19701
- Object.defineProperty(this, "iabTemplates", {
19702
- enumerable: true,
19703
- configurable: true,
19704
- writable: true,
19705
- value: void 0
19706
- });
19707
19419
  this.rbTemplates = this.initializeRbTemplates();
19708
19420
  this.iabTemplates = this.initializeIabTemplates();
19709
19421
  }
@@ -19990,69 +19702,34 @@ if (typeof window !== 'undefined' && typeof window.customElements !== 'undefined
19990
19702
  */
19991
19703
  constructor() {
19992
19704
  super();
19993
- /** Public properties that contain carousel configuration and slides */
19994
- Object.defineProperty(this, "data", {
19995
- enumerable: true,
19996
- configurable: true,
19997
- writable: true,
19998
- value: void 0
19999
- });
20000
- Object.defineProperty(this, "slides", {
20001
- enumerable: true,
20002
- configurable: true,
20003
- writable: true,
20004
- value: void 0
20005
- });
20006
- Object.defineProperty(this, "state", {
20007
- enumerable: true,
20008
- configurable: true,
20009
- writable: true,
20010
- value: {
20011
- currentSlide: 0,
20012
- autoplayInterval: null,
20013
- isAutoplayPaused: false,
20014
- useDots: false,
20015
- useButtons: false,
20016
- autoplay: true,
20017
- interval: CustomCarouselElement.defaultConfigs.interval,
20018
- dots: Object.assign({}, CustomCarouselElement.defaultConfigs.dots),
20019
- buttons: Object.assign({}, CustomCarouselElement.defaultConfigs.buttons),
20020
- isDragging: false,
20021
- startX: 0,
20022
- currentX: 0,
20023
- dragStartTime: 0,
20024
- dragDistance: 0,
20025
- containerWidth: 0,
20026
- isTransitioning: false,
20027
- realIndex: 0, // Track the actual slide index
20028
- virtualIndex: 1, // Track the virtual slide position (start at 1 to show clone)
20029
- isVirtualizing: false, // Flag for handling virtual slide transitions
20030
- }
20031
- });
20032
- Object.defineProperty(this, "elements", {
20033
- enumerable: true,
20034
- configurable: true,
20035
- writable: true,
20036
- value: {
20037
- slidesContainer: null,
20038
- dots: [],
20039
- prevButton: null,
20040
- nextButton: null,
20041
- }
20042
- });
20043
- /** Additional services and utilities */
20044
- Object.defineProperty(this, "resizeObserver", {
20045
- enumerable: true,
20046
- configurable: true,
20047
- writable: true,
20048
- value: void 0
20049
- });
20050
- Object.defineProperty(this, "cloneToOriginalMap", {
20051
- enumerable: true,
20052
- configurable: true,
20053
- writable: true,
20054
- value: new WeakMap()
20055
- });
19705
+ this.state = {
19706
+ currentSlide: 0,
19707
+ autoplayInterval: null,
19708
+ isAutoplayPaused: false,
19709
+ useDots: false,
19710
+ useButtons: false,
19711
+ autoplay: true,
19712
+ interval: CustomCarouselElement.defaultConfigs.interval,
19713
+ dots: { ...CustomCarouselElement.defaultConfigs.dots },
19714
+ buttons: { ...CustomCarouselElement.defaultConfigs.buttons },
19715
+ isDragging: false,
19716
+ startX: 0,
19717
+ currentX: 0,
19718
+ dragStartTime: 0,
19719
+ dragDistance: 0,
19720
+ containerWidth: 0,
19721
+ isTransitioning: false,
19722
+ realIndex: 0, // Track the actual slide index
19723
+ virtualIndex: 1, // Track the virtual slide position (start at 1 to show clone)
19724
+ isVirtualizing: false, // Flag for handling virtual slide transitions
19725
+ };
19726
+ this.elements = {
19727
+ slidesContainer: null,
19728
+ dots: [],
19729
+ prevButton: null,
19730
+ nextButton: null,
19731
+ };
19732
+ this.cloneToOriginalMap = new WeakMap();
20056
19733
  this.attachShadow({ mode: 'open' });
20057
19734
  this.handleTransitionEnd = this.handleTransitionEnd.bind(this);
20058
19735
  this.handleTouchStart = this.handleTouchStart.bind(this);
@@ -20110,10 +19787,10 @@ if (typeof window !== 'undefined' && typeof window.customElements !== 'undefined
20110
19787
  this.state.autoplay = (_d = (_c = this.data) === null || _c === void 0 ? void 0 : _c.autoplay) !== null && _d !== void 0 ? _d : true;
20111
19788
  this.state.interval = (_f = (_e = this.data) === null || _e === void 0 ? void 0 : _e.interval) !== null && _f !== void 0 ? _f : CustomCarouselElement.defaultConfigs.interval;
20112
19789
  if (typeof ((_g = this.data) === null || _g === void 0 ? void 0 : _g.useDots) === 'object') {
20113
- this.state.dots = Object.assign(Object.assign({}, this.state.dots), this.data.useDots);
19790
+ this.state.dots = { ...this.state.dots, ...this.data.useDots };
20114
19791
  }
20115
19792
  if (typeof ((_h = this.data) === null || _h === void 0 ? void 0 : _h.useButtons) === 'object') {
20116
- this.state.buttons = Object.assign(Object.assign({}, this.state.buttons), this.data.useButtons);
19793
+ this.state.buttons = { ...this.state.buttons, ...this.data.useButtons };
20117
19794
  }
20118
19795
  this.validateConfiguration();
20119
19796
  }
@@ -20703,50 +20380,40 @@ if (typeof window !== 'undefined' && typeof window.customElements !== 'undefined
20703
20380
  }
20704
20381
  }
20705
20382
  /** Core initialization and lifecycle methods */
20706
- Object.defineProperty(CustomCarouselElement, "defaultConfigs", {
20707
- enumerable: true,
20708
- configurable: true,
20709
- writable: true,
20710
- value: {
20711
- interval: 5000,
20712
- touchThreshold: 50, // minimum swipe distance in pixels
20713
- dragThreshold: 0.2, // minimum drag percentage of carousel width
20714
- dots: {
20715
- position: 'bottom-center',
20716
- color: '#d9d9d9',
20717
- activeColor: '#b5914a',
20718
- size: 'base',
20719
- opacity: 1,
20720
- },
20721
- buttons: {
20722
- together: false,
20723
- position: 'middle-sides',
20724
- textColor: '#000000',
20725
- backgroundColor: '#ffffff',
20726
- borderRadius: '50%',
20727
- prev: 'Prev',
20728
- next: 'Next',
20729
- size: 'base',
20730
- opacity: 1,
20731
- },
20732
- }
20733
- });
20734
- Object.defineProperty(CustomCarouselElement, "validPositions", {
20735
- enumerable: true,
20736
- configurable: true,
20737
- writable: true,
20738
- value: new Set([
20739
- 'top-left',
20740
- 'top-center',
20741
- 'top-right',
20742
- 'bottom-left',
20743
- 'bottom-center',
20744
- 'bottom-right',
20745
- 'middle-left',
20746
- 'middle-right',
20747
- 'middle-sides',
20748
- ])
20749
- });
20383
+ CustomCarouselElement.defaultConfigs = {
20384
+ interval: 5000,
20385
+ touchThreshold: 50, // minimum swipe distance in pixels
20386
+ dragThreshold: 0.2, // minimum drag percentage of carousel width
20387
+ dots: {
20388
+ position: 'bottom-center',
20389
+ color: '#d9d9d9',
20390
+ activeColor: '#b5914a',
20391
+ size: 'base',
20392
+ opacity: 1,
20393
+ },
20394
+ buttons: {
20395
+ together: false,
20396
+ position: 'middle-sides',
20397
+ textColor: '#000000',
20398
+ backgroundColor: '#ffffff',
20399
+ borderRadius: '50%',
20400
+ prev: 'Prev',
20401
+ next: 'Next',
20402
+ size: 'base',
20403
+ opacity: 1,
20404
+ },
20405
+ };
20406
+ CustomCarouselElement.validPositions = new Set([
20407
+ 'top-left',
20408
+ 'top-center',
20409
+ 'top-right',
20410
+ 'bottom-left',
20411
+ 'bottom-center',
20412
+ 'bottom-right',
20413
+ 'middle-left',
20414
+ 'middle-right',
20415
+ 'middle-sides',
20416
+ ]);
20750
20417
  CarouselElement = CustomCarouselElement;
20751
20418
  }
20752
20419
 
@@ -20755,12 +20422,6 @@ if (typeof window !== 'undefined' && typeof window.customElements !== 'undefined
20755
20422
  class CustomSkeletonElement extends HTMLElement {
20756
20423
  constructor() {
20757
20424
  super();
20758
- Object.defineProperty(this, "data", {
20759
- enumerable: true,
20760
- configurable: true,
20761
- writable: true,
20762
- value: void 0
20763
- });
20764
20425
  this.attachShadow({ mode: 'open' });
20765
20426
  }
20766
20427
  connectedCallback() {
@@ -20827,12 +20488,6 @@ if (typeof window !== 'undefined' && typeof window.customElements !== 'undefined
20827
20488
 
20828
20489
  class ElementService {
20829
20490
  constructor() {
20830
- Object.defineProperty(this, "spotTemplateService", {
20831
- enumerable: true,
20832
- configurable: true,
20833
- writable: true,
20834
- value: void 0
20835
- });
20836
20491
  this.spotTemplateService = SpotTemplateService.getInstance();
20837
20492
  this.defineCustomElements();
20838
20493
  }
@@ -20860,7 +20515,10 @@ class ElementService {
20860
20515
  // Define the custom element with the unique class implementation.
20861
20516
  this.defineSpotCustomElement(elementTagName, elementClass);
20862
20517
  const element = document.createElement(elementTagName);
20863
- element.initializeData(params.spot, Object.assign(Object.assign({}, params.config), { prefix: elementId }));
20518
+ element.initializeData(params.spot, {
20519
+ ...params.config,
20520
+ prefix: elementId,
20521
+ });
20864
20522
  return element;
20865
20523
  }
20866
20524
  /**
@@ -20890,7 +20548,11 @@ class ElementService {
20890
20548
  createSkeletonElement(params) {
20891
20549
  const skeleton = document.createElement(SKELETON_ELEMENT_TAG);
20892
20550
  const dimensions = SPOT_DIMENSIONS[params.spotType];
20893
- skeleton.data = Object.assign({ spotType: params.spotType, fluid: (params === null || params === void 0 ? void 0 : params.fluid) === undefined ? false : params.fluid }, dimensions);
20551
+ skeleton.data = {
20552
+ spotType: params.spotType,
20553
+ fluid: (params === null || params === void 0 ? void 0 : params.fluid) === undefined ? false : params.fluid,
20554
+ ...dimensions,
20555
+ };
20894
20556
  return skeleton;
20895
20557
  }
20896
20558
  /**
@@ -20942,18 +20604,6 @@ var AnalyticsTool;
20942
20604
 
20943
20605
  class DataLayerMonitor {
20944
20606
  constructor() {
20945
- Object.defineProperty(this, "originalPush", {
20946
- enumerable: true,
20947
- configurable: true,
20948
- writable: true,
20949
- value: void 0
20950
- });
20951
- Object.defineProperty(this, "listener", {
20952
- enumerable: true,
20953
- configurable: true,
20954
- writable: true,
20955
- value: void 0
20956
- });
20957
20607
  if (!window.dataLayer) {
20958
20608
  return;
20959
20609
  }
@@ -21029,30 +20679,6 @@ class DataLayerMonitor {
21029
20679
  // window.rmnDataLayer = window.rmnDataLayer || [];
21030
20680
  class MonitorService {
21031
20681
  constructor() {
21032
- Object.defineProperty(this, "implementedMonitor", {
21033
- enumerable: true,
21034
- configurable: true,
21035
- writable: true,
21036
- value: void 0
21037
- });
21038
- Object.defineProperty(this, "pubSubService", {
21039
- enumerable: true,
21040
- configurable: true,
21041
- writable: true,
21042
- value: void 0
21043
- });
21044
- Object.defineProperty(this, "localStorageService", {
21045
- enumerable: true,
21046
- configurable: true,
21047
- writable: true,
21048
- value: void 0
21049
- });
21050
- Object.defineProperty(this, "normalizeStringHelper", {
21051
- enumerable: true,
21052
- configurable: true,
21053
- writable: true,
21054
- value: void 0
21055
- });
21056
20682
  const analyticsTool = this.detectAnalyticsTool();
21057
20683
  switch (analyticsTool) {
21058
20684
  case AnalyticsTool.GoogleAnalytics:
@@ -21077,89 +20703,85 @@ class MonitorService {
21077
20703
  start() {
21078
20704
  if (!this.implementedMonitor)
21079
20705
  return;
21080
- this.implementedMonitor.setListener((eventData) => __awaiter(this, void 0, void 0, function* () {
20706
+ this.implementedMonitor.setListener(async (eventData) => {
21081
20707
  var _a;
21082
- yield this.matchAndFireEvent(eventData, (_a = this.localStorageService) === null || _a === void 0 ? void 0 : _a.getSpots());
21083
- }));
20708
+ await this.matchAndFireEvent(eventData, (_a = this.localStorageService) === null || _a === void 0 ? void 0 : _a.getSpots());
20709
+ });
21084
20710
  this.implementedMonitor.start();
21085
20711
  }
21086
- matchAndFireEvent(eventData, spots) {
21087
- return __awaiter(this, void 0, void 0, function* () {
21088
- var _a, _b, _c, _d;
21089
- if (!spots)
21090
- return;
21091
- for (const spot of Object.values(spots)) {
21092
- if (!spot.productIds.length)
20712
+ async matchAndFireEvent(eventData, spots) {
20713
+ var _a, _b, _c, _d;
20714
+ if (!spots)
20715
+ return;
20716
+ for (const spot of Object.values(spots)) {
20717
+ if (!spot.productIds.length)
20718
+ continue;
20719
+ for (const data of eventData.products) {
20720
+ if (!Object.values(RMN_SPOT_EVENT).includes(eventData.event)) {
21093
20721
  continue;
21094
- for (const data of eventData.products) {
21095
- if (!Object.values(RMN_SPOT_EVENT).includes(eventData.event)) {
21096
- continue;
21097
- }
21098
- const firedEvents = spot.firedEvents || [];
21099
- const eventProductId = (_a = this.normalizeStringHelper) === null || _a === void 0 ? void 0 : _a.normalize(String(data.id));
21100
- const isEventAlreadyFired = firedEvents.some((event) => event.productId === eventProductId && event.event === eventData.event);
21101
- if (isEventAlreadyFired) {
21102
- continue;
21103
- }
21104
- const spotRelatedProductIdsSet = new Set(spot.productIds.map((id) => { var _a; return (_a = this.normalizeStringHelper) === null || _a === void 0 ? void 0 : _a.normalize(String(id)); }));
21105
- const eventProductBrand = (_b = this.normalizeStringHelper) === null || _b === void 0 ? void 0 : _b.normalize(String(data.brand));
21106
- const eventVariantBrand = (_c = this.normalizeStringHelper) === null || _c === void 0 ? void 0 : _c.normalize(String(data.variant));
21107
- const isProductMatch = [eventProductId, eventProductBrand, eventVariantBrand].some((id) => spotRelatedProductIdsSet.has(id));
21108
- if (!isProductMatch) {
21109
- continue;
21110
- }
21111
- const eventPosition = spot.events.findIndex((event) => event.event === eventData.event);
21112
- if (eventPosition === -1)
21113
- continue;
21114
- const eventUrl = spot.events[eventPosition].url;
21115
- let additionalQueryParams = '';
21116
- if (eventData.event === RMN_SPOT_EVENT.PURCHASE) {
21117
- const conversionPrice = data.price && data.quantity ? data.price * data.quantity : undefined;
21118
- additionalQueryParams = objectToQueryParams({
21119
- override: conversionPrice,
21120
- gmv: conversionPrice,
21121
- });
21122
- }
21123
- // Fire the event and publish it to the pubsub service
21124
- yield this.fireAndPublishSpotEvent({
21125
- spotEvent: eventData.event,
21126
- eventUrl: `${eventUrl}${additionalQueryParams ? `&${additionalQueryParams}` : ''}`,
21127
- placementId: spot.placementId,
21128
- spotId: spot.spotId,
21129
- spotType: spot.spotType,
21130
- });
21131
- // Add the fired event of the product to spot fired events
21132
- firedEvents.push({
21133
- productId: eventProductId,
21134
- event: eventData.event,
21135
- });
21136
- // Update the spots in the local storage
21137
- (_d = this.localStorageService) === null || _d === void 0 ? void 0 : _d.setSpot(spot.spotId, {
21138
- placementId: spot.placementId,
21139
- spotId: spot.spotId,
21140
- spotType: spot.spotType,
21141
- events: spot.events,
21142
- firedEvents,
21143
- productIds: spot.productIds,
20722
+ }
20723
+ const firedEvents = spot.firedEvents || [];
20724
+ const eventProductId = (_a = this.normalizeStringHelper) === null || _a === void 0 ? void 0 : _a.normalize(String(data.id));
20725
+ const isEventAlreadyFired = firedEvents.some((event) => event.productId === eventProductId && event.event === eventData.event);
20726
+ if (isEventAlreadyFired) {
20727
+ continue;
20728
+ }
20729
+ const spotRelatedProductIdsSet = new Set(spot.productIds.map((id) => { var _a; return (_a = this.normalizeStringHelper) === null || _a === void 0 ? void 0 : _a.normalize(String(id)); }));
20730
+ const eventProductBrand = (_b = this.normalizeStringHelper) === null || _b === void 0 ? void 0 : _b.normalize(String(data.brand));
20731
+ const eventVariantBrand = (_c = this.normalizeStringHelper) === null || _c === void 0 ? void 0 : _c.normalize(String(data.variant));
20732
+ const isProductMatch = [eventProductId, eventProductBrand, eventVariantBrand].some((id) => spotRelatedProductIdsSet.has(id));
20733
+ if (!isProductMatch) {
20734
+ continue;
20735
+ }
20736
+ const eventPosition = spot.events.findIndex((event) => event.event === eventData.event);
20737
+ if (eventPosition === -1)
20738
+ continue;
20739
+ const eventUrl = spot.events[eventPosition].url;
20740
+ let additionalQueryParams = '';
20741
+ if (eventData.event === RMN_SPOT_EVENT.PURCHASE) {
20742
+ const conversionPrice = data.price && data.quantity ? data.price * data.quantity : undefined;
20743
+ additionalQueryParams = objectToQueryParams({
20744
+ override: conversionPrice,
20745
+ gmv: conversionPrice,
21144
20746
  });
21145
20747
  }
20748
+ // Fire the event and publish it to the pubsub service
20749
+ await this.fireAndPublishSpotEvent({
20750
+ spotEvent: eventData.event,
20751
+ eventUrl: `${eventUrl}${additionalQueryParams ? `&${additionalQueryParams}` : ''}`,
20752
+ placementId: spot.placementId,
20753
+ spotId: spot.spotId,
20754
+ spotType: spot.spotType,
20755
+ });
20756
+ // Add the fired event of the product to spot fired events
20757
+ firedEvents.push({
20758
+ productId: eventProductId,
20759
+ event: eventData.event,
20760
+ });
20761
+ // Update the spots in the local storage
20762
+ (_d = this.localStorageService) === null || _d === void 0 ? void 0 : _d.setSpot(spot.spotId, {
20763
+ placementId: spot.placementId,
20764
+ spotId: spot.spotId,
20765
+ spotType: spot.spotType,
20766
+ events: spot.events,
20767
+ firedEvents,
20768
+ productIds: spot.productIds,
20769
+ });
21146
20770
  }
21147
- });
20771
+ }
21148
20772
  }
21149
- fireAndPublishSpotEvent(_a) {
21150
- return __awaiter(this, arguments, void 0, function* ({ spotEvent, eventUrl, placementId, spotId, spotType, }) {
21151
- yield fireEvent({
21152
- spotType,
21153
- event: spotEvent,
21154
- eventUrl,
21155
- });
21156
- if (!this.pubSubService)
21157
- return;
21158
- this.pubSubService.publish(RMN_EVENT.SPOT_EVENT, {
21159
- eventType: spotEvent,
21160
- placementId,
21161
- spotId,
21162
- });
20773
+ async fireAndPublishSpotEvent({ spotEvent, eventUrl, placementId, spotId, spotType, }) {
20774
+ await fireEvent({
20775
+ spotType,
20776
+ event: spotEvent,
20777
+ eventUrl,
20778
+ });
20779
+ if (!this.pubSubService)
20780
+ return;
20781
+ this.pubSubService.publish(RMN_EVENT.SPOT_EVENT, {
20782
+ eventType: spotEvent,
20783
+ placementId,
20784
+ spotId,
21163
20785
  });
21164
20786
  }
21165
20787
  detectAnalyticsTool() {
@@ -21195,22 +20817,20 @@ class SelectionService extends BaseApi {
21195
20817
  *
21196
20818
  * @return {Promise<ISpots | { error: string }>} - The spots response object.
21197
20819
  */
21198
- spotSelection(data) {
21199
- return __awaiter(this, void 0, void 0, function* () {
21200
- if (data.userId === undefined) {
21201
- data.userId = this.getUserId();
21202
- }
21203
- const { isOk, val, isErr } = yield this.post(SELECTION_API_PATH, data, {});
21204
- if (isErr) {
21205
- return { error: `There was an error during spot selection: (${isErr === null || isErr === void 0 ? void 0 : isErr.errorMessage})` };
21206
- }
21207
- if (isOk && val && val.data && (val === null || val === void 0 ? void 0 : val.refresh.token)) {
21208
- this.authInfo.authenticated = true;
21209
- this.authInfo.token = val.refresh.token;
21210
- return val.data.spots;
21211
- }
21212
- return { error: 'Spot selection response was not successful' };
21213
- });
20820
+ async spotSelection(data) {
20821
+ if (data.userId === undefined) {
20822
+ data.userId = this.getUserId();
20823
+ }
20824
+ const { isOk, val, isErr } = await this.post(SELECTION_API_PATH, data, {});
20825
+ if (isErr) {
20826
+ return { error: `There was an error during spot selection: (${isErr === null || isErr === void 0 ? void 0 : isErr.errorMessage})` };
20827
+ }
20828
+ if (isOk && val && val.data && (val === null || val === void 0 ? void 0 : val.refresh.token)) {
20829
+ this.authInfo.authenticated = true;
20830
+ this.authInfo.token = val.refresh.token;
20831
+ return val.data.spots;
20832
+ }
20833
+ return { error: 'Spot selection response was not successful' };
21214
20834
  }
21215
20835
  getUserId() {
21216
20836
  const isWeb = typeof window !== 'undefined';
@@ -21224,24 +20844,6 @@ class SelectionService extends BaseApi {
21224
20844
 
21225
20845
  class SpotManagerService {
21226
20846
  constructor() {
21227
- Object.defineProperty(this, "pubSubService", {
21228
- enumerable: true,
21229
- configurable: true,
21230
- writable: true,
21231
- value: void 0
21232
- });
21233
- Object.defineProperty(this, "localStorageService", {
21234
- enumerable: true,
21235
- configurable: true,
21236
- writable: true,
21237
- value: void 0
21238
- });
21239
- Object.defineProperty(this, "spotLifecyleState", {
21240
- enumerable: true,
21241
- configurable: true,
21242
- writable: true,
21243
- value: void 0
21244
- });
21245
20847
  this.pubSubService = PubsubService.getInstance();
21246
20848
  this.localStorageService = LocalStorageService.getInstance();
21247
20849
  this.spotLifecyleState = new Map();
@@ -21260,11 +20862,11 @@ class SpotManagerService {
21260
20862
  // Handle Impression Event
21261
20863
  this.handleImpressionEvent(placementId, spot);
21262
20864
  // Handle Click Event
21263
- spotElement.addEventListener('click', () => __awaiter(this, void 0, void 0, function* () {
21264
- yield this.handleClickEvent(params);
20865
+ spotElement.addEventListener('click', async () => {
20866
+ await this.handleClickEvent(params);
21265
20867
  // Save spot to local storage for event tracking
21266
20868
  this.saveSpotDataToLocalStorage(placementId, spot);
21267
- }));
20869
+ });
21268
20870
  }
21269
20871
  unregisterSpot(rawPlacementId) {
21270
20872
  const placementId = rawPlacementId.replace('#', '');
@@ -21341,19 +20943,17 @@ class SpotManagerService {
21341
20943
  productIds: (_a = spot.productIds) !== null && _a !== void 0 ? _a : [],
21342
20944
  });
21343
20945
  }
21344
- handleClickEvent(_a) {
21345
- return __awaiter(this, arguments, void 0, function* ({ placementId, spot }) {
21346
- var _b, _c;
21347
- this.pubSubService.publish(RMN_EVENT.SPOT_EVENT, {
21348
- eventType: RMN_SPOT_EVENT.CLICK,
21349
- placementId,
21350
- spotId: spot.id,
21351
- });
21352
- yield fireEvent({
21353
- spotType: spot.spot,
21354
- event: RMN_SPOT_EVENT.CLICK,
21355
- eventUrl: (_c = (_b = spot.events.find((event) => event.event === RMN_SPOT_EVENT.CLICK)) === null || _b === void 0 ? void 0 : _b.url) !== null && _c !== void 0 ? _c : '',
21356
- });
20946
+ async handleClickEvent({ placementId, spot }) {
20947
+ var _a, _b;
20948
+ this.pubSubService.publish(RMN_EVENT.SPOT_EVENT, {
20949
+ eventType: RMN_SPOT_EVENT.CLICK,
20950
+ placementId,
20951
+ spotId: spot.id,
20952
+ });
20953
+ await fireEvent({
20954
+ spotType: spot.spot,
20955
+ event: RMN_SPOT_EVENT.CLICK,
20956
+ eventUrl: (_b = (_a = spot.events.find((event) => event.event === RMN_SPOT_EVENT.CLICK)) === null || _a === void 0 ? void 0 : _a.url) !== null && _b !== void 0 ? _b : '',
21357
20957
  });
21358
20958
  }
21359
20959
  handleImpressionEvent(placementId, spot) {
@@ -21362,23 +20962,25 @@ class SpotManagerService {
21362
20962
  placementId,
21363
20963
  spotId: spot.id,
21364
20964
  });
21365
- (() => __awaiter(this, void 0, void 0, function* () {
20965
+ (async () => {
21366
20966
  var _a, _b;
21367
- yield fireEvent({
20967
+ await fireEvent({
21368
20968
  spotType: spot.spot,
21369
20969
  event: RMN_SPOT_EVENT.IMPRESSION,
21370
20970
  eventUrl: (_b = (_a = spot.events.find((event) => event.event === RMN_SPOT_EVENT.IMPRESSION)) === null || _a === void 0 ? void 0 : _a.url) !== null && _b !== void 0 ? _b : '',
21371
20971
  });
21372
- }))();
20972
+ })();
21373
20973
  }
21374
20974
  deepMerge(current, updates) {
21375
20975
  return {
21376
20976
  identifier: updates.identifier
21377
- ? Object.assign(Object.assign({}, current.identifier), updates.identifier) : current.identifier,
21378
- dom: updates.dom ? Object.assign(Object.assign({}, current.dom), updates.dom) : current.dom,
21379
- state: updates.state ? Object.assign(Object.assign({}, current.state), updates.state) : current.state,
20977
+ ? { ...current.identifier, ...updates.identifier }
20978
+ : current.identifier,
20979
+ dom: updates.dom ? { ...current.dom, ...updates.dom } : current.dom,
20980
+ state: updates.state ? { ...current.state, ...updates.state } : current.state,
21380
20981
  displayConfig: updates.displayConfig
21381
- ? Object.assign(Object.assign({}, current.displayConfig), updates.displayConfig) : current.displayConfig,
20982
+ ? { ...current.displayConfig, ...updates.displayConfig }
20983
+ : current.displayConfig,
21382
20984
  };
21383
20985
  }
21384
20986
  }
@@ -21472,7 +21074,13 @@ function overrideSpotColors(spot, colors) {
21472
21074
  if (!colors)
21473
21075
  return spot;
21474
21076
  const { textColor, backgroundColor, ctaTextColor, ctaBorderColor } = colors;
21475
- return Object.assign(Object.assign({}, spot), { textColor: textColor !== null && textColor !== void 0 ? textColor : spot.textColor, backgroundColor: backgroundColor !== null && backgroundColor !== void 0 ? backgroundColor : spot.backgroundColor, ctaTextColor: ctaTextColor !== null && ctaTextColor !== void 0 ? ctaTextColor : spot.ctaTextColor, ctaBorderColor: ctaBorderColor !== null && ctaBorderColor !== void 0 ? ctaBorderColor : spot.ctaBorderColor });
21077
+ return {
21078
+ ...spot,
21079
+ textColor: textColor !== null && textColor !== void 0 ? textColor : spot.textColor,
21080
+ backgroundColor: backgroundColor !== null && backgroundColor !== void 0 ? backgroundColor : spot.backgroundColor,
21081
+ ctaTextColor: ctaTextColor !== null && ctaTextColor !== void 0 ? ctaTextColor : spot.ctaTextColor,
21082
+ ctaBorderColor: ctaBorderColor !== null && ctaBorderColor !== void 0 ? ctaBorderColor : spot.ctaBorderColor,
21083
+ };
21476
21084
  }
21477
21085
  // Sets the id for the user who is browsing the website
21478
21086
  // This id is used to identify the user and provide personalized content
@@ -21491,24 +21099,6 @@ function setUserId() {
21491
21099
  */
21492
21100
  class BrowserRmnClient {
21493
21101
  constructor(auth) {
21494
- Object.defineProperty(this, "selectionService", {
21495
- enumerable: true,
21496
- configurable: true,
21497
- writable: true,
21498
- value: void 0
21499
- });
21500
- Object.defineProperty(this, "elementService", {
21501
- enumerable: true,
21502
- configurable: true,
21503
- writable: true,
21504
- value: void 0
21505
- });
21506
- Object.defineProperty(this, "spotManagerService", {
21507
- enumerable: true,
21508
- configurable: true,
21509
- writable: true,
21510
- value: void 0
21511
- });
21512
21102
  this.selectionService = SelectionService.getInstance(auth);
21513
21103
  this.elementService = ElementService.getInstance();
21514
21104
  this.spotManagerService = SpotManagerService.getInstance();
@@ -21524,10 +21114,8 @@ class BrowserRmnClient {
21524
21114
  *
21525
21115
  * @return {Promise<ISpots | { error : string }>} - The spots response object.
21526
21116
  */
21527
- spotSelection(params) {
21528
- return __awaiter(this, void 0, void 0, function* () {
21529
- return this.selectionService.spotSelection(params);
21530
- });
21117
+ async spotSelection(params) {
21118
+ return this.selectionService.spotSelection(params);
21531
21119
  }
21532
21120
  /**
21533
21121
  * Publishes the spot data for a given placement ID to the RMN.
@@ -21546,33 +21134,31 @@ class BrowserRmnClient {
21546
21134
  *
21547
21135
  * @return {Promise<void>} - A promise that resolves when the spot elements are injected.
21548
21136
  */
21549
- injectSpotElement(params) {
21550
- return __awaiter(this, void 0, void 0, function* () {
21551
- // Handle no spots error state
21552
- if (!params.inject.length) {
21553
- this.spotManagerService.updateSpotLifecycleState('all', {
21554
- state: {
21555
- error: 'No spot elements provided for injection.',
21556
- },
21557
- });
21558
- return;
21559
- }
21560
- // Validate inject data
21561
- params.inject = validateInjectData(params.inject);
21562
- const placementIds = params.inject.map((item) => item.placementId);
21563
- new ProximityObserver(placementIds, (intersectingPlacementIds) => __awaiter(this, void 0, void 0, function* () {
21564
- /**
21565
- * Called when elements are within range
21566
- *
21567
- * intersectingPlacementIds includes:
21568
- * 1. The element that came within 2000px
21569
- * 2. Any unprocessed elements within 500px of that element
21570
- */
21571
- yield this.processPlacements(params, intersectingPlacementIds);
21572
- }), {
21573
- proximityThreshold: 500,
21574
- intersectionMargin: '2000px',
21137
+ async injectSpotElement(params) {
21138
+ // Handle no spots error state
21139
+ if (!params.inject.length) {
21140
+ this.spotManagerService.updateSpotLifecycleState('all', {
21141
+ state: {
21142
+ error: 'No spot elements provided for injection.',
21143
+ },
21575
21144
  });
21145
+ return;
21146
+ }
21147
+ // Validate inject data
21148
+ params.inject = validateInjectData(params.inject);
21149
+ const placementIds = params.inject.map((item) => item.placementId);
21150
+ new ProximityObserver(placementIds, async (intersectingPlacementIds) => {
21151
+ /**
21152
+ * Called when elements are within range
21153
+ *
21154
+ * intersectingPlacementIds includes:
21155
+ * 1. The element that came within 2000px
21156
+ * 2. Any unprocessed elements within 500px of that element
21157
+ */
21158
+ await this.processPlacements(params, intersectingPlacementIds);
21159
+ }, {
21160
+ proximityThreshold: 500,
21161
+ intersectionMargin: '2000px',
21576
21162
  });
21577
21163
  }
21578
21164
  /**
@@ -21583,104 +21169,105 @@ class BrowserRmnClient {
21583
21169
  *
21584
21170
  * @return {Promise<void>} - A promise that resolves when the spot elements are injected.
21585
21171
  */
21586
- processPlacements(params, placementIds) {
21587
- return __awaiter(this, void 0, void 0, function* () {
21588
- var _a, _b;
21589
- const globalConfig = params.config;
21590
- const injectMap = new Map(params.inject.map((item) => [item.placementId, item]));
21591
- const validPlacements = new Map();
21592
- for (const placementId of placementIds) {
21593
- const placement = document.getElementById(placementId);
21594
- const injectData = injectMap.get(placementId);
21595
- // Handle invalid placement scenarios
21596
- if (!placement || !injectData) {
21597
- this.spotManagerService.updateSpotLifecycleState(placementId, {
21598
- state: {
21599
- error: !placement
21600
- ? `Placement element not found for id "${placementId}".`
21601
- : `Placement not found for id "${placementId}".`,
21602
- mounted: false,
21603
- loading: false,
21604
- },
21605
- });
21606
- continue;
21607
- }
21608
- // Identify the spot element
21609
- this.spotManagerService.updateSpotLifecycleState(injectData.placementId, {
21610
- identifier: {
21611
- placementId: injectData.placementId,
21612
- spotType: injectData.spotType,
21172
+ async processPlacements(params, placementIds) {
21173
+ var _a, _b;
21174
+ const globalConfig = params.config;
21175
+ const injectMap = new Map(params.inject.map((item) => [item.placementId, item]));
21176
+ const validPlacements = new Map();
21177
+ for (const placementId of placementIds) {
21178
+ const placement = document.getElementById(placementId);
21179
+ const injectData = injectMap.get(placementId);
21180
+ // Handle invalid placement scenarios
21181
+ if (!placement || !injectData) {
21182
+ this.spotManagerService.updateSpotLifecycleState(placementId, {
21183
+ state: {
21184
+ error: !placement
21185
+ ? `Placement element not found for id "${placementId}".`
21186
+ : `Placement not found for id "${placementId}".`,
21187
+ mounted: false,
21188
+ loading: false,
21613
21189
  },
21614
- }, false);
21615
- prepareSpotPlacement(placement);
21616
- const skeletonElement = this.elementService.createSkeletonElement({
21617
- fluid: (_b = (_a = injectData === null || injectData === void 0 ? void 0 : injectData.config) === null || _a === void 0 ? void 0 : _a.fluid) !== null && _b !== void 0 ? _b : globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.fluid,
21618
- spotType: injectData.spotType,
21619
21190
  });
21620
- if (!skeletonElement) {
21621
- this.spotManagerService.updateSpotLifecycleState(injectData.placementId, {
21622
- state: {
21623
- error: `Failed to create skeleton loader element.`,
21624
- loading: true,
21625
- },
21626
- });
21627
- }
21628
- if (skeletonElement) {
21629
- placement.replaceChildren(skeletonElement);
21630
- }
21631
- validPlacements.set(placementId, placement);
21191
+ continue;
21192
+ }
21193
+ // Identify the spot element
21194
+ this.spotManagerService.updateSpotLifecycleState(injectData.placementId, {
21195
+ identifier: {
21196
+ placementId: injectData.placementId,
21197
+ spotType: injectData.spotType,
21198
+ },
21199
+ }, false);
21200
+ prepareSpotPlacement(placement);
21201
+ const skeletonElement = this.elementService.createSkeletonElement({
21202
+ fluid: (_b = (_a = injectData === null || injectData === void 0 ? void 0 : injectData.config) === null || _a === void 0 ? void 0 : _a.fluid) !== null && _b !== void 0 ? _b : globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.fluid,
21203
+ spotType: injectData.spotType,
21204
+ });
21205
+ if (!skeletonElement) {
21632
21206
  this.spotManagerService.updateSpotLifecycleState(injectData.placementId, {
21633
- state: { loading: true },
21207
+ state: {
21208
+ error: `Failed to create skeleton loader element.`,
21209
+ loading: true,
21210
+ },
21634
21211
  });
21635
21212
  }
21636
- // If no valid placements were found, return early
21637
- if (validPlacements.size === 0) {
21638
- return;
21213
+ if (skeletonElement) {
21214
+ placement.replaceChildren(skeletonElement);
21639
21215
  }
21640
- // Make the spot selection request only for valid placements
21641
- const validInjectPlacements = Array.from(validPlacements.keys())
21642
- .map((id) => injectMap.get(id))
21643
- .filter(Boolean);
21644
- // Make the spot selection request
21645
- const response = yield this.injectSpotSelectionRequest(Object.assign(Object.assign({}, params), { inject: validInjectPlacements }));
21646
- // Handle request error state
21647
- if (typeof response === 'object' && 'error' in response) {
21648
- this.spotManagerService.updateSpotLifecycleState('all', {
21216
+ validPlacements.set(placementId, placement);
21217
+ this.spotManagerService.updateSpotLifecycleState(injectData.placementId, {
21218
+ state: { loading: true },
21219
+ });
21220
+ }
21221
+ // If no valid placements were found, return early
21222
+ if (validPlacements.size === 0) {
21223
+ return;
21224
+ }
21225
+ // Make the spot selection request only for valid placements
21226
+ const validInjectPlacements = Array.from(validPlacements.keys())
21227
+ .map((id) => injectMap.get(id))
21228
+ .filter(Boolean);
21229
+ // Make the spot selection request
21230
+ const response = await this.injectSpotSelectionRequest({
21231
+ ...params,
21232
+ inject: validInjectPlacements,
21233
+ });
21234
+ // Handle request error state
21235
+ if (typeof response === 'object' && 'error' in response) {
21236
+ this.spotManagerService.updateSpotLifecycleState('all', {
21237
+ state: {
21238
+ error: response.error,
21239
+ mounted: false,
21240
+ loading: false,
21241
+ },
21242
+ });
21243
+ validPlacements.forEach((_, id) => clearPlacement(id));
21244
+ return;
21245
+ }
21246
+ // Process spots for valid placements
21247
+ validPlacements.forEach((placement, placementId) => {
21248
+ var _a;
21249
+ const injectData = injectMap.get(placementId);
21250
+ const itemConfig = (_a = injectData === null || injectData === void 0 ? void 0 : injectData.config) !== null && _a !== void 0 ? _a : globalConfig;
21251
+ const spots = response[placementId];
21252
+ if (!(spots === null || spots === void 0 ? void 0 : spots.length)) {
21253
+ this.spotManagerService.updateSpotLifecycleState(injectData.placementId, {
21649
21254
  state: {
21650
- error: response.error,
21255
+ error: `No spots found for type "${injectData.spotType}".`,
21651
21256
  mounted: false,
21652
21257
  loading: false,
21653
21258
  },
21654
21259
  });
21655
- validPlacements.forEach((_, id) => clearPlacement(id));
21260
+ clearPlacement(injectData.placementId);
21656
21261
  return;
21657
21262
  }
21658
- // Process spots for valid placements
21659
- validPlacements.forEach((placement, placementId) => {
21660
- var _a;
21661
- const injectData = injectMap.get(placementId);
21662
- const itemConfig = (_a = injectData === null || injectData === void 0 ? void 0 : injectData.config) !== null && _a !== void 0 ? _a : globalConfig;
21663
- const spots = response[placementId];
21664
- if (!(spots === null || spots === void 0 ? void 0 : spots.length)) {
21665
- this.spotManagerService.updateSpotLifecycleState(injectData.placementId, {
21666
- state: {
21667
- error: `No spots found for type "${injectData.spotType}".`,
21668
- mounted: false,
21669
- loading: false,
21670
- },
21671
- });
21672
- clearPlacement(injectData.placementId);
21673
- return;
21674
- }
21675
- // Handle single spot
21676
- if (spots.length === 1) {
21677
- this.injectOneSpotElement(placement, spots[0], itemConfig);
21678
- }
21679
- // Handle multiple spots (carousel)
21680
- if (spots.length > 1) {
21681
- this.injectCarouselSpotElement(placement, spots, itemConfig);
21682
- }
21683
- });
21263
+ // Handle single spot
21264
+ if (spots.length === 1) {
21265
+ this.injectOneSpotElement(placement, spots[0], itemConfig);
21266
+ }
21267
+ // Handle multiple spots (carousel)
21268
+ if (spots.length > 1) {
21269
+ this.injectCarouselSpotElement(placement, spots, itemConfig);
21270
+ }
21684
21271
  });
21685
21272
  }
21686
21273
  /**
@@ -21807,7 +21394,13 @@ class BrowserRmnClient {
21807
21394
  // Create the carousel element
21808
21395
  const carouselElement = this.elementService.createCarouselElement({
21809
21396
  slides: carouselSlides,
21810
- config: Object.assign({ fluid: config === null || config === void 0 ? void 0 : config.fluid, width: maxWidth, height: maxHeight, minScale: (_a = config === null || config === void 0 ? void 0 : config.minScale) !== null && _a !== void 0 ? _a : 0.25 }, config === null || config === void 0 ? void 0 : config.carousel),
21397
+ config: {
21398
+ fluid: config === null || config === void 0 ? void 0 : config.fluid,
21399
+ width: maxWidth,
21400
+ height: maxHeight,
21401
+ minScale: (_a = config === null || config === void 0 ? void 0 : config.minScale) !== null && _a !== void 0 ? _a : 0.25, // Scale down to 25% of the original size
21402
+ ...config === null || config === void 0 ? void 0 : config.carousel,
21403
+ },
21811
21404
  });
21812
21405
  if (!carouselElement) {
21813
21406
  this.spotManagerService.updateSpotLifecycleState(placementId, {
@@ -21840,17 +21433,20 @@ class BrowserRmnClient {
21840
21433
  *
21841
21434
  * @return {Promise<ISpots | {error: string}>} - The spots response object.
21842
21435
  */
21843
- injectSpotSelectionRequest(params) {
21844
- return __awaiter(this, void 0, void 0, function* () {
21845
- const { inject, filter, config } = params;
21846
- const spots = inject.map((item) => (Object.assign({ placementId: item.placementId, spot: item.spotType, count: item === null || item === void 0 ? void 0 : item.count }, item === null || item === void 0 ? void 0 : item.filter)));
21847
- const request = {
21848
- url: config === null || config === void 0 ? void 0 : config.url,
21849
- filter,
21850
- spots,
21851
- };
21852
- return this.spotSelection(request);
21853
- });
21436
+ async injectSpotSelectionRequest(params) {
21437
+ const { inject, filter, config } = params;
21438
+ const spots = inject.map((item) => ({
21439
+ placementId: item.placementId,
21440
+ spot: item.spotType,
21441
+ count: item === null || item === void 0 ? void 0 : item.count,
21442
+ ...item === null || item === void 0 ? void 0 : item.filter,
21443
+ }));
21444
+ const request = {
21445
+ url: config === null || config === void 0 ? void 0 : config.url,
21446
+ filter,
21447
+ spots,
21448
+ };
21449
+ return this.spotSelection(request);
21854
21450
  }
21855
21451
  }
21856
21452
  /**
@@ -21861,12 +21457,6 @@ class BrowserRmnClient {
21861
21457
  */
21862
21458
  class ServerRmnClient {
21863
21459
  constructor(auth) {
21864
- Object.defineProperty(this, "selectionService", {
21865
- enumerable: true,
21866
- configurable: true,
21867
- writable: true,
21868
- value: void 0
21869
- });
21870
21460
  this.selectionService = SelectionService.getInstance(auth);
21871
21461
  }
21872
21462
  /**
@@ -21878,10 +21468,8 @@ class ServerRmnClient {
21878
21468
  *
21879
21469
  * @return {Promise<ISpots | { error : string }>} - The spots response object.
21880
21470
  */
21881
- spotSelection(params) {
21882
- return __awaiter(this, void 0, void 0, function* () {
21883
- return this.selectionService.spotSelection(params);
21884
- });
21471
+ async spotSelection(params) {
21472
+ return this.selectionService.spotSelection(params);
21885
21473
  }
21886
21474
  /**
21887
21475
  * Publishes the spot data for a given placement ID to the RMN.
@@ -21902,10 +21490,8 @@ class ServerRmnClient {
21902
21490
  * @return {Promise<void>} - A promise that resolves when the spot elements are injected.
21903
21491
  */
21904
21492
  // eslint-disable-next-line @typescript-eslint/no-unused-vars,no-unused-vars
21905
- injectSpotElement(params) {
21906
- return __awaiter(this, void 0, void 0, function* () {
21907
- console.warn('RmnSdk: Injecting spot elements is not supported in server-side environment.');
21908
- });
21493
+ async injectSpotElement(params) {
21494
+ console.warn('RmnSdk: Injecting spot elements is not supported in server-side environment.');
21909
21495
  }
21910
21496
  }
21911
21497
  /**
@@ -21919,34 +21505,32 @@ class ServerRmnClient {
21919
21505
  *
21920
21506
  * @return {Promise<Partial<IRmnClient>>} - The appropriate RmnClient instance.
21921
21507
  */
21922
- function RmnClient(apiKey, config) {
21923
- return __awaiter(this, void 0, void 0, function* () {
21924
- const initializeServerClient = () => __awaiter(this, void 0, void 0, function* () {
21925
- const authService = AuthService.getInstance(apiKey, config.env);
21926
- const credentials = yield authService.initialize();
21927
- return new ServerRmnClient(credentials);
21928
- });
21929
- const initializeBrowserClient = () => __awaiter(this, void 0, void 0, function* () {
21930
- const authService = AuthService.getInstance(apiKey, config.env);
21931
- const credentials = yield authService.initialize();
21932
- setUserId();
21933
- return new BrowserRmnClient(credentials);
21934
- });
21935
- // For non-browser environment, initialize the server client
21936
- if (typeof window === 'undefined') {
21937
- return initializeServerClient();
21508
+ async function RmnClient(apiKey, config) {
21509
+ const initializeServerClient = async () => {
21510
+ const authService = AuthService.getInstance(apiKey, config.env);
21511
+ const credentials = await authService.initialize();
21512
+ return new ServerRmnClient(credentials);
21513
+ };
21514
+ const initializeBrowserClient = async () => {
21515
+ const authService = AuthService.getInstance(apiKey, config.env);
21516
+ const credentials = await authService.initialize();
21517
+ setUserId();
21518
+ return new BrowserRmnClient(credentials);
21519
+ };
21520
+ // For non-browser environment, initialize the server client
21521
+ if (typeof window === 'undefined') {
21522
+ return initializeServerClient();
21523
+ }
21524
+ // For browser environment, ensure the page is fully loaded before initializing the client
21525
+ return new Promise((resolve) => {
21526
+ if (document.readyState === 'complete') {
21527
+ resolve(initializeBrowserClient());
21938
21528
  }
21939
- // For browser environment, ensure the page is fully loaded before initializing the client
21940
- return new Promise((resolve) => {
21941
- if (document.readyState === 'complete') {
21529
+ else {
21530
+ window.addEventListener('load', () => {
21942
21531
  resolve(initializeBrowserClient());
21943
- }
21944
- else {
21945
- window.addEventListener('load', () => {
21946
- resolve(initializeBrowserClient());
21947
- });
21948
- }
21949
- });
21532
+ });
21533
+ }
21950
21534
  });
21951
21535
  }
21952
21536
  /**