@jetthai/cuora 1.0.307-dev-2 → 1.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.
Files changed (111) hide show
  1. package/CHANGELOG.md +4 -853
  2. package/README.md +0 -6
  3. package/dist/bundle.mjs +18461 -0
  4. package/package.json +9 -6
  5. package/rollup.config.js +16 -0
  6. package/src/api/activity.js +2 -43
  7. package/src/api/auth.js +7 -22
  8. package/src/api/common.js +1 -3
  9. package/src/api/game.js +7 -20
  10. package/src/api/mailbox.js +5 -9
  11. package/src/api/payment.js +19 -167
  12. package/src/api/user.js +0 -7
  13. package/src/machine/activity/activity.js +26 -111
  14. package/src/machine/activity/{friend_invite_friends_activity.js → affiliate_invite_friends_activity.js} +41 -70
  15. package/src/machine/activity/continue_deposit_activity.js +2 -11
  16. package/src/machine/activity/deposit_activity.js +4 -13
  17. package/src/machine/activity/diamond_shop_activity_vn.js +89 -54
  18. package/src/machine/activity/fafafa_activity.js +19 -34
  19. package/src/machine/activity/index.js +4 -22
  20. package/src/machine/activity/invite_friends_activity.js +14 -14
  21. package/src/machine/activity/ranking_activity.js +2 -11
  22. package/src/machine/activity/sign_in_activity.js +14 -21
  23. package/src/machine/activity/specify_bets_activity.js +3 -25
  24. package/src/machine/activity/specify_turnover_activity.js +3 -25
  25. package/src/machine/activity/time_bomb_activity.js +2 -11
  26. package/src/machine/auth.js +25 -141
  27. package/src/machine/auth_otp.js +201 -0
  28. package/src/machine/auth_otp_v2.js +4 -10
  29. package/src/machine/auth_otp_v3.js +3 -11
  30. package/src/machine/bank_binding.js +12 -112
  31. package/src/machine/common.js +30 -110
  32. package/src/machine/deposit/crypto.js +29 -50
  33. package/src/machine/deposit/crypto_button.js +39 -174
  34. package/src/machine/deposit/deposit_fc.js +5 -8
  35. package/src/machine/deposit/direct.js +16 -111
  36. package/src/machine/deposit/index.js +2 -43
  37. package/src/machine/deposit/loadcard_vn.js +43 -191
  38. package/src/machine/deposit/manual_vn.js +60 -182
  39. package/src/machine/deposit/qrcode_v2.js +52 -285
  40. package/src/machine/deposit/qrcode_vn.js +206 -0
  41. package/src/machine/game.js +285 -0
  42. package/src/machine/game_favorite.js +123 -0
  43. package/src/machine/game_favorite_v2.js +28 -74
  44. package/src/machine/game_search.js +244 -0
  45. package/src/machine/game_search_v2.js +24 -64
  46. package/src/machine/game_v2.js +356 -0
  47. package/src/machine/inbox.js +34 -259
  48. package/src/machine/index.js +17 -26
  49. package/src/machine/leaderboard.js +8 -31
  50. package/src/machine/reward.js +7 -74
  51. package/src/machine/setting.js +2 -5
  52. package/src/machine/side_v2.js +28 -33
  53. package/src/machine/user_sign_up.js +21 -112
  54. package/src/machine/{withdraw/withdraw_crypto.js → withdraw_crypto.js} +69 -220
  55. package/src/machine/{withdraw/withdraw_fc.js → withdraw_fc.js} +2 -2
  56. package/src/machine/{withdraw/withdraw_amb.js → withdraw_vn.js} +78 -146
  57. package/src/request/request.js +5 -10
  58. package/src/util/constant.js +1 -19
  59. package/src/util/deviceToken.js +8 -18
  60. package/src/util/index.js +1 -2
  61. package/src/util/storage.js +22 -22
  62. package/.husky/pre-commit +0 -4
  63. package/.prettierignore +0 -1
  64. package/src/lib/fingerprint.js +0 -9779
  65. package/src/machine/activity/activity_cash.js +0 -159
  66. package/src/machine/activity/cash_rain_activity.js +0 -153
  67. package/src/machine/activity/diamond_shop_activity_cash.js +0 -179
  68. package/src/machine/activity/instant_rebate_activity.js +0 -195
  69. package/src/machine/activity/jackpot.js +0 -74
  70. package/src/machine/activity/otp_verified_activity.js +0 -74
  71. package/src/machine/activity/roulette_activity_v2.js +0 -90
  72. package/src/machine/activity/sign_in_monthly_activity.js +0 -65
  73. package/src/machine/activity/vip_card_activity.js +0 -140
  74. package/src/machine/bank_binding_amb.js +0 -145
  75. package/src/machine/deposit/amb.js +0 -92
  76. package/src/machine/deposit/crypto_bank.js +0 -317
  77. package/src/machine/deposit/crypto_bank_cash.js +0 -287
  78. package/src/machine/deposit/crypto_cash.js +0 -255
  79. package/src/machine/deposit/crypto_qrcode.js +0 -148
  80. package/src/machine/deposit/crypto_qrcode_cash.js +0 -131
  81. package/src/machine/deposit/crypto_way.js +0 -239
  82. package/src/machine/deposit/crypto_way_cash.js +0 -256
  83. package/src/machine/deposit/direct_cash.js +0 -217
  84. package/src/machine/deposit/float.js +0 -366
  85. package/src/machine/deposit/krway.js +0 -151
  86. package/src/machine/deposit/loadcard_cash.js +0 -207
  87. package/src/machine/deposit/manual_cash.js +0 -356
  88. package/src/machine/deposit/qrcode_cash.js +0 -217
  89. package/src/machine/deposit/usdt.js +0 -144
  90. package/src/machine/deposit/usdt_cash.js +0 -138
  91. package/src/machine/deposit/vpay.js +0 -359
  92. package/src/machine/game_info.js +0 -57
  93. package/src/machine/game_search_cash.js +0 -390
  94. package/src/machine/game_v2_1.js +0 -662
  95. package/src/machine/honor_board.js +0 -118
  96. package/src/machine/honor_board_cash.js +0 -89
  97. package/src/machine/navbar.js +0 -57
  98. package/src/machine/promotions.js +0 -171
  99. package/src/machine/reward_cash.js +0 -219
  100. package/src/machine/roulette_v2.js +0 -276
  101. package/src/machine/side_cash.js +0 -110
  102. package/src/machine/user_photo.js +0 -65
  103. package/src/machine/withdraw/index.js +0 -23
  104. package/src/machine/withdraw/withdraw_crypto2.js +0 -540
  105. package/src/machine/withdraw/withdraw_crypto_cash.js +0 -319
  106. package/src/machine/withdraw/withdraw_krway.js +0 -220
  107. package/src/machine/withdraw/withdraw_manual.js +0 -610
  108. package/src/machine/withdraw/withdraw_manual_cash.js +0 -303
  109. package/src/machine/withdraw/withdraw_vn.js +0 -546
  110. package/src/machine/withdraw/withdraw_vn2.js +0 -561
  111. package/src/util/math.js +0 -4
@@ -1,14 +1,16 @@
1
1
  import { assign, createMachine } from 'xstate'
2
2
  import findLastIndex from 'lodash/findLastIndex.js'
3
- import payment from '../../api/payment.js'
4
- import common from '../../api/common.js'
5
- import user from '../../api/user.js'
3
+ import payment from '../api/payment.js'
4
+ import common from '../api/common.js'
5
+ import user from '../api/user.js'
6
+
7
+ // const findLastIndex = require('lodash/findLastIndex')
6
8
 
7
9
  export default function (request) {
8
10
  const { appSecret } = request.config
9
11
  return createMachine(
10
12
  {
11
- id: 'withdraw_amb',
13
+ id: 'withdraw_vn',
12
14
  initial: 'loading',
13
15
  context: {
14
16
  siteConfig: null,
@@ -25,12 +27,13 @@ export default function (request) {
25
27
  targetWithdrawLimit: null,
26
28
 
27
29
  amount: null,
30
+ bank: null,
31
+ branch: null,
32
+ accountNumber: null,
33
+ holderName: null,
28
34
 
29
- // otp
30
- requestId: null,
31
- status: null,
32
- target: null,
33
- ttl: null,
35
+ withdrawDistance: null,
36
+ withdrawAmount: null,
34
37
  },
35
38
  states: {
36
39
  loading: {
@@ -49,20 +52,20 @@ export default function (request) {
49
52
  always: [{ target: 'free', cond: 'isFree' }, { target: 'cash' }],
50
53
  },
51
54
  free: {
52
- initial: 'checking',
55
+ initial: 'loading',
53
56
  states: {
54
- // loading: {
55
- // invoke: {
56
- // src: 'fetchWithdrawRules',
57
- // onDone: {
58
- // target: 'checking',
59
- // actions: 'updateWithdrawCondition',
60
- // },
61
- // onError: {
62
- // target: 'notConvertible',
63
- // },
64
- // },
65
- // },
57
+ loading: {
58
+ invoke: {
59
+ src: 'fetchWithdrawRules',
60
+ onDone: {
61
+ target: 'checking',
62
+ actions: 'updateWithdrawCondition',
63
+ },
64
+ onError: {
65
+ target: 'notConvertible',
66
+ },
67
+ },
68
+ },
66
69
  checking: {
67
70
  always: [{ target: 'convertible', cond: 'isConvertible' }, { target: 'notConvertible' }],
68
71
  },
@@ -77,14 +80,9 @@ export default function (request) {
77
80
  converting: {
78
81
  invoke: {
79
82
  src: 'submitWithdrawFree',
80
- onDone: [
81
- {
82
- target: '#withdraw_amb.otp',
83
- actions: 'setOtp',
84
- cond: 'isOtpRequired',
85
- },
86
- { target: 'converted' },
87
- ],
83
+ onDone: {
84
+ target: 'converted',
85
+ },
88
86
  onError: {
89
87
  target: 'convertible',
90
88
  },
@@ -98,6 +96,7 @@ export default function (request) {
98
96
  states: {
99
97
  checking: {
100
98
  always: [
99
+ { target: 'inProcessing', cond: 'haveProcessing' },
101
100
  { target: 'notWithdrawable', cond: 'isNotWithdrawable' },
102
101
  { target: 'unbound', cond: 'isBankNotBound' },
103
102
  { target: 'withdrawable' },
@@ -107,27 +106,35 @@ export default function (request) {
107
106
  unbound: {
108
107
  // to bank_binding.js
109
108
  },
109
+ inProcessing: {},
110
110
  withdrawable: {
111
- entry: 'setMaximumWithdrawAmount',
112
111
  on: {
112
+ SET_CURRENT_BANK: {
113
+ actions: assign((context, event) => {
114
+ return {
115
+ bank: event.data,
116
+ }
117
+ }),
118
+ },
119
+ SET_AMOUNT: {
120
+ actions: assign((context, event) => {
121
+ return {
122
+ amount: event.data,
123
+ }
124
+ }),
125
+ },
113
126
  SUBMIT: {
114
127
  target: 'submitting',
128
+ cond: 'isSubmittable',
115
129
  },
116
130
  },
117
131
  },
118
132
  submitting: {
119
133
  invoke: {
120
134
  src: 'submitWithdraw',
121
- onDone: [
122
- {
123
- target: '#withdraw_amb.otp',
124
- actions: 'setOtp',
125
- cond: 'isOtpRequired',
126
- },
127
- {
128
- target: 'submitted',
129
- },
130
- ],
135
+ onDone: {
136
+ target: 'submitted',
137
+ },
131
138
  onError: {
132
139
  target: 'withdrawable',
133
140
  },
@@ -138,69 +145,13 @@ export default function (request) {
138
145
  const { applyId, balance, realAmount, charge } = event.data
139
146
  return { applyId, balance, realAmount, charge }
140
147
  }),
141
- },
142
- },
143
- },
144
- otp: {
145
- type: 'parallel',
146
- states: {
147
- countdown: {
148
- after: {
149
- 1000: {
150
- target: 'countdown',
151
- actions: 'decreaseTtl',
152
- cond: (context) => context.ttl > 0,
153
- },
154
- },
155
- },
156
- verification: {
157
- initial: 'idle',
158
- states: {
159
- idle: {
160
- on: {
161
- ACKNOWLEDGE: {
162
- target: 'acknowledging',
163
- },
164
- RESET_OTP: {
165
- target: 'reset',
166
- },
167
- BACK: [
168
- {
169
- target: '#withdraw_amb.free.convertible',
170
- cond: 'isFree',
171
- },
172
- {
173
- target: '#withdraw_amb.cash.withdrawable',
174
- },
175
- ],
176
- },
177
- },
178
- acknowledging: {
179
- invoke: {
180
- src: 'acknowledge',
181
- onDone: [
182
- {
183
- target: '#withdraw_amb.free.converted',
184
- cond: 'isFree',
185
- },
186
- {
187
- target: '#withdraw_amb.cash.submitted',
188
- },
189
- ],
190
- onError: {
191
- target: 'idle',
192
- },
193
- },
148
+ invoke: {
149
+ src: 'fetchPaymentData',
150
+ onDone: {
151
+ actions: 'setPaymentData',
194
152
  },
195
- reset: {
196
- invoke: {
197
- src: 'resetOtp',
198
- onDone: {
199
- target: 'idle',
200
- actions: 'setVerificationData',
201
- },
202
- onError: { target: 'idle' },
203
- },
153
+ onError: {
154
+ target: '#withdraw_vn.fail',
204
155
  },
205
156
  },
206
157
  },
@@ -272,40 +223,14 @@ export default function (request) {
272
223
  availableWithdrawAmount,
273
224
  }
274
225
  }),
275
- setOtp: assign((context, event) => {
276
- const { requestId, status, target, ttl } = event.data
277
- return {
278
- requestId,
279
- status,
280
- target,
281
- ttl,
282
- }
283
- }),
284
- decreaseTtl: assign((context, evnet) => {
285
- const second = context.ttl
286
- return {
287
- ttl: Math.max(second - 1, 0),
288
- }
289
- }),
290
- setVerificationData: assign((context, event) => {
291
- const { requestId, ttl, target } = event.data
292
- return {
293
- requestId,
294
- ttl,
295
- target,
296
- }
297
- }),
298
- setMaximumWithdrawAmount: assign((context, event) => {
299
- const { balance, paymentDetail } = context
300
- return {
301
- amount: Math.min(balance, paymentDetail[0]?.maximum || 0),
302
- }
303
- }),
304
226
  },
305
227
  guards: {
306
228
  isFree: (context, event) => {
307
229
  return context.userInfo?.withdraw_rule !== 'DEFAULT'
308
230
  },
231
+ haveProcessing: (context, event) => {
232
+ return (context.paymentDetail?.[0]?.processing || []).length > 0
233
+ },
309
234
  isWithdrawDisable: (context, event) => {
310
235
  const { siteConfig } = context
311
236
  const methods = siteConfig?.paymentMethods?.withdraw || []
@@ -314,6 +239,10 @@ export default function (request) {
314
239
  isBankNotBound: (context, event) => {
315
240
  return !context.bankInfo?.length
316
241
  },
242
+ isSubmittable: (context, event) => {
243
+ const { applyerBankCode, applyerAccountNumber, branch, holderName, amount } = event.data
244
+ return applyerBankCode && applyerAccountNumber && branch && holderName && amount
245
+ },
317
246
  isConvertible: (context, event) => {
318
247
  const { balance, withdrawLimit } = context
319
248
  return balance > 0 && withdrawLimit === 0
@@ -323,9 +252,6 @@ export default function (request) {
323
252
  const minWithdrawAmount = paymentDetail[0]?.minimum || 0
324
253
  return withdrawLimit !== 0 || balance < minWithdrawAmount
325
254
  },
326
- isOtpRequired: (context, event) => {
327
- return event.data?.status === 'otp-verifying'
328
- },
329
255
  },
330
256
  services: {
331
257
  fetchInitData: async (context, event) => {
@@ -336,7 +262,7 @@ export default function (request) {
336
262
  request.send(payment.getPaymentInfo()),
337
263
  ])
338
264
  const siteConfig = JSON.parse(window.atob(config))
339
- const method = paymentDetail.find((payment) => payment.category === 'amb').method
265
+ const method = paymentDetail.find((payment) => payment.category === 'manual').method
340
266
  const bankList = await request.send(payment.getBankList(method))
341
267
  const newBankInfo = bankInfo.map((item) => {
342
268
  return { ...item, ...bankList.find((bank) => bank.bankCode === item.bankCode) }
@@ -348,25 +274,31 @@ export default function (request) {
348
274
  const { bonus, bankInfo } = await request.send(payment.getPaymentInfo())
349
275
  return { bonus, bankInfo, paymentDetail }
350
276
  },
277
+ updatePaymentInfo: async (context, event) => {
278
+ const { bank, branch, accountNumber, holderName } = context
279
+ return await request.send(
280
+ payment.updatePaymentInfo({
281
+ bankCode: bank.bankCode,
282
+ branch,
283
+ bankAccount: accountNumber,
284
+ holderName,
285
+ })
286
+ )
287
+ },
351
288
  fetchWithdrawRules: async (context, event) => {
352
289
  return await request.send(payment.getCurrentWithdrawRule())
353
290
  },
354
291
  submitWithdraw: async (context, event) => {
292
+ const { amount, applyerBankCode, applyerAccountNumber, branch, holderName } = event.data
355
293
  const { method } = context.paymentDetail[0]
356
- return await request.send(payment.submitWithdrawTransactionAmb({ method }))
294
+ const branchTemp = branch === 'BLANK' ? '' : branch
295
+ return await request.send(
296
+ payment.submitWithdrawTransactionVN({ method, amount, applyerBankCode, applyerAccountNumber, branch: branchTemp, holderName })
297
+ )
357
298
  },
358
299
  submitWithdrawFree: async (context, event) => {
359
300
  return await request.send(payment.convertFreeCredit({ exchangeType: 1 }))
360
301
  },
361
- resetOtp: async (context, event) => {
362
- const { requestId, target } = context
363
- return await request.send(user.otpReset({ requestId, target }))
364
- },
365
- acknowledge: async (context, event) => {
366
- const { requestId, target } = context
367
- const code = event.data
368
- return await request.send(user.otpAcknowledge({ requestId, target, code }))
369
- },
370
302
  },
371
303
  }
372
304
  )
@@ -14,7 +14,6 @@ export default class Request {
14
14
  this.config = config
15
15
  this.key = `cuora_${config.clientId}`
16
16
  this.errorHandler = null
17
- this.hosts = []
18
17
  this.initialize()
19
18
  }
20
19
 
@@ -22,8 +21,8 @@ export default class Request {
22
21
  this.axios.interceptors.request.use((axiosConfig) => {
23
22
  axiosConfig.headers['X-TH1GAMES-VERSION'] = this.config.version
24
23
  axiosConfig.headers['X-TH1GAMES-PLATFORM'] = this.config.platform
25
- if (this.getToken()) {
26
- axiosConfig.headers.Authorization = this.getToken()
24
+ if (storage.get(this.key)) {
25
+ axiosConfig.headers.Authorization = storage.get(this.key)
27
26
  }
28
27
  return axiosConfig
29
28
  })
@@ -51,7 +50,7 @@ export default class Request {
51
50
  async send(req, customToken) {
52
51
  try {
53
52
  const cancelToken = customToken || this.source.token
54
- this._checkToken(req)
53
+ this._checkToken(req, storage.get(this.key))
55
54
  const requestConfig = this._createConfig(req, cancelToken)
56
55
  const { data } = await this.axios.request(requestConfig)
57
56
  return data
@@ -97,14 +96,10 @@ export default class Request {
97
96
  }
98
97
  }
99
98
 
100
- _checkToken(req) {
101
- if (!req.isPublic && !this.getToken()) {
99
+ _checkToken(req, token) {
100
+ if (!req.isPublic && !token) {
102
101
  console.error(req)
103
102
  throw { code: 'ERR_A103', url: req.url }
104
103
  }
105
104
  }
106
-
107
- getToken() {
108
- return storage.get(this.key)
109
- }
110
105
  }
@@ -1,20 +1,2 @@
1
1
  export const MY_FAVORITE = 'MyFavorite'
2
- export const GAME_SEARCH = 'GameSearch'
3
- export const GAME_TYPE_LIST = [
4
- { typeId: 'SLOT', name: 'Slots', gameTypeMappingId: 1 },
5
- { typeId: 'FISH', name: 'Fishing', gameTypeMappingId: 2 },
6
- { typeId: 'ARCADE', name: 'Arcades', gameTypeMappingId: 3 },
7
- { typeId: 'LOTTERY', name: 'Lottery', gameTypeMappingId: 4 },
8
- { typeId: 'CARD', name: 'Card', gameTypeMappingId: 5 },
9
- { typeId: 'TABLE', name: 'Table', gameTypeMappingId: 6 },
10
- { typeId: 'BINGO', name: 'Bingo', gameTypeMappingId: 7 },
11
- { typeId: 'LIVE', name: 'Live', gameTypeMappingId: 8 },
12
- { typeId: 'SCRATCHCARDS', name: 'Scratch Cards', gameTypeMappingId: 9 },
13
- { typeId: 'EGAME', name: 'E-Game', gameTypeMappingId: 10 },
14
- { typeId: 'BONUS', name: 'Bonus', gameTypeMappingId: 11 },
15
- { typeId: 'BALL', name: 'Ball', gameTypeMappingId: 12 },
16
- { typeId: 'PACHINKO', name: 'Pachinko', gameTypeMappingId: 13 },
17
- { typeId: 'GRAPH', name: 'Graph', gameTypeMappingId: 14 },
18
- { typeId: 'TURBO', name: 'Turbo', gameTypeMappingId: 15 },
19
- { typeId: 'SPORT', name: 'Sports', gameTypeMappingId: 16 },
20
- ]
2
+ export const GAME_SEARCH = 'GameSearch'
@@ -1,21 +1,12 @@
1
- import uniqBy from 'lodash/uniqBy'
2
- import { load, defaultEndpoint } from '../lib/fingerprint.js'
3
-
1
+ import FingerprintJS from '@fingerprintjs/fingerprintjs-pro'
4
2
  const reg = /fnapi\d*/
3
+ // const reg = /(?<=https:\/\/)\w+(?=(\.\w+\.\w+))/
5
4
 
6
- const getDeviceToken = async ({ fpToken, sentry, hosts, enable = true }) => {
7
- if (!enable) {
8
- return
9
- }
10
-
11
- let dt, endpoints
5
+ const getDeviceToken = async ({ fpToken, sentry, apiURL }) => {
6
+ let dt, endpoint
12
7
  try {
13
- endpoints = uniqBy(
14
- hosts.map((host) => host.replace(reg, 'fp')),
15
- (url) => url
16
- )
17
-
18
- const fp = await load({ endpoint: [...endpoints, defaultEndpoint] })
8
+ endpoint = apiURL.replace(reg, 'fp')
9
+ const fp = await FingerprintJS.load({ apiKey: fpToken, endpoint })
19
10
  const result = await fp.get({ timeout: 30000 })
20
11
  dt = result.visitorId
21
12
 
@@ -23,10 +14,9 @@ const getDeviceToken = async ({ fpToken, sentry, hosts, enable = true }) => {
23
14
  throw new Error('[Device Token] No token from FingerprintJS.')
24
15
  }
25
16
 
26
- console.log('[Device Token]', `${dt} from ${endpoints}`)
27
- sentry?.setTag('dt', dt)
17
+ console.log('[Device Token]', `${dt} from ${endpoint}`)
28
18
  } catch (error) {
29
- console.error('[Device Token]', `${dt} from ${endpoints}`, error)
19
+ console.error('[Device Token]', `${dt} from ${endpoint}`)
30
20
  sentry?.captureException(error)
31
21
  } finally {
32
22
  return dt
package/src/util/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import { getDeviceToken } from './deviceToken.js'
2
2
  import storage from './storage.js'
3
3
  import * as constant from './constant.js'
4
- import { max } from './math.js'
5
4
 
6
5
  export default { getDeviceToken }
7
- export { constant, storage, max }
6
+ export { constant, storage }
@@ -1,28 +1,28 @@
1
1
  export default {
2
- get(name, options) {
3
- const itemStr = localStorage.getItem(name)
2
+ get(name, options) {
3
+ const itemStr = localStorage.getItem(name)
4
4
 
5
- if (!itemStr) {
6
- return null
7
- }
5
+ if (!itemStr) {
6
+ return null
7
+ }
8
8
 
9
- const item = JSON.parse(itemStr)
10
- if (item.expiry && new Date().getTime() > item.expiry) {
11
- localStorage.removeItem(name)
12
- return null
13
- }
9
+ const item = JSON.parse(itemStr)
10
+ if (item.expiry && new Date().getTime() > item.expiry) {
11
+ localStorage.removeItem(name)
12
+ return null
13
+ }
14
14
 
15
- return item.value
16
- },
17
- set(name, value, options) {
18
- const item = { value }
15
+ return item.value
16
+ },
17
+ set(name, value, options) {
18
+ const item = {value}
19
19
 
20
- if (options?.maxAge) {
21
- item.expiry = new Date().getTime() + options.maxAge * 1000
20
+ if (options?.maxAge) {
21
+ item.expiry = new Date().getTime() + options.maxAge * 1000
22
+ }
23
+ localStorage.setItem(name, JSON.stringify(item))
24
+ },
25
+ remove(name, options) {
26
+ localStorage.removeItem(name)
22
27
  }
23
- localStorage.setItem(name, JSON.stringify(item))
24
- },
25
- remove(name, options) {
26
- localStorage.removeItem(name)
27
- },
28
- }
28
+ }
package/.husky/pre-commit DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env sh
2
- . "$(dirname -- "$0")/_/husky.sh"
3
-
4
- npm run format && git add .
package/.prettierignore DELETED
@@ -1 +0,0 @@
1
- dist/