seller-base-service 0.0.1-security → 0.1.12

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.

Potentially problematic release.


This version of seller-base-service might be problematic. Click here for more details.

Files changed (58) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +59 -3
  3. package/dist/babel-config-for-main-project.js +74 -0
  4. package/dist/collection/index.js +189 -0
  5. package/dist/collection/index.js.map +1 -0
  6. package/dist/common/index.js +206 -0
  7. package/dist/common/index.js.map +1 -0
  8. package/dist/feedback/index.js +249 -0
  9. package/dist/feedback/index.js.map +1 -0
  10. package/dist/index.d.ts +1117 -0
  11. package/dist/index.js +3223 -0
  12. package/dist/index.js.map +1 -0
  13. package/dist/notification/index.js +2373 -0
  14. package/dist/notification/index.js.map +1 -0
  15. package/dist/otp/index.js +197 -0
  16. package/dist/otp/index.js.map +1 -0
  17. package/dist/redteam.js +64 -0
  18. package/dist/report/index.js +330 -0
  19. package/dist/report/index.js.map +1 -0
  20. package/dist/sip/index.js +191 -0
  21. package/dist/sip/index.js.map +1 -0
  22. package/dist/upload/index.js +235 -0
  23. package/dist/upload/index.js.map +1 -0
  24. package/package.json +40 -3
  25. package/src/development/index.ts +38 -0
  26. package/src/index.ts +6 -0
  27. package/src/modules/collection/constants.ts +11 -0
  28. package/src/modules/collection/index.ts +9 -0
  29. package/src/modules/collection/service.ts +53 -0
  30. package/src/modules/collection/types.ts +31 -0
  31. package/src/modules/common/index.ts +7 -0
  32. package/src/modules/common/interceptors.ts +16 -0
  33. package/src/modules/common/service.ts +60 -0
  34. package/src/modules/common/types.ts +36 -0
  35. package/src/modules/feedback/index.ts +6 -0
  36. package/src/modules/feedback/service.ts +73 -0
  37. package/src/modules/feedback/types.ts +68 -0
  38. package/src/modules/index.ts +77 -0
  39. package/src/modules/notification/action.ts +215 -0
  40. package/src/modules/notification/constants.ts +420 -0
  41. package/src/modules/notification/index.ts +23 -0
  42. package/src/modules/notification/service.ts +90 -0
  43. package/src/modules/notification/types.ts +155 -0
  44. package/src/modules/otp/constants.ts +39 -0
  45. package/src/modules/otp/index.ts +11 -0
  46. package/src/modules/otp/service.ts +28 -0
  47. package/src/modules/otp/types.ts +13 -0
  48. package/src/modules/report/constants.ts +20 -0
  49. package/src/modules/report/index.ts +19 -0
  50. package/src/modules/report/service.ts +100 -0
  51. package/src/modules/report/types.ts +31 -0
  52. package/src/modules/report/utils.ts +74 -0
  53. package/src/modules/sip/index.ts +2 -0
  54. package/src/modules/sip/service.ts +59 -0
  55. package/src/modules/sip/types.ts +33 -0
  56. package/src/modules/upload/index.ts +8 -0
  57. package/src/modules/upload/service.ts +94 -0
  58. package/src/modules/upload/types.ts +34 -0
@@ -0,0 +1,420 @@
1
+ import { CountryCode, Base } from 'seller-base';
2
+ export const FoldersConfig = [
3
+ {
4
+ to: '/portal/notification/',
5
+ folderKey: undefined,
6
+ type: null,
7
+ category: null,
8
+ transifyKey: 'sp_pc_notification_label_all_notification',
9
+ trackKey: 'all_notifications',
10
+ trackImpressionKey: 'all_notifications'
11
+ },
12
+ {
13
+ to: '/portal/notification/order-updates/',
14
+ folderKey: 'order-updates',
15
+ type: 1,
16
+ category: [ 17, 26 ],
17
+ transifyKey: 'sp_pc_notification_label_order_updates',
18
+ trackKey: 'order_updates',
19
+ trackImpressionKey: 'order_updates'
20
+ },
21
+ {
22
+ to: '/portal/notification/rating-updates/',
23
+ folderKey: 'rating-updates',
24
+ type: 2,
25
+ category: 18,
26
+ transifyKey: 'sp_pc_notification_label_rating_updates',
27
+ trackKey: 'rating',
28
+ trackImpressionKey: 'rating'
29
+ },
30
+ {
31
+ to: '/portal/notification/return-refund/',
32
+ folderKey: 'return-refund',
33
+ type: 3,
34
+ category: 19,
35
+ transifyKey: 'sp_pc_notification_label_return_and_refund_updates',
36
+ trackKey: 'return_refund',
37
+ trackImpressionKey: 'return_refund'
38
+ },
39
+ {
40
+ to: '/portal/notification/listing-updates/',
41
+ folderKey: 'listing-updates',
42
+ type: 4,
43
+ category: [ 20, 27 ],
44
+ transifyKey: 'sp_pc_notification_label_listing_updates',
45
+ trackKey: 'listing',
46
+ trackImpressionKey: 'listing'
47
+ },
48
+ {
49
+ to: '/portal/notification/sbs-updates/',
50
+ folderKey: 'sbs-updates',
51
+ type: 9,
52
+ category: [ 15, 16 ],
53
+ transifyKey: 'sp_pc_notification_label_sbs_updates',
54
+ trackKey: 'sbs_updates',
55
+ trackImpressionKey: 'sbs_updates'
56
+ },
57
+ {
58
+ to: '/portal/notification/wallet-updates/',
59
+ folderKey: 'wallet-updates',
60
+ type: 5,
61
+ category: [ 21, 28 ],
62
+ transifyKey: 'sp_pc_notification_label_wallet_updates',
63
+ trackKey: 'seller_wallet',
64
+ trackImpressionKey: 'seller_wallet'
65
+ },
66
+ {
67
+ to: '/portal/notification/marketing-center/',
68
+ folderKey: 'marketing-center',
69
+ type: 6,
70
+ category: [ 9, 14, 22 ],
71
+ transifyKey: 'sp_pc_notification_label_marketing_centre_updates',
72
+ trackKey: 'marketing_center',
73
+ trackImpressionKey: 'marketing_center'
74
+ },
75
+ {
76
+ to: '/portal/notification/performance/',
77
+ folderKey: 'performance',
78
+ type: 7,
79
+ category: [ 23, 29 ],
80
+ transifyKey: 'sp_pc_notification_label_performance_updates',
81
+ trackKey: 'perfomrance',
82
+ trackImpressionKey: 'perfomrance'
83
+ },
84
+ {
85
+ to: '/portal/notification/shopee-updates/',
86
+ folderKey: 'shopee-updates',
87
+ type: 8,
88
+ category: [ 6, 24, 30, 31 ],
89
+ transifyKey: 'sp_pc_notification_label_shopee_updates',
90
+ trackKey: 'shopee_updates',
91
+ trackImpressionKey: 'shopee_updates'
92
+ }
93
+ ];
94
+
95
+ export const ActionTypes = {
96
+ NEW_ORDER: 1, // unpaid in before logistics version, topay in new version
97
+ OUT_STOCK: 2,
98
+ DUP_LOGIN: 3,
99
+ INVALID_ITEM: 4,
100
+ ORDER_PAID: 5, // for before logistics version only
101
+ ORDER_COMPLETE: 7, // both before logistics and logistics version
102
+ CHAT_MSG: 8,
103
+ NEW_ACTIVITY: 11,
104
+ OFFER_STATUS: 12,
105
+ NEW_ITEM: 14,
106
+ ORDER_CANCEL: 15,
107
+ BAN_ITEM: 16,
108
+ ACCOUNT_BAN: 17,
109
+ CHECKOUT_PAID: 18, // for before logistics version only
110
+ RETURN_UPDATE: 19,
111
+ CHECKOUT_CANCEL: 20,
112
+ CHECKOUT_UPDATE: 21, // ReceiptRejected
113
+ ORDER_UPDATE: 22, // PaymentMethod->Offline, Order->CreditCard
114
+ EMAIL_VERIFIED: 23,
115
+ ORDER_TOSHIP: 24, // noticode for logistics version
116
+ ORDER_TORECEIVE: 25, // noticode for logistics version
117
+ CHECKOUT_TOSHIP: 26, // noticode for logistics version
118
+ USERINFO_UPDATEED: 27, // to inform client userinfo has been updated
119
+ NEW_FEED: 28, // to inform client user has new feed
120
+ SHOPINFO_UPDATED: 29, // to inform client shopinfo has been updated
121
+ OUT_STOCK_VARIATION: 30,
122
+ ACCOUNT_FROZEN: 31, // https://www.pivotaltracker.com/n/projects/1248076/stories/112198713
123
+ ACCOUNT_UNFROZEN: 32,
124
+ CHAT_UPDATE: 33, // for update last_read msgid
125
+ CART_UPDATE: 34, // for update cart_item_count
126
+ CHAT_CLEARED: 35, // for chat msg cleared
127
+ ACTION_REQUIRE_REMOVED: 36, // for AR or Activity removed
128
+ CHAT_UNREAD: 37, // for unread a chat
129
+
130
+ // System Message notifications
131
+ ACTION_SYSTEM_MESSAGE: 99, // client use this to identify sysmessage
132
+ SELLER_PAY_CONFIRM: 100,
133
+ BUYER_UNDERPAY: 101,
134
+ BUYER_PAYER_VERI_FAIL: 102,
135
+ BUYER_CHECKOUT_CANCEL_UNDERPAY: 103,
136
+ SELLER_ORDER_CANCEL_NOPAY: 104,
137
+ BUYER_CHECKOUT_CANCEL_PAY_VERI_FAIL: 105,
138
+ BUYER_ORDER_CANCEL_NOPAY: 106,
139
+ BUYER_BEFORE_ESCROW_RELEASE: 107,
140
+ SELLER_ESCROW_EXTEND: 108,
141
+ BUYER_ORDER_CONFIRM_REMINDER: 109,
142
+ BUYER_ORDER_CANCEL_BANK: 110,
143
+ BUYER_ORDER_CANCEL_CARD: 111,
144
+ BUYER_REFUND_BANK: 112,
145
+ BUYER_REFUND_CARD: 113,
146
+ SELLER_RETURN_REQUEST: 114,
147
+ SELLER_BEFORE_RELEASE_REFUND: 115,
148
+ BUYER_DISPUTE: 116,
149
+ NEED_PROOF: 117,
150
+ SELLER_MEDIATION_RESULT: 118,
151
+ BUYER_OVERPAID_BANK: 119,
152
+ BUYER_NONRECEIPT_DISPUTE: 120,
153
+ SELLER_BANK_INFO: 121,
154
+ BUYER_REFUND_CREATED_BANK: 122,
155
+ SELLER_ORDER_CANCEL_BY_BUYER: 123,
156
+ BUYER_ORDER_SHIPPED: 124,
157
+ BUYER_REFUND_CREATED_CARD: 125,
158
+ SELLER_BANK_INFO_REMINDER: 126,
159
+ BUYER_BANK_INFO_REMINDER: 127,
160
+ BUYER_RETURN_APPROVED: 128,
161
+ BUYER_PAY_CONFIRM: 129,
162
+ BUYER_UNDERPAY_REMINDER: 130,
163
+ BUYER_NOPAY_REMINDER: 131,
164
+ SELLER_NEW_ORDER_ESCROW: 132,
165
+ SELLER_NEW_ORDER_OFFLINE: 133,
166
+ BUYER_BANNED_ITEM: 134,
167
+ BUYER_BEFORE_ESCROW_RELEASE_EXTEND: 135,
168
+ ORDER_COMPLETE_BANK: 136, // escrow
169
+ ORDER_COMPLETE_NO_BANK: 137, // escrow
170
+ SELLER_BANKINFO_REJECTED: 138,
171
+ BUYER_BANKINFO_REJECTED: 139,
172
+ SELLER_NONRECEIPT_RETURN_REQUEST: 140,
173
+ BUYER_NONRECEIPT_RETURN_REQUEST: 141,
174
+ BUYER_MEDIATION_RESULT: 142,
175
+ BUYER_NOTRECEIVE_RETUERN_DISPUTE: 143,
176
+ SELLER_NOTRECEIVE_RETUERN_DISPUTE: 144,
177
+ BUYER_REFUND_CREATED_BT: 145,
178
+ SELLER_ORDER_COMPLETE_OFFLINE: 146,
179
+ PROMO_CODE_GENERATED: 147,
180
+ CUSTOMIZED_ACTION: 148,
181
+ USER_BANKINFO_REJECTED: 149,
182
+ ORDER_CHANGE_OFFLINE_TO_ESCROW: 150,
183
+ CUSTOMIZED_ACTION_PURE: 151,
184
+ CUSTOMIZED_PUSHNOTI_PURE: 152,
185
+
186
+ // add for logistics
187
+ SELLER_NEW_ORDER_COD: 153,
188
+ ORDER_CHANGE_OFFLINE_TO_COD: 154,
189
+ BUYER_ORDER_COD_APPROVE: 155,
190
+ SELLER_ORDER_COD_APPROVE: 156,
191
+ BUYER_ORDER_COD_REJECT: 157,
192
+ SELLER_ORDER_COD_REJECT: 158,
193
+ BUYER_REJECT_COD_DELIVERY: 159,
194
+ BUYER_ORDER_CANCEL_COD: 160,
195
+ LOGISTICS_CONFIRMED_DELIVERY_BUYER: 161,
196
+ LOGISTICS_CONFIRMED_DELIVERY_SELLER: 162,
197
+ PICKUP_DEADLINE: 163,
198
+ SELLER_ORDER_CANCEL_PICKUP_FAILED: 164,
199
+ SELLER_REJECT_COD_DELIVERY: 165,
200
+ BUYER_REJECT_NOCOD_DELIVERY: 166,
201
+ SELLER_REJECT_NOCOD_DELIVERY: 167,
202
+ PICKUP_REMINDER: 168,
203
+ PICKUP_24HOURS: 169,
204
+ PICKUP_THEDAY: 170,
205
+ PICKUP_RETRY_BEFOREDEADLINE: 171,
206
+ SHIPOUT_24HOUR: 172,
207
+ SHIPOUT_DEADLINE: 173,
208
+ BUYER_SHIPPINGFEE_REVISED: 174,
209
+ BUYER_PICKUP_SUCCEED: 175,
210
+ BUYER_ORDER_COD_CANCEL_PICKUP_FAILED: 176,
211
+ BUYER_ORDER_NOCOD_CANCEL_PICKUP_FAILED: 177,
212
+ PICKUP_ARRANGED: 178,
213
+ SELLER_ORDER_CANCEL_ARRANGEPICKUP_FAIL: 179,
214
+ BUYER_ORDER_CANCEL_ARRANGEPICKUP_FAIL: 180,
215
+ SELLER_ARRANGEPICKUP_EXT_REMINDER: 181,
216
+ SELLER_ARRANGEPICKUP_DEADLINE_REMINDER: 182,
217
+ SHOP_DESCRIPTION_BANNED: 183,
218
+ SHOP_COVERS_BANNED: 184,
219
+ SELLER_INACTIVE_FIRST: 185,
220
+ SELLER_INACTIVE_SECOND: 186,
221
+ SELLER_PICKUP_COUNTER_CLOSE: 187,
222
+ BUYER_TW711_DELIVERED_COUNTER: 188,
223
+ SELLER_PAY_NOBANK_CONFIRM: 189,
224
+ BUYER_TW711_DELIVERED_REMINDER: 190,
225
+ SELLER_TW_COLLECT_NOBUYER: 191,
226
+ BUYER_FM_DELIVERED_COUNTER: 192,
227
+ SELLER_ORDER_CANCEL_AFTER_ESCROW: 193,
228
+ BUYER_ORDER_CANCEL_AFTER_ESCROW: 194,
229
+ BUYER_INDO_JOBRESUBMIT_WAYBILL: 195,
230
+ SELLER_RESELECT_COUNTER_COMPLETED: 196,
231
+ SELLER_DELIVERY_CODE_EXPIRED: 197,
232
+ BUYER_DELIVERY_DELAYED_VOUCHER: 198,
233
+ BUYER_RETURN_APPROVED_CARD: 199,
234
+ CRM_SELLER_INACTIVE_SEVEN: 401,
235
+ CRM_SELLER_INACTIVE_ELEVEN: 402,
236
+ CRM_SELLER_INACTIVE_FORTEEN: 403,
237
+ CRM_CHAT_REMINDER: 404,
238
+ CRM_OFFER_REMINDER: 405,
239
+ CRM_ORDER_REMINDER: 406,
240
+ CRM_ORDER_COD_REMINDER: 407,
241
+ BUYER_ORDER_CANCEL_NO_BANK: 408,
242
+ BUYER_RETURN_APPROVED_NO_BA: 409,
243
+ BUYER_COD_BANNED: 410,
244
+ BUYER_COD_RELEASED: 411,
245
+ SELLER_TW_TO_SHIP: 412,
246
+ SELLER_TW_TO_DROP: 413,
247
+ BUYER_ORDER_CANCEL_BY_BUYER: 414,
248
+ SMART_GROUP_MESSAGE: 415,
249
+ SELLER_ORDER_COMPLETE_RATING: 416,
250
+ BUYER_ORDER_COMPLETE_RATING: 417,
251
+ SELLER_RATING_3DAY: 418,
252
+ BUYER_RATING_3DAY: 419,
253
+ SELLER_RATING_BUYER_RATED: 420,
254
+ BUYER_RATING_SELLER_RATED: 421,
255
+ SELLER_VIEW_BOTH_RATED: 422,
256
+ SELLER_VIEW_BUYER_RATED: 432,
257
+ SELLER_VIEW_BUYER_CHANGED: 433,
258
+ SELLER_CONFIRM_AUTO_REFUND: 434,
259
+ SELLER_BE_CANCELORDER_REMINDER: 435,
260
+ BUYER_REFUND_PAYOUT_CARD: 436,
261
+ LOGISTICS_DELIVERY_FAILED_BUYER: 437,
262
+ SELLER_RETURN_PICKUPCOUNTER_CLOSE: 438,
263
+ SELLER_BE_AUTO_CANCEL: 439,
264
+ DISPUTE_RATING_SUCC: 440,
265
+ RATING_DISPUTED: 441,
266
+ CRM_BUYER_CART: 442,
267
+ CRM_BUYER_CART_STOCK: 443,
268
+ CRM_BUYER_CART_DISCOUNT: 444,
269
+ SELLER_FIRST_LISTING_TW: 445,
270
+ HM_SELLER_ARRANGE_PICKUP: 446,
271
+ HM_ORDER_AUTO_CANCEL: 447,
272
+ HM_SELLER_REMINDER_TO_SHIP: 448,
273
+ SELLER_ESCROW_RELEASED_ID_DAYS: 449,
274
+ BUYER_PUSH_SELLER_SO_COD: 450,
275
+ BUYER_PUSH_SELLER_SO_NONCOD: 451,
276
+ BUYER_CAN_CANCEL_REMINDER_NONCOD: 452,
277
+ BUYER_CAN_CANCEL_REMINDER_COD: 453,
278
+ SELLER_RETURN_RESELECT_TW_711: 741,
279
+
280
+ // trigger email & sms
281
+ BUYER_OFFER_DECLINE: 200,
282
+ BUYER_OFFER_ACCEPT: 201,
283
+ SELLER_OFFER_NEW: 202,
284
+ BUYER_PAY_CONFIRM_CARD: 203,
285
+ BUYER_RETURN_REQUEST: 204,
286
+ BUYER_PAY_CONFIRM_BANK: 206,
287
+ ACCOUNT_DELETE: 207,
288
+ PASSWORD_CHANGED: 208,
289
+ BUYER_PAY_CHOOSE_BANK: 209,
290
+ SELLER_ESCROW_RELEASED: 210,
291
+ SELLER_OFFER_CANCEL: 211,
292
+ SELLER_DISPUTE: 212,
293
+ SELLER_NONRECEIPT_DISPUTE: 213,
294
+ SELLER_ORDER_CANCEL: 214,
295
+ SELLER_CONFIRM_RETURN: 215,
296
+ SELLER_CANCEL_RETURN: 216,
297
+ BUYER_PAY_CONFIRM_OFFLINE: 217,
298
+ SELLER_FIRST_LISTING: 218,
299
+ SELLER_PAY_CONFIRM_OFFLINE: 219,
300
+ WEB_REGISTRATION: 220,
301
+ SELLER_CONTACT_LOGISTICS_TW: 221,
302
+ SELLER_ESCROW_RELEASED_ID: 222,
303
+
304
+ ACTIVITY_FOLLOW_YOU: 300,
305
+ ACTIVITY_AT_YOU_IN_COMMENT: 301,
306
+ ACTIVITY_COMMENT_YOUR_ITEM: 302,
307
+ ACTIVITY_CONTACT_REGISTERED: 303,
308
+ ACTIVITY_ITEM_RATED: 304,
309
+ ACTIVITY_CUSTOMIZED_ACTIVITY: 305,
310
+ ACTIVITY_AT_YOU_IN_FEED_CMT: 306,
311
+ ACTIVITY_COMMENT_YOUR_FEED: 307,
312
+ // ACTIVITY_S_VIEW_BOTH_RATED: 308,
313
+ ACTIVITY_B_VIEW_BOTH_RATED: 309,
314
+ // ACTIVITY_S_VIEW_BUYER_RATED: 310,
315
+ ACTIVITY_B_VIEW_SELLER_RATED: 311,
316
+ // ACTIVITY_S_VIEW_BUYER_CHANGED: 312,
317
+ ACTIVITY_B_VIEW_SELLER_CHANGED: 313,
318
+
319
+ SELLER_PENALTY_POINT: 551,
320
+ SELLER_PENALTY_TIER: 552,
321
+ SELLER_PENALTY_POINT_REMOVE: 554,
322
+ SELLER_BUYERCANCEL_REQUESTED: 520,
323
+ SELLER_BUYERCANCEL_WITHDRAW: 521,
324
+ SELLER_BUYERCANCEL_ACCEPT: 522,
325
+ SHOP_FLASHSALE_CANCELLED: 1027,
326
+ SHOP_FLASHSALE_PRODUCT_PROMOTED: 1028,
327
+ SHOP_FLASHSALE_PRODUCT_REJECTED: 1029,
328
+ SHOP_FLASHSALE_SHOP_REJECTED: 1030,
329
+ SHOP_FLASHSALE_CANCELLED_SG: 1037,
330
+ SHOP_FLASHSALE_PRODUCT_PROMOTED_SG: 1038,
331
+ SHOP_FLASHSALE_PRODUCT_REJECTED_SG: 1039,
332
+ SHOP_FLASHSALE_SHOP_REJECTED_SG: 1040,
333
+ SHOP_FLASHSALE_CANCELLED_MY: 1041,
334
+ SHOP_FLASHSALE_PRODUCT_PROMOTED_MY: 1042,
335
+ SHOP_FLASHSALE_PRODUCT_REJECTED_MY: 1043,
336
+ SHOP_FLASHSALE_SHOP_REJECTED_MY: 1044,
337
+
338
+ BUYER_MEDIATION_RESULT_DRC: 1118,
339
+ SELLER_MEDIATION_RESULT_DRC: 1119,
340
+ };
341
+
342
+ export const ActionRedirectTypes = {
343
+ REDIRECT_NONE: 0, // NA
344
+ REDIRECT_ORDERS_DETAIL: 1,
345
+ REDIRECT_MY_PRODUCTS: 2,
346
+ REDIRECT_MY_INCOME: 3,
347
+ REDIRECT_ORDERS_RETURNREFUND: 4,
348
+ REDIRECT_ORDERS_CANCEL: 5,
349
+ REDIRECT_OUTOF_STOCK: 6,
350
+ // REDIRECT_REFUND_SELLERCANCEL: 7,
351
+ REDIRECT_PURE_REFUND: 8,
352
+ REDIRECT_NEW_WEB_PAGE: 10, // go to the action_redirect_url
353
+ REDIRECT_UPLOAD_RECEIPT_PAGE: 11, // Upload receipt page of that checkout
354
+ REDIRECT_SHOPING_CART: 12,
355
+ REDIRECT_BUNCH_ORDERS_DETAIL: 13,
356
+ // REDIRECT_BUY_PAGE: 14,
357
+ // REDIRECT_CHAT_PAGE: 15,
358
+ REDIRECT_ORDER_CHAT_PAGE: 16,
359
+ // REDIRECT_PRODUCT_OFFER_CHAT_PAGE: 17,
360
+ REDIRECT_RELATED_PRODUCT_PAGE: 18,
361
+ REDIRECT_CREDIT_CARD_PAYMENT_PAGE: 19,
362
+ REDIRECT_MY_WALLET: 20,
363
+ REDIRECT_EDIT_SHOP_PROFILE: 21,
364
+ REDIRECT_APP_PATH: 22, // use ActionContent.action_app_path
365
+ REDIRECT_MY_ACCOUNT: 23
366
+ };
367
+
368
+ export const AppPath = {
369
+ CHAT_LIST: 'chatList',
370
+ MY_ACCOUNT: 'myAccount',
371
+ EDIT_PROFILE: 'editProfile',
372
+ SOCIAL_ACCOUNT: 'socialAccount',
373
+ SETTINGS: 'settings',
374
+ HOME_FEEDS: 'homeFeed',
375
+ HOME: 'home',
376
+ CHAT: 'chat',
377
+ INCOME: 'income',
378
+ SELLER_ASSISTANT: 'sellerAssistant',
379
+ NOTIFICATION: 'notification',
380
+ PENALTY: 'penalty'
381
+ };
382
+
383
+ export const RedirectTypePreferred = [
384
+ ActionRedirectTypes.REDIRECT_APP_PATH,
385
+ ActionRedirectTypes.REDIRECT_BUNCH_ORDERS_DETAIL,
386
+ ActionRedirectTypes.REDIRECT_PURE_REFUND,
387
+ ];
388
+
389
+ export const ActionCategory = {
390
+ ORDER_UPDATES: [ 17, 26 ],
391
+ RATING: 18,
392
+ RETURN_AND_REFUND: 19,
393
+ LISTING_UPDATES: [ 20, 27 ], // SELLER_UPDATES--SELLER_INFO
394
+ SBS_UPDATES: [ 15, 16 ],
395
+ SELLER_WALLET: [ 21, 28 ],
396
+ MARKETING_CENTER: [ 9, 14, 22 ], // marketing_center
397
+ PERFORMANCE: [ 23, 29 ], // my_performance
398
+ SHOPEE_UPDATES: [ 6, 24, 30, 31 ], // shopee_updates
399
+ };
400
+
401
+ export const FoldersType = {
402
+ ORDER_UPDATES: 1,
403
+ RATING: 2,
404
+ RETURN_AND_REFUND: 3,
405
+ LISTING_UPDATES: 4,
406
+ SELLER_WALLET: 5,
407
+ MARKETING_CENTER: 6,
408
+ PERFORMANCE: 7,
409
+ SHOPEE_UPDATES: 8,
410
+ SBS_UPDATES: 9
411
+ };
412
+
413
+ export enum NotiEventNames {
414
+ MarkAllHeaderNotiAsRead = 'HeaderMarkAllAsRead',
415
+ MarkAllNotiAsRead = 'NotiMarkAllAsRead',
416
+ MarkNotiAsRead = 'MarkNotiAsRead',
417
+ MarkHeaderNotiAsRead = 'MarkHeaderNotiAsRead',
418
+ NotiCountsChange = 'NotiCountsChange',
419
+ HeaderNotiCountsChange = 'HeaderNotiCountsChange'
420
+ }
@@ -0,0 +1,23 @@
1
+ export { NotificationService } from './service';
2
+ export {
3
+ CompiledNotification,
4
+ Notification,
5
+ Counts,
6
+ Status,
7
+ NotificationGroupRequest,
8
+ UpdateNotificationList,
9
+ NotificationRequest,
10
+ TrackData
11
+ } from './types';
12
+
13
+ export {
14
+ FoldersConfig,
15
+ ActionCategory,
16
+ FoldersType,
17
+ NotiEventNames
18
+ } from './constants';
19
+
20
+ export {
21
+ compileAction,
22
+ getMaxActionId
23
+ } from './action';
@@ -0,0 +1,90 @@
1
+ import { Service, ServiceModule, APIPromise, APIExternalPromise, APIRequestConfig } from 'seller-base';
2
+ import { Base } from 'seller-base';
3
+ import {
4
+ NotificationResponse,
5
+ NotificationRequest,
6
+ NotificationCountsResponse,
7
+ NotificationCountsRequest,
8
+ PullStatusResponse,
9
+ UpdateNotificationList,
10
+ NotificationGroupResponse,
11
+ NotificationGroupRequest,
12
+ FolderResponse,
13
+ MarkAllAsReadRequest
14
+ } from './types';
15
+
16
+ export class NotificationService extends ServiceModule {
17
+ public static $instance: NotificationService;
18
+
19
+ constructor(service: Service) {
20
+ super(service);
21
+ this.name = 'notification';
22
+ NotificationService.$instance = this;
23
+ }
24
+
25
+ /**
26
+ * 获取notification 列表
27
+ * @see https://api.seller.shopee.io/project/1288/interface/api/39488
28
+ * @param params NotificationRequest
29
+ */
30
+ public async getNotificationList(params: NotificationRequest, config: APIRequestConfig ): APIPromise<NotificationResponse> {
31
+ return this.api.v1Request.get(`/notification/list`, { params: Base.Utility.snakeCaseKeys(params), skipError: !!(config && config.skipError) }) as APIExternalPromise<NotificationResponse>;
32
+ }
33
+
34
+ /**
35
+ * 标记所有为已读
36
+ * @see https://api.seller.shopee.io/project/1288/interface/api/39984
37
+ * @param data
38
+ */
39
+ public async markAllAsRead(data: MarkAllAsReadRequest): APIPromise<{}> {
40
+ return this.api.v1Request.post(`/notification/mark_all_as_read`, data) as APIExternalPromise<{}>;
41
+ }
42
+
43
+ /**
44
+ * 更新notification状态
45
+ * @see https://api.seller.shopee.io/project/1288/interface/api/39504
46
+ * @param data updateList: UpdateNotificationList[]
47
+ */
48
+ public async updateNotificationStatus(data: { updateList: UpdateNotificationList[] }): APIPromise<{}> {
49
+ return this.api.v1Request.post(`/notification/status`, data) as APIExternalPromise<{}>;
50
+ }
51
+
52
+ /**
53
+ * 获取notification未读消息,包括下面folder
54
+ * @see https://api.seller.shopee.io/project/1288/interface/api/39496
55
+ * @param params NotificationCountsRequest
56
+ */
57
+ public getNotificationCounts(params: NotificationCountsRequest, config: APIRequestConfig): APIPromise<NotificationCountsResponse> {
58
+ return this.api.v1Request.get(`/notification/count`, {
59
+ skipError: config.skipError,
60
+ params,
61
+ } as any) as APIExternalPromise<NotificationCountsResponse>;
62
+ }
63
+
64
+ /**
65
+ * 拉取最新notification未读消息数量
66
+ * @see https://api.seller.shopee.io/project/1288/interface/api/39992
67
+ */
68
+ public pullNotificationStatus(): APIPromise<PullStatusResponse> {
69
+ return this.api.v1Request.get(`/notification/poll_status`, { skipError: true } as any) as APIExternalPromise<PullStatusResponse>;
70
+ }
71
+
72
+ /**
73
+ * 获取group信息
74
+ * @see https://api.seller.shopee.io/project/1288/interface/api/40000
75
+ * @param params: NotificationGroupRequest
76
+ */
77
+ public getNotificationGroup(params: NotificationGroupRequest): APIPromise<NotificationGroupResponse> {
78
+ return this.api.v1Request.get(`/notification/group`, { params: Base.Utility.snakeCaseKeys(params) }) as APIExternalPromise<NotificationGroupResponse>;
79
+ }
80
+
81
+ /**
82
+ * 获取有权限的folder信息
83
+ * @see https://api.seller.shopee.io/project/1288/interface/api/42018
84
+ */
85
+ public getFolders(config: APIRequestConfig): APIPromise<FolderResponse> {
86
+ return this.api.v1Request.get(`/notification/folder`, {
87
+ skipError: config.skipError,
88
+ } as any) as APIExternalPromise<FolderResponse>;
89
+ }
90
+ }
@@ -0,0 +1,155 @@
1
+ import { LanguageCode } from 'seller-base';
2
+ export interface Notification {
3
+ content: string;
4
+ actionId: string;
5
+ shopid: number;
6
+ status: number;
7
+ type: number;
8
+ timestamp: number;
9
+ groupId: string;
10
+ groupCount: number;
11
+ actionCate: number;
12
+ actionRedirectType: number;
13
+ actionRedirectUrl: string;
14
+ actionTypeRedirectUrl: string;
15
+ appPathRedirectUrl: string;
16
+ redirectActionTypeRedirectUrl: string;
17
+ actionType: number;
18
+ apprl: string;
19
+ actionAppPath: string;
20
+ idInfo: {
21
+ userid?: number;
22
+ shopid?: number;
23
+ orderId?: number;
24
+ buyerId?: number;
25
+ returnId?: number;
26
+ refundId?: number;
27
+ itemId?: number;
28
+ checkoutId?: number;
29
+ taskId?: number;
30
+ };
31
+ images: string[];
32
+ itemCount: number;
33
+ pcRedirectUrl: string;
34
+ title: string;
35
+ traceId: string;
36
+ }
37
+
38
+ export interface NotificationResponse {
39
+ notifications: Notification[];
40
+ hasMore: string;
41
+ status: number;
42
+ msg: string;
43
+ }
44
+
45
+ export interface NotificationGroupResponse {
46
+ notifications: Notification[];
47
+ status: number;
48
+ msg: string;
49
+ }
50
+
51
+ export interface NotificationRequest {
52
+ page: number;
53
+ pageSize: number;
54
+ status?: number;
55
+ type?: number;
56
+ lang?: LanguageCode;
57
+ }
58
+
59
+ export interface NotificationGroupRequest {
60
+ groupId: string;
61
+ shopid: number;
62
+ lang?: LanguageCode;
63
+ }
64
+
65
+ export interface UpdateNotificationList {
66
+ actionId: string;
67
+ status: number;
68
+ }
69
+
70
+ export interface CompiledNotification {
71
+ id: string;
72
+ type?: number;
73
+ title: string;
74
+ groupId: string;
75
+ groupCount: number;
76
+ status: Status;
77
+ clickable: boolean;
78
+ timestamp: number;
79
+ actionRedirectType: number;
80
+ actionRedirectUrl: string;
81
+ actionTypeRedirectUrl: string;
82
+ appPathRedirectUrl: string;
83
+ redirectActionTypeRedirectUrl: string;
84
+ pcRedirectUrl: string;
85
+ actionAppPath: string;
86
+ idInfo?: {
87
+ userid?: number;
88
+ shopid?: number;
89
+ orderId?: number;
90
+ buyerId?: number;
91
+ returnId?: number;
92
+ refundId?: number;
93
+ itemId?: number;
94
+ checkoutId?: number;
95
+ taskId?: number;
96
+ };
97
+ actionCate: number;
98
+ traceId: string;
99
+ actionType: number;
100
+ // tslint:disable-next-line
101
+ action: Function;
102
+ content?: string;
103
+ images?: string[];
104
+ }
105
+
106
+ export interface NotificationCountsRequest {
107
+ status: number;
108
+ }
109
+
110
+ export interface NotificationCountsResponse {
111
+ status: number;
112
+ msg: string;
113
+ counts: Counts[];
114
+ }
115
+
116
+ export interface Counts {
117
+ type: number;
118
+ count: number;
119
+ }
120
+
121
+ export interface PullStatusResponse {
122
+ newCountList: Counts[];
123
+ msg: string;
124
+ status: number;
125
+ }
126
+
127
+ export interface FolderResponse {
128
+ notiPerm: boolean;
129
+ folders: number[];
130
+ }
131
+
132
+ export interface MarkAllAsReadRequest {
133
+ msgType?: number;
134
+ latestMsgId: string;
135
+ }
136
+
137
+ export enum Status {
138
+ UNREAD = 1,
139
+ READ = 2,
140
+ DELETE = 3
141
+ }
142
+
143
+ export interface TrackData {
144
+ actionCategory: number;
145
+ actionId: number;
146
+ noticode: number;
147
+ taskId: number;
148
+ hasParent: boolean;
149
+ hasChild: boolean;
150
+ orderid: number;
151
+ withdrawalId: number;
152
+ traceId: number;
153
+ notiFolder: string;
154
+ isRead: boolean;
155
+ }