@cardsjd/device 0.1.9 → 0.1.11

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.
Files changed (2) hide show
  1. package/lib/device.js +10 -4
  2. package/package.json +1 -1
package/lib/device.js CHANGED
@@ -74,10 +74,10 @@ export default class Device {
74
74
 
75
75
  //Get override information
76
76
  const searchParams = new URLSearchParams(window.location.search);
77
-
77
+
78
78
  //discord has a platform in its url and messes up detection //detect first
79
79
  if (window.location.host.includes('discord') || (window.location.href.includes("localhost") && window.location.href.includes("frame_id"))) {
80
- return 'Discord';
80
+ return 'discord';
81
81
  }
82
82
 
83
83
  //override
@@ -91,7 +91,13 @@ export default class Device {
91
91
  }
92
92
 
93
93
  if (typeof globalThis.CrazyGames !== 'undefined') {
94
- return 'CrazyGames';
94
+ return 'crazygames';
95
+ }
96
+ if (globalThis.location?.ancestorOrigins?.[0]?.includes("crazygames")) {
97
+ return 'crazygames';
98
+ }
99
+ if (globalThis.location?.ancestorOrigins?.[0]?.includes("discord")) {
100
+ return 'discord';
95
101
  }
96
102
 
97
103
  //native Cordova
@@ -137,6 +143,6 @@ export default class Device {
137
143
  return 'web';
138
144
  }
139
145
 
140
- /** @typedef {'FBInstant' | 'windowsPhone' | 'windows' | 'amazon' | 'android' | 'ios' | 'steam' | 'windowsPWA' | 'web' | 'CrazyGames'} PlatformType */
146
+ /** @typedef {'FBInstant' | 'windowsPhone' | 'windows' | 'amazon' | 'android' | 'ios' | 'steam' | 'windowsPWA' | 'web' | 'crazygames'} PlatformType */
141
147
 
142
148
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cardsjd/device",
3
3
  "private": false,
4
- "version": "0.1.9",
4
+ "version": "0.1.11",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "files": [