-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add omit helper method * replace lodash/omit with our version * build as umd and remove lodash dep * set axios in output globals * set tsconfig typeroots and module resolution * disable eslint react-hooks/exhaustive-deps rule * remove parser from prettier config * set yarn resolutions and add rollup copy plugin * implement VoucherifyValidate widget * add base test setup for sdk * remove typeroots from tsconfig.build * run github lint action with yarn lifecycle scripts * use actions/setup-node@v2 * set react-widget as public * add changesets
- Loading branch information
Showing
32 changed files
with
1,724 additions
and
700 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@voucherify/react-widget': patch | ||
--- | ||
|
||
Implement VoucherifyValidate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@voucherify/sdk': patch | ||
--- | ||
|
||
Generate UMD bundle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,4 @@ module.exports = { | |
useTabs: true, | ||
endOfLine: 'lf', | ||
arrowParens: 'avoid', | ||
parser: 'typescript', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<link rel="stylesheet" type="text/css" href="./voucherify.css" /> | ||
</head> | ||
|
||
<body> | ||
<div id="voucher-validate"></div> | ||
|
||
<script src="https://unpkg.com/react@17/umd/react.production.min.js" crossorigin></script> | ||
<script src="https://unpkg.com/react-dom@17/umd/react-dom.production.min.js" crossorigin></script> | ||
<script src="https://unpkg.com/axios/dist/axios.min.js"></script> | ||
<script type="text/javascript" src="./voucherifysdk.umd.production.min.js"></script> | ||
<script type="text/javascript" src="../dist/voucherifywidget.umd.development.js"></script> | ||
<script type="text/javascript"> | ||
const React = window.React | ||
const reactDom = window.ReactDOM | ||
|
||
reactDom.render( | ||
React.createElement(VoucherifyWidget.VoucherifyValidate, { | ||
clientApplicationId: '011240bf-d5fc-4ef1-9e82-11eb68c43bf5', | ||
clientSecretKey: '9e2230c5-71fb-460a-91c6-fbee64707a20', | ||
textPlaceholder: 'e.g. Testing7fjWdr', | ||
amount: true, | ||
onValidated: function(response) { | ||
console.log('Do something with response:', response) | ||
}, | ||
onError: function (error) { | ||
console.error('Do something with error', error) | ||
} | ||
}), | ||
document.querySelector('#voucher-validate'), | ||
) | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import * as React from 'react' | ||
|
||
interface VoucherifyLogoProps { | ||
src?: string | ||
alt?: string | ||
} | ||
|
||
export function VoucherifyLogo({ src, alt }: VoucherifyLogoProps) { | ||
return ( | ||
<figure className="voucherifyLogo"> | ||
{src ? ( | ||
<img className="voucherifyLogo" src={src} alt={alt} /> | ||
) : ( | ||
<svg className="voucherifyLogo" viewBox="0 0 46 45"> | ||
<path | ||
fill="currentColor" | ||
fill-rule="nonzero" | ||
d="M18.494 3.174c2.112 2.131 3.145 4.69 3.145 7.72 0 3.032-1.033 5.59-3.145 7.722-2.112 2.131-4.647 3.173-7.651 3.173-3.004 0-5.539-1.042-7.651-3.173C1.032 16.532 0 13.926 0 10.942s1.033-5.637 3.145-7.768C5.257 1.042 7.839 0 10.843 0c2.957 0 5.539 1.042 7.65 3.174zm-7.651 1.231c-1.784 0-3.286.616-4.553 1.895-1.268 1.279-1.878 2.795-1.878 4.595 0 1.8.61 3.316 1.878 4.594 1.267 1.28 2.77 1.895 4.553 1.895 1.784 0 3.286-.616 4.553-1.895 1.267-1.278 1.877-2.794 1.877-4.594 0-1.8-.61-3.316-1.877-4.595-1.267-1.232-2.77-1.895-4.553-1.895zM34.782 44.574c-3.051-.19-5.54-1.232-7.51-3.221-2.066-2.085-3.145-5.21-3.145-8.195v-.569c0-.852.234-1.468.657-1.942.422-.426.938-.663 1.549-.663.61 0 1.126.237 1.549.663.422.427.657 1.042.657 1.895v.947c.094 1.611.704 3.553 1.877 4.69 1.268 1.279 2.77 1.895 4.553 1.895h.094c1.784 0 3.286-.616 4.553-1.895 1.174-1.137 1.784-3.079 1.878-4.69v-.947c0-.805.235-1.42.657-1.895.422-.426.939-.663 1.549-.663s1.127.237 1.549.663c.422.427.657 1.09.657 1.942v.569c-.047 2.984-1.08 6.063-3.145 8.195-1.971 1.99-4.459 3.079-7.51 3.22h-.47zM6.102 42.916c-.563 0-1.126-.237-1.596-.663-.892-.9-.892-2.321 0-3.174L40.367 2.937c.892-.9 2.3-.9 3.145 0 .892.9.892 2.32 0 3.174L7.698 42.253a2.307 2.307 0 01-1.596.663z" | ||
/> | ||
</svg> | ||
)} | ||
</figure> | ||
) | ||
} |
Oops, something went wrong.