|
2 | 2 | /* |
3 | 3 | Plugin Name: Frak |
4 | 4 | Description: Adds Frak configuration to your WordPress site |
5 | | -Version: 0.2 |
| 5 | +Version: 0.3 |
6 | 6 | Author: Frak-Labs |
7 | 7 | */ |
8 | 8 |
|
@@ -87,31 +87,50 @@ function frak_settings_page() { |
87 | 87 | if (empty($custom_config)) { |
88 | 88 | $custom_config = <<<JS |
89 | 89 | window.FrakSetup = { |
| 90 | + // Overall config of the Frak SDK |
90 | 91 | config: { |
91 | 92 | metadata: { |
92 | 93 | name: "{$app_name}", |
| 94 | + lang: "en", |
| 95 | + currency: "eur", |
| 96 | + logoUrl: "{$logo_url}", |
| 97 | + homepageLink: window.location.origin, |
| 98 | + }, |
| 99 | + customizations: { |
| 100 | + // Customize the i18n messages |
| 101 | + // i18n: { |
| 102 | + // }, |
93 | 103 | }, |
94 | 104 | domain: window.location.host, |
95 | 105 | }, |
| 106 | + // Config for the generic modal view |
96 | 107 | modalConfig: { |
97 | 108 | login: { |
98 | 109 | allowSso: true, |
99 | | - ssoMetadata: { |
100 | | - logoUrl: "{$logo_url}", |
101 | | - homepageLink: window.location.origin, |
102 | | - }, |
| 110 | + ssoMetadata: {}, |
103 | 111 | }, |
104 | 112 | metadata: { |
105 | | - header: { |
106 | | - icon: "{$logo_url}", |
107 | | - }, |
108 | 113 | isDismissible: true, |
109 | | - lang: "en", |
110 | 114 | }, |
111 | 115 | }, |
| 116 | + // Config for the sharing modal step |
112 | 117 | modalShareConfig: { |
113 | 118 | link: window.location.href, |
114 | | - } |
| 119 | + }, |
| 120 | + // Config for the embedded modal view |
| 121 | + modalWalletConfig: { |
| 122 | + metadata: { |
| 123 | + position: "left", |
| 124 | + }, |
| 125 | + loggedIn: { |
| 126 | + action: { |
| 127 | + key: "sharing", |
| 128 | + options: { |
| 129 | + link: window.location.href, |
| 130 | + }, |
| 131 | + }, |
| 132 | + }, |
| 133 | + }, |
115 | 134 | }; |
116 | 135 | JS; |
117 | 136 | } |
@@ -180,15 +199,9 @@ function updateConfig() { |
180 | 199 | '$1' + appName + '$2' |
181 | 200 | ); |
182 | 201 |
|
183 | | - // Update both logoUrl instances |
184 | | - currentConfig = currentConfig.replace( |
185 | | - /(ssoMetadata:\s*{\s*logoUrl:\s*")[^"]*(")/, |
186 | | - '$1' + logoUrl + '$2' |
187 | | - ); |
188 | | - |
189 | | - // Update icon |
| 202 | + // Update the logoUrl |
190 | 203 | currentConfig = currentConfig.replace( |
191 | | - /(header:\s*{\s*icon:\s*")[^"]*(")/, |
| 204 | + /(logoUrl:\s*")[^"]*(")/, |
192 | 205 | '$1' + logoUrl + '$2' |
193 | 206 | ); |
194 | 207 |
|
|
0 commit comments