Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions __tests__/generateAccessToken.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { generateAccessToken } from '../src/promo-node-utils';
import { generateAccessToken } from '../src/generateAccessToken';
jest.setTimeout(40000);

describe('generateAccessToken no sub', () => {
Expand All @@ -24,7 +24,7 @@ describe('generateAccessToken with sub and expiration', () => {
const clientId = 'test client id';
const hostName = 'http://localhost:3000';
const sub = 'test@tincre.com';
const expiration = 123456
const expiration = 123456;
let accessTokenSigned: string = generateAccessToken(
hostName,
clientId,
Expand Down
2 changes: 1 addition & 1 deletion __tests__/getToken.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getToken } from '../src/.';
import { generateAccessToken } from '../src/promo-node-utils';
import { generateAccessToken } from '../src/.';
jest.setTimeout(40000);

describe('getToken', () => {
Expand Down
8 changes: 5 additions & 3 deletions example/nextjs/pages/api/promo.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
// Promo API route support: https://tincre.dev/docs/reference
import { generateAccessToken } from '../../lib/promo-node-utils';
import { getToken } from '../../../../dist/lib/getToken'; //'@tincre/promo-button';
import { getToken, generateAccessToken } from '../../../../dist/index'; //'@tincre/promo-button';
import type { NextApiRequest, NextApiResponse } from 'next';

type Data = {
Expand All @@ -15,11 +14,14 @@ export default async function handler(
const clientSecret: string = process.env.PROMO_CLIENT_SECRET || '';
const appId: string = process.env.PROMO_APP_ID || '';
const clientId: string = process.env.PROMO_CLIENT_ID || '';
const email: string = 'example@example.com';
let accessTokenSigned: string = generateAccessToken(
'http://localhost:3000',
clientId,
appId,
clientSecret
clientSecret,
undefined,
email
);

let resultToken: string = await getToken(accessTokenSigned);
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { generateAccessToken } from './promo-node-utils';
import { generateAccessToken } from './generateAccessToken';
import { getToken } from './getToken';
import { getWidget, getWidgetCallback, showWidget } from './cloudinary-utils';
import defaultOptions from './defaultOptions';
Expand Down