Skip to content

Commit

Permalink
chore: add new version inplayer sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
kiremitrov123 committed May 5, 2023
1 parent f62f359 commit 428cc97
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

# yarn commit-msg
yarn commit-msg
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"deploy:github": "node ./scripts/deploy-github.js"
},
"dependencies": {
"@inplayer-org/inplayer.js": "^3.13.7",
"@inplayer-org/inplayer.js": "^3.13.9",
"classnames": "^2.3.1",
"date-fns": "^2.28.0",
"dompurify": "^2.3.8",
Expand Down Expand Up @@ -142,4 +142,4 @@
"flat": "^5.0.1",
"json5": "^2.2.2"
}
}
}
13 changes: 2 additions & 11 deletions src/services/inplayer.account.service.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
import InPlayer, {
AccountData,
Env,
RegisterField,
UpdateAccountData,
FavoritesData,
WatchHistory,
} from '@inplayer-org/inplayer.js';
import InPlayer, { AccountData, Env, RegisterField, UpdateAccountData, FavoritesData, WatchHistory } from '@inplayer-org/inplayer.js';
import i18next from 'i18next';

import type {
Expand Down Expand Up @@ -143,9 +136,7 @@ export const getPublisherConsents: GetPublisherConsents = async (config) => {
const { jwp } = config.integrations;
const { data } = await InPlayer.Account.getRegisterFields(jwp?.clientId || '');

const result: Consent[] = data?.collection
.filter((field) => field.type === 'checkbox')
.map((consent) => formatPublisherConsents(consent));
const result: Consent[] = data?.collection.filter((field) => field.type === 'checkbox').map((consent) => formatPublisherConsents(consent));

return {
consents: [getTermsConsent(), ...result],
Expand Down
5 changes: 4 additions & 1 deletion src/services/inplayer.checkout.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,12 @@ export const paymentWithPayPal: PaymentWithPayPal = async (payload) => {
origin: `${window.location.origin}?u=waiting-for-payment`,
accessFeeId: payload.order.id,
paymentMethod: 2,
// TODO: add voucherCode in sdk types
// @ts-ignore
voucherCode: payload.couponCode,
});


// @ts-ignore
if (response.data?.id) {
return {
errors: ['Already have an active access'],
Expand Down
3 changes: 0 additions & 3 deletions src/services/inplayer.subscription.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ export async function getActivePayment() {

return cards.find((paymentDetails) => paymentDetails.active) || null;
} catch {
//TODO Fix response code in the InPlayer API
//throw new Error('Failed to get payment details');
return null;
}
}
Expand Down Expand Up @@ -107,7 +105,6 @@ const formatCardDetails = (card: Card): PaymentDetail => {
} as PaymentDetail;
};

// TODO: fix PurchaseDetails type in InPlayer SDK
const formatTransaction = (transaction: PurchaseDetails): Transaction => {
const purchasedAmount = transaction?.purchased_amount?.toString() || '0';

Expand Down
1 change: 0 additions & 1 deletion types/inplayer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ export type InPlayerResponse<T> = {
statusText: string;
config: AxiosRequestConfig;
};

14 changes: 7 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1557,10 +1557,10 @@
resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45"
integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==

"@inplayer-org/inplayer.js@^3.13.7":
version "3.13.7"
resolved "https://registry.yarnpkg.com/@inplayer-org/inplayer.js/-/inplayer.js-3.13.7.tgz#8a3ebb52ffc90622c6be7618d9d767c4c7125167"
integrity sha512-7xx1/HDd2/UTZGW7MWoqdgbgkVA63iSJDecAn2Mho5JpdD35OfQMT514otNKkw0nNbDU5/Lj0cTnEsfN1a1QxQ==
"@inplayer-org/inplayer.js@^3.13.9":
version "3.13.9"
resolved "https://registry.yarnpkg.com/@inplayer-org/inplayer.js/-/inplayer.js-3.13.9.tgz#05b3ef6338ff48d0a7f97f0bae98aaa356034dec"
integrity sha512-V5CrjpGYysH1CHUgtfcXv5usIZG4HC/eo77rWjzX2/IGDpFHxpHHzbtdiy+n3qEIIybv0BPU3LWHfYRxQETZzQ==
dependencies:
aws-iot-device-sdk "^2.2.6"
axios "^0.21.2"
Expand Down Expand Up @@ -3425,9 +3425,9 @@ core-js@^3.19.2:
integrity sha512-1t+2a/d2lppW1gkLXx3pKPVGbBdxXAkqztvWb1EJ8oF8O2gIGiytzflNiFEehYwVK/t2ryUsGBoOFFvNx95mbg==

core-js@^3.8.2:
version "3.29.0"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.29.0.tgz#0273e142b67761058bcde5615c503c7406b572d6"
integrity sha512-VG23vuEisJNkGl6XQmFJd3rEG/so/CNatqeE+7uZAwTSwFeB/qaO0be8xZYUNWprJ/GIwL8aMt9cj1kvbpTZhg==
version "3.30.1"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.30.1.tgz#fc9c5adcc541d8e9fa3e381179433cbf795628ba"
integrity sha512-ZNS5nbiSwDTq4hFosEDqm65izl2CWmLz0hARJMyNQBgkUZMIF51cQiMvIQKA6hvuaeWxQDP3hEedM1JZIgTldQ==

core-util-is@~1.0.0:
version "1.0.3"
Expand Down

0 comments on commit 428cc97

Please sign in to comment.