"use strict";
(globalThis["webpackChunkathemes_starter_sites"] = globalThis["webpackChunkathemes_starter_sites"] || []).push([["v2_onboarding_src_components_Steps_Contact_js-node_modules_react-international-phone_dist_index_css"],{

/***/ "./v2/onboarding/src/components/Controls/SocialControl.js":
/*!****************************************************************!*\
  !*** ./v2/onboarding/src/components/Controls/SocialControl.js ***!
  \****************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components");
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _CustomSelectControlWithPlaceholder__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./CustomSelectControlWithPlaceholder */ "./v2/onboarding/src/components/Controls/CustomSelectControlWithPlaceholder.js");
/* harmony import */ var _utils_is_botiga__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../utils/is-botiga */ "./v2/onboarding/src/utils/is-botiga.js");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react/jsx-runtime */ "react/jsx-runtime");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__);
/**
 * Social Control component for the onboarding wizard.
 *
 * @package Athemes Starter Sites
 */






/**
 * Social platforms configuration.
 */

const socialPlatforms = [{
  key: 'facebook',
  name: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Facebook', 'athemes-starter-sites')
}, {
  key: 'twitter',
  name: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Twitter (X)', 'athemes-starter-sites')
}, {
  key: 'instagram',
  name: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Instagram', 'athemes-starter-sites')
}, {
  key: 'linkedin',
  name: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('LinkedIn', 'athemes-starter-sites')
}, {
  key: 'whatsapp',
  name: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('WhatsApp', 'athemes-starter-sites')
}, {
  key: 'youtube',
  name: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('YouTube', 'athemes-starter-sites')
}, {
  key: 'tiktok',
  name: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('TikTok', 'athemes-starter-sites')
}, {
  key: 'pinterest',
  name: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Pinterest', 'athemes-starter-sites')
}];

/**
 * Social Control component for managing social media links.
 *
 * @param {Object}   props          Component props.
 * @param {string}   props.label    Label for the control.
 * @param {Array}    props.value    Array of social link objects with platform and url.
 * @param {Function} props.onChange Callback when social links change.
 * @return {JSX.Element} Social Control component.
 */
function SocialControl({
  label,
  value = [],
  onChange
}) {
  /**
   * Add a new social link row.
   */
  const addSocialLink = () => {
    onChange([...value, {
      platform: '',
      url: ''
    }]);
  };

  /**
   * Remove a social link row.
   *
   * @param {number} index Index of the row to remove.
   */
  const removeSocialLink = index => {
    const newValue = value.filter((_, i) => i !== index);
    onChange(newValue);
  };

  /**
   * Update a social link field.
   *
   * @param {number} index Index of the row to update.
   * @param {string} field Field name (platform or url).
   * @param {string} newValue New value for the field.
   */
  const updateSocialLink = (index, field, newValue) => {
    const newLinks = [...value];
    newLinks[index] = {
      ...newLinks[index],
      [field]: newValue
    };
    onChange(newLinks);
  };

  /**
   * Get available platform options for a specific row.
   * Excludes platforms already selected in other rows.
   *
   * @param {number} currentIndex Index of the current row.
   * @return {Array} Filtered platform options.
   */
  const getAvailablePlatforms = currentIndex => {
    // Get all platforms selected in other rows
    const selectedPlatforms = value.map((link, index) => index !== currentIndex ? link.platform : null).filter(platform => platform && platform !== '');

    // Filter out selected platforms, but keep the current row's platform
    const currentPlatform = value[currentIndex]?.platform;
    return socialPlatforms.filter(option => {
      // Always include the current row's selected platform
      if (option.key === currentPlatform) {
        return true;
      }
      // Exclude platforms selected in other rows
      return !selectedPlatforms.includes(option.key);
    });
  };
  const themeText = {
    socialButton: _utils_is_botiga__WEBPACK_IMPORTED_MODULE_3__["default"] ? (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Add', 'athemes-starter-sites') : (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Add social link', 'athemes-starter-sites')
  };
  return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", {
    className: "atss-social-control",
    children: [label && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("label", {
      className: "atss-social-control__label components-base-control__label",
      children: label
    }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("div", {
      className: "atss-social-control__items",
      children: value.map((link, index) => /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", {
        className: "atss-social-control__item flex gap-xs",
        children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("div", {
          className: "atss-social-control__platform atss-form-field",
          children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_CustomSelectControlWithPlaceholder__WEBPACK_IMPORTED_MODULE_2__["default"], {
            placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Select platform...', 'athemes-starter-sites'),
            value: link.platform ? socialPlatforms.find(option => option.key === link.platform) : null,
            options: getAvailablePlatforms(index),
            onChange: ({
              selectedItem
            }) => updateSocialLink(index, 'platform', selectedItem?.key || ''),
            __next40pxDefaultSize: true
          })
        }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("div", {
          className: "atss-social-control__url atss-form-field",
          children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__.TextControl, {
            value: link.url,
            onChange: newUrl => updateSocialLink(index, 'url', newUrl),
            placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Enter URL...', 'athemes-starter-sites'),
            type: "url",
            __next40pxDefaultSize: true,
            __nextHasNoMarginBottom: true
          })
        }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("button", {
          type: "button",
          className: "atss-social-control__remove",
          onClick: () => removeSocialLink(index),
          "aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Remove social link', 'athemes-starter-sites'),
          children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("span", {
            children: "\xD7"
          })
        })]
      }, index))
    }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("button", {
      type: "button",
      className: "atss-onboarding-wizard__btn atss-onboarding-wizard__btn--skip",
      onClick: addSocialLink,
      children: themeText.socialButton
    })]
  });
}
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SocialControl);

/***/ }),

/***/ "./v2/onboarding/src/components/Steps/Contact.js":
/*!*******************************************************!*\
  !*** ./v2/onboarding/src/components/Steps/Contact.js ***!
  \*******************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components");
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _Layout__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Layout */ "./v2/onboarding/src/components/Layout/index.js");
/* harmony import */ var _context_WizardContext__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../context/WizardContext */ "./v2/onboarding/src/context/WizardContext.js");
/* harmony import */ var _utils_helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../utils/helpers */ "./v2/onboarding/src/utils/helpers.js");
/* harmony import */ var react_international_phone__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! react-international-phone */ "./node_modules/react-international-phone/dist/index.mjs");
/* harmony import */ var react_international_phone_style_css__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! react-international-phone/style.css */ "./node_modules/react-international-phone/dist/index.css");
/* harmony import */ var _Controls_SocialControl__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Controls/SocialControl */ "./v2/onboarding/src/components/Controls/SocialControl.js");
/* harmony import */ var _utils_is_botiga__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../utils/is-botiga */ "./v2/onboarding/src/utils/is-botiga.js");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! react/jsx-runtime */ "react/jsx-runtime");
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__);
/**
 * Contact step component.
 *
 * @package Athemes Starter Sites
 */












/**
 * Contact step component.
 *
 * @param {Object}   props                  Component props.
 * @param {Function} props.onBack           Callback to go to previous step.
 * @param {Function} props.onSkip           Callback to skip this step.
 * @param {Function} props.onContinue       Callback to proceed to next step.
 * @param {boolean}  props.navigationLoading Whether navigation is in loading state.
 * @param {string}   props.navigationError   Navigation error message.
 * @return {JSX.Element} Contact component.
 */

function Contact({
  onBack,
  onSkip,
  onContinue,
  navigationLoading,
  navigationError
}) {
  const {
    wizardData,
    siteTitle
  } = (0,_context_WizardContext__WEBPACK_IMPORTED_MODULE_4__.useWizard)();
  const savedData = wizardData.contact || {};

  // Get site name from the wizard context (stored as siteTitle)
  const siteName = siteTitle || (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('your site', 'athemes-starter-sites');
  const [businessEmail, setBusinessEmail] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(savedData.businessEmail || '');
  const [phoneNumber, setPhoneNumber] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(savedData.phoneNumber || '');
  const [address, setAddress] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(savedData.address || '');
  const [socialLinks, setSocialLinks] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(savedData.socialLinks || []);
  const [emailTouched, setEmailTouched] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)(false);
  const [emailError, setEmailError] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useState)('');

  /**
   * Handle email field blur event.
   */
  const handleEmailBlur = () => {
    setEmailTouched(true);
    if (businessEmail && !(0,_utils_helpers__WEBPACK_IMPORTED_MODULE_5__.validateEmail)(businessEmail)) {
      setEmailError((0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Please enter a valid email address', 'athemes-starter-sites'));
    } else {
      setEmailError('');
    }
  };

  /**
   * Handle email field change event.
   */
  const handleEmailChange = value => {
    setBusinessEmail(value);
    // Clear error if email becomes valid
    if (emailTouched && emailError && (0,_utils_helpers__WEBPACK_IMPORTED_MODULE_5__.validateEmail)(value)) {
      setEmailError('');
    }
  };

  /**
   * Handle continue button click.
   */
  const handleContinue = () => {
    onContinue({
      businessEmail,
      phoneNumber,
      address,
      socialLinks
    });
  };
  const themeText = {
    wizardDescription: _utils_is_botiga__WEBPACK_IMPORTED_MODULE_9__["default"] ? (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Please provide the contact information below. These will be used on your shop.', 'athemes-starter-sites') : (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Please provide the contact information below. This will be used on the website.', 'athemes-starter-sites'),
    addressLabel: _utils_is_botiga__WEBPACK_IMPORTED_MODULE_9__["default"] ? (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Local Address', 'athemes-starter-sites') : (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Address', 'athemes-starter-sites'),
    socialLabel: _utils_is_botiga__WEBPACK_IMPORTED_MODULE_9__["default"] ? (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Social Media', 'athemes-starter-sites') : (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Social media links', 'athemes-starter-sites')
  };
  return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)("div", {
    className: "atss-onboarding-wizard__step atss-onboarding-wizard__step--contact",
    children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("main", {
      className: "atss-onboarding-wizard__step-body",
      children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)("div", {
        className: "atss-onboarding-wizard__step-body-content",
        children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)("h2", {
          className: "atss-onboarding-wizard__step-body-title text-xl font-medium",
          children: [(0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('How Do People Get in Touch With ', 'athemes-starter-sites'), siteName, "?"]
        }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("p", {
          className: "atss-onboarding-wizard__step-body-description text-sm text-secondary",
          children: themeText.wizardDescription
        }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)("div", {
          className: "atss-onboarding-wizard__step-body-form atss-options-form flex flex-col gap-xxl",
          children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)("div", {
            className: "atss-form-row flex gap-xxl",
            children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)("div", {
              className: `atss-form-field atss-form-field--email${emailError ? ' atss-form-field--has-error' : ''}`,
              children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.TextControl, {
                label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Business Email', 'athemes-starter-sites'),
                value: businessEmail,
                onChange: handleEmailChange,
                onBlur: handleEmailBlur,
                type: "email",
                placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('e.g. office@example.com', 'athemes-starter-sites'),
                pattern: "[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,}$",
                required: true,
                __next40pxDefaultSize: true,
                __nextHasNoMarginBottom: true
              }), emailError && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("span", {
                className: "atss-form-field__error",
                children: emailError
              })]
            }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)("div", {
              className: "atss-form-field",
              children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("label", {
                className: "components-base-control__label",
                children: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Phone Number', 'athemes-starter-sites')
              }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(react_international_phone__WEBPACK_IMPORTED_MODULE_6__.PhoneInput, {
                defaultCountry: "us",
                value: phoneNumber,
                onChange: phone => setPhoneNumber(phone)
              })]
            })]
          }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("div", {
            className: "atss-form-field",
            children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__.TextControl, {
              label: themeText.addressLabel,
              value: address,
              onChange: value => setAddress(value),
              placeholder: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('e.g. 123 Main St, Anytown, USA', 'athemes-starter-sites'),
              __next40pxDefaultSize: true,
              __nextHasNoMarginBottom: true
            })
          }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("div", {
            className: "atss-form-field",
            children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_Controls_SocialControl__WEBPACK_IMPORTED_MODULE_8__["default"], {
              label: themeText.socialLabel,
              value: socialLinks,
              onChange: setSocialLinks
            })
          })]
        })]
      })
    }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_Layout__WEBPACK_IMPORTED_MODULE_3__.Footer, {
      showBack: true,
      showSkip: true,
      continueText: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Continue', 'athemes-starter-sites'),
      onBack: onBack,
      onSkip: onSkip,
      onContinue: handleContinue,
      continueLoading: navigationLoading,
      continueError: navigationError
    })]
  });
}
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Contact);

/***/ })

}]);
//# sourceMappingURL=v2_onboarding_src_components_Steps_Contact_js-node_modules_react-international-phone_dist_index_css.js.map?ver=15159b913eb8ec980e06