@mychoice/mychoice-sdk-modules 2.1.77 → 2.1.79

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -393,7 +393,8 @@ const OfferSection = ({ offerCompany, brokerCompany, offerPrice, phoneNumber, is
393
393
  }
394
394
  postRequestQuoteOnliaUrl(true, redirectUrl);
395
395
  };
396
- return (jsxs("div", { className: `offer-section ${mychoiceCls}`, children: [jsx(OfferHeader, { className: isTheBig ? 'thebig-bold' : '', companyName: offerCompany?.name, isBestOffer: isBestOffer }), jsx(OfferPrice, { className: isTheBig ? 'thebig' : '', companyLogo: offerCompany?.logo, price: offerPrice, withPriceTag: brokerIntegration?.type !== 'hub' }), brokerIntegration?.type === 'hub' && (jsx("div", { className: "offer-phone hub-integration", children: jsxs("p", { className: "hub-description", children: [jsx("span", { children: brokerIntegration?.data?.label }), jsx("br", {}), brokerIntegration?.data?.description] }) })), brokerIntegration?.type === 'youset' && brokerIntegration?.data?.url && (jsxs("div", { className: "offer-phone", children: [jsx("h3", { children: brokerIntegration?.data?.description || 'Click below to view your YouSet offer' }), jsx(ButtonBase, { className: `offer-phone-number ${mychoiceCls}`, label: brokerIntegration?.data?.label || 'View Offer', type: ButtonTypes.Button, category: CategoryTypes.Filled, color: ColorTypes.Primary, variant: ButtonVariantTypes.Rectangle, size: SizeTypes.Medium, onClick: () => window.open(brokerIntegration.data.url, '_blank') })] })), !brokerIntegration && !isTheBig && offsiteUrl && (jsxs("div", { className: "offer-phone", children: [jsx("h3", { children: "Click below to get this rate" }), jsx(ButtonBase, { className: `offer-phone-number ${mychoiceCls}`, label: "Buy Online", type: ButtonTypes.Button, category: CategoryTypes.Filled, color: ColorTypes.Primary, variant: ButtonVariantTypes.Rectangle, size: SizeTypes.Medium, onClick: handleCTAClick })] })), !brokerIntegration && (isTheBig || !offsiteUrl) && (jsxs("div", { className: "offer-phone", children: [jsx("h3", { className: isTheBig ? 'thebig-bold' : '', children: "Call now to get this rate" }), jsx("a", { target: "_blank", rel: "noreferrer noopener", href: `tel:${phoneNumber?.number}`, children: jsx(ButtonBase, { className: `${isTheBig ? 'thebig-bold' : 'mychoice'} offer-phone-number`, label: phoneNumber?.title, type: ButtonTypes.Button, category: CategoryTypes.Filled, color: ColorTypes.Primary, variant: ButtonVariantTypes.Rectangle, size: SizeTypes.Medium }) })] })), jsxs("button", { className: "dropdown", onClick: handleDropdownClick, children: [jsx("span", { children: detailsIsOpen ? 'Less Info' : 'More Info' }), jsx(IconDropdownArrow, { color: "grey", className: detailsIsOpen ? 'rotated' : '' })] }), detailsIsOpen && (jsxs("div", { className: "offer-details", children: [jsx(OfferDetail, { className: isTheBig ? 'thebig-bold' : '', name: offerCompany?.name, companyType: CompanyRoleTypes.Offering, description: offerCompany?.description }), jsx("hr", {}), (isTheBig || !offsiteUrl) && (jsxs(Fragment, { children: [jsx(OfferDetail, { className: isTheBig ? 'thebig-bold' : '', logo: brokerCompany?.logo, name: brokerCompany?.title, companyType: CompanyRoleTypes.Broker, description: brokerCompany?.description }), jsx("hr", {})] })), jsx(OfferDetail, { className: isTheBig ? 'thebig-bold' : '', name: "Hours of Operation", children: jsx(OperationHoursInfo, { weekdayHours: weekdayHours, saturdayHours: saturdayHours, sundayHours: sundayHours }) }), isMyChoice && coverages && (jsxs(Fragment, { children: [jsx("hr", {}), jsx(VehicleOfferCoverages, { coverages: coverages, nonStandardCoverages: nonStandardCoverages })] }))] }))] }));
396
+ const isHubIntegration = brokerIntegration?.type === 'hub';
397
+ return (jsxs("div", { className: `offer-section ${mychoiceCls}`, children: [!isHubIntegration && (jsx(OfferHeader, { className: isTheBig ? 'thebig-bold' : '', companyName: offerCompany?.name, isBestOffer: isBestOffer })), !isHubIntegration && (jsx(OfferPrice, { className: isTheBig ? 'thebig' : '', companyLogo: offerCompany?.logo, price: offerPrice })), isHubIntegration && (jsx("div", { className: "offer-phone hub-integration", children: jsx("div", { className: "hub-message-container", children: jsxs("p", { className: "hub-description", children: [jsx("span", { children: brokerIntegration?.data?.label }), jsx("br", {}), brokerIntegration?.data?.description] }) }) })), brokerIntegration?.type === 'youset' && brokerIntegration?.data?.url && (jsxs("div", { className: "offer-phone", children: [jsx("h3", { children: brokerIntegration?.data?.description || 'Click below to view your YouSet offer' }), jsx(ButtonBase, { className: `offer-phone-number ${mychoiceCls}`, label: brokerIntegration?.data?.label || 'View Offer', type: ButtonTypes.Button, category: CategoryTypes.Filled, color: ColorTypes.Primary, variant: ButtonVariantTypes.Rectangle, size: SizeTypes.Medium, onClick: () => window.open(brokerIntegration.data.url, '_blank') })] })), !brokerIntegration && !isTheBig && offsiteUrl && (jsxs("div", { className: "offer-phone", children: [jsx("h3", { children: "Click below to get this rate" }), jsx(ButtonBase, { className: `offer-phone-number ${mychoiceCls}`, label: "Buy Online", type: ButtonTypes.Button, category: CategoryTypes.Filled, color: ColorTypes.Primary, variant: ButtonVariantTypes.Rectangle, size: SizeTypes.Medium, onClick: handleCTAClick })] })), !brokerIntegration && (isTheBig || !offsiteUrl) && (jsxs("div", { className: "offer-phone", children: [jsx("h3", { className: isTheBig ? 'thebig-bold' : '', children: "Call now to get this rate" }), jsx("a", { target: "_blank", rel: "noreferrer noopener", href: `tel:${phoneNumber?.number}`, children: jsx(ButtonBase, { className: `${isTheBig ? 'thebig-bold' : 'mychoice'} offer-phone-number`, label: phoneNumber?.title, type: ButtonTypes.Button, category: CategoryTypes.Filled, color: ColorTypes.Primary, variant: ButtonVariantTypes.Rectangle, size: SizeTypes.Medium }) })] })), jsxs("button", { className: "dropdown", onClick: handleDropdownClick, children: [jsx("span", { children: detailsIsOpen ? 'Less Info' : 'More Info' }), jsx(IconDropdownArrow, { color: "grey", className: detailsIsOpen ? 'rotated' : '' })] }), detailsIsOpen && (jsxs("div", { className: "offer-details", children: [!isHubIntegration && (jsxs(Fragment, { children: [jsx(OfferDetail, { className: isTheBig ? 'thebig-bold' : '', name: offerCompany?.name, companyType: CompanyRoleTypes.Offering, description: offerCompany?.description }), jsx("hr", {})] })), (isTheBig || !offsiteUrl) && (jsxs(Fragment, { children: [jsx(OfferDetail, { className: isTheBig ? 'thebig-bold' : '', logo: brokerCompany?.logo, name: brokerCompany?.title, companyType: CompanyRoleTypes.Broker, description: brokerCompany?.description }), jsx("hr", {})] })), jsx(OfferDetail, { className: isTheBig ? 'thebig-bold' : '', name: "Hours of Operation", children: jsx(OperationHoursInfo, { weekdayHours: weekdayHours, saturdayHours: saturdayHours, sundayHours: sundayHours }) }), isMyChoice && coverages && (jsxs(Fragment, { children: [jsx("hr", {}), jsx(VehicleOfferCoverages, { coverages: coverages, nonStandardCoverages: nonStandardCoverages })] }))] }))] }));
397
398
  };
398
399
  OfferSection.defaultProps = {
399
400
  offerPrice: { monthly: 0, yearly: 0 },
@@ -3354,15 +3355,31 @@ const PageLifeQuote = () => {
3354
3355
  saturdayHours: items[0]?.brokerProfile.hoursSaturday,
3355
3356
  sundayHours: items[0]?.brokerProfile.hoursSunday,
3356
3357
  weekdayHours: items[0]?.brokerProfile.hoursWorkdays,
3357
- }, phoneNumber: formatPhoneObject(items[0]?.brokerProfile.phone), redirectUrl: items[0]?.brokerProfile.redirectUrl || '', brokerIntegration: items[0]?.brokerIntegration }) })) : (jsx(SplashScreen, {})) })) : (jsx(NoQuotesMessage, { type: "life" })) })), jsx(SectionQuoteEdit, {})] }), appDeviceType !== DeviceTypes.Mobile && quoteState.showCallMessage && jsx(SplashScreen, {}), !quoteState.showCallMessage && (jsx("div", { className: "offer-container", children: !!items?.length ? (items.map(({ company, brokerProfile, priceMonthly, priceYearly, brokerIntegration }, index) => (jsx("div", { children: (appDeviceType !== DeviceTypes.Mobile ||
3358
- (appDeviceType === DeviceTypes.Mobile && index !== 0)) && (jsx(OfferSection, { isBestOffer: index === 0, offerCompany: company, brokerCompany: brokerProfile, offerPrice: {
3359
- monthly: priceMonthly,
3360
- yearly: priceYearly,
3361
- }, operationHours: {
3362
- saturdayHours: brokerProfile.hoursSaturday,
3363
- sundayHours: brokerProfile.hoursSunday,
3364
- weekdayHours: brokerProfile.hoursWorkdays,
3365
- }, phoneNumber: formatPhoneObject(brokerProfile.phone), redirectUrl: brokerProfile.redirectUrl || '', brokerIntegration: brokerIntegration })) }, index)))) : (jsx(NoQuotesMessage, { type: "life" })) }))] })) }));
3358
+ }, phoneNumber: formatPhoneObject(items[0]?.brokerProfile.phone), redirectUrl: items[0]?.brokerProfile.redirectUrl || '', brokerIntegration: items[0]?.brokerIntegration }) })) : (jsx(SplashScreen, {})) })) : (jsx(NoQuotesMessage, { type: "life" })) })), jsx(SectionQuoteEdit, {})] }), appDeviceType !== DeviceTypes.Mobile && quoteState.showCallMessage && jsx(SplashScreen, {}), !quoteState.showCallMessage && (jsx("div", { className: "offer-container", children: !!items?.length ? ((() => {
3359
+ const bestQuote = items[0];
3360
+ const isHubIntegration = bestQuote?.brokerIntegration?.type === 'hub';
3361
+ // If Hub integration, show only the best quote
3362
+ if (isHubIntegration) {
3363
+ return (jsx(OfferSection, { isBestOffer: true, offerCompany: bestQuote.company, brokerCompany: bestQuote.brokerProfile, offerPrice: {
3364
+ monthly: bestQuote.priceMonthly,
3365
+ yearly: bestQuote.priceYearly,
3366
+ }, operationHours: {
3367
+ saturdayHours: bestQuote.brokerProfile.hoursSaturday,
3368
+ sundayHours: bestQuote.brokerProfile.hoursSunday,
3369
+ weekdayHours: bestQuote.brokerProfile.hoursWorkdays,
3370
+ }, phoneNumber: formatPhoneObject(bestQuote.brokerProfile.phone), redirectUrl: bestQuote.brokerProfile.redirectUrl || '', brokerIntegration: bestQuote.brokerIntegration }));
3371
+ }
3372
+ // Otherwise, show all quotes as before
3373
+ return items.map(({ company, brokerProfile, priceMonthly, priceYearly, brokerIntegration }, index) => (jsx("div", { children: (appDeviceType !== DeviceTypes.Mobile ||
3374
+ (appDeviceType === DeviceTypes.Mobile && index !== 0)) && (jsx(OfferSection, { isBestOffer: index === 0, offerCompany: company, brokerCompany: brokerProfile, offerPrice: {
3375
+ monthly: priceMonthly,
3376
+ yearly: priceYearly,
3377
+ }, operationHours: {
3378
+ saturdayHours: brokerProfile.hoursSaturday,
3379
+ sundayHours: brokerProfile.hoursSunday,
3380
+ weekdayHours: brokerProfile.hoursWorkdays,
3381
+ }, phoneNumber: formatPhoneObject(brokerProfile.phone), redirectUrl: brokerProfile.redirectUrl || '', brokerIntegration: brokerIntegration })) }, index)));
3382
+ })()) : (jsx(NoQuotesMessage, { type: "life" })) }))] })) }));
3366
3383
  };
3367
3384
 
3368
3385
  const getFormattedAddress = (unitNumber, streetAddress, city, provinceCode, postalCode, country) => {