@playbasis-ai/qwikcard-sdk 2.3.4

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 (106) hide show
  1. package/CHANGELOG.md +142 -0
  2. package/LICENSE +21 -0
  3. package/README.md +267 -0
  4. package/SDK_HANDOVER_GUIDE.md +129 -0
  5. package/dist/PlaybasisProvider.d.ts +19 -0
  6. package/dist/PlaybasisProvider.d.ts.map +1 -0
  7. package/dist/PlaybasisProvider.js +24 -0
  8. package/dist/QwikCardApp.d.ts +9 -0
  9. package/dist/QwikCardApp.d.ts.map +1 -0
  10. package/dist/QwikCardApp.js +210 -0
  11. package/dist/api/client.d.ts +66 -0
  12. package/dist/api/client.d.ts.map +1 -0
  13. package/dist/api/client.js +196 -0
  14. package/dist/components/Badge.d.ts +8 -0
  15. package/dist/components/Badge.d.ts.map +1 -0
  16. package/dist/components/Badge.js +34 -0
  17. package/dist/components/BadgeIcon.d.ts +10 -0
  18. package/dist/components/BadgeIcon.d.ts.map +1 -0
  19. package/dist/components/BadgeIcon.js +51 -0
  20. package/dist/components/Button.d.ts +10 -0
  21. package/dist/components/Button.d.ts.map +1 -0
  22. package/dist/components/Button.js +40 -0
  23. package/dist/components/GradientCard.d.ts +9 -0
  24. package/dist/components/GradientCard.d.ts.map +1 -0
  25. package/dist/components/GradientCard.js +28 -0
  26. package/dist/components/PointsBalance.d.ts +8 -0
  27. package/dist/components/PointsBalance.d.ts.map +1 -0
  28. package/dist/components/PointsBalance.js +85 -0
  29. package/dist/components/ProgressBar.d.ts +8 -0
  30. package/dist/components/ProgressBar.d.ts.map +1 -0
  31. package/dist/components/ProgressBar.js +41 -0
  32. package/dist/components/QuestProgress.d.ts +10 -0
  33. package/dist/components/QuestProgress.d.ts.map +1 -0
  34. package/dist/components/QuestProgress.js +94 -0
  35. package/dist/components/RadialGauge.d.ts +8 -0
  36. package/dist/components/RadialGauge.d.ts.map +1 -0
  37. package/dist/components/RadialGauge.js +53 -0
  38. package/dist/components/RewardCard.d.ts +10 -0
  39. package/dist/components/RewardCard.d.ts.map +1 -0
  40. package/dist/components/RewardCard.js +64 -0
  41. package/dist/components/RulesModal.d.ts +7 -0
  42. package/dist/components/RulesModal.d.ts.map +1 -0
  43. package/dist/components/RulesModal.js +106 -0
  44. package/dist/hooks/useBadges.d.ts +12 -0
  45. package/dist/hooks/useBadges.d.ts.map +1 -0
  46. package/dist/hooks/useBadges.js +42 -0
  47. package/dist/hooks/usePoints.d.ts +13 -0
  48. package/dist/hooks/usePoints.d.ts.map +1 -0
  49. package/dist/hooks/usePoints.js +70 -0
  50. package/dist/hooks/useQuests.d.ts +12 -0
  51. package/dist/hooks/useQuests.d.ts.map +1 -0
  52. package/dist/hooks/useQuests.js +41 -0
  53. package/dist/hooks/useQwikApp.d.ts +16 -0
  54. package/dist/hooks/useQwikApp.d.ts.map +1 -0
  55. package/dist/hooks/useQwikApp.js +42 -0
  56. package/dist/hooks/useRewards.d.ts +12 -0
  57. package/dist/hooks/useRewards.d.ts.map +1 -0
  58. package/dist/hooks/useRewards.js +56 -0
  59. package/dist/index.d.ts +27 -0
  60. package/dist/index.d.ts.map +1 -0
  61. package/dist/index.js +29 -0
  62. package/dist/theme/context.d.ts +8 -0
  63. package/dist/theme/context.d.ts.map +1 -0
  64. package/dist/theme/context.js +8 -0
  65. package/dist/theme/tokens.d.ts +35 -0
  66. package/dist/theme/tokens.d.ts.map +1 -0
  67. package/dist/theme/tokens.js +33 -0
  68. package/dist/types/index.d.ts +119 -0
  69. package/dist/types/index.d.ts.map +1 -0
  70. package/dist/types/index.js +4 -0
  71. package/dist/web/widgetAssets.d.ts +4 -0
  72. package/dist/web/widgetAssets.d.ts.map +1 -0
  73. package/dist/web/widgetAssets.js +5 -0
  74. package/dist/web/widgetHtml.d.ts +2 -0
  75. package/dist/web/widgetHtml.d.ts.map +1 -0
  76. package/dist/web/widgetHtml.js +299 -0
  77. package/dist/web/widgetTypes.d.ts +128 -0
  78. package/dist/web/widgetTypes.d.ts.map +1 -0
  79. package/dist/web/widgetTypes.js +1 -0
  80. package/package.json +86 -0
  81. package/src/PlaybasisProvider.tsx +72 -0
  82. package/src/QwikCardApp.tsx +302 -0
  83. package/src/api/client.ts +307 -0
  84. package/src/components/Badge.tsx +51 -0
  85. package/src/components/BadgeIcon.tsx +97 -0
  86. package/src/components/Button.tsx +70 -0
  87. package/src/components/GradientCard.tsx +49 -0
  88. package/src/components/PointsBalance.tsx +122 -0
  89. package/src/components/ProgressBar.tsx +65 -0
  90. package/src/components/QuestProgress.tsx +153 -0
  91. package/src/components/RadialGauge.tsx +101 -0
  92. package/src/components/RewardCard.tsx +123 -0
  93. package/src/components/RulesModal.tsx +171 -0
  94. package/src/hooks/useBadges.ts +59 -0
  95. package/src/hooks/usePoints.ts +91 -0
  96. package/src/hooks/useQuests.ts +60 -0
  97. package/src/hooks/useQwikApp.ts +49 -0
  98. package/src/hooks/useRewards.ts +74 -0
  99. package/src/index.ts +34 -0
  100. package/src/theme/context.tsx +17 -0
  101. package/src/theme/tokens.ts +68 -0
  102. package/src/types/index.ts +176 -0
  103. package/src/web/widgetAssets.d.ts +3 -0
  104. package/src/web/widgetAssets.ts +6 -0
  105. package/src/web/widgetHtml.ts +302 -0
  106. package/src/web/widgetTypes.ts +146 -0
@@ -0,0 +1,68 @@
1
+ export interface ColorTokens {
2
+ primary: string;
3
+ secondary: string;
4
+ background: string;
5
+ surface: string;
6
+ text: {
7
+ primary: string;
8
+ secondary: string;
9
+ onPrimary: string;
10
+ };
11
+ gradients: {
12
+ sunset: [string, string, string, string];
13
+ card: [string, string, string];
14
+ button: [string, string];
15
+ glass: [string, string];
16
+ };
17
+ }
18
+
19
+ export interface QwikTheme {
20
+ colors: ColorTokens;
21
+ spacing: {
22
+ xs: number;
23
+ s: number;
24
+ m: number;
25
+ l: number;
26
+ xl: number;
27
+ };
28
+ borderRadius: {
29
+ s: number;
30
+ m: number;
31
+ l: number;
32
+ xl: number;
33
+ };
34
+ }
35
+
36
+ export const qwikTheme: QwikTheme = {
37
+ colors: {
38
+ primary: '#FF4500', // OrangeRed
39
+ secondary: '#FFD4C8', // Pale Coral
40
+ background: '#0F1419', // Deep dark
41
+ surface: 'rgba(255, 255, 255, 0.08)',
42
+ text: {
43
+ primary: '#FFFFFF',
44
+ secondary: '#94A3B8',
45
+ onPrimary: '#FFFFFF',
46
+ },
47
+ gradients: {
48
+ // Smoother sunset: Pink -> Orange -> Gold -> Purple
49
+ sunset: ['#FF69B4', '#FF8C00', '#FFD700', '#DA70D6'],
50
+ card: ['rgba(255, 255, 255, 0.1)', 'rgba(255, 255, 255, 0.05)', 'rgba(255, 255, 255, 0)'],
51
+ button: ['#FF4500', '#FF69B4'],
52
+ glass: ['rgba(255, 255, 255, 0.15)', 'rgba(255, 255, 255, 0.05)'],
53
+ },
54
+ },
55
+ spacing: {
56
+ xs: 4,
57
+ s: 8,
58
+ m: 16,
59
+ l: 24,
60
+ xl: 32,
61
+ },
62
+ borderRadius: {
63
+ s: 8,
64
+ m: 12,
65
+ l: 16,
66
+ xl: 24,
67
+ },
68
+ };
@@ -0,0 +1,176 @@
1
+ /**
2
+ * TypeScript types for QwikCard SDK
3
+ */
4
+
5
+ // ─────────────────────────────────────────────────────────────────────────────
6
+ // Core Types
7
+ // ─────────────────────────────────────────────────────────────────────────────
8
+
9
+ export interface Player {
10
+ id: string;
11
+ displayName: string;
12
+ email?: string;
13
+ metadata?: PlayerMetadata;
14
+ createdAt: string;
15
+ updatedAt: string;
16
+ }
17
+
18
+ export interface PlayerMetadata {
19
+ externalId?: string; // QwikCard users.id
20
+ qwikTag?: string; // @handle
21
+ collegeName?: string;
22
+ qwikGoals?: string[];
23
+ workStatus?: string;
24
+ [key: string]: unknown;
25
+ }
26
+
27
+ // ─────────────────────────────────────────────────────────────────────────────
28
+ // Points & Currency
29
+ // ─────────────────────────────────────────────────────────────────────────────
30
+
31
+ export interface PointBalance {
32
+ currency: string;
33
+ balance: number;
34
+ updatedAt: string;
35
+ }
36
+
37
+ export type Currency = 'xp' | 'coins';
38
+
39
+ // ─────────────────────────────────────────────────────────────────────────────
40
+ // Quests
41
+ // ─────────────────────────────────────────────────────────────────────────────
42
+
43
+ export interface Quest {
44
+ id: string;
45
+ name: string;
46
+ description: string;
47
+ status: QuestStatus;
48
+ progress: number;
49
+ target: number;
50
+ rewards: QuestReward[];
51
+ expiresAt?: string;
52
+ completedAt?: string;
53
+ }
54
+
55
+ export type QuestStatus = 'not_started' | 'in_progress' | 'completed' | 'expired';
56
+
57
+ export interface QuestReward {
58
+ type: 'points' | 'badge' | 'reward';
59
+ currency?: string;
60
+ amount?: number;
61
+ badgeId?: string;
62
+ rewardId?: string;
63
+ }
64
+
65
+ // ─────────────────────────────────────────────────────────────────────────────
66
+ // Badges
67
+ // ─────────────────────────────────────────────────────────────────────────────
68
+
69
+ export interface Badge {
70
+ id: string;
71
+ name: string;
72
+ description: string;
73
+ imageUrl?: string;
74
+ earnedAt?: string;
75
+ isEarned: boolean;
76
+ }
77
+
78
+ // ─────────────────────────────────────────────────────────────────────────────
79
+ // Rewards
80
+ // ─────────────────────────────────────────────────────────────────────────────
81
+
82
+ export interface Reward {
83
+ id: string;
84
+ name: string;
85
+ description: string;
86
+ imageUrl?: string;
87
+ cost: number;
88
+ currency: string;
89
+ available: boolean;
90
+ expiresAt?: string;
91
+ }
92
+
93
+ export interface RedemptionResult {
94
+ success: boolean;
95
+ redemptionId?: string;
96
+ code?: string;
97
+ message?: string;
98
+ }
99
+
100
+ // ─────────────────────────────────────────────────────────────────────────────
101
+ // Leaderboard
102
+ // ─────────────────────────────────────────────────────────────────────────────
103
+
104
+ export interface LeaderboardEntry {
105
+ playerId: string;
106
+ displayName: string;
107
+ rank: number;
108
+ score: number;
109
+ metadata?: PlayerMetadata;
110
+ }
111
+
112
+ export interface PlayerRank {
113
+ playerId: string;
114
+ rank: number;
115
+ score: number;
116
+ above: LeaderboardEntry[];
117
+ below: LeaderboardEntry[];
118
+ }
119
+
120
+ // ─────────────────────────────────────────────────────────────────────────────
121
+ // Events (QwikCard-specific)
122
+ // ─────────────────────────────────────────────────────────────────────────────
123
+
124
+ export type QwikCardEventType =
125
+ | 'card.purchase'
126
+ | 'card.deposit'
127
+ | 'card.atm'
128
+ | 'qwikit.sent'
129
+ | 'qwikit.received'
130
+ | 'referral.signup'
131
+ | 'profile.complete';
132
+
133
+ export interface TrackEventInput {
134
+ type: QwikCardEventType;
135
+ playerId: string;
136
+ referenceId?: string;
137
+ data?: Record<string, unknown>;
138
+ }
139
+
140
+ export interface CardPurchaseData {
141
+ i2cTransId: string;
142
+ amount: number;
143
+ mcc?: string;
144
+ category?: string;
145
+ merchant?: string;
146
+ }
147
+
148
+ export interface QwikItData {
149
+ recipientPlayerId: string;
150
+ amount: number;
151
+ senderQwikTag?: string;
152
+ recipientQwikTag?: string;
153
+ }
154
+
155
+ // ─────────────────────────────────────────────────────────────────────────────
156
+ // API Response Types
157
+ // ─────────────────────────────────────────────────────────────────────────────
158
+
159
+ export interface ApiResponse<T> {
160
+ success: boolean;
161
+ data?: T;
162
+ error?: ApiError;
163
+ }
164
+
165
+ export interface ApiError {
166
+ code: string;
167
+ message: string;
168
+ details?: Record<string, unknown>;
169
+ }
170
+
171
+ export interface PaginatedResponse<T> {
172
+ items: T[];
173
+ total: number;
174
+ cursor?: string;
175
+ hasMore: boolean;
176
+ }
@@ -0,0 +1,3 @@
1
+ export declare const WIDGET_SDK_VERSION = "0.0.14";
2
+ export declare const WIDGET_UMD_JS: string;
3
+ export declare const WIDGET_CSS: string;