@zencemarketing/spin-scratch-sdk 0.1.0-alpha.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/LICENSE +21 -0
- package/README.md +716 -0
- package/dist/react.cjs.js +3588 -0
- package/dist/react.cjs.js.map +1 -0
- package/dist/react.d.ts +91 -0
- package/dist/react.esm.mjs +3579 -0
- package/dist/react.esm.mjs.map +1 -0
- package/dist/spin-wheel-sdk.cjs.js +3584 -0
- package/dist/spin-wheel-sdk.cjs.js.map +1 -0
- package/dist/spin-wheel-sdk.d.ts +513 -0
- package/dist/spin-wheel-sdk.esm.mjs +3577 -0
- package/dist/spin-wheel-sdk.esm.mjs.map +1 -0
- package/dist/spin-wheel-sdk.umd.js +3685 -0
- package/dist/spin-wheel-sdk.umd.js.map +1 -0
- package/dist/spin-wheel-sdk.umd.min.js +2 -0
- package/dist/spin-wheel-sdk.umd.min.js.map +1 -0
- package/package.json +83 -0
package/dist/react.d.ts
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SpinWheel SDK v0.1.0-alpha.1
|
|
3
|
+
* React subpath declarations
|
|
4
|
+
*
|
|
5
|
+
* Import as:
|
|
6
|
+
* import { SpinWheelReact, ScratchCardReact } from '@zencemarketing/spin-scratch-sdk/react';
|
|
7
|
+
*
|
|
8
|
+
* This entry also re-exports all vanilla APIs and types, so you can do:
|
|
9
|
+
* import {
|
|
10
|
+
* SpinWheelReact,
|
|
11
|
+
* ScratchCardReact,
|
|
12
|
+
* type SpinWheelReactProps,
|
|
13
|
+
* type ScratchCardReactProps,
|
|
14
|
+
* type SegmentConfig,
|
|
15
|
+
* type ScratchPrize,
|
|
16
|
+
* } from '@zencemarketing/spin-scratch-sdk/react';
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
// Re-export every vanilla API + type from the main entry
|
|
20
|
+
export {
|
|
21
|
+
// Classes / namespaces
|
|
22
|
+
SpinWheel,
|
|
23
|
+
SpinWheelInstance,
|
|
24
|
+
ScratchCard,
|
|
25
|
+
ScratchCardInstance,
|
|
26
|
+
|
|
27
|
+
// Factory functions
|
|
28
|
+
createSpinWheelReact,
|
|
29
|
+
createScratchCardReact,
|
|
30
|
+
|
|
31
|
+
// Option / Config types
|
|
32
|
+
type SegmentConfig,
|
|
33
|
+
type SpinWheelTheme,
|
|
34
|
+
type ThemeConfig,
|
|
35
|
+
type SpinWheelOptions,
|
|
36
|
+
type SpinWheelInitOptions,
|
|
37
|
+
type ScratchPrize,
|
|
38
|
+
type ScratchCardTheme,
|
|
39
|
+
type ScratchCardOptions,
|
|
40
|
+
|
|
41
|
+
// React prop / handle types
|
|
42
|
+
type SpinWheelReactProps,
|
|
43
|
+
type SpinWheelReactHandle,
|
|
44
|
+
type ScratchCardReactProps,
|
|
45
|
+
type ScratchCardReactHandle,
|
|
46
|
+
} from './spin-wheel-sdk';
|
|
47
|
+
|
|
48
|
+
// ── React components (pre-wired with your app's React) ────────────
|
|
49
|
+
|
|
50
|
+
import type { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
51
|
+
import type { SpinWheelReactProps, SpinWheelReactHandle, ScratchCardReactProps, ScratchCardReactHandle } from './spin-wheel-sdk';
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Pre-wired SpinWheel React component.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```tsx
|
|
58
|
+
* import { SpinWheelReact, type SpinWheelReactHandle } from '@zencemarketing/spin-scratch-sdk/react';
|
|
59
|
+
*
|
|
60
|
+
* const ref = useRef<SpinWheelReactHandle>(null);
|
|
61
|
+
*
|
|
62
|
+
* <SpinWheelReact
|
|
63
|
+
* ref={ref}
|
|
64
|
+
* segments={[{ label: 'Prize', color: '#55efc4' }]}
|
|
65
|
+
* onSpinEnd={(prize, idx) => console.log(prize)}
|
|
66
|
+
* />
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
export declare const SpinWheelReact: ForwardRefExoticComponent<
|
|
70
|
+
SpinWheelReactProps & RefAttributes<SpinWheelReactHandle>
|
|
71
|
+
>;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Pre-wired ScratchCard React component.
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```tsx
|
|
78
|
+
* import { ScratchCardReact, type ScratchCardReactHandle } from '@zencemarketing/spin-scratch-sdk/react';
|
|
79
|
+
*
|
|
80
|
+
* const ref = useRef<ScratchCardReactHandle>(null);
|
|
81
|
+
*
|
|
82
|
+
* <ScratchCardReact
|
|
83
|
+
* ref={ref}
|
|
84
|
+
* prize={{ name: 'Gift Voucher', icon: '🎁' }}
|
|
85
|
+
* onReveal={(prize) => console.log(prize)}
|
|
86
|
+
* />
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
export declare const ScratchCardReact: ForwardRefExoticComponent<
|
|
90
|
+
ScratchCardReactProps & RefAttributes<ScratchCardReactHandle>
|
|
91
|
+
>;
|