@anker-in/campaign-ui 0.5.1-beta.3 → 0.5.2

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 (75) hide show
  1. package/dist/cjs/components/credits/context/const.js +1 -1
  2. package/dist/cjs/components/credits/context/const.js.map +2 -2
  3. package/dist/cjs/components/credits/context/hooks/useMyRewards.js +1 -1
  4. package/dist/cjs/components/credits/context/hooks/useMyRewards.js.map +3 -3
  5. package/dist/cjs/components/credits/context/hooks/useRedeemCoupon.js +1 -1
  6. package/dist/cjs/components/credits/context/hooks/useRedeemCoupon.js.map +3 -3
  7. package/dist/cjs/components/credits/context/hooks/useRedeemGoGift.js +1 -1
  8. package/dist/cjs/components/credits/context/hooks/useRedeemGoGift.js.map +3 -3
  9. package/dist/cjs/components/credits/context/hooks/useRedeemProduct.js +1 -1
  10. package/dist/cjs/components/credits/context/hooks/useRedeemProduct.js.map +3 -3
  11. package/dist/cjs/components/credits/context/hooks/useRedeemableList.js +1 -1
  12. package/dist/cjs/components/credits/context/hooks/useRedeemableList.js.map +3 -3
  13. package/dist/cjs/components/credits/context/hooks/useSubscribed.js.map +2 -2
  14. package/dist/cjs/components/credits/context/provider.d.ts +2 -1
  15. package/dist/cjs/components/credits/context/provider.js +1 -1
  16. package/dist/cjs/components/credits/context/provider.js.map +3 -3
  17. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/index.js +1 -1
  18. package/dist/cjs/components/credits/creditsRedeemList/AddressForm/index.js.map +3 -3
  19. package/dist/cjs/components/index.d.ts +2 -2
  20. package/dist/cjs/components/index.js +1 -1
  21. package/dist/cjs/components/index.js.map +2 -2
  22. package/dist/cjs/components/memberPopup/MemberPopup.js +1 -1
  23. package/dist/cjs/components/memberPopup/MemberPopup.js.map +3 -3
  24. package/dist/cjs/components/memberPopup/type.d.ts +6 -0
  25. package/dist/cjs/components/memberPopup/type.js +1 -1
  26. package/dist/cjs/components/memberPopup/type.js.map +1 -1
  27. package/dist/cjs/templates/Credits.js +1 -1
  28. package/dist/cjs/templates/Credits.js.map +2 -2
  29. package/dist/cjs/templates/Credits.types.d.ts +1 -0
  30. package/dist/cjs/templates/Credits.types.js.map +1 -1
  31. package/dist/esm/components/credits/context/const.js +1 -1
  32. package/dist/esm/components/credits/context/const.js.map +2 -2
  33. package/dist/esm/components/credits/context/hooks/useMyRewards.js +1 -1
  34. package/dist/esm/components/credits/context/hooks/useMyRewards.js.map +3 -3
  35. package/dist/esm/components/credits/context/hooks/useRedeemCoupon.js +1 -1
  36. package/dist/esm/components/credits/context/hooks/useRedeemCoupon.js.map +3 -3
  37. package/dist/esm/components/credits/context/hooks/useRedeemGoGift.js +1 -1
  38. package/dist/esm/components/credits/context/hooks/useRedeemGoGift.js.map +3 -3
  39. package/dist/esm/components/credits/context/hooks/useRedeemProduct.js +1 -1
  40. package/dist/esm/components/credits/context/hooks/useRedeemProduct.js.map +3 -3
  41. package/dist/esm/components/credits/context/hooks/useRedeemableList.js +1 -1
  42. package/dist/esm/components/credits/context/hooks/useRedeemableList.js.map +3 -3
  43. package/dist/esm/components/credits/context/hooks/useSubscribed.js.map +2 -2
  44. package/dist/esm/components/credits/context/provider.d.ts +2 -1
  45. package/dist/esm/components/credits/context/provider.js +1 -1
  46. package/dist/esm/components/credits/context/provider.js.map +3 -3
  47. package/dist/esm/components/credits/creditsRedeemList/AddressForm/index.js +1 -1
  48. package/dist/esm/components/credits/creditsRedeemList/AddressForm/index.js.map +3 -3
  49. package/dist/esm/components/index.d.ts +2 -2
  50. package/dist/esm/components/index.js +1 -1
  51. package/dist/esm/components/index.js.map +2 -2
  52. package/dist/esm/components/memberPopup/MemberPopup.js +1 -1
  53. package/dist/esm/components/memberPopup/MemberPopup.js.map +3 -3
  54. package/dist/esm/components/memberPopup/type.d.ts +6 -0
  55. package/dist/esm/components/memberPopup/type.js.map +1 -1
  56. package/dist/esm/templates/Credits.js +1 -1
  57. package/dist/esm/templates/Credits.js.map +2 -2
  58. package/dist/esm/templates/Credits.types.d.ts +1 -0
  59. package/dist/esm/templates/Credits.types.js.map +1 -1
  60. package/package.json +1 -2
  61. package/src/components/credits/context/const.ts +1 -0
  62. package/src/components/credits/context/hooks/useMyRewards.ts +2 -2
  63. package/src/components/credits/context/hooks/useRedeemCoupon.ts +2 -2
  64. package/src/components/credits/context/hooks/useRedeemGoGift.ts +2 -2
  65. package/src/components/credits/context/hooks/useRedeemProduct.ts +2 -2
  66. package/src/components/credits/context/hooks/useRedeemableList.ts +2 -2
  67. package/src/components/credits/context/hooks/useSubscribed.ts +0 -1
  68. package/src/components/credits/context/provider.tsx +4 -0
  69. package/src/components/credits/creditsRedeemList/AddressForm/index.tsx +3 -3
  70. package/src/components/index.ts +2 -2
  71. package/src/components/memberPopup/MemberPopup.tsx +14 -3
  72. package/src/components/memberPopup/type.ts +6 -0
  73. package/src/templates/Credits.tsx +1 -0
  74. package/src/templates/Credits.types.ts +1 -0
  75. package/src/stories/CartCard.stories.tsx +0 -459
@@ -1,459 +0,0 @@
1
- /**
2
- * CartCard Storybook Stories
3
- * 展示购物车卡片组件的各种状态
4
- */
5
-
6
- import type { Meta, StoryObj } from '@storybook/react'
7
- import React from 'react'
8
- import { CartCard } from '../components/LiveChatWidget/components/MessageContent/CartCard.js'
9
- import type { CartContent } from '../components/LiveChatWidget/types'
10
-
11
- // Story 包装组件
12
- const CartCardWrapper: React.FC<{ content: CartContent }> = ({ content }) => {
13
- return (
14
- <div className="flex min-h-screen items-center justify-center bg-gray-100 p-4">
15
- <div className="w-full max-w-md">{CartCard.render(content, false, false)}</div>
16
- </div>
17
- )
18
- }
19
-
20
- const meta: Meta<typeof CartCardWrapper> = {
21
- title: 'Campaign/LiveChatWidget/MessageContent/CartCard',
22
- component: CartCardWrapper,
23
- parameters: {
24
- layout: 'fullscreen',
25
- docs: {
26
- description: {
27
- component: `
28
- # 购物车卡片组件
29
-
30
- 显示用户购物车内容,包括商品列表、价格汇总和结账按钮。
31
-
32
- ## 功能特性
33
-
34
- - 📦 **商品列表**: 展示购物车中的所有商品
35
- - 💰 **价格汇总**: 显示小计、折扣和总计
36
- - 🎟️ **折扣码**: 显示已应用的折扣码及其状态
37
- - 🛒 **结账按钮**: 一键跳转到 Shopify 结账页面
38
- - 🈳 **空状态**: 优雅的空购物车提示
39
-
40
- ## 使用场景
41
-
42
- - 用户添加商品到购物车后 (add_to_cart)
43
- - 用户查询购物车内容 (get_cart)
44
- - 用户修改购物车数量 (update_cart_item)
45
- - 用户应用折扣码 (update_discount_codes)
46
- `,
47
- },
48
- },
49
- },
50
- tags: ['autodocs'],
51
- }
52
-
53
- export default meta
54
-
55
- type Story = StoryObj<typeof CartCardWrapper>
56
-
57
- /**
58
- * 空购物车状态
59
- */
60
- export const Empty: Story = {
61
- args: {
62
- content: {
63
- type: 'cart',
64
- data: {
65
- isEmpty: true,
66
- cartId: 'gid://shopify/Cart/empty',
67
- totalQuantity: 0,
68
- lines: [],
69
- cost: {
70
- totalAmount: {
71
- amount: '0.00',
72
- currencyCode: 'USD',
73
- },
74
- subtotalAmount: {
75
- amount: '0.00',
76
- currencyCode: 'USD',
77
- },
78
- },
79
- },
80
- },
81
- },
82
- }
83
-
84
- /**
85
- * 单件商品
86
- */
87
- export const SingleItem: Story = {
88
- args: {
89
- content: {
90
- type: 'cart',
91
- data: {
92
- isEmpty: false,
93
- cartId: 'gid://shopify/Cart/Z2NwLXVzLWVhc3QxOjAxSkZHRjA4VkFRQkhON1dBMTNLREZEVEZH',
94
- totalQuantity: 1,
95
- lines: [
96
- {
97
- id: 'gid://shopify/CartLine/12345',
98
- quantity: 1,
99
- cost: {
100
- totalAmount: {
101
- amount: '99.99',
102
- currencyCode: 'USD',
103
- },
104
- amountPerQuantity: {
105
- amount: '99.99',
106
- currencyCode: 'USD',
107
- },
108
- subtotalAmount: {
109
- amount: '99.99',
110
- currencyCode: 'USD',
111
- },
112
- },
113
- merchandise: {
114
- id: 'gid://shopify/ProductVariant/43234567890',
115
- title: 'Black',
116
- price: {
117
- amount: '99.99',
118
- currencyCode: 'USD',
119
- },
120
- image: {
121
- url: 'https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=400&h=400&fit=crop',
122
- altText: 'Soundcore Space One',
123
- },
124
- product: {
125
- id: 'gid://shopify/Product/8179159826618',
126
- title: 'Soundcore Space One',
127
- handle: 'soundcore-space-one',
128
- },
129
- },
130
- },
131
- ],
132
- cost: {
133
- totalAmount: {
134
- amount: '99.99',
135
- currencyCode: 'USD',
136
- },
137
- subtotalAmount: {
138
- amount: '99.99',
139
- currencyCode: 'USD',
140
- },
141
- },
142
- checkoutUrl: 'https://checkout.shopify.com/example',
143
- },
144
- },
145
- },
146
- }
147
-
148
- /**
149
- * 多件商品
150
- */
151
- export const MultipleItems: Story = {
152
- args: {
153
- content: {
154
- type: 'cart',
155
- data: {
156
- isEmpty: false,
157
- cartId: 'gid://shopify/Cart/Z2NwLXVzLWVhc3QxOjAxSkZHRjA4VkFRQkhON1dBMTNLREZEVEZH',
158
- totalQuantity: 5,
159
- lines: [
160
- {
161
- id: 'gid://shopify/CartLine/12345',
162
- quantity: 2,
163
- cost: {
164
- totalAmount: {
165
- amount: '199.98',
166
- currencyCode: 'USD',
167
- },
168
- amountPerQuantity: {
169
- amount: '99.99',
170
- currencyCode: 'USD',
171
- },
172
- subtotalAmount: {
173
- amount: '199.98',
174
- currencyCode: 'USD',
175
- },
176
- },
177
- merchandise: {
178
- id: 'gid://shopify/ProductVariant/43234567890',
179
- title: 'Black',
180
- price: {
181
- amount: '99.99',
182
- currencyCode: 'USD',
183
- },
184
- image: {
185
- url: 'https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=400&h=400&fit=crop',
186
- altText: 'Soundcore Space One',
187
- },
188
- product: {
189
- id: 'gid://shopify/Product/8179159826618',
190
- title: 'Soundcore Space One',
191
- handle: 'soundcore-space-one',
192
- },
193
- },
194
- },
195
- {
196
- id: 'gid://shopify/CartLine/12346',
197
- quantity: 1,
198
- cost: {
199
- totalAmount: {
200
- amount: '129.99',
201
- currencyCode: 'USD',
202
- },
203
- amountPerQuantity: {
204
- amount: '129.99',
205
- currencyCode: 'USD',
206
- },
207
- subtotalAmount: {
208
- amount: '129.99',
209
- currencyCode: 'USD',
210
- },
211
- },
212
- merchandise: {
213
- id: 'gid://shopify/ProductVariant/43234567891',
214
- title: 'White',
215
- price: {
216
- amount: '129.99',
217
- currencyCode: 'USD',
218
- },
219
- image: {
220
- url: 'https://images.unsplash.com/photo-1484704849700-f032a568e944?w=400&h=400&fit=crop',
221
- altText: 'eufy Security Camera',
222
- },
223
- product: {
224
- id: 'gid://shopify/Product/8179159826619',
225
- title: 'eufy Security Camera',
226
- handle: 'eufy-security-camera',
227
- },
228
- },
229
- },
230
- {
231
- id: 'gid://shopify/CartLine/12347',
232
- quantity: 2,
233
- cost: {
234
- totalAmount: {
235
- amount: '79.98',
236
- currencyCode: 'USD',
237
- },
238
- amountPerQuantity: {
239
- amount: '39.99',
240
- currencyCode: 'USD',
241
- },
242
- subtotalAmount: {
243
- amount: '79.98',
244
- currencyCode: 'USD',
245
- },
246
- },
247
- merchandise: {
248
- id: 'gid://shopify/ProductVariant/43234567892',
249
- title: 'USB-C Cable',
250
- price: {
251
- amount: '39.99',
252
- currencyCode: 'USD',
253
- },
254
- image: {
255
- url: 'https://images.unsplash.com/photo-1583863788434-e58a36330cf0?w=400&h=400&fit=crop',
256
- altText: 'Anker USB-C Cable',
257
- },
258
- product: {
259
- id: 'gid://shopify/Product/8179159826620',
260
- title: 'Anker USB-C Cable 6ft',
261
- handle: 'anker-usb-c-cable',
262
- },
263
- },
264
- },
265
- ],
266
- cost: {
267
- totalAmount: {
268
- amount: '409.95',
269
- currencyCode: 'USD',
270
- },
271
- subtotalAmount: {
272
- amount: '409.95',
273
- currencyCode: 'USD',
274
- },
275
- },
276
- checkoutUrl: 'https://checkout.shopify.com/example',
277
- },
278
- },
279
- },
280
- }
281
-
282
- /**
283
- * 有折扣码的购物车
284
- */
285
- export const WithDiscount: Story = {
286
- args: {
287
- content: {
288
- type: 'cart',
289
- data: {
290
- isEmpty: false,
291
- cartId: 'gid://shopify/Cart/Z2NwLXVzLWVhc3QxOjAxSkZHRjA4VkFRQkhON1dBMTNLREZEVEZH',
292
- totalQuantity: 3,
293
- lines: [
294
- {
295
- id: 'gid://shopify/CartLine/12345',
296
- quantity: 2,
297
- cost: {
298
- totalAmount: {
299
- amount: '199.98',
300
- currencyCode: 'USD',
301
- },
302
- amountPerQuantity: {
303
- amount: '99.99',
304
- currencyCode: 'USD',
305
- },
306
- subtotalAmount: {
307
- amount: '199.98',
308
- currencyCode: 'USD',
309
- },
310
- },
311
- merchandise: {
312
- id: 'gid://shopify/ProductVariant/43234567890',
313
- title: 'Black',
314
- price: {
315
- amount: '99.99',
316
- currencyCode: 'USD',
317
- },
318
- image: {
319
- url: 'https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=400&h=400&fit=crop',
320
- altText: 'Soundcore Space One',
321
- },
322
- product: {
323
- id: 'gid://shopify/Product/8179159826618',
324
- title: 'Soundcore Space One',
325
- handle: 'soundcore-space-one',
326
- },
327
- },
328
- },
329
- {
330
- id: 'gid://shopify/CartLine/12346',
331
- quantity: 1,
332
- cost: {
333
- totalAmount: {
334
- amount: '129.99',
335
- currencyCode: 'USD',
336
- },
337
- amountPerQuantity: {
338
- amount: '129.99',
339
- currencyCode: 'USD',
340
- },
341
- subtotalAmount: {
342
- amount: '129.99',
343
- currencyCode: 'USD',
344
- },
345
- },
346
- merchandise: {
347
- id: 'gid://shopify/ProductVariant/43234567891',
348
- title: 'White',
349
- price: {
350
- amount: '129.99',
351
- currencyCode: 'USD',
352
- },
353
- image: {
354
- url: 'https://images.unsplash.com/photo-1484704849700-f032a568e944?w=400&h=400&fit=crop',
355
- altText: 'eufy Security Camera',
356
- },
357
- product: {
358
- id: 'gid://shopify/Product/8179159826619',
359
- title: 'eufy Security Camera',
360
- handle: 'eufy-security-camera',
361
- },
362
- },
363
- },
364
- ],
365
- cost: {
366
- totalAmount: {
367
- amount: '296.97',
368
- currencyCode: 'USD',
369
- },
370
- subtotalAmount: {
371
- amount: '329.97',
372
- currencyCode: 'USD',
373
- },
374
- },
375
- discountCodes: [
376
- {
377
- code: 'SPRING20',
378
- applicable: true,
379
- },
380
- ],
381
- checkoutUrl: 'https://checkout.shopify.com/example',
382
- },
383
- },
384
- },
385
- }
386
-
387
- /**
388
- * 多个折扣码(部分失效)
389
- */
390
- export const WithMultipleDiscounts: Story = {
391
- args: {
392
- content: {
393
- type: 'cart',
394
- data: {
395
- isEmpty: false,
396
- cartId: 'gid://shopify/Cart/Z2NwLXVzLWVhc3QxOjAxSkZHRjA4VkFRQkhON1dBMTNLREZEVEZH',
397
- totalQuantity: 2,
398
- lines: [
399
- {
400
- id: 'gid://shopify/CartLine/12345',
401
- quantity: 2,
402
- cost: {
403
- totalAmount: {
404
- amount: '199.98',
405
- currencyCode: 'USD',
406
- },
407
- amountPerQuantity: {
408
- amount: '99.99',
409
- currencyCode: 'USD',
410
- },
411
- subtotalAmount: {
412
- amount: '199.98',
413
- currencyCode: 'USD',
414
- },
415
- },
416
- merchandise: {
417
- id: 'gid://shopify/ProductVariant/43234567890',
418
- title: 'Black',
419
- price: {
420
- amount: '99.99',
421
- currencyCode: 'USD',
422
- },
423
- image: {
424
- url: 'https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=400&h=400&fit=crop',
425
- altText: 'Soundcore Space One',
426
- },
427
- product: {
428
- id: 'gid://shopify/Product/8179159826618',
429
- title: 'Soundcore Space One',
430
- handle: 'soundcore-space-one',
431
- },
432
- },
433
- },
434
- ],
435
- cost: {
436
- totalAmount: {
437
- amount: '179.98',
438
- currencyCode: 'USD',
439
- },
440
- subtotalAmount: {
441
- amount: '199.98',
442
- currencyCode: 'USD',
443
- },
444
- },
445
- discountCodes: [
446
- {
447
- code: 'WELCOME10',
448
- applicable: true,
449
- },
450
- {
451
- code: 'EXPIRED20',
452
- applicable: false,
453
- },
454
- ],
455
- checkoutUrl: 'https://checkout.shopify.com/example',
456
- },
457
- },
458
- },
459
- }