iphone-xudale 0.2.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. package/.eslintrc.json +3 -0
  2. package/app/(pages)/options/page.tsx +720 -0
  3. package/app/(pages)/popup/page.tsx +166 -0
  4. package/app/(pages)/tips/page.tsx +40 -0
  5. package/app/components/DropListBox.tsx +157 -0
  6. package/app/components/SVGPlay.tsx +14 -0
  7. package/app/favicon.ico +0 -0
  8. package/app/globals.css +27 -0
  9. package/app/layout.tsx +15 -0
  10. package/app/page.tsx +3 -0
  11. package/app/scripts/content/checkoutSteps.ts +341 -0
  12. package/app/scripts/content/doFroApplePages.ts +206 -0
  13. package/app/scripts/content/getPageInitInfo.ts +49 -0
  14. package/app/scripts/content/getStoreCanPickInfo.ts +251 -0
  15. package/app/scripts/content/goOrderSteps.ts +179 -0
  16. package/app/scripts/content/index.ts +56 -0
  17. package/app/scripts/content/playSystemNotifacation.ts +39 -0
  18. package/app/scripts/content/sendSelfNotificatioin.ts +27 -0
  19. package/app/scripts/inject/index.ts +18 -0
  20. package/app/shared/constants.ts +236 -0
  21. package/app/shared/interface.ts +25 -0
  22. package/app/shared/location/city.json +1774 -0
  23. package/app/shared/location/county.json +17115 -0
  24. package/app/shared/location/province.json +94 -0
  25. package/app/shared/util.ts +93 -0
  26. package/buildAfter.js +86 -0
  27. package/bunBuild.ts +54 -0
  28. package/extension/content-script.js +7 -0
  29. package/extension/favicon.ico +0 -0
  30. package/extension/icons/icon128.png +0 -0
  31. package/extension/icons/icon16.png +0 -0
  32. package/extension/icons/icon19-disable.png +0 -0
  33. package/extension/icons/icon19.png +0 -0
  34. package/extension/icons/icon32.png +0 -0
  35. package/extension/icons/icon38.png +0 -0
  36. package/extension/icons/icon48.png +0 -0
  37. package/extension/inject-script.js +1 -0
  38. package/extension/manifest.json +38 -0
  39. package/extension/service-worker.js +62 -0
  40. package/extension.next.config.js +25 -0
  41. package/icon_generator.py +30 -0
  42. package/middleware.ts +21 -0
  43. package/next.config.js +15 -0
  44. package/package.json +67 -0
  45. package/postcss.config.js +6 -0
  46. package/public/assets/images/SCR-20230916-nbkz.png +0 -0
  47. package/public/assets/images/SCR-20230916-nbyv.png +0 -0
  48. package/public/assets/images/SCR-20230916-ncte.png +0 -0
  49. package/public/assets/images/SCR-20230916-ndgw.png +0 -0
  50. package/public/assets/images/SCR-20230916-ndks.png +0 -0
  51. package/public/assets/images/SCR-20230916-neaa.png +0 -0
  52. package/public/assets/images/SCR-20230916-neeq.jpeg +0 -0
  53. package/public/assets/images/SCR-20230916-nfkt.png +0 -0
  54. package/public/assets/images/SCR-20230919-ulfn.png +0 -0
  55. package/public/assets/images/SCR-20230919-ulzd.png +0 -0
  56. package/public/assets/images/SCR-20230919-uocr.png +0 -0
  57. package/public/icon_original.png +0 -0
  58. package/public/next.svg +1 -0
  59. package/public/vercel.svg +1 -0
  60. package/tailwind.config.ts +20 -0
  61. package/tsconfig.json +27 -0
  62. package/types/global.d.ts +19 -0
@@ -0,0 +1,236 @@
1
+ import { mapValues as _mapValues } from 'lodash'
2
+ import { IPHONEORDER_CONFIG } from './interface'
3
+ export const iPhoneModels = {
4
+ iPhone15Pro: [
5
+ { color: { value: 'black', text: '黑色钛金属' }, capacity: '128GB', model: 'MTQ43CH/A' },
6
+ { color: { value: 'black', text: '黑色钛金属' }, capacity: '256GB', model: 'MTQ83CH/A' },
7
+ { color: { value: 'black', text: '黑色钛金属' }, capacity: '512GB', model: 'MTQD3CH/A' },
8
+ { color: { value: 'black', text: '黑色钛金属' }, capacity: '1TB', model: 'MTQH3CH/A' },
9
+
10
+ { color: { value: 'white', text: '白色钛金属' }, capacity: '128GB', model: 'MTQ53CH/A' },
11
+ { color: { value: 'white', text: '白色钛金属' }, capacity: '256GB', model: 'MTQ93CH/A' },
12
+ { color: { value: 'white', text: '白色钛金属' }, capacity: '512GB', model: 'MTQE3CH/A' },
13
+ { color: { value: 'white', text: '白色钛金属' }, capacity: '1TB', model: 'MTQJ3CH/A' },
14
+
15
+ { color: { value: 'blue', text: '蓝色钛金属' }, capacity: '128GB', model: 'MTQ73CH/A' },
16
+ { color: { value: 'blue', text: '蓝色钛金属' }, capacity: '256GB', model: 'MTQC3CH/A' },
17
+ { color: { value: 'blue', text: '蓝色钛金属' }, capacity: '512GB', model: 'MTQG3CH/A' },
18
+ { color: { value: 'blue', text: '蓝色钛金属' }, capacity: '1TB', model: 'MTQL3CH/A' },
19
+
20
+ { color: { value: 'primary', text: '原色钛金属' }, capacity: '128GB', model: 'MTQ63CH/A' },
21
+ { color: { value: 'primary', text: '原色钛金属' }, capacity: '256GB', model: 'MTQA3CH/A' },
22
+ { color: { value: 'primary', text: '原色钛金属' }, capacity: '512GB', model: 'MTQF3CH/A' },
23
+ { color: { value: 'primary', text: '原色钛金属' }, capacity: '1TB', model: 'MTQK3CH/A' },
24
+ ],
25
+
26
+ iPhone15ProMax: [
27
+ { color: { value: 'black', text: '黑色钛金属' }, capacity: '256GB', model: 'MU2N3CH/A' },
28
+ { color: { value: 'black', text: '黑色钛金属' }, capacity: '512GB', model: 'MU2T3CH/A' },
29
+ { color: { value: 'black', text: '黑色钛金属' }, capacity: '1TB', model: 'MU2X3CH/A' },
30
+
31
+ { color: { value: 'white', text: '白色钛金属' }, capacity: '256GB', model: 'MU2P3CH/A' },
32
+ { color: { value: 'white', text: '白色钛金属' }, capacity: '512GB', model: 'MU2U3CH/A' },
33
+ { color: { value: 'white', text: '白色钛金属' }, capacity: '1TB', model: 'MU2Y3CH/A' },
34
+
35
+ { color: { value: 'blue', text: '蓝色钛金属' }, capacity: '256GB', model: 'MU2R3CH/A' },
36
+ { color: { value: 'blue', text: '蓝色钛金属' }, capacity: '512GB', model: 'MU2W3CH/A' },
37
+ { color: { value: 'blue', text: '蓝色钛金属' }, capacity: '1TB', model: 'MU613CH/A' },
38
+
39
+ { color: { value: 'primary', text: '原色钛金属' }, capacity: '256GB', model: 'MU2Q3CH/A' },
40
+ { color: { value: 'primary', text: '原色钛金属' }, capacity: '512GB', model: 'MU2V3CH/A' },
41
+ { color: { value: 'primary', text: '原色钛金属' }, capacity: '1TB', model: 'MU603CH/A' },
42
+ ],
43
+ }
44
+
45
+ // keys
46
+ export enum storeKeys {
47
+ orderEnabled = `orderEnabled`,
48
+ orderConfig = `orderConfig`,
49
+ }
50
+
51
+ export const applePageUrl = {
52
+ shoppingCart: `https://www.apple.com.cn/shop/bag`,
53
+ buyiPhone: `https://www.apple.com.cn/shop/buy-iphone`,
54
+ shoppingCartWithoutHost: `/shop/bag`,
55
+ buyiPhoneWithoutHost: `/shop/buy-iphone`,
56
+ }
57
+
58
+ export const Match_URL = `apple.com.cn`
59
+
60
+ // ********** 👇page Element👇 **********
61
+ const prefixCheckout = `checkout`
62
+ const prefixPickupContact = `${prefixCheckout}.pickupContact`
63
+ const prefixSelfPickupContact = `${prefixPickupContact}.selfPickupContact`
64
+ const prefixSelfContact = `${prefixSelfPickupContact}.selfContact`
65
+ const prefixAddressCheckout = `${prefixSelfContact}.address`
66
+
67
+ const prefixNationalIdSelf = `${prefixSelfPickupContact}.nationalIdSelf`
68
+
69
+ const prefixBill = `${prefixCheckout}.billing`
70
+ export const prefixBillingoptions = `${prefixBill}.billingoptions`
71
+
72
+ export const pageElementsId = {
73
+ shoppingCart: {
74
+ checkoutButton: `shoppingCart.actions.navCheckout`,
75
+ },
76
+ signIn: {
77
+ appleIdInput: `signIn.customerLogin.appleId`,
78
+ applePasswordInput: `signIn.customerLogin.password`,
79
+ loginSubmitButton: `signin-submit-button`,
80
+ guestLoginButon: `signIn.guestLogin.guestLogin`,
81
+ dataHandleByAppleCheckbox: `signIn.consentOverlay.dataHandleByApple`,
82
+ dataOutSideMyCountryCheckbox: `signIn.consentOverlay.dataOutSideMyCountry`,
83
+ acceptButton: `consent-overlay-accept-button`,
84
+ },
85
+ checkout: {
86
+ continuebutton: `rs-checkout-continue-button-bottom`,
87
+ fulfillment: {
88
+ selectPickupButton: `fulfillmentOptionButtonGroup1`,
89
+ },
90
+ pickupContact: {
91
+ lastName: `${prefixAddressCheckout}.lastName`,
92
+ firstName: `${prefixAddressCheckout}.firstName`,
93
+ emailAddress: `${prefixAddressCheckout}.emailAddress`,
94
+ mobile: `${prefixAddressCheckout}.fullDaytimePhone`,
95
+ last4Id: `${prefixNationalIdSelf}.nationalIdSelf`,
96
+ },
97
+ bill: {
98
+ alipay: `${prefixBillingoptions}.alipay`,
99
+ wechat: `${prefixBillingoptions}.wechat`,
100
+ huabei: `${prefixBillingoptions}.installments0001243254`,
101
+ cmb: `${prefixBillingoptions}.installments0001321713`,
102
+ ccb: `${prefixBillingoptions}.installments0000882476`,
103
+ icbc: `${prefixBillingoptions}.installments0000833448`,
104
+ },
105
+ },
106
+ }
107
+
108
+ // ********** 👆page Element👆 **********
109
+
110
+ // 付款方式
111
+ export enum BILL_OPTIONS_TYPE {
112
+ alipay = `支付宝`,
113
+ wechat = `微信`,
114
+ ccb = `建设银行`,
115
+ cmb = `招商银行`,
116
+ icbc = `工商银行`,
117
+ huabei = `花呗`,
118
+ }
119
+
120
+ export const billTypeKeys = _mapValues(BILL_OPTIONS_TYPE, (v, k) => {
121
+ return k
122
+ })
123
+ export const billItemList = [
124
+ {
125
+ id: billTypeKeys.alipay,
126
+ name: BILL_OPTIONS_TYPE.alipay,
127
+ },
128
+ {
129
+ id: billTypeKeys.wechat,
130
+ name: BILL_OPTIONS_TYPE.wechat,
131
+ },
132
+ {
133
+ id: billTypeKeys.ccb,
134
+ name: BILL_OPTIONS_TYPE.ccb,
135
+ },
136
+ {
137
+ id: billTypeKeys.cmb,
138
+ name: BILL_OPTIONS_TYPE.cmb,
139
+ },
140
+ {
141
+ id: billTypeKeys.icbc,
142
+ name: BILL_OPTIONS_TYPE.icbc,
143
+ },
144
+ {
145
+ id: billTypeKeys.huabei,
146
+ name: BILL_OPTIONS_TYPE.huabei,
147
+ },
148
+ ]
149
+
150
+ export const defaultiPhoneOrderConfig: IPHONEORDER_CONFIG = {
151
+ stepWait: 10,
152
+ // @ts-ignore
153
+ payBill: billTypeKeys.alipay,
154
+
155
+ afterCountThenReload: 50, // 重试次数超过之后重新刷新页面
156
+
157
+ voiceInfo: {
158
+ text: `抢到了`,
159
+ times: 3,
160
+ },
161
+ }
162
+
163
+ export const defaultPayinstallmentTotal = [
164
+ {
165
+ id: 0,
166
+ name: '不分期',
167
+ },
168
+ {
169
+ id: 3,
170
+ name: '3期',
171
+ includes: [billTypeKeys.ccb, billTypeKeys.cmb, billTypeKeys.huabei, billTypeKeys.icbc],
172
+ },
173
+ {
174
+ id: 6,
175
+ name: '6期',
176
+ includes: [billTypeKeys.ccb, billTypeKeys.cmb, billTypeKeys.huabei, billTypeKeys.icbc],
177
+ },
178
+ {
179
+ id: 12,
180
+ name: '12期',
181
+ includes: [billTypeKeys.ccb, billTypeKeys.cmb, billTypeKeys.huabei, billTypeKeys.icbc],
182
+ },
183
+ {
184
+ id: 24,
185
+ name: '24期',
186
+ includes: [billTypeKeys.ccb, billTypeKeys.cmb, billTypeKeys.icbc],
187
+ },
188
+ ]
189
+
190
+ export const commonHeaders = {
191
+ accept: '*/*',
192
+ 'accept-language': 'zh-CN,zh;q=0.9',
193
+ 'sec-ch-ua': '"Google Chrome";v="105", "Not)A;Brand";v="8", "Chromium";v="105"',
194
+ 'sec-ch-ua-mobile': '?0',
195
+ 'sec-ch-ua-platform': '"macOS"',
196
+ 'sec-fetch-dest': 'empty',
197
+ 'sec-fetch-mode': 'cors',
198
+ 'sec-fetch-site': 'same-origin',
199
+ // "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36",
200
+ referer: applePageUrl.buyiPhone,
201
+ // cookie: document.cookie,
202
+ }
203
+
204
+ export const fetchHeaders = {
205
+ ...commonHeaders,
206
+ 'cache-control': 'no-cache',
207
+ 'content-type': 'application/x-www-form-urlencoded',
208
+ // 'Content-Type': 'application/x-www-form-urlencoded',
209
+ Modelversion: 'v2',
210
+ pragma: 'no-cache',
211
+ syntax: 'graviton',
212
+ // "x-aos-model-page": "checkoutPage",
213
+ // "x-aos-stk": x_aos_stk,
214
+ 'X-Requested-With': 'Fetch',
215
+ }
216
+
217
+ export const defaultAres = {
218
+ cityName: `上海`,
219
+ provinceName: `上海`,
220
+ districtName: `闵行区`,
221
+ }
222
+
223
+ export const CHECKOUT_STEPS = {
224
+ selectStore: `?_a=select&_m=checkout.fulfillment.pickupTab.pickup.storeLocator`,
225
+ selectPickupTime: `?_a=continueFromFulfillmentToPickupContact&_m=checkout.fulfillment`,
226
+ checkoutFulfillment: `?_a=continueFromFulfillmentToPickupContact&_m=checkout.fulfillment`,
227
+ pickupContact: `?_a=continueFromPickupContactToBilling&_m=checkout.pickupContact`,
228
+ selectBill: `/billing?_a=selectBillingOptionAction&_m=checkout.billing.billingOptions`,
229
+ checkoutBill: `/billing?_a=continueFromBillingToReview&_m=checkout.billing`,
230
+ placeOrder: `?_a=continueFromReviewToProcess&_m=checkout.review.placeOrder`,
231
+ }
232
+
233
+ export const iframeMessagePass = {
234
+ iframeID: 'tips_iframe',
235
+ messageAction: 'updateFetchCount',
236
+ }
@@ -0,0 +1,25 @@
1
+ export interface IPHONEORDER_CONFIG {
2
+ lastName?: string
3
+ firstName?: string
4
+ mobile?: string | number
5
+ last4code?: string | number
6
+ appleId?: string
7
+ password?: string
8
+ stepWait: number
9
+ payBill: 'alipay' | 'wechat' | 'ccb' | 'cmb' | 'icbc' | 'huabei'
10
+ payInstallment?: number
11
+ provinceName?: string
12
+ cityName?: string
13
+ districtName?: string
14
+ employeeId?: string
15
+ afterCountThenReload: number
16
+ selfNotiAPI?: string
17
+ voiceInfo: VOICE_OBJ
18
+ }
19
+
20
+ export interface VOICE_OBJ {
21
+ text: string
22
+ voiceName?: string
23
+ lang?: string
24
+ times: number
25
+ }