@taiga-ui/addon-commerce 2.55.0 → 3.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/taiga-ui-addon-commerce-components-card.umd.js +424 -305
- package/bundles/taiga-ui-addon-commerce-components-card.umd.js.map +1 -1
- package/bundles/taiga-ui-addon-commerce-components-input-card-grouped.umd.js +623 -466
- package/bundles/taiga-ui-addon-commerce-components-input-card-grouped.umd.js.map +1 -1
- package/bundles/taiga-ui-addon-commerce-components-input-card.umd.js +461 -331
- package/bundles/taiga-ui-addon-commerce-components-input-card.umd.js.map +1 -1
- package/bundles/taiga-ui-addon-commerce-components-input-cvc.umd.js +444 -314
- package/bundles/taiga-ui-addon-commerce-components-input-cvc.umd.js.map +1 -1
- package/bundles/taiga-ui-addon-commerce-components-input-expire.umd.js +432 -306
- package/bundles/taiga-ui-addon-commerce-components-input-expire.umd.js.map +1 -1
- package/bundles/taiga-ui-addon-commerce-components-money.umd.js +516 -384
- package/bundles/taiga-ui-addon-commerce-components-money.umd.js.map +1 -1
- package/bundles/taiga-ui-addon-commerce-components.umd.js +15 -27
- package/bundles/taiga-ui-addon-commerce-components.umd.js.map +1 -1
- package/bundles/taiga-ui-addon-commerce-constants.umd.js +38 -36
- package/bundles/taiga-ui-addon-commerce-constants.umd.js.map +1 -1
- package/bundles/taiga-ui-addon-commerce-enums.umd.js +6 -35
- package/bundles/taiga-ui-addon-commerce-enums.umd.js.map +1 -1
- package/bundles/taiga-ui-addon-commerce-interfaces.umd.js +2 -2
- package/bundles/taiga-ui-addon-commerce-interfaces.umd.js.map +1 -1
- package/bundles/taiga-ui-addon-commerce-pipes.umd.js +63 -274
- package/bundles/taiga-ui-addon-commerce-pipes.umd.js.map +1 -1
- package/bundles/taiga-ui-addon-commerce-tokens.umd.js +11 -7
- package/bundles/taiga-ui-addon-commerce-tokens.umd.js.map +1 -1
- package/bundles/taiga-ui-addon-commerce-types.umd.js +2 -2
- package/bundles/taiga-ui-addon-commerce-types.umd.js.map +1 -1
- package/bundles/taiga-ui-addon-commerce-utils.umd.js +63 -107
- package/bundles/taiga-ui-addon-commerce-utils.umd.js.map +1 -1
- package/bundles/taiga-ui-addon-commerce-validators.umd.js +17 -11
- package/bundles/taiga-ui-addon-commerce-validators.umd.js.map +1 -1
- package/bundles/taiga-ui-addon-commerce.umd.js +31 -33
- package/bundles/taiga-ui-addon-commerce.umd.js.map +1 -1
- package/components/card/card.component.d.ts +5 -2
- package/components/card/card.module.d.ts +7 -0
- package/components/card/package.json +2 -5
- package/components/card/taiga-ui-addon-commerce-components-card.d.ts +1 -0
- package/components/input-card/input-card.component.d.ts +4 -2
- package/components/input-card/input-card.module.d.ts +8 -0
- package/components/input-card/package.json +2 -5
- package/components/input-card/taiga-ui-addon-commerce-components-input-card.d.ts +1 -0
- package/components/input-card-grouped/input-card-grouped.component.d.ts +5 -3
- package/components/input-card-grouped/input-card-grouped.module.d.ts +12 -0
- package/components/input-card-grouped/package.json +2 -5
- package/components/input-card-grouped/taiga-ui-addon-commerce-components-input-card-grouped.d.ts +1 -0
- package/components/input-cvc/input-cvc.component.d.ts +3 -1
- package/components/input-cvc/input-cvc.module.d.ts +8 -0
- package/components/input-cvc/package.json +2 -5
- package/components/input-cvc/taiga-ui-addon-commerce-components-input-cvc.d.ts +1 -0
- package/components/input-expire/input-expire.component.d.ts +3 -1
- package/components/input-expire/input-expire.module.d.ts +8 -0
- package/components/input-expire/package.json +2 -5
- package/components/input-expire/taiga-ui-addon-commerce-components-input-expire.d.ts +1 -0
- package/components/money/money-options.d.ts +4 -4
- package/components/money/money.component.d.ts +7 -4
- package/components/money/money.module.d.ts +10 -0
- package/components/money/package.json +2 -5
- package/components/money/pipes/fraction-part.pipe.d.ts +5 -2
- package/components/money/pipes/integer-part.pipe.d.ts +3 -0
- package/components/money/pipes/sign-symbol.pipe.d.ts +5 -2
- package/components/money/taiga-ui-addon-commerce-components-money.d.ts +1 -0
- package/components/money/utils/format-fraction-part.d.ts +2 -2
- package/components/money/utils/format-sign-symbol.d.ts +2 -2
- package/components/package.json +2 -5
- package/components/taiga-ui-addon-commerce-components.d.ts +1 -0
- package/constants/package.json +2 -5
- package/constants/taiga-ui-addon-commerce-constants.d.ts +1 -0
- package/enums/currency-code.d.ts +0 -5
- package/enums/index.d.ts +0 -2
- package/enums/package.json +2 -5
- package/enums/taiga-ui-addon-commerce-enums.d.ts +1 -0
- package/esm2015/components/card/card.component.js +44 -30
- package/esm2015/components/card/card.module.js +15 -12
- package/esm2015/components/card/index.js +1 -1
- package/esm2015/components/card/taiga-ui-addon-commerce-components-card.js +1 -1
- package/esm2015/components/index.js +1 -1
- package/esm2015/components/input-card/index.js +1 -1
- package/esm2015/components/input-card/input-card.component.js +72 -56
- package/esm2015/components/input-card/input-card.module.js +24 -13
- package/esm2015/components/input-card/taiga-ui-addon-commerce-components-input-card.js +1 -1
- package/esm2015/components/input-card-grouped/index.js +1 -1
- package/esm2015/components/input-card-grouped/input-card-grouped.component.js +148 -121
- package/esm2015/components/input-card-grouped/input-card-grouped.module.js +45 -15
- package/esm2015/components/input-card-grouped/input-card-grouped.providers.js +3 -3
- package/esm2015/components/input-card-grouped/taiga-ui-addon-commerce-components-input-card-grouped.js +1 -1
- package/esm2015/components/input-cvc/index.js +1 -1
- package/esm2015/components/input-cvc/input-cvc.component.js +56 -43
- package/esm2015/components/input-cvc/input-cvc.module.js +26 -13
- package/esm2015/components/input-cvc/taiga-ui-addon-commerce-components-input-cvc.js +1 -1
- package/esm2015/components/input-expire/index.js +1 -1
- package/esm2015/components/input-expire/input-expire.component.js +49 -38
- package/esm2015/components/input-expire/input-expire.module.js +24 -13
- package/esm2015/components/input-expire/taiga-ui-addon-commerce-components-input-expire.js +1 -1
- package/esm2015/components/money/index.js +1 -1
- package/esm2015/components/money/money-options.js +4 -4
- package/esm2015/components/money/money.component.js +48 -35
- package/esm2015/components/money/money.module.js +23 -17
- package/esm2015/components/money/pipes/fraction-part.pipe.js +13 -12
- package/esm2015/components/money/pipes/integer-part.pipe.js +13 -12
- package/esm2015/components/money/pipes/sign-symbol.pipe.js +10 -8
- package/esm2015/components/money/taiga-ui-addon-commerce-components-money.js +1 -1
- package/esm2015/components/money/utils/format-fraction-part.js +4 -4
- package/esm2015/components/money/utils/format-sign-symbol.js +4 -4
- package/esm2015/components/taiga-ui-addon-commerce-components.js +1 -1
- package/esm2015/constants/card-holder-mask.js +27 -27
- package/esm2015/constants/card-mask.js +5 -5
- package/esm2015/constants/default-card-validator.js +3 -3
- package/esm2015/constants/index.js +1 -1
- package/esm2015/constants/taiga-ui-addon-commerce-constants.js +1 -1
- package/esm2015/enums/currency-code.js +1 -7
- package/esm2015/enums/currency.js +1 -1
- package/esm2015/enums/index.js +1 -3
- package/esm2015/enums/taiga-ui-addon-commerce-enums.js +1 -1
- package/esm2015/index.js +3 -1
- package/esm2015/interfaces/card.js +2 -1
- package/esm2015/interfaces/index.js +2 -1
- package/esm2015/interfaces/taiga-ui-addon-commerce-interfaces.js +2 -1
- package/esm2015/pipes/currency/currency.module.js +14 -11
- package/esm2015/pipes/currency/currency.pipe.js +12 -10
- package/esm2015/pipes/format-card/format-card.module.js +14 -11
- package/esm2015/pipes/format-card/format-card.pipe.js +14 -12
- package/esm2015/pipes/index.js +1 -1
- package/esm2015/pipes/taiga-ui-addon-commerce-pipes.js +1 -1
- package/esm2015/taiga-ui-addon-commerce.js +1 -1
- package/esm2015/tokens/i18n.js +6 -6
- package/esm2015/tokens/index.js +1 -1
- package/esm2015/tokens/taiga-ui-addon-commerce-tokens.js +1 -1
- package/esm2015/types/code-length.js +2 -1
- package/esm2015/types/currency-variants.js +2 -1
- package/esm2015/types/index.js +5 -1
- package/esm2015/types/money-sign.js +2 -1
- package/esm2015/types/payment-system.js +2 -0
- package/esm2015/types/taiga-ui-addon-commerce-types.js +2 -1
- package/esm2015/utils/create-auto-corrected-expire-pipe.js +6 -6
- package/esm2015/utils/format-currency.js +7 -7
- package/esm2015/utils/get-currency-symbol.js +21 -26
- package/esm2015/utils/get-payment-system.js +18 -48
- package/esm2015/utils/index.js +1 -1
- package/esm2015/utils/is-card-length-valid.js +9 -11
- package/esm2015/utils/is-card-number-valid.js +4 -6
- package/esm2015/utils/is-expire-valid.js +1 -1
- package/esm2015/utils/taiga-ui-addon-commerce-utils.js +1 -1
- package/esm2015/validators/card-expire.validator.js +2 -2
- package/esm2015/validators/card-number.validator.js +4 -4
- package/esm2015/validators/index.js +1 -1
- package/esm2015/validators/luhn.validator.js +5 -3
- package/esm2015/validators/taiga-ui-addon-commerce-validators.js +1 -1
- package/fesm2015/taiga-ui-addon-commerce-components-card.js +58 -39
- package/fesm2015/taiga-ui-addon-commerce-components-card.js.map +1 -1
- package/fesm2015/taiga-ui-addon-commerce-components-input-card-grouped.js +196 -136
- package/fesm2015/taiga-ui-addon-commerce-components-input-card-grouped.js.map +1 -1
- package/fesm2015/taiga-ui-addon-commerce-components-input-card.js +96 -67
- package/fesm2015/taiga-ui-addon-commerce-components-input-card.js.map +1 -1
- package/fesm2015/taiga-ui-addon-commerce-components-input-cvc.js +81 -53
- package/fesm2015/taiga-ui-addon-commerce-components-input-cvc.js.map +1 -1
- package/fesm2015/taiga-ui-addon-commerce-components-input-expire.js +72 -48
- package/fesm2015/taiga-ui-addon-commerce-components-input-expire.js.map +1 -1
- package/fesm2015/taiga-ui-addon-commerce-components-money.js +133 -108
- package/fesm2015/taiga-ui-addon-commerce-components-money.js.map +1 -1
- package/fesm2015/taiga-ui-addon-commerce-components.js.map +1 -1
- package/fesm2015/taiga-ui-addon-commerce-constants.js +32 -32
- package/fesm2015/taiga-ui-addon-commerce-constants.js.map +1 -1
- package/fesm2015/taiga-ui-addon-commerce-enums.js +1 -34
- package/fesm2015/taiga-ui-addon-commerce-enums.js.map +1 -1
- package/fesm2015/taiga-ui-addon-commerce-interfaces.js.map +1 -1
- package/fesm2015/taiga-ui-addon-commerce-pipes.js +47 -33
- package/fesm2015/taiga-ui-addon-commerce-pipes.js.map +1 -1
- package/fesm2015/taiga-ui-addon-commerce-tokens.js +5 -5
- package/fesm2015/taiga-ui-addon-commerce-tokens.js.map +1 -1
- package/fesm2015/taiga-ui-addon-commerce-types.js.map +1 -1
- package/fesm2015/taiga-ui-addon-commerce-utils.js +58 -97
- package/fesm2015/taiga-ui-addon-commerce-utils.js.map +1 -1
- package/fesm2015/taiga-ui-addon-commerce-validators.js +7 -5
- package/fesm2015/taiga-ui-addon-commerce-validators.js.map +1 -1
- package/fesm2015/taiga-ui-addon-commerce.js +2 -0
- package/fesm2015/taiga-ui-addon-commerce.js.map +1 -1
- package/interfaces/package.json +2 -5
- package/interfaces/taiga-ui-addon-commerce-interfaces.d.ts +1 -0
- package/package.json +12 -15
- package/pipes/currency/currency.module.d.ts +5 -0
- package/pipes/currency/currency.pipe.d.ts +3 -0
- package/pipes/format-card/format-card.module.d.ts +5 -0
- package/pipes/format-card/format-card.pipe.d.ts +3 -0
- package/pipes/package.json +2 -5
- package/pipes/taiga-ui-addon-commerce-pipes.d.ts +1 -0
- package/taiga-ui-addon-commerce.d.ts +1 -0
- package/tokens/package.json +2 -5
- package/tokens/taiga-ui-addon-commerce-tokens.d.ts +1 -0
- package/types/index.d.ts +1 -0
- package/types/money-sign.d.ts +1 -1
- package/types/package.json +2 -5
- package/types/payment-system.d.ts +1 -0
- package/types/taiga-ui-addon-commerce-types.d.ts +1 -0
- package/utils/get-currency-symbol.d.ts +1 -5
- package/utils/get-payment-system.d.ts +7 -31
- package/utils/is-card-length-valid.d.ts +1 -3
- package/utils/is-card-number-valid.d.ts +1 -3
- package/utils/package.json +2 -5
- package/utils/taiga-ui-addon-commerce-utils.d.ts +1 -0
- package/validators/package.json +2 -5
- package/validators/taiga-ui-addon-commerce-validators.d.ts +1 -0
- package/bundles/taiga-ui-addon-commerce-components-card.umd.min.js +0 -2
- package/bundles/taiga-ui-addon-commerce-components-card.umd.min.js.map +0 -1
- package/bundles/taiga-ui-addon-commerce-components-input-card-grouped.umd.min.js +0 -2
- package/bundles/taiga-ui-addon-commerce-components-input-card-grouped.umd.min.js.map +0 -1
- package/bundles/taiga-ui-addon-commerce-components-input-card.umd.min.js +0 -2
- package/bundles/taiga-ui-addon-commerce-components-input-card.umd.min.js.map +0 -1
- package/bundles/taiga-ui-addon-commerce-components-input-cvc.umd.min.js +0 -2
- package/bundles/taiga-ui-addon-commerce-components-input-cvc.umd.min.js.map +0 -1
- package/bundles/taiga-ui-addon-commerce-components-input-expire.umd.min.js +0 -2
- package/bundles/taiga-ui-addon-commerce-components-input-expire.umd.min.js.map +0 -1
- package/bundles/taiga-ui-addon-commerce-components-money.umd.min.js +0 -2
- package/bundles/taiga-ui-addon-commerce-components-money.umd.min.js.map +0 -1
- package/bundles/taiga-ui-addon-commerce-components.umd.min.js +0 -2
- package/bundles/taiga-ui-addon-commerce-components.umd.min.js.map +0 -1
- package/bundles/taiga-ui-addon-commerce-constants.umd.min.js +0 -2
- package/bundles/taiga-ui-addon-commerce-constants.umd.min.js.map +0 -1
- package/bundles/taiga-ui-addon-commerce-enums.umd.min.js +0 -2
- package/bundles/taiga-ui-addon-commerce-enums.umd.min.js.map +0 -1
- package/bundles/taiga-ui-addon-commerce-interfaces.umd.min.js +0 -2
- package/bundles/taiga-ui-addon-commerce-interfaces.umd.min.js.map +0 -1
- package/bundles/taiga-ui-addon-commerce-pipes.umd.min.js +0 -2
- package/bundles/taiga-ui-addon-commerce-pipes.umd.min.js.map +0 -1
- package/bundles/taiga-ui-addon-commerce-tokens.umd.min.js +0 -2
- package/bundles/taiga-ui-addon-commerce-tokens.umd.min.js.map +0 -1
- package/bundles/taiga-ui-addon-commerce-types.umd.min.js +0 -2
- package/bundles/taiga-ui-addon-commerce-types.umd.min.js.map +0 -1
- package/bundles/taiga-ui-addon-commerce-utils.umd.min.js +0 -2
- package/bundles/taiga-ui-addon-commerce-utils.umd.min.js.map +0 -1
- package/bundles/taiga-ui-addon-commerce-validators.umd.min.js +0 -2
- package/bundles/taiga-ui-addon-commerce-validators.umd.min.js.map +0 -1
- package/bundles/taiga-ui-addon-commerce.umd.min.js +0 -2
- package/bundles/taiga-ui-addon-commerce.umd.min.js.map +0 -1
- package/components/card/taiga-ui-addon-commerce-components-card.metadata.json +0 -1
- package/components/input-card/taiga-ui-addon-commerce-components-input-card.metadata.json +0 -1
- package/components/input-card-grouped/taiga-ui-addon-commerce-components-input-card-grouped.metadata.json +0 -1
- package/components/input-cvc/taiga-ui-addon-commerce-components-input-cvc.metadata.json +0 -1
- package/components/input-expire/taiga-ui-addon-commerce-components-input-expire.metadata.json +0 -1
- package/components/money/taiga-ui-addon-commerce-components-money.metadata.json +0 -1
- package/components/taiga-ui-addon-commerce-components.metadata.json +0 -1
- package/constants/taiga-ui-addon-commerce-constants.metadata.json +0 -1
- package/enums/money-sign.d.ts +0 -16
- package/enums/payment-system.d.ts +0 -8
- package/enums/taiga-ui-addon-commerce-enums.metadata.json +0 -1
- package/esm2015/enums/money-sign.js +0 -18
- package/esm2015/enums/payment-system.js +0 -9
- package/esm5/components/card/card.component.js +0 -73
- package/esm5/components/card/card.module.js +0 -19
- package/esm5/components/card/index.js +0 -3
- package/esm5/components/card/taiga-ui-addon-commerce-components-card.js +0 -5
- package/esm5/components/index.js +0 -7
- package/esm5/components/input-card/index.js +0 -3
- package/esm5/components/input-card/input-card.component.js +0 -167
- package/esm5/components/input-card/input-card.module.js +0 -25
- package/esm5/components/input-card/taiga-ui-addon-commerce-components-input-card.js +0 -5
- package/esm5/components/input-card-grouped/index.js +0 -4
- package/esm5/components/input-card-grouped/input-card-grouped.component.js +0 -511
- package/esm5/components/input-card-grouped/input-card-grouped.module.js +0 -40
- package/esm5/components/input-card-grouped/input-card-grouped.providers.js +0 -34
- package/esm5/components/input-card-grouped/taiga-ui-addon-commerce-components-input-card-grouped.js +0 -5
- package/esm5/components/input-cvc/index.js +0 -3
- package/esm5/components/input-cvc/input-cvc.component.js +0 -113
- package/esm5/components/input-cvc/input-cvc.module.js +0 -26
- package/esm5/components/input-cvc/taiga-ui-addon-commerce-components-input-cvc.js +0 -5
- package/esm5/components/input-expire/index.js +0 -3
- package/esm5/components/input-expire/input-expire.component.js +0 -108
- package/esm5/components/input-expire/input-expire.module.js +0 -25
- package/esm5/components/input-expire/taiga-ui-addon-commerce-components-input-expire.js +0 -5
- package/esm5/components/money/index.js +0 -9
- package/esm5/components/money/money-options.js +0 -18
- package/esm5/components/money/money.component.js +0 -101
- package/esm5/components/money/money.module.js +0 -27
- package/esm5/components/money/pipes/fraction-part.pipe.js +0 -27
- package/esm5/components/money/pipes/integer-part.pipe.js +0 -21
- package/esm5/components/money/pipes/sign-symbol.pipe.js +0 -16
- package/esm5/components/money/taiga-ui-addon-commerce-components-money.js +0 -5
- package/esm5/components/money/utils/format-fraction-part.js +0 -7
- package/esm5/components/money/utils/format-sign-symbol.js +0 -11
- package/esm5/components/taiga-ui-addon-commerce-components.js +0 -5
- package/esm5/constants/card-holder-mask.js +0 -37
- package/esm5/constants/card-mask.js +0 -30
- package/esm5/constants/default-card-validator.js +0 -5
- package/esm5/constants/index.js +0 -4
- package/esm5/constants/taiga-ui-addon-commerce-constants.js +0 -5
- package/esm5/enums/currency-code.js +0 -171
- package/esm5/enums/currency.js +0 -171
- package/esm5/enums/index.js +0 -5
- package/esm5/enums/money-sign.js +0 -18
- package/esm5/enums/payment-system.js +0 -9
- package/esm5/enums/taiga-ui-addon-commerce-enums.js +0 -5
- package/esm5/index.js +0 -8
- package/esm5/interfaces/card.js +0 -1
- package/esm5/interfaces/index.js +0 -1
- package/esm5/interfaces/taiga-ui-addon-commerce-interfaces.js +0 -4
- package/esm5/pipes/currency/currency.module.js +0 -16
- package/esm5/pipes/currency/currency.pipe.js +0 -18
- package/esm5/pipes/format-card/format-card.module.js +0 -16
- package/esm5/pipes/format-card/format-card.pipe.js +0 -22
- package/esm5/pipes/index.js +0 -5
- package/esm5/pipes/taiga-ui-addon-commerce-pipes.js +0 -5
- package/esm5/taiga-ui-addon-commerce.js +0 -5
- package/esm5/tokens/i18n.js +0 -13
- package/esm5/tokens/index.js +0 -2
- package/esm5/tokens/taiga-ui-addon-commerce-tokens.js +0 -5
- package/esm5/types/code-length.js +0 -1
- package/esm5/types/currency-variants.js +0 -1
- package/esm5/types/index.js +0 -1
- package/esm5/types/money-sign.js +0 -1
- package/esm5/types/taiga-ui-addon-commerce-types.js +0 -4
- package/esm5/utils/create-auto-corrected-expire-pipe.js +0 -43
- package/esm5/utils/format-currency.js +0 -17
- package/esm5/utils/get-currency-symbol.js +0 -71
- package/esm5/utils/get-payment-system.js +0 -103
- package/esm5/utils/index.js +0 -8
- package/esm5/utils/is-card-length-valid.js +0 -25
- package/esm5/utils/is-card-number-valid.js +0 -21
- package/esm5/utils/is-expire-valid.js +0 -14
- package/esm5/utils/taiga-ui-addon-commerce-utils.js +0 -5
- package/esm5/validators/card-expire.validator.js +0 -10
- package/esm5/validators/card-number.validator.js +0 -9
- package/esm5/validators/index.js +0 -4
- package/esm5/validators/luhn.validator.js +0 -9
- package/esm5/validators/taiga-ui-addon-commerce-validators.js +0 -5
- package/fesm5/taiga-ui-addon-commerce-components-card.js +0 -94
- package/fesm5/taiga-ui-addon-commerce-components-card.js.map +0 -1
- package/fesm5/taiga-ui-addon-commerce-components-input-card-grouped.js +0 -579
- package/fesm5/taiga-ui-addon-commerce-components-input-card-grouped.js.map +0 -1
- package/fesm5/taiga-ui-addon-commerce-components-input-card.js +0 -193
- package/fesm5/taiga-ui-addon-commerce-components-input-card.js.map +0 -1
- package/fesm5/taiga-ui-addon-commerce-components-input-cvc.js +0 -140
- package/fesm5/taiga-ui-addon-commerce-components-input-cvc.js.map +0 -1
- package/fesm5/taiga-ui-addon-commerce-components-input-expire.js +0 -134
- package/fesm5/taiga-ui-addon-commerce-components-input-expire.js.map +0 -1
- package/fesm5/taiga-ui-addon-commerce-components-money.js +0 -210
- package/fesm5/taiga-ui-addon-commerce-components-money.js.map +0 -1
- package/fesm5/taiga-ui-addon-commerce-components.js +0 -11
- package/fesm5/taiga-ui-addon-commerce-components.js.map +0 -1
- package/fesm5/taiga-ui-addon-commerce-constants.js +0 -78
- package/fesm5/taiga-ui-addon-commerce-constants.js.map +0 -1
- package/fesm5/taiga-ui-addon-commerce-enums.js +0 -375
- package/fesm5/taiga-ui-addon-commerce-enums.js.map +0 -1
- package/fesm5/taiga-ui-addon-commerce-interfaces.js +0 -4
- package/fesm5/taiga-ui-addon-commerce-interfaces.js.map +0 -1
- package/fesm5/taiga-ui-addon-commerce-pipes.js +0 -67
- package/fesm5/taiga-ui-addon-commerce-pipes.js.map +0 -1
- package/fesm5/taiga-ui-addon-commerce-tokens.js +0 -20
- package/fesm5/taiga-ui-addon-commerce-tokens.js.map +0 -1
- package/fesm5/taiga-ui-addon-commerce-types.js +0 -4
- package/fesm5/taiga-ui-addon-commerce-types.js.map +0 -1
- package/fesm5/taiga-ui-addon-commerce-utils.js +0 -298
- package/fesm5/taiga-ui-addon-commerce-utils.js.map +0 -1
- package/fesm5/taiga-ui-addon-commerce-validators.js +0 -31
- package/fesm5/taiga-ui-addon-commerce-validators.js.map +0 -1
- package/fesm5/taiga-ui-addon-commerce.js +0 -12
- package/fesm5/taiga-ui-addon-commerce.js.map +0 -1
- package/interfaces/taiga-ui-addon-commerce-interfaces.metadata.json +0 -1
- package/pipes/taiga-ui-addon-commerce-pipes.metadata.json +0 -1
- package/taiga-ui-addon-commerce.metadata.json +0 -1
- package/tokens/taiga-ui-addon-commerce-tokens.metadata.json +0 -1
- package/types/taiga-ui-addon-commerce-types.metadata.json +0 -1
- package/utils/taiga-ui-addon-commerce-utils.metadata.json +0 -1
- package/validators/taiga-ui-addon-commerce-validators.metadata.json +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-addon-commerce-interfaces.js","sources":["
|
|
1
|
+
{"version":3,"file":"taiga-ui-addon-commerce-interfaces.js","sources":["../../../projects/addon-commerce/interfaces/taiga-ui-addon-commerce-interfaces.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAAA;;AAEG"}
|
|
@@ -1,49 +1,63 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
2
|
import { Pipe, NgModule } from '@angular/core';
|
|
3
3
|
import { formatCurrency } from '@taiga-ui/addon-commerce/utils';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
class TuiCurrencyPipe {
|
|
6
6
|
transform(currency) {
|
|
7
7
|
return formatCurrency(currency);
|
|
8
8
|
}
|
|
9
|
-
}
|
|
10
|
-
TuiCurrencyPipe =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
}
|
|
10
|
+
TuiCurrencyPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TuiCurrencyPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
11
|
+
TuiCurrencyPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TuiCurrencyPipe, name: "tuiCurrency" });
|
|
12
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TuiCurrencyPipe, decorators: [{
|
|
13
|
+
type: Pipe,
|
|
14
|
+
args: [{
|
|
15
|
+
name: `tuiCurrency`,
|
|
16
|
+
}]
|
|
17
|
+
}] });
|
|
15
18
|
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
TuiCurrencyPipeModule =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
class TuiCurrencyPipeModule {
|
|
20
|
+
}
|
|
21
|
+
TuiCurrencyPipeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TuiCurrencyPipeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
22
|
+
TuiCurrencyPipeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TuiCurrencyPipeModule, declarations: [TuiCurrencyPipe], exports: [TuiCurrencyPipe] });
|
|
23
|
+
TuiCurrencyPipeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TuiCurrencyPipeModule });
|
|
24
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TuiCurrencyPipeModule, decorators: [{
|
|
25
|
+
type: NgModule,
|
|
26
|
+
args: [{
|
|
27
|
+
declarations: [TuiCurrencyPipe],
|
|
28
|
+
exports: [TuiCurrencyPipe],
|
|
29
|
+
}]
|
|
30
|
+
}] });
|
|
24
31
|
|
|
25
|
-
|
|
26
|
-
transform(value =
|
|
32
|
+
class TuiFormatCardPipe {
|
|
33
|
+
transform(value = ``, cardPrefilled = false) {
|
|
27
34
|
return value && !cardPrefilled
|
|
28
35
|
? value
|
|
29
|
-
.split(
|
|
36
|
+
.split(``)
|
|
30
37
|
.map((char, index) => (index && index % 4 === 0 ? ` ${char}` : char))
|
|
31
|
-
.join(
|
|
32
|
-
:
|
|
38
|
+
.join(``)
|
|
39
|
+
: ``;
|
|
33
40
|
}
|
|
34
|
-
}
|
|
35
|
-
TuiFormatCardPipe =
|
|
36
|
-
|
|
37
|
-
|
|
41
|
+
}
|
|
42
|
+
TuiFormatCardPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TuiFormatCardPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
43
|
+
TuiFormatCardPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TuiFormatCardPipe, name: "tuiFormatCard" });
|
|
44
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TuiFormatCardPipe, decorators: [{
|
|
45
|
+
type: Pipe,
|
|
46
|
+
args: [{ name: `tuiFormatCard` }]
|
|
47
|
+
}] });
|
|
38
48
|
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
TuiFormatCardModule =
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
49
|
+
class TuiFormatCardModule {
|
|
50
|
+
}
|
|
51
|
+
TuiFormatCardModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TuiFormatCardModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
52
|
+
TuiFormatCardModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TuiFormatCardModule, declarations: [TuiFormatCardPipe], exports: [TuiFormatCardPipe] });
|
|
53
|
+
TuiFormatCardModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TuiFormatCardModule });
|
|
54
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TuiFormatCardModule, decorators: [{
|
|
55
|
+
type: NgModule,
|
|
56
|
+
args: [{
|
|
57
|
+
declarations: [TuiFormatCardPipe],
|
|
58
|
+
exports: [TuiFormatCardPipe],
|
|
59
|
+
}]
|
|
60
|
+
}] });
|
|
47
61
|
|
|
48
62
|
/**
|
|
49
63
|
* Generated bundle index. Do not edit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-addon-commerce-pipes.js","sources":["
|
|
1
|
+
{"version":3,"file":"taiga-ui-addon-commerce-pipes.js","sources":["../../../projects/addon-commerce/pipes/currency/currency.pipe.ts","../../../projects/addon-commerce/pipes/currency/currency.module.ts","../../../projects/addon-commerce/pipes/format-card/format-card.pipe.ts","../../../projects/addon-commerce/pipes/format-card/format-card.module.ts","../../../projects/addon-commerce/pipes/taiga-ui-addon-commerce-pipes.ts"],"sourcesContent":["import {Pipe, PipeTransform} from '@angular/core';\nimport {TuiCurrencyVariants} from '@taiga-ui/addon-commerce/types';\nimport {formatCurrency} from '@taiga-ui/addon-commerce/utils';\n\n@Pipe({\n name: `tuiCurrency`,\n})\nexport class TuiCurrencyPipe implements PipeTransform {\n transform(currency: TuiCurrencyVariants): string {\n return formatCurrency(currency);\n }\n}\n","import {NgModule} from '@angular/core';\n\nimport {TuiCurrencyPipe} from './currency.pipe';\n\n@NgModule({\n declarations: [TuiCurrencyPipe],\n exports: [TuiCurrencyPipe],\n})\nexport class TuiCurrencyPipeModule {}\n","import {Pipe, PipeTransform} from '@angular/core';\n\n@Pipe({name: `tuiFormatCard`})\nexport class TuiFormatCardPipe implements PipeTransform {\n transform(value: string | null = ``, cardPrefilled: boolean = false): string {\n return value && !cardPrefilled\n ? value\n .split(``)\n .map((char, index) => (index && index % 4 === 0 ? ` ${char}` : char))\n .join(``)\n : ``;\n }\n}\n","import {NgModule} from '@angular/core';\n\nimport {TuiFormatCardPipe} from './format-card.pipe';\n\n@NgModule({\n declarations: [TuiFormatCardPipe],\n exports: [TuiFormatCardPipe],\n})\nexport class TuiFormatCardModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAOa,eAAe,CAAA;AACxB,IAAA,SAAS,CAAC,QAA6B,EAAA;AACnC,QAAA,OAAO,cAAc,CAAC,QAAQ,CAAC,CAAC;KACnC;;6GAHQ,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,IAAA,EAAA,CAAA,CAAA;2GAAf,eAAe,EAAA,IAAA,EAAA,aAAA,EAAA,CAAA,CAAA;4FAAf,eAAe,EAAA,UAAA,EAAA,CAAA;kBAH3B,IAAI;AAAC,YAAA,IAAA,EAAA,CAAA;AACF,oBAAA,IAAI,EAAE,CAAa,WAAA,CA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EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;kHAAnB,mBAAmB,EAAA,YAAA,EAAA,CAHb,iBAAiB,CAAA,EAAA,OAAA,EAAA,CACtB,iBAAiB,CAAA,EAAA,CAAA,CAAA;kHAElB,mBAAmB,EAAA,CAAA,CAAA;4FAAnB,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAJ/B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACN,YAAY,EAAE,CAAC,iBAAiB,CAAC;oBACjC,OAAO,EAAE,CAAC,iBAAiB,CAAC;AAC/B,iBAAA,CAAA;;;ACPD;;AAEG;;;;"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { InjectionToken } from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { tuiExtractI18n } from '@taiga-ui/i18n';
|
|
3
3
|
import { of } from 'rxjs';
|
|
4
4
|
|
|
5
5
|
const TUI_CARD_NUMBER_TEXTS = new InjectionToken(`Number and card number i18n`, {
|
|
6
|
-
factory:
|
|
6
|
+
factory: tuiExtractI18n(`cardNumber`),
|
|
7
7
|
});
|
|
8
8
|
const TUI_CARD_EXPIRY_TEXTS = new InjectionToken(`Expiry and card expiry i18n`, {
|
|
9
|
-
factory:
|
|
9
|
+
factory: tuiExtractI18n(`cardExpiry`),
|
|
10
10
|
});
|
|
11
|
-
const TUI_CARD_CVC_TEXTS = new InjectionToken(
|
|
12
|
-
factory: () => of([
|
|
11
|
+
const TUI_CARD_CVC_TEXTS = new InjectionToken(`Card CVC number text`, {
|
|
12
|
+
factory: () => of([`CVC`, `CVC/CVV`]),
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-addon-commerce-tokens.js","sources":["
|
|
1
|
+
{"version":3,"file":"taiga-ui-addon-commerce-tokens.js","sources":["../../../projects/addon-commerce/tokens/i18n.ts","../../../projects/addon-commerce/tokens/taiga-ui-addon-commerce-tokens.ts"],"sourcesContent":["import {InjectionToken} from '@angular/core';\nimport {tuiExtractI18n} from '@taiga-ui/i18n';\nimport {Observable, of} from 'rxjs';\n\nexport const TUI_CARD_NUMBER_TEXTS = new InjectionToken(`Number and card number i18n`, {\n factory: tuiExtractI18n(`cardNumber`),\n});\n\nexport const TUI_CARD_EXPIRY_TEXTS = new InjectionToken(`Expiry and card expiry i18n`, {\n factory: tuiExtractI18n(`cardExpiry`),\n});\n\nexport const TUI_CARD_CVC_TEXTS = new InjectionToken<Observable<[string, string]>>(\n `Card CVC number text`,\n {\n factory: () => of([`CVC`, `CVC/CVV`]),\n },\n);\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAIa,qBAAqB,GAAG,IAAI,cAAc,CAAC,6BAA6B,EAAE;AACnF,IAAA,OAAO,EAAE,cAAc,CAAC,CAAA,UAAA,CAAY,CAAC;AACxC,CAAA,EAAE;MAEU,qBAAqB,GAAG,IAAI,cAAc,CAAC,6BAA6B,EAAE;AACnF,IAAA,OAAO,EAAE,cAAc,CAAC,CAAA,UAAA,CAAY,CAAC;AACxC,CAAA,EAAE;MAEU,kBAAkB,GAAG,IAAI,cAAc,CAChD,sBAAsB,EACtB;IACI,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,CAAK,GAAA,CAAA,EAAE,CAAS,OAAA,CAAA,CAAC,CAAC;AACxC,CAAA;;AChBL;;AAEG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-addon-commerce-types.js","sources":["
|
|
1
|
+
{"version":3,"file":"taiga-ui-addon-commerce-types.js","sources":["../../../projects/addon-commerce/types/taiga-ui-addon-commerce-types.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAAA;;AAEG"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TUI_NON_DIGIT_REGEXP, TUI_NON_DIGITS_REGEXP } from '@taiga-ui/core';
|
|
2
|
-
import {
|
|
2
|
+
import { tuiIsString } from '@taiga-ui/cdk';
|
|
3
3
|
|
|
4
4
|
const TUI_EXP_YEAR_MONTH = /^\d{2}[/|.]\d{4}$/;
|
|
5
5
|
const TUI_EXP_SAFARI = /^\d{1,4}.\d{1,2}.\d{1,4}$/;
|
|
@@ -22,93 +22,88 @@ function tuiCreateAutoCorrectedExpirePipe() {
|
|
|
22
22
|
const array = rawValue.split(TUI_NON_DIGIT_REGEXP);
|
|
23
23
|
const month = array[1];
|
|
24
24
|
const year = array.find(({ length }) => length === 4);
|
|
25
|
-
conformedValue = `${
|
|
25
|
+
conformedValue = `${`0`.repeat(2 - month.length)}${month}/${year ? year.slice(2) : ``}`;
|
|
26
26
|
}
|
|
27
27
|
const indexesOfPipedChars = [];
|
|
28
|
-
const conformedValueArr = conformedValue.split(
|
|
28
|
+
const conformedValueArr = conformedValue.split(``);
|
|
29
29
|
if (parseInt(conformedValueArr[0], 10) > 1) {
|
|
30
|
-
conformedValueArr[2] =
|
|
30
|
+
conformedValueArr[2] = `/`;
|
|
31
31
|
conformedValueArr[1] = conformedValueArr[0];
|
|
32
|
-
conformedValueArr[0] =
|
|
32
|
+
conformedValueArr[0] = `0`;
|
|
33
33
|
indexesOfPipedChars.push(0);
|
|
34
34
|
}
|
|
35
35
|
return {
|
|
36
|
-
value: conformedValueArr.join(
|
|
36
|
+
value: conformedValueArr.join(``),
|
|
37
37
|
indexesOfPipedChars,
|
|
38
38
|
};
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
* @deprecated: use {@link tuiGetCurrencySymbol} instead
|
|
44
|
-
*/
|
|
45
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
46
|
-
function getCurrencySymbol(currency) {
|
|
42
|
+
function tuiGetCurrencySymbol(currency) {
|
|
47
43
|
switch (currency) {
|
|
48
44
|
case "RUB" /* Ruble */:
|
|
49
45
|
case "643" /* Ruble */:
|
|
50
|
-
return
|
|
46
|
+
return `₽`;
|
|
51
47
|
case "USD" /* Dollar */:
|
|
52
48
|
case "840" /* Dollar */:
|
|
53
49
|
case "MXN" /* MexicanPeso */:
|
|
54
50
|
case "484" /* MexicanPeso */:
|
|
55
|
-
return
|
|
51
|
+
return `$`;
|
|
56
52
|
case "SGD" /* SingaporeDollar */:
|
|
57
53
|
case "702" /* SingaporeDollar */:
|
|
58
|
-
return
|
|
54
|
+
return `S$`;
|
|
59
55
|
case "AUD" /* AustralianDollar */:
|
|
60
56
|
case "036" /* AustralianDollar */:
|
|
61
|
-
return
|
|
57
|
+
return `A$`;
|
|
62
58
|
case "HKD" /* HongKongDollar */:
|
|
63
59
|
case "344" /* HongKongDollar */:
|
|
64
|
-
return
|
|
60
|
+
return `HK$`;
|
|
65
61
|
case "CAD" /* CanadianDollar */:
|
|
66
62
|
case "124" /* CanadianDollar */:
|
|
67
|
-
return
|
|
63
|
+
return `C$`;
|
|
68
64
|
case "EUR" /* Euro */:
|
|
69
65
|
case "978" /* Euro */:
|
|
70
|
-
return
|
|
66
|
+
return `€`;
|
|
71
67
|
case "GBP" /* Pound */:
|
|
72
68
|
case "826" /* Pound */:
|
|
73
|
-
return
|
|
69
|
+
return `£`;
|
|
74
70
|
case "THB" /* Baht */:
|
|
75
71
|
case "764" /* Baht */:
|
|
76
|
-
return
|
|
72
|
+
return `฿`;
|
|
77
73
|
case "TRY" /* TurkishLira */:
|
|
78
74
|
case "949" /* TurkishLira */:
|
|
79
|
-
return
|
|
75
|
+
return `₺`;
|
|
80
76
|
case "CNY" /* YuanRenminbi */:
|
|
81
77
|
case "156" /* YuanRenminbi */:
|
|
82
|
-
return
|
|
78
|
+
return `CN¥`;
|
|
83
79
|
case "JPY" /* Yen */:
|
|
84
80
|
case "392" /* Yen */:
|
|
85
|
-
return
|
|
81
|
+
return `¥`;
|
|
86
82
|
case "ILS" /* IsraeliShekel */:
|
|
87
83
|
case "376" /* IsraeliShekel */:
|
|
88
|
-
return
|
|
84
|
+
return `₪`;
|
|
89
85
|
case "INR" /* IndianRupee */:
|
|
90
86
|
case "356" /* IndianRupee */:
|
|
91
|
-
return
|
|
87
|
+
return `₹`;
|
|
92
88
|
case "CHF" /* SwissFranc */:
|
|
93
89
|
case "756" /* SwissFranc */:
|
|
94
|
-
return
|
|
90
|
+
return `₣`;
|
|
95
91
|
case "AMD" /* ArmenianDram */:
|
|
96
92
|
case "051" /* ArmenianDram */:
|
|
97
|
-
return
|
|
93
|
+
return `֏`;
|
|
98
94
|
case "KRW" /* Won */:
|
|
99
95
|
case "410" /* Won */:
|
|
100
|
-
return
|
|
96
|
+
return `₩`;
|
|
101
97
|
case "KZT" /* Tenge */:
|
|
102
98
|
case "398" /* Tenge */:
|
|
103
|
-
return
|
|
99
|
+
return `₸`;
|
|
104
100
|
case "UAH" /* Hryvnia */:
|
|
105
101
|
case "980" /* Hryvnia */:
|
|
106
|
-
return
|
|
102
|
+
return `₴`;
|
|
107
103
|
default:
|
|
108
104
|
return null;
|
|
109
105
|
}
|
|
110
106
|
}
|
|
111
|
-
const tuiGetCurrencySymbol = getCurrencySymbol;
|
|
112
107
|
|
|
113
108
|
/**
|
|
114
109
|
* @deprecated: use {@link tuiFormatCurrency} instead
|
|
@@ -116,50 +111,41 @@ const tuiGetCurrencySymbol = getCurrencySymbol;
|
|
|
116
111
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
117
112
|
function formatCurrency(currency) {
|
|
118
113
|
const stringifiedCurrency = stringifyCurrency(currency);
|
|
119
|
-
return
|
|
114
|
+
return tuiGetCurrencySymbol(stringifiedCurrency) || stringifiedCurrency;
|
|
120
115
|
}
|
|
121
116
|
const tuiFormatCurrency = formatCurrency;
|
|
122
117
|
function stringifyCurrency(currency) {
|
|
123
|
-
return currency === null ||
|
|
124
|
-
? currency ||
|
|
125
|
-
:
|
|
118
|
+
return currency === null || tuiIsString(currency)
|
|
119
|
+
? currency || ``
|
|
120
|
+
: String(currency).padStart(3, `0`);
|
|
126
121
|
}
|
|
127
122
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
*/
|
|
131
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
132
|
-
function getPaymentSystem(cardNumber) {
|
|
133
|
-
if (cardNumber === '') {
|
|
123
|
+
function tuiGetPaymentSystem(cardNumber) {
|
|
124
|
+
if (cardNumber === ``) {
|
|
134
125
|
return null;
|
|
135
126
|
}
|
|
136
127
|
const one = Number.parseInt(cardNumber[0], 10);
|
|
137
128
|
const two = Number.parseInt(cardNumber.slice(0, 2), 10);
|
|
138
129
|
const three = Number.parseInt(cardNumber.slice(0, 3), 10);
|
|
139
130
|
const four = Number.parseInt(cardNumber.slice(0, 4), 10);
|
|
140
|
-
if (
|
|
141
|
-
return
|
|
131
|
+
if (tuiIsMaestro(three, two, one)) {
|
|
132
|
+
return `maestro`;
|
|
142
133
|
}
|
|
143
|
-
if (
|
|
144
|
-
return
|
|
134
|
+
if (tuiIsMastercard(four, two, one)) {
|
|
135
|
+
return `mastercard`;
|
|
145
136
|
}
|
|
146
|
-
if (
|
|
147
|
-
return
|
|
137
|
+
if (tuiIsMir(four)) {
|
|
138
|
+
return `mir`;
|
|
148
139
|
}
|
|
149
|
-
if (
|
|
150
|
-
return
|
|
140
|
+
if (tuiIsElectron(four)) {
|
|
141
|
+
return `electron`;
|
|
151
142
|
}
|
|
152
|
-
if (
|
|
153
|
-
return
|
|
143
|
+
if (tuiIsVisa(one)) {
|
|
144
|
+
return `visa`;
|
|
154
145
|
}
|
|
155
146
|
return null;
|
|
156
147
|
}
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* @deprecated: use {@link tuiIsMaestro} instead
|
|
160
|
-
*/
|
|
161
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
162
|
-
function isMaestro(three, two, one) {
|
|
148
|
+
function tuiIsMaestro(three, two, one) {
|
|
163
149
|
if (one === 6) {
|
|
164
150
|
return true;
|
|
165
151
|
}
|
|
@@ -171,12 +157,7 @@ function isMaestro(three, two, one) {
|
|
|
171
157
|
}
|
|
172
158
|
return three < 510;
|
|
173
159
|
}
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* @deprecated: use {@link tuiIsMastercard} instead
|
|
177
|
-
*/
|
|
178
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
179
|
-
function isMastercard(four, two, one) {
|
|
160
|
+
function tuiIsMastercard(four, two, one) {
|
|
180
161
|
if (one === 5) {
|
|
181
162
|
return true;
|
|
182
163
|
}
|
|
@@ -191,20 +172,10 @@ function isMastercard(four, two, one) {
|
|
|
191
172
|
}
|
|
192
173
|
return four > 2220 && four < 2721;
|
|
193
174
|
}
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* @deprecated: use {@link tuiIsMir} instead
|
|
197
|
-
*/
|
|
198
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
199
|
-
function isMir(four) {
|
|
175
|
+
function tuiIsMir(four) {
|
|
200
176
|
return four > 2199 && four < 2205;
|
|
201
177
|
}
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* @deprecated: use {@link tuiIsElectron} instead
|
|
205
|
-
*/
|
|
206
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
207
|
-
function isElectron(four) {
|
|
178
|
+
function tuiIsElectron(four) {
|
|
208
179
|
switch (four) {
|
|
209
180
|
case 4026:
|
|
210
181
|
case 4175:
|
|
@@ -218,49 +189,40 @@ function isElectron(four) {
|
|
|
218
189
|
return false;
|
|
219
190
|
}
|
|
220
191
|
}
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* @deprecated: use {@link tuiIsVisa} instead
|
|
224
|
-
*/
|
|
225
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
226
|
-
function isVisa(one) {
|
|
192
|
+
function tuiIsVisa(one) {
|
|
227
193
|
return one === 4;
|
|
228
194
|
}
|
|
229
|
-
const tuiIsVisa = isVisa;
|
|
230
195
|
|
|
231
196
|
/**
|
|
232
|
-
* @deprecated: use {@link tuiIsCardLengthValid} instead
|
|
233
197
|
* Validates card number length using payment system dictionary
|
|
234
198
|
*/
|
|
235
199
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
236
|
-
function
|
|
200
|
+
function tuiIsCardLengthValid(cardNumber) {
|
|
237
201
|
const { length } = cardNumber;
|
|
238
|
-
const paymentSystem =
|
|
202
|
+
const paymentSystem = tuiGetPaymentSystem(cardNumber);
|
|
239
203
|
switch (paymentSystem) {
|
|
240
|
-
case
|
|
204
|
+
case `electron`:
|
|
241
205
|
return length === 16;
|
|
242
|
-
case
|
|
206
|
+
case `maestro`:
|
|
243
207
|
return length > 11 && length < 20;
|
|
244
|
-
case
|
|
245
|
-
case
|
|
208
|
+
case `mastercard`:
|
|
209
|
+
case `mir`:
|
|
246
210
|
return length > 15 && length < 20;
|
|
247
|
-
case
|
|
211
|
+
case `visa`:
|
|
248
212
|
return length > 12 && length < 20;
|
|
249
213
|
default:
|
|
250
214
|
return length > 8 && length < 20;
|
|
251
215
|
}
|
|
252
216
|
}
|
|
253
|
-
const tuiIsCardLengthValid = isCardLengthValid;
|
|
254
217
|
|
|
255
218
|
/**
|
|
256
|
-
* @deprecated: use {@link tuiIsCardNumberValid} instead
|
|
257
219
|
* Validates card number using Luhn algorithm
|
|
258
220
|
*/
|
|
259
221
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
260
|
-
function
|
|
261
|
-
const cardNumber = String(value).replace(TUI_NON_DIGITS_REGEXP,
|
|
222
|
+
function tuiIsCardNumberValid(value) {
|
|
223
|
+
const cardNumber = String(value).replace(TUI_NON_DIGITS_REGEXP, ``);
|
|
262
224
|
const { length } = cardNumber;
|
|
263
|
-
const arr = cardNumber.split(
|
|
225
|
+
const arr = cardNumber.split(``).map((char, index) => {
|
|
264
226
|
const digit = parseInt(char, 10);
|
|
265
227
|
if ((index + length) % 2 === 0) {
|
|
266
228
|
const digitX2 = digit * 2;
|
|
@@ -270,7 +232,6 @@ function isCardNumberValid(value) {
|
|
|
270
232
|
});
|
|
271
233
|
return !(arr.reduce((a, b) => a + b, 0) % 10);
|
|
272
234
|
}
|
|
273
|
-
const tuiIsCardNumberValid = isCardNumberValid;
|
|
274
235
|
|
|
275
236
|
/**
|
|
276
237
|
* @deprecated: use {@link tuiIsExpireValid} instead
|
|
@@ -290,5 +251,5 @@ const tuiIsExpireValid = isExpireValid;
|
|
|
290
251
|
* Generated bundle index. Do not edit.
|
|
291
252
|
*/
|
|
292
253
|
|
|
293
|
-
export { formatCurrency,
|
|
254
|
+
export { formatCurrency, isExpireValid, tuiCreateAutoCorrectedExpirePipe, tuiFormatCurrency, tuiGetCurrencySymbol, tuiGetPaymentSystem, tuiIsCardLengthValid, tuiIsCardNumberValid, tuiIsElectron, tuiIsExpireValid, tuiIsMaestro, tuiIsMastercard, tuiIsMir, tuiIsVisa };
|
|
294
255
|
//# sourceMappingURL=taiga-ui-addon-commerce-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-addon-commerce-utils.js","sources":["ng://@taiga-ui/addon-commerce/utils/create-auto-corrected-expire-pipe.ts","ng://@taiga-ui/addon-commerce/utils/get-currency-symbol.ts","ng://@taiga-ui/addon-commerce/utils/format-currency.ts","ng://@taiga-ui/addon-commerce/utils/get-payment-system.ts","ng://@taiga-ui/addon-commerce/utils/is-card-length-valid.ts","ng://@taiga-ui/addon-commerce/utils/is-card-number-valid.ts","ng://@taiga-ui/addon-commerce/utils/is-expire-valid.ts","ng://@taiga-ui/addon-commerce/utils/taiga-ui-addon-commerce-utils.ts"],"sourcesContent":["import {TUI_NON_DIGIT_REGEXP, TuiTextMaskPipeHandler} from '@taiga-ui/core';\n\nconst TUI_EXP_YEAR_MONTH = /^\\d{2}[/|.]\\d{4}$/;\nconst TUI_EXP_SAFARI = /^\\d{1,4}.\\d{1,2}.\\d{1,4}$/;\n\n/**\n * Correct expiration date text allowing only valid months\n * @internal\n *\n * @returns MM/YY\n */\nexport function tuiCreateAutoCorrectedExpirePipe(): TuiTextMaskPipeHandler {\n return (conformedValue, {rawValue}) => {\n // Autofilled with MM/YYYY format\n if (TUI_EXP_YEAR_MONTH.test(rawValue)) {\n conformedValue = `${rawValue.slice(0, 2)}/${rawValue.slice(5)}`;\n }\n\n // Autofilled with Safari crazy format\n if (\n rawValue.length > 7 &&\n rawValue.length < 11 &&\n TUI_EXP_SAFARI.test(rawValue)\n ) {\n const array = rawValue.split(TUI_NON_DIGIT_REGEXP);\n const month = array[1];\n const year = array.find(({length}) => length === 4);\n\n conformedValue = `${'0'.repeat(2 - month.length)}${month}/${\n year ? year.slice(2) : ''\n }`;\n }\n\n const indexesOfPipedChars: number[] = [];\n const conformedValueArr = conformedValue.split('');\n\n if (parseInt(conformedValueArr[0], 10) > 1) {\n conformedValueArr[2] = '/';\n conformedValueArr[1] = conformedValueArr[0];\n conformedValueArr[0] = '0';\n indexesOfPipedChars.push(0);\n }\n\n return {\n value: conformedValueArr.join(''),\n indexesOfPipedChars,\n };\n };\n}\n","import {TuiCurrency, TuiCurrencyCode} from '@taiga-ui/addon-commerce/enums';\nimport {TuiCurrencyVariants} from '@taiga-ui/addon-commerce/types';\n\n/**\n * @deprecated: use {@link tuiGetCurrencySymbol} instead\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function getCurrencySymbol(currency: TuiCurrencyVariants): string | null {\n switch (currency) {\n case TuiCurrency.Ruble:\n case TuiCurrencyCode.Ruble:\n return '₽';\n case TuiCurrency.Dollar:\n case TuiCurrencyCode.Dollar:\n case TuiCurrency.MexicanPeso:\n case TuiCurrencyCode.MexicanPeso:\n return '$';\n case TuiCurrency.SingaporeDollar:\n case TuiCurrencyCode.SingaporeDollar:\n return 'S$';\n case TuiCurrency.AustralianDollar:\n case TuiCurrencyCode.AustralianDollar:\n return 'A$';\n case TuiCurrency.HongKongDollar:\n case TuiCurrencyCode.HongKongDollar:\n return 'HK$';\n case TuiCurrency.CanadianDollar:\n case TuiCurrencyCode.CanadianDollar:\n return 'C$';\n case TuiCurrency.Euro:\n case TuiCurrencyCode.Euro:\n return '€';\n case TuiCurrency.Pound:\n case TuiCurrencyCode.Pound:\n return '£';\n case TuiCurrency.Baht:\n case TuiCurrencyCode.Baht:\n return '฿';\n case TuiCurrency.TurkishLira:\n case TuiCurrencyCode.TurkishLira:\n return '₺';\n case TuiCurrency.YuanRenminbi:\n case TuiCurrencyCode.YuanRenminbi:\n return 'CN¥';\n case TuiCurrency.Yen:\n case TuiCurrencyCode.Yen:\n return '¥';\n case TuiCurrency.IsraeliShekel:\n case TuiCurrencyCode.IsraeliShekel:\n return '₪';\n case TuiCurrency.IndianRupee:\n case TuiCurrencyCode.IndianRupee:\n return '₹';\n case TuiCurrency.SwissFranc:\n case TuiCurrencyCode.SwissFranc:\n return '₣';\n case TuiCurrency.ArmenianDram:\n case TuiCurrencyCode.ArmenianDram:\n return '֏';\n case TuiCurrency.Won:\n case TuiCurrencyCode.Won:\n return '₩';\n case TuiCurrency.Tenge:\n case TuiCurrencyCode.Tenge:\n return '₸';\n case TuiCurrency.Hryvnia:\n case TuiCurrencyCode.Hryvnia:\n return '₴';\n default:\n return null;\n }\n}\n\nexport const tuiGetCurrencySymbol = getCurrencySymbol;\n","import {TuiCurrencyVariants} from '@taiga-ui/addon-commerce/types';\nimport {padStart} from '@taiga-ui/cdk';\n\nimport {getCurrencySymbol} from './get-currency-symbol';\n\n/**\n * @deprecated: use {@link tuiFormatCurrency} instead\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function formatCurrency(currency: TuiCurrencyVariants): string {\n const stringifiedCurrency = stringifyCurrency(currency);\n\n return getCurrencySymbol(stringifiedCurrency) || stringifiedCurrency;\n}\n\nexport const tuiFormatCurrency = formatCurrency;\n\nfunction stringifyCurrency(currency: TuiCurrencyVariants): string {\n return currency === null || typeof currency === 'string'\n ? currency || ''\n : padStart(String(currency), 3, '0');\n}\n","import {TuiPaymentSystem} from '@taiga-ui/addon-commerce/enums';\n\n/**\n * @deprecated: use {@link tuiGetPaymentSystem} instead\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function getPaymentSystem(cardNumber: string): TuiPaymentSystem | null {\n if (cardNumber === '') {\n return null;\n }\n\n const one = Number.parseInt(cardNumber[0], 10);\n const two = Number.parseInt(cardNumber.slice(0, 2), 10);\n const three = Number.parseInt(cardNumber.slice(0, 3), 10);\n const four = Number.parseInt(cardNumber.slice(0, 4), 10);\n\n if (isMaestro(three, two, one)) {\n return TuiPaymentSystem.Maestro;\n }\n\n if (isMastercard(four, two, one)) {\n return TuiPaymentSystem.Mastercard;\n }\n\n if (isMir(four)) {\n return TuiPaymentSystem.Mir;\n }\n\n if (isElectron(four)) {\n return TuiPaymentSystem.Electron;\n }\n\n if (isVisa(one)) {\n return TuiPaymentSystem.Visa;\n }\n\n return null;\n}\n\nexport const tuiGetPaymentSystem = getPaymentSystem;\n\n/**\n * @deprecated: use {@link tuiIsMaestro} instead\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function isMaestro(three: number, two: number, one: number): boolean {\n if (one === 6) {\n return true;\n }\n\n if (two === 50 || (two > 55 && two < 59)) {\n return true;\n }\n\n if (three < 500) {\n return false;\n }\n\n return three < 510;\n}\n\nexport const tuiIsMaestro = isMaestro;\n\n/**\n * @deprecated: use {@link tuiIsMastercard} instead\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function isMastercard(four: number, two: number, one: number): boolean {\n if (one === 5) {\n return true;\n }\n\n if (two < 10) {\n return false;\n }\n\n if (two > 50 && two < 56) {\n return true;\n }\n\n if (four < 1000) {\n return false;\n }\n\n return four > 2220 && four < 2721;\n}\n\nexport const tuiIsMastercard = isMastercard;\n\n/**\n * @deprecated: use {@link tuiIsMir} instead\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function isMir(four: number): boolean {\n return four > 2199 && four < 2205;\n}\n\nexport const tuiIsMir = isMir;\n\n/**\n * @deprecated: use {@link tuiIsElectron} instead\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function isElectron(four: number): boolean {\n switch (four) {\n case 4026:\n case 4175:\n case 4405:\n case 4508:\n case 4844:\n case 4913:\n case 4917:\n return true;\n default:\n return false;\n }\n}\n\nexport const tuiIsElectron = isElectron;\n\n/**\n * @deprecated: use {@link tuiIsVisa} instead\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function isVisa(one: number): boolean {\n return one === 4;\n}\n\nexport const tuiIsVisa = isVisa;\n","import {TuiPaymentSystem} from '@taiga-ui/addon-commerce/enums';\n\nimport {getPaymentSystem} from './get-payment-system';\n\n/**\n * @deprecated: use {@link tuiIsCardLengthValid} instead\n * Validates card number length using payment system dictionary\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function isCardLengthValid(cardNumber: string): boolean {\n const {length} = cardNumber;\n const paymentSystem = getPaymentSystem(cardNumber);\n\n switch (paymentSystem) {\n case TuiPaymentSystem.Electron:\n return length === 16;\n case TuiPaymentSystem.Maestro:\n return length > 11 && length < 20;\n case TuiPaymentSystem.Mastercard:\n case TuiPaymentSystem.Mir:\n return length > 15 && length < 20;\n case TuiPaymentSystem.Visa:\n return length > 12 && length < 20;\n default:\n return length > 8 && length < 20;\n }\n}\n\nexport const tuiIsCardLengthValid = isCardLengthValid;\n","import {TUI_NON_DIGITS_REGEXP} from '@taiga-ui/core';\n\n/**\n * @deprecated: use {@link tuiIsCardNumberValid} instead\n * Validates card number using Luhn algorithm\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function isCardNumberValid(value: string | number): boolean {\n const cardNumber = String(value).replace(TUI_NON_DIGITS_REGEXP, '');\n\n const {length} = cardNumber;\n const arr = cardNumber.split('').map((char, index) => {\n const digit = parseInt(char, 10);\n\n if ((index + length) % 2 === 0) {\n const digitX2 = digit * 2;\n\n return digitX2 > 9 ? digitX2 - 9 : digitX2;\n }\n\n return digit;\n });\n\n return !(arr.reduce((a, b) => a + b, 0) % 10);\n}\n\nexport const tuiIsCardNumberValid = isCardNumberValid;\n","/**\n * @deprecated: use {@link tuiIsExpireValid} instead\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function isExpireValid(expire: string): boolean {\n const today = new Date();\n const currentMonth = today.getMonth();\n const currentYear = today.getFullYear() - 2000;\n const month = parseInt(expire.slice(0, 2), 0);\n const year = parseInt(expire.slice(-2), 0);\n\n return year > currentYear || (year === currentYear && month >= currentMonth);\n}\n\nexport const tuiIsExpireValid = isExpireValid;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAEA,MAAM,kBAAkB,GAAG,mBAAmB,CAAC;AAC/C,MAAM,cAAc,GAAG,2BAA2B,CAAC;AAEnD;;;;;;SAMgB,gCAAgC;IAC5C,OAAO,CAAC,cAAc,EAAE,EAAC,QAAQ,EAAC;;QAE9B,IAAI,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;YACnC,cAAc,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;SACnE;;QAGD,IACI,QAAQ,CAAC,MAAM,GAAG,CAAC;YACnB,QAAQ,CAAC,MAAM,GAAG,EAAE;YACpB,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,EAC/B;YACE,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;YACnD,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YACvB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,EAAC,MAAM,EAAC,KAAK,MAAM,KAAK,CAAC,CAAC,CAAC;YAEpD,cAAc,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,KAAK,IACpD,IAAI,G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,YAAY,CAAC,CAAC;AACjF,CAAC;MAEY,gBAAgB,GAAG;;ACdhC;;;;;;"}
|
|
1
|
+
{"version":3,"file":"taiga-ui-addon-commerce-utils.js","sources":["../../../projects/addon-commerce/utils/create-auto-corrected-expire-pipe.ts","../../../projects/addon-commerce/utils/get-currency-symbol.ts","../../../projects/addon-commerce/utils/format-currency.ts","../../../projects/addon-commerce/utils/get-payment-system.ts","../../../projects/addon-commerce/utils/is-card-length-valid.ts","../../../projects/addon-commerce/utils/is-card-number-valid.ts","../../../projects/addon-commerce/utils/is-expire-valid.ts","../../../projects/addon-commerce/utils/taiga-ui-addon-commerce-utils.ts"],"sourcesContent":["import {TUI_NON_DIGIT_REGEXP, TuiTextMaskPipeHandler} from '@taiga-ui/core';\n\nconst TUI_EXP_YEAR_MONTH = /^\\d{2}[/|.]\\d{4}$/;\nconst TUI_EXP_SAFARI = /^\\d{1,4}.\\d{1,2}.\\d{1,4}$/;\n\n/**\n * Correct expiration date text allowing only valid months\n * @internal\n *\n * @returns MM/YY\n */\nexport function tuiCreateAutoCorrectedExpirePipe(): TuiTextMaskPipeHandler {\n return (conformedValue, {rawValue}) => {\n // Autofilled with MM/YYYY format\n if (TUI_EXP_YEAR_MONTH.test(rawValue)) {\n conformedValue = `${rawValue.slice(0, 2)}/${rawValue.slice(5)}`;\n }\n\n // Autofilled with Safari crazy format\n if (\n rawValue.length > 7 &&\n rawValue.length < 11 &&\n TUI_EXP_SAFARI.test(rawValue)\n ) {\n const array = rawValue.split(TUI_NON_DIGIT_REGEXP);\n const month = array[1];\n const year = array.find(({length}) => length === 4);\n\n conformedValue = `${`0`.repeat(2 - month.length)}${month}/${\n year ? year.slice(2) : ``\n }`;\n }\n\n const indexesOfPipedChars: number[] = [];\n const conformedValueArr = conformedValue.split(``);\n\n if (parseInt(conformedValueArr[0], 10) > 1) {\n conformedValueArr[2] = `/`;\n conformedValueArr[1] = conformedValueArr[0];\n conformedValueArr[0] = `0`;\n indexesOfPipedChars.push(0);\n }\n\n return {\n value: conformedValueArr.join(``),\n indexesOfPipedChars,\n };\n };\n}\n","import {TuiCurrency, TuiCurrencyCode} from '@taiga-ui/addon-commerce/enums';\nimport {TuiCurrencyVariants} from '@taiga-ui/addon-commerce/types';\n\nexport function tuiGetCurrencySymbol(currency: TuiCurrencyVariants): string | null {\n switch (currency) {\n case TuiCurrency.Ruble:\n case TuiCurrencyCode.Ruble:\n return `₽`;\n case TuiCurrency.Dollar:\n case TuiCurrencyCode.Dollar:\n case TuiCurrency.MexicanPeso:\n case TuiCurrencyCode.MexicanPeso:\n return `$`;\n case TuiCurrency.SingaporeDollar:\n case TuiCurrencyCode.SingaporeDollar:\n return `S$`;\n case TuiCurrency.AustralianDollar:\n case TuiCurrencyCode.AustralianDollar:\n return `A$`;\n case TuiCurrency.HongKongDollar:\n case TuiCurrencyCode.HongKongDollar:\n return `HK$`;\n case TuiCurrency.CanadianDollar:\n case TuiCurrencyCode.CanadianDollar:\n return `C$`;\n case TuiCurrency.Euro:\n case TuiCurrencyCode.Euro:\n return `€`;\n case TuiCurrency.Pound:\n case TuiCurrencyCode.Pound:\n return `£`;\n case TuiCurrency.Baht:\n case TuiCurrencyCode.Baht:\n return `฿`;\n case TuiCurrency.TurkishLira:\n case TuiCurrencyCode.TurkishLira:\n return `₺`;\n case TuiCurrency.YuanRenminbi:\n case TuiCurrencyCode.YuanRenminbi:\n return `CN¥`;\n case TuiCurrency.Yen:\n case TuiCurrencyCode.Yen:\n return `¥`;\n case TuiCurrency.IsraeliShekel:\n case TuiCurrencyCode.IsraeliShekel:\n return `₪`;\n case TuiCurrency.IndianRupee:\n case TuiCurrencyCode.IndianRupee:\n return `₹`;\n case TuiCurrency.SwissFranc:\n case TuiCurrencyCode.SwissFranc:\n return `₣`;\n case TuiCurrency.ArmenianDram:\n case TuiCurrencyCode.ArmenianDram:\n return `֏`;\n case TuiCurrency.Won:\n case TuiCurrencyCode.Won:\n return `₩`;\n case TuiCurrency.Tenge:\n case TuiCurrencyCode.Tenge:\n return `₸`;\n case TuiCurrency.Hryvnia:\n case TuiCurrencyCode.Hryvnia:\n return `₴`;\n default:\n return null;\n }\n}\n","import {TuiCurrencyVariants} from '@taiga-ui/addon-commerce/types';\nimport {tuiIsString} from '@taiga-ui/cdk';\n\nimport {tuiGetCurrencySymbol} from './get-currency-symbol';\n\n/**\n * @deprecated: use {@link tuiFormatCurrency} instead\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function formatCurrency(currency: TuiCurrencyVariants): string {\n const stringifiedCurrency = stringifyCurrency(currency);\n\n return tuiGetCurrencySymbol(stringifiedCurrency) || stringifiedCurrency;\n}\n\nexport const tuiFormatCurrency = formatCurrency;\n\nfunction stringifyCurrency(currency: TuiCurrencyVariants): string {\n return currency === null || tuiIsString(currency)\n ? currency || ``\n : String(currency).padStart(3, `0`);\n}\n","import {TuiPaymentSystem} from '@taiga-ui/addon-commerce/types';\n\nexport function tuiGetPaymentSystem(cardNumber: string): TuiPaymentSystem | null {\n if (cardNumber === ``) {\n return null;\n }\n\n const one = Number.parseInt(cardNumber[0], 10);\n const two = Number.parseInt(cardNumber.slice(0, 2), 10);\n const three = Number.parseInt(cardNumber.slice(0, 3), 10);\n const four = Number.parseInt(cardNumber.slice(0, 4), 10);\n\n if (tuiIsMaestro(three, two, one)) {\n return `maestro`;\n }\n\n if (tuiIsMastercard(four, two, one)) {\n return `mastercard`;\n }\n\n if (tuiIsMir(four)) {\n return `mir`;\n }\n\n if (tuiIsElectron(four)) {\n return `electron`;\n }\n\n if (tuiIsVisa(one)) {\n return `visa`;\n }\n\n return null;\n}\n\nexport function tuiIsMaestro(three: number, two: number, one: number): boolean {\n if (one === 6) {\n return true;\n }\n\n if (two === 50 || (two > 55 && two < 59)) {\n return true;\n }\n\n if (three < 500) {\n return false;\n }\n\n return three < 510;\n}\n\nexport function tuiIsMastercard(four: number, two: number, one: number): boolean {\n if (one === 5) {\n return true;\n }\n\n if (two < 10) {\n return false;\n }\n\n if (two > 50 && two < 56) {\n return true;\n }\n\n if (four < 1000) {\n return false;\n }\n\n return four > 2220 && four < 2721;\n}\n\nexport function tuiIsMir(four: number): boolean {\n return four > 2199 && four < 2205;\n}\n\nexport function tuiIsElectron(four: number): boolean {\n switch (four) {\n case 4026:\n case 4175:\n case 4405:\n case 4508:\n case 4844:\n case 4913:\n case 4917:\n return true;\n default:\n return false;\n }\n}\n\nexport function tuiIsVisa(one: number): boolean {\n return one === 4;\n}\n","import {tuiGetPaymentSystem} from './get-payment-system';\n\n/**\n * Validates card number length using payment system dictionary\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function tuiIsCardLengthValid(cardNumber: string): boolean {\n const {length} = cardNumber;\n const paymentSystem = tuiGetPaymentSystem(cardNumber);\n\n switch (paymentSystem) {\n case `electron`:\n return length === 16;\n case `maestro`:\n return length > 11 && length < 20;\n case `mastercard`:\n case `mir`:\n return length > 15 && length < 20;\n case `visa`:\n return length > 12 && length < 20;\n default:\n return length > 8 && length < 20;\n }\n}\n","import {TUI_NON_DIGITS_REGEXP} from '@taiga-ui/core';\n\n/**\n * Validates card number using Luhn algorithm\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function tuiIsCardNumberValid(value: string | number): boolean {\n const cardNumber = String(value).replace(TUI_NON_DIGITS_REGEXP, ``);\n\n const {length} = cardNumber;\n const arr = cardNumber.split(``).map((char, index) => {\n const digit = parseInt(char, 10);\n\n if ((index + length) % 2 === 0) {\n const digitX2 = digit * 2;\n\n return digitX2 > 9 ? digitX2 - 9 : digitX2;\n }\n\n return digit;\n });\n\n return !(arr.reduce((a, b) => a + b, 0) % 10);\n}\n","/**\n * @deprecated: use {@link tuiIsExpireValid} instead\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function isExpireValid(expire: string): boolean {\n const today = new Date();\n const currentMonth = today.getMonth();\n const currentYear = today.getFullYear() - 2000;\n const month = parseInt(expire.slice(0, 2), 0);\n const year = parseInt(expire.slice(-2), 0);\n\n return year > currentYear || (year === currentYear && month >= currentMonth);\n}\n\nexport const tuiIsExpireValid = isExpireValid;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAEA,MAAM,kBAAkB,GAAG,mBAAmB,CAAC;AAC/C,MAAM,cAAc,GAAG,2BAA2B,CAAC;AAEnD;;;;;AAKG;SACa,gCAAgC,GAAA;AAC5C,IAAA,OAAO,CAAC,cAAc,EAAE,EAAC,QAAQ,EAAC,KAAI;;AAElC,QAAA,IAAI,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;AACnC,YAAA,cAAc,GAAG,CAAG,EAAA,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA,CAAA,EAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AACnE,SAAA;;AAGD,QAAA,IACI,QAAQ,CAAC,MAAM,GAAG,CAAC;YACnB,QAAQ,CAAC,MAAM,GAAG,EAAE;AACpB,YAAA,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,EAC/B;YACE,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;AACnD,YAAA,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AACvB,YAAA,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,EAAC,MAAM,EAAC,KAAK,MAAM,KAAK,CAAC,CAAC,CAAC;AAEpD,YAAA,cAAc,GAAG,CAAA,EAAG,CAAG,CAAA,CAAA,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,KAAK,CAAA,CAAA,EACpD,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAA,CAC3B,EAAE,CAAC;AACN,SAAA;QAED,MAAM,mBAAmB,GAAa,EAAE,CAAC;QACzC,MAAM,iBAAiB,GAAG,cAAc,CAAC,KAAK,CAAC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isExpireValid, tuiIsCardNumberValid } from '@taiga-ui/addon-commerce/utils';
|
|
2
2
|
import { TuiValidationError } from '@taiga-ui/cdk';
|
|
3
3
|
|
|
4
4
|
function tuiCardExpireValidator({ value, }) {
|
|
5
5
|
var _a;
|
|
6
6
|
return ((_a = value === null || value === void 0 ? void 0 : value.expire) === null || _a === void 0 ? void 0 : _a.length) === 5 && !isExpireValid(value === null || value === void 0 ? void 0 : value.expire)
|
|
7
|
-
? { expire: new TuiValidationError(
|
|
7
|
+
? { expire: new TuiValidationError(`Expire date`) }
|
|
8
8
|
: null;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
function tuiCardNumberValidator({ value, }) {
|
|
12
|
-
return (value === null || value === void 0 ? void 0 : value.card) && !
|
|
13
|
-
? { card: new TuiValidationError(
|
|
12
|
+
return (value === null || value === void 0 ? void 0 : value.card) && !tuiIsCardNumberValid(value.card)
|
|
13
|
+
? { card: new TuiValidationError(`Invalid card number`) }
|
|
14
14
|
: null;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
function tuiCreateLuhnValidator(message) {
|
|
18
18
|
return ({ value }) => {
|
|
19
|
-
return
|
|
19
|
+
return tuiIsCardNumberValid(value)
|
|
20
|
+
? null
|
|
21
|
+
: { luhn: new TuiValidationError(message) };
|
|
20
22
|
};
|
|
21
23
|
}
|
|
22
24
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-addon-commerce-validators.js","sources":["
|
|
1
|
+
{"version":3,"file":"taiga-ui-addon-commerce-validators.js","sources":["../../../projects/addon-commerce/validators/card-expire.validator.ts","../../../projects/addon-commerce/validators/card-number.validator.ts","../../../projects/addon-commerce/validators/luhn.validator.ts","../../../projects/addon-commerce/validators/taiga-ui-addon-commerce-validators.ts"],"sourcesContent":["import {AbstractControl, ValidationErrors} from '@angular/forms';\nimport {isExpireValid} from '@taiga-ui/addon-commerce/utils';\nimport {TuiValidationError} from '@taiga-ui/cdk';\n\nexport function tuiCardExpireValidator({\n value,\n}: AbstractControl): ValidationErrors | null {\n return value?.expire?.length === 5 && !isExpireValid(value?.expire)\n ? {expire: new TuiValidationError(`Expire date`)}\n : null;\n}\n","import {AbstractControl, ValidationErrors} from '@angular/forms';\nimport {tuiIsCardNumberValid} from '@taiga-ui/addon-commerce/utils';\nimport {TuiValidationError} from '@taiga-ui/cdk';\n\nexport function tuiCardNumberValidator({\n value,\n}: AbstractControl): ValidationErrors | null {\n return value?.card && !tuiIsCardNumberValid(value.card)\n ? {card: new TuiValidationError(`Invalid card number`)}\n : null;\n}\n","import {AbstractControl, ValidatorFn} from '@angular/forms';\nimport {tuiIsCardNumberValid} from '@taiga-ui/addon-commerce/utils';\nimport {TuiValidationError} from '@taiga-ui/cdk';\nimport {PolymorpheusContent} from '@tinkoff/ng-polymorpheus';\n\nexport function tuiCreateLuhnValidator(message: PolymorpheusContent): ValidatorFn {\n return ({value}: AbstractControl) => {\n return tuiIsCardNumberValid(value)\n ? null\n : {luhn: new TuiValidationError(message)};\n };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAIgB,SAAA,sBAAsB,CAAC,EACnC,KAAK,GACS,EAAA;;IACd,OAAO,CAAA,CAAA,EAAA,GAAA,KAAK,KAAL,IAAA,IAAA,KAAK,uBAAL,KAAK,CAAE,MAAM,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAE,MAAM,MAAK,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,KAAA,IAAA,IAAL,KAAK,KAAL,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,KAAK,CAAE,MAAM,CAAC;UAC7D,EAAC,MAAM,EAAE,IAAI,kBAAkB,CAAC,CAAa,WAAA,CAAA,CAAC,EAAC;UAC/C,IAAI,CAAC;AACf;;ACNgB,SAAA,sBAAsB,CAAC,EACnC,KAAK,GACS,EAAA;AACd,IAAA,OAAO,CAAA,KAAK,KAAL,IAAA,IAAA,KAAK,uBAAL,KAAK,CAAE,IAAI,KAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,IAAI,CAAC;UACjD,EAAC,IAAI,EAAE,IAAI,kBAAkB,CAAC,CAAqB,mBAAA,CAAA,CAAC,EAAC;UACrD,IAAI,CAAC;AACf;;ACLM,SAAU,sBAAsB,CAAC,OAA4B,EAAA;AAC/D,IAAA,OAAO,CAAC,EAAC,KAAK,EAAkB,KAAI;QAChC,OAAO,oBAAoB,CAAC,KAAK,CAAC;AAC9B,cAAE,IAAI;cACJ,EAAC,IAAI,EAAE,IAAI,kBAAkB,CAAC,OAAO,CAAC,EAAC,CAAC;AAClD,KAAC,CAAC;AACN;;ACXA;;AAEG;;;;"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export * from '@taiga-ui/addon-commerce/components';
|
|
2
2
|
export * from '@taiga-ui/addon-commerce/constants';
|
|
3
3
|
export * from '@taiga-ui/addon-commerce/enums';
|
|
4
|
+
export * from '@taiga-ui/addon-commerce/interfaces';
|
|
4
5
|
export * from '@taiga-ui/addon-commerce/pipes';
|
|
5
6
|
export * from '@taiga-ui/addon-commerce/tokens';
|
|
7
|
+
export * from '@taiga-ui/addon-commerce/types';
|
|
6
8
|
export * from '@taiga-ui/addon-commerce/utils';
|
|
7
9
|
export * from '@taiga-ui/addon-commerce/validators';
|
|
8
10
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-addon-commerce.js","sources":["
|
|
1
|
+
{"version":3,"file":"taiga-ui-addon-commerce.js","sources":["../../../projects/addon-commerce/taiga-ui-addon-commerce.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;AAAA;;AAEG"}
|