Skip to content
This repository was archived by the owner on Apr 21, 2026. It is now read-only.

Commit ab44de6

Browse files
committed
feat: update the config template to new types
1 parent a6a03ab commit ab44de6

1 file changed

Lines changed: 31 additions & 18 deletions

File tree

frak-integration.php

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
Plugin Name: Frak
44
Description: Adds Frak configuration to your WordPress site
5-
Version: 0.2
5+
Version: 0.3
66
Author: Frak-Labs
77
*/
88

@@ -87,31 +87,50 @@ function frak_settings_page() {
8787
if (empty($custom_config)) {
8888
$custom_config = <<<JS
8989
window.FrakSetup = {
90+
// Overall config of the Frak SDK
9091
config: {
9192
metadata: {
9293
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+
// },
93103
},
94104
domain: window.location.host,
95105
},
106+
// Config for the generic modal view
96107
modalConfig: {
97108
login: {
98109
allowSso: true,
99-
ssoMetadata: {
100-
logoUrl: "{$logo_url}",
101-
homepageLink: window.location.origin,
102-
},
110+
ssoMetadata: {},
103111
},
104112
metadata: {
105-
header: {
106-
icon: "{$logo_url}",
107-
},
108113
isDismissible: true,
109-
lang: "en",
110114
},
111115
},
116+
// Config for the sharing modal step
112117
modalShareConfig: {
113118
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+
},
115134
};
116135
JS;
117136
}
@@ -180,15 +199,9 @@ function updateConfig() {
180199
'$1' + appName + '$2'
181200
);
182201

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
190203
currentConfig = currentConfig.replace(
191-
/(header:\s*{\s*icon:\s*")[^"]*(")/,
204+
/(logoUrl:\s*")[^"]*(")/,
192205
'$1' + logoUrl + '$2'
193206
);
194207

0 commit comments

Comments
 (0)