@liquidcommercedev/rmn-sdk 1.4.6-beta.6 → 1.4.6-beta.7

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.cjs CHANGED
@@ -56,6 +56,7 @@ exports.RMN_FILTER_PROPERTIES = void 0;
56
56
  })(exports.RMN_FILTER_PROPERTIES || (exports.RMN_FILTER_PROPERTIES = {}));
57
57
  exports.RMN_SPOT_EVENT = void 0;
58
58
  (function (RMN_SPOT_EVENT) {
59
+ RMN_SPOT_EVENT["INJECT_SPOTS"] = "INJECT_SPOTS";
59
60
  RMN_SPOT_EVENT["MOUNTED"] = "MOUNTED";
60
61
  RMN_SPOT_EVENT["UNMOUNTED"] = "UNMOUNTED";
61
62
  RMN_SPOT_EVENT["IMPRESSION"] = "IMPRESSION";
@@ -17913,19 +17914,19 @@ class SelectionService extends BaseApi {
17913
17914
  *
17914
17915
  * @param {ISpotSelectionParams} data - Spots selection parameters.
17915
17916
  *
17916
- * @return {Promise<ISpots>} - The spots response object.
17917
+ * @return {Promise<ISpots | { error: string }>} - The spots response object.
17917
17918
  */
17918
17919
  async spotSelection(data) {
17919
17920
  const { isOk, val, isErr } = await this.post(SELECTION_API_PATH, data, {});
17920
17921
  if (isErr) {
17921
- throw new Error(`There was an error during spot selection: (${isErr === null || isErr === void 0 ? void 0 : isErr.errorMessage})`);
17922
+ return { error: `There was an error during spot selection: (${isErr === null || isErr === void 0 ? void 0 : isErr.errorMessage})` };
17922
17923
  }
17923
17924
  if (isOk && val && val.data && (val === null || val === void 0 ? void 0 : val.refresh.token)) {
17924
17925
  this.authInfo.authenticated = true;
17925
17926
  this.authInfo.token = val.refresh.token;
17926
17927
  return val.data.spots;
17927
17928
  }
17928
- throw new Error('Spot selection response was not successful');
17929
+ return { error: 'Spot selection response was not successful' };
17929
17930
  }
17930
17931
  }
17931
17932
 
@@ -17942,7 +17943,7 @@ class LiquidCommerceRmnClient {
17942
17943
  *
17943
17944
  * @param {ISpotSelectionParams} params - Spots selection parameters.
17944
17945
  *
17945
- * @return {Promise<ISpots>} - The spots response object.
17946
+ * @return {Promise<ISpots | {error : string}>} - The spots response object.
17946
17947
  */
17947
17948
  async spotSelection(params) {
17948
17949
  return this.selectionService.spotSelection(params);
@@ -17956,31 +17957,51 @@ class LiquidCommerceRmnClient {
17956
17957
  */
17957
17958
  async injectSpotElement(params) {
17958
17959
  var _a;
17959
- const { inject, config } = params;
17960
+ const config = params.config;
17961
+ let inject = params.inject;
17962
+ this.eventService.publish(exports.RMN_SPOT_EVENT.INJECT_SPOTS, {
17963
+ isLoading: true,
17964
+ isCompleted: false,
17965
+ error: null,
17966
+ });
17960
17967
  if (!inject.length) {
17961
- console.warn('RmnSdk: Failed to inject spot element. Please provide at least one spot element to inject.');
17968
+ this.eventError('RmnSdk: Failed to inject spot element. Please provide at least one spot element to inject.');
17969
+ return;
17970
+ }
17971
+ const hasDuplicatePlacementIds = this.preventDuplicateSpotPlacementIds(inject);
17972
+ if (!hasDuplicatePlacementIds) {
17973
+ return;
17974
+ }
17975
+ inject = this.preventNonExistentSpotTypes(inject);
17976
+ const response = await this.spotSelectionRequest({ ...params, inject });
17977
+ if (typeof response === 'object' && 'error' in response) {
17978
+ this.eventError(response.error);
17962
17979
  return;
17963
17980
  }
17964
- this.preventDuplicateSpotPlacementIds(inject);
17965
- const response = await this.spotSelectionRequest(params);
17966
17981
  for (const item of inject) {
17967
17982
  const itemConfig = (_a = item.config) !== null && _a !== void 0 ? _a : config;
17968
17983
  const spots = response[item.placementId];
17969
17984
  if (!(spots === null || spots === void 0 ? void 0 : spots.length)) {
17970
- console.warn(`RmnSdk: Failed to inject spot element. No spots found for type "${item.spotType}".`);
17985
+ this.eventError(`RmnSdk: Failed to inject spot element. No spots found for type "${item.spotType}".`, { placementId: item.placementId, type: item.spotType });
17971
17986
  continue;
17972
17987
  }
17973
17988
  const placementId = item.placementId.replace('#', '');
17974
17989
  const placement = document.getElementById(placementId);
17975
17990
  if (!placement) {
17976
- console.warn(`RmnSdk: Failed to inject spot element. Placement not found for id "#${placementId}".`);
17991
+ this.eventError(`RmnSdk: Failed to inject spot element. Placement not found for id "#${placementId}".`, { placementId, type: item.spotType });
17977
17992
  continue;
17978
17993
  }
17979
17994
  if (spots.length === 1) {
17980
- this.injectOneSpotElement(item, placement, spots[0], itemConfig);
17995
+ const isInjected = this.injectOneSpotElement(item, placement, spots[0], itemConfig);
17996
+ if (!isInjected) {
17997
+ continue;
17998
+ }
17981
17999
  }
17982
18000
  if (spots.length > 1) {
17983
- this.injectCarouselSpotElement(placement, spots, itemConfig);
18001
+ const isInjected = this.injectCarouselSpotElement(placement, spots, itemConfig);
18002
+ if (!isInjected) {
18003
+ continue;
18004
+ }
17984
18005
  }
17985
18006
  }
17986
18007
  }
@@ -17997,7 +18018,7 @@ class LiquidCommerceRmnClient {
17997
18018
  *
17998
18019
  * @param {IInjectSpotElementParams} params - Parameters for injecting spot elements.
17999
18020
  *
18000
- * @return {Promise<ISpots>} - The spots response object.
18021
+ * @return {Promise<ISpots | {error: string}>} - The spots response object.
18001
18022
  */
18002
18023
  async spotSelectionRequest(params) {
18003
18024
  const { inject, filter, config } = params;
@@ -18029,8 +18050,8 @@ class LiquidCommerceRmnClient {
18029
18050
  const spot = this.elementService.overrideSpotColors(spotItem, config === null || config === void 0 ? void 0 : config.colors);
18030
18051
  const content = SPOT_TEMPLATE_HTML_ELEMENT(spot, { overlay: config === null || config === void 0 ? void 0 : config.overlay });
18031
18052
  if (!content) {
18032
- console.warn(`RmnSdk: Failed to inject carousel spot element. Could not create element for type "${spot.spot}".`);
18033
- return;
18053
+ this.eventError(`RmnSdk: Failed to inject carousel spot element. Could not create element for type "${spot.spot}".`, { placementId: placement.id, type: spot.spot });
18054
+ continue;
18034
18055
  }
18035
18056
  this.eventSpotElement({
18036
18057
  spot,
@@ -18054,10 +18075,11 @@ class LiquidCommerceRmnClient {
18054
18075
  },
18055
18076
  });
18056
18077
  if (!carouselElement) {
18057
- console.warn(`RmnSdk: Failed to inject spot carousel element. Could not create spot carousel element.`);
18058
- return;
18078
+ this.eventError(`RmnSdk: Failed to inject spot carousel element. Could not create spot carousel element.`, { placementId: placement.id });
18079
+ return false;
18059
18080
  }
18060
18081
  placement.replaceChildren(carouselElement);
18082
+ return true;
18061
18083
  }
18062
18084
  /**
18063
18085
  * Injects a single spot element into the provided placement.
@@ -18074,8 +18096,8 @@ class LiquidCommerceRmnClient {
18074
18096
  const spotData = this.elementService.overrideSpotColors(spot, config === null || config === void 0 ? void 0 : config.colors);
18075
18097
  const content = SPOT_TEMPLATE_HTML_ELEMENT(spotData, { overlay: config === null || config === void 0 ? void 0 : config.overlay });
18076
18098
  if (!content) {
18077
- console.warn(`RmnSdk: Failed to inject spot element. Could not create element for type "${injectItem.spotType}".`);
18078
- return;
18099
+ this.eventError(`RmnSdk: Failed to inject spot element. Could not create element for type "${injectItem.spotType}".`, { placementId: injectItem.placementId, type: injectItem.spotType });
18100
+ return false;
18079
18101
  }
18080
18102
  const spotElement = this.elementService.createSpotElement({
18081
18103
  content,
@@ -18088,8 +18110,8 @@ class LiquidCommerceRmnClient {
18088
18110
  },
18089
18111
  });
18090
18112
  if (!spotElement) {
18091
- console.warn(`RmnSdk: Failed to inject spot element. Could not create element for type "${injectItem.spotType}".`);
18092
- return;
18113
+ this.eventError(`RmnSdk: Failed to inject spot element. Could not create element for type "${injectItem.spotType}".`, { placementId: injectItem.placementId, type: injectItem.spotType });
18114
+ return false;
18093
18115
  }
18094
18116
  this.eventSpotElement({
18095
18117
  spot,
@@ -18097,6 +18119,7 @@ class LiquidCommerceRmnClient {
18097
18119
  element: spotElement,
18098
18120
  });
18099
18121
  placement.replaceChildren(spotElement);
18122
+ return true;
18100
18123
  }
18101
18124
  eventSpotElement({ spot, placementId, element, }) {
18102
18125
  this.eventService.registerSpot({
@@ -18118,10 +18141,33 @@ class LiquidCommerceRmnClient {
18118
18141
  const placementIds = new Set();
18119
18142
  for (const item of inject) {
18120
18143
  if (placementIds.has(item.placementId)) {
18121
- throw new Error(`RmnSdk: Duplicate placement id (${item.placementId}) found. Please provide a unique placement id for each spot element.`);
18144
+ this.eventError(`RmnSdk: Duplicate placement id (${item.placementId}) found. Please provide a unique placement id for each spot element.`, { placementId: item.placementId, type: item.spotType });
18145
+ return false;
18122
18146
  }
18123
18147
  placementIds.add(item.placementId);
18124
18148
  }
18149
+ return true;
18150
+ }
18151
+ preventNonExistentSpotTypes(inject) {
18152
+ const newInject = [];
18153
+ for (const item of inject) {
18154
+ if (!Object.values(exports.RMN_SPOT_TYPE).includes(item.spotType)) {
18155
+ this.eventError(`RmnSdk: Invalid spot type (${item.spotType}) found. Please provide a valid spot type for each spot element.`, { placementId: item.placementId, type: item.spotType });
18156
+ continue;
18157
+ }
18158
+ newInject.push(item);
18159
+ }
18160
+ return newInject;
18161
+ }
18162
+ eventError(error, spot) {
18163
+ this.eventService.publish(exports.RMN_SPOT_EVENT.INJECT_SPOTS, {
18164
+ isLoading: false,
18165
+ isCompleted: true,
18166
+ error: {
18167
+ message: error,
18168
+ spot,
18169
+ },
18170
+ });
18125
18171
  }
18126
18172
  }
18127
18173
  /**
package/dist/index.esm.js CHANGED
@@ -54,6 +54,7 @@ var RMN_FILTER_PROPERTIES;
54
54
  })(RMN_FILTER_PROPERTIES || (RMN_FILTER_PROPERTIES = {}));
55
55
  var RMN_SPOT_EVENT;
56
56
  (function (RMN_SPOT_EVENT) {
57
+ RMN_SPOT_EVENT["INJECT_SPOTS"] = "INJECT_SPOTS";
57
58
  RMN_SPOT_EVENT["MOUNTED"] = "MOUNTED";
58
59
  RMN_SPOT_EVENT["UNMOUNTED"] = "UNMOUNTED";
59
60
  RMN_SPOT_EVENT["IMPRESSION"] = "IMPRESSION";
@@ -17911,19 +17912,19 @@ class SelectionService extends BaseApi {
17911
17912
  *
17912
17913
  * @param {ISpotSelectionParams} data - Spots selection parameters.
17913
17914
  *
17914
- * @return {Promise<ISpots>} - The spots response object.
17915
+ * @return {Promise<ISpots | { error: string }>} - The spots response object.
17915
17916
  */
17916
17917
  async spotSelection(data) {
17917
17918
  const { isOk, val, isErr } = await this.post(SELECTION_API_PATH, data, {});
17918
17919
  if (isErr) {
17919
- throw new Error(`There was an error during spot selection: (${isErr === null || isErr === void 0 ? void 0 : isErr.errorMessage})`);
17920
+ return { error: `There was an error during spot selection: (${isErr === null || isErr === void 0 ? void 0 : isErr.errorMessage})` };
17920
17921
  }
17921
17922
  if (isOk && val && val.data && (val === null || val === void 0 ? void 0 : val.refresh.token)) {
17922
17923
  this.authInfo.authenticated = true;
17923
17924
  this.authInfo.token = val.refresh.token;
17924
17925
  return val.data.spots;
17925
17926
  }
17926
- throw new Error('Spot selection response was not successful');
17927
+ return { error: 'Spot selection response was not successful' };
17927
17928
  }
17928
17929
  }
17929
17930
 
@@ -17940,7 +17941,7 @@ class LiquidCommerceRmnClient {
17940
17941
  *
17941
17942
  * @param {ISpotSelectionParams} params - Spots selection parameters.
17942
17943
  *
17943
- * @return {Promise<ISpots>} - The spots response object.
17944
+ * @return {Promise<ISpots | {error : string}>} - The spots response object.
17944
17945
  */
17945
17946
  async spotSelection(params) {
17946
17947
  return this.selectionService.spotSelection(params);
@@ -17954,31 +17955,51 @@ class LiquidCommerceRmnClient {
17954
17955
  */
17955
17956
  async injectSpotElement(params) {
17956
17957
  var _a;
17957
- const { inject, config } = params;
17958
+ const config = params.config;
17959
+ let inject = params.inject;
17960
+ this.eventService.publish(RMN_SPOT_EVENT.INJECT_SPOTS, {
17961
+ isLoading: true,
17962
+ isCompleted: false,
17963
+ error: null,
17964
+ });
17958
17965
  if (!inject.length) {
17959
- console.warn('RmnSdk: Failed to inject spot element. Please provide at least one spot element to inject.');
17966
+ this.eventError('RmnSdk: Failed to inject spot element. Please provide at least one spot element to inject.');
17967
+ return;
17968
+ }
17969
+ const hasDuplicatePlacementIds = this.preventDuplicateSpotPlacementIds(inject);
17970
+ if (!hasDuplicatePlacementIds) {
17971
+ return;
17972
+ }
17973
+ inject = this.preventNonExistentSpotTypes(inject);
17974
+ const response = await this.spotSelectionRequest({ ...params, inject });
17975
+ if (typeof response === 'object' && 'error' in response) {
17976
+ this.eventError(response.error);
17960
17977
  return;
17961
17978
  }
17962
- this.preventDuplicateSpotPlacementIds(inject);
17963
- const response = await this.spotSelectionRequest(params);
17964
17979
  for (const item of inject) {
17965
17980
  const itemConfig = (_a = item.config) !== null && _a !== void 0 ? _a : config;
17966
17981
  const spots = response[item.placementId];
17967
17982
  if (!(spots === null || spots === void 0 ? void 0 : spots.length)) {
17968
- console.warn(`RmnSdk: Failed to inject spot element. No spots found for type "${item.spotType}".`);
17983
+ this.eventError(`RmnSdk: Failed to inject spot element. No spots found for type "${item.spotType}".`, { placementId: item.placementId, type: item.spotType });
17969
17984
  continue;
17970
17985
  }
17971
17986
  const placementId = item.placementId.replace('#', '');
17972
17987
  const placement = document.getElementById(placementId);
17973
17988
  if (!placement) {
17974
- console.warn(`RmnSdk: Failed to inject spot element. Placement not found for id "#${placementId}".`);
17989
+ this.eventError(`RmnSdk: Failed to inject spot element. Placement not found for id "#${placementId}".`, { placementId, type: item.spotType });
17975
17990
  continue;
17976
17991
  }
17977
17992
  if (spots.length === 1) {
17978
- this.injectOneSpotElement(item, placement, spots[0], itemConfig);
17993
+ const isInjected = this.injectOneSpotElement(item, placement, spots[0], itemConfig);
17994
+ if (!isInjected) {
17995
+ continue;
17996
+ }
17979
17997
  }
17980
17998
  if (spots.length > 1) {
17981
- this.injectCarouselSpotElement(placement, spots, itemConfig);
17999
+ const isInjected = this.injectCarouselSpotElement(placement, spots, itemConfig);
18000
+ if (!isInjected) {
18001
+ continue;
18002
+ }
17982
18003
  }
17983
18004
  }
17984
18005
  }
@@ -17995,7 +18016,7 @@ class LiquidCommerceRmnClient {
17995
18016
  *
17996
18017
  * @param {IInjectSpotElementParams} params - Parameters for injecting spot elements.
17997
18018
  *
17998
- * @return {Promise<ISpots>} - The spots response object.
18019
+ * @return {Promise<ISpots | {error: string}>} - The spots response object.
17999
18020
  */
18000
18021
  async spotSelectionRequest(params) {
18001
18022
  const { inject, filter, config } = params;
@@ -18027,8 +18048,8 @@ class LiquidCommerceRmnClient {
18027
18048
  const spot = this.elementService.overrideSpotColors(spotItem, config === null || config === void 0 ? void 0 : config.colors);
18028
18049
  const content = SPOT_TEMPLATE_HTML_ELEMENT(spot, { overlay: config === null || config === void 0 ? void 0 : config.overlay });
18029
18050
  if (!content) {
18030
- console.warn(`RmnSdk: Failed to inject carousel spot element. Could not create element for type "${spot.spot}".`);
18031
- return;
18051
+ this.eventError(`RmnSdk: Failed to inject carousel spot element. Could not create element for type "${spot.spot}".`, { placementId: placement.id, type: spot.spot });
18052
+ continue;
18032
18053
  }
18033
18054
  this.eventSpotElement({
18034
18055
  spot,
@@ -18052,10 +18073,11 @@ class LiquidCommerceRmnClient {
18052
18073
  },
18053
18074
  });
18054
18075
  if (!carouselElement) {
18055
- console.warn(`RmnSdk: Failed to inject spot carousel element. Could not create spot carousel element.`);
18056
- return;
18076
+ this.eventError(`RmnSdk: Failed to inject spot carousel element. Could not create spot carousel element.`, { placementId: placement.id });
18077
+ return false;
18057
18078
  }
18058
18079
  placement.replaceChildren(carouselElement);
18080
+ return true;
18059
18081
  }
18060
18082
  /**
18061
18083
  * Injects a single spot element into the provided placement.
@@ -18072,8 +18094,8 @@ class LiquidCommerceRmnClient {
18072
18094
  const spotData = this.elementService.overrideSpotColors(spot, config === null || config === void 0 ? void 0 : config.colors);
18073
18095
  const content = SPOT_TEMPLATE_HTML_ELEMENT(spotData, { overlay: config === null || config === void 0 ? void 0 : config.overlay });
18074
18096
  if (!content) {
18075
- console.warn(`RmnSdk: Failed to inject spot element. Could not create element for type "${injectItem.spotType}".`);
18076
- return;
18097
+ this.eventError(`RmnSdk: Failed to inject spot element. Could not create element for type "${injectItem.spotType}".`, { placementId: injectItem.placementId, type: injectItem.spotType });
18098
+ return false;
18077
18099
  }
18078
18100
  const spotElement = this.elementService.createSpotElement({
18079
18101
  content,
@@ -18086,8 +18108,8 @@ class LiquidCommerceRmnClient {
18086
18108
  },
18087
18109
  });
18088
18110
  if (!spotElement) {
18089
- console.warn(`RmnSdk: Failed to inject spot element. Could not create element for type "${injectItem.spotType}".`);
18090
- return;
18111
+ this.eventError(`RmnSdk: Failed to inject spot element. Could not create element for type "${injectItem.spotType}".`, { placementId: injectItem.placementId, type: injectItem.spotType });
18112
+ return false;
18091
18113
  }
18092
18114
  this.eventSpotElement({
18093
18115
  spot,
@@ -18095,6 +18117,7 @@ class LiquidCommerceRmnClient {
18095
18117
  element: spotElement,
18096
18118
  });
18097
18119
  placement.replaceChildren(spotElement);
18120
+ return true;
18098
18121
  }
18099
18122
  eventSpotElement({ spot, placementId, element, }) {
18100
18123
  this.eventService.registerSpot({
@@ -18116,10 +18139,33 @@ class LiquidCommerceRmnClient {
18116
18139
  const placementIds = new Set();
18117
18140
  for (const item of inject) {
18118
18141
  if (placementIds.has(item.placementId)) {
18119
- throw new Error(`RmnSdk: Duplicate placement id (${item.placementId}) found. Please provide a unique placement id for each spot element.`);
18142
+ this.eventError(`RmnSdk: Duplicate placement id (${item.placementId}) found. Please provide a unique placement id for each spot element.`, { placementId: item.placementId, type: item.spotType });
18143
+ return false;
18120
18144
  }
18121
18145
  placementIds.add(item.placementId);
18122
18146
  }
18147
+ return true;
18148
+ }
18149
+ preventNonExistentSpotTypes(inject) {
18150
+ const newInject = [];
18151
+ for (const item of inject) {
18152
+ if (!Object.values(RMN_SPOT_TYPE).includes(item.spotType)) {
18153
+ this.eventError(`RmnSdk: Invalid spot type (${item.spotType}) found. Please provide a valid spot type for each spot element.`, { placementId: item.placementId, type: item.spotType });
18154
+ continue;
18155
+ }
18156
+ newInject.push(item);
18157
+ }
18158
+ return newInject;
18159
+ }
18160
+ eventError(error, spot) {
18161
+ this.eventService.publish(RMN_SPOT_EVENT.INJECT_SPOTS, {
18162
+ isLoading: false,
18163
+ isCompleted: true,
18164
+ error: {
18165
+ message: error,
18166
+ spot,
18167
+ },
18168
+ });
18123
18169
  }
18124
18170
  }
18125
18171
  /**
@@ -49,6 +49,7 @@ export declare enum RMN_FILTER_PROPERTIES {
49
49
  SECTION = "section"
50
50
  }
51
51
  export declare enum RMN_SPOT_EVENT {
52
+ INJECT_SPOTS = "INJECT_SPOTS",
52
53
  MOUNTED = "MOUNTED",
53
54
  UNMOUNTED = "UNMOUNTED",
54
55
  IMPRESSION = "IMPRESSION",
@@ -4,6 +4,18 @@ export interface IFireEventParams {
4
4
  event: RMN_SPOT_EVENT;
5
5
  eventUrl: string;
6
6
  }
7
+ export interface IInjectSpotError {
8
+ message: string;
9
+ spot?: {
10
+ type?: string;
11
+ placementId?: string;
12
+ };
13
+ }
14
+ export interface IInjectSpotsEvent {
15
+ isLoading: boolean;
16
+ isCompleted: boolean;
17
+ error: null | IInjectSpotError;
18
+ }
7
19
  export interface IMountedEvent {
8
20
  placementId: string;
9
21
  spotId: string;
@@ -42,6 +54,7 @@ export interface IBuyNowEvent {
42
54
  spotId: string;
43
55
  }
44
56
  export interface IEventMap {
57
+ [RMN_SPOT_EVENT.INJECT_SPOTS]: IInjectSpotsEvent;
45
58
  [RMN_SPOT_EVENT.MOUNTED]: IMountedEvent;
46
59
  [RMN_SPOT_EVENT.UNMOUNTED]: IUnMountedEvent;
47
60
  [RMN_SPOT_EVENT.CLICK]: IClickEvent;
@@ -33,5 +33,7 @@ export interface ISpot {
33
33
  }
34
34
  export type ISpots = Record<PlacementIdType, ISpot[]>;
35
35
  export interface ISelectionService {
36
- spotSelection(data: ISpotSelectionParams): Promise<ISpots>;
36
+ spotSelection(data: ISpotSelectionParams): Promise<ISpots | {
37
+ error: string;
38
+ }>;
37
39
  }
@@ -10,7 +10,9 @@ export declare class SelectionService extends BaseApi implements ISelectionServi
10
10
  *
11
11
  * @param {ISpotSelectionParams} data - Spots selection parameters.
12
12
  *
13
- * @return {Promise<ISpots>} - The spots response object.
13
+ * @return {Promise<ISpots | { error: string }>} - The spots response object.
14
14
  */
15
- spotSelection(data: ISpotSelectionParams): Promise<ISpots>;
15
+ spotSelection(data: ISpotSelectionParams): Promise<ISpots | {
16
+ error: string;
17
+ }>;
16
18
  }
@@ -15,9 +15,11 @@ export declare class LiquidCommerceRmnClient implements IRmnClient {
15
15
  *
16
16
  * @param {ISpotSelectionParams} params - Spots selection parameters.
17
17
  *
18
- * @return {Promise<ISpots>} - The spots response object.
18
+ * @return {Promise<ISpots | {error : string}>} - The spots response object.
19
19
  */
20
- spotSelection(params: ISpotSelectionParams): Promise<ISpots>;
20
+ spotSelection(params: ISpotSelectionParams): Promise<ISpots | {
21
+ error: string;
22
+ }>;
21
23
  /**
22
24
  * Injects the spot elements into their provided placement.
23
25
  *
@@ -37,7 +39,7 @@ export declare class LiquidCommerceRmnClient implements IRmnClient {
37
39
  *
38
40
  * @param {IInjectSpotElementParams} params - Parameters for injecting spot elements.
39
41
  *
40
- * @return {Promise<ISpots>} - The spots response object.
42
+ * @return {Promise<ISpots | {error: string}>} - The spots response object.
41
43
  */
42
44
  private spotSelectionRequest;
43
45
  /**
@@ -72,6 +74,8 @@ export declare class LiquidCommerceRmnClient implements IRmnClient {
72
74
  * @return {void}
73
75
  */
74
76
  private preventDuplicateSpotPlacementIds;
77
+ private preventNonExistentSpotTypes;
78
+ private eventError;
75
79
  }
76
80
  /**
77
81
  * Creates a new instance of the RmnClient.
@@ -7,7 +7,9 @@ import type { RMN_ENV } from 'enums';
7
7
  import type { IInjectSpotElementParams } from 'modules/element';
8
8
  import type { ISpots, ISpotSelectionParams } from 'modules/selection';
9
9
  export interface IRmnClient {
10
- spotSelection(params: ISpotSelectionParams): Promise<ISpots>;
10
+ spotSelection(params: ISpotSelectionParams): Promise<ISpots | {
11
+ error: string;
12
+ }>;
11
13
  injectSpotElement(params: IInjectSpotElementParams): Promise<void>;
12
14
  eventManager(): EventService;
13
15
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@liquidcommercedev/rmn-sdk",
3
3
  "description": "LiquidCommerce RMN SDK",
4
4
  "author": "LiquidCommerce Tech",
5
- "version": "1.4.6-beta.6",
5
+ "version": "1.4.6-beta.7",
6
6
  "homepage": "https://docs.liquidcommerce.co/rmn-sdk",
7
7
  "main": "./dist/index.cjs",
8
8
  "module": "./dist/index.esm.js",