Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hotfix 0.16.1 #52

Merged
merged 5 commits into from
Dec 13, 2019
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
2 changes: 1 addition & 1 deletion .createMockdata.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ do
mkdir -p src/assets/mock-data/$path

echo " to src/assets/mock-data/$path/get.json"
curl -sf -H "$header" "http://10.0.206.226:4322/INTERSHOP/rest/WFS/inSPIRED-inTRONICS-Site/-/${path}${params}" | jq -S -M "${jqquery}" | sed -e 's%/INTERSHOP/static/.*.jpg%assets/mock-img/product/a.jpg%' | sed -e 's%inSPIRED-inTRONICS-b2c-responsive:%assets/mock-img%' > src/assets/mock-data/$path/get.json
curl -sf -H "$header" "http://10.0.206.226:4322/INTERSHOP/rest/WFS/inSPIRED-inTRONICS-Site/-/${path}${params}" | jq -S -M "${jqquery}" | sed -e 's%/INTERSHOP/static/.*.jpg%assets/img/not_available.png%' > src/assets/mock-data/$path/get.json
done
1 change: 0 additions & 1 deletion .createMockdata.table
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,3 @@ suggest ?SearchTerm=kodak
products ?amount=9&attrs=sku,salePrice,listPrice,availability,manufacturer,image,minOrderQuantity,inStock,promotions,packingUnit,mastered,productMaster,productMasterSKU,roundedAverageRating&offset=0&returnSortKeys=true&searchTerm=kodak {elements:[.elements[]|select(.uri|test(".*/7912057"))],name,type,sortKeys,total:1,offset,amount}
countries ? . Accept:application/vnd.intershop.country.v1+json
customers/- ? . Authorization:BASIC\ cGF0cmljaWFAdGVzdC5pbnRlcnNob3AuZGU6IUludGVyU2hvcDAwIQ==
cms/includes/pwa.include.homepage.pagelet2-Include
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ browserslist
LICENSE
/charts/**/templates/*
*~
roboto.scss
4 changes: 3 additions & 1 deletion 3rd-party-licenses.txt
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@
"inquirer@6.5.1","MIT","Copyright (c) 2012 Simon Boudrias","https://github.com/SBoudrias/Inquirer.js"
"internal-ip@4.3.0","MIT","Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)","https://github.com/sindresorhus/internal-ip"
"interpret@1.2.0","MIT","Copyright (c) 2014-2018 Tyler Kellen <tyler@sleekcode.net>, Blaine Bublitz <blaine.bublitz@gmail.com>, and Eric Schoffstall <yo@contra.io>","https://github.com/gulpjs/interpret"
"intershop-pwa@0.16.0","UNLICENSED","Copyright (c) 2019 Intershop Communications AG, http://www.intershop.de",""
"intershop-pwa@0.16.1","UNLICENSED","Copyright (c) 2019 Intershop Communications AG, http://www.intershop.de",""
"intershop-schematics@0.0.1","UNLICENSED","",""
"intershop-tslint-rules@0.0.1","UNLICENSED","",""
"invariant@2.2.4","MIT","Copyright (c) 2013-present, Facebook, Inc.","https://github.com/zertosh/invariant"
Expand Down Expand Up @@ -1383,6 +1383,8 @@
"type-fest@0.5.2","(MIT OR CC0-1.0)","Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)","https://github.com/sindresorhus/type-fest"
"type-is@1.6.18","MIT","Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>. Copyright (c) 2014-2015 Douglas Christopher Wilson <doug@somethingdoug.com>","https://github.com/jshttp/type-is"
"typedarray@0.0.6","MIT","","https://github.com/substack/typedarray"
"typeface-roboto-condensed@0.0.75","MIT","","https://github.com/KyleAMathews/typefaces/tree/master/packages/roboto-condensed"
"typeface-roboto@0.0.75","MIT","","https://github.com/KyleAMathews/typefaces/tree/master/packages/roboto"
"typescript@3.5.3","Apache-2.0","","https://github.com/Microsoft/TypeScript"
"uglify-js@3.7.0","BSD-2-Clause","Copyright 2012-2019 (c) Mihai Bazon <mihai.bazon@gmail.com>","https://github.com/mishoo/UglifyJS2"
"unherit@1.1.2","MIT","Copyright (c) 2015 Titus Wormer <tituswormer@gmail.com>","https://github.com/wooorm/unherit"
Expand Down
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
# [0.16.1](https://github.com/intershop/intershop-pwa/releases/tag/0.16.1) (2019-12-13)

> NOTE: To address the issue with trademarked content or content of questionable origin it was neccessary to clean the complete GitHub repository resulting in a rewritten history. Because of that change it is advisable to work with a new clone of the repository.

> NOTE: Release 0.16.1 is the first release that contains all necessary assets again to run "out of the box". Older releases will miss some referenced assets that had to be removed from an Open Source project.

**required Intershop Commerce Management version: 7.10.15.2**

### Bug Fixes

- remove trademark content from open source project (#39)
- always write apiToken cookie as it is a functional cookie (#36)

### Code Refactoring

- switch from roboto font files contained in the sources to ones provided via npm packages
- move all used images to a central img folder for a better overview

# [0.16.0](https://github.com/intershop/intershop-pwa/releases/tag/0.16.0) (2019-11-29)

**required Intershop Commerce Management version: 7.10.15.2**
Expand Down
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<img src="./intershop-logo.png">

# Intershop Progressive Web App

Welcome to the Intershop PWA project!
Expand All @@ -10,8 +8,6 @@ Accompany us on a journey for great cutting-edge eCommerce and take the chance t

If you want to get a first impression, please visit our [public demo](https://intershoppwa.azurewebsites.net/home).

<img src="./intershop-pwa-screenshot.png">

More information on the PWA can be found [here](https://www.intershop.com/en/progressive-web-app).

In order to contribute, please have a look at our [Contribution Guidelines](./CONTRIBUTING.md)
Expand Down
12 changes: 11 additions & 1 deletion package-lock.json

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

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "intershop-pwa",
"description": "Intershop Progressive Web App",
"version": "0.16.0",
"version": "0.16.1",
"license": "Intershop Standard Software End User License Agreement Intershop 7",
"keywords": [
"intershop"
Expand Down Expand Up @@ -81,6 +81,8 @@
"ngx-toastr": "^10.2.0",
"rxjs": "~6.5.3",
"tslib": "^1.10.0",
"typeface-roboto": "0.0.75",
"typeface-roboto-condensed": "0.0.75",
"url-polyfill": "^1.1.7",
"zone.js": "~0.9.1"
},
Expand Down
51 changes: 13 additions & 38 deletions src/app/core/services/cookies/cookies.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PLATFORM_ID } from '@angular/core';
import { TestBed } from '@angular/core/testing';
import { CookiesService as ForeignCookiesService } from '@ngx-utils/cookies';
import { anything, instance, mock, verify, when } from 'ts-mockito';
import { anything, instance, mock, verify } from 'ts-mockito';

import { CookiesService } from './cookies.service';

Expand Down Expand Up @@ -29,44 +29,19 @@ describe('Cookies Service', () => {
verify(foreignCookiesServiceMock.get('dummy')).once();
});

describe('when cookieLaw was not yet accepted', () => {
it('should call remove of underlying implementation', done => {
setTimeout(() => {
cookiesService.remove('dummy');
verify(foreignCookiesServiceMock.remove('dummy')).once();
done();
}, 2000);
});

it('should not call put of underlying implementation', done => {
setTimeout(() => {
cookiesService.put('dummy', 'value');
verify(foreignCookiesServiceMock.put(anything(), anything())).never();
verify(foreignCookiesServiceMock.put(anything(), anything(), anything())).never();
done();
}, 2000);
});
it('should call remove of underlying implementation', done => {
setTimeout(() => {
cookiesService.remove('dummy');
verify(foreignCookiesServiceMock.remove('dummy')).once();
done();
}, 2000);
});

describe('when cookieLaw was accepted', () => {
beforeEach(() => {
when(foreignCookiesServiceMock.get('cookieLawSeen')).thenReturn('true');
});

it('should call remove of underlying implementation', done => {
setTimeout(() => {
cookiesService.remove('dummy');
verify(foreignCookiesServiceMock.remove('dummy')).once();
done();
}, 2000);
});

it('should call put of underlying implementation', done => {
setTimeout(() => {
cookiesService.put('dummy', 'value');
verify(foreignCookiesServiceMock.put('dummy', anything(), anything())).once();
done();
}, 2000);
});
it('should call put of underlying implementation', done => {
setTimeout(() => {
cookiesService.put('dummy', 'value');
verify(foreignCookiesServiceMock.put('dummy', anything(), anything())).once();
done();
}, 2000);
});
});
11 changes: 3 additions & 8 deletions src/app/core/services/cookies/cookies.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ import { isPlatformBrowser } from '@angular/common';
import { ApplicationRef, Inject, Injectable, PLATFORM_ID } from '@angular/core';
import { CookiesOptions, CookiesService as ForeignCookiesService } from '@ngx-utils/cookies';
import { ReplaySubject, timer } from 'rxjs';
import { distinct, map, switchMap, take, tap } from 'rxjs/operators';
import { distinct, map, switchMap, take } from 'rxjs/operators';

import { whenTruthy } from 'ish-core/utils/operators';

@Injectable({ providedIn: 'root' })
export class CookiesService {
private cookieLawSeen: boolean;

cookieLawSeen$ = new ReplaySubject<boolean>(1);

constructor(
Expand All @@ -25,8 +23,7 @@ export class CookiesService {
switchMap(() =>
timer(0, 1000).pipe(
map(() => this.cookiesService.get('cookieLawSeen') === 'true'),
distinct(),
tap(cookieLawSeen => (this.cookieLawSeen = cookieLawSeen))
distinct()
)
)
)
Expand All @@ -45,8 +42,6 @@ export class CookiesService {
}

put(key: string, value: string, options?: CookiesOptions) {
if (this.cookieLawSeen) {
this.cookiesService.put(key, value, options);
}
this.cookiesService.put(key, value, options);
}
}
41 changes: 3 additions & 38 deletions src/app/core/store/restore/restore.effects.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import { provideMockActions } from '@ngrx/effects/testing';
import { Action, combineReducers } from '@ngrx/store';
import { cold } from 'jest-marbles';
import { Observable, ReplaySubject, of } from 'rxjs';
import { Observable, of } from 'rxjs';
import { anyString, anything, capture, instance, mock, verify, when } from 'ts-mockito';

import { Order } from 'ish-core/models/order/order.model';
Expand All @@ -28,12 +28,9 @@ describe('Restore Effects', () => {
let actions$: Observable<Action>;
let cookiesServiceMock: CookiesService;
let store$: TestStore;
let cookieLawSubject$: ReplaySubject<boolean>;

beforeEach(() => {
cookiesServiceMock = mock(CookiesService);
cookieLawSubject$ = new ReplaySubject(1);
when(cookiesServiceMock.cookieLawSeen$).thenReturn(cookieLawSubject$);

TestBed.configureTestingModule({
imports: [
Expand Down Expand Up @@ -118,10 +115,6 @@ describe('Restore Effects', () => {
});

describe('saveAPITokenToCookie$', () => {
beforeEach(() => {
cookieLawSubject$.next(true);
});

it('should not save token when neither basket nor user nor order is available', () => {
store$.dispatch(new SetAPIToken({ apiToken: 'dummy' }));

Expand Down Expand Up @@ -197,9 +190,7 @@ describe('Restore Effects', () => {
});

describe('logOutUserIfTokenVanishes$', () => {
it('should log out user when token is not available and cookie law was accepted', done => {
cookieLawSubject$.next(true);

it('should log out user when token is not available', done => {
store$.dispatch(new LoginUserSuccess({ user: { email: 'test@intershop.de' } as User, customer: undefined }));

restoreEffects.logOutUserIfTokenVanishes$.subscribe(
Expand All @@ -211,23 +202,10 @@ describe('Restore Effects', () => {
fail
);
});

it('should do nothing when cookie law was not yet accepted', done => {
cookieLawSubject$.next(false);

store$.dispatch(new LoginUserSuccess({ user: { email: 'test@intershop.de' } as User, customer: undefined }));

restoreEffects.logOutUserIfTokenVanishes$.subscribe(fail, fail, fail);

// terminate checking
setTimeout(done, 3000);
});
});

describe('removeAnonymousBasketIfTokenVanishes$', () => {
it('should remove basket when token is not available and cookie law was accepted', done => {
cookieLawSubject$.next(true);

it('should remove basket when token is not available', done => {
store$.dispatch(new LoadBasketSuccess({ basket: BasketMockData.getBasket() }));

restoreEffects.removeAnonymousBasketIfTokenVanishes$.subscribe({
Expand All @@ -239,20 +217,7 @@ describe('Restore Effects', () => {
});
});

it('should do nothing when cookie law was not yet accepted', done => {
cookieLawSubject$.next(false);

store$.dispatch(new LoadBasketSuccess({ basket: BasketMockData.getBasket() }));

restoreEffects.removeAnonymousBasketIfTokenVanishes$.subscribe(fail, fail, fail);

// terminate checking
setTimeout(done, 3000);
});

it('should do nothing when user is available', done => {
cookieLawSubject$.next(true);

store$.dispatch(new LoginUserSuccess({ user: { email: 'test@intershop.de' } as User, customer: undefined }));
store$.dispatch(new LoadBasketSuccess({ basket: BasketMockData.getBasket() }));

Expand Down
13 changes: 4 additions & 9 deletions src/app/core/store/restore/restore.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ export class RestoreEffects {
this.store$.pipe(select(getCurrentBasket)),
this.store$.pipe(select(getSelectedOrderId)),
this.store$.pipe(select(getAPIToken)),
this.cookieService.cookieLawSeen$,
]).pipe(
filter(() => isPlatformBrowser(this.platformId)),
filter(([user, basket, orderId]) => !!user || !!basket || !!orderId),
map(([user, basket, orderId, apiToken]) =>
this.makeCookie({ apiToken, type: user ? 'user' : basket ? 'basket' : 'order', orderId })
Expand All @@ -82,6 +82,7 @@ export class RestoreEffects {
*/
@Effect()
restoreUserOrBasketOrOrderByToken$ = this.router.events.pipe(
filter(() => isPlatformBrowser(this.platformId)),
filter(event => event instanceof NavigationStart),
first(),
map(() => this.cookieService.get('apiToken')),
Expand Down Expand Up @@ -109,8 +110,7 @@ export class RestoreEffects {
concatMapTo(
interval(1000).pipe(
takeWhile(() => isPlatformBrowser(this.platformId)),
withLatestFrom(this.store$.pipe(select(getLoggedInUser)), this.cookieService.cookieLawSeen$),
filter(([, , cookieLawAccepted]) => cookieLawAccepted),
withLatestFrom(this.store$.pipe(select(getLoggedInUser))),
map(([, user]) => ({ user, apiToken: this.cookieService.get('apiToken') })),
filter(({ user, apiToken }) => user && !apiToken),
mapTo(new LogoutUser())
Expand All @@ -125,12 +125,7 @@ export class RestoreEffects {
concatMapTo(
interval(1000).pipe(
takeWhile(() => isPlatformBrowser(this.platformId)),
withLatestFrom(
this.store$.pipe(select(getLoggedInUser)),
this.store$.pipe(select(getCurrentBasket)),
this.cookieService.cookieLawSeen$
),
filter(([, , , cookieLawAccepted]) => cookieLawAccepted),
withLatestFrom(this.store$.pipe(select(getLoggedInUser)), this.store$.pipe(select(getCurrentBasket))),
map(([, user, basket]) => ({ user, basket, apiToken: this.cookieService.get('apiToken') })),
filter(({ user, basket, apiToken }) => !user && basket && !apiToken),
mapTo(new ResetBasket())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<div class="empty-cart">
<img
class="empty-cart-icon"
src="assets/img/checkout/empty-cart.png"
alt="{{ 'shopping_cart.empty.alt.text' | translate }}"
/>
<img class="empty-cart-icon" src="assets/img/empty-cart.png" alt="{{ 'shopping_cart.empty.alt.text' | translate }}" />

<h2>{{ 'shopping_cart.empty.text' | translate }}</h2>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
z-index: 1;
min-width: 50px;
min-height: 50px;
background: #fff url('/assets/img/icons/loading.gif') center center no-repeat;
background: #fff url('/assets/img/loading.gif') center center no-repeat;
opacity: 0.5;
}

Expand Down
Loading