@live-change/phone-service 0.9.125 → 0.9.127

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.
Files changed (2) hide show
  1. package/package.json +4 -4
  2. package/render.js +8 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/phone-service",
3
- "version": "0.9.125",
3
+ "version": "0.9.127",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -22,12 +22,12 @@
22
22
  },
23
23
  "type": "module",
24
24
  "dependencies": {
25
- "@live-change/framework": "^0.9.125",
26
- "@live-change/relations-plugin": "^0.9.125",
25
+ "@live-change/framework": "^0.9.127",
26
+ "@live-change/relations-plugin": "^0.9.127",
27
27
  "got": "^11.8.6",
28
28
  "html-to-text": "8.1.0",
29
29
  "jsdom": "^24.1.0",
30
30
  "smsapi": "2.0.9"
31
31
  },
32
- "gitHead": "ba8f22a86fea42d874c0d3163369b3364e56f60c"
32
+ "gitHead": "acd85c886f4086b2d559eb40b5343f05d64ff294"
33
33
  }
package/render.js CHANGED
@@ -5,9 +5,15 @@ import { convert as htmlToText } from 'html-to-text'
5
5
  import definition from './definition.js'
6
6
  const config = definition.config
7
7
 
8
+ const getValue = (configValue, envValue, defaultValue) => configValue ?? envValue ?? defaultValue
9
+
8
10
  async function renderSms(data) {
9
- const baseUrl = `http://${config.ssrHost||process.env.SSR_HOST||'localhost'}`+
10
- `:${config.ssrPort||process.env.SSR_PORT||'8001'}`
11
+ const ssrUrl = getValue(
12
+ definition.config.browser?.ssrUrl,
13
+ process.env.SSR_URL,
14
+ 'http://localhost:8001'
15
+ )
16
+ const baseUrl = ssrUrl
11
17
 
12
18
  const encodedData = encodeURIComponent(JSON.stringify(data))
13
19
  const url = `${baseUrl}/_sms/${data.action}/${data.contact}/${encodedData}`