@liquidcommercedev/rmn-sdk 1.5.0-beta.13 → 1.5.0-beta.15

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.cjs CHANGED
@@ -16145,6 +16145,7 @@ class AuthService extends BaseApi {
16145
16145
 
16146
16146
  const SPOT_ELEMENT_TAG = 'spot-element';
16147
16147
  const CAROUSEL_ELEMENT_TAG = 'spot-carousel-element';
16148
+ const SKELETON_ELEMENT_TAG = 'spot-skeleton-element';
16148
16149
  const GFONT_PRECONNECT = `
16149
16150
  <link rel="preconnect" href="https://fonts.googleapis.com">
16150
16151
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
@@ -16155,6 +16156,45 @@ const GFONT_SOURCE_SANS_3 = `
16155
16156
  const GFONT_CORMORANT = `
16156
16157
  <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Cormorant:ital,wght@0,300..700;1,300..700&family=Source+Sans+3:ital,wght@0,200..900;1,200..900&display=swap">
16157
16158
  `;
16159
+ const SPOT_DIMENSIONS = {
16160
+ [exports.RMN_SPOT_TYPE.RB_HOMEPAGE_HERO]: { width: 1140, height: 640 },
16161
+ [exports.RMN_SPOT_TYPE.RB_HOMEPAGE_HERO_THREE_TILE]: { width: 1140, height: 640 },
16162
+ [exports.RMN_SPOT_TYPE.RB_HOMEPAGE_HERO_TWO_TILE]: { width: 1140, height: 640 },
16163
+ [exports.RMN_SPOT_TYPE.RB_HOMEPAGE_HERO_FULL_IMAGE]: { width: 1140, height: 640 },
16164
+ [exports.RMN_SPOT_TYPE.RB_LARGE_CATEGORY_IMAGE_TOUT]: { width: 468, height: 410 },
16165
+ [exports.RMN_SPOT_TYPE.RB_SMALL_DISCOVER_TOUT]: { width: 224, height: 378 },
16166
+ [exports.RMN_SPOT_TYPE.RB_SMALL_CATEGORY_IMAGE_TOUT]: { width: 224, height: 410 },
16167
+ [exports.RMN_SPOT_TYPE.RB_COLLECTION_BANNER_WITHOUT_TEXT_BLOCK]: { width: 887, height: 344 },
16168
+ [exports.RMN_SPOT_TYPE.RB_PRODUCT_UPCS]: { width: 1, height: 1 },
16169
+ [exports.RMN_SPOT_TYPE.RB_NAVIGATION_BANNER]: { width: 440, height: 220 },
16170
+ [exports.RMN_SPOT_TYPE.SMALL_RECTANGLE]: { width: 180, height: 150 },
16171
+ [exports.RMN_SPOT_TYPE.MEDIUM_RECTANGLE]: { width: 300, height: 250 },
16172
+ [exports.RMN_SPOT_TYPE.LARGE_RECTANGLE]: { width: 336, height: 280 },
16173
+ [exports.RMN_SPOT_TYPE.VERTICAL_RECTANGLE]: { width: 240, height: 400 },
16174
+ [exports.RMN_SPOT_TYPE.BANNER]: { width: 468, height: 60 },
16175
+ [exports.RMN_SPOT_TYPE.LEADERBOARD]: { width: 728, height: 90 },
16176
+ [exports.RMN_SPOT_TYPE.LARGE_LEADERBOARD]: { width: 970, height: 90 },
16177
+ [exports.RMN_SPOT_TYPE.BILLBOARD]: { width: 970, height: 250 },
16178
+ [exports.RMN_SPOT_TYPE.SKYSCRAPER]: { width: 120, height: 600 },
16179
+ [exports.RMN_SPOT_TYPE.WIDE_SKYSCRAPER]: { width: 160, height: 600 },
16180
+ [exports.RMN_SPOT_TYPE.HALF_PAGE]: { width: 300, height: 600 },
16181
+ [exports.RMN_SPOT_TYPE.SMALL_SQUARE]: { width: 200, height: 200 },
16182
+ [exports.RMN_SPOT_TYPE.SQUARE]: { width: 250, height: 250 },
16183
+ [exports.RMN_SPOT_TYPE.VERTICAL_BANNER]: { width: 120, height: 240 },
16184
+ [exports.RMN_SPOT_TYPE.BUTTON_2]: { width: 120, height: 60 },
16185
+ [exports.RMN_SPOT_TYPE.MICRO_BAR]: { width: 88, height: 31 },
16186
+ [exports.RMN_SPOT_TYPE.POP_UP]: { width: 550, height: 480 },
16187
+ [exports.RMN_SPOT_TYPE.PORTRAIT]: { width: 300, height: 1050 },
16188
+ [exports.RMN_SPOT_TYPE.SMARTPHONE_BANNER_1]: { width: 300, height: 50 },
16189
+ [exports.RMN_SPOT_TYPE.SMARTPHONE_BANNER_2]: { width: 320, height: 50 },
16190
+ [exports.RMN_SPOT_TYPE.MOBILE_PHONE_INTERSTITIAL_1]: { width: 640, height: 1136 },
16191
+ [exports.RMN_SPOT_TYPE.MOBILE_PHONE_INTERSTITIAL_2]: { width: 750, height: 1334 },
16192
+ [exports.RMN_SPOT_TYPE.MOBILE_PHONE_INTERSTITIAL_3]: { width: 1080, height: 1920 },
16193
+ [exports.RMN_SPOT_TYPE.FEATURE_PHONE_SMALL_BANNER]: { width: 120, height: 20 },
16194
+ [exports.RMN_SPOT_TYPE.FEATURE_PHONE_MEDIUM_BANNER]: { width: 168, height: 28 },
16195
+ [exports.RMN_SPOT_TYPE.FEATURE_PHONE_LARGE_BANNER]: { width: 216, height: 36 },
16196
+ [exports.RMN_SPOT_TYPE.IN_TEXT]: { width: 1, height: 1 },
16197
+ };
16158
16198
 
16159
16199
  class IntersectionObserverService {
16160
16200
  constructor(defaultOptions = {}) {
@@ -16993,6 +17033,118 @@ if (typeof window !== 'undefined' && typeof window.customElements !== 'undefined
16993
17033
  CarouselElement = CustomCarouselElement;
16994
17034
  }
16995
17035
 
17036
+ function SkeletonTemplate({ fluid, width, height }) {
17037
+ return `
17038
+ <style>
17039
+ :host {
17040
+ display: block;
17041
+ position: relative;
17042
+ box-sizing: border-box;
17043
+ overflow: hidden;
17044
+ width: ${fluid ? '100%' : `${width}px`};
17045
+ height: ${fluid ? '100%' : `${height}px`};
17046
+ background: #ffffff;
17047
+ padding: 20px;
17048
+ border-radius: 5px;
17049
+ }
17050
+
17051
+ .content {
17052
+ height: 100%;
17053
+ display: flex;
17054
+ flex-direction: column;
17055
+ gap: 20px;
17056
+ }
17057
+
17058
+ .image-placeholder {
17059
+ width: 100%;
17060
+ height: 100%;
17061
+ background: #f0f0f0;
17062
+ border-radius: 4px;
17063
+ position: relative;
17064
+ overflow: hidden;
17065
+ }
17066
+
17067
+ .lines-container {
17068
+ display: flex;
17069
+ flex-direction: column;
17070
+ justify-content: flex-end;
17071
+ }
17072
+
17073
+ .line {
17074
+ height: 20px;
17075
+ background: #f0f0f0;
17076
+ border-radius: 4px;
17077
+ margin-bottom: 15px;
17078
+ position: relative;
17079
+ overflow: hidden;
17080
+ }
17081
+
17082
+ .image-placeholder::after,
17083
+ .line::after {
17084
+ content: "";
17085
+ position: absolute;
17086
+ top: 0;
17087
+ left: 0;
17088
+ width: 100%;
17089
+ height: 100%;
17090
+ background: linear-gradient(
17091
+ 90deg,
17092
+ rgba(255, 255, 255, 0) 0%,
17093
+ rgba(255, 255, 255, 0.5) 50%,
17094
+ rgba(255, 255, 255, 0) 100%
17095
+ );
17096
+ animation: shimmer 1.5s infinite;
17097
+ }
17098
+
17099
+ .line.header {
17100
+ width: 25%;
17101
+ }
17102
+
17103
+ .line.description {
17104
+ width: 65%;
17105
+ }
17106
+
17107
+ .line.button {
17108
+ width: 40%;
17109
+ }
17110
+
17111
+ @keyframes shimmer {
17112
+ 0% {
17113
+ transform: translateX(-100%);
17114
+ }
17115
+ 100% {
17116
+ transform: translateX(100%);
17117
+ }
17118
+ }
17119
+ </style>
17120
+
17121
+ <div class="content">
17122
+ <div class="image-placeholder"></div>
17123
+ <div class="lines-container">
17124
+ <div class="line header"></div>
17125
+ <div class="line description"></div>
17126
+ <div class="line button"></div>
17127
+ </div>
17128
+ </div>
17129
+ `;
17130
+ }
17131
+
17132
+ let SkeletonElement;
17133
+ if (typeof window !== 'undefined' && typeof window.customElements !== 'undefined') {
17134
+ class CustomSkeletonElement extends HTMLElement {
17135
+ constructor() {
17136
+ super();
17137
+ this.attachShadow({ mode: 'open' });
17138
+ }
17139
+ connectedCallback() {
17140
+ if (!this.shadowRoot || !this.data)
17141
+ return;
17142
+ this.shadowRoot.innerHTML = SkeletonTemplate(this.data);
17143
+ }
17144
+ }
17145
+ SkeletonElement = CustomSkeletonElement;
17146
+ }
17147
+
16996
17148
  let SpotElement;
16997
17149
  if (typeof window !== 'undefined' && typeof window.customElements !== 'undefined') {
16998
17150
  class CustomSpotElement extends HTMLElement {
@@ -17100,15 +17252,14 @@ class ElementService {
17100
17252
  * @return {HTMLElement | null} - The html element or null if the browser environment is not available.
17101
17253
  */
17102
17254
  createSpotElement({ content, config }) {
17103
- var _a, _b;
17255
+ var _a;
17104
17256
  if (!this.ensureBrowserEnvironmentAndDefineElement()) {
17105
17257
  return null;
17106
17258
  }
17107
17259
  const spot = document.createElement(SPOT_ELEMENT_TAG);
17108
- spot.setAttribute('type', (_a = config === null || config === void 0 ? void 0 : config.spot) !== null && _a !== void 0 ? _a : '');
17109
17260
  spot.data = {
17110
17261
  spot: config === null || config === void 0 ? void 0 : config.spot,
17111
- fluid: (_b = config === null || config === void 0 ? void 0 : config.fluid) !== null && _b !== void 0 ? _b : false,
17262
+ fluid: (_a = config === null || config === void 0 ? void 0 : config.fluid) !== null && _a !== void 0 ? _a : false,
17112
17263
  ...config,
17113
17264
  };
17114
17265
  spot.content = content;
@@ -17136,6 +17287,27 @@ class ElementService {
17136
17287
  carousel.slides = slides;
17137
17288
  return carousel;
17138
17289
  }
17290
+ /**
17291
+ * Creates the skeleton html element based on the provided data using shadow dom.
17292
+ *
17293
+ * This method is only available in browser environments.
17294
+ *
17295
+ * @param {ICreateSkeletonElementParams} params - The parameters to create the final element.
17296
+ *
17297
+ * @return {HTMLElement | null} - The html element or null if the browser environment is not available.
17298
+ */
17299
+ createSkeletonElement(params) {
17300
+ if (!this.ensureBrowserEnvironmentAndDefineElement()) {
17301
+ return null;
17302
+ }
17303
+ const skeleton = document.createElement(SKELETON_ELEMENT_TAG);
17304
+ const dimensions = SPOT_DIMENSIONS[params.spotType];
17305
+ skeleton.data = {
17306
+ fluid: params.fluid,
17307
+ ...dimensions,
17308
+ };
17309
+ return skeleton;
17310
+ }
17139
17311
  /**
17140
17312
  * Overrides the spot colors with the provided colors.
17141
17313
  *
@@ -17170,6 +17342,9 @@ class ElementService {
17170
17342
  if (!window.customElements.get(CAROUSEL_ELEMENT_TAG)) {
17171
17343
  window.customElements.define(CAROUSEL_ELEMENT_TAG, CarouselElement);
17172
17344
  }
17345
+ if (!window.customElements.get(SKELETON_ELEMENT_TAG)) {
17346
+ window.customElements.define(SKELETON_ELEMENT_TAG, SkeletonElement);
17347
+ }
17173
17348
  return true;
17174
17349
  }
17175
17350
  }
@@ -19059,11 +19234,11 @@ class MonitorService {
19059
19234
  var _a, _b;
19060
19235
  if (!spots)
19061
19236
  return;
19062
- const eventProductIds = new Set(eventData.productIds);
19237
+ const eventProductIds = new Set(eventData.productIds.map((productId) => String(productId)));
19063
19238
  for (const spot of Object.values(spots)) {
19064
19239
  if (!spot.productIds.length)
19065
19240
  continue;
19066
- const hasCommonProductIds = spot.productIds.find((productId) => eventProductIds.has(productId));
19241
+ const hasCommonProductIds = spot.productIds.find((productId) => eventProductIds.has(String(productId)));
19067
19242
  if (hasCommonProductIds) {
19068
19243
  if (Object.values(exports.RMN_SPOT_EVENT).includes(eventData.event)) {
19069
19244
  await this.fireAndPublishSpotEvent({
@@ -19315,6 +19490,7 @@ class LiquidCommerceRmnClient {
19315
19490
  this.selectionService = SelectionService.getInstance(auth);
19316
19491
  this.elementService = ElementService.getInstance();
19317
19492
  this.eventService = EventService.getInstance();
19493
+ this.intersectionObserver = new IntersectionObserverService();
19318
19494
  }
19319
19495
  /**
19320
19496
  * Makes a selection request on our server based on the provided data.
@@ -19338,24 +19514,29 @@ class LiquidCommerceRmnClient {
19338
19514
  async injectSpotElement(params) {
19339
19515
  var _a;
19340
19516
  if (typeof window === 'undefined' || typeof document === 'undefined') {
19341
- console.warn('LiquidCommerce Rmn Sdk: Methods which create elements are only available in browser environments.');
19517
+ console.warn('LiquidCommerce Rmn Sdk: injectSpotElement method is only available in the browser environment.');
19342
19518
  return;
19343
19519
  }
19344
19520
  const config = params.config;
19345
19521
  let inject = params.inject;
19522
+ // Handle no spots error state
19346
19523
  if (!inject.length) {
19347
- // Handle no spots error state
19348
19524
  this.eventService.handleSpotState('all', {
19349
19525
  state: {
19350
19526
  error: 'No spot elements provided for injection.',
19351
- loading: false,
19352
- mounted: false,
19353
19527
  },
19354
19528
  });
19355
19529
  return;
19356
19530
  }
19357
- // Update the state of the spots to loading
19358
- this.updateSpotsState(inject);
19531
+ // Identify the spot elements
19532
+ for (const item of inject) {
19533
+ this.eventService.handleSpotState(item.placementId, {
19534
+ identifier: {
19535
+ placementId: item.placementId,
19536
+ spotType: item.spotType,
19537
+ },
19538
+ }, false);
19539
+ }
19359
19540
  // Prevent duplicate placement ids
19360
19541
  const hasDuplicatePlacementIds = this.preventDuplicateSpotPlacementIds(inject);
19361
19542
  if (!hasDuplicatePlacementIds) {
@@ -19363,35 +19544,9 @@ class LiquidCommerceRmnClient {
19363
19544
  }
19364
19545
  // Prevent non-existent spot types
19365
19546
  inject = this.preventNonExistentSpotTypes(inject);
19366
- // Make the spot selection request
19367
- const response = await this.spotSelectionRequest({ ...params, inject });
19368
- // const response = await this.useSpotSelectionExample(inject);
19369
- // Handle the response
19370
- if (typeof response === 'object' && 'error' in response) {
19371
- // Handle request error state
19372
- this.eventService.handleSpotState('all', {
19373
- state: {
19374
- error: response.error,
19375
- mounted: false,
19376
- loading: false,
19377
- },
19378
- });
19379
- return;
19380
- }
19547
+ // Add Intersection Observer to the spot elements to track visibility
19548
+ // This is useful for lazy loading the spot elements
19381
19549
  for (const item of inject) {
19382
- const itemConfig = (_a = item.config) !== null && _a !== void 0 ? _a : config;
19383
- const spots = response[item.placementId];
19384
- if (!(spots === null || spots === void 0 ? void 0 : spots.length)) {
19385
- // Handle no spots found error state
19386
- this.eventService.handleSpotState(item.placementId, {
19387
- state: {
19388
- error: `No spots found for type "${item.spotType}".`,
19389
- mounted: false,
19390
- loading: false,
19391
- },
19392
- });
19393
- continue;
19394
- }
19395
19550
  const placementId = item.placementId.replace('#', '');
19396
19551
  const placement = document.getElementById(placementId);
19397
19552
  if (!placement) {
@@ -19399,8 +19554,6 @@ class LiquidCommerceRmnClient {
19399
19554
  this.eventService.handleSpotState(item.placementId, {
19400
19555
  state: {
19401
19556
  error: `Placement not found for id "${placementId}".`,
19402
- mounted: false,
19403
- loading: false,
19404
19557
  },
19405
19558
  });
19406
19559
  continue;
@@ -19414,43 +19567,73 @@ class LiquidCommerceRmnClient {
19414
19567
  display: 'flex',
19415
19568
  justifyContent: 'center',
19416
19569
  });
19417
- // Handle single spot
19418
- if (spots.length === 1) {
19419
- const isInjected = this.injectOneSpotElement(item, placement, spots[0], itemConfig);
19420
- if (!isInjected) {
19421
- continue;
19422
- }
19570
+ const skeletonElement = this.elementService.createSkeletonElement({
19571
+ fluid: (_a = config === null || config === void 0 ? void 0 : config.fluid) !== null && _a !== void 0 ? _a : false,
19572
+ spotType: item.spotType,
19573
+ });
19574
+ if (!skeletonElement) {
19575
+ this.eventService.handleSpotState(item.placementId, {
19576
+ state: {
19577
+ error: `Failed to create skeleton loader element.`,
19578
+ mounted: false,
19579
+ loading: true,
19580
+ },
19581
+ });
19582
+ continue;
19423
19583
  }
19424
- // Handle multiple spots (carousel)
19425
- if (spots.length > 1) {
19426
- const isInjected = this.injectCarouselSpotElement(placement, spots, itemConfig);
19427
- if (!isInjected) {
19428
- continue;
19584
+ placement.replaceChildren(skeletonElement);
19585
+ const spotPlacementIsNear = async () => {
19586
+ var _a;
19587
+ // Set the spot element to loading state
19588
+ this.eventService.handleSpotState(item.placementId, {
19589
+ state: {
19590
+ loading: true,
19591
+ },
19592
+ });
19593
+ // Stop observing the placement
19594
+ this.intersectionObserver.unobserve(placement);
19595
+ // Make the spot selection request
19596
+ const response = await this.spotSelectionRequest({ ...params, inject: [item] });
19597
+ // const response = await this.useSpotSelectionExample(inject);
19598
+ // Handle request error state
19599
+ if (typeof response === 'object' && 'error' in response) {
19600
+ this.eventService.handleSpotState(item.placementId, {
19601
+ state: {
19602
+ error: response.error,
19603
+ mounted: false,
19604
+ loading: false,
19605
+ },
19606
+ });
19607
+ this.clearPlacement(item.placementId);
19608
+ return;
19429
19609
  }
19430
- }
19610
+ const itemConfig = (_a = item.config) !== null && _a !== void 0 ? _a : config;
19611
+ const spots = response[item.placementId];
19612
+ if (!(spots === null || spots === void 0 ? void 0 : spots.length)) {
19613
+ // Handle no spots found error state
19614
+ this.eventService.handleSpotState(item.placementId, {
19615
+ state: {
19616
+ error: `No spots found for type "${item.spotType}".`,
19617
+ mounted: false,
19618
+ loading: false,
19619
+ },
19620
+ });
19621
+ this.clearPlacement(item.placementId);
19622
+ return;
19623
+ }
19624
+ // Handle single spot
19625
+ if (spots.length === 1) {
19626
+ this.injectOneSpotElement(item, placement, spots[0], itemConfig);
19627
+ }
19628
+ // Handle multiple spots (carousel)
19629
+ if (spots.length > 1) {
19630
+ this.injectCarouselSpotElement(placement, spots, itemConfig);
19631
+ }
19632
+ };
19633
+ this.intersectionObserver.observe(placement, spotPlacementIsNear, { rootMargin: '500px' });
19431
19634
  }
19432
19635
  }
19433
- /**
19434
- * Makes a selection request on our server based on the provided data.
19435
- *
19436
- * @param {IInjectSpotElementParams} params - Parameters for injecting spot elements.
19437
- *
19438
- * @return {Promise<ISpots | {error: string}>} - The spots response object.
19439
- */
19440
- async spotSelectionRequest(params) {
19441
- const { inject, filter, config } = params;
19442
- const request = {
19443
- url: config === null || config === void 0 ? void 0 : config.url,
19444
- filter,
19445
- spots: inject.map((item) => ({
19446
- placementId: item.placementId,
19447
- spot: item.spotType,
19448
- count: item === null || item === void 0 ? void 0 : item.count,
19449
- ...item === null || item === void 0 ? void 0 : item.filter,
19450
- })),
19451
- };
19452
- return this.spotSelection(request);
19453
- }
19636
+ /** ========================= HELPER METHODS ========================= **/
19454
19637
  /**
19455
19638
  * Injects a carousel element with the provided spots into the placement.
19456
19639
  *
@@ -19519,7 +19702,8 @@ class LiquidCommerceRmnClient {
19519
19702
  loading: false,
19520
19703
  },
19521
19704
  });
19522
- return false;
19705
+ this.clearPlacement(placement.id);
19706
+ return;
19523
19707
  }
19524
19708
  placement.replaceChildren(carouselElement);
19525
19709
  this.eventService.handleSpotState(placement.id, {
@@ -19533,7 +19717,6 @@ class LiquidCommerceRmnClient {
19533
19717
  error: undefined,
19534
19718
  },
19535
19719
  });
19536
- return true;
19537
19720
  }
19538
19721
  /**
19539
19722
  * Injects a single spot element into the provided placement.
@@ -19569,7 +19752,8 @@ class LiquidCommerceRmnClient {
19569
19752
  loading: false,
19570
19753
  },
19571
19754
  });
19572
- return false;
19755
+ this.clearPlacement(injectItem.placementId);
19756
+ return;
19573
19757
  }
19574
19758
  // Create the spot element
19575
19759
  const spotElement = this.elementService.createSpotElement({
@@ -19590,7 +19774,8 @@ class LiquidCommerceRmnClient {
19590
19774
  loading: false,
19591
19775
  },
19592
19776
  });
19593
- return false;
19777
+ this.clearPlacement(injectItem.placementId);
19778
+ return;
19594
19779
  }
19595
19780
  this.eventService.registerSpot({
19596
19781
  spot: spotData,
@@ -19609,7 +19794,38 @@ class LiquidCommerceRmnClient {
19609
19794
  error: undefined,
19610
19795
  },
19611
19796
  });
19612
- return true;
19797
+ }
19798
+ /**
19799
+ * Clears the placement element by removing all its children.
19800
+ *
19801
+ * @param {string} placementId - The placement id.
19802
+ *
19803
+ * @return {void}
19804
+ */
19805
+ clearPlacement(placementId) {
19806
+ var _a;
19807
+ (_a = document.getElementById(placementId)) === null || _a === void 0 ? void 0 : _a.replaceChildren();
19808
+ }
19809
+ /**
19810
+ * Makes a selection request on our server based on the provided data.
19811
+ *
19812
+ * @param {IInjectSpotElementParams} params - Parameters for injecting spot elements.
19813
+ *
19814
+ * @return {Promise<ISpots | {error: string}>} - The spots response object.
19815
+ */
19816
+ async spotSelectionRequest(params) {
19817
+ const { inject, filter, config } = params;
19818
+ const request = {
19819
+ url: config === null || config === void 0 ? void 0 : config.url,
19820
+ filter,
19821
+ spots: inject.map((item) => ({
19822
+ placementId: item.placementId,
19823
+ spot: item.spotType,
19824
+ count: item === null || item === void 0 ? void 0 : item.count,
19825
+ ...item === null || item === void 0 ? void 0 : item.filter,
19826
+ })),
19827
+ };
19828
+ return this.spotSelection(request);
19613
19829
  }
19614
19830
  /**
19615
19831
  * Prevents duplicate placement ids in the inject data.
@@ -19627,8 +19843,6 @@ class LiquidCommerceRmnClient {
19627
19843
  this.eventService.handleSpotState(item.placementId, {
19628
19844
  state: {
19629
19845
  error: `Duplicate placement id (${item.placementId}) found. Please provide a unique placement id for each spot element.`,
19630
- mounted: false,
19631
- loading: false,
19632
19846
  },
19633
19847
  });
19634
19848
  return false;
@@ -19637,6 +19851,12 @@ class LiquidCommerceRmnClient {
19637
19851
  }
19638
19852
  return true;
19639
19853
  }
19854
+ /**
19855
+ * Prevents non-existent spot types in the inject data.
19856
+ *
19857
+ * @param {IInjectSpotElement[]} inject - The inject data.
19858
+ * @return {IInjectSpotElement[]} - The filtered inject data.
19859
+ */
19640
19860
  preventNonExistentSpotTypes(inject) {
19641
19861
  const newInject = [];
19642
19862
  for (const item of inject) {
@@ -19644,8 +19864,6 @@ class LiquidCommerceRmnClient {
19644
19864
  this.eventService.handleSpotState(item.placementId, {
19645
19865
  state: {
19646
19866
  error: `Invalid spot type (${item.spotType}) found. Please provide a valid spot type for each spot element.`,
19647
- mounted: false,
19648
- loading: false,
19649
19867
  },
19650
19868
  });
19651
19869
  continue;
@@ -19654,22 +19872,7 @@ class LiquidCommerceRmnClient {
19654
19872
  }
19655
19873
  return newInject;
19656
19874
  }
19657
- // Initialize spots with loading state and identifiers
19658
- updateSpotsState(inject) {
19659
- for (const item of inject) {
19660
- this.eventService.handleSpotState(item.placementId, {
19661
- identifier: {
19662
- placementId: item.placementId,
19663
- spotType: item.spotType,
19664
- },
19665
- state: {
19666
- loading: true,
19667
- mounted: false,
19668
- error: undefined,
19669
- },
19670
- });
19671
- }
19672
- }
19875
+ // Use spot selection example data for private testing
19673
19876
  useSpotSelectionExample(inject) {
19674
19877
  const examples = { ...RB_SPOTS_SELECTION_EXAMPLE, ...IAB_SPOTS_SELECTION_EXAMPLE };
19675
19878
  const data = {};