@mparticle/web-sdk 3.28.0 → 3.29.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +65 -34
- package/dist/mparticle.common.js +1 -1
- package/dist/mparticle.esm.js +1 -1
- package/dist/mparticle.js +324 -55
- package/dist/types/src/buttonTracking/buttonDescription.d.ts +2 -0
- package/dist/types/src/buttonTracking/buttonTracker.d.ts +1 -0
- package/dist/types/src/buttonTracking/checkoutIntent.d.ts +2 -0
- package/dist/types/src/roktManager.d.ts +3 -0
- package/package.json +1 -1
- package/src/buttonTracking/buttonDescription.ts +397 -61
- package/src/buttonTracking/buttonTracker.ts +49 -7
- package/src/buttonTracking/checkoutIntent.ts +36 -0
- package/src/mp-instance.ts +8 -4
- package/src/roktManager.ts +13 -0
package/README.md
CHANGED
|
@@ -16,11 +16,11 @@ Version 3 of the mParticle Web SDK is generally available. See [MIGRATING.md](MI
|
|
|
16
16
|
|
|
17
17
|
## Include and Initialize the SDK
|
|
18
18
|
|
|
19
|
-
There are two ways to initialize the SDK, either via a script tag, or you can bundle the SDK via NPM. A summary of steps for both
|
|
19
|
+
There are two ways to initialize the SDK, either via a script tag, or you can bundle the SDK via NPM. A summary of steps for both is available below, but you should review the detailed documentation for the [script tag](https://docs.mparticle.com/developers/sdk/web/getting-started) and [self hosting](https://docs.mparticle.com/developers/sdk/web/self-hosting) on the mParticle docs site.
|
|
20
20
|
|
|
21
21
|
### Option 1. Load mParticle via Script Tag
|
|
22
22
|
|
|
23
|
-
To integrate the SDK add the following snippet to your site after customizing `mParticle.config`, ideally in the `<head>` element. Replace `
|
|
23
|
+
To integrate the SDK add the following snippet to your site after customizing `mParticle.config`, ideally in the `<head>` element. Replace `REPLACE WITH API KEY` at the end of the snippet with the API key for your mParticle Web workspace.
|
|
24
24
|
|
|
25
25
|
This snippet pre-populates method stubs for much of the public SDK API, allowing immediate reference to these APIs as the SDK loads.
|
|
26
26
|
|
|
@@ -144,14 +144,32 @@ This package comes with the NPM package [pre-commit](https://www.npmjs.com/packa
|
|
|
144
144
|
|
|
145
145
|
## Three-step release process (maintainers)
|
|
146
146
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
147
|
+
V2 and V3 release with separate workflows: `staging-step-1.yml`,
|
|
148
|
+
`staging-step-2.yml` and `staging-step-3.yml` for v2, and
|
|
149
|
+
`v3-release-step-1.yml`, `v3-release-step-2.yml` and `v3-release-step-3.yml`
|
|
150
|
+
for v3.
|
|
151
|
+
|
|
152
|
+
During the switch to the V3 files, `staging-step-1.yml` keeps its `v3` track
|
|
153
|
+
and kit recovery. The first V3 release after the split still runs it from
|
|
154
|
+
`v3-staging` with `track=v3`, because `v3-release-step-1.yml` reaches `main`
|
|
155
|
+
only at that release's Step 3. If that release's kit publishing fails, resume
|
|
156
|
+
it with **Staging Release - Step 1** from `v3-staging` (`track=v3`,
|
|
157
|
+
`dryRun=false`, `resumeKitReleaseTag`). The same release runs Steps 2 and 3
|
|
158
|
+
with **Staging Release - Step 2** and **Staging Release - Step 3** from `main`,
|
|
159
|
+
because `v3-release-step-2.yml` and `v3-release-step-3.yml` also reach `main`
|
|
160
|
+
only at its Step 3. Once a V3 release has run on
|
|
161
|
+
`v3-release-step-1.yml`, a follow-up removes the `v3` track from
|
|
162
|
+
`staging-step-1.yml`. V2 runs the copies on `staging` and `master`, which this
|
|
163
|
+
split does not change.
|
|
164
|
+
|
|
165
|
+
In GitHub Actions, choose the version's branch from the **Use workflow
|
|
166
|
+
from** dropdown and run its workflows in order:
|
|
167
|
+
|
|
168
|
+
1. **Step 1: Prepare CDN Pre-Release, Publish NPM**: run
|
|
169
|
+
**Staging Release - Step 1** (`staging-step-1.yml`) from `staging` with
|
|
170
|
+
`track=v2`, or **V3 Release - Step 1** (`v3-release-step-1.yml`) from
|
|
171
|
+
`v3-staging`. This workflow builds and tests the version, creates and
|
|
172
|
+
merges a generated release branch, runs semantic-release, and publishes the npm
|
|
155
173
|
release. Before a new v3 release can advance, every existing kit `next` tag
|
|
156
174
|
must match the core SDK's current `next` version. The one-time `3.0.0`
|
|
157
175
|
bootstrap permits all kit tags to be absent so the first synchronized release
|
|
@@ -172,26 +190,27 @@ workflows in order:
|
|
|
172
190
|
identical. `dryRun=true` previews the merge and semantic-release result
|
|
173
191
|
without creating a branch or publishing; `dryRun=false` creates/pushes the
|
|
174
192
|
release branch and publishes. If core publishes but kit publication cannot
|
|
175
|
-
finish, rerun Step 1 from `v3-staging` with `
|
|
193
|
+
finish, rerun V3 Release - Step 1 from `v3-staging` with `dryRun=false` and
|
|
176
194
|
`resumeKitReleaseTag` set to the exact Step 1 tag. Recovery validates that
|
|
177
195
|
immutable tag and resumes kits without republishing core.
|
|
178
|
-
2. **
|
|
179
|
-
(`staging-step-2.yml
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
enter the exact Git tag created by the
|
|
183
|
-
`v2.80.0` or `v3.0.1`). Choose
|
|
196
|
+
2. **Step 2: Publish SDK Release to Release Order Branch** (optional): run
|
|
197
|
+
**Staging Release - Step 2** (`staging-step-2.yml`) from `master` for v2, or
|
|
198
|
+
**V3 Release - Step 2** (`v3-release-step-2.yml`) from `main` for v3. Every
|
|
199
|
+
run, dry runs included, rejects the other version's tag and a dispatch from
|
|
200
|
+
any other branch. For `releaseTag`, enter the exact Git tag created by the
|
|
201
|
+
successful Step 1 run (for example, `v2.80.0` or `v3.0.1`). Choose
|
|
184
202
|
`release-order-a`, `-b`, or `-c` as `releaseOrderBranch`. For v3, that
|
|
185
203
|
logical choice maps to the corresponding `v3-release-order-*` branch.
|
|
186
204
|
`dryRun=true` validates the exact candidate and fast-forward without
|
|
187
205
|
pushing; `dryRun=false` promotes it.
|
|
188
|
-
3. **
|
|
189
|
-
(`staging-step-3.yml`)
|
|
190
|
-
|
|
206
|
+
3. **Step 3: Release to CDN and Synchronize Branches**: run
|
|
207
|
+
**Staging Release - Step 3** (`staging-step-3.yml`) from `master` for v2, or
|
|
208
|
+
**V3 Release - Step 3** (`v3-release-step-3.yml`) from `main` for v3, with
|
|
209
|
+
the same rule as Step 2. For `releaseTag`, enter the same exact Git
|
|
191
210
|
tag created by the successful Step 1 run. The workflow verifies that the tag
|
|
192
|
-
matches `package.json`, resolves to the current
|
|
211
|
+
matches `package.json`, resolves to the version's current staging head, and can
|
|
193
212
|
fast-forward every destination. It then uses one atomic push to synchronize
|
|
194
|
-
the
|
|
213
|
+
the version's development branch, trunk (`master` or `main`), and all three
|
|
195
214
|
release-order branches; either every ref updates or none does. `dryRun=true`
|
|
196
215
|
performs all validation without pushing. `dryRun=false` performs the atomic
|
|
197
216
|
synchronization and releases the candidate to those destinations.
|
|
@@ -202,8 +221,8 @@ release-order branch; finally run Step 3 with `dryRun=true`, then
|
|
|
202
221
|
`dryRun=false`.
|
|
203
222
|
|
|
204
223
|
Shadow v3 candidate packaging: when the `V3_PACKAGE_CANDIDATE` repository
|
|
205
|
-
variable is `true`, a real
|
|
206
|
-
|
|
224
|
+
variable is `true`, a real V3 Step 1 run also runs **Package V3 candidate
|
|
225
|
+
(shadow)** after the release. It packages the release tag's committed
|
|
207
226
|
bundles into a `v3-candidate-<run id>-<run attempt>` artifact, kept for 7 days.
|
|
208
227
|
It never runs for v2 or dry runs, has read-only access, and its failure does
|
|
209
228
|
not fail the Step 1 run. It does keep the Step 1 run open until it finishes,
|
|
@@ -219,8 +238,11 @@ A real v3 Step 1 run can publish core and create the GitHub Release before all
|
|
|
219
238
|
2. Copy the exact release tag from the failed Step 1 run.
|
|
220
239
|
3. Use the failed job and its npm kit publish summary to identify any
|
|
221
240
|
missing or rejected kits. Correct their npm or trusted-publisher configuration.
|
|
222
|
-
4. Dispatch **
|
|
223
|
-
|
|
241
|
+
4. Dispatch **V3 Release - Step 1** from `v3-staging` with `dryRun=false`
|
|
242
|
+
and `resumeKitReleaseTag` set to the failed run's exact tag. If `main` has
|
|
243
|
+
no `v3-release-step-1.yml` yet (the first V3 release after the split),
|
|
244
|
+
dispatch **Staging Release - Step 1** from `v3-staging` with `track=v3`
|
|
245
|
+
and the same two inputs instead.
|
|
224
246
|
5. Wait for recovery to verify core and all 33 kits at that version on `next`.
|
|
225
247
|
Existing byte-identical packages are skipped and only missing kits publish.
|
|
226
248
|
6. Continue to Step 2 or Step 3 only after the recovery run is green.
|
|
@@ -243,14 +265,23 @@ If core's `next` tag changes without a corresponding Step 1 Git tag, do not use
|
|
|
243
265
|
the bootstrap exception or guess a recovery tag. Stop releases and reconcile
|
|
244
266
|
the unexpected npm and Git state before continuing.
|
|
245
267
|
|
|
246
|
-
Each
|
|
247
|
-
and `main` for v3.
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
268
|
+
Each version's trunk owns its own copy of its release workflows: `master` for
|
|
269
|
+
v2 and `main` for v3. A change to one version's release steps does not need a
|
|
270
|
+
twin on the other trunk. Steps 2 and 3 run from the dispatching trunk, and the
|
|
271
|
+
rule above keeps each version on its own trunk's copy. GitHub executes Step 1
|
|
272
|
+
from the branch selected in the **Use workflow from** dropdown, so every
|
|
273
|
+
`dryRun=false` Step 1 run rejects the release unless its workflow on the
|
|
274
|
+
staging branch is identical to its trunk's copy: `staging-step-1.yml` on
|
|
275
|
+
`staging` to `master`'s, and `v3-release-step-1.yml` on `v3-staging` to
|
|
276
|
+
`main`'s. During the switch to the V3 files, a `track=v3` run of
|
|
277
|
+
`staging-step-1.yml` from `v3-staging` must match `main`'s copy instead.
|
|
278
|
+
|
|
279
|
+
npm trusted publishing names the workflow file that publishes each package:
|
|
280
|
+
`staging-step-1.yml` publishes v2 of `@mparticle/web-sdk`, and
|
|
281
|
+
`v3-release-step-1.yml` publishes v3 of `@mparticle/web-sdk` and every kit in
|
|
282
|
+
`kits/publish-matrix.json`. Until a V3 release has run on
|
|
283
|
+
`v3-release-step-1.yml`, each of those packages keeps `staging-step-1.yml` as a
|
|
284
|
+
trusted publisher too, so the first V3 release after the split can publish.
|
|
254
285
|
|
|
255
286
|
## Support
|
|
256
287
|
|