sales-frontend-components 0.0.130 → 0.0.131

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/index.cjs.js CHANGED
@@ -1642,23 +1642,38 @@ function useNxlOneModal({
1642
1642
  },
1643
1643
  modalSize = "medium",
1644
1644
  step = "appInit",
1645
- env = "stg"
1645
+ env = "stg",
1646
+ nxlOneProps = {}
1646
1647
  }) {
1647
1648
  const { isOpen, openModal, closeModal } = salesFrontendDesignSystem.useModalState();
1649
+ const [nxlOnePropsState, setNxlOnePropsState] = React.useState(nxlOneProps);
1648
1650
  const { bizCode, tmplCode } = CODES[step][env];
1649
1651
  const { Iframe, open } = useNxlOne({
1650
- bizCode,
1651
- tmplCode
1652
+ ...nxlOnePropsState,
1653
+ bizCode: nxlOnePropsState.bizCode || bizCode,
1654
+ tmplCode: nxlOnePropsState.tmplCode || tmplCode
1652
1655
  });
1656
+ const openNxlOneModal = () => {
1657
+ const type = salesFrontendUtils.isClient() ? window.location.hostname : "";
1658
+ if (type.includes("localhost") || type.includes("local.hanwhalife.com")) {
1659
+ open({ popupWidth: 500, popupHeight: 500 }).then((result) => {
1660
+ onSuccess(result);
1661
+ });
1662
+ } else {
1663
+ openModal();
1664
+ }
1665
+ };
1666
+ React.useEffect(() => {
1667
+ if (nxlOnePropsState.nlcCtfnId) {
1668
+ openNxlOneModal();
1669
+ }
1670
+ }, [nxlOnePropsState]);
1653
1671
  return {
1654
- openNxlOneModal: () => {
1655
- const type = salesFrontendUtils.isClient() ? window.location.hostname : "";
1656
- if (type.includes("localhost") || type.includes("local.hanwhalife.com")) {
1657
- open({ popupWidth: 500, popupHeight: 500 }).then((result) => {
1658
- onSuccess(result);
1659
- });
1672
+ openNxlOneModal: (nxlOnePropsState2) => {
1673
+ if (nxlOnePropsState2) {
1674
+ setNxlOnePropsState(nxlOnePropsState2);
1660
1675
  } else {
1661
- openModal();
1676
+ openNxlOneModal();
1662
1677
  }
1663
1678
  },
1664
1679
  closeNxlOneModal: closeModal,