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yBJ,EAAc,CAAC,CAACK,IAAKd,EAAoBe,MAAO,CAAEC,YAAaX,MAAAA,OAAF,EAAEA,EAAYO,UAAY,GACtH,OAAI/C,GACOoD,EAAAA,EAAAA,gCACH,CAAEC,cAAevE,EAAKwE,YAAa,OACnC1C,EAAcK,aAAaC,KAAKqC,GAChC7B,EACAsB,GACFQ,MAAKC,IACC,IAAKA,EAAuBC,gBAAkBD,EAAuBE,kBACjE,MAAM,IAAIhD,MACN,+IAGR,OAAO8C,KAEV3C,OAAMC,IAGH,MAFAjC,EAAI2B,UAAUC,UAAUK,GACxBjC,EAAI2B,UAAUmD,MAAM,2CACd7C,KAGX,GAGJ,MAAM8C,GAA6CC,EAAAA,EAAAA,IAA2B,CACjF9E,GAAI,+EACJL,OAAyC6B,EACzC3B,MAAOqB,IAGX,8FClKM,MAAO6D,EAETzF,cAIO,KAAAC,YAAc,IAAM,oBACpB,KAAAC,mBAAqB,IAAM,oBAC3B,KAAAC,cAAgB,IAA0B,eA4BrD,QAAeC,EAAAA,GAAoC,CAC/CC,OATJC,eAAsBC,EAA+BC,GAKjD,MAAO,CAAEkF,WAAY,GAAIC,aAAc,GAAIC,oBAAqB,KAMhElF,GAAI,oBACJH,MAnBiBI,GACV,IAAI8E,oGCtBT,MAAOI,EAET7F,cAIO,KAAAC,YAAc,IAAM,6BACpB,KAAAC,mBAAqB,IAAM,6BAC3B,KAAAC,cAAgB,IAA0B,eA6BrD,QAAeC,EAAAA,GAAoC,CAC/CC,OATJC,eAAsBC,EAAqCC,GAKvD,MAAO,CAAEsF,qBAAqB,EAAOC,kBAAkB,EAAOC,sBAAsB,EAAOC,wBAAwB,IAMnHvF,GAAI,0BACJH,MAnBiBI,GACV,IAAIkF","sources":["webpack://mattressfirm/./src/Utilities/cart-utils.ts?6ba1","webpack://mattressfirm/./src/Utilities/select-financing-offer.tsx?5f53","webpack://mattressfirm/./src/actions/payment-redirect-to-order-confirmation.action.ts?c6dc","webpack://mattressfirm/./src/actions/paypalsuccesstrigger.action.ts?ccb0","webpack://mattressfirm/./src/actions/update-monthly-payment.action.ts?0e43","webpack://mattressfirm/./src/data-actions/financing-offer-state.action.ts?9faa","webpack://mattressfirm/./src/data-actions/get-card-payment-accept-point.override.action.ts?a2c5","webpack://mattressfirm/./src/data-actions/payment-error-state.action.ts?5f0f","webpack://mattressfirm/./src/data-actions/toggle-submit-order-button.action.ts?9a11"],"sourcesContent":["import MsDyn365 from '@msdyn365-commerce/core';\r\nimport {IProductDetails,IProductBonusItems, IProductBonusWithBrandName } from '../modules/mfrm-cart/mfrm-cart';\r\nimport {IMFIBonusItemsResponse, IMFIGetBonusCouponsDetailsResponse} from '../actions/BonusItemDataServiceEntities.g';\r\n\r\nexport interface IMFRMDateGroupedProducts {\r\n dateStr: string;\r\n days?: string;\r\n productVariantRecordIds: number[];\r\n productItemIds: string[];\r\n productsType: string;\r\n}\r\n\r\nconst getSetLocalStorage = (key: string, getSet: string, valueToSet?: any, returnType?: any) => {\r\n if (MsDyn365.isBrowser) {\r\n switch (getSet) {\r\n case 'set':\r\n return localStorage.setItem(key, JSON.stringify(valueToSet || returnType));\r\n case 'get':\r\n return JSON.parse(localStorage.getItem(key) || '[]');\r\n default:\r\n return returnType;\r\n }\r\n } else {\r\n return returnType;\r\n }\r\n};\r\n\r\nexport const getSetProductData = (getSet: string, products?: IProductDetails[]) => {\r\n return getSetLocalStorage('product_details', getSet, products, []);\r\n};\r\n\r\nexport const getSetProductSpec = (getSet: string, products?: IProductDetails[]) => {\r\n return getSetLocalStorage('product_specification', getSet, products, []);\r\n};\r\n\r\nexport const getSetPromoCodeApplyList = (getSet: string) => {\r\n return getSetLocalStorage('promo_code_apply_list', getSet, [], []);\r\n};\r\n\r\nexport const getSetPromoCode = (getSet: string) => {\r\n return getSetLocalStorage('promoCode', getSet, [], []);\r\n};\r\n\r\nexport const getSetGrandTotal = (getSet: string, total?: string) => {\r\n return getSetLocalStorage('grand_total', getSet, total, 0);\r\n};\r\n\r\nexport const getSetBonusItemProd = (getSet: string, globalBonusItems?: IMFIBonusItemsResponse[])=>{\r\n return getSetLocalStorage('BonusItemProduct', getSet, globalBonusItems, []);\r\n};\r\n\r\nexport const getSetSelectedBonasItem = (getSet: string, bonusItemArray?: IProductBonusItems[]) => {\r\n return getSetLocalStorage('selectedBonasItems', getSet, bonusItemArray, []);\r\n};\r\n\r\nexport const getSetBonusCouponDetail = (getSet: string, getCoupons?: IMFIGetBonusCouponsDetailsResponse[])=>{\r\n return getSetLocalStorage('bonusCouponsDetail', getSet, getCoupons, []);\r\n};\r\n\r\nexport const getSetPrevBonasModalState = (getSet: string, previousBonasModal?: IProductBonusItems[]) => {\r\n return getSetLocalStorage('previousBonasModalState', getSet, previousBonasModal, []);\r\n};\r\n\r\nexport const getSetBonusItemBrandName = (getSet: string, bonusItemsBrandName?: IProductBonusWithBrandName[]) => {\r\n return getSetLocalStorage('bonusItmesWithBrand', getSet, bonusItemsBrandName, []);\r\n};\r\n\r\nexport const getSetDateGroupedProducts = (getSet: string, products?: IMFRMDateGroupedProducts[]) => {\r\n return getSetLocalStorage('date_grouped_products', getSet, products, []);\r\n};","import { RichText } from '@msdyn365-commerce/core';\r\n\r\nimport dayjs from 'dayjs';\r\nimport tz from 'dayjs/plugin/timezone';\r\nimport utc from 'dayjs/plugin/utc';\r\nimport isBetween from 'dayjs/plugin/isBetween';\r\ndayjs.extend(tz);\r\ndayjs.extend(utc);\r\ndayjs.extend(isBetween);\r\nconst format = 'M/D/YYYY';\r\n\r\nexport interface IFinancingOffer {\r\n offerName?: string;\r\n noInterestFor: number;\r\n minPurchase: number;\r\n everydayFinancingOfferMessage:string,\r\n limitedFinancingOfferMessage:string,\r\n monthlyOfferDetails?: RichText;\r\n financingOfferDescription: RichText;\r\n disclaimer: RichText;\r\n offerValidStartDate?: string;\r\n offerValidEndDate?: string;\r\n specialCampaignOffer?: IFinancingOfferCampaign;\r\n checkoutDisplay?: {heading: string; details: string}\r\n}\r\n\r\nexport interface IFinancingOfferFormatted {\r\n numOfMonths: number;\r\n costPerMonth: number;\r\n startDate?: string;\r\n endDate?: string;\r\n isLTO: boolean;\r\n monthlyOfferDetails?: RichText;\r\n minPurchase: number;\r\n everydayFinancingOfferMessage:string;\r\n limitedFinancingOfferMessage:string;\r\n financingOfferDescription: RichText;\r\n disclaimer: RichText;\r\n specialCampaign?: IFinancingOfferCampaign;\r\n offerName?: string;\r\n checkoutDisplay?: {heading: string; details: string}\r\n}\r\n\r\nexport interface IFinancingOfferCampaign {\r\n initialMonthlyAmount: number;\r\n numOfDiscountedMonths: number;\r\n campaignValidStartDate: string;\r\n campaignValidEndDate: string;\r\n enableCampaign: boolean;\r\n}\r\n\r\nexport interface ISelectFinancingOfferData {\r\n limitedTimeFinancingOffers: IFinancingOffer[];\r\n everydayFinancingOffers: IFinancingOffer[];\r\n totalPrice: number | undefined;\r\n specialFinancingOffer?: IFinancingOffer[];\r\n synchronySpecialFinancingCondition?: boolean;\r\n specialFinancingEnable?: boolean;\r\n}\r\n\r\nexport interface ICampaignRemainingCost {\r\n cost: number;\r\n months: number;\r\n}\r\n\r\nexport const getValidSpecialCampaign = (financingOffer: IFinancingOfferFormatted): IFinancingOfferCampaign | undefined => {\r\n if (\r\n financingOffer.specialCampaign &&\r\n financingOffer.specialCampaign.enableCampaign &&\r\n financingOffer.specialCampaign.initialMonthlyAmount &&\r\n financingOffer.specialCampaign.numOfDiscountedMonths &&\r\n isCampaignScheduled(financingOffer)\r\n ) {\r\n return financingOffer.specialCampaign;\r\n }\r\n\r\n return undefined;\r\n};\r\n\r\nexport const getCampaignRemainingCost = (\r\n campaign: IFinancingOfferCampaign,\r\n financingOffer: IFinancingOfferFormatted,\r\n totalPrice: number | undefined\r\n): ICampaignRemainingCost | undefined => {\r\n if (!totalPrice) {\r\n return undefined;\r\n }\r\n\r\n const initialCost = campaign.initialMonthlyAmount * campaign.numOfDiscountedMonths;\r\n const remainingCost = totalPrice - initialCost;\r\n const remainingMonths = financingOffer.numOfMonths - campaign.numOfDiscountedMonths;\r\n const monthlyCost = remainingCost / remainingMonths;\r\n\r\n return {\r\n cost: monthlyCost,\r\n months: remainingMonths\r\n };\r\n};\r\nexport const isValidLimitedTimeOffer = (offer: IFinancingOffer): boolean => {\r\n const startDate = dayjs(offer.offerValidStartDate, format);\r\n const endDate = dayjs(offer.offerValidEndDate, format).add(1, 'd');\r\n\r\n const startDateCentralTime = startDate.isValid() && dayjs(startDate.format(format), format).tz('America/Chicago').local();\r\n const endDateCentralTime = endDate.isValid() && dayjs(endDate.format(format), format).tz('America/Chicago').local();\r\n\r\n const now = dayjs();\r\n return startDateCentralTime && endDateCentralTime && now.isBetween(startDateCentralTime, endDateCentralTime);\r\n};\r\n\r\nexport const isCampaignScheduled = (offer: IFinancingOfferFormatted): boolean => {\r\n const tempOffer = Object.create(offer);\r\n if (tempOffer.specialCampaign?.campaignValidStartDate && tempOffer.specialCampaign?.campaignValidEndDate) {\r\n tempOffer.startDate = tempOffer.specialCampaign?.campaignValidStartDate;\r\n tempOffer.endDate = tempOffer.specialCampaign?.campaignValidEndDate;\r\n\r\n return isScheduled(tempOffer);\r\n }\r\n\r\n return false;\r\n};\r\n\r\nexport const isScheduled = (offer: IFinancingOfferFormatted): boolean => {\r\n const startDate = dayjs(offer.startDate, format);\r\n const endDate = dayjs(offer.endDate, format).add(1, 'd');\r\n\r\n const startDateCentralTime = startDate.isValid() && dayjs(startDate.format(format), format).tz('America/Chicago').local();\r\n const endDateCentralTime = endDate.isValid() && dayjs(endDate.format(format), format).tz('America/Chicago').local();\r\n\r\n const now = dayjs();\r\n\r\n return startDateCentralTime && endDateCentralTime && now.isBetween(startDateCentralTime, endDateCentralTime);\r\n};\r\n\r\nexport const selectFinancingOffer = ({ limitedTimeFinancingOffers = [], everydayFinancingOffers = [], totalPrice = 0, specialFinancingOffer = [], synchronySpecialFinancingCondition = false, specialFinancingEnable = false }: ISelectFinancingOfferData, returnCustomOfferArray?: boolean): IFinancingOfferFormatted | undefined => {\r\n let highestMinimumPurchase: number = 0;\r\n let bestOffer: IFinancingOfferFormatted = {\r\n numOfMonths: 0,\r\n costPerMonth: 0,\r\n isLTO: false,\r\n minPurchase: 0,\r\n everydayFinancingOfferMessage:'',\r\n limitedFinancingOfferMessage:'',\r\n monthlyOfferDetails: '',\r\n financingOfferDescription: '',\r\n disclaimer: ''\r\n };\r\n let offerFound = false;\r\n\r\n let campaignFound: IFinancingOfferFormatted | undefined;\r\n\r\n const everydayOffers: IFinancingOfferFormatted[] | undefined = [];\r\n const specialOffer: IFinancingOfferFormatted[] | undefined = [];\r\n\r\n const validLimitedTimeFinancingOffers = limitedTimeFinancingOffers.filter((offer)=>{\r\n return isValidLimitedTimeOffer(offer) && offer;\r\n });\r\n\r\n if (synchronySpecialFinancingCondition && specialFinancingEnable) {\r\n if (!offerFound || (!isScheduled(bestOffer) && specialFinancingOffer.length)) {\r\n // try default offer\r\n offerFound = false;\r\n highestMinimumPurchase = 0;\r\n specialFinancingOffer.forEach((offer: IFinancingOffer) => {\r\n const minPurchase = offer.minPurchase ? offer.minPurchase : 0;\r\n let currentOfferAccepted = false;\r\n if (totalPrice >= minPurchase && minPurchase >= highestMinimumPurchase) {\r\n bestOffer = {\r\n numOfMonths: offer.noInterestFor,\r\n costPerMonth: Math.ceil(totalPrice / offer.noInterestFor),\r\n startDate: offer.offerValidStartDate,\r\n endDate: offer.offerValidEndDate,\r\n isLTO: false,\r\n minPurchase: offer.minPurchase || 0,\r\n everydayFinancingOfferMessage:offer.everydayFinancingOfferMessage,\r\n limitedFinancingOfferMessage:offer.limitedFinancingOfferMessage,\r\n offerName: offer.offerName,\r\n financingOfferDescription: offer.financingOfferDescription,\r\n disclaimer: offer.disclaimer\r\n };\r\n highestMinimumPurchase = offer.minPurchase;\r\n offerFound = true;\r\n currentOfferAccepted = true;\r\n }\r\n if (returnCustomOfferArray && (totalPrice >= minPurchase)) {\r\n specialOffer?.push({\r\n numOfMonths: offer.noInterestFor,\r\n costPerMonth: Math.ceil(totalPrice / offer.noInterestFor),\r\n startDate: offer.offerValidStartDate,\r\n endDate: offer.offerValidEndDate,\r\n isLTO: false,\r\n minPurchase: offer.minPurchase || 0,\r\n everydayFinancingOfferMessage:offer.everydayFinancingOfferMessage,\r\n limitedFinancingOfferMessage:offer.limitedFinancingOfferMessage,\r\n financingOfferDescription: offer.financingOfferDescription,\r\n disclaimer: offer.disclaimer,\r\n offerName: offer.offerName\r\n });\r\n highestMinimumPurchase = offer.minPurchase;\r\n offerFound = true;\r\n currentOfferAccepted = true;\r\n // @ts-ignore\r\n bestOffer = specialOffer;\r\n }\r\n // Do not use default if end date is defined and has expired\r\n if (currentOfferAccepted && offer.offerValidEndDate) {\r\n const endDate = dayjs(offer.offerValidEndDate, format);\r\n const now = dayjs();\r\n if (endDate.isValid() && now.isAfter(endDate)) {\r\n offerFound = false;\r\n }\r\n }\r\n });\r\n }\r\n } else {\r\n validLimitedTimeFinancingOffers.forEach((offer: IFinancingOffer) => {\r\n const minPurchase = offer.minPurchase ? offer.minPurchase : 0;\r\n\r\n if (totalPrice >= minPurchase && minPurchase > highestMinimumPurchase) {\r\n const currentOffer: IFinancingOfferFormatted = {\r\n numOfMonths: offer.noInterestFor,\r\n costPerMonth: Math.ceil(totalPrice / offer.noInterestFor),\r\n startDate: offer.offerValidStartDate,\r\n endDate: offer.offerValidEndDate,\r\n isLTO: true,\r\n minPurchase: offer.minPurchase,\r\n everydayFinancingOfferMessage:offer.everydayFinancingOfferMessage,\r\n limitedFinancingOfferMessage:offer.limitedFinancingOfferMessage,\r\n monthlyOfferDetails: offer.monthlyOfferDetails,\r\n financingOfferDescription: offer.financingOfferDescription,\r\n disclaimer: offer.disclaimer,\r\n specialCampaign: offer.specialCampaignOffer,\r\n checkoutDisplay: offer.checkoutDisplay,\r\n offerName: offer.offerName\r\n };\r\n bestOffer = currentOffer;\r\n highestMinimumPurchase = offer.minPurchase;\r\n offerFound = true;\r\n\r\n // check if campaign schedule is scheduled, otherwise fall back to parent offer\r\n const validCampaign = getValidSpecialCampaign(currentOffer);\r\n if (validCampaign) {\r\n currentOffer.startDate = validCampaign.campaignValidStartDate;\r\n currentOffer.endDate = validCampaign.campaignValidEndDate;\r\n campaignFound = currentOffer;\r\n }\r\n else {\r\n campaignFound = undefined;\r\n }\r\n }\r\n });\r\n\r\n if (!offerFound || (!isScheduled(bestOffer) && everydayFinancingOffers.length)) {\r\n // try default offer\r\n offerFound = false;\r\n highestMinimumPurchase = 0;\r\n\r\n everydayFinancingOffers.forEach((offer: IFinancingOffer) => {\r\n const minPurchase = offer.minPurchase ? offer.minPurchase : 0;\r\n let currentOfferAccepted = false;\r\n if (totalPrice >= minPurchase && minPurchase >= highestMinimumPurchase) {\r\n bestOffer = {\r\n numOfMonths: offer.noInterestFor,\r\n costPerMonth: Math.ceil(totalPrice / offer.noInterestFor),\r\n isLTO: false,\r\n minPurchase: offer.minPurchase || 0,\r\n everydayFinancingOfferMessage: offer.everydayFinancingOfferMessage,\r\n limitedFinancingOfferMessage:offer.limitedFinancingOfferMessage,\r\n offerName: offer.offerName,\r\n monthlyOfferDetails: offer.monthlyOfferDetails,\r\n financingOfferDescription: offer.financingOfferDescription,\r\n disclaimer: offer.disclaimer\r\n };\r\n highestMinimumPurchase = offer.minPurchase;\r\n offerFound = true;\r\n currentOfferAccepted = true;\r\n }\r\n\r\n if (returnCustomOfferArray && (totalPrice >= minPurchase)) {\r\n everydayOffers?.push({\r\n numOfMonths: offer.noInterestFor,\r\n costPerMonth: Math.ceil(totalPrice / offer.noInterestFor),\r\n isLTO: false,\r\n minPurchase: offer.minPurchase || 0,\r\n everydayFinancingOfferMessage:offer.everydayFinancingOfferMessage,\r\n limitedFinancingOfferMessage:offer.limitedFinancingOfferMessage,\r\n monthlyOfferDetails: offer.monthlyOfferDetails,\r\n financingOfferDescription: offer.financingOfferDescription,\r\n disclaimer: offer.disclaimer,\r\n offerName: offer.offerName\r\n });\r\n highestMinimumPurchase = offer.minPurchase;\r\n offerFound = true;\r\n currentOfferAccepted = true;\r\n // @ts-ignore\r\n bestOffer = everydayOffers;\r\n }\r\n\r\n // Do not use default if end date is defined and has expired\r\n if (currentOfferAccepted && offer.offerValidEndDate) {\r\n const endDate = dayjs(offer.offerValidEndDate, format);\r\n const now = dayjs();\r\n if (endDate.isValid() && now.isAfter(endDate)) {\r\n offerFound = false;\r\n }\r\n }\r\n });\r\n }\r\n}\r\n\r\n if (!offerFound) {\r\n return undefined;\r\n }\r\n if (campaignFound) {\r\n return campaignFound;\r\n }\r\n return bestOffer;\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 * as Msdyn365 from '@msdyn365-commerce/core';\r\n\r\n/**\r\n * PaymentRedirectToOrderConfirmation Input Action\r\n */\r\nexport class PaymentRedirectToOrderConfirmationInput implements Msdyn365.IActionInput {\r\n // TODO: Construct the input needed to run the action\r\n constructor() {}\r\n\r\n // TODO: Determine if the results of this get action should cache the results and if so provide\r\n // a cache object type and an appropriate cache key\r\n public getCacheKey = () => `PaymentRedirectToOrderConfirmation`;\r\n public getCacheObjectType = () => 'PaymentRedirectToOrderConfirmation';\r\n public dataCacheType = (): Msdyn365.CacheType => 'request';\r\n}\r\n\r\n// TODO: Create a data model here or import one to capture the response of the action\r\nexport interface IPaymentRedirectToOrderConfirmationData {\r\n redirectToOrderConfirmation: boolean;\r\n}\r\n\r\n/**\r\n * TODO: Use this function to create the input required to make the action call\r\n */\r\nconst createInput = (args: Msdyn365.ICreateActionContext): Msdyn365.IActionInput => {\r\n return new PaymentRedirectToOrderConfirmationInput();\r\n};\r\n\r\n/**\r\n * TODO: Use this function to call your action and process the results as needed\r\n */\r\nasync function paymentRedirectAction(input: PaymentRedirectToOrderConfirmationInput, ctx: Msdyn365.IActionContext): Promise {\r\n // const apiSettings = Msdyn365.msdyn365Commerce.apiSettings;\r\n\r\n // TODO: Uncomment the below line to get the value from a service\r\n // const response = await Msdyn365.sendRequest('/get/example/id/1', 'get');\r\n return { redirectToOrderConfirmation: false };\r\n}\r\n\r\nexport default Msdyn365.createObservableDataAction({\r\n action: >paymentRedirectAction,\r\n // TODO: Give your data action a unique id\r\n id: 'PaymentRedirectToOrderConfirmation',\r\n input: createInput\r\n // TODO: Uncomment the below line if this is a meant to be a batched data action\r\n // isBatched: true\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 * as Msdyn365 from '@msdyn365-commerce/core';\r\n\r\n/**\r\n * Paypalsuccesstrigger Input Action\r\n */\r\nexport class PaypalsuccesstriggerInput implements Msdyn365.IActionInput {\r\n // TODO: Construct the input needed to run the action\r\n constructor() {}\r\n\r\n // TODO: Determine if the results of this get action should cache the results and if so provide\r\n // a cache object type and an appropriate cache key\r\n public getCacheKey = () => `PayPalSuccessFlag`;\r\n public getCacheObjectType = () => 'PayPalSuccessFlag';\r\n public dataCacheType = (): Msdyn365.CacheType => 'application';\r\n}\r\n\r\n// TODO: Create a data model here or import one to capture the response of the action\r\nexport interface IPaypalsuccesstriggerData {\r\n isPaymentSuccess: boolean;\r\n paymentSuccessEmail: string;\r\n}\r\n\r\n/**\r\n * TODO: Use this function to create the input required to make the action call\r\n */\r\nconst createInput = (args: Msdyn365.ICreateActionContext): Msdyn365.IActionInput => {\r\n return new PaypalsuccesstriggerInput();\r\n};\r\n\r\n/**\r\n * TODO: Use this function to call your action and process the results as needed\r\n */\r\nasync function action(input: PaypalsuccesstriggerInput, ctx: Msdyn365.IActionContext): Promise {\r\n // const apiSettings = Msdyn365.msdyn365Commerce.apiSettings;\r\n\r\n // TODO: Uncomment the below line to get the value from a service\r\n // const response = await Msdyn365.sendRequest('/get/example/id/1', 'get');\r\n return { isPaymentSuccess: false, paymentSuccessEmail: '' };\r\n}\r\n\r\nexport default Msdyn365.createObservableDataAction({\r\n action: >action,\r\n // TODO: Give your data action a unique id\r\n id: 'Paypalsuccesstrigger',\r\n input: createInput\r\n // TODO: Uncomment the below line if this is a meant to be a batched data action\r\n // isBatched: true\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 * as Msdyn365 from '@msdyn365-commerce/core';\r\n/**\r\n * UpdateMonthlyPayment Input Action\r\n */\r\nexport class UpdateMonthlyPaymentInput implements Msdyn365.IActionInput {\r\n // a cache object type and an appropriate cache key\r\n public getCacheKey = () => `updateMonthlyPayment`;\r\n public getCacheObjectType = () => 'updateMonthlyPayment';\r\n public dataCacheType = (): Msdyn365.CacheType => 'application';\r\n}\r\n\r\n// TODO: Create a data model here or import one to capture the response of the action\r\nexport interface IUpdateMonthlyPaymentData {\r\n updateTotal: string | undefined;\r\n}\r\n\r\n/**\r\n * TODO: Use this function to create the input required to make the action call\r\n */\r\nconst createInput = (args: Msdyn365.ICreateActionContext): Msdyn365.IActionInput => {\r\n return new UpdateMonthlyPaymentInput();\r\n};\r\n\r\n/**\r\n * TODO: Use this function to call your action and process the results as needed\r\n */\r\nasync function updateMonthlyPayment(input: UpdateMonthlyPaymentInput, ctx: Msdyn365.IActionContext): Promise {\r\n return { updateTotal: '0' };\r\n}\r\n\r\nexport default Msdyn365.createObservableDataAction({\r\n action: >updateMonthlyPayment,\r\n input: createInput\r\n});\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\n\r\nimport * as Msdyn365 from '@msdyn365-commerce/core';\r\n\r\nimport { IFinancingOfferFormatted } from '../Utilities/select-financing-offer';\r\n\r\n/**\r\n * FinancingOfferState Input Action\r\n */\r\n\r\nexport class FinancingOfferStateInput implements Msdyn365.IActionInput {\r\n // TODO: Determine if the results of this get action should cache the results and if so provide\r\n // a cache object type and an appropriate cache key\r\n public getCacheKey = () => `FinancingOfferState`;\r\n public getCacheObjectType = () => 'FinancingOfferState';\r\n public dataCacheType = (): Msdyn365.CacheType => 'application';\r\n}\r\n\r\n// TODO: Create a data model here or import one to capture the response of the action\r\nexport interface IFinancingOfferStateData {\r\n isOpen: boolean;\r\n totalPrice?: number;\r\n financingOffer?: IFinancingOfferFormatted;\r\n}\r\n\r\n/**\r\n * TODO: Use this function to create the input required to make the action call\r\n */\r\nconst createInput = (args: Msdyn365.ICreateActionContext): Msdyn365.IActionInput => {\r\n return new FinancingOfferStateInput();\r\n};\r\n\r\n/**\r\n * TODO: Use this function to call your action and process the results as needed\r\n */\r\nasync function action(input: FinancingOfferStateInput, ctx: Msdyn365.IActionContext): Promise {\r\n return { isOpen: false };\r\n}\r\n\r\nexport default Msdyn365.createObservableDataAction({\r\n action: >action,\r\n id: 'FinancingOfferState',\r\n input: createInput\r\n});\r\n","/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { buildCacheKey } from '@msdyn365-commerce-modules/retail-actions';\r\nimport {\r\n CacheType, createObservableDataAction, IAction, IActionContext, IActionInput,\r\n ICommerceApiSettings, ICreateActionContext, isEmptyOrNullObject\r\n} from '@msdyn365-commerce/core';\r\nimport { getCheckoutState, ICheckoutState } from '@msdyn365-commerce/global-state';\r\nimport {\r\n getCardPaymentAcceptPointAsync\r\n} from '@msdyn365-commerce/retail-proxy/dist/DataActions/CartsDataActions.g';\r\nimport {\r\n CardPaymentAcceptPoint, CommerceProperty\r\n} from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\r\nimport get from 'lodash/get';\r\nimport Cookies from 'universal-cookie';\r\nimport { selectFinancingOffer } from '../Utilities/select-financing-offer';\r\nimport { getSetGrandTotal } from '../Utilities/cart-utils';\r\nimport { hasArray } from '../Utilities/emtpyChecker';\r\nexport interface IGetCardPaymentAcceptPointInput {\r\n showBillingAddress?: boolean;\r\n paymenTenderType?: string;\r\n apiSettings: ICommerceApiSettings;\r\n selectedOfferName?: string;\r\n isReload?: boolean;\r\n amountDue?: number;\r\n synchronySpecialFinancingCondition?: boolean;\r\n}\r\n\r\n/**\r\n * GetCardPaymentAcceptPointInput - Input for create GetCardPaymentAcceptPoint\r\n */\r\nexport class GetCardPaymentAcceptPointInput implements IActionInput {\r\n public showBillingAddress?: boolean;\r\n public paymenTenderType?: string;\r\n public selectedOfferName?: string;\r\n public amountDue?: number;\r\n public synchronySpecialFinancingCondition?: boolean;\r\n private apiSettings: ICommerceApiSettings;\r\n public isReload?: boolean;\r\n\r\n constructor(input: IGetCardPaymentAcceptPointInput) {\r\n this.showBillingAddress = input.showBillingAddress;\r\n this.paymenTenderType = input.paymenTenderType;\r\n this.apiSettings = input.apiSettings;\r\n this.selectedOfferName = input.selectedOfferName;\r\n this.isReload = input.isReload;\r\n this.amountDue = input.amountDue;\r\n this.synchronySpecialFinancingCondition = input.synchronySpecialFinancingCondition;\r\n }\r\n\r\n public getCacheKey = () => buildCacheKey(`CardPaymentAcceptPoint${this.paymenTenderType ? `-${this.paymenTenderType}` : ''}`, this.apiSettings);\r\n public getCacheObjectType = () => `CardPaymentAcceptPoint`;\r\n public dataCacheType = (): CacheType => 'none';\r\n}\r\n\r\nexport const createCheckoutPaymentInstrumentInput = (inputData: ICreateActionContext) => {\r\n // @ts-ignore\r\n const { showBillingAddress, paymenTenderType, amountDue, synchronySpecialFinancingCondition } = inputData.config;\r\n const getCardPaymentAcceptPointInput = {\r\n showBillingAddres: showBillingAddress,\r\n paymenTenderType: paymenTenderType,\r\n apiSettings: inputData.requestContext.apiSettings,\r\n amountDue,\r\n synchronySpecialFinancingCondition\r\n };\r\n\r\n return new GetCardPaymentAcceptPointInput(getCardPaymentAcceptPointInput);\r\n};\r\n\r\n/**\r\n * Calls the Retail API and returns a cart object based on the passed GetCartInput\r\n */\r\nexport async function getCardPaymentAcceptPointAction(\r\n input: GetCardPaymentAcceptPointInput,\r\n ctx: IActionContext\r\n): Promise {\r\n // If no cart ID is provided in input, we need to create a cart object\r\n if (!input) {\r\n ctx.telemetry.exception(new Error('[getCardPaymentAcceptPointAction] No valid Input was provided, failing'));\r\n throw new Error('[getCardPaymentAcceptPointAction] No valid Input was provided, failing');\r\n }\r\n\r\n const { showBillingAddress, paymenTenderType, amountDue = 0, synchronySpecialFinancingCondition } = input;\r\n const checkoutState: ICheckoutState = await getCheckoutState(ctx).catch((error: Error) => {\r\n ctx.telemetry.exception(error);\r\n throw error;\r\n });\r\n\r\n if (\r\n isEmptyOrNullObject(checkoutState) ||\r\n isEmptyOrNullObject(checkoutState.checkoutCart) ||\r\n isEmptyOrNullObject(checkoutState.checkoutCart.cart)\r\n ) {\r\n ctx.telemetry.exception(new Error('[getCardPaymentAcceptPointAction] Unable to get cart'));\r\n throw new Error('[getCardPaymentAcceptPointAction] Unable to get cart');\r\n }\r\n\r\n if (!checkoutState.checkoutCart.cart.CartLines || !checkoutState.checkoutCart.cart.CartLines.length) {\r\n ctx.telemetry.exception(new Error('[getCardPaymentAcceptPointAction] Cart is empty'));\r\n throw new Error('[getCardPaymentAcceptPointAction] Cart is empty');\r\n }\r\n\r\n const requestUrl =\r\n typeof ctx.requestContext.url.requestUrl === 'string'\r\n ? new URL(ctx.requestContext.url.requestUrl)\r\n : ctx.requestContext.url.requestUrl;\r\n const origin = get(window, 'location.origin') || requestUrl.origin;\r\n const zeroAmount = 0;\r\n\r\n const cardPaymentAcceptSettings = {\r\n '@odata.type': '#Microsoft.Dynamics.Commerce.Runtime.DataModel.CardPaymentAcceptSettings',\r\n HostPageOrigin: origin,\r\n AdaptorPath: `${origin}/Connectors/` || origin,\r\n CardPaymentEnabled: false,\r\n CardTokenizationEnabled: true,\r\n ...(!showBillingAddress && { HideBillingAddress: true }),\r\n ...(paymenTenderType && { TenderTypeId: paymenTenderType }),\r\n PaymentAmount: amountDue || zeroAmount\r\n };\r\n\r\n const { everydayFinancingOffers, addPaymentMethodName, extensionKeyPlanId, limitedTimeFinancingOffers, specialFinancingOffer, specialFinancingEnable } = ctx.requestContext.app.config;\r\n const getOffer = selectFinancingOffer({\r\n limitedTimeFinancingOffers,\r\n everydayFinancingOffers,\r\n totalPrice: getSetGrandTotal('get'),\r\n specialFinancingOffer,\r\n synchronySpecialFinancingCondition,\r\n specialFinancingEnable\r\n });\r\n const allOffers = [...(hasArray(limitedTimeFinancingOffers) || []), ...(hasArray(everydayFinancingOffers) || []), ...(hasArray(specialFinancingOffer) || [])];\r\n const offerName = synchronySpecialFinancingCondition && specialFinancingEnable? getOffer?.offerName : getOffer?.isLTO ? getOffer?.offerName : (input.selectedOfferName || getOffer?.offerName);\r\n const isReload = input.isReload;\r\n const defaultVal =\r\n allOffers?.find((item: { offerName: string }) => item.offerName?.toLowerCase() === offerName?.toLowerCase());\r\n const isSynchrony = paymenTenderType?.toLowerCase() === addPaymentMethodName?.toLowerCase();\r\n if(isSynchrony){\r\n (new Cookies()).set('Ecom_FinanceOption', defaultVal?.offerName);\r\n (new Cookies()).set('Ecom_FinancePlanId', defaultVal?.planID);\r\n }\r\n const ep: CommerceProperty[] = isSynchrony ? [{Key: extensionKeyPlanId, Value: { StringValue: defaultVal?.planID}}] : [];\r\n if (isReload) {\r\n return getCardPaymentAcceptPointAsync(\r\n { callerContext: ctx, bypassCache: 'get' },\r\n checkoutState.checkoutCart.cart.Id,\r\n cardPaymentAcceptSettings,\r\n ep\r\n ).then(cardPaymentAcceptPoint => {\r\n if (!cardPaymentAcceptPoint.AcceptPageUrl && !cardPaymentAcceptPoint.AcceptPageContent) {\r\n throw new Error(\r\n '[getCardPaymentAcceptPointAction] Payment Accept Page has neither return AcceptPageUrl nor AcceptPageContent in updatePaymentAcceptPageData'\r\n );\r\n }\r\n return cardPaymentAcceptPoint;\r\n })\r\n .catch(error => {\r\n ctx.telemetry.exception(error);\r\n ctx.telemetry.debug('Unable to get Card Payment Accept Point');\r\n throw error;\r\n });\r\n }\r\n return {};\r\n}\r\n\r\nexport const getCardPaymentAcceptPointActionDataAction = createObservableDataAction({\r\n id: '@msdyn365-commerce/checkout-payment-instrument/get-card-payment-accept-point',\r\n action: >getCardPaymentAcceptPointAction,\r\n input: createCheckoutPaymentInstrumentInput\r\n});\r\n\r\nexport default getCardPaymentAcceptPointActionDataAction;","/*!\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 * as Msdyn365 from '@msdyn365-commerce/core';\r\n\r\n/**\r\n * PaymentErrorState Input Action\r\n */\r\nexport class PaymentErrorStateInput implements Msdyn365.IActionInput {\r\n // TODO: Construct the input needed to run the action\r\n constructor() { }\r\n\r\n // TODO: Determine if the results of this get action should cache the results and if so provide\r\n // a cache object type and an appropriate cache key\r\n public getCacheKey = () => `PaymentErrorState`;\r\n public getCacheObjectType = () => 'PaymentErrorState';\r\n public dataCacheType = (): Msdyn365.CacheType => 'application';\r\n}\r\n\r\n// TODO: Create a data model here or import one to capture the response of the action\r\nexport interface IPaymentErrorState {\r\n errorTitle: string;\r\n errorMessage: string;\r\n progressiveLinkText: string;\r\n}\r\n\r\n/**\r\n * TODO: Use this function to create the input required to make the action call\r\n */\r\nconst createInput = (args: Msdyn365.ICreateActionContext): Msdyn365.IActionInput => {\r\n return new PaymentErrorStateInput();\r\n};\r\n\r\n/**\r\n * TODO: Use this function to call your action and process the results as needed\r\n */\r\nasync function action(input: PaymentErrorStateInput, ctx: Msdyn365.IActionContext): Promise {\r\n // const apiSettings = Msdyn365.msdyn365Commerce.apiSettings;\r\n\r\n // TODO: Uncomment the below line to get the value from a service\r\n // const response = await Msdyn365.sendRequest('/get/example/id/1', 'get');\r\n return { errorTitle: \"\", errorMessage: \"\", progressiveLinkText: \"\" };\r\n}\r\n\r\nexport default Msdyn365.createObservableDataAction({\r\n action: >action,\r\n // TODO: Give your data action a unique id\r\n id: 'PaymentErrorState',\r\n input: createInput\r\n // TODO: Uncomment the below line if this is a meant to be a batched data action\r\n // isBatched: true\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 * as Msdyn365 from '@msdyn365-commerce/core';\r\n\r\n/**\r\n * ToggleSynchronySubmitOrderButton Input Action\r\n */\r\nexport class ToggleSubmitOrderButtonInput implements Msdyn365.IActionInput {\r\n // TODO: Construct the input needed to run the action\r\n constructor() {}\r\n\r\n // TODO: Determine if the results of this get action should cache the results and if so provide\r\n // a cache object type and an appropriate cache key\r\n public getCacheKey = () => `toggle-submit-order-button`;\r\n public getCacheObjectType = () => 'toggle-submit-order-button';\r\n public dataCacheType = (): Msdyn365.CacheType => 'application';\r\n}\r\n\r\n// TODO: Create a data model here or import one to capture the response of the action\r\nexport interface IToggleSubmitOrderButtonData {\r\n isSynchronySelected: boolean;\r\n isPaypalSelected: boolean;\r\n isCreditcardSelected: boolean;\r\n isCcFieldsNotPopulated: boolean;\r\n}\r\n\r\n/**\r\n * TODO: Use this function to create the input required to make the action call\r\n */\r\nconst createInput = (args: Msdyn365.ICreateActionContext): Msdyn365.IActionInput => {\r\n return new ToggleSubmitOrderButtonInput();\r\n};\r\n\r\n/**\r\n * TODO: Use this function to call your action and process the results as needed\r\n */\r\nasync function action(input: ToggleSubmitOrderButtonInput, ctx: Msdyn365.IActionContext): Promise {\r\n // const apiSettings = Msdyn365.msdyn365Commerce.apiSettings;\r\n\r\n // TODO: Uncomment the below line to get the value from a service\r\n // const response = await Msdyn365.sendRequest('/get/example/id/1', 'get');\r\n return { isSynchronySelected: false, isPaypalSelected: false, isCreditcardSelected: false, isCcFieldsNotPopulated: true };\r\n}\r\n\r\nexport default Msdyn365.createObservableDataAction({\r\n action: >action,\r\n // TODO: Give your data action a unique id\r\n id: 'ToggleSubmitOrderButton',\r\n input: createInput\r\n // TODO: Uncomment the below line if this is a meant to be a batched data action\r\n // isBatched: true\r\n});\r\n"],"names":["getSetLocalStorage","key","getSet","valueToSet","returnType","MsDyn365","localStorage","setItem","JSON","stringify","parse","getItem","getSetProductData","products","getSetProductSpec","getSetPromoCodeApplyList","getSetPromoCode","getSetGrandTotal","total","getSetBonusItemProd","globalBonusItems","getSetSelectedBonasItem","bonusItemArray","getSetBonusCouponDetail","getCoupons","getSetPrevBonasModalState","previousBonasModal","getSetBonusItemBrandName","bonusItemsBrandName","getSetDateGroupedProducts","dayjs","tz","utc","isBetween","format","getValidSpecialCampaign","financingOffer","specialCampaign","enableCampaign","initialMonthlyAmount","numOfDiscountedMonths","isCampaignScheduled","getCampaignRemainingCost","campaign","totalPrice","remainingCost","remainingMonths","numOfMonths","cost","months","offer","tempOffer","Object","create","campaignValidStartDate","campaignValidEndDate","startDate","endDate","isScheduled","add","startDateCentralTime","isValid","local","endDateCentralTime","now","selectFinancingOffer","returnCustomOfferArray","campaignFound","limitedTimeFinancingOffers","everydayFinancingOffers","specialFinancingOffer","synchronySpecialFinancingCondition","specialFinancingEnable","highestMinimumPurchase","bestOffer","costPerMonth","isLTO","minPurchase","everydayFinancingOfferMessage","limitedFinancingOfferMessage","monthlyOfferDetails","financingOfferDescription","disclaimer","offerFound","everydayOffers","specialOffer","validLimitedTimeFinancingOffers","filter","offerValidStartDate","offerValidEndDate","isValidLimitedTimeOffer","length","forEach","currentOfferAccepted","noInterestFor","Math","ceil","offerName","push","isAfter","currentOffer","specialCampaignOffer","checkoutDisplay","validCampaign","undefined","PaymentRedirectToOrderConfirmationInput","constructor","getCacheKey","getCacheObjectType","dataCacheType","Msdyn365","action","async","input","ctx","redirectToOrderConfirmation","id","args","PaypalsuccesstriggerInput","isPaymentSuccess","paymentSuccessEmail","UpdateMonthlyPaymentInput","updateTotal","FinancingOfferStateInput","isOpen","GetCardPaymentAcceptPointInput","buildCacheKey","this","paymenTenderType","apiSettings","showBillingAddress","selectedOfferName","isReload","amountDue","createCheckoutPaymentInstrumentInput","inputData","config","getCardPaymentAcceptPointInput","showBillingAddres","requestContext","getCardPaymentAcceptPointAction","telemetry","exception","Error","checkoutState","getCheckoutState","catch","error","isEmptyOrNullObject","checkoutCart","cart","CartLines","requestUrl","url","URL","origin","get","window","cardPaymentAcceptSettings","HostPageOrigin","AdaptorPath","CardPaymentEnabled","CardTokenizationEnabled","HideBillingAddress","TenderTypeId","PaymentAmount","addPaymentMethodName","extensionKeyPlanId","app","getOffer","allOffers","hasArray","defaultVal","find","item","toLowerCase","isSynchrony","Cookies","set","planID","ep","Key","Value","StringValue","getCardPaymentAcceptPointAsync","callerContext","bypassCache","Id","then","cardPaymentAcceptPoint","AcceptPageUrl","AcceptPageContent","debug","getCardPaymentAcceptPointActionDataAction","createObservableDataAction","PaymentErrorStateInput","errorTitle","errorMessage","progressiveLinkText","ToggleSubmitOrderButtonInput","isSynchronySelected","isPaypalSelected","isCreditcardSelected","isCcFieldsNotPopulated"],"sourceRoot":""}