{"id":24510686,"url":"https://github.com/rhdeck/usesegment","last_synced_at":"2025-03-15T09:41:23.793Z","repository":{"id":52689411,"uuid":"359652084","full_name":"rhdeck/usesegment","owner":"rhdeck","description":null,"archived":false,"fork":false,"pushed_at":"2021-04-21T01:19:04.000Z","size":28,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-22T02:05:33.847Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rhdeck.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-04-20T01:54:18.000Z","updated_at":"2021-04-21T01:19:05.000Z","dependencies_parsed_at":"2022-08-26T08:31:04.147Z","dependency_job_id":null,"html_url":"https://github.com/rhdeck/usesegment","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":"rhdeck/ts-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhdeck%2Fusesegment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhdeck%2Fusesegment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhdeck%2Fusesegment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhdeck%2Fusesegment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rhdeck","download_url":"https://codeload.github.com/rhdeck/usesegment/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243713392,"owners_count":20335566,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-22T00:30:21.201Z","updated_at":"2025-03-15T09:41:23.773Z","avatar_url":"https://github.com/rhdeck.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003ca name=\"readmemd\"\u003e\u003c/a\u003e\n\nTemplate for making easy-to-work-with tempates\n\n# ts-template\n\n## Usage\n\n1. [Copy this template](https://github.com/rhdeck/ts-template/)\n2. Clone to a local directory (eg `git clone https://github.com/me/my-repository/ \u0026\u0026 cd my-repository`)\n3. Run `yarn \u0026\u0026 yarn setup` to initialize the node package (Get rid of template strings - and this readme!)\n4. Happy Coding!\n\n## Useful Scripts\n\n1. `yarn build` will build using typescript pre-configured to node-compatible defaults\n2. `yarn docs` will auto-generate a README.md that starts with TOP.md, then adds CLI documentation (via [commanderdoc](https://npmjs.com/package/commanderdoc)) for any tool you have set up, and then library documentation after that.\n3. `yarn test` is pre-configured to test for typescript errors\n4. `yarn watch` will watch the codebase for changes and rebuild (using [livelink](https://npmjs.com/package/@raydeck/livelink))\n\n## Git code protections\n\n1. `git commit` will be blocked on the `main` branch unless you set the environment variable `ALLOWMAIN=1` Branch commits and PRs are thus encouraged\n2. `git commit` also tests messages for meeting the commitline standard conventions.\n3. `git commit` blocks pushes that do not pass `yarn test` (as a base case, they must pass typescript compilation)\n4. `npm publish` will always rebuild the code, the documentation, and push those changes back to the repository.\n5. `npm publish` will only publish the lib and src directories - any others are no\n\n## A note on \"main\"\n\nI made a deliberate choice to change the primary branch from `master` to `main` for reasons that are obvious to some. This repository endeavors to make that just automatic.\n\nPRs and feedback welcome via GitHub issues.\n\n\n\u003ca name=\"_librarymd\"\u003e\u003c/a\u003e\n\nusesegment - v1.0.0\n\n# usesegment - v1.0.0\n\n## Table of contents\n\n### Functions\n\n- [Segment](#segment)\n- [getAnalytics](#getanalytics)\n- [install](#install)\n- [useSegment](#usesegment)\n\n## Functions\n\n### Segment\n\n▸ **Segment**(`props`: { `children?`: ReactNode ; `id`: *string*  }): *Element*\n\nReact Component to initialize analytics\n\n#### Parameters:\n\n| Name | Type |\n| :------ | :------ |\n| `props` | *object* |\n| `props.children?` | ReactNode |\n| `props.id` | *string* |\n\n**Returns:** *Element*\n\nDefined in: index.tsx:87\n\n___\n\n### getAnalytics\n\n▸ **getAnalytics**(): *AnalyticsJS*\n\nRetrieve the analytics object. Note that it throws if it has not yet been installed\n\n**Returns:** *AnalyticsJS*\n\nanalytics object\n\nDefined in: index.tsx:19\n\n___\n\n### install\n\n▸ **install**(`id`: *string*): *void*\n\nDownload and install analytics.js\n\n#### Parameters:\n\n| Name | Type | Description |\n| :------ | :------ | :------ |\n| `id` | *string* | Segment identifier from snippet |\n\n**Returns:** *void*\n\nDefined in: index.tsx:28\n\n___\n\n### useSegment\n\n▸ **useSegment**(): *AnalyticsJS*\n\nUse Analytics in context of a compoent\n\n**Returns:** *AnalyticsJS*\n\nanalytics object\n\nDefined in: index.tsx:98\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhdeck%2Fusesegment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frhdeck%2Fusesegment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhdeck%2Fusesegment/lists"}