{"id":1909,"date":"2025-03-23T03:44:56","date_gmt":"2025-03-23T03:44:56","guid":{"rendered":"https:\/\/production.easypick.app\/?page_id=1909"},"modified":"2025-03-28T03:36:22","modified_gmt":"2025-03-28T03:36:22","slug":"verify-account","status":"publish","type":"page","link":"https:\/\/www.easypick.app\/no\/verify-account\/","title":{"rendered":"Verify Account"},"content":{"rendered":"<div data-elementor-type=\"wp-page\" data-elementor-id=\"1909\" class=\"elementor elementor-1909\" data-elementor-post-type=\"page\">\n\t\t\t\t<div class=\"elementor-element elementor-element-0c7dfe8 verify-account--container e-flex e-con-boxed e-con e-parent\" data-id=\"0c7dfe8\" data-element_type=\"container\" data-settings=\"{&quot;background_background&quot;:&quot;classic&quot;}\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-5642669 elementor-widget-widescreen__width-initial easypick-logo elementor-widget elementor-widget-image\" data-id=\"5642669\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"50\" height=\"42\" src=\"https:\/\/www.easypick.app\/wp-content\/uploads\/2025\/03\/logo.svg\" class=\"attachment-large size-large wp-image-1912\" alt=\"\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-357edef e-con-full replaceable-container e-flex e-con e-child\" data-id=\"357edef\" data-element_type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-5cad0f9 elementor-widget elementor-widget-image\" data-id=\"5cad0f9\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"40\" height=\"40\" src=\"https:\/\/www.easypick.app\/wp-content\/uploads\/2025\/03\/loading.webp\" class=\"attachment-large size-large wp-image-1916\" alt=\"\" srcset=\"https:\/\/www.easypick.app\/wp-content\/uploads\/2025\/03\/loading.webp 40w, https:\/\/www.easypick.app\/wp-content\/uploads\/2025\/03\/loading-12x12.webp 12w\" sizes=\"(max-width: 40px) 100vw, 40px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-28ac08c elementor-widget elementor-widget-html\" data-id=\"28ac08c\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t\t<script>\nconst failed_message = {\n  en: 'Something went wrong on verifying account.',\n  no: 'N\u00e5got gick fel n\u00e4r kontot verifierades.',\n  de: 'Bei der Kontobest\u00e4tigung ist ein Fehler aufgetreten.',\n  da: 'Noget gik galt med at bekr\u00e6fte kontoen.',\n  fi: 'Jotain meni pieleen tilin vahvistamisessa.',\n  sv: 'N\u00e5got gick fel n\u00e4r kontot verifierades.',\n};\n\nconst success_message = {\n  en: 'Congratulations! Your account has been successfully verified.',\n  no: 'Gratulerer! Kontoen din har blitt bekreftet.',\n  de: 'Gl\u00fcckwunsch! Ihr Konto wurde erfolgreich verifiziert.',\n  da: 'Tillykke! Din konto er blevet bekr\u00e6ftet.',\n  fi: 'Onnittelut! Tilisi on vahvistettu onnistuneesti.',\n  sv: 'Grattis! Ditt konto har verifierats.',\n};\n\nconst userLanguage = navigator.language || navigator.languages[0];\n\nasync function redirectUser() {\n  const email = new URLSearchParams(window.location.search).get('email');\n\n  const phoneNumber = new URLSearchParams(window.location.search).get(\n    'phoneNumber'\n  );\n\n  const iv = new URLSearchParams(window.location.search).get('iv');\n\n  const encryptedData = new URLSearchParams(window.location.search).get(\n    'encryptedData'\n  );\n\n  const stripeCustomerId = new URLSearchParams(window.location.search).get(\n    'stripeCustomerId'\n  );\n\n  const container = document.querySelector('.replaceable-container');\n\n  const newHeading = document.createElement('h3');\n  newHeading.classList.add('success-text');\n\n  \/\/   const mobileDeepLink = `easypick:\/\/verify-email?token=${token}`;\n  const appStoreLink = 'https:\/\/apps.apple.com\/app\/1215465630'; \/\/ iOS App Store\n\n  const playStoreLink =\n    'https:\/\/play.google.com\/store\/apps\/details?id=com.easypick.main'; \/\/ Android Play Store\n\n  const isMobile = \/iPhone|iPad|iPod|Android\/i.test(navigator.userAgent);\n\n  if (isMobile) {\n    \/\/ window.location.href = mobileDeepLink;\n\n    setTimeout(() => {\n      if (\/iPhone|iPad|iPod\/.test(navigator.userAgent)) {\n        window.location.href = appStoreLink;\n      } else {\n        window.location.href = playStoreLink;\n      }\n    }, 2000);\n  } else {\n    try {\n      if (!(email && phoneNumber && iv && stripeCustomerId)) {\n        throw new Error('Something went wrong. Please try again later.');\n      }\n\n      const response = await fetch(\n        'https:\/\/api.dev.easypick.no\/api\/user\/settings\/verify-account',\n        {\n          method: 'POST',\n          headers: {\n            'Content-Type': 'application\/json',\n          },\n          body: JSON.stringify({\n            email,\n            phoneNumber,\n            iv,\n            encryptedData,\n            stripeCustomerId,\n          }),\n        }\n      );\n\n      if (response.ok) {\n        console.log('Successfully verified account');\n        newHeading.textContent =\n          success_message[userLanguage] || success_message.en;\n        container.innerHTML = '';\n        container.appendChild(newHeading);\n        \/\/ window.history.pushState({}, '', '\/verify-account.html');\n\n        \/\/ setTimeout(() => {\n        \/\/   window.location.href = 'https:\/\/www.easypick.app';\n        \/\/ }, 2000);\n      } else {\n        console.log('Something went wrong. Please try again later.');\n        throw new Error('Something went wrong. Please try again later.');\n      }\n    } catch (error) {\n      console.log('Failed to verify account');\n\n      newHeading.textContent =\n        failed_message[userLanguage] || failed_message.en;\n      container.innerHTML = '';\n      container.appendChild(newHeading);\n\n      \/\/ window.history.pushState({}, '', '\/verify-account.html');\n\n      \/\/ setTimeout(() => {\n      \/\/   window.location.href = 'https:\/\/www.easypick.app';\n      \/\/ }, 2000);\n    }\n  }\n}\n\nwindow.onload = redirectUser;\n<\/script>\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>","protected":false},"excerpt":{"rendered":"","protected":false},"author":5,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1909","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.easypick.app\/no\/wp-json\/wp\/v2\/pages\/1909","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.easypick.app\/no\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.easypick.app\/no\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.easypick.app\/no\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.easypick.app\/no\/wp-json\/wp\/v2\/comments?post=1909"}],"version-history":[{"count":44,"href":"https:\/\/www.easypick.app\/no\/wp-json\/wp\/v2\/pages\/1909\/revisions"}],"predecessor-version":[{"id":2063,"href":"https:\/\/www.easypick.app\/no\/wp-json\/wp\/v2\/pages\/1909\/revisions\/2063"}],"wp:attachment":[{"href":"https:\/\/www.easypick.app\/no\/wp-json\/wp\/v2\/media?parent=1909"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}