@momo-kits/foundation 0.169.16-beta.29 → 0.169.16-beta.30

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.
package/Icon/index.tsx CHANGED
@@ -6,7 +6,468 @@ import { ApplicationContext, MiniAppContext } from '../Context';
6
6
  import { Image } from '../Image';
7
7
  import { StyleSheet } from 'react-native';
8
8
  import { Colors } from '../Consts';
9
- import { getIconSource, isNoThemeIcon, IconNewSources } from './utils';
9
+
10
+ type IconMap = { [key: string]: { uri: string } };
11
+
12
+ // Kept in this file on purpose: mini apps load foundation modules from the host
13
+ // app per file (Module Federation shares `@momo-kits/foundation/`), so a new file
14
+ // here crashes them on a host built with an older foundation.
15
+ const NEW_ICON_BASE_URL = 'https://img.mservice.com.vn/app/icon/kits/v2025/';
16
+
17
+ /** Keys of the 2025 icon set, served as `<NEW_ICON_BASE_URL><key>.png`. */
18
+ const NEW_ICON_KEYS = [
19
+ 'arrow_back',
20
+ 'arrow_bold_forward',
21
+ 'arrow_chevron_down',
22
+ 'arrow_chevron_down_small',
23
+ 'arrow_chevron_left',
24
+ 'arrow_chevron_left_small',
25
+ 'arrow_chevron_right',
26
+ 'arrow_chevron_right_small',
27
+ 'arrow_chevron_up',
28
+ 'arrow_chevron_up_small',
29
+ 'arrow_chevrons_double_down',
30
+ 'arrow_chevrons_double_left',
31
+ 'arrow_chevrons_double_up',
32
+ 'arrow_circle_chevron_right',
33
+ 'arrow_circle_chevron_top',
34
+ 'arrow_circle_chevrons_left',
35
+ 'arrow_circle_chevrons_right',
36
+ 'arrow_diagonals',
37
+ 'arrow_diagonals_bltr',
38
+ 'arrow_down',
39
+ 'arrow_next',
40
+ 'arrow_refresh_ccw',
41
+ 'arrow_reply',
42
+ 'arrow_rotate_ccw',
43
+ 'arrow_rotate_cw',
44
+ 'arrow_top',
45
+ 'arrow_undo_1',
46
+ 'arrow_undo_2',
47
+ 'basic_account',
48
+ 'basic_add_to_phone',
49
+ 'basic_cccd',
50
+ 'basic_change_account',
51
+ 'basic_chart',
52
+ 'basic_chart_line_up',
53
+ 'basic_chart_up',
54
+ 'basic_copy',
55
+ 'basic_delete',
56
+ 'basic_feed',
57
+ 'basic_filter',
58
+ 'basic_flag',
59
+ 'basic_flaged',
60
+ 'basic_help_center_1',
61
+ 'basic_help_center_2',
62
+ 'basic_home',
63
+ 'basic_moon',
64
+ 'basic_nfc',
65
+ 'basic_none_delete',
66
+ 'basic_options',
67
+ 'basic_person',
68
+ 'basic_person_add',
69
+ 'basic_person_group',
70
+ 'basic_power',
71
+ 'basic_quet_qr',
72
+ 'basic_setting',
73
+ 'basic_sorting',
74
+ 'basic_support',
75
+ 'basic_support_24h',
76
+ 'basic_thong_bao_tai_khoan',
77
+ 'basic_ticket',
78
+ 'basic_ticket_movie',
79
+ 'basic_ticket_star',
80
+ 'basic_translate',
81
+ 'basic_upload_photo',
82
+ 'basic_world',
83
+ 'bookmark_1',
84
+ 'bookmark_2',
85
+ 'bookmark_add',
86
+ 'bookmark_heart',
87
+ 'bookmark_star',
88
+ 'bookmark_x',
89
+ 'chatting_back_space',
90
+ 'chatting_comment',
91
+ 'chatting_comment_delete',
92
+ 'chatting_comment_empty',
93
+ 'chatting_q_and_a_left',
94
+ 'chatting_q_and_a_right',
95
+ 'chatting_request_money',
96
+ 'chatting_sent',
97
+ 'chatting_sticker',
98
+ 'connection_bluetooth',
99
+ 'connection_bluetooth_no',
100
+ 'connection_launch',
101
+ 'connection_link',
102
+ 'connection_link_disable',
103
+ 'connection_mail',
104
+ 'connection_share_1',
105
+ 'connection_share_2',
106
+ 'connection_wifi',
107
+ 'connection_wifi_no',
108
+ 'entertainment_home_movie_1',
109
+ 'entertainment_home_movie_2',
110
+ 'entertainment_movie_uni',
111
+ 'file_account_notebook',
112
+ 'file_bill_setting',
113
+ 'file_briefcase',
114
+ 'file_clipboard_check',
115
+ 'file_clipboard_note',
116
+ 'file_cloud_download',
117
+ 'file_cloud_upload',
118
+ 'file_download',
119
+ 'file_edit',
120
+ 'file_edit_in_box',
121
+ 'file_file',
122
+ 'file_file_create',
123
+ 'file_file_download',
124
+ 'file_file_plus',
125
+ 'file_file_search',
126
+ 'file_file_text',
127
+ 'file_folder',
128
+ 'file_folder_forward',
129
+ 'file_folder_opened',
130
+ 'file_folder_plus',
131
+ 'file_mail',
132
+ 'file_paperclip',
133
+ 'file_paperclip_no',
134
+ 'file_pin',
135
+ 'file_pinned',
136
+ 'file_unpin',
137
+ 'file_upload',
138
+ 'finance_card_1',
139
+ 'finance_card_2',
140
+ 'finance_card_jcb',
141
+ 'finance_card_master',
142
+ 'finance_card_visa',
143
+ 'finance_cash',
144
+ 'finance_chuyen_tien_ngan_hang',
145
+ 'finance_chuyen_tien_ngan_hang_2',
146
+ 'finance_credit_card',
147
+ 'finance_dat_lenh',
148
+ 'finance_jcb',
149
+ 'finance_legal_certifiacte',
150
+ 'finance_lien_ket_ngan_hang',
151
+ 'finance_lien_ket_ngan_hang_2',
152
+ 'finance_limit',
153
+ 'finance_master',
154
+ 'finance_money_arrow_down',
155
+ 'finance_money_arrow_up',
156
+ 'finance_money_bag',
157
+ 'finance_money_bag_plus',
158
+ 'finance_nap_tien_ngan_hang',
159
+ 'finance_nap_tien_ngan_hang_2',
160
+ 'finance_ngan_hang_1',
161
+ 'finance_ngan_hang_2',
162
+ 'finance_quan_ly',
163
+ 'finance_quan_ly_tai_khoan',
164
+ 'finance_rut_tien',
165
+ 'finance_rut_tien_ngan_hang',
166
+ 'finance_rut_tien_ngan_hang_2',
167
+ 'finance_safe_box',
168
+ 'finance_saving',
169
+ 'finance_stock',
170
+ 'finance_tax',
171
+ 'finance_visa',
172
+ 'finance_wallet',
173
+ 'finance_wallet_add',
174
+ 'finance_wallet_card',
175
+ 'gadgets_iphone',
176
+ 'gadgets_mobile',
177
+ 'gadgets_monitor',
178
+ 'gadgets_print',
179
+ 'gadgets_soft_disk',
180
+ 'logistics_delivery',
181
+ 'logistics_delivery_bike',
182
+ 'logistics_delivery_fast',
183
+ 'logistics_package',
184
+ 'logistics_package_cancel',
185
+ 'logistics_package_list',
186
+ 'maps_360',
187
+ 'maps_direction_45',
188
+ 'maps_location',
189
+ 'maps_map',
190
+ 'maps_pin',
191
+ 'maps_pin_round',
192
+ 'maps_pin_start',
193
+ 'maps_zoom_in',
194
+ 'maps_zoom_out',
195
+ 'media',
196
+ 'media_add',
197
+ 'media_camera',
198
+ 'media_camera_add',
199
+ 'media_camera_linked',
200
+ 'media_camera_switch',
201
+ 'media_collection',
202
+ 'media_control_point',
203
+ 'media_flash_on',
204
+ 'media_flashlight_on',
205
+ 'media_player_play_circle',
206
+ 'media_record',
207
+ 'media_repeat',
208
+ 'media_video',
209
+ 'media_volume',
210
+ 'media_volume_high',
211
+ 'media_volume_low',
212
+ 'media_volume_no',
213
+ 'media_volume_off',
214
+ 'momo_background_primary',
215
+ 'momo_background_white',
216
+ 'navigation_add_to_home',
217
+ 'navigation_app',
218
+ 'navigation_ar',
219
+ 'navigation_cash_in',
220
+ 'navigation_close',
221
+ 'navigation_close_circle',
222
+ 'navigation_close_circle_full',
223
+ 'navigation_full_screen',
224
+ 'navigation_menu',
225
+ 'navigation_minus_circle',
226
+ 'navigation_minus_circle_full',
227
+ 'navigation_more_action',
228
+ 'navigation_more_horiz',
229
+ 'navigation_more_vert',
230
+ 'navigation_plus',
231
+ 'navigation_plus_circle',
232
+ 'navigation_plus_circle_full',
233
+ 'navigation_qr_code',
234
+ 'navigation_remove_from_home',
235
+ 'navigation_scan_barcode',
236
+ 'navigation_search',
237
+ 'navigation_search_add',
238
+ 'navigation_search_minus',
239
+ 'notifications_alert_octagon',
240
+ 'notifications_alert_triangle',
241
+ 'notifications_bell',
242
+ 'notifications_bell_checked',
243
+ 'notifications_bell_no',
244
+ 'notifications_bell_setting',
245
+ 'notifications_bell_x',
246
+ 'notifications_check',
247
+ 'notifications_check_circle',
248
+ 'notifications_check_circle_full',
249
+ 'notifications_check_double',
250
+ 'notifications_circle_alert',
251
+ 'notifications_circle_question',
252
+ 'notifications_follow',
253
+ 'notifications_followed',
254
+ 'notifications_guide',
255
+ 'notifications_information',
256
+ 'notifications_x_octagon',
257
+ 'phone_call',
258
+ 'phone_call_mic_on',
259
+ 'phone_call_phone_calling',
260
+ 'phone_call_phonebook_outline',
261
+ 'reaction_dislike',
262
+ 'reaction_disliked',
263
+ 'reaction_heart',
264
+ 'reaction_heart_check',
265
+ 'reaction_heart_disable',
266
+ 'reaction_heart_full',
267
+ 'reaction_like',
268
+ 'reaction_liked',
269
+ 'reaction_star_check',
270
+ 'reaction_star_disable',
271
+ 'reaction_star_full',
272
+ 'reaction_star_half',
273
+ 'reaction_star_non',
274
+ 'security_account',
275
+ 'security_alert',
276
+ 'security_bug',
277
+ 'security_eye_off',
278
+ 'security_eye_open',
279
+ 'security_fingerprint',
280
+ 'security_hacker',
281
+ 'security_key',
282
+ 'security_keypass',
283
+ 'security_lock',
284
+ 'security_lock_no',
285
+ 'security_password',
286
+ 'security_phone_alert',
287
+ 'security_shield',
288
+ 'security_shield_check',
289
+ 'security_shield_setting_1',
290
+ 'security_shield_setting_2',
291
+ 'security_unlock',
292
+ 'security_verified_face_id',
293
+ 'shopping_add',
294
+ 'shopping_bag',
295
+ 'shopping_bag_shopping',
296
+ 'shopping_bill',
297
+ 'shopping_cart',
298
+ 'shopping_check',
299
+ 'shopping_coupon',
300
+ 'shopping_coupon_percent',
301
+ 'shopping_coupon_star',
302
+ 'shopping_fast_food',
303
+ 'shopping_free',
304
+ 'shopping_gift_box',
305
+ 'shopping_gift_card',
306
+ 'shopping_scan_money',
307
+ 'shopping_store',
308
+ 'shopping_tag',
309
+ 'shopping_x',
310
+ 'time_alarm',
311
+ 'time_alarm_check',
312
+ 'time_calendar_1',
313
+ 'time_calendar_2',
314
+ 'time_calendar_add',
315
+ 'time_calendar_checked',
316
+ 'time_calendar_edit',
317
+ 'time_calendar_fire',
318
+ 'time_calendar_heart',
319
+ 'time_calendar_setting',
320
+ 'time_calendar_star',
321
+ 'time_calendar_x',
322
+ 'time_clock',
323
+ 'time_clock_reset',
324
+ 'time_note',
325
+ 'time_stop_watch',
326
+ 'travel_air_conditional',
327
+ 'travel_apartment',
328
+ 'travel_apartment_hotel',
329
+ 'travel_apartments',
330
+ 'travel_bathtub',
331
+ 'travel_bed',
332
+ 'travel_bed_single',
333
+ 'travel_bike',
334
+ 'travel_bus',
335
+ 'travel_business',
336
+ 'travel_camping',
337
+ 'travel_car',
338
+ 'travel_children_area',
339
+ 'travel_environment_friendly',
340
+ 'travel_family',
341
+ 'travel_fridge',
342
+ 'travel_healing',
343
+ 'travel_historical_place',
344
+ 'travel_homestay',
345
+ 'travel_kitchen',
346
+ 'travel_led_light',
347
+ 'travel_luxury_place',
348
+ 'travel_luxury_place_2',
349
+ 'travel_outdoor_table',
350
+ 'travel_people_baby',
351
+ 'travel_people_kid',
352
+ 'travel_people_man',
353
+ 'travel_people_wheelchair',
354
+ 'travel_plane',
355
+ 'travel_plane_landing',
356
+ 'travel_plane_take_off',
357
+ 'travel_pool',
358
+ 'travel_private_room',
359
+ 'travel_resort',
360
+ 'travel_romantic',
361
+ 'travel_romantical_place',
362
+ 'travel_ship',
363
+ 'travel_subway',
364
+ 'travel_suitcase',
365
+ 'travel_taxi',
366
+ 'travel_tram',
367
+ 'travel_van',
368
+ 'travel_villa',
369
+ ];
370
+
371
+ /** Legacy key -> replacement key in the new set. Legacy keys keep rendering. */
372
+ const DEPRECATED_ICONS: { [key: string]: string } = {
373
+ Phonebook: 'phone_call_phonebook_outline',
374
+ 'arrow-back': 'arrow_back',
375
+ 'arrow_arrow-down': 'arrow_down',
376
+ 'arrow_arrow-next': 'arrow_next',
377
+ 'arrow_arrow-top': 'arrow_top',
378
+ arrow_arrow_bold_forward: 'arrow_bold_forward',
379
+ arrow_arrow_reply: 'arrow_reply',
380
+ arrow_arrow_undo: 'arrow_undo_2',
381
+ arrow_undo: 'arrow_undo_1',
382
+ basic_Moon: 'basic_moon',
383
+ chat_back_space: 'chatting_back_space',
384
+ chat_comment: 'chatting_comment',
385
+ chat_comment_delete: 'chatting_comment_delete',
386
+ chat_comment_empty: 'chatting_comment_empty',
387
+ chat_q_and_a: 'chatting_q_and_a_right',
388
+ chat_sent: 'chatting_sent',
389
+ chat_sticker: 'chatting_sticker',
390
+ connection_share: 'connection_share_1',
391
+ file_Billsetting: 'file_bill_setting',
392
+ file_clipboard_checked: 'file_clipboard_check',
393
+ file_plus: 'file_file_plus',
394
+ file_search: 'file_file_search',
395
+ file_text: 'file_file_text',
396
+ finance_safe: 'finance_safe_box',
397
+ help_center: 'basic_help_center_1',
398
+ logicstics_delivery: 'logistics_delivery',
399
+ logicstics_delivery_fast: 'logistics_delivery_fast',
400
+ logicstics_delivey_bike: 'logistics_delivery_bike',
401
+ logicstics_package: 'logistics_package',
402
+ logicstics_package_cancel: 'logistics_package_cancel',
403
+ logicstics_package_list: 'logistics_package_list',
404
+ navigation_AR: 'navigation_ar',
405
+ navigation_close_circle_full_2: 'navigation_close_circle_full',
406
+ navigation_qrcode: 'navigation_qr_code',
407
+ phonebook_outline: 'phone_call_phonebook_outline',
408
+ security_verifiedface_id: 'security_verified_face_id',
409
+ time_calendar: 'time_calendar_1',
410
+ travel_airconditional: 'travel_air_conditional',
411
+ 'travel_bed-single': 'travel_bed_single',
412
+ travel_kid_area: 'travel_children_area',
413
+ travel_led_Light: 'travel_led_light',
414
+ travel_people_family: 'travel_family',
415
+ };
416
+
417
+ const NEW_ICONS: { [key: string]: { uri: string } } = Object.fromEntries(
418
+ NEW_ICON_KEYS.map(key => [key, { uri: `${NEW_ICON_BASE_URL}${key}.png` }]),
419
+ );
420
+
421
+ const OLD_ICONS: IconMap = IconSources;
422
+ const FALLBACK_ICON = 'ic_warning';
423
+
424
+ /**
425
+ * Multicolor brand glyphs that keep their own colors; tinting turns them into
426
+ * solid blocks. Parity with native `noThemeIcons`.
427
+ */
428
+ const NO_THEME_ICONS = new Set<string>([
429
+ 'ic_round_momo_tiny',
430
+ 'finance_card_visa',
431
+ 'finance_card_jcb',
432
+ 'finance_card_master',
433
+ 'finance_visa',
434
+ 'finance_jcb',
435
+ 'finance_master',
436
+ 'momo_background_white',
437
+ 'momo_background_primary',
438
+ ]);
439
+
440
+ const isNoThemeIcon = (source: string) => NO_THEME_ICONS.has(source);
441
+
442
+ const warnedKeys = new Set<string>();
443
+
444
+ /**
445
+ * Warns once per key in dev when a deprecated icon name is used, pointing to
446
+ * its replacement in the new icon set.
447
+ */
448
+ const warnDeprecatedIcon = (source: string) => {
449
+ const replacement = DEPRECATED_ICONS[source];
450
+ if (!__DEV__ || !replacement || warnedKeys.has(source)) {
451
+ return;
452
+ }
453
+ warnedKeys.add(source);
454
+ console.warn(
455
+ `[@momo-kits] Icon "${source}" is deprecated, use "${replacement}" instead.`,
456
+ );
457
+ };
458
+
459
+ /**
460
+ * Resolves an icon name or URL to an image source. Lookup order: new set,
461
+ * old set, then `ic_warning`.
462
+ */
463
+ const getIconSource = (source: string): { uri: string } => {
464
+ if (!source || source.includes('http')) {
465
+ return { uri: source };
466
+ }
467
+ warnDeprecatedIcon(source);
468
+ const icon = NEW_ICONS[source] ?? OLD_ICONS[source];
469
+ return icon ?? OLD_ICONS[FALLBACK_ICON];
470
+ };
10
471
 
11
472
  /**
12
473
  * Tinted icon from the bundled icon map (unknown names fall back to
@@ -26,8 +487,8 @@ const Icon: React.FC<IconProps> = ({
26
487
  const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
27
488
 
28
489
  const tintColor = color ?? theme.colors.text.default;
29
- const tintColorProps =
30
- color !== null && !isNoThemeIcon(source) && { tintColor };
490
+ const tintColorProps = color !== null &&
491
+ !isNoThemeIcon(source) && { tintColor };
31
492
 
32
493
  return (
33
494
  <Image
@@ -49,4 +510,10 @@ const styles = StyleSheet.create({
49
510
  debugBaseLine: { borderWidth: 1, borderColor: Colors.green_06 },
50
511
  });
51
512
 
52
- export { Icon, IconSources, IconBankSources, IconNewSources };
513
+ export {
514
+ Icon,
515
+ IconSources,
516
+ IconBankSources,
517
+ NEW_ICONS as IconNewSources,
518
+ DEPRECATED_ICONS as IconDeprecatedSources,
519
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.169.16-beta.29",
3
+ "version": "0.169.16-beta.30",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},
@@ -1,44 +0,0 @@
1
- {
2
- "Phonebook": "phone_call_phonebook_outline",
3
- "arrow-back": "arrow_back",
4
- "arrow_arrow-down": "arrow_down",
5
- "arrow_arrow-next": "arrow_next",
6
- "arrow_arrow-top": "arrow_top",
7
- "arrow_arrow_bold_forward": "arrow_bold_forward",
8
- "arrow_arrow_reply": "arrow_reply",
9
- "arrow_arrow_undo": "arrow_undo_2",
10
- "arrow_undo": "arrow_undo_1",
11
- "basic_Moon": "basic_moon",
12
- "chat_back_space": "chatting_back_space",
13
- "chat_comment": "chatting_comment",
14
- "chat_comment_delete": "chatting_comment_delete",
15
- "chat_comment_empty": "chatting_comment_empty",
16
- "chat_q_and_a": "chatting_q_and_a_right",
17
- "chat_sent": "chatting_sent",
18
- "chat_sticker": "chatting_sticker",
19
- "connection_share": "connection_share_1",
20
- "file_Billsetting": "file_bill_setting",
21
- "file_clipboard_checked": "file_clipboard_check",
22
- "file_plus": "file_file_plus",
23
- "file_search": "file_file_search",
24
- "file_text": "file_file_text",
25
- "finance_safe": "finance_safe_box",
26
- "help_center": "basic_help_center_1",
27
- "logicstics_delivery": "logistics_delivery",
28
- "logicstics_delivery_fast": "logistics_delivery_fast",
29
- "logicstics_delivey_bike": "logistics_delivery_bike",
30
- "logicstics_package": "logistics_package",
31
- "logicstics_package_cancel": "logistics_package_cancel",
32
- "logicstics_package_list": "logistics_package_list",
33
- "navigation_AR": "navigation_ar",
34
- "navigation_close_circle_full_2": "navigation_close_circle_full",
35
- "navigation_qrcode": "navigation_qr_code",
36
- "phonebook_outline": "phone_call_phonebook_outline",
37
- "security_verifiedface_id": "security_verified_face_id",
38
- "time_calendar": "time_calendar_1",
39
- "travel_airconditional": "travel_air_conditional",
40
- "travel_bed-single": "travel_bed_single",
41
- "travel_kid_area": "travel_children_area",
42
- "travel_led_Light": "travel_led_light",
43
- "travel_people_family": "travel_family"
44
- }