From c5907ef345cb1986364a62a2ee6f4b34cb96ccff Mon Sep 17 00:00:00 2001 From: Justin Fiedler Date: Tue, 26 Sep 2023 17:42:25 -0700 Subject: [PATCH] fix: Amp 85112 set user id is not queued in snippet v1 (#592) * fix: proxy non-promised methods in browser-snippet (#591) * fix: proxy non-promised methods in browser-snippet * fix: removed extra semicolon in browser-snippet template * fix: revert manual generated file changes * chore: undo manual changes to generated snippet * fix: update README.md for lerna to pickup package changes --- packages/analytics-browser/README.md | 2 +- scripts/templates/browser-snippet.template.js | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/analytics-browser/README.md b/packages/analytics-browser/README.md index 30aa003fc..122abfd76 100644 --- a/packages/analytics-browser/README.md +++ b/packages/analytics-browser/README.md @@ -11,7 +11,7 @@ Official Amplitude SDK for Web # Doc -See our [Typescript Analytics Browser SDK](https://amplitude.github.io/Amplitude-TypeScript/modules/_amplitude_analytics_browser.html) Reference for a list and description of all available SDK methods. +See our [Analytics SDK for Browser](https://amplitude.github.io/Amplitude-TypeScript/modules/_amplitude_analytics_browser.html) Reference for a list and description of all available SDK methods. # Installation and Quick Start diff --git a/scripts/templates/browser-snippet.template.js b/scripts/templates/browser-snippet.template.js index cb6211e32..237a81d98 100644 --- a/scripts/templates/browser-snippet.template.js +++ b/scripts/templates/browser-snippet.template.js @@ -96,12 +96,19 @@ const snippet = (name, integrity, version, globalVar) => ` }); }; } + function proxyInstance(instance, fn, args) { + instance._q.push({ + name: fn, + args: Array.prototype.slice.call(args, 0), + }); + } function proxyMain(instance, fn, isPromise) { var args = arguments; instance[fn] = function () { if (isPromise) return { promise: new Promise(getPromiseResult(instance, fn, Array.prototype.slice.call(arguments))), }; + proxyInstance(instance, fn, Array.prototype.slice.call(arguments)); }; } function setUpProxy(instance) {