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AAM,CACJI,MAAO,CACLmD,wBAAyBkM,KAAKuE,mBAC5BQ,EAAO5E,MAAQ,GACfhQ,EAAMuR,QAIZrQ,QAASlB,EAAMkB,QACf2C,GAAI7D,EAAM6D,GACVC,SAAU9D,EAAM8D,SAChBxE,UAAU,yCAGdH,EAAAA,cAACwU,EAAAA,OAAM,CACLC,MAAO5T,EAAMkV,gBACb5V,UAAU,mCACV2P,QAAS4E,EAAgB,aACbe,EAAO5E,KAAI,aACX+E,GAEX/U,EAAMkV,uBAzSnBrF,KAAKpJ,SAAUC,EAAAA,EAAAA,kBACb,QACAmJ,KAAK7P,MAAM2G,iBACXwO,EAAAA,kBAAkBC,gBAEpBvF,KAAKa,MAAQ,CACX2E,gBAAgB,EAChBnE,oBAAqB,GACrBJ,MAAO,GACPM,UAAU,GAIPkE,sBAAsBC,GAC3B,OACE1F,KAAK7P,MAAM8U,8BACXS,EAAUT,4BAOPU,SACL,OACErW,EAAAA,cAAA,WACEA,EAAAA,cAAA,OAAKG,UAAU,0BACZuQ,KAAK7P,MAAMyV,sBAEb5F,KAAKqD,YACJrD,KAAK7P,MAAMmT,qBACXtD,KAAK7P,MAAMoT,yBACXvD,KAAK7P,MAAMuR,MAEbpS,EAAAA,cAAA,KACEG,UAAWuQ,KAAKa,MAAMI,MAAQ,mBAAqB,GAAE,YAC3C,aAETjB,KAAKa,MAAMI,OAEbjB,KAAK6E,wBAAwB7E,KAAK7P,SA2QpC,MAAM0V,EAEXlR,EAAAA,GAAiBC,wBAA6C,iXAAWC,CAAA,CACvEC,UAAW8L,GA7UmB,KAiVlC","sources":["webpack://@msdyn365-commerce-partners/fabrikam/./src/themes/britax-romers/views/components/cartlineitematp.component.tsx?818d","webpack://@msdyn365-commerce-partners/fabrikam/./src/actions/PromoCodeValidationDataServiceEntities.g.ts?62a9","webpack://@msdyn365-commerce-partners/fabrikam/./src/actions/PromoCodeValidationDataActionExtension.g.ts?019e","webpack://@msdyn365-commerce-partners/fabrikam/./src/themes/britax-romers/views/components/promocode.component.tsx?bfa6"],"sourcesContent":["/* !\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n */\r\n\r\nimport {\r\n  ArrayExtensions,\r\n  getFallbackImageUrl,\r\n  ObjectExtensions,\r\n} from \"@msdyn365-commerce-modules/retail-actions\";\r\nimport {\r\n  getPayloadObject,\r\n  getTelemetryAttributes,\r\n  ITelemetryContent,\r\n  IncrementalQuantity,\r\n} from \"@msdyn365-commerce-modules/utilities\";\r\nimport {\r\n  IComponentProps,\r\n  IGridSettings,\r\n  IImageSettings,\r\n  Image,\r\n  msdyn365Commerce,\r\n} from \"@msdyn365-commerce/core\";\r\nimport {\r\n  ChannelDeliveryOptionConfiguration,\r\n  SimpleProduct,\r\n} from \"@msdyn365-commerce/retail-proxy\";\r\nimport {\r\n  CartLine,\r\n  SalesLine,\r\n} from \"@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g\";\r\nimport * as React from \"react\";\r\nimport PriceComponent from \"./price.component\";\r\nimport {getProductPageUrlSync} from \"@msdyn365-commerce-modules/retail-actions\";\r\nimport {ICoreContext} from \"@msdyn365-commerce/core\";\r\nimport {ICartResources} from \"../../definition-extensions/cart.ext.props.autogenerated\";\r\n// import currencyFormatter from \"currency-formatter\";\r\n\r\n/**\r\n * ICartlineResourceString: Interface for specifying the\r\n * resource strings that the component needs.\r\n */\r\nexport interface ICartlineResourceString {\r\n  /** Display string for discount label */\r\n  discountStringText: string;\r\n\r\n  /** String for size key  */\r\n  sizeString: string;\r\n\r\n  /** String for color key  */\r\n  colorString: string;\r\n\r\n  /** String associated with the configuration product dimension  */\r\n  configString: string;\r\n\r\n  /** String for style key  */\r\n  styleString: string;\r\n\r\n  /** String for amount key  */\r\n  amountString?: string;\r\n\r\n  /** Display string for quantity label  */\r\n  quantityDisplayString: string;\r\n\r\n  /** Display string for quantity label  */\r\n  inputQuantityAriaLabel: string;\r\n\r\n  /** Aria label for the decrement button in quanitity component  */\r\n  decrementButtonAriaLabel?: string;\r\n\r\n  /** Aria label for the increment button in quanitity component  */\r\n  incrementButtonAriaLabel?: string;\r\n\r\n  /** Original text screenreader */\r\n  originalPriceText: string;\r\n\r\n  /** Current text screenreader  */\r\n  currentPriceText: string;\r\n\r\n  /** Shipping Charges Text  */\r\n  shippingChargesText: string;\r\n}\r\n\r\ninterface ICartLineData {\r\n  cartLine: CartLine | SalesLine;\r\n  product?: SimpleProduct;\r\n}\r\n\r\nexport type CartLineDisplayMode = \"DEFAULT\" | \"COMPACT\";\r\n\r\n/**\r\n * ICartLineProps: The props required to render cartLineitem.\r\n */\r\nexport interface ICartLineProps\r\n  extends IComponentProps<ICartLineData & ICartResources> {\r\n  /** The flag to change the quantity component from interactible to static  */\r\n  disableQuantityInteractivity?: boolean;\r\n\r\n  /** The primary image url  */\r\n  primaryImageUrl?: string;\r\n\r\n  /** The product url  */\r\n  productUrl?: string;\r\n\r\n  /** GridSettings for the product image in cartLine  */\r\n  gridSettings: IGridSettings;\r\n\r\n  /** ImageSettings for the product image in cartLine  */\r\n  imageSettings: IImageSettings;\r\n\r\n  /** Boolean flag to indicate if the item is out of stock  */\r\n  isOutOfStock?: boolean;\r\n\r\n  /** Flag to make quantity section editable  */\r\n  isQuantityEditable?: boolean;\r\n\r\n  /** Max quantity for line item  */\r\n  maxQuantity?: number;\r\n\r\n  /** Current quantity for line item  */\r\n  currentQuantity?: number;\r\n\r\n  /** Resource string for the component  */\r\n  resources: ICartlineResourceString;\r\n\r\n  /** SalesLine flag  */\r\n  isSalesLine?: boolean;\r\n\r\n  /** Error message to show in place of quantity */\r\n  errorMessage?: string;\r\n\r\n  /** Display mode to use */\r\n  displayMode?: CartLineDisplayMode;\r\n\r\n  /** Inventory information label  */\r\n  inventoryInformationLabel?: string;\r\n\r\n  /** Inventory information class name  */\r\n  inventoryLabelClassName?: string;\r\n\r\n  /** Flag to show/hide shipping charges for line items  */\r\n  showShippingChargesForLineItems?: boolean;\r\n\r\n  /** Boolean flag to indicate if cart state status is ready  */\r\n  isCartStateReady?: boolean;\r\n\r\n  /**  Chanel Delivery Option configuration is from api. */\r\n  channelDeliveryOptionConfig?: ChannelDeliveryOptionConfiguration;\r\n\r\n  /** The telemetry content */\r\n  telemetryContent?: ITelemetryContent;\r\n\r\n  /** Quantity onChange callback  */\r\n  quantityOnChange?(cartLine: any, newQuantity: number): void;\r\n\r\n  allProps: any;\r\n\r\n  atp?: any;\r\n}\r\n\r\ninterface IDimensionStrings {\r\n  /** String for size key  */\r\n  sizeString: string;\r\n\r\n  /** String for color key  */\r\n  colorString: string;\r\n\r\n  /** String associated with the configuration product dimension  */\r\n  configString: string;\r\n\r\n  /** String for style key  */\r\n  styleString: string;\r\n\r\n  /** String for amount key  */\r\n  amountString?: string;\r\n}\r\n\r\nconst CartLineItemFunctions = {\r\n  renderProductDimensions: (\r\n    Product: SimpleProduct,\r\n    DimensionStrings: IDimensionStrings,\r\n  ) => {\r\n    if (!Product || !Product.Dimensions) {\r\n      return [];\r\n    }\r\n\r\n    return Product.Dimensions.map((productDimension: any) => {\r\n      if (productDimension.DimensionTypeValue === 1) {\r\n        return (\r\n          <div\r\n            key={`${Product.RecordId}ProductDimensions1`}\r\n            className=\"msc-cart-line__product-variant-item\"\r\n          >\r\n            <span className=\"msc-cart-line__product-variant-color\">\r\n              {DimensionStrings.colorString}:\r\n              <span className=\"name\">\r\n                {productDimension.DimensionValue &&\r\n                  productDimension.DimensionValue.Value}\r\n              </span>\r\n            </span>\r\n          </div>\r\n        );\r\n      }\r\n\r\n      if (productDimension.DimensionTypeValue === 2) {\r\n        return (\r\n          <div\r\n            key={`${Product.RecordId}ProductDimensions2`}\r\n            className=\"msc-cart-line__product-variant-item\"\r\n          >\r\n            <span className=\"msc-cart-line__product-configuration\">\r\n              {DimensionStrings.configString}\r\n\r\n              <span className=\"name\">\r\n                {productDimension.DimensionValue &&\r\n                  productDimension.DimensionValue.Value}\r\n              </span>\r\n            </span>\r\n          </div>\r\n        );\r\n      }\r\n\r\n      if (productDimension.DimensionTypeValue === 3) {\r\n        return (\r\n          <div\r\n            key={`${Product.RecordId}ProductDimensions3`}\r\n            className=\"msc-cart-line__product-variant-item\"\r\n          >\r\n            <span className=\"msc-cart-line__product-variant-size\">\r\n              {DimensionStrings.sizeString}\r\n              <span className=\"name\">\r\n                {productDimension.DimensionValue &&\r\n                  productDimension.DimensionValue.Value}\r\n              </span>\r\n            </span>\r\n          </div>\r\n        );\r\n      }\r\n\r\n      if (productDimension.DimensionTypeValue === 4) {\r\n        return (\r\n          <div\r\n            key={`${Product.RecordId}ProductDimensions4`}\r\n            className=\"msc-cart-line__product-variant-item\"\r\n          >\r\n            <span className=\"msc-cart-line__product-variant-style\">\r\n              {Product.IsGiftCard\r\n                ? DimensionStrings.amountString\r\n                : DimensionStrings.styleString}\r\n              <span className=\"name\">\r\n                {productDimension.DimensionValue &&\r\n                  productDimension.DimensionValue.Value}\r\n              </span>\r\n            </span>\r\n          </div>\r\n        );\r\n      }\r\n      return null;\r\n    });\r\n  },\r\n  renderDiscountLines: (props: any) => {\r\n    if (\r\n      !props.data?.cartline?.DiscountLines ||\r\n      props.data.cartline?.DiscountLines?.length === 0\r\n    ) {\r\n      return null;\r\n    }\r\n    let price = props.data.cartline.Price * props.data.cartline.Quantity;\r\n    /**\r\n     * Get the updated discount percentage.\r\n     * @param {DiscountLine} discountLine - The discount line.\r\n     * @param {CartLine} cartLine - The cart line.\r\n     * @returns {number} The updated discount percentage.\r\n     */\r\n    // const discountPercent = (discountLine: DiscountLine, cartLine: CartLine): number => {\r\n    //     const numberZero = 0;\r\n    //     const decimalPrecision = 2;\r\n    //     const fullPercentage = 100;\r\n    //     let updatedPercent: number = discountLine.Percentage ?? numberZero;\r\n\r\n    //     if ((discountLine.EffectivePercentage === numberZero ||\r\n    //         (discountLine.DiscountLineTypeValue && discountLine.DiscountLineTypeValue === DiscountLineType.TenderTypeDiscount)) &&\r\n    //         cartLine.Price && cartLine.Price > numberZero && cartLine.Quantity && cartLine.Quantity !== numberZero) {\r\n    //         const effectiveAmount = discountLine.EffectiveAmount ?? numberZero;\r\n    //         updatedPercent = Number(((effectiveAmount / (cartLine.Price * cartLine.Quantity)) * fullPercentage).toFixed(decimalPrecision));\r\n    //     }\r\n\r\n    //     return updatedPercent;\r\n    // };\r\n\r\n    // const discountAmountCalculate = (discountLines: any): any => {\r\n    //     var sum: Number = 0;\r\n    //     discountLines.map((element: any) => {\r\n    //         if (element.CustomerDiscountTypeValue !== 3) {\r\n    //             sum += element?.EffectiveAmount\r\n    //         }\r\n    //     })\r\n    //     return sum;\r\n    // }\r\n\r\n    const PrevSum = (arr: any, currentIndex: any) => {\r\n      var sum: number = 0;\r\n      if (currentIndex == 0) {\r\n        return 0;\r\n      }\r\n      for (var i = 0; i < currentIndex; i++) {\r\n        sum += Number(arr[i].EffectiveAmount);\r\n      }\r\n      return sum;\r\n    };\r\n\r\n    return props.data.cartline?.DiscountLines?.map(\r\n      (discountLine: any, index: any) => {\r\n        if (discountLine.CustomerDiscountTypeValue != 3) {\r\n          return (\r\n            <div\r\n              key={discountLine?.OfferId || index}\r\n              className=\"msc-cart-line-item-product-discount\"\r\n            >\r\n              <span className=\"msc-cart-line__product-savings-label\">\r\n                {discountLine?.OfferName ? discountLine?.OfferName : \"\"}\r\n                {` ${props.resources.discountStringText || \"Discount\"} `}\r\n              </span>\r\n              <span className=\"msc-cart-line__promo-codes\">\r\n                <span>\r\n                  {props.context.cultureFormatter.formatCurrency(\r\n                    Number(discountLine.EffectiveAmount),\r\n                  )}\r\n                </span>\r\n\r\n                {/* {props.isSalesLine ? <span>{props.context.cultureFormatter.formatCurrency(\r\n                                  discountAmountCalculate(props.data.cartline.DiscountLines)\r\n                              )}</span> : <span>{props.context.cultureFormatter.formatCurrency(\r\n                                  Number(discountLine.DiscountCost)\r\n                              )}</span> */}\r\n\r\n                {/* discountLine?.DiscountCost && (\r\n                                       <>\r\n  \r\n                                          <PriceComponent */}\r\n\r\n                {/* data={ {\r\n                                                   price: {\r\n                                                       CustomerContextualPrice: props?.data?.cartline?.DiscountAmountWithoutTax,\r\n                                                       BasePrice: props?.data?.cartline?.DiscountAmount\r\n                                                   }\r\n                                               }}\r\n  \r\n                                               context={props.context}\r\n                                               id={props.id}\r\n                                               typeName={props.typeName}\r\n                                               className='msc-cart-line__discount-value'\r\n                                               currencyCode={props.currencyCode}\r\n                                           />\r\n                                       </>\r\n                                   ) */}\r\n                {/* } */}\r\n                {/* {discountLine.DiscountCost && (\r\n                              <>\r\n                              \r\n                                  <PriceComponent\r\n                                      // data={props.isSalesLine ? {\r\n                                      //     price: {\r\n                                      //         // @ts-expect-error\r\n                                      //         CustomerContextualPrice: props.data.cartLine.PeriodicDiscount\r\n                                      //     }\r\n                                      // } : {\r\n                                      //     price: {\r\n                                      //         CustomerContextualPrice: props.data.cartLine.DiscountAmountWithoutTax,\r\n                                      //         BasePrice: props.data.cartLine.DiscountAmount\r\n                                      //     }\r\n                                      // }}\r\n                                      data={ {\r\n                                          price: {\r\n                                              CustomerContextualPrice: props.data.cartLine.DiscountAmountWithoutTax,\r\n                                              BasePrice: props.data.cartLine.DiscountAmount\r\n                                          }\r\n                                      }}\r\n                                     \r\n                                      context={props.context}\r\n                                      id={props.id}\r\n                                      typeName={props.typeName}\r\n                                      className='msc-cart-line__discount-value'\r\n                                  />\r\n                              </>\r\n                          )} */}\r\n              </span>\r\n              <span>\r\n                {` (${\r\n                  discountLine?.EffectivePercentage != 0\r\n                    ? discountLine?.EffectivePercentage\r\n                    : (\r\n                        Number(\r\n                          discountLine.EffectiveAmount /\r\n                            (price -\r\n                              PrevSum(\r\n                                props.data.cartline.DiscountLines,\r\n                                index,\r\n                              )),\r\n                        ) * 100\r\n                      ).toFixed(2)\r\n                }%)`}\r\n                {/* {` (${discountLine?.EffectivePercentage !== undefined && discountLine?.EffectivePercentage != 0 ? discountLine?.EffectivePercentage : discountPercent}%)`} */}\r\n              </span>\r\n            </div>\r\n          );\r\n        } else {\r\n          return <></>;\r\n        }\r\n      },\r\n    );\r\n  },\r\n  renderInventoryLabel: (props: ICartLineProps) => {\r\n    if (!props.inventoryInformationLabel) {\r\n      return null;\r\n    }\r\n    const inventoryCssName = props.inventoryLabelClassName\r\n      ? `msc-cart-line__product-inventory-label ${props.inventoryLabelClassName}`\r\n      : \"msc-cart-line__product-inventory-label\";\r\n    return (\r\n      <span className={inventoryCssName}>\r\n        {props.inventoryInformationLabel}\r\n      </span>\r\n    );\r\n  },\r\n  renderShippingLabel: (props: any) => {\r\n    const pickupDeliveryModeCode =\r\n      props.context.request.channel?.PickupDeliveryModeCode;\r\n    const channelDeliveryOptionConfig = props.channelDeliveryOptionConfig;\r\n    const cartline = props.data.cartline;\r\n    let hasShippingMethod = false;\r\n    if (channelDeliveryOptionConfig !== undefined) {\r\n      hasShippingMethod = !!(\r\n        cartline?.DeliveryMode &&\r\n        channelDeliveryOptionConfig.PickupDeliveryModeCodes?.some(\r\n          (deliveryMode: any) => deliveryMode !== cartline?.DeliveryMode,\r\n        )\r\n      );\r\n    } else {\r\n      hasShippingMethod = !!(\r\n        cartline?.DeliveryMode &&\r\n        cartline?.DeliveryMode !== pickupDeliveryModeCode\r\n      );\r\n    }\r\n    if (!hasShippingMethod) {\r\n      return undefined;\r\n    }\r\n\r\n    const shippingChargeLines = (cartline?.ChargeLines || []).filter(\r\n      (chargeLine: any) => chargeLine.IsShipping,\r\n    );\r\n\r\n    if (shippingChargeLines.length === 0) {\r\n      return undefined;\r\n    }\r\n\r\n    const freightFee = shippingChargeLines.reduce(\r\n      (chargeTotal: any, chargeLine: any) => {\r\n        return chargeTotal + (chargeLine.CalculatedAmount || 0);\r\n      },\r\n      0,\r\n    );\r\n\r\n    const priceComponent = (\r\n      <PriceComponent\r\n        data={{\r\n          price: {\r\n            CustomerContextualPrice: freightFee,\r\n          },\r\n        }}\r\n        freePriceText=\"Free\"\r\n        context={props.context}\r\n        id={props.id}\r\n        typeName={props.typeName}\r\n        className=\"msc-cart-line__freight-actual\"\r\n        currencyCode={props.currencyCode}\r\n      />\r\n    );\r\n    return (\r\n      <>\r\n        <label className=\"msc-cart-line__freight-label\">\r\n          {`${props.resources.shippingChargesText}:`}\r\n        </label>\r\n        <span className=\"shipping-value\">{priceComponent}</span>\r\n      </>\r\n    );\r\n  },\r\n  renderOtherCharges: (props: any) => {\r\n    const cartline = props.data.cartline;\r\n    const otherCharges = cartline?.ChargeLines?.filter(\r\n      (chargeline: any) => !chargeline?.IsShipping,\r\n    );\r\n\r\n    return (\r\n      (otherCharges &&\r\n        otherCharges.map((otherCharge: any, key: any) => {\r\n          return otherCharge && otherCharge.CalculatedAmount ? (\r\n            <div className=\"msc-cart-line__other-charges\" key={key}>\r\n              <label className=\"msc-cart-line__other-charges-label\">\r\n                {`${otherCharge?.Description}:`}\r\n              </label>\r\n              <span className=\"other-charge-value\">\r\n                <PriceComponent\r\n                  data={{\r\n                    price: {\r\n                      CustomerContextualPrice: otherCharge?.CalculatedAmount,\r\n                    },\r\n                  }}\r\n                  context={props.context}\r\n                  id={props.id}\r\n                  typeName={props.typeName}\r\n                  className=\"msc-cart-line__other-charges-actual\"\r\n                  currencyCode={props.currencyCode}\r\n                />\r\n              </span>\r\n            </div>\r\n          ) : (\r\n            \"\"\r\n          );\r\n        })) ||\r\n      undefined\r\n    );\r\n  },\r\n};\r\n\r\n// tslint:disable-next-line:max-func-body-length\r\nconst CartLine: React.FC<ICartLineProps> = (props: any) => {\r\n  let {\r\n    productUrl,\r\n    resources,\r\n    allProps,\r\n    atp,\r\n    callFromCart,\r\n    stopAtp,\r\n    atpIndexDate,\r\n  } = props;\r\n\r\n  const {product, cartline} = props.data;\r\n  const defaultImageSettings: IImageSettings = {\r\n    viewports: {\r\n      xs: {q: `w=300&h=300&m=6`, w: 0, h: 0},\r\n      lg: {q: `w=300&h=300&m=6`, w: 0, h: 0},\r\n      xl: {q: `w=300&h=300&m=6`, w: 0, h: 0},\r\n    },\r\n    lazyload: true,\r\n    cropFocalRegion: true,\r\n  };\r\n\r\n  const destructDimensionStrings = {\r\n    sizeString: resources?.sizeString,\r\n    colorString: resources?.colorString,\r\n    styleString: resources?.styleString,\r\n    configString: resources?.configString,\r\n    amountString: resources?.amountString,\r\n  };\r\n  const fallbackImageUrl =\r\n    product &&\r\n    getFallbackImageUrl(\r\n      product.ItemId,\r\n      props.context.actionContext.requestContext.apiSettings,\r\n    );\r\n  const imageSettings = defaultImageSettings || props.imageSettings;\r\n  imageSettings.cropFocalRegion =\r\n    !ObjectExtensions.isNullOrUndefined(imageSettings);\r\n  // const { inputQuantityAriaLabel } = props.resources;\r\n  const productDimensions =\r\n    product &&\r\n    CartLineItemFunctions.renderProductDimensions(\r\n      product,\r\n      destructDimensionStrings,\r\n    );\r\n  const renderDisountLines = CartLineItemFunctions?.renderDiscountLines(props);\r\n  const renderShippingLabel = CartLineItemFunctions.renderShippingLabel(props);\r\n  const renderOtherCharges = CartLineItemFunctions.renderOtherCharges(props);\r\n  const payLoad = getPayloadObject(\r\n    \"click\",\r\n    props.telemetryContent!,\r\n    \"\",\r\n    product?.RecordId.toString(),\r\n  );\r\n  const prodAttribute = getTelemetryAttributes(\r\n    props.telemetryContent!,\r\n    payLoad,\r\n  );\r\n  const productName = product?.Name || cartline?.Description;\r\n  /*Saqlain Customization Start - Added Product URL for each Product*/\r\n  productUrl = getProductPageUrlSync(\r\n    productName,\r\n    product?.RecordId,\r\n    props.context.actionContext,\r\n  );\r\n  /*Saqlain Customiation End*/\r\n  const discountAmountCalculate = (discountLines: any): any => {\r\n    var sum: Number = 0;\r\n    discountLines.map((element: any) => {\r\n      if (element.CustomerDiscountTypeValue !== 3) {\r\n        sum += element?.EffectiveAmount;\r\n      }\r\n    });\r\n    return sum;\r\n  };\r\n  if (\r\n    typeof window !== \"undefined\" &&\r\n    typeof document !== \"undefined\" &&\r\n    typeof localStorage !== \"undefined\"\r\n  ) {\r\n    const [screenSize, setScreenSize] = React.useState(1);\r\n\r\n    const [storeIndexes, setStoreIndexes] = React.useState<any[]>([]);\r\n    React.useEffect(() => {\r\n      setStoreIndexes([]);\r\n    }, [callFromCart.toString()]);\r\n    const _generateErrorMessage = (): JSX.Element | null => {\r\n      /* \r\n              VSI CUSTOMIZATION \r\n              Maximum Quantity Limit has Precendence over other conditions/errors (minimum, multiple)\r\n              Checks if maximum quanity of a product is reached, if yes returns error message. \r\n              Otherwise if there is any other error message, that is displayed\r\n          */\r\n      if (props.isCartIcon != true || props.isCartIcon == undefined) {\r\n        if (props.maxQuantity) {\r\n          if (props.currentQuantity >= props.maxQuantity) {\r\n            return (\r\n              <div className=\"msc-alert__header\">\r\n                <span className=\"msi-exclamation-triangle\" />\r\n                <span>{props.limitReached}</span>\r\n              </div>\r\n            );\r\n          }\r\n        }\r\n      }\r\n\r\n      if (props.errorMessage) {\r\n        return (\r\n          <div className=\"msc-alert__header\">\r\n            <span className=\"msi-exclamation-triangle\" />\r\n            <span>{props.errorMessage}</span>\r\n          </div>\r\n        );\r\n      } else {\r\n        return null;\r\n      }\r\n    };\r\n\r\n    React.useEffect(() => {\r\n      const _isMobile = _getScreenSize(props.context);\r\n      setScreenSize(_isMobile);\r\n    });\r\n\r\n    const onChange = (newValue: number): boolean => {\r\n      stopAtp();\r\n      storeArray(props.data.product?.RecordId);\r\n\r\n      if (props.quantityOnChange) {\r\n        return props.quantityOnChange(props.data.cartLine, newValue);\r\n      }\r\n      return true;\r\n    };\r\n    const storeArray = (index: number) => {\r\n      setStoreIndexes([...new Set([...storeIndexes, index])]);\r\n    };\r\n    const _getScreenSize = (context: ICoreContext): number => {\r\n      // always render in mobile viewport on a mobile device\r\n      if (\r\n        context.request &&\r\n        context.request.device &&\r\n        context.request.device.Type === \"Mobile\"\r\n      ) {\r\n        return 1;\r\n      }\r\n\r\n      if (typeof window !== undefined && window.innerWidth) {\r\n        const gridSettings = context.request.gridSettings;\r\n        if (gridSettings) {\r\n          if (gridSettings.xs && window.innerWidth < gridSettings.xs.w) {\r\n            // mobile\r\n            return 1;\r\n          } else if (\r\n            gridSettings.sm &&\r\n            window.innerWidth <= gridSettings.sm.w\r\n          ) {\r\n            // iPad\r\n            return 2;\r\n          } else if (\r\n            gridSettings.md &&\r\n            window.innerWidth <= gridSettings.md.w\r\n          ) {\r\n            // Desktop\r\n            return 3;\r\n          } else if (\r\n            gridSettings.lg &&\r\n            window.innerWidth <= gridSettings.lg.w\r\n          ) {\r\n            // Desktop\r\n            return 3;\r\n          } else {\r\n            return 3;\r\n          }\r\n        }\r\n      }\r\n\r\n      return 3; // desktop\r\n    };\r\n\r\n    const _generateSelectMenu = (\r\n      quantity: number,\r\n      currentQuantity: any | undefined,\r\n    ): JSX.Element => {\r\n      const errorMessage = _generateErrorMessage();\r\n      // var status:boolean = false;\r\n\r\n      return (\r\n        <div className=\"product-quantity small-blks\">\r\n          {errorMessage ? [errorMessage] : null}\r\n          <div className=\"mobile-quantity-and-atp-date-display\">\r\n            <div>\r\n              <span className=\"mobile-label\">Quantity: </span>\r\n              <div>\r\n                <IncrementalQuantity\r\n                  id={`msc-cart-line__quantity_${props.data.product?.RecordId}-${props.data.cartLine?.DeliveryMode}-${props.data.cartLine?.LineId}`}\r\n                  max={props.maxQuantity || 10}\r\n                  currentCount={props.currentQuantity}\r\n                  onChange={onChange}\r\n                  inputQuantityAriaLabel={resources.inputQuantityAriaLabel}\r\n                  decrementButtonAriaLabel={resources.decrementButtonAriaLabel}\r\n                  incrementButtonAriaLabel={resources.incrementButtonAriaLabel}\r\n                  key={props.data.cartLine.LineId}\r\n                  disabled={!props.isCartStateReady}\r\n                  isGiftCard={props.data.product.IsGiftCard}\r\n                  telemetryContent={props.telemetryContent}\r\n                />\r\n              </div>\r\n            </div>\r\n            {/* {screenSize === 1 || screenSize === 2 ? (\r\n                <div className=\"product-atp small-blks\">\r\n                  <label className=\"mobile-label\">\r\n                    {allProps === undefined\r\n                      ? \"\"\r\n                      : allProps.resources.atpCartTitle}\r\n                  </label>\r\n                  10-02-2023\r\n                </div>\r\n              ) : (\r\n                <></>\r\n              )} */}\r\n          </div>\r\n        </div>\r\n      );\r\n    };\r\n\r\n    const _generateQuantityAndPrice = (): JSX.Element[] | null => {\r\n      const nodes = [];\r\n\r\n      if (!props.data.cartLine) {\r\n        props.data.cartLine = props.data.cartline;\r\n      } else {\r\n        props.data.cartline = props.data.cartLine;\r\n      }\r\n\r\n      var discountArray = props.data.cartline?.Price;\r\n\r\n      props.data.cartline?.DiscountLines.map((ele: any) => {\r\n        discountArray = discountArray - (discountArray * ele.Percentage) / 100;\r\n      });\r\n\r\n      if (\r\n        typeof window !== \"undefined\" &&\r\n        typeof document !== \"undefined\" &&\r\n        typeof localStorage !== \"undefined\"\r\n      ) {\r\n        if (props.data?.cartline?.IsInvoiceLine == false) {\r\n          if (props.isQuantityEditable && !props.data.product?.IsGiftCard) {\r\n            nodes.push(\r\n              <div className=\"product_price test small-blks\">\r\n                <span className=\"mobile-label\">{props.priceTranslation}: </span>\r\n                {props.data.cartline.LinePercentageDiscount > 0 ? (\r\n                  <s>\r\n                    {props.context.cultureFormatter.formatCurrency(\r\n                      Number(props.data?.cartline.Price),\r\n                    )}\r\n                  </s>\r\n                ) : props.data.cartline.DiscountLines?.length > 0 ? (\r\n                  <s>\r\n                    {props.context.cultureFormatter.formatCurrency(\r\n                      Number(props.data?.cartline.Price),\r\n                    )}\r\n                  </s>\r\n                ) : (\r\n                  <React.Fragment>\r\n                    {props.context.cultureFormatter.formatCurrency(\r\n                      Number(props.data.cartline.Price),\r\n                    )}\r\n                  </React.Fragment>\r\n                )}\r\n                {/* this */}\r\n                <h6>\r\n                  {props.data.cartline.LinePercentageDiscount > 0 &&\r\n                  props.data.cartline.DiscountLines.length == 0\r\n                    ? props.context.cultureFormatter.formatCurrency(\r\n                        Number(\r\n                          Math.round(\r\n                            (props.data?.cartline?.Price + Number.EPSILON) *\r\n                              100,\r\n                          ) / 100,\r\n                        ) -\r\n                          (Number(\r\n                            Math.round(\r\n                              (props.data?.cartline?.Price + Number.EPSILON) *\r\n                                100,\r\n                            ) / 100,\r\n                          ) *\r\n                            props.data.cartline?.LinePercentageDiscount) /\r\n                            100,\r\n                      )\r\n                    : props.data.cartline.DiscountLines?.length > 0\r\n                    ? props.context.cultureFormatter.formatCurrency(\r\n                        (Number(\r\n                          Math.round(\r\n                            (props.data?.cartline?.Price + Number.EPSILON) *\r\n                              100,\r\n                          ) / 100,\r\n                        ) *\r\n                          Number(props.data.cartline.Quantity) -\r\n                          discountAmountCalculate(\r\n                            props.data.cartline.DiscountLines,\r\n                          )) /\r\n                          Number(props.data.cartline.Quantity),\r\n                      )\r\n                    : null}\r\n                </h6>\r\n              </div>,\r\n            );\r\n            nodes.push(\r\n              _generateSelectMenu(\r\n                props.maxQuantity || 10,\r\n                props.currentQuantity,\r\n              ),\r\n            );\r\n          } else {\r\n            nodes.push(\r\n              <div className=\"product_price small-blks\">\r\n                {\" \"}\r\n                {\r\n                  <span className=\"mobile-label\">\r\n                    {props?.priceTranslation}:{\" \"}\r\n                  </span>\r\n                }\r\n                {props.data.cartline.LinePercentageDiscount > 0 ? (\r\n                  <s>\r\n                    {props.context.cultureFormatter.formatCurrency(\r\n                      Number(props.data.cartline?.Price),\r\n                    )}\r\n                  </s>\r\n                ) : props.data.cartline.DiscountLines?.length > 0 ? (\r\n                  <s>\r\n                    {props.context.cultureFormatter.formatCurrency(\r\n                      Number(props.data.cartline?.Price),\r\n                    )}\r\n                  </s>\r\n                ) : (\r\n                  <React.Fragment>\r\n                    {props.context.cultureFormatter.formatCurrency(\r\n                      Number(props.data.cartline?.Price),\r\n                    )}\r\n                  </React.Fragment>\r\n                )}\r\n                <h6>\r\n                  {props.data.cartline.LinePercentageDiscount > 0 &&\r\n                  props.data.cartline.DiscountLines.length == 0\r\n                    ? props.context.cultureFormatter.formatCurrency(\r\n                        Number(\r\n                          Math.round(\r\n                            (props.data?.cartline?.Price + Number.EPSILON) *\r\n                              100,\r\n                          ) / 100,\r\n                        ) -\r\n                          (Number(\r\n                            Math.round(\r\n                              (props.data?.cartline?.Price + Number.EPSILON) *\r\n                                100,\r\n                            ) / 100,\r\n                          ) *\r\n                            props.data.cartline?.LinePercentageDiscount) /\r\n                            100,\r\n                      )\r\n                    : props.data.cartline.DiscountLines?.length > 0\r\n                    ? props.context.cultureFormatter.formatCurrency(\r\n                        (Number(\r\n                          Math.round(\r\n                            (props.data?.cartline?.Price + Number.EPSILON) *\r\n                              100,\r\n                          ) / 100,\r\n                        ) *\r\n                          Number(props.data.cartline.Quantity) -\r\n                          discountAmountCalculate(\r\n                            props.data.cartline.DiscountLines,\r\n                          )) /\r\n                          Number(props.data.cartline.Quantity),\r\n                      )\r\n                    : null}\r\n                </h6>\r\n                {/* {props.data.cartline?  currencyFormatter.format(\r\n                                              Number(Math.round((props.data?.cartline?.Price + Number.EPSILON) * 100) / 100),\r\n                                              {\r\n                                                code: props.currencyCode,\r\n                                                decimal: \".\",\r\n                                                precision: 2,\r\n                                                thousand:\",\"\r\n                                              }\r\n                                            ): currencyFormatter.format(\r\n                                              Number(Math.round((props.data?.cartline?.Price + Number.EPSILON) * 100) / 100),\r\n                                              {\r\n                                                code: props.currencyCode,\r\n                                                decimal: \".\",\r\n                                                precision: 2,\r\n                                                thousand:\",\"\r\n                                              }\r\n                                            )} */}\r\n              </div>,\r\n            );\r\n\r\n            nodes.push(\r\n              <div className=\"msc-cart-line__quantity small-blks\">\r\n                <label className=\"mobile-label\">\r\n                  {resources.quantityDisplayString}:\r\n                </label>\r\n\r\n                <span className=\"quantity-value\">\r\n                  {props.data.cartline\r\n                    ? props.data.cartline.Quantity\r\n                    : props.data.cartLine.Quantity}\r\n                </span>\r\n              </div>,\r\n            );\r\n          }\r\n        }\r\n        nodes.push(\r\n          <div className=\"product-subtotal small-blks\">\r\n            <span className=\"mobile-label\">Sub Total: </span>\r\n            {window.location.href.includes(\"orderdetails\") ? (\r\n              props.data.cartline ? (\r\n                props.data.cartline.LinePercentageDiscount > 0 &&\r\n                props.data.cartline.DiscountLines?.length == 0 ? (\r\n                  <div>\r\n                    <s>\r\n                      {props.context.cultureFormatter.formatCurrency(\r\n                        Number(\r\n                          Math.round(\r\n                            (props.data?.cartline?.Price + Number.EPSILON) *\r\n                              100,\r\n                          ) / 100,\r\n                        ) * Number(props.data.cartline.Quantity),\r\n                      )}\r\n                    </s>\r\n                    <br />\r\n\r\n                    <span className=\"msc-price__actual\">\r\n                      {props.context.cultureFormatter.formatCurrency(\r\n                        Number(\r\n                          Math.round(\r\n                            (props.data?.cartline?.Price + Number.EPSILON) *\r\n                              100,\r\n                          ) / 100,\r\n                        ) *\r\n                          Number(props.data.cartline.Quantity) -\r\n                          discountAmountCalculate(\r\n                            props.data.cartline.DiscountLines,\r\n                          ),\r\n                      )}\r\n                    </span>\r\n                  </div>\r\n                ) : props.data.cartline.DiscountLines?.length > 0 ? (\r\n                  <div>\r\n                    <s>\r\n                      {props.context.cultureFormatter.formatCurrency(\r\n                        Number(\r\n                          Math.round(\r\n                            (props.data?.cartline?.Price + Number.EPSILON) *\r\n                              100,\r\n                          ) / 100,\r\n                        ) * Number(props.data.cartline.Quantity),\r\n                      )}\r\n                    </s>\r\n                    <br />\r\n                    <span className=\"msc-price__actual\">\r\n                      {props.context.cultureFormatter.formatCurrency(\r\n                        Number(\r\n                          Math.round(\r\n                            (props.data?.cartline?.Price + Number.EPSILON) *\r\n                              100,\r\n                          ) / 100,\r\n                        ) *\r\n                          Number(props.data.cartline.Quantity) -\r\n                          discountAmountCalculate(\r\n                            props.data.cartline.DiscountLines,\r\n                          ),\r\n                      )}\r\n                    </span>\r\n                  </div>\r\n                ) : (\r\n                  <span className=\"msc-price__actual\">\r\n                    {props.context.cultureFormatter.formatCurrency(\r\n                      Number(props.data?.cartline?.Price) *\r\n                        Number(props.data.cartline.Quantity),\r\n                    )}\r\n                  </span>\r\n                )\r\n              ) : props.data.cartLine.LinePercentageDiscount > 0 ? (\r\n                <div>\r\n                  <s>\r\n                    {props.context.cultureFormatter.formatCurrency(\r\n                      Number(\r\n                        Math.round(\r\n                          (props.data?.cartline?.Price + Number.EPSILON) * 100,\r\n                        ) / 100,\r\n                      ) * Number(props.data.cartLine.Quantity),\r\n                    )}\r\n                  </s>\r\n                  <br />\r\n                  <span className=\"msc-price__actual\">\r\n                    {props.context.cultureFormatter.formatCurrency(\r\n                      Number(\r\n                        Math.round(\r\n                          (props.data?.cartline?.Price + Number.EPSILON) * 100,\r\n                        ) / 100,\r\n                      ) *\r\n                        Number(props.data.cartLine.Quantity) -\r\n                        discountAmountCalculate(\r\n                          props.data.cartLine.DiscountLines,\r\n                        ),\r\n                    )}\r\n                  </span>\r\n                </div>\r\n              ) : props.data.cartLine.DiscountLines?.length > 0 ? (\r\n                <div>\r\n                  <s>\r\n                    {props.context.cultureFormatter.formatCurrency(\r\n                      Number(\r\n                        Math.round(\r\n                          (props.data?.cartline?.Price + Number.EPSILON) * 100,\r\n                        ) / 100,\r\n                      ) * Number(props.data.cartline.Quantity),\r\n                    )}\r\n                  </s>\r\n                  <br />\r\n                  <span className=\"msc-price__actual\">\r\n                    {props.context.cultureFormatter.formatCurrency(\r\n                      Number(\r\n                        Math.round(\r\n                          (props.data?.cartline?.Price + Number.EPSILON) * 100,\r\n                        ) / 100,\r\n                      ) *\r\n                        Number(props.data.cartLine.Quantity) -\r\n                        Number(\r\n                          discountAmountCalculate(\r\n                            props.data.cartLine.DiscountLines,\r\n                          ),\r\n                        ),\r\n                    )}\r\n                  </span>\r\n                </div>\r\n              ) : (\r\n                <span className=\"msc-price__actual\">\r\n                  {props.context.cultureFormatter.formatCurrency(\r\n                    Number(props.data?.cartLine.Price) *\r\n                      Number(props.data.cartLine.Quantity),\r\n                  )}\r\n                </span>\r\n              )\r\n            ) : null}\r\n\r\n            {window.location.href.includes(\"orderdetails\") == false ? (\r\n              <div>\r\n                {props.data.cartline.LinePercentageDiscount > 0 ? (\r\n                  <s>\r\n                    {props.context.cultureFormatter.formatCurrency(\r\n                      Number(\r\n                        Math.round(\r\n                          (props.data?.cartline?.Price + Number.EPSILON) * 100,\r\n                        ) / 100,\r\n                      ) * Number(props.data?.cartline?.Quantity),\r\n                    )}\r\n                  </s>\r\n                ) : props.data.cartline.DiscountLines?.length > 0 ? (\r\n                  <s>\r\n                    {props.context.cultureFormatter.formatCurrency(\r\n                      Number(\r\n                        Math.round(\r\n                          (props.data?.cartline?.Price + Number.EPSILON) * 100,\r\n                        ) / 100,\r\n                      ) * Number(props.data?.cartline?.Quantity),\r\n                    )}\r\n                  </s>\r\n                ) : (\r\n                  <React.Fragment>\r\n                    {props.context.cultureFormatter.formatCurrency(\r\n                      Number(\r\n                        Math.round(\r\n                          (props.data?.cartline?.Price + Number.EPSILON) * 100,\r\n                        ) / 100,\r\n                      ) * Number(props.data?.cartline?.Quantity),\r\n                    )}\r\n                  </React.Fragment>\r\n                )}\r\n\r\n                <h6>\r\n                  {props.data.cartline.LinePercentageDiscount > 0 &&\r\n                  props.data.cartline.DiscountLines?.length == 0\r\n                    ? props.context.cultureFormatter.formatCurrency(\r\n                        Number(\r\n                          Number(\r\n                            Math.round(\r\n                              (props.data?.cartline?.Price + Number.EPSILON) *\r\n                                100,\r\n                            ) / 100,\r\n                          ) *\r\n                            props.data?.cartline?.Quantity -\r\n                            discountAmountCalculate(\r\n                              props.data.cartline.DiscountLines,\r\n                            ),\r\n                        ),\r\n                      )\r\n                    : props.data.cartline.DiscountLines?.length > 0\r\n                    ? props.context.cultureFormatter.formatCurrency(\r\n                        Number(\r\n                          Number(\r\n                            Math.round(\r\n                              (props.data?.cartline?.Price + Number.EPSILON) *\r\n                                100,\r\n                            ) / 100,\r\n                          ) *\r\n                            Number(props.data?.cartline?.Quantity) -\r\n                            discountAmountCalculate(\r\n                              props.data.cartline.DiscountLines,\r\n                            ),\r\n                        ),\r\n                      )\r\n                    : null}\r\n                </h6>\r\n              </div>\r\n            ) : null}\r\n          </div>,\r\n        );\r\n\r\n        return nodes;\r\n      } else {\r\n        return [];\r\n      }\r\n      // No quantity selector for invoice line\r\n    };\r\n\r\n    if (props.displayMode === \"COMPACT\") {\r\n      const reducedDimensions: string = product?.Dimensions\r\n        ? product.Dimensions.reduce((str: any, productDimension: any) => {\r\n            if (\r\n              productDimension.DimensionValue &&\r\n              productDimension.DimensionValue.Value\r\n            ) {\r\n              if (str) {\r\n                return `${str}, ${productDimension.DimensionValue.Value}`;\r\n              }\r\n\r\n              return `${productDimension.DimensionValue.Value}`;\r\n            }\r\n\r\n            return str;\r\n          }, \"\")\r\n        : \"\";\r\n\r\n      return (\r\n        <div className=\"msc-cart-line msc-cart-line__compact\">\r\n          <div className=\"msc-cart-line__product-image\">\r\n            <Image\r\n              src={props.primaryImageUrl || \"\"}\r\n              fallBackSrc={fallbackImageUrl}\r\n              altText={productName}\r\n              gridSettings={props.gridSettings}\r\n              imageSettings={imageSettings}\r\n              loadFailureBehavior=\"empty\"\r\n            />\r\n          </div>\r\n          <div className=\"msc-cart-line__content\">\r\n            <a\r\n              className=\"msc-cart-line__product-title\"\r\n              href={productUrl}\r\n              {...prodAttribute}\r\n            >\r\n              {productName}\r\n            </a>\r\n            {reducedDimensions !== \"\" ? (\r\n              <div className=\"msc-cart-line__product-variants\">\r\n                {destructDimensionStrings?.colorString}: {reducedDimensions}\r\n              </div>\r\n            ) : (\r\n              \"\"\r\n            )}\r\n            {_generateQuantityAndPrice()}\r\n          </div>\r\n        </div>\r\n      );\r\n    }\r\n\r\n    let filterAtpDate =\r\n      atp?.length &&\r\n      atp.filter(\r\n        (obj: any, index: number, self: any) =>\r\n          index ===\r\n          self.findIndex(\r\n            (item: any) => item.productRecordID === obj.productRecordID,\r\n          ),\r\n      );\r\n\r\n    return (\r\n      <div className=\"msc-cart-line\">\r\n        <div className=\"msc-cart-line__product-image\">\r\n          <Image\r\n            src={props.primaryImageUrl || \"\"}\r\n            fallBackSrc={fallbackImageUrl}\r\n            altText={productName}\r\n            gridSettings={props.gridSettings}\r\n            imageSettings={imageSettings}\r\n            loadFailureBehavior=\"empty\"\r\n          />\r\n          <div className=\"product-info\">\r\n            <a\r\n              className=\"msc-cart-line__product-title\"\r\n              href={productUrl}\r\n              {...prodAttribute}\r\n              onClick={() => {}}\r\n            >\r\n              {productName}\r\n            </a>\r\n            {renderDisountLines}\r\n            {ArrayExtensions.hasElements(productDimensions) ? (\r\n              <div className=\"msc-cart-line__product-variants\">\r\n                {productDimensions}\r\n              </div>\r\n            ) : (\r\n              \"\"\r\n            )}\r\n          </div>\r\n        </div>\r\n\r\n        {props.showShippingChargesForLineItems && (\r\n          <div className=\"msc-cart-line__freight\">{renderShippingLabel}</div>\r\n        )}\r\n        {renderOtherCharges}\r\n        {_generateQuantityAndPrice()}\r\n\r\n        {(screenSize && screenSize === 1) || screenSize === 2 ? (\r\n          <></>\r\n        ) : (\r\n          <div className=\"product-atp small-blks\">\r\n            <label className=\"mobile-label\">\r\n              {allProps === undefined ? \"\" : allProps.resources.atpCartTitle}\r\n            </label>\r\n            {filterAtpDate.map((item: any, index: any) => {\r\n              let whatToShowInATPField: string = \"\";\r\n              if (\r\n                item &&\r\n                item.atpDate !== \"\" &&\r\n                storeIndexes.includes(props.data.product?.RecordId) &&\r\n                item.currentQuantity\r\n              ) {\r\n                whatToShowInATPField = \"NA\";\r\n              } else if (item) {\r\n                if (item.atpDate === \"\" || item.currentQuantity === 0) {\r\n                  whatToShowInATPField = \"\";\r\n                } else {\r\n                  // whatToShowInATPField = item.atpDate;\r\n                  whatToShowInATPField = atpIndexDate;\r\n                }\r\n              }\r\n              if (item.productRecordID === props.data.product?.RecordId) {\r\n                return <span>{whatToShowInATPField}</span>;\r\n              }\r\n              return \"\";\r\n            })}\r\n          </div>\r\n        )}\r\n      </div>\r\n    );\r\n  } else {\r\n    return <></>;\r\n  }\r\n};\r\n\r\nexport const CartLineItemAtpComponent: React.FunctionComponent<ICartLineProps> =\r\n  msdyn365Commerce.createComponentOverride<any>(\"CartLineItem\", {\r\n    component: CartLine,\r\n    ...CartLineItemFunctions,\r\n  });\r\n\r\nexport default CartLineItemAtpComponent;\r\n","// tslint:disable\r\nimport * as EntityClasses from \"@msdyn365-commerce/retail-proxy/dist/Entities/CommerceModels.g\";\r\n// import * as Entities from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\r\n// import { jsonLightReadStringPropertyValue } from '@msdyn365-commerce/retail-proxy/dist/externals';\r\n\r\n/**\r\n * ValidateCouponCodeResponse entity interface.\r\n */\r\nexport interface IValidateCouponCodeResponse {\r\n  Status?: boolean;\r\n  Message?: string;\r\n  Code?: string;\r\n}\r\n\r\n/**\r\n * ShipmentTrackingLines entity interface.\r\n */\r\nexport interface IShipmentTrackingLines {\r\n  TrackingLine?: ITrackingLine[];\r\n}\r\n\r\n/**\r\n * ProductReferenceNumber entity interface.\r\n */\r\nexport interface IProductReferenceNumber {\r\n  Id: number;\r\n  ReferenceNumber?: string;\r\n}\r\n\r\n/**\r\n * InvoiceInquiryResult entity interface.\r\n */\r\nexport interface IInvoiceInquiryResult {\r\n  EmailSent: boolean;\r\n  Message?: string;\r\n}\r\n\r\n/**\r\n * TrackingLine entity interface.\r\n */\r\nexport interface ITrackingLine {\r\n  LineNumber?: string;\r\n  TrackingId?: string;\r\n  TrackingUrl?: string;\r\n}\r\n\r\n/**\r\n * ValidateCouponCodeResponse entity class.\r\n */\r\nexport class ValidateCouponCodeResponseExtensionClass\r\n  implements IValidateCouponCodeResponse\r\n{\r\n  // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n  public Status: boolean;\r\n\r\n  // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n  public Message: string;\r\n\r\n  // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n  public Code: string;\r\n\r\n  // Navigation properties names\r\n\r\n  /**\r\n   * Construct an object from odata response.\r\n   * @param {any} odataObject The odata result object.\r\n   */\r\n  constructor(odataObject?: any) {\r\n    odataObject = odataObject || {};\r\n    // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n    this.Status = odataObject.Status;\r\n\r\n    // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n    this.Message = odataObject.Message;\r\n\r\n    // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n    this.Code = odataObject.Code;\r\n  }\r\n}\r\n\r\n/**\r\n * ShipmentTrackingLines entity class.\r\n */\r\nexport class ShipmentTrackingLinesExtensionClass\r\n  implements IShipmentTrackingLines\r\n{\r\n  // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n  public TrackingLine: ITrackingLine[];\r\n\r\n  // Navigation properties names\r\n\r\n  /**\r\n   * Construct an object from odata response.\r\n   * @param {any} odataObject The odata result object.\r\n   */\r\n  constructor(odataObject?: any) {\r\n    odataObject = odataObject || {};\r\n    // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n    this.TrackingLine = undefined;\r\n    if (odataObject.TrackingLine) {\r\n      this.TrackingLine = [];\r\n      for (var i = 0; i < odataObject.TrackingLine.length; i++) {\r\n        if (odataObject.TrackingLine[i]) {\r\n          if (odataObject.TrackingLine[i][\"@odata.type\"]) {\r\n            var className: string = odataObject.TrackingLine[i][\"@odata.type\"];\r\n            className = className\r\n              .substr(className.lastIndexOf(\".\") + 1)\r\n              .concat(\"Class\");\r\n            if (EntityClasses[className]) {\r\n              this.TrackingLine[i] = new EntityClasses[className](\r\n                odataObject.TrackingLine[i]\r\n              );\r\n            }\r\n          } else {\r\n            this.TrackingLine[i] = new TrackingLineExtensionClass(\r\n              odataObject.TrackingLine[i]\r\n            );\r\n          }\r\n        } else {\r\n          // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n          this.TrackingLine[i] = undefined;\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n\r\n/**\r\n * ProductReferenceNumber entity class.\r\n */\r\nexport class ProductReferenceNumberExtensionClass\r\n  implements IProductReferenceNumber\r\n{\r\n  // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n  public Id: number;\r\n\r\n  // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n  public ReferenceNumber: string;\r\n\r\n  // Navigation properties names\r\n\r\n  /**\r\n   * Construct an object from odata response.\r\n   * @param {any} odataObject The odata result object.\r\n   */\r\n  constructor(odataObject?: any) {\r\n    odataObject = odataObject || {};\r\n    // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n    this.Id = odataObject.Id ? parseInt(odataObject.Id, 10) : 0;\r\n\r\n    // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n    this.ReferenceNumber = odataObject.ReferenceNumber;\r\n  }\r\n}\r\n\r\n/**\r\n * InvoiceInquiryResult entity class.\r\n */\r\nexport class InvoiceInquiryResultExtensionClass\r\n  implements IInvoiceInquiryResult\r\n{\r\n  // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n  public EmailSent: boolean;\r\n\r\n  // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n  public Message: string;\r\n\r\n  // Navigation properties names\r\n\r\n  /**\r\n   * Construct an object from odata response.\r\n   * @param {any} odataObject The odata result object.\r\n   */\r\n  constructor(odataObject?: any) {\r\n    odataObject = odataObject || {};\r\n    // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n    this.EmailSent = odataObject.EmailSent;\r\n\r\n    // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n    this.Message = odataObject.Message;\r\n  }\r\n}\r\n\r\n/**\r\n * TrackingLine entity class.\r\n */\r\nexport class TrackingLineExtensionClass implements ITrackingLine {\r\n  // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n  public LineNumber: string;\r\n\r\n  // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n  public TrackingId: string;\r\n\r\n  // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n  public TrackingUrl: string;\r\n\r\n  // Navigation properties names\r\n\r\n  /**\r\n   * Construct an object from odata response.\r\n   * @param {any} odataObject The odata result object.\r\n   */\r\n  constructor(odataObject?: any) {\r\n    odataObject = odataObject || {};\r\n    // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n    this.LineNumber = odataObject.LineNumber;\r\n\r\n    // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n    this.TrackingId = odataObject.TrackingId;\r\n\r\n    // @ts-ignore - TODO bug fix #23427261 - remove ts-ignore - https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/23427261/\r\n    this.TrackingUrl = odataObject.TrackingUrl;\r\n  }\r\n}\r\n","/*!\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n * THIS FILE IS AN AUTOGENERATED TYPESCRIPT PROXY EXTENSION.\r\n * TO USE THIS FILE, IT MUST BE ADDED TO A D365COMMERCE APPLICATION\r\n */\r\n// tslint:disable\r\nimport {\r\n  AsyncResult,\r\n  callActionOrExecute,\r\n  DataServiceQuery,\r\n  IContext,\r\n  IDataServiceRequest,\r\n  IQueryResultSettings,\r\n} from \"@msdyn365-commerce/retail-proxy\";\r\n// import { AsyncResult, callActionOrExecute, DataServiceQuery, IContext, IDataServiceRequest, IQueryResultSettings, NullResult } from '@msdyn365-commerce/retail-proxy';\r\n\r\n// @ts-ignore\r\nimport * as EntityClasses from \"@msdyn365-commerce/retail-proxy/dist/Entities/CommerceModels.g\";\r\n// import * as Entities from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\r\nimport * as DataServiceEntities from \"./PromoCodeValidationDataServiceEntities.g\";\r\n\r\nfunction validateCouponQuery(): DataServiceQuery {\r\n  return new DataServiceQuery();\r\n}\r\n\r\nexport function validateCouponInput(\r\n  cartId: string,\r\n  couponCode: string\r\n): IDataServiceRequest {\r\n  const query = validateCouponQuery();\r\n  return query.createDataServiceRequestForOperation(\r\n    \"ValidateCoupon\",\r\n    true,\r\n    DataServiceEntities.ValidateCouponCodeResponseExtensionClass,\r\n    \"false\",\r\n    {\r\n      bypassCache: \"get\",\r\n      returnEntity: \"DataServiceEntities.IValidateCouponCodeResponse\",\r\n    },\r\n    {\r\n      cartId: cartId,\r\n      couponCode: couponCode,\r\n    }\r\n  );\r\n}\r\n\r\nexport function validateCouponAsync(\r\n  context: IContext,\r\n  cartId: string,\r\n  couponCode: string\r\n): AsyncResult<DataServiceEntities.IValidateCouponCodeResponse> {\r\n  const request = validateCouponInput(cartId, couponCode);\r\n  return callActionOrExecute<DataServiceEntities.IValidateCouponCodeResponse>(\r\n    request,\r\n    context.callerContext\r\n  );\r\n}\r\n\r\nfunction getShiptrackTrackingNumberQuery(): DataServiceQuery {\r\n  return new DataServiceQuery();\r\n}\r\n\r\nexport function getShiptrackTrackingNumberInput(\r\n  salesOrderNum: string\r\n): IDataServiceRequest {\r\n  const query = getShiptrackTrackingNumberQuery();\r\n  return query.createDataServiceRequestForOperation(\r\n    \"GetShiptrackTrackingNumber\",\r\n    true,\r\n    DataServiceEntities.ShipmentTrackingLinesExtensionClass,\r\n    \"false\",\r\n    {\r\n      bypassCache: \"get\",\r\n      returnEntity: \"DataServiceEntities.IShipmentTrackingLines\",\r\n    },\r\n    {\r\n      salesOrderNum: salesOrderNum,\r\n    }\r\n  );\r\n}\r\n\r\nexport function getShiptrackTrackingNumberAsync(\r\n  context: IContext,\r\n  salesOrderNum: string\r\n): AsyncResult<DataServiceEntities.IShipmentTrackingLines> {\r\n  const request = getShiptrackTrackingNumberInput(salesOrderNum);\r\n  return callActionOrExecute<DataServiceEntities.IShipmentTrackingLines>(\r\n    request,\r\n    context.callerContext\r\n  );\r\n}\r\n\r\nfunction getProductsReferenceNumberQuery(): DataServiceQuery {\r\n  return new DataServiceQuery();\r\n}\r\n\r\nexport function getProductsReferenceNumberInput(\r\n  queryResultSettings: IQueryResultSettings,\r\n  productIds: number[]\r\n): IDataServiceRequest {\r\n  const query =\r\n    getProductsReferenceNumberQuery().resultSettings(queryResultSettings);\r\n  return query.createDataServiceRequestForOperation(\r\n    \"GetProductsReferenceNumber\",\r\n    true,\r\n    DataServiceEntities.ProductReferenceNumberExtensionClass,\r\n    \"true\",\r\n    {\r\n      bypassCache: \"get\",\r\n      returnEntity: \"DataServiceEntities.IProductReferenceNumber\",\r\n    },\r\n    {\r\n      productIds: productIds,\r\n    }\r\n  );\r\n}\r\n\r\nexport function getProductsReferenceNumberAsync(\r\n  context: IContext,\r\n  productIds: number[]\r\n): AsyncResult<DataServiceEntities.IProductReferenceNumber[]> {\r\n  const request = getProductsReferenceNumberInput(\r\n    context.queryResultSettings || {},\r\n    productIds\r\n  );\r\n  return callActionOrExecute<DataServiceEntities.IProductReferenceNumber[]>(\r\n    request,\r\n    context.callerContext\r\n  );\r\n}\r\n\r\nfunction customerInvoiceInquiryQuery(): DataServiceQuery {\r\n  return new DataServiceQuery();\r\n}\r\n\r\nexport function customerInvoiceInquiryInput(\r\n  invoiceId: string,\r\n  customerId: string,\r\n  reason: string,\r\n  comment: string,\r\n  emailAddress: string\r\n): IDataServiceRequest {\r\n  const query = customerInvoiceInquiryQuery();\r\n  return query.createDataServiceRequestForOperation(\r\n    \"CustomerInvoiceInquiry\",\r\n    true,\r\n    DataServiceEntities.InvoiceInquiryResultExtensionClass,\r\n    \"false\",\r\n    {\r\n      bypassCache: \"get\",\r\n      returnEntity: \"DataServiceEntities.IInvoiceInquiryResult\",\r\n    },\r\n    {\r\n      invoiceId: invoiceId,\r\n      customerId: customerId,\r\n      reason: reason,\r\n      comment: comment,\r\n      emailAddress: emailAddress,\r\n    }\r\n  );\r\n}\r\n\r\nexport function customerInvoiceInquiryAsync(\r\n  context: IContext,\r\n  invoiceId: string,\r\n  customerId: string,\r\n  reason: string,\r\n  comment: string,\r\n  emailAddress: string\r\n): AsyncResult<DataServiceEntities.IInvoiceInquiryResult> {\r\n  const request = customerInvoiceInquiryInput(\r\n    invoiceId,\r\n    customerId,\r\n    reason,\r\n    comment,\r\n    emailAddress\r\n  );\r\n  return callActionOrExecute<DataServiceEntities.IInvoiceInquiryResult>(\r\n    request,\r\n    context.callerContext\r\n  );\r\n}\r\n\r\nfunction getKeyVaultValueAsyncQuery(): DataServiceQuery {\r\n  return new DataServiceQuery();\r\n}\r\n\r\nexport function getKeyVaultValueAsyncInput(\r\n  keyVaultName: string\r\n): IDataServiceRequest {\r\n  const query = getKeyVaultValueAsyncQuery();\r\n  return query.createDataServiceRequestForOperation(\r\n    \"GetKeyVaultValueAsync\",\r\n    true,\r\n    \"\",\r\n    \"false\",\r\n    { bypassCache: \"get\", returnEntity: \"\" },\r\n    {\r\n      keyVaultName: keyVaultName,\r\n    }\r\n  );\r\n}\r\n\r\nexport function getKeyVaultValueAsyncAsync(\r\n  context: IContext,\r\n  keyVaultName: string\r\n): AsyncResult<string> {\r\n  const request = getKeyVaultValueAsyncInput(keyVaultName);\r\n  return callActionOrExecute<string>(request, context.callerContext);\r\n}\r\n","/*!\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n */\r\n\r\nimport {\r\n  IComponent,\r\n  IComponentProps,\r\n  msdyn365Commerce,\r\n} from \"@msdyn365-commerce/core\";\r\nimport {ICartState} from \"@msdyn365-commerce/global-state\";\r\nimport {Coupon} from \"@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g\";\r\nimport {\r\n  Button,\r\n  format,\r\n  getPayloadObject,\r\n  getTelemetryAttributes,\r\n  IPayLoad,\r\n  ITelemetryContent,\r\n  TelemetryConstant,\r\n} from \"@msdyn365-commerce-modules/utilities\";\r\nimport * as React from \"react\";\r\n\r\nimport {PriceComponent} from \"@msdyn365-commerce/components\";\r\nimport {validateCouponAsync} from \"../../../../actions/PromoCodeValidationDataActionExtension.g\";\r\nexport interface IPromoCodeProps extends IComponentProps<{}> {\r\n  cart: ICartState | undefined;\r\n  promoCodeHeadingText: string;\r\n  appliedPromoCodeHeadingText: string;\r\n  removePromoAriaLabelFormat: string;\r\n  promoPlaceholderText: string;\r\n  promoCodeApplyButtonText: string;\r\n  collapseTimeOut: number;\r\n  removePromoText: string;\r\n  invalidPromoCodeErrorText: string;\r\n  failedToAddPromoCodeErrorText: string;\r\n  duplicatePromoCodeErrorText: string;\r\n  failedToRemovePromoCodeErrorText: string;\r\n  multiPromoCodeError: string;\r\n\r\n  /**\r\n   * The telemetry content\r\n   */\r\n  telemetryContent?: ITelemetryContent;\r\n  promoCodeApplyCallback?(): void;\r\n  // cartId : string | undefined; //\r\n  // couponCode : (string | undefined)[] //\r\n}\r\n\r\nexport interface IPromoCodeComponent extends IComponent<IPromoCodeProps> {}\r\n\r\nconst PromoCodeComponentActions = {};\r\n\r\ninterface IPromoCodeState {\r\n  isCollapseOpen: boolean;\r\n  promoCodeInputValue: string;\r\n  error: string;\r\n  canApply: boolean;\r\n}\r\n\r\nexport interface PromoAPIRequestObject {\r\n  cartId: string | undefined;\r\n  couponCode: string | undefined;\r\n}\r\n/**\r\n *\r\n * The PromoCode component renders the promocode section.\r\n * @extends {React.PureComponent<IRefineSubmenuProps>}\r\n */\r\nclass PromoCode extends React.Component<IPromoCodeProps, IPromoCodeState> {\r\n  private readonly payLoad: IPayLoad;\r\n\r\n  constructor(props: IPromoCodeProps, state: IPromoCodeState) {\r\n    super(props);\r\n    this.payLoad = getPayloadObject(\r\n      \"click\",\r\n      this.props.telemetryContent!,\r\n      TelemetryConstant.ApplyPromoCode,\r\n    );\r\n    this.state = {\r\n      isCollapseOpen: false,\r\n      promoCodeInputValue: \"\",\r\n      error: \"\",\r\n      canApply: false,\r\n    };\r\n  }\r\n\r\n  public shouldComponentUpdate(nextProps: IPromoCodeProps): boolean {\r\n    if (\r\n      this.props.appliedPromoCodeHeadingText !==\r\n      nextProps.appliedPromoCodeHeadingText\r\n    ) {\r\n      return false;\r\n    }\r\n    return true;\r\n  }\r\n\r\n  public render(): JSX.Element {\r\n    return (\r\n      <div>\r\n        <div className=\"msc-promo-code-heading\">\r\n          {this.props.promoCodeHeadingText}\r\n        </div>\r\n        {this._renderForm(\r\n          this.props.promoPlaceholderText,\r\n          this.props.promoCodeApplyButtonText,\r\n          this.props.cart,\r\n        )}\r\n        <p\r\n          className={this.state.error ? \"msc-alert-danger\" : \"\"}\r\n          aria-live=\"assertive\"\r\n        >\r\n          {this.state.error}\r\n        </p>\r\n        {this._renderAppliedPromoCode(this.props)}\r\n      </div>\r\n    );\r\n  }\r\n\r\n  private readonly _onInputChange = (\r\n    e: React.ChangeEvent<HTMLInputElement>,\r\n  ) => {\r\n    const error = e.target.value === \"\" ? \"\" : this.state.error;\r\n    this.setState({\r\n      promoCodeInputValue: e.target.value.trim(),\r\n      error,\r\n      canApply: !!e.target.value,\r\n    });\r\n  };\r\n\r\n  private readonly _applyPromotion = (cartState: ICartState | undefined) => {\r\n    if (!cartState || !cartState.cart) {\r\n      return;\r\n    }\r\n    const appliedPromo = this.state.promoCodeInputValue;\r\n    cartState\r\n      .addPromoCode({promoCode: appliedPromo})\r\n      .then((result) => {\r\n        if (result.status === \"SUCCESS\") {\r\n          // Show success text\r\n          this.setState({promoCodeInputValue: \"\", error: \"\", canApply: false});\r\n        } else if (result.substatus === \"ALREADYADDED\") {\r\n          this.setState({error: this.props.duplicatePromoCodeErrorText});\r\n        } else {\r\n          this.setState({error: this.props.invalidPromoCodeErrorText});\r\n        }\r\n      })\r\n      .catch((error) => {\r\n        this.setState({error: this.props.failedToAddPromoCodeErrorText});\r\n      });\r\n  };\r\n\r\n  //VSI-Customization-Talha start BugFix-2665\r\n  private readonly _checkIfAppliedPromoCodeMoreThanOne = (\r\n    props: IPromoCodeProps,\r\n    cartState: ICartState | undefined,\r\n  ) => {\r\n    let couponCodes =\r\n      props && props.cart && props.cart.cart && props.cart.cart.Coupons;\r\n    if (couponCodes && couponCodes?.length > 0) {\r\n      this._handlePromoCall(props, cartState);\r\n    } else {\r\n      this._applyPromotion(cartState);\r\n    }\r\n  };\r\n\r\n  private readonly _handlePromoCall = async (\r\n    props?: IPromoCodeProps,\r\n    cartState?: ICartState | undefined,\r\n  ) => {\r\n    let cartId = props?.cart?.cart.Id ?? `${props?.cart?.cart.Id}`;\r\n\r\n    let couponCodes =\r\n      props && props.cart && props.cart.cart && props.cart.cart.Coupons;\r\n    const appliedPromo = this.state.promoCodeInputValue;\r\n\r\n    if (couponCodes?.length !== 0) {\r\n      validateCouponAsync(\r\n        {callerContext: this.props.context.actionContext},\r\n        cartId,\r\n        appliedPromo,\r\n      )\r\n        .then((res) => {\r\n          if (res.Status === true) {\r\n            this._applyPromotion(cartState);\r\n          } else {\r\n            this.setState({error: this.props.multiPromoCodeError});\r\n          }\r\n        })\r\n        .catch((err) => {\r\n          return err;\r\n        });\r\n    }\r\n  };\r\n  //VSI-Customization-Talha end BugFix-2665\r\n\r\n  private readonly _renderForm = (\r\n    promoPlaceholderText: string,\r\n    promoCodeApplyButtonText: string,\r\n    cartState: ICartState | undefined,\r\n  ) => {\r\n    const _onSubmit = (event: React.FormEvent<HTMLFormElement>) => {\r\n      event.preventDefault();\r\n\r\n      this._applyPromotion(cartState);\r\n    };\r\n    const _applyPromotion = (event?: React.MouseEvent<HTMLElement>) => {\r\n      // this._applyPromotion(cartState);\r\n      this._checkIfAppliedPromoCodeMoreThanOne(this.props, cartState); //VSI-Customization BugFix-2665\r\n    };\r\n    const attributes = getTelemetryAttributes(\r\n      this.props.telemetryContent!,\r\n      this.payLoad,\r\n    );\r\n\r\n    const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\r\n      if (e.key === \"Enter\") {\r\n        e.preventDefault();\r\n        _applyPromotion();\r\n      }\r\n    };\r\n    return (\r\n      <form onSubmit={_onSubmit} className=\"msc-promo-code__form-container\">\r\n        <div className=\"msc-promo-code__group\">\r\n          <input\r\n            className=\"msc-promo-code__input-box\"\r\n            aria-label={promoPlaceholderText}\r\n            onChange={this._onInputChange}\r\n            value={this.state.promoCodeInputValue}\r\n            placeholder={promoPlaceholderText}\r\n            onKeyDown={handleKeyDown}\r\n          />\r\n          <Button\r\n            title={promoCodeApplyButtonText}\r\n            className=\"msc-promo-code__apply-btn btn\"\r\n            onClick={_applyPromotion}\r\n            disabled={!this.state.canApply}\r\n            {...attributes}\r\n          >\r\n            {promoCodeApplyButtonText}\r\n          </Button>\r\n        </div>\r\n      </form>\r\n    );\r\n  };\r\n\r\n  private readonly _removePromotion = (\r\n    cartState: ICartState | undefined,\r\n    event: React.MouseEvent,\r\n  ) => {\r\n    if (!cartState) {\r\n      return;\r\n    }\r\n    const code = event.currentTarget.getAttribute(\"data-value\") || \"\";\r\n    cartState\r\n      .removePromoCodes({\r\n        promoCodes: [code],\r\n      })\r\n      .then((result) => {\r\n        if (result.status === \"SUCCESS\") {\r\n          this.setState({error: \"\"});\r\n        }\r\n      })\r\n      .catch(() => {\r\n        this.setState({error: this.props.failedToRemovePromoCodeErrorText});\r\n      });\r\n  };\r\n\r\n  private readonly _calculateDiscount = (\r\n    code: string,\r\n    cartState: ICartState | undefined,\r\n  ) => {\r\n    if (\r\n      !cartState ||\r\n      !cartState.cart ||\r\n      !cartState.cart.CartLines ||\r\n      cartState.cart.CartLines.length === 0 ||\r\n      !code\r\n    ) {\r\n      return;\r\n    }\r\n    let discountAmount = 0;\r\n    for (const line of cartState.cart.CartLines) {\r\n      if (line.DiscountLines) {\r\n        for (const discountLine of line.DiscountLines) {\r\n          if (discountLine.DiscountCode === code) {\r\n            discountAmount += discountLine.DiscountCost!;\r\n          }\r\n        }\r\n      }\r\n    }\r\n    return discountAmount * -1;\r\n  };\r\n\r\n  private readonly _renderAppliedPromoCode = (props: IPromoCodeProps) => {\r\n    if (\r\n      !props.cart ||\r\n      !props.cart.cart ||\r\n      !props.cart.cart.Coupons ||\r\n      !(props.cart.cart.Coupons.length > 0)\r\n    ) {\r\n      return;\r\n    }\r\n    const _removePromotion = (event: React.MouseEvent<HTMLElement>) => {\r\n      this._removePromotion(props.cart, event);\r\n    };\r\n    let totalCouponDiscountAmount = 0;\r\n    for (const coupon of props.cart.cart.Coupons) {\r\n      const discountAmount = this._calculateDiscount(\r\n        coupon.Code ?? \"\",\r\n        props.cart,\r\n      );\r\n      if (discountAmount) {\r\n        totalCouponDiscountAmount += discountAmount;\r\n      }\r\n    }\r\n\r\n    return (\r\n      <>\r\n        <div className=\"msc-promo-code__discount\">\r\n          <div className=\"msc-promo-code__discount-heading\">\r\n            {this.props.appliedPromoCodeHeadingText}\r\n          </div>\r\n          <PriceComponent\r\n            data={{\r\n              price: {\r\n                CustomerContextualPrice: totalCouponDiscountAmount,\r\n              },\r\n            }}\r\n            context={props.context}\r\n            id={props.id}\r\n            typeName={props.typeName}\r\n            className=\"msc-promo-code__discount-value\"\r\n          />\r\n        </div>\r\n        {props.cart.cart.Coupons.map((coupon: Coupon) => {\r\n          const ariaLabel = props.removePromoAriaLabelFormat\r\n            ? format(\r\n                props.removePromoAriaLabelFormat,\r\n                props.removePromoText,\r\n                coupon.Code,\r\n              )\r\n            : \"\";\r\n\r\n          return (\r\n            <div key={coupon.Code} className=\"msc-promo-code__line-container\">\r\n              <div className=\"msc-promo-code__line-value\">\r\n                {coupon.Code}\r\n                {` `}\r\n                <PriceComponent\r\n                  data={{\r\n                    price: {\r\n                      CustomerContextualPrice: this._calculateDiscount(\r\n                        coupon.Code || \"\",\r\n                        props.cart,\r\n                      ),\r\n                    },\r\n                  }}\r\n                  context={props.context}\r\n                  id={props.id}\r\n                  typeName={props.typeName}\r\n                  className=\"msc-promo-code__line-discount-value\"\r\n                />\r\n              </div>\r\n              <Button\r\n                title={props.removePromoText}\r\n                className=\"msc-promo-code__line__btn-remove\"\r\n                onClick={_removePromotion}\r\n                data-value={coupon.Code}\r\n                aria-label={ariaLabel}\r\n              >\r\n                {props.removePromoText}\r\n              </Button>\r\n            </div>\r\n          );\r\n        })}\r\n      </>\r\n    );\r\n  };\r\n}\r\n\r\nexport const PromoCodeComponent: React.FunctionComponent<IPromoCodeProps> =\r\n  //@ts-expect-error\r\n  msdyn365Commerce.createComponentOverride<IPromoCodeComponent>(\"PromoCode\", {\r\n    component: PromoCode,\r\n    ...PromoCodeComponentActions,\r\n  });\r\n\r\nexport default PromoCodeComponent;\r\n"],"names":["CartLineItemFunctions","renderProductDimensions","Product","DimensionStrings","Dimensions","map","productDimension","DimensionTypeValue","React","key","RecordId","className","colorString","DimensionValue","Value","configString","sizeString","IsGiftCard","amountString","styleString","renderDiscountLines","props","_props$data","_props$data$cartline","_props$data$cartline2","data","cartline","DiscountLines","length","price","Price","Quantity","discountLine","index","CustomerDiscountTypeValue","OfferId","OfferName","resources","discountStringText","context","cultureFormatter","formatCurrency","Number","EffectiveAmount","EffectivePercentage","PrevSum","arr","currentIndex","sum","i","toFixed","renderInventoryLabel","inventoryInformationLabel","inventoryCssName","inventoryLabelClassName","renderShippingLabel","_props$context$reques","pickupDeliveryModeCode","request","channel","PickupDeliveryModeCode","channelDeliveryOptionConfig","hasShippingMethod","_channelDeliveryOptio","undefined","DeliveryMode","PickupDeliveryModeCodes","some","deliveryMode","shippingChargeLines","ChargeLines","filter","chargeLine","IsShipping","freightFee","reduce","chargeTotal","CalculatedAmount","priceComponent","PriceComponent","CustomerContextualPrice","freePriceText","id","typeName","currencyCode","shippingChargesText","renderOtherCharges","_cartline$ChargeLines","otherCharges","chargeline","otherCharge","Description","CartLineItemAtpComponent","msdyn365Commerce","createComponentOverride","_objectSpread","component","productUrl","allProps","atp","callFromCart","stopAtp","atpIndexDate","product","defaultImageSettings","viewports","xs","q","w","h","lg","xl","lazyload","cropFocalRegion","destructDimensionStrings","fallbackImageUrl","getFallbackImageUrl","ItemId","actionContext","requestContext","apiSettings","imageSettings","ObjectExtensions","isNullOrUndefined","productDimensions","renderDisountLines","payLoad","getPayloadObject","telemetryContent","toString","prodAttribute","getTelemetryAttributes","productName","Name","getProductPageUrlSync","discountAmountCalculate","discountLines","element","window","document","localStorage","screenSize","setScreenSize","storeIndexes","setStoreIndexes","_generateErrorMessage","isCartIcon","maxQuantity","currentQuantity","limitReached","errorMessage","_isMobile","_getScreenSize","onChange","newValue","_props$data$product","storeArray","quantityOnChange","cartLine","Set","device","Type","innerWidth","gridSettings","sm","md","_generateSelectMenu","quantity","_props$data$product2","_props$data$cartLine","_props$data$cartLine2","IncrementalQuantity","LineId","max","currentCount","inputQuantityAriaLabel","decrementButtonAriaLabel","incrementButtonAriaLabel","disabled","isCartStateReady","isGiftCard","_generateQuantityAndPrice","_props$data$cartline3","_props$data$cartline4","nodes","discountArray","ele","Percentage","_props$data2","_props$data$cartline$5","_props$data11","_props$data12","_props$data$cartline$6","_props$data13","_props$data14","_props$data15","_props$data16","_props$data17","_props$data$cartLine$","_props$data18","_props$data19","_props$data20","_props$data21","_props$data22","_props$data$cartline$7","_props$data23","_props$data24","_props$data25","_props$data26","_props$data$cartline$8","_props$data27","_props$data28","_props$data$cartline$9","_props$data29","_props$data30","_props$data$product3","_props$data$cartline6","_props$data$cartline$3","_props$data$cartline7","_props$data$cartline8","_props$data8","_props$data9","_props$data$cartline9","_props$data$cartline$4","_props$data10","_props$data3","_props$data$cartline$","_props$data4","_props$data5","_props$data6","_props$data$cartline5","_props$data$cartline$2","_props$data7","IsInvoiceLine","isQuantityEditable","push","priceTranslation","LinePercentageDiscount","Math","round","EPSILON","quantityDisplayString","location","href","includes","displayMode","reducedDimensions","str","Image","src","primaryImageUrl","fallBackSrc","altText","loadFailureBehavior","Object","assign","filterAtpDate","obj","self","findIndex","item","productRecordID","onClick","ArrayExtensions","hasElements","showShippingChargesForLineItems","atpCartTitle","_props$data$product4","_props$data$product5","whatToShowInATPField","atpDate","ValidateCouponCodeResponseExtensionClass","constructor","odataObject","this","Status","Message","Code","validateCouponInput","cartId","couponCode","DataServiceQuery","createDataServiceRequestForOperation","DataServiceEntities","bypassCache","returnEntity","PromoCode","state","super","_onInputChange","e","error","target","value","setState","promoCodeInputValue","trim","canApply","_applyPromotion","cartState","cart","appliedPromo","addPromoCode","promoCode","then","result","status","substatus","duplicatePromoCodeErrorText","invalidPromoCodeErrorText","catch","failedToAddPromoCodeErrorText","_checkIfAppliedPromoCodeMoreThanOne","couponCodes","Coupons","_handlePromoCall","async","_props$cart$cart$Id","_props$cart","_props$cart2","Id","callActionOrExecute","callerContext","validateCouponAsync","res","multiPromoCodeError","err","_renderForm","promoPlaceholderText","promoCodeApplyButtonText","event","attributes","onSubmit","preventDefault","placeholder","onKeyDown","Button","title","_removePromotion","code","currentTarget","getAttribute","removePromoCodes","promoCodes","failedToRemovePromoCodeErrorText","_calculateDiscount","CartLines","discountAmount","line","DiscountCode","DiscountCost","_renderAppliedPromoCode","totalCouponDiscountAmount","coupon","_coupon$Code","appliedPromoCodeHeadingText","ariaLabel","removePromoAriaLabelFormat","format","removePromoText","TelemetryConstant","ApplyPromoCode","isCollapseOpen","shouldComponentUpdate","nextProps","render","promoCodeHeadingText","PromoCodeComponent"],"sourceRoot":""}