@wise/art 2.6.0-beta.4 → 2.6.0-beta.5

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 (124) hide show
  1. package/dist/CheckMark-08efb7f5.js +37 -0
  2. package/dist/CheckMark-08efb7f5.js.map +1 -0
  3. package/dist/CheckMark-31f05a78.js +39 -0
  4. package/dist/CheckMark-31f05a78.js.map +1 -0
  5. package/dist/Confetti-8a609ba7.js +36 -0
  6. package/dist/Confetti-8a609ba7.js.map +1 -0
  7. package/dist/Confetti-f2b8c66c.js +34 -0
  8. package/dist/Confetti-f2b8c66c.js.map +1 -0
  9. package/dist/Flower-7efb2e8a.js +29 -0
  10. package/dist/Flower-7efb2e8a.js.map +1 -0
  11. package/dist/Flower-e27b9aa5.js +27 -0
  12. package/dist/Flower-e27b9aa5.js.map +1 -0
  13. package/dist/Globe-74ea3473.js +43 -0
  14. package/dist/Globe-74ea3473.js.map +1 -0
  15. package/dist/Globe-8ffb1711.js +45 -0
  16. package/dist/Globe-8ffb1711.js.map +1 -0
  17. package/dist/Graph-031f065a.js +33 -0
  18. package/dist/Graph-031f065a.js.map +1 -0
  19. package/dist/Graph-8df77bac.js +31 -0
  20. package/dist/Graph-8df77bac.js.map +1 -0
  21. package/dist/Illustration.css +19 -0
  22. package/dist/Jars-2a5848e6.js +50 -0
  23. package/dist/Jars-2a5848e6.js.map +1 -0
  24. package/dist/Jars-e516b2e0.js +52 -0
  25. package/dist/Jars-e516b2e0.js.map +1 -0
  26. package/dist/Lock-2aa09874.js +43 -0
  27. package/dist/Lock-2aa09874.js.map +1 -0
  28. package/dist/Lock-3aedc17b.js +41 -0
  29. package/dist/Lock-3aedc17b.js.map +1 -0
  30. package/dist/MagnifyingGlass-a1407044.js +30 -0
  31. package/dist/MagnifyingGlass-a1407044.js.map +1 -0
  32. package/dist/MagnifyingGlass-c2cb3012.js +32 -0
  33. package/dist/MagnifyingGlass-c2cb3012.js.map +1 -0
  34. package/dist/Marble-b62c2381.js +44 -0
  35. package/dist/Marble-b62c2381.js.map +1 -0
  36. package/dist/Marble-c9af6485.js +42 -0
  37. package/dist/Marble-c9af6485.js.map +1 -0
  38. package/dist/MarbleCard-793354a5.js +45 -0
  39. package/dist/MarbleCard-793354a5.js.map +1 -0
  40. package/dist/MarbleCard-89edbd62.js +47 -0
  41. package/dist/MarbleCard-89edbd62.js.map +1 -0
  42. package/dist/MultiCurrency-705852bd.js +63 -0
  43. package/dist/MultiCurrency-705852bd.js.map +1 -0
  44. package/dist/MultiCurrency-a5b192dd.js +61 -0
  45. package/dist/MultiCurrency-a5b192dd.js.map +1 -0
  46. package/dist/Plane-4da712da.js +37 -0
  47. package/dist/Plane-4da712da.js.map +1 -0
  48. package/dist/Plane-ce2952f8.js +39 -0
  49. package/dist/Plane-ce2952f8.js.map +1 -0
  50. package/dist/Scene-05003c4d.js +50 -0
  51. package/dist/Scene-05003c4d.js.map +1 -0
  52. package/dist/Scene-e93b55fd.js +48 -0
  53. package/dist/Scene-e93b55fd.js.map +1 -0
  54. package/dist/common.d.ts +5 -0
  55. package/dist/common.d.ts.map +1 -1
  56. package/dist/flags/Flag.d.ts +2 -1
  57. package/dist/flags/Flag.d.ts.map +1 -1
  58. package/dist/flags/index.d.ts +1 -1
  59. package/dist/flags/index.d.ts.map +1 -1
  60. package/dist/illustrations3d/Illustration3d.d.ts +11 -0
  61. package/dist/illustrations3d/Illustration3d.d.ts.map +1 -0
  62. package/dist/illustrations3d/Scene.d.ts +9 -0
  63. package/dist/illustrations3d/Scene.d.ts.map +1 -0
  64. package/dist/illustrations3d/index.d.ts +5 -0
  65. package/dist/illustrations3d/index.d.ts.map +1 -0
  66. package/dist/illustrations3d/models/CheckMark.d.ts +4 -0
  67. package/dist/illustrations3d/models/CheckMark.d.ts.map +1 -0
  68. package/dist/illustrations3d/models/Confetti.d.ts +4 -0
  69. package/dist/illustrations3d/models/Confetti.d.ts.map +1 -0
  70. package/dist/illustrations3d/models/Flower.d.ts +4 -0
  71. package/dist/illustrations3d/models/Flower.d.ts.map +1 -0
  72. package/dist/illustrations3d/models/Globe.d.ts +4 -0
  73. package/dist/illustrations3d/models/Globe.d.ts.map +1 -0
  74. package/dist/illustrations3d/models/Graph.d.ts +4 -0
  75. package/dist/illustrations3d/models/Graph.d.ts.map +1 -0
  76. package/dist/illustrations3d/models/Jars.d.ts +4 -0
  77. package/dist/illustrations3d/models/Jars.d.ts.map +1 -0
  78. package/dist/illustrations3d/models/Lock.d.ts +4 -0
  79. package/dist/illustrations3d/models/Lock.d.ts.map +1 -0
  80. package/dist/illustrations3d/models/MagnifyingGlass.d.ts +4 -0
  81. package/dist/illustrations3d/models/MagnifyingGlass.d.ts.map +1 -0
  82. package/dist/illustrations3d/models/Marble.d.ts +4 -0
  83. package/dist/illustrations3d/models/Marble.d.ts.map +1 -0
  84. package/dist/illustrations3d/models/MarbleCard.d.ts +4 -0
  85. package/dist/illustrations3d/models/MarbleCard.d.ts.map +1 -0
  86. package/dist/illustrations3d/models/MultiCurrency.d.ts +4 -0
  87. package/dist/illustrations3d/models/MultiCurrency.d.ts.map +1 -0
  88. package/dist/illustrations3d/models/Plane.d.ts +4 -0
  89. package/dist/illustrations3d/models/Plane.d.ts.map +1 -0
  90. package/dist/illustrations3d/utils.d.ts +9 -0
  91. package/dist/illustrations3d/utils.d.ts.map +1 -0
  92. package/dist/index-3bca1c43.js +325 -0
  93. package/dist/index-3bca1c43.js.map +1 -0
  94. package/dist/index-897e0762.js +332 -0
  95. package/dist/index-897e0762.js.map +1 -0
  96. package/dist/index.d.ts +4 -1
  97. package/dist/index.d.ts.map +1 -1
  98. package/dist/index.js +15 -155
  99. package/dist/index.js.map +1 -1
  100. package/dist/index.mjs +4 -158
  101. package/dist/index.mjs.map +1 -1
  102. package/package.json +6 -2
  103. package/src/common.ts +6 -0
  104. package/src/flags/Flag.tsx +3 -1
  105. package/src/flags/index.ts +1 -1
  106. package/src/illustrations/Illustration.css +19 -0
  107. package/src/illustrations3d/Illustration3d.stories.tsx +89 -0
  108. package/src/illustrations3d/Illustration3d.tsx +134 -0
  109. package/src/illustrations3d/Scene.tsx +54 -0
  110. package/src/illustrations3d/index.ts +6 -0
  111. package/src/illustrations3d/models/CheckMark.tsx +30 -0
  112. package/src/illustrations3d/models/Confetti.tsx +29 -0
  113. package/src/illustrations3d/models/Flower.tsx +24 -0
  114. package/src/illustrations3d/models/Globe.tsx +41 -0
  115. package/src/illustrations3d/models/Graph.tsx +26 -0
  116. package/src/illustrations3d/models/Jars.tsx +46 -0
  117. package/src/illustrations3d/models/Lock.tsx +38 -0
  118. package/src/illustrations3d/models/MagnifyingGlass.tsx +30 -0
  119. package/src/illustrations3d/models/Marble.tsx +56 -0
  120. package/src/illustrations3d/models/MarbleCard.tsx +61 -0
  121. package/src/illustrations3d/models/MultiCurrency.tsx +57 -0
  122. package/src/illustrations3d/models/Plane.tsx +32 -0
  123. package/src/illustrations3d/utils.ts +68 -0
  124. package/src/index.ts +6 -1
@@ -0,0 +1,26 @@
1
+ import { useGLTF } from '@react-three/drei';
2
+ import { useFrame, useLoader } from '@react-three/fiber';
3
+ import { ObjectLoader } from 'three';
4
+
5
+ import { defineSrc } from '../utils';
6
+
7
+ const Graph = () => {
8
+ const model = useGLTF(defineSrc(`graph.gltf`));
9
+
10
+ const lights = useLoader(ObjectLoader, defineSrc('graph-light.json'));
11
+
12
+ useFrame(() => {
13
+ const { offset } = model.materials['Standard '].map;
14
+ offset.x += -0.0015;
15
+ offset.y += 0.0015;
16
+ });
17
+
18
+ return (
19
+ <>
20
+ <primitive scale={1.3} position={[0, -10, 0]} object={model.scene} />
21
+ <primitive object={lights} />
22
+ </>
23
+ );
24
+ };
25
+
26
+ export default Graph;
@@ -0,0 +1,46 @@
1
+ import { useGLTF, useAnimations } from '@react-three/drei';
2
+ import { useFrame, useLoader } from '@react-three/fiber';
3
+ import { TextureLoader, ObjectLoader } from 'three';
4
+
5
+ import { defineSrc } from '../utils';
6
+
7
+ const Jars = () => {
8
+ const ref = useRef();
9
+ const model = useGLTF(defineSrc('jars.gltf'));
10
+ const lights = useLoader(ObjectLoader, defineSrc('jars-light.json'));
11
+ const wiseLogo = useLoader(TextureLoader, defineSrc('wise-flag-map-bump.jpg'));
12
+ const jars = [];
13
+
14
+ model.scene.traverse((child) => {
15
+ if (child.name.startsWith('Coin_')) {
16
+ child.material.bumpMap = wiseLogo;
17
+
18
+ child.material.bumpMap.flipY = false;
19
+ child.castShadow = false;
20
+ child.receiveShadow = false;
21
+ }
22
+ if (child.name.startsWith('Jar_')) {
23
+ jars.push(child);
24
+ }
25
+ });
26
+
27
+ const { mixer, clips } = useAnimations(model.animations, ref);
28
+
29
+ useFrame(() => {
30
+ mixer.clipAction(clips[0]).play();
31
+
32
+ jars.forEach((jar) => {
33
+ jar.material.map.offset.x += 0.001;
34
+ jar.material.map.offset.y += 0.0;
35
+ });
36
+ });
37
+
38
+ return (
39
+ <>
40
+ <primitive ref={ref} scale={1.3} position={[0, -10, 0]} object={model.scene} />
41
+ <primitive object={lights} />
42
+ </>
43
+ );
44
+ };
45
+
46
+ export default Jars;
@@ -0,0 +1,38 @@
1
+ import { useGLTF, useAnimations } from '@react-three/drei';
2
+ import { useFrame, useLoader } from '@react-three/fiber';
3
+ import { useRef } from 'react';
4
+ import { LoopOnce, ObjectLoader } from 'three';
5
+
6
+ import { defineSrc } from '../utils';
7
+
8
+ const Lock = () => {
9
+ const ref = useRef();
10
+ const model = useGLTF(defineSrc('lock.gltf'));
11
+
12
+ const lights = useLoader(ObjectLoader, defineSrc('lock-light.json'));
13
+
14
+ model.scene.traverse((node) => {
15
+ if (node.isMesh) {
16
+ node.castShadow = true;
17
+ node.receiveShadow = true;
18
+ }
19
+ });
20
+
21
+ const { clips, mixer } = useAnimations(model.animations, ref);
22
+ let frame = 0;
23
+ useFrame(() => {
24
+ mixer.clipAction(clips[0]).play().setLoop(LoopOnce, 1);
25
+ model.scene.position.y = Math.sin(frame++ * 0.04) * 0.2;
26
+
27
+ model.materials.Standard.map.offset.x += -0.001;
28
+ });
29
+
30
+ return (
31
+ <>
32
+ <primitive ref={ref} scale={1.4} object={model.scene} />
33
+ <primitive object={lights} />
34
+ </>
35
+ );
36
+ };
37
+
38
+ export default Lock;
@@ -0,0 +1,30 @@
1
+ import { useGLTF } from '@react-three/drei';
2
+ import { useFrame, useLoader } from '@react-three/fiber';
3
+ import { ObjectLoader } from 'three';
4
+
5
+ import { defineSrc } from '../utils';
6
+
7
+ const MagnifyingGlass = () => {
8
+ const model = useGLTF(defineSrc(`magnifying-glass.gltf`));
9
+
10
+ const lights = useLoader(ObjectLoader, defineSrc('magnifying-glass-light.json'));
11
+
12
+ const lens = model.scene.getObjectByName('Optimised_lens');
13
+
14
+ useFrame(() => {
15
+ lens.material.transparent = true;
16
+
17
+ lens.material.opacity = 0.8;
18
+
19
+ model.materials['Tapestry WebGL'].map.offset.x += -0.0006;
20
+ });
21
+
22
+ return (
23
+ <>
24
+ <primitive scale={1.5} position={[0, -12, 0]} object={model.scene} />
25
+ <primitive object={lights} />
26
+ </>
27
+ );
28
+ };
29
+
30
+ export default MagnifyingGlass;
@@ -0,0 +1,56 @@
1
+ import { useGLTF } from '@react-three/drei';
2
+ import { useFrame, useLoader } from '@react-three/fiber';
3
+ import { ObjectLoader } from 'three';
4
+
5
+ import { defineSrc } from '../utils';
6
+
7
+ const Marble = () => {
8
+ const model = useGLTF(defineSrc('marble.gltf'));
9
+
10
+ const lights = useLoader(ObjectLoader, defineSrc('marble-light.json'));
11
+
12
+ const sphere = model.scene.getObjectByName('Sphere1');
13
+
14
+ sphere.material.depthTest = true;
15
+
16
+ const stripeBottom = model.scene.getObjectByName('Strip_Center_Big_(4th_-_Bottom_Layer)');
17
+
18
+ stripeBottom.material.depthTest = false;
19
+
20
+ stripeBottom.renderOrder = 1;
21
+
22
+ const stripeLeft = model.scene.getObjectByName('Strip_Left_(3rd)');
23
+
24
+ stripeLeft.material.depthTest = false;
25
+
26
+ stripeLeft.renderOrder = 2;
27
+
28
+ const stripeRight = model.scene.getObjectByName('Strip_Left_(3rd)');
29
+
30
+ stripeRight.material.depthTest = false;
31
+
32
+ stripeRight.renderOrder = 3;
33
+
34
+ const stripeTop = model.scene.getObjectByName('Strip_Center_(1st_-_Top_Layer)');
35
+
36
+ stripeTop.material.depthTest = false;
37
+
38
+ stripeTop.renderOrder = 4;
39
+
40
+ const animatedMaps = [sphere, stripeTop, stripeBottom, stripeLeft, stripeRight].map(
41
+ (object) => object.material.map,
42
+ );
43
+
44
+ useFrame(() => {
45
+ animatedMaps.forEach((map) => (map.offset.y += -0.0015));
46
+ });
47
+
48
+ return (
49
+ <>
50
+ <primitive scale={1.4} position={[0, -11, 0]} object={model.scene} />
51
+ <primitive object={lights} />
52
+ </>
53
+ );
54
+ };
55
+
56
+ export default Marble;
@@ -0,0 +1,61 @@
1
+ import { useGLTF } from '@react-three/drei';
2
+ import { useFrame, useLoader } from '@react-three/fiber';
3
+ import { ObjectLoader } from 'three';
4
+
5
+ import { defineSrc } from '../utils';
6
+
7
+ const MarbleCard = () => {
8
+ const model = useGLTF(defineSrc('marble-card.gltf'));
9
+
10
+ const lights = useLoader(ObjectLoader, defineSrc('marble-card-light.json'));
11
+ const sphere = model.scene.getObjectByName('Sphere1');
12
+
13
+ sphere.material.depthTest = true;
14
+
15
+ const stripeBottom = model.scene.getObjectByName('Strip_Center_Big_(4th_-_Bottom_Layer)');
16
+
17
+ stripeBottom.material.depthTest = false;
18
+
19
+ stripeBottom.renderOrder = 1;
20
+
21
+ const stripeLeft = model.scene.getObjectByName('Strip_Left_(3rd)');
22
+
23
+ stripeLeft.material.depthTest = false;
24
+
25
+ stripeLeft.renderOrder = 2;
26
+
27
+ const stripeRight = model.scene.getObjectByName('Strip_Right_(2nd)');
28
+
29
+ stripeRight.material.depthTest = false;
30
+
31
+ stripeRight.renderOrder = 3;
32
+
33
+ const stripeTop = model.scene.getObjectByName('Strip_Center_(1st_-_Top_Layer)');
34
+
35
+ stripeTop.material.depthTest = false;
36
+
37
+ stripeTop.renderOrder = 4;
38
+
39
+ const card = model.scene.getObjectByName('Plane');
40
+
41
+ card.material.depthTest = false;
42
+
43
+ card.material.metalness = 0;
44
+
45
+ const animatedMaps = [sphere, stripeTop, stripeBottom, stripeLeft, stripeRight].map(
46
+ (object) => object.material.map,
47
+ );
48
+
49
+ useFrame(() => {
50
+ animatedMaps.forEach((map) => (map.offset.y += -0.0015));
51
+ });
52
+
53
+ return (
54
+ <>
55
+ <primitive scale={1.4} position={[0, -10, 0]} object={model.scene} />
56
+ <primitive object={lights} />
57
+ </>
58
+ );
59
+ };
60
+
61
+ export default MarbleCard;
@@ -0,0 +1,57 @@
1
+ import { useGLTF, useAnimations } from '@react-three/drei';
2
+ import { useFrame, useLoader } from '@react-three/fiber';
3
+ import { ObjectLoader, TextureLoader, Color } from 'three';
4
+
5
+ import { defineSrc } from '../utils';
6
+
7
+ const MultiCurrency = () => {
8
+ const ref = useRef();
9
+ const model = useGLTF(defineSrc(`multi-currency.gltf`));
10
+
11
+ const lights = useLoader(ObjectLoader, defineSrc('multi-currency-light.json'));
12
+ const wiseLogo = useLoader(TextureLoader, defineSrc('wise-flag-map-bump.jpg'));
13
+
14
+ const animatedMaps = [];
15
+
16
+ model.scene.traverse((child) => {
17
+ if (child.name.includes('Note')) {
18
+ child.castShadow = true;
19
+ child.receiveShadow = true;
20
+ }
21
+
22
+ if (child.name.startsWith('Coin_') && child.isMesh) {
23
+ const { material } = child;
24
+ material.bumpMap = wiseLogo;
25
+ material.bumpMap.flipY = false;
26
+ material.bumpScale = 1;
27
+ material.color = new Color(0.49, 0.49, 0.49);
28
+ child.castShadow = false;
29
+ child.receiveShadow = false;
30
+ }
31
+
32
+ if (child.name.startsWith('NoteBase_') && child.isMesh) {
33
+ animatedMaps.push(child.material.map);
34
+ }
35
+
36
+ if (child.name.includes('Wise') && child.isMesh) {
37
+ animatedMaps.push(child.material.map);
38
+ }
39
+ });
40
+
41
+ const { mixer, clips } = useAnimations(model.animations, ref);
42
+ useFrame(() => {
43
+ animatedMaps.forEach((animatedMap) => {
44
+ animatedMap.offset.x += 0.001;
45
+ });
46
+ mixer.clipAction(clips[0]).play();
47
+ });
48
+
49
+ return (
50
+ <>
51
+ <primitive ref={ref} position={[-0.5, -10, 0]} scale={1.3} object={model.scene} />
52
+ <primitive object={lights} />
53
+ </>
54
+ );
55
+ };
56
+
57
+ export default MultiCurrency;
@@ -0,0 +1,32 @@
1
+ import { useGLTF, useAnimations } from '@react-three/drei';
2
+ import { useFrame, useLoader } from '@react-three/fiber';
3
+ import { ObjectLoader } from 'three';
4
+
5
+ import { defineSrc } from '../utils';
6
+
7
+ const Plane = () => {
8
+ const ref = useRef();
9
+ const model = useGLTF(defineSrc('plane.gltf'));
10
+
11
+ const lights = useLoader(ObjectLoader, defineSrc('plane-light.json'));
12
+ const plane = model.scene.getObjectByName('Plane_6_update');
13
+
14
+ const { mixer, clips } = useAnimations(model.animations, ref);
15
+ useFrame(() => {
16
+ model.materials['Tapestry WebGL'].map.offset.y += 0.018;
17
+
18
+ plane.position.x = 0.45;
19
+
20
+ plane.position.y = 7.5;
21
+ mixer.clipAction(clips[0]).play();
22
+ });
23
+
24
+ return (
25
+ <>
26
+ <primitive ref={ref} scale={1.3} position={[0, -7, 0]} object={model.scene} />
27
+ <primitive object={lights} />
28
+ </>
29
+ );
30
+ };
31
+
32
+ export default Plane;
@@ -0,0 +1,68 @@
1
+ import { useState, useEffect } from 'react';
2
+
3
+ import type { IllustrationNames } from '../illustrations/metadata';
4
+
5
+ export function useBattery() {
6
+ const [batteryData, setBatteryData] = useState<{ level: number }>({ level: 1.0 });
7
+
8
+ useEffect(() => {
9
+ const getBatteryData = async () => {
10
+ // @ts-expect-error .getBattery exists in Navigator interface
11
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call
12
+ const battery = await navigator.getBattery();
13
+
14
+ setBatteryData({
15
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
16
+ level: battery?.level,
17
+ });
18
+ };
19
+ // Check if the browser supports the Battery API
20
+ if ('getBattery' in navigator) {
21
+ void getBatteryData();
22
+ }
23
+ }, []);
24
+
25
+ return batteryData;
26
+ }
27
+
28
+ export function isBatteryLow(batteryLevel: number): boolean {
29
+ return batteryLevel < 0.2;
30
+ }
31
+
32
+ export function isConnectionSlow(): boolean {
33
+ // @ts-expect-error .connection prop exists in Navigator interface
34
+ const { connection } = window.navigator;
35
+ if (connection === undefined) {
36
+ return false;
37
+ }
38
+ return (
39
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
40
+ ['slow-2g', '2g'].includes(connection?.effectiveType as string) ||
41
+ // @ts-expect-error Property 'connection' does exist on type 'Navigator'
42
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
43
+ navigator?.connection?.saveData === true
44
+ );
45
+ }
46
+
47
+ export function defineSrc(asset: string): string {
48
+ return `https://wise.com/web-art/assets/illustrations3d/${asset}`;
49
+ }
50
+
51
+ const illustration3dNames = [
52
+ 'lock',
53
+ 'globe',
54
+ 'confetti',
55
+ 'check-mark',
56
+ 'flower',
57
+ 'graph',
58
+ 'jars',
59
+ 'magnifying-glass',
60
+ 'marble',
61
+ 'marble-card',
62
+ 'multi-currency',
63
+ 'plane',
64
+ ];
65
+
66
+ export function is3dIllustrationSupported(asset: IllustrationNames): boolean {
67
+ return illustration3dNames.includes(asset);
68
+ }
package/src/index.ts CHANGED
@@ -1,7 +1,12 @@
1
- export { Flag } from './flags';
1
+ export { default as Flag } from './flags';
2
2
  export { default as Illustration } from './illustrations';
3
+ export { default as Illustration3d } from './illustrations3d';
4
+
3
5
  export { Assets } from './illustrations';
4
6
  export { Sizes } from './common';
5
7
 
6
8
  export type { FlagProps } from './flags';
7
9
  export type { IllustrationNames, IllustrationProps } from './illustrations';
10
+ export type { Illustration3dNames, Illustration3dProps } from './illustrations3d';
11
+
12
+ export { is3dIllustrationSupported } from './illustrations3d';