@ordergroove/offers 2.46.0 → 2.46.1-alpha-PR-1280-4.55

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.
@@ -36,6 +36,7 @@ import type {
36
36
  OfferElement,
37
37
  OptedInState,
38
38
  OptInItem,
39
+ PriceState,
39
40
  ReceiveOfferPayload,
40
41
  SetupProductPayload
41
42
  } from '../core/types/reducer';
@@ -289,6 +290,25 @@ export const optedin = (state: OptedInState = [], action): OptedInState => {
289
290
  return coreOptedin(state, action);
290
291
  };
291
292
 
293
+ export const price = (state: PriceState = {}, action): PriceState => {
294
+ if (constants.SETUP_PRODUCT === action.type) {
295
+ const {
296
+ payload: { product }
297
+ } = action as { payload: SetupProductPayload };
298
+ return (
299
+ product.variants?.reduce(
300
+ (acc, cur) => ({
301
+ ...acc,
302
+ [cur.id]: { value: cur.price }
303
+ }),
304
+ state
305
+ ) || state
306
+ );
307
+ }
308
+
309
+ return state;
310
+ };
311
+
292
312
  export const productOffer = (state = {}, _action) => state;
293
313
 
294
314
  export const productPlans = (state = {}, action) => {
@@ -352,6 +372,7 @@ const reducer = combineReducers({
352
372
  optedout,
353
373
  previewStandardOffer,
354
374
  previewUpsellOffer,
375
+ price,
355
376
  productOffer,
356
377
  productPlans,
357
378
  productToSubscribe,
@@ -8,4 +8,5 @@ export interface ProductPlanEntity {
8
8
  prepaidSavingsPerShipment?: string;
9
9
  prepaidSavingsTotal?: string;
10
10
  prepaidExtraSavingsPercentage?: string;
11
+ hasPriceAdjustments?: boolean;
11
12
  }