{
  "version": 3,
  "sources": ["/cdn/shop/t/47/assets/DIUsers.js?referral=bobvance232"],
  "sourcesContent": ["(function () {\n\n  function getReferralFromShopDomain() {\n      try {\n        const host = (window.location.hostname || \"\").toLowerCase();\n        const zone = \"olivetreepeople.shop\";\n\n        // Only apply fallback on *.olivetreepeople.shop\n        if (!host.endsWith(\".\" + zone)) return null;\n\n        // Exclude apex + www\n        if (host === zone || host === \"www.\" + zone) return null;\n\n        // Extract subdomain\n        const sub = host.slice(0, -(zone.length + 1));\n        return sub.split(\".\")[0] || null;\n      } catch {\n        return null;\n      }\n    }\n\n\n  function DIUsers() {\n    \"use strict\";\n    var context = this;\n    var mainScope = window.DI;\n    context.name = \"Users\";\n    context.init = function () {\n      context.endpoint = window.DI.CompanyStatic.ApiMethod;\n      mainScope.DI.subscribeDOMLoaded(function () {\n      });\n      context.webAlias.init();\n    };\n\n    \n    context.webAlias = {\n      init: function init() {\n        var urlParams = {};\n        var paramsToSend = {};\n\n        if (window.location.search.length > 0) {\n          urlParams = mainScope.CompanyUtil.parseUrlParams(window.location.search);\n        }\n\n        const shopFallback = getReferralFromShopDomain();\n         const landingPage = sessionStorage.getItem(\"landingPage\");\n        let referralFromLanding = null;\n        if (landingPage) {\n          const match = landingPage.match(/[?&]referral=([^&]+)/);\n          if (match) {\n            referralFromLanding = decodeURIComponent(match[1]);\n          }\n        }\n\n\n\n\n        if (typeof urlParams.referral === \"string\" && urlParams.referral.length > 0) {\n\n              // Primary: ?referral=\n              paramsToSend.referral = urlParams.referral;\n\n            } else if (referralFromLanding) {\n\n              // Secondary: sessionStorage landingPage\n              paramsToSend.referral = referralFromLanding;\n\n            } else if (shopFallback) {\n\n              // Fallback: subdomain\n              paramsToSend.referral = shopFallback;\n\n            } else {\n\n              // Default\n              paramsToSend.referral = \"\";\n\n            }\n\n\n        if (typeof urlParams.type == \"string\" && urlParams.type.length > 0) {\n          paramsToSend.type = urlParams.type || 2;\n          sessionStorage.setItem('customerType', parseInt(paramsToSend.type, 10));\n          window.AssociateType = parseInt(paramsToSend.type, 10);\n        } else {\n          if (sessionStorage.getItem('customerType') == null || sessionStorage.getItem('customerType') == 0) {\n            sessionStorage.setItem('customerType', 1);\n          }\n        }\n        console.log('GetCustomerSite');\n\n        $.ajax({\n          url: \"https://eusync.connectolive.com/getWebsite/\" + (paramsToSend.referral || window.localStorage.getItem('ALS') || window.ALS || \"\"),\n          type: \"GET\",\n          dataType: \"json\",\n          contentType: \"application/json; charset=utf-8\",\n          // data: paramsToSend.referral,\n          success: function (response) {\n            if (response) {\n              var data = response.Data;\n              if (typeof urlParams.type == \"string\" && urlParams.type.length > 0) {\n                window.AssociateType = parseInt(paramsToSend.type, 10);\n              }\n              var customerType = window.AssociateType > 0 ? window.AssociateType : sessionStorage.getItem('customerType');\n              console.log(\"customerType\", customerType);\n              if (window.ALS || paramsToSend.referral) {\n                window.localStorage.setItem('ALS', (paramsToSend.referral || window.ALS ));\n              }\n              var PriceType = \"Retail\";\n              switch (parseInt(customerType, 10)) {\n                case 2:\n                case 7:\n                  PriceType = \"Retail\";\n                  break;\n                case 1:\n                case 4:\n                case 5:\n                  PriceType = \"Wholesale\";\n                  break;\n                case 3:\n                case 6:\n                  PriceType = \"Corporate\";\n                  break;\n                default:\n                  PriceType = \"Retail\";\n              }\n              console.log(\"PriceType\", PriceType);\n              window.localStorage.setItem('enrollerinfo', JSON.stringify(response.Data));\n              try {\n                var rootScope = angular.element(document.body).injector() && angular.element(document.body).injector().get('$rootScope');\n                if(rootScope){\n                  rootScope.EnrollerInfo = JSON.parse(localStorage.getItem('enrollerinfo'));\n                  rootScope.$apply();\n                }\n              } catch (error) {\n              }\n            }\n          },\n          error: function (error) {\n          }\n        });\n      },\n      setPriceType: function setPriceType(priceType) {\n        var request = new XMLHttpRequest();\n        request.open(\"POST\", \"/cart/update.js\", true);\n        request.withCredentials = true;\n        request.setRequestHeader(\"Content-Type\", \"application/json\");\n\n        request.onreadystatechange = function () {\n          if (request.readyState === 4) {\n            try {\n              var resp = JSON.parse(request.response);\n            } catch (e) {\n              console.error(\"Failed adding country selection to attributes!\");\n            }\n          }\n        };\n        var updateCartRequest = {\n          attributes: {\n            priceType: priceType || 2\n          }\n        };\n        if (window.location.pathname.indexOf('/pages/thank-you') > -1) {\n          updateCartRequest.items = [];\n        }\n        request.send(JSON.stringify(updateCartRequest));\n      },\n      apply: function apply(info) {\n\n      }\n    };\n\n    context.account = {\n      CreateCustomer: function CreateCustomer() {\n        var form = document.querySelector(\"#create_customer\");\n        var data = mainScope.CompanyUtil.collectFormData(form);\n        var endpoint = context.endpoint[\"Customer\"][\"CreateCustomer\"];\n        var metafields = {\n          \"birthDate\": \"\",\n          \"Gender\": \"\",\n          \"webAlias\": data['customer[replicate_url]'],\n          \"associateType\": 1,\n          \"taxID\": \"\",\n          \"Password\": data['customer[password]'],\n          \"companyName\": \"\",\n          \"textPhone\": data['customer[phone]'],\n          \"userName\": data['customer[replicate_url]'],\n          \"languageCode\": \"en\",\n          \"sponsorId\": $rootScope.EnrollerInfo.AssociateID\n        };\n        var request = {\n          \"customer\": {\n            \"AcceptsMarketing\": true,\n            \"Addresses\": [\n              {\n                \"Address1\": data['customer[street1]'],\n                \"Address2\": data['customer[street2]'],\n                \"City\": data['customer[county]'],\n                \"Company\": \"\",\n                \"Country\": data['customer[country]'],\n                \"CountryCode\": data['customer[country]'],\n                \"CountryName\": data['customer[country]'],\n                \"Default\": true,\n                \"FirstName\": data['customer[first_name]'],\n                \"LastName\": data['customer[last_name]'],\n                \"Name\": data['customer[first_name]'] + data['customer[last_name]'],\n                \"Phone\": data['customer[phone]'],\n                \"Province\": data['customer[state]'],\n                \"ProvinceCode\": data['customer[last_name]'],\n                \"Zip\": data['customer[postal_code]']\n              }\n            ],\n            \"CreatedAt\": new Date(),\n            \"Currency\": \"USD\",\n            \"DefaultAddress\": {\n              \"Address1\": data['customer[street1]'],\n              \"Address2\": data['customer[street2]'],\n              \"City\": data['customer[county]'],\n              \"Company\": \"\",\n              \"Country\": data['customer[country]'],\n              \"CountryCode\": data['customer[country]'],\n              \"CountryName\": data['customer[country]'],\n              \"Default\": true,\n              \"FirstName\": data['customer[first_name]'],\n              \"LastName\": data['customer[last_name]'],\n              \"Name\": data['customer[first_name]'] + data['customer[last_name]'],\n              \"Phone\": data['customer[phone]'],\n              \"Province\": data['customer[state]'],\n              \"ProvinceCode\": data['customer[state]'],\n              \"Zip\": data['customer[postal_code]']\n            },\n            \"Email\": data['customer[email]'],\n            \"FirstName\": data['customer[first_name]'],\n            \"LastName\": data['customer[last_name]'],\n            \"Phone\": data['customer[phone]'],\n            \"State\": data['customer[state]'],\n            \"VerifiedEmail\": false,\n            \"Metafields\": [\n              {\n                \"Key\": \"Customer\",\n                \"Value\": JSON.stringify(metafields),\n                \"ValueType\": \"json_string\",\n                \"Namespace\": \"ProviderFields\",\n                \"OwnerResource\": \"customers\"\n              }\n            ]\n          },\n          \"Metafields\": [\n            {\n              \"Key\": \"Customer\",\n              \"Value\": JSON.stringify(metafields),\n              \"ValueType\": \"json_string\",\n              \"Namespace\": \"ProviderFields\",\n              \"OwnerResource\": \"customers\"\n            }\n          ],\n          \"options\": {\n            \"Password\": data['customer[password]'],\n            \"password_confirmation\": data['customer[password]'],\n            \"SendEmailInvite\": true,\n            \"SendWelcomeEmail\": true\n          }\n        };\n        $.ajax({\n          url: endpoint,\n          type: \"POST\",\n          dataType: \"json\",\n          contentType: \"application/json; charset=utf-8\",\n          data: paramsToSend,\n          success: function (response) {\n            if (response.status === 200) {\n              document.getElementById(\"create_customer\").reset();\n              response = JSON.parse(response.responseText);\n              //mainScope.General.notifications.showNotification(1, \"Success\", \"Account created!\");\n              mainScope.Users.webAlias.init();\n              setTimeout(function () {\n                var urlParams = {};\n                if (window.location.search.length > 0) {\n                  urlParams = mainScope.CompanyUtil.parseUrlParams(window.location.search);\n                }\n                if (urlParams.hasOwnProperty(\"redirect\")) {\n                  window.location.href = decodeURIComponent(urlParams.redirect);\n                } else {\n                  var redirectURL = window.location.origin + mainScope.Static.sitePages.account;\n                  if (response.data.siteOwner && response.data.siteOwner.alias) {\n                    redirectURL += \"&referral=\" + response.data.siteOwner.alias;\n                  }\n                  window.location.href = redirectURL;\n                }\n              }, 1500);\n            } else {\n              console.log(2, \"Error\", response.message);\n            }\n            context.actions.enableElement(trigger);\n\n          },\n          error: function (error) {\n\n          }\n        });\n      },\n      getAccountData: function getAccountData() {\n        var account = document.querySelector(\".st-bds_account-content-area\");\n        if (account !== null) {\n          $.ajax({\n            url: context.endpoint[\"customer\"][\"GetCustomer\"],\n            type: \"POST\",\n            dataType: \"json\",\n            contentType: \"application/json; charset=utf-8\",\n            data: {\n              \"customerId\": \"5290891411618\"\n            },\n            success: function (response) {\n              if (response.status === 200) {\n                response = JSON.parse(response.response);\n                context.account.renderAccountData(response, target);\n              } else {\n                console.log(2, \"Error\", response.message);\n              }\n            },\n            error: function (error) {\n            }\n          });\n        }\n      },\n\n    };\n    context.findenroller = function findenroller(searchtext) {\n      return $.ajax({\n        url: context.endpoint[\"Customer\"][\"FindEnroller\"],\n        type: \"POST\",\n        dataType: \"json\",\n        contentType: \"application/json; charset=utf-8\",\n        data: JSON.stringify({\n          \"SearchTerm\": searchtext,\n          \"IncludeCustomers\": true,\n          \"StatusIds\": 1\n        })\n      });\n    };\n    context.getcustomersitebyid = function getcustomersitebyid(id) {\n\n      return $.ajax({\n        url: \"https://eusync.connectolive.com/getWebsiteParms/id/\" + id,\n        type: \"GET\",\n        dataType: \"json\",\n        contentType: \"application/json; charset=utf-8\"\n      });\n    };\n    return this;\n  };\n\n\n  var DIUsersInstance = new DIUsers();\n  window.DIMainInstance.injectReference(DIUsersInstance.name, DIUsersInstance);\n  DIUsersInstance.init();\n})();"],
  "mappings": "CAAC,UAAY,CAEX,SAAS,2BAA4B,CACjC,GAAI,CACF,MAAM,MAAQ,OAAO,SAAS,UAAY,IAAI,YAAY,EACpD,KAAO,uBAMb,MAHI,CAAC,KAAK,SAAS,IAAM,IAAI,GAGzB,OAAS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