# @dac-software/phone-number

> Phone number logic for Qarson

Latest version **1.2.3** (published 2020-12-02) · 0 weekly downloads

## Install

```sh
npm install @dac-software/phone-number
pnpm add @dac-software/phone-number
yarn add @dac-software/phone-number
bun add @dac-software/phone-number
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.3 |
| Published | 2020-12-02 |
| First published | 2019-09-25 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10.0.0 |
| Dependencies | 4 |
| Unpacked size | 170.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | dac-software |

## Links

- npm: https://www.npmjs.com/package/@dac-software/phone-number
- npm.io page: https://npm.io/package/@dac-software/phone-number

## Dependencies (4)

- [react](https://npm.io/package/react.md) ^16.8.6
- [react-dom](https://npm.io/package/react-dom.md) ^16.8.6
- [escape-string-regexp](https://npm.io/package/escape-string-regexp.md) ^4.0.0
- [@dac-software/analytics-extensions](https://npm.io/package/@dac-software/analytics-extensions.md) ~1.0.0

## Recent versions

- 1.2.3 (latest) — 2020-12-02
- 1.2.3-QFR-1711-configure-tracking-for-new-goog.0 — 2020-12-02
- 1.2.1 — 2020-08-24
- 1.2.1-QFR-422-phone-number-is-not-pesonalized-.0 — 2020-08-14
- 1.2.0 — 2020-08-10
- 1.0.1-QFR-140-track-web-site-calls---forms-for.2 — 2020-08-06
- 1.0.1-QFR-140-track-web-site-calls---forms-for.1 — 2020-08-03
- 1.0.1-QFR-140-track-web-site-calls---forms-for.0 — 2020-07-30
- 1.0.1-mvp-release.4 — 2020-06-25
- 1.1.3 — 2020-06-25
- 1.1.2 — 2020-06-25
- 1.1.1 — 2020-06-25
- 1.1.0 — 2020-06-24
- 1.0.1-mvp-release.3 — 2020-05-26
- 1.0.1-Q2-2753-data-layer-for-conversions---con-release.9 — 2020-05-21
- … 32 more at https://npm.io/package/@dac-software/phone-number/versions

## README

#Phone Number
This is phone number logic app. It can be applied to qarson pl and fr. Library uses react, typescript, css written in SASS preprocessor.

Developing bundler is webpack.

Build production build made as simple tsc compilation with asset files copies provided

This app have custom event listener 'preparePhoneNumber' which reacts on event passed in GTM script.
This event can be dispatched everywhere on website using phonenumber app.

##Requirements
- nodejs v10 +
- npm v6.9.0 +

##Installation:
Installing dependencies
```bash
npm install
```
Build production library files
```bash
npm run build
```
* Build task build two types of library entrypoints : "web" - destined to web include (for example by script tag) with all depedencies built in (like react and other third party libraries) "ecma script module" - destined for further bundler processing, it is resolved through simply typescript compiling in package.json statement bash tsc -p tsconfig-prod.json && copyfiles "./lib/**/*.!(tsx|ts|d.ts|html)" "dist/esm" -u 1

##Use

Application should be used by placing 

```html
<div class="react-root-phone-number"><!-- form --></div>
```

Second mode allows to "predefine"/"force" phone number to show to client

```html
<div class="react-root-phone-number" data-forced-number=""122.122.122"><!-- form --></div>
```

Library through ESM exposes PhoneNumber react component

```jsx
<PhoneNumber forcedNumber={'123.123.123'} />
```

##Development

Running dev server in standalone mode
```bash
npm run start
```
Running dev mode through bundler in other project. Project should be linked by npm.
```bash
npm run build:dev
```
* build dev emmits files into dist/esm/phone-number without CSS / files extraction, it is determined by webpack condition on compilation mode

Running tests
```bash
npm run test
```
####Codestyle

We are in consonance with standardjs.

Validation codestyle:

npm run codestyle-check-typescript
Automatic fix:
```bash
npm run codestyle-typescript-fix
```
####CI (bitbucket pipelines)

Checks codestyles and run tests

##Compilation summary

| | ```npm start``` - (standalone dev) | ```npm run build:dev``` (imported as esm in higher bundler) | ```npm run build``` (production build)
|---|---|---|---|
|key dist files|none|dist/esm/phone-number.js|dist/esm/offers-gallery.js, dist/phone-number.js, dist/phone-number.css
|css extraction|no|css in js|esm: css in js, web: extracted
|files extraction|no|yes|no (copied)

## NPM publishing

### NPM publishing manually:

1) Increase version in package.json 
2) Npm login with proper username and password
    ```bash
    npm login
    ```
3) Npm publish (command will trigger prepare npm method which should build files to dist directory)
    ```bash
    npm publish --access=public
    ```

### NPM publishing through bitbucket  pipelines:

1) dev tag publish using pipeline named:
    ``custom: dev-npm-publish``

    This pipeline automatically defines branch related tag name, for example :
        ``1.0.0-some-branch-name.0``

2) production tag publish using pipeline named: 
    ``custom: prod-npm-publish``

    This pipeline requires what kind of semver tag should be defined for publish. You need to fill additional field in pipeline form and type one of version type :
        - patch
        - minor
        - major

---
_Source: https://npm.io/package/@dac-software/phone-number · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
