Skip to content

Commit

Permalink
Staging -> Prod [ Fix Connect URL ] (#9)
Browse files Browse the repository at this point in the history
* SDK Init (#1)

* First Itr With Check in Initialization

* Sync Initialization

* Validate no required service

* Use graphql-codegen

* Use ENV For Codegen

* Custom Error Codes

* Error Modules

* Fix copy errors

* Github Workflow and Readme (#2)

* Github Workflow

* Minor Mods

* Update Readme

* Update Readme.md

* Update README.md

* Update README.md

* Update README.md

---------

Co-authored-by: Timi Ajiboye <[email protected]>

* Modify Publish Workflow (#3)

* Modify Publish Workflow

* Update Readme.md

* Update Workflow

* Fix Test (#5)

* Update Graphql Queries to use the Public API (#6)

* Update Graphql Schema

* Update Version

* Fix Connect URL (#8)

* Fix Connect URL

* Use Multiple Export Paths

* Fix Test

---------

Co-authored-by: Timi Ajiboye <[email protected]>
  • Loading branch information
TosinJs and timigod authored Mar 21, 2024
1 parent 27aa0a3 commit 4ae1cc7
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 13 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 15 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
{
"name": "@gandalf-network/connect",
"version": "1.0.1",
"version": "1.0.2",
"description": "",
"main": "dist/bundle.js",
"main": "dist/entry.bundle.js",
"types": "dist/index.d.ts",
"module": "dist/entry.bundle.js",
"exports": {
".": {
"import": "./dist/entry.bundle.js",
"require": "./dist/entry.bundle.js",
"types": "./dist/index.d.ts"
},
"./components": {
"import": "./dist/components.bundle.js",
"require": "./dist/components.bundle.js",
"types": "./dist/components.d.ts"
}
},
"files": [
"dist/**/*"
],
Expand Down
4 changes: 4 additions & 0 deletions src/components.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Services } from "./connect";
import { GandalfError, GandalfErrorCode } from "./lib/errors";

export { Services, GandalfError, GandalfErrorCode }
4 changes: 2 additions & 2 deletions src/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Connect {
async generateURL(): Promise<string> {
await this.allValidations(this.publicKey, this.redirectURL, this.services);
const services = JSON.stringify(this.services)
return encodeURI(`${APP_CLIP_BASE_URL}?services=${services}&redirectUrl=${this.redirectURL}&publicKey=${this.publicKey}`)
return encodeURI(`${APP_CLIP_BASE_URL}&services=${services}&redirectUrl=${this.redirectURL}&publicKey=${this.publicKey}`)
}

async generateQRCode(): Promise<string> {
Expand All @@ -44,7 +44,7 @@ class Connect {
}
await this.allValidations(this.publicKey, this.redirectURL, this.services);
const services = JSON.stringify(this.services)
const url = encodeURI(`${APP_CLIP_BASE_URL}?services=${services}&redirectUrl=${this.redirectURL}&publicKey=${this.publicKey}`)
const url = encodeURI(`${APP_CLIP_BASE_URL}&services=${services}&redirectUrl=${this.redirectURL}&publicKey=${this.publicKey}`)
const qrCode = new QRCodeStyling(qrCodeStyle(url));
try {
const qrCodeBlob = await qrCode.getRawData('webp')
Expand Down
5 changes: 1 addition & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import Connect, { Services } from "./connect";
import { GandalfError, GandalfErrorCode } from "./lib/errors";
import Connect from "./connect";


export { Services, GandalfError, GandalfErrorCode }
export default Connect;
2 changes: 1 addition & 1 deletion src/tests/connect.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ describe('Connect SDK', () => {
it('should generate the correct URL', async () => {
const connect = new Connect({publicKey, redirectURL, services});
const generatedURL = await connect.generateURL();
expect(generatedURL).toEqual(encodeURI(`${APP_CLIP_BASE_URL}?services=${stringServices}&redirectUrl=${redirectURL}&publicKey=${publicKey}`));
expect(generatedURL).toEqual(encodeURI(`${APP_CLIP_BASE_URL}&services=${stringServices}&redirectUrl=${redirectURL}&publicKey=${publicKey}`));
});
});

Expand Down
7 changes: 5 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ const webpack = require('webpack');
require('dotenv').config();

module.exports = {
entry: './src/index.ts',
entry: {
entry: './src/index.ts',
components: './src/components.ts',
},
mode: 'production',
plugins: [
new webpack.DefinePlugin({
Expand All @@ -29,8 +32,8 @@ module.exports = {
},
target: 'web',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist'),
filename: '[name].bundle.js',
libraryTarget: 'umd',
globalObject: 'this'
},
Expand Down

0 comments on commit 4ae1cc7

Please sign in to comment.