// Load with agent-browser --init-script when checking the local preview. if (location.hostname === '127.0.0.1' && location.port === '48138') { localStorage.setItem('token', 'mock-session'); localStorage.setItem('identifier', 'A'); localStorage.setItem('customerAssetPhoneState', JSON.stringify({ type: 'object', data: { token: 'mock-session', identifier: 'A', customerPhone: '13800000001', assetPhoneBound: false, assetPhoneIsOwn: false, needBindPhone: false } })); const originalOpen = XMLHttpRequest.prototype.open; XMLHttpRequest.prototype.open = function (method, url, ...rest) { if (typeof url === 'string' && url.includes('/api/c/v1/')) { url = location.origin + '/__mock/' + url.split('/api/c/v1/')[1]; } return originalOpen.call(this, method, url, ...rest); }; }