Skip to content

Commit

Permalink
Ember 5 (#1732)
Browse files Browse the repository at this point in the history
* Ember 5

* Get running on Ember 5

* Lint fix

* feat: conver session to javascript, unable to extend service with typescript (#1736)

---------

Co-authored-by: Bartlomiej Dudzik <bartholomew.dudzik@gmail.com>
  • Loading branch information
RobbieTheWagner and BobrImperator authored Aug 10, 2023
1 parent 1d1e2d0 commit 81548b5
Show file tree
Hide file tree
Showing 6 changed files with 533 additions and 234 deletions.
3 changes: 0 additions & 3 deletions app/routes/-private/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,5 @@ export default class ApplicationRoute extends Route {

await this.data.activate();
await this.data.synchronize();

this.session.on('authenticationSucceeded', () => this.data.synchronize());
this.session.on('invalidationSucceeded', () => this.data.reset());
}
}
19 changes: 19 additions & 0 deletions app/services/session.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { inject as service } from '@ember/service';

import BaseSessionService from 'ember-simple-auth/services/session';

export default class SessionService extends BaseSessionService {
@service('data') swachData;

async handleAuthentication() {
super.handleAuthentication(...arguments);

this.swachData.synchronize();
}

async handleInvalidation() {
super.handleInvalidation(...arguments);

this.swachData.reset();
}
}
17 changes: 10 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@
"@csstools/postcss-sass": "^5.0.1",
"@ctrl/tinycolor": "^3.6.0",
"@ember/optional-features": "^2.0.0",
"@ember/render-modifiers": "^2.0.5",
"@ember/render-modifiers": "^2.1.0",
"@ember/string": "^3.1.1",
"@ember/test-helpers": "^2.9.4",
"@embroider/compat": "^2.1.1",
"@embroider/core": "^2.1.1",
"@embroider/webpack": "^2.1.1",
"@embroider/compat": "^3.2.0",
"@embroider/core": "^3.2.0",
"@embroider/webpack": "^3.1.4",
"@gavant/glint-template-types": "^0.3.4",
"@glimmer/component": "^1.1.2",
"@glimmer/tracking": "^1.1.2",
Expand All @@ -70,7 +70,7 @@
"@types/ember-resolver": "^9.0.0",
"@types/ember__test-helpers": "^2.9.1",
"@types/qunit": "^2.19.6",
"@types/sinon": "^10.0.13",
"@types/sinon": "^10.0.15",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"aws4fetch": "^1.0.17",
Expand Down Expand Up @@ -114,9 +114,9 @@
"ember-resolver": "^10.1.1",
"ember-set-body-class": "^1.0.2",
"ember-set-helper": "^2.0.1",
"ember-simple-auth": "^4.2.2",
"ember-simple-auth": "^6.0.0-rc.1",
"ember-sinon-qunit": "^7.1.4",
"ember-source": "^4.12.3",
"ember-source": "^5.1.2",
"ember-svg-jar": "^2.4.3",
"ember-template-lint": "^5.11.1",
"ember-template-lint-plugin-prettier": "^4.2.0",
Expand Down Expand Up @@ -156,6 +156,9 @@
"overrides": {
"ember-animated>@ember/test-helpers": "^2.9.3",
"ember-animated>ember-element-helper": "^0.6.1"
},
"patchedDependencies": {
"ember-inputmask@0.11.0": "patches/ember-inputmask@0.11.0.patch"
}
},
"engines": {
Expand Down
92 changes: 92 additions & 0 deletions patches/ember-inputmask@0.11.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
diff --git a/addon/components/one-way-credit-card-mask.js b/addon/components/one-way-credit-card-mask.js
index 2fe41df0e0df27230d3f1b4ce9a27069644fecde..0989f18b91c9538f73bd31cc52ceaf4714c0208b 100644
--- a/addon/components/one-way-credit-card-mask.js
+++ b/addon/components/one-way-credit-card-mask.js
@@ -4,7 +4,6 @@ import OneWayInputMask, {
import { computed, set } from '@ember/object';
import { isBlank } from '@ember/utils';
import { scheduleOnce } from '@ember/runloop';
-import { assign } from '@ember/polyfills';


/**
@@ -18,7 +17,7 @@ export default OneWayInputMask.extend({

let options = this._options;

- set(this, '_options', assign({}, {
+ set(this, '_options', Object.assign({}, {
// We need to make sure we catch paste events so that we change the mask before the text
// hits the input. This is a callback provided by Inputmask.js
onBeforePaste: value => {
diff --git a/addon/components/one-way-date-mask.js b/addon/components/one-way-date-mask.js
index 50d0922925c322b4674ff480201a0774d670576f..08c301ccdcef7c8f5bf088bb35ec9b6bb99de558 100644
--- a/addon/components/one-way-date-mask.js
+++ b/addon/components/one-way-date-mask.js
@@ -1,6 +1,5 @@
import OneWayInputMask from 'ember-inputmask/components/one-way-input-mask';
import { set } from '@ember/object';
-import { assign } from '@ember/polyfills';

const DEFAULT_OPTIONS = {
inputFormat: 'dd/mm/yyyy',
@@ -20,6 +19,6 @@ export default OneWayInputMask.extend({
init() {
this._super(...arguments);

- set(this, '_options', assign({}, this._options, DEFAULT_OPTIONS));
+ set(this, '_options', Object.assign({}, this._options, DEFAULT_OPTIONS));
},
});
diff --git a/addon/components/one-way-input-mask.js b/addon/components/one-way-input-mask.js
index a9e97578578eeb5cf3bd65a59d02bb356b758bec..ccb8083346bec5a89cb904851575717e1683c3c1 100644
--- a/addon/components/one-way-input-mask.js
+++ b/addon/components/one-way-input-mask.js
@@ -3,7 +3,7 @@ import Inputmask from 'inputmask';
import { computed, get, set } from '@ember/object';
import { schedule } from '@ember/runloop';
import { areDifferent } from 'ember-inputmask/utils/compare-objects';
-import { assign } from '@ember/polyfills';
+

const DEFAULT_OPTIONS = {
rightAlign: false,
@@ -99,7 +99,7 @@ const OneWayInputMask = Component.extend({

// Give the mask some default options that can be overridden
let options = this.options;
- set(this, '_options', assign({}, DEFAULT_OPTIONS, options));
+ set(this, '_options', Object.assign({}, DEFAULT_OPTIONS, options));

// We want any attribute that is not explicitally blacklisted to be bound that way we don't
// have to whitelist every single html attribute that an `input` can have. Borrowed from
@@ -134,7 +134,7 @@ const OneWayInputMask = Component.extend({

if (didOptionsChange) {
// Override external options on top of internal options
- set(this, '_options', assign({}, this._options, options));
+ set(this, '_options', Object.assign({}, this._options, options));
}

// We want to reapply the mask if it has changed
diff --git a/addon/components/one-way-number-mask.js b/addon/components/one-way-number-mask.js
index 4790169a04df0d0b8797687846fc77495df79c35..e70b4471e745a2467c4427bffcc4f3cbabce32ea 100644
--- a/addon/components/one-way-number-mask.js
+++ b/addon/components/one-way-number-mask.js
@@ -3,7 +3,6 @@ import OneWayInputMask, {
} from 'ember-inputmask/components/one-way-input-mask';
import { set } from '@ember/object';
import { isBlank } from '@ember/utils';
-import { assign } from '@ember/polyfills';

const DEFAULT_OPTIONS = {
groupSeparator: ',',
@@ -35,7 +34,7 @@ export default OneWayInputMask.extend({
init() {
this._super(...arguments);

- set(this, '_options', assign({}, this._options, DEFAULT_OPTIONS));
+ set(this, '_options', Object.assign({}, this._options, DEFAULT_OPTIONS));

if (this.decimal) {
set(this, 'mask', 'decimal');
Loading

0 comments on commit 81548b5

Please sign in to comment.