{"action":"created","comment":{"url":"https://api.github.com/repos/artsy/emission/pulls/comments/201040363","pull_request_review_id":135463710,"id":201040363,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMTA0MDM2Mw==","diff_hunk":"@@ -0,0 +1,141 @@\n+import { stringify } from \"qs\"\n+import React from \"react\"\n+import {\n+  ActivityIndicator,\n+  Dimensions,\n+  KeyboardAvoidingView,\n+  NativeModules,\n+  NavigatorIOS,\n+  ScrollView,\n+  TouchableWithoutFeedback,\n+  ViewProperties,\n+} from \"react-native\"\n+\n+import { BackButton } from \"../Components/BackButton\"\n+import { BiddingThemeProvider } from \"../Components/BiddingThemeProvider\"\n+import { Container } from \"../Components/Containers\"\n+import { Input } from \"../Components/Input\"\n+import { Title } from \"../Components/Title\"\n+import { Serif18, SerifItalic18 } from \"../Elements/Typography\"\n+import { Country, SearchResult } from \"../types\"\n+\n+const { Emission } = NativeModules\n+\n+interface SelectCountryProps extends ViewProperties {\n+  navigator: NavigatorIOS\n+  onCountrySelected?: (country: any) => void\n+}\n+\n+interface SelectCountryState {\n+  query: string\n+  isLoading: boolean\n+  results: SearchResult[]\n+}\n+\n+// TODO: Remove this once React Native has been updated\n+const isPhoneX = Dimensions.get(\"window\").height === 812 && Dimensions.get(\"window\").width === 375\n+const defaultVerticalOffset = isPhoneX ? 30 : 15\n+\n+export class SelectCountry extends React.Component<SelectCountryProps, SelectCountryState> {\n+  constructor(props) {\n+    super(props)\n+\n+    this.state = {\n+      query: null,\n+      isLoading: false,\n+      results: [],\n+    }\n+  }\n+\n+  locationSelected = async (result: SearchResult) => {\n+    // The extra key is from a throwaway google account,\n+    // it should only get used in Emission dev mode\n+    const apiKey = Emission.googleMapsAPIKey || \"AIzaSyBJRIy_zCXQ7XYt9Ubn8bpUIEAxEOKUmx8\"\n+    const queryString = stringify({\n+      key: apiKey,\n+      placeid: result.id,\n+    })\n+\n+    const response = await fetch(`https://maps.googleapis.com/maps/api/place/details/json?${queryString}`)\n+    const results = await response.json()\n+    const country = results.result.address_components.find(comp => comp.types[0] === \"country\")\n+\n+    this.props.onCountrySelected({ longName: country.long_name, shortName: country.short_name } as Country)\n+    this.props.navigator.pop()\n+  }\n+\n+  textChanged = async (text: string) => {\n+    this.setState({ query: text, isLoading: text.length > 0 })\n+    this.searchForQuery(text)\n+  }\n+\n+  // https://developers.google.com/places/\n+  // https://developers.google.com/places/web-service/details\n+  searchForQuery = async (input: string) => {\n+    // The 2nd is a throw-away key on a throw-away account\n+    const apiKey = Emission.googleMapsAPIKey || \"AIzaSyBJRIy_zCXQ7XYt9Ubn8bpUIEAxEOKUmx8\"\n+    const queryString = stringify({\n+      key: apiKey,\n+      language: \"en\",\n+      types: \"(regions)\",\n+      input,\n+    })\n+\n+    const response = await fetch(`https://maps.googleapis.com/maps/api/place/autocomplete/json?${queryString}`)\n+    const results = await response.json()\n+    const predictions = (results.predictions || [])\n+      .filter(prediction => prediction.types[0] === \"country\")\n+      .map(prediction => ({ id: prediction.place_id, name: prediction.description }))\n+\n+    this.setState({\n+      results: predictions,\n+      isLoading: false,\n+    })\n+  }\n+\n+  render() {\n+    const { results, isLoading, query } = this.state\n+\n+    return (\n+      <BiddingThemeProvider>\n+        <KeyboardAvoidingView behavior=\"padding\" keyboardVerticalOffset={defaultVerticalOffset} style={{ flex: 1 }}>","path":"src/lib/Components/Bidding/Screens/SelectCountry.tsx","position":101,"original_position":101,"commit_id":"bf4a37aae01039fbcf2d8c5fd1eea317595bc52f","original_commit_id":"bf4a37aae01039fbcf2d8c5fd1eea317595bc52f","user":{"login":"yuki24","id":386234,"node_id":"MDQ6VXNlcjM4NjIzNA==","avatar_url":"https://avatars0.githubusercontent.com/u/386234?v=4","gravatar_id":"","url":"https://api.github.com/users/yuki24","html_url":"https://github.com/yuki24","followers_url":"https://api.github.com/users/yuki24/followers","following_url":"https://api.github.com/users/yuki24/following{/other_user}","gists_url":"https://api.github.com/users/yuki24/gists{/gist_id}","starred_url":"https://api.github.com/users/yuki24/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yuki24/subscriptions","organizations_url":"https://api.github.com/users/yuki24/orgs","repos_url":"https://api.github.com/users/yuki24/repos","events_url":"https://api.github.com/users/yuki24/events{/privacy}","received_events_url":"https://api.github.com/users/yuki24/received_events","type":"User","site_admin":false},"body":"Good call, let me test this without it.","created_at":"2018-07-09T15:15:15Z","updated_at":"2018-07-09T15:15:16Z","html_url":"https://github.com/artsy/emission/pull/1149#discussion_r201040363","pull_request_url":"https://api.github.com/repos/artsy/emission/pulls/1149","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/artsy/emission/pulls/comments/201040363"},"html":{"href":"https://github.com/artsy/emission/pull/1149#discussion_r201040363"},"pull_request":{"href":"https://api.github.com/repos/artsy/emission/pulls/1149"}},"in_reply_to_id":201017420},"pull_request":{"url":"https://api.github.com/repos/artsy/emission/pulls/1149","id":199856605,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk5ODU2NjA1","html_url":"https://github.com/artsy/emission/pull/1149","diff_url":"https://github.com/artsy/emission/pull/1149.diff","patch_url":"https://github.com/artsy/emission/pull/1149.patch","issue_url":"https://api.github.com/repos/artsy/emission/issues/1149","number":1149,"state":"open","locked":false,"title":"WIP: User can navigate to Select country screen and type a country name","user":{"login":"yuki24","id":386234,"node_id":"MDQ6VXNlcjM4NjIzNA==","avatar_url":"https://avatars0.githubusercontent.com/u/386234?v=4","gravatar_id":"","url":"https://api.github.com/users/yuki24","html_url":"https://github.com/yuki24","followers_url":"https://api.github.com/users/yuki24/followers","following_url":"https://api.github.com/users/yuki24/following{/other_user}","gists_url":"https://api.github.com/users/yuki24/gists{/gist_id}","starred_url":"https://api.github.com/users/yuki24/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yuki24/subscriptions","organizations_url":"https://api.github.com/users/yuki24/orgs","repos_url":"https://api.github.com/users/yuki24/repos","events_url":"https://api.github.com/users/yuki24/events{/privacy}","received_events_url":"https://api.github.com/users/yuki24/received_events","type":"User","site_admin":false},"body":"This is a spike on https://artsyproduct.atlassian.net/browse/PURCHASE-251\r\n\r\nThis adds a new `<SelectCountry>` component. The visual part of mostly done, but the parent `<BillingAddress>` component needs to pass a callback function to the child to get the country field updated.\r\n\r\n * [x] Check in with @briansw about the UI\r\n * [x] Make sure we send a country value in the appropriate format Stripe accepts\r\n * [x] Add more test coverage for the `<BillingAddress>` component (find the `TODO` in `src/lib/Components/Bidding/Screens/__tests__/BillingAddress-tests.tsx`)\r\n * [ ] Add new tests for the `<SelectCountry>` component\r\n\r\n<img src=\"https://user-images.githubusercontent.com/386234/42401946-13b8eb1e-8146-11e8-9348-d15c25b7369c.gif\" width=\"414\" height=\"808\">\r\n","created_at":"2018-07-06T22:03:19Z","updated_at":"2018-07-09T15:15:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d5c704d27cc372daa5afb44d69cec8ab5885288b","assignee":{"login":"sweir27","id":2081340,"node_id":"MDQ6VXNlcjIwODEzNDA=","avatar_url":"https://avatars3.githubusercontent.com/u/2081340?v=4","gravatar_id":"","url":"https://api.github.com/users/sweir27","html_url":"https://github.com/sweir27","followers_url":"https://api.github.com/users/sweir27/followers","following_url":"https://api.github.com/users/sweir27/following{/other_user}","gists_url":"https://api.github.com/users/sweir27/gists{/gist_id}","starred_url":"https://api.github.com/users/sweir27/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sweir27/subscriptions","organizations_url":"https://api.github.com/users/sweir27/orgs","repos_url":"https://api.github.com/users/sweir27/repos","events_url":"https://api.github.com/users/sweir27/events{/privacy}","received_events_url":"https://api.github.com/users/sweir27/received_events","type":"User","site_admin":false},"assignees":[{"login":"sweir27","id":2081340,"node_id":"MDQ6VXNlcjIwODEzNDA=","avatar_url":"https://avatars3.githubusercontent.com/u/2081340?v=4","gravatar_id":"","url":"https://api.github.com/users/sweir27","html_url":"https://github.com/sweir27","followers_url":"https://api.github.com/users/sweir27/followers","following_url":"https://api.github.com/users/sweir27/following{/other_user}","gists_url":"https://api.github.com/users/sweir27/gists{/gist_id}","starred_url":"https://api.github.com/users/sweir27/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sweir27/subscriptions","organizations_url":"https://api.github.com/users/sweir27/orgs","repos_url":"https://api.github.com/users/sweir27/repos","events_url":"https://api.github.com/users/sweir27/events{/privacy}","received_events_url":"https://api.github.com/users/sweir27/received_events","type":"User","site_admin":false}],"requested_reviewers":[{"login":"orta","id":49038,"node_id":"MDQ6VXNlcjQ5MDM4","avatar_url":"https://avatars2.githubusercontent.com/u/49038?v=4","gravatar_id":"","url":"https://api.github.com/users/orta","html_url":"https://github.com/orta","followers_url":"https://api.github.com/users/orta/followers","following_url":"https://api.github.com/users/orta/following{/other_user}","gists_url":"https://api.github.com/users/orta/gists{/gist_id}","starred_url":"https://api.github.com/users/orta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/orta/subscriptions","organizations_url":"https://api.github.com/users/orta/orgs","repos_url":"https://api.github.com/users/orta/repos","events_url":"https://api.github.com/users/orta/events{/privacy}","received_events_url":"https://api.github.com/users/orta/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/artsy/emission/pulls/1149/commits","review_comments_url":"https://api.github.com/repos/artsy/emission/pulls/1149/comments","review_comment_url":"https://api.github.com/repos/artsy/emission/pulls/comments{/number}","comments_url":"https://api.github.com/repos/artsy/emission/issues/1149/comments","statuses_url":"https://api.github.com/repos/artsy/emission/statuses/bf4a37aae01039fbcf2d8c5fd1eea317595bc52f","head":{"label":"artsy:PURCHASE-251","ref":"PURCHASE-251","sha":"bf4a37aae01039fbcf2d8c5fd1eea317595bc52f","user":{"login":"artsy","id":546231,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU0NjIzMQ==","avatar_url":"https://avatars3.githubusercontent.com/u/546231?v=4","gravatar_id":"","url":"https://api.github.com/users/artsy","html_url":"https://github.com/artsy","followers_url":"https://api.github.com/users/artsy/followers","following_url":"https://api.github.com/users/artsy/following{/other_user}","gists_url":"https://api.github.com/users/artsy/gists{/gist_id}","starred_url":"https://api.github.com/users/artsy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/artsy/subscriptions","organizations_url":"https://api.github.com/users/artsy/orgs","repos_url":"https://api.github.com/users/artsy/repos","events_url":"https://api.github.com/users/artsy/events{/privacy}","received_events_url":"https://api.github.com/users/artsy/received_events","type":"Organization","site_admin":false},"repo":{"id":52437732,"node_id":"MDEwOlJlcG9zaXRvcnk1MjQzNzczMg==","name":"emission","full_name":"artsy/emission","owner":{"login":"artsy","id":546231,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU0NjIzMQ==","avatar_url":"https://avatars3.githubusercontent.com/u/546231?v=4","gravatar_id":"","url":"https://api.github.com/users/artsy","html_url":"https://github.com/artsy","followers_url":"https://api.github.com/users/artsy/followers","following_url":"https://api.github.com/users/artsy/following{/other_user}","gists_url":"https://api.github.com/users/artsy/gists{/gist_id}","starred_url":"https://api.github.com/users/artsy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/artsy/subscriptions","organizations_url":"https://api.github.com/users/artsy/orgs","repos_url":"https://api.github.com/users/artsy/repos","events_url":"https://api.github.com/users/artsy/events{/privacy}","received_events_url":"https://api.github.com/users/artsy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/artsy/emission","description":"React Native Components","fork":false,"url":"https://api.github.com/repos/artsy/emission","forks_url":"https://api.github.com/repos/artsy/emission/forks","keys_url":"https://api.github.com/repos/artsy/emission/keys{/key_id}","collaborators_url":"https://api.github.com/repos/artsy/emission/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/artsy/emission/teams","hooks_url":"https://api.github.com/repos/artsy/emission/hooks","issue_events_url":"https://api.github.com/repos/artsy/emission/issues/events{/number}","events_url":"https://api.github.com/repos/artsy/emission/events","assignees_url":"https://api.github.com/repos/artsy/emission/assignees{/user}","branches_url":"https://api.github.com/repos/artsy/emission/branches{/branch}","tags_url":"https://api.github.com/repos/artsy/emission/tags","blobs_url":"https://api.github.com/repos/artsy/emission/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/artsy/emission/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/artsy/emission/git/refs{/sha}","trees_url":"https://api.github.com/repos/artsy/emission/git/trees{/sha}","statuses_url":"https://api.github.com/repos/artsy/emission/statuses/{sha}","languages_url":"https://api.github.com/repos/artsy/emission/languages","stargazers_url":"https://api.github.com/repos/artsy/emission/stargazers","contributors_url":"https://api.github.com/repos/artsy/emission/contributors","subscribers_url":"https://api.github.com/repos/artsy/emission/subscribers","subscription_url":"https://api.github.com/repos/artsy/emission/subscription","commits_url":"https://api.github.com/repos/artsy/emission/commits{/sha}","git_commits_url":"https://api.github.com/repos/artsy/emission/git/commits{/sha}","comments_url":"https://api.github.com/repos/artsy/emission/comments{/number}","issue_comment_url":"https://api.github.com/repos/artsy/emission/issues/comments{/number}","contents_url":"https://api.github.com/repos/artsy/emission/contents/{+path}","compare_url":"https://api.github.com/repos/artsy/emission/compare/{base}...{head}","merges_url":"https://api.github.com/repos/artsy/emission/merges","archive_url":"https://api.github.com/repos/artsy/emission/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/artsy/emission/downloads","issues_url":"https://api.github.com/repos/artsy/emission/issues{/number}","pulls_url":"https://api.github.com/repos/artsy/emission/pulls{/number}","milestones_url":"https://api.github.com/repos/artsy/emission/milestones{/number}","notifications_url":"https://api.github.com/repos/artsy/emission/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/artsy/emission/labels{/name}","releases_url":"https://api.github.com/repos/artsy/emission/releases{/id}","deployments_url":"https://api.github.com/repos/artsy/emission/deployments","created_at":"2016-02-24T11:36:24Z","updated_at":"2018-07-06T22:54:21Z","pushed_at":"2018-07-09T14:44:21Z","git_url":"git://github.com/artsy/emission.git","ssh_url":"git@github.com:artsy/emission.git","clone_url":"https://github.com/artsy/emission.git","svn_url":"https://github.com/artsy/emission","homepage":"http://artsy.github.io/blog/2018/04/17/making-a-components-pod/","size":26018,"stargazers_count":490,"watchers_count":490,"language":"TypeScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":52,"mirror_url":null,"archived":false,"open_issues_count":65,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":52,"open_issues":65,"watchers":490,"default_branch":"master"}},"base":{"label":"artsy:master","ref":"master","sha":"75746c3de5c7483bdf4e87f46f8387459d74200e","user":{"login":"artsy","id":546231,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU0NjIzMQ==","avatar_url":"https://avatars3.githubusercontent.com/u/546231?v=4","gravatar_id":"","url":"https://api.github.com/users/artsy","html_url":"https://github.com/artsy","followers_url":"https://api.github.com/users/artsy/followers","following_url":"https://api.github.com/users/artsy/following{/other_user}","gists_url":"https://api.github.com/users/artsy/gists{/gist_id}","starred_url":"https://api.github.com/users/artsy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/artsy/subscriptions","organizations_url":"https://api.github.com/users/artsy/orgs","repos_url":"https://api.github.com/users/artsy/repos","events_url":"https://api.github.com/users/artsy/events{/privacy}","received_events_url":"https://api.github.com/users/artsy/received_events","type":"Organization","site_admin":false},"repo":{"id":52437732,"node_id":"MDEwOlJlcG9zaXRvcnk1MjQzNzczMg==","name":"emission","full_name":"artsy/emission","owner":{"login":"artsy","id":546231,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU0NjIzMQ==","avatar_url":"https://avatars3.githubusercontent.com/u/546231?v=4","gravatar_id":"","url":"https://api.github.com/users/artsy","html_url":"https://github.com/artsy","followers_url":"https://api.github.com/users/artsy/followers","following_url":"https://api.github.com/users/artsy/following{/other_user}","gists_url":"https://api.github.com/users/artsy/gists{/gist_id}","starred_url":"https://api.github.com/users/artsy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/artsy/subscriptions","organizations_url":"https://api.github.com/users/artsy/orgs","repos_url":"https://api.github.com/users/artsy/repos","events_url":"https://api.github.com/users/artsy/events{/privacy}","received_events_url":"https://api.github.com/users/artsy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/artsy/emission","description":"React Native Components","fork":false,"url":"https://api.github.com/repos/artsy/emission","forks_url":"https://api.github.com/repos/artsy/emission/forks","keys_url":"https://api.github.com/repos/artsy/emission/keys{/key_id}","collaborators_url":"https://api.github.com/repos/artsy/emission/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/artsy/emission/teams","hooks_url":"https://api.github.com/repos/artsy/emission/hooks","issue_events_url":"https://api.github.com/repos/artsy/emission/issues/events{/number}","events_url":"https://api.github.com/repos/artsy/emission/events","assignees_url":"https://api.github.com/repos/artsy/emission/assignees{/user}","branches_url":"https://api.github.com/repos/artsy/emission/branches{/branch}","tags_url":"https://api.github.com/repos/artsy/emission/tags","blobs_url":"https://api.github.com/repos/artsy/emission/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/artsy/emission/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/artsy/emission/git/refs{/sha}","trees_url":"https://api.github.com/repos/artsy/emission/git/trees{/sha}","statuses_url":"https://api.github.com/repos/artsy/emission/statuses/{sha}","languages_url":"https://api.github.com/repos/artsy/emission/languages","stargazers_url":"https://api.github.com/repos/artsy/emission/stargazers","contributors_url":"https://api.github.com/repos/artsy/emission/contributors","subscribers_url":"https://api.github.com/repos/artsy/emission/subscribers","subscription_url":"https://api.github.com/repos/artsy/emission/subscription","commits_url":"https://api.github.com/repos/artsy/emission/commits{/sha}","git_commits_url":"https://api.github.com/repos/artsy/emission/git/commits{/sha}","comments_url":"https://api.github.com/repos/artsy/emission/comments{/number}","issue_comment_url":"https://api.github.com/repos/artsy/emission/issues/comments{/number}","contents_url":"https://api.github.com/repos/artsy/emission/contents/{+path}","compare_url":"https://api.github.com/repos/artsy/emission/compare/{base}...{head}","merges_url":"https://api.github.com/repos/artsy/emission/merges","archive_url":"https://api.github.com/repos/artsy/emission/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/artsy/emission/downloads","issues_url":"https://api.github.com/repos/artsy/emission/issues{/number}","pulls_url":"https://api.github.com/repos/artsy/emission/pulls{/number}","milestones_url":"https://api.github.com/repos/artsy/emission/milestones{/number}","notifications_url":"https://api.github.com/repos/artsy/emission/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/artsy/emission/labels{/name}","releases_url":"https://api.github.com/repos/artsy/emission/releases{/id}","deployments_url":"https://api.github.com/repos/artsy/emission/deployments","created_at":"2016-02-24T11:36:24Z","updated_at":"2018-07-06T22:54:21Z","pushed_at":"2018-07-09T14:44:21Z","git_url":"git://github.com/artsy/emission.git","ssh_url":"git@github.com:artsy/emission.git","clone_url":"https://github.com/artsy/emission.git","svn_url":"https://github.com/artsy/emission","homepage":"http://artsy.github.io/blog/2018/04/17/making-a-components-pod/","size":26018,"stargazers_count":490,"watchers_count":490,"language":"TypeScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":52,"mirror_url":null,"archived":false,"open_issues_count":65,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":52,"open_issues":65,"watchers":490,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/artsy/emission/pulls/1149"},"html":{"href":"https://github.com/artsy/emission/pull/1149"},"issue":{"href":"https://api.github.com/repos/artsy/emission/issues/1149"},"comments":{"href":"https://api.github.com/repos/artsy/emission/issues/1149/comments"},"review_comments":{"href":"https://api.github.com/repos/artsy/emission/pulls/1149/comments"},"review_comment":{"href":"https://api.github.com/repos/artsy/emission/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/artsy/emission/pulls/1149/commits"},"statuses":{"href":"https://api.github.com/repos/artsy/emission/statuses/bf4a37aae01039fbcf2d8c5fd1eea317595bc52f"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"yuki24"}}