Skip to content

Commit 0de7a1f

Browse files
committed
core-940
1 parent 603dd29 commit 0de7a1f

File tree

15 files changed

+57
-146
lines changed

15 files changed

+57
-146
lines changed

src/app/lang/en.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@ export default {
4747
'getit.pdf.download': ' Download a PDF',
4848
'getit.pdf.sample': ' sample',
4949
'getit.print': 'Order a print copy',
50-
'getit.ibooks.download': 'Download on iBooks',
51-
'getit.ibooks.part1': 'iBooks part 1',
52-
'getit.ibooks.part2': 'iBooks part 2',
5350
'getit.kindle.header': 'Download for Kindle',
5451
'getit.kindle.disclaimer': 'As an Amazon Associate we earn from qualifying purchases',
5552
'how-using.how-many': 'How many students are using {title} each semester?',
@@ -89,7 +86,8 @@ export default {
8986
'pubInfo.pub.web': 'Web Version Last Updated:',
9087
'pubInfo.pub.color': 'Color',
9188
'pubInfo.pub.b-w': 'Black and White',
92-
'pubInfo.pub.dig': 'Digital',
89+
'pubInfo.pub.dig': 'Digital PDF',
90+
'pubInfo.pub.assignable': 'Assignable',
9391
'school-type.College/University (4)': 'College/University (4)',
9492
'school-type.Technical/Community College (2)': 'Technical/Community College (2)',
9593
'school-type.Career School/For-Profit (2)': 'Career School/For-Profit (2)',

src/app/lang/es.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@ export default {
4747
'getit.pdf.download': ' Descargar un PDF',
4848
'getit.pdf.sample': ' muestra',
4949
'getit.print': 'Solicitar una copia impresa',
50-
'getit.ibooks.download': 'Descargar en iBooks',
51-
'getit.ibooks.part1': 'iBooks parte 1',
52-
'getit.ibooks.part2': 'iBooks parte 2',
5350
'getit.kindle.header': 'Descargar para Kindle',
5451
'getit.kindle.disclaimer': 'Como Asociado de Amazon, ganamos con las compras que califican',
5552
'how-using.how-many': '¿Cuántos estudiantes utilizan {title} cada semestre?',
@@ -89,7 +86,8 @@ export default {
8986
'pubInfo.pub.web': 'Última actualización de la versión web:',
9087
'pubInfo.pub.color': 'Color',
9188
'pubInfo.pub.b-w': 'Blanco y negro',
92-
'pubInfo.pub.dig': 'Edición digital',
89+
'pubInfo.pub.dig': 'Edición digital (PDF)',
90+
'pubInfo.pub.assignable': 'Assignable',
9391
'school-type.College/University (4)': 'Facultad/Universidad (4)',
9492
'school-type.Technical/Community College (2)': 'Colegio técnico/comunitario (2)',
9593
'school-type.Career School/For-Profit (2)': 'Escuela profesional/Con fines de lucro (2)',

src/app/pages/details/common/get-this-title-files/options.tsx

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {faListOl} from '@fortawesome/free-solid-svg-icons/faListOl';
88
import {faCloudDownloadAlt} from '@fortawesome/free-solid-svg-icons/faCloudDownloadAlt';
99
import {faVolumeUp} from '@fortawesome/free-solid-svg-icons/faVolumeUp';
1010
import {faAmazon} from '@fortawesome/free-brands-svg-icons/faAmazon';
11-
import {faApple} from '@fortawesome/free-brands-svg-icons/faApple';
1211
import $ from '~/helpers/$';
1312
import {treatSpaceOrEnterAsClick} from '~/helpers/events';
1413
import {useIntl, FormattedMessage} from 'react-intl';
@@ -230,48 +229,6 @@ export function BookshareOption({model}: {model: Model}) {
230229
);
231230
}
232231

233-
export function Ibooks2Volumes({model}: {model: Model}) {
234-
const intl = useIntl();
235-
const download = intl.formatMessage({id: 'getit.ibooks.download'});
236-
237-
return (
238-
<React.Fragment>
239-
<span className="option-header">
240-
<IconAndText icon={faApple} text={download} />
241-
</span>
242-
<a href={model.ibookLink} data-track="iBooks">
243-
<FormattedMessage
244-
id="getit.ibooks.part1"
245-
defaultMessage="iBooks part 1"
246-
/>
247-
</a>
248-
<a href={model.ibookLink2} data-track="iBooks">
249-
<FormattedMessage
250-
id="getit.ibooks.part2"
251-
defaultMessage="iBooks part 2"
252-
/>
253-
</a>
254-
</React.Fragment>
255-
);
256-
}
257-
258-
export function IbooksOption({model}: {model: Model}) {
259-
const intl = useIntl();
260-
const download = intl.formatMessage({id: 'getit.ibooks.download'});
261-
262-
return (
263-
<Option condition={model.ibookLink}>
264-
{model.ibookLink2 ? (
265-
<Ibooks2Volumes model={model} />
266-
) : (
267-
<a href={model.ibookLink} data-track="iBooks">
268-
<IconAndText icon={faApple} text={download} />
269-
</a>
270-
)}
271-
</Option>
272-
);
273-
}
274-
275232
export function KindleOption({model}: {model: Model}) {
276233
const intl = useIntl();
277234
const header = intl.formatMessage({id: 'getit.kindle.header'});

src/app/pages/details/common/get-this-title.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
WebviewOption,
66
PdfOption,
77
BookshareOption,
8-
IbooksOption,
98
KindleOption,
109
CheggOption,
1110
OptionExpander
@@ -21,8 +20,6 @@ export type Model = {
2120
comingSoon: boolean;
2221
title: string;
2322
bookshareLink: string;
24-
ibookLink: string;
25-
ibookLink2: string;
2623
kindleLink: string;
2724
webviewRexLink: string;
2825
webviewLink: string;
@@ -34,22 +31,21 @@ export type Model = {
3431
cheggLink: string; // These may not be supported at all anymore,
3532
cheggLinkText: string; // but the CMS is still serving them.
3633
};
37-
type ModelKey = 'bookshareLink' | 'ibookLink' | 'kindleLink';
34+
type ModelKey = 'bookshareLink' | 'kindleLink';
3835
type TrackedMouseEvent = Parameters<typeof trackLink>[0];
3936

4037
function AdditionalOptions({model}: {model: Model}) {
4138
return (
4239
<React.Fragment>
4340
<BookshareOption model={model} />
44-
<IbooksOption model={model} />
4541
<KindleOption model={model} />
4642
</React.Fragment>
4743
);
4844
}
4945

5046
export default function GetThisTitle({model}: {model: Model}) {
5147
const additionalOptions = (
52-
['bookshareLink', 'ibookLink', 'kindleLink'] as ModelKey[]
48+
['bookshareLink', 'kindleLink'] as ModelKey[]
5349
).filter((key) => model[key]).length;
5450
const [expanded, toggleExpanded] = useToggle(additionalOptions < 1);
5551
const interceptLinkClicks = React.useCallback<React.MouseEventHandler>(

src/app/pages/details/common/publication-info.tsx

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -216,18 +216,14 @@ export default function PublicationInfo({url, polish}: {
216216
const model = useDetailsContext();
217217
const [webUpdate, setWebUpdate] = useState(model.lastUpdatedWeb);
218218
const intl = useIntl();
219-
const [pub, web, hard, paper, dig] = [
219+
const [pub, web, hard, paper, dig, assignable] = [
220220
intl.formatMessage({id: 'pubInfo.pub.pub'}),
221221
intl.formatMessage({id: 'pubInfo.pub.web'}),
222222
intl.formatMessage({id: 'pubInfo.pub.color'}),
223223
intl.formatMessage({id: 'pubInfo.pub.b-w'}),
224-
intl.formatMessage({id: 'pubInfo.pub.dig'})
224+
intl.formatMessage({id: 'pubInfo.pub.dig'}),
225+
intl.formatMessage({id: 'pubInfo.pub.assignable'})
225226
];
226-
const iBooksLabel =
227-
model.ibookVolume2Isbn10 || model.ibookVolume2Isbn13
228-
? intl.formatMessage({id: 'getit.ibooks.part1'})
229-
: 'iBooks';
230-
const labelPart2 = intl.formatMessage({id: 'getit.ibooks.part2'});
231227

232228
useEffect(() => {
233229
const isRex = Boolean(model.webviewRexLink);
@@ -260,8 +256,7 @@ export default function PublicationInfo({url, polish}: {
260256
<IsbnInfo label={hard} tag="print" />
261257
<IsbnInfo label={paper} tag="printSoftcover" />
262258
<IsbnInfo label={dig} tag="digital" />
263-
<IsbnInfo label={iBooksLabel} tag="ibook" />
264-
<IsbnInfo label={labelPart2} tag="ibookVolume2" />
259+
<IsbnInfo label={assignable} tag="assignable" />
265260
<LicenseInfo
266261
name={model.licenseName}
267262
text={model.licenseText}

src/app/pages/details/context.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ type Author = {
3535
seniorAuthor?: boolean;
3636
};
3737

38-
export type IsbnType = 'print' | 'printSoftcover' | 'digital' | 'ibook' | 'ibookVolume2';
38+
export type IsbnType = 'print' | 'printSoftcover' | 'digital' | 'assignable';
3939

4040
export type ContextValues = {
4141
id: number;
@@ -76,10 +76,8 @@ export type ContextValues = {
7676
printSoftcoverIsbn13: string;
7777
digitalIsbn10?: string;
7878
digitalIsbn13: string;
79-
ibookIsbn10?: string;
80-
ibookIsbn13: string | null;
81-
ibookVolume2Isbn10?: string;
82-
ibookVolume2Isbn13: string | null;
79+
assignableIsbn10?: null;
80+
assignableIsbn13?: string | null;
8381
lastUpdatedWeb?: string;
8482
lastUpdatedPdf: string | null;
8583
licenseName: string;

src/app/pages/errata-form/form/ErrorSourceSelector.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,6 @@ function LabeledButton({selectedSource, sType, onChange, radioRef}) {
6363
function filterForBook(bookInfo) {
6464
// eslint-disable-next-line complexity
6565
return function (type) {
66-
if (type.startsWith('iBooks')) {
67-
return Boolean(bookInfo.ibook_link);
68-
}
69-
if (type.startsWith('Rover')) {
70-
return false;
71-
}
7266
if (type.startsWith('Assignable')) {
7367
return bookInfo.assignable_book;
7468
}

test/helpers/future-memory-router.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from 'react';
2+
import {MemoryRouter} from 'react-router-dom';
3+
4+
// @ts-expect-error does not exist on
5+
const {routerFuture} = global;
6+
7+
export default function FutureMemoryRouter(props: Parameters<typeof MemoryRouter>[0]) {
8+
return <MemoryRouter {...props} future={routerFuture} />;
9+
}

test/src/data/business-books.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ export default {
185185
amazonLink:
186186
'https://www.amazon.com/dp/1947172689',
187187
bookstoreComingSoon: true,
188-
compCopyAvailable: false,
189188
salesforceAbbreviation:
190189
'Financial Accounting',
191190
salesforceName: 'Financial Accounting',
@@ -223,7 +222,6 @@ export default {
223222
amazonLink:
224223
'https://www.amazon.com/dp/1947172603',
225224
bookstoreComingSoon: true,
226-
compCopyAvailable: false,
227225
salesforceAbbreviation:
228226
'Managerial Accounting',
229227
salesforceName: 'Managerial Accounting',
@@ -271,7 +269,6 @@ export default {
271269
amazonLink:
272270
'https://www.amazon.com/dp/1947172549',
273271
bookstoreComingSoon: false,
274-
compCopyAvailable: false,
275272
salesforceAbbreviation:
276273
'Introduction to Business',
277274
salesforceName: 'Introduction to Business',
@@ -304,7 +301,6 @@ export default {
304301
amazonComingSoon: false,
305302
amazonLink: '',
306303
bookstoreComingSoon: false,
307-
compCopyAvailable: true,
308304
salesforceAbbreviation: null,
309305
salesforceName: null,
310306
urls: [],
@@ -349,7 +345,6 @@ export default {
349345
amazonLink:
350346
'https://he.kendallhunt.com/sites/default/files/uploadedFiles/Kendall_Hunt/OPENSTAX_PRICE_LIST_and_ORDER_FORM.pdf',
351347
bookstoreComingSoon: false,
352-
compCopyAvailable: false,
353348
salesforceAbbreviation: null,
354349
salesforceName: null,
355350
urls: [],
@@ -408,7 +403,6 @@ export default {
408403
amazonLink:
409404
'https://www.amazon.com/dp/1947172689',
410405
bookstoreComingSoon: true,
411-
compCopyAvailable: false,
412406
salesforceAbbreviation: 'Financial Accounting',
413407
salesforceName: 'Financial Accounting',
414408
urls: [],
@@ -445,7 +439,6 @@ export default {
445439
amazonLink:
446440
'https://www.amazon.com/dp/1947172603',
447441
bookstoreComingSoon: true,
448-
compCopyAvailable: false,
449442
salesforceAbbreviation: 'Managerial Accounting',
450443
salesforceName: 'Managerial Accounting',
451444
urls: [],
@@ -497,7 +490,6 @@ export default {
497490
amazonComingSoon: false,
498491
amazonLink: 'https://www.amazon.com/dp/1947172549',
499492
bookstoreComingSoon: false,
500-
compCopyAvailable: false,
501493
salesforceAbbreviation: 'Introduction to Business',
502494
salesforceName: 'Introduction to Business',
503495
urls: [],
@@ -529,7 +521,6 @@ export default {
529521
amazonComingSoon: false,
530522
amazonLink: '',
531523
bookstoreComingSoon: false,
532-
compCopyAvailable: true,
533524
salesforceAbbreviation: null,
534525
salesforceName: null,
535526
urls: [],
@@ -568,8 +559,6 @@ export default {
568559
coverColor: 'blue',
569560
highResolutionPdfUrl: null,
570561
lowResolutionPdfUrl: null,
571-
ibookLink: '',
572-
ibookLinkVolume2: '',
573562
webviewLink:
574563
'https://dev.cnx.org/contents/547026cb-a330-4809-94bf-126be5f62381',
575564
webviewRexLink:
@@ -580,7 +569,6 @@ export default {
580569
amazonLink:
581570
'https://he.kendallhunt.com/sites/default/files/uploadedFiles/Kendall_Hunt/OPENSTAX_PRICE_LIST_and_ORDER_FORM.pdf',
582571
bookstoreComingSoon: false,
583-
compCopyAvailable: false,
584572
salesforceAbbreviation: null,
585573
salesforceName: null,
586574
urls: [],

test/src/data/college-algebra-postproc.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -436,8 +436,8 @@ export default {
436436
printIsbn13: '978-1-938168-38-3',
437437
printSoftcoverIsbn13: '978-1-50669-822-9',
438438
digitalIsbn13: '978-1-947172-12-8',
439-
ibookIsbn13: null,
440-
ibookVolume2Isbn13: null,
439+
assignableIsbn10: null,
440+
assignableIsbn13: '978-1-947172-12-14',
441441
licenseText: '',
442442
licenseName: 'Creative Commons Attribution License',
443443
licenseVersion: '4.0',
@@ -490,8 +490,6 @@ export default {
490490
link: 'https://openstax.org/webinars'
491491
},
492492
promoteSnippet: [],
493-
ibookLink: '',
494-
ibookLinkVolume2: '',
495493
webviewLink:
496494
'https://dev.cnx.org/contents/9b08c294-057f-4201-9f48-5d6ad992740d',
497495
webviewRexLink:
@@ -526,8 +524,6 @@ export default {
526524
buttonUrl: 'https://buyprint.openstax.org/bookstore-suppliers'
527525
}
528526
],
529-
compCopyAvailable: false,
530-
compCopyContent: ['iBooks comp copy request'],
531527
tutorMarketingBook: false,
532528
assignableBook: false,
533529
partnerListLabel: 'Technology Partners',

test/src/data/details-biology-2e.js

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -213,24 +213,6 @@ export default {
213213
"featured": false,
214214
"k12": false
215215
},
216-
{
217-
"id": 2086,
218-
"meta": {
219-
"type": "books.BookFacultyResources"
220-
},
221-
"resource_heading": "Apple iBooks Comp Copy",
222-
"resource_description": "<p>We don&#x27;t give out print copies, but instructors can get an enhanced, interactive version of the textbook with an Apple iBooks comp copy.</p>",
223-
"resource_unlocked": false,
224-
"creator_fest_resource": false,
225-
"link_external": "http://www.openstax.org/comp-copy",
226-
"link_page": null,
227-
"link_text": "Request your copy",
228-
"coming_soon_text": null,
229-
"video_reference_number": null,
230-
"updated": null,
231-
"featured": false,
232-
"k12": false
233-
},
234216
{
235217
"id": 2087,
236218
"meta": {

test/src/layouts/landing/footer.test.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import userEvent from '@testing-library/user-event';
33
import {render, screen, waitFor} from '@testing-library/preact';
44
import {describe, it} from '@jest/globals';
5-
import { MemoryRouter } from 'react-router-dom';
5+
import MR from '~/../../test/helpers/future-memory-router';
66
import { useContactDialog } from '~/layouts/landing/footer/flex';
77

88
const user = userEvent.setup({advanceTimers: jest.advanceTimersByTime});
@@ -31,9 +31,9 @@ describe('flex landing footer', () => {
3131
];
3232

3333
render(
34-
<MemoryRouter initialEntries={['']}>
34+
<MR initialEntries={['']}>
3535
<ShowContactDialog contactFormParams={contactFormParams} />
36-
</MemoryRouter>
36+
</MR>
3737
);
3838
expect(getIframe()).toBeNull();
3939
await user.click(await screen.findByText('Contact Us'));
@@ -48,5 +48,17 @@ describe('flex landing footer', () => {
4848
window.postMessage('CONTACT_FORM_SUBMITTED', '*');
4949
await waitFor(() => expect(getIframe()).toBeNull());
5050
});
51+
it('handles undefined contactFormParams', async () => {
52+
const getIframe = () => document.querySelector('iframe');
53+
54+
render(
55+
<MR initialEntries={['']}>
56+
<ShowContactDialog />
57+
</MR>
58+
);
59+
expect(getIframe()).toBeNull();
60+
await user.click(await screen.findByText('Contact Us'));
61+
expect(getIframe()?.src.endsWith('embedded/contact')).toBe(true);
62+
});
5163
});
5264
});

0 commit comments

Comments
 (0)