Skip to content

Commit

Permalink
Merge pull request #83 from rspective/pg/api-configurable
Browse files Browse the repository at this point in the history
Set api endopoint inside iframe widgets
  • Loading branch information
tpindel authored Jun 18, 2021
2 parents fab4c9f + da6575b commit d96ca1e
Show file tree
Hide file tree
Showing 7 changed files with 449 additions and 441 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,7 @@ The iframe renders the redeem widget
<div class="voucherify-voucher-redeem"
data-client-app-id="YOUR-CLIENT-APPLICATION-ID-FROM-SETTINGS"
data-client-token="YOUR-CLIENT-TOKEN-FROM-SETTINGS"
data-client-app-url="API-ENDPOINT; optional; defaults to https://app.voucherify.io"

data-code-field="true"
data-code-field-label="Label"
Expand Down Expand Up @@ -622,6 +623,7 @@ You can also embed the "get voucher" widget as an iframe
<div class="voucherify-get-voucher"
data-client-app-id="YOUR-CLIENT-APPLICATION-ID-FROM-SETTINGS"
data-client-token="YOUR-CLIENT-TOKEN-FROM-SETTINGS"
data-client-app-url="API-ENDPOINT; optional; defaults to https://app.voucherify.io"

data-campaign="Campaign name"

Expand Down Expand Up @@ -670,12 +672,13 @@ The widget is fully configurable. You can decide which fields are visible and re
### Subscribe widget - iframe
The iframe redners a widget which creates a customer profile in Voucherify
The iframe renders a widget which creates a customer profile in Voucherify
```html
<div class="voucherify-subscribe"
data-client-app-id="YOUR-CLIENT-APPLICATION-ID-FROM-SETTINGS"
data-client-token="YOUR-CLIENT-TOKEN-FROM-SETTINGS"
data-client-app-url="API-ENDPOINT; optional; defaults to https://app.voucherify.io"

data-name-field="true"
data-name-field-required="false"
Expand Down Expand Up @@ -736,6 +739,7 @@ Description and legal fields do support markdown syntax. It means that you can u
### Changelog
- **2021-06-20** - `1.33.0` - Add possibility of configuring API endpoint for iframe widgets
- **2020-09-16** - `1.32.0` - Add possibility to send order metadata with validation request
- **2019-12-23** - `1.31.0` - Add possibility to send customer metadata with validation request
- **2019-02-05** - `1.30.0` - Add method for setting base app url
Expand Down
4 changes: 3 additions & 1 deletion dist/voucherify.js
Original file line number Diff line number Diff line change
Expand Up @@ -1089,10 +1089,10 @@ window.Voucherify = (function (window, document, $) {
})("docReady", window);

function renderIframes() {
var host = "https://app.voucherify.io";
var common_attributes = [
"client-app-id",
"client-token",
"client-app-url",

"logo",

Expand Down Expand Up @@ -1259,6 +1259,8 @@ window.Voucherify = (function (window, document, $) {
return self;
}

var host = self._options["client-app-url"] ? self._options["client-app-url"] : "https://app.voucherify.io";

// -- set custom height or fallback
var widget_height = self._options.height;
// -- remove custom height from options to prevent before sending it
Expand Down
2 changes: 1 addition & 1 deletion dist/voucherify.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/voucherify.min.js.map

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion lib/voucherify.js
Original file line number Diff line number Diff line change
Expand Up @@ -1089,10 +1089,10 @@ window.Voucherify = (function (window, document, $) {
})("docReady", window);

function renderIframes() {
var host = "https://app.voucherify.io";
var common_attributes = [
"client-app-id",
"client-token",
"client-app-url",

"logo",

Expand Down Expand Up @@ -1259,6 +1259,8 @@ window.Voucherify = (function (window, document, $) {
return self;
}

var host = self._options["client-app-url"] ? self._options["client-app-url"] : "https://app.voucherify.io";

// -- set custom height or fallback
var widget_height = self._options.height;
// -- remove custom height from options to prevent before sending it
Expand Down
Loading

0 comments on commit d96ca1e

Please sign in to comment.