diff --git a/CHANGELOG.md b/CHANGELOG.md index fbf8f4da335..f00ea709f99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,20 @@ +### ⚠️ Breaking changes + +This release replaces the existing “map views” pricing model in favor of a “map load” model. Learn more in [a recent blog post about these changes](https://blog.mapbox.com/new-pricing-46b7c26166e7). + +**By upgrading to this release, you are opting in to the new map loads pricing.** + +**Why is this change being made?** + +This change allows us to implement a more standardized and predictable method of billing GL JS map usage. You’ll be charged whenever your website or web application loads, not by when users pan and zoom around the map, incentivizing developers to create highly interactive map experiences. The new pricing structure also creates a significantly larger free tier to help developers get started building their applications with Mapbox tools while pay-as-you-go pricing and automatic volume discounts help your application scale with Mapbox. Session billing also aligns invoices with metrics web developers already track and makes it easier to compare usage with other mapping providers. + +**What is changing?** +- Add SKU token to Mapbox API requests [#8276](https://github.com/mapbox/mapbox-gl-js/pull/8276) + +When (and only when) loading tiles from a Mapbox API with a Mapbox access token set (`mapboxgl.accessToken`), a query parameter named `sku` will be added to all requests for vector, raster and raster-dem tiles. Every map instance uses a unique `sku` value, which is refreshed every 12 hours. The token itself is comprised of a token version (always “1”), a sku ID (always “01”) and a random 10-digit base-62 number. The purpose of the token is to allow for metering of map sessions on the server-side. A session lasts from a new map instantiation until the map is destroyed or 12 hours passes, whichever comes first. + +For further information on the pricing changes, you can read our [blog post](https://blog.mapbox.com/new-pricing-46b7c26166e7) and check out our new [pricing page](https://www.mapbox.com/pricing), which has a price calculator. As always, you can also contact our team at [https://support.mapbox.com](https://support.mapbox.com). + ## 0.54.0 ### Breaking changes diff --git a/bench/lib/fetch_style.js b/bench/lib/fetch_style.js index a766e8a6f75..316cfd84588 100644 --- a/bench/lib/fetch_style.js +++ b/bench/lib/fetch_style.js @@ -1,10 +1,12 @@ // @flow import type {StyleSpecification} from '../../src/style-spec/types'; -import {normalizeStyleURL} from '../../src/util/mapbox'; +import { RequestManager } from '../../src/util/mapbox'; + +const requestManager = new RequestManager(); export default function fetchStyle(value: string | StyleSpecification): Promise { return typeof value === 'string' ? - fetch(normalizeStyleURL(value)).then(response => response.json()) : + fetch(requestManager.normalizeStyleURL(value)).then(response => response.json()) : Promise.resolve(value); } diff --git a/bench/lib/tile_parser.js b/bench/lib/tile_parser.js index 1b0d72dabf3..3be9eb95b16 100644 --- a/bench/lib/tile_parser.js +++ b/bench/lib/tile_parser.js @@ -7,7 +7,7 @@ import assert from 'assert'; import deref from '../../src/style-spec/deref'; import Style from '../../src/style/style'; import { Evented } from '../../src/util/evented'; -import { normalizeSourceURL, normalizeTileURL } from '../../src/util/mapbox'; +import { RequestManager } from '../../src/util/mapbox'; import WorkerTile from '../../src/source/worker_tile'; import StyleLayerIndex from '../../src/style/style_layer_index'; @@ -17,14 +17,19 @@ import type { OverscaledTileID } from '../../src/source/tile_id'; import type { TileJSON } from '../../src/types/tilejson'; class StubMap extends Evented { - _transformRequest(url) { - return {url}; + _requestManager: RequestManager; + + constructor() { + super(); + this._requestManager = new RequestManager(); } } +const mapStub = new StubMap(); + function createStyle(styleJSON: StyleSpecification): Promise