@zohodesk/i18n 1.0.0-beta.4 → 1.0.0-beta.40-murphy
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/README.md +130 -4
- package/docs/murphy/01-MURPHY_OVERVIEW.md +148 -0
- package/docs/murphy/02-MURPHY_ARCHITECTURE.md +283 -0
- package/docs/murphy/03-MURPHY_BACKEND_CONFIG.md +337 -0
- package/docs/murphy/04-MURPHY_FRONTEND_INIT.md +437 -0
- package/docs/murphy/05-MURPHY_DESK_CLIENT_USAGE.md +467 -0
- package/docs/murphy/06-MURPHY_I18N_INTEGRATION.md +402 -0
- package/docs/murphy/07-MURPHY_WHY_I18N_APPROACH.md +391 -0
- package/es/I18NContext.js +1 -2
- package/es/components/DateTimeDiffFormat.js +185 -209
- package/es/components/FormatText.js +7 -27
- package/es/components/HOCI18N.js +35 -58
- package/es/components/I18N.js +48 -74
- package/es/components/I18NProvider.js +59 -93
- package/es/components/PluralFormat.js +28 -51
- package/es/components/UserTimeDiffFormat.js +66 -81
- package/es/components/__tests__/DateTimeDiffFormat.spec.js +810 -663
- package/es/components/__tests__/FormatText.spec.js +22 -19
- package/es/components/__tests__/HOCI18N.spec.js +19 -25
- package/es/components/__tests__/I18N.spec.js +23 -21
- package/es/components/__tests__/I18NProvider.spec.js +38 -47
- package/es/components/__tests__/PluralFormat.spec.js +23 -20
- package/es/components/__tests__/UserTimeDiffFormat.spec.js +1259 -1110
- package/es/index.js +13 -15
- package/es/utils/__tests__/jsxTranslations.spec.js +170 -0
- package/es/utils/errorReporter.js +109 -0
- package/es/utils/index.js +543 -0
- package/es/utils/jsxTranslations.js +185 -0
- package/lib/I18NContext.js +5 -10
- package/lib/components/DateTimeDiffFormat.js +131 -146
- package/lib/components/FormatText.js +29 -42
- package/lib/components/HOCI18N.js +34 -45
- package/lib/components/I18N.js +46 -57
- package/lib/components/I18NProvider.js +72 -95
- package/lib/components/PluralFormat.js +39 -55
- package/lib/components/UserTimeDiffFormat.js +76 -84
- package/lib/components/__tests__/DateTimeDiffFormat.spec.js +751 -635
- package/lib/components/__tests__/FormatText.spec.js +21 -30
- package/lib/components/__tests__/HOCI18N.spec.js +22 -41
- package/lib/components/__tests__/I18N.spec.js +20 -33
- package/lib/components/__tests__/I18NProvider.spec.js +40 -63
- package/lib/components/__tests__/PluralFormat.spec.js +23 -35
- package/lib/components/__tests__/UserTimeDiffFormat.spec.js +1195 -1046
- package/lib/index.js +95 -104
- package/lib/utils/__tests__/jsxTranslations.spec.js +172 -0
- package/lib/utils/errorReporter.js +137 -0
- package/lib/utils/index.js +583 -0
- package/lib/utils/jsxTranslations.js +216 -0
- package/package.json +4 -3
- package/src/components/DateTimeDiffFormat.js +84 -55
- package/src/components/I18N.js +2 -0
- package/src/components/I18NProvider.js +44 -33
- package/src/components/UserTimeDiffFormat.js +22 -18
- package/src/index.js +14 -9
- package/src/utils/__tests__/jsxTranslations.spec.js +213 -0
- package/src/utils/errorReporter.js +129 -0
- package/src/utils/index.js +644 -0
- package/src/utils/jsxTranslations.js +199 -0
- package/es/components/NewDateFormat.js +0 -50
- package/es/offset.js +0 -629
- package/es/timezones.js +0 -118
- package/es/utils.js +0 -621
- package/lib/components/NewDateFormat.js +0 -68
- package/lib/offset.js +0 -634
- package/lib/timezones.js +0 -129
- package/lib/utils.js +0 -651
- package/src/components/NewDateFormat.js +0 -60
- package/src/offset.js +0 -629
- package/src/timezones.js +0 -113
- package/src/utils.js +0 -648
package/README.md
CHANGED
|
@@ -1,13 +1,139 @@
|
|
|
1
1
|
# i18n
|
|
2
2
|
|
|
3
|
-
# 1.0.0-beta.
|
|
3
|
+
# 1.0.0-beta.34
|
|
4
4
|
|
|
5
|
-
-
|
|
5
|
+
- Tagholder Replacement with React Component
|
|
6
6
|
|
|
7
|
-
# 1.0.0-beta.
|
|
7
|
+
# 1.0.0-beta.33
|
|
8
8
|
|
|
9
|
-
-
|
|
9
|
+
- Upgrading @zoho/SecurityJS package to 7.2.4
|
|
10
|
+
|
|
11
|
+
# 1.0.0-beta.32
|
|
12
|
+
|
|
13
|
+
- Upgrading @zoho/SecurityJS package to 7.2.0
|
|
14
|
+
|
|
15
|
+
# 1.0.0-beta.31
|
|
16
|
+
|
|
17
|
+
- Syntax correction in Update Flow
|
|
18
|
+
|
|
19
|
+
# 1.0.0-beta.30
|
|
20
|
+
|
|
21
|
+
- Upgrading @zoho/SecurityJS package to 6.4.2
|
|
22
|
+
|
|
23
|
+
# 1.0.0-beta.29
|
|
24
|
+
|
|
25
|
+
- Downgrading @zoho/SecurityJS package to 6.3.0
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# 1.0.0-beta.28
|
|
29
|
+
|
|
30
|
+
- Updating @zoho/SecurityJS package to 7.0.2
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# 1.0.0-beta.27
|
|
34
|
+
|
|
35
|
+
- JSX support within a text
|
|
36
|
+
|
|
37
|
+
# 1.0.0-beta.26
|
|
38
|
+
|
|
39
|
+
- Localization feature enhancement in i18n method.
|
|
40
|
+
|
|
41
|
+
# 1.0.0-beta.25
|
|
42
|
+
|
|
43
|
+
- July i18n key correction
|
|
44
|
+
|
|
45
|
+
# 1.0.0-beta.24
|
|
46
|
+
|
|
47
|
+
- I18N support for Days, Months and 12-hour time variables.
|
|
48
|
+
|
|
49
|
+
# 1.0.0-beta.23
|
|
50
|
+
|
|
51
|
+
- Zoho security version updated.
|
|
52
|
+
|
|
53
|
+
# 1.0.0-beta.22
|
|
54
|
+
|
|
55
|
+
- Data test id added for I18N.js
|
|
56
|
+
|
|
57
|
+
# 1.0.0-beta.21
|
|
58
|
+
|
|
59
|
+
- Data test id added for dateTimedifformat.js
|
|
60
|
+
|
|
61
|
+
# 1.0.0-beta.20
|
|
62
|
+
|
|
63
|
+
- Date field issue fixed in UserTimeDiffFormat component
|
|
64
|
+
|
|
65
|
+
# 1.0.0-beta.19
|
|
66
|
+
|
|
67
|
+
- In this version we have made changes in i18n provider to call user date format function only if the time zone data is available.
|
|
68
|
+
|
|
69
|
+
# 1.0.0-beta.18
|
|
70
|
+
|
|
71
|
+
- Localization feature added and incorporated into getI18NValue Method.
|
|
72
|
+
|
|
73
|
+
# 1.0.0-beta.17
|
|
74
|
+
|
|
75
|
+
- There was some i18n changes done in live before moving the date format build to live. Since we need these changes we have published it as new version.
|
|
76
|
+
|
|
77
|
+
# 1.0.0-beta.16
|
|
78
|
+
|
|
79
|
+
- DatePattern and dateTimePattern key has been changed for the date format build.
|
|
80
|
+
|
|
81
|
+
# 1.0.0-beta.15.1
|
|
82
|
+
|
|
83
|
+
- Zoho security version updated.
|
|
84
|
+
|
|
85
|
+
# 1.0.0-beta.15
|
|
86
|
+
|
|
87
|
+
- When working on date format build we have published I18n. Also, before moving date format build to master we had a emergency fix that need to be sent, so when publishing I18n we have published the date format changes with the next version.
|
|
88
|
+
|
|
89
|
+
# 1.0.0-beta.14
|
|
90
|
+
|
|
91
|
+
- Issue fixed in enable current year.
|
|
92
|
+
|
|
93
|
+
# 1.0.0-beta.13
|
|
94
|
+
|
|
95
|
+
- Issue fixed in due date.
|
|
96
|
+
|
|
97
|
+
# 1.0.0-beta.12
|
|
98
|
+
|
|
99
|
+
- Issue fixed in date Format Pattern.
|
|
100
|
+
|
|
101
|
+
# 1.0.0-beta.11
|
|
102
|
+
|
|
103
|
+
- Date Format Changes
|
|
104
|
+
|
|
105
|
+
# 1.0.0-beta.10
|
|
106
|
+
|
|
107
|
+
- Date Format Issue Fixes
|
|
108
|
+
|
|
109
|
+
# 1.0.0-beta.9
|
|
110
|
+
|
|
111
|
+
- Date Format Changes
|
|
112
|
+
|
|
113
|
+
# 1.0.0-beta.8
|
|
114
|
+
|
|
115
|
+
- ES Module Support Changes
|
|
116
|
+
|
|
117
|
+
# 1.0.0-beta.7
|
|
118
|
+
|
|
119
|
+
- 'userDateFormat' util method - 'others' function fix
|
|
120
|
+
|
|
121
|
+
# 1.0.0-beta.6
|
|
122
|
+
|
|
123
|
+
- Added new prop 'isNeedTime' for DateTimeDiffFormat Component
|
|
124
|
+
|
|
125
|
+
# 1.0.0-beta.5
|
|
126
|
+
|
|
127
|
+
- Timezone logic moved to @zohodesk/datetimejs
|
|
10
128
|
|
|
11
129
|
# 1.0.0-beta.4
|
|
12
130
|
|
|
13
131
|
- Added new prop 'page' for DateTimeDiffFormat Component
|
|
132
|
+
|
|
133
|
+
# 1.0.0-beta.3
|
|
134
|
+
|
|
135
|
+
- Added support for exact times along with relative times in format() function
|
|
136
|
+
|
|
137
|
+
# 1.0.0-beta.0
|
|
138
|
+
|
|
139
|
+
- Test Publish
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# Murphy SDK Overview
|
|
2
|
+
|
|
3
|
+
## What is Murphy?
|
|
4
|
+
|
|
5
|
+
Murphy is Zoho's internal **error tracking and monitoring SDK**. It's similar to popular monitoring tools like:
|
|
6
|
+
- Sentry
|
|
7
|
+
- Datadog
|
|
8
|
+
- LogRocket
|
|
9
|
+
- Bugsnag
|
|
10
|
+
|
|
11
|
+
Murphy is specifically designed for Zoho's ecosystem and integrates seamlessly with Zoho's infrastructure across all datacenters.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Why Murphy in Zoho Desk?
|
|
16
|
+
|
|
17
|
+
Murphy helps us monitor the health of our JavaScript applications in production:
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
21
|
+
│ Without Murphy │ With Murphy │
|
|
22
|
+
├────────────────────────────────┼────────────────────────────┤
|
|
23
|
+
│ │ │
|
|
24
|
+
│ User sees error │ User sees error │
|
|
25
|
+
│ ↓ │ ↓ │
|
|
26
|
+
│ User reports to support │ Murphy logs automatically │
|
|
27
|
+
│ ↓ │ ↓ │
|
|
28
|
+
│ Support creates ticket │ Team sees in dashboard │
|
|
29
|
+
│ ↓ │ ↓ │
|
|
30
|
+
│ Dev tries to reproduce │ Full stack trace + context│
|
|
31
|
+
│ ↓ │ ↓ │
|
|
32
|
+
│ "Works on my machine" 😫 │ Fix deployed quickly 🎉 │
|
|
33
|
+
│ │ │
|
|
34
|
+
└────────────────────────────────┴────────────────────────────┘
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Murphy SDK Capabilities
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
43
|
+
│ MURPHY SDK FEATURES │
|
|
44
|
+
├─────────────────────────────────────────────────────────────┤
|
|
45
|
+
│ │
|
|
46
|
+
│ ┌─────────────────────┐ ┌─────────────────────┐ │
|
|
47
|
+
│ │ Error Tracking │ │ Performance Monitor │ │
|
|
48
|
+
│ ├─────────────────────┤ ├─────────────────────┤ │
|
|
49
|
+
│ │ murphy.error() │ │ murphy.clientmetrics│ │
|
|
50
|
+
│ │ murphy.addCustom │ │ Time to Interactive │ │
|
|
51
|
+
│ │ Tracking() │ │ Soft Navigation │ │
|
|
52
|
+
│ │ Custom error tags │ │ Web Vitals │ │
|
|
53
|
+
│ └─────────────────────┘ └─────────────────────┘ │
|
|
54
|
+
│ │
|
|
55
|
+
│ ┌─────────────────────┐ ┌─────────────────────┐ │
|
|
56
|
+
│ │ User Behavior │ │ Logging │ │
|
|
57
|
+
│ ├─────────────────────┤ ├─────────────────────┤ │
|
|
58
|
+
│ │ Rage Clicks │ │ murphy.appLog() │ │
|
|
59
|
+
│ │ Rage Requests │ │ INFO level │ │
|
|
60
|
+
│ │ Session Telemetry │ │ WARN level │ │
|
|
61
|
+
│ │ User Actions │ │ SEVERE level │ │
|
|
62
|
+
│ └─────────────────────┘ └─────────────────────┘ │
|
|
63
|
+
│ │
|
|
64
|
+
└─────────────────────────────────────────────────────────────┘
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Key Murphy Methods
|
|
70
|
+
|
|
71
|
+
### 1. Error Tracking
|
|
72
|
+
```javascript
|
|
73
|
+
// Report JavaScript errors
|
|
74
|
+
murphy.error(error, undefined, {
|
|
75
|
+
customTags: {
|
|
76
|
+
module: 'tickets',
|
|
77
|
+
action: 'save'
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### 2. Application Logging
|
|
83
|
+
```javascript
|
|
84
|
+
// Log application events
|
|
85
|
+
murphy.appLog('INFO', 'User clicked save button', {
|
|
86
|
+
ticketId: '12345'
|
|
87
|
+
});
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### 3. Custom Tracking
|
|
91
|
+
```javascript
|
|
92
|
+
// Track custom events
|
|
93
|
+
murphy.addCustomTracking({
|
|
94
|
+
event: 'feature_used',
|
|
95
|
+
feature: 'bulk_update'
|
|
96
|
+
});
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 4. Performance Metrics
|
|
100
|
+
```javascript
|
|
101
|
+
// Track page load performance
|
|
102
|
+
murphy.clientmetrics.setTimeToInteractive();
|
|
103
|
+
|
|
104
|
+
// Track route changes
|
|
105
|
+
murphy.clientmetrics.startSoftNavigation('tickets-list');
|
|
106
|
+
murphy.clientmetrics.endSoftNavigation('tickets-list');
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Murphy Dashboard
|
|
112
|
+
|
|
113
|
+
All logged data appears in the Murphy dashboard where teams can:
|
|
114
|
+
|
|
115
|
+
- **View error trends** - See error frequency over time
|
|
116
|
+
- **Group similar errors** - Automatic grouping by stack trace
|
|
117
|
+
- **Filter by tags** - Find errors by module, user, datacenter
|
|
118
|
+
- **Track performance** - Monitor load times and web vitals
|
|
119
|
+
- **Set alerts** - Get notified when error rates spike
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Murphy in Zoho Infrastructure
|
|
124
|
+
|
|
125
|
+
Murphy is deployed across all Zoho datacenters:
|
|
126
|
+
|
|
127
|
+
| Datacenter | Murphy Domain |
|
|
128
|
+
|------------|---------------|
|
|
129
|
+
| US | murphy.zoho.com |
|
|
130
|
+
| EU | murphy.zoho.eu |
|
|
131
|
+
| IN | murphy.zoho.in |
|
|
132
|
+
| JP | murphy.zoho.jp |
|
|
133
|
+
| CN | murphy.zoho.com.cn |
|
|
134
|
+
| AU | murphy.zoho.com.au |
|
|
135
|
+
| CA | murphy.zoho.ca |
|
|
136
|
+
|
|
137
|
+
Each datacenter has its own Murphy instance for data residency compliance.
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Related Documents
|
|
142
|
+
|
|
143
|
+
- [02-MURPHY_ARCHITECTURE.md](./02-MURPHY_ARCHITECTURE.md) - Full architecture diagrams
|
|
144
|
+
- [03-MURPHY_BACKEND_CONFIG.md](./03-MURPHY_BACKEND_CONFIG.md) - Server configuration
|
|
145
|
+
- [04-MURPHY_FRONTEND_INIT.md](./04-MURPHY_FRONTEND_INIT.md) - Client initialization
|
|
146
|
+
- [05-MURPHY_DESK_CLIENT_USAGE.md](./05-MURPHY_DESK_CLIENT_USAGE.md) - Usage in desk client
|
|
147
|
+
- [06-MURPHY_I18N_INTEGRATION.md](./06-MURPHY_I18N_INTEGRATION.md) - i18n library integration
|
|
148
|
+
- [07-MURPHY_WHY_I18N_APPROACH.md](./07-MURPHY_WHY_I18N_APPROACH.md) - Why i18n approach
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
# Murphy Architecture in Zoho Desk
|
|
2
|
+
|
|
3
|
+
## Complete Architecture Diagram
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
┌──────────────────────────────────────────────────────────────────────────────┐
|
|
7
|
+
│ MURPHY ARCHITECTURE IN ZOHO DESK │
|
|
8
|
+
├──────────────────────────────────────────────────────────────────────────────┤
|
|
9
|
+
│ │
|
|
10
|
+
│ ┌────────────────────────────────────────────────────────────────────────┐ │
|
|
11
|
+
│ │ SERVER SIDE (Java Backend) │ │
|
|
12
|
+
│ ├────────────────────────────────────────────────────────────────────────┤ │
|
|
13
|
+
│ │ │ │
|
|
14
|
+
│ │ ┌───────────────────────────────────────────────────────────────────┐ │ │
|
|
15
|
+
│ │ │ dcurl.properties (Region-specific credentials) │ │ │
|
|
16
|
+
│ │ │ /product_package/conf/ZohoSupport/dcurl.properties │ │ │
|
|
17
|
+
│ │ │ │ │ │
|
|
18
|
+
│ │ │ dcurl.desk.murphy.appkey_US = 755747375 │ │ │
|
|
19
|
+
│ │ │ dcurl.desk.murphy.appkey_JP = 90001069766 │ │ │
|
|
20
|
+
│ │ │ dcurl.desk.murphy.appkey_IN = 60013588960 │ │ │
|
|
21
|
+
│ │ │ dcurl.desk.murphy.appdomain_US = murphy.zoho.com │ │ │
|
|
22
|
+
│ │ │ dcurl.desk.murphy.appdomain_JP = murphy.zoho.jp │ │ │
|
|
23
|
+
│ │ │ dcurl.desk.murphy.authKey_US = BPEEOUVxexAB... │ │ │
|
|
24
|
+
│ │ └───────────────────────────────────────────────────────────────────┘ │ │
|
|
25
|
+
│ │ │ │ │
|
|
26
|
+
│ │ ▼ │ │
|
|
27
|
+
│ │ ┌───────────────────────────────────────────────────────────────────┐ │ │
|
|
28
|
+
│ │ │ MurphyConstants.java │ │ │
|
|
29
|
+
│ │ │ /com/adventnet/support/common/util/MurphyConstants.java │ │ │
|
|
30
|
+
│ │ │ │ │ │
|
|
31
|
+
│ │ │ APP_KEY = Configuration.getString("...murphy.appkey") │ │ │
|
|
32
|
+
│ │ │ AUTH_KEY = Configuration.getString("...murphy.authKey") │ │ │
|
|
33
|
+
│ │ │ APP_DOMAIN = Configuration.getString("...murphy.appdomain") │ │ │
|
|
34
|
+
│ │ └───────────────────────────────────────────────────────────────────┘ │ │
|
|
35
|
+
│ │ │ │ │
|
|
36
|
+
│ │ ▼ │ │
|
|
37
|
+
│ │ ┌───────────────────────────────────────────────────────────────────┐ │ │
|
|
38
|
+
│ │ │ ClientInitUtil.java │ │ │
|
|
39
|
+
│ │ │ /com/zoho/desk/client/util/ClientInitUtil.java │ │ │
|
|
40
|
+
│ │ │ │ │ │
|
|
41
|
+
│ │ │ getDeskUrls(request) { │ │ │
|
|
42
|
+
│ │ │ deskUrls.put("murphyAppKey", MurphyConstants.APP_KEY); │ │ │
|
|
43
|
+
│ │ │ deskUrls.put("murphyAppDomain", MurphyConstants.APP_DOMAIN); │ │ │
|
|
44
|
+
│ │ │ deskUrls.put("murphyAuthKey", MurphyConstants.AUTH_KEY); │ │ │
|
|
45
|
+
│ │ │ } │ │ │
|
|
46
|
+
│ │ └───────────────────────────────────────────────────────────────────┘ │ │
|
|
47
|
+
│ │ │ │ │
|
|
48
|
+
│ └───────────────────────────────│─────────────────────────────────────────┘ │
|
|
49
|
+
│ │ │
|
|
50
|
+
│ ▼ HTTP Response with embedded <script> │
|
|
51
|
+
│ │
|
|
52
|
+
│ ┌────────────────────────────────────────────────────────────────────────┐ │
|
|
53
|
+
│ │ CLIENT SIDE (Browser) │ │
|
|
54
|
+
│ ├────────────────────────────────────────────────────────────────────────┤ │
|
|
55
|
+
│ │ │ │
|
|
56
|
+
│ │ ┌───────────────────────────────────────────────────────────────────┐ │ │
|
|
57
|
+
│ │ │ index.html (Server-rendered) │ │ │
|
|
58
|
+
│ │ │ │ │ │
|
|
59
|
+
│ │ │ <script nonce="..."> │ │ │
|
|
60
|
+
│ │ │ var desk_urls = { │ │ │
|
|
61
|
+
│ │ │ murphyAppKey: "755747375", │ │ │
|
|
62
|
+
│ │ │ murphyAppDomain: "murphy.zoho.com", │ │ │
|
|
63
|
+
│ │ │ murphyAuthKey: "BPEEOUVxexAB..." │ │ │
|
|
64
|
+
│ │ │ }; │ │ │
|
|
65
|
+
│ │ │ </script> │ │ │
|
|
66
|
+
│ │ └───────────────────────────────────────────────────────────────────┘ │ │
|
|
67
|
+
│ │ │ │ │
|
|
68
|
+
│ │ ▼ │ │
|
|
69
|
+
│ │ ┌───────────────────────────────────────────────────────────────────┐ │ │
|
|
70
|
+
│ │ │ Murphy SDK (CDN loaded) │ │ │
|
|
71
|
+
│ │ │ https://static.zoho.com/murphysdk/3.0.0/murphy.min.js │ │ │
|
|
72
|
+
│ │ │ │ │ │
|
|
73
|
+
│ │ │ Creates global: window.murphy │ │ │
|
|
74
|
+
│ │ └───────────────────────────────────────────────────────────────────┘ │ │
|
|
75
|
+
│ │ │ │ │
|
|
76
|
+
│ │ ▼ │ │
|
|
77
|
+
│ │ ┌───────────────────────────────────────────────────────────────────┐ │ │
|
|
78
|
+
│ │ │ murphy/initial_html/utils.js │ │ │
|
|
79
|
+
│ │ │ │ │ │
|
|
80
|
+
│ │ │ murphyInit() { │ │ │
|
|
81
|
+
│ │ │ murphy.install({ │ │ │
|
|
82
|
+
│ │ │ config: { │ │ │
|
|
83
|
+
│ │ │ appKey: desk_urls.murphyAppKey, │ │ │
|
|
84
|
+
│ │ │ appDomain: desk_urls.murphyAppDomain, │ │ │
|
|
85
|
+
│ │ │ authKey: desk_urls.murphyAuthKey │ │ │
|
|
86
|
+
│ │ │ } │ │ │
|
|
87
|
+
│ │ │ }); │ │ │
|
|
88
|
+
│ │ │ } │ │ │
|
|
89
|
+
│ │ └───────────────────────────────────────────────────────────────────┘ │ │
|
|
90
|
+
│ │ │ │ │
|
|
91
|
+
│ │ ▼ │ │
|
|
92
|
+
│ │ ┌───────────────────────────────────────────────────────────────────┐ │ │
|
|
93
|
+
│ │ │ Global murphy object ready for use! │ │ │
|
|
94
|
+
│ │ │ │ │ │
|
|
95
|
+
│ │ │ murphy.error(...) → Track errors │ │ │
|
|
96
|
+
│ │ │ murphy.appLog(...) → Application logs │ │ │
|
|
97
|
+
│ │ │ murphy.clientmetrics → Performance monitoring │ │ │
|
|
98
|
+
│ │ └───────────────────────────────────────────────────────────────────┘ │ │
|
|
99
|
+
│ │ │ │
|
|
100
|
+
│ └─────────────────────────────────────────────────────────────────────────┘ │
|
|
101
|
+
│ │
|
|
102
|
+
└───────────────────────────────────────────────────────────────────────────────┘
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Multi-Datacenter Architecture
|
|
108
|
+
|
|
109
|
+
One of Murphy's key features is multi-datacenter support. The same code runs in all datacenters, but configuration is injected at runtime.
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
┌───────────────────────────────────────────────────────────────────────────────┐
|
|
113
|
+
│ SAME CODE → DIFFERENT DATACENTERS │
|
|
114
|
+
├───────────────────────────────────────────────────────────────────────────────┤
|
|
115
|
+
│ │
|
|
116
|
+
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
|
|
117
|
+
│ │ ONE CODEBASE (Git Repository) │ │
|
|
118
|
+
│ │ │ │
|
|
119
|
+
│ │ desk client app │ i18n library │ murphy.error() call │ │
|
|
120
|
+
│ │ │ │
|
|
121
|
+
│ │ Same JavaScript code deployed everywhere │ │
|
|
122
|
+
│ └─────────────────────────────────────────────────────────────────────────┘ │
|
|
123
|
+
│ │ │
|
|
124
|
+
│ ┌───────────────┼───────────────┐ │
|
|
125
|
+
│ │ │ │ │
|
|
126
|
+
│ ▼ ▼ ▼ │
|
|
127
|
+
│ ┌───────────────────┐ ┌───────────────────┐ ┌───────────────────┐ │
|
|
128
|
+
│ │ US Datacenter │ │ JP Datacenter │ │ IN Datacenter │ │
|
|
129
|
+
│ │ │ │ │ │ │ │
|
|
130
|
+
│ │ desk_urls = { │ │ desk_urls = { │ │ desk_urls = { │ │
|
|
131
|
+
│ │ appKey: "755.." │ │ appKey: "900.." │ │ appKey: "600.." │ │
|
|
132
|
+
│ │ appDomain: │ │ appDomain: │ │ appDomain: │ │
|
|
133
|
+
│ │ "murphy.zoho │ │ "murphy.zoho │ │ "murphy.zoho │ │
|
|
134
|
+
│ │ .com" │ │ .jp" │ │ .in" │ │
|
|
135
|
+
│ │ } │ │ } │ │ } │ │
|
|
136
|
+
│ └─────────┬─────────┘ └─────────┬─────────┘ └─────────┬─────────┘ │
|
|
137
|
+
│ │ │ │ │
|
|
138
|
+
│ ▼ ▼ ▼ │
|
|
139
|
+
│ ┌───────────────────┐ ┌───────────────────┐ ┌───────────────────┐ │
|
|
140
|
+
│ │ murphy.zoho.com │ │ murphy.zoho.jp │ │ murphy.zoho.in │ │
|
|
141
|
+
│ │ (US Murphy) │ │ (JP Murphy) │ │ (IN Murphy) │ │
|
|
142
|
+
│ └───────────────────┘ └───────────────────┘ └───────────────────┘ │
|
|
143
|
+
│ │
|
|
144
|
+
│ KEY INSIGHT: Code doesn't care about DC - config is injected at runtime! │
|
|
145
|
+
│ │
|
|
146
|
+
└───────────────────────────────────────────────────────────────────────────────┘
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Data Flow Summary
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
┌───────────────────────────────────────────────────────────────────────────────┐
|
|
155
|
+
│ DATA FLOW: Error Reporting │
|
|
156
|
+
├───────────────────────────────────────────────────────────────────────────────┤
|
|
157
|
+
│ │
|
|
158
|
+
│ 1. ERROR OCCURS │
|
|
159
|
+
│ ┌──────────────────────────────────────────────────────────────────────┐ │
|
|
160
|
+
│ │ // In i18n library │ │
|
|
161
|
+
│ │ getI18NValue('missing.key') → Key not found! │ │
|
|
162
|
+
│ └──────────────────────────────────────────────────────────────────────┘ │
|
|
163
|
+
│ │ │
|
|
164
|
+
│ ▼ │
|
|
165
|
+
│ 2. REPORT TO MURPHY │
|
|
166
|
+
│ ┌──────────────────────────────────────────────────────────────────────┐ │
|
|
167
|
+
│ │ reportI18NError(I18N_ERROR_TYPES.MISSING_KEY, 'missing.key'); │ │
|
|
168
|
+
│ │ │ │
|
|
169
|
+
│ │ // Internally calls: │ │
|
|
170
|
+
│ │ murphy.error(error, undefined, { customTags: {...} }); │ │
|
|
171
|
+
│ └──────────────────────────────────────────────────────────────────────┘ │
|
|
172
|
+
│ │ │
|
|
173
|
+
│ ▼ │
|
|
174
|
+
│ 3. MURPHY SDK SENDS DATA │
|
|
175
|
+
│ ┌──────────────────────────────────────────────────────────────────────┐ │
|
|
176
|
+
│ │ HTTP POST to murphy.zoho.com (or regional endpoint) │ │
|
|
177
|
+
│ │ │ │
|
|
178
|
+
│ │ { │ │
|
|
179
|
+
│ │ error: "i18n I18N_MISSING_KEY: missing.key", │ │
|
|
180
|
+
│ │ stackTrace: "...", │ │
|
|
181
|
+
│ │ customTags: { │ │
|
|
182
|
+
│ │ errorType: "I18N_MISSING_KEY", │ │
|
|
183
|
+
│ │ i18nKey: "missing.key", │ │
|
|
184
|
+
│ │ category: "i18n" │ │
|
|
185
|
+
│ │ }, │ │
|
|
186
|
+
│ │ buildId: "1.2.3", │ │
|
|
187
|
+
│ │ userId: "12345", │ │
|
|
188
|
+
│ │ orgId: "67890" │ │
|
|
189
|
+
│ │ } │ │
|
|
190
|
+
│ └──────────────────────────────────────────────────────────────────────┘ │
|
|
191
|
+
│ │ │
|
|
192
|
+
│ ▼ │
|
|
193
|
+
│ 4. MURPHY DASHBOARD │
|
|
194
|
+
│ ┌──────────────────────────────────────────────────────────────────────┐ │
|
|
195
|
+
│ │ • Error logged with full context │ │
|
|
196
|
+
│ │ • Grouped with similar errors │ │
|
|
197
|
+
│ │ • Searchable by tags │ │
|
|
198
|
+
│ │ • Alerts if threshold exceeded │ │
|
|
199
|
+
│ └──────────────────────────────────────────────────────────────────────┘ │
|
|
200
|
+
│ │
|
|
201
|
+
└───────────────────────────────────────────────────────────────────────────────┘
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## Component Layers
|
|
207
|
+
|
|
208
|
+
```
|
|
209
|
+
┌───────────────────────────────────────────────────────────────────────────────┐
|
|
210
|
+
│ COMPONENT LAYERS │
|
|
211
|
+
├───────────────────────────────────────────────────────────────────────────────┤
|
|
212
|
+
│ │
|
|
213
|
+
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
|
|
214
|
+
│ │ LAYER 1: Configuration Storage │ │
|
|
215
|
+
│ │ ────────────────────────────────────────────────────────────────────── │ │
|
|
216
|
+
│ │ dcurl.properties │ │
|
|
217
|
+
│ │ • Stores Murphy credentials per datacenter │ │
|
|
218
|
+
│ │ • Region suffix: _US, _JP, _IN, _EU, _CN, _AU, _CA, _SA │ │
|
|
219
|
+
│ │ • Three keys: appkey, appdomain, authKey │ │
|
|
220
|
+
│ └─────────────────────────────────────────────────────────────────────────┘ │
|
|
221
|
+
│ │ │
|
|
222
|
+
│ ▼ │
|
|
223
|
+
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
|
|
224
|
+
│ │ LAYER 2: Java Configuration API │ │
|
|
225
|
+
│ │ ────────────────────────────────────────────────────────────────────── │ │
|
|
226
|
+
│ │ MurphyConstants.java │ │
|
|
227
|
+
│ │ • Reads properties via Configuration.getString() │ │
|
|
228
|
+
│ │ • Auto-detects datacenter region │ │
|
|
229
|
+
│ │ • Exposes as static final constants │ │
|
|
230
|
+
│ └─────────────────────────────────────────────────────────────────────────┘ │
|
|
231
|
+
│ │ │
|
|
232
|
+
│ ▼ │
|
|
233
|
+
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
|
|
234
|
+
│ │ LAYER 3: Frontend Injection │ │
|
|
235
|
+
│ │ ────────────────────────────────────────────────────────────────────── │ │
|
|
236
|
+
│ │ ClientInitUtil.java │ │
|
|
237
|
+
│ │ • Creates desk_urls JSON object │ │
|
|
238
|
+
│ │ • Injects into HTML via <script> tag │ │
|
|
239
|
+
│ │ • XSS protection via IAMEncoder │ │
|
|
240
|
+
│ └─────────────────────────────────────────────────────────────────────────┘ │
|
|
241
|
+
│ │ │
|
|
242
|
+
│ ▼ │
|
|
243
|
+
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
|
|
244
|
+
│ │ LAYER 4: Murphy SDK │ │
|
|
245
|
+
│ │ ────────────────────────────────────────────────────────────────────── │ │
|
|
246
|
+
│ │ murphy.min.js (CDN loaded) │ │
|
|
247
|
+
│ │ • Creates global murphy object │ │
|
|
248
|
+
│ │ • Configured via murphy.install() │ │
|
|
249
|
+
│ │ • Exposes error(), appLog(), clientmetrics APIs │ │
|
|
250
|
+
│ └─────────────────────────────────────────────────────────────────────────┘ │
|
|
251
|
+
│ │ │
|
|
252
|
+
│ ▼ │
|
|
253
|
+
│ ┌─────────────────────────────────────────────────────────────────────────┐ │
|
|
254
|
+
│ │ LAYER 5: Application Code │ │
|
|
255
|
+
│ │ ────────────────────────────────────────────────────────────────────── │ │
|
|
256
|
+
│ │ desk client app / i18n library │ │
|
|
257
|
+
│ │ • Uses global murphy object │ │
|
|
258
|
+
│ │ • Calls murphy.error(), murphy.appLog(), etc. │ │
|
|
259
|
+
│ │ • No need to know about datacenter configuration │ │
|
|
260
|
+
│ └─────────────────────────────────────────────────────────────────────────┘ │
|
|
261
|
+
│ │
|
|
262
|
+
└───────────────────────────────────────────────────────────────────────────────┘
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
## Key Files Summary
|
|
268
|
+
|
|
269
|
+
| Layer | File | Purpose |
|
|
270
|
+
|-------|------|---------|
|
|
271
|
+
| Config Storage | `dcurl.properties` | Store DC-specific Murphy keys |
|
|
272
|
+
| Java API | `MurphyConstants.java` | Read config as Java constants |
|
|
273
|
+
| Injection | `ClientInitUtil.java` | Inject config into HTML |
|
|
274
|
+
| SDK Init | `murphy/initial_html/utils.js` | Call murphy.install() |
|
|
275
|
+
| Usage | App code / i18n lib | Call murphy.error(), etc. |
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
## Related Documents
|
|
280
|
+
|
|
281
|
+
- [01-MURPHY_OVERVIEW.md](./01-MURPHY_OVERVIEW.md) - Murphy introduction
|
|
282
|
+
- [03-MURPHY_BACKEND_CONFIG.md](./03-MURPHY_BACKEND_CONFIG.md) - Backend config details
|
|
283
|
+
- [04-MURPHY_FRONTEND_INIT.md](./04-MURPHY_FRONTEND_INIT.md) - Frontend initialization
|