open-index/open-npm huggingface dataset:
npm package: @opencage/geosearch-bundle
Description: OpenCage GeoSearch bundled with Algolia autocomplete
Author: OpenCage GmbH
Latest version: 0.2.0

# @opencage/geosearch-bundle

The `geosearch-bundle` bundles the Algolia [autocomplete](https://github.com/algolia/autocomplete) and [OpenCage](https://opencagedata.com/) GeoSearch plugin to search for places around the world. This bundle is for browser usage.

## Usage

Links to the css and the script:

```html
<link
  rel="stylesheet"
  href="https://cdn.jsdelivr.net/npm/@opencage/geosearch-bundle/dist/css/autocomplete-theme-classic.min.css"
/>
<script src="https://cdn.jsdelivr.net/npm/@opencage/geosearch-bundle"></script>
```

Container and code

```html
<div id="place"></div>

<script type="text/javascript">
  opencage.algoliaAutocomplete({
    container: '#place',
    plugins: [
      opencage.OpenCageGeoSearchPlugin({
        key: 'YOUR-GEOSEARCH-KEY',
      }),
    ],
  });
</script>
```

## Documentation

See [Documentation](https://github.com/opencagedata/geosearch).

## Demo

See [Demo](https://opencagedata.com/geosearch).
npm package: @opencage/geosearch-core
Description: Core client for OpenCage GeoSearch
Author: OpenCage GmbH
Latest version: 0.2.0

# @opencage/geosearch-core

The `geosearch-core` package is an Algolia [autocomplete](https://github.com/algolia/autocomplete) plugin used by [OpenCage Geosearch](https://opencagedata.com/geosearch) to search for places around the world.

## Installation

```bash
pnpm add @opencage/geosearch-core
or
yarn add @opencage/geosearch-core
# or
npm install @opencage/geosearch-core
```

## Documentation

See [Documentation](https://github.com/opencagedata/geosearch).

## Demo

See [Demo](https://opencagedata.com/geosearch).
npm package: @opencage/ol-opencage-geosearch
Description: An OpenLayers geosearch control that uses OpenCage's geosearch API.
Author: OpenCage GmbH
Latest version: 0.2.0

# `@opencage/ol-opencage-geosearch`

<p>An OpenLayers plugin that lets you quickly add a search box and help your users find locations on the map</p>

Check out a demo page in [/openlayers-library-example](https://github.com/OpenCageData/geosearch/tree/master/examples/openlayers-library-example). Or take a look at the [live demo](https://codepen.io/opencage/full/LYezKGz).

## OpenLayers version

Tested with versions:

- 6.14.1
- 7.1.0
- 7.3.0
- 7.4.0
- 8.1.0
- 8.2.0
- 9.0.0
- 9.1.0
- 9.2.3
- 10.0.0
- 10.5.0

## Other external dependencies

This plugin at the moment uses the [Opencage geoseach SDK bundle]() with alogolia's autocomplete. Check the [instructions](#usage).

## Browser / device compatibility

This plugin will be compatible with the same browsers / device than the OpenLayers library is.

## Usage

Load the plugin's CSS and JavaScript files:

```html
<link
  rel="stylesheet"
  href="https://cdn.jsdelivr.net/npm/@opencage/ol-opencage-geosearch/ol-opencage-geosearch.css"
/>

<script src="https://cdn.jsdelivr.net/npm/@opencage/geosearch-bundle"></script>
<script src="https://cdn.jsdelivr.net/npm/@opencage/ol-opencage-geosearch"></script>
```

and insert this new control to your leaflet map:

```js
const options = {
  key: 'YOUR_OPENCAGE_GEOSEARCH_KEY',
  // you will need to become a customer to get a geosearch key
  //
  // limit: 3,
  // noResults: 'Pas de résultat.',
  //
  // openlayers options:
  position: 'topright', // Possible values are 'topleft', 'topright', 'bottomleft' or 'bottomright'
};

var controlGeosearch = new OpenCageGeosearchControl(options);
map.addControl(controlGeosearch);
```

## API reference

1. the `options` parameter has the same API as the [core sdk](https://github.com/OpenCageData/geosearch)

2. the `events` from the [core sdk](https://github.com/OpenCageData/geosearch) can be included directly in the `options` parameter.

   | example:

```js
const options = {
  key: window.OPENCAGE_GEOSEARCH_KEY,
  // you will need to become a customer to get a geosearch key
  //
  onActive: () => {
    console.log('Happy Geosearch');
  },
  //
  // leafletjs options:
  position: 'topright', // Possible values are 'topleft', 'topright', 'bottomleft' or 'bottomright'
};
```

## License

Licensed under the MIT License

A copy of the license is available in the repository's [LICENSE](LICENSE) file.

## Who is OpenCage GmbH?

[![OpenCage Logo](/resources/opencage_logo_300_150.png)](https://opencagedata.com)

We run the [OpenCage Geocoding API](https://opencagedata.com/api). Learn more [about us](https://opencagedata.com/about).

We also run [Geomob](https://thegeomob.com), a series of regular meetups for location based service creators, where we do our best to highlight geoinnovation. If you like geo stuff, you will probably enjoy [the Geomob podcast](https://thegeomob.com/podcast/).
npm package: @opencampus/ochub-harness
Description: Test harness for OCID-authenticated mini apps
Author: Open Campus
Latest version: 0.0.5

# @opencampus/ochub-harness

A test harness for developing and testing OCID-authenticated mini apps. This tool provides a local development environment that use the Open Campus Hub authentication flow, allowing you to test your mini app's integration with OCID Connect without deploying to production.

## Usage

```bash
npx @opencampus/ochub-harness --url <mini-app-url>
```

### Options

| Option          | Description                | Default                 |
| --------------- | -------------------------- | ----------------------- |
| `--url <url>`   | URL of your mini app       | `http://localhost:3000` |
| `--port <port>` | Port to run the harness on | `8080`                  |

### Example

Start the harness pointing to your local mini app:

```bash
npx @opencampus/ochub-harness --url http://localhost:5173
```

Or use defaults (assumes your app runs on port 3000):

```bash
npx @opencampus/ochub-harness
```

Then open `http://localhost:8080` in your browser.
npm package: @opencampus/ochub-utils
Description: Open Campus Hub utilities library for analytics and account management
Latest version: 0.4.2

# @opencampus/ochub-utils

Open Campus Hub utilities library providing analytics and account management modules.

## Installation

```bash
npm install @opencampus/ochub-utils
```

## Usage

### Analytics Module

```typescript
import { OCAnalytics } from "@opencampus/ochub-utils";

// Initialize with app name and GTM container ID (no secrets exposed!)
OCAnalytics.initialize("my-app", {
  containerId: "GTM-XXXXXXXXX",
});

// Get the instance and track events
const analytics = OCAnalytics.getInstance();

// Track a custom event
// Pushes: { event: 'app_event', app_name, event_name, event_payload: {...} }
analytics.trackEvent("user_signup", {
  signup_method: "email",
  user_age: 25,
});

// Set user ID for tracking
analytics.setUserId("user123");
```

**Note:** GTM is the recommended approach for frontend tracking as it doesn't require exposing API secrets or measurement IDs directly in code. All events are pushed to the GTM data layer, which can be configured securely in the GTM console.

### Account Module

```typescript
import { getInstance } from "@opencampus/ochub-utils";

// Get the module-level singleton instance (instantiates only once)
const account = getInstance({
  sandboxMode: false, // Set to true for sandbox/test mode
  opts: {
    // OCID Connect options here
  },
});

// Subsequent calls return the same instance, config is ignored
const accountAgain = getInstance(); // Returns same instance

// Subscribe to authentication state changes
const unsubscribe = account.subscribe((authState) => {
  console.log("Auth state updated:", authState);
});

// Access authentication state
if (account.isAuthenticated()) {
  const ocId = account.getOCId();
  const ethAddress = account.getEthAddress();
  const authState = account.getAuthState();

  // Access JWT tokens
  const idToken = account.getIdToken();
  const accessToken = account.getAccessToken();
}

// Check SDK initialization status
if (account.isSDKInitialized()) {
  console.log("OCID SDK is ready");
}

// Unsubscribe when done
unsubscribe();
```

**Note:**

- `getInstance()` is a module-level singleton function - instantiates only once
- Configuration is only used on first instantiation
- It's read-only for accessing authentication state
- Connection management is handled by the OCID Connect component in your application

## Modules

- **analytics** - Google Tag Manager integration for frontend tracking
  - `OCAnalytics` - Singleton class for tracking custom events
  - Secure frontend tracking without exposing API secrets
  - App name set once at initialization, included in all events
  - Supports custom event parameters
  - Automatic GTM script injection and data layer management
- **account** - Account and user management utilities
  - `OCAccount` - Singleton class for OCID Connect SDK management
  - Authentication state management with subscription support
  - Support for sandbox and live modes
  - Access to OCId, Ethereum address, and JWT tokens (idToken, accessToken)

## License

MIT