@amplifyup/sdk 0.1.0 → 0.1.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 +15 -0
- package/dist/AmplifyRenderer.js +11 -1
- package/dist/AmplifyRenderer.js.map +1 -1
- package/dist/AmplifyRenderer.mjs +11 -1
- package/dist/AmplifyRenderer.mjs.map +1 -1
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -1
- package/dist/index.mjs.map +1 -1
- package/dist/react.js +11 -1
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +11 -1
- package/dist/react.mjs.map +1 -1
- package/dist/server.js +11 -1
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +11 -1
- package/dist/server.mjs.map +1 -1
- package/package.json +1 -2
package/dist/react.mjs
CHANGED
|
@@ -176,6 +176,16 @@ var AWSAdapter = class {
|
|
|
176
176
|
// src/storage.ts
|
|
177
177
|
var INSTANCE_ID_KEY = "amplifyup_instance_id";
|
|
178
178
|
var USER_ID_KEY = "amplifyup_user_id";
|
|
179
|
+
function generateGuid() {
|
|
180
|
+
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
181
|
+
return crypto.randomUUID();
|
|
182
|
+
}
|
|
183
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
|
184
|
+
const r = Math.random() * 16 | 0;
|
|
185
|
+
const v = c === "x" ? r : r & 3 | 8;
|
|
186
|
+
return v.toString(16);
|
|
187
|
+
});
|
|
188
|
+
}
|
|
179
189
|
function getInstanceId() {
|
|
180
190
|
if (typeof window === "undefined") {
|
|
181
191
|
return "";
|
|
@@ -184,7 +194,7 @@ function getInstanceId() {
|
|
|
184
194
|
if (stored) {
|
|
185
195
|
return stored;
|
|
186
196
|
}
|
|
187
|
-
const instanceId = `
|
|
197
|
+
const instanceId = `browser_${generateGuid()}`;
|
|
188
198
|
localStorage.setItem(INSTANCE_ID_KEY, instanceId);
|
|
189
199
|
return instanceId;
|
|
190
200
|
}
|